diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e272c9f114b0f28f05bab75f2be4d7f89e9d2ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralAngularParameter +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralBoundaryNeighborhood +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralC1HarmonicMembership +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCanonicalParameterL2 +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCanonicalParameterSmooth +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralChainCoreC1 +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralChainCorePower +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralChainRobinC1 +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalContinuousTest +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalObservationLine +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalSlopePairing +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClosedDerivative +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactKernelLift +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactObservedChain +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactPencilDerivative +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCoreBoundaryLinear +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCoupledGreenFull +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCrossFluxLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralDilationBoundaryEstimate +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralDilationDecomposition +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralDirichletGreenData +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEventualSimple +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFixedGaugeAnalytic +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFluxChainGauge +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFluxRobinLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeBasisParameter +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeBoundaryMultiplicity +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeChainCore +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeCollarUniqueness +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeInterfaceRoot +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreePhysicalIdentification +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeRadiusLog +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeClassicalSourceFlux +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeComponentEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeCoreLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeCrossBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeFirstBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeFirstMass +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHolomorphicFixedLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHolomorphicRobinLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralInwardDecay +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralJointNonzero +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralJointUniformLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralKernelCoefficientLine +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLogGaugeCoefficients +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLowerOrderConvergence +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMassConvergence +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchedBases +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchedCaseIIShell +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchedEscapeExclusion +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchedWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchingAnalytic +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchingGluing +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralODESmoothness +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralObservedSourceEquation +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilExclusion +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilFlux +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilFluxSystem +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilJointLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilRobin +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPhysicalGaugeTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPhysicalParameterBounds +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPhysicalSourceBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPowerPressureAway +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralQuotientDecay +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialCoreWeak +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialGaugeEnergyUpper +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialPenalty +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialPoincare +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialRealGauge +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialRealSourceGauge +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRemoteScaleSymbols +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRobinSourcePlane +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarBoundaryNorm +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarOutgoingBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEnergyLinear +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEnergyPair +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailOutgoingSelection +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningCentralTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGreenUniform +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGreenSmallness +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningLogarithmicLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningNegativeTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOutgoingRobin +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningShellDecay +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralUniformWeightBounds +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeakRobinC1 +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightExt +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedGaugeBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedProductLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedSourceBalance + +/-! Outgoing spectral estimates and symmetry-mode classification. -/ diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClassicalFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClassicalFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..911c396219760c7f5509444425a4597abcc461c0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClassicalFlux.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondFluxDerivative + +namespace OAI + +/-! The weak flux equals the flux of the classical radial representative. -/ + +open Set MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +noncomputable def spectralSecondClassicalFlux (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (x : ℝ) : ℂ := + (x : ℂ)^11*((w.density x : ℂ)*deriv (spectralHarmonicRepresentative ell R hR u.snd) x+ + (a.density x : ℂ)*spectralHarmonicRepresentative ell R hR u.fst x) + +theorem spectralSecondDerivativeValue_continuousOn (ell : ℕ) (R l r : ℝ) (hR : 0 < R) + (hl : 0 < l) (hr : r ≤ R) (w a : SpectralHarmonicWeight R) + (u : SpectralHarmonicPair ell R) (P : ℝ → ℂ) + (hw : ContinuousOn w.density (Ioo l r)) (ha : ContinuousOn a.density (Ioo l r)) + (hpos : ∀ x ∈ Ioo l r, 0 < w.density x) (hP : ContinuousOn P (Ioo l r)) : + ContinuousOn (spectralSecondDerivativeValue ell R hR w a u P) (Ioo l r) := by + have hs : Ioo l r ⊆ Ioo 0 R := fun t ht => ⟨hl.trans ht.1,ht.2.trans_le hr⟩ + exact ((hP.div (Complex.continuous_ofReal.continuousOn.pow 11) + (fun t ht => pow_ne_zero _ (by exact_mod_cast (hl.trans ht.1).ne'))).sub + ((Complex.continuous_ofReal.comp_continuousOn ha).mul + ((spectralHarmonicRepresentative_continuousOn ell R hR u.fst).mono hs))).div + (Complex.continuous_ofReal.comp_continuousOn hw) + (fun t ht => by exact_mod_cast (hpos t ht).ne') + +theorem spectralSecondClassicalFlux_eq (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (P : ℝ → ℂ) + (x : ℝ) (hx : x ≠ 0) (hw : w.density x ≠ 0) + (hd : HasDerivAt (spectralHarmonicRepresentative ell R hR u.snd) + (spectralSecondDerivativeValue ell R hR w a u P x) x) : + spectralSecondClassicalFlux ell R hR w a u x=P x := by + unfold spectralSecondClassicalFlux + rw [hd.deriv] + dsimp only [spectralSecondDerivativeValue] + have hx' : (x : ℂ) ≠ 0 := by exact_mod_cast hx + have hw' : (w.density x : ℂ) ≠ 0 := by exact_mod_cast hw + field_simp + ring + +theorem spectralSecond_classical (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (B : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (hpos : ∀ x ∈ Ioo 0 R, 0 < w.density x) + (he : ∀ f : 𝓢(ℝ,ℂ), + spectralHarmonicPairComplexForm ell R w u (spectralSecondTest ell R f)= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ B + (spectralHarmonicObservation ell R hR u)) (spectralSecondTest ell R f)) : + DifferentiableOn ℝ (spectralHarmonicRepresentative ell R hR u.snd) (Ioo 0 R) ∧ + ContinuousOn (deriv (spectralHarmonicRepresentative ell R hR u.snd)) (Ioo 0 R) ∧ + ∀ x ∈ Ioo 0 R, HasDerivAt (spectralSecondClassicalFlux ell R hR w a u) + (spectralSecondContinuousSource ell R hR w u c ζ x) x := by + have hlocal (x : ℝ) (hx : x ∈ Ioo 0 R) : + DifferentiableAt ℝ (spectralHarmonicRepresentative ell R hR u.snd) x ∧ + ContinuousAt (deriv (spectralHarmonicRepresentative ell R hR u.snd)) x ∧ + HasDerivAt (spectralSecondClassicalFlux ell R hR w a u) + (spectralSecondContinuousSource ell R hR w u c ζ x) x := by + let l := x/2 + let r := (x+R)/2 + have hl : 0 < l := by dsimp only [l]; linarith [hx.1] + have hxl : l < x := by dsimp only [l]; linarith [hx.1] + have hxr : x < r := by dsimp only [r]; linarith [hx.2] + have hr : r < R := by dsimp only [r]; linarith [hx.2] + have hs : Ioo l r ⊆ Ioo 0 R := fun t ht => ⟨hl.trans ht.1,ht.2.trans hr⟩ + obtain ⟨P,hP,hflux⟩ := spectralSecondFlux_primitive ell R l r hR hl (hxl.trans hxr) hr + w a u c ζ B hw ha he + have hPc : ContinuousOn P (Ioo l r) := fun t ht => (hP t ht).continuousAt.continuousWithinAt + have hd (t : ℝ) (ht : t ∈ Ioo l r) := spectralSecondFlux_hasDerivAt ell R l r hR + hl hr.le w a u P (hw.mono hs) (ha.mono hs) (fun s hs' => hpos s (hs hs')) hPc hflux t ht + have heq (t : ℝ) (ht : t ∈ Ioo l r) : + spectralSecondClassicalFlux ell R hR w a u t=P t := + spectralSecondClassicalFlux_eq ell R hR w a u P t (hl.trans ht.1).ne' + (hpos t (hs ht)).ne' (hd t ht) + refine ⟨(hd x ⟨hxl,hxr⟩).differentiableAt,?_,?_⟩ + · have hDc := spectralSecondDerivativeValue_continuousOn ell R l r hR hl hr.le + w a u P (hw.mono hs) (ha.mono hs) (fun s hs' => hpos s (hs hs')) hPc + exact (hDc.congr (fun t ht => (hd t ht).deriv)).continuousAt + (Ioo_mem_nhds hxl hxr) + · apply (hP x ⟨hxl,hxr⟩).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds hxl hxr] with t ht + exact heq t ht + exact ⟨fun x hx => (hlocal x hx).1.differentiableWithinAt, + fun x hx => (hlocal x hx).2.1.continuousWithinAt,fun x hx => (hlocal x hx).2.2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClosedBoundary.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClosedBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..62a0d2f62aa2b61554a65fea18185262e4858012 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondClosedBoundary.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalFluxAE +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClosedSource +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCutoffFluxTrace +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEndpointTest +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralBoundaryFlux + +namespace OAI + +/-! The second scalar weak equation gives its exact classical outer flux trace. -/ + +open Set MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralSecond_closedBoundary (ell : ℕ) (R δ : ℝ) (hR : 0 < R) + (hδ : 0 < δ) (hδR : δ < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (B : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (hwc : ContinuousOn w.density (Icc δ R)) + (hpos : ∀ x ∈ Ioo 0 R, 0 < w.density x) + (he : ∀ f : 𝓢(ℝ,ℂ), + spectralHarmonicPairComplexForm ell R w u (spectralSecondTest ell R f)= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ B + (spectralHarmonicObservation ell R hR u)) (spectralSecondTest ell R f)) : + ∃ P : ℝ → ℂ, Continuous P ∧ + (∀ x ∈ Icc δ R, HasDerivAt P (spectralSecondContinuousSource ell R hR w u c ζ x) x) ∧ + EqOn (spectralSecondClassicalFlux ell R hR w a u) P (Ioo δ R) ∧ + (∀ᵐ x, x ∈ Icc δ R → spectralSecondFlux ell R w a u x=P x) ∧ + P R=(B (spectralHarmonicPairTraces ell R hR u)).2 := by + have hs : Ioo δ R ⊆ Ioo 0 R := fun x hx => ⟨hδ.trans hx.1,hx.2⟩ + have hG := spectralSecondContinuousSource_closed ell R δ hR hδ w u c ζ hwc + have hclass := (spectralSecond_classical ell R hR w a u c ζ B hw ha hpos he).2.2 + have hae := spectralSecondClassicalFlux_ae ell R hR w a u c ζ B hw ha hpos he + obtain ⟨P,hP,hd,hEq,hFP⟩ := spectralClosedFlux_ae_primitive δ R hδR + (spectralSecondFlux ell R w a u) (spectralSecondClassicalFlux ell R hR w a u) + (spectralSecondContinuousSource ell R hR w u c ζ) hG + (fun x hx => hclass x (hs hx)) (by + filter_upwards [hae] with x hx hxr + exact hx (hs hxr)) + refine ⟨P,hP,hd,hEq,hFP,?_⟩ + obtain ⟨f,hfR,hf,hdf⟩ := spectralEndpointTest δ R hδR + apply spectralCutoffFlux_trace δ R hδ.le hδR + (spectralSecondFlux ell R w a u) (spectralSecondSource ell R w u c ζ) P + (spectralSecondContinuousSource ell R hR w u c ζ) hP hG hd hFP _ f hfR hf hdf + (B (spectralHarmonicPairTraces ell R hR u)).2 + · simpa only [hfR,star_one,one_mul] using spectralSecond_boundaryFlux ell R hR w a u c ζ B f (he f) + · have hsource := (ae_restrict_iff' measurableSet_Icc).mp (spectralSecondSource_ae ell R hR w u c ζ) + filter_upwards [hsource] with x hx hxr + exact hx ⟨hδ.le.trans hxr.1,hxr.2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondCorePower.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondCorePower.lean new file mode 100644 index 0000000000000000000000000000000000000000..948ea4693abe1dcbbb255506603a2af3c491616b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondCorePower.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondClassicalFlux +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEulerRegularBranch +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialCoreLocality + +namespace OAI + +/-! A limiting weak kernel is a regular harmonic power inside the constrained core. -/ + +open Set MeasureTheory Filter Topology +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralHarmonicCore_representative_zero (ell : ℕ) (R l : ℝ) (hR : 0 < R) + (hlR : l ≤ R) (u : SpectralHarmonicPair ell R) + (hu : u ∈ spectralHarmonicCoreSubspace ell R l) (x : ℝ) (hx : x ∈ Ioc 0 l) : + spectralHarmonicRepresentative ell R hR u.fst x=0 := by + rw [spectralHarmonicCore_mem] at hu + change spectralRadialRepresentative R hR (spectralHarmonicRadialForget ell R u.fst) x=0 + rw [spectralRadialRepresentative,dite_eq_left hx.1] + exact spectralRadialCore_point_zero_of_le R l x hR hx.1 hx.2 hlR _ hu + +theorem spectralSecond_core_power (ell : ℕ) (R l : ℝ) (hR : 0 < R) + (hl : 0 < l) (hlR : l < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (B : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hu : u ∈ spectralHarmonicCoreSubspace ell R l) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (hpos : ∀ x ∈ Ioo 0 R, 0 < w.density x) + (hcore : ∀ x ∈ Ioc 0 l, w.density x=1) + (he : ∀ f : 𝓢(ℝ,ℂ), + spectralHarmonicPairComplexForm ell R w u (spectralSecondTest ell R f)= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ B + (spectralHarmonicObservation ell R hR u)) (spectralSecondTest ell R f)) : + ∃ C : ℂ, (∀ x ∈ Ioc 0 l, spectralHarmonicRepresentative ell R hR u.snd x=C*(x : ℂ)^ell) ∧ + deriv (spectralHarmonicRepresentative ell R hR u.snd) l= + (ell : ℂ)*spectralHarmonicRepresentative ell R hR u.snd l/(l : ℂ) := by + let g := spectralHarmonicRepresentative ell R hR u.snd + let P := spectralSecondClassicalFlux ell R hR w a u + obtain ⟨hg,hgc,hP⟩ := spectralSecond_classical ell R hR w a u c ζ B hw ha hpos he + have hsub : Ioc 0 l ⊆ Ioo 0 R := fun x hx => ⟨hx.1,hx.2.trans_lt hlR⟩ + have hz (x : ℝ) (hx : x ∈ Ioc 0 l) := + spectralHarmonicCore_representative_zero ell R l hR hlR.le u hu x hx + have hflux (x : ℝ) (hx : x ∈ Ioc 0 l) : P x=(x : ℂ)^11*deriv g x := by + dsimp only [P,spectralSecondClassicalFlux,g] + rw [hcore x hx,hz x hx] + simp + have hdg (x : ℝ) (hx : x ∈ Ioo 0 l) : HasDerivAt g (P x/(x : ℂ)^11) x := by + have hd := (hg x (hsub (Ioo_subset_Ioc_self hx))).differentiableAt + (Ioo_mem_nhds hx.1 (hx.2.trans hlR)) + have hxn : (x : ℂ)^11 ≠ 0 := pow_ne_zero _ (by exact_mod_cast hx.1.ne') + rw [hflux x (Ioo_subset_Ioc_self hx),mul_div_cancel_left₀ _ hxn] + exact hd.hasDerivAt + have hdP (x : ℝ) (hx : x ∈ Ioo 0 l) : + HasDerivAt P ((ell : ℂ)*((ell : ℂ)+10)*(x : ℂ)^9*g x) x := by + have hp := hP x (hsub (Ioo_subset_Ioc_self hx)) + simpa only [spectralSecondContinuousSource,hcore x (Ioo_subset_Ioc_self hx), + hz x (Ioo_subset_Ioc_self hx),one_smul,smul_zero,mul_zero,add_zero, + Complex.ofReal_mul,Complex.ofReal_add,Complex.ofReal_natCast,Complex.ofReal_ofNat] using hp + obtain ⟨C,hC⟩ := spectralEuler_regular_branch ell l hl g P hdg hdP + (spectralRadialRepresentative_origin_decay R hR (spectralHarmonicRadialForget ell R u.snd) ell) + have hclosed : Ioc (0 : ℝ) l ⊆ closure (Ioo 0 l) := by + rw [closure_Ioo hl.ne] + exact Ioc_subset_Icc_self + have hCE : EqOn g (fun x : ℝ => C*(x : ℂ)^ell) (Ioo 0 l) := hC + have hCfull : EqOn g (fun x : ℝ => C*(x : ℂ)^ell) (Ioc 0 l) := + hCE.of_subset_closure ((spectralHarmonicRepresentative_continuousOn ell R hR u.snd).mono hsub) + (by fun_prop) Ioo_subset_Ioc_self hclosed + refine ⟨C,hCfull,?_⟩ + have hderiv : EqOn (deriv g) (fun x : ℝ => (ell : ℂ)*g x/(x : ℂ)) (Ioo 0 l) := by + intro x hx + have heq : g =ᶠ[𝓝 x] fun y : ℝ => C*(y : ℂ)^ell := by + filter_upwards [Ioo_mem_nhds hx.1 hx.2] with y hy + exact hC y hy + have hd := ((spectralRadialPower_hasDerivAt ell x hx.1.ne').const_mul C).congr_of_eventuallyEq heq + rw [hd.deriv] + change C*((ell : ℂ)*(x : ℂ)^ell/(x : ℂ))=(ell : ℂ)*g x/(x : ℂ) + rw [hC x hx] + ring + have hfcont : ContinuousOn (fun x : ℝ => (ell : ℂ)*g x/(x : ℂ)) (Ioc 0 l) := + (continuousOn_const.mul ((spectralHarmonicRepresentative_continuousOn ell R hR u.snd).mono hsub)).div + Complex.continuous_ofReal.continuousOn (fun x hx => by exact_mod_cast hx.1.ne') + exact (hderiv.of_subset_closure (hgc.mono hsub) hfcont Ioo_subset_Ioc_self hclosed) ⟨hl,le_rfl⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..34a3a8543860da48cbb0217c9111e92d4666af0b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxDerivative.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondFluxPrimitive +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialLocalDerivative + +namespace OAI + +/-! Recover the classical second derivative coordinate from its continuous weighted flux. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +noncomputable def spectralSecondDerivativeValue (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) + (P : ℝ → ℂ) (x : ℝ) : ℂ := + (P x/(x : ℂ)^11 - (a.density x : ℂ)*spectralHarmonicRepresentative ell R hR u.fst x)/ + (w.density x : ℂ) + +theorem spectralSecondFlux_hasDerivAt (ell : ℕ) (R l r : ℝ) (hR : 0 < R) + (hl : 0 < l) (hr : r ≤ R) (w a : SpectralHarmonicWeight R) + (u : SpectralHarmonicPair ell R) (P : ℝ → ℂ) + (hw : ContinuousOn w.density (Ioo l r)) (ha : ContinuousOn a.density (Ioo l r)) + (hpos : ∀ x ∈ Ioo l r, 0 < w.density x) (hP : ContinuousOn P (Ioo l r)) + (hflux : ∀ᵐ x, x ∈ Ioo l r → spectralSecondFlux ell R w a u x=P x) + (x : ℝ) (hx : x ∈ Ioo l r) : + HasDerivAt (spectralHarmonicRepresentative ell R hR u.snd) + (spectralSecondDerivativeValue ell R hR w a u P x) x := by + have hs : Ioo l r ⊆ Ioo 0 R := fun t ht => ⟨hl.trans ht.1,ht.2.trans_le hr⟩ + have hn (t : ℝ) (ht : t ∈ Ioo l r) : (t : ℂ)^11 ≠ 0 := + pow_ne_zero _ (by exact_mod_cast (hl.trans ht.1).ne') + have hm (t : ℝ) (ht : t ∈ Ioo l r) : (w.density t : ℂ) ≠ 0 := + by exact_mod_cast (hpos t ht).ne' + have hF : ContinuousOn (spectralSecondDerivativeValue ell R hR w a u P) (Ioo l r) := + ((hP.div (Complex.continuous_ofReal.continuousOn.pow 11) hn).sub + ((Complex.continuous_ofReal.comp_continuousOn ha).mul + ((spectralHarmonicRepresentative_continuousOn ell R hR u.fst).mono hs))).div + (Complex.continuous_ofReal.comp_continuousOn hw) hm + have hf := (ae_restrict_iff' measurableSet_Icc).mp + (spectralHarmonicRepresentative_ae ell R hR u.fst) + apply spectralRadialRepresentative_hasDerivAt_local R l r hR hl hr + (spectralHarmonicRadialForget ell R u.snd) _ hF _ x hx + filter_upwards [hflux,hf] with t ht hf htmem + have hft := hf (Ioo_subset_Icc_self (hs htmem)) + change spectralHarmonicDerivative ell R u.snd t = _ + apply (eq_div_iff (hm t htmem)).mpr + have he : (w.density t : ℂ)*spectralHarmonicDerivative ell R u.snd t + + (a.density t : ℂ)*spectralHarmonicRepresentative ell R hR u.fst t = P t/(t : ℂ)^11 := by + apply (eq_div_iff (hn t htmem)).mpr + simpa only [spectralSecondFlux,Complex.real_smul,← hft,mul_comm] using ht htmem + linear_combination he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxPrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..31826143f5e9830a130f38978c065a3a9348f19d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxPrimitive.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondFluxRegularity +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactRadialTest +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLocalFluxPrimitive + +namespace OAI + +/-! The actual second weak equation gives a continuous flux across every interior radius. -/ + +open Set MeasureTheory +open scoped SchwartzMap ContDiff +namespace DefocusingNLS + +theorem spectralSecondFlux_primitive (ell : ℕ) (R l r : ℝ) (hR : 0 < R) + (hl : 0 < l) (hlr : l < r) (hr : r < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (B : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (he : ∀ f : 𝓢(ℝ,ℂ), + spectralHarmonicPairComplexForm ell R w u (spectralSecondTest ell R f)= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ B + (spectralHarmonicObservation ell R hR u)) (spectralSecondTest ell R f)) : + ∃ P : ℝ → ℂ, + (∀ x ∈ Ioo l r, HasDerivAt P (spectralSecondContinuousSource ell R hR w u c ζ x) x) ∧ + ∀ᵐ x, x ∈ Ioo l r → spectralSecondFlux ell R w a u x=P x := by + apply spectralLocalFlux_primitive R l r hl hlr hr + (spectralSecondFlux ell R w a u) (spectralSecondContinuousSource ell R hR w u c ζ) + (spectralSecondFlux_locallyIntegrableOn ell R w a u hw ha) + (spectralSecondContinuousSource_continuousOn ell R hR w u c ζ hw) + intro φ hφ hφc hφs + let f := spectralRealSchwartzTest φ hφ hφc + have hφR : φ R=0 := image_eq_zero_of_notMem_tsupport + (fun h => (lt_irrefl R) (hφs h).2) + have hfR : f R=0 := by simp only [f,spectralRealSchwartzTest_apply,hφR,Complex.ofReal_zero] + have hbal := spectralSecondTest_balance ell R hR w a u c ζ B f hfR (he f) + have ht := spectralSecondBalance_to_flux ell R hR w a u c ζ f hbal + simp only [f,spectralRealSchwartzTest_deriv,spectralRealSchwartzTest_apply, + Complex.star_def,Complex.conj_ofReal,← Complex.real_smul] at ht + rw [spectralCompactTest_integral R (deriv φ) _ (tsupport_deriv_subset.trans hφs), + spectralCompactTest_integral R φ _ hφs] at ht + have hs : (∫ x, φ x • spectralSecondSource ell R w u c ζ x)= + ∫ x, φ x • spectralSecondContinuousSource ell R hR w u c ζ x := by + apply integral_congr_ae + have hae := (ae_restrict_iff' measurableSet_Icc).mp + (spectralSecondSource_ae ell R hR w u c ζ) + filter_upwards [hae] with x hx + by_cases hmem : x ∈ Icc (0 : ℝ) R + · rw [hx hmem] + · have hz : φ x=0 := image_eq_zero_of_notMem_tsupport + (fun h => hmem (Ioo_subset_Icc_self (hφs h))) + simp only [hz,zero_smul] + rwa [hs] at ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxRegularity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..0123b286927c3ad979bc9bd82087882306babc25 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxRegularity.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondFluxTesting +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicRepresentative +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialLocalIntegrable + +namespace OAI + +/-! The weak flux is locally integrable and its source has a continuous representative. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +noncomputable def spectralSecondContinuousSource (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) (r : ℝ) : ℂ := + (((ell : ℝ)*(ell+10) : ℝ) : ℂ)*(r : ℂ)^9* + (w.density r • spectralHarmonicRepresentative ell R hR u.snd r) + + (c-ζ)*(r : ℂ)^11*(w.density r • spectralHarmonicRepresentative ell R hR u.fst r) + +theorem spectralSecondContinuousSource_continuousOn (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) : + ContinuousOn (spectralSecondContinuousSource ell R hR w u c ζ) (Ioo 0 R) := by + have hf := spectralHarmonicRepresentative_continuousOn ell R hR u.fst + have hg := spectralHarmonicRepresentative_continuousOn ell R hR u.snd + exact ((continuousOn_const.mul (Complex.continuous_ofReal.continuousOn.pow 9)).mul + (hw.smul hg)).add + ((continuousOn_const.mul (Complex.continuous_ofReal.continuousOn.pow 11)).mul (hw.smul hf)) + +theorem spectralSecondSource_ae (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) : + spectralSecondSource ell R w u c ζ =ᵐ[volume.restrict (Icc 0 R)] + spectralSecondContinuousSource ell R hR w u c ζ := by + filter_upwards [spectralHarmonicRepresentative_ae ell R hR u.fst, + spectralHarmonicRepresentative_ae ell R hR u.snd] with r hf hg + simp only [spectralSecondSource,spectralSecondContinuousSource,hf,hg] + +theorem spectralSecondFlux_locallyIntegrableOn (ell : ℕ) (R : ℝ) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) : + LocallyIntegrableOn (spectralSecondFlux ell R w a u) (Ioo 0 R) := by + have hd := spectralRadialL2_locallyIntegrableOn R (spectralHarmonicDerivative ell R u.snd) + have hv := spectralRadialL2_locallyIntegrableOn R (spectralHarmonicValue ell R u.fst) + have h1 := hd.continuousOn_smul isOpen_Ioo.isLocallyClosed hw + have h2 := hv.continuousOn_smul isOpen_Ioo.isLocallyClosed ha + exact (h1.add h2).continuousOn_smul isOpen_Ioo.isLocallyClosed + (Complex.continuous_ofReal.continuousOn.pow 11) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxTesting.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxTesting.lean new file mode 100644 index 0000000000000000000000000000000000000000..045ebf3662d1ba37f992a6cc60f99a3f393083f3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondFluxTesting.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSecondBalance +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedTestIntegrable +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMeasureIntegrability + +namespace OAI + +/-! The scalar balance is the ordinary weak derivative equation for the weighted flux. -/ + +open MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +noncomputable def spectralSecondFlux (ell : ℕ) (R : ℝ) (w a : SpectralHarmonicWeight R) + (u : SpectralHarmonicPair ell R) (r : ℝ) : ℂ := + (r : ℂ)^11*(w.density r • spectralHarmonicDerivative ell R u.snd r + + a.density r • spectralHarmonicValue ell R u.fst r) + +noncomputable def spectralSecondSource (ell : ℕ) (R : ℝ) (w : SpectralHarmonicWeight R) + (u : SpectralHarmonicPair ell R) (c ζ : ℂ) (r : ℝ) : ℂ := + (((ell : ℝ)*(ell+10) : ℝ) : ℂ)*(r : ℂ)^9* + (w.density r • spectralHarmonicValue ell R u.snd r) + + (c-ζ)*(r : ℂ)^11*(w.density r • spectralHarmonicValue ell R u.fst r) + +theorem spectralSecondBalance_to_flux (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (f : 𝓢(ℝ,ℂ)) + (hbal : + (∫ r, star (deriv f r)*(w.density r • spectralHarmonicDerivative ell R u.snd r) + ∂radialPressureMeasure R) + + (((ell : ℝ)*(ell+10) : ℝ) : ℂ)* + (∫ r, star (f r)*(w.density r • spectralHarmonicValue ell R u.snd r) + ∂spectralAngularMeasure R) + + (c-ζ)*(∫ r, star (f r)*(w.density r • spectralHarmonicValue ell R u.fst r) + ∂radialPressureMeasure R) + + (∫ r, star (deriv f r)*(a.density r • spectralHarmonicValue ell R u.fst r) + ∂radialPressureMeasure R)=0) : + (∫ r in (0 : ℝ)..R, star (deriv f r)*spectralSecondFlux ell R w a u r)= + -(∫ r in (0 : ℝ)..R, star (f r)*spectralSecondSource ell R w u c ζ r) := by + let J₁ := fun r => star (deriv f r)*(w.density r • spectralHarmonicDerivative ell R u.snd r) + let J₂ := fun r => star (deriv f r)*(a.density r • spectralHarmonicValue ell R u.fst r) + let J₃ := fun r => star (f r)*(w.density r • spectralHarmonicValue ell R u.snd r) + let J₄ := fun r => star (f r)*(w.density r • spectralHarmonicValue ell R u.fst r) + let η : ℂ := (((ell : ℝ)*(ell+10) : ℝ) : ℂ) + have hd (v : SpectralRadialL2 R) (b : SpectralHarmonicWeight R) : + Integrable (fun r => star (deriv f r)*(b.density r • v r)) (radialPressureMeasure R) := + spectralWeightedTest_integrable _ _ b.radial_measurable b.bound b.radial_bound v + (spectralHarmonicDerivative ell R (spectralHarmonicSmoothEmbedding ell R f)) + (deriv f) (spectralHarmonicDerivative_smooth_ae ell R f) + have hv (v : SpectralRadialL2 R) : + Integrable (fun r => star (f r)*(w.density r • v r)) (radialPressureMeasure R) := + spectralWeightedTest_integrable _ _ w.radial_measurable w.bound w.radial_bound v + (spectralHarmonicValue ell R (spectralHarmonicSmoothEmbedding ell R f)) + f (spectralHarmonicValue_smooth_ae ell R f) + have hi₁ : IntervalIntegrable (fun r => (r : ℂ)^11*J₁ r) volume 0 R := + (intervalIntegrable_iff_integrableOn_Icc_of_le hR.le).mpr + (spectralRadial_integrableOn R J₁ (hd _ w)) + have hi₂ : IntervalIntegrable (fun r => (r : ℂ)^11*J₂ r) volume 0 R := + (intervalIntegrable_iff_integrableOn_Icc_of_le hR.le).mpr + (spectralRadial_integrableOn R J₂ (hd _ a)) + have hi₄ : IntervalIntegrable (fun r => (r : ℂ)^11*J₄ r) volume 0 R := + (intervalIntegrable_iff_integrableOn_Icc_of_le hR.le).mpr + (spectralRadial_integrableOn R J₄ (hv _)) + have hi₃ : IntervalIntegrable (fun r => η*((r : ℂ)^9*J₃ r)) volume 0 R := by + have hi := (intervalIntegrable_iff_integrableOn_Icc_of_le hR.le).mpr + (spectralAngular_integrableOn R _ (spectralAngularTest_integrable ell R w u.snd f)) + convert hi using 1 + funext r + dsimp only [η,J₃] + ring + have hflux : (∫ r in (0 : ℝ)..R, star (deriv f r)*spectralSecondFlux ell R w a u r)= + (∫ r in (0 : ℝ)..R, (r : ℂ)^11*J₁ r)+ + ∫ r in (0 : ℝ)..R, (r : ℂ)^11*J₂ r := by + rw [← intervalIntegral.integral_add hi₁ hi₂] + apply intervalIntegral.integral_congr + intro r _ + dsimp only [spectralSecondFlux,J₁,J₂] + ring + have hsource : (∫ r in (0 : ℝ)..R, star (f r)*spectralSecondSource ell R w u c ζ r)= + η*(∫ r in (0 : ℝ)..R, (r : ℂ)^9*J₃ r)+ + (c-ζ)*(∫ r in (0 : ℝ)..R, (r : ℂ)^11*J₄ r) := by + rw [← intervalIntegral.integral_const_mul,← intervalIntegral.integral_const_mul, + ← intervalIntegral.integral_add hi₃ (hi₄.const_mul (c-ζ))] + apply intervalIntegral.integral_congr + intro r _ + dsimp only [spectralSecondSource,J₃,J₄,η] + ring + rw [hflux,hsource] + change (∫ r, J₁ r ∂radialPressureMeasure R)+ + η*(∫ r, J₃ r ∂spectralAngularMeasure R)+ + (c-ζ)*(∫ r, J₄ r ∂radialPressureMeasure R)+ + (∫ r, J₂ r ∂radialPressureMeasure R)=0 at hbal + rw [spectral_radial_complex_integral R hR.le, + spectral_angular_complex_integral R hR.le, + spectral_radial_complex_integral R hR.le, + spectral_radial_complex_integral R hR.le] at hbal + linear_combination hbal + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondTest.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..6408428db7ccf9d2af4c400124df2500cf7d264a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSecondTest.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilComplexEquation +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicScalarPairing +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLowerOrderOperator + +namespace OAI + +/-! The second scalar equation may be tested across the constrained core boundary. -/ + +open MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +noncomputable def spectralSecondTest (ell : ℕ) (R : ℝ) (f : 𝓢(ℝ,ℂ)) : + SpectralHarmonicPair ell R := + (WithLp.prodContinuousLinearEquiv 2 ℂ (SpectralHarmonicEnergy ell R) + (SpectralHarmonicEnergy ell R)).symm (0,spectralHarmonicSmoothEmbedding ell R f) + +theorem spectralSecondTest_core (ell : ℕ) (R l : ℝ) (f : 𝓢(ℝ,ℂ)) : + spectralSecondTest ell R f ∈ spectralHarmonicCoreSubspace ell R l := by + rw [spectralHarmonicCore_mem] + change (fun r => spectralHarmonicValue ell R 0 r)=ᵐ[_] 0 + simp only [map_zero] + exact ae_restrict_of_ae (Lp.coeFn_zero ℂ 2 (radialPressureMeasure R)) + +theorem spectralSecondTest_values (ell : ℕ) (R : ℝ) (f : 𝓢(ℝ,ℂ)) : + spectralHarmonicPairValues ell R (spectralSecondTest ell R f)= + (0,spectralHarmonicValue ell R (spectralHarmonicSmoothEmbedding ell R f)) := by + change (spectralHarmonicValue ell R 0,_)=_ + rw [map_zero] + rfl + +theorem spectralSecondTest_derivatives (ell : ℕ) (R : ℝ) (f : 𝓢(ℝ,ℂ)) : + spectralHarmonicPairDerivatives ell R (spectralSecondTest ell R f)= + (0,spectralHarmonicDerivative ell R (spectralHarmonicSmoothEmbedding ell R f)) := by + change (spectralHarmonicDerivative ell R 0,_)=_ + rw [map_zero] + rfl + +theorem spectralSecondTest_traces (ell : ℕ) (R : ℝ) (hR : 0 < R) (f : 𝓢(ℝ,ℂ)) : + spectralHarmonicPairTraces ell R hR (spectralSecondTest ell R f)=(0,f R) := by + change (spectralRadialTrace R hR 0, + spectralRadialTrace R hR (spectralRadialSmoothEmbedding R f))=_ + rw [map_zero,spectralRadialTrace_smooth] + +theorem spectralSecondTest_equation (ell : ℕ) (R : ℝ) (hR : 0 < R) + (w : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) + (Q A : SpectralRadialL2 R →L[ℂ] SpectralRadialL2 R) (c ζ : ℂ) + (B : ℂ × ℂ →L[ℂ] ℂ × ℂ) (z : SpectralRadialObservationSpace R) + (f : 𝓢(ℝ,ℂ)) + (he : spectralHarmonicPairComplexForm ell R w u (spectralSecondTest ell R f)= + inner ℂ (spectralLowerOrderOperator ell R hR Q A c ζ B z) (spectralSecondTest ell R f)) : + star (spectralHarmonicComplexForm ell R w u.snd (spectralHarmonicSmoothEmbedding ell R f))= + inner ℂ (spectralHarmonicValue ell R (spectralHarmonicSmoothEmbedding ell R f)) (Q z.1.2)- + (c-ζ)*inner ℂ (spectralHarmonicValue ell R (spectralHarmonicSmoothEmbedding ell R f)) (Q z.1.1)- + inner ℂ (spectralHarmonicDerivative ell R (spectralHarmonicSmoothEmbedding ell R f)) (A z.1.1)+ + star (f R)*(B z.2).2 := by + have hs := congrArg star he + rw [spectral_star_inner,spectralLowerOrderOperator_inner] at hs + change star (spectralHarmonicComplexForm ell R w u.fst 0+ + spectralHarmonicComplexForm ell R w u.snd (spectralHarmonicSmoothEmbedding ell R f))=_ at hs + have hz : spectralHarmonicComplexForm ell R w u.fst 0=0 := by + simp only [spectralHarmonicComplexForm,map_zero,inner_zero_right,add_zero] + rw [hz,zero_add] at hs + unfold spectralWeakPairing at hs + rw [spectralSecondTest_values,spectralSecondTest_derivatives,spectralSecondTest_traces] at hs + simpa only [inner_zero_left,zero_add,zero_sub,add_zero,RCLike.inner_apply', + sub_eq_add_neg,mul_neg,neg_mul,zero_mul,star_zero,starRingEnd_apply] using hs + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellAbsorption.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellAbsorption.lean new file mode 100644 index 0000000000000000000000000000000000000000..bff0ede0a6a0d6c46d3753dcc0d00d69dd6e3ebc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellAbsorption.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCouplingEstimate +import Mathlib.Topology.Order.Compact +import Mathlib.Topology.Order.Lattice + +namespace OAI + +/-! A compact-shell maximum makes the small Green and Robin corrections absorbable. +No a priori bound on the size of a particular solution is required. -/ + +open Set +namespace DefocusingNLS + +theorem spectralShellPairNorm_add_le (kp km : ℝ) (hp : 0≤ kp) (hm : 0≤ km) + (u v : (ℂ × ℂ) × (ℂ × ℂ)) : + spectralShellPairNorm kp km (u+v)≤ spectralShellPairNorm kp km u+spectralShellPairNorm kp km v := by + apply max_le + · exact (spectralShellNorm_add_le kp hp u.1 v.1).trans + (add_le_add (le_max_left _ _) (le_max_left _ _)) + · exact (spectralShellNorm_add_le km hm u.2 v.2).trans + (add_le_add (le_max_right _ _) (le_max_right _ _)) + +theorem spectralShellPairNorm_continuousOn (R E : ℝ) (kp km : ℝ → ℝ) + (u : ℝ → (ℂ × ℂ) × (ℂ × ℂ)) + (hkp : ContinuousOn kp (Icc R E)) (hkm : ContinuousOn km (Icc R E)) + (hp : ∀ r ∈ Icc R E, kp r≠0) (hm : ∀ r ∈ Icc R E, km r≠0) + (hu : ContinuousOn u (Icc R E)) : + ContinuousOn (fun r => spectralShellPairNorm (kp r) (km r) (u r)) (Icc R E) := by + exact ((hkp.mul hu.fst.fst.norm).add ((hkp.inv₀ hp).mul hu.fst.snd.norm)).sup + ((hkm.mul hu.snd.fst.norm).add ((hkm.inv₀ hm).mul hu.snd.snd.norm)) + +theorem spectralShellPairNorm_exists_max (R E : ℝ) (hRE : R≤ E) + (kp km : ℝ → ℝ) (u : ℝ → (ℂ × ℂ) × (ℂ × ℂ)) + (hkp : ContinuousOn kp (Icc R E)) (hkm : ContinuousOn km (Icc R E)) + (hp : ∀ r ∈ Icc R E, 0 (hp r hr).ne') (fun r hr => (hm r hr).ne') hu) + exact ⟨_,spectralShellPairNorm_nonneg _ _ (hp r hr).le _,hmax,r,hr,rfl⟩ + +theorem spectralShellPairNorm_absorb (R E B theta : ℝ) (hRE : R≤ E) + (htheta : 0≤ theta) (htheta1 : theta≤ 1/2) + (kp km : ℝ → ℝ) (u v : ℝ → (ℂ × ℂ) × (ℂ × ℂ)) + (hkp : ContinuousOn kp (Icc R E)) (hkm : ContinuousOn km (Icc R E)) + (hp : ∀ r ∈ Icc R E, 0 spectralShellPlusForcing m (Q r) r (u r)) (Icc R E) ∧ + ContinuousOn (fun r => spectralShellMinusForcing m (Q r) r (u r)) (Icc R E) := by + have hfac (h : ℝ) : ContinuousOn (homogeneousSpectralLocalizationFactor h) (Icc R E) := by + intro r hr + exact (homogeneousSpectralLocalizationFactor_hasDerivAt h r + (hR.trans_le hr.1)).continuousAt.continuousWithinAt + have hne (h r : ℝ) : homogeneousSpectralLocalizationFactor h r≠0 := Complex.exp_ne_zero _ + have hp := (hfac 1).div (hfac (-1)) (fun r _ => hne (-1) r) + have hm := (hfac (-1)).div (hfac 1) (fun r _ => hne 1 r) + have hD : ContinuousOn (fun r => spectralDiagonalCoefficient m (Q r)) (Icc R E) := by + dsimp only [spectralDiagonalCoefficient] + fun_prop + have hC : ContinuousOn (fun r => spectralCrossCoefficient m (Q r)) (Icc R E) := by + dsimp only [spectralCrossCoefficient] + fun_prop + constructor + · exact (hD.mul hu.fst.fst).add ((hC.mul hp).mul hu.snd.fst) + · exact (hD.star.mul hu.snd.fst).add ((hC.star.mul hm).mul hu.fst.fst) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGoodPoint.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGoodPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..0792b9797a3acea334e86c1e43a22852ddb26827 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGoodPoint.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRobinNormBounds +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic +import Mathlib.Topology.Order.Compact + +namespace OAI + +/-! Select bounded Cauchy data in the first half of the shell from its +integrated energy and the coercive local Robin relation. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectral_interval_energy_point (a b K : ℝ) (hab : a < b) + (e : ℝ → ℝ) (he : ContinuousOn e (Icc a b)) (hbound : (∫ r in a..b, e r) ≤ K) : + ∃ r ∈ Icc a b, e r ≤ K/(b-a) := by + obtain ⟨r,hr,hmin⟩ := isCompact_Icc.exists_isMinOn (nonempty_Icc.mpr hab.le) he + refine ⟨r,hr,?_⟩ + have hi := intervalIntegral.integral_mono_on (μ := volume) hab.le + (intervalIntegrable_const (c := e r)) (he.intervalIntegrable_of_Icc hab.le) (fun x hx => hmin hx) + rw [intervalIntegral.integral_const] at hi + simp only [smul_eq_mul] at hi + exact (le_div_iff₀ (sub_pos.mpr hab)).mpr (by nlinarith) + +theorem spectral_shell_good_point (a b K mu : ℝ) (hab : a < b) (hmu : 0 ≤ mu) + (q : ℝ → (ℂ × ℂ) × (ℂ × ℂ)) (hq : ContinuousOn q (Icc a b)) + (hrobin : ∀ r ∈ Icc a b, + mu*(‖(q r).1.1‖+‖(q r).2.1‖) ≤ 2*(‖(q r).1.2‖+‖(q r).2.2‖)) + (hbound : (∫ r in a..b, ‖(q r).1.2‖^2+‖(q r).2.2‖^2) ≤ K) : + ∃ r ∈ Icc a b, ‖(q r).1.2‖^2+‖(q r).2.2‖^2 ≤ K/(b-a) ∧ + mu^2*(‖(q r).1.1‖^2+‖(q r).2.1‖^2) ≤ 8*(K/(b-a)) := by + obtain ⟨r,hr,hb⟩ := spectral_interval_energy_point a b K hab + (fun r => ‖(q r).1.2‖^2+‖(q r).2.2‖^2) + ((hq.fst.snd.norm.pow 2).add (hq.snd.snd.norm.pow 2)) hbound + refine ⟨r,hr,hb,?_⟩ + have hc := hrobin r hr + have hs := pow_le_pow_left₀ (mul_nonneg hmu (by positivity)) hc 2 + have hcross := sq_nonneg (‖(q r).1.2‖-‖(q r).2.2‖) + have hp : 0 ≤ mu^2*‖(q r).1.1‖*‖(q r).2.1‖ := by positivity + nlinarith only [hs,hcross,hp,hb] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGreenBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGreenBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..c814af51d5808943f83569581a53a486ff98d6dc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellGreenBounds.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralShellNorm +import Mathlib.Analysis.SpecialFunctions.ExpDeriv + +namespace OAI + +/-! The two action factors in the scalar Green kernel stay in their own channel. +No comparison between the actions of distinct channels is needed. -/ + +namespace DefocusingNLS + +private theorem action_ratio (C c k H A B : ℝ) + (hc : c≠0) (hk : k≠0) : + (C*Real.exp A/k)/(c*Real.exp H)*(C*Real.exp (H-B))= + C^2/(c*k)*Real.exp (A-B) := by + have he : Real.exp A*Real.exp (H-B)=Real.exp H*Real.exp (A-B) := by + rw [← Real.exp_add,← Real.exp_add] + congr 1 + ring + field_simp + linear_combination C^2*he + +theorem spectralShellNorm_green_factor (kr kt C c HR Hr Ht : ℝ) + (hkr : 0≤ kr) (hkt : 0 spectralShellNorm k (F t)) (Icc a b) := + (continuousOn_const.mul hF.fst.norm).add (continuousOn_const.mul hF.snd.norm) + exact intervalIntegral.integral_mono_on hab + (ContinuousOn.intervalIntegrable_of_Icc (μ := volume) hab hN) + (ContinuousOn.intervalIntegrable_of_Icc (μ := volume) hab hB) hbound + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellInwardLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellInwardLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4fcef9c8c751f1651818ccbcc8a89fe14a325de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellInwardLimit.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCoupledInwardLimit + +namespace OAI + +/-! A uniformly small local Robin error and bounded oscillatory channel +force the rescaled inward channel to vanish at the far end of a shell. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralShell_inward_limit + (omega : ℕ → ℝ) (R B D A M : ℝ) (hRB : R < B) + (hD : 0 ≤ D) (_hA : 0 ≤ A) (hM : 0 ≤ M) + (hw : Tendsto omega atTop atTop) + (q dq w : ℕ → ℝ → ℂ) + (hc : ∀ n, ContinuousOn (q n) (Icc R B)) + (hd : ∀ n r, r ∈ Ioo R B → HasDerivAt (q n) (dq n r) r) + (hg : ∀ᶠ n in atTop, ∃ a ∈ Icc R ((R+B)/2), + omega n*‖q n a‖^2 ≤ M ∧ ∀ r ∈ Icc a B, omega n*‖w n r‖^2 ≤ M) + (hs : ∀ delta : ℝ, 0 < delta → ∀ᶠ n in atTop, ∀ r ∈ Icc R B, + ∃ alpha : ℂ, alpha.re ≤ -Real.sqrt (omega n)/48 ∧ + ‖alpha‖ ≤ A*Real.sqrt (omega n) ∧ + ‖dq n r-alpha*q n r‖ ≤ delta*D*Real.sqrt (omega n)*(‖q n r‖+‖w n r‖)) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun n => (Real.sqrt (omega (φ n)) : ℂ)*q (φ n) B) atTop (𝓝 0) ∧ + Tendsto (fun n => dq (φ n) B) atTop (𝓝 0) := by + classical + let delta := fun n : ℕ => 1/((n : ℝ)+1) + have hdelta : ∀ n, 0 < delta n := by intro n; dsimp only [delta]; positivity + have hdelta0 : Tendsto delta atTop (𝓝 0) := by + simpa only [delta] using tendsto_one_div_add_atTop_nhds_zero_nat + obtain ⟨φ,hφ,hall⟩ := extraction_forall_of_eventually (fun n => + (hw.eventually (eventually_gt_atTop 0)).and (hg.and (hs (delta n) (hdelta n)))) + choose a ha hqa hwa using fun n => (hall n).2.1 + let nu := fun n => Real.sqrt (omega (φ n)) + have hnu : ∀ n, 0 < nu n := fun n => Real.sqrt_pos.mpr (hall n).1 + have hnu2 : ∀ n, (nu n)^2 = omega (φ n) := fun n => Real.sq_sqrt (hall n).1.le + have hnulim : Tendsto nu atTop atTop := Real.tendsto_sqrt_atTop.comp (hw.comp hφ.tendsto_atTop) + have hals : ∀ n r, r ∈ Icc R B → ∃ alpha : ℂ, + alpha.re ≤ -nu n/48 ∧ ‖alpha‖ ≤ A*nu n ∧ + ‖dq (φ n) r-alpha*q (φ n) r‖ ≤ delta n*D*nu n*(‖q (φ n) r‖+‖w (φ n) r‖) := + fun n => (hall n).2.2 + let alpha := fun n r => if hr : r ∈ Icc R B then (hals n r hr).choose else 0 + have halpha n r (hr : r ∈ Icc R B) : + (alpha n r).re ≤ -nu n/48 ∧ ‖alpha n r‖ ≤ A*nu n ∧ + ‖dq (φ n) r-alpha n r*q (φ n) r‖ ≤ delta n*D*nu n*(‖q (φ n) r‖+‖w (φ n) r‖) := by + simpa only [alpha,dite_eq_left hr] using (hals n r hr).choose_spec + let Q := fun n r => (nu n : ℂ)*q (φ n) r + let dQ := fun n r => (nu n : ℂ)*dq (φ n) r + let W := fun n r => (nu n : ℂ)*w (φ n) r + have hQnorm n r : ‖Q n r‖ = nu n*‖q (φ n) r‖ := by + simp only [Q,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (hnu n)] + have hWnorm n r : ‖W n r‖ = nu n*‖w (φ n) r‖ := by + simp only [W,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (hnu n)] + have hinit n : ‖Q n (a n)‖ ≤ Real.sqrt M := by + apply (Real.le_sqrt (norm_nonneg _) hM).mpr + rw [hQnorm,mul_pow,hnu2] + exact hqa n + have hbound n r (hr : r ∈ Icc (a n) B) : ‖W n r‖ ≤ Real.sqrt M := by + apply (Real.le_sqrt (norm_nonneg _) hM).mpr + rw [hWnorm,mul_pow,hnu2] + exact hwa n r hr + have hscaled n r (hr : r ∈ Icc R B) : + ‖dQ n r-alpha n r*Q n r‖ ≤ (48*D*delta n)*(nu n/48)*(‖Q n r‖+‖W n r‖) := by + have heq : dQ n r-alpha n r*Q n r = + (nu n : ℂ)*(dq (φ n) r-alpha n r*q (φ n) r) := by dsimp only [dQ,Q]; ring + rw [heq,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (hnu n)] + calc + _ ≤ nu n*(delta n*D*nu n*(‖q (φ n) r‖+‖w (φ n) r‖)) := + mul_le_mul_of_nonneg_left (halpha n r hr).2.2 (hnu n).le + _ = _ := by rw [hQnorm,hWnorm]; ring + have hlimit : Tendsto (fun n => Q n B) atTop (𝓝 0) := by + apply spectralComplex_coupled_inward_limit a (fun n => nu n/48) (fun n => 48*D*delta n) + B ((B-R)/2) (Real.sqrt M) (by linarith) (Real.sqrt_nonneg _) + (hnulim.atTop_div_const (by norm_num)) (by simpa using hdelta0.const_mul (48*D)) Q dQ W alpha + apply Eventually.of_forall + intro n + refine ⟨by linarith [(ha n).2],by positivity,?_,hinit n,?_,?_,?_,?_⟩ + · exact continuousOn_const.mul ((hc (φ n)).mono (by intro r hr; exact ⟨(ha n).1.trans hr.1,hr.2⟩)) + · intro r hr + exact (hd (φ n) r ⟨lt_of_le_of_lt (ha n).1 hr.1,hr.2⟩).const_mul _ + · intro r hr + simpa only [neg_div] using (halpha n r ⟨(ha n).1.trans hr.1.le,hr.2.le⟩).1 + · intro r hr + exact hscaled n r ⟨(ha n).1.trans hr.1.le,hr.2.le⟩ + · intro r hr + exact hbound n r ⟨hr.1.le,hr.2.le⟩ + refine ⟨φ,hφ,hlimit,?_⟩ + have hBn : B ∈ Icc R B := ⟨hRB.le,le_rfl⟩ + have hBbound n : ‖W n B‖ ≤ Real.sqrt M := hbound n B ⟨by linarith [(ha n).2],le_rfl⟩ + have hnormlim := tendsto_zero_iff_norm_tendsto_zero.mp hlimit + have hrhs : Tendsto (fun n => A*‖Q n B‖+delta n*D*(‖Q n B‖+Real.sqrt M)) atTop (𝓝 0) := by + convert (hnormlim.const_mul A).add ((hdelta0.mul_const D).mul (hnormlim.add_const (Real.sqrt M))) using 1 + simp + apply tendsto_zero_iff_norm_tendsto_zero.mpr + apply squeeze_zero' (Eventually.of_forall (fun n => norm_nonneg _)) _ hrhs + apply Eventually.of_forall + intro n + calc + ‖dq (φ n) B‖ ≤ ‖alpha n B*q (φ n) B‖+‖dq (φ n) B-alpha n B*q (φ n) B‖ := norm_le_insert' _ _ + _ ≤ (A*nu n)*‖q (φ n) B‖+delta n*D*nu n*(‖q (φ n) B‖+‖w (φ n) B‖) := + add_le_add (by rw [norm_mul]; exact mul_le_mul_of_nonneg_right (halpha n B hBn).2.1 (norm_nonneg _)) + (halpha n B hBn).2.2 + _ = A*‖Q n B‖+delta n*D*(‖Q n B‖+‖W n B‖) := by rw [hQnorm,hWnorm]; ring + _ ≤ _ := by gcongr; exact hBbound n + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellMatchedCoupling.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellMatchedCoupling.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc56bba8f696ba2769c980b8d16fb96ce9bf5872 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralShellMatchedCoupling.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCouplingEstimate +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousSpectralLocalizationPotential + +namespace OAI + +/-! The small coefficient in the shell Green argument is supplied by the +actual matched profile, uniformly in both spectral and angular parameters. -/ + +open Set Filter +namespace DefocusingNLS +open ProfileCertificate + +noncomputable def spectralShellPlusForcing (m : ℕ) (Q : ℂ) (r : ℝ) + (u : (ℂ × ℂ) × (ℂ × ℂ)) : ℂ := + spectralDiagonalCoefficient m Q*u.1.1+ + spectralCrossCoefficient m Q*(homogeneousSpectralLocalizationFactor 1 r/ + homogeneousSpectralLocalizationFactor (-1) r)*u.2.1 + +noncomputable def spectralShellMinusForcing (m : ℕ) (Q : ℂ) (r : ℝ) + (u : (ℂ × ℂ) × (ℂ × ℂ)) : ℂ := + star (spectralDiagonalCoefficient m Q)*u.2.1+ + star (spectralCrossCoefficient m Q)*(homogeneousSpectralLocalizationFactor (-1) r/ + homogeneousSpectralLocalizationFactor 1 r)*u.1.1 + +theorem spectralShellForcing_bound (m : ℕ) (Q : ℂ) (r kp km k C : ℝ) + (hr : 0 v n - K (v n)) atTop (𝓝 0)) : + ∃ v₀ : E, ‖v₀‖ = 1 ∧ K v₀ = v₀ ∧ + ∃ φ : ℕ → ℕ, StrictMono φ ∧ Tendsto (fun n => v (φ n)) atTop (𝓝 v₀) := by + have hb (n : ℕ) : v n ∈ Metric.closedBall (0 : E) 1 := by + simpa only [Metric.mem_closedBall, dist_zero_right, hv n] using (le_refl (1 : ℝ)) + have hcomp := hK.isCompact_closure_image_closedBall 1 + obtain ⟨v₀, _, φ, hφ, ht⟩ := hcomp.tendsto_subseq + (fun n => subset_closure (mem_image_of_mem K (hb n))) + have ht' : Tendsto (fun n => v (φ n)) atTop (𝓝 v₀) := by + have hs := (he.comp hφ.tendsto_atTop).add ht + simpa only [Function.comp_def, sub_add_cancel, zero_add] using hs + have hn : ‖v₀‖ = 1 := by + apply tendsto_nhds_unique ht'.norm + simpa only [hv] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)) + have hfix : K v₀ = v₀ := + tendsto_nhds_unique (K.continuous.continuousAt.tendsto.comp ht') ht + exact ⟨v₀, hn, hfix, φ, hφ, ht'⟩ + +theorem compact_simple_kernel_estimate {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℂ E] + (K : E →L[ℂ] E) (hK : IsCompactOperator K) (v : E) + (L : E →L[ℂ] ℂ) (hLv : L v ≠ 0) + (hker : ∀ u : E, K u = u → ∃ a : ℂ, u = a • v) : + ∃ c : ℝ, 0 < c ∧ ∀ u : E, L u = 0 → c * ‖u‖ ≤ ‖u - K u‖ := by + by_contra hfail + push Not at hfail + let ε : ℕ → ℝ := fun n => 1 / ((n : ℝ) + 1) + have hε (n : ℕ) : 0 < ε n := by dsimp [ε]; positivity + choose u hu using fun n => hfail (ε n) (hε n) + have hu0 (n : ℕ) : u n ≠ 0 := by + intro h + have hh := (hu n).2 + simp [h] at hh + have hun (n : ℕ) : ‖u n‖ ≠ 0 := norm_ne_zero_iff.mpr (hu0 n) + let w := fun n => ((‖u n‖ : ℂ)⁻¹) • u n + have hw (n : ℕ) : ‖w n‖ = 1 := by + dsimp [w] + rw [norm_smul, norm_inv, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (norm_nonneg _), inv_mul_cancel₀ (hun n)] + have hLw (n : ℕ) : L (w n) = 0 := by + dsimp only [w] + rw [map_smul, (hu n).1, smul_zero] + have hres (n : ℕ) : ‖w n - K (w n)‖ ≤ ε n := by + have hn : 0 < ‖u n‖ := norm_pos_iff.mpr (hu0 n) + have hid : w n - K (w n) = ((‖u n‖ : ℂ)⁻¹) • (u n - K (u n)) := by + simp only [w, map_smul, smul_sub] + rw [hid, norm_smul, norm_inv, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hn.le] + calc + ‖u n‖⁻¹ * ‖u n - K (u n)‖ ≤ ‖u n‖⁻¹ * (ε n * ‖u n‖) := + mul_le_mul_of_nonneg_left (hu n).2.le (inv_nonneg.mpr hn.le) + _ = ε n := by field_simp + have hεlim : Tendsto ε atTop (𝓝 0) := by + have ht : Tendsto (fun n : ℕ => (n : ℝ) + 1) atTop atTop := + tendsto_atTop_mono (fun n : ℕ => by simp only [le_add_iff_nonneg_right]; norm_num) + tendsto_natCast_atTop_atTop + simpa only [ε, one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp ht + obtain ⟨v₀, hv₀, hfix, φ, _hφ, ht⟩ := compact_approximate_kernel_limit K hK w hw + (squeeze_zero_norm hres hεlim) + have hL₀ : L v₀ = 0 := by + apply tendsto_nhds_unique (L.continuous.continuousAt.tendsto.comp ht) + change Tendsto (fun n => L (w (φ n))) atTop (𝓝 (0 : ℂ)) + simpa only [hLw] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℂ)) atTop (𝓝 0)) + obtain ⟨a, ha⟩ := hker v₀ hfix + have ha0 : a = 0 := by + rw [ha, map_smul, smul_eq_mul] at hL₀ + exact (mul_eq_zero.mp hL₀).resolve_right hLv + rw [ha, ha0, zero_smul, norm_zero] at hv₀ + norm_num at hv₀ + +theorem kernel_complement_perturbation_estimate {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℂ E] + (K₀ K : E →L[ℂ] E) (L : E →L[ℂ] ℂ) (c : ℝ) + (hbase : ∀ u : E, L u = 0 → c * ‖u‖ ≤ ‖u - K₀ u‖) + (hK : ‖K - K₀‖ ≤ c / 2) (u : E) (hu : L u = 0) : + c / 2 * ‖u‖ ≤ ‖u - K u‖ := by + have hb := hbase u hu + have hop := (K - K₀).le_opNorm u + have he : u - K₀ u = (u - K u) + (K - K₀) u := by + simp only [sub_apply] + abel + have ht := norm_add_le (u - K u) ((K - K₀) u) + rw [← he] at ht + have hm := mul_le_mul_of_nonneg_right hK (norm_nonneg u) + linarith + +theorem kernel_unique_with_normalization {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℂ E] + (K : E →L[ℂ] E) (L : E →L[ℂ] ℂ) (c : ℝ) (hc : 0 < c) + (hbound : ∀ u : E, L u = 0 → c * ‖u‖ ≤ ‖u - K u‖) + (u v : E) (hu : K u = u) (hv : K v = v) (hL : L u = L v) : u = v := by + have hzero : L (u - v) = 0 := by rw [map_sub, hL, sub_self] + have hh := hbound (u - v) hzero + rw [map_sub, hu, hv, sub_self, norm_zero] at hh + have hn : ‖u - v‖ = 0 := le_antisymm (by nlinarith) (norm_nonneg _) + exact sub_eq_zero.mp (norm_eq_zero.mp hn) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoJordan.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoJordan.lean new file mode 100644 index 0000000000000000000000000000000000000000..041fa54e23643050378b6aee100ab95f732e2daf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoJordan.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSimpleLimitNoSplitting +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactJordanLimit + +namespace OAI + +/-! First analytic chains cannot persist near a simple limiting root. -/ + +open Set Filter Topology +namespace DefocusingNLS +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +theorem spectral_simple_limit_no_jordan + (F : ℕ → ℂ → E →L[ℂ] E) (f : ℂ → E →L[ℂ] E) + (U : Set ℂ) (hU : IsOpen U) + (hF : TendstoLocallyUniformlyOn F f atTop U) + (hd : ∀ᶠ n in atTop, DifferentiableOn ℂ (F n) U) + (z : ℂ) (hz : z ∈ U) (hcompact : IsCompactOperator (f z)) + (x : ℕ → ℂ) (hx : Tendsto x atTop (𝓝 z)) (u v : ℕ → E) + (hu : ∀ᶠ n in atTop, F n (x n) (u n)=u n ∧ u n ≠ 0) + (hv : ∀ᶠ n in atTop, v n-F n (x n) (v n)=deriv (F n) (x n) (u n)) + (hker : ∀ u₀ : E, u₀ ≠ 0 → f z u₀=u₀ → + ∀ w : E, f z w=w → ∃ a : ℂ, w=a • u₀) + (hno : ∀ u₀ : E, u₀ ≠ 0 → f z u₀=u₀ → + ∀ w : E, w-f z w ≠ deriv f z u₀) : False := by + have hdf := hF.differentiableOn hd hU + have hj := spectral_locallyUniform_joint_tendsto F f U hU hF z hz + (hdf.differentiableAt (hU.mem_nhds hz)).continuousAt + have hK := hj.comp (tendsto_id.prodMk hx) + have hdj := spectral_locallyUniform_joint_tendsto (fun n => deriv (F n)) (deriv f) + U hU (hF.deriv hd hU) z hz ((hdf.deriv hU).continuousOn.continuousAt (hU.mem_nhds hz)) + have hD := hdj.comp (tendsto_id.prodMk hx) + obtain ⟨u₀,hnorm,hfix⟩ := compact_kernel_limit_of_eventually_nonzero + (fun n => F n (x n)) (f z) hK hcompact u hu + have hu₀ : u₀ ≠ 0 := by + intro he + rw [he,norm_zero] at hnorm + norm_num at hnorm + obtain ⟨L,_hLnorm,hLu⟩ := exists_dual_vector ℂ u₀ (by rw [hnorm]; norm_num) + have hL₀ : L u₀=1 := by simpa [hnorm] using hLu + obtain ⟨c,hc,hbase⟩ := compact_simple_kernel_estimate (f z) hcompact u₀ L + (by rw [hL₀]; norm_num) (hker u₀ hu₀ hfix) + have heK : ∀ᶠ n in atTop, ‖F n (x n)-f z‖ ≤ c/2 := + ((tendsto_iff_norm_sub_tendsto_zero.mp hK).eventually + (gt_mem_nhds (half_pos hc))).mono (fun _ h => h.le) + obtain ⟨N,hN⟩ := eventually_atTop.mp (heK.and (hu.and hv)) + let k := fun n => n+N + have hk : Tendsto k atTop atTop := tendsto_add_atTop_nat N + have hg (n : ℕ) := hN (n+N) (Nat.le_add_left N n) + have hLn (n : ℕ) : L (u (k n)) ≠ 0 := + spectral_kernel_functional_ne_zero (f z) _ L c hc hbase (hg n).1 _ + (hg n).2.1.1 (hg n).2.1.2 + let a := fun n => (L (u (k n)))⁻¹ • u (k n) + let b := fun n => (L (u (k n)))⁻¹ • v (k n) + have ha (n : ℕ) : F (k n) (x (k n)) (a n)=a n ∧ L (a n)=1 := + spectral_normalize_kernel _ L _ (hg n).2.1.1 (hLn n) + have halim : Tendsto a atTop (𝓝 u₀) := + spectral_normalized_kernel_tendsto (fun n => F (k n) (x (k n))) (f z) + (hK.comp hk) L c hc hbase (fun n => (hg n).1) u₀ a hfix + (fun n => (ha n).1) (fun n => (ha n).2.trans hL₀.symm) + have hb (n : ℕ) : b n-F (k n) (x (k n)) (b n)=deriv (F (k n)) (x (k n)) (a n) := by + dsimp only [a,b] + rw [map_smul,map_smul,← smul_sub,(hg n).2.2] + exact compact_pencil_no_jordan_sequence (fun n => F (k n) (x (k n))) + (fun n => deriv (F (k n)) (x (k n))) (f z) (deriv f z) + (hK.comp hk) hcompact (hD.comp hk) L c hc hbase (fun n => (hg n).1) + a b u₀ halim (fun n => (ha n).1) (fun n => (ha n).2) hb (hno u₀ hu₀ hfix) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoSplitting.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..49978034d602a1ab07b0401d2b02bbe2977f3f74 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSimpleLimitNoSplitting.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEventualNoSplitting +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNonzeroKernelLimit +import Mathlib.Analysis.Normed.Module.HahnBanach + +namespace OAI + +/-! A one-dimensional limiting kernel with no first chain prevents distinct nearby roots. -/ + +open Set Filter Topology +namespace DefocusingNLS +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +theorem spectral_simple_limit_no_splitting + (F : ℕ → ℂ → E →L[ℂ] E) (f : ℂ → E →L[ℂ] E) + (U : Set ℂ) (hU : IsOpen U) + (hF : TendstoLocallyUniformlyOn F f atTop U) + (hd : ∀ᶠ n in atTop, DifferentiableOn ℂ (F n) U) + (z : ℂ) (hz : z ∈ U) (hcompact : IsCompactOperator (f z)) + (x y : ℕ → ℂ) (hx : Tendsto x atTop (𝓝 z)) (hy : Tendsto y atTop (𝓝 z)) + (hne : ∀ᶠ n in atTop, x n ≠ y n) + (u v : ℕ → E) + (hu : ∀ᶠ n in atTop, F n (x n) (u n)=u n ∧ u n ≠ 0) + (hv : ∀ᶠ n in atTop, F n (y n) (v n)=v n ∧ v n ≠ 0) + (hker : ∀ u₀ : E, u₀ ≠ 0 → f z u₀=u₀ → + ∀ w : E, f z w=w → ∃ a : ℂ, w=a • u₀) + (hno : ∀ u₀ : E, u₀ ≠ 0 → f z u₀=u₀ → + ∀ w : E, w-f z w ≠ deriv f z u₀) : False := by + have hdf := hF.differentiableOn hd hU + have hj := spectral_locallyUniform_joint_tendsto F f U hU hF z hz + (hdf.differentiableAt (hU.mem_nhds hz)).continuousAt + obtain ⟨u₀,hnorm,hfix⟩ := compact_kernel_limit_of_eventually_nonzero + (fun n => F n (x n)) (f z) (hj.comp (tendsto_id.prodMk hx)) hcompact u hu + have hu₀ : u₀ ≠ 0 := by + intro he + rw [he,norm_zero] at hnorm + norm_num at hnorm + obtain ⟨L,_hLnorm,hLu⟩ := exists_dual_vector ℂ u₀ (by rw [hnorm]; norm_num) + have hL₀ : L u₀=1 := by simpa [hnorm] using hLu + obtain ⟨c,hc,hbase⟩ := compact_simple_kernel_estimate (f z) hcompact u₀ L + (by rw [hL₀]; norm_num) (hker u₀ hu₀ hfix) + exact spectral_eventual_no_splitting F f U hU hF hd z hz hcompact x y hx hy hne + L c hc hbase u₀ hfix hL₀ u v hu hv (hno u₀ hu₀ hfix) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothCutoff.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..967adac6a16295d7ace78988fbd80c7c867fed59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothCutoff.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicJetMultiplier +import Mathlib.Analysis.Complex.RealDeriv + +namespace OAI + +/-! Smooth cutoffs on Schwartz functions and their exact L² product identities. -/ + +open MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +noncomputable def spectralSmoothCutoff (q : ℝ → ℝ) : 𝓢(ℝ,ℂ) →L[ℂ] 𝓢(ℝ,ℂ) := + SchwartzMap.smulLeftCLM ℂ (fun r => (q r : ℂ)) + +theorem spectralSmoothCutoff_apply (q : ℝ → ℝ) (hq : q.HasTemperateGrowth) + (f : 𝓢(ℝ,ℂ)) (r : ℝ) : spectralSmoothCutoff q f r=(q r : ℂ)*f r := by + have hqc : (fun r => (q r : ℂ)).HasTemperateGrowth := Complex.hasTemperateGrowth_ofReal.comp hq + rw [spectralSmoothCutoff,SchwartzMap.smulLeftCLM_apply_apply hqc] + rfl + +theorem spectralSmoothCutoff_derivative (q dq : ℝ → ℝ) (hq : q.HasTemperateGrowth) + (hd : ∀ r, HasDerivAt q (dq r) r) (f : 𝓢(ℝ,ℂ)) (r : ℝ) : + SchwartzMap.derivCLM ℂ ℂ (spectralSmoothCutoff q f) r= + (dq r : ℂ)*f r+(q r : ℂ)*SchwartzMap.derivCLM ℂ ℂ f r := by + have he : (spectralSmoothCutoff q f : ℝ → ℂ)=(fun s => (q s : ℂ)*f s) := + funext (spectralSmoothCutoff_apply q hq f) + rw [SchwartzMap.derivCLM_apply,he,SchwartzMap.derivCLM_apply] + exact ((hd r).ofReal_comp.mul (f.hasDerivAt r)).deriv + +theorem spectralSmoothCutoff_L2 (μ : Measure ℝ) [IsFiniteMeasure μ] + (q : ℝ → ℝ) (hq : q.HasTemperateGrowth) (hqm : AEStronglyMeasurable q μ) + (M : ℝ) (hqb : ∀ᵐ r ∂μ, ‖q r‖ ≤ M) (f : 𝓢(ℝ,ℂ)) : + spectralL2ComplexMultiplier μ q hqm M hqb + (BoundedContinuousFunction.toLp 2 μ ℂ (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ f))= + BoundedContinuousFunction.toLp 2 μ ℂ + (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ (spectralSmoothCutoff q f)) := by + apply Lp.ext + filter_upwards [spectralL2ComplexMultiplier_ae μ q hqm M hqb + (BoundedContinuousFunction.toLp 2 μ ℂ (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ f)), + BoundedContinuousFunction.coeFn_toLp 2 μ ℂ + (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ f), + BoundedContinuousFunction.coeFn_toLp 2 μ ℂ + (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ (spectralSmoothCutoff q f))] + with r hm hf hg + rw [hm,hf,hg] + change q r • f r = spectralSmoothCutoff q f r + simpa only [Complex.real_smul] using (spectralSmoothCutoff_apply q hq f r).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothHarmonicBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothHarmonicBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0987d977588803abe21e231c5b66dfb6057b78b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothHarmonicBound.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedPairing + +namespace OAI + +/-! Uniform C1 control on the ball bounds the completed harmonic energy. -/ + +open Set MeasureTheory +open scoped SchwartzMap ENNReal +namespace DefocusingNLS + +theorem spectralHarmonicNorm_le_sum (ell : ℕ) (R : ℝ) + (u : SpectralHarmonicEnergy ell R) : + ‖u‖ ≤ ‖spectralHarmonicValue ell R u‖+‖spectralHarmonicDerivative ell R u‖+ + ‖spectralHarmonicAngularValue ell R u‖ := by + have he := spectralHarmonicEnergy_norm_sq ell R u + rw [spectralRadialEnergy_norm_sq] at he + change ‖u‖^2=‖spectralHarmonicValue ell R u‖^2+ + ‖spectralHarmonicDerivative ell R u‖^2+‖spectralHarmonicAngularValue ell R u‖^2 at he + have hv := norm_nonneg (spectralHarmonicValue ell R u) + have hd := norm_nonneg (spectralHarmonicDerivative ell R u) + have ha := norm_nonneg (spectralHarmonicAngularValue ell R u) + nlinarith [norm_nonneg u,mul_nonneg hv hd,mul_nonneg hv ha,mul_nonneg hd ha] + +theorem spectralSmoothHarmonic_uniform_bound (ell : ℕ) (R : ℝ) : + ∃ C : ℝ, 0 < C ∧ ∀ (f : 𝓢(ℝ,ℂ)) (d : ℝ), 0 ≤ d → + (∀ r ∈ Icc 0 R, ‖f r‖ ≤ d) → (∀ r ∈ Icc 0 R, ‖deriv f r‖ ≤ d) → + ‖spectralHarmonicSmoothEmbedding ell R f‖ ≤ C*d := by + let c : ℝ := (measureUnivNNReal (radialPressureMeasure R) : ℝ)^((2 : ℝ≥0∞).toReal)⁻¹ + let a : ℝ := (measureUnivNNReal (spectralAngularMeasure R) : ℝ)^((2 : ℝ≥0∞).toReal)⁻¹ + let k : ℝ := ‖(Real.sqrt ((ell : ℝ)*(ell+10)) : ℂ)‖ + have hc : 0 ≤ c := Real.rpow_nonneg (by positivity) _ + have ha : 0 ≤ a := Real.rpow_nonneg (by positivity) _ + have hk : 0 ≤ k := norm_nonneg _ + refine ⟨2*c+k*a+1,by positivity,fun f d hd hf hdf => ?_⟩ + let u := spectralHarmonicSmoothEmbedding ell R f + have hV : ‖spectralHarmonicValue ell R u‖ ≤ c*d := by + apply Lp.norm_le_of_ae_bound hd + filter_upwards [spectralHarmonicValue_smooth_ae ell R f, + radialPressureMeasure_ae_positive R] with r hr hp + rw [hr] + exact hf r ⟨hp.1.le,hp.2⟩ + have hD : ‖spectralHarmonicDerivative ell R u‖ ≤ c*d := by + apply Lp.norm_le_of_ae_bound hd + filter_upwards [spectralHarmonicDerivative_smooth_ae ell R f, + radialPressureMeasure_ae_positive R] with r hr hp + rw [hr] + exact hdf r ⟨hp.1.le,hp.2⟩ + have hA : ‖spectralSmoothAngularValue R f‖ ≤ a*d := by + apply Lp.norm_le_of_ae_bound hd + filter_upwards [BoundedContinuousFunction.coeFn_toLp 2 (spectralAngularMeasure R) ℂ + (SchwartzMap.toBoundedContinuousFunctionCLM ℂ ℝ ℂ f), + (spectralAngularMeasure_absolutelyContinuous R).ae_le (radialPressureMeasure_ae_positive R)] + with r hr hp + change spectralSmoothAngularValue R f r=f r at hr + rw [hr] + exact hf r ⟨hp.1.le,hp.2⟩ + have hG : ‖spectralHarmonicAngularValue ell R u‖ ≤ k*(a*d) := by + rw [spectralHarmonicAngularValue_smooth,norm_smul] + exact mul_le_mul_of_nonneg_left hA hk + apply (spectralHarmonicNorm_le_sum ell R u).trans + calc + _ ≤ c*d+c*d+k*(a*d) := add_le_add (add_le_add hV hD) hG + _ ≤ (2*c+k*a+1)*d := by nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothPairTesting.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothPairTesting.lean new file mode 100644 index 0000000000000000000000000000000000000000..19cffa9c3fa20bee8c5f4ca05cacd0ed2f2ec008 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSmoothPairTesting.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFirstTest +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPencilVariational + +namespace OAI + +/-! Schwartz tests in both coordinates determine the complete weak equation. -/ + +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralPairFunctional_ext (ell : ℕ) (R : ℝ) + (L M : SpectralHarmonicPair ell R →L[ℝ] ℝ) + (hf : ∀ f : 𝓢(ℝ,ℂ), L (spectralFirstTest ell R f)=M (spectralFirstTest ell R f)) + (hg : ∀ f : 𝓢(ℝ,ℂ), L (spectralSecondTest ell R f)=M (spectralSecondTest ell R f)) : + L=M := by + let J := (WithLp.prodContinuousLinearEquiv 2 ℂ + (SpectralHarmonicEnergy ell R) (SpectralHarmonicEnergy ell R)).symm + have hfirst : (fun v : SpectralHarmonicEnergy ell R => L (J (v,0)))= + (fun v : SpectralHarmonicEnergy ell R => M (J (v,0))) := + (spectralHarmonicSmooth_dense ell R).equalizer + (L.continuous.comp (J.continuous.comp (continuous_id.prodMk continuous_const))) + (M.continuous.comp (J.continuous.comp (continuous_id.prodMk continuous_const))) (funext hf) + have hsecond : (fun v : SpectralHarmonicEnergy ell R => L (J (0,v)))= + (fun v : SpectralHarmonicEnergy ell R => M (J (0,v))) := + (spectralHarmonicSmooth_dense ell R).equalizer + (L.continuous.comp (J.continuous.comp (continuous_const.prodMk continuous_id))) + (M.continuous.comp (J.continuous.comp (continuous_const.prodMk continuous_id))) (funext hg) + apply DFunLike.ext + intro v + have hv : v=J (v.fst,0)+J (0,v.snd) := by + change v=WithLp.toLp 2 (v.fst,0)+WithLp.toLp 2 (0,v.snd) + apply (WithLp.prodContinuousLinearEquiv 2 ℂ + (SpectralHarmonicEnergy ell R) (SpectralHarmonicEnergy ell R)).injective + change (v.fst,v.snd)=(v.fst+0,0+v.snd) + simp + rw [hv,map_add,map_add,congrFun hfirst,congrFun hsecond] + +namespace SpectralPenaltyFamily +variable {R l : ℝ} + +theorem compactPencil_of_smooth_tests (s : SpectralPenaltyFamily R l) (ell n : ℕ) + (hR : 0 < R) (K : SpectralRadialObservationSpace R →L[ℂ] SpectralHarmonicPair ell R) + (u : SpectralHarmonicPair ell R) + (hf : ∀ f : 𝓢(ℝ,ℂ), s.penaltyForm ell n u (spectralFirstTest ell R f)= + inner ℝ (K (spectralHarmonicObservation ell R hR u)) (spectralFirstTest ell R f)) + (hg : ∀ f : 𝓢(ℝ,ℂ), s.penaltyForm ell n u (spectralSecondTest ell R f)= + inner ℝ (K (spectralHarmonicObservation ell R hR u)) (spectralSecondTest ell R f)) : + s.compactPencil ell hR n K (spectralHarmonicObservation ell R hR u)= + spectralHarmonicObservation ell R hR u := by + apply (s.compactPencil_variational ell n hR K _).mpr + refine ⟨u,rfl,?_⟩ + have he := spectralPairFunctional_ext ell R (s.penaltyForm ell n u) + (InnerProductSpace.toDual ℝ (SpectralHarmonicPair ell R) + (K (spectralHarmonicObservation ell R hR u))) hf hg + exact fun v => DFunLike.congr_fun he v + +end SpectralPenaltyFamily +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitCoefficients.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..92e20443e66c298afb79f072b184ed6f1de45181 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitCoefficients.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCoefficientContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Profile.RadialUniformAnnulus +import Mathlib.Analysis.SpecificLimits.Normed + +namespace OAI + +/-! Uniform decay of the actual two spectral potential coefficients on the +exterior subunit annulus. The polynomial factor in the power is retained. -/ + +open Filter Topology Set +namespace DefocusingNLS +open ProfileCertificate +local notation "E₄" => (ℂ × ℂ) × (ℂ × ℂ) + +theorem spectralSubunitCoefficient_decay (ρ : ℝ) (hρ : 0 ≤ ρ) (hρ1 : ρ < 1) : + Tendsto (fun n : ℕ => (2*(n : ℝ)+1)*ρ^(2*n)) atTop (𝓝 0) := by + have hq : ρ^2 < 1 := pow_lt_one₀ hρ hρ1 (by decide : 2 ≠ 0) + have hp := tendsto_pow_atTop_nhds_zero_of_lt_one (sq_nonneg ρ) hq + have hn := tendsto_self_mul_const_pow_of_lt_one (sq_nonneg ρ) hq + convert (hn.const_mul 2).add hp using 1 + · funext n + rw [pow_mul] + ring + · norm_num + +theorem spectralCoefficient_norm_sum (m : ℕ) (hm : 1 ≤ m) (q : ℂ) : + ‖spectralDiagonalCoefficient m q‖+‖spectralCrossCoefficient m q‖= + (2*(m : ℝ)+1)*‖q‖^(2*m) := by + rw [spectralDiagonalCoefficient_norm,spectralCrossCoefficient_norm m hm] + ring + +theorem spectralCoefficient_subunit_bound (m : ℕ) (hm : 1 ≤ m) (q : ℂ) + (ρ : ℝ) (hq : ‖q‖ ≤ ρ) : + ‖spectralDiagonalCoefficient m q‖+‖spectralCrossCoefficient m q‖ ≤ + (2*(m : ℝ)+1)*ρ^(2*m) := by + rw [spectralCoefficient_norm_sum m hm] + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) hq _) (by positivity) + +theorem spectralCoefficient_zero (m : ℕ) (hm : 1 ≤ m) : + spectralDiagonalCoefficient m 0=0 ∧ spectralCrossCoefficient m 0=0 := by + have hmn : m ≠ 0 := by omega + simp [spectralDiagonalCoefficient,spectralCrossCoefficient,hmn] + +theorem circularBoundedField_subunit_bound (νp νm η : ℂ) (m : ℕ) (hm : 1 ≤ m) + (q : ℂ) (ρ : ℝ) (hq : ‖q‖ ≤ ρ) (z : E₄) : + ‖circularBoundedField νp νm η m q z-circularBoundedField νp νm η m 0 z‖ ≤ + ((2*(m : ℝ)+1)*ρ^(2*m))*‖z‖ := by + rw [circularBoundedField_coefficient_difference, + (spectralCoefficient_zero m hm).1,(spectralCoefficient_zero m hm).2,sub_zero,sub_zero] + exact (circularCoefficientAction_norm _ _ z).trans + (mul_le_mul_of_nonneg_right (spectralCoefficient_subunit_bound m hm q ρ hq) (norm_nonneg z)) + +theorem radialShooting_spectralCoefficients_uniform_small : + ∃ δ : ℕ → ℝ, (∀ n, 0 ≤ δ n) ∧ Tendsto δ atTop (𝓝 0) ∧ + ∀ᶠ n in atTop, ∀ z : ProfileMatchingBall, ∀ t : ℝ, + Real.log innerBoundaryRadius ≤ t → + ‖spectralDiagonalCoefficient n + (radialExteriorCanonical (radialShootingNu n z) n (radialShootingM z) + (Real.log innerBoundaryRadius) t).1‖+ + ‖spectralCrossCoefficient n + (radialExteriorCanonical (radialShootingNu n z) n (radialShootingM z) + (Real.log innerBoundaryRadius) t).1‖ ≤ δ n := by + obtain ⟨κ,ρ,hκ,hρ,he⟩ := radialShooting_uniform_annulus + let σ := max ρ 0 + have hσ : 0 ≤ σ := le_max_right _ _ + have hσ1 : σ < 1 := max_lt hρ (by norm_num) + refine ⟨fun n => (2*(n : ℝ)+1)*σ^(2*n),fun n => by positivity, + spectralSubunitCoefficient_decay σ hσ hσ1,?_⟩ + filter_upwards [he,eventually_ge_atTop 1] with n hn hm z t ht + exact spectralCoefficient_subunit_bound n hm _ σ ((hn z t ht).2.trans (le_max_left _ _)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitDifference.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ffb80b8d50f5dcdaa72791845c74bd335d3c671 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitDifference.lean @@ -0,0 +1,138 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSubunitCoefficients + +namespace OAI + +/-! A quantitative Lipschitz constant for the spectral coefficient pair. +It tends to zero on a fixed subunit disk, even after division by the +exponential order of the profile remainder. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectral_power_difference_bound (n : ℕ) (ρ : ℝ) (hρ : 0 < ρ) + (z w : ℂ) (hz : ‖z‖ ≤ ρ) (hw : ‖w‖ ≤ ρ) : + ‖z^n-w^n‖ ≤ ((n : ℝ)*ρ^n/ρ)*‖z-w‖ := by + induction n with + | zero => simp + | succ n ih => + have he : z^(n+1)-w^(n+1)=z^n*(z-w)+(z^n-w^n)*w := by ring + rw [he] + calc + _ ≤ ‖z^n*(z-w)‖+‖(z^n-w^n)*w‖ := norm_add_le _ _ + _ = ‖z‖^n*‖z-w‖+‖z^n-w^n‖*‖w‖ := by simp only [norm_mul,norm_pow] + _ ≤ ρ^n*‖z-w‖+(((n : ℝ)*ρ^n/ρ)*‖z-w‖)*ρ := by + gcongr + _ = (((n+1 : ℕ) : ℝ)*ρ^(n+1)/ρ)*‖z-w‖ := by + rw [pow_succ,Nat.cast_add,Nat.cast_one] + field_simp + ring + +theorem spectral_mixed_power_difference_bound (a b : ℕ) (ρ : ℝ) (hρ : 0 < ρ) + (z w : ℂ) (hz : ‖z‖ ≤ ρ) (hw : ‖w‖ ≤ ρ) : + ‖z^a*(star z)^b-w^a*(star w)^b‖ ≤ (((a+b : ℕ) : ℝ)*ρ^(a+b)/ρ)*‖z-w‖ := by + have hp := spectral_power_difference_bound a ρ hρ z w hz hw + have hs := spectral_power_difference_bound b ρ hρ (star z) (star w) + (by simpa only [norm_star] using hz) (by simpa only [norm_star] using hw) + simp only [← star_sub,norm_star] at hs + have he : z^a*(star z)^b-w^a*(star w)^b= + (z^a-w^a)*(star z)^b+w^a*((star z)^b-(star w)^b) := by ring + rw [he] + calc + _ ≤ ‖(z^a-w^a)*(star z)^b‖+‖w^a*((star z)^b-(star w)^b)‖ := norm_add_le _ _ + _ = ‖z^a-w^a‖*‖z‖^b+‖w‖^a*‖(star z)^b-(star w)^b‖ := by + simp only [norm_mul,norm_pow,norm_star] + _ ≤ (((a : ℝ)*ρ^a/ρ)*‖z-w‖)*ρ^b+ρ^a*(((b : ℝ)*ρ^b/ρ)*‖z-w‖) := by + gcongr + _ = _ := by rw [pow_add,Nat.cast_add]; ring + +theorem spectralCoefficient_subunit_difference (m : ℕ) (hm : 1 ≤ m) + (ρ : ℝ) (hρ : 0 < ρ) (z w : ℂ) (hz : ‖z‖ ≤ ρ) (hw : ‖w‖ ≤ ρ) : + ‖spectralDiagonalCoefficient m z-spectralDiagonalCoefficient m w‖+ + ‖spectralCrossCoefficient m z-spectralCrossCoefficient m w‖ ≤ + (2*(m : ℝ)*(2*(m : ℝ)+1)*ρ^(2*m)/ρ)*‖z-w‖ := by + have hp := spectral_mixed_power_difference_bound m m ρ hρ z w hz hw + have hmixed := spectral_mixed_power_difference_bound (m+1) (m-1) ρ hρ z w hz hw + have he : m+1+(m-1)=2*m := by omega + have he' : m+m=2*m := by omega + rw [he'] at hp + rw [he] at hmixed + have hdiag : ‖spectralDiagonalCoefficient m z-spectralDiagonalCoefficient m w‖ ≤ + ((m : ℝ)+1)*(((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖ := by + have heq : spectralDiagonalCoefficient m z-spectralDiagonalCoefficient m w= + ((m+1 : ℕ) : ℂ)*(z^m*(star z)^m-w^m*(star w)^m) := by + simp only [spectralDiagonalCoefficient] + ring + rw [heq,norm_mul,Complex.norm_natCast,Nat.cast_add,Nat.cast_one] + calc + _ ≤ ((m : ℝ)+1)*((((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖) := by gcongr + _ = _ := by ring + have hcross : ‖spectralCrossCoefficient m z-spectralCrossCoefficient m w‖ ≤ + (m : ℝ)*(((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖ := by + have heq : spectralCrossCoefficient m z-spectralCrossCoefficient m w= + (m : ℂ)*(z^(m+1)*(star z)^(m-1)-w^(m+1)*(star w)^(m-1)) := by + simp only [spectralCrossCoefficient] + ring + rw [heq,norm_mul,Complex.norm_natCast] + calc + _ ≤ (m : ℝ)*((((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖) := by gcongr + _ = _ := by ring + calc + _ ≤ ((m : ℝ)+1)*(((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖+ + (m : ℝ)*(((2*m : ℕ) : ℝ)*ρ^(2*m)/ρ)*‖z-w‖ := add_le_add hdiag hcross + _ = _ := by push_cast; ring + +theorem spectralCoefficient_difference_rate_tendsto (ρ : ℝ) (hρ : 0 < ρ) (hρ1 : ρ < 1) : + Tendsto (fun n : ℕ => 2*(n : ℝ)*(2*(n : ℝ)+1)*ρ^(2*n)/ρ) atTop (𝓝 0) := by + have hq : ρ^2 < 1 := pow_lt_one₀ hρ.le hρ1 (by decide : 2 ≠ 0) + have h₂ := tendsto_pow_const_mul_const_pow_of_lt_one 2 (sq_nonneg ρ) hq + have h₁ := tendsto_self_mul_const_pow_of_lt_one (sq_nonneg ρ) hq + convert ((h₂.const_mul 4).add (h₁.const_mul 2)).div_const ρ using 1 + · funext n + rw [pow_mul] + ring + · norm_num + +theorem spectralCoefficient_weighted_difference (m : ℕ) (hm : 1 ≤ m) + (ρ : ℝ) (hρ : 0 < ρ) (q p e : ℂ) (κ t : ℝ) + (hq : ‖q‖ ≤ ρ) (hp : ‖p‖ ≤ ρ) + (he : q-p=(Real.exp (-κ*t) : ℂ)*e) : + ‖(Real.exp (κ*t) : ℂ)*(spectralDiagonalCoefficient m q-spectralDiagonalCoefficient m p)‖+ + ‖(Real.exp (κ*t) : ℂ)*(spectralCrossCoefficient m q-spectralCrossCoefficient m p)‖ ≤ + (2*(m : ℝ)*(2*(m : ℝ)+1)*ρ^(2*m)/ρ)*‖e‖ := by + have hb := spectralCoefficient_subunit_difference m hm ρ hρ q p hq hp + have hn : ‖q-p‖=Real.exp (-κ*t)*‖e‖ := by + rw [he,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + have hh := mul_le_mul_of_nonneg_left hb (Real.exp_nonneg (κ*t)) + have hexp : Real.exp (κ*t)*Real.exp (-κ*t)=1 := by rw [← Real.exp_add]; simp + rw [hn] at hh + simp only [norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + calc + _ = Real.exp (κ*t)*(‖spectralDiagonalCoefficient m q-spectralDiagonalCoefficient m p‖+ + ‖spectralCrossCoefficient m q-spectralCrossCoefficient m p‖) := by ring + _ ≤ Real.exp (κ*t)*((2*(m : ℝ)*(2*(m : ℝ)+1)*ρ^(2*m)/ρ)*(Real.exp (-κ*t)*‖e‖)) := hh + _ = (Real.exp (κ*t)*Real.exp (-κ*t))* + (2*(m : ℝ)*(2*(m : ℝ)+1)*ρ^(2*m)/ρ)*‖e‖ := by ring + _ = _ := by rw [hexp,one_mul] + +theorem radialShooting_spectralDifference_uniform_small : + ∃ ρ : ℝ, 0 < ρ ∧ ρ < 1 ∧ ∃ δ : ℕ → ℝ, + (∀ n, 0 ≤ δ n) ∧ Tendsto δ atTop (𝓝 0) ∧ + ∀ᶠ n in atTop, ∀ z : ProfileCertificate.ProfileMatchingBall, ∀ t : ℝ, + Real.log innerBoundaryRadius ≤ t → ∀ p : ℂ, ‖p‖ ≤ ρ → + let q := (radialExteriorCanonical (radialShootingNu n z) n (radialShootingM z) + (Real.log innerBoundaryRadius) t).1 + ‖spectralDiagonalCoefficient n q-spectralDiagonalCoefficient n p‖+ + ‖spectralCrossCoefficient n q-spectralCrossCoefficient n p‖ ≤ δ n*‖q-p‖ := by + obtain ⟨κ,σ,hκ,hσ,he⟩ := radialShooting_uniform_annulus + let ρ := max σ (1/2) + have hρ : 0 < ρ := lt_of_lt_of_le (by norm_num) (le_max_right _ _) + have hρ1 : ρ < 1 := max_lt hσ (by norm_num) + refine ⟨ρ,hρ,hρ1,fun n => 2*(n : ℝ)*(2*(n : ℝ)+1)*ρ^(2*n)/ρ, + fun n => by positivity,spectralCoefficient_difference_rate_tendsto ρ hρ hρ1,?_⟩ + filter_upwards [he,eventually_ge_atTop 1] with n hn hmn z t ht p hp + exact spectralCoefficient_subunit_difference n hmn ρ hρ _ p + ((hn z t ht).2.trans (le_max_left _ _)) hp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitFieldLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitFieldLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..718826d3c0782289422e9f640d88e1de1f1f6c10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitFieldLimit.lean @@ -0,0 +1,27 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFieldParameterLimit + +namespace OAI + +/-! The elementary contraction bound also converges on a fixed subunit +profile ball, so the limiting gap holds for every sufficiently large power. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem circularFieldBound_subunit_tendsto (νp νm : ℕ → ℂ) (μp μm η : ℂ) + (hp : Tendsto νp atTop (𝓝 μp)) (hm : Tendsto νm atTop (𝓝 μm)) + (m : ℕ → ℕ) (hmTop : Tendsto m atTop atTop) + (ρ : ℝ) (hρ : 0 ≤ ρ) (hρ1 : ρ < 1) : + Tendsto (fun n => circularFieldBound (νp n) (νm n) η (m n) ρ) atTop + (𝓝 (circularFieldBound μp μm η 1 0)) := by + have h1 := ((hp.const_mul 2).add_const 10).norm + have h2 := ((hm.const_mul 2).add_const 10).norm + have h3 := ((hp.mul (hp.add_const 10)).sub_const η).norm + have h4 := ((hm.mul (hm.add_const 10)).sub_const η).norm + have h5 := (spectralSubunitCoefficient_decay ρ hρ hρ1).comp hmTop + simpa only [Function.comp_def,circularFieldBound,pow_succ,pow_zero,zero_mul,mul_zero,add_zero] + using ((((h1.const_add 1).add h2).add h3).add h4).add h5 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitPressure.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitPressure.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d73f2e02e6a5aa1a85aeb69b6bf86fc31c20bd4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralSubunitPressure.lean @@ -0,0 +1,35 @@ +import Mathlib.Analysis.SpecificLimits.Normed +import Mathlib.Topology.UniformSpace.UniformConvergence + +namespace OAI + +/-! The pressure divided by its small scale vanishes uniformly where the limiting amplitude is subunit. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralSubunit_scaled_power_uniform {s : Set ℝ} (H : ℕ → ℝ → ℝ) (H₀ : ℝ → ℝ) + (hH : TendstoUniformlyOn H H₀ atTop s) (ρ : ℝ) (hρ : 0 ≤ ρ) (hρ1 : ρ < 1) + (hbound : ∀ r ∈ s, ‖H₀ r‖ ≤ ρ) (p : ℕ → ℕ) (hp : Tendsto p atTop atTop) : + TendstoUniformlyOn (fun n r => (p n : ℝ)*(H n r)^(p n)) (fun _ => 0) atTop s := by + let q := (ρ+1)/2 + have hq0 : 0 ≤ q := by dsimp [q]; positivity + have hq1 : q < 1 := by dsimp [q]; linarith + have hgap : 0 < q-ρ := by dsimp [q]; linarith + have hclose : ∀ᶠ n in atTop, ∀ r ∈ s, ‖H n r‖ ≤ q := by + filter_upwards [(Metric.tendstoUniformlyOn_iff.mp hH) (q-ρ) hgap] with n hn r hr + have hd : ‖H n r-H₀ r‖ < q-ρ := by + simpa only [dist_eq_norm,norm_sub_rev] using hn r hr + exact (norm_le_norm_sub_add (H n r) (H₀ r)).trans (by linarith [hbound r hr]) + have hdecay : Tendsto (fun n => (p n : ℝ)*q^(p n)) atTop (𝓝 0) := + (tendsto_self_mul_const_pow_of_lt_one hq0 hq1).comp hp + rw [Metric.tendstoUniformlyOn_iff] + intro ε hε + filter_upwards [hclose,hdecay.eventually (Iio_mem_nhds hε)] with n hn hb r hr + rw [dist_zero_left,norm_mul,norm_pow,Real.norm_natCast] + exact (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) (hn r hr) (p n)) + (Nat.cast_nonneg (p n))).trans_lt hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf510256c6eee9126295b0c7723f27caf6e21359 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyLinear.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEnergyOperations + +namespace OAI + +/-! Finite linear combinations preserve the weighted top energy on a tail. -/ + +open Set Filter Topology MeasureTheory +open scoped ContDiff +namespace DefocusingNLS +local notation "V" => ℂ × ℂ + +theorem spectralWeighted_top_smul_integrable (u : ℝ → V) (R : ℝ) (N : ℕ) (c : ℂ) + (hu : IntegrableOn (fun r => r^11*‖iteratedDeriv N u r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖iteratedDeriv N (fun s => c • u s) r‖^2) (Ioi R) := by + simpa only [iteratedDeriv_fun_const_smul_field] using + spectralWeighted_square_smul_integrable (iteratedDeriv N u) R c hu + +theorem spectralWeighted_top_add_integrable (u v : ℝ → V) (R : ℝ) (hR : 0≤R) (N : ℕ) + (hcU : ContDiffOn ℝ ∞ u (Ioi R)) (hcV : ContDiffOn ℝ ∞ v (Ioi R)) + (hu : IntegrableOn (fun r => r^11*‖iteratedDeriv N u r‖^2) (Ioi R)) + (hv : IntegrableOn (fun r => r^11*‖iteratedDeriv N v r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖iteratedDeriv N (fun s => u s+v s) r‖^2) (Ioi R) := by + have hn := spectralWeighted_top_smul_integrable v R N (-1) hv + have hh := spectralWeighted_top_sub_integrable u (fun s => (-1 : ℂ) • v s) R hR N + hcU (hcV.const_smul (-1 : ℂ)) hu hn + simpa only [neg_one_smul,sub_neg_eq_add] using hh + +theorem spectralWeighted_top_combination_integrable (u v : ℝ → V) + (R : ℝ) (hR : 0≤R) (N : ℕ) (a b : ℂ) + (hcU : ContDiffOn ℝ ∞ u (Ioi R)) (hcV : ContDiffOn ℝ ∞ v (Ioi R)) + (hu : IntegrableOn (fun r => r^11*‖iteratedDeriv N u r‖^2) (Ioi R)) + (hv : IntegrableOn (fun r => r^11*‖iteratedDeriv N v r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖iteratedDeriv N (fun s => a • u s+b • v s) r‖^2) (Ioi R) := + spectralWeighted_top_add_integrable _ _ R hR N (hcU.const_smul a) (hcV.const_smul b) + (spectralWeighted_top_smul_integrable u R N a hu) + (spectralWeighted_top_smul_integrable v R N b hv) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyOperations.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyOperations.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8e215394e9f64904a22cf4f8d4853dff8696fe2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyOperations.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailWeightedL2 + +namespace OAI + +/-! Weighted top energy is preserved by subtracting an outgoing parameter correction. -/ + +open Set Filter Topology MeasureTheory +open scoped ContDiff +namespace DefocusingNLS +local notation "V" => ℂ × ℂ + +theorem spectralWeighted_square_sub_integrable (u v : ℝ → V) (R : ℝ) (hR : 0≤R) + (hcU : ContinuousOn u (Ioi R)) (hcV : ContinuousOn v (Ioi R)) + (hu : IntegrableOn (fun r => r^11*‖u r‖^2) (Ioi R)) + (hv : IntegrableOn (fun r => r^11*‖v r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖u r-v r‖^2) (Ioi R) := by + have hmajor := (hu.add hv).const_mul (2 : ℝ) + apply hmajor.mono' + (((continuousOn_id.pow 11).mul ((hcU.sub hcV).norm.pow 2)).aestronglyMeasurable measurableSet_Ioi) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + have hr₀ : 0≤r := hR.trans hr.le + have hsq : ‖u r-v r‖^2 ≤ 2*(‖u r‖^2+‖v r‖^2) := by + have h := norm_sub_le (u r) (v r) + have hnorm := norm_nonneg (u r-v r) + nlinarith [sq_nonneg (‖u r‖-‖v r‖)] + change ‖(r^11*‖u r-v r‖^2 : ℝ)‖ ≤ 2*(r^11*‖u r‖^2+r^11*‖v r‖^2) + rw [Real.norm_eq_abs,abs_of_nonneg (mul_nonneg (pow_nonneg hr₀ 11) (sq_nonneg ‖u r-v r‖))] + calc + _ ≤ r^11*(2*(‖u r‖^2+‖v r‖^2)) := + mul_le_mul_of_nonneg_left hsq (pow_nonneg hr₀ _) + _ = _ := by ring + +theorem spectralWeighted_square_smul_integrable (u : ℝ → V) (R : ℝ) (c : ℂ) + (hu : IntegrableOn (fun r => r^11*‖u r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖c • u r‖^2) (Ioi R) := by + have hi : IntegrableOn (fun r => ‖c‖^2*(r^11*‖u r‖^2)) (Ioi R) := hu.const_mul _ + apply hi.congr_fun _ measurableSet_Ioi + intro r _ + dsimp only + rw [norm_smul,mul_pow] + ring + +theorem spectralWeighted_top_sub_integrable (u v : ℝ → V) (R : ℝ) (hR : 0≤R) (N : ℕ) + (hcU : ContDiffOn ℝ ∞ u (Ioi R)) (hcV : ContDiffOn ℝ ∞ v (Ioi R)) + (hu : IntegrableOn (fun r => r^11*‖iteratedDeriv N u r‖^2) (Ioi R)) + (hv : IntegrableOn (fun r => r^11*‖iteratedDeriv N v r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖iteratedDeriv N (fun s => u s-v s) r‖^2) (Ioi R) := by + have hi := spectralWeighted_square_sub_integrable (iteratedDeriv N u) (iteratedDeriv N v) R hR + (homogeneousPair_iteratedDeriv_smooth_tail u R hcU N).continuousOn + (homogeneousPair_iteratedDeriv_smooth_tail v R hcV N).continuousOn hu hv + apply hi.congr_fun _ measurableSet_Ioi + intro r hr + dsimp only + rw [iteratedDeriv_fun_sub + (((hcU r hr).contDiffAt (Ioi_mem_nhds hr)).of_le (by simp)) + (((hcV r hr).contDiffAt (Ioi_mem_nhds hr)).of_le (by simp))] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyPair.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9ebab3c152e28bc3519bd40a630a35b5b52f472 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEnergyPair.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEnergyOperations +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousRadialPairL2 + +namespace OAI + +/-! Conversion between the two radial channel energies and the pair norm. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS +local notation "V" => ℂ × ℂ + +theorem spectralWeighted_pair_integrable (U : ℝ → V) (R : ℝ) (hR : 0≤R) + (hU : ContinuousOn U (Ioi R)) + (hp : IntegrableOn (fun r => r^11*‖(U r).1‖^2) (Ioi R)) + (hm : IntegrableOn (fun r => r^11*‖(U r).2‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖U r‖^2) (Ioi R) := by + have hi := radial_pair_energy_integrable (fun r => (U r).1) (fun r => (U r).2) R hp hm + apply hi.mono' (((continuousOn_id.pow 11).mul (hU.norm.pow 2)).aestronglyMeasurable measurableSet_Ioi) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + have hr₀ : 0≤r := hR.trans hr.le + change ‖(r^11*‖U r‖^2 : ℝ)‖ ≤ r^11*homogeneousPairEnergy ((U r).1,(U r).2) + rw [Real.norm_eq_abs,abs_of_nonneg (mul_nonneg (pow_nonneg hr₀ 11) (sq_nonneg ‖U r‖))] + exact mul_le_mul_of_nonneg_left (homogeneousPairEnergy_lower (U r)) (pow_nonneg hr₀ 11) + +theorem spectralWeighted_scalar_of_pair (U : ℝ → V) (f : ℝ → ℂ) (R : ℝ) (hR : 0≤R) + (hf : ContinuousOn f (Ioi R)) (hb : ∀ r, R r^11*‖U r‖^2) (Ioi R)) : + IntegrableOn (fun r => r^11*‖f r‖^2) (Ioi R) := by + apply hU.mono' (((continuousOn_id.pow 11).mul (hf.norm.pow 2)).aestronglyMeasurable measurableSet_Ioi) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + have hr₀ : 0≤r := hR.trans hr.le + change ‖(r^11*‖f r‖^2 : ℝ)‖ ≤ r^11*‖U r‖^2 + rw [Real.norm_eq_abs,abs_of_nonneg (mul_nonneg (pow_nonneg hr₀ 11) (sq_nonneg ‖f r‖))] + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) (hb r hr) 2) (pow_nonneg hr₀ 11) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEulerPhysical.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEulerPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e1fe59c17e25ba9cd2eda4fe7125ff5aacbf696 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailEulerPhysical.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousEulerPhysical + +namespace OAI + +/-! Falling Euler derivatives on a tail only require smoothness on that tail. -/ + +open Set Filter Topology +open scoped ContDiff +namespace DefocusingNLS +local notation "V" => ℂ × ℂ + +theorem homogeneousPair_iteratedDeriv_smooth_tail (U : ℝ → V) (R : ℝ) + (hU : ContDiffOn ℝ ∞ U (Ioi R)) (n : ℕ) : + ContDiffOn ℝ ∞ (iteratedDeriv n U) (Ioi R) := by + induction n with + | zero => simpa using hU + | succ n ih => + rw [iteratedDeriv_succ] + exact ih.deriv_of_isOpen isOpen_Ioi (by simp) + +theorem homogeneousEulerDeriv_physical_tail (U : ℝ → V) (L : ℝ) + (hU : ContDiffOn ℝ ∞ U (Ioi (Real.exp L))) (n : ℕ) (t : ℝ) (ht : L U (Real.exp s)) n t = + Real.exp ((n : ℝ)*t) • iteratedDeriv n U (Real.exp t) := by + induction n generalizing t with + | zero => simp [homogeneousEulerDeriv] + | succ n ih => + have heq : homogeneousEulerDeriv (fun s => U (Real.exp s)) n =ᶠ[𝓝 t] + (fun s => Real.exp ((n : ℝ)*s) • iteratedDeriv n U (Real.exp s)) := by + filter_upwards [Ioi_mem_nhds ht] with s hs + exact ih s hs + have het : Real.exp L < Real.exp t := Real.exp_lt_exp.mpr ht + have hUn : HasDerivAt (iteratedDeriv n U) (iteratedDeriv (n+1) U (Real.exp t)) + (Real.exp t) := by + rw [iteratedDeriv_succ] + exact (((homogeneousPair_iteratedDeriv_smooth_tail U (Real.exp L) hU n) _ het).contDiffAt + (Ioi_mem_nhds het)).differentiableAt (by simp) |>.hasDerivAt + have hUt : HasDerivAt (fun s => iteratedDeriv n U (Real.exp s)) + (Real.exp t • iteratedDeriv (n+1) U (Real.exp t)) t := + hUn.scomp t (Real.hasDerivAt_exp t) + have hweight : HasDerivAt (fun s : ℝ => Real.exp ((n : ℝ)*s)) + ((n : ℝ)*Real.exp ((n : ℝ)*t)) t := by + convert ((hasDerivAt_id t).const_mul (n : ℝ)).exp using 1 <;> simp [mul_comm] + have hh := hweight.smul hUt + have hd := hh.congr_of_eventuallyEq heq + change deriv (homogeneousEulerDeriv (fun s => U (Real.exp s)) n) t - + (n : ℝ) • homogeneousEulerDeriv (fun s => U (Real.exp s)) n t = _ + rw [hd.deriv,ih t ht] + simp only [smul_smul] + have hexp : Real.exp ((n : ℝ)*t)*Real.exp t=Real.exp (((n+1 : ℕ) : ℝ)*t) := by + rw [← Real.exp_add] + congr 1 + push_cast + ring + rw [hexp] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..59451adf2e7a48bef77337fccc3d2021cbd0e1d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailLinear.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCircularTail + +namespace OAI + +/-! The backward circular integral is a bounded complex-linear operator. -/ + +open Set MeasureTheory +open scoped BoundedContinuousFunction +namespace DefocusingNLS + +theorem boundedRadialExteriorTail_zero (κ : ℝ) (hκ : 0 < κ) : + boundedRadialExteriorTail κ hκ 0=0 := by + apply BoundedContinuousFunction.ext + intro t + change radialExteriorTailIntegral κ (0 : ℝ →ᵇ ℂ × ℂ) t=0 + simp [radialExteriorTailIntegral,radialExteriorPropagator] + +theorem boundedRadialExteriorTail_smul (κ : ℝ) (hκ : 0 < κ) + (a : ℂ) (g : ℝ →ᵇ ℂ × ℂ) : + boundedRadialExteriorTail κ hκ (a • g)=a • boundedRadialExteriorTail κ hκ g := by + apply BoundedContinuousFunction.ext + intro t + change radialExteriorTailIntegral κ (a • g) t=a • radialExteriorTailIntegral κ g t + have hp (u : ℝ) : radialExteriorPropagator t (t+u) ((a • g) (t+u))= + a • radialExteriorPropagator t (t+u) (g (t+u)) := by + apply Prod.ext <;> simp [radialExteriorPropagator,smul_eq_mul,mul_left_comm] + unfold radialExteriorTailIntegral + change -(∫ u in Ioi (0 : ℝ), Real.exp (-κ*u) • + radialExteriorPropagator t (t+u) ((a • g) (t+u))) = + a • -(∫ u in Ioi (0 : ℝ), Real.exp (-κ*u) • + radialExteriorPropagator t (t+u) (g (t+u))) + simp_rw [hp,smul_comm (Real.exp (-κ * _)) a] + rw [integral_smul,smul_neg] + +theorem boundedRadialExteriorTail_add (κ : ℝ) (hκ : 0 < κ) + (g h : ℝ →ᵇ ℂ × ℂ) : + boundedRadialExteriorTail κ hκ (g+h)= + boundedRadialExteriorTail κ hκ g+boundedRadialExteriorTail κ hκ h := by + have hs : boundedRadialExteriorTail κ hκ (-h)= -boundedRadialExteriorTail κ hκ h := by + have he : boundedRadialExteriorTail κ hκ (0-h)= + boundedRadialExteriorTail κ hκ 0-boundedRadialExteriorTail κ hκ h := by + apply BoundedContinuousFunction.ext + intro t + exact radialExteriorTailIntegral_sub κ hκ 0 h t + simpa only [zero_sub,boundedRadialExteriorTail_zero] using he + have he : boundedRadialExteriorTail κ hκ (g-(-h))= + boundedRadialExteriorTail κ hκ g-boundedRadialExteriorTail κ hκ (-h) := by + apply BoundedContinuousFunction.ext + intro t + exact radialExteriorTailIntegral_sub κ hκ g (-h) t + simpa only [sub_neg_eq_add,hs] using he + +noncomputable def boundedRadialExteriorTailCLM (κ : ℝ) (hκ : 0 < κ) : + (ℝ →ᵇ ℂ × ℂ) →L[ℂ] (ℝ →ᵇ ℂ × ℂ) := + LinearMap.mkContinuous + { toFun := boundedRadialExteriorTail κ hκ + map_add' := boundedRadialExteriorTail_add κ hκ + map_smul' := fun a g => boundedRadialExteriorTail_smul κ hκ a g } + (1/κ) (fun g => by + change ‖boundedRadialExteriorTail κ hκ g‖ ≤ (1/κ)*‖g‖ + rw [one_div_mul_eq_div] + exact boundedRadialExteriorTail_norm κ hκ g) + +theorem circularTail_add (κ : ℝ) (hκ : 0 < κ) (g h : CircularTailSpace) : + circularTail κ hκ (g+h)=circularTail κ hκ g+circularTail κ hκ h := by + apply Prod.ext + · exact boundedRadialExteriorTail_add κ hκ g.1 h.1 + · change star (boundedRadialExteriorTail κ hκ (star (g.2+h.2)))=_ + rw [star_add,boundedRadialExteriorTail_add,star_add] + rfl + +theorem circularTail_smul (κ : ℝ) (hκ : 0 < κ) (a : ℂ) (g : CircularTailSpace) : + circularTail κ hκ (a • g)=a • circularTail κ hκ g := by + apply Prod.ext + · exact boundedRadialExteriorTail_smul κ hκ a g.1 + · change star (boundedRadialExteriorTail κ hκ (star (a • g.2)))=_ + rw [star_smul,boundedRadialExteriorTail_smul,star_smul,star_star] + rfl + +noncomputable def circularTailCLM (κ : ℝ) (hκ : 0 < κ) : + CircularTailSpace →L[ℂ] CircularTailSpace := + LinearMap.mkContinuous + { toFun := circularTail κ hκ + map_add' := circularTail_add κ hκ + map_smul' := fun a g => circularTail_smul κ hκ a g } + (1/κ) (fun g => by + change ‖circularTail κ hκ g‖ ≤ (1/κ)*‖g‖ + rw [one_div_mul_eq_div] + exact circularTail_norm κ hκ g) + +theorem circularTailCLM_norm (κ : ℝ) (hκ : 0 < κ) : + ‖circularTailCLM κ hκ‖ ≤ 1/κ := by + exact LinearMap.mkContinuous_norm_le _ (by positivity) _ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailOutgoingSelection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailOutgoingSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..568aa9c9a16998d17adc936956d6183e63952ba9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailOutgoingSelection.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailRows +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousOutgoingDefectEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalColumnJets +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousOutgoingPropagation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousRadialRiccati +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousLogEquation + +namespace OAI + +/-! Selection of the outgoing plane from regularity and finite energy on a tail. -/ + +open Set Filter Topology MeasureTheory +open scoped ContDiff + +namespace DefocusingNLS + +local notation "V" => ℂ × ℂ +local notation "V₄" => V × V +local notation "End" => V →L[ℂ] V + +theorem homogeneousPhysicalOutgoing_tail_selection + (νp νm eta : ℂ) (m n : ℕ) (Q : ℝ → ℂ) (Z Zp Zm : ℝ → V₄) + (R₀ L c : ℝ) (hR₀ : 0 < R₀) (hL : Real.log R₀ ≤ L) (hc : 0 < c) + (hν : νp.re = νm.re) + (hbeta : -6 ≤ (n : ℝ) - (11 + νp.re)) + (hgap : 0 < ((n + 1 : ℕ) : ℝ) + n - (11 + νp.re)) + (hQ : ContinuousOn Q (Ici R₀)) + (hZ : ∀ r, R₀ ≤ r → HasDerivAt Z + (spectralPhysicalCircularField νp νm eta m (Q r) r (Z r)) r) + (hZp : ∀ r, R₀ ≤ r → HasDerivAt Zp + (spectralPhysicalCircularField νp νm eta m (Q r) r (Zp r)) r) + (hZm : ∀ r, R₀ ≤ r → HasDerivAt Zm + (spectralPhysicalCircularField νp νm eta m (Q r) r (Zm r)) r) + (hU : ContDiffOn ℝ ∞ (fun r => spectralPhysicalValueMap (Z r)) (Ioi R₀)) + (hbounded : ∃ M : ℝ, 0 ≤ M ∧ ∀ r, R₀≤r → ‖spectralPhysicalValueMap (Z r)‖ ≤ M) + (hL2p : IntegrableOn (fun r => r ^ 11 * + ‖(iteratedDeriv (n + 1) (fun s => spectralPhysicalValueMap (Z s)) r).1‖ ^ 2) (Ioi R₀)) + (hL2m : IntegrableOn (fun r => r ^ 11 * + ‖(iteratedDeriv (n + 1) (fun s => spectralPhysicalValueMap (Z s)) r).2‖ ^ 2) (Ioi R₀)) + (hB : ContDiffOn ℝ ∞ homogeneousLogRadialDamping (Ioi L)) + (hC : ContDiffOn ℝ ∞ + (homogeneousLogRadialStiffness νp νm eta m (fun t => Q (Real.exp t))) (Ioi L)) + (hrow : ∀ᶠ t in atTop, ∀ w : V, + c * Real.exp (2 * (n : ℝ) * t) * ‖w‖ ≤ + ‖(homogeneousEulerRows homogeneousLogRadialDamping + (homogeneousLogRadialStiffness νp νm eta m (fun s => Q (Real.exp s))) + (n + 1)).2 t w‖) + (hrem : ∃ K : ℝ, 0 ≤ K ∧ ∀ᶠ t in atTop, + spectralValueDet (spectralPhysicalValueMap (Zp (Real.exp t))) + (spectralPhysicalValueMap (Zm (Real.exp t))) ≠ 0 ∧ + ‖spectralTwoColumns + (homogeneousEulerDeriv (fun s => spectralPhysicalValueMap (Zp (Real.exp s))) (n + 1) t) + (homogeneousEulerDeriv (fun s => spectralPhysicalValueMap (Zm (Real.exp s))) (n + 1) t) * + spectralValueInverse (spectralPhysicalValueMap (Zp (Real.exp t))) + (spectralPhysicalValueMap (Zm (Real.exp t)))‖ ≤ K) + (herr : ∃ M : ℝ, 0 ≤ M ∧ ∀ᶠ r in atTop, + ‖spectralJetRobin (Zp r) (Zm r) - r⁻¹ • homogeneousDiagonal νp νm‖ ≤ M / r ^ 3) + (R : ℝ) (hR : R₀ ≤ R) : + ∃ a : V, Z R = a.1 • Zp R + a.2 • Zm R := by + let U := fun r => spectralPhysicalValueMap (Z r) + let Vd := fun r => spectralPhysicalDerivativeMap (Z r) + let A := fun r => spectralJetRobin (Zp r) (Zm r) + let W := homogeneousRadialDefect A U Vd + let logU := fun t => U (Real.exp t) + let logV := fun t => Real.exp t • Vd (Real.exp t) + let up := fun t => spectralPhysicalValueMap (Zp (Real.exp t)) + let um := fun t => spectralPhysicalValueMap (Zm (Real.exp t)) + let dp := fun t => Real.exp t • spectralPhysicalDerivativeMap (Zp (Real.exp t)) + let dm := fun t => Real.exp t • spectralPhysicalDerivativeMap (Zm (Real.exp t)) + let C := homogeneousLogRadialStiffness νp νm eta m (fun t => Q (Real.exp t)) + have hrad (t : ℝ) (ht : L < t) : R₀ ≤ Real.exp t := by + rw [← Real.exp_log hR₀] + exact Real.exp_le_exp.mpr (hL.trans ht.le) + have hlogs (S : ℝ → V₄) + (hS : ∀ r, R₀ ≤ r → HasDerivAt S + (spectralPhysicalCircularField νp νm eta m (Q r) r (S r)) r) + (t : ℝ) (ht : L < t) := + homogeneousPhysicalRadial_logEquation νp νm eta m Q + (fun r => spectralPhysicalValueMap (S r)) + (fun r => spectralPhysicalDerivativeMap (S r)) t + (homogeneousPhysicalState_pair_derivatives νp νm eta m _ S _ (hS _ (hrad t ht))).1 + (homogeneousPhysicalState_pair_derivatives νp νm eta m _ S _ (hS _ (hrad t ht))).2 + have hAscale (t : ℝ) : spectralRobinOperator (up t) (um t) (dp t) (dm t) = + Real.exp t • A (Real.exp t) := + homogeneousRobin_smul_derivatives _ _ _ _ _ + obtain ⟨K, hK, hremK⟩ := hrem + obtain ⟨M, hM, hMbound⟩ := hbounded + let T := (homogeneousEulerRows homogeneousLogRadialDamping C (n + 1)).2 + let Rem := fun t => spectralTwoColumns (homogeneousEulerDeriv up (n + 1) t) + (homogeneousEulerDeriv um (n + 1) t) * spectralValueInverse (up t) (um t) + have hid : ∀ᶠ t in atTop, homogeneousEulerDeriv logU (n + 1) t = + T t (Real.exp t • W (Real.exp t)) + Rem t (U (Real.exp t)) := by + filter_upwards [hremK, eventually_gt_atTop L] with t ht hLt + have hh := homogeneousEulerRows_defect_identity homogeneousLogRadialDamping C + up um dp dm logU logV L hB hC + (fun t ht => (hlogs Zp hZp t ht).1) (fun t ht => (hlogs Zm hZm t ht).1) + (fun t ht => (hlogs Zp hZp t ht).2) (fun t ht => (hlogs Zm hZm t ht).2) + (fun t ht => (hlogs Z hZ t ht).1) (fun t ht => (hlogs Z hZ t ht).2) + (n + 1) t hLt ht.1 + have hw : logV t - spectralRobinOperator (up t) (um t) (dp t) (dm t) (logU t) = + Real.exp t • W (Real.exp t) := by + rw [hAscale] + simp only [logV, logU, W, homogeneousRadialDefect, smul_apply, smul_sub] + simpa only [hw] using hh + have hcomp := homogeneousOutgoingRows_tail_comparison U W T Rem n c K M R₀ hR₀ + hU hc hK hM hMbound hrow (hremK.mono fun _ h => h.2) hid + have hd : ∀ᶠ r in atTop, spectralValueDet (spectralPhysicalValueMap (Zp r)) + (spectralPhysicalValueMap (Zm r)) ≠ 0 := by + filter_upwards [Real.tendsto_log_atTop.eventually hremK, + eventually_gt_atTop (0 : ℝ)] with r hr hr0 + simpa only [Real.exp_log hr0] using hr.1 + obtain ⟨R₁, hR₁⟩ := eventually_atTop.mp hd + let R₂ := max R₀ R₁ + have hW (r : ℝ) (hr : R₂ ≤ r) : HasDerivAt W + (-(homogeneousRadialDamping r + A r) (W r)) r := by + have hr₀ := (le_max_left R₀ R₁).trans hr + have hp := homogeneousPhysicalState_pair_derivatives νp νm eta m _ Zp r (hZp r hr₀) + have hm := homogeneousPhysicalState_pair_derivatives νp νm eta m _ Zm r (hZm r hr₀) + have hu := homogeneousPhysicalState_pair_derivatives νp νm eta m _ Z r (hZ r hr₀) + exact homogeneousRadialDefect_from_columns _ _ _ _ _ _ U Vd r hp.1 hm.1 hp.2 hm.2 + (hR₁ r ((le_max_right R₀ R₁).trans hr)) hu.1 hu.2 + have hwzero := homogeneousOutgoingDefect_eventually_zero νp νm hν A W + (fun r => (iteratedDeriv (n + 1) U r).1) + (fun r => (iteratedDeriv (n + 1) U r).2) R₂ n (4 / c ^ 2) + ((4 / c ^ 2) * (K * M) ^ 2) (n + 1) + (hR₀.trans_le (le_max_left _ _)) (by positivity) hbeta hgap hW herr hcomp + (hL2p.mono_set (Ioi_subset_Ioi (le_max_left R₀ R₁))) + (hL2m.mono_set (Ioi_subset_Ioi (le_max_left R₀ R₁))) + have hout : ∀ᶠ r in atTop, ∃ a : V, Z r = a.1 • Zp r + a.2 • Zm r := by + filter_upwards [hwzero, hd] with r hw hd' + apply (spectralJetRobin_plane _ _ _ hd').1 + exact sub_eq_zero.mp hw + obtain ⟨T', ⟨a, ha⟩, hT'⟩ := (hout.and (eventually_ge_atTop R)).exists + refine ⟨a, homogeneousPhysicalOutgoingPlane_backward νp νm eta m Q Z Zp Zm R T' + (hR₀.trans_le hR) hT' ?_ ?_ ?_ ?_ a ha⟩ + · exact hQ.mono (fun _ hr => hR.trans hr.1) + · exact fun _ hr => hZ _ (hR.trans hr.1) + · exact fun _ hr => hZp _ (hR.trans hr.1) + · exact fun _ hr => hZm _ (hR.trans hr.1) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailPowerBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailPowerBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..74ebb07c3f33ed51d62353faea0cb4a0bf136af8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailPowerBounds.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralParameterShearLogJets +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEulerPhysical +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousOutgoingEstimates + +namespace OAI + +/-! Bounds for every physical radial derivative from the normalized logarithmic jets. -/ + +open Set Filter Topology +open scoped ContDiff +namespace DefocusingNLS +local notation "V" => ℂ × ℂ + +noncomputable def spectralPowerValues (νp νm : ℂ) (f g : ℝ → ℂ) (r : ℝ) : V := + homogeneousPhysicalLogColumn νp νm f g (Real.log r) + +theorem spectralPowerValues_smooth (νp νm : ℂ) (f g : ℝ → ℂ) (L : ℝ) + (hf : ContDiffOn ℝ ∞ f (Ioi L)) (hg : ContDiffOn ℝ ∞ g (Ioi L)) : + ContDiffOn ℝ ∞ (spectralPowerValues νp νm f g) (Ioi (Real.exp L)) := by + have hlog : ContDiffOn ℝ ∞ Real.log (Ioi (Real.exp L)) := + Real.contDiffOn_log.mono (fun r hr => (lt_trans (Real.exp_pos L) hr).ne') + have hmap : MapsTo Real.log (Ioi (Real.exp L)) (Ioi L) := by + intro r hr + simpa only [mem_Ioi,Real.log_exp] using + Real.log_lt_log (Real.exp_pos L) hr + have hfp := hf.comp hlog hmap + have hgp := hg.comp hlog hmap + have hEp : ContDiffOn ℝ ∞ (fun r : ℝ => Complex.exp (νp*(Real.log r : ℂ))) + (Ioi (Real.exp L)) := + Complex.contDiff_exp.comp_contDiffOn + (contDiffOn_const.mul (Complex.ofRealCLM.contDiff.comp_contDiffOn hlog)) + have hEm : ContDiffOn ℝ ∞ (fun r : ℝ => Complex.exp (νm*(Real.log r : ℂ))) + (Ioi (Real.exp L)) := + Complex.contDiff_exp.comp_contDiffOn + (contDiffOn_const.mul (Complex.ofRealCLM.contDiff.comp_contDiffOn hlog)) + exact (hEp.mul hfp).prodMk (hEm.mul hgp) + +theorem spectralPowerValues_derivative_bound (νp νm : ℂ) (hsame : νp.re=νm.re) + (f g : ℝ → ℂ) (σ : ℝ) (hf : HasLogJetBound σ f) (hg : HasLogJetBound σ g) + (n : ℕ) : + ∃ C : ℝ, 0≤C ∧ ∀ᶠ r in atTop, + ‖iteratedDeriv n (spectralPowerValues νp νm f g) r‖ ≤ + C*r^(νp.re+σ-(n : ℝ)) := by + obtain ⟨Lf,hfs⟩ := hf.smooth + obtain ⟨Lg,hgs⟩ := hg.smooth + let L := max Lf Lg + have hfl := hfs.mono (Ioi_subset_Ioi (le_max_left Lf Lg)) + have hgl := hgs.mono (Ioi_subset_Ioi (le_max_right Lf Lg)) + have hU := spectralPowerValues_smooth νp νm f g L hfl hgl + have hE := (homogeneousNormalizedEuler_bound_order νp f σ hf n).pair + (homogeneousNormalizedEuler_bound_order νm g σ hg n) + obtain ⟨C,hC,hbound⟩ := hE.bound 0 + refine ⟨C,hC,?_⟩ + have hlogbound := Real.tendsto_log_atTop.eventually hbound + filter_upwards [hlogbound,eventually_gt_atTop (Real.exp L)] with r hr hrL + have hr₀ : 0 spectralPowerValues νp νm f g (Real.exp s))= + homogeneousPhysicalLogColumn νp νm f g := by + funext s + simp only [spectralPowerValues,Real.log_exp] + rw [heq,homogeneousPhysicalLogColumn_euler νp νm f g L hfl hgl n t ht] at hphys + have hnp : ‖Complex.exp (νp*(t : ℂ))‖=Real.exp (νp.re*t) := by + simp only [Complex.norm_exp,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,mul_zero,sub_zero] + have hnm : ‖Complex.exp (νm*(t : ℂ))‖=Real.exp (νp.re*t) := by + simpa only [hsame] using (show ‖Complex.exp (νm*(t : ℂ))‖=Real.exp (νm.re*t) by + simp only [Complex.norm_exp,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,mul_zero,sub_zero]) + have hn := congrArg norm hphys + rw [homogeneousDiagonal_norm _ _ _ (Real.exp_pos _).le hnp hnm,norm_smul, + Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] at hn + simp only [iteratedDeriv_zero] at hr + have hr' : ‖homogeneousNormalizedEulerColumn νp νm f g n t‖≤C*Real.exp (σ*t) := hr + have hprod : Real.exp ((n : ℝ)*t)* + ‖iteratedDeriv n (spectralPowerValues νp νm f g) (Real.exp t)‖ ≤ + C*Real.exp ((νp.re+σ)*t) := by + rw [← hn] + calc + _ ≤ Real.exp (νp.re*t)*(C*Real.exp (σ*t)) := + mul_le_mul_of_nonneg_left hr' (Real.exp_pos _).le + _ = _ := by rw [add_mul,Real.exp_add]; ring + have hout : ‖iteratedDeriv n (spectralPowerValues νp νm f g) (Real.exp t)‖ ≤ + C*Real.exp ((νp.re+σ-(n : ℝ))*t) := by + apply (mul_le_mul_iff_right₀ (Real.exp_pos ((n : ℝ)*t))).mp + calc + _ ≤ C*Real.exp ((νp.re+σ)*t) := by simpa only [mul_comm] using hprod + _ = _ := by + calc + C*Real.exp ((νp.re+σ)*t) = + C*Real.exp ((n : ℝ)*t+(νp.re+σ-(n : ℝ))*t) := by congr 2; ring + _ = _ := by rw [Real.exp_add]; ring + simpa only [t,Real.exp_log hr₀,Real.rpow_def_of_pos hr₀,mul_comm] using hout + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailRows.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..c516e214da2954dc76576febc8cbd7716e5c41e9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTailRows.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousOutgoingRadialRows +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTailEulerPhysical + +namespace OAI + +/-! The physical row comparison only needs smoothness and boundedness on a tail. -/ + +open Set Filter Topology +open scoped ContDiff +namespace DefocusingNLS +local notation "V" => ℂ × ℂ +local notation "End" => V →L[ℂ] V + +theorem homogeneousOutgoingRows_tail_comparison + (U W : ℝ → V) (T R : ℝ → End) (n : ℕ) (c K M : ℝ) + (R₀ : ℝ) (hR₀ : 0 U (Real.exp s)) (n + 1) t = + T t (Real.exp t • W (Real.exp t)) + R t (U (Real.exp t))) : + ∀ᶠ r in atTop, r ^ (2 * (n : ℝ)) * homogeneousPairEnergy (W r) ≤ + (4 / c ^ 2) * homogeneousPairEnergy (iteratedDeriv (n + 1) U r) + + (4 / c ^ 2) * (K * M) ^ 2 * r ^ (-2 * ((n + 1 : ℕ) : ℝ)) := by + have hall := hrow.and (hR.and hid) + have hlog := Real.tendsto_log_atTop.eventually hall + filter_upwards [hlog, eventually_gt_atTop R₀] with r h hr₁ + have hr : 0 ℂ × ℂ + +theorem spectral_tail_top_integrable (U : ℝ → V) (N : ℕ) (R s : ℝ) + (hU : ContDiffOn ℝ ∞ U (Ioi R)) (hs : 11+2*s < -1) + (hb : ∃ C : ℝ, 0≤C ∧ ∀ᶠ r in atTop, ‖iteratedDeriv N U r‖≤C*r^s) : + ∃ T : ℝ, R r^11*‖iteratedDeriv N U r‖^2) (Ioi T) := by + obtain ⟨C,hC,hb⟩ := hb + obtain ⟨B,hB⟩ := eventually_atTop.mp hb + let T := max R (max B 1)+1 + have hRT : R r^11*‖iteratedDeriv N U r‖^2) (Ioi T) := + (continuousOn_id.pow 11).mul + (((hc.mono (Ioi_subset_Ioi hRT.le)).norm).pow 2) + refine ⟨T,hRT,hT,?_⟩ + have hi := (integrableOn_Ioi_rpow_of_lt hs hT₀).const_mul (C^2) + apply hi.mono' (hcT.aestronglyMeasurable measurableSet_Ioi) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + have hr₀ : 0 r^11*‖iteratedDeriv N (spectralPowerValues νp νm f g) r‖^2) + (Ioi T) := by + obtain ⟨Lf,hfs⟩ := hf.smooth + obtain ⟨Lg,hgs⟩ := hg.smooth + have hU := spectralPowerValues_smooth νp νm f g (max Lf Lg) + (hfs.mono (Ioi_subset_Ioi (le_max_left _ _))) + (hgs.mono (Ioi_subset_Ioi (le_max_right _ _))) + obtain ⟨T,_,hT,hi⟩ := spectral_tail_top_integrable _ N _ _ hU hs + (spectralPowerValues_derivative_bound νp νm hsame f g σ hf hg N) + exact ⟨T,hT,hi⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTerminalResidualBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTerminalResidualBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b874ad3665fe94799a17654064f5a86d284556a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTerminalResidualBound.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarTerminalDuhamel + +namespace OAI + +/-! A terminal comparison error is controlled by the integral of the scaled +residual and a bound for the true Cauchy data. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralScalar_terminal_residual_bound + (R E kr A B : ℝ) (hRE : R ≤ E) (hkr : 0 ≤ kr) (_hA : 0 ≤ A) (hB : 0 ≤ B) + (D U q : ℝ → ℂ × ℂ) (W : ℂ) (e : ℝ → ℂ) (k : ℝ → ℝ) + (hD : ContinuousOn D (Icc R E)) (hU : ContinuousOn U (Icc R E)) + (hq : ContinuousOn q (Icc R E)) (he : ContinuousOn e (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ t ∈ Icc R E, 0 < k t) + (hkernel : ∀ t ∈ Icc R E, + spectralShellNorm kr (spectralScalarTransferKernel D U W R t) ≤ A/k t) + (hqbound : ∀ t ∈ Icc R E, spectralShellNorm (k t) (q t) ≤ B) : + spectralShellNorm kr + (∫ t in R..E, (e t*(q t).1) • spectralScalarTransferKernel D U W R t) ≤ + A*B*(∫ t in R..E, ‖e t‖/(k t)^2) := by + have hK : ContinuousOn (fun t => spectralScalarTransferKernel D U W R t) (Icc R E) := + ((hD.fst.div_const W).smul continuousOn_const).sub + ((hU.fst.div_const W).smul continuousOn_const) + have hg : ContinuousOn (fun t => A*B*(‖e t‖/(k t)^2)) (Icc R E) := + continuousOn_const.mul (he.norm.div (hk.pow 2) (fun t ht => pow_ne_zero _ (hk0 t ht).ne')) + have hval (t : ℝ) (ht : t ∈ Icc R E) : ‖(q t).1‖ ≤ B/k t := + (spectralShellNorm_value (k t) (hk0 t ht) (q t)).trans + (div_le_div_of_nonneg_right (hqbound t ht) (hk0 t ht).le) + have hb := spectralShellNorm_integral_bound R E kr hRE hkr + (fun t => (e t*(q t).1) • spectralScalarTransferKernel D U W R t) + (fun t => A*B*(‖e t‖/(k t)^2)) ((he.mul hq.fst).smul hK) hg (by + intro t ht + have hkt := hk0 t ht + rw [spectralShellNorm_smul,norm_mul] + calc + _ = ‖e t‖*(‖(q t).1‖*spectralShellNorm kr (spectralScalarTransferKernel D U W R t)) := by ring + _ ≤ ‖e t‖*((B/k t)*(A/k t)) := mul_le_mul_of_nonneg_left + (mul_le_mul (hval t ht) (hkernel t ht) + (spectralShellNorm_nonneg kr hkr _) (by positivity)) (norm_nonneg _) + _ = A*B*(‖e t‖/(k t)^2) := by ring) + rw [intervalIntegral.integral_const_mul] at hb + exact hb + +theorem spectralScalar_terminal_comparison_error + (R E A B : ℝ) (hRE : R ≤ E) (hA : 0 ≤ A) (hB : 0 ≤ B) + (D U q : ℝ → ℂ × ℂ) (V e : ℝ → ℂ) (W : ℂ) (k : ℝ → ℝ) + (hDc : ContinuousOn D (Icc R E)) (hUc : ContinuousOn U (Icc R E)) + (hqc : ContinuousOn q (Icc R E)) (hec : ContinuousOn e (Icc R E)) + (hkc : ContinuousOn k (Icc R E)) (hk : ∀ t ∈ Icc R E, 0 < k t) + (hW : W ≠ 0) (hdet : ∀ t ∈ Icc R E, spectralScalarWronskian (D t) (U t) = W) + (hD : ∀ t ∈ Ioo R E, HasDerivAt D (spectralScalarField (V t) (D t)) t) + (hU : ∀ t ∈ Ioo R E, HasDerivAt U (spectralScalarField (V t) (U t)) t) + (hq : ∀ t ∈ Ioo R E, HasDerivAt q + (spectralScalarField (V t) (q t)+(0,e t*(q t).1)) t) + (hkernel : ∀ t ∈ Icc R E, + spectralShellNorm (k R) (spectralScalarTransferKernel D U W R t) ≤ A/k t) + (hqbound : ∀ t ∈ Icc R E, spectralShellNorm (k t) (q t) ≤ B) : + spectralShellNorm (k R) + (q R - ((spectralScalarWronskian (q E) (U E)/W) • D R + + (spectralScalarWronskian (D E) (q E)/W) • U R)) ≤ + A*B*(∫ t in R..E, ‖e t‖/(k t)^2) := by + have hrep := spectralScalar_terminal_representation R E D U q V + (fun t => e t*(q t).1) W hDc hUc hqc (hec.mul hqc.fst) hW hdet hD hU hq R ⟨le_rfl,hRE⟩ + have herr : q R - ((spectralScalarWronskian (q E) (U E)/W) • D R + + (spectralScalarWronskian (D E) (q E)/W) • U R) = + -(∫ t in R..E, (e t*(q t).1) • spectralScalarTransferKernel D U W R t) := by + rw [hrep] + abel + rw [herr,spectralShellNorm_neg] + exact spectralScalar_terminal_residual_bound R E (k R) A B hRE + (hk R ⟨le_rfl,hRE⟩).le hA hB D U q W e k hDc hUc hqc hec hkc hk hkernel hqbound + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTestPrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTestPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..6be222907db87612caeeeb8dd73a99126eea021f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTestPrimitive.lean @@ -0,0 +1,53 @@ +import Mathlib.Analysis.Distribution.AEEqOfIntegralContDiff +import Mathlib.Analysis.Calculus.ContDiff.Deriv +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! Compactly supported primitives for the radial weak-flux equation. -/ + +open Set MeasureTheory +open scoped ContDiff +namespace DefocusingNLS + +theorem spectralTestPrimitive (a b : ℝ) (ψ : ℝ → ℝ) + (hψ : ContDiff ℝ ∞ ψ) (hs : Function.support ψ ⊆ Ioo a b) + (hz : ∫ x, ψ x = 0) : + ∃ Φ : ℝ → ℝ, ContDiff ℝ ∞ Φ ∧ HasCompactSupport Φ ∧ + tsupport Φ ⊆ Icc a b ∧ ∀ x, deriv Φ x = ψ x := by + let Φ := fun t => ∫ x in a..t, ψ x + have hd (t : ℝ) : HasDerivAt Φ (ψ t) t := + intervalIntegral.integral_hasDerivAt_right (hψ.continuous.intervalIntegrable a t) + hψ.continuous.aestronglyMeasurable.stronglyMeasurableAtFilter hψ.continuous.continuousAt + have he : deriv Φ=ψ := funext (fun t => (hd t).deriv) + have hc : ContDiff ℝ ∞ Φ := contDiff_infty_iff_deriv.mpr + ⟨fun t => (hd t).differentiableAt,by simpa only [he] using hψ⟩ + have hzero (t : ℝ) (ht : t ∉ Icc a b) : Φ t=0 := by + rcases not_and_or.mp ht with ht | ht + · have hta : t < a := lt_of_not_ge ht + change (∫ x in a..t, ψ x)=0 + rw [intervalIntegral.integral_symm] + have hi : (∫ x in t..a, ψ x)=0 := by + calc + (∫ x in t..a, ψ x) = ∫ _ in t..a, (0 : ℝ) := by + apply intervalIntegral.integral_congr_Ioo_of_le hta.le + intro x hx + apply Function.notMem_support.mp + intro hxs + exact (not_lt_of_ge (hs hxs).1.le) hx.2 + _ = 0 := intervalIntegral.integral_zero + rw [hi,neg_zero] + · have hbt : b < t := lt_of_not_ge ht + change (∫ x in a..t, ψ x)=0 + rw [intervalIntegral.integral_eq_integral_of_support_subset + (fun x hx => ⟨(hs hx).1,(hs hx).2.le.trans hbt.le⟩),hz] + have hsup : Function.support Φ ⊆ Icc a b := by + intro t ht + by_contra h + exact ht (hzero t h) + exact ⟨Φ,hc,HasCompactSupport.of_support_subset_isCompact isCompact_Icc hsup, + closure_minimal hsup isClosed_Icc,fun t => (hd t).deriv⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e17f72662b0153dbc274e70ec2e84aa1e63a3afe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionBounds.lean @@ -0,0 +1,54 @@ +import Mathlib.Analysis.SpecialFunctions.ExpDeriv +import Mathlib.Topology.Order.Basic + +namespace OAI + +/-! Join estimates from the forbidden, central, and oscillatory regions +without comparing the actions of distinct scalar channels. -/ + +open Set +namespace DefocusingNLS + +noncomputable def spectralTruncatedAction (a : ℝ) (H : ℝ → ℝ) (r : ℝ) : ℝ := + if r ≤ a then H r else 0 + +theorem spectralTruncatedAction_antitone (R a E : ℝ) (hRa : R ≤ a) (_haE : a ≤ E) + (H : ℝ → ℝ) (hH : AntitoneOn H (Icc R a)) (ha : H a = 0) : + AntitoneOn (spectralTruncatedAction a H) (Icc R E) := by + intro r hr s hs hrs + by_cases hsa : s ≤ a + · have hra := hrs.trans hsa + simp only [spectralTruncatedAction,ite_eq_left hsa,ite_eq_left hra] + exact hH ⟨hr.1,hra⟩ ⟨hs.1,hsa⟩ hrs + · by_cases hra : r ≤ a + · simp only [spectralTruncatedAction,ite_eq_right hsa,ite_eq_left hra] + exact ha ▸ hH ⟨hr.1,hra⟩ ⟨hRa,le_rfl⟩ hra + · simp only [spectralTruncatedAction,ite_eq_right hsa,ite_eq_right hra,le_refl] + +theorem spectralThreeRegion_bound (R a b E A C D B : ℝ) + (_hRa : R ≤ a) (hab : a ≤ b) (_hbE : b ≤ E) + (_hA : 0 ≤ A) (hC : 0 ≤ C) (hD : 1 ≤ D) (hB : 0 ≤ B) + (N H : ℝ → ℝ) (_ha : H a = 0) + (hleft : ∀ r ∈ Icc R a, N r ≤ A*Real.exp (H r)*B) + (hcentral : ∀ r ∈ Icc a b, N r ≤ C*B) + (hright : ∀ r ∈ Icc b E, N r ≤ D*N b) : + ∀ r ∈ Icc R E, + N r ≤ max A (C*D)*Real.exp (spectralTruncatedAction a H r)*B := by + intro r hr + by_cases hra : r ≤ a + · simp only [spectralTruncatedAction,ite_eq_left hra] + exact (hleft r ⟨hr.1,hra⟩).trans (by gcongr; exact le_max_left _ _) + · simp only [spectralTruncatedAction,ite_eq_right hra,Real.exp_zero,mul_one] + by_cases hrb : r ≤ b + · have hCD : C ≤ C*D := by nlinarith + exact (hcentral r ⟨le_of_not_ge hra,hrb⟩).trans + (mul_le_mul_of_nonneg_right (hCD.trans (le_max_right _ _)) hB) + · calc + N r ≤ D*N b := hright r ⟨le_of_not_ge hrb,hr.2⟩ + _ ≤ D*(C*B) := mul_le_mul_of_nonneg_left (hcentral b ⟨hab,le_rfl⟩) (by linarith) + _ = (C*D)*B := by ring + _ ≤ max A (C*D)*B := mul_le_mul_of_nonneg_right (le_max_right _ _) hB + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionGreen.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionGreen.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a241deb386c157fbf96d09b4f8969893ff1b45b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionGreen.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralThreeRegionTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralDirichletGreenScaled +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralOutgoingExtensionBound + +namespace OAI + +/-! Extend the Dirichlet/outgoing construction across a turning interval and +the oscillatory region. No exponential comparison between channels is needed. -/ + +open Set +namespace DefocusingNLS + +theorem spectralScalar_three_region_green_and_extension (R a b E A C D c : ℝ) + (hRa : R ≤ a) (hab : a ≤ b) (hbE : b ≤ E) + (hA : 0 ≤ A) (hC : 0 ≤ C) (hD : 1 ≤ D) (hc : 0 < c) + (V : ℝ → ℂ) (k H : ℝ → ℝ) + (hV : ContinuousOn V (Icc R E)) (hk : ∀ r ∈ Icc R E, 0 < k r) + (hH : AntitoneOn H (Icc R a)) (ha : H a = 0) + (U : ℝ → ℂ × ℂ) (hUc : ContinuousOn U (Icc R E)) + (hUD : ∀ r ∈ Ioo R E, HasDerivAt U (spectralScalarField (V r) (U r)) r) + (hN : 0 < spectralShellNorm (k a) (U a)) + (hvalue : c*Real.exp (H R)*spectralShellNorm (k a) (U a) ≤ k R*‖(U R).1‖) + (hleft : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc R a, + spectralShellNorm (k r) (q r) ≤ A*Real.exp (H R-H r)*spectralShellNorm (k R) (q R) ∧ + spectralShellNorm (k r) (q r) ≤ A*Real.exp (H r)*spectralShellNorm (k a) (q a)) + (hcentral : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc a b, spectralShellNorm (k r) (q r) ≤ C*spectralShellNorm (k a) (q a)) + (hright : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc b E, spectralShellNorm (k r) (q r) ≤ D*spectralShellNorm (k b) (q b)) : + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y R = (0,(k R : ℂ)) ∧ + (∀ r ∈ Icc R E, HasDerivAt Y (spectralScalarField (V r) (Y r)) r) ∧ + W ≠ 0 ∧ (∀ r ∈ Icc R E, spectralScalarWronskian (Y r) (U r) = W) ∧ + (∀ r ∈ Icc R E, ∀ t ∈ Icc R E, + spectralShellNorm (k r) (spectralScalarGreenState Y U W r t) ≤ + max A (C*A*D)*max A (C*D)/(c*k t)) ∧ + ∀ z : ℂ, ∀ r ∈ Icc R E, + spectralShellNorm (k r) ((z/(U R).1) • U r) ≤ (max A (C*D)/c)*k R*‖z‖ := by + let N := spectralShellNorm (k a) (U a) + let G := spectralTruncatedAction a H + have hRE : R ≤ E := hRa.trans (hab.trans hbE) + have hGR : G R = H R := by simp only [G,spectralTruncatedAction,ite_eq_left hRa] + have hUb : ∀ r ∈ Icc R E, spectralShellNorm (k r) (U r) ≤ max A (C*D)*N*Real.exp (G r) := by + intro r hr + have hh := spectralThreeRegion_bound R a b E A C D N hRa hab hbE hA hC hD hN.le + (fun t => spectralShellNorm (k t) (U t)) H ha + (fun t ht => (hleft U hUc hUD t ht).2) (hcentral U hUc hUD) (hright U hUc hUD) r hr + convert hh using 1 + ring + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hYb,hWb,hgreen⟩ := + spectralScalar_dirichlet_green_scaled_data R E (max A (C*A*D)) (max A (C*D)) c N + hRE (hA.trans (le_max_left _ _)) (hA.trans (le_max_left _ _)) hc hN V k G hV hk + (spectralTruncatedAction_antitone R a E hRa (hab.trans hbE) H hH ha) U hUc hUD hUb + (by rw [hGR]; simpa only [N,mul_assoc,mul_left_comm,mul_comm] using hvalue) + (by + intro q hq hqD r hr + rw [hGR] + exact spectralThreeRegion_forward R a b E A C D hRa hab hbE hA hC hD + (fun t => spectralShellNorm (k t) (q t)) H + (spectralShellNorm_nonneg _ (hk R ⟨le_rfl,hRE⟩).le _) ha + (fun t ht => (hleft q hq hqD t ht).1) (hcentral q hq hqD) (hright q hq hqD) r hr) + refine ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,?_⟩ + intro z r hr + apply spectralOutgoing_extension_bound (k r) (k R) (max A (C*D)) c N (G r) (G R) + (U r) (U R) z (hA.trans (le_max_left _ _)) hc hN + · exact spectralTruncatedAction_antitone R a E hRa (hab.trans hbE) H hH ha + ⟨le_rfl,hRE⟩ hr hr.1 + · exact hUb r hr + · rw [hGR] + simpa only [N,mul_assoc,mul_left_comm,mul_comm] using hvalue + +theorem spectralScalar_three_region_green (R a b E A C D c : ℝ) + (hRa : R ≤ a) (hab : a ≤ b) (hbE : b ≤ E) + (hA : 0 ≤ A) (hC : 0 ≤ C) (hD : 1 ≤ D) (hc : 0 < c) + (V : ℝ → ℂ) (k H : ℝ → ℝ) + (hV : ContinuousOn V (Icc R E)) (hk : ∀ r ∈ Icc R E, 0 < k r) + (hH : AntitoneOn H (Icc R a)) (ha : H a = 0) + (U : ℝ → ℂ × ℂ) (hUc : ContinuousOn U (Icc R E)) + (hUD : ∀ r ∈ Ioo R E, HasDerivAt U (spectralScalarField (V r) (U r)) r) + (hN : 0 < spectralShellNorm (k a) (U a)) + (hvalue : c*Real.exp (H R)*spectralShellNorm (k a) (U a) ≤ k R*‖(U R).1‖) + (hleft : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc R a, + spectralShellNorm (k r) (q r) ≤ A*Real.exp (H R-H r)*spectralShellNorm (k R) (q R) ∧ + spectralShellNorm (k r) (q r) ≤ A*Real.exp (H r)*spectralShellNorm (k a) (q a)) + (hcentral : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc a b, spectralShellNorm (k r) (q r) ≤ C*spectralShellNorm (k a) (q a)) + (hright : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc R E) → + (∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (V r) (q r)) r) → + ∀ r ∈ Icc b E, spectralShellNorm (k r) (q r) ≤ D*spectralShellNorm (k b) (q b)) : + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y R = (0,(k R : ℂ)) ∧ + (∀ r ∈ Icc R E, HasDerivAt Y (spectralScalarField (V r) (Y r)) r) ∧ + W ≠ 0 ∧ (∀ r ∈ Icc R E, spectralScalarWronskian (Y r) (U r) = W) ∧ + ∀ r ∈ Icc R E, ∀ t ∈ Icc R E, + spectralShellNorm (k r) (spectralScalarGreenState Y U W r t) ≤ + max A (C*A*D)*max A (C*D)/(c*k t) := by + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,_⟩ := + spectralScalar_three_region_green_and_extension R a b E A C D c hRa hab hbE + hA hC hD hc V k H hV hk hH ha U hUc hUD hN hvalue hleft hcentral hright + exact ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd85e4ca289a3b842149a584e34a19671983ac68 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralThreeRegionTransfer.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralThreeRegionBounds + +namespace OAI + +/-! Propagate an endpoint state and an outgoing state with separate constants, +retaining the action only on the forbidden part of the interval. -/ + +open Set +namespace DefocusingNLS + +theorem spectralThreeRegion_forward (R a b E A C D : ℝ) + (hRa : R ≤ a) (hab : a ≤ b) (hbE : b ≤ E) + (hA : 0 ≤ A) (hC : 0 ≤ C) (hD : 1 ≤ D) + (N H : ℝ → ℝ) (hNR : 0 ≤ N R) (ha : H a = 0) + (hleft : ∀ r ∈ Icc R a, N r ≤ A*Real.exp (H R-H r)*N R) + (hcentral : ∀ r ∈ Icc a b, N r ≤ C*N a) + (hright : ∀ r ∈ Icc b E, N r ≤ D*N b) : + ∀ r ∈ Icc R E, N r ≤ max A (C*A*D)* + Real.exp (H R-spectralTruncatedAction a H r)*N R := by + have haN : N a ≤ A*(Real.exp (H R)*N R) := by + simpa only [ha,sub_zero,mul_assoc] using hleft a ⟨hRa,le_rfl⟩ + have hcN (r : ℝ) (hr : r ∈ Icc a b) : N r ≤ (C*A)*(Real.exp (H R)*N R) := by + calc + N r ≤ C*N a := hcentral r hr + _ ≤ C*(A*(Real.exp (H R)*N R)) := mul_le_mul_of_nonneg_left haN hC + _ = _ := by ring + have hh := spectralThreeRegion_bound R a b E A (C*A) D (Real.exp (H R)*N R) + hRa hab hbE hA (mul_nonneg hC hA) hD (mul_nonneg (Real.exp_pos _).le hNR) + N (fun r => -H r) (by simp only [ha,neg_zero]) + (fun r hr => by + convert hleft r hr using 1 + rw [Real.exp_sub,Real.exp_neg] + field_simp + ) hcN hright + intro r hr + have he : spectralTruncatedAction a (fun s => -H s) r = -spectralTruncatedAction a H r := by + unfold spectralTruncatedAction + split_ifs <;> simp only [neg_zero] + have hb := hh r hr + rw [he] at hb + convert hb using 1 + rw [Real.exp_sub,Real.exp_neg] + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionGrowth.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ce64e5bdb6064c83bd2901702480f3b8135371b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionGrowth.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFluxMargin + +namespace OAI + +/-! The forbidden action tends to infinity with the turning radius, already +on the segment between the fixed shell and half the turning radius. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_far_momentum_re_lower (h b eta omega gamma r₀ r : ℝ) + (heta : 0 ≤ eta) (hr₀ : 0 < r₀) (hr : 0 < r) (hrr : r ≤ r₀/2) + (hz : homogeneousSpectralLocalizationFrequency h b eta omega r₀ = 0) : + r₀/16 ≤ (spectralLiouvilleMomentum (-1) h b eta omega gamma r).re := by + let F := homogeneousSpectralLocalizationFrequency h b eta omega r + let p := spectralLiouvilleMomentum (-1) h b eta omega gamma r + have hfar := (spectralTurning_forbidden_far h b eta omega r₀ r heta hr₀ hr hrr hz).1 + have hFp : 0 < -F := by dsimp only [F]; nlinarith [sq_pos_of_pos hr₀] + have he : spectralWKBSquaredMomentum (-1) F gamma = ((-F : ℝ) : ℂ)+Complex.I*((-gamma : ℝ) : ℂ) := by + dsimp only [spectralWKBSquaredMomentum] + push_cast + ring + have hre : (2/3 : ℝ)*‖p‖ ≤ p.re := by + dsimp only [p,spectralLiouvilleMomentum] + rw [he] + exact spectralComplexSqrt_re_two_thirds (-F) (-gamma) hFp + have hsq : ‖p‖^2 = ‖spectralWKBSquaredMomentum (-1) F gamma‖ := spectralComplexSqrt_norm_sq _ + have hnorm : -F ≤ ‖p‖^2 := (neg_le_abs F).trans (by + rw [hsq] + exact spectralWKBSquaredMomentum_norm_lower (-1) F gamma (by norm_num)) + have hplower : r₀/8 ≤ ‖p‖ := by nlinarith [norm_nonneg p] + change r₀/16 ≤ p.re + linarith + +theorem spectralTurning_forbidden_action_lower (h b eta omega gamma r₀ R E : ℝ) + (heta : 0 ≤ eta) (hr₀ : 0 < r₀) (hR : 0 < R) + (hRfour : R ≤ r₀/4) (hEhalf : r₀/2 ≤ E) (hEturn : E < r₀) + (hz : homogeneousSpectralLocalizationFrequency h b eta omega r₀ = 0) : + r₀^2/64 ≤ (∫ t in R..E, spectralLiouvilleMomentum (-1) h b eta omega gamma t).re := by + let p := spectralLiouvilleMomentum (-1) h b eta omega gamma + have hRE : R ≤ E := by linarith + have hRh : R ≤ r₀/2 := by linarith + have hF (t : ℝ) (ht : t ∈ Icc R E) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h b eta omega t := by + have hh := homogeneousSpectralLocalizationFrequency_strictMono h b eta omega heta + (hR.trans_le ht.1) hr₀ (ht.2.trans_lt hEturn) + rw [hz] at hh + linarith + have hpc : ContinuousOn p (Icc R E) := fun t ht => + (spectralLiouvilleMomentum_hasDerivAt (-1) h b eta omega gamma t + (hR.trans_le ht.1) (hF t ht)).continuousAt.continuousWithinAt + have hrc : ContinuousOn (fun t => (p t).re) (Icc R E) := + Complex.continuous_re.comp_continuousOn hpc + have hi₁ : IntervalIntegrable (fun t => (p t).re) volume R (r₀/2) := + (hrc.mono (Icc_subset_Icc le_rfl hEhalf)).intervalIntegrable_of_Icc hRh + have hi₂ : IntervalIntegrable (fun t => (p t).re) volume (r₀/2) E := + (hrc.mono (Icc_subset_Icc hRh le_rfl)).intervalIntegrable_of_Icc hEhalf + have hlow : (r₀/2-R)*(r₀/16) ≤ ∫ t in R..r₀/2, (p t).re := by + calc + _ = ∫ _t in R..r₀/2, r₀/16 := by + simp only [intervalIntegral.integral_const,smul_eq_mul] + _ ≤ _ := intervalIntegral.integral_mono_on hRh intervalIntegrable_const hi₁ + (fun t ht => spectralTurning_far_momentum_re_lower h b eta omega gamma r₀ t + heta hr₀ (hR.trans_le ht.1) ht.2 hz) + have hpos : 0 ≤ ∫ t in r₀/2..E, (p t).re := intervalIntegral.integral_nonneg hEhalf + (fun t _ => spectralComplexSqrt_re_nonneg _) + have hadd := intervalIntegral.integral_add_adjacent_intervals hi₁ hi₂ + have hreal : (∫ t in R..E, p t).re = ∫ t in R..E, (p t).re := by + exact (intervalIntegral.intervalIntegral_re (hpc.intervalIntegrable_of_Icc hRE)).symm + change r₀^2/64 ≤ (∫ t in R..E, p t).re + rw [hreal] + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..6112955b55b6542ef1b9889cddc0ec668afc4d7e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningActionLimit.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningActionGrowth +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit + +namespace OAI + +/-! The forbidden action diverges along every escaping turning radius, +for any fixed inner radius and fixed Airy observation point. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_forbidden_action_tendsto + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (R M : ℝ) (hR : 0 < R) (hM : 0 < M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1) : + Tendsto (fun n => (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re) + atTop atTop := by + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have hlarge : ∀ᶠ n in atTop, (r₀ n)^2/64 ≤ + (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re := by + filter_upwards [hdata,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max (4*R) (2*M)))] with n hn hdn hrn + have hdp : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hsc := hn.2.2.2.2 + rw [← he] at hsc + norm_num at hsc + exact spectralTurning_forbidden_action_lower h (b n) (eta n) (omega n) (gamma n) + (r₀ n) R (r₀ n-M*d n) hn.2.2.1 hn.1 hR + (by linarith [le_trans (le_max_left (4*R) (2*M)) hrn]) + (by nlinarith [le_trans (le_max_right (4*R) (2*M)) hrn]) + (by nlinarith) hn.2.2.2.1 + have hsq := (tendsto_pow_atTop (by decide : (2 : ℕ) ≠ 0)).comp hr₀ + have hbound : Tendsto (fun n => (r₀ n)^2/64) atTop atTop := + Filter.Tendsto.atTop_div_const (by norm_num) hsq + rw [tendsto_atTop] + intro A + filter_upwards [hlarge,hbound.eventually (eventually_ge_atTop A)] with n hn hAn + exact hAn.trans hn + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryCoefficient.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2c83302c8dbc12047dd62f2caf69694a2199230 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryCoefficient.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformLimit + +namespace OAI + +/-! The reflected coefficient converges to the Airy coefficient on every +fixed compact interval, with no symmetry restriction on its endpoints. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurningAiryCoefficient_uniform_limit + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (a c G : ℝ) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + TendstoUniformlyOn + (fun n t => spectralTurningCoefficient h (b n) (eta n) (omega n) + (gamma n) (r₀ n) (d n) (-t)) + (fun t => -(t : ℂ)) atTop (Icc a c) := by + let M := max |a| |c| + have hM : 0 ≤ M := (abs_nonneg a).trans (le_max_left _ _) + have ha : -M ≤ a := (neg_le_neg (le_max_left |a| |c|)).trans (neg_abs_le a) + have hc : c ≤ M := (le_abs_self c).trans (le_max_right _ _) + have hu := spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d M G hM hr₀ hdata + rw [Metric.tendstoUniformlyOn_iff] + intro eps heps + filter_upwards [(Metric.tendstoUniformlyOn_iff.mp hu) eps heps] with n hn t ht + have hm : -t ∈ Icc (-M) M := by constructor <;> linarith [ht.1,ht.2] + simpa only [Complex.ofReal_neg] using hn (-t) hm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryHalfLineLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryHalfLineLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f67d40786c29fba6fa80d54200a0796f2a5ce9f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryHalfLineLimit.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryLimit + +namespace OAI + +/-! One limiting Airy solution works on every fixed compact interval. Local +uniqueness makes the independently obtained interval limits agree. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurningAiry_halfLine_limit + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (a R G : ℝ) + (q : ℕ → ℝ → ℂ × ℂ) (x : ℂ × ℂ) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (hq : ∀ᶠ n in atTop, Continuous (q n) ∧ ∀ r ∈ Icc R (2*r₀ n), + HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) r : ℂ) + + Complex.I*(gamma n : ℂ)) (q n r)) r) + (hinit : Tendsto (fun n => + spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) a) atTop (𝓝 x)) : + ∃ p : ℝ → ℂ × ℂ, Continuous p ∧ p a = x ∧ + (∀ t, a ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) ∧ + ∀ c : ℝ, TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) + p atTop (Icc a c) := by + obtain ⟨p,hp,hpa,hpD,_⟩ := spectralTurningAiry_cauchy_limit h b eta omega gamma r₀ d + a a R G q x hr₀ hdata hq hinit + refine ⟨p,hp,hpa,hpD,?_⟩ + intro c + obtain ⟨u,hu,hua,huD,hlim⟩ := spectralTurningAiry_cauchy_limit h b eta omega gamma r₀ d + a c R G q x hr₀ hdata hq hinit + apply hlim.congr_right + intro t ht + apply spectralScalar_unique_right a t ht.1 (fun s => -(s : ℂ)) (by fun_prop) + u p hu.continuousOn hp.continuousOn + · exact fun s hs => huD s hs.1.le + · exact fun s hs => hpD s hs.1.le + · exact hua.trans hpa.symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2005e307d6ba8eb00cfcfeb57bcc51876828c0d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryLimit.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryCoefficient +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryState +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarHalfLineExistence +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarUniformDependence + +namespace OAI + +/-! Actual rescaled scalar solutions converge to one Airy solution whenever +their Cauchy data at the left endpoint converge. The equation is inherited +from the original radial equation, rather than assumed for the limit. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurningAiry_cauchy_limit + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (a c R G : ℝ) + (q : ℕ → ℝ → ℂ × ℂ) (x : ℂ × ℂ) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (hq : ∀ᶠ n in atTop, Continuous (q n) ∧ ∀ r ∈ Icc R (2*r₀ n), + HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) r : ℂ) + + Complex.I*(gamma n : ℂ)) (q n r)) r) + (hinit : Tendsto (fun n => + spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) a) atTop (𝓝 x)) : + ∃ p : ℝ → ℂ × ℂ, Continuous p ∧ p a = x ∧ + (∀ t, a ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) ∧ + TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) + p atTop (Icc a c) := by + obtain ⟨p,hp,hpa,hpD⟩ := spectralScalar_halfLine_exists a (fun t => -(t : ℂ)) + (by fun_prop) x + refine ⟨p,hp,hpa,hpD,?_⟩ + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + let M := max |a| |c| + have hM : 0 ≤ M := (abs_nonneg a).trans (le_max_left _ _) + have ha : -M ≤ a := (neg_le_neg (le_max_left |a| |c|)).trans (neg_abs_le a) + have hc : c ≤ M := (le_abs_self c).trans (le_max_right _ _) + have hstate : ∀ᶠ n in atTop, + ContinuousOn (spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) (Icc a c) ∧ + ∀ t ∈ Icc a c, HasDerivAt + (spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) + (spectralScalarField + (spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) (-t)) + (spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) t)) t := by + filter_upwards [hdata,hq,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max (R + M) M))] with n hn hqn hd1 hrn + have hdn : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have heq := hn.2.2.2.2.2 + rw [← he] at heq + norm_num at heq + refine ⟨(spectralTurningAiryState_continuous _ _ _ _ hqn.1).continuousOn,?_⟩ + intro t ht + have htM : |t| ≤ M := abs_le.mpr ⟨ha.trans ht.1,ht.2.trans hc⟩ + have hprod : |d n*t| ≤ M := by + rw [abs_mul,abs_of_nonneg hn.2.1] + exact (mul_le_mul_of_nonneg_left htM hn.2.1).trans (by nlinarith) + have hpoint : r₀ n - d n*t ∈ Icc R (2*r₀ n) := by + have hleft := (le_max_left (R+M) M).trans hrn + have hright := (le_max_right (R+M) M).trans hrn + constructor <;> linarith [(abs_le.mp hprod).1,(abs_le.mp hprod).2] + exact spectralTurningAiryState_hasDerivAt h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) (Real.sqrt (d n)) t (Real.sqrt_pos.mpr hdn).ne' + (Real.sq_sqrt hn.2.1) (q n) (hqn.2 _ hpoint) + apply spectralScalar_uniform_dependence a c + (fun n t => spectralTurningCoefficient h (b n) (eta n) (omega n) + (gamma n) (r₀ n) (d n) (-t)) (fun t => -(t : ℂ)) + (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) p + (by fun_prop) hp.continuousOn (fun t ht => hpD t ht.1) hstate + (spectralTurningAiryCoefficient_uniform_limit h b eta omega gamma r₀ d a c G hr₀ hdata) + simpa only [hpa] using hinit + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryNonzero.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryNonzero.lean new file mode 100644 index 0000000000000000000000000000000000000000..b46cc9c989da8b4988889256aa4b4bfcfd797479 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryNonzero.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOutgoingFlux +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOutgoingAiry + +namespace OAI + +/-! The actual outgoing comparison has a nonzero Airy limit. The cutoff is +chosen from the explicit WKB error before extracting a subsequence. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_airy_nonzero + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (M : ℝ) (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ) (p : ℝ → ℂ × ℂ), + 32 ≤ M ∧ StrictMono φ ∧ Continuous p ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + (∀ t, -M ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) ∧ + spectralTurningFluxBase/2 ≤ -h*spectralScalarFlux (p 1) ∧ + ∀ c : ℝ, TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ (φ n)) (d (φ n)) + (Real.sqrt (d (φ n))) (q (φ n))) p atTop (Icc (-M) c) := by + obtain ⟨M,hM,hflux⟩ := spectralTurning_eventual_outgoing_flux ell h b omega gamma r₀ d E R + hh hr₀ hdata + obtain ⟨q,φ,p,hφ,hp,hq,hpD,hlim⟩ := spectralTurning_outgoing_airy_limit ell h b omega gamma r₀ d E M R + hh hM hR hr₀ hdata + have hqflux := hflux q (hq.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.2⟩)) + have hpflux : spectralTurningFluxBase/2 ≤ -h*spectralScalarFlux (p (-M)) := by + apply ge_of_tendsto ((spectralScalarFlux_continuous.continuousAt.tendsto.comp + ((hlim (-M)).tendsto_at ⟨le_rfl,le_rfl⟩)).const_mul (-h)) + filter_upwards [hφ.tendsto_atTop.eventually hqflux,hφ.tendsto_atTop.eventually hdata] with n hn hdn + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hdn.2.1 + intro he + have hs := hdn.2.2.2.2.2.2.2.2 + rw [← he] at hs + norm_num at hs + dsimp only [Function.comp_def] + rw [spectralTurningAiryState_flux _ _ _ _ (Real.sqrt_pos.mpr hdp).ne'] + have he : r₀ (φ n)-d (φ n)*(-M) = r₀ (φ n)+M*d (φ n) := by ring + rw [he] + nlinarith + have heq := spectralScalarFlux_const (-M) 1 p (fun t => -t) hp.continuousOn + (fun t ht => by simpa only [Complex.ofReal_neg] using hpD t ht.1.le) + 1 ⟨by linarith,le_rfl⟩ + refine ⟨M,q,φ,p,hM,hφ,hp,hq,hpD,?_,hlim⟩ + simpa only [heq] using hpflux + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc031c5492af994b0cd5c152e58e0d3ee5f9b2c3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryProjection.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningProjectionLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryState +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralAiryGrowingMargin + +namespace OAI + +/-! Nonzero limiting flux supplies a fixed growing-mode margin for the +actual rescaled WKB projection at every sufficiently late fixed Airy point. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_eventual_growing_projection + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (a G : ℝ) (ha : a ≤ 1) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (q : ℕ → ℝ → ℂ × ℂ) (p : ℝ → ℂ × ℂ) (hp : Continuous p) + (hpD : ∀ t, a ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) + (hpJ : spectralScalarFlux (p 1) ≠ 0) + (hlim : ∀ c : ℝ, TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) p atTop (Icc a c)) : + ∀ᶠ T : ℝ in atTop, ∀ᶠ n in atTop, + let u := spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) T + let P := (d n : ℂ)*spectralLiouvilleMomentum (-1) h (b n) (eta n) + (omega n) (gamma n) (r₀ n-d n*T) + let A := ((d n)^3*spectralLiouvilleSlope (eta n) (r₀ n-d n*T) : ℝ) + (1/8 : ℝ)*spectralShellNorm (Real.sqrt ‖P‖) u ≤ + ‖(u.2+(P+(A : ℂ)/(4*P^2))*u.1)/(2*Complex.sqrt P)‖ := by + have hmargin := spectralAiry_eventual_growing_margin p 1 le_rfl hp.continuousOn + (fun t ht => hpD t (ha.trans ht)) hpJ + filter_upwards [hmargin,eventually_ge_atTop (1 : ℝ)] with T hTmargin hT + have hTp : 0 < T := by linarith + have hJT : spectralScalarFlux (p T) ≠ 0 := by + rw [spectralScalarFlux_const 1 T p (fun t => -t) hp.continuousOn + (fun t ht => by simpa only [Complex.ofReal_neg] using hpD t (ha.trans ht.1.le)) + T ⟨hT,le_rfl⟩] + exact hpJ + exact spectralTurning_growing_projection_margin h b eta omega gamma r₀ d T G hTp hr₀ hdata + (p T) (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) T) + hJT ((hlim T).tendsto_at ⟨ha.trans hT,le_rfl⟩) hTmargin + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryState.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryState.lean new file mode 100644 index 0000000000000000000000000000000000000000..6332fb54c99058a6dd32e32aa9ff0160961e0e12 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAiryState.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningState +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningCoefficient +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarReflection +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarFlux + +namespace OAI + +/-! Reflected turning-point coordinates put the forbidden side on the +positive Airy half-line. Reflection reverses the conserved flux. -/ + +namespace DefocusingNLS + +noncomputable def spectralTurningAiryState (r₀ d s : ℝ) + (q : ℝ → ℂ × ℂ) : ℝ → ℂ × ℂ := + spectralScalarReflect 0 0 (spectralTurningState r₀ d s q) + +theorem spectralTurningAiryState_continuous (r₀ d s : ℝ) + (q : ℝ → ℂ × ℂ) (hq : Continuous q) : + Continuous (spectralTurningAiryState r₀ d s q) := by + apply spectralScalarReflect_continuous + have hc : Continuous (fun t => q (r₀ + d * t)) := + hq.comp (continuous_const.add (continuous_const.mul continuous_id)) + exact (hc.fst.div_const (s : ℂ)).prodMk (hc.snd.const_mul (s : ℂ)) + +theorem spectralTurningAiryState_hasDerivAt + (h b eta omega gamma r₀ d s t : ℝ) (hs : s ≠ 0) (hsq : s^2 = d) + (q : ℝ → ℂ × ℂ) + (hq : HasDerivAt q (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h b eta omega (r₀ - d*t) : ℂ) + + Complex.I*(gamma : ℂ)) (q (r₀ - d*t))) (r₀ - d*t)) : + HasDerivAt (spectralTurningAiryState r₀ d s q) + (spectralScalarField + (spectralTurningCoefficient h b eta omega gamma r₀ d (-t)) + (spectralTurningAiryState r₀ d s q t)) t := by + have he : r₀ + d * (-t) = r₀ - d*t := by ring + have hd := spectralTurningState_hasDerivAt r₀ d s (-t) hs hsq q + ((homogeneousSpectralLocalizationFrequency h b eta omega (r₀-d*t) : ℂ) + + Complex.I*(gamma : ℂ)) (by simpa only [he] using hq) + have hr := spectralScalarReflect_hasDerivAt 0 0 t + (spectralTurningState r₀ d s q) + ((d : ℂ)^2*((homogeneousSpectralLocalizationFrequency h b eta omega (r₀-d*t) : ℂ) + + Complex.I*(gamma : ℂ))) (by simpa only [zero_add,zero_sub] using hd) + simpa only [spectralTurningAiryState,spectralTurningCoefficient, + Complex.ofReal_pow,he] using hr + +theorem spectralTurningAiryState_flux (r₀ d s t : ℝ) (hs : s ≠ 0) + (q : ℝ → ℂ × ℂ) : + spectralScalarFlux (spectralTurningAiryState r₀ d s q t) = + -spectralScalarFlux (q (r₀-d*t)) := by + simp only [spectralScalarFlux,spectralTurningAiryState,spectralScalarReflect, + zero_add,zero_sub,mul_neg,Complex.neg_im] + rw [spectralTurningState_flux r₀ d s (-t) hs q] + simp only [mul_neg,sub_eq_add_neg] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAirySubsequence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAirySubsequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bcb9470087650e9f592dc3213d05b7bca2d1aed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningAirySubsequence.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryHalfLineLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningDataBound +import Mathlib.Topology.Sequences + +namespace OAI + +/-! Compact rescaled outgoing data produce one limiting Airy solution and a +single subsequence on all fixed observation intervals. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurningAiry_subsequence + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M R G C : ℝ) (hM : 0 < M) + (q : ℕ → ℝ → ℂ × ℂ) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (hq : ∀ᶠ n in atTop, Continuous (q n) ∧ ∀ r ∈ Icc R (2*r₀ n), + HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) r : ℂ) + + Complex.I*(gamma n : ℂ)) (q n r)) r) + (hbound : ∀ᶠ n in atTop, spectralShellNorm + (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) (gamma n) + (r₀ n+d n*M)‖) (q n (r₀ n+d n*M)) ≤ C) : + ∃ (φ : ℕ → ℕ) (p : ℝ → ℂ × ℂ), StrictMono φ ∧ Continuous p ∧ + (∀ t, -M ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) ∧ + ∀ c : ℝ, TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ (φ n)) (d (φ n)) + (Real.sqrt (d (φ n))) (q (φ n))) p atTop (Icc (-M) c) := by + obtain ⟨B,hB⟩ := spectralTurning_rescaled_data_bounded h b eta omega gamma r₀ d M G C + hM q hr₀ hdata hbound + let v := fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) (-M) + have hmem : ∀ᶠ n in atTop, v n ∈ Metric.closedBall (0 : ℂ × ℂ) B := by + filter_upwards [hB] with n hn + simpa only [Metric.mem_closedBall,dist_zero_right] using hn + obtain ⟨x,_,φ,hφ,hx⟩ := (isCompact_closedBall (0 : ℂ × ℂ) B).tendsto_subseq' hmem.frequently + obtain ⟨p,hp,_,hpD,hlim⟩ := spectralTurningAiry_halfLine_limit h + (fun n => b (φ n)) (fun n => eta (φ n)) (fun n => omega (φ n)) + (fun n => gamma (φ n)) (fun n => r₀ (φ n)) (fun n => d (φ n)) + (-M) R G (fun n => q (φ n)) x (hr₀.comp hφ.tendsto_atTop) + (hφ.tendsto_atTop.eventually hdata) (hφ.tendsto_atTop.eventually hq) hx + exact ⟨φ,p,hφ,hp,hpD,hlim⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundaryCoercive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundaryCoercive.lean new file mode 100644 index 0000000000000000000000000000000000000000..31a19631ef8b64b93aac9a56221672ce3e251b22 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundaryCoercive.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningBoundarySlope +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRobinCoercive + +namespace OAI + +/-! Every normalized outgoing scalar comparison has a strictly inward +logarithmic slope on a fixed inner sphere along an escaping turn. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_normalized_inward + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ᶠ n in atTop, + ∀ U : ℝ → ℂ × ℂ, ContinuousOn U (Icc R (E (φ n))) → + (∀ r ∈ Icc R (E (φ n)), HasDerivAt U (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) + (U r)) r) → + U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) → + ((U R).2/(U R).1).re ≤ -(1/24 : ℝ)*‖spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) R‖ := by + obtain ⟨φ,hφ,hslope⟩ := spectralTurning_normalized_slope + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨φ,hφ,?_⟩ + filter_upwards [hslope (1/2) (by norm_num),hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop (max (2*R) (64/R)))] + with n hsn hdn hlarge + intro U hUc hUD hUE + obtain ⟨hU0,hUn⟩ := hsn U hUc hUD hUE + change max (2*R) (64/R) ≤ r₀ (φ n) at hlarge + have hRh : R ≤ r₀ (φ n)/2 := by linarith [(le_max_left (2*R) (64/R)).trans hlarge] + have h64 : 64 ≤ r₀ (φ n)*R := by + have hh := mul_le_mul_of_nonneg_right ((le_max_right (2*R) (64/R)).trans hlarge) hR.le + rwa [div_mul_cancel₀ _ hR.ne'] at hh + apply spectralTurning_inner_robin_coercive h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) R (by positivity) hdn.1 hR hRh h64 + hdn.2.2.2.2.2.2.2.1 (U R) hU0 + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) R + let c := p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/(4*p^2) + change ‖(U R).2+c*(U R).1‖ ≤ (1/2 : ℝ)*‖p‖*‖(U R).1‖ + rw [show (U R).2+c*(U R).1 = ((U R).2/(U R).1+c)*(U R).1 by field_simp [hU0]] + rw [norm_mul] + exact mul_le_mul_of_nonneg_right hUn (norm_nonneg _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySlope.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySlope.lean new file mode 100644 index 0000000000000000000000000000000000000000..73d004f043290c01c5b88c7883e1527b5b96053d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySlope.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningInnerCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarTerminalUniqueness + +namespace OAI + +/-! The turning-channel logarithmic derivative estimate applies to every +comparison solution with the normalized outgoing terminal data. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_normalized_slope + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ eps : ℝ, 0 < eps → ∀ᶠ n in atTop, + ∀ U : ℝ → ℂ × ℂ, ContinuousOn U (Icc R (E (φ n))) → + (∀ r ∈ Icc R (E (φ n)), HasDerivAt U (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) + (U r)) r) → + U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) → + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) R + (U R).1 ≠ 0 ∧ + ‖(U R).2/(U R).1+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/(4*p^2))‖ ≤ + eps*‖p‖ := by + obtain ⟨q,φ,hφ,hq,hcone⟩ := spectralTurning_outgoing_relative_cone + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨φ,hφ,?_⟩ + intro eps heps + filter_upwards [hcone eps heps,hφ.tendsto_atTop.eventually hq, + hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop R)] with n hcn hqn hdn hlarge + intro U hUc hUD hUE + change R ≤ r₀ (φ n) at hlarge + have hRE : R ≤ E (φ n) := by linarith [hdn.1,hdn.2.2.2.2.2.1] + let V := fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ) + have hV : ContinuousOn V (Icc R (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun r hr => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r + (hR.trans_le hr.1)).continuousAt.continuousWithinAt)).add continuousOn_const + have heq : q (φ n) R = U R := spectralScalar_unique_left R (E (φ n)) hRE V hV + (q (φ n)) U hqn.1.continuousOn hUc + (fun r hr => hqn.2.2.2 r ⟨hr.1.le,hr.2.le⟩) + (fun r hr => hUD r ⟨hr.1.le,hr.2.le⟩) (hqn.2.1.trans hUE.symm) + dsimp only at hcn ⊢ + rw [heq] at hcn + refine ⟨hcn.1,?_⟩ + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) R + let c := p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/(4*p^2) + change ‖(U R).2/(U R).1+c‖ ≤ eps*‖p‖ + rw [show (U R).2/(U R).1+c = ((U R).2+c*(U R).1)/(U R).1 by + field_simp [hcn.1]] + rw [norm_div] + exact (div_le_iff₀ (norm_pos_iff.mpr hcn.1)).mpr hcn.2 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySystem.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..f69101fee228774183eed9c48da4dfef09b6bb6e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningBoundarySystem.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGreenFamily +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNormalizedBoundarySystem + +namespace OAI + +/-! The constructed turning comparison supplies a scalar boundary system +and a uniform extension bound, ready for coupled absorption. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_boundary_systems + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, + ∃ S : SpectralScalarBoundarySystem R (E (φ n)) K, + S.k = spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) ∧ + S.V = (fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) ∧ + S.beta = (h : ℂ)*Complex.I*(Real.sqrt (homogeneousSpectralLocalizationFrequency h + (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) : ℂ) ∧ + S.U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) ∧ + ∀ z : ℂ, ∀ r ∈ Icc R (E (φ n)), + spectralShellNorm (S.k r) (S.extension z r) ≤ J*S.k R*‖z‖ := by + obtain ⟨q,φ,hφ,hq,K,J,hK,hJ,hall⟩ := spectralTurning_outgoing_green_extension_uniform + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨φ,K,J,hφ,hK,hJ,?_⟩ + filter_upwards [hall,hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop R)] with n hn hqn hdn hlarge + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,hext⟩ := hn + obtain ⟨hrp,hd,hb,hb1,hg,hRE',hscale,hroot,hdscale⟩ := hdn + change R ≤ r₀ (φ n) at hlarge + have hRE : R ≤ E (φ n) := by linarith + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hd + intro he + rw [← he] at hdscale + norm_num at hdscale + let k := spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) + let V := fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ) + have hk : ContinuousOn k (Icc R (E (φ n))) := + (spectralTurningRegularizedWeight_continuousOn h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n))).mono + (fun r hr => hR.trans_le hr.1) + have hkp : ∀ r ∈ Icc R (E (φ n)), 0 < k r := fun r _ => + spectralTurningRegularizedWeight_pos h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) r hdp + let S := spectralNormalizedBoundarySystem R (E (φ n)) K h + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) hRE + k V Y (q (φ n)) W hk hkp hYc.continuousOn hqn.1.continuousOn hYD hqn.2.2.2 + hYR hqn.2.1 hW hdet hgreen + exact ⟨S,rfl,rfl,rfl,hqn.2.1,hext⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIData.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIData.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fbd5b5a53e5757b4a5a8af321aa034bd3c805ff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIData.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRootRemote + +namespace OAI + +/-! Actual turning data for an angular-dominated parameter sequence. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectralTurningRoot_caseI_data + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma E : ℕ → ℝ) + (hh : h^2 = 1) + (hescape : Tendsto (fun n => ((ell n : ℝ)*(ell n+10))/(1+omega n)) atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 ≤ b n ∧ b n ≤ 1 ∧ 0 ≤ omega n ∧ + |gamma n| ≤ 8 ∧ 0 < E n ∧ (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n)) : + let r₀ := fun n => spectralTurningRoot h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) + let d := fun n => spectralTurningRootScale ((ell n : ℝ)*(ell n+10)) (r₀ n) + Tendsto r₀ atTop atTop ∧ Tendsto d atTop (𝓝 0) ∧ + (∀ n, 0 < d n) ∧ + ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1 := by + dsimp only + let r₀ := fun n => spectralTurningRoot h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) + let d := fun n => spectralTurningRootScale ((ell n : ℝ)*(ell n+10)) (r₀ n) + have hr : ∀ n, 0 < r₀ n ∧ homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 := fun n => + spectralTurningRoot_data h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (by positivity) + have hd : ∀ n, 0 < d n ∧ spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) + (r₀ n)*(d n)^3 = 1 := fun n => + spectralTurningRootScale_data _ _ (by positivity) (hr n).1 + have hha : |h| ≤ 1 := by + rcases sq_eq_one_iff.mp hh with rfl | rfl <;> norm_num + have hrTop : Tendsto r₀ atTop atTop := spectralTurning_radius_escape_caseI h hha b + (fun n => (ell n : ℝ)*(ell n+10)) omega r₀ hescape (by + filter_upwards [hdata] with n hn + exact ⟨hn.2.1,by positivity,hn.2.2.1,(hr n).1,(hr n).2⟩) + have hd0 : Tendsto d atTop (𝓝 0) := spectralTurningScale_tendsto + (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hrTop (Eventually.of_forall (fun n => + ⟨(hr n).1,(hd n).1.le,by positivity,(hd n).2⟩)) + refine ⟨hrTop,hd0,fun n => (hd n).1,?_⟩ + filter_upwards [hdata] with n hn + exact ⟨(hr n).1,(hd n).1.le,hn.1,hn.2.1,hn.2.2.2.1, + spectralTurningRoot_remote (ell n) h (b n) (omega n) (E n) hha hn.1 hn.2.2.1 + hn.2.2.2.2.1 hn.2.2.2.2.2,hn.2.2.2.2.2,(hr n).2,(hd n).2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIIData.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIIData.lean new file mode 100644 index 0000000000000000000000000000000000000000..406e2286da967f5af23ef277ff328225135a7c6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCaseIIData.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningCaseIData +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningComparison + +namespace OAI + +/-! The positive channel turns and its Airy scale shrinks in Case II. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectralTurningRoot_caseII_data + (ell : ℕ → ℕ) (b omega gamma E : ℕ → ℝ) + (hw : Tendsto omega atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 ≤ b n ∧ b n ≤ 1 ∧ 0 ≤ omega n ∧ + |gamma n| ≤ 8 ∧ 0 < E n ∧ (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n)) : + let r₀ := fun n => spectralTurningRoot 1 (b n) ((ell n : ℝ)*(ell n+10)) (omega n) + let d := fun n => spectralTurningRootScale ((ell n : ℝ)*(ell n+10)) (r₀ n) + Tendsto r₀ atTop atTop ∧ Tendsto d atTop (𝓝 0) ∧ + (∀ n, 0 < d n) ∧ SpectralTurningFamilyData ell 1 b omega gamma r₀ d E := by + dsimp only + let r₀ := fun n => spectralTurningRoot 1 (b n) ((ell n : ℝ)*(ell n+10)) (omega n) + let d := fun n => spectralTurningRootScale ((ell n : ℝ)*(ell n+10)) (r₀ n) + have hr : ∀ n, 0 < r₀ n ∧ homogeneousSpectralLocalizationFrequency 1 (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 := fun n => + spectralTurningRoot_data 1 (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (by positivity) + have hd : ∀ n, 0 < d n ∧ spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) + (r₀ n)*(d n)^3 = 1 := fun n => + spectralTurningRootScale_data _ _ (by positivity) (hr n).1 + have hrTop : Tendsto r₀ atTop atTop := spectralTurning_radius_escape_caseII b + (fun n => (ell n : ℝ)*(ell n+10)) omega r₀ hw (by + filter_upwards [hdata] with n hn + exact ⟨hn.2.1,by positivity,(hr n).1,(hr n).2⟩) + have hd0 : Tendsto d atTop (𝓝 0) := spectralTurningScale_tendsto + (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hrTop (Eventually.of_forall (fun n => + ⟨(hr n).1,(hd n).1.le,by positivity,(hd n).2⟩)) + refine ⟨hrTop,hd0,fun n => (hd n).1,?_⟩ + filter_upwards [hdata] with n hn + exact ⟨(hr n).1,(hd n).1.le,hn.1,hn.2.1,hn.2.2.2.1, + spectralTurningRoot_remote (ell n) 1 (b n) (omega n) (E n) (by norm_num) hn.1 hn.2.2.1 + hn.2.2.2.2.1 hn.2.2.2.2.2,hn.2.2.2.2.2,(hr n).2,(hd n).2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..89df0c1383ad42fb59230700750ce6f07a6234cf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralTransfer.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarIntervalBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningWeightLimit + +namespace OAI + +/-! Uniform two-way transfer across the fixed central turning interval. +All Cauchy states are solutions of the actual rescaled Liouville equation. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_central_transfer + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G : ℝ) (hM : 0 < M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ᶠ n in atTop, + ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc (r₀ n-d n*M) (r₀ n+d n*M)) → + (∀ t ∈ Icc (r₀ n-d n*M) (r₀ n+d n*M), HasDerivAt q + (spectralScalarField ((homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) t : ℂ)+ + Complex.I*(gamma n : ℂ)) (q t)) t) → + let k := fun t => Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) (gamma n) t‖ + spectralShellNorm (k (r₀ n+d n*M)) (q (r₀ n+d n*M)) ≤ + C*spectralShellNorm (k (r₀ n-d n*M)) (q (r₀ n-d n*M)) ∧ + spectralShellNorm (k (r₀ n-d n*M)) (q (r₀ n-d n*M)) ≤ + C*spectralShellNorm (k (r₀ n+d n*M)) (q (r₀ n+d n*M)) := by + let k₀ := Real.sqrt (Real.sqrt M) + let low := k₀/2 + let up := 2*k₀ + let C := (up+low⁻¹)*max low⁻¹ up*Real.exp ((1+(M+1))*(M-(-M))) + have hk₀ : 0 < k₀ := Real.sqrt_pos.mpr (Real.sqrt_pos.mpr hM) + have hl : 0 < low := by dsimp only [low]; positivity + have hup : 0 ≤ up := by dsimp only [up]; positivity + refine ⟨C,by dsimp only [C]; positivity,?_⟩ + have hcoeff := spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d M G hM.le hr₀ hdata + have hplus := spectralTurning_weight_tendsto_at h b eta omega gamma r₀ d M G hr₀ hdata + have hminus := spectralTurning_weight_tendsto_at h b eta omega gamma r₀ d (-M) G hr₀ hdata + simp only [abs_neg,abs_of_pos hM] at hplus hminus + have hkl : low < k₀ := by dsimp only [low]; linarith + have hku : k₀ < up := by dsimp only [up]; linarith + filter_upwards [hdata, (Metric.tendstoUniformlyOn_iff.mp hcoeff) 1 (by norm_num), + hplus.eventually (lt_mem_nhds hkl),hplus.eventually (gt_mem_nhds hku), + hminus.eventually (lt_mem_nhds hkl),hminus.eventually (gt_mem_nhds hku)] + with n hn hc hpl hpu hml hmu + intro q hq hqD + let s := Real.sqrt (d n) + have hd : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hh := hn.2.2.2.2.2 + rw [← he] at hh + norm_num at hh + have hs : 0 < s := Real.sqrt_pos.mpr hd + have hs2 : s^2 = d n := Real.sq_sqrt hd.le + let Q := spectralTurningState (r₀ n) (d n) s q + let V := spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) + let k := fun t => Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) (gamma n) t‖ + have hmem (t : ℝ) (ht : t ∈ Icc (-M) M) : r₀ n+d n*t ∈ Icc (r₀ n-d n*M) (r₀ n+d n*M) := by + constructor <;> nlinarith [ht.1,ht.2] + have hQc : ContinuousOn Q (Icc (-M) M) := + ((hq.comp (continuous_const.add (continuous_const.mul continuous_id)).continuousOn hmem).fst.div_const _).prodMk + (continuousOn_const.mul (hq.comp (continuous_const.add (continuous_const.mul continuous_id)).continuousOn hmem).snd) + have hQD (t : ℝ) (ht : t ∈ Icc (-M) M) : HasDerivAt Q (spectralScalarField (V t) (Q t)) t := by + simpa only [Q,V,spectralTurningCoefficient,Complex.ofReal_pow] using + spectralTurningState_hasDerivAt (r₀ n) (d n) s t hs.ne' hs2 q _ (hqD _ (hmem t ht)) + have hV (t : ℝ) (ht : t ∈ Icc (-M) M) : ‖V t‖ ≤ M+1 := by + have he : ‖V t-(t : ℂ)‖ ≤ 1 := by + simpa only [V,dist_eq_norm,norm_sub_rev] using (hc t ht).le + have htM : |t| ≤ M := abs_le.mpr ht + have htN : ‖(t : ℂ)‖ ≤ M := by simpa only [Complex.norm_real,Real.norm_eq_abs] using htM + have hb := norm_add_le (V t-(t : ℂ)) (t : ℂ) + rw [sub_add_cancel] at hb + linarith + have hkL : 0 < k (r₀ n-d n*M) := by + change low < s*k (r₀ n+d n*(-M)) at hml + have he : r₀ n+d n*(-M) = r₀ n-d n*M := by ring + rw [he] at hml + nlinarith + have hkU : 0 < k (r₀ n+d n*M) := by + change low < s*k (r₀ n+d n*M) at hpl + nlinarith + have hminus_eq : r₀ n+d n*(-M) = r₀ n-d n*M := by ring + have hlt : low ≤ s*k (r₀ n-d n*M) := by simpa only [hminus_eq] using hml.le + have hut : s*k (r₀ n-d n*M) ≤ up := by simpa only [hminus_eq] using hmu.le + have ht := spectralScalar_interval_shell_bound (-M) M (M+1) low up + (s*k (r₀ n-d n*M)) (s*k (r₀ n+d n*M)) (by linarith) (by positivity) hl + hlt hut hpl.le hpu.le V Q hQc hQD hV + have hQL : spectralShellNorm (s*k (r₀ n-d n*M)) (Q (-M)) = + spectralShellNorm (k (r₀ n-d n*M)) (q (r₀ n-d n*M)) := by + simpa only [hminus_eq,Q] using spectralTurningState_shell_norm (r₀ n) (d n) s (-M) + (k (r₀ n+d n*(-M))) hs (by simpa only [hminus_eq] using hkL) q + have hQU : spectralShellNorm (s*k (r₀ n+d n*M)) (Q M) = + spectralShellNorm (k (r₀ n+d n*M)) (q (r₀ n+d n*M)) := + spectralTurningState_shell_norm (r₀ n) (d n) s M _ hs hkU q + simpa only [hQL,hQU] using ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralWeight.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..21fc67522a33389b413bdc0a762dbfb550eb8c2e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCentralWeight.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRegularizedWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformLimit + +namespace OAI + +/-! The continuous regularized frequency has fixed upper and lower bounds +on each scaled Airy interval, uniformly along the escaping sequence. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_central_weight_bounds + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G : ℝ) (hM : 0 ≤ M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + ∀ᶠ n in atTop, 0 < d n ∧ ∀ xi ∈ Icc (-M) M, + 1 ≤ Real.sqrt (d n)*spectralTurningRegularizedWeight h (b n) (eta n) (omega n) + (gamma n) (d n) (r₀ n+d n*xi) ∧ + Real.sqrt (d n)*spectralTurningRegularizedWeight h (b n) (eta n) (omega n) + (gamma n) (d n) (r₀ n+d n*xi) ≤ M+3 := by + have hu := spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d M G hM hr₀ hdata + filter_upwards [hdata,(Metric.tendstoUniformlyOn_iff.mp hu) 1 (by norm_num)] with n hn hc + have hd : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hh := hn.2.2.2.2.2 + rw [← he] at hh + norm_num at hh + refine ⟨hd,?_⟩ + intro xi hxi + apply spectralTurningRegularizedWeight_scaled_bounds h (b n) (eta n) (omega n) + (gamma n) (r₀ n) (d n) xi M hd hM + have he : ‖spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) xi- + (xi : ℂ)‖ ≤ 1 := by + simpa only [dist_eq_norm,norm_sub_rev] using (hc xi hxi).le + have hx : ‖(xi : ℂ)‖ ≤ M := by + simpa only [Complex.norm_real,Real.norm_eq_abs] using abs_le.mpr hxi + have hb := norm_add_le (spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) xi-(xi : ℂ)) (xi : ℂ) + rw [sub_add_cancel] at hb + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCoefficient.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..840d295cceef0b9579026d151c4a8893b2e8cfc3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCoefficient.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRescale +import Mathlib.Analysis.Complex.Basic + +namespace OAI + +/-! The actual complex Liouville coefficient converges to the Airy coefficient +on each fixed rescaled interval, with an explicit uniform error. -/ + +namespace DefocusingNLS + +noncomputable def spectralTurningCoefficient + (h b eta omega gamma r₀ d xi : ℝ) : ℂ := + (d^2 : ℝ)*(homogeneousSpectralLocalizationFrequency h b eta omega (r₀+d*xi)+ + Complex.I*(gamma : ℂ)) + +theorem spectralTurningCoefficient_bound (h b eta omega gamma r₀ d M xi : ℝ) + (hr₀ : 0 (homogeneousSpectralLocalizationFrequency h b eta omega r : ℂ)+ + Complex.I*(gamma : ℂ)) ∧ + S.beta = (h : ℂ)*Complex.I*(Real.sqrt + (homogeneousSpectralLocalizationFrequency h b eta omega E) : ℂ) ∧ + (∀ z : ℂ, ∀ r ∈ Icc R E, spectralShellNorm (S.k r) (S.extension z r) ≤ J*S.k R*‖z‖) ∧ + ((S.U R).2/(S.U R).1).re ≤ -(1/24 : ℝ)*(S.k R)^2 ∧ + S.U E = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h b eta omega E))) + +theorem SpectralTurningComparison.withBound {R E K : ℝ} + {S : SpectralScalarBoundarySystem R E K} {J h b eta omega gamma d : ℝ} + (hs : SpectralTurningComparison S J h b eta omega gamma d) + (K' J' : ℝ) (hK : K ≤ K') (hJ : J ≤ J') : + SpectralTurningComparison (S.withBound K' hK) J' h b eta omega gamma d := by + refine ⟨hs.1,hs.2.1,hs.2.2.1,?_,hs.2.2.2.2⟩ + intro z r hr + exact (hs.2.2.2.1 z r hr).trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right hJ + (S.positive_k R ⟨le_rfl,hr.1.trans hr.2⟩).le) (norm_nonneg _)) + +def SpectralTurningFamilyData (ell : ℕ → ℕ) (h : ℝ) + (b omega gamma r₀ d E : ℕ → ℝ) : Prop := + ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1 + +theorem spectralTurning_comparisons + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : SpectralTurningFamilyData ell h b omega gamma r₀ d E) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, + ∃ S : SpectralScalarBoundarySystem R (E (φ n)) K, + SpectralTurningComparison S J h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) (d (φ n)) := + spectralTurning_inward_systems ell h b omega gamma r₀ d E R hh hR hr₀ hdata + +theorem spectralTurning_paired_comparisons + (ell : ℕ → ℕ) (b omega gamma rp rm dp dm E : ℕ → ℝ) (R : ℝ) + (hR : 0 < R) (hrp : Tendsto rp atTop atTop) (hrm : Tendsto rm atTop atTop) + (hp : SpectralTurningFamilyData ell 1 b omega gamma rp dp E) + (hm : SpectralTurningFamilyData ell (-1) b omega (-gamma) rm dm E) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, + ∃ Sp Sm : SpectralScalarBoundarySystem R (E (φ n)) K, + SpectralTurningComparison Sp J 1 (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) (dp (φ n)) ∧ + SpectralTurningComparison Sm J (-1) (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (-gamma (φ n)) (dm (φ n)) := by + obtain ⟨φ,Kp,Jp,hφ,hKp,hJp,hplus⟩ := spectralTurning_comparisons ell 1 b omega gamma rp dp E R + (by norm_num) hR hrp hp + obtain ⟨ψ,Km,Jm,hψ,hKm,hJm,hminus⟩ := spectralTurning_comparisons (ell ∘ φ) (-1) + (b ∘ φ) (omega ∘ φ) ((-gamma) ∘ φ) (rm ∘ φ) (dm ∘ φ) (E ∘ φ) R + (by norm_num) hR (hrm.comp hφ.tendsto_atTop) (hφ.tendsto_atTop.eventually hm) + refine ⟨φ ∘ ψ,max Kp Km,max Jp Jm,hφ.comp hψ,hKp.trans (le_max_left _ _), + hJp.trans (le_max_left _ _),?_⟩ + filter_upwards [hψ.tendsto_atTop.eventually hplus,hminus] with n hpn hmn + obtain ⟨Sp,hsp⟩ := hpn + obtain ⟨Sm,hsm⟩ := hmn + exact ⟨Sp.withBound (max Kp Km) (le_max_left _ _), + Sm.withBound (max Kp Km) (le_max_right _ _), + hsp.withBound _ _ (le_max_left _ _) (le_max_left _ _), + hsm.withBound _ _ (le_max_right _ _) (le_max_right _ _)⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningComplexIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningComplexIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..0dd52dd276ca66381815b3313f41fc8ecd4311d7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningComplexIntegral.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveScale +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleResidualContinuity + +namespace OAI + +/-! The actual complex residual has the same parameter-uniform near-turn bound. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_complex_scaled_integral (h b eta omega gamma r₀ d M c : ℝ) + (heta : 0≤eta) (hr₀ : 0 + (homogeneousSpectralLocalizationFrequency_hasDerivAt h b eta omega t + (ht0 t ht)).continuousAt.continuousWithinAt + have hp : ContinuousOn (fun t => Real.sqrt (F t)) (Icc a c) := + Real.continuous_sqrt.comp_continuousOn hFc + have hpn (t : ℝ) (ht : t ∈ Icc a c) : Real.sqrt (F t)≠0 := + (Real.sqrt_pos.2 (hF0 t ht)).ne' + have hg : ContinuousOn (spectralLiouvilleSlope eta) (Icc a c) := fun t ht => + (spectralLiouvilleSlope_hasDerivAt eta t (ht0 t ht)).continuousAt.continuousWithinAt + have he : ContinuousOn (spectralLiouvilleSecond eta) (Icc a c) := by + apply continuousOn_const.sub + apply continuousOn_const.div (continuousOn_id.pow 4) + exact fun t ht => pow_ne_zero _ (ht0 t ht).ne' + have hreal : ContinuousOn (fun t => (5/16 : ℝ)*(spectralLiouvilleSlope eta t)^2/ + (Real.sqrt (F t))^5+|spectralLiouvilleSecond eta t|/(4*(Real.sqrt (F t))^3)) + (Icc a c) := ((continuousOn_const.mul (hg.pow 2)).div (hp.pow 5) + (fun t ht => pow_ne_zero _ (hpn t ht))).add + (he.abs.div (continuousOn_const.mul (hp.pow 3)) + (fun t ht => mul_ne_zero (by norm_num) (pow_ne_zero _ (hpn t ht)))) + have hcomplex := (spectralLiouvilleResidual_continuousOn 1 h b eta omega gamma a c + (by norm_num) ha0 (fun t ht => by simpa only [one_mul] using hF0 t ht)).2 + have hle := intervalIntegral.integral_mono_on (μ := volume) hac + (hcomplex.intervalIntegrable_of_Icc hac) (hreal.intervalIntegrable_of_Icc hac) + (fun t ht => by + have hh := spectralLiouville_weighted_residual_le 1 h b eta omega gamma t + (by norm_num) (hF0 t ht).ne' + have hFt : 0 by simpa only [neg_one_mul] using neg_pos.2 (hF t ht)) + have he : (∫ t in a..c, (5/16 : ℝ)*(spectralLiouvilleSlope eta t)^2/ + (Real.sqrt |homogeneousSpectralLocalizationFrequency h b eta omega t|)^5+ + |spectralLiouvilleSecond eta t|/ + (4*(Real.sqrt |homogeneousSpectralLocalizationFrequency h b eta omega t|)^3))= + ∫ t in a..c, (5/16 : ℝ)*(spectralLiouvilleSlope eta t)^2/ + (Real.sqrt (-homogeneousSpectralLocalizationFrequency h b eta omega t))^5+ + |spectralLiouvilleSecond eta t|/ + (4*(Real.sqrt (-homogeneousSpectralLocalizationFrequency h b eta omega t))^3) := by + apply intervalIntegral.integral_congr + intro t ht + have htc : t ∈ Icc a c := by simpa only [uIcc_of_le (show a≤c from hac)] using ht + dsimp only + rw [abs_of_neg (hF t htc)] + rw [he] at hb + exact hb.trans (spectralTurning_negative_scaled_integral h b eta omega r₀ d M a + heta hr₀ hd hM ha hac hz hscale) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningConeError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningConeError.lean new file mode 100644 index 0000000000000000000000000000000000000000..9facbb0f426bbf1ee33f5c72eca9156232879239 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningConeError.lean @@ -0,0 +1,159 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningNegativeErrorLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningActionLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterNegative + +namespace OAI + +/-! The error threshold for the forbidden WKB cone follows from the actual +residual integral and action, with the fixed cutoff chosen first. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_eventual_cone_error + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (R : ℝ) (hR : 0 < R) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1) : + ∀ᶠ M : ℝ in atTop, 32 ≤ M ∧ ∀ᶠ n in atTop, + let J := ∫ t in R..(r₀ n-M*d n), (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖ + let H := (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ 1/64 := by + let A : ℝ := 25/4 + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have hj := spectralTurningCutoffError_tendsto.const_mul A + have hbase : Tendsto (fun M => A*Real.exp (A*spectralTurningCutoffError M)* + (A*spectralTurningCutoffError M)) atTop (𝓝 0) := by + simpa only [Function.comp_def,mul_zero,Real.exp_zero,mul_one,mul_assoc] using + (((Real.continuous_exp.tendsto (A*0)).comp hj).mul hj).const_mul A + filter_upwards [eventually_ge_atTop (32 : ℝ), + hbase.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1/64))] with M hM hbaseM + refine ⟨hM,?_⟩ + have hMp : 0 < M := by linarith + let Jb := fun n => A*spectralTurningNegativeError M R (r₀ n) (d n) + let H := fun n => (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re + have hJb : Tendsto Jb atTop (𝓝 (A*spectralTurningCutoffError M)) := + (spectralTurningNegativeError_tendsto M R r₀ d hr₀ hd).const_mul A + have hH : Tendsto H atTop atTop := + spectralTurning_forbidden_action_tendsto h b eta omega gamma r₀ d R M hR hMp hr₀ hdata + have he : Tendsto (fun n => Real.exp (-2*H n)) atTop (𝓝 0) := by + simpa only [Function.comp_def,neg_mul] using + Real.tendsto_exp_neg_atTop_nhds_zero.comp (hH.const_mul_atTop (by norm_num : (0 : ℝ) < 2)) + have htotal : Tendsto (fun n => A*Real.exp (Jb n)*Jb n+(25/8)*Real.exp (-2*H n)) atTop + (𝓝 (A*Real.exp (A*spectralTurningCutoffError M)*(A*spectralTurningCutoffError M))) := by + simpa only [Function.comp_def,mul_zero,add_zero,mul_assoc] using + ((((Real.continuous_exp.tendsto _).comp hJb).mul hJb).const_mul A).add + (he.const_mul (25/8 : ℝ)) + filter_upwards [hdata,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max (2*R) (2*M))), + htotal.eventually (gt_mem_nhds hbaseM)] with n hn hdn hrn htn + rcases hn with ⟨hrp,hdn0,heta,hz,hsc⟩ + have hdp : 0 < d n := by + apply lt_of_le_of_ne hdn0 + intro he + rw [← he] at hsc + norm_num at hsc + have hRhalf : R ≤ r₀ n/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hrn] + have hMd : M*d n ≤ r₀ n/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hrn] + let J := ∫ t in R..(r₀ n-M*d n), A* + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖ + have hJ0 : 0 ≤ J := intervalIntegral.integral_nonneg (by linarith) + (fun t _ => by dsimp only [A]; positivity) + have hJeq : J = A*(∫ t in R..(r₀ n-M*d n), + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖) := by + rw [← intervalIntegral.integral_const_mul] + apply intervalIntegral.integral_congr + intro t _ + ring + have hJle : J ≤ Jb n := by + rw [hJeq] + exact mul_le_mul_of_nonneg_left + (spectralTurning_outer_negative_error h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) M R heta hrp hdp hMp hR hRhalf hMd hz hsc) (by norm_num) + change A*Real.exp J*J+(25/8)*Real.exp (-2*H n) ≤ 1/64 + apply le_trans _ htn.le + gcongr + +theorem spectralTurning_eventual_relative_error + (eps : ℝ) (heps : 0 < eps) (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (R : ℝ) (hR : 0 < R) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1) : + ∀ᶠ M : ℝ in atTop, 32 ≤ M ∧ ∀ᶠ n in atTop, + let J := ∫ t in R..(r₀ n-M*d n), (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖ + let H := (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ eps := by + let A : ℝ := 25/4 + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have hj := spectralTurningCutoffError_tendsto.const_mul A + have hbase : Tendsto (fun M => A*Real.exp (A*spectralTurningCutoffError M)* + (A*spectralTurningCutoffError M)) atTop (𝓝 0) := by + simpa only [Function.comp_def,mul_zero,Real.exp_zero,mul_one,mul_assoc] using + (((Real.continuous_exp.tendsto (A*0)).comp hj).mul hj).const_mul A + filter_upwards [eventually_ge_atTop (32 : ℝ), + hbase.eventually (gt_mem_nhds heps)] with M hM hbaseM + refine ⟨hM,?_⟩ + have hMp : 0 < M := by linarith + let Jb := fun n => A*spectralTurningNegativeError M R (r₀ n) (d n) + let H := fun n => (∫ t in R..(r₀ n-M*d n), + spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t).re + have hJb : Tendsto Jb atTop (𝓝 (A*spectralTurningCutoffError M)) := + (spectralTurningNegativeError_tendsto M R r₀ d hr₀ hd).const_mul A + have hH : Tendsto H atTop atTop := + spectralTurning_forbidden_action_tendsto h b eta omega gamma r₀ d R M hR hMp hr₀ hdata + have he : Tendsto (fun n => Real.exp (-2*H n)) atTop (𝓝 0) := by + simpa only [Function.comp_def,neg_mul] using + Real.tendsto_exp_neg_atTop_nhds_zero.comp (hH.const_mul_atTop (by norm_num : (0 : ℝ) < 2)) + have htotal : Tendsto (fun n => A*Real.exp (Jb n)*Jb n+(25/8)*Real.exp (-2*H n)) atTop + (𝓝 (A*Real.exp (A*spectralTurningCutoffError M)*(A*spectralTurningCutoffError M))) := by + simpa only [Function.comp_def,mul_zero,add_zero,mul_assoc] using + ((((Real.continuous_exp.tendsto _).comp hJb).mul hJb).const_mul A).add + (he.const_mul (25/8 : ℝ)) + filter_upwards [hdata,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max (2*R) (2*M))), + htotal.eventually (gt_mem_nhds hbaseM)] with n hn hdn hrn htn + rcases hn with ⟨hrp,hdn0,heta,hz,hsc⟩ + have hdp : 0 < d n := by + apply lt_of_le_of_ne hdn0 + intro he + rw [← he] at hsc + norm_num at hsc + have hRhalf : R ≤ r₀ n/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hrn] + have hMd : M*d n ≤ r₀ n/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hrn] + let J := ∫ t in R..(r₀ n-M*d n), A* + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖ + have hJ0 : 0 ≤ J := intervalIntegral.integral_nonneg (by linarith) + (fun t _ => by dsimp only [A]; positivity) + have hJeq : J = A*(∫ t in R..(r₀ n-M*d n), + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖) := by + rw [← intervalIntegral.integral_const_mul] + apply intervalIntegral.integral_congr + intro t _ + ring + have hJle : J ≤ Jb n := by + rw [hJeq] + exact mul_le_mul_of_nonneg_left + (spectralTurning_outer_negative_error h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) M R heta hrp hdp hMp hR hRhalf hMd hz hsc) (by norm_num) + change A*Real.exp J*J+(25/8)*Real.exp (-2*H n) ≤ eps + apply le_trans _ htn.le + gcongr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCutoffChoice.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCutoffChoice.lean new file mode 100644 index 0000000000000000000000000000000000000000..02c0c59cd122a04ef8905fb9c273edac91077638 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningCutoffChoice.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningErrorLimit + +namespace OAI + +/-! Choose one finite turning cutoff before passing to the escaping +parameter sequence. All constants are fixed independently of that sequence. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_cutoff_choice (K L H c : ℝ) (hc : 0 < c) + (r₀ d E : ℕ → ℝ) (hr₀ : Tendsto r₀ atTop atTop) + (hd : Tendsto d atTop (𝓝 0)) (hE : Tendsto E atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 ≤ r₀ n ∧ 0 ≤ d n) : + ∃ M : ℝ, 32 ≤ M ∧ ∀ᶠ n in atTop, + 0 ≤ spectralTurningOuterError M (r₀ n) (d n) ∧ + spectralTurningOuterError M (r₀ n) (d n) ≤ 1 ∧ + c/2 ≤ c-(K*spectralTurningOuterError M (r₀ n) (d n)+L/(E n)^2)* + (H+(K*spectralTurningOuterError M (r₀ n) (d n)+L/(E n)^2)) := by + have hj := spectralTurningCutoffError_tendsto + have hcst : Tendsto (fun _ : ℝ => c) atTop (𝓝 c) := tendsto_const_nhds + have hHst : Tendsto (fun _ : ℝ => H) atTop (𝓝 H) := tendsto_const_nhds + have hlim := hcst.sub ((hj.const_mul K).mul (hHst.add (hj.const_mul K))) + have hsmall : ∀ᶠ M : ℝ in atTop, + spectralTurningCutoffError M < 1 ∧ + c/2 < c-(K*spectralTurningCutoffError M)*(H+K*spectralTurningCutoffError M) := by + have hhalf : c/2 < c := by linarith + have hlim' : Tendsto (fun M : ℝ => c-(K*spectralTurningCutoffError M)* + (H+K*spectralTurningCutoffError M)) atTop (𝓝 c) := by + simpa only [mul_zero,add_zero,zero_mul,sub_zero] using hlim + exact (hj.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1))).and + (hlim'.eventually (lt_mem_nhds hhalf)) + obtain ⟨M,hM,hm⟩ := ((eventually_ge_atTop (32 : ℝ)).and hsmall).exists + refine ⟨M,hM,?_⟩ + have hJ := spectralTurningOuterError_tendsto M r₀ d hr₀ hd + have hi := tendsto_inv_atTop_zero.comp hE + have hrm : Tendsto (fun n => L/(E n)^2) atTop (𝓝 0) := by + simpa only [div_eq_mul_inv,inv_pow,Function.comp_def,mul_zero,zero_pow (by decide : (2 : ℕ) ≠ 0)] + using (hi.pow 2).const_mul L + have hDel := (hJ.const_mul K).add hrm + have hcseq : Tendsto (fun _ : ℕ => c) atTop (𝓝 c) := tendsto_const_nhds + have hHseq : Tendsto (fun _ : ℕ => H) atTop (𝓝 H) := tendsto_const_nhds + have hf := hcseq.sub (hDel.mul (hHseq.add hDel)) + have hf' : Tendsto (fun n => c-(K*spectralTurningOuterError M (r₀ n) (d n)+L/(E n)^2)* + (H+(K*spectralTurningOuterError M (r₀ n) (d n)+L/(E n)^2))) atTop + (𝓝 (c-(K*spectralTurningCutoffError M)*(H+K*spectralTurningCutoffError M))) := by + simpa only [add_zero] using hf + filter_upwards [hdata,hJ.eventually (gt_mem_nhds hm.1),hf'.eventually (lt_mem_nhds hm.2)] + with n hn hjn hfn + refine ⟨?_,hjn.le,hfn.le⟩ + rcases hn with ⟨hrn,hdn⟩ + dsimp only [spectralTurningOuterError,spectralTurningCutoffError] + positivity + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDataBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDataBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5b22eadc864a4342277d51ebb754646a97d8d8b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDataBound.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningWeightLimit + +namespace OAI + +/-! A bounded physical outgoing norm gives bounded rescaled Cauchy data at +any fixed positive oscillatory cutoff. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_rescaled_data_bounded + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G C : ℝ) (hM : 0 < M) + (q : ℕ → ℝ → ℂ × ℂ) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (hbound : ∀ᶠ n in atTop, spectralShellNorm + (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) (gamma n) + (r₀ n+d n*M)‖) (q n (r₀ n+d n*M)) ≤ C) : + ∃ B : ℝ, ∀ᶠ n in atTop, + ‖spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) (-M)‖ ≤ B := by + let k₀ := Real.sqrt (Real.sqrt M) + have hk₀ : 0 < k₀ := Real.sqrt_pos.mpr (Real.sqrt_pos.mpr hM) + let k := fun n => Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) + (gamma n) (r₀ n+d n*M)‖ + have hw := spectralTurning_weight_tendsto h b eta omega gamma r₀ d M G hM.le hr₀ hdata + have hlow : k₀/2 < k₀ := by linarith + have hupp : k₀ < 2*k₀ := by linarith + refine ⟨max (k₀/2)⁻¹ (2*k₀)*C,?_⟩ + filter_upwards [hdata,hbound,hw.eventually (lt_mem_nhds hlow), + hw.eventually (gt_mem_nhds hupp)] with n hn hb hl hu + have hd : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hh := hn.2.2.2.2.2 + rw [← he] at hh + norm_num at hh + have hs : 0 < Real.sqrt (d n) := Real.sqrt_pos.mpr hd + have hk : 0 < k n := by + have hn0 : 0 ≤ k n := Real.sqrt_nonneg _ + change k₀/2 < Real.sqrt (d n)*k n at hl + nlinarith + have he : spectralShellNorm (Real.sqrt (d n)*k n) + (spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) (-M)) = + spectralShellNorm (k n) (q n (r₀ n+d n*M)) := by + simpa only [spectralTurningAiryState,spectralScalarReflect,spectralTurningState, + zero_add,zero_sub,neg_neg,neg_mul] using + spectralShellNorm_scale (Real.sqrt (d n)) (k n) hs hk (q n (r₀ n+d n*M)) + calc + _ ≤ max (k₀/2)⁻¹ (2*k₀) * spectralShellNorm (Real.sqrt (d n)*k n) + (spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n) (-M)) := + spectralShellNorm_controls_norm (k₀/2) (2*k₀) _ (half_pos hk₀) hl.le hu.le _ + _ = max (k₀/2)⁻¹ (2*k₀) * spectralShellNorm (k n) (q n (r₀ n+d n*M)) := by rw [he] + _ ≤ max (k₀/2)⁻¹ (2*k₀)*C := mul_le_mul_of_nonneg_left hb (by positivity) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDerivativeBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ce17581b2e12c51dab0f9589e1d030b92257ee5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningDerivativeBounds.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleFrequencyJet + +namespace OAI + +/-! Derivative bounds near and away from the unique Liouville turning point. -/ + +namespace DefocusingNLS + +theorem spectralLiouvilleSlope_near (eta r₀ r : ℝ) (heta : 0≤eta) + (hr₀ : 0 linarith + +theorem spectralLiouvilleSecond_relative (eta r : ℝ) (heta : 0≤eta) (hr : 0 M/8) atTop atTop := + Filter.Tendsto.atTop_div_const (by norm_num) tendsto_id + have hs := Real.tendsto_sqrt_atTop.comp hdiv + have hc := (tendsto_pow_atTop (by decide : (3 : ℕ) ≠ 0)).comp hs + have hi := tendsto_inv_atTop_zero.comp hc + have hh := hi.const_mul (5/3 : ℝ) + change Tendsto (fun M : ℝ => 5/(3*(Real.sqrt (M/8))^3)) atTop (𝓝 0) + convert hh using 1 + · funext M + dsimp only [Function.comp_def] + ring + · simp only [mul_zero] + +theorem spectralTurningOuterError_tendsto (M : ℝ) (r₀ d : ℕ → ℝ) + (hr₀ : Tendsto r₀ atTop atTop) (hd : Tendsto d atTop (𝓝 0)) : + Tendsto (fun n => spectralTurningOuterError M (r₀ n) (d n)) atTop + (𝓝 (spectralTurningCutoffError M)) := by + have hi := tendsto_inv_atTop_zero.comp hr₀ + have hnear := (hd.mul hi).const_mul (3/Real.sqrt (M/8)) + have hfar := (hi.pow 2).const_mul (8 : ℝ) + have hlim := (tendsto_const_nhds : Tendsto (fun _ : ℕ => spectralTurningCutoffError M) + atTop (𝓝 (spectralTurningCutoffError M))).add (hnear.add hfar) + convert hlim using 1 + · funext n + dsimp only [spectralTurningOuterError,Function.comp_def] + ring + · simp only [mul_zero,zero_pow (by decide : (2 : ℕ) ≠ 0),add_zero] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarGeometry.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..be150bb4b1a5b15522df6c5dda2611a0929e468a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarGeometry.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningDerivativeBounds + +namespace OAI + +/-! On the far oscillatory side, the potential dominates its radial derivative. -/ + +namespace DefocusingNLS + +theorem spectralTurning_far_geometry (h b eta omega r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 spectralTurning_far_residual h b eta omega gamma r₀ t heta hr₀ + (ha.trans ht.1) hz) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarPhase.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e683559becbfa8627588e3475349d55ac378c50 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFarPhase.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRemoteScale +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPhaseLowerBound + +namespace OAI + +/-! Uniform phase integrals on both far intervals. The oscillatory bound uses +exactly the remote scale 16 sqrt(max(ell+1,omega)) chosen in the paper. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_positive_far_phase (ell : ℕ) (h b omega r₀ E : ℝ) + (hh : h^2=1) (hb : 0≤b) (hb1 : b≤1) (hr₀ : 0 Real.sqrt (F t)) (Icc (2*r₀) E) := by + apply Real.continuous_sqrt.comp_continuousOn + intro t ht + exact (homogeneousSpectralLocalizationFrequency_hasDerivAt h b _ omega t + (by linarith [ht.1])).continuousAt.continuousWithinAt + have hbound (t : ℝ) (ht : t ∈ Icc (2*r₀) E) : L≤Real.sqrt (F t) := by + apply Real.sqrt_le_sqrt + exact (homogeneousSpectralLocalizationFrequency_strictMono h b _ omega heta).monotoneOn + (by change 0<2*r₀; positivity) (by change 0 Real.sqrt (-F t)) (Icc a c) := by + apply Real.continuous_sqrt.comp_continuousOn + apply ContinuousOn.neg + intro t ht + exact (homogeneousSpectralLocalizationFrequency_hasDerivAt h b eta omega t + (ha.trans_le ht.1)).continuousAt.continuousWithinAt + have hbound (t : ℝ) (ht : t ∈ Icc a c) : r₀/8≤Real.sqrt (-F t) := by + have hb := (spectralTurning_forbidden_far h b eta omega r₀ t heta hr₀ + (ha.trans_le ht.1) (ht.2.trans hc) hz).1 + have hFp : 0≤-F t := (by positivity : (0 : ℝ)≤r₀^2/32).trans hb + have hsq := Real.sq_sqrt hFp + have hsn := Real.sqrt_nonneg (-F t) + nlinarith + have hi := spectralWKB_phase_of_lower a c (r₀/8) hac (by positivity) _ hp hbound + calc + _ ≤ (c-a)/(r₀/8) := hi + _ ≤ 4 := (div_le_iff₀ (by positivity : 0 (spectralLiouvilleSlope eta t : ℂ)/(2*p t) + let k := fun t => Real.sqrt ‖p t‖ + let B := |gamma| * 288 + let C := (5/2 : ℝ)*Real.exp B + let J := 5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2 + let delta := (6*(C^2)^2*Real.exp (C^2*J)*J)+C^2*((32*|gamma|+8)/E^2) + let D := spectralWKBFrame a ((h : ℂ)*Complex.I) p v + let z := (q E).1/(D E).1 + have heta : 0 ≤ eta := by dsimp only [eta]; positivity + have hr₀p : 0 < r₀ := by linarith + have hMp : 0 < M := by linarith + have ha : r₀ < a := by dsimp only [a]; nlinarith + have ha0 : 0 < a := hr₀p.trans ha + have haE : a ≤ E := by dsimp only [a]; linarith + have hEpos : 0 < E := by linarith + have hF (t : ℝ) (ht : t ∈ Icc a E) : + 0 < homogeneousSpectralLocalizationFrequency h b eta omega t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h b eta omega heta + hr₀p (ha0.trans_le ht.1) (ha.trans_le ht.1) + simpa only [eta,hz] using hf + have hsmall (t : ℝ) (ht : t ∈ Icc a E) : |spectralLiouvilleSlope eta t| ≤ 2*‖p t‖^3 := + spectralTurning_positive_derivative_small 1 h b eta omega gamma r₀ d M t + (by norm_num) heta (by linarith) hd hM ht.1 hz hscale + have hFar := spectralTurning_far_geometry h b eta omega r₀ E heta hr₀p hE hz + have hgammaFar : |gamma| ≤ homogeneousSpectralLocalizationFrequency h b eta omega E := by + nlinarith + have hnormE : spectralShellNorm (k E) (q E) ≤ 3 := by + rw [hqE] + simpa only [k,p,spectralLiouvilleMomentum,spectralWKBSquaredMomentum,Complex.ofReal_one,one_mul] using + spectralOscillatoryData_complex_norm h (homogeneousSpectralLocalizationFrequency h b eta omega E) + gamma hh (hF E ⟨haE,le_rfl⟩) hgammaFar + have hA : (∫ t in a..E, 1/Real.sqrt (homogeneousSpectralLocalizationFrequency h b eta omega t)) ≤ 288 := + spectralTurning_positive_outer_phase ell h b omega r₀ d M E + hh hb hb1 hr₀p hd hMp hMd hE hEscale hz + have hchi : ‖(h : ℂ)*Complex.I‖ = 1 := by + have hha : |h| = 1 := by nlinarith [sq_abs h,abs_nonneg h] + simp only [norm_mul,Complex.norm_real,Real.norm_eq_abs,hha,Complex.norm_I,mul_one] + have hchire : ((h : ℂ)*Complex.I).re = 0 := by simp + have hphase := spectralLiouville_positive_phase_bound h b eta omega gamma a E 288 ha0 haE + ((h : ℂ)*Complex.I) hchi hchire hF hA + have hbranch := spectralLiouville_outgoing_branch_margin h b eta omega gamma a E B hh ha0 haE hF + (hsmall a ⟨le_rfl,haE⟩) (hphase E ⟨haE,le_rfl⟩) hgammaFar + dsimp only at hbranch + rw [← hqE] at hbranch + change (Real.exp (-B))^2/6 ≤ h*spectralScalarFlux (z • D a) ∧ + spectralShellNorm (k a) (z • D a) ≤ 5*Real.exp B at hbranch + have herr := spectralTurning_positive_branch_error ell h b omega gamma r₀ d M E hh hb hb1 + (by linarith) hd hM hMd hE hEscale hz hscale q hq hqE hODE + change spectralShellNorm (k a) (q a-z • D a) ≤ + (2*(C^2)^2*Real.exp (C^2*J)*J)*spectralShellNorm (k E) (q E) + + C^2*((32*|gamma|+8)/E^2) at herr + have hJ : 0 ≤ J := by dsimp only [J]; positivity + have hclose : spectralShellNorm (k a) (q a-z • D a) ≤ delta := by + apply herr.trans + calc + _ ≤ (2*(C^2)^2*Real.exp (C^2*J)*J)*3 + C^2*((32*|gamma|+8)/E^2) := + add_le_add (mul_le_mul_of_nonneg_left hnormE (by positivity)) le_rfl + _ = delta := by dsimp only [delta]; ring + have hk : 0 < k a := by + apply Real.sqrt_pos.mpr + apply lt_of_lt_of_le (Real.sqrt_pos.mpr (hF a ⟨le_rfl,haE⟩)) + simpa only [p,spectralLiouvilleMomentum,abs_of_pos (hF a ⟨le_rfl,haE⟩)] using + spectralWKBSqrt_frequency_lower 1 (homogeneousSpectralLocalizationFrequency h b eta omega a) + gamma (by norm_num) + have hqa : spectralShellNorm (k a) (q a) ≤ delta+5*Real.exp B := by + have he : q a = (q a-z • D a)+z • D a := by abel + calc + _ ≤ spectralShellNorm (k a) (q a-z • D a)+spectralShellNorm (k a) (z • D a) := by + conv_lhs => rw [he] + exact spectralShellNorm_add_le (k a) hk.le _ _ + _ ≤ _ := add_le_add hclose hbranch.2 + have hf := spectralScalarFlux_lower_of_close h (k a) ((Real.exp (-B))^2/6) + (delta+5*Real.exp B) (5*Real.exp B) delta (q a) (z • D a) + hh hk hbranch.1 hqa hbranch.2 hclose + convert hf using 1; dsimp only [B,C,J,delta,a]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenFarIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenFarIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..de8e4462146e1c38737c5947092c1ca50578cda1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenFarIntegral.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFarBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleResidualContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCouplingEstimate + +namespace OAI + +/-! The far forbidden residual is small uniformly down to a fixed positive radius. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_forbidden_far_residual (h b eta omega gamma r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 (t^2)⁻¹) (Icc a c) := + (continuousOn_id.pow 2).inv₀ (fun t ht => pow_ne_zero _ (ha.trans_le ht.1).ne') + have hint : (∫ t in a..c, ‖spectralLiouvilleResidual (-1) h b eta omega gamma t‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma t‖)≤ + ∫ t in a..c, (64/r₀)*(t^2)⁻¹ := by + apply intervalIntegral.integral_mono_on hac (hcont.intervalIntegrable_of_Icc hac) + ((continuousOn_const.mul hpow).intervalIntegrable_of_Icc hac) + intro t ht + have hb := spectralTurning_forbidden_far_residual h b eta omega gamma r₀ t heta hr₀ + (ha.trans_le ht.1) (ht.2.trans hc) hz + convert hb using 1 + change (64/r₀)*(t^2)⁻¹=64/(r₀*t^2) + ring + rw [intervalIntegral.integral_const_mul] at hint + calc + _ ≤ (64/r₀)*(∫ t in a..c, (t^2)⁻¹) := hint + _ ≤ (64/r₀)*a⁻¹ := mul_le_mul_of_nonneg_left + (spectral_inverse_square_integral_le a c ha hac) (by positivity) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGeometry.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..71f417e48c9d739b32ca2f32600942389dcc2a15 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGeometry.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningFrequencyGrowth +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGeometry + +namespace OAI + +/-! Quantitative potential bounds on the forbidden side of the turning point. -/ + +open Set +namespace DefocusingNLS + +theorem spectralTurning_forbidden_growth (h b eta omega r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 (hd t ht).continuousAt.continuousWithinAt + have hdiff : DifferentiableOn ℝ F (interior (Icc r r₀)) := + fun t ht => (hd t (interior_subset ht)).differentiableAt.differentiableWithinAt + have hbounds (t : ℝ) (ht : t ∈ Icc r r₀) := + spectralLiouvilleSlope_near eta r₀ t heta hr₀ (hr.trans ht.1) (by linarith [ht.2]) + have hl := (convex_Icc r r₀).mul_sub_le_image_sub_of_le_deriv hc hdiff + (fun t ht => by rw [(hd t (interior_subset ht)).deriv]; exact (hbounds t (interior_subset ht)).1) + r ⟨le_rfl,hr'⟩ r₀ ⟨hr',le_rfl⟩ hr' + have hu := (convex_Icc r r₀).image_sub_le_mul_sub_of_deriv_le hc hdiff + (fun t ht => by rw [(hd t (interior_subset ht)).deriv]; exact (hbounds t (interior_subset ht)).2) + r ⟨le_rfl,hr'⟩ r₀ ⟨hr',le_rfl⟩ hr' + dsimp only [F] at hl hu + rw [hz,zero_sub] at hl hu + exact ⟨hl,hu⟩ + +theorem spectralTurning_forbidden_far (h b eta omega r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 Real.sqrt ‖p t‖ + let J := ∫ t in R..c, (25/4 : ℝ)*‖spectralLiouvilleResidual (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) t‖/‖p t‖ + ∃ (D : ℝ → ℂ × ℂ) (W : ℂ), Continuous D ∧ D R = (0,(k R : ℂ)) ∧ + (∀ t ∈ Icc R c, HasDerivAt D (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (D t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc R c, spectralScalarWronskian (D t) (q (φ n) t) = W) ∧ + ∀ r ∈ Icc R c, ∀ t ∈ Icc R c, + spectralShellNorm (k r) (spectralScalarGreenState D (q (φ n)) W r t) ≤ + 1250*Real.exp (2*J)/(k t) := by + obtain ⟨q,φ,hφ,hq,hbounds⟩ := spectralTurning_outgoing_relative_bounds + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + obtain ⟨M,hM,hvalue⟩ := hbounds (1/2) (by norm_num) + refine ⟨q,φ,hφ,hq,M,hM,?_⟩ + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ (φ n))*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + have hd := spectralTurningScale_tendsto eta (fun n => r₀ (φ n)) (fun n => d (φ n)) hrt + (hsample.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + hsample,hvalue,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*R) (2*M))))] + with n hqn hdn hsn hval hsmalln hlarge + dsimp only [Function.comp_def] at hlarge + have hMp : 0 < M := by linarith + let c := r₀ (φ n)-M*d (φ n) + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hs := hsn.2.2.2.2 + rw [← he] at hs + norm_num at hs + have hRM := (le_max_right (16/R) (max (2*R) (2*M))).trans hlarge + have hRhalf : R ≤ r₀ (φ n)/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hRM] + have hMd : M*d (φ n) ≤ r₀ (φ n)/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hRM] + have hprod : 16 ≤ r₀ (φ n)*R := by + have hl := mul_le_mul_of_nonneg_right ((le_max_left (16/R) (max (2*R) (2*M))).trans hlarge) hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at hl + have hRc : R ≤ c := by dsimp only [c]; linarith + have hct : c < r₀ (φ n) := by dsimp only [c]; nlinarith + have hcE : c ≤ E (φ n) := hct.le.trans (by linarith [hdn.2.2.2.2.2.1]) + have hF (t : ℝ) (ht : t ∈ Icc R c) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h (b (φ n)) (eta n) (omega (φ n)) + hsn.2.2.1 (hR.trans_le ht.1) hsn.1 (ht.2.trans_lt hct) + rw [hsn.2.2.2.1] at hf + linarith + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Icc c (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) (eta n) (omega (φ n)) t + (hR.trans_le (hRc.trans ht.1))).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (E (φ n)) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + rw [he] at hf + have hz : spectralScalarFlux (0 : ℂ × ℂ) = 0 := by simp [spectralScalarFlux] + rw [hz] at hf + nlinarith [hh] + have hqc : q (φ n) c ≠ 0 := spectralScalar_ne_zero_of_right c (E (φ n)) hcE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRc.trans ht.1.le,ht.2.le⟩) hqE + have hk : 0 < Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) c‖ := + spectralLiouville_norm_weight_pos (-1) h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) c + (by norm_num) (by intro he; have hf := hF c ⟨hRc,le_rfl⟩; rw [he,mul_zero] at hf; linarith) + have hN : 0 < spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + (eta n) (omega (φ n)) (gamma (φ n)) c‖) (q (φ n) c) := by + by_contra hbad + have hz := le_antisymm (le_of_not_gt hbad) (spectralShellNorm_nonneg _ hk.le _) + exact hqc ((spectralShellNorm_eq_zero _ hk _).mp hz) + exact spectralLiouville_forbidden_green_data h (b (φ n)) (eta n) (omega (φ n)) + (gamma (φ n)) R c hR hRc hF + (fun t ht => spectralTurning_negative_derivative_small (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) (d (φ n)) M R t (by norm_num) + hsn.2.2.1 hsn.1 hdp hM hR hprod ht.1 ht.2 hsn.2.2.2.1 hsn.2.2.2.2) + (q (φ n)) hqn.1.continuousOn + (fun t ht => hqn.2.2.2 t ⟨ht.1,ht.2.trans hcE⟩) hN hval.2 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGreenUniform.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGreenUniform.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bda391e1bec64120f3bd68b9ef4a352212e1615 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningForbiddenGreenUniform.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGreen +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningResidualUniform + +namespace OAI + +/-! The forbidden Green bound has a constant independent of the escaping +parameters, after selecting the fixed turning cutoff. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_outgoing_forbidden_green_uniform + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∃ M : ℝ, 32 ≤ M ∧ ∀ᶠ n in atTop, + let c := r₀ (φ n)-M*d (φ n) + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) + let k := fun t => Real.sqrt ‖p t‖ + ∃ (D : ℝ → ℂ × ℂ) (W : ℂ), Continuous D ∧ D R = (0,(k R : ℂ)) ∧ + (∀ t ∈ Icc R c, HasDerivAt D (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (D t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc R c, spectralScalarWronskian (D t) (q (φ n) t) = W) ∧ + ∀ r ∈ Icc R c, ∀ t ∈ Icc R c, + spectralShellNorm (k r) (spectralScalarGreenState D (q (φ n)) W r t) ≤ + 1250*Real.exp 4/(k t) := by + obtain ⟨q,φ,hφ,hq,M,hM,hgreen⟩ := spectralTurning_outgoing_forbidden_green + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ (φ n))*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hres := spectralTurning_eventual_residual_bound h (fun n => b (φ n)) eta + (fun n => omega (φ n)) (fun n => gamma (φ n)) (fun n => r₀ (φ n)) + (fun n => d (φ n)) R M hR hM (hr₀.comp hφ.tendsto_atTop) hsample + refine ⟨q,φ,hφ,hq,M,hM,?_⟩ + filter_upwards [hgreen,hres] with n hgn hrn + obtain ⟨D,W,hDc,hDR,hDD,hW,hdet,hbound⟩ := hgn + refine ⟨D,W,hDc,hDR,hDD,hW,hdet,?_⟩ + intro r hr t ht + apply (hbound r hr t ht).trans + gcongr + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFrequencyGrowth.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFrequencyGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..1adaf76a454a5e64d022a02cc91239e4cbc46ac1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningFrequencyGrowth.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningDerivativeBounds + +namespace OAI + +/-! Linear control of the actual frequency on the fixed-size turning annulus. -/ + +open Set +namespace DefocusingNLS + +theorem spectralTurningFrequency_growth (h b eta omega r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 (hd t ht).continuousAt.continuousWithinAt + have hdiff : DifferentiableOn ℝ F (interior (Icc r₀ r)) := + fun t ht => (hd t (interior_subset ht)).differentiableAt.differentiableWithinAt + have hbounds (t : ℝ) (ht : t ∈ Icc r₀ r) := + spectralLiouvilleSlope_near eta r₀ t heta hr₀ (by linarith [ht.1]) (ht.2.trans hr') + have hl := (convex_Icc r₀ r).mul_sub_le_image_sub_of_le_deriv hc hdiff + (fun t ht => by rw [(hd t (interior_subset ht)).deriv]; exact (hbounds t (interior_subset ht)).1) + r₀ ⟨le_rfl,hr⟩ r ⟨hr,le_rfl⟩ hr + have hu := (convex_Icc r₀ r).image_sub_le_mul_sub_of_deriv_le hc hdiff + (fun t ht => by rw [(hd t (interior_subset ht)).deriv]; exact (hbounds t (interior_subset ht)).2) + r₀ ⟨le_rfl,hr⟩ r ⟨hr,le_rfl⟩ hr + dsimp only [F] at hl hu + rw [hz,sub_zero] at hl hu + exact ⟨hl,hu⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGeometry.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..74f9cdb0d0c8eb68e6a7995de2d9519ad7afd374 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGeometry.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousSpectralLocalizationGeometry + +namespace OAI + +/-! Exact identities and a uniform quadratic error for the Liouville frequency +at its unique turning point. These identify the rescaled limiting equation. -/ + +namespace DefocusingNLS + +theorem spectralTurningFrequency_identity (h b eta omega r₀ r : ℝ) + (hr₀ : r₀≠0) (hr : r≠0) + (hzero : homogeneousSpectralLocalizationFrequency h b eta omega r₀=0) : + homogeneousSpectralLocalizationFrequency h b eta omega r= + (r₀^2/16)*((r/r₀)^2-1)+((eta+99/4)/r₀^2)*(1-(r₀/r)^2) := by + have hz : b-h*omega=(eta+99/4)/r₀^2-r₀^2/16 := by + dsimp only [homogeneousSpectralLocalizationFrequency] at hzero + linarith + dsimp only [homogeneousSpectralLocalizationFrequency] + calc + _ = r^2/16+(b-h*omega)-(eta+99/4)/r^2 := by ring + _ = _ := by rw [hz]; field_simp; ring + +theorem spectralTurningFrequency_remainder (h b eta omega r₀ delta : ℝ) + (hr₀ : r₀≠0) (hr : r₀+delta≠0) + (hzero : homogeneousSpectralLocalizationFrequency h b eta omega r₀=0) : + homogeneousSpectralLocalizationFrequency h b eta omega (r₀+delta)- + (r₀/8+2*(eta+99/4)/r₀^3)*delta= + delta^2*(1/16-(eta+99/4)*(3*r₀+2*delta)/(r₀^3*(r₀+delta)^2)) := by + rw [spectralTurningFrequency_identity h b eta omega r₀ (r₀+delta) hr₀ hr hzero] + field_simp + ring + +theorem spectralTurningFrequency_remainder_bound (h b eta omega r₀ delta : ℝ) + (hr₀ : 0 (homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+Complex.I*(gamma : ℂ) + let H := fun r => (∫ t in r..a, spectralLiouvilleMomentum (-1) h b eta omega gamma t).re + let A := (25/2 : ℝ)*Real.exp 2 + have haz : a ≤ z := by dsimp only [a,z]; nlinarith + have hRE : R ≤ E := hRa.le.trans (haz.trans hbE.le) + have hV : ContinuousOn V (Icc R E) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h b eta omega t + (hR.trans_le ht.1)).continuousAt.continuousWithinAt)).add continuousOn_const + have hk (t : ℝ) (_ht : t ∈ Icc R E) : 0 < k t := + spectralTurningRegularizedWeight_pos h b eta omega gamma d t hd + apply spectralScalar_three_region_green_and_extension R a z E A C P (1/16) hRa.le haz hbE.le + (by dsimp only [A]; positivity) hC hP (by norm_num) V k H hV hk + (spectralLiouville_action_antitone h b eta omega gamma R a hR hF) + (by dsimp only [H]; simp only [intervalIntegral.integral_same,Complex.zero_re]) U hUc hUD hN hvalue + · intro q hq hqD t ht + have hsub : Icc R a ⊆ Icc R E := Icc_subset_Icc le_rfl (haz.trans hbE.le) + have hb := spectralLiouville_forbidden_bounds h b eta omega gamma R a hR hRa.le hF hsmall + q (hq.mono hsub) (fun s hs => hqD s ⟨hs.1,hs.2.trans_le (haz.trans hbE.le)⟩) t ht + have he : Real.exp (∫ s in R..a, (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h b eta omega gamma s‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma s‖) ≤ Real.exp 2 := + Real.exp_le_exp.mpr hJ + have hkt := hweight t ht + have hkR := hweight R ⟨le_rfl,hRa.le⟩ + have hka := hweight a ⟨hRa.le,le_rfl⟩ + change k t = _ at hkt + change k R = _ at hkR + change k a = _ at hka + dsimp only at hb + rw [← hkt,← hkR,← hka] at hb + have hNR := spectralShellNorm_nonneg (k R) (hk R ⟨le_rfl,hRE⟩).le (q R) + have hNa := spectralShellNorm_nonneg (k a) (hk a ⟨hRa.le,haz.trans hbE.le⟩).le (q a) + have he1 : (25/4 : ℝ)*Real.exp (∫ s in R..a, (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h b eta omega gamma s‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma s‖) ≤ A := by + calc + _ ≤ (25/4 : ℝ)*Real.exp 2 := mul_le_mul_of_nonneg_left he (by norm_num) + _ ≤ A := by dsimp only [A]; nlinarith [Real.exp_pos (2 : ℝ)] + have he2 : (25/2 : ℝ)*Real.exp (∫ s in R..a, (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h b eta omega gamma s‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma s‖) ≤ A := + mul_le_mul_of_nonneg_left he (by norm_num) + constructor + · exact hb.1.trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right he1 (Real.exp_pos (H R-H t)).le) hNR) + · exact hb.2.trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right he2 (Real.exp_pos (H t)).le) hNa) + · intro q hq hqD t ht + have hsub : Icc a z ⊆ Icc R E := Icc_subset_Icc hRa.le hbE.le + have hb := (spectralTurning_regularized_physical_transfer h b eta omega gamma r₀ d M + hd hM hcoef q (hq.mono hsub) + (fun s hs => hqD s ⟨hRa.trans_le hs.1,hs.2.trans_lt hbE⟩) + a t ⟨le_rfl,haz⟩ ht ht.1).1 + exact hb.trans (mul_le_mul_of_nonneg_right hCbound (spectralShellNorm_nonneg _ (hk a ⟨hRa.le,haz.trans hbE.le⟩).le _)) + · intro q hq hqD t ht + exact hpos q (hq.mono (Icc_subset_Icc (hRa.le.trans haz) le_rfl)) + (fun s hs => hqD s ⟨(hRa.le.trans haz).trans_lt hs.1,hs.2⟩) t ht + +theorem spectralTurning_regularized_green + (h b eta omega gamma r₀ d M R E C P : ℝ) + (hR : 0 < R) (hd : 0 < d) (hM : 0 ≤ M) (hC : 0 ≤ C) (hP : 1 ≤ P) + (hRa : R < r₀-d*M) (hbE : r₀+d*M < E) + (hcoef : ∀ xi ∈ Icc (-M) M, + ‖spectralTurningCoefficient h b eta omega gamma r₀ d xi‖ ≤ M+1) + (hCbound : (M+3+(1 : ℝ)⁻¹)*max (1 : ℝ)⁻¹ (M+3)* + Real.exp ((1+(M+1))*(M-(-M))) ≤ C) + (hF : ∀ t ∈ Icc R (r₀-d*M), + 0 < (-1)*homogeneousSpectralLocalizationFrequency h b eta omega t) + (hsmall : ∀ t ∈ Icc R (r₀-d*M), |spectralLiouvilleSlope eta t| ≤ + 2*‖spectralLiouvilleMomentum (-1) h b eta omega gamma t‖^3) + (hJ : (∫ t in R..(r₀-d*M), (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h b eta omega gamma t‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma t‖) ≤ 2) + (hweight : ∀ t ∈ Icc R (r₀-d*M), + spectralTurningRegularizedWeight h b eta omega gamma d t = + Real.sqrt ‖spectralLiouvilleMomentum (-1) h b eta omega gamma t‖) + (hpos : ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc (r₀+d*M) E) → + (∀ t ∈ Ioo (r₀+d*M) E, HasDerivAt q (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+ + Complex.I*(gamma : ℂ)) (q t)) t) → + ∀ t ∈ Icc (r₀+d*M) E, + spectralShellNorm (spectralTurningRegularizedWeight h b eta omega gamma d t) (q t) ≤ + P*spectralShellNorm (spectralTurningRegularizedWeight h b eta omega gamma d (r₀+d*M)) + (q (r₀+d*M))) + (U : ℝ → ℂ × ℂ) (hUc : ContinuousOn U (Icc R E)) + (hUD : ∀ t ∈ Ioo R E, HasDerivAt U (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+ + Complex.I*(gamma : ℂ)) (U t)) t) + (hN : 0 < spectralShellNorm (spectralTurningRegularizedWeight h b eta omega gamma d (r₀-d*M)) + (U (r₀-d*M))) + (hvalue : (1/16 : ℝ)*Real.exp ((∫ t in R..(r₀-d*M), + spectralLiouvilleMomentum (-1) h b eta omega gamma t).re)* + spectralShellNorm (spectralTurningRegularizedWeight h b eta omega gamma d (r₀-d*M)) + (U (r₀-d*M)) ≤ spectralTurningRegularizedWeight h b eta omega gamma d R*‖(U R).1‖) : + let k := spectralTurningRegularizedWeight h b eta omega gamma d + let A := (25/2 : ℝ)*Real.exp 2 + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y R = (0,(k R : ℂ)) ∧ + (∀ t ∈ Icc R E, HasDerivAt Y (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+ + Complex.I*(gamma : ℂ)) (Y t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc R E, spectralScalarWronskian (Y t) (U t) = W) ∧ + ∀ r ∈ Icc R E, ∀ t ∈ Icc R E, + spectralShellNorm (k r) (spectralScalarGreenState Y U W r t) ≤ + max A (C*A*P)*max A (C*P)/((1/16)*k t) := by + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,_⟩ := + spectralTurning_regularized_green_and_extension h b eta omega gamma r₀ d M R E C P + hR hd hM hC hP hRa hbE hcoef hCbound hF hsmall hJ hweight hpos U hUc hUD hN hvalue + exact ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenFamily.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c32cbc06b31325af9c011601fcc795fb0c09de1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenFamily.lean @@ -0,0 +1,220 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGreen +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningInnerCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOscillatoryUniform + +namespace OAI + +/-! The actual normalized outgoing family has a uniformly bounded Green +kernel on the full interval from the fixed inner radius to the remote radius. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_outgoing_green_extension_uniform + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∃ K J : ℝ, 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, + let k := spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y R = (0,(k R : ℂ)) ∧ + (∀ t ∈ Icc R (E (φ n)), HasDerivAt Y (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Y t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc R (E (φ n)), spectralScalarWronskian (Y t) (q (φ n) t) = W) ∧ + (∀ r ∈ Icc R (E (φ n)), ∀ t ∈ Icc R (E (φ n)), + spectralShellNorm (k r) (spectralScalarGreenState Y (q (φ n)) W r t) ≤ K/(k t)) ∧ + ∀ z : ℂ, ∀ r ∈ Icc R (E (φ n)), + spectralShellNorm (k r) ((z/(q (φ n) R).1) • q (φ n) r) ≤ J*k R*‖z‖ := by + obtain ⟨q,φ,hφ,hq,hbounds⟩ := spectralTurning_outgoing_relative_bounds + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + obtain ⟨M,hM,hvalue⟩ := hbounds 1 (by norm_num) + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + let bs := fun n => b (φ n) + let os := fun n => omega (φ n) + let gs := fun n => gamma (φ n) + let rs := fun n => r₀ (φ n) + let ds := fun n => d (φ n) + let es := fun n => E (φ n) + have hrt : Tendsto rs atTop atTop := hr₀.comp hφ.tendsto_atTop + have hs : ∀ᶠ n in atTop, 0 < rs n ∧ 0 ≤ ds n ∧ 0 ≤ eta n ∧ |gs n| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) (rs n) = 0 ∧ + spectralLiouvilleSlope (eta n) (rs n)*(ds n)^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity,hn.2.2.2.2.1, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hs' : ∀ᶠ n in atTop, 0 < rs n ∧ 0 ≤ ds n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) (rs n) = 0 ∧ + spectralLiouvilleSlope (eta n) (rs n)*(ds n)^3 = 1 := hs.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.1,hn.2.2.2.2.2⟩) + have hd := spectralTurningScale_tendsto eta rs ds hrt + (hs.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hu := spectralTurningCoefficient_uniform_limit h bs eta os gs rs ds M 8 (by linarith) hrt hs + have hw := spectralTurning_regularized_outer_weights h bs eta os gs rs ds M 8 (by linarith) hrt hs + have hres := spectralTurning_eventual_residual_bound h bs eta os gs rs ds R M hR hM hrt hs' + have hpos := spectralTurning_oscillatory_uniform (fun n => ell (φ n)) h bs os gs rs ds es M hh hM hrt + (hφ.tendsto_atTop.eventually hdata) + let A : ℝ := (25/2)*Real.exp 2 + let C : ℝ := (M+3+(1 : ℝ)⁻¹)*max (1 : ℝ)⁻¹ (M+3)*Real.exp ((1+(M+1))*(M-(-M))) + let P : ℝ := 25*Real.exp (2304+25/4) + let K : ℝ := max A (C*A*P)*max A (C*P)/(1/16) + let J : ℝ := max A (C*P)/(1/16) + have hC : 0 ≤ C := by dsimp only [C]; positivity + have hP : 1 ≤ P := by + have he : 1 ≤ Real.exp (2304+(25/4 : ℝ)) := Real.one_le_exp_iff.mpr (by norm_num) + dsimp only [P] + linarith + refine ⟨q,φ,hφ,hq,K,J,by dsimp only [K,A]; positivity, + by dsimp only [J,A]; positivity,?_⟩ + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata,hs, + hvalue,hw,hres,hpos,(Metric.tendstoUniformlyOn_iff.mp hu) 1 (by norm_num), + hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*R+2) (2*M+2))))] + with n hqn hdn hsn hvn hwn hrn hpn hun hsmall hlarge + have hdp : 0 < ds n := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hc := hsn.2.2.2.2.2 + rw [← he] at hc + norm_num at hc + have hlargeR := (le_max_left (16/R) (max (2*R+2) (2*M+2))).trans hlarge + have hlargeRM := (le_max_right (16/R) (max (2*R+2) (2*M+2))).trans hlarge + have hbigR := (le_max_left (2*R+2) (2*M+2)).trans hlargeRM + have hbigM := (le_max_right (2*R+2) (2*M+2)).trans hlargeRM + have hMp : 0 < M := by linarith + have hMd : ds n*M < rs n/2 := by nlinarith + let a := rs n-ds n*M + let z := rs n+ds n*M + have hRa : R < a := by dsimp only [a]; linarith + have hzE : z < es n := by dsimp only [z,es,rs] at *; linarith [hdn.2.2.2.2.2.1] + have ha0 : 0 < a := hR.trans hRa + have haE : a ≤ es n := by dsimp only [a,z] at *; nlinarith + have hprod : 16 ≤ rs n*R := by + have ht := mul_le_mul_of_nonneg_right hlargeR hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at ht + have hF (t : ℝ) (ht : t ∈ Icc R a) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) t := by + have ht0 := hR.trans_le ht.1 + have htr : t < rs n := by dsimp only [a] at ht; nlinarith [ht.2] + have he := homogeneousSpectralLocalizationFrequency_strictMono h (bs n) (eta n) (os n) + hsn.2.2.1 ht0 hsn.1 htr + rw [hsn.2.2.2.2.1] at he + linarith + have hcoef (xi : ℝ) (hxi : xi ∈ Icc (-M) M) : + ‖spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi‖ ≤ M+1 := by + have he : ‖spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi-(xi : ℂ)‖ ≤ 1 := by + simpa only [dist_eq_norm,norm_sub_rev] using (hun xi hxi).le + have hx : ‖(xi : ℂ)‖ ≤ M := by simpa only [Complex.norm_real,Real.norm_eq_abs] using abs_le.mpr hxi + have hb := norm_add_le (spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi-(xi : ℂ)) (xi : ℂ) + rw [sub_add_cancel] at hb + linarith + let k := spectralTurningRegularizedWeight h (bs n) (eta n) (os n) (gs n) (ds n) + have hwl (t : ℝ) (ht : t ∈ Icc R a) : k t = + Real.sqrt ‖spectralLiouvilleMomentum (-1) h (bs n) (eta n) (os n) (gs n) t‖ := + hwn.1 t (hR.trans_le ht.1) ht.2 + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) t : ℂ)+Complex.I*(gs n : ℂ)) (Icc a (es n)) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (bs n) (eta n) (os n) t + (ha0.trans_le ht.1)).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (es n) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + change spectralScalarFlux (q (φ n) (es n)) = h at hf + rw [he] at hf + norm_num [spectralScalarFlux] at hf + nlinarith [hh] + have hqa : q (φ n) a ≠ 0 := spectralScalar_ne_zero_of_right a (es n) haE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRa.le.trans ht.1.le,ht.2.le⟩) hqE + have hN : 0 < spectralShellNorm (k a) (q (φ n) a) := by + have hkp := spectralTurningRegularizedWeight_pos h (bs n) (eta n) (os n) (gs n) (ds n) a hdp + exact lt_of_le_of_ne (spectralShellNorm_nonneg _ hkp.le _) (fun he => + hqa ((spectralShellNorm_eq_zero _ hkp _).mp he.symm)) + have hval : (1/16 : ℝ)*Real.exp ((∫ t in R..a, + spectralLiouvilleMomentum (-1) h (bs n) (eta n) (os n) (gs n) t).re)* + spectralShellNorm (k a) (q (φ n) a) ≤ k R*‖(q (φ n) R).1‖ := by + rw [hwl a ⟨hRa.le,le_rfl⟩,hwl R ⟨le_rfl,hRa.le⟩] + simpa only [a,bs,eta,os,gs,rs,ds,mul_comm M] using hvn.2 + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,hext⟩ := spectralTurning_regularized_green_and_extension + h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) M R (es n) C P hR hdp + (by linarith) hC hP hRa hzE hcoef le_rfl hF + (fun t ht => spectralTurning_negative_derivative_small (-1) h (bs n) (eta n) (os n) (gs n) + (rs n) (ds n) M R t (by norm_num) hsn.2.2.1 hsn.1 hdp hM hR hprod ht.1 + (by simpa only [mul_comm M] using ht.2) hsn.2.2.2.2.1 hsn.2.2.2.2.2) + (by simpa only [mul_comm M] using hrn) hwl + (by + intro v hvc hvD t ht + have he : rs n+M*ds n = z := by dsimp only [z]; ring + rw [he] at hpn + have hz := hwn.2 z le_rfl + have ht' := hwn.2 t ht.1 + have hp := (hpn v hvc hvD z ⟨le_rfl,hzE.le⟩ t ht ht.1).1 + dsimp only at hp + rw [← hz,← ht'] at hp + exact hp) + (q (φ n)) hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨ht.1.le,ht.2.le⟩) hN hval + refine ⟨Y,W,hYc,hYR,hYD,hW,hdet,?_,?_⟩ + · intro r hr t ht + apply (hgreen r hr t ht).trans_eq + dsimp only [K,A] + ring + · intro z r hr + exact hext z r hr + +theorem spectralTurning_outgoing_green_uniform + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∃ K : ℝ, 0 ≤ K ∧ ∀ᶠ n in atTop, + let k := spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y R = (0,(k R : ℂ)) ∧ + (∀ t ∈ Icc R (E (φ n)), HasDerivAt Y (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Y t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc R (E (φ n)), spectralScalarWronskian (Y t) (q (φ n) t) = W) ∧ + ∀ r ∈ Icc R (E (φ n)), ∀ t ∈ Icc R (E (φ n)), + spectralShellNorm (k r) (spectralScalarGreenState Y (q (φ n)) W r t) ≤ K/(k t) := by + obtain ⟨q,φ,hφ,hq,K,J,hK,_hJ,hall⟩ := spectralTurning_outgoing_green_extension_uniform + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,K,hK,?_⟩ + filter_upwards [hall] with n hn + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,_⟩ := hn + exact ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenSmallness.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenSmallness.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e1eba6f6e99c9c7c8ccca36ce100dcdc1b2d896 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningGreenSmallness.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGreenBranchBounds +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningWeightEscape +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGreenSmallness + +namespace OAI + +/-! In the regularized turning norm the full Green correction is bounded +by a fixed constant times the vanishing Airy scale. -/ + +open Set +namespace DefocusingNLS + +theorem spectralTurning_green_integral_bound + (h b eta omega gamma d R E r A C M : ℝ) + (hd : 0 < d) (hR : 0 < R) (hr : r ∈ Icc R E) + (hA : 0 ≤ A) (hC : 0 ≤ C) (hM : 0 ≤ M) + (D U : ℝ → ℂ × ℂ) (W : ℂ) (f : ℝ → ℂ) + (hDc : ContinuousOn D (Icc R E)) (hUc : ContinuousOn U (Icc R E)) + (hfc : ContinuousOn f (Icc R E)) (hW : W ≠ 0) + (hdet : spectralScalarWronskian (D r) (U r) = W) + (hgreen : ∀ t ∈ Icc R E, + let k := spectralTurningRegularizedWeight h b eta omega gamma d + spectralShellNorm (k r) (spectralScalarGreenState D U W r t) ≤ A/(k t)) + (hforcing : ∀ t ∈ Icc R E, ‖f t‖ ≤ C/((Real.sqrt d)⁻¹*t^2)*M) : + spectralShellNorm (spectralTurningRegularizedWeight h b eta omega gamma d r) + (spectralScalarGreenIntegral R E D U W f r) ≤ ((A+1)*C/R)*d*M := by + let k := spectralTurningRegularizedWeight h b eta omega gamma d + have hkap : 0 < (Real.sqrt d)⁻¹ := inv_pos.mpr (Real.sqrt_pos.mpr hd) + obtain ⟨hl,hright⟩ := spectralGreen_closed_branch_bounds D U W k R E A (Real.sqrt d)⁻¹ r + hr hA hkap (fun t _ => spectralTurning_weight_floor h b eta omega gamma d t) hW hdet hgreen + have hb := spectralScalarGreenIntegral_small R E r (k r) (Real.sqrt d)⁻¹ (A+1) C M hR hr + (spectralTurningRegularizedWeight_pos h b eta omega gamma d r hd).le hkap + (by linarith) hC hM D U W f hDc hUc hfc hl hright hforcing + apply hb.trans_eq + rw [inv_pow,Real.sq_sqrt hd.le] + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInnerCone.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInnerCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b76e6265865e7f6d45f3a92313306a379de82e1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInnerCone.lean @@ -0,0 +1,272 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOutgoingConnection +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningConeError +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleReflectedCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarNonzero +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterDerivative + +namespace OAI + +/-! The actual outgoing comparison enters the fixed inner Robin cone along +an escaping subsequence. Its turning coefficients and small-error hypotheses +are all supplied by the preceding construction. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_inner_cone + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ᶠ n in atTop, + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) R + (q (φ n) R).1 ≠ 0 ∧ + ‖(q (φ n) R).2+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/ + (4*p^2))*(q (φ n) R).1‖ ≤ (1/2 : ℝ)*‖p‖*‖(q (φ n) R).1‖ := by + obtain ⟨q,φ,hφ,hq,hmargin⟩ := spectralTurning_outgoing_growing_connection + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ (φ n))*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + have hd := spectralTurningScale_tendsto eta (fun n => r₀ (φ n)) (fun n => d (φ n)) hrt + (hsample.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have herr := spectralTurning_eventual_cone_error h (fun n => b (φ n)) eta + (fun n => omega (φ n)) (fun n => gamma (φ n)) (fun n => r₀ (φ n)) + (fun n => d (φ n)) R hR hrt hsample + obtain ⟨M,hMm,hMe⟩ := (hmargin.and herr).exists + have hM : 32 ≤ M := hMe.1 + have hMp : 0 < M := by linarith + refine ⟨q,φ,hφ,hq,?_⟩ + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + hsample,hMm,hMe.2,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*R) (2*M))))] + with n hqn hdn hsn hmn hen hsmalln hlarge + dsimp only [Function.comp_def] at hlarge + let c := r₀ (φ n)-M*d (φ n) + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hs := hsn.2.2.2.2 + rw [← he] at hs + norm_num at hs + have hRM := (le_max_right (16/R) (max (2*R) (2*M))).trans hlarge + have hRhalf : R ≤ r₀ (φ n)/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hRM] + have hMd : M*d (φ n) ≤ r₀ (φ n)/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hRM] + have hprod : 16 ≤ r₀ (φ n)*R := by + have hl := mul_le_mul_of_nonneg_right ((le_max_left (16/R) (max (2*R) (2*M))).trans hlarge) hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at hl + have hRc : R ≤ c := by dsimp only [c]; linarith + have hct : c < r₀ (φ n) := by dsimp only [c]; nlinarith + have hcE : c ≤ E (φ n) := hct.le.trans (by linarith [hdn.2.2.2.2.2.1]) + have hF (t : ℝ) (ht : t ∈ Icc R c) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h (b (φ n)) (eta n) (omega (φ n)) + hsn.2.2.1 (hR.trans_le ht.1) hsn.1 (ht.2.trans_lt hct) + rw [hsn.2.2.2.1] at hf + linarith + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Icc c (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) (eta n) (omega (φ n)) t + (hR.trans_le (hRc.trans ht.1))).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (E (φ n)) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + rw [he] at hf + have hz : spectralScalarFlux (0 : ℂ × ℂ) = 0 := by simp [spectralScalarFlux] + rw [hz] at hf + nlinarith [hh] + have hqc : q (φ n) c ≠ 0 := spectralScalar_ne_zero_of_right c (E (φ n)) hcE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRc.trans ht.1.le,ht.2.le⟩) hqE + have hk : 0 < Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) c‖ := + spectralLiouville_norm_weight_pos (-1) h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) c + (by norm_num) (by intro he; have hf := hF c ⟨hRc,le_rfl⟩; rw [he,mul_zero] at hf; linarith) + have hN : 0 < spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + (eta n) (omega (φ n)) (gamma (φ n)) c‖) (q (φ n) c) := by + by_contra hbad + have hz := le_antisymm (le_of_not_gt hbad) (spectralShellNorm_nonneg _ hk.le _) + exact hqc ((spectralShellNorm_eq_zero _ hk _).mp hz) + apply spectralLiouville_reflected_cone h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) R c + hR hRc hF + (fun t ht => spectralTurning_negative_derivative_small (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) (d (φ n)) M R t (by norm_num) + hsn.2.2.1 hsn.1 hdp hM hR hprod ht.1 ht.2 hsn.2.2.2.1 hsn.2.2.2.2) + (q (φ n)) hqn.1.continuousOn + (fun t ht => hqn.2.2.2 t ⟨ht.1.le,ht.2.le.trans hcE⟩) hN + · simpa only [eta, c, div_eq_mul_inv, mul_comm, one_mul] using hmn + · exact hen + +theorem spectralTurning_outgoing_relative_bounds + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ eps : ℝ, 0 < eps → ∃ M : ℝ, 32 ≤ M ∧ ∀ᶠ n in atTop, + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) R + ((q (φ n) R).1 ≠ 0 ∧ + ‖(q (φ n) R).2+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/ + (4*p^2))*(q (φ n) R).1‖ ≤ eps*‖p‖*‖(q (φ n) R).1‖) ∧ + (1/16 : ℝ)*Real.exp ((∫ t in R..(r₀ (φ n)-M*d (φ n)), + spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) t).re)* + spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) + (r₀ (φ n)-M*d (φ n))‖) (q (φ n) (r₀ (φ n)-M*d (φ n))) ≤ + Real.sqrt ‖p‖*‖(q (φ n) R).1‖ := by + obtain ⟨q,φ,hφ,hq,hmargin⟩ := spectralTurning_outgoing_growing_connection + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,?_⟩ + intro eps heps + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ (φ n))*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + have hd := spectralTurningScale_tendsto eta (fun n => r₀ (φ n)) (fun n => d (φ n)) hrt + (hsample.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have herr := spectralTurning_eventual_relative_error (min (1/16) (eps/40)) + (lt_min (by norm_num) (by positivity)) h (fun n => b (φ n)) eta + (fun n => omega (φ n)) (fun n => gamma (φ n)) (fun n => r₀ (φ n)) + (fun n => d (φ n)) R hR hrt hsample + obtain ⟨M,hMm,hMe⟩ := (hmargin.and herr).exists + have hM : 32 ≤ M := hMe.1 + have hMp : 0 < M := by linarith + refine ⟨M,hM,?_⟩ + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + hsample,hMm,hMe.2,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*R) (2*M))))] + with n hqn hdn hsn hmn hen hsmalln hlarge + dsimp only [Function.comp_def] at hlarge + let c := r₀ (φ n)-M*d (φ n) + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hs := hsn.2.2.2.2 + rw [← he] at hs + norm_num at hs + have hRM := (le_max_right (16/R) (max (2*R) (2*M))).trans hlarge + have hRhalf : R ≤ r₀ (φ n)/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hRM] + have hMd : M*d (φ n) ≤ r₀ (φ n)/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hRM] + have hprod : 16 ≤ r₀ (φ n)*R := by + have hl := mul_le_mul_of_nonneg_right ((le_max_left (16/R) (max (2*R) (2*M))).trans hlarge) hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at hl + have hRc : R ≤ c := by dsimp only [c]; linarith + have hct : c < r₀ (φ n) := by dsimp only [c]; nlinarith + have hcE : c ≤ E (φ n) := hct.le.trans (by linarith [hdn.2.2.2.2.2.1]) + have hF (t : ℝ) (ht : t ∈ Icc R c) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h (b (φ n)) (eta n) (omega (φ n)) + hsn.2.2.1 (hR.trans_le ht.1) hsn.1 (ht.2.trans_lt hct) + rw [hsn.2.2.2.1] at hf + linarith + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Icc c (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) (eta n) (omega (φ n)) t + (hR.trans_le (hRc.trans ht.1))).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (E (φ n)) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + rw [he] at hf + have hz : spectralScalarFlux (0 : ℂ × ℂ) = 0 := by simp [spectralScalarFlux] + rw [hz] at hf + nlinarith [hh] + have hqc : q (φ n) c ≠ 0 := spectralScalar_ne_zero_of_right c (E (φ n)) hcE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRc.trans ht.1.le,ht.2.le⟩) hqE + have hk : 0 < Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) c‖ := + spectralLiouville_norm_weight_pos (-1) h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) c + (by norm_num) (by intro he; have hf := hF c ⟨hRc,le_rfl⟩; rw [he,mul_zero] at hf; linarith) + have hN : 0 < spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + (eta n) (omega (φ n)) (gamma (φ n)) c‖) (q (φ n) c) := by + by_contra hbad + have hz := le_antisymm (le_of_not_gt hbad) (spectralShellNorm_nonneg _ hk.le _) + exact hqc ((spectralShellNorm_eq_zero _ hk _).mp hz) + apply spectralLiouville_reflected_relative_bounds eps heps h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) R c + hR hRc hF + (fun t ht => spectralTurning_negative_derivative_small (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) (d (φ n)) M R t (by norm_num) + hsn.2.2.1 hsn.1 hdp hM hR hprod ht.1 ht.2 hsn.2.2.2.1 hsn.2.2.2.2) + (q (φ n)) hqn.1.continuousOn + (fun t ht => hqn.2.2.2 t ⟨ht.1.le,ht.2.le.trans hcE⟩) hN + · simpa only [eta, c, div_eq_mul_inv, mul_comm, one_mul] using hmn + · exact hen + +theorem spectralTurning_outgoing_relative_cone + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ eps : ℝ, 0 < eps → ∀ᶠ n in atTop, + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) R + (q (φ n) R).1 ≠ 0 ∧ + ‖(q (φ n) R).2+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) R : ℂ)/ + (4*p^2))*(q (φ n) R).1‖ ≤ eps*‖p‖*‖(q (φ n) R).1‖ := by + obtain ⟨q,φ,hφ,hq,hbounds⟩ := spectralTurning_outgoing_relative_bounds + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,?_⟩ + intro eps heps + obtain ⟨M,_,hM⟩ := hbounds eps heps + exact hM.mono (fun _ hn => hn.1) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInwardSystem.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInwardSystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5658477ddaff5500a718e36aa489d20abf9cead --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningInwardSystem.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningBoundarySystem +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningBoundaryCoercive +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit + +namespace OAI + +/-! The actual normalized turning comparison has an inward boundary slope +in the same regularized norm used by the coupled Green estimate. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_inward_systems + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, + ∃ S : SpectralScalarBoundarySystem R (E (φ n)) K, + S.k = spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) ∧ + S.V = (fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) ∧ + S.beta = (h : ℂ)*Complex.I*(Real.sqrt (homogeneousSpectralLocalizationFrequency h + (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) : ℂ) ∧ + (∀ z : ℂ, ∀ r ∈ Icc R (E (φ n)), + spectralShellNorm (S.k r) (S.extension z r) ≤ J*S.k R*‖z‖) ∧ + ((S.U R).2/(S.U R).1).re ≤ -(1/24 : ℝ)*(S.k R)^2 ∧ + S.U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) := by + have hddata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ + 0 ≤ (ell n : ℝ)*(ell n+10) ∧ |gamma n| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*((ell n : ℝ)*(ell n+10)+99/4)/(r₀ n)^3)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.1,hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hd0 := spectralTurningScale_tendsto (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hr₀ + (hddata.mono (fun _ hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hout := spectralTurning_regularized_outer_weights h b + (fun n => (ell n : ℝ)*(ell n+10)) omega gamma r₀ d 2 8 (by norm_num) hr₀ hddata + have hinner : ∀ᶠ n in atTop, + (spectralTurningRegularizedWeight h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (gamma n) (d n) R)^2 = + ‖spectralLiouvilleMomentum (-1) h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (gamma n) R‖ := by + filter_upwards [hout,hr₀.eventually (eventually_ge_atTop (R+2)), + hd0.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1))] with n hn hr hd + rw [hn.1 R hR (by linarith),Real.sq_sqrt (norm_nonneg _)] + obtain ⟨φ,hφ,hin⟩ := spectralTurning_normalized_inward ell h b omega gamma r₀ d E R hh hR hr₀ hdata + obtain ⟨ψ,K,J,hψ,hK,hJ,hsys⟩ := spectralTurning_boundary_systems + (ell ∘ φ) h (b ∘ φ) (omega ∘ φ) (gamma ∘ φ) (r₀ ∘ φ) (d ∘ φ) (E ∘ φ) R hh hR + (hr₀.comp hφ.tendsto_atTop) (hφ.tendsto_atTop.eventually hdata) + refine ⟨φ ∘ ψ,K,J,hφ.comp hψ,hK,hJ,?_⟩ + filter_upwards [hsys,hψ.tendsto_atTop.eventually hin, + (hφ.comp hψ).tendsto_atTop.eventually hinner] with n hsn hinn hkn + obtain ⟨S,hk,hV,hbeta,hUE,hext⟩ := hsn + refine ⟨S,hk,hV,hbeta,hext,?_,hUE⟩ + have hi := hinn S.U S.continuous_U (by simpa only [hV,Function.comp_def] using S.ode_U) hUE + rw [hk] + simp only [Function.comp_def] at hkn ⊢ + rw [hkn] + exact hi + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningLogarithmicLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningLogarithmicLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b294973d1b7d36d23a9711d3040cf2557872e76c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningLogarithmicLimit.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningInnerCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRobinRelative + +namespace OAI + +/-! The same actual scalar outgoing family has relative logarithmic slope +minus one at every fixed inner radius along its selected subsequence. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_logarithmic_limit + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + (∀ᶠ n in atTop, (q (φ n) R).1 ≠ 0) ∧ + Tendsto (fun n => ((q (φ n) R).2/(q (φ n) R).1)/ + spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) R) atTop (𝓝 (-1)) := by + obtain ⟨q,φ,hφ,hq,hcone⟩ := spectralTurning_outgoing_relative_cone + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,(hcone 1 (by norm_num)).mono (fun _ hn => hn.1),?_⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + have hcorr : Tendsto (fun n => 16/(R*r₀ (φ n))) atTop (𝓝 0) := by + convert (tendsto_inv_atTop_zero.comp hrt).const_mul (16/R) using 1 + · funext n + simp only [Function.comp_def,div_eq_mul_inv,mul_inv_rev] + ring + · ring_nf + rw [Metric.tendsto_nhds] + intro eps heps + filter_upwards [hcone (eps/2) (by positivity), hφ.tendsto_atTop.eventually hdata, + hrt.eventually (eventually_ge_atTop (2*R)), + hcorr.eventually (gt_mem_nhds (by positivity : (0 : ℝ) < eps/2))] with n hn hd hl hcn + dsimp only [Function.comp_def] at hl + let eta := (ell (φ n) : ℝ)*(ell (φ n)+10) + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) eta (omega (φ n)) (gamma (φ n)) R + let c : ℂ := (spectralLiouvilleSlope eta R : ℂ)/(4*p^2) + have heta : 0 ≤ eta := by dsimp only [eta]; positivity + have hRh : R ≤ r₀ (φ n)/2 := by linarith + have hz : homogeneousSpectralLocalizationFrequency h (b (φ n)) eta (omega (φ n)) + (r₀ (φ n)) = 0 := hd.2.2.2.2.2.2.2.1 + have hpre := spectralTurning_far_momentum_re_lower h (b (φ n)) eta (omega (φ n)) + (gamma (φ n)) (r₀ (φ n)) R heta hd.1 hR hRh hz + have hp : p ≠ 0 := by + intro hp0 + change r₀ (φ n)/16 ≤ p.re at hpre + rw [hp0,Complex.zero_re] at hpre + linarith [hd.1] + have hc : ‖c/p‖ ≤ 16/(R*r₀ (φ n)) := + spectralTurning_log_correction_bound h (b (φ n)) eta (omega (φ n)) + (gamma (φ n)) (r₀ (φ n)) R heta hd.1 hR hRh hz + have he := spectralRobin_relative_residual p c (q (φ n) R) (eps/2) hn.1 hp hn.2 + change dist (((q (φ n) R).2/(q (φ n) R).1)/p) (-1) < eps + rw [dist_eq_norm,sub_neg_eq_add] + exact (he.trans (add_le_add le_rfl hc)).trans_lt (by linarith) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningMomentumLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningMomentumLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..eba8e68583688a1e06b68f925df67488eb2164b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningMomentumLimit.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleFrequencyJet +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralComplexSqrtScale +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformLimit + +namespace OAI + +/-! The complex forbidden-side momentum, after the actual turning scaling, +converges to the positive Airy momentum at every fixed observation point. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_negative_momentum_tendsto + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (T G : ℝ) (hT : 0 < T) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + Tendsto (fun n => (d n : ℂ)*spectralLiouvilleMomentum (-1) h (b n) (eta n) + (omega n) (gamma n) (r₀ n-d n*T)) atTop (𝓝 (Real.sqrt T : ℂ)) := by + let Z := fun n => -spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) (-T) + have hu := (spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d T G hT.le + hr₀ hdata).tendsto_at (show -T ∈ Icc (-T) T from ⟨le_rfl,by linarith⟩) + have hZ : Tendsto Z atTop (𝓝 (T : ℂ)) := by + simpa only [Z,Complex.ofReal_neg,neg_neg] using hu.neg + have hroot : Tendsto (fun n => Complex.sqrt (Z n)) atTop (𝓝 (Real.sqrt T : ℂ)) := by + have hs := (Complex.continuousAt_sqrt (z := (T : ℂ)) (Or.inl (by simpa using hT.le))).tendsto.comp hZ + have he : Complex.sqrt (T : ℂ) = (Real.sqrt T : ℂ) := by + apply Complex.sqrt_of_nonneg + exact_mod_cast hT.le + simpa only [he,Function.comp_def] using hs + apply hroot.congr' + filter_upwards [hdata,((Complex.continuous_re.tendsto (T : ℂ)).comp hZ).eventually + (lt_mem_nhds hT)] with n hn hre + have hdp : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hs := hn.2.2.2.2.2 + rw [← he] at hs + norm_num at hs + let z := spectralWKBSquaredMomentum (-1) + (homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n-d n*T)) (gamma n) + have he : Z n = (d n : ℂ)^2*z := by + dsimp only [Z,z,spectralTurningCoefficient,spectralWKBSquaredMomentum] + simp only [mul_neg,sub_eq_add_neg] + push_cast + ring + have hz : 0 < z.re := by + dsimp only [Function.comp_def] at hre + rw [he] at hre + simp only [← Complex.ofReal_pow,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im, + zero_mul,sub_zero] at hre + nlinarith [sq_nonneg (d n)] + rw [he,spectralComplexSqrt_scale (d n) hdp z hz] + rfl + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNearPhase.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNearPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c3d0e1816d61d7935cebd784259cbaf9db213dd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNearPhase.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPotentialBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPhaseIntegral +import Mathlib.Analysis.SpecialFunctions.Sqrt + +namespace OAI + +/-! A uniform phase integral over either near-turning outer interval. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_near_phase (sign h b eta omega r₀ a c : ℝ) + (hs : sign^2=1) (heta : 0≤eta) (hr₀ : 0 Real.sqrt (sign*F t) + have hg : 0 (hD t ht).continuousAt.continuousWithinAt + have hp : ContinuousOn p (Icc a c) := Real.continuous_sqrt.comp_continuousOn (continuousOn_const.mul hFc) + have hp0 (t : ℝ) (ht : t ∈ Icc a c) : 0

+ (spectralLiouvilleSlope_hasDerivAt eta t (ht0 t ht)).continuousAt.continuousWithinAt + have hbound (t : ℝ) (ht : t ∈ Icc a c) : p t≤8*g := by + have hpot := spectralTurning_potential_slope_bound h b eta omega r₀ t heta hr₀ + (ha.trans ht.1) (ht.2.trans hc) hz + have hsign : sign*F t≤|F t| := by + rcases sq_eq_one_iff.mp hs with h | h + · rw [h,one_mul]; exact le_abs_self _ + · rw [h,neg_one_mul]; exact neg_le_abs _ + have hp2 : (p t)^2=sign*F t := Real.sq_sqrt (hF t ht).le + have hpn := (hp0 t ht).le + nlinarith + have hh := spectralWKB_phase_integral a c (g/8) (8*g) sign hac + (div_pos hg (by norm_num)) hs p (spectralLiouvilleSlope eta) hp hgc hp0 + (fun t ht => (spectralLiouvilleSlope_near eta r₀ t heta hr₀ + (ha.trans ht.1) (ht.2.trans hc)).1) + (hbound a ⟨le_rfl,hac⟩) (hbound c ⟨hac,le_rfl⟩) + (fun t ht => ((hD t ⟨ht.1.le,ht.2.le⟩).const_mul sign).sqrt (hF t ⟨ht.1.le,ht.2.le⟩).ne') + calc + _ ≤ 4*(8*g)/(g/8) := hh + _ = 256 := by field_simp [hg.ne']; norm_num + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeErrorLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeErrorLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec0c79d07570fc673c6c25e5f7c1e0b86160a6a9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeErrorLimit.lean @@ -0,0 +1,31 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningErrorLimit + +namespace OAI + +/-! Limit of the explicit forbidden-side residual bound, with the inner +radius fixed and the Airy cutoff chosen before the escaping sequence. -/ + +open Filter Topology +namespace DefocusingNLS + +noncomputable def spectralTurningNegativeError (M R r₀ d : ℝ) : ℝ := + spectralTurningCutoffError M+3*d/(r₀*Real.sqrt (M/8))+64/(r₀*R) + +theorem spectralTurningNegativeError_tendsto (M R : ℝ) (r₀ d : ℕ → ℝ) + (hr₀ : Tendsto r₀ atTop atTop) (hd : Tendsto d atTop (𝓝 0)) : + Tendsto (fun n => spectralTurningNegativeError M R (r₀ n) (d n)) atTop + (𝓝 (spectralTurningCutoffError M)) := by + have hi := tendsto_inv_atTop_zero.comp hr₀ + have hnear := (hd.mul hi).const_mul (3/Real.sqrt (M/8)) + have hfar := hi.const_mul (64/R) + have hlim := (tendsto_const_nhds : Tendsto (fun _ : ℕ => spectralTurningCutoffError M) + atTop (𝓝 (spectralTurningCutoffError M))).add (hnear.add hfar) + convert hlim using 1 + · funext n + dsimp only [spectralTurningNegativeError,Function.comp_def] + ring + · simp only [mul_zero,add_zero] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..a31100f01b11d0d7939eb1322c6039afb449006a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningNegativeIntegral.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBDecreasingIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBScaledEndpoint + +namespace OAI + +/-! The near-turning forbidden interval has the same uniform residual error. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_negative_scaled_integral (h b eta omega r₀ d M a : ℝ) + (heta : 0≤eta) (hr₀ : 0 (hFD t ht).continuousAt.continuousWithinAt + have hgc : ContinuousOn (spectralLiouvilleSlope eta) (Icc a c) := + fun t ht => (spectralLiouvilleSlope_hasDerivAt eta t (ht0 t ht)).continuousAt.continuousWithinAt + have hec : ContinuousOn (spectralLiouvilleSecond eta) (Icc a c) := by + apply continuousOn_const.sub + apply continuousOn_const.div (continuousOn_id.pow 4) + exact fun t ht => pow_ne_zero _ (ht0 t ht).ne' + have hB : 0≤8*spectralLiouvilleSlope eta r₀ := by + dsimp only [spectralLiouvilleSlope] + positivity + have hint := spectralWKB_decreasing_residual_integral a c (6/r₀) + (8*spectralLiouvilleSlope eta r₀) hac (by positivity) hB + (fun t => Real.sqrt (-F t)) (spectralLiouvilleSlope eta) (spectralLiouvilleSecond eta) + (Real.continuous_sqrt.comp_continuousOn hFc.neg) hgc hec + (fun t ht => Real.sqrt_pos.2 (neg_pos.2 (hF0 t ht))) + (fun t ht => by dsimp only [spectralLiouvilleSlope]; have := ht0 t ht; positivity) + (fun t ht => (spectralLiouvilleSlope_near eta r₀ t heta hr₀ + (ha.trans ht.1) (by linarith [ht.2])).2) + (fun t ht => spectralLiouvilleSecond_near eta r₀ t heta hr₀ (ha.trans ht.1)) + (fun t ht => by + have hh := (hFD t ⟨ht.1.le,ht.2.le⟩).neg.sqrt (neg_ne_zero.mpr (hF0 t ⟨ht.1.le,ht.2.le⟩).ne) + simpa only [Pi.neg_apply,neg_div] using hh) + have hcC : c ∈ Icc a c := ⟨hac,le_rfl⟩ + have hp : 0 spectralTurning_negative_derivative_small (-1) h b eta omega gamma r₀ d M R t + (by norm_num) heta hr₀ hd hM hR hlarge ht.1 ht.2 hz hscale) hphase + (by + simpa only [neg_one_mul] using + spectralTurning_negative_outer_phase h b eta omega r₀ d M R + heta hr₀ hd hMp hR hRhalf hMd hz) + (spectralTurning_outer_negative_error h b eta omega gamma r₀ d M R + heta hr₀ hd hMp hR hRhalf hMd hz hscale) q hq hODE + simpa only [Complex.one_re,one_mul,neg_one_mul] using ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOscillatoryUniform.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOscillatoryUniform.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0b841e2609bde2ba3c14975a4e8dca758c0e31c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOscillatoryUniform.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleOscillatoryBounds +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningResidualUniform + +namespace OAI + +/-! A fixed constant controls every oscillatory subinterval in the actual +escaping family. The fixed cutoff is chosen before the sequence index. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_oscillatory_uniform + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (M : ℝ) + (hh : h^2 = 1) (hM : 32 ≤ M) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∀ᶠ n in atTop, ∀ q : ℝ → ℂ × ℂ, ContinuousOn q (Icc (r₀ n+M*d n) (E n)) → + (∀ t ∈ Ioo (r₀ n+M*d n) (E n), HasDerivAt q (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+ + Complex.I*(gamma n : ℂ)) (q t)) t) → + ∀ r ∈ Icc (r₀ n+M*d n) (E n), ∀ t ∈ Icc (r₀ n+M*d n) (E n), r ≤ t → + let k := fun s => Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (gamma n) s‖ + spectralShellNorm (k t) (q t) ≤ (25*Real.exp (2304+25/4))*spectralShellNorm (k r) (q r) ∧ + spectralShellNorm (k r) (q r) ≤ (25*Real.exp (2304+25/4))*spectralShellNorm (k t) (q t) := by + let eta := fun n => (ell n : ℝ)*(ell n+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity,hn.2.2.2.2.2.2.2.2⟩ + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ hsample + have he := spectralTurningOuterError_tendsto M r₀ d hr₀ hd + have hsmallLimit : spectralTurningCutoffError M < 1 := by linarith [spectralTurningCutoffError_le M hM] + filter_upwards [hdata,he.eventually (gt_mem_nhds hsmallLimit), + hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max 2 M))] with n hn hen hdn hrn + have hr2 : 2 ≤ r₀ n := (le_max_left 2 M).trans hrn + have hMr : M ≤ r₀ n := (le_max_right 2 M).trans hrn + have hMp : 0 < M := by linarith + have hdp : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro heq + have hs := hn.2.2.2.2.2.2.2.2 + rw [← heq] at hs + norm_num at hs + have hMd : M*d n ≤ r₀ n := by nlinarith + let a := r₀ n+M*d n + have ha : 0 < a := by dsimp only [a]; positivity + have haE : a ≤ E n := by dsimp only [a]; linarith [hn.2.2.2.2.2.1] + have hz : homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 := hn.2.2.2.2.2.2.2.1 + have hsc : spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1 := hn.2.2.2.2.2.2.2.2 + have heta : 0 ≤ eta n := by dsimp only [eta]; positivity + have hF (t : ℝ) (ht : t ∈ Icc a (E n)) : 0 < homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) t := by + have hlt : r₀ n < t := by dsimp only [a] at ht; nlinarith [ht.1] + have hm := homogeneousSpectralLocalizationFrequency_strictMono h (b n) (eta n) (omega n) + heta hn.1 (ha.trans_le ht.1) hlt + rwa [hz] at hm + have hA : (∫ t in a..E n, 1/Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) t)) ≤ 288 := by + simpa only [one_mul] using spectralTurning_positive_outer_phase (ell n) h (b n) (omega n) + (r₀ n) (d n) M (E n) hh hn.2.2.1 hn.2.2.2.1 hn.1 hdp hMp hMd + hn.2.2.2.2.2.1 hn.2.2.2.2.2.2.1 hz + have hB : (∫ t in a..E n, ‖spectralLiouvilleResidual 1 h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum 1 h (b n) (eta n) (omega n) (gamma n) t‖) ≤ 1 := + (spectralTurning_outer_positive_error h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) + M (E n) heta hn.1 hdp hMp hMd hn.2.2.2.2.2.1 hz hsc).trans hen.le + intro q hq hODE r hr t ht hrt + have hb := spectralLiouville_oscillatory_subinterval h (b n) (eta n) (omega n) (gamma n) + a (E n) 288 1 ha haE hF + (fun s hs => spectralTurning_positive_derivative_small 1 h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) M s (by norm_num) heta hr2 hdp hM hs.1 hz hsc) + hA hB r t hr ht hrt q hq hODE + have hNr : 0 ≤ spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) + (omega n) (gamma n) r‖) (q r) := spectralShellNorm_nonneg _ (Real.sqrt_nonneg _) _ + have hNt : 0 ≤ spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) (eta n) + (omega n) (gamma n) t‖) (q t) := spectralShellNorm_nonneg _ (Real.sqrt_nonneg _) _ + have hexp : Real.exp (|gamma n| *288+(25/4)*1) ≤ Real.exp (2304+25/4) := by + apply Real.exp_le_exp.mpr + linarith [hn.2.2.2.2.1] + have hc : 2*((25/4 : ℝ)*Real.exp (|gamma n| *288+(25/4)*1)) ≤ 25*Real.exp (2304+25/4) := by + nlinarith [Real.exp_pos (2304+25/4)] + have hc' : (25/4 : ℝ)*Real.exp (|gamma n| *288+(25/4)*1) ≤ 25*Real.exp (2304+25/4) := by + nlinarith [Real.exp_pos (|gamma n| *288+(25/4)*1)] + constructor + · exact hb.1.trans (mul_le_mul_of_nonneg_right hc' hNr) + · exact hb.2.trans (mul_le_mul_of_nonneg_right hc hNt) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..49ba0c33cd801002c55292a43acf1f1374c1ae0e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterDerivative.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningDerivativeSmall +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningFarGeometry + +namespace OAI + +/-! The actual momentum satisfies the WKB small-derivative condition throughout +both outer intervals, with explicit cutoffs on the radius and Airy scale. -/ + +namespace DefocusingNLS + +theorem spectralWKB_radial_slope_small (r p g : ℝ) (hr : 0 ‖spectralLiouvilleResidual (-1) h b eta omega gamma t‖/ + ‖spectralLiouvilleMomentum (-1) h b eta omega gamma t‖ + have hhalf : r₀/2≤c := by dsimp only [c]; linarith + have hc : c 1/Real.sqrt (sign*homogeneousSpectralLocalizationFrequency h b eta omega t)) + (Icc a c) := by + have hFc : ContinuousOn (homogeneousSpectralLocalizationFrequency h b eta omega) (Icc a c) := + fun t ht => (homogeneousSpectralLocalizationFrequency_hasDerivAt h b eta omega t + (ha.trans_le ht.1)).continuousAt.continuousWithinAt + exact continuousOn_const.div (Real.continuous_sqrt.comp_continuousOn (continuousOn_const.mul hFc)) + (fun t ht => (Real.sqrt_pos.2 (hF t ht)).ne') + +theorem spectralTurning_positive_outer_phase (ell : ℕ) (h b omega r₀ d M E : ℝ) + (hh : h^2=1) (hb : 0≤b) (hb1 : b≤1) (hr₀ : 0 1/Real.sqrt (homogeneousSpectralLocalizationFrequency h b eta omega t) + have heta : 0≤eta := by dsimp only [eta]; positivity + have ha : r₀ by simpa only [one_mul] using hF t ht) + have hiL : IntervalIntegrable f volume a (2*r₀) := (hf.mono (Icc_subset_Icc le_rfl hE)).intervalIntegrable_of_Icc hac + have hiR : IntervalIntegrable f volume (2*r₀) E := (hf.mono (Icc_subset_Icc hac le_rfl)).intervalIntegrable_of_Icc hE + have hnear := spectralTurning_near_phase 1 h b eta omega r₀ a (2*r₀) + (by norm_num) heta hr₀ (by linarith) hac le_rfl hz + (fun t ht => by simpa only [one_mul] using hF t ⟨ht.1,ht.2.trans hE⟩) + simp only [one_mul] at hnear + have hfar := spectralTurning_positive_far_phase ell h b omega r₀ E hh hb hb1 hr₀ hE hscale hz + calc + _ = (∫ t in a..(2*r₀), f t)+(∫ t in (2*r₀)..E, f t) := + (intervalIntegral.integral_add_adjacent_intervals hiL hiR).symm + _ ≤ 256+32 := add_le_add hnear hfar + _ = 288 := by norm_num + +theorem spectralTurning_negative_outer_phase (h b eta omega r₀ d M a : ℝ) + (heta : 0≤eta) (hr₀ : 0 1/Real.sqrt (-homogeneousSpectralLocalizationFrequency h b eta omega t) + have hhalf : r₀/2≤c := by dsimp only [c]; linarith + have hc : c by simpa only [neg_one_mul] using hF t ht) + have hiL : IntervalIntegrable f volume a (r₀/2) := (hf.mono (Icc_subset_Icc le_rfl hhalf)).intervalIntegrable_of_Icc hahalf + have hiR : IntervalIntegrable f volume (r₀/2) c := (hf.mono (Icc_subset_Icc hahalf le_rfl)).intervalIntegrable_of_Icc hhalf + have hnear := spectralTurning_near_phase (-1) h b eta omega r₀ (r₀/2) c + (by norm_num) heta hr₀ le_rfl hhalf (by linarith) hz + (fun t ht => by simpa only [neg_one_mul] using hF t ⟨hahalf.trans ht.1,ht.2⟩) + simp only [neg_one_mul] at hnear + have hfar := spectralTurning_negative_far_phase h b eta omega r₀ a (r₀/2) + heta hr₀ ha hahalf le_rfl hz + calc + _ = (∫ t in a..(r₀/2), f t)+(∫ t in (r₀/2)..c, f t) := + (intervalIntegral.integral_add_adjacent_intervals hiL hiR).symm + _ ≤ 4+256 := add_le_add hfar hnear + _ = 260 := by norm_num + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterPositive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterPositive.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3896504162b37c6db150488cd677184fe8adfe6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOuterPositive.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningComplexIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningFarIntegral + +namespace OAI + +/-! Integrated residual on the entire oscillatory side of a turning point. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_outer_positive_error (h b eta omega gamma r₀ d M E : ℝ) + (heta : 0≤eta) (hr₀ : 0 ‖spectralLiouvilleResidual 1 h b eta omega gamma t‖/ + ‖spectralLiouvilleMomentum 1 h b eta omega gamma t‖ + have ha : r₀ spectralTurningAiryState (r₀ (φ n)) (d (φ n)) + (Real.sqrt (d (φ n))) (q (φ n))) p atTop (Icc (-M) c) := by + obtain ⟨q,hq⟩ := spectralTurning_outgoing_family ell h b omega gamma r₀ d E M R + hh hM hR hr₀ hdata + have hd : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ (ell n : ℝ)*(ell n+10) ∧ + |gamma n| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*((ell n : ℝ)*(ell n+10)+99/4)/(r₀ n)^3)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.1, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hqc : ∀ᶠ n in atTop, Continuous (q n) ∧ ∀ t ∈ Icc R (2*r₀ n), + HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ) + Complex.I*(gamma n : ℂ)) + (q n t)) t := by + filter_upwards [hdata,hq] with n hn hqn + exact ⟨hqn.1,fun t ht => hqn.2.2.2.2 t ⟨ht.1,ht.2.trans hn.2.2.2.2.2.1⟩⟩ + have hqb : ∀ᶠ n in atTop, spectralShellNorm + (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (gamma n) (r₀ n+d n*M)‖) (q n (r₀ n+d n*M)) ≤ + (75/2 : ℝ)*Real.exp (8*288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+11)) := by + filter_upwards [hq] with n hn + simpa only [mul_comm (d n) M] using hn.2.2.2.1 + obtain ⟨φ,p,hφ,hp,hpD,hlim⟩ := spectralTurningAiry_subsequence h b + (fun n => (ell n : ℝ)*(ell n+10)) omega gamma r₀ d M R 8 + ((75/2 : ℝ)*Real.exp (8*288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+11))) + (by linarith) q hr₀ hd hqc hqb + refine ⟨q,φ,p,hφ,hp,?_,hpD,hlim⟩ + exact hq.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..53a9e21eb13b14122bb396c98442561813c8d211 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBound.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralOutgoingComparison +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveReverse + +namespace OAI + +/-! Construct the normalized outgoing scalar solution on the full comparison +interval and bound its Cauchy data just to the right of the turning point. -/ + +open Set +namespace DefocusingNLS + +theorem spectralTurning_outgoing_comparison_bound + (ell : ℕ) (h b omega gamma r₀ d M R E : ℝ) + (hh : h^2=1) (hb : 0≤b) (hb1 : b≤1) (hr₀ : 16≤r₀) (hd : 0 hqD t ⟨hRa.trans ht.1.le,ht.2.le⟩) + calc + _ ≤ ((25/2 : ℝ)*Real.exp (|gamma| * 288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+ + 3*d/(r₀*Real.sqrt (M/8))+8/r₀^2)))* + spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma E‖) (q E) := hbound + _ ≤ ((25/2 : ℝ)*Real.exp (|gamma| * 288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+ + 3*d/(r₀*Real.sqrt (M/8))+8/r₀^2)))*3 := mul_le_mul_of_nonneg_left hnorm (by positivity) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBranch.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBranch.lean new file mode 100644 index 0000000000000000000000000000000000000000..370d3124dee4651f25b6a007883562498aad227e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingBranch.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleOutgoingBranch +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveError + +namespace OAI + +/-! The actual normalized outgoing comparison solution is close to its one +selected WKB branch on the positive outer interval. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_positive_branch_error + (ell : ℕ) (h b omega gamma r₀ d M E : ℝ) + (hh : h^2 = 1) (hb : 0 ≤ b) (hb1 : b ≤ 1) (hr₀ : 2 ≤ r₀) (hd : 0 < d) (hM : 32 ≤ M) + (hMd : M*d ≤ r₀) (hE : 2*r₀ ≤ E) (hEscale : E^2 = 256*max ((ell : ℝ)+1) omega) + (hz : homogeneousSpectralLocalizationFrequency h b ((ell : ℝ)*(ell+10)) omega r₀ = 0) + (hscale : spectralLiouvilleSlope ((ell : ℝ)*(ell+10)) r₀*d^3 = 1) + (q : ℝ → ℂ × ℂ) (hq : ContinuousOn q (Icc (r₀+M*d) E)) + (hqE : q E = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h b ((ell : ℝ)*(ell+10)) omega E)))) + (hODE : ∀ t ∈ Ioo (r₀+M*d) E, HasDerivAt q + (spectralScalarField ((homogeneousSpectralLocalizationFrequency h b + ((ell : ℝ)*(ell+10)) omega t : ℂ)+Complex.I*(gamma : ℂ)) (q t)) t) : + let a := r₀+M*d + let p := spectralLiouvilleMomentum 1 h b ((ell : ℝ)*(ell+10)) omega gamma + let v := fun t => (spectralLiouvilleSlope ((ell : ℝ)*(ell+10)) t : ℂ)/(2*p t) + let D := spectralWKBFrame a ((h : ℂ)*Complex.I) p v + let C := (5/2 : ℝ)*Real.exp (|gamma| * 288) + let J := 5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2 + spectralShellNorm (Real.sqrt ‖p a‖) (q a - ((q E).1/(D E).1) • D a) ≤ + (2*(C^2)^2*Real.exp (C^2*J)*J)*spectralShellNorm (Real.sqrt ‖p E‖) (q E) + + C^2*((32*|gamma|+8)/E^2) := by + dsimp only + let eta : ℝ := (ell : ℝ)*(ell+10) + let a := r₀+M*d + let chi := (h : ℂ)*Complex.I + have heta : 0 ≤ eta := by dsimp only [eta]; positivity + have hr₀p : 0 < r₀ := by linarith + have hMp : 0 < M := by linarith + have ha : r₀ < a := by dsimp only [a]; nlinarith + have ha0 : 0 < a := hr₀p.trans ha + have haE : a ≤ E := by dsimp only [a]; linarith + have hF (t : ℝ) (ht : t ∈ Icc a E) : + 0 < 1*homogeneousSpectralLocalizationFrequency h b eta omega t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h b eta omega heta + hr₀p (ha0.trans_le ht.1) (ha.trans_le ht.1) + simpa only [eta,hz,one_mul] using hf + have hhabs : |h| = 1 := by nlinarith [sq_abs h,abs_nonneg h] + have hchi : ‖chi‖ = 1 := by + simp only [chi,norm_mul,Complex.norm_real,Real.norm_eq_abs,hhabs,Complex.norm_I,mul_one] + have hchi2 : chi^2*(1 : ℂ) = -1 := by + have hhC : (h : ℂ)^2 = 1 := by exact_mod_cast hh + simp only [chi,mul_pow,hhC,Complex.I_sq,one_mul,mul_one] + have hchiRe : chi.re = 0 := by + simp only [chi,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,Complex.I_re, + Complex.I_im,mul_zero,zero_mul,sub_zero] + have hA : (∫ t in a..E, 1/Real.sqrt (homogeneousSpectralLocalizationFrequency h b eta omega t)) ≤ 288 := + spectralTurning_positive_outer_phase ell h b omega r₀ d M E + hh hb hb1 hr₀p hd hMp hMd hE hEscale hz + have hp := spectralLiouville_positive_phase_bound h b eta omega gamma a E 288 ha0 haE + chi hchi hchiRe (fun t ht => by simpa only [one_mul] using hF t ht) hA + have hj := spectralTurning_outer_positive_error h b eta omega gamma r₀ d M E + heta hr₀p hd hMp hMd hE hz hscale + have hFar := spectralTurning_far_geometry h b eta omega r₀ E heta hr₀p hE hz + have hEpos : 0 < E := by linarith + have hg0 : 0 ≤ spectralLiouvilleSlope eta E := by + dsimp only [spectralLiouvilleSlope] + positivity + have hgFar : |spectralLiouvilleSlope eta E| ≤ + 4*homogeneousSpectralLocalizationFrequency h b eta omega E/E := by + rw [abs_of_nonneg hg0] + exact hFar.2 + have he := spectralLiouville_outgoing_branch_error h b eta omega gamma a E + (|gamma| * 288) (5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2) + hh ha0 haE hEpos hF + (fun t ht => spectralTurning_positive_derivative_small 1 h b eta omega gamma r₀ d M t + (by norm_num) heta hr₀ hd hM ht.1 hz hscale) hp hj hFar.1 hgFar q hq hqE hODE + exact he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingConnection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingConnection.lean new file mode 100644 index 0000000000000000000000000000000000000000..9973566c0eb25042ee2a7ef327456ec4b3da79f0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingConnection.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryNonzero +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPhysicalMargin + +namespace OAI + +/-! Actual normalized outgoing solutions cross the turning region with a +uniformly nonzero physical growing WKB coefficient. No Airy solution or +matching coefficient is assumed as input. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_growing_connection + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ᶠ T : ℝ in atTop, ∀ᶠ n in atTop, + let c := r₀ (φ n)-d (φ n)*T + let P := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) c + let D := ((Complex.sqrt P)⁻¹, + (P+(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) c : ℂ)/(4*P^2))* + (Complex.sqrt P)⁻¹) + (1/8 : ℝ)*spectralShellNorm (Real.sqrt ‖P‖) (q (φ n) c) ≤ + ‖spectralScalarWronskian D (q (φ n) c)/(-2)‖ := by + obtain ⟨M,q,φ,p,hM,hφ,hp,hq,hpD,hflux,hlim⟩ := spectralTurning_outgoing_airy_nonzero + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + have hpJ : spectralScalarFlux (p 1) ≠ 0 := by + intro hz + rw [hz,mul_zero] at hflux + exact (not_le_of_gt (half_pos spectralTurningFluxBase_pos)) hflux + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ + 0 ≤ (ell (φ n) : ℝ)*(ell (φ n)+10) ∧ |gamma (φ n)| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + (r₀ (φ n)/8+2*((ell (φ n) : ℝ)*(ell (φ n)+10)+99/4)/(r₀ (φ n))^3)*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.1, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + refine ⟨q,φ,hφ,hq,?_⟩ + exact spectralTurning_physical_growing_margin h (fun n => b (φ n)) + (fun n => (ell (φ n) : ℝ)*(ell (φ n)+10)) (fun n => omega (φ n)) + (fun n => gamma (φ n)) (fun n => r₀ (φ n)) (fun n => d (φ n)) (-M) 8 + (by linarith) (hr₀.comp hφ.tendsto_atTop) hsample (fun n => q (φ n)) p hp hpD hpJ hlim + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFamily.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..9921cb995ea4d8000203d9596c0fe56b0c06cf32 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFamily.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOutgoingBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit + +namespace OAI + +/-! The normalized scalar outgoing solutions can be chosen along an escaping +parameter sequence with one bound at any fixed oscillatory cutoff. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_bound_coarse (M r₀ d gamma : ℝ) + (hM : 32 ≤ M) (hr₀ : 1 ≤ r₀) (_hd : 0 ≤ d) (hd1 : d ≤ 1) (hg : |gamma| ≤ 8) : + (75/2 : ℝ)*Real.exp (|gamma| *288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+ + 3*d/(r₀*Real.sqrt (M/8))+8/r₀^2)) ≤ + (75/2 : ℝ)*Real.exp (8*288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+11)) := by + have hMp : 0 ≤ M/8 := by linarith + have hs : 1 ≤ Real.sqrt (M/8) := by + nlinarith [Real.sq_sqrt hMp,Real.sqrt_nonneg (M/8)] + have hp : 0 < r₀*Real.sqrt (M/8) := by positivity + have hden : 1 ≤ r₀*Real.sqrt (M/8) := by nlinarith + have hterm : 3*d/(r₀*Real.sqrt (M/8)) ≤ 3 := + (div_le_iff₀ hp).mpr (by nlinarith) + have hfar : 8/r₀^2 ≤ 8 := div_le_self (by norm_num) (by nlinarith) + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply Real.exp_le_exp.mpr + nlinarith + +theorem spectralTurning_outgoing_family + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (M R : ℝ) + (hh : h^2 = 1) (hM : 32 ≤ M) (hR : 0 < R) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ q : ℕ → ℝ → ℂ × ℂ, ∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h + (Real.sqrt (Real.sqrt (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (gamma n) (r₀ n+M*d n)‖) + (q n (r₀ n+M*d n)) ≤ + (75/2 : ℝ)*Real.exp (8*288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+11)) ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ) + Complex.I*(gamma n : ℂ)) + (q n t)) t := by + have hscale : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ + 0 ≤ (ell n : ℝ)*(ell n+10) ∧ + (r₀ n/8 + 2*((ell n : ℝ)*(ell n+10)+99/4)/(r₀ n)^3)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.2.2.2.2⟩ + have hd := spectralTurningScale_tendsto (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hr₀ hscale + let valid := fun n => 16 ≤ r₀ n ∧ 0 < d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ |gamma n| ≤ 8 ∧ + R ≤ r₀ n/2 ∧ M*d n ≤ r₀ n/2 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1 + have hevent : ∀ᶠ n in atTop, valid n ∧ d n ≤ 1 := by + filter_upwards [hdata,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max 16 (max (2*R) (2*M))))] with n hn hdn hrn + have hdn0 : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hsc := hn.2.2.2.2.2.2.2.2 + rw [← he] at hsc + norm_num at hsc + have hr16 := (le_max_left 16 (max (2*R) (2*M))).trans hrn + have hrRM := (le_max_right 16 (max (2*R) (2*M))).trans hrn + have hrR := (le_max_left (2*R) (2*M)).trans hrRM + have hrM := (le_max_right (2*R) (2*M)).trans hrRM + refine ⟨⟨hr16,hdn0,hn.2.2.1,hn.2.2.2.1,hn.2.2.2.2.1,?_,?_, + hn.2.2.2.2.2.1,hn.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩,hdn.le⟩ + · linarith + · nlinarith + let P := fun n (q : ℝ → ℂ × ℂ) => Continuous q ∧ + q (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q (E n)) = h ∧ + spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum 1 h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (gamma n) (r₀ n+M*d n)‖) (q (r₀ n+M*d n)) ≤ + (75/2 : ℝ)*Real.exp (|gamma n| *288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+ + 3*d n/(r₀ n*Real.sqrt (M/8))+8/(r₀ n)^2)) ∧ + ∀ t ∈ Icc R (E n), HasDerivAt q (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ) + + Complex.I*(gamma n : ℂ)) (q t)) t + have hex (n : ℕ) : ∃ q : ℝ → ℂ × ℂ, valid n → P n q := by + by_cases hv : valid n + · obtain ⟨q,hq⟩ := spectralTurning_outgoing_comparison_bound (ell n) h (b n) (omega n) + (gamma n) (r₀ n) (d n) M R (E n) hh hv.2.2.1 hv.2.2.2.1 hv.1 hv.2.1 hM + hR hv.2.2.2.2.2.1 hv.2.2.2.2.2.2.1 hv.2.2.2.2.2.2.2.1 + hv.2.2.2.2.2.2.2.2.1 hv.2.2.2.2.1 hv.2.2.2.2.2.2.2.2.2.1 + hv.2.2.2.2.2.2.2.2.2.2 + exact ⟨q,fun _ => hq⟩ + · exact ⟨0,fun hv' => (hv hv').elim⟩ + choose q hq using hex + refine ⟨q,?_⟩ + filter_upwards [hevent] with n hn + obtain ⟨hc,hE,hJ,hN,hD⟩ := hq n hn.1 + refine ⟨hc,hE,hJ,hN.trans ?_,hD⟩ + exact spectralTurning_outgoing_bound_coarse M (r₀ n) (d n) (gamma n) hM + (by linarith [hn.1.1]) hn.1.2.1.le hn.2 hn.1.2.2.2.2.1 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..7700961f1f07907d1a98a6973177ba9865927028 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingFlux.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningFluxCoarse +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningCutoffChoice + +namespace OAI + +/-! A single oscillatory cutoff retains a positive amount of the outgoing +flux for every sufficiently large member of the actual parameter family. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_eventual_outgoing_flux + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ M : ℝ, 32 ≤ M ∧ ∀ q : ℕ → ℝ → ℂ × ℂ, + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) → + ∀ᶠ n in atTop, spectralTurningFluxBase/2 ≤ + h*spectralScalarFlux (q n (r₀ n+M*d n)) := by + have hs : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ + 0 ≤ (ell n : ℝ)*(ell n+10) ∧ + (r₀ n/8+2*((ell n : ℝ)*(ell n+10)+99/4)/(r₀ n)^3)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.2.2.2.2⟩ + have hd := spectralTurningScale_tendsto (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hr₀ hs + have hEt : Tendsto E atTop atTop := by + rw [tendsto_atTop] + intro A + filter_upwards [hdata,hr₀.eventually (eventually_ge_atTop (A/2))] with n hn hrn + linarith [hn.2.2.2.2.2.1] + obtain ⟨M,hM,hcut⟩ := spectralTurning_cutoff_choice spectralTurningFluxErrorConstant + spectralTurningFluxRemoteConstant spectralTurningFluxNormConstant spectralTurningFluxBase + spectralTurningFluxBase_pos r₀ d E hr₀ hd hEt + (hdata.mono (fun n hn => ⟨hn.1.le,hn.2.1⟩)) + refine ⟨M,hM,?_⟩ + intro q hq + filter_upwards [hdata,hq,hcut,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max 16 (max R M)))] with n hn hqn hcn hdn hrn + rcases hn with ⟨hrp,hdn0,hbn,hbn1,hgn,hEn,hEs,hzn,hscn⟩ + have hr16 : 16 ≤ r₀ n := (le_max_left 16 (max R M)).trans hrn + have hrRM := (le_max_right 16 (max R M)).trans hrn + have hrr : R ≤ r₀ n := (le_max_left R M).trans hrRM + have hrM : M ≤ r₀ n := (le_max_right R M).trans hrRM + have hdp : 0 < d n := by + apply lt_of_le_of_ne hdn0 + intro he + rw [← he] at hscn + norm_num at hscn + have hmd : M*d n ≤ r₀ n := by nlinarith + have hlo := spectralTurning_outgoing_flux_lower (ell n) h (b n) (omega n) (gamma n) + (r₀ n) (d n) M (E n) hh hbn hbn1 hr16 hdp hM hmd hEn hEs hgn hzn hscn + (q n) hqn.1.continuousOn hqn.2.1 + (fun t ht => hqn.2.2 t ⟨by nlinarith [ht.1],ht.2.le⟩) + have hcoarse := spectralTurning_flux_coarse (gamma n) + (spectralTurningOuterError M (r₀ n) (d n)) (E n) hgn hcn.1 hcn.2.1 + apply hcn.2.2.trans + apply hcoarse.trans + simpa only [spectralTurningOuterError,spectralTurningCutoffError] using hlo + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingRobin.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingRobin.lean new file mode 100644 index 0000000000000000000000000000000000000000..5850c6bda3f98a713a38d2b3048b9deff3c8475d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningOutgoingRobin.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningInnerCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRobinCoercive + +namespace OAI + +/-! The actual scalar outgoing family has a coercive inward Robin slope +along every escaping turning-parameter sequence, after subselection. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_robin + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ᶠ n in atTop, (q (φ n) R).1 ≠ 0 ∧ + ((q (φ n) R).2/(q (φ n) R).1).re ≤ -(r₀ (φ n))/384 := by + obtain ⟨q,φ,hφ,hq,hcone⟩ := spectralTurning_outgoing_inner_cone + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,?_⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + filter_upwards [hcone,hφ.tendsto_atTop.eventually hdata, + hrt.eventually (eventually_ge_atTop (max (2*R) (64/R)))] with n hn hd hl + dsimp only [Function.comp_def] at hl + have hRh : R ≤ r₀ (φ n)/2 := by linarith [le_trans (le_max_left (2*R) (64/R)) hl] + have hlarge : 64 ≤ r₀ (φ n)*R := by + have hh := mul_le_mul_of_nonneg_right ((le_max_right (2*R) (64/R)).trans hl) hR.le + have he : (64/R)*R = 64 := by field_simp + rwa [he] at hh + let eta := (ell (φ n) : ℝ)*(ell (φ n)+10) + have heta : 0 ≤ eta := by dsimp only [eta]; positivity + have hz : homogeneousSpectralLocalizationFrequency h (b (φ n)) eta (omega (φ n)) + (r₀ (φ n)) = 0 := hd.2.2.2.2.2.2.2.1 + have hc := spectralTurning_inner_robin_coercive h (b (φ n)) eta (omega (φ n)) + (gamma (φ n)) (r₀ (φ n)) R heta hd.1 hR hRh hlarge hz (q (φ n) R) hn.1 hn.2 + have hp := spectralTurning_far_momentum_re_lower h (b (φ n)) eta (omega (φ n)) + (gamma (φ n)) (r₀ (φ n)) R heta hd.1 hR hRh hz + have hnorm : (spectralLiouvilleMomentum (-1) h (b (φ n)) eta (omega (φ n)) + (gamma (φ n)) R).re ≤ ‖spectralLiouvilleMomentum (-1) h (b (φ n)) eta + (omega (φ n)) (gamma (φ n)) R‖ := Complex.re_le_norm _ + refine ⟨hn.1,?_⟩ + -- The real-part bound is deliberately weaker than the modulus bound. + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPairWeight.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPairWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f00caf6b7f3e7806998c8647e03c7f962367a30 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPairWeight.lean @@ -0,0 +1,27 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningWeightEscape + +namespace OAI + +/-! A single weight floor works for both turning channels. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_pair_floor (dp dm : ℝ) (hp : 0 < dp) (hm : 0 < dm) : + (Real.sqrt (dp+dm))⁻¹ ≤ (Real.sqrt dp)⁻¹ ∧ + (Real.sqrt (dp+dm))⁻¹ ≤ (Real.sqrt dm)⁻¹ := by + exact ⟨inv_anti₀ (Real.sqrt_pos.mpr hp) (Real.sqrt_le_sqrt (by linarith)), + inv_anti₀ (Real.sqrt_pos.mpr hm) (Real.sqrt_le_sqrt (by linarith))⟩ + +theorem spectralTurning_pair_floor_tendsto (dp dm : ℕ → ℝ) + (hp : Tendsto dp atTop (𝓝 0)) (hm : Tendsto dm atTop (𝓝 0)) + (hpp : ∀ᶠ n in atTop, 0 < dp n) (hmp : ∀ᶠ n in atTop, 0 < dm n) : + Tendsto (fun n => (Real.sqrt (dp n+dm n))⁻¹) atTop atTop := by + apply spectralTurning_weight_floor_tendsto + · simpa only [add_zero] using hp.add hm + · filter_upwards [hpp,hmp] with n hn hn' + exact add_pos hn hn' + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPhysicalMargin.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPhysicalMargin.lean new file mode 100644 index 0000000000000000000000000000000000000000..fab9b247a3ed62aaf584ab97ddfd7da26d422578 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPhysicalMargin.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningAiryProjection +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningProjectionIdentity + +namespace OAI + +/-! The limiting Airy growing mode is exactly the physical outgoing WKB +coefficient at the forbidden edge of the turning interval. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_physical_growing_margin + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (a G : ℝ) (ha : a ≤ 1) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) + (q : ℕ → ℝ → ℂ × ℂ) (p : ℝ → ℂ × ℂ) (hp : Continuous p) + (hpD : ∀ t, a ≤ t → HasDerivAt p (spectralScalarField (-(t : ℂ)) (p t)) t) + (hpJ : spectralScalarFlux (p 1) ≠ 0) + (hlim : ∀ c : ℝ, TendstoUniformlyOn + (fun n => spectralTurningAiryState (r₀ n) (d n) (Real.sqrt (d n)) (q n)) p atTop (Icc a c)) : + ∀ᶠ T : ℝ in atTop, ∀ᶠ n in atTop, + let c := r₀ n-d n*T + let P := spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) c + let D := ((Complex.sqrt P)⁻¹, + (P+(spectralLiouvilleSlope (eta n) c : ℂ)/(4*P^2))*(Complex.sqrt P)⁻¹) + (1/8 : ℝ)*spectralShellNorm (Real.sqrt ‖P‖) (q n c) ≤ + ‖spectralScalarWronskian D (q n c)/(-2)‖ := by + have hmargin := spectralTurning_eventual_growing_projection h b eta omega gamma r₀ d a G + ha hr₀ hdata q p hp hpD hpJ hlim + filter_upwards [hmargin,eventually_gt_atTop (0 : ℝ)] with T hTm hT + have hP := spectralTurning_negative_momentum_tendsto h b eta omega gamma r₀ d T G hT hr₀ hdata + have hre := ((Complex.continuous_re.tendsto (Real.sqrt T : ℂ)).comp hP).eventually + (lt_mem_nhds (Real.sqrt_pos.mpr hT)) + filter_upwards [hTm,hdata,hre] with n hn hdn hren + let P := spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) (r₀ n-d n*T) + let u := q n (r₀ n-d n*T) + have hd : 0 < d n := by + apply lt_of_le_of_ne hdn.2.1 + intro he + have hs := hdn.2.2.2.2.2 + rw [← he] at hs + norm_num at hs + have hPre : 0 < P.re := by + change 0 < ((d n : ℂ)*P).re at hren + simp only [Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] at hren + nlinarith + have hPn : P ≠ 0 := by intro he; rw [he] at hPre; norm_num at hPre + have hn' : (1/8 : ℝ)*spectralShellNorm (Real.sqrt ‖(d n : ℂ)*P‖) + (u.1/(Real.sqrt (d n) : ℂ),-(Real.sqrt (d n) : ℂ)*u.2) ≤ + ‖((-(Real.sqrt (d n) : ℂ)*u.2)+((d n : ℂ)*P+ + (((d n)^3*spectralLiouvilleSlope (eta n) (r₀ n-d n*T) : ℝ) : ℂ)/(4*((d n : ℂ)*P)^2))* + (u.1/(Real.sqrt (d n) : ℂ)))/(2*Complex.sqrt ((d n : ℂ)*P))‖ := by + simpa only [spectralTurningAiryState,spectralScalarReflect,spectralTurningState, + zero_add,zero_sub,mul_neg,neg_mul,sub_eq_add_neg,P,u] using hn + rw [spectralTurning_projection_norm_scale (d n) P u hd hPn, + spectralTurning_projection_identity (d n) (spectralLiouvilleSlope (eta n) (r₀ n-d n*T)) P u hd hPre] at hn' + exact hn' + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveError.lean new file mode 100644 index 0000000000000000000000000000000000000000..23ba95e2f740cd34f0edd93865cfd774dbf3debb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveError.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleTerminalError +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleOscillatoryPhase +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveTransfer + +namespace OAI + +/-! The actual outgoing orientation has a quantitative WKB error on the +whole positive outer interval. All phase and residual bounds are derived +from the radial frequency and turning scale. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_positive_terminal_error + (ell : ℕ) (h b omega gamma r₀ d M E : ℝ) + (hh : h^2 = 1) (hb : 0 ≤ b) (hb1 : b ≤ 1) (hr₀ : 2 ≤ r₀) (hd : 0 < d) (hM : 32 ≤ M) + (hMd : M*d ≤ r₀) (hE : 2*r₀ ≤ E) (hEscale : E^2 = 256*max ((ell : ℝ)+1) omega) + (hz : homogeneousSpectralLocalizationFrequency h b ((ell : ℝ)*(ell+10)) omega r₀ = 0) + (hscale : spectralLiouvilleSlope ((ell : ℝ)*(ell+10)) r₀*d^3 = 1) + (q : ℝ → ℂ × ℂ) (hq : ContinuousOn q (Icc (r₀+M*d) E)) + (hODE : ∀ t ∈ Ioo (r₀+M*d) E, HasDerivAt q + (spectralScalarField ((homogeneousSpectralLocalizationFrequency h b + ((ell : ℝ)*(ell+10)) omega t : ℂ)+Complex.I*(gamma : ℂ)) (q t)) t) : + let a := r₀+M*d + let p := spectralLiouvilleMomentum 1 h b ((ell : ℝ)*(ell+10)) omega gamma + let v := fun t => (spectralLiouvilleSlope ((ell : ℝ)*(ell+10)) t : ℂ)/(2*p t) + let chi := (h : ℂ)*Complex.I + let D := spectralWKBFrame a chi p v + let U := spectralWKBFrame a (-chi) p v + let W := (-2 : ℂ)*chi + let C := (5/2 : ℝ)*Real.exp (|gamma| * 288) + let J := 5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2 + spectralShellNorm (Real.sqrt ‖p a‖) + (q a - ((spectralScalarWronskian (q E) (U E)/W) • D a + + (spectralScalarWronskian (D E) (q E)/W) • U a)) ≤ + (2*(C^2)^2*Real.exp (C^2*J)*J)*spectralShellNorm (Real.sqrt ‖p E‖) (q E) := by + dsimp only + let eta : ℝ := (ell : ℝ)*(ell+10) + let a := r₀+M*d + let chi := (h : ℂ)*Complex.I + have heta : 0 ≤ eta := by dsimp only [eta]; positivity + have hr₀p : 0 < r₀ := by linarith + have hMp : 0 < M := by linarith + have ha : r₀ < a := by dsimp only [a]; nlinarith + have ha0 : 0 < a := hr₀p.trans ha + have haE : a ≤ E := by dsimp only [a]; linarith + have hF (t : ℝ) (ht : t ∈ Icc a E) : + 0 < 1*homogeneousSpectralLocalizationFrequency h b eta omega t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h b eta omega heta + hr₀p (ha0.trans_le ht.1) (ha.trans_le ht.1) + simpa only [eta,hz,one_mul] using hf + have hhabs : |h| = 1 := by nlinarith [sq_abs h,abs_nonneg h] + have hchi : ‖chi‖ = 1 := by + simp only [chi,norm_mul,Complex.norm_real,Real.norm_eq_abs,hhabs,Complex.norm_I,mul_one] + have hchi2 : chi^2*(1 : ℂ) = -1 := by + have hhC : (h : ℂ)^2 = 1 := by exact_mod_cast hh + simp only [chi,mul_pow,hhC,Complex.I_sq,one_mul,mul_one] + have hchiRe : chi.re = 0 := by + simp only [chi,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,Complex.I_re, + Complex.I_im,mul_zero,zero_mul,sub_zero] + have hA : (∫ t in a..E, 1/Real.sqrt (homogeneousSpectralLocalizationFrequency h b eta omega t)) ≤ 288 := + spectralTurning_positive_outer_phase ell h b omega r₀ d M E + hh hb hb1 hr₀p hd hMp hMd hE hEscale hz + have hp := spectralLiouville_positive_phase_bound h b eta omega gamma a E 288 ha0 haE + chi hchi hchiRe (fun t ht => by simpa only [one_mul] using hF t ht) hA + have hj := spectralTurning_outer_positive_error h b eta omega gamma r₀ d M E + heta hr₀p hd hMp hMd hE hz hscale + have he := spectralLiouville_terminal_error 1 h b eta omega gamma a E (|gamma| * 288) + (5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2) + (by norm_num) ha0 haE chi hchi hchi2 hF + (fun t ht => spectralTurning_positive_derivative_small 1 h b eta omega gamma r₀ d M t + (by norm_num) heta hr₀ hd hM ht.1 hz hscale) hp hj q hq hODE + simpa only [Complex.ofReal_one,one_mul] using he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b01fd71896a5b15a71908bf88a29685108f753e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveIntegral.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningFrequencyGrowth +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBResidualIntegral +import Mathlib.Analysis.SpecialFunctions.Sqrt + +namespace OAI + +/-! The near-turning oscillatory WKB error for the actual Liouville potential. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_positive_integral (h b eta omega r₀ a c : ℝ) + (heta : 0≤eta) (hr₀ : 0 (hFD t ht).continuousAt.continuousWithinAt + have hgc : ContinuousOn (spectralLiouvilleSlope eta) (Icc a c) := + fun t ht => (spectralLiouvilleSlope_hasDerivAt eta t (ht0 t ht)).continuousAt.continuousWithinAt + have hec : ContinuousOn (spectralLiouvilleSecond eta) (Icc a c) := by + apply continuousOn_const.sub + apply continuousOn_const.div (continuousOn_id.pow 4) + exact fun t ht => pow_ne_zero _ (ht0 t ht).ne' + have hB : 0≤8*spectralLiouvilleSlope eta r₀ := by + dsimp only [spectralLiouvilleSlope] + positivity + exact spectralWKB_residual_integral a c (6/r₀) (8*spectralLiouvilleSlope eta r₀) hac + (by positivity) hB (fun t => Real.sqrt (F t)) (spectralLiouvilleSlope eta) + (spectralLiouvilleSecond eta) (Real.continuous_sqrt.comp_continuousOn hFc) hgc hec + (fun t ht => Real.sqrt_pos.2 (hF0 t ht)) + (fun t ht => by dsimp only [spectralLiouvilleSlope]; have := ht0 t ht; positivity) + (fun t ht => (spectralLiouvilleSlope_near eta r₀ t heta hr₀ + (by linarith [ht.1]) (ht.2.trans hc)).2) + (fun t ht => spectralLiouvilleSecond_near eta r₀ t heta hr₀ (by linarith [ht.1])) + (fun t ht => (hFD t ⟨ht.1.le,ht.2.le⟩).sqrt (hF0 t ⟨ht.1.le,ht.2.le⟩).ne') + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveReverse.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveReverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3e74d897446d5a68116a372d353d265a03aeaeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPositiveReverse.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningPositiveTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleNormPositive +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarReverseTransfer + +namespace OAI + +/-! A uniform reverse bound for actual outgoing scalar data in the oscillatory +outer interval, obtained from the proved forward estimate by Wronskian duality. -/ + +open Set +namespace DefocusingNLS + +theorem spectralTurning_positive_reverse_transfer + (ell : ℕ) (h b omega gamma r₀ d M E : ℝ) + (hh : h^2=1) (hb : 0≤b) (hb1 : b≤1) (hr₀ : 2≤r₀) (hd : 0 (homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+Complex.I*(gamma : ℂ) + let k := fun t => Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma t‖ + let C := (25/4 : ℝ)*Real.exp (|gamma| * 288+(25/4)*(5/(3*(Real.sqrt (M/8))^3)+ + 3*d/(r₀*Real.sqrt (M/8))+8/r₀^2)) + have heta : 0≤eta := by dsimp only [eta]; positivity + have hr₀p : 0 hF t ⟨ht.1.le,ht.2.le⟩) + have hchiRe : chi.re=0 := by + have hc2 : chi^2=Complex.I^2 := by simpa only [Complex.ofReal_one,mul_one,Complex.I_sq] using hchi2 + rcases sq_eq_sq_iff_eq_or_eq_neg.mp hc2 with hc | hc + · simp only [hc,Complex.I_re] + · simp only [hc,Complex.neg_re,Complex.I_re,neg_zero] + have ht := spectralLiouville_endpoint_bound 1 h b eta omega gamma a E 288 + (5/(3*(Real.sqrt (M/8))^3)+3*d/(r₀*Real.sqrt (M/8))+8/r₀^2) + (by norm_num) ha0 haE chi hchi hchi2 hF + (fun t ht => spectralTurning_positive_derivative_small 1 h b eta omega gamma r₀ d M t + (by norm_num) heta hr₀ hd hM ht.1 hz hscale) hphase + (by + simpa only [one_mul] using + spectralTurning_positive_outer_phase ell h b omega r₀ d M E + hh hb hb1 hr₀p hd hMp hMd hE hEscale hz) + (spectralTurning_outer_positive_error h b eta omega gamma r₀ d M E + heta hr₀p hd hMp hMd hE hz hscale) q hq hODE + simpa only [hchiRe,zero_mul,zero_add] using ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPotentialBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPotentialBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..12bb015f1a0ac8ac59c97ef6d99daeb7b4a2560e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningPotentialBound.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningForbiddenGeometry + +namespace OAI + +/-! The frequency height on the fixed turning annulus is controlled by its +slope at the turning point. This bounds the near-turning phase integral. -/ + +namespace DefocusingNLS + +theorem spectralTurning_potential_slope_bound (h b eta omega r₀ r : ℝ) + (heta : 0≤eta) (hr₀ : 0 (d n : ℂ)*spectralLiouvilleMomentum (-1) h (b n) (eta n) + (omega n) (gamma n) (r₀ n-d n*T) + let A := fun n => ((d n)^3*spectralLiouvilleSlope (eta n) (r₀ n-d n*T) : ℝ) + ∀ᶠ n in atTop, (1/8 : ℝ)*spectralShellNorm (Real.sqrt ‖P n‖) (un n) ≤ + ‖((un n).2+(P n+(A n : ℂ)/(4*(P n)^2))*(un n).1)/(2*Complex.sqrt (P n))‖ := by + dsimp only + let P := fun n => (d n : ℂ)*spectralLiouvilleMomentum (-1) h (b n) (eta n) + (omega n) (gamma n) (r₀ n-d n*T) + let A := fun n => ((d n)^3*spectralLiouvilleSlope (eta n) (r₀ n-d n*T) : ℝ) + have hP : Tendsto P atTop (𝓝 (Real.sqrt T : ℂ)) := + spectralTurning_negative_momentum_tendsto h b eta omega gamma r₀ d T G hT hr₀ hdata + have hA : Tendsto A atTop (𝓝 1) := by + simpa only [A,mul_neg,sub_eq_add_neg,mul_comm] using + spectralTurning_scaled_slope_tendsto eta r₀ d (-T) hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hAC := (Complex.continuous_ofReal.tendsto 1).comp hA + have hroot : Tendsto (fun n => Complex.sqrt (P n)) atTop + (𝓝 (Real.sqrt (Real.sqrt T) : ℂ)) := by + have he : Complex.sqrt (Real.sqrt T : ℂ) = (Real.sqrt (Real.sqrt T) : ℂ) := + Complex.sqrt_of_nonneg (by exact_mod_cast Real.sqrt_nonneg T) + simpa only [he,Function.comp_def] using + (Complex.continuousAt_sqrt (Or.inl (by simp))).tendsto.comp hP + have hk : Tendsto (fun n => Real.sqrt ‖P n‖) atTop (𝓝 (Real.sqrt (Real.sqrt T))) := by + simpa only [Function.comp_def,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (Real.sqrt_nonneg T)] using + (Real.continuous_sqrt.tendsto ‖(Real.sqrt T : ℂ)‖).comp hP.norm + have hsT : (Real.sqrt T : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (Real.sqrt_pos.mpr hT).ne' + have hsquare : (Real.sqrt T : ℂ)^2 = (T : ℂ) := by exact_mod_cast Real.sq_sqrt hT.le + have hB : Tendsto (fun n => P n+(A n : ℂ)/(4*(P n)^2)) atTop + (𝓝 (((Real.sqrt (Real.sqrt T))^2+1/(4*T) : ℝ) : ℂ)) := by + have hlim := hP.add (hAC.div ((hP.pow 2).const_mul 4) (mul_ne_zero (by norm_num) (pow_ne_zero _ hsT))) + simpa only [Function.comp_def,Pi.div_apply,hsquare,Real.sq_sqrt (Real.sqrt_nonneg T), + Complex.ofReal_add,Complex.ofReal_div,Complex.ofReal_one,Complex.ofReal_mul,Complex.ofReal_ofNat] using hlim + exact spectralGrowingCoefficient_eventual_margin (Real.sqrt (Real.sqrt T)) (1/(4*T)) + (Real.sqrt_pos.mpr (Real.sqrt_pos.mpr hT)) u hu hmargin + (fun n => Real.sqrt ‖P n‖) (fun n => Complex.sqrt (P n)) + (fun n => P n+(A n : ℂ)/(4*(P n)^2)) un hk hroot hB hun + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRadius.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..eae262be913a40a812375e15f711e4e4cfca340c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRadius.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGeometry + +namespace OAI + +/-! Turning radii escape in both high-parameter cases used in the paper. -/ + +open Filter +namespace DefocusingNLS + +theorem spectralTurning_radius_bound (h b eta omega r : ℝ) + (hh : |h|≤1) (hb : b≤1) (homega : 0≤omega) (hr : 0 x*r^2) hz + field_simp at hprod + nlinarith + have hhw : -omega≤h*omega := by nlinarith [abs_le.mp hh] + have hlow : eta≤r^4/16+(1+omega)*r^2 := by + have hm := mul_le_mul_of_nonneg_right (show b-h*omega≤1+omega by linarith) hr2.le + nlinarith + apply (div_le_iff₀ hden).mpr + have hrest : 0≤omega*(r^4/16) := by positivity + nlinarith + +theorem spectralTurning_radius_escape_caseI + (h : ℝ) (hh : |h|≤1) (b eta omega r : ℕ → ℝ) + (hescape : Tendsto (fun n => eta n/(1+omega n)) atTop atTop) + (hdata : ∀ᶠ n in atTop, b n≤1 ∧ 0≤eta n ∧ 0≤omega n ∧ 0 s*k (r₀+d*t) + let Q := spectralTurningState r₀ d s q + let V := spectralTurningCoefficient h b eta omega gamma r₀ d + have hs : 0 < s := Real.sqrt_pos.mpr hd + have hs2 : s^2 = d := Real.sq_sqrt hd.le + have hmem (t : ℝ) (ht : t ∈ Icc (-M) M) : r₀+d*t ∈ Icc (r₀-d*M) (r₀+d*M) := by + constructor <;> nlinarith [ht.1,ht.2] + have hQc : ContinuousOn Q (Icc (-M) M) := + ((hq.comp (continuous_const.add (continuous_const.mul continuous_id)).continuousOn hmem).fst.div_const _).prodMk + (continuousOn_const.mul (hq.comp (continuous_const.add (continuous_const.mul continuous_id)).continuousOn hmem).snd) + have hQD (t : ℝ) (ht : t ∈ Icc (-M) M) : HasDerivAt Q (spectralScalarField (V t) (Q t)) t := by + simpa only [Q,V,spectralTurningCoefficient,Complex.ofReal_pow] using + spectralTurningState_hasDerivAt r₀ d s t hs.ne' hs2 q _ (hD _ (hmem t ht)) + have hK (t : ℝ) (ht : t ∈ Icc (-M) M) : 1 ≤ K t ∧ K t ≤ M+3 := + spectralTurningRegularizedWeight_scaled_bounds h b eta omega gamma r₀ d t M hd hM (hcoef t ht) + have hb := spectralScalar_interval_shell_subinterval (-M) M (M+1) 1 (M+3) + (by linarith) (by positivity) (by norm_num) V K Q hQc hQD hcoef hK xi zeta hxi hzeta hxz + have hnorm (t : ℝ) : spectralShellNorm (K t) (Q t) = spectralShellNorm (k (r₀+d*t)) (q (r₀+d*t)) := + spectralTurningState_shell_norm r₀ d s t (k (r₀+d*t)) hs + (spectralTurningRegularizedWeight_pos h b eta omega gamma d _ hd) q + simpa only [hnorm] using hb + + +theorem spectralTurning_regularized_physical_transfer + (h b eta omega gamma r₀ d M : ℝ) (hd : 0 < d) (hM : 0 ≤ M) + (hcoef : ∀ xi ∈ Icc (-M) M, + ‖spectralTurningCoefficient h b eta omega gamma r₀ d xi‖ ≤ M+1) + (q : ℝ → ℂ × ℂ) (hq : ContinuousOn q (Icc (r₀-d*M) (r₀+d*M))) + (hD : ∀ t ∈ Icc (r₀-d*M) (r₀+d*M), HasDerivAt q + (spectralScalarField ((homogeneousSpectralLocalizationFrequency h b eta omega t : ℂ)+ + Complex.I*(gamma : ℂ)) (q t)) t) + (r t : ℝ) (hr : r ∈ Icc (r₀-d*M) (r₀+d*M)) + (ht : t ∈ Icc (r₀-d*M) (r₀+d*M)) (hrt : r ≤ t) : + let k := spectralTurningRegularizedWeight h b eta omega gamma d + let C := (M+3+(1 : ℝ)⁻¹)*max (1 : ℝ)⁻¹ (M+3)*Real.exp ((1+(M+1))*(M-(-M))) + spectralShellNorm (k t) (q t) ≤ C*spectralShellNorm (k r) (q r) ∧ + spectralShellNorm (k r) (q r) ≤ C*spectralShellNorm (k t) (q t) := by + let xi := (r-r₀)/d + let zeta := (t-r₀)/d + have hxi : xi ∈ Icc (-M) M := by + constructor + · apply (le_div_iff₀ hd).mpr + linarith [hr.1] + · apply (div_le_iff₀ hd).mpr + linarith [hr.2] + have hzeta : zeta ∈ Icc (-M) M := by + constructor + · apply (le_div_iff₀ hd).mpr + linarith [ht.1] + · apply (div_le_iff₀ hd).mpr + linarith [ht.2] + have hxz : xi ≤ zeta := div_le_div_of_nonneg_right (sub_le_sub_right hrt r₀) hd.le + have heR : r₀+d*xi = r := by dsimp only [xi]; field_simp; ring + have heT : r₀+d*zeta = t := by dsimp only [zeta]; field_simp; ring + simpa only [heR,heT] using spectralTurning_regularized_central_transfer + h b eta omega gamma r₀ d M hd hM hcoef q hq hD xi zeta hxi hzeta hxz + + +theorem spectralTurning_regularized_central_family + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G : ℝ) (hM : 0 ≤ M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ᶠ n in atTop, ∀ q : ℝ → ℂ × ℂ, + ContinuousOn q (Icc (r₀ n-d n*M) (r₀ n+d n*M)) → + (∀ t ∈ Icc (r₀ n-d n*M) (r₀ n+d n*M), HasDerivAt q + (spectralScalarField ((homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) t : ℂ)+ + Complex.I*(gamma n : ℂ)) (q t)) t) → + ∀ xi ∈ Icc (-M) M, ∀ zeta ∈ Icc (-M) M, xi ≤ zeta → + let k := spectralTurningRegularizedWeight h (b n) (eta n) (omega n) (gamma n) (d n) + spectralShellNorm (k (r₀ n+d n*zeta)) (q (r₀ n+d n*zeta)) ≤ + C*spectralShellNorm (k (r₀ n+d n*xi)) (q (r₀ n+d n*xi)) ∧ + spectralShellNorm (k (r₀ n+d n*xi)) (q (r₀ n+d n*xi)) ≤ + C*spectralShellNorm (k (r₀ n+d n*zeta)) (q (r₀ n+d n*zeta)) := by + let C := (M+3+(1 : ℝ)⁻¹)*max (1 : ℝ)⁻¹ (M+3)*Real.exp ((1+(M+1))*(M-(-M))) + refine ⟨C,by dsimp only [C]; positivity,?_⟩ + have hu := spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d M G hM hr₀ hdata + filter_upwards [hdata,(Metric.tendstoUniformlyOn_iff.mp hu) 1 (by norm_num)] with n hn hc + have hd : 0 < d n := by + apply lt_of_le_of_ne hn.2.1 + intro he + have hh := hn.2.2.2.2.2 + rw [← he] at hh + norm_num at hh + have hcoef (xi : ℝ) (hxi : xi ∈ Icc (-M) M) : + ‖spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) xi‖ ≤ M+1 := by + have he : ‖spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) xi- + (xi : ℂ)‖ ≤ 1 := by + simpa only [dist_eq_norm,norm_sub_rev] using (hc xi hxi).le + have hx : ‖(xi : ℂ)‖ ≤ M := by + simpa only [Complex.norm_real,Real.norm_eq_abs] using abs_le.mpr hxi + have hb := norm_add_le (spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) xi-(xi : ℂ)) (xi : ℂ) + rw [sub_add_cancel] at hb + linarith + intro q hq hD xi hxi zeta hzeta hxz + exact spectralTurning_regularized_central_transfer h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) M hd hM hcoef q hq hD xi zeta hxi hzeta hxz + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRegularizedWeight.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRegularizedWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..12503b06d76007a0351d16552faec45e1ac75e2c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRegularizedWeight.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaledNorm +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleFrequencyJet + +namespace OAI + +/-! A continuous positive frequency weight agrees with the WKB weight away +from the turn and remains nondegenerate on the scaled central interval. -/ + +open Set +namespace DefocusingNLS + +theorem spectralComplexSqrt_norm (z : ℂ) : ‖Complex.sqrt z‖ = Real.sqrt ‖z‖ := by + have hs := spectralComplexSqrt_norm_sq z + have hr := Real.sq_sqrt (norm_nonneg z) + nlinarith [norm_nonneg (Complex.sqrt z),Real.sqrt_nonneg ‖z‖] + +noncomputable def spectralTurningRegularizedWeight (h b eta omega gamma d r : ℝ) : ℝ := + max (Real.sqrt d)⁻¹ (Real.sqrt (Real.sqrt + ‖(homogeneousSpectralLocalizationFrequency h b eta omega r : ℂ)+Complex.I*(gamma : ℂ)‖)) + +theorem spectralTurningRegularizedWeight_pos (h b eta omega gamma d r : ℝ) (hd : 0 < d) : + 0 < spectralTurningRegularizedWeight h b eta omega gamma d r := + lt_of_lt_of_le (inv_pos.mpr (Real.sqrt_pos.mpr hd)) (le_max_left _ _) + +theorem spectralTurningRegularizedWeight_continuousOn (h b eta omega gamma d : ℝ) : + ContinuousOn (spectralTurningRegularizedWeight h b eta omega gamma d) (Ioi 0) := by + have hF : ContinuousOn (homogeneousSpectralLocalizationFrequency h b eta omega) (Ioi 0) := + fun r hr => (homogeneousSpectralLocalizationFrequency_hasDerivAt h b eta omega r hr).continuousAt.continuousWithinAt + exact continuousOn_const.sup (Real.continuous_sqrt.comp_continuousOn + (Real.continuous_sqrt.comp_continuousOn + ((Complex.continuous_ofReal.comp_continuousOn hF).add continuousOn_const).norm)) + +theorem spectralTurningRegularizedWeight_eq_wkb (h b eta omega gamma d r : ℝ) + (hweight : (Real.sqrt d)⁻¹ ≤ + Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖) : + spectralTurningRegularizedWeight h b eta omega gamma d r = + Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖ := by + have he : Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖ = + Real.sqrt (Real.sqrt ‖(homogeneousSpectralLocalizationFrequency h b eta omega r : ℂ)+ + Complex.I*(gamma : ℂ)‖) := by + simp only [spectralLiouvilleMomentum,spectralWKBSquaredMomentum,Complex.ofReal_one, + one_mul,spectralComplexSqrt_norm] + rw [he] at hweight ⊢ + exact max_eq_right hweight + +theorem spectralTurningRegularizedWeight_scaled (h b eta omega gamma r₀ d xi : ℝ) (hd : 0 < d) : + Real.sqrt d*spectralTurningRegularizedWeight h b eta omega gamma d (r₀+d*xi) = + max 1 (Real.sqrt (Real.sqrt ‖spectralTurningCoefficient h b eta omega gamma r₀ d xi‖)) := by + have hs : 0 < Real.sqrt d := Real.sqrt_pos.mpr hd + rw [spectralTurningRegularizedWeight,mul_max_of_nonneg _ _ hs.le,mul_inv_cancel₀ hs.ne'] + congr 1 + simpa only [spectralLiouvilleMomentum,spectralWKBSquaredMomentum,Complex.ofReal_one, + one_mul,spectralComplexSqrt_norm] using + spectralTurning_scaled_weight h b eta omega gamma r₀ d xi hd.le + + +theorem spectralTurningRegularizedWeight_eq_of_frequency + (h b eta omega gamma d r : ℝ) (hd : 0 < d) + (hlarge : 1 ≤ d^2*|homogeneousSpectralLocalizationFrequency h b eta omega r|) : + spectralTurningRegularizedWeight h b eta omega gamma d r = + Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖ := by + let z : ℂ := (homogeneousSpectralLocalizationFrequency h b eta omega r : ℂ)+Complex.I*(gamma : ℂ) + have hz : |homogeneousSpectralLocalizationFrequency h b eta omega r| ≤ ‖z‖ := by + simpa only [z,spectralWKBSquaredMomentum,Complex.ofReal_one,one_mul] using + spectralWKBSquaredMomentum_norm_lower 1 (homogeneousSpectralLocalizationFrequency h b eta omega r) gamma (by norm_num) + have hn : 1 ≤ ‖(d : ℂ)^2*z‖ := by + rw [norm_mul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hd] + exact hlarge.trans (mul_le_mul_of_nonneg_left hz (sq_nonneg d)) + have hs : 1 ≤ Real.sqrt d*Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖ := by + have he := spectralComplexSqrt_scaled_weight d hd.le z + have hroot := Real.one_le_sqrt.mpr (Real.one_le_sqrt.mpr hn) + simpa only [spectralLiouvilleMomentum,spectralWKBSquaredMomentum,Complex.ofReal_one,one_mul,z,← he] using hroot + apply spectralTurningRegularizedWeight_eq_wkb + exact (inv_le_iff_one_le_mul₀ (Real.sqrt_pos.mpr hd)).mpr (by simpa only [mul_comm] using hs) + + +theorem spectralTurningRegularizedWeight_scaled_bounds (h b eta omega gamma r₀ d xi M : ℝ) + (hd : 0 < d) (hM : 0 ≤ M) + (hcoef : ‖spectralTurningCoefficient h b eta omega gamma r₀ d xi‖ ≤ M+1) : + 1 ≤ Real.sqrt d*spectralTurningRegularizedWeight h b eta omega gamma d (r₀+d*xi) ∧ + Real.sqrt d*spectralTurningRegularizedWeight h b eta omega gamma d (r₀+d*xi) ≤ M+3 := by + rw [spectralTurningRegularizedWeight_scaled h b eta omega gamma r₀ d xi hd] + refine ⟨le_max_left _ _,max_le (by linarith) ?_⟩ + have hsqrt (x : ℝ) (hx : 0 ≤ x) : Real.sqrt x ≤ x+1 := by + apply (Real.sqrt_le_iff).mpr + constructor + · positivity + · nlinarith [sq_nonneg x] + exact (hsqrt _ (Real.sqrt_nonneg _)).trans + ((add_le_add (hsqrt _ (norm_nonneg _)) (le_refl (1 : ℝ))).trans (by linarith)) + + +theorem spectralLiouville_weight_sign (sign h b eta omega gamma r : ℝ) (hs : sign^2 = 1) : + Real.sqrt ‖spectralLiouvilleMomentum sign h b eta omega gamma r‖ = + Real.sqrt ‖spectralLiouvilleMomentum 1 h b eta omega gamma r‖ := by + have habs : |sign| = 1 := by nlinarith [sq_abs sign,abs_nonneg sign] + simp only [spectralLiouvilleMomentum,spectralComplexSqrt_norm,spectralWKBSquaredMomentum, + norm_mul,Complex.norm_real,Real.norm_eq_abs,habs,Complex.ofReal_one,one_mul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRemoteScale.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRemoteScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b0194365aea35da0767585384c8523be670af36 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRemoteScale.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGeometry +import Mathlib.Analysis.SpecialFunctions.Sqrt + +namespace OAI + +/-! The frequency at twice the turning radius controls the remote scale chosen +in the paper, uniformly in angular degree and imaginary spectral parameter. -/ + +namespace DefocusingNLS + +theorem spectralTurning_remote_scale (ell : ℕ) (h b omega r₀ : ℝ) + (hh : h^2=1) (hb : 0≤b) (hb1 : b≤1) (hr₀ : 0 x*r₀^3) hscale + field_simp at hh + nlinarith [hh] + have h₁ : r₀^4*d^3≤8*r₀^3 := by + nlinarith [mul_nonneg (show 0≤eta+99/4 by linarith) (show 0≤d^3 by positivity)] + have h₂ : (eta+99/4)*d^3≤r₀^3/2 := by + nlinarith [mul_nonneg (show 0≤r₀^4 by positivity) (show 0≤d^3 by positivity)] + have h₁' : r₀^4*d^4≤8*r₀^3*d := by nlinarith [mul_le_mul_of_nonneg_right h₁ hd] + have h₂' : (eta+99/4)*d^4≤r₀^3*d/2 := by nlinarith [mul_le_mul_of_nonneg_right h₂ hd] + apply (mul_le_mul_iff_left₀ (show 0 ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have hbound := (spectralTurningNegativeError_tendsto M R r₀ d hr₀ hd).const_mul (25/4 : ℝ) + have hlim : (25/4 : ℝ)*spectralTurningCutoffError M < 2 := by + linarith [spectralTurningCutoffError_le M hM] + filter_upwards [hdata,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (max (2*R) (2*M))), + hbound.eventually (gt_mem_nhds hlim)] with n hn hdn hrn hbn + rcases hn with ⟨hrp,hd0,heta,hz,hsc⟩ + have hdp : 0 < d n := by + apply lt_of_le_of_ne hd0 + intro he + rw [← he] at hsc + norm_num at hsc + have hMp : 0 < M := by linarith + have hRh : R ≤ r₀ n/2 := by linarith [le_trans (le_max_left (2*R) (2*M)) hrn] + have hMd : M*d n ≤ r₀ n/2 := by nlinarith [le_trans (le_max_right (2*R) (2*M)) hrn] + have he : (∫ t in R..(r₀ n-M*d n), (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖) = + (25/4 : ℝ)*(∫ t in R..(r₀ n-M*d n), + ‖spectralLiouvilleResidual (-1) h (b n) (eta n) (omega n) (gamma n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (b n) (eta n) (omega n) (gamma n) t‖) := by + rw [← intervalIntegral.integral_const_mul] + apply intervalIntegral.integral_congr + intro t _ + ring + rw [he] + exact (mul_le_mul_of_nonneg_left (spectralTurning_outer_negative_error h (b n) (eta n) + (omega n) (gamma n) (r₀ n) (d n) M R heta hrp hdp hMp hR hRh hMd hz hsc) + (by norm_num : (0 : ℝ) ≤ 25/4)).trans hbn.le + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRobinCoercive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRobinCoercive.lean new file mode 100644 index 0000000000000000000000000000000000000000..d99eba8dd5b2839969a3d0e65cb7fa0468e0657e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRobinCoercive.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningActionGrowth + +namespace OAI + +/-! The fixed-shell growing cone gives a strictly inward logarithmic +slope for the scalar outgoing comparison. -/ + +namespace DefocusingNLS + +theorem spectralRobin_ratio_coercive (p : ℂ) (u : ℂ × ℂ) (hu : u.1 ≠ 0) + (hp : (2/3 : ℝ)*‖p‖ ≤ p.re) + (hclose : ‖u.2+p*u.1‖ ≤ (5/8 : ℝ)*‖p‖*‖u.1‖) : + (u.2/u.1).re ≤ -(1/24 : ℝ)*‖p‖ := by + have hv : 0 < ‖u.1‖ := norm_pos_iff.mpr hu + have he : u.2/u.1+p = (u.2+p*u.1)/u.1 := by field_simp + have hn : ‖u.2/u.1+p‖ ≤ (5/8 : ℝ)*‖p‖ := by + rw [he,norm_div] + exact (div_le_iff₀ hv).mpr hclose + have hr := (Complex.re_le_norm (u.2/u.1+p)).trans hn + rw [Complex.add_re] at hr + linarith + +theorem spectralTurning_inner_robin_coercive (h b eta omega gamma r₀ R : ℝ) + (heta : 0 ≤ eta) (hr₀ : 0 < r₀) (hR : 0 < R) (hRh : R ≤ r₀/2) + (hlarge : 64 ≤ r₀*R) + (hz : homogeneousSpectralLocalizationFrequency h b eta omega r₀ = 0) + (u : ℂ × ℂ) (hu : u.1 ≠ 0) + (hcone : + let p := spectralLiouvilleMomentum (-1) h b eta omega gamma R + ‖u.2+(p-(spectralLiouvilleSlope eta R : ℂ)/(4*p^2))*u.1‖ ≤ + (1/2 : ℝ)*‖p‖*‖u.1‖) : + (u.2/u.1).re ≤ -(1/24 : ℝ)*‖spectralLiouvilleMomentum (-1) h b eta omega gamma R‖ := by + let F := homogeneousSpectralLocalizationFrequency h b eta omega R + let p := spectralLiouvilleMomentum (-1) h b eta omega gamma R + let g := spectralLiouvilleSlope eta R + obtain ⟨hFlo,hFg⟩ := spectralTurning_forbidden_far h b eta omega r₀ R heta hr₀ hR hRh hz + have hFp : 0 < -F := by dsimp only [F]; nlinarith [sq_pos_of_pos hr₀] + have he : spectralWKBSquaredMomentum (-1) F gamma = ((-F : ℝ) : ℂ)+Complex.I*((-gamma : ℝ) : ℂ) := by + dsimp only [spectralWKBSquaredMomentum] + push_cast + ring + have hre : (2/3 : ℝ)*‖p‖ ≤ p.re := by + dsimp only [p,spectralLiouvilleMomentum] + rw [he] + exact spectralComplexSqrt_re_two_thirds (-F) (-gamma) hFp + have hsq : ‖p‖^2 = ‖spectralWKBSquaredMomentum (-1) F gamma‖ := spectralComplexSqrt_norm_sq _ + have hnorm : -F ≤ ‖p‖^2 := (neg_le_abs F).trans (by + rw [hsq] + exact spectralWKBSquaredMomentum_norm_lower (-1) F gamma (by norm_num)) + have hplower : r₀/8 ≤ ‖p‖ := by nlinarith [norm_nonneg p] + have hpn : 0 < ‖p‖ := lt_of_lt_of_le (by positivity : 0 < r₀/8) hplower + have hRp : 8 ≤ R*‖p‖ := by + have hh := mul_le_mul_of_nonneg_left hplower hR.le + nlinarith + have hg : 0 ≤ g := by dsimp only [g,spectralLiouvilleSlope]; positivity + have hgBound : g ≤ 4*‖p‖^2/R := + hFg.trans (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hnorm (by norm_num)) hR.le) + have hc : ‖(g : ℂ)/(4*p^2)‖ ≤ ‖p‖/8 := by + rw [norm_div,norm_mul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hg] + norm_num only [Complex.norm_ofNat] + apply (div_le_iff₀ (by positivity : 0 < 4*‖p‖^2)).mpr + have hgR := (le_div_iff₀ hR).mp hgBound + have hmult := mul_le_mul_of_nonneg_left hRp (by positivity : 0 ≤ ‖p‖^2) + nlinarith + apply spectralRobin_ratio_coercive p u hu hre + have hrep : u.2+p*u.1 = (u.2+(p-(g : ℂ)/(4*p^2))*u.1)+((g : ℂ)/(4*p^2))*u.1 := by ring + rw [hrep] + calc + _ ≤ ‖u.2+(p-(g : ℂ)/(4*p^2))*u.1‖+‖((g : ℂ)/(4*p^2))*u.1‖ := norm_add_le _ _ + _ ≤ (1/2 : ℝ)*‖p‖*‖u.1‖+(‖p‖/8)*‖u.1‖ := by + rw [norm_mul] + exact add_le_add hcone (mul_le_mul_of_nonneg_right hc (norm_nonneg _)) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootConstruction.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3af96d0c8938dcc4501241aee3bc9e95857a273b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootConstruction.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRadius +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleFrequencyJet + +namespace OAI + +/-! Explicit construction of the unique positive turning radius and its +Airy scale for the actual radial frequency. -/ + +namespace DefocusingNLS + +noncomputable def spectralTurningRoot (h b eta omega : ℝ) : ℝ := + Real.sqrt (8*(Real.sqrt ((b-h*omega)^2+(eta+99/4)/4)-(b-h*omega))) + +theorem spectralTurningRoot_data (h b eta omega : ℝ) (heta : 0 ≤ eta) : + 0 < spectralTurningRoot h b eta omega ∧ + homogeneousSpectralLocalizationFrequency h b eta omega (spectralTurningRoot h b eta omega) = 0 := by + let t := b-h*omega + let L := eta+99/4 + let Z := Real.sqrt (t^2+L/4) + have hL : 0 < L := by dsimp only [L]; linarith + have hD : 0 < t^2+L/4 := by positivity + have hZ : Z^2 = t^2+L/4 := Real.sq_sqrt hD.le + have habs : |t| < Z := (sq_lt_sq₀ (abs_nonneg t) (Real.sqrt_nonneg _)).mp (by + rw [sq_abs,hZ] + linarith) + have ht : t < Z := (le_abs_self t).trans_lt habs + have harg : 0 < 8*(Z-t) := by positivity + have hr : 0 < spectralTurningRoot h b eta omega := Real.sqrt_pos.mpr harg + have hr2 : (spectralTurningRoot h b eta omega)^2 = 8*(Z-t) := Real.sq_sqrt harg.le + refine ⟨hr,?_⟩ + let r := spectralTurningRoot h b eta omega + have hpoly : r^4/16+t*r^2-L = 0 := by + change (spectralTurningRoot h b eta omega)^4/16+t*(spectralTurningRoot h b eta omega)^2-L = 0 + rw [show (spectralTurningRoot h b eta omega)^4 = ((spectralTurningRoot h b eta omega)^2)^2 by ring,hr2] + nlinarith + have hmul : r^2*homogeneousSpectralLocalizationFrequency h b eta omega r = r^4/16+t*r^2-L := by + dsimp only [homogeneousSpectralLocalizationFrequency,t,L] + have hr' : r ≠ 0 := hr.ne' + field_simp [hr'] + ring + apply (mul_left_cancel₀ (pow_ne_zero 2 hr.ne')) + rw [hmul,mul_zero,hpoly] + +noncomputable def spectralTurningRootScale (eta r : ℝ) : ℝ := + (spectralLiouvilleSlope eta r ^ (1/3 : ℝ))⁻¹ + +theorem spectralTurningRootScale_data (eta r : ℝ) (heta : 0 ≤ eta) (hr : 0 < r) : + 0 < spectralTurningRootScale eta r ∧ + spectralLiouvilleSlope eta r*(spectralTurningRootScale eta r)^3 = 1 := by + have hs : 0 < spectralLiouvilleSlope eta r := by + dsimp only [spectralLiouvilleSlope] + positivity + refine ⟨inv_pos.mpr (Real.rpow_pos_of_pos hs _),?_⟩ + rw [spectralTurningRootScale,inv_pow,← Real.rpow_mul_natCast hs.le] + norm_num + exact mul_inv_cancel₀ hs.ne' + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootRemote.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootRemote.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4703d24632f99bac9a8480158c0c9f5152aedbe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningRootRemote.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRootConstruction + +namespace OAI + +/-! The explicit turn lies before half the natural remote radius. -/ + +namespace DefocusingNLS + +theorem spectralTurningRoot_remote (ell : ℕ) (h b omega E : ℝ) + (hh : |h| ≤ 1) (hb : 0 ≤ b) (hw : 0 ≤ omega) (hE : 0 < E) + (hscale : E^2 = 256*max ((ell : ℝ)+1) omega) : + 2*spectralTurningRoot h b ((ell : ℝ)*(ell+10)) omega ≤ E := by + let S := max ((ell : ℝ)+1) omega + let r := E/2 + let L := (ell : ℝ)*(ell+10)+99/4 + have hell : 0 ≤ (ell : ℝ) := Nat.cast_nonneg ell + have hS : 1 ≤ S := le_trans (by linarith) (le_max_left _ _) + have hwS : omega ≤ S := le_max_right _ _ + have hr : 0 < r := by dsimp only [r]; positivity + have hr2 : r^2 = 64*S := by dsimp only [r,S]; nlinarith [hscale] + have hL : L ≤ 25*S^2 := by + have he : ((ell : ℝ)+1)^2 ≤ S^2 := + (sq_le_sq₀ (by positivity) (by linarith)).mpr (le_max_left _ _) + dsimp only [L] + nlinarith + have hhw : h*omega ≤ omega := by nlinarith [abs_le.mp hh] + have hprod : h*omega*r^2 ≤ S*r^2 := + mul_le_mul_of_nonneg_right (hhw.trans hwS) (sq_nonneg r) + have hbr : 0 ≤ b*r^2 := mul_nonneg hb (sq_nonneg r) + have hid : r^2*homogeneousSpectralLocalizationFrequency h b + ((ell : ℝ)*(ell+10)) omega r = r^4/16+b*r^2-h*omega*r^2-L := by + dsimp only [homogeneousSpectralLocalizationFrequency,L] + field_simp [hr.ne'] + have hF : 0 < homogeneousSpectralLocalizationFrequency h b + ((ell : ℝ)*(ell+10)) omega r := by + have hS2 : 0 < S^2 := sq_pos_of_pos (by linarith) + have hr4 : r^4 = (64*S)^2 := by rw [show r^4 = (r^2)^2 by ring,hr2] + have hp : 0 < r^2*homogeneousSpectralLocalizationFrequency h b + ((ell : ℝ)*(ell+10)) omega r := by + rw [hid,hr4] + rw [hr2] at hprod + nlinarith + exact (mul_pos_iff_of_pos_left (sq_pos_of_pos hr)).mp hp + obtain ⟨ht,htF⟩ := spectralTurningRoot_data h b ((ell : ℝ)*(ell+10)) omega (by positivity) + have hlt : spectralTurningRoot h b ((ell : ℝ)*(ell+10)) omega < r := by + by_contra hn + have hm := (homogeneousSpectralLocalizationFrequency_strictMono h b + ((ell : ℝ)*(ell+10)) omega (by positivity)).monotoneOn hr ht (le_of_not_gt hn) + rw [htF] at hm + exact (not_le_of_gt hF) hm + dsimp only [r] at hlt + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningScaleLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningScaleLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..20227b6bb24b17e56c37dd7e3d7647812c0f5e07 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningScaleLimit.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRescale +import Mathlib.Topology.MetricSpace.Pseudo.Defs +import Mathlib.Analysis.SpecificLimits.Basic + +namespace OAI + +/-! The Airy length tends to zero as the actual turning radius escapes. +This follows directly from its defining equation, without an assumed scale limit. -/ + +open Filter Set Topology +namespace DefocusingNLS + +theorem spectralTurningScale_cubic (eta r₀ d : ℝ) (hr₀ : 0 by simpa only [hS.2.1] using S.ode_U r (hsub hr)) hS.2.2.2.2.2 + let F := homogeneousSpectralLocalizationFrequency 1 (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) + have hF : ∀ r ∈ Icc R B, F r ≤ -omega (φ n)/2 := by + intro r hr + have hr0 : 0 < r := hR.trans_le hr.1 + have hr2 := pow_le_pow_left₀ hr0.le hr.2 2 + have hpot : 0 ≤ ((ell (φ n) : ℝ)*(ell (φ n)+10)+99/4)/r^2 := by positivity + dsimp only [F,homogeneousSpectralLocalizationFrequency] + nlinarith [hdn.2.2.2.1] + have hFB := hF B ⟨hRB,le_rfl⟩ + have hp : Real.sqrt (omega (φ n)/2) ≤ + ‖spectralLiouvilleMomentum (-1) 1 (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) B‖ := by + apply (Real.sqrt_le_sqrt (show omega (φ n)/2 ≤ |F B| from by + rw [abs_of_nonpos (hFB.trans (by linarith))]; linarith)).trans + exact spectralWKBSqrt_frequency_lower (-1) (F B) (gamma (φ n)) (by norm_num) + let mu := Real.sqrt (omega (φ n)/2)/24 + have hmu : 0 < mu := by dsimp only [mu]; positivity + have hslope : ((S.U B).2/(S.U B).1).re ≤ -mu := by + dsimp only [mu] + linarith + apply spectralForbidden_mass_decay R B mu hRB hmu S.U S.V + (S.continuous_U.mono (Icc_subset_Icc le_rfl hBE)) + (fun r hr => S.ode_U r ⟨hr.1.le,hr.2.le.trans hBE⟩) + · intro r hr + have hf := hF r ⟨hr.1.le,hr.2.le⟩ + have hs := Real.sq_sqrt (show 0 ≤ omega (φ n)/2 by positivity) + rw [hS.2.1] + simp only [Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,zero_mul,mul_zero,sub_zero,add_zero] + dsimp only [mu] + nlinarith + · rw [spectralScalarMomentum_ratio (S.U B)] + have hm := mul_le_mul_of_nonneg_right hslope (Complex.normSq_nonneg (S.U B).1) + change 2*(((S.U B).2/(S.U B).1).re*spectralScalarMass (S.U B))+ + mu*spectralScalarMass (S.U B) ≤ 0 + have hmass : 0 ≤ spectralScalarMass (S.U B) := Complex.normSq_nonneg _ + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningSlopeLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningSlopeLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4a1860c520a67df7b1234dc089d9af3b1015704 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningSlopeLimit.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleFrequencyJet +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit + +namespace OAI + +/-! The derivative of the frequency has the Airy normalization at every +fixed rescaled point, uniformly in the angular parameter. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_scaled_slope_bound (eta r₀ d xi : ℝ) + (hr₀ : 0 < r₀) (hd : 0 ≤ d) (heta : 0 ≤ eta) (hr : r₀+d*xi ≠ 0) + (hscale : spectralLiouvilleSlope eta r₀*d^3 = 1) : + |spectralLiouvilleSlope eta (r₀+d*xi)*d^3-1| ≤ + |d*xi/r₀|+|(r₀/(r₀+d*xi))^3-1| := by + let A := r₀/8*d^3 + let B := 2*(eta+99/4)/r₀^3*d^3 + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hAB : A+B = 1 := by + dsimp only [A,B] + simpa only [spectralLiouvilleSlope,add_mul] using hscale + have hA1 : A ≤ 1 := by linarith + have hB1 : B ≤ 1 := by linarith + have he : spectralLiouvilleSlope eta (r₀+d*xi)*d^3-1 = + A*(d*xi/r₀)+B*((r₀/(r₀+d*xi))^3-1) := by + calc + _ = spectralLiouvilleSlope eta (r₀+d*xi)*d^3-(A+B) := by rw [hAB] + _ = _ := by + dsimp only [spectralLiouvilleSlope,A,B] + field_simp [hr₀.ne',hr] + ring_nf + rw [he] + calc + _ ≤ |A*(d*xi/r₀)|+|B*((r₀/(r₀+d*xi))^3-1)| := abs_add_le _ _ + _ = A*|d*xi/r₀|+B*|(r₀/(r₀+d*xi))^3-1| := by + rw [abs_mul A (d*xi/r₀),abs_mul B ((r₀/(r₀+d*xi))^3-1), + abs_of_nonneg hA,abs_of_nonneg hB] + _ ≤ _ := add_le_add (mul_le_of_le_one_left (abs_nonneg _) hA1) + (mul_le_of_le_one_left (abs_nonneg _) hB1) + +theorem spectralTurning_scaled_slope_tendsto (eta r₀ d : ℕ → ℝ) (xi : ℝ) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1) : + Tendsto (fun n => spectralLiouvilleSlope (eta n) (r₀ n+d n*xi)*(d n)^3) + atTop (𝓝 1) := by + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ hdata + let t := fun n => d n*xi/r₀ n + have ht : Tendsto t atTop (𝓝 0) := by + convert (hd.mul (tendsto_inv_atTop_zero.comp hr₀)).mul_const xi using 1 + · funext n + dsimp only [t,Function.comp_def] + ring_nf + · simp only [mul_zero,zero_mul] + have ht1 : Tendsto (fun n => 1+t n) atTop (𝓝 1) := by + simpa only [add_zero] using ht.const_add 1 + have hrec : Tendsto (fun n => ((1+t n)⁻¹)^3-1) atTop (𝓝 0) := by + simpa only [inv_one,one_pow,sub_self] using ((ht1.inv₀ (by norm_num)).pow 3).sub_const 1 + have hrate : Tendsto (fun n => |t n|+|((1+t n)⁻¹)^3-1|) atTop (𝓝 0) := by + simpa only [abs_zero,zero_add] using ht.abs.add hrec.abs + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero' (Eventually.of_forall (fun n => norm_nonneg _)) _ hrate + filter_upwards [hdata,ht1.eventually (lt_mem_nhds (by norm_num : (0 : ℝ) < 1))] with n hn htpos + have hr : r₀ n+d n*xi ≠ 0 := by + have he : r₀ n+d n*xi = r₀ n*(1+t n) := by + dsimp only [t] + field_simp [hn.1.ne'] + rw [he] + exact mul_ne_zero hn.1.ne' htpos.ne' + have hbound := spectralTurning_scaled_slope_bound (eta n) (r₀ n) (d n) xi + hn.1 hn.2.1 hn.2.2.1 hr hn.2.2.2 + have he : r₀ n/(r₀ n+d n*xi) = (1+t n)⁻¹ := by + dsimp only [t] + field_simp [hn.1.ne',hr] + simpa only [Real.norm_eq_abs,he,t] using hbound + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningState.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningState.lean new file mode 100644 index 0000000000000000000000000000000000000000..e32aec496db6b06a32361c162358e8b924f5aaea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningState.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarGreen +import Mathlib.Analysis.Calculus.Deriv.Comp + +namespace OAI + +/-! Exact Cauchy-state rescaling at a turning point. The value and derivative +factors preserve the complex flux. -/ + +namespace DefocusingNLS + +noncomputable def spectralTurningState (r₀ d s : ℝ) (q : ℝ → ℂ × ℂ) (xi : ℝ) : ℂ × ℂ := + ((q (r₀+d*xi)).1/(s : ℂ),(s : ℂ)*(q (r₀+d*xi)).2) + +theorem spectralTurningState_hasDerivAt + (r₀ d s xi : ℝ) (hs : s≠0) (hsq : s^2=d) (q : ℝ → ℂ × ℂ) (V : ℂ) + (hq : HasDerivAt q (spectralScalarField V (q (r₀+d*xi))) (r₀+d*xi)) : + HasDerivAt (spectralTurningState r₀ d s q) + (spectralScalarField ((d : ℂ)^2*V) (spectralTurningState r₀ d s q xi)) xi := by + have hsC : (s : ℂ)≠0 := Complex.ofReal_ne_zero.mpr hs + have hsqC : (s : ℂ)^2=(d : ℂ) := by exact_mod_cast hsq + have hcomp := hq.scomp xi (((hasDerivAt_id xi).const_mul d).const_add r₀) + have h1 := (ContinuousLinearMap.fst ℝ ℂ ℂ).hasFDerivAt.comp_hasDerivAt xi hcomp + have h2 := (ContinuousLinearMap.snd ℝ ℂ ℂ).hasFDerivAt.comp_hasDerivAt xi hcomp + apply ((h1.div_const (s : ℂ)).prodMk (h2.const_mul (s : ℂ))).congr_deriv + apply Prod.ext + · dsimp only [ContinuousLinearMap.coe_fst',ContinuousLinearMap.coe_snd',Function.comp_apply, + Prod.smul_fst,Prod.smul_snd,spectralScalarField,spectralTurningState] + rw [Complex.real_smul] + field_simp + linear_combination -(q (r₀+d*xi)).2*hsqC + · dsimp only [ContinuousLinearMap.coe_fst',ContinuousLinearMap.coe_snd',Function.comp_apply, + Prod.smul_fst,Prod.smul_snd,spectralScalarField,spectralTurningState] + rw [Complex.real_smul] + field_simp + linear_combination -(d : ℂ)*V*(q (r₀+d*xi)).1*hsqC + +theorem spectralTurningState_flux (r₀ d s xi : ℝ) (hs : s≠0) (q : ℝ → ℂ × ℂ) : + (star (spectralTurningState r₀ d s q xi).1*(spectralTurningState r₀ d s q xi).2).im= + (star (q (r₀+d*xi)).1*(q (r₀+d*xi)).2).im := by + have hsC : (s : ℂ)≠0 := Complex.ofReal_ne_zero.mpr hs + congr 1 + dsimp only [spectralTurningState] + simp only [Complex.star_def,map_div₀,Complex.conj_ofReal] + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformBoundary.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..a944ecf4a0547e9c675f57110aa08abc5ba7408a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformBoundary.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformGreen +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNormalizedBoundarySystem + +namespace OAI + +/-! The constructed turning comparison supplies a scalar boundary system +and a uniform extension bound, ready for coupled absorption. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_uniform_boundary_systems + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + ∃ S : SpectralScalarBoundarySystem L (E (φ n)) K, + S.k = spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) ∧ + S.V = (fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) ∧ + S.beta = (h : ℂ)*Complex.I*(Real.sqrt (homogeneousSpectralLocalizationFrequency h + (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) : ℂ) ∧ + S.U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) ∧ + ∀ z : ℂ, ∀ r ∈ Icc L (E (φ n)), + spectralShellNorm (S.k r) (S.extension z r) ≤ J*S.k L*‖z‖ := by + obtain ⟨q,φ,hφ,hq,K,J,hK,hJ,hall⟩ := spectralTurning_outgoing_green_extension_uniform_inner + ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + refine ⟨φ,K,J,hφ,hK,hJ,?_⟩ + filter_upwards [hall,hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop B)] with n hn hqn hdn hlarge + intro L hL + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,hext⟩ := hn L hL + obtain ⟨hrp,hd,hb,hb1,hg,hRE',hscale,hroot,hdscale⟩ := hdn + change B ≤ r₀ (φ n) at hlarge + have hL0 : 0 < L := hR.trans_le hL.1 + have hRE : L ≤ E (φ n) := by linarith [hL.2] + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hd + intro he + rw [← he] at hdscale + norm_num at hdscale + let k := spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) + let V := fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ) + have hk : ContinuousOn k (Icc L (E (φ n))) := + (spectralTurningRegularizedWeight_continuousOn h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n))).mono + (fun r hr => hL0.trans_le hr.1) + have hkp : ∀ r ∈ Icc L (E (φ n)), 0 < k r := fun r _ => + spectralTurningRegularizedWeight_pos h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) r hdp + let S := spectralNormalizedBoundarySystem L (E (φ n)) K h + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) hRE + k V Y (q (φ n)) W hk hkp hYc.continuousOn hqn.1.continuousOn hYD (fun t ht => hqn.2.2.2 t ⟨hL.1.trans ht.1,ht.2⟩) + hYR hqn.2.1 hW hdet hgreen + exact ⟨S,rfl,rfl,rfl,hqn.2.1,hext⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformCone.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..275e1c385ea8ed696e97682c3ae7ffd3b528c57a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformCone.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningInnerCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformError + +namespace OAI + +/-! The outgoing reflected cone and growing value bound hold uniformly +as the left endpoint varies on a fixed shell. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_outgoing_uniform_relative_bounds + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∀ eps : ℝ, 0 < eps → ∃ M : ℝ, 32 ≤ M ∧ ∀ᶠ n in atTop, ∀ r ∈ Icc R B, + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) r + ((q (φ n) r).1 ≠ 0 ∧ + ‖(q (φ n) r).2+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) r : ℂ)/ + (4*p^2))*(q (φ n) r).1‖ ≤ eps*‖p‖*‖(q (φ n) r).1‖) ∧ + (1/16 : ℝ)*Real.exp ((∫ t in r..(r₀ (φ n)-M*d (φ n)), + spectralLiouvilleMomentum (-1) h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) t).re)* + spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) + (r₀ (φ n)-M*d (φ n))‖) (q (φ n) (r₀ (φ n)-M*d (φ n))) ≤ + Real.sqrt ‖p‖*‖(q (φ n) r).1‖ := by + obtain ⟨q,φ,hφ,hq,hmargin⟩ := spectralTurning_outgoing_growing_connection + ell h b omega gamma r₀ d E R hh hR hr₀ hdata + refine ⟨q,φ,hφ,hq,?_⟩ + intro eps heps + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + have hsample : ∀ᶠ n in atTop, 0 < r₀ (φ n) ∧ 0 ≤ d (φ n) ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) (r₀ (φ n)) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ (φ n))*(d (φ n))^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hrt := hr₀.comp hφ.tendsto_atTop + have hd := spectralTurningScale_tendsto eta (fun n => r₀ (φ n)) (fun n => d (φ n)) hrt + (hsample.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + have herr := spectralTurning_eventual_uniform_error (min (1/16) (eps/40)) + (lt_min (by norm_num) (by positivity)) h (fun n => b (φ n)) eta + (fun n => omega (φ n)) (fun n => gamma (φ n)) (fun n => r₀ (φ n)) + (fun n => d (φ n)) R B hR hRB hrt hsample + obtain ⟨M,hMm,hMe⟩ := (hmargin.and herr).exists + have hM : 32 ≤ M := hMe.1 + have hMp : 0 < M := by linarith + refine ⟨M,hM,?_⟩ + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata, + hsample,hMm,hMe.2,hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*B) (2*M))))] + with n hqn hdn hsn hmn hen hsmalln hlarge + dsimp only [Function.comp_def] at hlarge + let c := r₀ (φ n)-M*d (φ n) + have hdp : 0 < d (φ n) := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hs := hsn.2.2.2.2 + rw [← he] at hs + norm_num at hs + have hRM := (le_max_right (16/R) (max (2*B) (2*M))).trans hlarge + have hBhalf : B ≤ r₀ (φ n)/2 := by linarith [le_trans (le_max_left (2*B) (2*M)) hRM] + have hMd : M*d (φ n) ≤ r₀ (φ n)/2 := by nlinarith [le_trans (le_max_right (2*B) (2*M)) hRM] + have hprod : 16 ≤ r₀ (φ n)*R := by + have hl := mul_le_mul_of_nonneg_right ((le_max_left (16/R) (max (2*B) (2*M))).trans hlarge) hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at hl + have hBc : B ≤ c := by dsimp only [c]; linarith + have hRc : R ≤ c := hRB.trans hBc + have hct : c < r₀ (φ n) := by dsimp only [c]; nlinarith + have hcE : c ≤ E (φ n) := hct.le.trans (by linarith [hdn.2.2.2.2.2.1]) + have hF (t : ℝ) (ht : t ∈ Icc R c) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t := by + have hf := homogeneousSpectralLocalizationFrequency_strictMono h (b (φ n)) (eta n) (omega (φ n)) + hsn.2.2.1 (hR.trans_le ht.1) hsn.1 (ht.2.trans_lt hct) + rw [hsn.2.2.2.1] at hf + linarith + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (b (φ n)) (eta n) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Icc c (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) (eta n) (omega (φ n)) t + (hR.trans_le (hRc.trans ht.1))).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (E (φ n)) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + rw [he] at hf + have hz : spectralScalarFlux (0 : ℂ × ℂ) = 0 := by simp [spectralScalarFlux] + rw [hz] at hf + nlinarith [hh] + have hqc : q (φ n) c ≠ 0 := spectralScalar_ne_zero_of_right c (E (φ n)) hcE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRc.trans ht.1.le,ht.2.le⟩) hqE + have hk : 0 < Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) c‖ := + spectralLiouville_norm_weight_pos (-1) h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) c + (by norm_num) (by intro he; have hf := hF c ⟨hRc,le_rfl⟩; rw [he,mul_zero] at hf; linarith) + have hN : 0 < spectralShellNorm (Real.sqrt ‖spectralLiouvilleMomentum (-1) h (b (φ n)) + (eta n) (omega (φ n)) (gamma (φ n)) c‖) (q (φ n) c) := by + by_contra hbad + have hz := le_antisymm (le_of_not_gt hbad) (spectralShellNorm_nonneg _ hk.le _) + exact hqc ((spectralShellNorm_eq_zero _ hk _).mp hz) + intro r hr + have hrc : r ≤ c := hr.2.trans hBc + apply spectralLiouville_reflected_relative_bounds eps heps h (b (φ n)) (eta n) (omega (φ n)) (gamma (φ n)) r c + (hR.trans_le hr.1) hrc (fun t ht => hF t ⟨hr.1.trans ht.1,ht.2⟩) + (fun t ht => spectralTurning_negative_derivative_small (-1) h (b (φ n)) (eta n) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) (d (φ n)) M R t (by norm_num) + hsn.2.2.1 hsn.1 hdp hM hR hprod (hr.1.trans ht.1) ht.2 hsn.2.2.2.1 hsn.2.2.2.2) + (q (φ n)) hqn.1.continuousOn + (fun t ht => hqn.2.2.2 t ⟨hr.1.trans ht.1.le,ht.2.le.trans hcE⟩) hN + · simpa only [eta, c, div_eq_mul_inv, mul_comm, one_mul] using hmn + · exact hen r hr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformError.lean new file mode 100644 index 0000000000000000000000000000000000000000..5321e2f523d9da941c85b5c7ee8e32e9a6e34124 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformError.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningConeError +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleUniformError + +namespace OAI + +/-! A single cutoff controls the reflected error at every left endpoint +of a fixed shell. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_eventual_uniform_error + (eps : ℝ) (heps : 0 < eps) (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) + (R B : ℝ) (hR : 0 < R) (hRB : R ≤ B) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope (eta n) (r₀ n)*(d n)^3 = 1) : + ∀ᶠ M : ℝ in atTop, 32 ≤ M ∧ ∀ᶠ n in atTop, + ∀ r ∈ Icc R B, + spectralLiouvilleConeError h (b n) (eta n) (omega n) (gamma n) r (r₀ n-M*d n) ≤ eps := by + have hlow := spectralTurning_eventual_relative_error (eps/2) (by positivity) + h b eta omega gamma r₀ d R hR hr₀ hdata + have hhigh := spectralTurning_eventual_relative_error (eps/2) (by positivity) + h b eta omega gamma r₀ d B (hR.trans_le hRB) hr₀ hdata + have hd := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun _ hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2⟩)) + filter_upwards [hlow,hhigh] with M hMl hMh + refine ⟨hMl.1,?_⟩ + filter_upwards [hMl.2,hMh.2,hdata, + hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hr₀.eventually (eventually_ge_atTop (B+M+1))] with n hln hhn hdn hds hrn + have hdp : 0 < d n := by + apply lt_of_le_of_ne hdn.2.1 + intro he + have hx := hdn.2.2.2.2 + rw [← he] at hx + norm_num at hx + have hMp : 0 < M := by linarith [hMl.1] + have hBc : B ≤ r₀ n-M*d n := by nlinarith + have hF : ∀ t ∈ Icc R (r₀ n-M*d n), + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) t := by + intro t ht + have hlt : t < r₀ n := by nlinarith [ht.2] + have hm := homogeneousSpectralLocalizationFrequency_strictMono h (b n) (eta n) (omega n) + hdn.2.2.1 (hR.trans_le ht.1) hdn.1 hlt + rw [hdn.2.2.2.1] at hm + linarith + have hh := spectralLiouvilleConeError_uniform h (b n) (eta n) (omega n) (gamma n) + R B (r₀ n-M*d n) (eps/2) hR hRB hBc hF hln hhn + rw [show 2*(eps/2) = eps by ring] at hh + exact hh + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformGreen.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformGreen.lean new file mode 100644 index 0000000000000000000000000000000000000000..c66a3cf09bf10300196d3e2b32e1c63c0387fcbb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformGreen.lean @@ -0,0 +1,195 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningGreen +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleResidualOrder +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOscillatoryUniform + +namespace OAI + +/-! Uniform scalar Green kernels as the inner endpoint varies through a fixed shell. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralTurning_outgoing_green_extension_uniform_inner + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (q : ℕ → ℝ → ℂ × ℂ) (φ : ℕ → ℕ), StrictMono φ ∧ + (∀ᶠ n in atTop, Continuous (q n) ∧ + q n (E n) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (E n)))) ∧ + spectralScalarFlux (q n (E n)) = h ∧ + ∀ t ∈ Icc R (E n), HasDerivAt (q n) (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) t : ℂ)+Complex.I*(gamma n : ℂ)) + (q n t)) t) ∧ + ∃ K J : ℝ, 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + let k := spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) + ∃ (Y : ℝ → ℂ × ℂ) (W : ℂ), Continuous Y ∧ Y L = (0,(k L : ℂ)) ∧ + (∀ t ∈ Icc L (E (φ n)), HasDerivAt Y (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) t : ℂ)+ + Complex.I*(gamma (φ n) : ℂ)) (Y t)) t) ∧ + W ≠ 0 ∧ (∀ t ∈ Icc L (E (φ n)), spectralScalarWronskian (Y t) (q (φ n) t) = W) ∧ + (∀ r ∈ Icc L (E (φ n)), ∀ t ∈ Icc L (E (φ n)), + spectralShellNorm (k r) (spectralScalarGreenState Y (q (φ n)) W r t) ≤ K/(k t)) ∧ + ∀ z : ℂ, ∀ r ∈ Icc L (E (φ n)), + spectralShellNorm (k r) ((z/(q (φ n) L).1) • q (φ n) r) ≤ J*k L*‖z‖ := by + obtain ⟨q,φ,hφ,hq,hbounds⟩ := spectralTurning_outgoing_uniform_relative_bounds + ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + obtain ⟨M,hM,hvalue⟩ := hbounds 1 (by norm_num) + let eta := fun n => (ell (φ n) : ℝ)*(ell (φ n)+10) + let bs := fun n => b (φ n) + let os := fun n => omega (φ n) + let gs := fun n => gamma (φ n) + let rs := fun n => r₀ (φ n) + let ds := fun n => d (φ n) + let es := fun n => E (φ n) + have hrt : Tendsto rs atTop atTop := hr₀.comp hφ.tendsto_atTop + have hs : ∀ᶠ n in atTop, 0 < rs n ∧ 0 ≤ ds n ∧ 0 ≤ eta n ∧ |gs n| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) (rs n) = 0 ∧ + spectralLiouvilleSlope (eta n) (rs n)*(ds n)^3 = 1 := by + filter_upwards [hφ.tendsto_atTop.eventually hdata] with n hn + exact ⟨hn.1,hn.2.1,by dsimp only [eta]; positivity,hn.2.2.2.2.1, + hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hs' : ∀ᶠ n in atTop, 0 < rs n ∧ 0 ≤ ds n ∧ 0 ≤ eta n ∧ + homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) (rs n) = 0 ∧ + spectralLiouvilleSlope (eta n) (rs n)*(ds n)^3 = 1 := hs.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.1,hn.2.2.2.2.2⟩) + have hd := spectralTurningScale_tendsto eta rs ds hrt + (hs.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hu := spectralTurningCoefficient_uniform_limit h bs eta os gs rs ds M 8 (by linarith) hrt hs + have hw := spectralTurning_regularized_outer_weights h bs eta os gs rs ds M 8 (by linarith) hrt hs + have hres := spectralTurning_eventual_residual_bound h bs eta os gs rs ds R M hR hM hrt hs' + have hpos := spectralTurning_oscillatory_uniform (fun n => ell (φ n)) h bs os gs rs ds es M hh hM hrt + (hφ.tendsto_atTop.eventually hdata) + let A : ℝ := (25/2)*Real.exp 2 + let C : ℝ := (M+3+(1 : ℝ)⁻¹)*max (1 : ℝ)⁻¹ (M+3)*Real.exp ((1+(M+1))*(M-(-M))) + let P : ℝ := 25*Real.exp (2304+25/4) + let K : ℝ := max A (C*A*P)*max A (C*P)/(1/16) + let J : ℝ := max A (C*P)/(1/16) + have hC : 0 ≤ C := by dsimp only [C]; positivity + have hP : 1 ≤ P := by + have he : 1 ≤ Real.exp (2304+(25/4 : ℝ)) := Real.one_le_exp_iff.mpr (by norm_num) + dsimp only [P] + linarith + refine ⟨q,φ,hφ,hq,K,J,by dsimp only [K,A]; positivity, + by dsimp only [J,A]; positivity,?_⟩ + filter_upwards [hφ.tendsto_atTop.eventually hq,hφ.tendsto_atTop.eventually hdata,hs, + hvalue,hw,hres,hpos,(Metric.tendstoUniformlyOn_iff.mp hu) 1 (by norm_num), + hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)), + hrt.eventually (eventually_ge_atTop (max (16/R) (max (2*B+2) (2*M+2))))] + with n hqn hdn hsn hvn hwn hrn hpn hun hsmall hlarge + have hdp : 0 < ds n := by + apply lt_of_le_of_ne hsn.2.1 + intro he + have hc := hsn.2.2.2.2.2 + rw [← he] at hc + norm_num at hc + have hlargeR := (le_max_left (16/R) (max (2*B+2) (2*M+2))).trans hlarge + have hlargeRM := (le_max_right (16/R) (max (2*B+2) (2*M+2))).trans hlarge + have hbigR := (le_max_left (2*B+2) (2*M+2)).trans hlargeRM + have hbigM := (le_max_right (2*B+2) (2*M+2)).trans hlargeRM + have hMp : 0 < M := by linarith + have hMd : ds n*M < rs n/2 := by nlinarith + let a := rs n-ds n*M + let z := rs n+ds n*M + have hBa : B < a := by dsimp only [a]; linarith + have hRa : R < a := hRB.trans_lt hBa + have hzE : z < es n := by dsimp only [z,es,rs] at *; linarith [hdn.2.2.2.2.2.1] + have ha0 : 0 < a := hR.trans hRa + have haE : a ≤ es n := by dsimp only [a,z] at *; nlinarith + have hprod : 16 ≤ rs n*R := by + have ht := mul_le_mul_of_nonneg_right hlargeR hR.le + have he : (16/R)*R = 16 := by field_simp + rwa [he] at ht + have hF (t : ℝ) (ht : t ∈ Icc R a) : + 0 < (-1)*homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) t := by + have ht0 := hR.trans_le ht.1 + have htr : t < rs n := by dsimp only [a] at ht; nlinarith [ht.2] + have he := homogeneousSpectralLocalizationFrequency_strictMono h (bs n) (eta n) (os n) + hsn.2.2.1 ht0 hsn.1 htr + rw [hsn.2.2.2.2.1] at he + linarith + have hcoef (xi : ℝ) (hxi : xi ∈ Icc (-M) M) : + ‖spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi‖ ≤ M+1 := by + have he : ‖spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi-(xi : ℂ)‖ ≤ 1 := by + simpa only [dist_eq_norm,norm_sub_rev] using (hun xi hxi).le + have hx : ‖(xi : ℂ)‖ ≤ M := by simpa only [Complex.norm_real,Real.norm_eq_abs] using abs_le.mpr hxi + have hb := norm_add_le (spectralTurningCoefficient h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) xi-(xi : ℂ)) (xi : ℂ) + rw [sub_add_cancel] at hb + linarith + let k := spectralTurningRegularizedWeight h (bs n) (eta n) (os n) (gs n) (ds n) + have hwl (t : ℝ) (ht : t ∈ Icc R a) : k t = + Real.sqrt ‖spectralLiouvilleMomentum (-1) h (bs n) (eta n) (os n) (gs n) t‖ := + hwn.1 t (hR.trans_le ht.1) ht.2 + have hVp : ContinuousOn (fun t => + (homogeneousSpectralLocalizationFrequency h (bs n) (eta n) (os n) t : ℂ)+Complex.I*(gs n : ℂ)) (Icc a (es n)) := + (Complex.continuous_ofReal.comp_continuousOn (fun t ht => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (bs n) (eta n) (os n) t + (ha0.trans_le ht.1)).continuousAt.continuousWithinAt)).add continuousOn_const + have hqE : q (φ n) (es n) ≠ 0 := by + intro he + have hf := hqn.2.2.1 + change spectralScalarFlux (q (φ n) (es n)) = h at hf + rw [he] at hf + norm_num [spectralScalarFlux] at hf + nlinarith [hh] + have hqa : q (φ n) a ≠ 0 := spectralScalar_ne_zero_of_right a (es n) haE _ hVp _ + hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hRa.le.trans ht.1.le,ht.2.le⟩) hqE + have hN : 0 < spectralShellNorm (k a) (q (φ n) a) := by + have hkp := spectralTurningRegularizedWeight_pos h (bs n) (eta n) (os n) (gs n) (ds n) a hdp + exact lt_of_le_of_ne (spectralShellNorm_nonneg _ hkp.le _) (fun he => + hqa ((spectralShellNorm_eq_zero _ hkp _).mp he.symm)) + intro L hL + have hLa : L < a := hL.2.trans_lt hBa + have hL0 : 0 < L := hR.trans_le hL.1 + have hFL (t : ℝ) (ht : t ∈ Icc L a) := hF t ⟨hL.1.trans ht.1,ht.2⟩ + have hwlL (t : ℝ) (ht : t ∈ Icc L a) := hwl t ⟨hL.1.trans ht.1,ht.2⟩ + have hresL : (∫ t in L..a, (25/4 : ℝ)* + ‖spectralLiouvilleResidual (-1) h (bs n) (eta n) (os n) (gs n) t‖/ + ‖spectralLiouvilleMomentum (-1) h (bs n) (eta n) (os n) (gs n) t‖) ≤ 2 := by + apply (spectralLiouvilleResidual_integral_mono h (bs n) (eta n) (os n) (gs n) R L a + hR hL.1 hLa.le hF).trans + simpa only [mul_comm M] using hrn + have hval : (1/16 : ℝ)*Real.exp ((∫ t in L..a, + spectralLiouvilleMomentum (-1) h (bs n) (eta n) (os n) (gs n) t).re)* + spectralShellNorm (k a) (q (φ n) a) ≤ k L*‖(q (φ n) L).1‖ := by + rw [hwl a ⟨hRa.le,le_rfl⟩,hwl L ⟨hL.1,hLa.le⟩] + simpa only [a,bs,eta,os,gs,rs,ds,mul_comm M] using (hvn L hL).2 + obtain ⟨Y,W,hYc,hYR,hYD,hW,hdet,hgreen,hext⟩ := spectralTurning_regularized_green_and_extension + h (bs n) (eta n) (os n) (gs n) (rs n) (ds n) M L (es n) C P hL0 hdp + (by linarith) hC hP hLa hzE hcoef le_rfl hFL + (fun t ht => spectralTurning_negative_derivative_small (-1) h (bs n) (eta n) (os n) (gs n) + (rs n) (ds n) M R t (by norm_num) hsn.2.2.1 hsn.1 hdp hM hR hprod (hL.1.trans ht.1) + (by simpa only [mul_comm M] using ht.2) hsn.2.2.2.2.1 hsn.2.2.2.2.2) + hresL hwlL + (by + intro v hvc hvD t ht + have he : rs n+M*ds n = z := by dsimp only [z]; ring + rw [he] at hpn + have hz := hwn.2 z le_rfl + have ht' := hwn.2 t ht.1 + have hp := (hpn v hvc hvD z ⟨le_rfl,hzE.le⟩ t ht ht.1).1 + dsimp only at hp + rw [← hz,← ht'] at hp + exact hp) + (q (φ n)) hqn.1.continuousOn (fun t ht => hqn.2.2.2 t ⟨hL.1.trans ht.1.le,ht.2.le⟩) hN hval + refine ⟨Y,W,hYc,hYR,hYD,hW,hdet,?_,?_⟩ + · intro r hr t ht + apply (hgreen r hr t ht).trans_eq + dsimp only [K,A] + ring + · intro z r hr + exact hext z r hr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformInward.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformInward.lean new file mode 100644 index 0000000000000000000000000000000000000000..af3ab06647c0f3dc70f919ac936482988b411914 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformInward.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformSlope +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRobinCoercive + +namespace OAI + +/-! Every normalized outgoing scalar comparison has a strictly inward +logarithmic slope on a fixed inner sphere along an escaping turn. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_normalized_uniform_inward + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ᶠ n in atTop, + ∀ L ∈ Icc R B, ∀ U : ℝ → ℂ × ℂ, ContinuousOn U (Icc L (E (φ n))) → + (∀ r ∈ Icc L (E (φ n)), HasDerivAt U (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) + (U r)) r) → + U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) → + ((U L).2/(U L).1).re ≤ -(1/24 : ℝ)*‖spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) L‖ := by + obtain ⟨φ,hφ,hslope⟩ := spectralTurning_normalized_uniform_slope + ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + refine ⟨φ,hφ,?_⟩ + filter_upwards [hslope (1/2) (by norm_num),hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop (max (2*B) (64/R)))] + with n hsn hdn hlarge + intro L hL U hUc hUD hUE + obtain ⟨hU0,hUn⟩ := hsn L hL U hUc hUD hUE + have hL0 : 0 < L := hR.trans_le hL.1 + change max (2*B) (64/R) ≤ r₀ (φ n) at hlarge + have hRh : L ≤ r₀ (φ n)/2 := by linarith [(le_max_left (2*B) (64/R)).trans hlarge,hL.2] + have h64 : 64 ≤ r₀ (φ n)*R := by + have hh := mul_le_mul_of_nonneg_right ((le_max_right (2*B) (64/R)).trans hlarge) hR.le + rwa [div_mul_cancel₀ _ hR.ne'] at hh + have h64L : 64 ≤ r₀ (φ n)*L := h64.trans (mul_le_mul_of_nonneg_left hL.1 hdn.1.le) + apply spectralTurning_inner_robin_coercive h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) (r₀ (φ n)) L (by positivity) hdn.1 hL0 hRh h64L + hdn.2.2.2.2.2.2.2.1 (U L) hU0 + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) L + let c := p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) L : ℂ)/(4*p^2) + change ‖(U L).2+c*(U L).1‖ ≤ (1/2 : ℝ)*‖p‖*‖(U L).1‖ + rw [show (U L).2+c*(U L).1 = ((U L).2/(U L).1+c)*(U L).1 by field_simp [hU0]] + rw [norm_mul] + exact mul_le_mul_of_nonneg_right hUn (norm_nonneg _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..120181cc5e83bd209ccf3e9182b1a030b7effbbf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformLimit.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningCoefficient +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit +import Mathlib.Topology.UniformSpace.UniformConvergence + +namespace OAI + +/-! Uniform convergence to the Airy coefficient on each fixed rescaled interval. +The scale limit is derived from the turning-point normalization. -/ + +open Filter Set Topology +namespace DefocusingNLS + +theorem spectralTurningCoefficient_uniform_limit + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G : ℝ) (hM : 0≤M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) xi) + (fun xi => (xi : ℂ)) atTop (Icc (-M) M) := by + have hd : Tendsto d atTop (𝓝 0) := spectralTurningScale_tendsto eta r₀ d hr₀ + (hdata.mono (fun n hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hrate : Tendsto (fun n => (17/2 : ℝ)*M^2*d n+G*(d n)^2) atTop (𝓝 0) := by + simpa only [mul_zero,zero_pow (by decide : 2≠0),add_zero] using + (hd.const_mul ((17/2 : ℝ)*M^2)).add ((hd.pow 2).const_mul G) + rw [Metric.tendstoUniformlyOn_iff] + intro eps heps + filter_upwards [hdata,hr₀.eventually (eventually_ge_atTop (max 1 (2*M))), + hd.eventually (gt_mem_nhds (by norm_num : (0 : ℝ)<1)), + hrate.eventually (gt_mem_nhds heps)] with n hn hr hd1 hsmall xi hxi + have hr1 : 1≤r₀ n := (le_max_left _ _).trans hr + have hrM : 2*M≤r₀ n := (le_max_right _ _).trans hr + have hxiM : |xi|≤M := abs_le.mpr hxi + have hdM : d n*M≤r₀ n/2 := by nlinarith + have hb := spectralTurningCoefficient_bound h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) M xi + hn.1 hn.2.1 hn.2.2.1 hM hxiM hdM hn.2.2.2.2.1 hn.2.2.2.2.2 + have hA : 0≤(17/2 : ℝ)*M^2*d n := + mul_nonneg (mul_nonneg (by norm_num) (sq_nonneg M)) hn.2.1 + have hdiv : (17/2 : ℝ)*M^2*d n/r₀ n≤(17/2 : ℝ)*M^2*d n := + (div_le_iff₀ hn.1).mpr (by nlinarith) + have hg := mul_le_mul_of_nonneg_right hn.2.2.2.1 (sq_nonneg (d n)) + rw [dist_comm,dist_eq_norm] + exact (hb.trans (add_le_add hdiv hg)).trans_lt hsmall + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSlope.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSlope.lean new file mode 100644 index 0000000000000000000000000000000000000000..af9889d88da176923a8227088c913616bb8dd173 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSlope.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformCone +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarTerminalUniqueness + +namespace OAI + +/-! The turning-channel logarithmic derivative estimate applies to every +comparison solution with the normalized outgoing terminal data. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_normalized_uniform_slope + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∀ eps : ℝ, 0 < eps → ∀ᶠ n in atTop, + ∀ L ∈ Icc R B, ∀ U : ℝ → ℂ × ℂ, ContinuousOn U (Icc L (E (φ n))) → + (∀ r ∈ Icc L (E (φ n)), HasDerivAt U (spectralScalarField + ((homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) + (U r)) r) → + U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) → + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) L + (U L).1 ≠ 0 ∧ + ‖(U L).2/(U L).1+(p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) L : ℂ)/(4*p^2))‖ ≤ + eps*‖p‖ := by + obtain ⟨q,φ,hφ,hq,hcone⟩ := spectralTurning_outgoing_uniform_relative_bounds + ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + refine ⟨φ,hφ,?_⟩ + intro eps heps + obtain ⟨M,_hM,hc⟩ := hcone eps heps + filter_upwards [hc,hφ.tendsto_atTop.eventually hq, + hφ.tendsto_atTop.eventually hdata, + (hr₀.comp hφ.tendsto_atTop).eventually (eventually_ge_atTop B)] with n hcn hqn hdn hlarge + intro L hL U hUc hUD hUE + have hcn := (hcn L hL).1 + change B ≤ r₀ (φ n) at hlarge + have hL0 : 0 < L := hR.trans_le hL.1 + have hRE : L ≤ E (φ n) := by linarith [hdn.1,hdn.2.2.2.2.2.1,hL.2] + let V := fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ) + have hV : ContinuousOn V (Icc L (E (φ n))) := + (Complex.continuous_ofReal.comp_continuousOn (fun r hr => + (homogeneousSpectralLocalizationFrequency_hasDerivAt h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r + (hL0.trans_le hr.1)).continuousAt.continuousWithinAt)).add continuousOn_const + have heq : q (φ n) L = U L := spectralScalar_unique_left L (E (φ n)) hRE V hV + (q (φ n)) U hqn.1.continuousOn hUc + (fun r hr => hqn.2.2.2 r ⟨hL.1.trans hr.1.le,hr.2.le⟩) + (fun r hr => hUD r ⟨hr.1.le,hr.2.le⟩) (hqn.2.1.trans hUE.symm) + dsimp only at hcn ⊢ + rw [heq] at hcn + refine ⟨hcn.1,?_⟩ + let p := spectralLiouvilleMomentum (-1) h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) L + let c := p-(spectralLiouvilleSlope ((ell (φ n) : ℝ)*(ell (φ n)+10)) L : ℂ)/(4*p^2) + change ‖(U L).2/(U L).1+c‖ ≤ eps*‖p‖ + rw [show (U L).2/(U L).1+c = ((U L).2+c*(U L).1)/(U L).1 by + field_simp [hcn.1]] + rw [norm_div] + exact (div_le_iff₀ (norm_pos_iff.mpr hcn.1)).mpr hcn.2 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSystems.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSystems.lean new file mode 100644 index 0000000000000000000000000000000000000000..10ee02b0e1ef2b135649048f7a9ed6d6fbc5c5d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningUniformSystems.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformInward +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningOuterWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaleLimit + +namespace OAI + +/-! The actual normalized turning comparison has an inward boundary slope +in the same regularized norm used by the coupled Green estimate. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_uniform_inward_systems + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ b n ∧ b n ≤ 1 ∧ + |gamma n| ≤ 8 ∧ 2*r₀ n ≤ E n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n) ∧ + homogeneousSpectralLocalizationFrequency h (b n) + ((ell n : ℝ)*(ell n+10)) (omega n) (r₀ n) = 0 ∧ + spectralLiouvilleSlope ((ell n : ℝ)*(ell n+10)) (r₀ n)*(d n)^3 = 1) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + ∃ S : SpectralScalarBoundarySystem L (E (φ n)) K, + S.k = spectralTurningRegularizedWeight h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (gamma (φ n)) (d (φ n)) ∧ + S.V = (fun r => (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) r : ℂ)+Complex.I*(gamma (φ n) : ℂ)) ∧ + S.beta = (h : ℂ)*Complex.I*(Real.sqrt (homogeneousSpectralLocalizationFrequency h + (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))) : ℂ) ∧ + (∀ z : ℂ, ∀ r ∈ Icc L (E (φ n)), + spectralShellNorm (S.k r) (S.extension z r) ≤ J*S.k L*‖z‖) ∧ + ((S.U L).2/(S.U L).1).re ≤ -(1/24 : ℝ)*(S.k L)^2 ∧ + S.U (E (φ n)) = spectralOscillatoryData h (Real.sqrt (Real.sqrt + (homogeneousSpectralLocalizationFrequency h (b (φ n)) + ((ell (φ n) : ℝ)*(ell (φ n)+10)) (omega (φ n)) (E (φ n))))) := by + have hddata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ + 0 ≤ (ell n : ℝ)*(ell n+10) ∧ |gamma n| ≤ 8 ∧ + homogeneousSpectralLocalizationFrequency h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (r₀ n) = 0 ∧ + (r₀ n/8+2*((ell n : ℝ)*(ell n+10)+99/4)/(r₀ n)^3)*(d n)^3 = 1 := by + filter_upwards [hdata] with n hn + exact ⟨hn.1,hn.2.1,by positivity,hn.2.2.2.2.1,hn.2.2.2.2.2.2.2.1,hn.2.2.2.2.2.2.2.2⟩ + have hd0 := spectralTurningScale_tendsto (fun n => (ell n : ℝ)*(ell n+10)) r₀ d hr₀ + (hddata.mono (fun _ hn => ⟨hn.1,hn.2.1,hn.2.2.1,hn.2.2.2.2.2⟩)) + have hout := spectralTurning_regularized_outer_weights h b + (fun n => (ell n : ℝ)*(ell n+10)) omega gamma r₀ d 2 8 (by norm_num) hr₀ hddata + have hinner : ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + (spectralTurningRegularizedWeight h (b n) ((ell n : ℝ)*(ell n+10)) + (omega n) (gamma n) (d n) L)^2 = + ‖spectralLiouvilleMomentum (-1) h (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (gamma n) L‖ := by + filter_upwards [hout,hr₀.eventually (eventually_ge_atTop (B+2)), + hd0.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1))] with n hn hr hd + intro L hL + rw [hn.1 L (hR.trans_le hL.1) (by linarith [hL.2]),Real.sq_sqrt (norm_nonneg _)] + obtain ⟨φ,hφ,hin⟩ := spectralTurning_normalized_uniform_inward ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + obtain ⟨ψ,K,J,hψ,hK,hJ,hsys⟩ := spectralTurning_uniform_boundary_systems + (ell ∘ φ) h (b ∘ φ) (omega ∘ φ) (gamma ∘ φ) (r₀ ∘ φ) (d ∘ φ) (E ∘ φ) R B hh hR hRB + (hr₀.comp hφ.tendsto_atTop) (hφ.tendsto_atTop.eventually hdata) + refine ⟨φ ∘ ψ,K,J,hφ.comp hψ,hK,hJ,?_⟩ + filter_upwards [hsys,hψ.tendsto_atTop.eventually hin, + (hφ.comp hψ).tendsto_atTop.eventually hinner] with n hsn hinn hkn + intro L hL + obtain ⟨S,hk,hV,hbeta,hUE,hext⟩ := hsn L hL + have hkn := hkn L hL + refine ⟨S,hk,hV,hbeta,hext,?_,hUE⟩ + have hi := hinn L hL S.U S.continuous_U (by simpa only [hV,Function.comp_def] using S.ode_U) hUE + rw [hk] + simp only [Function.comp_def] at hkn ⊢ + rw [hkn] + exact hi + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightEscape.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightEscape.lean new file mode 100644 index 0000000000000000000000000000000000000000..35877e18f74e7a6244f0be3aa396a559539827d8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightEscape.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningRegularizedWeight +import Mathlib.Topology.Algebra.Order.Field + +namespace OAI + +/-! The regularized weight has a spatially uniform lower bound tending to +infinity, even at the moving turning point. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_weight_floor_tendsto (d : ℕ → ℝ) + (hd : Tendsto d atTop (𝓝 0)) (hdpos : ∀ᶠ n in atTop, 0 < d n) : + Tendsto (fun n => (Real.sqrt (d n))⁻¹) atTop atTop := by + have hs : Tendsto (fun n => Real.sqrt (d n)) atTop (𝓝 0) := by + simpa only [Function.comp_def,Real.sqrt_zero] using Real.continuous_sqrt.continuousAt.tendsto.comp hd + apply tendsto_inv_nhdsGT_zero.comp + exact tendsto_nhdsWithin_iff.mpr ⟨hs,hdpos.mono (fun n hn => Real.sqrt_pos.mpr hn)⟩ + +theorem spectralTurning_weight_floor (h b eta omega gamma d r : ℝ) : + (Real.sqrt d)⁻¹ ≤ spectralTurningRegularizedWeight h b eta omega gamma d r := + le_max_left _ _ + +theorem spectralTurning_green_coefficient_tendsto (d : ℕ → ℝ) + (hd : Tendsto d atTop (𝓝 0)) (hdpos : ∀ᶠ n in atTop, 0 < d n) + (A C R : ℝ) (_hR : 0 < R) : + Tendsto (fun n => A*C/(((Real.sqrt (d n))⁻¹)^2*R)) atTop (𝓝 0) := by + have he : ∀ᶠ n in atTop, + A*C/(((Real.sqrt (d n))⁻¹)^2*R) = (A*C/R)*d n := by + filter_upwards [hdpos] with n hn + rw [inv_pow,Real.sq_sqrt hn.le] + field_simp + apply Tendsto.congr' (he.mono (fun _ hn => hn.symm)) + simpa only [mul_zero] using hd.const_mul (A*C/R) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7c0dc3c3c4f9fee9c9c9ccf32b08036ef547d41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralTurningWeightLimit.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningScaledNorm +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformLimit + +namespace OAI + +/-! The physical WKB weight becomes the fixed Airy weight after rescaling. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_weight_tendsto + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (M G : ℝ) (hM : 0 ≤ M) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + Tendsto (fun n => Real.sqrt (d n) * Real.sqrt ‖spectralLiouvilleMomentum 1 h + (b n) (eta n) (omega n) (gamma n) (r₀ n+d n*M)‖) + atTop (𝓝 (Real.sqrt (Real.sqrt M))) := by + have hu := (spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d M G hM + hr₀ hdata).tendsto_at (show M ∈ Icc (-M) M from ⟨by linarith,le_rfl⟩) + have hk := (Real.continuous_sqrt.tendsto _).comp + ((Real.continuous_sqrt.tendsto _).comp hu.norm) + have hk' : Tendsto (fun n => Real.sqrt (Real.sqrt + ‖spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) M‖)) + atTop (𝓝 (Real.sqrt (Real.sqrt M))) := by + simpa only [Function.comp_def,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hM] using hk + apply hk'.congr' + filter_upwards [hdata] with n hn + exact (spectralTurning_scaled_weight h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) M hn.2.1).symm + + +theorem spectralTurning_weight_tendsto_at + (h : ℝ) (b eta omega gamma r₀ d : ℕ → ℝ) (xi G : ℝ) + (hr₀ : Tendsto r₀ atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 < r₀ n ∧ 0 ≤ d n ∧ 0 ≤ eta n ∧ |gamma n| ≤ G ∧ + homogeneousSpectralLocalizationFrequency h (b n) (eta n) (omega n) (r₀ n) = 0 ∧ + (r₀ n/8 + 2*(eta n+99/4)/(r₀ n)^3)*(d n)^3 = 1) : + Tendsto (fun n => Real.sqrt (d n) * Real.sqrt ‖spectralLiouvilleMomentum 1 h + (b n) (eta n) (omega n) (gamma n) (r₀ n+d n*xi)‖) + atTop (𝓝 (Real.sqrt (Real.sqrt |xi|))) := by + have hu := (spectralTurningCoefficient_uniform_limit h b eta omega gamma r₀ d |xi| G + (abs_nonneg xi) hr₀ hdata).tendsto_at + (show xi ∈ Icc (-|xi|) |xi| from ⟨neg_abs_le xi,le_abs_self xi⟩) + have hk := (Real.continuous_sqrt.tendsto _).comp + ((Real.continuous_sqrt.tendsto _).comp hu.norm) + have hk' : Tendsto (fun n => Real.sqrt (Real.sqrt + ‖spectralTurningCoefficient h (b n) (eta n) (omega n) (gamma n) (r₀ n) (d n) xi‖)) + atTop (𝓝 (Real.sqrt (Real.sqrt |xi|))) := by + simpa only [Function.comp_def,Complex.norm_real,Real.norm_eq_abs] using hk + apply hk'.congr' + filter_upwards [hdata] with n hn + exact (spectralTurning_scaled_weight h (b n) (eta n) (omega n) (gamma n) + (r₀ n) (d n) xi hn.2.1).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformComparisons.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformComparisons.lean new file mode 100644 index 0000000000000000000000000000000000000000..1902d1c7dc5c3de5730ae599fd635759bf142c97 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformComparisons.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningUniformSystems +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNoTurnUniformBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNoTurnUniformSlope +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTurningComparison +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralNoTurnComparison + +namespace OAI + +/-! The actual scalar comparisons have common constants for every inner +endpoint in a fixed shell. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralTurning_uniform_comparisons + (ell : ℕ → ℕ) (h : ℝ) (b omega gamma r₀ d E : ℕ → ℝ) (R B : ℝ) + (hh : h^2 = 1) (hR : 0 < R) (hRB : R ≤ B) (hr₀ : Tendsto r₀ atTop atTop) + (hdata : SpectralTurningFamilyData ell h b omega gamma r₀ d E) : + ∃ (φ : ℕ → ℕ) (K J : ℝ), StrictMono φ ∧ 0 ≤ K ∧ 0 ≤ J ∧ + ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + ∃ S : SpectralScalarBoundarySystem L (E (φ n)) K, + SpectralTurningComparison S J h (b (φ n)) ((ell (φ n) : ℝ)*(ell (φ n)+10)) + (omega (φ n)) (gamma (φ n)) (d (φ n)) := + spectralTurning_uniform_inward_systems ell h b omega gamma r₀ d E R B hh hR hRB hr₀ hdata + +theorem spectralNoTurn_uniform_comparisons + (ell : ℕ → ℕ) (b omega gamma E : ℕ → ℝ) (C R B : ℝ) + (hC : 0 ≤ C) (hR : 0 < R) (hRB : R ≤ B) (hCR : 2*C ≤ R^2) + (hw : Tendsto omega atTop atTop) + (hdata : ∀ᶠ n in atTop, 0 ≤ b n ∧ |gamma n| ≤ 8 ∧ 0 < E n ∧ + (ell n : ℝ)*(ell n+10)+99/4 ≤ C*omega n ∧ + (E n)^2 = 256*max ((ell n : ℝ)+1) (omega n)) : + ∃ (K J : ℝ) (eps : ℕ → ℝ), 0 ≤ K ∧ 0 ≤ J ∧ + (∀ n, 0 ≤ eps n) ∧ Tendsto eps atTop (𝓝 0) ∧ ∀ᶠ n in atTop, ∀ L ∈ Icc R B, + ∃ S : SpectralScalarBoundarySystem L (E n) K, + SpectralNoTurnComparison S J (eps n) (b n) ((ell n : ℝ)*(ell n+10)) (omega n) (gamma n) := by + obtain ⟨K,J,hK,hJ,hsys⟩ := spectralNoTurn_uniform_boundary_systems + ell b omega gamma E C R B hC hR hRB hCR hw hdata + have hslope := spectralNoTurn_eventual_uniform_slope ell b omega gamma E C R B hC hR hRB hCR hw hdata + have hE := (spectralNoTurn_eventual_data ell b omega gamma E C R hC hR hw hdata).1 + let eps := fun n => max 0 (spectralNoTurnRealError C R (omega n) (E n)) + have heps : Tendsto eps atTop (𝓝 0) := by + have hzero : Tendsto (fun _ : ℕ => (0 : ℝ)) atTop (𝓝 0) := tendsto_const_nhds + have ht := hzero.max (spectralNoTurn_real_error_tendsto omega E C R hw hE) + simpa only [max_self] using ht + refine ⟨K,J,eps,hK,hJ,fun _ => le_max_left _ _,heps,?_⟩ + filter_upwards [hsys,hslope] with n hn hsn + intro L hL + obtain ⟨S,hk,hV,hbeta,hUE,hext⟩ := hn L hL + refine ⟨S,hk,hV,hbeta,hext,?_⟩ + have hh := hsn L hL S.U S.continuous_U hUE (fun t ht => by + simpa only [hV] using S.ode_U t ⟨ht.1.le,ht.2.le⟩) + exact hh.2.trans (le_max_right _ _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformError.lean new file mode 100644 index 0000000000000000000000000000000000000000..311484386ea28d4f63c9eedaadaf34c5d10ca5f2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformError.lean @@ -0,0 +1,42 @@ +import Mathlib.Topology.UniformSpace.UniformConvergence +import Mathlib.Analysis.Normed.Field.Basic + +namespace OAI + +/-! A scalar error sequence for uniformly converging bounded coefficients. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralUniform_error_bound {s : Set ℝ} (f : ℕ → ℝ → ℝ) (g : ℝ → ℝ) + (hf : TendstoUniformlyOn f g atTop s) + (hb : ∀ n, ∃ B : ℝ, ∀ r ∈ s, ‖f n r-g r‖ ≤ B) : + ∃ δ : ℕ → ℝ, (∀ n, 0 ≤ δ n) ∧ Tendsto δ atTop (𝓝 0) ∧ + ∀ n r, r ∈ s → ‖f n r-g r‖ ≤ δ n := by + let A := fun n => insert (0 : ℝ) ((fun r => ‖f n r-g r‖) '' s) + have hne (n : ℕ) : (A n).Nonempty := ⟨0,mem_insert _ _⟩ + have hbd (n : ℕ) : BddAbove (A n) := by + obtain ⟨B,hB⟩ := hb n + refine ⟨max 0 B,?_⟩ + rintro y (rfl | ⟨r,hr,rfl⟩) + · exact le_max_left _ _ + · exact (hB r hr).trans (le_max_right _ _) + let δ := fun n => sSup (A n) + have hδ (n : ℕ) : 0 ≤ δ n := le_csSup (hbd n) (mem_insert _ _) + refine ⟨δ,hδ,?_,fun n r hr => le_csSup (hbd n) (mem_insert_of_mem _ ⟨r,hr,rfl⟩)⟩ + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [(Metric.tendstoUniformlyOn_iff.mp hf) (ε/2) (half_pos hε)] with n hn + have he : δ n ≤ ε/2 := by + apply csSup_le (hne n) + rintro y (rfl | ⟨r,hr,rfl⟩) + · exact (half_pos hε).le + · have hh : ‖f n r-g r‖ < ε/2 := by + simpa only [dist_eq_norm,norm_sub_rev] using hn r hr + exact hh.le + simpa only [dist_zero_right,Real.norm_eq_abs,abs_of_nonneg (hδ n)] using + he.trans_lt (half_lt_self hε) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformWeightBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformWeightBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e3edd2ac849c1ca01185b4a88506d0e281d1828 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUniformWeightBounds.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralContinuousWeight +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralUniformError + +namespace OAI + +/-! A positive limiting density supplies uniform coercivity of its nearby weights. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralUniform_positive_bounds (R : ℝ) (q : ℕ → ℝ → ℝ) (q₀ : ℝ → ℝ) + (hq₀ : ContinuousOn q₀ (Icc 0 R)) (hp : ∀ r ∈ Icc 0 R, 0 < q₀ r) + (hlim : TendstoUniformlyOn q q₀ atTop (Icc 0 R)) : + ∃ c M : ℝ, 0 < c ∧ 0 ≤ M ∧ + (∀ r ∈ Icc 0 R, c ≤ q₀ r ∧ ‖q₀ r‖ ≤ M) ∧ + ∀ᶠ n in atTop, ∀ r ∈ Icc 0 R, c ≤ q n r ∧ ‖q n r‖ ≤ M := by + obtain ⟨c,hc,hc₀⟩ := isCompact_Icc.exists_forall_le' hq₀ hp + obtain ⟨B,hB⟩ := isCompact_Icc.bddAbove_image hq₀.norm + let M := max 0 B+1 + have hM : 0 ≤ M := by dsimp [M]; positivity + have hbn (r : ℝ) (hr : r ∈ Icc 0 R) : ‖q₀ r‖ ≤ B := hB ⟨r,hr,rfl⟩ + refine ⟨c/2,M,half_pos hc,hM,?_,?_⟩ + · intro r hr + exact ⟨(half_le_self hc.le).trans (hc₀ r hr), + (hbn r hr).trans (by dsimp [M]; linarith [le_max_right (0 : ℝ) B])⟩ + · have he := (Metric.tendstoUniformlyOn_iff.mp hlim) (min (c/2) 1) + (lt_min (half_pos hc) zero_lt_one) + filter_upwards [he] with n hn r hr + have hd : ‖q n r-q₀ r‖ < min (c/2) 1 := by + simpa only [dist_eq_norm,norm_sub_rev] using hn r hr + constructor + · have hx := (le_abs_self (q₀ r-q n r)).trans (le_of_lt (by + simpa only [Real.norm_eq_abs,abs_sub_comm] using hd)) + have hy := hc₀ r hr + have hz := min_le_left (c/2) (1 : ℝ) + linarith + · have ht := norm_le_norm_sub_add (q n r) (q₀ r) + have hz := min_le_right (c/2) (1 : ℝ) + have hb := hbn r hr + dsimp only [M] + linarith [le_max_right (0 : ℝ) B] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUnitTest.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUnitTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..61c953a856200375b6b9905ec91507bcd2d3a084 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralUnitTest.lean @@ -0,0 +1,29 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralTestPrimitive +import Mathlib.Analysis.Calculus.BumpFunction.Normed + +namespace OAI + +/-! A unit-integral smooth test strictly inside each nonempty radial interval. -/ + +open Set MeasureTheory +open scoped ContDiff +namespace DefocusingNLS + +theorem spectralUnitTest (a b : ℝ) (hab : a < b) : + ∃ β : ℝ → ℝ, ContDiff ℝ ∞ β ∧ HasCompactSupport β ∧ + tsupport β ⊆ Ioo a b ∧ ∫ x, β x = 1 := by + let f : ContDiffBump ((a+b)/2) := + { rIn := (b-a)/8 + rOut := (b-a)/4 + rIn_pos := by linarith + rIn_lt_rOut := by linarith } + refine ⟨f.normed volume,f.contDiff_normed,f.hasCompactSupport_normed,?_,f.integral_normed⟩ + rw [f.tsupport_normed_eq] + intro x hx + have hx' : |x-(a+b)/2| ≤ (b-a)/4 := by + simpa only [Metric.mem_closedBall,Real.dist_eq,f] using hx + constructor <;> linarith [(abs_le.mp hx').1,(abs_le.mp hx').2] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBAmplitude.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..6661a8859e437e28bafd741151ff99d621b35189 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBAmplitude.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFrame +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! Construct the WKB amplitude by an actual scalar integral. Its normalization +is propagated by differentiation; no choice of a logarithm branch is needed. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +noncomputable def spectralWKBAmplitude (R : ℝ) (a₀ : ℂ) (p v : ℝ → ℂ) (r : ℝ) : ℂ := + a₀*Complex.exp (∫ t in R..r, -(v t/(2*p t))) + +theorem spectralShellPrimitive_hasDerivAt (R E : ℝ) (f : ℝ → ℂ) + (hf : ContinuousOn f (Icc R E)) (r : ℝ) (hr : r ∈ Ioo R E) : + HasDerivAt (fun s => ∫ t in R..s, f t) (f r) r := by + have hi : IntervalIntegrable f volume R r := ContinuousOn.intervalIntegrable_of_Icc hr.1.le + (hf.mono (Icc_subset_Icc le_rfl hr.2.le)) + have hc : ContinuousAt f r := hf.continuousAt (Icc_mem_nhds hr.1 hr.2) + have hm : StronglyMeasurableAtFilter f (nhds r) volume := + ContinuousOn.stronglyMeasurableAtFilter isOpen_Ioo (hf.mono Ioo_subset_Icc_self) r hr + exact intervalIntegral.integral_hasDerivAt_right hi hm hc + +theorem spectralWKBAmplitude_initial (R : ℝ) (a₀ : ℂ) (p v : ℝ → ℂ) : + spectralWKBAmplitude R a₀ p v R=a₀ := by + simp only [spectralWKBAmplitude,intervalIntegral.integral_same,Complex.exp_zero,mul_one] + +theorem spectralWKBAmplitude_continuousOn (R E : ℝ) (hRE : R≤ E) + (a₀ : ℂ) (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hv : ContinuousOn v (Icc R E)) (hp0 : ∀ r ∈ Icc R E, p r≠0) : + ContinuousOn (spectralWKBAmplitude R a₀ p v) (Icc R E) := by + have hq : ContinuousOn (fun t => -(v t/(2*p t))) (Icc R E) := + (hv.div (continuousOn_const.mul hp) (fun t ht => mul_ne_zero (by norm_num) (hp0 t ht))).neg + have hi : IntervalIntegrable (fun t => -(v t/(2*p t))) volume R E := + ContinuousOn.intervalIntegrable_of_Icc hRE hq + have hc := intervalIntegral.continuousOn_primitive_interval' hi (show R ∈ uIcc R E from left_mem_uIcc) + rw [uIcc_of_le hRE] at hc + exact continuousOn_const.mul (Complex.continuous_exp.comp_continuousOn hc) + +theorem spectralWKBAmplitude_hasDerivAt (R E : ℝ) + (a₀ : ℂ) (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hv : ContinuousOn v (Icc R E)) (hp0 : ∀ r ∈ Icc R E, p r≠0) + (r : ℝ) (hr : r ∈ Ioo R E) : + HasDerivAt (spectralWKBAmplitude R a₀ p v) + (-(v r/(2*p r))*spectralWKBAmplitude R a₀ p v r) r := by + have hq : ContinuousOn (fun t => -(v t/(2*p t))) (Icc R E) := + (hv.div (continuousOn_const.mul hp) (fun t ht => mul_ne_zero (by norm_num) (hp0 t ht))).neg + have hd := (spectralShellPrimitive_hasDerivAt R E _ hq r hr).cexp.const_mul a₀ + apply hd.congr_deriv + dsimp only [spectralWKBAmplitude] + ring + +theorem spectralWKBAmplitude_normalization (R E : ℝ) (hRE : R≤ E) + (a₀ : ℂ) (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hv : ContinuousOn v (Icc R E)) (hp0 : ∀ r ∈ Icc R E, p r≠0) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) (ha₀ : p R*a₀^2=1) + (r : ℝ) (hr : r ∈ Icc R E) : + p r*(spectralWKBAmplitude R a₀ p v r)^2=1 := by + have hac := spectralWKBAmplitude_continuousOn R E hRE a₀ p v hp hv hp0 + have hprod : ContinuousOn (fun t => p t*(spectralWKBAmplitude R a₀ p v t)^2) (Icc R E) := hp.mul (hac.pow 2) + have hd (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt (fun s => p s*(spectralWKBAmplitude R a₀ p v s)^2) 0 t := by + apply ((hpD t ht).mul ((spectralWKBAmplitude_hasDerivAt R E a₀ p v hp hv hp0 t ht).pow 2)).congr_deriv + simp only [Pi.pow_apply] + field_simp [hp0 t ⟨ht.1.le,ht.2.le⟩] + ring + have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hr.1 + (hprod.mono (Icc_subset_Icc le_rfl hr.2)) + (fun t ht => hd t ⟨ht.1,ht.2.trans_le hr.2⟩) + (continuous_const.intervalIntegrable R r) + rw [intervalIntegral.integral_zero,spectralWKBAmplitude_initial,ha₀] at hi + exact sub_eq_zero.mp hi.symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBBranchAmplitude.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBBranchAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..3610b7a7673f4b334474f99bf4180176cb04cebb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBBranchAmplitude.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFrameValue + +namespace OAI + +/-! The coefficient selected by the terminal first coordinate stays away +from zero under a bounded oscillatory action. -/ + +open Set +namespace DefocusingNLS + +theorem spectralWKB_branch_amplitude + (R E B kR kE : ℝ) (hRE : R ≤ E) (chi : ℂ) (hchi : ‖chi‖ = 1) + (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hp0 : ∀ t ∈ Icc R E, p t ≠ 0) + (hpD : ∀ t ∈ Ioo R E, HasDerivAt p (v t) t) + (hkR : 0 < kR) (hkE : 0 < kE) (hkRp : kR^2 = ‖p R‖) (hkEp : kE^2 = ‖p E‖) + (hsmall : ‖v R‖ ≤ ‖p R‖^2) + (hphase : |(spectralWKBPhase R chi p E).re| ≤ B) + (x : ℂ) (hxlo : 1 ≤ kE*‖x‖) (hxhi : kE*‖x‖ ≤ 2) : + let z := x/(spectralWKBFrame R chi p v E).1 + Real.exp (-B) ≤ ‖z‖ ∧ ‖z‖ ≤ 2*Real.exp B ∧ + spectralShellNorm kR (z • spectralWKBFrame R chi p v R) ≤ 5*Real.exp B := by + dsimp only + have hvE := spectralWKBFrame_value_norm R E hRE chi p v hp hv hp0 hpD kE E hkE hkEp ⟨hRE,le_rfl⟩ + obtain ⟨hzlo,hzhi⟩ := spectralFrame_amplitude_bounds kE (spectralWKBPhase R chi p E).re B x + (spectralWKBFrame R chi p v E).1 hkE hvE hphase hxlo hxhi + refine ⟨hzlo,hzhi,?_⟩ + have hDr : spectralShellNorm kR (spectralWKBFrame R chi p v R) ≤ 5/2 := by + rw [spectralWKBFrame_initial] + simpa only [Complex.zero_re,Real.exp_zero,mul_one] using + spectralWKBState_shell_bound chi (p R) (v R) (spectralWKBInitialAmplitude (p R)) 0 + kR hkR hkRp (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) + hchi.le hsmall + rw [spectralShellNorm_smul] + calc + _ ≤ (2*Real.exp B)*(5/2) := mul_le_mul hzhi hDr + (spectralShellNorm_nonneg kR hkR.le _) (by positivity) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBConstruction.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..f171fcc844d889cdf39c06e88b34cb716580d435 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBConstruction.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBAmplitude +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSquareRoot + +namespace OAI + +/-! The scalar WKB frame is constructed from integrals, including its +normalization. Its constant Wronskian and differential equation are derived. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +noncomputable def spectralWKBInitialAmplitude (z : ℂ) : ℂ := (Complex.sqrt z)⁻¹ + +noncomputable def spectralWKBPhase (R : ℝ) (chi : ℂ) (p : ℝ → ℂ) (r : ℝ) : ℂ := + chi*(∫ t in R..r, p t) + +noncomputable def spectralWKBFrame (R : ℝ) (chi : ℂ) (p v : ℝ → ℂ) (r : ℝ) : ℂ × ℂ := + spectralWKBState chi (p r) (v r) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v r) + (spectralWKBPhase R chi p r) + +theorem spectralWKBInitialAmplitude_normalization (z : ℂ) (hz : z≠0) : + z*(spectralWKBInitialAmplitude z)^2=1 := by + have hs := spectralComplexSqrt_ne_zero z hz + have he := spectralComplexSqrt_sq z + dsimp only [spectralWKBInitialAmplitude] + field_simp + exact he.symm + +theorem spectralWKBPhase_continuousOn (R E : ℝ) (hRE : R≤ E) (chi : ℂ) + (p : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) : + ContinuousOn (spectralWKBPhase R chi p) (Icc R E) := by + have hi : IntervalIntegrable p volume R E := ContinuousOn.intervalIntegrable_of_Icc hRE hp + have hc := intervalIntegral.continuousOn_primitive_interval' hi (show R ∈ uIcc R E from left_mem_uIcc) + rw [uIcc_of_le hRE] at hc + exact continuousOn_const.mul hc + +theorem spectralWKBPhase_hasDerivAt (R E : ℝ) (chi : ℂ) + (p : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) (r : ℝ) (hr : r ∈ Ioo R E) : + HasDerivAt (spectralWKBPhase R chi p) (chi*p r) r := + (spectralShellPrimitive_hasDerivAt R E p hp r hr).const_mul chi + +theorem spectralWKBFrame_continuousOn (R E : ℝ) (hRE : R≤ E) (chi : ℂ) + (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hv : ContinuousOn v (Icc R E)) (hp0 : ∀ r ∈ Icc R E, p r≠0) : + ContinuousOn (spectralWKBFrame R chi p v) (Icc R E) := by + have ha := spectralWKBAmplitude_continuousOn R E hRE + (spectralWKBInitialAmplitude (p R)) p v hp hv hp0 + have hS := spectralWKBPhase_continuousOn R E hRE chi p hp + have hL : ContinuousOn (fun r => homogeneousSpectralWKBLog chi (p r) (v r)) (Icc R E) := + (continuousOn_const.mul hp).sub (hv.div (continuousOn_const.mul hp) + (fun r hr => mul_ne_zero (by norm_num) (hp0 r hr))) + have hz := ha.mul (Complex.continuous_exp.comp_continuousOn hS) + exact hz.prodMk (hL.mul hz) + +theorem spectralWKBFrame_wronskian (R E : ℝ) (hRE : R≤ E) (chi : ℂ) + (p v : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hv : ContinuousOn v (Icc R E)) (hp0 : ∀ r ∈ Icc R E, p r≠0) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (r : ℝ) (hr : r ∈ Icc R E) : + spectralScalarWronskian (spectralWKBFrame R chi p v r) + (spectralWKBFrame R (-chi) p v r)= -2*chi := by + have ha := spectralWKBAmplitude_normalization R E hRE + (spectralWKBInitialAmplitude (p R)) p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) r hr + have hS : spectralWKBPhase R (-chi) p r= -spectralWKBPhase R chi p r := neg_mul _ _ + dsimp only [spectralWKBFrame] + rw [hS] + exact spectralWKBState_wronskian _ _ _ _ _ ha + +theorem spectralWKBFrame_hasDerivAt (R E : ℝ) (chi : ℂ) (p v : ℝ → ℂ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hp0 : ∀ r ∈ Icc R E, p r≠0) (w : ℂ) (r : ℝ) (hr : r ∈ Ioo R E) + (hpD : HasDerivAt p (v r) r) (hvD : HasDerivAt v w r) : + HasDerivAt (spectralWKBFrame R chi p v) + (spectralScalarField (-(chi^2*(p r)^2+homogeneousSpectralWKBResidual (p r) (v r) w)) + (spectralWKBFrame R chi p v r)) r := by + have hd := spectralWKBState_hasDerivAt chi p v + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v) + (spectralWKBPhase R chi p) w r (hp0 r ⟨hr.1.le,hr.2.le⟩) + hpD hvD (spectralWKBAmplitude_hasDerivAt R E _ p v hp hv hp0 r hr) + (spectralWKBPhase_hasDerivAt R E chi p hp r hr) + apply hd.congr_deriv + simp only [spectralScalarField,spectralWKBFrame,neg_neg] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBDecreasingIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBDecreasingIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..73029ab521db22ef5bde99c92cb2124155be3992 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBDecreasingIntegral.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBResidualIntegral + +namespace OAI + +/-! Reflection gives the endpoint form for decreasing momentum, as used on + the forbidden side of a turning point. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_decreasing_residual_integral (a b A B : ℝ) (hab : a≤b) + (hA : 0≤A) (hB : 0≤B) (p g e : ℝ → ℝ) + (hp : ContinuousOn p (Icc a b)) (hg : ContinuousOn g (Icc a b)) + (he : ContinuousOn e (Icc a b)) (hp0 : ∀ t ∈ Icc a b, 0

a+b-t + have hR : ContinuousOn R (Icc a b) := (continuous_const.sub continuous_id).continuousOn + have hmaps : MapsTo R (Icc a b) (Icc a b) := by + intro t ht + dsimp only [R] + constructor <;> linarith [ht.1,ht.2] + have hmapsO (t : ℝ) (ht : t ∈ Ioo a b) : R t ∈ Ioo a b := by + dsimp only [R] + constructor <;> linarith [ht.1,ht.2] + have hD' (t : ℝ) (ht : t ∈ Ioo a b) : + HasDerivAt (fun t => p (R t)) (g (R t)/(2*p (R t))) t := by + have hh := (hD (R t) (hmapsO t ht)).comp t ((hasDerivAt_id t).const_sub (a+b)) + apply hh.congr_deriv + ring + have hb := spectralWKB_residual_integral a b A B hab hA hB + (fun t => p (R t)) (fun t => g (R t)) (fun t => e (R t)) + (hp.comp hR hmaps) (hg.comp hR hmaps) (he.comp hR hmaps) + (fun t ht => hp0 (R t) (hmaps ht)) (fun t ht => hg0 (R t) (hmaps ht)) + (fun t ht => hgB (R t) (hmaps ht)) (fun t ht => heA (R t) (hmaps ht)) hD' + dsimp only [R] at hb + have hi := intervalIntegral.integral_comp_sub_left + (fun t => (5/16 : ℝ)*(g t)^2/(p t)^5+|e t|/(4*(p t)^3)) (a+b) (a := a) (b := b) + rw [hi] at hb + simpa only [add_sub_cancel_right,add_sub_cancel_left] using hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFarBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFarBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..42020c2991ba5a6bd63223a05832516626a93e0f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFarBound.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBResidualIntegral + +namespace OAI + +/-! Radial symbol bounds imply an integrable inverse-cubic residual. -/ + +namespace DefocusingNLS + +theorem spectralWKB_radial_bound (r p g e : ℝ) (hr : 0 spectralWKBValue (a t) (S t)) + (homogeneousSpectralWKBLog chi (p r) (v r)*spectralWKBValue (a r) (S r)) r := by + apply (ha.mul hS.cexp).congr_deriv + dsimp only [homogeneousSpectralWKBLog,spectralWKBValue] + ring + +theorem spectralWKBState_hasDerivAt + (chi : ℂ) (p v a S : ℝ → ℂ) (w : ℂ) (r : ℝ) + (hp0 : p r≠0) (hp : HasDerivAt p (v r) r) (hv : HasDerivAt v w r) + (ha : HasDerivAt a (-(v r/(2*p r))*a r) r) + (hS : HasDerivAt S (chi*p r) r) : + HasDerivAt (fun t => spectralWKBState chi (p t) (v t) (a t) (S t)) + ((spectralWKBState chi (p r) (v r) (a r) (S r)).2, + (chi^2*(p r)^2+homogeneousSpectralWKBResidual (p r) (v r) w)* + (spectralWKBState chi (p r) (v r) (a r) (S r)).1) r := by + have hz := spectralWKBValue_hasDerivAt chi p v a S r ha hS + exact hz.prodMk (homogeneousSpectralWKB_acceleration chi p v + (fun t => spectralWKBValue (a t) (S t)) w r hp0 hp hv hz) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFrameBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFrameBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..9679ec5c666d8fb88fc0650c4794a3a57b944d05 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBFrameBound.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFrame +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralShellNorm + +namespace OAI + +/-! The normalized WKB frame is uniformly bounded in the scalar transfer norm. -/ + +namespace DefocusingNLS + +theorem spectralWKB_amplitude_norm (p a : ℂ) (k : ℝ) (hk : 0 (spectralWKBPhase R 1 p r).re) (Icc R E)) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) + (hN : 0 < spectralShellNorm (k R) (q R)) + (ha : spectralShellNorm (k R) (q R)/8 ≤ + ‖spectralScalarWronskian (q R) (spectralWKBFrame R (-1) p v R)/(-2)‖) + (hsmallError : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let H := (spectralWKBPhase R 1 p E).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ 1/64) : + (q E).1 ≠ 0 ∧ + ‖(q E).2-homogeneousSpectralWKBLog 1 (p E) (v E)*(q E).1‖ ≤ + (1/2 : ℝ)*‖p E‖*‖(q E).1‖ := by + let D := spectralWKBFrame R 1 p v + let U := spectralWKBFrame R (-1) p v + let H := (spectralWKBPhase R 1 p E).re + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let N := spectralShellNorm (k R) (q R) + let a := spectralScalarWronskian (q R) (U R)/(-2) + let b := spectralScalarWronskian (D R) (q R)/(-2) + have hRI : R ∈ Icc R E := ⟨le_rfl,hRE⟩ + have hEI : E ∈ Icc R E := ⟨hRE,le_rfl⟩ + have hpn (r : ℝ) (hr : r ∈ Icc R E) : p r ≠ 0 := by + apply norm_pos_iff.mp + rw [← hkp r hr] + exact sq_pos_of_pos (hk0 r hr) + have hDR : spectralShellNorm (k R) (D R) ≤ 5/2 := by + dsimp only [D] + rw [spectralWKBFrame_initial] + simpa only [Complex.zero_re,Real.exp_zero,mul_one] using + spectralWKBState_shell_bound 1 (p R) (v R) (spectralWKBInitialAmplitude (p R)) 0 + (k R) (hk0 R hRI) (hkp R hRI) + (spectralWKBInitialAmplitude_normalization (p R) (hpn R hRI)) (by norm_num) (hsmall R hRI) + have hUE : spectralShellNorm (k E) (U E) ≤ (5/2 : ℝ)*Real.exp (-H) := by + have hb := spectralWKBState_shell_bound (-1) (p E) (v E) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v E) + (spectralWKBPhase R (-1) p E) (k E) (hk0 E hEI) (hkp E hEI) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hpn hpD + (spectralWKBInitialAmplitude_normalization (p R) (hpn R hRI)) E hEI) + (by norm_num) (hsmall E hEI) + simpa only [U,spectralWKBFrame,spectralWKBPhase,H,neg_mul,one_mul,Complex.neg_re] using hb + have hb : ‖b‖ ≤ (5/2 : ℝ)/2*N := by + dsimp only [b] + rw [norm_div] + norm_num only [norm_neg,Complex.norm_ofNat] + apply (div_le_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + have hw := spectralScalarWronskian_shell_bound (k R) (hk0 R hRI) (D R) (q R) + nlinarith [mul_le_mul_of_nonneg_right hDR hN.le] + have herr := spectralWKB_initial_action_error R E hRE 1 (by norm_num) + p v w q k hp hv hw hq hk hk0 hkp hpD hvD hsmall hH + (fun t ht => by simpa only [one_pow,neg_one_mul] using hODE t ht) + dsimp only at herr + simp only [mul_one] at herr + have he : spectralShellNorm (k E) (q E-(a • D E+b • U E)) ≤ + ((25/4 : ℝ)*Real.exp J*J)*Real.exp H*N := by + change spectralShellNorm (k E) (q E-(a • D E+b • U E)) ≤ + ((25/4 : ℝ)*N)*Real.exp (H+J)*J at herr + rw [Real.exp_add] at herr + convert herr using 1; ring + have hclose := spectralGrowingBranch_error (k E) (5/2) H N + ((25/4 : ℝ)*Real.exp J*J) (hk0 E hEI) (by norm_num) hN.le a b (D E) (U E) (q E) hUE hb he + have hvalue := spectralWKBFrame_value_norm R E hRE 1 p v hp hv hpn hpD (k E) E + (hk0 E hEI) (hkp E hEI) hEI + have hlog := spectralWKB_log_bound 1 (p E) (v E) (hpn E hEI) (by norm_num) (hsmall E hEI) + have hc := spectralGrowingBranch_cone (k E) H N + ((25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H)) (hk0 E hEI) hN + hsmallError a (homogeneousSpectralWKBLog 1 (p E) (v E)) (D E) (q E) + (by rfl) hvalue (by simpa only [hkp E hEI] using hlog) ha (by norm_num only at hclose ⊢; exact hclose) + simpa only [hkp E hEI] using hc + +theorem spectralWKB_initial_relative_bounds + (eps : ℝ) (heps : 0 < eps) (R E : ℝ) (hRE : R ≤ E) (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hH : MonotoneOn (fun r => (spectralWKBPhase R 1 p r).re) (Icc R E)) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) + (hN : 0 < spectralShellNorm (k R) (q R)) + (ha : spectralShellNorm (k R) (q R)/8 ≤ + ‖spectralScalarWronskian (q R) (spectralWKBFrame R (-1) p v R)/(-2)‖) + (hsmallError : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let H := (spectralWKBPhase R 1 p E).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ min (1/16) (eps/40)) : + ((q E).1 ≠ 0 ∧ + ‖(q E).2-homogeneousSpectralWKBLog 1 (p E) (v E)*(q E).1‖ ≤ + eps*‖p E‖*‖(q E).1‖) ∧ + (1/16 : ℝ)*Real.exp ((spectralWKBPhase R 1 p E).re)* + spectralShellNorm (k R) (q R) ≤ (k E)*‖(q E).1‖ := by + let D := spectralWKBFrame R 1 p v + let U := spectralWKBFrame R (-1) p v + let H := (spectralWKBPhase R 1 p E).re + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let N := spectralShellNorm (k R) (q R) + let a := spectralScalarWronskian (q R) (U R)/(-2) + let b := spectralScalarWronskian (D R) (q R)/(-2) + have hRI : R ∈ Icc R E := ⟨le_rfl,hRE⟩ + have hEI : E ∈ Icc R E := ⟨hRE,le_rfl⟩ + have hpn (r : ℝ) (hr : r ∈ Icc R E) : p r ≠ 0 := by + apply norm_pos_iff.mp + rw [← hkp r hr] + exact sq_pos_of_pos (hk0 r hr) + have hDR : spectralShellNorm (k R) (D R) ≤ 5/2 := by + dsimp only [D] + rw [spectralWKBFrame_initial] + simpa only [Complex.zero_re,Real.exp_zero,mul_one] using + spectralWKBState_shell_bound 1 (p R) (v R) (spectralWKBInitialAmplitude (p R)) 0 + (k R) (hk0 R hRI) (hkp R hRI) + (spectralWKBInitialAmplitude_normalization (p R) (hpn R hRI)) (by norm_num) (hsmall R hRI) + have hUE : spectralShellNorm (k E) (U E) ≤ (5/2 : ℝ)*Real.exp (-H) := by + have hb := spectralWKBState_shell_bound (-1) (p E) (v E) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v E) + (spectralWKBPhase R (-1) p E) (k E) (hk0 E hEI) (hkp E hEI) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hpn hpD + (spectralWKBInitialAmplitude_normalization (p R) (hpn R hRI)) E hEI) + (by norm_num) (hsmall E hEI) + simpa only [U,spectralWKBFrame,spectralWKBPhase,H,neg_mul,one_mul,Complex.neg_re] using hb + have hb : ‖b‖ ≤ (5/2 : ℝ)/2*N := by + dsimp only [b] + rw [norm_div] + norm_num only [norm_neg,Complex.norm_ofNat] + apply (div_le_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + have hw := spectralScalarWronskian_shell_bound (k R) (hk0 R hRI) (D R) (q R) + nlinarith [mul_le_mul_of_nonneg_right hDR hN.le] + have herr := spectralWKB_initial_action_error R E hRE 1 (by norm_num) + p v w q k hp hv hw hq hk hk0 hkp hpD hvD hsmall hH + (fun t ht => by simpa only [one_pow,neg_one_mul] using hODE t ht) + dsimp only at herr + simp only [mul_one] at herr + have he : spectralShellNorm (k E) (q E-(a • D E+b • U E)) ≤ + ((25/4 : ℝ)*Real.exp J*J)*Real.exp H*N := by + change spectralShellNorm (k E) (q E-(a • D E+b • U E)) ≤ + ((25/4 : ℝ)*N)*Real.exp (H+J)*J at herr + rw [Real.exp_add] at herr + convert herr using 1; ring + have hclose := spectralGrowingBranch_error (k E) (5/2) H N + ((25/4 : ℝ)*Real.exp J*J) (hk0 E hEI) (by norm_num) hN.le a b (D E) (U E) (q E) hUE hb he + have hvalue := spectralWKBFrame_value_norm R E hRE 1 p v hp hv hpn hpD (k E) E + (hk0 E hEI) (hkp E hEI) hEI + have hlog := spectralWKB_log_bound 1 (p E) (v E) (hpn E hEI) (by norm_num) (hsmall E hEI) + have hc := spectralGrowingBranch_relative_cone (k E) H N + ((25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H)) (hk0 E hEI) hN eps heps + hsmallError a (homogeneousSpectralWKBLog 1 (p E) (v E)) (D E) (q E) + (by rfl) hvalue (by simpa only [hkp E hEI] using hlog) ha (by norm_num only at hclose ⊢; exact hclose) + refine ⟨?_,?_⟩ + · simpa only [hkp E hEI] using hc + · exact spectralGrowingBranch_value_lower (k E) H N + ((25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H)) (hk0 E hEI) hN.le + ((le_min_iff.mp hsmallError).1) a (D E) (q E) hvalue ha + (by norm_num only at hclose ⊢; exact hclose) + +theorem spectralWKB_initial_relative_cone + (eps : ℝ) (heps : 0 < eps) (R E : ℝ) (hRE : R ≤ E) (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hH : MonotoneOn (fun r => (spectralWKBPhase R 1 p r).re) (Icc R E)) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) + (hN : 0 < spectralShellNorm (k R) (q R)) + (ha : spectralShellNorm (k R) (q R)/8 ≤ + ‖spectralScalarWronskian (q R) (spectralWKBFrame R (-1) p v R)/(-2)‖) + (hsmallError : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let H := (spectralWKBPhase R 1 p E).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ min (1/16) (eps/40)) : + (q E).1 ≠ 0 ∧ + ‖(q E).2-homogeneousSpectralWKBLog 1 (p E) (v E)*(q E).1‖ ≤ + eps*‖p E‖*‖(q E).1‖ := by + exact (spectralWKB_initial_relative_bounds eps heps R E hRE p v w q k hp hv hw hq hk hk0 + hkp hpD hvD hsmall hH hODE hN ha hsmallError).1 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBInitialError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBInitialError.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b18eaae9c10892bc2c3c31e26f3b4774ef0df20 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBInitialError.lean @@ -0,0 +1,126 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralDuhamelActionError + +namespace OAI + +/-! Error of the actual solution relative to its propagated initial WKB +coefficients, measured on the same growing action scale. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_initial_action_error + (R E : ℝ) (hRE : R ≤ E) (chi : ℂ) (hchi : ‖chi‖ = 1) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hH : MonotoneOn (fun r => (spectralWKBPhase R chi p r).re) (Icc R E)) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q + (spectralScalarField (-chi^2*(p r)^2) (q r)) r) : + let D := spectralWKBFrame R chi p v + let U := spectralWKBFrame R (-chi) p v + let W := (-2 : ℂ)*chi + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + spectralShellNorm (k E) + (q E-((spectralScalarWronskian (q R) (U R)/W) • D E+ + (spectralScalarWronskian (D R) (q R)/W) • U E)) ≤ + ((25/4 : ℝ)*spectralShellNorm (k R) (q R))* + Real.exp ((spectralWKBPhase R chi p E).re+J)*J := by + dsimp only + have hp0 (r : ℝ) (hr : r ∈ Icc R E) : p r≠0 := by + apply norm_pos_iff.mp + rw [← hkp r hr] + exact sq_pos_of_pos (hk0 r hr) + let e := fun r => -homogeneousSpectralWKBResidual (p r) (v r) (w r) + let V := fun r => -(chi^2*(p r)^2-e r) + let D := spectralWKBFrame R chi p v + let U := spectralWKBFrame R (-chi) p v + let H := fun r => (spectralWKBPhase R chi p r).re + have he : ContinuousOn e (Icc R E) := by + exact ((continuousOn_const.mul ((hv.div hp hp0).pow 2)).sub + (hw.div (continuousOn_const.mul hp) + (fun r hr => mul_ne_zero (by norm_num) (hp0 r hr)))).neg + have hDc := spectralWKBFrame_continuousOn R E hRE chi p v hp hv hp0 + have hUc := spectralWKBFrame_continuousOn R E hRE (-chi) p v hp hv hp0 + have hD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt D (spectralScalarField (V t) (D t)) t := by + simpa only [V,e,sub_neg_eq_add] using + spectralWKBFrame_hasDerivAt R E chi p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + have hU (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt U (spectralScalarField (V t) (U t)) t := by + have hh := spectralWKBFrame_hasDerivAt R E (-chi) p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + simpa only [V,e,sub_neg_eq_add,neg_sq] using hh + have hODE' (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt q (spectralScalarField (V t) (q t)+(0,e t*(q t).1)) t := by + apply (hODE t ht).congr_deriv + apply Prod.ext + · simp only [spectralScalarField,Prod.fst_add,add_zero] + · dsimp only [spectralScalarField,Prod.snd_add,V] + ring + have hnorm : ‖(-2 : ℂ)*chi‖=2 := by rw [norm_mul,hchi,mul_one]; norm_num + have hDb0 (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (D t)≤(5/2 : ℝ)*Real.exp (H t) := by + exact spectralWKBState_shell_bound chi (p t) (v t) _ _ (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + hchi.le (hsmall t ht) + have hUb0 (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp (-H t) := by + have hh := spectralWKBState_shell_bound (-chi) (p t) (v t) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v t) + (spectralWKBPhase R (-chi) p t) (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + (by simpa only [norm_neg] using hchi.le) (hsmall t ht) + have hsre : (spectralWKBPhase R (-chi) p t).re= -H t := by + dsimp only [spectralWKBPhase,H] + rw [neg_mul,Complex.neg_re] + change spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp ((spectralWKBPhase R (-chi) p t).re) at hh + rw [hsre] at hh + exact hh + have hHc : ContinuousOn H (Icc R E) := + Complex.continuous_re.comp_continuousOn (spectralWKBPhase_continuousOn R E hRE chi p hp) + have hzero : H R = 0 := by + simp only [H,spectralWKBPhase,intervalIntegral.integral_same,mul_zero,Complex.zero_re] + have ht := spectralWKB_actual_transfer R E hRE chi hchi p v w q k + hp hv hw hq hk hk0 hkp hpD hvD hsmall hH hODE + have hsol (t : ℝ) (htt : t ∈ Icc R E) : spectralShellNorm (k t) (q t) ≤ + ((25/4 : ℝ)*spectralShellNorm (k R) (q R))* + Real.exp (H t+∫ s in R..t, (25/4 : ℝ)*‖e s‖/(k s)^2) := by + have htt' := ht t htt + change spectralShellNorm (k t) (q t) ≤ + ((25/4 : ℝ)*spectralShellNorm (k R) (q R))* + Real.exp (H t-H R+∫ s in R..t, + (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p s) (v s) (w s)‖/(k s)^2) at htt' + rw [hzero,sub_zero] at htt' + simpa only [e,norm_neg] using htt' + have hker (t : ℝ) (htt : t ∈ Icc R E) : + spectralShellNorm (k E) (spectralScalarTransferKernel D U ((-2 : ℂ)*chi) E t) ≤ + (25/4 : ℝ)/k t*Real.exp (H E-H t) := by + have hh := spectralScalarTransferKernel_bound D U ((-2 : ℂ)*chi) + (k E) (k t) (5/2) 2 (H E) (H t) E t (hk0 E ⟨hRE,le_rfl⟩).le + (hk0 t htt) (by norm_num) (by norm_num) (by rw [hnorm]) + (hDb0 E ⟨hRE,le_rfl⟩) (hDb0 t htt) (hUb0 E ⟨hRE,le_rfl⟩) (hUb0 t htt) + rw [abs_of_nonneg (sub_nonneg.mpr (hH htt ⟨hRE,le_rfl⟩ htt.2))] at hh + convert hh using 1; dsimp only [H]; ring + have herr := spectralScalarDuhamelIntegral_action_error R E (25/4) + ((25/4 : ℝ)*spectralShellNorm (k R) (q R)) hRE (by norm_num) + (mul_nonneg (by norm_num) (spectralShellNorm_nonneg _ (hk0 R ⟨le_rfl,hRE⟩).le _)) + D U q ((-2 : ℂ)*chi) e k H hDc hUc hq he hk hHc hk0 hker hsol + have hrep := spectralScalarDuhamel_representation R E D U q V (fun t => e t*(q t).1) + ((-2 : ℂ)*chi) hDc hUc hq (he.mul hq.fst) + (norm_pos_iff.mp (by rw [hnorm]; norm_num)) + (spectralWKBFrame_wronskian R E hRE chi p v hp hv hp0 hpD) hD hU hODE' E ⟨hRE,le_rfl⟩ + have heq : q E-((spectralScalarWronskian (q R) (U R)/((-2 : ℂ)*chi)) • D E+ + (spectralScalarWronskian (D R) (q R)/((-2 : ℂ)*chi)) • U E) = + spectralScalarDuhamelIntegral R D U ((-2 : ℂ)*chi) (fun t => e t*(q t).1) E := by + exact sub_eq_iff_eq_add.mpr (by simpa only [add_comm] using hrep) + rw [heq] + simpa only [e,norm_neg,H] using herr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c36e6894796bb977c814fcd28633be818011b5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseIntegral.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBWeightedPrimitives + +namespace OAI + +/-! A phase integral controlled by the momentum derivative and endpoint size. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_phase_integral (a b c B sign : ℝ) (hab : a≤b) + (hc : 0 g t/p t) volume a b := + (hg.div hp (fun t ht => (hp0 t ht).ne')).intervalIntegrable_of_Icc hab + have hA : ContinuousOn (fun t => (2*sign)*p t) (Icc a b) := continuousOn_const.mul hp + have hAD (t : ℝ) (ht : t ∈ Ioo a b) : + HasDerivAt (fun t => (2*sign)*p t) (g t/p t) t := by + apply ((hD t ht).const_mul (2*sign)).congr_deriv + calc + _ = sign^2*(g t/p t) := by ring + _ = _ := by rw [hs,one_mul] + have he := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hab hA hAD hi + have hio : IntervalIntegrable (fun t => 1/p t) volume a b := + (continuousOn_const.div hp (fun t ht => (hp0 t ht).ne')).intervalIntegrable_of_Icc hab + have hle : (∫ t in a..b, 1/p t)≤(1/c)*(∫ t in a..b, g t/p t) := by + rw [← intervalIntegral.integral_const_mul] + apply intervalIntegral.integral_mono_on hab hio (hi.const_mul _) + intro t ht + have hpt := hp0 t ht + have hh : 1/p t≤g t/(c*p t) := by + apply (div_le_div_iff₀ hpt (mul_pos hc hpt)).mpr + simpa only [one_mul,mul_comm c (p t)] using mul_le_mul_of_nonneg_right (hcg t ht) hpt.le + convert hh using 1 + ring + have hpa : 0≤p a := (hp0 a ⟨le_rfl,hab⟩).le + have hpb : 0≤p b := (hp0 b ⟨hab,le_rfl⟩).le + have hend : (2*sign)*p b-(2*sign)*p a≤4*B := by + rcases sq_eq_one_iff.mp hs with hs' | hs' + · rw [hs']; nlinarith + · rw [hs']; nlinarith + rw [he] at hle + calc + _ ≤ (1/c)*((2*sign)*p b-(2*sign)*p a) := hle + _ ≤ (1/c)*(4*B) := mul_le_mul_of_nonneg_left hend (by positivity) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseLowerBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..be604c773a5330dedaa125273c432b6ee6478ca8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseLowerBound.lean @@ -0,0 +1,24 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPhaseIntegral + +namespace OAI + +/-! A positive lower bound for momentum controls its phase integral. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_phase_of_lower (a b L : ℝ) (hab : a≤b) (hL : 0 1/p t) volume a b := + (continuousOn_const.div hp (fun t ht => (hp0 t ht).ne')).intervalIntegrable_of_Icc hab + calc + _ ≤ ∫ _ in a..b, 1/L := intervalIntegral.integral_mono_on hab hi intervalIntegrable_const + (fun t ht => by gcongr; exact hbound t ht) + _ = _ := by rw [intervalIntegral.integral_const]; simp only [smul_eq_mul]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseOrder.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..86aec419f420c1a87dec4b6bc37d17140f85e088 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPhaseOrder.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBConstruction +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSqrtApproximation + +namespace OAI + +/-! The action is monotone after choosing the orientation of the WKB pair. +For an oscillatory branch the choice depends only on the sign of gamma. -/ + +open Set +namespace DefocusingNLS + +theorem spectralComplexSqrt_re_pos (x y : ℝ) (hx : 0 intro hy <;> nlinarith + +theorem spectralWKBPhase_monotone (R E : ℝ) (hRE : R≤E) (chi : ℂ) + (p : ℝ → ℂ) (hp : ContinuousOn p (Icc R E)) + (hpositive : ∀ r ∈ Ioo R E, 0≤(chi*p r).re) : + MonotoneOn (fun r => (spectralWKBPhase R chi p r).re) (Icc R E) := by + have hc := Complex.continuous_re.comp_continuousOn + (spectralWKBPhase_continuousOn R E hRE chi p hp) + have hd (r : ℝ) (hr : r ∈ Ioo R E) : + HasDerivAt (fun t => (spectralWKBPhase R chi p t).re) (chi*p r).re r := + Complex.reCLM.hasFDerivAt.comp_hasDerivAt r (spectralWKBPhase_hasDerivAt R E chi p hp r hr) + apply monotoneOn_of_deriv_nonneg (convex_Icc R E) hc + · intro r hr + exact (hd r (by simpa only [interior_Icc] using hr)).differentiableAt.differentiableWithinAt + · intro r hr + have hri : r ∈ Ioo R E := by simpa only [interior_Icc] using hr + change 0≤deriv (fun t => (spectralWKBPhase R chi p t).re) r + rw [(hd r hri).deriv] + exact hpositive r hri + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPotentialResidual.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPotentialResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cc6daae828e85669c510bc7dc95544c7b42a295 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBPotentialResidual.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousSpectralLocalizationWKB + +namespace OAI + +/-! The WKB residual written in terms of derivatives of the squared momentum. +These are exactly the two terms integrated away from a turning point. -/ + +namespace DefocusingNLS + +theorem spectralWKB_potential_residual (p d e : ℂ) (hp : p≠0) : + homogeneousSpectralWKBResidual p (d/(2*p)) (e/(2*p)-d^2/(4*p^3))= + (5/16 : ℂ)*d^2/p^4-e/(4*p^2) := by + dsimp only [homogeneousSpectralWKBResidual] + field_simp [hp] + ring + +theorem spectralWKB_potential_residual_norm (p d e : ℂ) (hp : p≠0) : + ‖homogeneousSpectralWKBResidual p (d/(2*p)) (e/(2*p)-d^2/(4*p^3))‖≤ + (5/16 : ℝ)*‖d‖^2/‖p‖^4+‖e‖/(4*‖p‖^2) := by + rw [spectralWKB_potential_residual p d e hp] + have hb := norm_sub_le ((5/16 : ℂ)*d^2/p^4) (e/(4*p^2)) + norm_num only [norm_div,norm_mul,norm_pow,Complex.norm_ofNat] at hb + exact hb + +theorem spectralWKB_potential_residual_weighted (p d e : ℂ) (k : ℝ) + (hk : 0 R+E-t + have hj (t : ℝ) (ht : t ∈ Icc R E) : j t ∈ Icc R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjo (t : ℝ) (ht : t ∈ Ioo R E) : j t ∈ Ioo R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjc : Continuous j := continuous_const.sub continuous_id + let P := fun t => p (j t) + let V := fun t => -v (j t) + let W := fun t => w (j t) + let K := fun t => k (j t) + let Q := spectralScalarReflect R E q + have hPc : ContinuousOn P (Icc R E) := hp.comp hjc.continuousOn hj + have hVc : ContinuousOn V (Icc R E) := (hv.comp hjc.continuousOn hj).neg + have hWc : ContinuousOn W (Icc R E) := hw.comp hjc.continuousOn hj + have hKc : ContinuousOn K (Icc R E) := hk.comp hjc.continuousOn hj + have hQc : ContinuousOn Q (Icc R E) := + ((hq.comp hjc.continuousOn hj).fst).prodMk ((hq.comp hjc.continuousOn hj).snd.neg) + have hPD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt P (V t) t := by + have hh := (hpD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E)) + simpa only [P,V,j,Function.comp_def,neg_one_smul] using hh + have hVD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt V (W t) t := by + have hh := ((hvD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E))).neg + change HasDerivAt (fun x => -v (j x)) (-((-1 : ℝ) • w (j t))) t at hh + simpa only [V,W,j,neg_one_smul,neg_neg] using hh + have hQODE (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt Q (spectralScalarField (-(1 : ℂ)^2*(P t)^2) (Q t)) t := by + simpa only [one_pow,neg_one_mul] using + spectralScalarReflect_hasDerivAt R E t q (-(P t)^2) (hODE (j t) (hjo t ht)) + have hmono : MonotoneOn (fun t => (spectralWKBPhase R 1 P t).re) (Icc R E) := + spectralWKBPhase_monotone R E hRE 1 P hPc (fun t ht => by + simpa only [one_mul] using hpositive (j t) (hj t ⟨ht.1.le,ht.2.le⟩)) + have hNR : 0 < spectralShellNorm (K R) (Q R) := by + simpa only [K,Q,j,spectralScalarReflect_norm,add_sub_cancel_left] using hN + have haR : spectralShellNorm (K R) (Q R)/8 ≤ + ‖spectralScalarWronskian (Q R) (spectralWKBFrame R (-1) P V R)/(-2)‖ := by + have he : spectralScalarWronskian (Q R) (spectralWKBFrame R (-1) P V R) = + spectralScalarWronskian ((Complex.sqrt (p E))⁻¹, + (p E-v E/(2*p E))*(Complex.sqrt (p E))⁻¹) (q E) := by + rw [spectralWKBFrame_initial] + simp only [Q,spectralScalarReflect,P,V,j,add_sub_cancel_left,spectralWKBState, + spectralWKBValue,Complex.exp_zero,mul_one,spectralWKBInitialAmplitude, + homogeneousSpectralWKBLog,spectralScalarWronskian] + ring + rw [he] + simpa only [K,Q,j,spectralScalarReflect_norm,add_sub_cancel_left] using ha + have herr : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (P t) (V t) (W t)‖/(K t)^2 + let H := (spectralWKBPhase R 1 P E).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ 1/64 := by + dsimp only [P,V,W,K,j] + rw [spectralWKB_reflected_residual_integral,spectralWKB_reflected_phase] + exact herror + have hc := spectralWKB_initial_cone R E hRE P V W Q K + hPc hVc hWc hQc hKc (fun t ht => hk0 (j t) (hj t ht)) + (fun t ht => hkp (j t) (hj t ht)) hPD hVD + (fun t ht => by simpa only [V,norm_neg] using hsmall (j t) (hj t ht)) hmono (fun t ht => by simpa only [one_pow,neg_one_mul] using hQODE t ht) hNR haR herr + have hres : (Q E).2-homogeneousSpectralWKBLog 1 (P E) (V E)*(Q E).1 = + -((q R).2+(p R+v R/(2*p R))*(q R).1) := by + simp only [Q,spectralScalarReflect,P,V,j,add_sub_cancel_right,homogeneousSpectralWKBLog] + ring + rw [hres,norm_neg] at hc + simpa only [Q,spectralScalarReflect,P,j,add_sub_cancel_right] using hc + +theorem spectralWKB_reflected_relative_bounds + (eps : ℝ) (heps : 0 < eps) (R E : ℝ) (hRE : R ≤ E) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hpositive : ∀ r ∈ Icc R E, 0 ≤ (p r).re) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) + (hN : 0 < spectralShellNorm (k E) (q E)) + (ha : spectralShellNorm (k E) (q E)/8 ≤ + ‖spectralScalarWronskian ((Complex.sqrt (p E))⁻¹, + (p E-v E/(2*p E))*(Complex.sqrt (p E))⁻¹) (q E)/(-2)‖) + (herror : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let H := (∫ t in R..E, p t).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ min (1/16) (eps/40)) : + ((q R).1 ≠ 0 ∧ ‖(q R).2+(p R+v R/(2*p R))*(q R).1‖ ≤ + eps*‖p R‖*‖(q R).1‖) ∧ + (1/16 : ℝ)*Real.exp ((∫ t in R..E, p t).re)* + spectralShellNorm (k E) (q E) ≤ (k R)*‖(q R).1‖ := by + let j := fun t : ℝ => R+E-t + have hj (t : ℝ) (ht : t ∈ Icc R E) : j t ∈ Icc R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjo (t : ℝ) (ht : t ∈ Ioo R E) : j t ∈ Ioo R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjc : Continuous j := continuous_const.sub continuous_id + let P := fun t => p (j t) + let V := fun t => -v (j t) + let W := fun t => w (j t) + let K := fun t => k (j t) + let Q := spectralScalarReflect R E q + have hPc : ContinuousOn P (Icc R E) := hp.comp hjc.continuousOn hj + have hVc : ContinuousOn V (Icc R E) := (hv.comp hjc.continuousOn hj).neg + have hWc : ContinuousOn W (Icc R E) := hw.comp hjc.continuousOn hj + have hKc : ContinuousOn K (Icc R E) := hk.comp hjc.continuousOn hj + have hQc : ContinuousOn Q (Icc R E) := + ((hq.comp hjc.continuousOn hj).fst).prodMk ((hq.comp hjc.continuousOn hj).snd.neg) + have hPD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt P (V t) t := by + have hh := (hpD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E)) + simpa only [P,V,j,Function.comp_def,neg_one_smul] using hh + have hVD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt V (W t) t := by + have hh := ((hvD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E))).neg + change HasDerivAt (fun x => -v (j x)) (-((-1 : ℝ) • w (j t))) t at hh + simpa only [V,W,j,neg_one_smul,neg_neg] using hh + have hQODE (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt Q (spectralScalarField (-(1 : ℂ)^2*(P t)^2) (Q t)) t := by + simpa only [one_pow,neg_one_mul] using + spectralScalarReflect_hasDerivAt R E t q (-(P t)^2) (hODE (j t) (hjo t ht)) + have hmono : MonotoneOn (fun t => (spectralWKBPhase R 1 P t).re) (Icc R E) := + spectralWKBPhase_monotone R E hRE 1 P hPc (fun t ht => by + simpa only [one_mul] using hpositive (j t) (hj t ⟨ht.1.le,ht.2.le⟩)) + have hNR : 0 < spectralShellNorm (K R) (Q R) := by + simpa only [K,Q,j,spectralScalarReflect_norm,add_sub_cancel_left] using hN + have haR : spectralShellNorm (K R) (Q R)/8 ≤ + ‖spectralScalarWronskian (Q R) (spectralWKBFrame R (-1) P V R)/(-2)‖ := by + have he : spectralScalarWronskian (Q R) (spectralWKBFrame R (-1) P V R) = + spectralScalarWronskian ((Complex.sqrt (p E))⁻¹, + (p E-v E/(2*p E))*(Complex.sqrt (p E))⁻¹) (q E) := by + rw [spectralWKBFrame_initial] + simp only [Q,spectralScalarReflect,P,V,j,add_sub_cancel_left,spectralWKBState, + spectralWKBValue,Complex.exp_zero,mul_one,spectralWKBInitialAmplitude, + homogeneousSpectralWKBLog,spectralScalarWronskian] + ring + rw [he] + simpa only [K,Q,j,spectralScalarReflect_norm,add_sub_cancel_left] using ha + have herr : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (P t) (V t) (W t)‖/(K t)^2 + let H := (spectralWKBPhase R 1 P E).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ min (1/16) (eps/40) := by + dsimp only [P,V,W,K,j] + rw [spectralWKB_reflected_residual_integral,spectralWKB_reflected_phase] + exact herror + have hc := spectralWKB_initial_relative_bounds eps heps R E hRE P V W Q K + hPc hVc hWc hQc hKc (fun t ht => hk0 (j t) (hj t ht)) + (fun t ht => hkp (j t) (hj t ht)) hPD hVD + (fun t ht => by simpa only [V,norm_neg] using hsmall (j t) (hj t ht)) hmono (fun t ht => by simpa only [one_pow,neg_one_mul] using hQODE t ht) hNR haR herr + have hres : (Q E).2-homogeneousSpectralWKBLog 1 (P E) (V E)*(Q E).1 = + -((q R).2+(p R+v R/(2*p R))*(q R).1) := by + simp only [Q,spectralScalarReflect,P,V,j,add_sub_cancel_right,homogeneousSpectralWKBLog] + ring + rw [hres,norm_neg] at hc + simpa only [Q,spectralScalarReflect,P,K,j,add_sub_cancel_right,add_sub_cancel_left, + spectralScalarReflect_norm,spectralWKB_reflected_phase,spectralShellNorm,norm_neg] using hc + +theorem spectralWKB_reflected_relative_cone + (eps : ℝ) (heps : 0 < eps) (R E : ℝ) (hRE : R ≤ E) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hpositive : ∀ r ∈ Icc R E, 0 ≤ (p r).re) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) + (hN : 0 < spectralShellNorm (k E) (q E)) + (ha : spectralShellNorm (k E) (q E)/8 ≤ + ‖spectralScalarWronskian ((Complex.sqrt (p E))⁻¹, + (p E-v E/(2*p E))*(Complex.sqrt (p E))⁻¹) (q E)/(-2)‖) + (herror : + let J := ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 + let H := (∫ t in R..E, p t).re + (25/4 : ℝ)*Real.exp J*J+(25/8)*Real.exp (-2*H) ≤ min (1/16) (eps/40)) : + (q R).1 ≠ 0 ∧ ‖(q R).2+(p R+v R/(2*p R))*(q R).1‖ ≤ + eps*‖p R‖*‖(q R).1‖ := by + exact (spectralWKB_reflected_relative_bounds eps heps R E hRE p v w q k hp hv hw hq hk hk0 + hkp hpD hvD hsmall hpositive hODE hN ha herror).1 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBReflectedError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBReflectedError.lean new file mode 100644 index 0000000000000000000000000000000000000000..383d5c9a6b8cf9e828f4be5f766924b87bde1a28 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBReflectedError.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBInitialError +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralScalarReflection +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPhaseOrder + +namespace OAI + +/-! Propagate the growing WKB coefficient from the turning edge toward a +fixed inner radius by reflecting the actual Cauchy equation. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_reflected_action_error + (R E : ℝ) (hRE : R ≤ E) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hpositive : ∀ r ∈ Icc R E, 0 ≤ (p r).re) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q (spectralScalarField (-(p r)^2) (q r)) r) : + let P := fun t => p (R+E-t) + let V := fun t => -v (R+E-t) + let Q := spectralScalarReflect R E q + let D := spectralWKBFrame R 1 P V + let U := spectralWKBFrame R (-1) P V + let J := ∫ t in R..E, (25/4 : ℝ)* + ‖homogeneousSpectralWKBResidual (P t) (V t) (w (R+E-t))‖/(k (R+E-t))^2 + spectralShellNorm (k R) + (Q E-((spectralScalarWronskian (Q R) (U R)/(-2)) • D E+ + (spectralScalarWronskian (D R) (Q R)/(-2)) • U E)) ≤ + ((25/4 : ℝ)*spectralShellNorm (k E) (q E))* + Real.exp ((spectralWKBPhase R 1 P E).re+J)*J := by + dsimp only + let j := fun t : ℝ => R+E-t + have hj (t : ℝ) (ht : t ∈ Icc R E) : j t ∈ Icc R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjo (t : ℝ) (ht : t ∈ Ioo R E) : j t ∈ Ioo R E := by + dsimp only [j] + constructor <;> linarith [ht.1,ht.2] + have hjc : Continuous j := continuous_const.sub continuous_id + let P := fun t => p (j t) + let V := fun t => -v (j t) + let W := fun t => w (j t) + let K := fun t => k (j t) + let Q := spectralScalarReflect R E q + have hPc : ContinuousOn P (Icc R E) := hp.comp hjc.continuousOn hj + have hVc : ContinuousOn V (Icc R E) := (hv.comp hjc.continuousOn hj).neg + have hWc : ContinuousOn W (Icc R E) := hw.comp hjc.continuousOn hj + have hKc : ContinuousOn K (Icc R E) := hk.comp hjc.continuousOn hj + have hQc : ContinuousOn Q (Icc R E) := + ((hq.comp hjc.continuousOn hj).fst).prodMk ((hq.comp hjc.continuousOn hj).snd.neg) + have hPD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt P (V t) t := by + have hh := (hpD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E)) + simpa only [P,V,j,Function.comp_def,neg_one_smul] using hh + have hVD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt V (W t) t := by + have hh := ((hvD (j t) (hjo t ht)).scomp t ((hasDerivAt_id t).const_sub (R+E))).neg + change HasDerivAt (fun x => -v (j x)) (-((-1 : ℝ) • w (j t))) t at hh + simpa only [V,W,j,neg_one_smul,neg_neg] using hh + have hQODE (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt Q (spectralScalarField (-(1 : ℂ)^2*(P t)^2) (Q t)) t := by + simpa only [one_pow,neg_one_mul] using + spectralScalarReflect_hasDerivAt R E t q (-(P t)^2) (hODE (j t) (hjo t ht)) + have hmono : MonotoneOn (fun t => (spectralWKBPhase R 1 P t).re) (Icc R E) := + spectralWKBPhase_monotone R E hRE 1 P hPc (fun t ht => by + simpa only [one_mul] using hpositive (j t) (hj t ⟨ht.1.le,ht.2.le⟩)) + have hh := spectralWKB_initial_action_error R E hRE 1 (by norm_num) P V W Q K + hPc hVc hWc hQc hKc (fun t ht => hk0 (j t) (hj t ht)) + (fun t ht => hkp (j t) (hj t ht)) hPD hVD + (fun t ht => by simpa only [V,norm_neg] using hsmall (j t) (hj t ht)) hmono hQODE + simpa only [P,V,W,K,Q,j,neg_mul,mul_one,one_mul,spectralScalarReflect_norm, + add_sub_cancel_left,add_sub_cancel_right] using hh + +theorem spectralWKB_reflected_residual_integral (R E : ℝ) + (p v w : ℝ → ℂ) (k : ℝ → ℝ) : + (∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual + (p (R+E-t)) (-v (R+E-t)) (w (R+E-t))‖/(k (R+E-t))^2) = + ∫ t in R..E, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2 := by + simpa only [homogeneousSpectralWKBResidual,neg_div,neg_sq, + add_sub_cancel_left,add_sub_cancel_right] using + intervalIntegral.integral_comp_sub_left + (fun t => (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2) + (a := R) (b := E) (R+E) + +theorem spectralWKB_reflected_phase (R E : ℝ) (p : ℝ → ℂ) : + spectralWKBPhase R 1 (fun t => p (R+E-t)) E = ∫ t in R..E, p t := by + simp only [spectralWKBPhase,one_mul] + rw [intervalIntegral.integral_comp_sub_left] + simp only [add_sub_cancel_left,add_sub_cancel_right] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBRemoteMismatch.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBRemoteMismatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9e1a64e1ba7369b42e6ab525e6bc536495b073a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBRemoteMismatch.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSlopeError + +namespace OAI + +/-! At a remote endpoint the normalized slope mismatch is of order E⁻², +uniformly under the radial frequency and derivative bounds. -/ + +namespace DefocusingNLS + +theorem spectralWKB_remote_mismatch (h F gamma g E : ℝ) + (hh : h^2 = 1) (hE : 0 < E) (hF : E^2/32 ≤ F) (hg : |g| ≤ 4*F/E) : + ‖((h : ℂ)*Complex.I)*(Real.sqrt F : ℂ) - + homogeneousSpectralWKBLog ((h : ℂ)*Complex.I) + (Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))) + ((g : ℂ)/(2*Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))))‖ / Real.sqrt F ≤ + (32*|gamma|+8)/E^2 := by + have hFp : 0 < F := (by positivity : 0 < E^2/32).trans_le hF + have hS : 0 < Real.sqrt F := Real.sqrt_pos.mpr hFp + have hSq := Real.sq_sqrt hFp.le + have hSlo : E/8 ≤ Real.sqrt F := by + apply (sq_le_sq₀ (by positivity : 0 ≤ E/8) hS.le).mp + nlinarith [sq_nonneg E] + have hγ : |gamma|/Real.sqrt F/Real.sqrt F ≤ 32*|gamma|/E^2 := by + calc + _ = |gamma|/F := by rw [div_div,← sq,hSq] + _ ≤ |gamma|/(E^2/32) := div_le_div_of_nonneg_left (abs_nonneg _) (by positivity) hF + _ = _ := by ring + have hg' : |g|/(4*F) ≤ 1/E := by + apply (div_le_iff₀ (by positivity : 0 < 4*F)).mpr + exact hg.trans_eq (by ring) + have hrem : (1/E)/Real.sqrt F ≤ 8/E^2 := by + calc + _ ≤ (1/E)/(E/8) := div_le_div_of_nonneg_left (by positivity) (by positivity) hSlo + _ = _ := by ring + calc + _ ≤ (|gamma|/Real.sqrt F+|g|/(4*F))/Real.sqrt F := + div_le_div_of_nonneg_right (spectralWKB_oscillatory_slope_error h F gamma g hh hFp) hS.le + _ = |gamma|/Real.sqrt F/Real.sqrt F + (|g|/(4*F))/Real.sqrt F := add_div _ _ _ + _ ≤ 32*|gamma|/E^2 + (1/E)/Real.sqrt F := + add_le_add hγ (div_le_div_of_nonneg_right hg' hS.le) + _ ≤ 32*|gamma|/E^2 + 8/E^2 := add_le_add le_rfl hrem + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBResidualIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBResidualIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..99a3f45bccced2343fa33b22201c5c24f26729d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBResidualIntegral.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBWeightedPrimitives + +namespace OAI + +/-! Integrated WKB error from exact momentum primitives. The constants only +use derivative bounds and the momentum at the near endpoint. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_residual_integral (a b A B : ℝ) (hab : a≤b) + (hA : 0≤A) (hB : 0≤B) (p g e : ℝ → ℝ) + (hp : ContinuousOn p (Icc a b)) (hg : ContinuousOn g (Icc a b)) + (he : ContinuousOn e (Icc a b)) (hp0 : ∀ t ∈ Icc a b, 0

g t/(p t)^3) volume a b := + ContinuousOn.intervalIntegrable_of_Icc hab + (hg.div (hp.pow 3) (fun t ht => pow_ne_zero _ (hpn t ht))) + have hi5 : IntervalIntegrable (fun t => g t/(p t)^5) volume a b := + ContinuousOn.intervalIntegrable_of_Icc hab + (hg.div (hp.pow 5) (fun t ht => pow_ne_zero _ (hpn t ht))) + have hif : IntervalIntegrable + (fun t => (5/16 : ℝ)*(g t)^2/(p t)^5+|e t|/(4*(p t)^3)) volume a b := + ContinuousOn.intervalIntegrable_of_Icc hab + (((continuousOn_const.mul (hg.pow 2)).div (hp.pow 5) + (fun t ht => pow_ne_zero _ (hpn t ht))).add + (he.abs.div (continuousOn_const.mul (hp.pow 3)) + (fun t ht => mul_ne_zero (by norm_num) (pow_ne_zero _ (hpn t ht))))) + have hbound : (∫ t in a..b, (5/16 : ℝ)*(g t)^2/(p t)^5+|e t|/(4*(p t)^3))≤ + (5*B/16)*(∫ t in a..b, g t/(p t)^5)+(A/4)*(∫ t in a..b, g t/(p t)^3) := by + rw [← intervalIntegral.integral_const_mul, ← intervalIntegral.integral_const_mul, + ← intervalIntegral.integral_add (hi5.const_mul _) (hi3.const_mul _)] + apply intervalIntegral.integral_mono_on hab hif + ((hi5.const_mul _).add (hi3.const_mul _)) + intro t ht + have hp5 : 0≤(p t)^5 := (pow_pos (hp0 t ht) _).le + have hp3 : 0≤(p t)^3 := (pow_pos (hp0 t ht) _).le + have hb : (g t)^2≤B*g t := by nlinarith [hg0 t ht,hgB t ht] + have h1 := div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_left hb (by norm_num : (0 : ℝ)≤5/16)) hp5 + have h2 := div_le_div_of_nonneg_right (heA t ht) + (mul_nonneg (by norm_num : (0 : ℝ)≤4) hp3) + convert add_le_add h1 h2 using 1 + ring + rw [spectralWKB_integral_fifth a b hab p g hp hg hp0 hD, + spectralWKB_integral_cube a b hab p g hp hg hp0 hD] at hbound + have hpa : 0

(le_abs_self _).trans (hphase t ht)) r hr + have hUb (r : ℝ) (hr : r ∈ Icc R E) : spectralShellNorm (k r) (U r) ≤ C := by + apply hN (-chi) (by simpa only [norm_neg] using hchi) _ r hr + intro t ht + have he : (spectralWKBPhase R (-chi) p t).re = -(spectralWKBPhase R chi p t).re := by + simp only [spectralWKBPhase,neg_mul,Complex.neg_re] + rw [he] + exact (neg_le_abs _).trans (hphase t ht) + have hWnorm : ‖W‖ = 2 := by dsimp only [W]; rw [norm_mul,hchi,mul_one]; norm_num + have hWe : W ≠ 0 := norm_ne_zero_iff.mp (by rw [hWnorm]; norm_num) + have hdet : spectralScalarWronskian (D E) (U E) = W := + spectralWKBFrame_wronskian R E hRE chi p v hp hv hp0 hpD E ⟨hRE,le_rfl⟩ + have hterm : spectralShellNorm (k R) (P-z • D R) ≤ C^2*eps := by + rw [← spectralFrameTransfer_sub_branch D U W R E (q E) z hWe hdet] + have hb := spectralScalarInitialTerm_bound D U W (q E-z • D E) + (k R) (k E) C 2 0 0 R E (hk0 R ⟨le_rfl,hRE⟩).le (hk0 E ⟨hRE,le_rfl⟩) hC + (by norm_num) (by rw [hWnorm]) + (by simpa using hDb R ⟨le_rfl,hRE⟩) (by simpa using hDb E ⟨hRE,le_rfl⟩) + (by simpa using hUb R ⟨le_rfl,hRE⟩) (by simpa using hUb E ⟨hRE,le_rfl⟩) + have hb' : spectralShellNorm (k R) (spectralFrameTransfer D U W R E (q E-z • D E)) ≤ + C^2*spectralShellNorm (k E) (q E-z • D E) := by + simpa only [spectralFrameTransfer,sub_self,abs_zero,Real.exp_zero,mul_one,show 2*C^2/2=C^2 by ring] using hb + exact hb'.trans (mul_le_mul_of_nonneg_left hend (sq_nonneg C)) + have herr := spectralWKB_terminal_error R E B J hRE chi hchi p v w q k + hp hv hw hq hk hk0 hkp hpD hvD hsmall hphase hJ hODE + have heq : q R-z • D R = (q R-P)+(P-z • D R) := by abel + rw [heq] + exact (spectralShellNorm_add_le (k R) (hk0 R ⟨le_rfl,hRE⟩).le _ _).trans (add_le_add herr hterm) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSlopeError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSlopeError.lean new file mode 100644 index 0000000000000000000000000000000000000000..03927057a39aedb9ae6f7297523aca90622187d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSlopeError.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPhaseOrder +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSquareRootJet + +namespace OAI + +/-! The WKB slope at the remote endpoint differs from the prescribed outgoing +slope by the imaginary-potential error and the amplitude derivative. -/ + +namespace DefocusingNLS + +theorem spectralWKB_oscillatory_slope_error (h F gamma g : ℝ) + (hh : h^2 = 1) (hF : 0 < F) : + ‖((h : ℂ)*Complex.I)*(Real.sqrt F : ℂ) - + homogeneousSpectralWKBLog ((h : ℂ)*Complex.I) + (Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))) + ((g : ℂ)/(2*Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))))‖ ≤ + |gamma|/Real.sqrt F + |g|/(4*F) := by + let p := Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ)) + have hsp : 0 < Real.sqrt F := Real.sqrt_pos.mpr hF + have hlo : Real.sqrt F ≤ ‖p‖ := by + simpa only [spectralWKBSquaredMomentum,Complex.ofReal_one,one_mul,abs_of_pos hF] using + spectralWKBSqrt_frequency_lower 1 F gamma (by norm_num) + have hpn : p ≠ 0 := norm_pos_iff.mp (hsp.trans_le hlo) + have hpp : 0 < ‖p‖ := hsp.trans_le hlo + have hp2 : F ≤ ‖p‖^2 := by nlinarith [Real.sq_sqrt hF.le] + have hhabs : |h| = 1 := by nlinarith [sq_abs h,abs_nonneg h] + have hchi : ‖(h : ℂ)*Complex.I‖ = 1 := by + simp only [norm_mul,Complex.norm_real,Real.norm_eq_abs,hhabs,Complex.norm_I,mul_one] + have he : ((h : ℂ)*Complex.I)*(Real.sqrt F : ℂ) - + homogeneousSpectralWKBLog ((h : ℂ)*Complex.I) p ((g : ℂ)/(2*p)) = + ((h : ℂ)*Complex.I)*((Real.sqrt F : ℂ)-p) + (g : ℂ)/(4*p^2) := by + dsimp only [homogeneousSpectralWKBLog] + field_simp + ring + rw [he] + calc + _ ≤ ‖((h : ℂ)*Complex.I)*((Real.sqrt F : ℂ)-p)‖ + ‖(g : ℂ)/(4*p^2)‖ := norm_add_le _ _ + _ = ‖p-(Real.sqrt F : ℂ)‖ + |g|/(4*‖p‖^2) := by + rw [norm_mul,hchi,one_mul,norm_sub_rev,norm_div,norm_mul,norm_pow] + simp only [Complex.norm_real,Real.norm_eq_abs,Complex.norm_ofNat] + _ ≤ |gamma|/Real.sqrt F + |g|/(4*F) := + add_le_add (spectralComplexSqrt_approx F gamma hF) + (div_le_div_of_nonneg_left (abs_nonneg g) (by positivity) + (mul_le_mul_of_nonneg_left hp2 (by norm_num))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSqrtApproximation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSqrtApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd088549d26e5e04a1f6994f2e2c3f24fa3a21cf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSqrtApproximation.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSquareRoot +import Mathlib.Analysis.SpecialFunctions.Pow.Real + +namespace OAI + +/-! The complex momentum differs from the positive real momentum by at most +|gamma|/sqrt(x). This is the pointwise estimate behind the bounded action error. -/ + +namespace DefocusingNLS + +theorem spectralComplexSqrt_re_nonneg (z : ℂ) : 0≤(Complex.sqrt z).re := by + rw [Complex.sqrt,Complex.cpow_inv_two_re] + exact Real.sqrt_nonneg _ + +theorem spectralComplexSqrt_approx (x gamma : ℝ) (hx : 0 Complex.sqrt (Z t)) (d/(2*Complex.sqrt (Z r))) r := by + have hslit : Z r ∈ Complex.slitPlane := Or.inl hRe + have hp := ((Complex.differentiableAt_sqrt hslit).restrictScalars ℝ).comp r hZ.differentiableAt + have hpd := hp.hasDerivAt + have hsq := hpd.pow 2 + have heq : (fun t => (Complex.sqrt (Z t))^2)=Z := funext (fun t => spectralComplexSqrt_sq (Z t)) + change HasDerivAt (fun t => (Complex.sqrt (Z t))^2) _ r at hsq + rw [heq] at hsq + have he := hsq.unique hZ + have hz : Z r≠0 := by intro hz; rw [hz] at hRe; norm_num at hRe + have hp0 := spectralComplexSqrt_ne_zero (Z r) hz + apply hpd.congr_deriv + simp only [Nat.cast_ofNat,Nat.reduceSub,pow_one,Function.comp_apply] at he + apply (eq_div_iff (mul_ne_zero (by norm_num) hp0)).mpr + simpa only [mul_comm,mul_left_comm,mul_assoc] using he + +theorem spectralComplexSqrt_norm_sq (z : ℂ) : ‖Complex.sqrt z‖^2=‖z‖ := by + simpa only [norm_pow] using congrArg norm (spectralComplexSqrt_sq z) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSquareRootJet.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSquareRootJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..510f4de13475caca38dac10a6b81f3469bc44cc6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBSquareRootJet.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBSquareRoot +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBPotentialResidual + +namespace OAI + +/-! The exact first two momentum derivatives used in the WKB residual. -/ + +namespace DefocusingNLS + +theorem spectralComplexSqrt_slope_hasDerivAt (Z d : ℝ → ℂ) (e : ℂ) (r : ℝ) + (hZ : HasDerivAt Z (d r) r) (hd : HasDerivAt d e r) (hRe : 0<(Z r).re) : + HasDerivAt (fun t => d t/(2*Complex.sqrt (Z t))) + (e/(2*Complex.sqrt (Z r))-(d r)^2/(4*(Complex.sqrt (Z r))^3)) r := by + have hp := spectralComplexSqrt_hasDerivAt Z (d r) r hZ hRe + have hz : Z r≠0 := by intro he; rw [he] at hRe; norm_num at hRe + have hp0 := spectralComplexSqrt_ne_zero (Z r) hz + apply (hd.div (hp.const_mul 2) (mul_ne_zero (by norm_num) hp0)).congr_deriv + field_simp [hp0] + ring + +noncomputable def spectralWKBSquaredMomentum (sign F gamma : ℝ) : ℂ := + (sign : ℂ)*((F : ℂ)+Complex.I*(gamma : ℂ)) + +theorem spectralWKBSquaredMomentum_re (sign F gamma : ℝ) : + (spectralWKBSquaredMomentum sign F gamma).re=sign*F := by + simp only [spectralWKBSquaredMomentum,Complex.mul_re,Complex.add_re,Complex.ofReal_re, + Complex.ofReal_im,Complex.I_re,Complex.I_im,zero_mul,mul_zero,sub_zero,add_zero] + +theorem spectralWKBSquaredMomentum_norm_lower (sign F gamma : ℝ) + (hs : sign^2=1) : |F|≤‖spectralWKBSquaredMomentum sign F gamma‖ := by + have hsign : |sign|=1 := by nlinarith [sq_abs sign,abs_nonneg sign] + have he : |(spectralWKBSquaredMomentum sign F gamma).re|=|F| := by + rw [spectralWKBSquaredMomentum_re,abs_mul,hsign,one_mul] + rw [← he] + exact Complex.abs_re_le_norm _ + +theorem spectralWKBSqrt_frequency_lower (sign F gamma : ℝ) (hs : sign^2=1) : + Real.sqrt |F|≤‖Complex.sqrt (spectralWKBSquaredMomentum sign F gamma)‖ := by + have hn := spectralWKBSquaredMomentum_norm_lower sign F gamma hs + have hp := spectralComplexSqrt_norm_sq (spectralWKBSquaredMomentum sign F gamma) + have hsq := Real.sq_sqrt (abs_nonneg F) + nlinarith [Real.sqrt_nonneg |F|,norm_nonneg (Complex.sqrt (spectralWKBSquaredMomentum sign F gamma))] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBStateFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBStateFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..0992dbd9f9631bd61a24149df209a0cdc9879271 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBStateFlux.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFluxMargin +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFrameBound + +namespace OAI + +/-! The outgoing WKB logarithmic slope gives a lower bound for the flux of +the full Cauchy state, measured by its scaled first coordinate. -/ + +namespace DefocusingNLS + +theorem spectralScalarFlux_graph (z L : ℂ) : + spectralScalarFlux (z,L*z) = ‖z‖^2*L.im := by + rw [← Complex.normSq_eq_norm_sq] + simp only [spectralScalarFlux,Complex.star_def,Complex.mul_im,Complex.mul_re, + Complex.conj_re,Complex.conj_im,Complex.normSq_apply] + ring + +theorem spectralWKBState_value_norm (chi p v a S : ℂ) (k : ℝ) + (hk : 0 < k) (hkp : k^2 = ‖p‖) (ha : p*a^2 = 1) : + k*‖(spectralWKBState chi p v a S).1‖ = Real.exp S.re := by + have hka := spectralWKB_amplitude_norm p a k hk hkp ha + simp only [spectralWKBState,spectralWKBValue,norm_mul,Complex.norm_exp] + rw [← mul_assoc,hka,one_mul] + +theorem spectralWKBState_flux_lower (h F gamma k : ℝ) (v a S : ℂ) + (hh : h^2 = 1) (hF : 0 < F) + (hkp : k^2 = ‖Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))‖) + (hv : ‖v‖ ≤ ‖Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))‖^2) : + (k*‖(spectralWKBState ((h : ℂ)*Complex.I) + (Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))) v a S).1‖)^2/6 ≤ + h*spectralScalarFlux (spectralWKBState ((h : ℂ)*Complex.I) + (Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ))) v a S) := by + let p := Complex.sqrt ((F : ℂ)+Complex.I*(gamma : ℂ)) + have hl := spectralWKB_log_flux_margin h F gamma v hh hF hv + have hm := mul_le_mul_of_nonneg_right hl (sq_nonneg ‖spectralWKBValue a S‖) + change (k*‖spectralWKBValue a S‖)^2/6 ≤ + h*spectralScalarFlux (spectralWKBValue a S, + homogeneousSpectralWKBLog ((h : ℂ)*Complex.I) p v*spectralWKBValue a S) + rw [spectralScalarFlux_graph,mul_pow,hkp] + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTerminalError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTerminalError.lean new file mode 100644 index 0000000000000000000000000000000000000000..30a500d7f145597c57d6c26270f899413e947ac9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTerminalError.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralBoundedFrameError + +namespace OAI + +/-! Terminal transfer error for the constructed WKB frame on an oscillatory +interval. The bounded real action is retained in the explicit constant. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_terminal_error + (R E B J : ℝ) (hRE : R ≤ E) (chi : ℂ) (hchi : ‖chi‖ = 1) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 < k r) + (hkp : ∀ r ∈ Icc R E, (k r)^2 = ‖p r‖) + (hpD : ∀ r ∈ Ioo R E, HasDerivAt p (v r) r) + (hvD : ∀ r ∈ Ioo R E, HasDerivAt v (w r) r) + (hsmall : ∀ r ∈ Icc R E, ‖v r‖ ≤ ‖p r‖^2) + (hphase : ∀ r ∈ Icc R E, |(spectralWKBPhase R chi p r).re| ≤ B) + (hJ : (∫ r in R..E, ‖homogeneousSpectralWKBResidual (p r) (v r) (w r)‖/(k r)^2) ≤ J) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q + (spectralScalarField (-chi^2*(p r)^2) (q r)) r) : + let D := spectralWKBFrame R chi p v + let U := spectralWKBFrame R (-chi) p v + let W := (-2 : ℂ)*chi + let C := (5/2 : ℝ)*Real.exp B + spectralShellNorm (k R) + (q R - ((spectralScalarWronskian (q E) (U E)/W) • D R + + (spectralScalarWronskian (D E) (q E)/W) • U R)) ≤ + (2*(C^2)^2*Real.exp (C^2*J)*J)*spectralShellNorm (k E) (q E) := by + dsimp only + have hp0 (r : ℝ) (hr : r ∈ Icc R E) : p r≠0 := by + apply norm_pos_iff.mp + rw [← hkp r hr] + exact sq_pos_of_pos (hk0 r hr) + let e := fun r => -homogeneousSpectralWKBResidual (p r) (v r) (w r) + let V := fun r => -(chi^2*(p r)^2-e r) + let D := spectralWKBFrame R chi p v + let U := spectralWKBFrame R (-chi) p v + let H := fun r => (spectralWKBPhase R chi p r).re + have he : ContinuousOn e (Icc R E) := by + exact ((continuousOn_const.mul ((hv.div hp hp0).pow 2)).sub + (hw.div (continuousOn_const.mul hp) + (fun r hr => mul_ne_zero (by norm_num) (hp0 r hr)))).neg + have hDc := spectralWKBFrame_continuousOn R E hRE chi p v hp hv hp0 + have hUc := spectralWKBFrame_continuousOn R E hRE (-chi) p v hp hv hp0 + have hD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt D (spectralScalarField (V t) (D t)) t := by + simpa only [V,e,sub_neg_eq_add] using + spectralWKBFrame_hasDerivAt R E chi p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + have hU (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt U (spectralScalarField (V t) (U t)) t := by + have hh := spectralWKBFrame_hasDerivAt R E (-chi) p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + simpa only [V,e,sub_neg_eq_add,neg_sq] using hh + have hODE' (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt q (spectralScalarField (V t) (q t)+(0,e t*(q t).1)) t := by + apply (hODE t ht).congr_deriv + apply Prod.ext + · simp only [spectralScalarField,Prod.fst_add,add_zero] + · dsimp only [spectralScalarField,Prod.snd_add,V] + ring + have hnorm : ‖(-2 : ℂ)*chi‖=2 := by rw [norm_mul,hchi,mul_one]; norm_num + have hDb0 (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (D t)≤(5/2 : ℝ)*Real.exp (H t) := by + exact spectralWKBState_shell_bound chi (p t) (v t) _ _ (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + hchi.le (hsmall t ht) + have hUb0 (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp (-H t) := by + have hh := spectralWKBState_shell_bound (-chi) (p t) (v t) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v t) + (spectralWKBPhase R (-chi) p t) (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + (by simpa only [norm_neg] using hchi.le) (hsmall t ht) + have hsre : (spectralWKBPhase R (-chi) p t).re= -H t := by + dsimp only [spectralWKBPhase,H] + rw [neg_mul,Complex.neg_re] + change spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp ((spectralWKBPhase R (-chi) p t).re) at hh + rw [hsre] at hh + exact hh + let C := (5/2 : ℝ)*Real.exp B + have hC : 0 ≤ C := by dsimp only [C]; positivity + have hDb (t : ℝ) (ht : t ∈ Icc R E) : spectralShellNorm (k t) (D t) ≤ C := by + apply (hDb0 t ht).trans + exact mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ((le_abs_self (H t)).trans (hphase t ht))) + (by norm_num) + have hUb (t : ℝ) (ht : t ∈ Icc R E) : spectralShellNorm (k t) (U t) ≤ C := by + apply (hUb0 t ht).trans + exact mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr ((neg_le_abs (H t)).trans (hphase t ht))) + (by norm_num) + have hVc : ContinuousOn V (Icc R E) := + ((continuousOn_const.mul (hp.pow 2)).sub he).neg + have herr := spectral_bounded_frame_terminal_error R E C 2 J hRE hC (by norm_num) + D U q V e ((-2 : ℂ)*chi) k hDc hUc hq hVc he hk hk0 (by rw [hnorm]) + (spectralWKBFrame_wronskian R E hRE chi p v hp hv hp0 hpD) hD hU hODE' hDb hUb + (by simpa only [e,norm_neg] using hJ) + simpa only [C,D,U,show 2*C^2/2=C^2 by ring] using herr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..e221fb1b02757aca78076c974ceb4ef650f24588 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBTransfer.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBConstruction +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWKBFrameBound +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralPerturbedTransfer + +namespace OAI + +/-! Transfer for an actual scalar equation from the explicitly constructed WKB +frame. All frame equations and its nonzero Wronskian are discharged here. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_actual_transfer + (R E : ℝ) (hRE : R≤ E) (chi : ℂ) (hchi : ‖chi‖=1) + (p v w : ℝ → ℂ) (q : ℝ → ℂ × ℂ) (k : ℝ → ℝ) + (hp : ContinuousOn p (Icc R E)) (hv : ContinuousOn v (Icc R E)) + (hw : ContinuousOn w (Icc R E)) (hq : ContinuousOn q (Icc R E)) + (hk : ContinuousOn k (Icc R E)) (hk0 : ∀ r ∈ Icc R E, 0 (spectralWKBPhase R chi p r).re) (Icc R E)) + (hODE : ∀ r ∈ Ioo R E, HasDerivAt q + (spectralScalarField (-chi^2*(p r)^2) (q r)) r) : + ∀ r ∈ Icc R E, spectralShellNorm (k r) (q r)≤ + (25/4 : ℝ)*spectralShellNorm (k R) (q R)* + Real.exp ((spectralWKBPhase R chi p r).re-(spectralWKBPhase R chi p R).re+ + ∫ t in R..r, (25/4 : ℝ)*‖homogeneousSpectralWKBResidual (p t) (v t) (w t)‖/(k t)^2) := by + have hp0 (r : ℝ) (hr : r ∈ Icc R E) : p r≠0 := by + apply norm_pos_iff.mp + rw [← hkp r hr] + exact sq_pos_of_pos (hk0 r hr) + let e := fun r => -homogeneousSpectralWKBResidual (p r) (v r) (w r) + let V := fun r => -(chi^2*(p r)^2-e r) + let D := spectralWKBFrame R chi p v + let U := spectralWKBFrame R (-chi) p v + let H := fun r => (spectralWKBPhase R chi p r).re + have he : ContinuousOn e (Icc R E) := by + exact ((continuousOn_const.mul ((hv.div hp hp0).pow 2)).sub + (hw.div (continuousOn_const.mul hp) + (fun r hr => mul_ne_zero (by norm_num) (hp0 r hr)))).neg + have hDc := spectralWKBFrame_continuousOn R E hRE chi p v hp hv hp0 + have hUc := spectralWKBFrame_continuousOn R E hRE (-chi) p v hp hv hp0 + have hHc : ContinuousOn H (Icc R E) := + Complex.continuous_re.comp_continuousOn (spectralWKBPhase_continuousOn R E hRE chi p hp) + have hD (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt D (spectralScalarField (V t) (D t)) t := by + simpa only [V,e,sub_neg_eq_add] using + spectralWKBFrame_hasDerivAt R E chi p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + have hU (t : ℝ) (ht : t ∈ Ioo R E) : HasDerivAt U (spectralScalarField (V t) (U t)) t := by + have hh := spectralWKBFrame_hasDerivAt R E (-chi) p v hp hv hp0 (w t) t ht (hpD t ht) (hvD t ht) + simpa only [V,e,sub_neg_eq_add,neg_sq] using hh + have hODE' (t : ℝ) (ht : t ∈ Ioo R E) : + HasDerivAt q (spectralScalarField (V t) (q t)+(0,e t*(q t).1)) t := by + apply (hODE t ht).congr_deriv + apply Prod.ext + · simp only [spectralScalarField,Prod.fst_add,add_zero] + · dsimp only [spectralScalarField,Prod.snd_add,V] + ring + have hnorm : ‖(-2 : ℂ)*chi‖=2 := by rw [norm_mul,hchi,mul_one]; norm_num + have hDb (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (D t)≤(5/2 : ℝ)*Real.exp (H t) := by + exact spectralWKBState_shell_bound chi (p t) (v t) _ _ (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + hchi.le (hsmall t ht) + have hUb (t : ℝ) (ht : t ∈ Icc R E) : + spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp (-H t) := by + have hh := spectralWKBState_shell_bound (-chi) (p t) (v t) + (spectralWKBAmplitude R (spectralWKBInitialAmplitude (p R)) p v t) + (spectralWKBPhase R (-chi) p t) (k t) (hk0 t ht) (hkp t ht) + (spectralWKBAmplitude_normalization R E hRE _ p v hp hv hp0 hpD + (spectralWKBInitialAmplitude_normalization (p R) (hp0 R ⟨le_rfl,hRE⟩)) t ht) + (by simpa only [norm_neg] using hchi.le) (hsmall t ht) + have hsre : (spectralWKBPhase R (-chi) p t).re= -H t := by + dsimp only [spectralWKBPhase,H] + rw [neg_mul,Complex.neg_re] + change spectralShellNorm (k t) (U t)≤(5/2 : ℝ)*Real.exp ((spectralWKBPhase R (-chi) p t).re) at hh + rw [hsre] at hh + exact hh + have ht := spectral_perturbed_transfer R E (5/2) 2 hRE (by norm_num) (by norm_num) + D U q V e ((-2 : ℂ)*chi) k H hDc hUc hq he hk hHc hk0 hH + (by rw [hnorm]) + (spectralWKBFrame_wronskian R E hRE chi p v hp hv hp0 hpD) hD hU hODE' hDb hUb + simpa only [e,norm_neg,show (2 : ℝ)*(5/2)^2/2=25/4 by norm_num] using ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBWeightedPrimitives.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBWeightedPrimitives.lean new file mode 100644 index 0000000000000000000000000000000000000000..112592c4107b96f5f3c9e9867d47396c25c889fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWKBWeightedPrimitives.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralIntegralGronwall +import Mathlib.Analysis.Calculus.Deriv.Inv +import Mathlib.Analysis.Calculus.Deriv.Pow + +namespace OAI + +/-! The two exact weighted primitives used in the outer WKB residual integral. -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem spectralWKB_integral_cube (a b : ℝ) (hab : a≤b) (p g : ℝ → ℝ) + (hp : ContinuousOn p (Icc a b)) (hg : ContinuousOn g (Icc a b)) + (hp0 : ∀ t ∈ Icc a b, 0

(-2 : ℝ)*(p t)⁻¹ + have hAc : ContinuousOn A (Icc a b) := continuousOn_const.mul (hp.inv₀ (fun t ht => (hp0 t ht).ne')) + have hAd (t : ℝ) (ht : t ∈ Ioo a b) : HasDerivAt A (g t/(p t)^3) t := by + apply ((hD t ht).inv (hp0 t ⟨ht.1.le,ht.2.le⟩).ne' |>.const_mul (-2)).congr_deriv + field_simp + have hi : IntervalIntegrable (fun t => g t/(p t)^3) volume a b := + ContinuousOn.intervalIntegrable_of_Icc hab + (hg.div (hp.pow 3) (fun t ht => pow_ne_zero _ (hp0 t ht).ne')) + have he := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hab hAc hAd hi + dsimp only [A] at he + calc + _ = -2*(p b)⁻¹-(-2*(p a)⁻¹) := he + _ = _ := by ring + +theorem spectralWKB_integral_fifth (a b : ℝ) (hab : a≤b) (p g : ℝ → ℝ) + (hp : ContinuousOn p (Icc a b)) (hg : ContinuousOn g (Icc a b)) + (hp0 : ∀ t ∈ Icc a b, 0

(-2/3 : ℝ)*((p t)^3)⁻¹ + have hAc : ContinuousOn A (Icc a b) := + continuousOn_const.mul ((hp.pow 3).inv₀ (fun t ht => pow_ne_zero _ (hp0 t ht).ne')) + have hAd (t : ℝ) (ht : t ∈ Ioo a b) : HasDerivAt A (g t/(p t)^5) t := by + apply (((hD t ht).pow 3).inv (pow_ne_zero _ (hp0 t ⟨ht.1.le,ht.2.le⟩).ne') |>.const_mul (-2/3)).congr_deriv + simp only [Pi.pow_apply] + field_simp [(hp0 t ⟨ht.1.le,ht.2.le⟩).ne'] + ring + have hi : IntervalIntegrable (fun t => g t/(p t)^5) volume a b := + ContinuousOn.intervalIntegrable_of_Icc hab + (hg.div (hp.pow 5) (fun t ht => pow_ne_zero _ (hp0 t ht).ne')) + have he := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hab hAc hAd hi + dsimp only [A] at he + calc + _ = (-2/3)*((p b)^3)⁻¹-((-2/3)*((p a)^3)⁻¹) := he + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxConstant.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxConstant.lean new file mode 100644 index 0000000000000000000000000000000000000000..72c4432f3bca446a122d52bbb0011780a4b424f1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxConstant.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralUnitTest + +namespace OAI + +/-! A locally integrable flux with zero weak derivative is constant on an interval. -/ + +open Set MeasureTheory +open scoped ContDiff +namespace DefocusingNLS + +theorem spectralWeakFlux_constant (a b : ℝ) (hab : a < b) (F : ℝ → ℂ) + (hF : LocallyIntegrable F) + (hw : ∀ Φ : ℝ → ℝ, ContDiff ℝ ∞ Φ → HasCompactSupport Φ → + tsupport Φ ⊆ Icc a b → ∫ x, deriv Φ x • F x = 0) : + ∃ c : ℂ, ∀ᵐ x, x ∈ Ioo a b → F x=c := by + obtain ⟨β,hβ,hβc,hβs,hβi⟩ := spectralUnitTest a b hab + let c : ℂ := ∫ x, β x • F x + refine ⟨c,?_⟩ + have hfc : LocallyIntegrable (fun x => F x-c) := hF.sub (locallyIntegrable_const c) + have hz := isOpen_Ioo.ae_eq_zero_of_integral_contDiff_smul_eq_zero + (hfc.locallyIntegrableOn (Ioo a b)) + have ha : ∀ᵐ x, x ∈ Ioo a b → F x-c=0 := by + apply hz + intro φ hφ hφc hφs + let d : ℝ := ∫ x, φ x + let ψ := fun x => φ x-d*β x + have hd : ContDiff ℝ ∞ ψ := hφ.sub (contDiff_const.mul hβ) + have hψs : Function.support ψ ⊆ Ioo a b := by + intro x hx + by_contra h + have h1 : φ x=0 := Function.notMem_support.mp (fun hx => h (hφs (subset_tsupport _ hx))) + have h2 : β x=0 := Function.notMem_support.mp (fun hx => h (hβs (subset_tsupport _ hx))) + exact hx (by simp [ψ,h1,h2]) + have hφi : Integrable φ := hφ.continuous.integrable_of_hasCompactSupport hφc + have hβi' : Integrable β := hβ.continuous.integrable_of_hasCompactSupport hβc + have hψi : ∫ x, ψ x=0 := by + simp only [ψ] + rw [integral_sub hφi (hβi'.const_mul d),integral_const_mul,hβi,mul_one] + exact sub_self d + obtain ⟨Φ,hΦ,hΦc,hΦs,hΦd⟩ := spectralTestPrimitive a b ψ hd hψs hψi + have hp : ∫ x, ψ x • F x=0 := by + simpa only [hΦd] using hw Φ hΦ hΦc hΦs + have hφF := hF.integrable_smul_left_of_hasCompactSupport hφ.continuous hφc + have hβF := hF.integrable_smul_left_of_hasCompactSupport hβ.continuous hβc + have hrel : (∫ x, φ x • F x)=d • c := by + have he : (∫ x, ψ x • F x)=(∫ x, φ x • F x)-d • c := by + have heq : (fun x => ψ x • F x)= + (fun x => φ x • F x-d • (β x • F x)) := by + funext x + dsimp only [ψ] + rw [sub_smul,smul_smul] + rw [heq,integral_sub,integral_smul] + · exact hφF + · exact hβF.smul d + rw [he] at hp + exact sub_eq_zero.mp hp + simp only [smul_sub] + rw [integral_sub hφF (hφi.smul_const c),integral_smul_const,hrel,sub_self] + filter_upwards [ha] with x hx hxab + exact sub_eq_zero.mp (hx hxab) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxPrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..3532663d3bf43d10ca36f926025600900ad14e4d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakFluxPrimitive.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeakFluxConstant +import Mathlib.MeasureTheory.Integral.IntegralEqImproper + +namespace OAI + +/-! The continuous primitive represented by an inhomogeneous weak flux. -/ + +open Set MeasureTheory +open scoped ContDiff +namespace DefocusingNLS + +theorem spectralCompactTest_integrationByParts (φ : ℝ → ℝ) (P G : ℝ → ℂ) + (hφ : ContDiff ℝ ∞ φ) (hφc : HasCompactSupport φ) + (hP : ∀ x, HasDerivAt P (G x) x) (hG : Continuous G) : + (∫ x, deriv φ x • P x) = -(∫ x, φ x • G x) := by + have hPc : Continuous P := (show Differentiable ℝ P from fun x => (hP x).differentiableAt).continuous + have hφd : Continuous (deriv φ) := hφ.continuous_deriv (by simp) + have hp := integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable + (L := ContinuousLinearMap.lsmul ℝ ℝ) + (fun x _ => (hφ.differentiable (by simp) x).hasDerivAt) + (fun x _ => hP x) + (hG.locallyIntegrable.integrable_smul_left_of_hasCompactSupport hφ.continuous hφc) + (hPc.locallyIntegrable.integrable_smul_left_of_hasCompactSupport hφd hφc.deriv) + (hPc.locallyIntegrable.integrable_smul_left_of_hasCompactSupport hφ.continuous hφc) + simpa only [neg_neg,ContinuousLinearMap.lsmul_apply] using congrArg Neg.neg hp.symm + +theorem spectralWeakFlux_primitive (a b : ℝ) (hab : a < b) (F G : ℝ → ℂ) + (hF : LocallyIntegrable F) (hG : Continuous G) + (hw : ∀ φ : ℝ → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → + tsupport φ ⊆ Icc a b → (∫ x, deriv φ x • F x) = -(∫ x, φ x • G x)) : + ∃ P : ℝ → ℂ, (∀ x, HasDerivAt P (G x) x) ∧ + ∀ᵐ x, x ∈ Ioo a b → F x=P x := by + let P := fun t => ∫ x in a..t, G x + have hd (x : ℝ) : HasDerivAt P (G x) x := + intervalIntegral.integral_hasDerivAt_right (hG.intervalIntegrable a x) + hG.aestronglyMeasurable.stronglyMeasurableAtFilter hG.continuousAt + have hc : Continuous P := (show Differentiable ℝ P from fun x => (hd x).differentiableAt).continuous + obtain ⟨c,he⟩ := spectralWeakFlux_constant a b hab (fun x => F x-P x) + (hF.sub (hc.locallyIntegrable (μ := volume))) (by + intro φ hφ hφc hφs + have h1 := hF.integrable_smul_left_of_hasCompactSupport + (hφ.continuous_deriv (by simp)) hφc.deriv + have h2 := (hc.locallyIntegrable (μ := volume)).integrable_smul_left_of_hasCompactSupport + (hφ.continuous_deriv (by simp)) hφc.deriv + simp only [smul_sub] + rw [integral_sub h1 h2,hw φ hφ hφc hφs, + spectralCompactTest_integrationByParts φ P G hφ hφc hd hG,sub_self]) + refine ⟨fun x => P x+c,fun x => (hd x).add_const c,?_⟩ + filter_upwards [he] with x hx hxab + have heq : F x=c+P x := sub_eq_iff_eq_add.mp (hx hxab) + simpa only [add_comm] using heq + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakJointLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakJointLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8893fe7342a06d3dcf3f1816a248a53f404aa368 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakJointLimit.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLowerOrderOperator + +namespace OAI + +/-! Product-filter versions of the weak-operator limit, for joint convergence +in power and spectral parameter. -/ + +open Filter Topology +namespace DefocusingNLS +theorem spectralComposition_tendsto_filter {ι E F G : Type*} + [NormedAddCommGroup E] [NormedSpace ℂ E] + [NormedAddCommGroup F] [NormedSpace ℂ F] + [NormedAddCommGroup G] [NormedSpace ℂ G] + (p : Filter ι) (T : ι → F →L[ℂ] G) (T₀ : F →L[ℂ] G) + (K : ι → E →L[ℂ] F) (K₀ : E →L[ℂ] F) + (hT : Tendsto T p (𝓝 T₀)) (hK : Tendsto K p (𝓝 K₀)) : + Tendsto (fun i => (T i).comp (K i)) p (𝓝 (T₀.comp K₀)) := by + exact ((ContinuousLinearMap.compL ℂ E F G).continuous₂.continuousAt.tendsto).comp + (hT.prodMk_nhds hK) + + +theorem spectralSandwich_tendsto_filter {ι E F G : Type*} (p : Filter ι) + [NormedAddCommGroup E] [NormedSpace ℂ E] + [NormedAddCommGroup F] [NormedSpace ℂ F] + [NormedAddCommGroup G] [NormedSpace ℂ G] + (A : F →L[ℂ] G) (B : E →L[ℂ] F) + (Q : ι → F →L[ℂ] F) (Q₀ : F →L[ℂ] F) + (hQ : Tendsto Q p (𝓝 Q₀)) : + Tendsto (fun n => (A.comp (Q n)).comp B) p (𝓝 ((A.comp Q₀).comp B)) := by + exact spectralComposition_tendsto_filter p _ _ _ _ + (spectralComposition_tendsto_filter p (fun _ => A) A Q Q₀ tendsto_const_nhds hQ) + tendsto_const_nhds + +theorem spectralWeakOperator_tendsto_filter {ι E F : Type*} (p : Filter ι) + [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + (V D : E →L[ℂ] F × F) (T : E →L[ℂ] ℂ × ℂ) + (Q A : ι → F →L[ℂ] F) + (Q₀ A₀ : F →L[ℂ] F) + (hQ : Tendsto Q p (𝓝 Q₀)) (hA : Tendsto A p (𝓝 A₀)) + (c ζ : ι → ℂ) (c₀ ζ₀ : ℂ) + (hc : Tendsto c p (𝓝 c₀)) (hζ : Tendsto ζ p (𝓝 ζ₀)) + (B : ι → ℂ × ℂ →L[ℂ] ℂ × ℂ) (B₀ : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hB : Tendsto B p (𝓝 B₀)) : + Tendsto (fun n => spectralWeakOperator V D T (Q n) (A n) (c n) (ζ n) (B n)) + p (𝓝 (spectralWeakOperator V D T Q₀ A₀ c₀ ζ₀ B₀)) := by + let RV := spectralPairRiesz V + let RD := spectralPairRiesz D + let RT := spectralPairRiesz T + let P := ContinuousLinearMap.fst ℂ (F × F) (ℂ × ℂ) + let H := ContinuousLinearMap.snd ℂ (F × F) (ℂ × ℂ) + let J := spectralPairSkew (F) + have hQQ : Tendsto (fun n => (Q n).prodMap (Q n)) p (𝓝 (Q₀.prodMap Q₀)) := + ((ContinuousLinearMap.prodMapL ℂ (F) (F) + (F) (F)).continuous.continuousAt.tendsto).comp + (hQ.prodMk_nhds hQ) + have hAA : Tendsto (fun n => (A n).prodMap (A n)) p (𝓝 (A₀.prodMap A₀)) := + ((ContinuousLinearMap.prodMapL ℂ (F) (F) + (F) (F)).continuous.continuousAt.tendsto).comp + (hA.prodMk_nhds hA) + have hmass := spectralSandwich_tendsto_filter p RV P _ _ hQQ + have hskew := spectralSandwich_tendsto_filter p RV (J.comp P) _ _ hQQ + have htransport := spectralSandwich_tendsto_filter p RD (J.comp P) _ _ hAA + have hboundary := spectralSandwich_tendsto_filter p RT H B B₀ hB + exact ((hmass.add ((hc.sub hζ).smul hskew)).add htransport).add hboundary + +theorem spectralLowerOrderOperator_tendsto_filter {ι : Type*} (p : Filter ι) (ell : ℕ) (R : ℝ) (hR : 0 < R) + (Q A : ι → SpectralRadialL2 R →L[ℂ] SpectralRadialL2 R) + (Q₀ A₀ : SpectralRadialL2 R →L[ℂ] SpectralRadialL2 R) + (hQ : Tendsto Q p (𝓝 Q₀)) (hA : Tendsto A p (𝓝 A₀)) + (c ζ : ι → ℂ) (c₀ ζ₀ : ℂ) + (hc : Tendsto c p (𝓝 c₀)) (hζ : Tendsto ζ p (𝓝 ζ₀)) + (B : ι → ℂ × ℂ →L[ℂ] ℂ × ℂ) (B₀ : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hB : Tendsto B p (𝓝 B₀)) : + Tendsto (fun n => spectralLowerOrderOperator ell R hR (Q n) (A n) (c n) (ζ n) (B n)) + p (𝓝 (spectralLowerOrderOperator ell R hR Q₀ A₀ c₀ ζ₀ B₀)) := by + unfold spectralLowerOrderOperator + exact spectralWeakOperator_tendsto_filter p _ _ _ _ _ _ _ hQ hA _ _ _ _ hc hζ _ _ hB + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobin.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobin.lean new file mode 100644 index 0000000000000000000000000000000000000000..48828306fb4e6cc0ce962e967aee9e1be9a2e82c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobin.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFirstClosedBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClosedClassicalExtension +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFluxRobin +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRepresentativeTrace + +namespace OAI + +/-! The exact variational equation implies the Robin condition on classical endpoint extensions. -/ + +open Set +namespace DefocusingNLS + +theorem spectralWeakEquation_robin (ell : ℕ) (R l δ : ℝ) (hR : 0 < R) + (hl : 0 < l) (hlδ : l < δ) (hδR : δ < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (M : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (hwc : ContinuousOn w.density (Icc δ R)) (hac : ContinuousOn a.density (Icc δ R)) + (hpos : ∀ x ∈ Ioo 0 R, 0 < w.density x) (hposc : ∀ x ∈ Icc δ R, 0 < w.density x) + (he : ∀ v : spectralHarmonicCoreSubspace ell R l, + spectralHarmonicPairComplexForm ell R w u v= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ + (spectralFluxBoundary R (w.density R) (a.density R) M) + (spectralHarmonicObservation ell R hR u)) v) : + ∃ f g : ℝ → ℂ, Continuous f ∧ Continuous g ∧ + EqOn f (spectralHarmonicRepresentative ell R hR u.fst) (Icc δ R) ∧ + EqOn g (spectralHarmonicRepresentative ell R hR u.snd) (Icc δ R) ∧ + (deriv f R,deriv g R)=M (f R,g R) := by + let B := spectralFluxBoundary R (w.density R) (a.density R) M + obtain ⟨Pf,hPf,_,_,hfluxf,hPfR⟩ := spectralFirst_closedBoundary ell R l δ hR hl hlδ hδR + w a u c ζ B hw ha hwc hpos he + obtain ⟨Pg,hPg,_,_,hfluxg,hPgR⟩ := spectralSecond_closedBoundary ell R δ hR + (hl.trans hlδ) hδR w a u c ζ B hw ha hwc hpos + (fun t => he ⟨spectralSecondTest ell R t,spectralSecondTest_core ell R l t⟩) + obtain ⟨f,hf,_,hef,hfR⟩ := spectralSecond_closedExtension ell R δ hR (hl.trans hlδ) hδR + w (spectralNegWeight a) (spectralSwapPair ell R u) Pf hPf hwc hac.neg hposc hfluxf + obtain ⟨g,hg,_,heg,hgR⟩ := spectralSecond_closedExtension ell R δ hR (hl.trans hlδ) hδR + w a u Pg hPg hwc hac hposc hfluxg + change EqOn f (spectralHarmonicRepresentative ell R hR u.fst) (Icc δ R) at hef + have hsf : (spectralSwapPair ell R u).fst=u.snd := rfl + rw [hsf] at hfR + have hfr : f R=spectralHarmonicRepresentative ell R hR u.fst R := hef ⟨hδR.le,le_rfl⟩ + have hgr : g R=spectralHarmonicRepresentative ell R hR u.snd R := heg ⟨hδR.le,le_rfl⟩ + have htrace : (f R,g R)=spectralHarmonicPairTraces ell R hR u := by + rw [hfr,hgr] + exact spectralHarmonicRepresentative_trace ell R hR u + refine ⟨f,g,hf,hg,hef,heg,?_⟩ + apply (spectralFluxBoundary_condition R (w.density R) (a.density R) + hR.ne' (hposc R ⟨hδR.le,le_rfl⟩).ne' M (f R,g R) (deriv f R,deriv g R)).mp + apply Prod.ext + · change (R : ℂ)^11*((w.density R : ℂ)*deriv f R-(a.density R : ℂ)*g R)= + (B (f R,g R)).1 + rw [htrace,← hPfR,hgr] + convert hfR using 1 + simp only [spectralNegWeight,Complex.ofReal_neg,neg_mul,sub_eq_add_neg] + · change (R : ℂ)^11*((w.density R : ℂ)*deriv g R+(a.density R : ℂ)*f R)= + (B (f R,g R)).2 + rw [htrace,← hPgR,hfr] + exact hgR + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobinC1.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobinC1.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a7f63213636fa5c1d7c945b7a68bc9583032a33 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakRobinC1.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFirstClosedBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClosedExtensionRegularity +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFluxRobin +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRepresentativeTrace + +namespace OAI + +/-! The exact variational equation gives a Robin extension with continuous endpoint derivatives. -/ + +open Set +namespace DefocusingNLS + +theorem spectralWeakEquation_robin_C1 (ell : ℕ) (R l δ : ℝ) (hR : 0 < R) + (hl : 0 < l) (hlδ : l < δ) (hδR : δ < R) + (w a : SpectralHarmonicWeight R) (u : SpectralHarmonicPair ell R) (c ζ : ℂ) + (M : ℂ × ℂ →L[ℂ] ℂ × ℂ) + (hw : ContinuousOn w.density (Ioo 0 R)) (ha : ContinuousOn a.density (Ioo 0 R)) + (hwc : ContinuousOn w.density (Icc δ R)) (hac : ContinuousOn a.density (Icc δ R)) + (hpos : ∀ x ∈ Ioo 0 R, 0 < w.density x) (hposc : ∀ x ∈ Icc δ R, 0 < w.density x) + (he : ∀ v : spectralHarmonicCoreSubspace ell R l, + spectralHarmonicPairComplexForm ell R w u v= + inner ℂ (spectralLowerOrderOperator ell R hR + (spectralRadialWeightMultiplier R w) (spectralRadialWeightMultiplier R a) c ζ + (spectralFluxBoundary R (w.density R) (a.density R) M) + (spectralHarmonicObservation ell R hR u)) v) : + ∃ f g : ℝ → ℂ, Continuous f ∧ Continuous g ∧ + ContinuousOn (deriv f) (Icc δ R) ∧ ContinuousOn (deriv g) (Icc δ R) ∧ + EqOn f (spectralHarmonicRepresentative ell R hR u.fst) (Icc δ R) ∧ + EqOn g (spectralHarmonicRepresentative ell R hR u.snd) (Icc δ R) ∧ + (deriv f R,deriv g R)=M (f R,g R) := by + let B := spectralFluxBoundary R (w.density R) (a.density R) M + obtain ⟨Pf,hPf,_,_,hfluxf,hPfR⟩ := spectralFirst_closedBoundary ell R l δ hR hl hlδ hδR + w a u c ζ B hw ha hwc hpos he + obtain ⟨Pg,hPg,_,_,hfluxg,hPgR⟩ := spectralSecond_closedBoundary ell R δ hR + (hl.trans hlδ) hδR w a u c ζ B hw ha hwc hpos + (fun t => he ⟨spectralSecondTest ell R t,spectralSecondTest_core ell R l t⟩) + obtain ⟨f,hf,hdf,_,hef,hfR⟩ := spectralSecond_closedExtension_C1 ell R δ hR (hl.trans hlδ) hδR + w (spectralNegWeight a) (spectralSwapPair ell R u) Pf hPf hwc hac.neg hposc hfluxf + obtain ⟨g,hg,hdg,_,heg,hgR⟩ := spectralSecond_closedExtension_C1 ell R δ hR (hl.trans hlδ) hδR + w a u Pg hPg hwc hac hposc hfluxg + change EqOn f (spectralHarmonicRepresentative ell R hR u.fst) (Icc δ R) at hef + have hsf : (spectralSwapPair ell R u).fst=u.snd := rfl + rw [hsf] at hfR + have hfr : f R=spectralHarmonicRepresentative ell R hR u.fst R := hef ⟨hδR.le,le_rfl⟩ + have hgr : g R=spectralHarmonicRepresentative ell R hR u.snd R := heg ⟨hδR.le,le_rfl⟩ + have htrace : (f R,g R)=spectralHarmonicPairTraces ell R hR u := by + rw [hfr,hgr] + exact spectralHarmonicRepresentative_trace ell R hR u + refine ⟨f,g,hf,hg,hdf,hdg,hef,heg,?_⟩ + apply (spectralFluxBoundary_condition R (w.density R) (a.density R) + hR.ne' (hposc R ⟨hδR.le,le_rfl⟩).ne' M (f R,g R) (deriv f R,deriv g R)).mp + apply Prod.ext + · change (R : ℂ)^11*((w.density R : ℂ)*deriv f R-(a.density R : ℂ)*g R)= + (B (f R,g R)).1 + rw [htrace,← hPfR,hgr] + convert hfR using 1 + simp only [spectralNegWeight,Complex.ofReal_neg,neg_mul,sub_eq_add_neg] + · change (R : ℂ)^11*((w.density R : ℂ)*deriv g R+(a.density R : ℂ)*f R)= + (B (f R,g R)).2 + rw [htrace,← hPgR,hfr] + exact hgR + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakSubsequence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakSubsequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ea3b71acc2c536a0a65a03654a27232e35b4e70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeakSubsequence.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCompactWeak +import Mathlib.Analysis.Normed.Module.WeakDual +import Mathlib.Analysis.InnerProductSpace.Dual + +namespace OAI + +/-! Weak subsequences and compact observations for the real variational domain. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem spectralRealHilbert_weak_subsequence {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℝ E] [CompleteSpace E] [TopologicalSpace.SeparableSpace E] + (u : ℕ → E) (M : ℝ) (hu : ∀ n, ‖u n‖ ≤ M) : + ∃ v : E, ‖v‖ ≤ M ∧ ∃ φ : ℕ → ℕ, StrictMono φ ∧ + ∀ L : E →L[ℝ] ℝ, Tendsto (fun n => L (u (φ n))) atTop (𝓝 (L v)) := by + let R := InnerProductSpace.toDual ℝ E + let w : ℕ → WeakDual ℝ E := fun n => (R (u n)).toWeakDual + have hw (n : ℕ) : w n ∈ WeakDual.toStrongDual ⁻¹' Metric.closedBall 0 M := by + change R (u n) ∈ Metric.closedBall 0 M + simpa only [Metric.mem_closedBall,dist_zero_right,R.norm_map] using hu n + obtain ⟨v',hv',φ,hφ,ht⟩ := (WeakDual.isSeqCompact_closedBall ℝ E 0 M) hw + let v := R.symm v'.toStrongDual + have hv : ‖v‖ ≤ M := by + change ‖R.symm v'.toStrongDual‖ ≤ M + rw [R.symm.norm_map] + simpa only [mem_preimage,Metric.mem_closedBall,dist_zero_right] using hv' + refine ⟨v,hv,φ,hφ,fun L => ?_⟩ + let x := R.symm L + have hn (n : ℕ) : w (φ n) x=L (u (φ n)) := by + change inner ℝ (u (φ n)) x=L (u (φ n)) + rw [real_inner_comm] + exact InnerProductSpace.toDual_symm_apply + have hvx : v' x=L v := by + have he : R v=v'.toStrongDual := R.apply_symm_apply _ + change v'.toStrongDual x=L v + rw [← he] + change inner ℝ v x=L v + rw [real_inner_comm] + exact InnerProductSpace.toDual_symm_apply + have h := (WeakDual.eval_continuous x).continuousAt.tendsto.comp ht + simpa only [Function.comp_def,hn,hvx] using h + +theorem spectralCompact_weakSequence {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] (T : E →L[ℝ] F) (hT : IsCompactOperator T) + (u : ℕ → E) (u₀ : E) (M : ℝ) (hu : ∀ n, ‖u n‖ ≤ M) + (hweak : ∀ L : E →L[ℝ] ℝ, Tendsto (fun n => L (u n)) atTop (𝓝 (L u₀))) : + Tendsto (fun n => T (u n)) atTop (𝓝 (T u₀)) := by + have hb (n : ℕ) : ‖u n-u₀‖ ≤ M+‖u₀‖ := + (norm_sub_le _ _).trans (add_le_add (hu n) le_rfl) + have hw (L : E →L[ℝ] ℝ) : Tendsto (fun n => L (u n-u₀)) atTop (𝓝 0) := by + simpa only [map_sub,sub_self] using (hweak L).sub_const (L u₀) + have h := spectralCompact_weakNull T hT (fun n => u n-u₀) (M+‖u₀‖) hb hw + simpa only [map_sub,sub_add_cancel,zero_add] using h.add_const (T u₀) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightExt.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightExt.lean new file mode 100644 index 0000000000000000000000000000000000000000..67027196c122b819e97ab29c7b2aa6b52c1fc3c7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightExt.lean @@ -0,0 +1,25 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralComplexMultiplierLimit + +namespace OAI + +/-! The coefficient multiplier depends only on the density. -/ + +open MeasureTheory +namespace DefocusingNLS + +theorem spectralRadialWeightMultiplier_eq_of_density (R : ℝ) + (w v : SpectralHarmonicWeight R) (h : w.density=v.density) : + spectralRadialWeightMultiplier R w=spectralRadialWeightMultiplier R v := by + apply ContinuousLinearMap.ext + intro f + apply Lp.ext + filter_upwards [spectralL2ComplexMultiplier_ae (radialPressureMeasure R) w.density + w.radial_measurable w.bound w.radial_bound f, + spectralL2ComplexMultiplier_ae (radialPressureMeasure R) v.density + v.radial_measurable v.bound v.radial_bound f] with r hw hv + dsimp only [spectralRadialWeightMultiplier] + rw [hw,hv,h] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCircularEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCircularEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..747e4e6a97a5f7713df91c3e6eeb6a517c21190f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCircularEquation.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeGaugeAlgebra + +namespace OAI + +/-! Classical circular equation obtained from the weighted divergence flux. -/ + +namespace DefocusingNLS + +noncomputable def spectralWeightedCircularFlux (σ : ℂ) (μ A : ℝ → ℝ) + (u : ℝ → ℂ) (r : ℝ) : ℂ := + (r : ℂ)^11*((μ r : ℂ)*deriv u r+σ*Complex.I*(A r : ℂ)*u r) + +theorem spectralWeightedCircularEquation (σ ζ η : ℂ) (μ A : ℝ → ℝ) + (u : ℝ → ℂ) (r dμ : ℝ) (hr : r ≠ 0) + (hμ : HasDerivAt μ dμ r) + (hA : HasDerivAt A (6*μ r-11/r*A r) r) + (hu : DifferentiableAt ℝ u r) (hDu : DifferentiableAt ℝ (deriv u) r) + (hF : HasDerivAt (spectralWeightedCircularFlux σ μ A u) + (η*(r : ℂ)^9*(μ r : ℂ)*u r+ + σ*Complex.I*(6-ζ)*(r : ℂ)^11*(μ r : ℂ)*u r) r) : + (μ r : ℂ)*deriv (deriv u) r+ + (11*(μ r : ℂ)/(r : ℂ)+(dμ : ℂ)+σ*Complex.I*(A r : ℂ))*deriv u r+ + (σ*Complex.I*ζ*(μ r : ℂ)-η*(μ r : ℂ)/(r : ℂ)^2)*u r=0 := by + have hd := (((hasDerivAt_id r).ofReal_comp).pow 11).mul + ((hμ.ofReal_comp.mul hDu.hasDerivAt).add + ((hA.ofReal_comp.const_mul (σ*Complex.I)).mul hu.hasDerivAt)) + have he := hd.unique hF + dsimp only [id_eq,Pi.pow_apply,Pi.mul_apply,Pi.add_apply] at he + push_cast at he + have hrC : (r : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hr + linear_combination (norm := (field_simp [hrC]; ring_nf)) (1/(r : ℂ)^11)*he + +theorem spectralFreeGaugeJet_hasDerivAt (σ b ζ η : ℂ) (μ A : ℝ → ℝ) + (Q u : ℝ → ℂ) (r dμ : ℝ) (hr : r ≠ 0) (hμn : μ r ≠ 0) + (hμ : HasDerivAt μ dμ r) + (hA : HasDerivAt A (6*μ r-11/r*A r) r) + (hQ : DifferentiableAt ℝ Q r) (hDQ : DifferentiableAt ℝ (deriv Q) r) + (hu : DifferentiableAt ℝ u r) (hDu : DifferentiableAt ℝ (deriv u) r) + (hQE : deriv (deriv Q) r+(11/(r : ℂ)+σ*Complex.I*(r : ℂ)/2)*deriv Q r+b*Q r=0) + (hC : ((dμ : ℂ)+σ*Complex.I*(A r : ℂ))*Q r= + (μ r : ℂ)*(2*deriv Q r+σ*Complex.I*(r : ℂ)/2*Q r)) + (hF : HasDerivAt (spectralWeightedCircularFlux σ μ A u) + (η*(r : ℂ)^9*(μ r : ℂ)*u r+ + σ*Complex.I*(6-ζ)*(r : ℂ)^11*(μ r : ℂ)*u r) r) : + HasDerivAt (fun t => (Q t*u t,deriv Q t*u t+Q t*deriv u t)) + (deriv Q r*u r+Q r*deriv u r, + -(11/(r : ℂ)+σ*Complex.I*(r : ℂ)/2)*(deriv Q r*u r+Q r*deriv u r)- + (b+σ*Complex.I*ζ-η/(r : ℂ)^2)*(Q r*u r)) r := by + have hU := spectralWeightedCircularEquation σ ζ η μ A u r dμ hr hμ hA hu hDu hF + have he := spectralFreeGauge_algebra (r : ℂ) (μ r : ℂ) (dμ : ℂ) (A r : ℂ) + σ b ζ η (Q r) (deriv Q r) (deriv (deriv Q) r) (u r) (deriv u r) + (deriv (deriv u) r) (Complex.ofReal_ne_zero.mpr hμn) hQE hC hU + apply ((hQ.hasDerivAt.mul hu.hasDerivAt).prodMk + ((hDQ.hasDerivAt.mul hu.hasDerivAt).add (hQ.hasDerivAt.mul hDu.hasDerivAt))).congr_deriv + apply Prod.ext + · rfl + · dsimp only + linear_combination he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoefficientLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoefficientLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b9181eb37f0e1d5591a92a171ca5e237d7557af --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoefficientLimit.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralSubunitDifference +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFieldOperator + +namespace OAI + +/-! The normalized coefficient error tends to zero in the bounded-function +norm when the profile's weighted expansion remainder stays bounded. -/ + +open Filter Topology +open scoped BoundedContinuousFunction +namespace DefocusingNLS + +theorem exists_spectral_weighted_coefficient_limit + (m : ℕ → ℕ) (hm : ∀ n, 1 ≤ m n) (hmTop : Tendsto m atTop atTop) + (q p : ℕ → ℝ → ℂ) (hq : ∀ n, Continuous (q n)) (hp : ∀ n, Continuous (p n)) + (κ T ρ C : ℝ) (hρ : 0 < ρ) (hρ1 : ρ < 1) (hC : 0 ≤ C) + (e : ℕ → ℝ →ᵇ ℂ) (he : ∀ n, ‖e n‖ ≤ C) + (hqb : ∀ n t, T ≤ t → ‖q n t‖ ≤ ρ) + (hpb : ∀ n t, T ≤ t → ‖p n t‖ ≤ ρ) + (hqp : ∀ n t, T ≤ t → q n t-p n t=(Real.exp (-κ*t) : ℂ)*e n t) : + ∃ A B : ℕ → ℝ →ᵇ ℂ, Tendsto A atTop (𝓝 0) ∧ Tendsto B atTop (𝓝 0) ∧ + ∀ n t, T ≤ t → + A n t=(Real.exp (κ*t) : ℂ)* + (spectralDiagonalCoefficient (m n) (q n t)-spectralDiagonalCoefficient (m n) (p n t)) ∧ + B n t=(Real.exp (κ*t) : ℂ)* + (spectralCrossCoefficient (m n) (q n t)-spectralCrossCoefficient (m n) (p n t)) := by + let δ := fun n => 2*(m n : ℝ)*(2*(m n : ℝ)+1)*ρ^(2*m n)/ρ + have hδ (n : ℕ) : 0 ≤ δ n := by dsimp [δ]; positivity + have hδ0 : Tendsto δ atTop (𝓝 0) := + (spectralCoefficient_difference_rate_tendsto ρ hρ hρ1).comp hmTop + let f := fun n t => (Real.exp (κ*max T t) : ℂ)* + (spectralDiagonalCoefficient (m n) (q n (max T t))- + spectralDiagonalCoefficient (m n) (p n (max T t))) + let g := fun n t => (Real.exp (κ*max T t) : ℂ)* + (spectralCrossCoefficient (m n) (q n (max T t))- + spectralCrossCoefficient (m n) (p n (max T t))) + have hf (n : ℕ) : Continuous (f n) := by + dsimp [f,spectralDiagonalCoefficient] + fun_prop + have hg (n : ℕ) : Continuous (g n) := by + dsimp [g,spectralCrossCoefficient] + fun_prop + have hb (n : ℕ) (t : ℝ) : ‖f n t‖+‖g n t‖ ≤ δ n*C := by + have ht : T ≤ max T t := le_max_left _ _ + have hh := spectralCoefficient_weighted_difference (m n) (hm n) ρ hρ + (q n (max T t)) (p n (max T t)) (e n (max T t)) κ (max T t) + (hqb n _ ht) (hpb n _ ht) (hqp n _ ht) + exact hh.trans (mul_le_mul_of_nonneg_left ((e n).norm_coe_le_norm (max T t) |>.trans (he n)) (hδ n)) + let A := fun n => BoundedContinuousFunction.ofNormedAddCommGroup + (f n) (hf n) (δ n*C) (fun t => (le_add_of_nonneg_right (norm_nonneg (g n t))).trans (hb n t)) + let B := fun n => BoundedContinuousFunction.ofNormedAddCommGroup + (g n) (hg n) (δ n*C) (fun t => (le_add_of_nonneg_left (norm_nonneg (f n t))).trans (hb n t)) + have hA (n : ℕ) : ‖A n‖ ≤ δ n*C := by + apply (BoundedContinuousFunction.norm_le (mul_nonneg (hδ n) hC)).mpr + intro t + exact (le_add_of_nonneg_right (norm_nonneg (g n t))).trans (hb n t) + have hB (n : ℕ) : ‖B n‖ ≤ δ n*C := by + apply (BoundedContinuousFunction.norm_le (mul_nonneg (hδ n) hC)).mpr + intro t + exact (le_add_of_nonneg_left (norm_nonneg (f n t))).trans (hb n t) + have hlim : Tendsto (fun n => δ n*C) atTop (𝓝 0) := by + simpa only [zero_mul] using hδ0.mul_const C + refine ⟨A,B,squeeze_zero_norm hA hlim,squeeze_zero_norm hB hlim,?_⟩ + intro n t ht + constructor + · change f n t = _ + dsimp only [f] + rw [max_eq_right ht] + · change g n t = _ + dsimp only [g] + rw [max_eq_right ht] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoreWeak.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoreWeak.lean new file mode 100644 index 0000000000000000000000000000000000000000..effea10b4cebfd8b3c25c92a5d8536bd4bba6b26 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedCoreWeak.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicCoreInverse +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeakSubsequence + +namespace OAI + +/-! Compact observations of the weighted constrained inverse converge for weak inputs. -/ + +open MeasureTheory Filter Topology +namespace DefocusingNLS + +theorem spectralHarmonicObservation_weakSequence (ell : ℕ) (R : ℝ) (hR : 0 < R) + (u : ℕ → SpectralHarmonicPair ell R) (u₀ : SpectralHarmonicPair ell R) + (M : ℝ) (hu : ∀ n, ‖u n‖ ≤ M) + (hweak : ∀ L : SpectralHarmonicPair ell R →L[ℝ] ℝ, + Tendsto (fun n => L (u n)) atTop (𝓝 (L u₀))) : + Tendsto (fun n => spectralHarmonicObservation ell R hR (u n)) atTop + (𝓝 (spectralHarmonicObservation ell R hR u₀)) := by + exact spectralCompact_weakSequence ((spectralHarmonicObservation ell R hR).restrictScalars ℝ) + (spectralHarmonicObservation_compact ell R hR) u u₀ M hu hweak + +theorem spectralHarmonicFirstValue_weakSequence (ell : ℕ) (R : ℝ) (hR : 0 < R) + (u : ℕ → SpectralHarmonicPair ell R) (u₀ : SpectralHarmonicPair ell R) + (M : ℝ) (hu : ∀ n, ‖u n‖ ≤ M) + (hweak : ∀ L : SpectralHarmonicPair ell R →L[ℝ] ℝ, + Tendsto (fun n => L (u n)) atTop (𝓝 (L u₀))) : + Tendsto (fun n => spectralHarmonicFirstValue ell R (u n)) atTop + (𝓝 (spectralHarmonicFirstValue ell R u₀)) := by + have hp : Continuous (fun z : SpectralRadialObservationSpace R => z.1.1) := + continuous_fst.fst + exact hp.continuousAt.tendsto.comp + (spectralHarmonicObservation_weakSequence ell R hR u u₀ M hu hweak) + +theorem spectralHarmonicCoreInverse_weak_input (ell : ℕ) (R l : ℝ) (hR : 0 < R) + (w : SpectralHarmonicWeight R) (c : ℝ) (hc : 0 < c) + (hcr : ∀ᵐ r ∂radialPressureMeasure R, c ≤ w.density r) + (hca : ∀ᵐ r ∂spectralAngularMeasure R, c ≤ w.density r) + (F : ℕ → StrongDual ℝ (SpectralHarmonicPair ell R)) + (F₀ : StrongDual ℝ (SpectralHarmonicPair ell R)) (M : ℝ) (hF : ∀ n, ‖F n‖ ≤ M) + (hweak : ∀ L : StrongDual ℝ (SpectralHarmonicPair ell R) →L[ℝ] ℝ, + Tendsto (fun n => L (F n)) atTop (𝓝 (L F₀))) : + Tendsto (fun n => spectralHarmonicObservation ell R hR + (spectralHarmonicCoreInverse ell R l w c hc hcr hca (F n))) atTop + (𝓝 (spectralHarmonicObservation ell R hR + (spectralHarmonicCoreInverse ell R l w c hc hcr hca F₀))) := by + let T := spectralHarmonicCoreInverse ell R l w c hc hcr hca + apply spectralHarmonicObservation_weakSequence ell R hR (fun n => T (F n)) (T F₀) (M/c) + · intro n + exact (spectralHarmonicCoreInverse_norm ell R l w c hc hcr hca (F n)).trans + (div_le_div_of_nonneg_right (hF n) hc.le) + · intro L + exact hweak (L.comp T) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedFluxBalance.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedFluxBalance.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f16dc9ad773772d09a74821f06e740310e052be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedFluxBalance.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalTestForms +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralAngularComplexIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralClassicalFluxTesting +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralGaugeClassicalFlux + +namespace OAI + +/-! The dimension-twelve classical flux identity in the exact weighted test form. -/ + +open Set MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralClassicalRadialPairing_interval (R : ℝ) (hR : 0 ≤ R) + (q : ℝ → ℝ) (f φ : ℝ → ℂ) : + spectralClassicalRadialPairing R q f φ= + ∫ r in (0 : ℝ)..R, (r : ℂ)^11*star (φ r)*(q r : ℂ)*f r := by + rw [spectralClassicalRadialPairing,spectral_radial_complex_integral R hR] + apply intervalIntegral.integral_congr + intro r _ + simp only [Complex.real_smul] + ring + +theorem spectralClassicalAngularPairing_interval (R : ℝ) (hR : 0 ≤ R) + (q : ℝ → ℝ) (f φ : ℝ → ℂ) : + spectralClassicalAngularPairing R q f φ= + ∫ r in (0 : ℝ)..R, (r : ℂ)^9*star (φ r)*(q r : ℂ)*f r := by + rw [spectralClassicalAngularPairing,spectral_angular_complex_integral R hR] + apply intervalIntegral.integral_congr + intro r _ + simp only [Complex.real_smul] + ring + +private theorem integral_linear_five (R : ℝ) (f₁ f₂ f₃ f₄ f₅ : ℝ → ℂ) + (h₁ : Continuous f₁) (h₂ : Continuous f₂) (h₃ : Continuous f₃) + (h₄ : Continuous f₄) (h₅ : Continuous f₅) (a b : ℂ) : + (∫ r in (0 : ℝ)..R, f₁ r-f₂ r+a*f₃ r+f₄ r+b*f₅ r)= + (∫ r in (0 : ℝ)..R, f₁ r)-(∫ r in (0 : ℝ)..R, f₂ r)+ + a*(∫ r in (0 : ℝ)..R, f₃ r)+(∫ r in (0 : ℝ)..R, f₄ r)+ + b*(∫ r in (0 : ℝ)..R, f₅ r) := by + rw [intervalIntegral.integral_add,intervalIntegral.integral_add, + intervalIntegral.integral_add,intervalIntegral.integral_sub, + intervalIntegral.integral_const_mul,intervalIntegral.integral_const_mul] + all_goals exact Continuous.intervalIntegrable (by fun_prop) _ _ + +theorem spectralWeightedFlux_first_balance (R : ℝ) (hR : 0 ≤ R) + (μ A P : ℝ → ℝ) (hμ : Continuous μ) (hA : Continuous A) (hP : Continuous P) + (f g : ℝ → ℂ) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (η c lam : ℂ) (φ : 𝓢(ℝ,ℂ)) + (hflux : + (∫ r in (0 : ℝ)..R, star (deriv φ r)*spectralGaugeFirstFlux μ A f g r)+ + (∫ r in (0 : ℝ)..R, star (φ r)* + (η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r)))= + star (φ R)*spectralGaugeFirstFlux μ A f g R) : + spectralClassicalRadialPairing R μ (deriv f) (deriv φ)+ + η*spectralClassicalAngularPairing R μ f φ+ + spectralClassicalRadialPairing R (fun r => μ r*P r) f φ= + (c-lam)*spectralClassicalRadialPairing R μ g φ+ + spectralClassicalRadialPairing R A g (deriv φ)+ + star (φ R)*spectralGaugeFirstFlux μ A f g R := by + have hfc := hf.continuous + have hgc := hg.continuous + have hdf := hf.continuous_deriv (by norm_num) + have hdφ : Continuous (deriv (φ : ℝ → ℂ)) := + (SchwartzMap.derivCLM ℂ ℂ φ).continuous + have hsplit := intervalIntegral.integral_add (μ := volume) + (a := (0 : ℝ)) (b := R) + (f := fun r => star (deriv φ r)*spectralGaugeFirstFlux μ A f g r) + (g := fun r => star (φ r)*(η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r))) + (Continuous.intervalIntegrable (by unfold spectralGaugeFirstFlux; fun_prop) _ _) + (Continuous.intervalIntegrable (by fun_prop) _ _) + rw [← hsplit] at hflux + have heq : (∫ r in (0 : ℝ)..R, + star (deriv φ r)*spectralGaugeFirstFlux μ A f g r+ + star (φ r)*(η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r)))= + spectralClassicalRadialPairing R μ (deriv f) (deriv φ)- + spectralClassicalRadialPairing R A g (deriv φ)+ + η*spectralClassicalAngularPairing R μ f φ+ + spectralClassicalRadialPairing R (fun r => μ r*P r) f φ+ + (lam-c)*spectralClassicalRadialPairing R μ g φ := by + rw [spectralClassicalRadialPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR, + spectralClassicalAngularPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR] + rw [← integral_linear_five] + · apply intervalIntegral.integral_congr + intro r _ + simp only [spectralGaugeFirstFlux,Complex.ofReal_mul] + ring + all_goals fun_prop + rw [heq] at hflux + linear_combination hflux + +theorem spectralClassicalRadialPairing_neg_weight (R : ℝ) (q : ℝ → ℝ) + (f φ : ℝ → ℂ) : + spectralClassicalRadialPairing R (fun r => -q r) f φ= + -spectralClassicalRadialPairing R q f φ := by + unfold spectralClassicalRadialPairing + simp only [neg_smul,mul_neg,integral_neg] + +theorem spectralWeightedFlux_second_balance (R : ℝ) (hR : 0 ≤ R) + (μ A : ℝ → ℝ) (hμ : Continuous μ) (hA : Continuous A) + (f g : ℝ → ℂ) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (η c lam : ℂ) (φ : 𝓢(ℝ,ℂ)) + (hflux : + (∫ r in (0 : ℝ)..R, star (deriv φ r)*spectralGaugeSecondFlux μ A f g r)+ + (∫ r in (0 : ℝ)..R, star (φ r)* + (η*(r : ℂ)^9*(μ r : ℂ)*g r+ + (r : ℂ)^11*(μ r : ℂ)*(c-lam)*f r))= + star (φ R)*spectralGaugeSecondFlux μ A f g R) : + spectralClassicalRadialPairing R μ (deriv g) (deriv φ)+ + η*spectralClassicalAngularPairing R μ g φ+ + (c-lam)*spectralClassicalRadialPairing R μ f φ+ + spectralClassicalRadialPairing R A f (deriv φ)= + star (φ R)*spectralGaugeSecondFlux μ A f g R := by + have hflip : spectralGaugeFirstFlux μ (fun r => -A r) g f= + spectralGaugeSecondFlux μ A f g := by + funext r + simp only [spectralGaugeFirstFlux,spectralGaugeSecondFlux,Complex.ofReal_neg, + neg_mul,sub_neg_eq_add] + have ht := spectralWeightedFlux_first_balance R hR μ (fun r => -A r) (fun _ => 0) + hμ hA.neg continuous_const g f hg hf η (-c) (-lam) φ (by + rw [hflip] + simpa only [Complex.ofReal_zero,zero_mul,zero_add,neg_sub_neg,mul_assoc] using hflux) + rw [hflip,spectralClassicalRadialPairing_neg_weight] at ht + have hz : spectralClassicalRadialPairing R (fun r => μ r*0) g φ=0 := by + simp only [spectralClassicalRadialPairing,mul_zero,zero_smul,integral_zero] + rw [hz,add_zero] at ht + linear_combination ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedGaugeBoundary.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedGaugeBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dd4818cbff6f3fb28ee5036fce2458f5ad37144 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedGaugeBoundary.lean @@ -0,0 +1,29 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralLiouvilleWeightedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialGaugeEnergy + +namespace OAI + +/-! Fixed-radius gauge changes preserve vanishing frequency-weighted Cauchy +energy under a positive mass bound and a bounded profile derivative. -/ + +namespace DefocusingNLS + +theorem spectralWeightedGaugeBoundary_le (omega c D r : ℝ) (ho : 1 ≤ omega) (hc : 0 < c) + (Q f g F G : ℝ → ℂ) (hQ : DifferentiableAt ℝ Q r) + (hf : DifferentiableAt ℝ f r) (hg : DifferentiableAt ℝ g r) + (hp : ∀ t, (Q t*(f t+Complex.I*g t),star (Q t)*(f t-Complex.I*g t))=(F t,G t)) + (hm : c ≤ ‖Q r‖^2) (hdQ : ‖deriv Q r‖ ≤ D) : + ‖Q r‖^2*spectralWeightedCauchyEnergy omega f g r ≤ + (1+D^2/c)*spectralWeightedCauchyEnergy omega F G r := by + obtain ⟨hv,hd⟩ := spectralGauge_jet_identity Q f g F G r hQ hf hg hp + have hb := (spectralGauge_energy_comparison (Q r) (deriv Q r) (f r,g r) + (deriv f r,deriv g r) c D (omega-1) hc hm hdQ (by linarith)).2 + rw [hv,hd] at hb + have he : 1+(omega-1)=omega := by ring + rw [he] at hb + dsimp only [spectralWeightedCauchyEnergy,spectralCoordinateEnergy] at hb ⊢ + nlinarith only [hb] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedPairing.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..55209cf5896fb5fef9e467494b5b6cb233de2837 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedPairing.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralL2ComplexMultiplier +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicCoordinates + +namespace OAI + +/-! Exact scalar integrands of the completed weighted harmonic form. -/ + +open MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralL2ComplexMultiplier_pairing (μ : Measure ℝ) (q : ℝ → ℝ) + (hq : AEStronglyMeasurable q μ) (M : ℝ) (hb : ∀ᵐ r ∂μ, ‖q r‖ ≤ M) + (u v : Lp ℂ 2 μ) : + inner ℂ v (spectralL2ComplexMultiplier μ q hq M hb u)= + ∫ r, star (v r)*(q r • u r) ∂μ := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [spectralL2ComplexMultiplier_ae μ q hq M hb u] with r hr + rw [RCLike.inner_apply',hr] + rfl + +theorem spectralL2ComplexMultiplier_pairing_test (μ : Measure ℝ) (q : ℝ → ℝ) + (hq : AEStronglyMeasurable q μ) (M : ℝ) (hb : ∀ᵐ r ∂μ, ‖q r‖ ≤ M) + (u v : Lp ℂ 2 μ) (f : ℝ → ℂ) (hv : v =ᵐ[μ] f) : + inner ℂ v (spectralL2ComplexMultiplier μ q hq M hb u)= + ∫ r, star (f r)*(q r • u r) ∂μ := by + rw [spectralL2ComplexMultiplier_pairing] + apply integral_congr_ae + filter_upwards [hv] with r hr + rw [hr] + +theorem spectralHarmonicValue_smooth_ae (ell : ℕ) (R : ℝ) (f : 𝓢(ℝ,ℂ)) : + spectralHarmonicValue ell R (spectralHarmonicSmoothEmbedding ell R f) + =ᵐ[radialPressureMeasure R] f := + spectralRadialSmoothValue_ae R f + +theorem spectralHarmonicDerivative_smooth_ae (ell : ℕ) (R : ℝ) (f : 𝓢(ℝ,ℂ)) : + spectralHarmonicDerivative ell R (spectralHarmonicSmoothEmbedding ell R f) + =ᵐ[radialPressureMeasure R] deriv f := by + have h := spectralRadialSmoothValue_ae R (SchwartzMap.derivCLM ℂ ℂ f) + change spectralRadialSmoothValue R (SchwartzMap.derivCLM ℂ ℂ f) + =ᵐ[radialPressureMeasure R] deriv (f : ℝ → ℂ) + filter_upwards [h] with r hr + exact hr.trans (SchwartzMap.derivCLM_apply ℂ f r) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedProductLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedProductLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa4de2e4ff862367f724ad4457480e4e7b8c6b97 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedProductLimit.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRadialGaugeEnergy + +namespace OAI + +/-! A vanishing weighted L2 factor times a bounded weighted L2 factor has +vanishing pairing. The proof uses Young's inequality on the fixed interval. -/ + +open Set Filter Topology MeasureTheory +namespace DefocusingNLS + +theorem spectralNorm_young (delta : ℝ) (hd : 0 < delta) (x y : ℂ) : + ‖x‖*‖y‖ ≤ delta*‖x‖^2+‖y‖^2/(4*delta) := by + apply (mul_le_mul_iff_right₀ (show 0 < 4*delta by positivity)).mp + have hc : (‖y‖^2/(4*delta))*(4*delta)=‖y‖^2 := div_mul_cancel₀ _ (by positivity) + nlinarith only [sq_nonneg (2*delta*‖x‖-‖y‖),hc] + +theorem spectralYoung_pairing_limit (a : ℕ → ℂ) (b : ℕ → ℝ) (B : ℝ) (hB : 0 ≤ B) + (hb : Tendsto b atTop (𝓝 0)) + (hbound : ∀ delta : ℝ, 0 < delta → ∀ᶠ n in atTop, ‖a n‖ ≤ delta*B+b n/(4*delta)) : + Tendsto a atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro epsilon he + let delta := epsilon/(4*(B+1)) + have hd : 0 < delta := by dsimp only [delta]; positivity + have hsmall : delta*B < epsilon/2 := by + dsimp only [delta] + rw [div_mul_eq_mul_div] + apply (div_lt_iff₀ (by positivity : 0 < 4*(B+1))).mpr + nlinarith + have ht : Tendsto (fun n => b n/(4*delta)) atTop (𝓝 0) := by + simpa only [zero_div] using hb.div_const (4*delta) + filter_upwards [hbound delta hd,ht.eventually (gt_mem_nhds (half_pos he))] with n hn hbn + simpa only [dist_zero_right] using (hn.trans_lt (by linarith)) + +theorem spectralWeightedProduct_tendsto_zero (R C M : ℝ) (hR : 0 ≤ R) (hC : 0 ≤ C) (hM : 0 ≤ M) + (mu A : ℕ → ℝ → ℝ) (u v : ℕ → ℝ → ℂ) + (hmu : ∀ n, ContinuousOn (mu n) (Icc 0 R)) (_hA : ∀ n, ContinuousOn (A n) (Icc 0 R)) + (hu : ∀ n, ContinuousOn (u n) (Icc 0 R)) (hv : ∀ n, ContinuousOn (v n) (Icc 0 R)) + (hmu0 : ∀ n r, r ∈ Icc 0 R → 0 ≤ mu n r) + (hAbound : ∀ᶠ n in atTop, ∀ r ∈ Icc 0 R, |A n r| ≤ C*mu n r) + (huBound : ∀ᶠ n in atTop, (∫ r in (0 : ℝ)..R, r^11*mu n r*‖u n r‖^2) ≤ M) + (hvZero : Tendsto (fun n => ∫ r in (0 : ℝ)..R, r^11*mu n r*‖v n r‖^2) atTop (𝓝 0)) : + Tendsto (fun n => ∫ r in (0 : ℝ)..R, (r : ℂ)^11*(A n r : ℂ)*star (u n r)*v n r) atTop (𝓝 0) := by + apply spectralYoung_pairing_limit _ + (fun n => C*(∫ r in (0 : ℝ)..R, r^11*mu n r*‖v n r‖^2)) (C*M) (mul_nonneg hC hM) + (by simpa only [mul_zero] using hvZero.const_mul C) + intro delta hd + filter_upwards [hAbound,huBound] with n hAn hun + let E := fun r => r^11*mu n r*‖u n r‖^2 + let V := fun r => r^11*mu n r*‖v n r‖^2 + have hEc : ContinuousOn E (Icc 0 R) := by dsimp only [E]; fun_prop + have hVc : ContinuousOn V (Icc 0 R) := by dsimp only [V]; fun_prop + have hpoint r (hr : r ∈ Ioc 0 R) : + ‖(r : ℂ)^11*(A n r : ℂ)*star (u n r)*v n r‖ ≤ delta*C*E r+(C/(4*delta))*V r := by + simp only [norm_mul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hr.1.le,norm_star] + have hm := hmu0 n r ⟨hr.1.le,hr.2⟩ + have h1 := mul_le_mul_of_nonneg_left (hAn r ⟨hr.1.le,hr.2⟩) (pow_nonneg hr.1.le 11) + have h2 := spectralNorm_young delta hd (u n r) (v n r) + have hh := mul_le_mul h1 h2 (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + (mul_nonneg (pow_nonneg hr.1.le 11) (mul_nonneg hC hm)) + dsimp only [E,V] + convert hh using 1 <;> ring + have hi := intervalIntegral.norm_integral_le_of_norm_le (μ := volume) hR + (Eventually.of_forall hpoint) + (((hEc.const_mul (delta*C)).add (hVc.const_mul (C/(4*delta)))).intervalIntegrable_of_Icc hR) + rw [intervalIntegral.integral_add,intervalIntegral.integral_const_mul, + intervalIntegral.integral_const_mul] at hi + · have hb := mul_le_mul_of_nonneg_left hun (mul_nonneg hd.le hC) + dsimp only [E,V] at hi + calc + _ ≤ delta*C*M+(C/(4*delta))*(∫ r in (0 : ℝ)..R, r^11*mu n r*‖v n r‖^2) := + hi.trans (add_le_add hb le_rfl) + _ = _ := by ring + · exact (hEc.const_mul _).intervalIntegrable_of_Icc hR + · exact (hVc.const_mul _).intervalIntegrable_of_Icc hR + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedSourceBalance.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedSourceBalance.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd36e1e0de99c9462b7b4544d74a185d25c8b9a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedSourceBalance.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralWeightedFluxBalance + +namespace OAI + +/-! The weak flux balance retains exactly the volume forcing of a first chain. -/ + +open Set MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +private theorem integral_linear_six (R : ℝ) (f₁ f₂ f₃ f₄ f₅ f₆ : ℝ → ℂ) + (h₁ : Continuous f₁) (h₂ : Continuous f₂) (h₃ : Continuous f₃) + (h₄ : Continuous f₄) (h₅ : Continuous f₅) (h₆ : Continuous f₆) (a b : ℂ) : + (∫ r in (0 : ℝ)..R, f₁ r-f₂ r+a*f₃ r+f₄ r+b*f₅ r+f₆ r)= + (∫ r in (0 : ℝ)..R, f₁ r)-(∫ r in (0 : ℝ)..R, f₂ r)+ + a*(∫ r in (0 : ℝ)..R, f₃ r)+(∫ r in (0 : ℝ)..R, f₄ r)+ + b*(∫ r in (0 : ℝ)..R, f₅ r)+(∫ r in (0 : ℝ)..R, f₆ r) := by + rw [intervalIntegral.integral_add,intervalIntegral.integral_add,intervalIntegral.integral_add, + intervalIntegral.integral_add,intervalIntegral.integral_sub, + intervalIntegral.integral_const_mul,intervalIntegral.integral_const_mul] + all_goals exact Continuous.intervalIntegrable (by fun_prop) _ _ + +theorem spectralWeightedFlux_first_source_balance (R : ℝ) (hR : 0 ≤ R) + (μ A P : ℝ → ℝ) (hμ : Continuous μ) (hA : Continuous A) (hP : Continuous P) + (f g G : ℝ → ℂ) (hG : Continuous G) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (η c lam : ℂ) (φ : 𝓢(ℝ,ℂ)) + (hflux : + (∫ r in (0 : ℝ)..R, star (deriv φ r)*spectralGaugeFirstFlux μ A f g r)+ + (∫ r in (0 : ℝ)..R, star (φ r)* + (η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r+G r)))= + star (φ R)*spectralGaugeFirstFlux μ A f g R) : + spectralClassicalRadialPairing R μ (deriv f) (deriv φ)+ + η*spectralClassicalAngularPairing R μ f φ+ + spectralClassicalRadialPairing R (fun r => μ r*P r) f φ+ + spectralClassicalRadialPairing R μ G φ= + (c-lam)*spectralClassicalRadialPairing R μ g φ+ + spectralClassicalRadialPairing R A g (deriv φ)+ + star (φ R)*spectralGaugeFirstFlux μ A f g R := by + have hfc := hf.continuous + have hgc := hg.continuous + have hdf := hf.continuous_deriv (by norm_num) + have hdφ : Continuous (deriv (φ : ℝ → ℂ)) := + (SchwartzMap.derivCLM ℂ ℂ φ).continuous + have hsplit := intervalIntegral.integral_add (μ := volume) + (a := (0 : ℝ)) (b := R) + (f := fun r => star (deriv φ r)*spectralGaugeFirstFlux μ A f g r) + (g := fun r => star (φ r)*(η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r+G r))) + (Continuous.intervalIntegrable (by unfold spectralGaugeFirstFlux; fun_prop) _ _) + (Continuous.intervalIntegrable (by fun_prop) _ _) + rw [← hsplit] at hflux + have heq : (∫ r in (0 : ℝ)..R, + star (deriv φ r)*spectralGaugeFirstFlux μ A f g r+ + star (φ r)*(η*(r : ℂ)^9*(μ r : ℂ)*f r+ + (r : ℂ)^11*(μ r : ℂ)*((P r : ℂ)*f r+(lam-c)*g r+G r)))= + spectralClassicalRadialPairing R μ (deriv f) (deriv φ)- + spectralClassicalRadialPairing R A g (deriv φ)+ + η*spectralClassicalAngularPairing R μ f φ+ + spectralClassicalRadialPairing R (fun r => μ r*P r) f φ+ + (lam-c)*spectralClassicalRadialPairing R μ g φ+ + spectralClassicalRadialPairing R μ G φ := by + rw [spectralClassicalRadialPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR, + spectralClassicalAngularPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR, + spectralClassicalRadialPairing_interval R hR] + rw [← integral_linear_six] + · apply intervalIntegral.integral_congr + intro r _ + simp only [spectralGaugeFirstFlux,Complex.ofReal_mul] + ring + all_goals fun_prop + rw [heq] at hflux + linear_combination hflux + +theorem spectralWeightedFlux_second_source_balance (R : ℝ) (hR : 0 ≤ R) + (μ A : ℝ → ℝ) (hμ : Continuous μ) (hA : Continuous A) + (f g F : ℝ → ℂ) (hF : Continuous F) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (η c lam : ℂ) (φ : 𝓢(ℝ,ℂ)) + (hflux : + (∫ r in (0 : ℝ)..R, star (deriv φ r)*spectralGaugeSecondFlux μ A f g r)+ + (∫ r in (0 : ℝ)..R, star (φ r)* + (η*(r : ℂ)^9*(μ r : ℂ)*g r+ + (r : ℂ)^11*(μ r : ℂ)*((c-lam)*f r-F r)))= + star (φ R)*spectralGaugeSecondFlux μ A f g R) : + spectralClassicalRadialPairing R μ (deriv g) (deriv φ)+ + η*spectralClassicalAngularPairing R μ g φ+ + (c-lam)*spectralClassicalRadialPairing R μ f φ+ + spectralClassicalRadialPairing R A f (deriv φ)- + spectralClassicalRadialPairing R μ F φ= + star (φ R)*spectralGaugeSecondFlux μ A f g R := by + have hflip : spectralGaugeFirstFlux μ (fun r => -A r) g f= + spectralGaugeSecondFlux μ A f g := by + funext r + simp only [spectralGaugeFirstFlux,spectralGaugeSecondFlux,Complex.ofReal_neg, + neg_mul,sub_neg_eq_add] + have ht := spectralWeightedFlux_first_source_balance R hR μ (fun r => -A r) (fun _ => 0) + hμ hA.neg continuous_const g f (fun r => -F r) hF.neg hg hf η (-c) (-lam) φ (by + rw [hflip] + simpa only [Complex.ofReal_zero,zero_mul,zero_add,neg_sub_neg,mul_assoc,sub_eq_add_neg,neg_neg,add_assoc,add_left_comm,add_comm,add_zero] using hflux) + rw [hflip,spectralClassicalRadialPairing_neg_weight] at ht + have hz : spectralClassicalRadialPairing R (fun r => μ r*0) g φ=0 := by + simp only [spectralClassicalRadialPairing,mul_zero,zero_smul,integral_zero] + rw [hz,add_zero] at ht + have hn : spectralClassicalRadialPairing R μ (fun r => -F r) φ = + -spectralClassicalRadialPairing R μ F φ := by + simp only [spectralClassicalRadialPairing,smul_neg,mul_neg,integral_neg] + rw [hn] at ht + linear_combination ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedTestIntegrable.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedTestIntegrable.lean new file mode 100644 index 0000000000000000000000000000000000000000..14506604682436844f15b20d8c5bb5cf18ccebee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Spectrum/SpectralWeightedTestIntegrable.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHarmonicScalarPairing + +namespace OAI + +/-! Integrability of the exact scalar test integrands. -/ + +open MeasureTheory +open scoped SchwartzMap +namespace DefocusingNLS + +theorem spectralWeightedTest_integrable (μ : Measure ℝ) (q : ℝ → ℝ) + (hq : AEStronglyMeasurable q μ) (M : ℝ) (hb : ∀ᵐ r ∂μ, ‖q r‖ ≤ M) + (u v : Lp ℂ 2 μ) (f : ℝ → ℂ) (hv : v =ᵐ[μ] f) : + Integrable (fun r => star (f r)*(q r • u r)) μ := by + apply (L2.integrable_inner (𝕜 := ℂ) v + (spectralL2ComplexMultiplier μ q hq M hb u)).congr + filter_upwards [hv,spectralL2ComplexMultiplier_ae μ q hq M hb u] with r hr hp + rw [RCLike.inner_apply',hr,hp] + rfl + +theorem spectralAngularTest_integrable (ell : ℕ) (R : ℝ) (w : SpectralHarmonicWeight R) + (u : SpectralHarmonicEnergy ell R) (f : 𝓢(ℝ,ℂ)) : + Integrable (fun r => (((ell : ℝ)*(ell+10) : ℝ) : ℂ)* + (star (f r)*(w.density r • spectralHarmonicValue ell R u r))) + (spectralAngularMeasure R) := by + let A := spectralL2ComplexMultiplier (spectralAngularMeasure R) w.density + w.angular_measurable w.bound w.angular_bound + apply (L2.integrable_inner (𝕜 := ℂ) + (spectralHarmonicAngularValue ell R (spectralHarmonicSmoothEmbedding ell R f)) + (A (spectralHarmonicAngularValue ell R u))).congr + filter_upwards [spectralHarmonicAngular_smooth_ae ell R f, + spectralHarmonicAngularValue_ae ell R u, + spectralL2ComplexMultiplier_ae (spectralAngularMeasure R) w.density + w.angular_measurable w.bound w.angular_bound (spectralHarmonicAngularValue ell R u)] + with r hf hu hA + rw [RCLike.inner_apply',hf,hA,hu] + have hη : (Real.sqrt ((ell : ℝ)*(ell+10)) : ℂ)^2= + (((ell : ℝ)*(ell+10) : ℝ) : ℂ) := by + norm_cast + exact Real.sq_sqrt (by positivity) + rw [← hη] + rw [map_mul,Complex.conj_ofReal] + simp only [Complex.real_smul,Complex.star_def] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Augmented.lean b/lean/OAI/MathematicalPhysics/Elasticity/Augmented.lean new file mode 100644 index 0000000000000000000000000000000000000000..2124d74ebfd9d7d2623618d211fe1026b95bcf5b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Augmented.lean @@ -0,0 +1,381 @@ +import Mathlib + +namespace OAI + +/-! Exact differential-algebra identities of the physical and normalized +augmented elasticity systems. Smooth derivatives are constructed below; +commutation and Leibniz are proved, not postulated for the physical operator. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +abbrev X := EuclideanSpace ℝ (Fin 3) +def e (i : Fin 3) : X := EuclideanSpace.single i 1 + +def smoothAlgebra : Subalgebra ℂ (X → ℂ) where + carrier := {f | ContDiff ℝ (⊤ : ℕ∞) f} + add_mem' := by + intro f g hf hg + change ContDiff ℝ (⊤ : ℕ∞) f at hf + change ContDiff ℝ (⊤ : ℕ∞) g at hg + exact hf.add hg + mul_mem' := by + intro f g hf hg + change ContDiff ℝ (⊤ : ℕ∞) f at hf + change ContDiff ℝ (⊤ : ℕ∞) g at hg + exact hf.mul hg + zero_mem' := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : X => (0 : ℂ)) + exact contDiff_const + one_mem' := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : X => (1 : ℂ)) + exact contDiff_const + algebraMap_mem' a := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : X => a) + exact contDiff_const + +abbrev Smooth := smoothAlgebra + +lemma smooth_coe (f : Smooth) : ContDiff ℝ (⊤ : ℕ∞) (f : X → ℂ) := f.property + +/-- Actual coordinate derivative, as a derivation of the smooth function algebra. -/ +def coord (i : Fin 3) : Derivation ℂ Smooth Smooth := Derivation.mk' + { toFun := fun f => ⟨fun x => fderiv ℝ (f : X → ℂ) x (e i), + by + change ContDiff ℝ (⊤ : ℕ∞) (fun x => fderiv ℝ (f : X → ℂ) x (e i)) + exact ((smooth_coe f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const⟩ + map_add' := by + intro f g + apply Subtype.ext + funext x + exact congrArg (fun L : X →L[ℝ] ℂ => L (e i)) + (fderiv_add ((smooth_coe f).differentiable (by simp) x) + ((smooth_coe g).differentiable (by simp) x)) + map_smul' := by + intro a f + apply Subtype.ext + funext x + exact congrArg (fun L : X →L[ℝ] ℂ => L (e i)) + (fderiv_const_smul ((smooth_coe f).differentiable (by simp) x) a) } + (by + intro f g + apply Subtype.ext + funext x + exact congrArg (fun L : X →L[ℝ] ℂ => L (e i)) + (fderiv_mul ((smooth_coe f).differentiable (by simp) x) + ((smooth_coe g).differentiable (by simp) x))) + +lemma coord_apply (i : Fin 3) (f : Smooth) (x : X) : + (coord i f : X → ℂ) x = fderiv ℝ (f : X → ℂ) x (e i) := rfl + +lemma coord_coord (f : Smooth) (i j : Fin 3) (x : X) : + (coord i (coord j f) : X → ℂ) x = fderiv ℝ (fderiv ℝ (f : X → ℂ)) x (e i) (e j) := by + have hd : Differentiable ℝ (fderiv ℝ (f : X → ℂ)) := + ((smooth_coe f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ (f : X → ℂ) y (e j)) x (e i) = _ + rw [fderiv_clm_apply (hd x) (differentiableAt_const (e j))] + simp + +lemma coord_commute (i j : Fin 3) (f : Smooth) : coord i (coord j f) = coord j (coord i f) := by + apply Subtype.ext + funext x + rw [coord_coord, coord_coord] + exact (smooth_coe f).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) _ _ + +section DifferentialAlgebra +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable {ι : Type*} [Fintype ι] +variable (D : ι → Derivation ℂ A A) + +omit [Fintype ι] in +lemma partial_mul (i : ι) (a b : A) : D i (a*b) = D i a*b + a*D i b := by + simpa only [smul_eq_mul, add_comm, mul_comm] using (D i).leibniz a b + +def lap (f : A) : A := ∑ i, D i (D i f) +def div (u : ι → A) : A := ∑ i, D i (u i) +def cm (m : A) (u : ι → A) (i : ι) : A := + ∑ j, D j m * (D j (u i) + D i (u j)) +def R (lam m : A) (u : ι → A) (d : A) (i : ι) : A := + m * lap D (u i) + (lam+m)*D i d + cm D m u i + D i lam*d +def S (lam m : A) (u : ι → A) (d : A) : A := + (lam+m+m)*lap D d + 2*(∑ i, D i (lam+m)*D i d) + + 2*(∑ i, D i m*lap D (u i)) + + 2*(∑ i, ∑ j, D i (D j m)*D i (u j)) + lap D lam*d +def P (m : A) (f : A) : A := m*lap D f + ∑ i, D i m*D i f + +variable (hD : ∀ i j f, D i (D j f) = D j (D i f)) +include hD + +lemma partial_lap (i : ι) (f : A) : D i (lap D f) = lap D (D i f) := by + simp only [lap, map_sum] + apply Finset.sum_congr rfl + intro j _ + rw [hD i j, hD i j] + +lemma div_lap (u : ι → A) : div D (fun i => lap D (u i)) = lap D (div D u) := by + simp only [div, lap, map_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + rw [hD i j, hD i j] + +lemma div_cm (m : A) (u : ι → A) : + div D (cm D m u) = + 2*(∑ i, ∑ j, D i (D j m)*D i (u j)) + + (∑ i, D i m*D i (div D u)) + (∑ i, D i m*lap D (u i)) := by + have hH : (∑ i, ∑ j, D i (D j m)*D j (u i)) = + ∑ i, ∑ j, D i (D j m)*D i (u j) := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [hD j i] + have hv : (∑ i, ∑ j, D j m * D i (D j (u i))) = + ∑ j, D j m*D j (div D u) := by + rw [Finset.sum_comm] + simp only [div, map_sum, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + rw [hD i j] + have hl : (∑ i, ∑ j, D j m * D i (D i (u j))) = + ∑ j, D j m*lap D (u j) := by + rw [Finset.sum_comm] + simp only [lap, Finset.mul_sum] + simp only [div, cm, map_sum, partial_mul, map_add, mul_add, Finset.sum_add_distrib] + rw [hH, hv, hl] + simp only [div, map_sum] + ring + +/-- The independent scalar compatibility identity, before imposing d=div u. -/ +theorem augmented_identity (lam m : A) (u : ι → A) (d : A) : + div D (R D lam m u d) - S D lam m u d = P D m (div D u-d) := by + have hL := div_lap D hD u + have hC := div_cm D hD m u + simp only [div] at hL hC + simp only [div, R, map_add, partial_mul, Finset.sum_add_distrib] + rw [← Finset.mul_sum, hL, hC] + simp only [S, P, lap, map_sub, map_add, map_sum, mul_sub, add_mul, mul_add, + Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.mul_sum, Finset.sum_mul] + ring_nf + simp only [← Finset.sum_mul, ← Finset.mul_sum] + ring + +end DifferentialAlgebra + +/-- No commuting-derivation hypothesis remains for actual smooth functions. -/ +theorem smooth_augmented_identity (lam m : Smooth) (u : Fin 3 → Smooth) (d : Smooth) : + div coord (R coord lam m u d) - S coord lam m u d = P coord m (div coord u-d) := + augmented_identity coord coord_commute lam m u d + +section CovariantAlgebra +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable {ι : Type*} [Fintype ι] +variable (D : ι → Derivation ℂ A A) (T : ι → A →ₗ[ℂ] A) + +def lapT (f : A) : A := ∑ i, T i (T i f) +def divT (u : ι → A) : A := ∑ i, T i (u i) +def cmT (m : A) (u : ι → A) (i : ι) : A := + ∑ j, D j m * (T j (u i) + T i (u j)) +def RT (lam m : A) (u : ι → A) (d : A) (i : ι) : A := + m * lapT T (u i) + (lam+m)*T i d + cmT D T m u i + D i lam*d +def ST (lam m : A) (u : ι → A) (d : A) : A := + (lam+m+m)*lapT T d + 2*(∑ i, D i (lam+m)*T i d) + + 2*(∑ i, D i m*lapT T (u i)) + + 2*(∑ i, ∑ j, D i (D j m)*T i (u j)) + lap D lam*d +def PT (m : A) (f : A) : A := m*lapT T f + ∑ i, D i m*T i f + +variable (hD : ∀ i j f, D i (D j f) = D j (D i f)) +variable (hT : ∀ i j f, T i (T j f) = T j (T i f)) +variable (hTD : ∀ i a b, T i (a*b) = D i a*b+a*T i b) + +include hT in +lemma covariant_div_lap (u : ι → A) : divT T (fun i => lapT T (u i)) = lapT T (divT T u) := by + simp only [divT, lapT, map_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + rw [hT i j, hT i j] + +include hD hT hTD in +lemma covariant_div_cm (m : A) (u : ι → A) : + divT T (cmT D T m u) = + 2*(∑ i, ∑ j, D i (D j m)*T i (u j)) + + (∑ i, D i m*T i (divT T u)) + (∑ i, D i m*lapT T (u i)) := by + have hH : (∑ i, ∑ j, D i (D j m)*T j (u i)) = + ∑ i, ∑ j, D i (D j m)*T i (u j) := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [hD j i] + have hv : (∑ i, ∑ j, D j m * T i (T j (u i))) = + ∑ j, D j m*T j (divT T u) := by + rw [Finset.sum_comm] + simp only [divT, map_sum, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + rw [hT i j] + have hl : (∑ i, ∑ j, D j m * T i (T i (u j))) = + ∑ j, D j m*lapT T (u j) := by + rw [Finset.sum_comm] + simp only [lapT, Finset.mul_sum] + simp only [divT, cmT, map_sum, hTD, map_add, mul_add, Finset.sum_add_distrib] + rw [hH, hv, hl] + simp only [divT, map_sum] + ring + +include hD hT hTD in +/-- Compatibility after conjugation, proved for the genuine connection +Leibniz rule rather than falsely treating a shifted derivative as a derivation. -/ +theorem covariant_augmented_identity (lam m : A) (u : ι → A) (d : A) : + divT T (RT D T lam m u d) - ST D T lam m u d = PT D T m (divT T u-d) := by + have hL := covariant_div_lap T hT u + have hC := covariant_div_cm D T hD hT hTD m u + simp only [divT] at hL hC + simp only [divT, RT, map_add, hTD, Finset.sum_add_distrib] + rw [← Finset.mul_sum, hL, hC] + simp only [ST, PT, lap, lapT, map_sub, map_add, map_sum, mul_sub, add_mul, mul_add, + Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.mul_sum, Finset.sum_mul] + ring_nf + simp only [← Finset.sum_mul, ← Finset.mul_sum] + ring + +/-- The physical stress-divergence, using the conjugated coordinate derivative. -/ +def LT (lam m : A) (u : ι → A) (i : ι) : A := + T i (lam * divT T u) + ∑ j, T j (m*(T j (u i)+T i (u j))) + +include hT hTD in +lemma physical_conjugated_expansion (lam m : A) (u : ι → A) (i : ι) : + LT T lam m u i = RT D T lam m u (divT T u) i := by + have ht : (∑ j, T j (T i (u j))) = T i (divT T u) := by + simp only [divT, map_sum] + apply Finset.sum_congr rfl + intro j _ + rw [hT j i] + simp only [LT, RT, hTD, map_add, mul_add, Finset.sum_add_distrib, ← Finset.mul_sum] + rw [ht] + simp only [cmT, lapT, mul_add, Finset.sum_add_distrib] + ring + +/-- A complex constant phase shifts an actual coordinate derivative. -/ +def shifted (z : ι → ℂ) (i : ι) : A →ₗ[ℂ] A := + (D i).toLinearMap + z i • LinearMap.id + +omit [Fintype ι] in +lemma shifted_apply (z : ι → ℂ) (i : ι) (f : A) : + shifted D z i f = D i f + z i • f := rfl + +omit [Fintype ι] in +lemma shifted_mul (z : ι → ℂ) (i : ι) (a b : A) : + shifted D z i (a*b) = D i a*b+a*shifted D z i b := by + simp only [shifted_apply, partial_mul, Algebra.smul_def] + ring + +include hD in +omit [Fintype ι] in +lemma shifted_commute (z : ι → ℂ) (i j : ι) (f : A) : + shifted D z i (shifted D z j f) = shifted D z j (shifted D z i f) := by + simp only [shifted_apply, map_add, map_smul, smul_add, smul_smul, hD i j] + simp only [Algebra.smul_def] + ring_nf + +theorem shifted_physical_expansion (z : ι → ℂ) (lam m : A) (u : ι → A) + (hc : ∀ i j f, D i (D j f) = D j (D i f)) (i : ι) : + LT (shifted D z) lam m u i = RT D (shifted D z) lam m u (divT (shifted D z) u) i := + physical_conjugated_expansion D (shifted D z) (shifted_commute D hc z) (shifted_mul D z) lam m u i + +theorem shifted_physical_divergence (z : ι → ℂ) (lam m : A) (u : ι → A) + (hc : ∀ i j f, D i (D j f) = D j (D i f)) : + divT (shifted D z) (LT (shifted D z) lam m u) = + ST D (shifted D z) lam m u (divT (shifted D z) u) := by + have he := covariant_augmented_identity D (shifted D z) hc (shifted_commute D hc z) + (shifted_mul D z) lam m u (divT (shifted D z) u) + rw [sub_self] at he + simp only [PT, lapT, map_zero, mul_zero, Finset.sum_const_zero, add_zero] at he + rw [← sub_eq_zero] + convert he using 1 + congr 2 + funext i + exact shifted_physical_expansion D z lam m u hc i + +end CovariantAlgebra + +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable {ι : Type*} [Fintype ι] +variable (D : ι → Derivation ℂ A A) (T : ι → A →ₗ[ℂ] A) + +lemma grad_cm (m : A) (u : ι → A) : + (∑ i, D i m*cmT D T m u i) = + 2*(∑ i, ∑ j, D i m*D j m*T i (u j)) := by + have hs : (∑ i, ∑ j, D i m*D j m*T j (u i)) = + ∑ i, ∑ j, D i m*D j m*T i (u j) := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + simp only [cmT, Finset.mul_sum, mul_add, ← mul_assoc, Finset.sum_add_distrib] + rw [hs] + ring_nf + simp only [← Finset.sum_mul] + +lemma grad_RT (lam m : A) (u : ι → A) (d : A) : + (∑ i, D i m*RT D T lam m u d i) = + m*(∑ i, D i m*lapT T (u i)) + + (lam+m)*(∑ i, D i m*T i d) + + 2*(∑ i, ∑ j, D i m*D j m*T i (u j)) + + (∑ i, D i m*D i lam)*d := by + have hc := grad_cm D T m u + simp only [RT, mul_add, Finset.sum_add_distrib] + rw [hc] + simp only [Finset.mul_sum, mul_assoc, mul_left_comm, mul_comm] + +lemma normalized_vector (lam m n : A) (hn : n*m=1) (u : ι → A) (d : A) (i : ι) : + n*RT D T lam m u d i = lapT T (u i) + ((lam+m)*n)*T i d + + (∑ j, ((n*D j m)*T j (u i) + (n*D j m)*T i (u j))) + + (n*D i lam)*d := by + simp only [RT, cmT, mul_add, add_mul, Finset.mul_sum, Finset.sum_add_distrib] + simp only [← mul_assoc] + linear_combination lapT T (u i)*hn + +lemma normalized_scalar_numerator (lam m n : A) (hn : n*m=1) + (u : ι → A) (d : A) : + ST D T lam m u d - 2*n*(∑ i, D i m*RT D T lam m u d i) = + (lam+m+m)*lapT T d + + 2*(∑ i, (D i (lam+m)-(lam+m)*n*D i m)*T i d) + + 2*(∑ i, ∑ j, (D i (D j m)-2*n*D i m*D j m)*T i (u j)) + + (lap D lam-2*n*(∑ i, D i m*D i lam))*d := by + rw [grad_RT] + simp only [ST, sub_mul, Finset.sum_sub_distrib] + simp only [mul_assoc, ← Finset.mul_sum] + linear_combination -2*(∑ i, D i m*lapT T (u i))*hn + +lemma normalized_scalar (lam m n o : A) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (u : ι → A) (d : A) : + o*(ST D T lam m u d - 2*n*(∑ i, D i m*RT D T lam m u d i)) = + lapT T d + + (∑ i, (2*o*(D i (lam+m)-(lam+m)*n*D i m))*T i d) + + (∑ i, ∑ j, (2*o*(D i (D j m)-2*n*D i m*D j m))*T i (u j)) + + (o*(lap D lam-2*n*(∑ i, D i m*D i lam)))*d := by + rw [normalized_scalar_numerator D T lam m n hn] + simp only [mul_add, Finset.mul_sum, ← mul_assoc, ho, one_mul] + ring_nf + +end ElasticityAugmented + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Basic.lean b/lean/OAI/MathematicalPhysics/Elasticity/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..1199411d42d54154ec2520d8911ec0d4582bb78c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Basic.lean @@ -0,0 +1,114 @@ +import Mathlib + +namespace OAI + +/-! +# Variational isotropic elasticity + +H¹ is the closure of smooth value/gradient jets in L². Boundary data are +the quotient by the closure of compactly supported smooth jets, and the +Dirichlet-to-Neumann map is the physical variational displacement-to-traction +pairing. Arbitrary-data Dirichlet well-posedness and independence of +representatives are proved, not assumed. Identification of the quotient +norm with boundary-chart fractional Sobolev norms is not established here. +-/ + +noncomputable section +open MeasureTheory Set +open scoped BigOperators + +namespace Elasticity + +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev V := X + +def coordVector (i : Fin 3) : X := EuclideanSpace.single i 1 + +def SmoothBoundary (Ω : Set X) : Prop := + ∀ x ∈ frontier Ω, ∃ e : OpenPartialHomeomorph X X, + x ∈ e.source ∧ + ContDiffOn ℝ (⊤ : ℕ∞) e e.source ∧ + ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target ∧ + e x 0 = 0 ∧ + ∀ y ∈ e.source, y ∈ Ω ↔ 0 < e y 0 + +def Domain (Ω : Set X) : Prop := + IsOpen Ω ∧ IsConnected Ω ∧ Bornology.IsBounded Ω ∧ SmoothBoundary Ω + +def SmoothUpTo (Ω : Set X) (f : X → ℝ) : Prop := + ∃ U : Set X, IsOpen U ∧ closure Ω ⊆ U ∧ ContDiffOn ℝ (⊤ : ℕ∞) f U + +def Admissible (Ω : Set X) (lam mu : X → ℝ) : Prop := + SmoothUpTo Ω lam ∧ SmoothUpTo Ω mu ∧ + ∀ x ∈ closure Ω, 0 < mu x ∧ 0 < 3 * lam x + 2 * mu x + +abbrev Ambient (Ω : Set X) := + Lp V 2 (volume.restrict Ω) × (Fin 3 → Lp V 2 (volume.restrict Ω)) + +def coordDeriv (f : X → V) (i : Fin 3) (x : X) : V := + fderiv ℝ f x (coordVector i) + +def SmoothJets (Ω : Set X) : Set (Ambient Ω) := + {j | ∃ (f : X → V) (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ i, MemLp (coordDeriv f i) 2 (volume.restrict Ω)), + ContDiff ℝ (⊤ : ℕ∞) f ∧ + j.1 = hf.toLp f ∧ j.2 = fun i => (hd i).toLp (coordDeriv f i)} + +def TestJets (Ω : Set X) : Set (Ambient Ω) := + {j | ∃ (f : X → V) (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ i, MemLp (coordDeriv f i) 2 (volume.restrict Ω)), + ContDiff ℝ (⊤ : ℕ∞) f ∧ HasCompactSupport f ∧ tsupport f ⊆ Ω ∧ + j.1 = hf.toLp f ∧ j.2 = fun i => (hd i).toLp (coordDeriv f i)} + +abbrev H1 (Ω : Set X) := {j : Ambient Ω // j ∈ closure (SmoothJets Ω)} + +def HasZeroTrace (Ω : Set X) (u : H1 Ω) : Prop := + u.val ∈ closure (TestJets Ω) + +def SameTrace (Ω : Set X) (u v : H1 Ω) : Prop := + u.val - v.val ∈ closure (TestJets Ω) + +/-- Variational boundary data: the quotient by the closure of compactly supported smooth jets. -/ +abbrev BoundaryData (Ω : Set X) := Quot (SameTrace Ω) + +def trace (Ω : Set X) (u : H1 Ω) : BoundaryData Ω := Quot.mk _ u + +def div (Ω : Set X) (u : H1 Ω) (x : X) : ℝ := + ∑ i, (u.val.2 i x) i + +def strain (Ω : Set X) (u : H1 Ω) (x : X) (i j : Fin 3) : ℝ := + ((u.val.2 j x) i + (u.val.2 i x) j) / 2 + +def energy (Ω : Set X) (lam mu : X → ℝ) (u v : H1 Ω) : ℝ := + ∫ x, (lam x * div Ω u x * div Ω v x + + 2 * mu x * ∑ i, ∑ j, strain Ω u x i j * strain Ω v x i j) + ∂(volume.restrict Ω) + +def WeakSolution (Ω : Set X) (lam mu : X → ℝ) (u : H1 Ω) : Prop := + ∀ v : H1 Ω, HasZeroTrace Ω v → energy Ω lam mu u v = 0 + +/-- A definition by choice, not a wellposedness assumption. The fallback is +irrelevant once the Dirichlet problem has been proved solvable. -/ +def dirichletSolution (Ω : Set X) (lam mu : X → ℝ) + (f : BoundaryData Ω) : H1 Ω := by + classical + exact if h : ∃ u : H1 Ω, trace Ω u = f ∧ WeakSolution Ω lam mu u + then Classical.choose h + else f.out + +/-- The weak displacement-to-traction pairing; definition (physical-dn). -/ +def DN (Ω : Set X) (lam mu : X → ℝ) : BoundaryData Ω → BoundaryData Ω → ℝ := + fun f g => energy Ω lam mu (dirichletSolution Ω lam mu f) g.out + +def MainClaim : Prop := + ∀ (Ω : Set X), Domain Ω → + ∀ (lam₁ mu₁ lam₂ mu₂ : X → ℝ), + Admissible Ω lam₁ mu₁ → Admissible Ω lam₂ mu₂ → + DN Ω lam₁ mu₁ = DN Ω lam₂ mu₂ → + (∀ x ∈ Ω, lam₁ x = lam₂ x) ∧ (∀ x ∈ Ω, mu₁ x = mu₂ x) + +end Elasticity + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Bessel.lean b/lean/OAI/MathematicalPhysics/Elasticity/Bessel.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ee19842d0152a7fcbbada2e167d8245b1d0c06f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Bessel.lean @@ -0,0 +1,2608 @@ +import Mathlib + +namespace OAI + +noncomputable section + +/-! Concrete Fourier Bessel potentials for the required negative-order +supported Carleman estimate. All functions and operators are actual Schwartz +maps; no Sobolev-shift estimate is being assumed. -/ +open MeasureTheory Complex SchwartzMap +open scoped BigOperators FourierTransform SchwartzMap LineDeriv ENNReal +namespace ElasticityBessel +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev S := SchwartzMap X ℂ + +def weight (h s : ℝ) (x : X) : ℝ := (1 + ‖(2*Real.pi*h) • x‖^2)^(s/2) + +lemma weight_pos (h s : ℝ) (x : X) : 0 < weight h s x := by + exact Real.rpow_pos_of_pos (by positivity) _ + +lemma temperate_weight (h s : ℝ) : (weight h s).HasTemperateGrowth := by + exact (Function.hasTemperateGrowth_one_add_norm_sq_rpow X (s/2)).comp + (((2*Real.pi*h) • ContinuousLinearMap.id ℝ X).hasTemperateGrowth) + +lemma temperate_complex_weight (h s : ℝ) : + (fun x => (weight h s x : ℂ)).HasTemperateGrowth := by + exact Complex.ofRealCLM.hasTemperateGrowth.comp (temperate_weight h s) + +lemma weight_add (h s t : ℝ) (x : X) : weight h (s+t) x = weight h s x * weight h t x := by + simp only [weight, add_div] + exact Real.rpow_add (by positivity) _ _ + +@[simp] lemma weight_zero (h : ℝ) (x : X) : weight h 0 x = 1 := by simp [weight] + +lemma weight_neg (h s : ℝ) (x : X) : weight h (-s) x = (weight h s x)⁻¹ := by + simp only [weight, neg_div] + exact Real.rpow_neg (by positivity) _ + +def M (h s : ℝ) : S →L[ℂ] S := + SchwartzMap.smulLeftCLM ℂ (fun x => (weight h s x : ℂ)) + +@[simp] lemma M_apply (h s : ℝ) (f : S) (x : X) : + M h s f x = (weight h s x : ℂ)*f x := by + exact SchwartzMap.smulLeftCLM_apply_apply (temperate_complex_weight h s) f x + +lemma M_add (h s t : ℝ) (f : S) : M h (s+t) f = M h s (M h t f) := by + ext x + simp only [M_apply, weight_add, Complex.ofReal_mul] + ring + +@[simp] lemma M_zero (h : ℝ) (f : S) : M h 0 f = f := by + ext x + simp only [M_apply, weight_zero, Complex.ofReal_one, one_mul] + +def J (h s : ℝ) (f : S) : S := 𝓕⁻ (M h s (𝓕 f)) + +lemma fourier_J (h s : ℝ) (f : S) : 𝓕 (J h s f) = M h s (𝓕 f) := by + simp only [J, FourierTransform.fourier_fourierInv_eq] + +lemma J_add_order (h s t : ℝ) (f : S) : J h (s+t) f = J h s (J h t f) := by + simp only [J, FourierTransform.fourier_fourierInv_eq, M_add] + +@[simp] lemma J_zero (h : ℝ) (f : S) : J h 0 f = f := by + simp only [J, M_zero, FourierTransform.fourierInv_fourier_eq] + +lemma J_neg_inverse (h s : ℝ) (f : S) : J h s (J h (-s) f) = f := by + rw [← J_add_order, add_neg_cancel, J_zero] + +lemma J_add (h s : ℝ) (f g : S) : J h s (f+g) = J h s f + J h s g := by + simp only [J, FourierTransform.fourier_add, map_add, FourierTransform.fourierInv_add] + +lemma J_smul (h s : ℝ) (a : ℂ) (f : S) : J h s (a • f) = a • J h s f := by + simp only [J, FourierTransform.fourier_smul, map_smul, FourierTransform.fourierInv_smul] + +lemma J_deriv (h s : ℝ) (f : S) (v : X) : J h s (∂_{v} f) = ∂_{v} (J h s f) := by + apply (FourierTransform.fourierCLE ℂ S).injective + simp only [FourierTransform.fourierCLE_apply, fourier_J, + SchwartzMap.fourier_lineDerivOp_eq] + ext x + have ht : (inner ℝ · v).HasTemperateGrowth := ((innerSL ℝ).flip v).hasTemperateGrowth + simp only [map_smul, smul_apply, M_apply, + SchwartzMap.smulLeftCLM_apply_apply ht, smul_eq_mul, Complex.real_smul] + ring + +abbrev L2 : S →L[ℂ] Lp ℂ 2 (volume : Measure X) := SchwartzMap.toLpCLM ℂ ℂ 2 (volume : Measure X) + +def norm2 (f : S) : ℝ := ‖L2 f‖ + +lemma norm2_nonneg (f : S) : 0 ≤ norm2 f := norm_nonneg _ + +lemma norm2_eq_zero (f : S) (h : norm2 f = 0) : f = 0 := by + have hi : Function.Injective L2 := SchwartzMap.injective_toLp 2 volume + apply hi + rw [map_zero] + exact norm_eq_zero.mp h + +lemma norm2_add_le (f g : S) : norm2 (f+g) ≤ norm2 f + norm2 g := by + simpa only [norm2, map_add] using norm_add_le (L2 f) (L2 g) + +lemma norm2_const_smul (a : ℂ) (f : S) : norm2 (a • f) = ‖a‖*norm2 f := by + simp only [norm2, map_smul, norm_smul] + +lemma norm2_bound (f g : S) (c : ℝ) (h : ∀ x : X, ‖f x‖ ≤ c*‖g x‖) : + norm2 f ≤ c*norm2 g := by + apply Lp.norm_le_mul_norm_of_ae_le_mul + filter_upwards [f.coeFn_toLp 2 volume, g.coeFn_toLp 2 volume] with x hx hy + change ‖f.toLp 2 volume x‖ ≤ c * ‖g.toLp 2 volume x‖ + rw [hx, hy] + exact h x + +lemma norm2_fourier (f : S) : norm2 (𝓕 f) = norm2 f := + SchwartzMap.norm_fourier_toL2_eq f + +lemma norm2_fourierInv (f : S) : norm2 (𝓕⁻ f) = norm2 f := by + have h := norm2_fourier (𝓕⁻ f) + rw [FourierTransform.fourier_fourierInv_eq] at h + exact h.symm + +lemma norm2_J (h s : ℝ) (f : S) : norm2 (J h s f) = norm2 (M h s (𝓕 f)) := + norm2_fourierInv _ + +lemma real_weight_bound (h s t c : ℝ) + (hw : ∀ x : X, weight h s x ≤ c*weight h t x) (f : S) : + norm2 (J h s f) ≤ c*norm2 (J h t f) := by + rw [norm2_J, norm2_J] + apply norm2_bound + intro x + simp only [M_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (weight_pos _ _ _)] + exact (mul_le_mul_of_nonneg_right (hw x) (norm_nonneg (𝓕 f x))).trans_eq (by ring) + +lemma fderiv_weight (h s : ℝ) (x v : X) : + fderiv ℝ (weight h s) x v = + s * (2*Real.pi*h)^2 * inner ℝ x v * weight h (s-2) x := by + let c : ℝ := 2*Real.pi*h + let L : X →L[ℝ] X := c • ContinuousLinearMap.id ℝ X + have hn : HasFDerivAt (fun y : X => 1 + ‖c • y‖^2) + (2 • (innerSL ℝ (c • x)).comp L) x := by + simpa only [L, smul_apply, ContinuousLinearMap.id_apply] using + (L.hasFDerivAt.norm_sq.const_add 1) + have hp : (1 + ‖c • x‖^2) ≠ 0 := by positivity + have hd := (hn.rpow_const (p := s/2) (Or.inl hp)).fderiv + have he : s/2-1 = (s-2)/2 := by ring + change fderiv ℝ (fun y : X => (1 + ‖c • y‖^2)^(s/2)) x v = _ + rw [hd] + simp only [smul_apply, smul_eq_mul, + ContinuousLinearMap.comp_apply, innerSL_apply_apply, L, + ContinuousLinearMap.id_apply, real_inner_smul_left, real_inner_smul_right, he] + change _ = s * c^2 * inner ℝ x v * (1+‖c • x‖^2)^((s-2)/2) + ring + +lemma fderiv_complex_weight (h s : ℝ) (x v : X) : + fderiv ℝ (fun y => (weight h s y : ℂ)) x v = + (s * (2*Real.pi*h)^2 * inner ℝ x v * weight h (s-2) x : ℝ) := by + have hw := (temperate_weight h s).1.differentiable (by simp) + have hd := (Complex.ofRealCLM.hasFDerivAt.comp x (hw x).hasFDerivAt).fderiv + calc + _ = (fderiv ℝ (weight h s) x v : ℂ) := + congrArg (fun T : X →L[ℝ] ℂ => T v) hd + _ = _ := congrArg Complex.ofReal (fderiv_weight h s x v) + +def Q (v : X) : S →L[ℂ] S := + SchwartzMap.smulLeftCLM ℂ (fun x => (inner ℝ x v : ℂ)) + +@[simp] lemma Q_apply (v : X) (f : S) (x : X) : + Q v f x = (inner ℝ x v : ℂ) * f x := by + have ht : (inner ℝ · v).HasTemperateGrowth := ((innerSL ℝ).flip v).hasTemperateGrowth + have hc := Complex.ofRealCLM.hasTemperateGrowth.comp ht + exact SchwartzMap.smulLeftCLM_apply_apply hc f x + +lemma Q_real (v : X) (f : S) : + Q v f = SchwartzMap.smulLeftCLM ℂ (inner ℝ · v) f := by + exact SchwartzMap.smulLeftCLM_ofReal ℂ (((innerSL ℝ).flip v).hasTemperateGrowth) f + +lemma deriv_M (h s : ℝ) (v : X) (f : S) : + ∂_{v} (M h s f) = M h s (∂_{v} f) + + (s*(2*Real.pi*h)^2 : ℂ) • Q v (M h (s-2) f) := by + ext x + rw [SchwartzMap.lineDerivOp_apply_eq_fderiv] + have hc : (M h s f : X → ℂ) = fun y => (weight h s y : ℂ) * f y := by + funext y + exact M_apply h s f y + rw [hc] + change fderiv ℝ ((fun y => (weight h s y : ℂ)) * (f : X → ℂ)) x v = _ + rw [fderiv_mul ((temperate_complex_weight h s).1.differentiable (by simp) x) + (f.differentiable x)] + simp only [add_apply, smul_apply, smul_eq_mul, + fderiv_complex_weight, M_apply, Q_apply, + SchwartzMap.lineDerivOp_apply_eq_fderiv, Complex.ofReal_mul] + push_cast + ring + +lemma fourier_Q (v : X) (f : S) : + 𝓕 (Q v f) = (-(2*Real.pi*Complex.I))⁻¹ • ∂_{v} (𝓕 f) := by + have hn : (-(2*Real.pi*Complex.I) : ℂ) ≠ 0 := by + simp only [ne_eq, neg_eq_zero, mul_eq_zero, Complex.ofReal_eq_zero, + OfNat.ofNat_ne_zero, Real.pi_ne_zero, Complex.I_ne_zero, or_self, not_false_eq_true] + rw [SchwartzMap.lineDerivOp_fourier_eq, FourierTransform.fourier_smul, smul_smul] + simp only [inv_mul_cancel₀ hn, one_smul, Q_real] + +lemma Q_J (h s : ℝ) (v : X) (f : S) : + Q v (J h s f) = J h s (Q v f) + + (s*h^2 : ℂ) • J h (s-2) (∂_{v} f) := by + apply (FourierTransform.fourierCLE ℂ S).injective + simp only [FourierTransform.fourierCLE_apply, FourierTransform.fourier_add, + FourierTransform.fourier_smul, fourier_Q, fourier_J, deriv_M, + SchwartzMap.fourier_lineDerivOp_eq] + ext x + have ht : (inner ℝ · v).HasTemperateGrowth := ((innerSL ℝ).flip v).hasTemperateGrowth + simp only [M_apply, Q_apply, smul_apply, add_apply, smul_eq_mul, + SchwartzMap.smulLeftCLM_apply_apply ht, Complex.real_smul] + field_simp + simp only [Complex.I_sq] + ring + +def ip (f g : S) : ℂ := inner ℂ (L2 f) (L2 g) + +lemma ip_integral (f g : S) : ip f g = ∫ x : X, star (f x) * g x := by + simpa only [ip, L2, SchwartzMap.toLpCLM_apply, RCLike.inner_apply', RCLike.star_def] + using SchwartzMap.inner_toL2_toL2_eq f g volume + +lemma norm2_sq (f : S) : norm2 f ^ 2 = (ip f f).re := by + exact (inner_self_eq_norm_sq (𝕜 := ℂ) (L2 f)).symm + +lemma ip_fourier (f g : S) : ip (𝓕 f) (𝓕 g) = ip f g := + SchwartzMap.inner_fourier_toL2_eq f g + +lemma ip_M (h s : ℝ) (f g : S) : ip (M h s f) g = ip f (M h s g) := by + simp only [ip_integral] + apply integral_congr_ae + filter_upwards [] with x + simp only [M_apply, star_mul, Complex.star_def, Complex.conj_ofReal] + ring + +lemma ip_J (h s : ℝ) (f g : S) : ip (J h s f) g = ip f (J h s g) := by + rw [← ip_fourier (J h s f) g, ← ip_fourier f (J h s g), fourier_J, fourier_J] + exact ip_M h s _ _ + +lemma norm2_J_sq (h s : ℝ) (f : S) : + norm2 (J h s f)^2 = (ip f (J h (s+s) f)).re := by + rw [norm2_sq, ip_J, ← J_add_order] + +@[simp] lemma weight_two (h : ℝ) (x : X) : + weight h 2 x = 1 + ‖(2*Real.pi*h) • x‖^2 := by + simp [weight] + +lemma weight_one_sq (h : ℝ) (x : X) : + weight h 1 x ^ 2 = 1 + ‖(2*Real.pi*h) • x‖^2 := by + rw [sq, ← weight_add, show (1 : ℝ)+1=2 by norm_num, weight_two] + +lemma norm_le_weight_one (h : ℝ) (x : X) : + ‖(2*Real.pi*h) • x‖ ≤ weight h 1 x := by + have hp := (weight_pos h 1 x).le + have he := weight_one_sq h x + nlinarith [norm_nonneg ((2*Real.pi*h) • x)] + +lemma weight_mono (h : ℝ) {s t : ℝ} (hst : s ≤ t) (x : X) : + weight h s x ≤ weight h t x := by + exact Real.rpow_le_rpow_of_exponent_le + (by nlinarith [sq_nonneg ‖(2*Real.pi*h) • x‖]) (by linarith) + +lemma norm2_J_mono (h : ℝ) {s t : ℝ} (hst : s ≤ t) (f : S) : + norm2 (J h s f) ≤ norm2 (J h t f) := by + have he := real_weight_bound h s t 1 (fun x => by + simpa only [one_mul] using weight_mono h hst x) f + simpa only [one_mul] using he + +lemma norm2_J_nonpos (h s : ℝ) (hs : s ≤ 0) (f : S) : + norm2 (J h s f) ≤ norm2 f := by + simpa only [J_zero] using norm2_J_mono h hs f + +lemma norm_fourier_deriv (v : X) (f : S) (x : X) : + ‖𝓕 (∂_{v} f) x‖ = (2*Real.pi) * |inner ℝ x v| * ‖𝓕 f x‖ := by + have ht : (inner ℝ · v).HasTemperateGrowth := ((innerSL ℝ).flip v).hasTemperateGrowth + simp only [SchwartzMap.fourier_lineDerivOp_eq, smul_apply, + SchwartzMap.smulLeftCLM_apply_apply ht, norm_smul, norm_mul, + Complex.norm_ofNat, Complex.norm_real, Real.norm_eq_abs, Complex.norm_I, + mul_one, abs_of_pos Real.pi_pos] + ring + +lemma semiclassical_frequency_bound (h : ℝ) (x v : X) : + |h| * (2*Real.pi) * |inner ℝ x v| ≤ weight h 1 x * ‖v‖ := by + have hi := abs_real_inner_le_norm x v + have hn := norm_le_weight_one h x + have hc : ‖(2*Real.pi*h) • x‖ = |h| *(2*Real.pi)*‖x‖ := by + simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_pos Real.pi_pos, + abs_of_pos (by norm_num : (0:ℝ)<2)] + ring + rw [hc] at hn + calc + |h| *(2*Real.pi)*|inner ℝ x v| ≤ |h| *(2*Real.pi)*(‖x‖*‖v‖) := + mul_le_mul_of_nonneg_left hi (by positivity) + _ = (|h| *(2*Real.pi)*‖x‖)*‖v‖ := by ring + _ ≤ weight h 1 x * ‖v‖ := mul_le_mul_of_nonneg_right hn (norm_nonneg _) + +lemma norm2_J_semideriv (h s : ℝ) (v : X) (f : S) : + norm2 ((h : ℂ) • J h (s-1) (∂_{v} f)) ≤ ‖v‖ * norm2 (J h s f) := by + rw [← norm2_fourier ((h : ℂ) • J h (s-1) (∂_{v} f)), + FourierTransform.fourier_smul, fourier_J, norm2_J] + apply norm2_bound + intro x + simp only [smul_apply, M_apply, norm_smul, norm_mul, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (weight_pos _ _ _), + norm_fourier_deriv] + have hi := semiclassical_frequency_bound h x v + have hw : weight h (s-1) x * weight h 1 x = weight h s x := by + rw [← weight_add] + congr 1 + ring + calc + |h| * (weight h (s-1) x * ((2*Real.pi)*|inner ℝ x v| *‖𝓕 f x‖)) = + weight h (s-1) x * (|h| *(2*Real.pi)*|inner ℝ x v|) * ‖𝓕 f x‖ := by ring + _ ≤ weight h (s-1) x * (weight h 1 x * ‖v‖) * ‖𝓕 f x‖ := + mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hi (weight_pos _ _ _).le) (norm_nonneg _) + _ = ‖v‖ * (weight h s x * ‖𝓕 f x‖) := by rw [← hw]; ring + +end ElasticityBessel + +/-! Positive commutator algebra on actual Schwartz functions, allowing +nonlocal Bessel shifts without silently retaining compact support. -/ +open MeasureTheory Complex SchwartzMap LineDeriv +open scoped BigOperators LineDeriv SchwartzMap +namespace ElasticitySchwartzCarleman +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev Test := SchwartzMap X ℂ + +lemma smooth (f : Test) : ContDiff ℝ (⊤ : ℕ∞) (f : X → ℂ) := f.smooth _ + +def d (v : X) : Test →ₗ[ℂ] Test := (lineDerivOpCLM ℂ Test v).toLinearMap + +@[simp] lemma d_apply (v : X) (f : Test) (z : X) : + (d v f : X → ℂ) z = fderiv ℝ (f : X → ℂ) z v := rfl + +lemma d_d (v w : X) (f : Test) (z : X) : + (d v (d w f) : X → ℂ) z = fderiv ℝ (fderiv ℝ (f : X → ℂ)) z v w := by + have hd : Differentiable ℝ (fderiv ℝ (f : X → ℂ)) := + ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ (f : X → ℂ) y w) z v = _ + rw [fderiv_clm_apply (hd z) (differentiableAt_const w)] + simp + +lemma d_comm (v w : X) (f : Test) : d v (d w f) = d w (d v f) := by + ext z + rw [d_d, d_d] + exact (smooth f).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) _ _ + +lemma deriv_conj (f : Test) (z v : X) : + fderiv ℝ (fun z => star (f z)) z v = star (fderiv ℝ (f : X → ℂ) z v) := by + have h := (Complex.conjCLE.hasFDerivAt.comp z + ((smooth f).differentiable (by simp) z).hasFDerivAt).fderiv + exact congrArg (fun L : X →L[ℝ] ℂ => L v) h + +def pair (f g : Test) : ℂ := ∫ z : X, star (f z) * g z + +lemma integrable_pair (f g : Test) : Integrable (fun z : X => star (f z)*g z) := by + have hi := (SchwartzMap.pairing (ContinuousLinearMap.mul ℝ ℂ) + (f.postcompCLM Complex.conjCLE.toContinuousLinearMap) g).integrable (μ := volume) + convert hi using 1 + ext x + rfl + +lemma pair_add_right (f g h : Test) : pair f (g+h) = pair f g + pair f h := by + simpa only [pair, FunLike.coe_add, Pi.add_apply, mul_add] using + integral_add (integrable_pair f g) (integrable_pair f h) + +lemma pair_add_left (f g h : Test) : pair (f+g) h = pair f h + pair g h := by + simpa only [pair, FunLike.coe_add, Pi.add_apply, star_add, add_mul] using + integral_add (integrable_pair f h) (integrable_pair g h) + +lemma pair_sub_right (f g h : Test) : pair f (g-h) = pair f g - pair f h := by + simpa only [pair, FunLike.coe_sub, Pi.sub_apply, mul_sub] using + integral_sub (integrable_pair f g) (integrable_pair f h) + +lemma pair_sub_left (f g h : Test) : pair (f-g) h = pair f h - pair g h := by + simpa only [pair, FunLike.coe_sub, Pi.sub_apply, star_sub, sub_mul] using + integral_sub (integrable_pair f h) (integrable_pair g h) + +lemma pair_smul_right (f g : Test) (a : ℂ) : pair f (a • g) = a * pair f g := by + simp only [pair, FunLike.coe_smul, Pi.smul_apply, smul_eq_mul] + simp_rw [← mul_assoc, mul_comm (star (f _)) a, mul_assoc] + exact integral_const_mul a _ + +lemma pair_smul_left (f g : Test) (a : ℂ) : pair (a • f) g = star a * pair f g := by + simp only [pair, FunLike.coe_smul, Pi.smul_apply, smul_eq_mul, star_mul, mul_comm (star (f _)), mul_assoc] + exact integral_const_mul (star a) _ + +/-- Coordinate derivatives are skew adjoint on the actual test space. -/ +lemma pair_real_smul_left (f g : Test) (a : ℝ) : + pair (a • f) g = (a : ℂ) * pair f g := by + rw [RCLike.real_smul_eq_coe_smul (K := ℂ) a, pair_smul_left] + simp + +lemma pair_d (f g : Test) (v : X) : pair f (d v g) = -pair (d v f) g := by + have h1 : Integrable (fun z : X => fderiv ℝ (fun z => star (f z)) z v * g z) := by + simpa only [deriv_conj, d_apply] using integrable_pair (d v f) g + have h2 : Integrable (fun z : X => star (f z)*fderiv ℝ (g : X → ℂ) z v) := + integrable_pair f (d v g) + exact integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable h1 h2 (integrable_pair f g) + (fun z _ => Complex.conjCLE.differentiableAt.comp z ((smooth f).differentiable (by simp) z)) + (fun z _ => (smooth g).differentiable (by simp) z) + |>.trans (by simp only [pair, deriv_conj, d_apply]) + +def mass (f : Test) : ℝ := (pair f f).re + +lemma mass_integral (f : Test) : mass f = ∫ z : X, Complex.normSq (f z) := by + have h := integral_re (integrable_pair f f) + simpa only [mass, pair, Complex.star_def, ← Complex.normSq_eq_conj_mul_self, + RCLike.re_to_complex, Complex.ofReal_re] using h.symm + +lemma integrable_normSq (f : Test) : Integrable (fun z : X => Complex.normSq (f z)) := by + have h := (integrable_pair f f).re + simpa only [Complex.star_def, ← Complex.normSq_eq_conj_mul_self, + RCLike.re_to_complex, Complex.ofReal_re] using h + +lemma mass_nonneg (f : Test) : 0 ≤ mass f := by + rw [mass_integral] + exact integral_nonneg fun _ => Complex.normSq_nonneg _ + +lemma mass_eq_zero (f : Test) (h : mass f = 0) : f = 0 := by + rw [mass_integral] at h + have hae := (integral_eq_zero_iff_of_nonneg + (fun z : X => Complex.normSq_nonneg (f z)) (integrable_normSq f)).mp h + have hf : (f : X → ℂ) =ᵐ[volume] 0 := by + filter_upwards [hae] with z hz + exact Complex.normSq_eq_zero.mp hz + apply SchwartzMap.ext + exact congrFun (((smooth f).continuous.ae_eq_iff_eq volume continuous_zero).mp hf) + +def e (i : Fin 3) : X := EuclideanSpace.single i 1 + +def qCLM : X →L[ℝ] ℂ := Complex.ofRealCLM.comp (EuclideanSpace.proj 0) + +@[simp] lemma qCLM_apply (x : X) : qCLM x = (x 0 : ℂ) := rfl + +@[simp] lemma qCLM_e (i : Fin 3) : qCLM (e i) = if i = 0 then 1 else 0 := by + simp [qCLM, e, EuclideanSpace.proj, apply_ite, eq_comm] + +def Q : Test →ₗ[ℂ] Test := (SchwartzMap.smulLeftCLM ℂ qCLM).toLinearMap + +@[simp] lemma Q_apply (f : Test) (x : X) : (Q f : X → ℂ) x = (x 0 : ℂ) * f x := by + exact SchwartzMap.smulLeftCLM_apply_apply qCLM.hasTemperateGrowth f x + +lemma d_Q (v : X) (f : Test) : d v (Q f) = (qCLM v) • f + Q (d v f) := by + ext x + rw [d_apply] + have hc : (Q f : X → ℂ) = fun x => qCLM x * f x := by + funext x + exact Q_apply f x + rw [hc] + simp only [add_apply, smul_apply, smul_eq_mul, Q_apply] + change fderiv ℝ (fun x => qCLM x * f x) x v = qCLM v * f x + qCLM x * ((d v f : X → ℂ) x) + have h := congrArg (fun L : X →L[ℝ] ℂ => L v) + ((qCLM.hasFDerivAt (x := x)).mul ((smooth f).differentiable (by simp) x).hasFDerivAt).fderiv + simpa [d_apply, add_comm, mul_comm, Pi.mul_def] using h + +lemma pair_Q (f g : Test) : pair f (Q g) = pair (Q f) g := by + apply integral_congr_ae + filter_upwards [] with x + simp only [Q_apply, star_mul, Complex.star_def, Complex.conj_ofReal] + ring + +/-- Affine normal derivative of the convexified linear weight. -/ +def G (a b : ℝ) : Test →ₗ[ℂ] Test := (a : ℂ) • LinearMap.id + (b : ℂ) • Q + +def lap : Test →ₗ[ℂ] Test := ∑ i : Fin 3, (d (e i)).comp (d (e i)) + +lemma lap_apply (f : Test) : lap f = d (e 0) (d (e 0) f) + + d (e 1) (d (e 1) f) + d (e 2) (d (e 2) f) := by + simp [lap, Fin.sum_univ_three] + +def A (h a b : ℝ) : Test →ₗ[ℂ] Test := + -(h : ℂ)^2 • lap - (G a b).comp (G a b) + +def B (h a b : ℝ) : Test →ₗ[ℂ] Test := + (2 * (h : ℂ)) • (G a b).comp (d (e 0)) + ((h : ℂ) * b) • LinearMap.id + +def P (h a b : ℝ) : Test →ₗ[ℂ] Test := A h a b + B h a b + +@[simp] lemma G_apply (a b : ℝ) (f : Test) (x : X) : + (G a b f : Test) x = ((a : ℂ) + b * (x 0 : ℂ)) * f x := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, + LinearMap.id_apply, add_apply, smul_apply, smul_eq_mul, Q_apply] + ring + +lemma d_G (v : X) (a b : ℝ) (f : Test) : + d v (G a b f) = ((b : ℂ) * qCLM v) • f + G a b (d v f) := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply, + map_add, map_smul, d_Q] + module + +lemma pair_G (a b : ℝ) (f g : Test) : pair f (G a b g) = pair (G a b f) g := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply, + pair_add_right, pair_smul_right, pair_add_left, pair_smul_left, pair_Q, + Complex.star_def, Complex.conj_ofReal] + +lemma lap_comm (v : X) (f : Test) : lap (d v f) = d v (lap f) := by + simp only [lap, LinearMap.sum_apply, LinearMap.comp_apply, map_sum] + apply Finset.sum_congr rfl + intro i _ + rw [d_comm (e i) v f, d_comm (e i) v (d (e i) f)] + +lemma lap_G (a b : ℝ) (f : Test) : + lap (G a b f) = (2 * (b : ℂ)) • d (e 0) f + G a b (lap f) := by + simp only [lap_apply, d_G, map_add, map_smul, qCLM_e] + norm_num [show (2 : Fin 3) ≠ 0 by decide] + module + +lemma pair_dd (v : X) (f g : Test) : + pair f (d v (d v g)) = pair (d v (d v f)) g := by + rw [pair_d, pair_d, neg_neg] + +lemma pair_lap (f g : Test) : pair f (lap g) = pair (lap f) g := by + simp only [lap_apply, pair_add_right, pair_add_left, pair_dd] + +lemma pair_A (h a b : ℝ) (f g : Test) : pair f (A h a b g) = pair (A h a b f) g := by + simp only [A, LinearMap.sub_apply, LinearMap.smul_apply, LinearMap.comp_apply, + pair_sub_right, pair_sub_left, pair_smul_right, pair_smul_left, + map_neg, map_pow, Complex.star_def, Complex.conj_ofReal] + rw [pair_lap, pair_G, pair_G] + +lemma pair_B (h a b : ℝ) (f g : Test) : pair f (B h a b g) = -pair (B h a b f) g := by + simp only [B, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.comp_apply, + LinearMap.id_apply, pair_add_right, pair_add_left, pair_smul_right, + pair_smul_left, map_mul, Complex.star_def, Complex.conj_ofReal, + map_ofNat] + rw [pair_G, pair_d, d_G] + norm_num [pair_add_left, pair_smul_left, pair_real_smul_left, e] + ring + +/-- The commutator producing the convexification gain. -/ +lemma commutator (h a b : ℝ) (f : Test) : + A h a b (B h a b f) - B h a b (A h a b f) = + (-4 * (h : ℂ)^3 * b) • d (e 0) (d (e 0) f) + + (4 * (h : ℂ) * b) • G a b (G a b f) := by + simp only [A, B, LinearMap.add_apply, LinearMap.sub_apply, LinearMap.smul_apply, + LinearMap.comp_apply, LinearMap.id_apply, map_add, map_sub, map_smul, + lap_G, lap_comm, d_G, qCLM_e] + norm_num + module + +lemma energy_identity (h a b : ℝ) (f : Test) : + mass (P h a b f) = mass (A h a b f) + mass (B h a b f) + + 4 * h^3 * b * mass (d (e 0) f) + 4 * h * b * mass (G a b f) := by + have hc : pair (A h a b f) (B h a b f) + pair (B h a b f) (A h a b f) = + (-4 * (h : ℂ)^3 * b) * pair f (d (e 0) (d (e 0) f)) + + (4 * (h : ℂ) * b) * pair f (G a b (G a b f)) := by + calc + _ = pair f (A h a b (B h a b f) - B h a b (A h a b f)) := by + rw [pair_sub_right, pair_A h a b f (B h a b f), pair_B h a b f (A h a b f)] + ring + _ = _ := by rw [commutator, pair_add_right, pair_smul_right, pair_smul_right] + rw [pair_d, pair_G] at hc + have hp : pair (P h a b f) (P h a b f) = + pair (A h a b f) (A h a b f) + pair (B h a b f) (B h a b f) + + ((4 * h^3 * b : ℝ) : ℂ) * pair (d (e 0) f) (d (e 0) f) + + ((4 * h * b : ℝ) : ℂ) * pair (G a b f) (G a b f) := by + simp only [P, LinearMap.add_apply, pair_add_right, pair_add_left] + push_cast + linear_combination hc + have hr := congrArg Complex.re hp + simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] at hr + exact hr + +lemma mass_A_le (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (f : Test) : + mass (A h a b f) ≤ mass (P h a b f) := by + rw [energy_identity] + have h₁ := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num : (0:ℝ) ≤ 4) + (pow_nonneg hh 3)) hb) (mass_nonneg (d (e 0) f)) + have h₂ := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num : (0:ℝ) ≤ 4) + hh) hb) (mass_nonneg (G a b f)) + linarith [mass_nonneg (B h a b f)] + +lemma mass_G_le (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (f : Test) : + 4*h*b*mass (G a b f) ≤ mass (P h a b f) := by + rw [energy_identity] + have h₁ := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num : (0:ℝ) ≤ 4) + (pow_nonneg hh 3)) hb) (mass_nonneg (d (e 0) f)) + linarith [mass_nonneg (A h a b f), mass_nonneg (B h a b f)] + +lemma normSq_G (a b : ℝ) (f : Test) (x : X) : + Complex.normSq (G a b f x) = (a+b*x 0)^2 * Complex.normSq (f x) := by + rw [G_apply, map_mul] + congr 1 + rw [← Complex.ofReal_mul, ← Complex.ofReal_add, Complex.normSq_ofReal] + ring + +lemma lower_mass_G (a b : ℝ) (f : Test) + (hf : ∀ x : X, f x ≠ 0 → (1/4:ℝ) ≤ (a+b*x 0)^2) : + mass f ≤ 4*mass (G a b f) := by + rw [mass_integral, mass_integral, ← integral_const_mul] + apply integral_mono (integrable_normSq f) ((integrable_normSq (G a b f)).const_mul 4) + intro x + dsimp only + rw [normSq_G] + by_cases hx : f x = 0 + · simp [hx] + · have := mul_le_mul_of_nonneg_right (hf x hx) (Complex.normSq_nonneg (f x)) + nlinarith + +lemma upper_mass_G (a b c : ℝ) (f : Test) + (hf : ∀ x : X, f x ≠ 0 → (a+b*x 0)^2 ≤ c) : + mass (G a b f) ≤ c*mass f := by + rw [mass_integral, mass_integral, ← integral_const_mul] + apply integral_mono (integrable_normSq (G a b f)) ((integrable_normSq f).const_mul c) + intro x + dsimp only + rw [normSq_G] + by_cases hx : f x = 0 + · simp [hx] + · exact mul_le_mul_of_nonneg_right (hf x hx) (Complex.normSq_nonneg (f x)) + +lemma mass_coercivity (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (f : Test) + (hf : ∀ x : X, f x ≠ 0 → (1/4:ℝ) ≤ (a+b*x 0)^2) : + h*b*mass f ≤ mass (P h a b f) := by + have h₁ := mul_le_mul_of_nonneg_left (lower_mass_G a b f hf) (mul_nonneg hh hb) + have h₂ := mass_G_le h a b hh hb f + nlinarith + +lemma pair_symm (f g : Test) : star (pair f g) = pair g f := by + simp only [pair, Complex.star_def] + rw [← integral_conj] + apply integral_congr_ae + filter_upwards [] with x + simp only [map_mul, Complex.conj_conj] + ring + +lemma pair_re_bound (f g : Test) : + 2 * (pair f g).re ≤ mass f + mass g := by + have hm := mass_nonneg (f-g) + simp only [mass, pair_sub_left, pair_sub_right, Complex.sub_re] at hm + have he := congrArg Complex.re (pair_symm f g) + simp only [Complex.star_def, Complex.conj_re] at he + change 2 * _ ≤ (pair f f).re + (pair g g).re + linarith + +def gradientMass (f : Test) : ℝ := ∑ i : Fin 3, mass (d (e i) f) + +lemma gradientMass_nonneg (f : Test) : 0 ≤ gradientMass f := + Finset.sum_nonneg fun _ _ => mass_nonneg _ + +lemma lap_energy (f : Test) : (pair f (lap f)).re = -gradientMass f := by + simp only [gradientMass, lap_apply, Fin.sum_univ_three, pair_add_right, + pair_d, Complex.add_re, Complex.neg_re, mass] + ring + +lemma kinetic_identity (h a b : ℝ) (f : Test) : + h^2 * gradientMass f = (pair f (A h a b f)).re + mass (G a b f) := by + simp only [A, LinearMap.sub_apply, LinearMap.smul_apply, LinearMap.comp_apply, + pair_sub_right, pair_smul_right, Complex.sub_re] + rw [pair_G] + have hc : -(h : ℂ)^2 = ((-h^2 : ℝ) : ℂ) := by push_cast; rfl + rw [hc, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, + lap_energy] + dsimp [mass] + ring + +/-- A concrete positive-order supported Carleman estimate. This is not yet + the negative-order estimate needed for the augmented system. -/ +lemma scalar_H1_coercivity (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) + (hsmall : h*b ≤ 1) (f : Test) + (hlo : ∀ x : X, f x ≠ 0 → (1/4:ℝ) ≤ (a+b*x 0)^2) + (hhi : ∀ x : X, f x ≠ 0 → (a+b*x 0)^2 ≤ (9/4:ℝ)) : + h*b*(mass f + h^2*gradientMass f) ≤ (17/4:ℝ)*mass (P h a b f) := by + have hm := mass_coercivity h a b hh hb f hlo + have ha := mass_A_le h a b hh hb f + have hG := upper_mass_G a b (9/4) f hhi + have hp := pair_re_bound f (A h a b f) + have hk := kinetic_identity h a b f + have hbound : h^2*gradientMass f ≤ (1/2:ℝ)*mass (P h a b f) + (11/4:ℝ)*mass f := by + linarith + have hmul := mul_le_mul_of_nonneg_left hbound (mul_nonneg hh hb) + have hsmall' := mul_le_mul_of_nonneg_right hsmall (mass_nonneg (P h a b f)) + nlinarith + +lemma mass_add_bound (f g : Test) : mass (f+g) ≤ 2*mass f+2*mass g := by + have hp := pair_re_bound f g + have he := congrArg Complex.re (pair_symm f g) + simp only [Complex.star_def, Complex.conj_re] at he + simp only [mass, pair_add_left, pair_add_right, Complex.add_re] + dsimp [mass] at hp + linarith + +lemma mass_ofReal_smul (a : ℝ) (f : Test) : mass ((a : ℂ) • f) = a^2*mass f := by + simp only [mass, pair_smul_left, pair_smul_right, Complex.star_def, + Complex.conj_ofReal, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, sub_zero] + ring + +lemma lap_mass_bound (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (f : Test) + (hhi : ∀ x : X, f x ≠ 0 → (a+b*x 0)^2 ≤ (9/4:ℝ)) : + h^4*mass (lap f) ≤ 2*mass (P h a b f) + (81/8:ℝ)*mass f := by + have he : ((-h^2 : ℝ) : ℂ) • lap f = A h a b f + G a b (G a b f) := by + simp only [A, LinearMap.sub_apply, LinearMap.smul_apply, LinearMap.comp_apply] + push_cast + module + have hm := mass_add_bound (A h a b f) (G a b (G a b f)) + rw [← he, mass_ofReal_smul] at hm + have hG := upper_mass_G a b (9/4) f hhi + have hGG := upper_mass_G a b (9/4) (G a b f) (by + intro x hx + apply hhi x + intro hzero + apply hx + simp [G_apply, hzero]) + have hA := mass_A_le h a b hh hb f + nlinarith + +/-- The two-derivative, L²-forcing estimate in concrete derivative norms. + The unproved Sobolev shift to H⁻¹ forcing is a separate required step. -/ +lemma scalar_H2_coercivity (h a b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) + (hsmall : h*b ≤ 1) (f : Test) + (hlo : ∀ x : X, f x ≠ 0 → (1/4:ℝ) ≤ (a+b*x 0)^2) + (hhi : ∀ x : X, f x ≠ 0 → (a+b*x 0)^2 ≤ (9/4:ℝ)) : + h*b*(mass f + 2*h^2*gradientMass f + h^4*mass (lap f)) ≤ + (21:ℝ)*mass (P h a b f) := by + have h₁ := scalar_H1_coercivity h a b hh hb hsmall f hlo hhi + have h₂ := lap_mass_bound h a b hh hb f hhi + have h₃ := mul_le_mul_of_nonneg_left h₂ (mul_nonneg hh hb) + have h₄ := mass_coercivity h a b hh hb f hlo + have h₅ := mul_le_mul_of_nonneg_right hsmall (mass_nonneg (P h a b f)) + have h₆ := mul_nonneg (mul_nonneg hh hb) (mass_nonneg f) + nlinarith [mass_nonneg (P h a b f)] + +lemma linear_weight_bounds (b : ℝ) (f : Test) + (hf : ∀ x : X, f x ≠ 0 → |b*x 0| ≤ (1/2:ℝ)) : + (∀ x : X, f x ≠ 0 → (1/4:ℝ) ≤ (-1+b*x 0)^2) ∧ + (∀ x : X, f x ≠ 0 → (-1+b*x 0)^2 ≤ (9/4:ℝ)) := by + constructor <;> intro x hx <;> obtain ⟨hl, hu⟩ := abs_le.mp (hf x hx) + · nlinarith [sq_nonneg (b*x 0 - 1/2)] + · nlinarith [sq_nonneg (b*x 0), sq_nonneg (b*x 0 + 1/2)] + +lemma mass_neg (f : Test) : mass (-f) = mass f := by + have he := mass_ofReal_smul (-1) f + simpa using he + +lemma affine_mass_bounds (b : ℝ) (f : Test) : + mass f ≤ 2*mass (G (-1) b f) + 2*b^2*mass (Q f) ∧ + mass (G (-1) b f) ≤ 2*mass f + 2*b^2*mass (Q f) := by + have he : f = -G (-1) b f + (b : ℂ) • Q f := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply] + push_cast + module + have ht : G (-1) b f = -f + (b : ℂ) • Q f := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply] + push_cast + module + constructor + · have hm := mass_add_bound (-G (-1) b f) ((b : ℂ) • Q f) + rw [← he, mass_neg, mass_ofReal_smul] at hm + nlinarith + · rw [ht] + have hm := mass_add_bound (-f) ((b : ℂ) • Q f) + rw [mass_neg, mass_ofReal_smul] at hm + nlinarith + +lemma affine_square_mass_bound (b : ℝ) (f : Test) : + mass (G (-1) b (G (-1) b f)) ≤ + 4*mass f+16*b^2*mass (Q f)+4*b^4*mass (Q (Q f)) := by + have hm := (affine_mass_bounds b (G (-1) b f)).2 + have hq : Q (G (-1) b f) = G (-1) b (Q f) := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply, + map_add, map_smul] + rw [hq] at hm + have hu := (affine_mass_bounds b f).2 + have hv := (affine_mass_bounds b (Q f)).2 + have he := mul_le_mul_of_nonneg_left hv (by positivity : 0 ≤ 2*b^2) + nlinarith [mul_nonneg (sq_nonneg b) (mass_nonneg (Q f))] + +/-- Schwartz Carleman algebra with controlled moments, without a false +compact-support claim for Bessel potentials. -/ +lemma scalar_H2_moment_bound (h b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) + (hsmall : h*b ≤ 1) (f : Test) : + h*b*(mass f+2*h^2*gradientMass f+h^4*mass (lap f)) ≤ + 10*mass (P h (-1) b f) + + h*b*(64*b^2*mass (Q f)+8*b^4*mass (Q (Q f))) := by + have hs := (affine_mass_bounds b f).1 + have hu := (affine_mass_bounds b f).2 + have hG := mass_G_le h (-1) b hh hb f + have hA := mass_A_le h (-1) b hh hb f + have hmul := mul_le_mul_of_nonneg_left hs (mul_nonneg hh hb) + have hm : h*b*mass f ≤ (1/2:ℝ)*mass (P h (-1) b f) + + 2*h*b^3*mass (Q f) := by nlinarith + have hk := kinetic_identity h (-1) b f + have hp := pair_re_bound f (A h (-1) b f) + have hg : h^2*gradientMass f ≤ (1/2:ℝ)*mass (P h (-1) b f)+ + (5/2:ℝ)*mass f+2*b^2*mass (Q f) := by linarith + have he : ((-h^2 : ℝ) : ℂ) • lap f = + A h (-1) b f + G (-1) b (G (-1) b f) := by + simp only [A, LinearMap.sub_apply, LinearMap.smul_apply, LinearMap.comp_apply] + push_cast + module + have hl := mass_add_bound (A h (-1) b f) (G (-1) b (G (-1) b f)) + rw [← he, mass_ofReal_smul] at hl + have hgg := affine_square_mass_bound b f + have hlap : h^4*mass (lap f) ≤ 2*mass (P h (-1) b f)+ + 8*mass f+32*b^2*mass (Q f)+8*b^4*mass (Q (Q f)) := by nlinarith + have h₁ := mul_le_mul_of_nonneg_left hg (mul_nonneg hh hb) + have h₂ := mul_le_mul_of_nonneg_left hlap (mul_nonneg hh hb) + have h₃ := mul_le_mul_of_nonneg_right hsmall (mass_nonneg (P h (-1) b f)) + nlinarith + +end ElasticitySchwartzCarleman + +namespace ElasticityNegativeOrder +open ElasticityBessel +open ElasticitySchwartzCarleman + +section +abbrev X := ElasticityBessel.X + +lemma norm2_sq_mass (f : S) : norm2 f^2 = mass f := by + rw [norm2_sq, ip_integral] + rfl + +lemma Q_bridge (f : S) : ElasticityBessel.Q (e 0) f = ElasticitySchwartzCarleman.Q f := by + ext x + simp [ElasticityBessel.Q_apply, ElasticitySchwartzCarleman.Q_apply, + e, EuclideanSpace.inner_single_right] + +lemma fourier_d (i : Fin 3) (f : S) (x : X) : + 𝓕 (d (e i) f) x = (2*Real.pi*Complex.I)*(x i : ℂ)*𝓕 f x := by + have ht : (inner ℝ · (e i)).HasTemperateGrowth := + ((innerSL ℝ).flip (e i)).hasTemperateGrowth + change 𝓕 (∂_{e i} f) x = _ + simp only [SchwartzMap.fourier_lineDerivOp_eq, smul_apply, + SchwartzMap.smulLeftCLM_apply_apply ht, Complex.real_smul, smul_eq_mul] + simp only [e, EuclideanSpace.inner_single_right, conj_trivial, one_mul] + ring + +lemma J_two (h : ℝ) (f : S) : J h 2 f = f - (h : ℂ)^2 • lap f := by + apply (FourierTransform.fourierCLE ℂ S).injective + rw [map_sub, map_smul] + simp only [FourierTransform.fourierCLE_apply, fourier_J, lap_apply, + FourierTransform.fourier_add] + ext x + simp only [M_apply, weight_two, sub_apply, add_apply, smul_apply, smul_eq_mul, + fourier_d, EuclideanSpace.real_norm_sq_eq, Fin.sum_univ_three, + PiLp.smul_apply, smul_eq_mul] + push_cast + ring_nf + simp only [Complex.I_sq] + ring + +lemma mass_sub (f g : S) : mass (f-g) = mass f - 2*(pair f g).re + mass g := by + have hs := congrArg Complex.re (pair_symm f g) + simp only [Complex.star_def, Complex.conj_re] at hs + simp only [mass, pair_sub_left, pair_sub_right, Complex.sub_re] + linarith + +lemma H2_energy (h : ℝ) (f : S) : + norm2 (J h 2 f)^2 = mass f+2*h^2*gradientMass f+h^4*mass (lap f) := by + rw [norm2_sq_mass, J_two, mass_sub] + have hc : (h : ℂ)^2 = ((h^2 : ℝ) : ℂ) := by push_cast; rfl + rw [hc, mass_ofReal_smul, pair_smul_right] + simp only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, sub_zero, lap_energy] + ring + +lemma d_eq (v : X) (f : S) : d v f = ∂_{v} f := by + ext x + rfl + +lemma semideriv_bound (h s : ℝ) (hh : 0 ≤ h) (i : Fin 3) (f : S) : + h * norm2 (J h (s-1) (d (e i) f)) ≤ norm2 (J h s f) := by + have ht := norm2_J_semideriv h s (e i) f + rw [norm2_const_smul] at ht + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hh, + e, PiLp.norm_single, norm_one, one_mul, d_eq] using ht + +lemma second_deriv_bound (h s : ℝ) (hh : 0 ≤ h) (i j : Fin 3) (f : S) : + h^2 * norm2 (J h (s-2) (d (e i) (d (e j) f))) ≤ norm2 (J h s f) := by + have h₁ := semideriv_bound h (s-1) hh i (d (e j) f) + have h₂ := semideriv_bound h s hh j f + rw [show s-1-1=s-2 by ring] at h₁ + have h₃ := mul_le_mul_of_nonneg_left h₁ hh + nlinarith only [h₂, h₃] + +lemma Q_J (h s : ℝ) (f : S) : + ElasticitySchwartzCarleman.Q (J h s f) = + J h s (ElasticitySchwartzCarleman.Q f) + + ((s*h^2 : ℝ) : ℂ) • J h (s-2) (d (e 0) f) := by + simpa only [Q_bridge, Complex.ofReal_mul, Complex.ofReal_pow, d_eq] using + ElasticityBessel.Q_J h s (e 0) f + +lemma QQ_J (h s : ℝ) (f : S) : + ElasticitySchwartzCarleman.Q (ElasticitySchwartzCarleman.Q (J h s f)) = + J h s (ElasticitySchwartzCarleman.Q (ElasticitySchwartzCarleman.Q f)) + + ((2*s*h^2 : ℝ) : ℂ) • J h (s-2) (d (e 0) (ElasticitySchwartzCarleman.Q f)) - + ((s*h^2 : ℝ) : ℂ) • J h (s-2) f + + ((s*(s-2)*h^4 : ℝ) : ℂ) • J h (s-4) (d (e 0) (d (e 0) f)) := by + rw [Q_J, map_add, map_smul, Q_J, Q_J] + have hd : ElasticitySchwartzCarleman.Q (d (e 0) f) = + d (e 0) (ElasticitySchwartzCarleman.Q f) - f := by + rw [d_Q, qCLM_e] + norm_num + rw [hd] + have hjsub (t : ℝ) (u v : S) : J h t (u-v) = J h t u - J h t v := by + rw [sub_eq_add_neg, J_add, ← neg_one_smul ℂ v, J_smul] + simp only [neg_one_smul, sub_eq_add_neg] + rw [hjsub, show s-2-2=s-4 by ring] + push_cast + module + +lemma norm2_real_smul (a : ℝ) (f : S) : + norm2 ((a : ℂ) • f) = |a| * norm2 f := by + rw [norm2_const_smul, Complex.norm_real, Real.norm_eq_abs] + +lemma norm2_sub_le (f g : S) : norm2 (f-g) ≤ norm2 f+norm2 g := by + simpa only [norm2, map_sub] using norm_sub_le (L2 f) (L2 g) + +lemma norm2_Q_supported (R : ℝ) (_hR : 0 ≤ R) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (ElasticitySchwartzCarleman.Q f) ≤ R*norm2 f := by + apply norm2_bound + intro x + rw [ElasticitySchwartzCarleman.Q_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs] + by_cases hx : f x = 0 + · simp only [hx, norm_zero, mul_zero, le_refl] + · exact mul_le_mul_of_nonneg_right (hf x hx) (norm_nonneg _) + +lemma norm2_QQ_supported (R : ℝ) (hR : 0 ≤ R) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (ElasticitySchwartzCarleman.Q (ElasticitySchwartzCarleman.Q f)) ≤ R^2*norm2 f := by + have hs := norm2_Q_supported R hR (ElasticitySchwartzCarleman.Q f) (by + intro x hx + apply hf x + intro hz + exact hx (by simp [ElasticitySchwartzCarleman.Q_apply, hz])) + have hs' := mul_le_mul_of_nonneg_left (norm2_Q_supported R hR f hf) hR + nlinarith only [hs, hs'] + +local notation "Q₀" => ElasticitySchwartzCarleman.Q +local notation "D₀" => d (e 0) + +lemma semideriv_nonpos (h s : ℝ) (hh : 0 ≤ h) (hs : s ≤ 0) + (i : Fin 3) (f : S) : + h*norm2 (J h (s-1) (d (e i) f)) ≤ norm2 f := + (semideriv_bound h s hh i f).trans (norm2_J_nonpos h s hs f) + +lemma second_deriv_nonpos (h s : ℝ) (hh : 0 ≤ h) (hs : s ≤ 0) + (i j : Fin 3) (f : S) : + h^2*norm2 (J h (s-2) (d (e i) (d (e j) f))) ≤ norm2 f := + (second_deriv_bound h s hh i j f).trans (norm2_J_nonpos h s hs f) + +lemma first_moment (h R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) (hR : 1 ≤ R) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (Q₀ (J h (-1) f)) ≤ 2*R*norm2 f := by + have he : Q₀ (J h (-1) f) = J h (-1) (Q₀ f) + + ((-h^2 : ℝ) : ℂ) • J h (-3) (D₀ f) := by + convert Q_J h (-1) f using 1; norm_num + have ht := norm2_add_le (J h (-1) (Q₀ f)) + (((-h^2 : ℝ) : ℂ) • J h (-3) (D₀ f)) + rw [← he, norm2_real_smul, abs_neg, abs_of_nonneg (sq_nonneg h)] at ht + have hA := norm2_J_nonpos h (-1) (by norm_num) (Q₀ f) + have hB : h*norm2 (J h (-3) (D₀ f)) ≤ norm2 f := by + convert semideriv_nonpos h (-2) hh (by norm_num) 0 f using 1; norm_num + have hB' := mul_le_mul_of_nonneg_left hB hh + have hQ := norm2_Q_supported R (by linarith) f hf + have hn := norm2_nonneg f + have hh' := mul_le_mul_of_nonneg_right hh1 hn + have hR' := mul_le_mul_of_nonneg_right hR hn + nlinarith only [ht, hA, hB', hQ, hh', hR'] + +lemma norm2_four_terms (a b c d : S) : + norm2 (a+b-c+d) ≤ norm2 a+norm2 b+norm2 c+norm2 d := by + have h₁ := norm2_add_le (a+b-c) d + have h₂ := norm2_sub_le (a+b) c + have h₃ := norm2_add_le a b + linarith only [h₁, h₂, h₃] + +lemma second_moment (h R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) (hR : 1 ≤ R) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (Q₀ (Q₀ (J h (-1) f))) ≤ 7*R^2*norm2 f := by + have he : Q₀ (Q₀ (J h (-1) f)) = J h (-1) (Q₀ (Q₀ f)) + + ((-2*h^2 : ℝ) : ℂ) • J h (-3) (D₀ (Q₀ f)) - + ((-h^2 : ℝ) : ℂ) • J h (-3) f + + ((3*h^4 : ℝ) : ℂ) • J h (-5) (D₀ (D₀ f)) := by + convert QQ_J h (-1) f using 1; norm_num + have ht := norm2_four_terms (J h (-1) (Q₀ (Q₀ f))) + (((-2*h^2 : ℝ) : ℂ) • J h (-3) (D₀ (Q₀ f))) + (((-h^2 : ℝ) : ℂ) • J h (-3) f) + (((3*h^4 : ℝ) : ℂ) • J h (-5) (D₀ (D₀ f))) + rw [← he] at ht + simp only [norm2_real_smul, abs_mul, abs_neg, abs_of_nonneg (sq_nonneg h), + abs_of_nonneg (pow_nonneg hh 4)] at ht + norm_num at ht + have hA := norm2_J_nonpos h (-1) (by norm_num) (Q₀ (Q₀ f)) + have hD : h*norm2 (J h (-3) (D₀ (Q₀ f))) ≤ norm2 (Q₀ f) := by + convert semideriv_nonpos h (-2) hh (by norm_num) 0 (Q₀ f) using 1; norm_num + have hD' := mul_le_mul_of_nonneg_left hD hh + have hhQ := mul_le_mul_of_nonneg_right hh1 (norm2_nonneg (Q₀ f)) + have hQ := norm2_Q_supported R (by linarith) f hf + have hQQ := norm2_QQ_supported R (by linarith) f hf + have hC := norm2_J_nonpos h (-3) (by norm_num) f + have hC' := mul_le_mul_of_nonneg_left hC (sq_nonneg h) + have hh2 : h^2 ≤ 1 := by nlinarith + have hh2n := mul_le_mul_of_nonneg_right hh2 (norm2_nonneg f) + have hDD : h^2*norm2 (J h (-5) (D₀ (D₀ f))) ≤ norm2 f := by + convert second_deriv_nonpos h (-3) hh (by norm_num) 0 0 f using 1; norm_num + have hDD' := mul_le_mul_of_nonneg_left hDD (sq_nonneg h) + have hR2 : R^2+2*R+4 ≤ 7*R^2 := by nlinarith [sq_nonneg (R-1)] + have hR2n := mul_le_mul_of_nonneg_right hR2 (norm2_nonneg f) + nlinarith only [ht, hA, hD', hhQ, hQ, hQQ, hC', hh2n, hDD', hR2n] + +lemma J_sub (h s : ℝ) (f g : S) : J h s (f-g) = J h s f-J h s g := by + rw [sub_eq_add_neg, J_add, ← neg_one_smul ℂ g, J_smul] + simp only [neg_one_smul, sub_eq_add_neg] + +lemma d_J (h s : ℝ) (v : X) (f : S) : d v (J h s f) = J h s (d v f) := by + simp only [d_eq, J_deriv] + +lemma lap_J (h s : ℝ) (f : S) : lap (J h s f) = J h s (lap f) := by + simp only [lap_apply, J_add, d_J] + +lemma P_expanded (h b : ℝ) (f : S) : + P h (-1) b f = ((-h^2 : ℝ) : ℂ) • lap f - f + + ((2*b : ℝ) : ℂ) • Q₀ f - ((b^2 : ℝ) : ℂ) • Q₀ (Q₀ f) - + ((2*h : ℝ) : ℂ) • D₀ f + ((2*h*b : ℝ) : ℂ) • Q₀ (D₀ f) + + ((h*b : ℝ) : ℂ) • f := by + simp only [P, A, B, G, LinearMap.add_apply, LinearMap.sub_apply, + LinearMap.smul_apply, LinearMap.comp_apply, LinearMap.id_apply, map_add, map_smul] + push_cast + module + +lemma P_shift (h b : ℝ) (f : S) : + P h (-1) b (J h (-1) f) = J h (-1) (P h (-1) b f) + + ((-2*b*h^2 : ℝ) : ℂ) • J h (-3) (D₀ f) + + ((2*b^2*h^2 : ℝ) : ℂ) • J h (-3) (D₀ (Q₀ f)) - + ((b^2*h^2 : ℝ) : ℂ) • J h (-3) f - + ((3*b^2*h^4 : ℝ) : ℂ) • J h (-5) (D₀ (D₀ f)) - + ((2*b*h^3 : ℝ) : ℂ) • J h (-3) (D₀ (D₀ f)) := by + simp only [P_expanded, J_add, J_sub, J_smul, lap_J, d_J] + rw [QQ_J] + simp only [Q_J] + norm_num + module + +lemma norm2_six_terms (a b c d e f : S) : + norm2 (a+b+c-d-e-f) ≤ norm2 a+norm2 b+norm2 c+norm2 d+norm2 e+norm2 f := by + have h₁ := norm2_sub_le (a+b+c-d-e) f + have h₂ := norm2_sub_le (a+b+c-d) e + have h₃ := norm2_sub_le (a+b+c) d + have h₄ := norm2_add_le (a+b) c + have h₅ := norm2_add_le a b + linarith only [h₁, h₂, h₃, h₄, h₅] + +lemma norm2_P_shift (h b R : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (hR : 0 ≤ R) + (hbR : b*R ≤ 1) (hhb : h*b ≤ 1) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (P h (-1) b (J h (-1) f)) ≤ + norm2 (J h (-1) (P h (-1) b f)) + 10*h*b*norm2 f := by + have ht := norm2_six_terms (J h (-1) (P h (-1) b f)) + (((-2*b*h^2 : ℝ) : ℂ) • J h (-3) (D₀ f)) + (((2*b^2*h^2 : ℝ) : ℂ) • J h (-3) (D₀ (Q₀ f))) + (((b^2*h^2 : ℝ) : ℂ) • J h (-3) f) + (((3*b^2*h^4 : ℝ) : ℂ) • J h (-5) (D₀ (D₀ f))) + (((2*b*h^3 : ℝ) : ℂ) • J h (-3) (D₀ (D₀ f))) + rw [← P_shift] at ht + simp only [norm2_real_smul, abs_mul, abs_pow, abs_of_nonneg hh, abs_of_nonneg hb] at ht + norm_num at ht + have hD : h*norm2 (J h (-3) (D₀ f)) ≤ norm2 f := by + convert semideriv_nonpos h (-2) hh (by norm_num) 0 f using 1; norm_num + have hDQ : h*norm2 (J h (-3) (D₀ (Q₀ f))) ≤ norm2 (Q₀ f) := by + convert semideriv_nonpos h (-2) hh (by norm_num) 0 (Q₀ f) using 1; norm_num + have hQ := norm2_Q_supported R hR f hf + have hC := norm2_J_nonpos h (-3) (by norm_num) f + have hDD5 : h^2*norm2 (J h (-5) (D₀ (D₀ f))) ≤ norm2 f := by + convert second_deriv_nonpos h (-3) hh (by norm_num) 0 0 f using 1; norm_num + have hDD3 : h^2*norm2 (J h (-3) (D₀ (D₀ f))) ≤ norm2 f := by + convert second_deriv_nonpos h (-1) hh (by norm_num) 0 0 f using 1; norm_num + have hp : 0 ≤ h*b := mul_nonneg hh hb + have hn := norm2_nonneg f + have h₁ := mul_le_mul_of_nonneg_left hD (by positivity : 0 ≤ 2*h*b) + have h₂ := mul_le_mul_of_nonneg_left (hDQ.trans hQ) (by positivity : 0 ≤ 2*b^2*h) + have h₃ := mul_le_mul_of_nonneg_left hC (by positivity : 0 ≤ b^2*h^2) + have h₄ := mul_le_mul_of_nonneg_left hDD5 (by positivity : 0 ≤ 3*b^2*h^2) + have h₅ := mul_le_mul_of_nonneg_left hDD3 (by positivity : 0 ≤ 2*b*h) + have hsmallR := mul_le_mul_of_nonneg_left hbR (by positivity : 0 ≤ 2*h*b*norm2 f) + have hsmallh := mul_le_mul_of_nonneg_left hhb (mul_nonneg hp hn) + nlinarith only [ht, h₁, h₂, h₃, h₄, h₅, hsmallR, hsmallh] + +lemma moment_coefficient_small (z : ℝ) (hz : 0 ≤ z) (hz' : z ≤ 1/100) : + 256*z^2+392*z^4 ≤ (1/4 : ℝ) := by + have h₂ := pow_le_pow_left₀ hz hz' 2 + have h₄ := pow_le_pow_left₀ hz hz' 4 + norm_num at h₂ h₄ + linarith only [h₂, h₄] + +lemma norm2_J_one_ge (h : ℝ) (f : S) : norm2 f ≤ norm2 (J h 1 f) := by + have ht := norm2_J_mono h (show (0 : ℝ) ≤ 1 by norm_num) f + simpa only [J_zero] using ht + +lemma shifted_energy (h b : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) (hhb : h*b ≤ 1) + (f : S) : + h*b*norm2 (J h 1 f)^2 ≤ 10*norm2 (P h (-1) b (J h (-1) f))^2 + + h*b*(64*b^2*norm2 (Q₀ (J h (-1) f))^2 + + 8*b^4*norm2 (Q₀ (Q₀ (J h (-1) f)))^2) := by + have ht := scalar_H2_moment_bound h b hh hb hhb (J h (-1) f) + rw [← H2_energy h (J h (-1) f)] at ht + have hj : J h 2 (J h (-1) f) = J h 1 f := by + rw [← J_add_order] + norm_num + rw [hj] at ht + simpa only [← norm2_sq_mass] using ht + +/-- The missing scalar negative-order shift, obtained using actual nonlocal +Bessel potentials and Schwartz moments, not a false preservation of support. -/ +lemma scalar_supported_shift (h b R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) + (hb : 0 ≤ b) (hR : 1 ≤ R) (hbR : b*R ≤ 1/100) (hhb : h*b ≤ 1/8000) + (f : S) (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + h*b*norm2 (J h 1 f)^2 ≤ 40*norm2 (J h (-1) (P h (-1) b f))^2 := by + have hR0 : 0 ≤ R := by linarith + have hp : 0 ≤ h*b := mul_nonneg hh hb + have hn := norm2_nonneg f + have he := shifted_energy h b hh hb (by linarith) f + have hq := first_moment h R hh hh1 hR f hf + have hqq := second_moment h R hh hh1 hR f hf + have hq₂ := pow_le_pow_left₀ (norm2_nonneg (Q₀ (J h (-1) f))) hq 2 + have hqq₂ := pow_le_pow_left₀ (norm2_nonneg (Q₀ (Q₀ (J h (-1) f)))) hqq 2 + have hq₃ := mul_le_mul_of_nonneg_left hq₂ (by positivity : 0 ≤ h*b*64*b^2) + have hqq₃ := mul_le_mul_of_nonneg_left hqq₂ (by positivity : 0 ≤ h*b*8*b^4) + have hc := moment_coefficient_small (b*R) (mul_nonneg hb hR0) hbR + have hc' := mul_le_mul_of_nonneg_left hc (mul_nonneg hp (sq_nonneg (norm2 f))) + have he' : h*b*norm2 (J h 1 f)^2 ≤ + 10*norm2 (P h (-1) b (J h (-1) f))^2+(1/4:ℝ)*h*b*norm2 f^2 := by + nlinarith only [he, hq₃, hqq₃, hc'] + have hs := norm2_P_shift h b R hh hb hR0 (by linarith) (by linarith) f hf + have hs₂ := pow_le_pow_left₀ (norm2_nonneg (P h (-1) b (J h (-1) f))) hs 2 + have hs' : norm2 (P h (-1) b (J h (-1) f))^2 ≤ + 2*norm2 (J h (-1) (P h (-1) b f))^2+200*h^2*b^2*norm2 f^2 := by + nlinarith only [hs₂, sq_nonneg (norm2 (J h (-1) (P h (-1) b f))-10*h*b*norm2 f)] + have hh' := mul_le_mul_of_nonneg_left hhb + (by positivity : 0 ≤ 2000*h*b*norm2 f^2) + have hN := pow_le_pow_left₀ hn (norm2_J_one_ge h f) 2 + have hN' := mul_le_mul_of_nonneg_left hN hp + nlinarith only [he', hs', hh', hN'] + +lemma convexified_supported (h ε R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) + (hε : 0 < ε) (hR : 1 ≤ R) (hsmall : (h/ε)*R ≤ 1/8000) + (f : S) (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + (h / Real.sqrt ε) * norm2 (J h 1 f) ≤ + 7 * norm2 (J h (-1) (P h (-1) (h/ε) f)) := by + have hb : 0 ≤ h/ε := div_nonneg hh hε.le + have hb' : h/ε ≤ 1/8000 := by + nlinarith only [mul_le_mul_of_nonneg_left hR hb, hsmall] + have hhb : h*(h/ε) ≤ 1/8000 := by + nlinarith only [mul_le_mul_of_nonneg_right hh1 hb, hb'] + have ht := scalar_supported_shift h (h/ε) R hh hh1 hb hR (by linarith) hhb f hf + have hs := Real.sq_sqrt hε.le + have hs0 := Real.sqrt_pos.mpr hε + have he : (h / Real.sqrt ε)^2 = h*(h/ε) := by + rw [div_pow, hs] + ring + have hn0 := norm2_nonneg (J h 1 f) + have hn1 := norm2_nonneg (J h (-1) (P h (-1) (h/ε) f)) + have hsN : ((h / Real.sqrt ε) * norm2 (J h 1 f))^2 = + h*(h/ε)*norm2 (J h 1 f)^2 := by rw [mul_pow, he] + nlinarith only [ht, hsN, mul_nonneg (div_nonneg hh hs0.le) hn0, hn1] + +lemma H1_energy (h : ℝ) (f : S) : + norm2 (J h 1 f)^2 = mass f + h^2*gradientMass f := by + rw [norm2_J_sq] + norm_num only [show (1:ℝ)+1=2 by norm_num] + rw [J_two, ip_integral] + change (pair f (f-(h:ℂ)^2 • lap f)).re = _ + rw [pair_sub_right, pair_smul_right] + have hc : (h:ℂ)^2 = ((h^2:ℝ):ℂ) := by push_cast; rfl + rw [hc] + simp only [Complex.sub_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero, lap_energy, mass] + ring + +def mult (a : X → ℂ) : S →L[ℂ] S := SchwartzMap.smulLeftCLM ℂ a + +lemma mult_apply (a : X → ℂ) (ha : a.HasTemperateGrowth) (f : S) (x : X) : + mult a f x = a x * f x := + SchwartzMap.smulLeftCLM_apply_apply ha f x + +lemma d_mult_apply (a : X → ℂ) (ha : a.HasTemperateGrowth) (v : X) + (f : S) (x : X) : + d v (mult a f) x = a x * d v f x + fderiv ℝ a x v * f x := by + rw [d_apply] + have he : (mult a f : X → ℂ) = a * (f : X → ℂ) := by + funext y + exact mult_apply a ha f y + rw [he, fderiv_mul (ha.1.differentiable (by simp) x) (f.differentiable x)] + simp only [add_apply, smul_apply, + smul_eq_mul, d_apply] + ring + +lemma mass_bound_two (f g k : S) (A B : ℝ) + (hab : ∀ x : X, ‖f x‖^2 ≤ A*‖g x‖^2+B*‖k x‖^2) : + mass f ≤ A*mass g+B*mass k := by + have hg := (integrable_normSq g).const_mul A + have hk := (integrable_normSq k).const_mul B + rw [mass_integral, mass_integral, mass_integral, + ← integral_const_mul, ← integral_const_mul, ← integral_add hg hk] + apply integral_mono (integrable_normSq f) (hg.add hk) + intro x + simpa only [Complex.normSq_eq_norm_sq, Pi.add_apply] using hab x + +lemma mult_mass (a : X → ℂ) (ha : a.HasTemperateGrowth) (A : ℝ) + (haA : ∀ x, ‖a x‖ ≤ A) (f : S) : + mass (mult a f) ≤ A^2*mass f := by + have ht := norm2_bound (mult a f) f A (fun x => by + rw [mult_apply a ha, norm_mul] + exact mul_le_mul_of_nonneg_right (haA x) (norm_nonneg _)) + have ht2 := pow_le_pow_left₀ (norm2_nonneg (mult a f)) ht 2 + simpa only [mul_pow, norm2_sq_mass] using ht2 + +lemma mult_deriv_mass (h : ℝ) (hh : 0 ≤ h) (a : X → ℂ) + (ha : a.HasTemperateGrowth) (A D : ℝ) + (haA : ∀ x, ‖a x‖ ≤ A) (had : ∀ x i, h*‖fderiv ℝ a x (e i)‖ ≤ D) + (f : S) (i : Fin 3) : + h^2*mass (d (e i) (mult a f)) ≤ + 2*A^2*h^2*mass (d (e i) f)+2*D^2*mass f := by + have ht := mass_bound_two ((h:ℂ) • d (e i) (mult a f)) (d (e i) f) f + (2*A^2*h^2) (2*D^2) (fun x => by + have ht := norm_add_le (a x*d (e i) f x) (fderiv ℝ a x (e i)*f x) + rw [← d_mult_apply a ha, norm_mul, norm_mul] at ht + have ht' := mul_le_mul_of_nonneg_left ht hh + have ha' := mul_le_mul_of_nonneg_right (haA x) + (mul_nonneg hh (norm_nonneg (d (e i) f x))) + have hd' := mul_le_mul_of_nonneg_right (had x i) (norm_nonneg (f x)) + have hbound : h*‖d (e i) (mult a f) x‖ ≤ + A*h*‖d (e i) f x‖+D*‖f x‖ := by nlinarith only [ht', ha', hd'] + have hb2 := pow_le_pow_left₀ (mul_nonneg hh (norm_nonneg _)) hbound 2 + simp only [smul_apply, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hh] + nlinarith only [hb2, sq_nonneg (A*h*‖d (e i) f x‖-D*‖f x‖)]) + rw [mass_ofReal_smul] at ht + exact ht + +lemma mult_H1 (h : ℝ) (hh : 0 ≤ h) (a : X → ℂ) + (ha : a.HasTemperateGrowth) (A D : ℝ) (hA : 0 ≤ A) (hD : 0 ≤ D) + (haA : ∀ x, ‖a x‖ ≤ A) (had : ∀ x i, h*‖fderiv ℝ a x (e i)‖ ≤ D) + (f : S) : + norm2 (J h 1 (mult a f)) ≤ 3*(A+D)*norm2 (J h 1 f) := by + have hm := mult_mass a ha A haA f + have hd0 := mult_deriv_mass h hh a ha A D haA had f 0 + have hd1 := mult_deriv_mass h hh a ha A D haA had f 1 + have hd2 := mult_deriv_mass h hh a ha A D haA had f 2 + have hgrad : h^2*gradientMass (mult a f) ≤ + 2*A^2*h^2*gradientMass f+6*D^2*mass f := by + simp only [gradientMass, Fin.sum_univ_three] + linarith only [hd0, hd1, hd2] + have hn := H1_energy h (mult a f) + have hn' := H1_energy h f + have hc : A^2+6*D^2 ≤ (3*(A+D))^2 := by nlinarith [mul_nonneg hA hD] + have hc' : 2*A^2 ≤ (3*(A+D))^2 := by nlinarith [mul_nonneg hA hD] + have hb₀ := mul_le_mul_of_nonneg_right hc (mass_nonneg f) + have hb₁ := mul_le_mul_of_nonneg_right hc' + (mul_nonneg (sq_nonneg h) (gradientMass_nonneg f)) + have hb : norm2 (J h 1 (mult a f))^2 ≤ (3*(A+D)*norm2 (J h 1 f))^2 := by + nlinarith only [hm, hgrad, hn, hn', hb₀, hb₁] + exact (sq_le_sq₀ (norm2_nonneg _) + (mul_nonneg (by positivity) (norm2_nonneg _))).mp hb + +lemma temperate_conj (a : X → ℂ) (ha : a.HasTemperateGrowth) : + (fun x => star (a x)).HasTemperateGrowth := + Complex.conjCLE.toContinuousLinearMap.hasTemperateGrowth.comp ha + +lemma fderiv_conj (a : X → ℂ) (ha : a.HasTemperateGrowth) (x v : X) : + fderiv ℝ (fun x => star (a x)) x v = star (fderiv ℝ a x v) := by + exact congrArg (fun L : X →L[ℝ] ℂ => L v) + (Complex.conjCLE.hasFDerivAt.comp x + (ha.1.differentiable (by simp) x).hasFDerivAt).fderiv + +lemma ip_mult (a : X → ℂ) (ha : a.HasTemperateGrowth) (f g : S) : + ip (mult a f) g = ip f (mult (fun x => star (a x)) g) := by + simp only [ip_integral] + apply integral_congr_ae + filter_upwards [] with x + rw [mult_apply a ha, mult_apply _ (temperate_conj a ha)] + simp only [star_mul] + ring + +lemma ip_shift (h : ℝ) (f g : S) : + ip f g = ip (J h (-1) f) (J h 1 g) := by + rw [ip_J, ← J_add_order] + norm_num + +lemma ip_re_shift_bound (h : ℝ) (f g : S) : + (ip f g).re ≤ norm2 (J h (-1) f)*norm2 (J h 1 g) := by + rw [ip_shift h] + exact (Complex.re_le_norm _).trans (norm_inner_le_norm _ _) + +lemma mult_Hneg1 (h : ℝ) (hh : 0 ≤ h) (a : X → ℂ) + (ha : a.HasTemperateGrowth) (A D : ℝ) (hA : 0 ≤ A) (hD : 0 ≤ D) + (haA : ∀ x, ‖a x‖ ≤ A) (had : ∀ x i, h*‖fderiv ℝ a x (e i)‖ ≤ D) + (f : S) : + norm2 (J h (-1) (mult a f)) ≤ 3*(A+D)*norm2 (J h (-1) f) := by + let w := mult a f + let g := J h (-2) w + have had' : ∀ x i, h*‖fderiv ℝ (fun y => star (a y)) x (e i)‖ ≤ D := by + intro x i + rw [fderiv_conj a ha, norm_star] + exact had x i + have hm := mult_H1 h hh (fun x => star (a x)) (temperate_conj a ha) A D hA hD + (fun x => by simpa only [norm_star] using haA x) had' g + have hj : J h 1 g = J h (-1) w := by + dsimp only [g] + rw [← J_add_order] + norm_num + rw [hj] at hm + have hn : norm2 (J h (-1) w)^2 = (ip w g).re := by + dsimp only [g] + convert norm2_J_sq h (-1) w using 1; norm_num + have hpair : ip w g = ip f (mult (fun x => star (a x)) g) := ip_mult a ha f g + rw [hpair] at hn + have hi := ip_re_shift_bound h f (mult (fun x => star (a x)) g) + have hm' := mul_le_mul_of_nonneg_left hm (norm2_nonneg (J h (-1) f)) + have hbound : norm2 (J h (-1) w)^2 ≤ + (3*(A+D)*norm2 (J h (-1) f))*norm2 (J h (-1) w) := by + nlinarith only [hn, hi, hm'] + have hn0 := norm2_nonneg (J h (-1) w) + have hc0 : 0 ≤ 3*(A+D)*norm2 (J h (-1) f) := + mul_nonneg (by positivity) (norm2_nonneg _) + change norm2 (J h (-1) w) ≤ _ + nlinarith only [hbound, hn0, hc0] + +lemma norm2_sum_le {ι : Type*} (T : Finset ι) (f : ι → S) : + norm2 (∑ i ∈ T, f i) ≤ ∑ i ∈ T, norm2 (f i) := by + simpa only [norm2, map_sum] using norm_sum_le T (fun i => L2 (f i)) + +lemma norm2_mult (a : X → ℂ) (ha : a.HasTemperateGrowth) (A : ℝ) + (haA : ∀ x, ‖a x‖ ≤ A) (f : S) : norm2 (mult a f) ≤ A*norm2 f := by + apply norm2_bound + intro x + rw [mult_apply a ha, norm_mul] + exact mul_le_mul_of_nonneg_right (haA x) (norm_nonneg _) + +lemma norm2_G_supported (b R : ℝ) (hb : 0 ≤ b) (hR : 0 ≤ R) (hbR : b*R ≤ 1) + (f : S) (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (G (-1) b f) ≤ 2*norm2 f := by + have he : G (-1) b f = -f+(b:ℂ) • Q₀ f := by + simp only [G, LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply] + push_cast + module + rw [he] + have ht := norm2_add_le (-f) ((b:ℂ) • Q₀ f) + have hn : norm2 (-f) = norm2 f := by simp only [norm2, map_neg, norm_neg] + rw [hn, norm2_real_smul, abs_of_nonneg hb] at ht + have hq := mul_le_mul_of_nonneg_left (norm2_Q_supported R hR f hf) hb + have hc := mul_le_mul_of_nonneg_right hbR (norm2_nonneg f) + nlinarith only [ht, hq, hc] + +def conjugatedDeriv (h b : ℝ) (i : Fin 3) (f : S) : S := + ((h^2:ℝ):ℂ) • d (e i) f - (if i=0 then (h:ℂ) • G (-1) b f else 0) + +lemma norm2_conjugatedDeriv (h b R : ℝ) (hh : 0 ≤ h) (hb : 0 ≤ b) + (hR : 0 ≤ R) (hbR : b*R ≤ 1) (f : S) + (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) (i : Fin 3) : + norm2 (conjugatedDeriv h b i f) ≤ 3*h*norm2 (J h 1 f) := by + have hd := semideriv_bound h 1 hh i f + norm_num only [sub_self, J_zero] at hd + have hd' := mul_le_mul_of_nonneg_left hd hh + have hg := norm2_G_supported b R hb hR hbR f hf + have hg' := mul_le_mul_of_nonneg_left hg hh + have hf' := mul_le_mul_of_nonneg_left (norm2_J_one_ge h f) hh + unfold conjugatedDeriv + split_ifs with hi + · have ht := norm2_sub_le (((h^2:ℝ):ℂ) • d (e i) f) ((h:ℂ) • G (-1) b f) + rw [norm2_real_smul, norm2_real_smul, abs_of_nonneg (sq_nonneg h), abs_of_nonneg hh] at ht + nlinarith only [ht, hd', hg', hf'] + · simp only [sub_zero, norm2_real_smul, abs_of_nonneg (sq_nonneg h)] + have hn := mul_nonneg hh (norm2_nonneg (J h 1 f)) + nlinarith only [hd', hn] + +def lowerOrder (h b : ℝ) (a : Fin 3 → X → ℂ) (v : X → ℂ) (f : S) : S := + (∑ i : Fin 3, mult (a i) (conjugatedDeriv h b i f)) + ((h^2:ℝ):ℂ) • mult v f + +lemma norm2_lowerOrder (h b R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) (hb : 0 ≤ b) + (hR : 0 ≤ R) (hbR : b*R ≤ 1) (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ i x, ‖a i x‖ ≤ A) (hvV : ∀ x, ‖v x‖ ≤ V) + (f : S) (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (lowerOrder h b a v f) ≤ (9*A+V)*h*norm2 (J h 1 f) := by + have hd (i : Fin 3) : norm2 (mult (a i) (conjugatedDeriv h b i f)) ≤ + 3*A*h*norm2 (J h 1 f) := by + have ht := norm2_mult (a i) (ha i) A (haA i) (conjugatedDeriv h b i f) + have hc := mul_le_mul_of_nonneg_left + (norm2_conjugatedDeriv h b R hh hb hR hbR f hf i) hA + nlinarith only [ht, hc] + have hdSum := norm2_sum_le Finset.univ (fun i => mult (a i) (conjugatedDeriv h b i f)) + simp only [Fin.sum_univ_three] at hdSum + have hv' := norm2_mult v hv V hvV f + have hv'' := mul_le_mul_of_nonneg_left hv' (sq_nonneg h) + have hn := norm2_J_one_ge h f + have hn' := mul_le_mul_of_nonneg_left hn (mul_nonneg hV hh) + have hsmall := mul_le_mul_of_nonneg_right hh1 + (mul_nonneg (mul_nonneg hh hV) (norm2_nonneg f)) + have ht := norm2_add_le (∑ i : Fin 3, mult (a i) (conjugatedDeriv h b i f)) + (((h^2:ℝ):ℂ) • mult v f) + rw [norm2_real_smul, abs_of_nonneg (sq_nonneg h)] at ht + change norm2 (lowerOrder h b a v f) ≤ _ at ht + simp only [Fin.sum_univ_three] at ht + nlinarith only [ht, hdSum, hd 0, hd 1, hd 2, hv'', hn', hsmall] + +lemma scalar_perturbed (h ε R : ℝ) (hh : 0 < h) (hh1 : h ≤ 1) + (hε : 0 < ε) (hR : 1 ≤ R) (hsmall : (h/ε)*R ≤ 1/8000) + (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ i x, ‖a i x‖ ≤ A) (hvV : ∀ x, ‖v x‖ ≤ V) + (habsorb : 14*(9*A+V)*Real.sqrt ε ≤ 1) + (f : S) (hf : ∀ x : X, f x ≠ 0 → |x 0| ≤ R) : + norm2 (J h 1 f) ≤ (14*Real.sqrt ε/h) * + norm2 (J h (-1) (P h (-1) (h/ε) f + lowerOrder h (h/ε) a v f)) := by + have ht := convexified_supported h ε R hh.le hh1 hε hR hsmall f hf + have hp := norm2_lowerOrder h (h/ε) R hh.le hh1 (div_nonneg hh.le hε.le) + (by linarith) (by linarith) a v ha hv A V hA hV haA hvV f hf + have hj := norm2_J_nonpos h (-1) (by norm_num) (lowerOrder h (h/ε) a v f) + have he : P h (-1) (h/ε) f = + (P h (-1) (h/ε) f+lowerOrder h (h/ε) a v f)-lowerOrder h (h/ε) a v f := by abel + have hn := norm2_sub_le + (J h (-1) (P h (-1) (h/ε) f+lowerOrder h (h/ε) a v f)) + (J h (-1) (lowerOrder h (h/ε) a v f)) + rw [← J_sub] at hn + rw [← he] at hn + have hs0 := Real.sqrt_pos.mpr hε + have hts := mul_le_mul_of_nonneg_left ht hs0.le + have hs : Real.sqrt ε * (h / Real.sqrt ε) = h := by field_simp + rw [← mul_assoc, hs] at hts + have hb := mul_le_mul_of_nonneg_right habsorb + (mul_nonneg hh.le (norm2_nonneg (J h 1 f))) + have hn' := mul_le_mul_of_nonneg_left hn hs0.le + have hp' := mul_le_mul_of_nonneg_left (hj.trans hp) hs0.le + rw [div_mul_eq_mul_div] + apply (le_div_iff₀ hh).mpr + nlinarith only [hts, hb, hn', hp'] + +/-- Componentwise ℓ¹ auxiliary norm; the actual Hermitian Sobolev norm is +`sobNorm` below, and is compared explicitly, not substituted in the statement. -/ +def sumNorm {n : ℕ} (h s : ℝ) (U : Fin n → S) : ℝ := + ∑ i, norm2 (J h s (U i)) + +def sobNorm {n : ℕ} (h s : ℝ) (U : Fin n → S) : ℝ := + Real.sqrt (∑ i, norm2 (J h s (U i))^2) + +lemma sumNorm_nonneg {n : ℕ} (h s : ℝ) (U : Fin n → S) : 0 ≤ sumNorm h s U := + Finset.sum_nonneg (fun _ _ => norm2_nonneg _) + +lemma sobNorm_le_sumNorm {n : ℕ} (h s : ℝ) (U : Fin n → S) : + sobNorm h s U ≤ sumNorm h s U := by + have hn : 0 ≤ ∑ i, norm2 (J h s (U i))^2 := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hs := Real.sq_sqrt hn + have ht := Finset.sum_sq_le_sq_sum_of_nonneg + (s := Finset.univ) (f := fun i => norm2 (J h s (U i))) (fun _ _ => norm2_nonneg _) + dsimp only [sobNorm, sumNorm] + have hsum := sumNorm_nonneg h s U + dsimp only [sumNorm] at hsum + nlinarith only [hs, ht, hsum, Real.sqrt_nonneg (∑ i, norm2 (J h s (U i))^2)] + +lemma sumNorm_four_le (h s : ℝ) (U : Fin 4 → S) : + sumNorm h s U ≤ 2*sobNorm h s U := by + have hn : 0 ≤ ∑ i, norm2 (J h s (U i))^2 := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hs := Real.sq_sqrt hn + have ht := sq_sum_le_card_mul_sum_sq + (s := Finset.univ) (f := fun i => norm2 (J h s (U i))) + norm_num only [Finset.card_univ, Fintype.card_fin, Nat.cast_ofNat] at ht + dsimp only [sobNorm, sumNorm] + nlinarith only [hs, ht, Real.sqrt_nonneg (∑ i, norm2 (J h s (U i))^2)] + +def lowerSystem {n : ℕ} (h b : ℝ) (a : Fin 3 → Fin n → Fin n → X → ℂ) + (v : Fin n → Fin n → X → ℂ) (U : Fin n → S) (i : Fin n) : S := + ∑ j, lowerOrder h b (fun k => a k i j) (v i j) (U j) + +lemma lowerSystem_bound {n : ℕ} (h b R : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) + (hb : 0 ≤ b) (hR : 0 ≤ R) (hbR : b*R ≤ 1) + (a : Fin 3 → Fin n → Fin n → X → ℂ) (v : Fin n → Fin n → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) + (U : Fin n → S) (hU : ∀ i x, U i x ≠ 0 → |x 0| ≤ R) : + sumNorm h (-1) (lowerSystem h b a v U) ≤ + (n*(9*A+V))*h*sumNorm h 1 U := by + have hc (i : Fin n) : norm2 (lowerSystem h b a v U i) ≤ + (9*A+V)*h*sumNorm h 1 U := by + calc + _ ≤ ∑ j, norm2 (lowerOrder h b (fun k => a k i j) (v i j) (U j)) := + norm2_sum_le _ _ + _ ≤ ∑ j, (9*A+V)*h*norm2 (J h 1 (U j)) := Finset.sum_le_sum (fun j _ => + norm2_lowerOrder h b R hh hh1 hb hR hbR _ _ + (fun k => ha k i j) (hv i j) A V hA hV (fun k => haA k i j) (hvV i j) (U j) (hU j)) + _ = _ := by rw [← Finset.mul_sum]; rfl + have ht := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + (norm2_J_nonpos h (-1) (by norm_num) (lowerSystem h b a v U i)).trans (hc i)) + simpa only [sumNorm, Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_assoc] using ht + +lemma system_perturbed_l1 {n : ℕ} (h ε R : ℝ) (hh : 0 < h) (hh1 : h ≤ 1) + (hε : 0 < ε) (hR : 1 ≤ R) (hsmall : (h/ε)*R ≤ 1/8000) + (a : Fin 3 → Fin n → Fin n → X → ℂ) (v : Fin n → Fin n → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) + (habsorb : 14*(n*(9*A+V))*Real.sqrt ε ≤ 1) + (U : Fin n → S) (hU : ∀ i x, U i x ≠ 0 → |x 0| ≤ R) : + sumNorm h 1 U ≤ (14*Real.sqrt ε/h) * + sumNorm h (-1) (fun i => P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i) := by + have ht := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + convexified_supported h ε R hh.le hh1 hε hR hsmall (U i) (hU i)) + simp only [← Finset.mul_sum] at ht + change (h/Real.sqrt ε)*sumNorm h 1 U ≤ + 7*sumNorm h (-1) (fun i => P h (-1) (h/ε) (U i)) at ht + have hp := lowerSystem_bound h (h/ε) R hh.le hh1 (div_nonneg hh.le hε.le) + (by linarith) (by linarith) a v ha hv A V hA hV haA hvV U hU + have hn0 (i : Fin n) : norm2 (J h (-1) (P h (-1) (h/ε) (U i))) ≤ + norm2 (J h (-1) (P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i))+ + norm2 (J h (-1) (lowerSystem h (h/ε) a v U i)) := by + have he : P h (-1) (h/ε) (U i) = + (P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i)-lowerSystem h (h/ε) a v U i := by abel + have hn := norm2_sub_le + (J h (-1) (P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i)) + (J h (-1) (lowerSystem h (h/ε) a v U i)) + rwa [← J_sub, ← he] at hn + have hn := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hn0 i) + rw [Finset.sum_add_distrib] at hn + change sumNorm h (-1) (fun i => P h (-1) (h/ε) (U i)) ≤ + sumNorm h (-1) (fun i => P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i) + + sumNorm h (-1) (lowerSystem h (h/ε) a v U) at hn + have hs0 := Real.sqrt_pos.mpr hε + have hts := mul_le_mul_of_nonneg_left ht hs0.le + have hs : Real.sqrt ε * (h / Real.sqrt ε) = h := by field_simp + rw [← mul_assoc, hs] at hts + have hb := mul_le_mul_of_nonneg_right habsorb + (mul_nonneg hh.le (sumNorm_nonneg h 1 U)) + have hn' := mul_le_mul_of_nonneg_left hn hs0.le + have hp' := mul_le_mul_of_nonneg_left hp hs0.le + rw [div_mul_eq_mul_div] + apply (le_div_iff₀ hh).mpr + nlinarith only [hts, hb, hn', hp'] + +lemma system_four_perturbed (h ε R : ℝ) (hh : 0 < h) (hh1 : h ≤ 1) + (hε : 0 < ε) (hR : 1 ≤ R) (hsmall : (h/ε)*R ≤ 1/8000) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) + (habsorb : 56*(9*A+V)*Real.sqrt ε ≤ 1) + (U : Fin 4 → S) (hU : ∀ i x, U i x ≠ 0 → |x 0| ≤ R) : + sobNorm h 1 U ≤ (28*Real.sqrt ε/h) * + sobNorm h (-1) (fun i => P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i) := by + have ht := system_perturbed_l1 h ε R hh hh1 hε hR hsmall a v ha hv A V hA hV haA hvV + (by norm_num; nlinarith only [habsorb]) U hU + have hl := sobNorm_le_sumNorm h 1 U + have hr := sumNorm_four_le h (-1) + (fun i => P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i) + have hr' := mul_le_mul_of_nonneg_left hr + (show 0 ≤ 14*Real.sqrt ε/h from + div_nonneg (mul_nonneg (by norm_num) (Real.sqrt_nonneg ε)) hh.le) + calc + _ ≤ (14*Real.sqrt ε/h)*(2*sobNorm h (-1) + (fun i => P h (-1) (h/ε) (U i)+lowerSystem h (h/ε) a v U i)) := hl.trans (ht.trans hr') + _ = _ := by ring + +end + +section +local notation "Q₀" => ElasticitySchwartzCarleman.Q +/-- Support in a fixed closed Euclidean ball. -/ +def BallSupported (R : ℝ) (f : S) : Prop := + ∀ x : X, f x ≠ 0 → ‖x‖ ≤ R + +lemma BallSupported.add {R : ℝ} {f g : S} (hf : BallSupported R f) + (hg : BallSupported R g) : BallSupported R (f+g) := by + intro x hx + by_contra hn + have hf0 : f x = 0 := by by_contra h; exact hn (hf x h) + have hg0 : g x = 0 := by by_contra h; exact hn (hg x h) + exact hx (by simp [hf0, hg0]) + +lemma BallSupported.smul {R : ℝ} {f : S} (hf : BallSupported R f) (c : ℂ) : + BallSupported R (c • f) := by + intro x hx + exact hf x (fun h => hx (by simp [h])) + +lemma BallSupported.d {R : ℝ} {f : S} (hf : BallSupported R f) (v : X) : + BallSupported R (d v f) := by + have ht : tsupport (f : X → ℂ) ⊆ {x : X | ‖x‖ ≤ R} := + closure_minimal (fun x hx => hf x hx) (isClosed_le continuous_norm continuous_const) + intro x hx + exact ht ((tsupport_fderiv_apply_subset ℝ v) (subset_closure hx)) + +lemma BallSupported.Q {R : ℝ} {f : S} (hf : BallSupported R f) : + BallSupported R (Q f) := by + intro x hx + exact hf x (fun h => hx (by simp [ElasticitySchwartzCarleman.Q_apply, h])) + +lemma BallSupported.mult {R : ℝ} {f : S} (hf : BallSupported R f) + (a : X → ℂ) (ha : a.HasTemperateGrowth) : BallSupported R (mult a f) := by + intro x hx + exact hf x (fun h => hx (by rw [mult_apply a ha, h, mul_zero])) + +lemma BallSupported.coordinate {R : ℝ} {f : S} (hf : BallSupported R f) : + ∀ x : X, f x ≠ 0 → |x 0| ≤ R := by + intro x hx + have hc : |x 0| ≤ ‖x‖ := by + simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le x 0 + exact hc.trans (hf x hx) + +def cutoff (R : ℝ) (hR : 1 ≤ R) : ContDiffBump (0 : X) where + rIn := R+1 + rOut := R+2 + rIn_pos := by linarith + rIn_lt_rOut := by linarith + +def expQuad (c : ℂ) (x : X) : ℂ := Complex.exp ((c/2)*(qCLM x)^2) + +lemma smooth_expQuad (c : ℂ) : ContDiff ℝ (⊤ : ℕ∞) (expQuad c) := + (contDiff_const.mul (qCLM.contDiff.pow 2)).cexp + +lemma fderiv_expQuad (c : ℂ) (x v : X) : + fderiv ℝ (expQuad c) x v = expQuad c x*c*qCLM x*qCLM v := by + have hd := (((qCLM.hasFDerivAt (x := x)).mul (qCLM.hasFDerivAt (x := x))).const_mul (c/2)).cexp + have he := congrArg (fun L : X →L[ℝ] ℂ => L v) hd.fderiv + change fderiv ℝ (fun y => Complex.exp ((c/2)*(qCLM y*qCLM y))) x v = _ at he + simp only [Pi.mul_apply, add_apply, smul_apply, + smul_eq_mul] at he + unfold expQuad + simp_rw [pow_two] + rw [he] + ring + +def weightCut (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (x : X) : ℂ := + (cutoff R hR x : ℂ)*expQuad c x + +lemma compact_weightCut (R : ℝ) (hR : 1 ≤ R) (c : ℂ) : + HasCompactSupport (weightCut R hR c) := by + apply HasCompactSupport.mul_right + exact (cutoff R hR).hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + +lemma smooth_weightCut (R : ℝ) (hR : 1 ≤ R) (c : ℂ) : + ContDiff ℝ (⊤ : ℕ∞) (weightCut R hR c) := + (Complex.ofRealCLM.contDiff.comp (cutoff R hR).contDiff).mul (smooth_expQuad c) + +lemma temperate_weightCut (R : ℝ) (hR : 1 ≤ R) (c : ℂ) : + (weightCut R hR c).HasTemperateGrowth := + (compact_weightCut R hR c).hasTemperateGrowth (smooth_weightCut R hR c) + +def W (R : ℝ) (hR : 1 ≤ R) (c : ℂ) : S →L[ℂ] S := mult (weightCut R hR c) + +lemma W_apply (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) + (hf : BallSupported R f) (x : X) : W R hR c f x = expQuad c x*f x := by + rw [W, mult_apply _ (temperate_weightCut R hR c)] + by_cases hx : f x = 0 + · simp only [hx, mul_zero] + · have hc : cutoff R hR x = 1 := (cutoff R hR).one_of_mem_closedBall (by + simp only [Metric.mem_closedBall, dist_zero_right] + change ‖x‖ ≤ R+1 + linarith [hf x hx]) + simp only [weightCut, hc, Complex.ofReal_one, one_mul] + +lemma BallSupported.W {R : ℝ} {f : S} (hf : BallSupported R f) (hR : 1 ≤ R) (c : ℂ) : + BallSupported R (W R hR c f) := hf.mult _ (temperate_weightCut R hR c) + +lemma d_W (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) (hf : BallSupported R f) (v : X) : + d v (W R hR c f) = W R hR c (d v f+(c*qCLM v) • Q f) := by + ext x + rw [W_apply R hR c _ ((hf.d v).add (hf.Q.smul _)), d_apply] + have he : (W R hR c f : X → ℂ) = fun x => expQuad c x*f x := + funext (W_apply R hR c f hf) + rw [he] + change (fderiv ℝ (expQuad c * (f : X → ℂ)) x) v = _ + rw [fderiv_mul ((smooth_expQuad c).differentiable (by simp) x) (f.differentiable x)] + simp only [add_apply, smul_apply, smul_eq_mul, ElasticitySchwartzCarleman.Q_apply, d_apply, fderiv_expQuad, + qCLM_apply] + ring + +lemma lap_W (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) (hf : BallSupported R f) : + lap (W R hR c f) = W R hR c (lap f+(2*c) • Q (d (e 0) f)+c • f+c^2 • Q (Q f)) := by + have hv (v : X) : + d v (d v (W R hR c f)) = W R hR c + (d v (d v f)+(2*c*qCLM v) • Q (d v f)+ + (c*(qCLM v)^2) • f+(c^2*(qCLM v)^2) • Q (Q f)) := by + rw [d_W R hR c f hf v, d_W R hR c _ ((hf.d v).add (hf.Q.smul _)) v] + simp only [map_add, map_smul, d_Q, smul_add, smul_smul] + module + simp only [lap_apply, hv, map_add, map_smul, qCLM_e] + norm_num [show (2 : Fin 3) ≠ 0 by decide] + module + +lemma W_inverse (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) (hf : BallSupported R f) : + W R hR (-c) (W R hR c f) = f := by + ext x + rw [W_apply R hR (-c) _ (hf.W hR c), W_apply R hR c f hf] + simp only [expQuad, ← mul_assoc, ← Complex.exp_add] + have he : (-c/2)*(qCLM x)^2+(c/2)*(qCLM x)^2 = 0 := by ring + rw [he, Complex.exp_zero, one_mul] + +lemma Q_W (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) : + Q (W R hR c f) = W R hR c (Q f) := by + ext x + simp only [ElasticitySchwartzCarleman.Q_apply, W, + mult_apply _ (temperate_weightCut R hR c)] + ring + +lemma mult_W (R : ℝ) (hR : 1 ≤ R) (c : ℂ) (f : S) + (a : X → ℂ) (ha : a.HasTemperateGrowth) : + mult a (W R hR c f) = W R hR c (mult a f) := by + ext x + simp only [W, mult_apply _ ha, mult_apply _ (temperate_weightCut R hR c)] + ring + +lemma P_W (R : ℝ) (hR : 1 ≤ R) (c h : ℝ) (f : S) (hf : BallSupported R f) : + P h (-1) (h*c) (W R hR c f) = W R hR c (P h (-1) 0 f) := by + rw [P_expanded, P_expanded, lap_W R hR c f hf, d_W R hR c f hf] + simp only [qCLM_e, Q_W, map_add, map_sub, map_smul] + push_cast + module + +lemma conjugatedDeriv_W (R : ℝ) (hR : 1 ≤ R) (c h : ℝ) (f : S) + (hf : BallSupported R f) (i : Fin 3) : + conjugatedDeriv h (h*c) i (W R hR c f) = W R hR c (conjugatedDeriv h 0 i f) := by + unfold conjugatedDeriv + rw [d_W R hR c f hf] + simp only [qCLM_e, G, LinearMap.add_apply, LinearMap.smul_apply, + LinearMap.id_apply, Q_W, map_smul, map_add, map_sub] + split_ifs <;> simp only [map_add, map_smul, map_zero] <;> push_cast <;> module + +lemma lowerOrder_W (R : ℝ) (hR : 1 ≤ R) (c h : ℝ) (f : S) + (hf : BallSupported R f) (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) : + lowerOrder h (h*c) a v (W R hR c f) = W R hR c (lowerOrder h 0 a v f) := by + simp only [lowerOrder, conjugatedDeriv_W R hR c h f hf, + mult_W R hR c _ _ hv, mult_W R hR c _ _ (ha _), map_add, map_smul, map_sum] + +lemma compact_mult_bounds (a : X → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hc : HasCompactSupport a) : + ∃ C : ℝ, 0 < C ∧ ∀ h : ℝ, 0 ≤ h → h ≤ 1 → ∀ f : S, + norm2 (J h 1 (mult a f)) ≤ C*norm2 (J h 1 f) ∧ + norm2 (J h (-1) (mult a f)) ≤ C*norm2 (J h (-1) f) := by + obtain ⟨x₀, hx₀⟩ := ha.continuous.norm.exists_forall_ge_of_hasCompactSupport hc.norm + obtain ⟨x₁, hx₁⟩ := (ha.continuous_fderiv (by simp)).norm.exists_forall_ge_of_hasCompactSupport + (hc.fderiv ℝ).norm + let M := 1+‖a x₀‖+‖fderiv ℝ a x₁‖ + have hM : 0 < M := by dsimp only [M]; positivity + refine ⟨6*M, by positivity, fun h hh hh1 f => ?_⟩ + have hb : ∀ x, ‖a x‖ ≤ M := fun x => by + dsimp only [M]; linarith [hx₀ x, norm_nonneg (fderiv ℝ a x₁)] + have hd : ∀ x i, h*‖fderiv ℝ a x (e i)‖ ≤ M := by + intro x i + have he : ‖e i‖ = 1 := by simp [e, PiLp.norm_single] + have hop := (fderiv ℝ a x).le_opNorm (e i) + rw [he, mul_one] at hop + calc + _ ≤ ‖fderiv ℝ a x (e i)‖ := by nlinarith only [hh1, norm_nonneg (fderiv ℝ a x (e i))] + _ ≤ ‖fderiv ℝ a x‖ := hop + _ ≤ M := by dsimp only [M]; linarith [hx₁ x, norm_nonneg (a x₀)] + constructor + · convert mult_H1 h hh a (hc.hasTemperateGrowth ha) M M hM.le hM.le hb hd f using 1; ring + · convert mult_Hneg1 h hh a (hc.hasTemperateGrowth ha) M M hM.le hM.le hb hd f using 1; ring + +lemma sobNorm_map_bound {n : ℕ} (h s C : ℝ) (hC : 0 ≤ C) (T : S → S) + (hT : ∀ f, norm2 (J h s (T f)) ≤ C*norm2 (J h s f)) (U : Fin n → S) : + sobNorm h s (fun i => T (U i)) ≤ C*sobNorm h s U := by + have ht := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + (sq_le_sq₀ (norm2_nonneg _) (mul_nonneg hC (norm2_nonneg _))).mpr (hT (U i))) + simp_rw [mul_pow] at ht + rw [← Finset.mul_sum] at ht + have h₁ := Real.sq_sqrt (Finset.sum_nonneg (s := Finset.univ) + (fun i _ => sq_nonneg (norm2 (J h s (T (U i)))))) + have h₂ := Real.sq_sqrt (Finset.sum_nonneg (s := Finset.univ) + (fun i _ => sq_nonneg (norm2 (J h s (U i))))) + dsimp only [sobNorm] + nlinarith only [ht, h₁, h₂, Real.sqrt_nonneg (∑ i, norm2 (J h s (T (U i)))^2), + mul_nonneg hC (Real.sqrt_nonneg (∑ i, norm2 (J h s (U i))^2))] + +lemma lowerSystem_W {n : ℕ} (R : ℝ) (hR : 1 ≤ R) (c h : ℝ) + (U : Fin n → S) (hU : ∀ i, BallSupported R (U i)) + (a : Fin 3 → Fin n → Fin n → X → ℂ) (v : Fin n → Fin n → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) (i : Fin n) : + lowerSystem h (h*c) a v (fun i => W R hR c (U i)) i = + W R hR c (lowerSystem h 0 a v U i) := by + simp only [lowerSystem, lowerOrder_W R hR c h _ (hU _) _ _ (fun k => ha k i _) (hv i _), map_sum] + +/-- Removal of the fixed quadratic convexification by actual smooth +Schwartz multipliers; the constant is independent of the small parameter h. -/ +lemma system_four_real_fixed (ε R : ℝ) (hε : 0 < ε) (hR : 1 ≤ R) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) + (habsorb : 56*(9*A+V)*Real.sqrt ε ≤ 1) : + ∃ C : ℝ, 0 < C ∧ ∀ h : ℝ, 0 < h → h ≤ 1 → (h/ε)*R ≤ 1/8000 → + ∀ U : Fin 4 → S, (∀ i, BallSupported R (U i)) → + sobNorm h 1 U ≤ (C/h)*sobNorm h (-1) + (fun i => P h (-1) 0 (U i)+lowerSystem h 0 a v U i) := by + obtain ⟨Cp, hCp, hp⟩ := compact_mult_bounds (weightCut R hR ((1/ε : ℝ) : ℂ)) + (smooth_weightCut R hR _) (compact_weightCut R hR _) + obtain ⟨Cm, hCm, hm⟩ := compact_mult_bounds (weightCut R hR (-((1/ε : ℝ) : ℂ))) + (smooth_weightCut R hR _) (compact_weightCut R hR _) + refine ⟨Cm*(28*Real.sqrt ε)*Cp, by positivity, fun h hh hh1 hsmall U hU => ?_⟩ + let Up : Fin 4 → S := fun i => W R hR ((1/ε : ℝ) : ℂ) (U i) + let F : Fin 4 → S := fun i => P h (-1) 0 (U i)+lowerSystem h 0 a v U i + have hinv : (fun i => W R hR (-((1/ε : ℝ) : ℂ)) (Up i)) = U := + funext (fun i => W_inverse R hR _ (U i) (hU i)) + have hl := sobNorm_map_bound h 1 Cm hCm.le (W R hR (-((1/ε : ℝ) : ℂ))) + (fun f => (hm h hh.le hh1 f).1) Up + rw [hinv] at hl + have hshift : h/ε = h*(1/ε) := by ring + have ht := system_four_perturbed h ε R hh hh1 hε hR hsmall a v ha hv A V hA hV haA hvV habsorb + Up (fun i => ((hU i).W hR _).coordinate) + have he : (fun i => P h (-1) (h/ε) (Up i)+lowerSystem h (h/ε) a v Up i) = + fun i => W R hR ((1/ε : ℝ) : ℂ) (F i) := by + funext i + dsimp only [Up, F] + rw [hshift, P_W R hR (1/ε) h (U i) (hU i), lowerSystem_W R hR (1/ε) h U hU a v ha hv i, + map_add] + rw [he] at ht + have hr := sobNorm_map_bound h (-1) Cp hCp.le (W R hR ((1/ε : ℝ) : ℂ)) + (fun f => (hp h hh.le hh1 f).2) F + calc + _ ≤ Cm*sobNorm h 1 Up := hl + _ ≤ Cm*((28*Real.sqrt ε/h)*sobNorm h (-1) (fun i => W R hR ((1/ε : ℝ) : ℂ) (F i))) := + mul_le_mul_of_nonneg_left ht hCm.le + _ ≤ Cm*((28*Real.sqrt ε/h)*(Cp*sobNorm h (-1) F)) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hr (by positivity)) hCm.le + _ = _ := by dsimp only [F]; ring + +lemma system_four_real (R : ℝ) (hR : 1 ≤ R) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ U : Fin 4 → S, (∀ i, BallSupported R (U i)) → + sobNorm h 1 U ≤ (C/h)*sobNorm h (-1) + (fun i => P h (-1) 0 (U i)+lowerSystem h 0 a v U i) := by + let D := 56*(9*A+V)+1 + have hD : 0 < D := by dsimp only [D]; positivity + let ε := (1/D)^2 + have hε : 0 < ε := sq_pos_of_pos (by positivity) + have hs : Real.sqrt ε = 1/D := by + dsimp only [ε]; rw [Real.sqrt_sq (by positivity)] + have habsorb : 56*(9*A+V)*Real.sqrt ε ≤ 1 := by + rw [hs, mul_one_div, div_le_iff₀ hD] + dsimp only [D]; linarith + obtain ⟨C, hC, hc⟩ := system_four_real_fixed ε R hε hR a v ha hv A V hA hV haA hvV habsorb + have hR0 : 0 < R := by linarith + refine ⟨C, min 1 (ε/(8000*R)), hC, by positivity, fun h hh hh₀ U hU => ?_⟩ + have hh1 := hh₀.trans (min_le_left 1 (ε/(8000*R))) + have hsm := hh₀.trans (min_le_right 1 (ε/(8000*R))) + have hsmall : (h/ε)*R ≤ 1/8000 := by + calc + _ = h*(R/ε) := by ring + _ ≤ (ε/(8000*R))*(R/ε) := mul_le_mul_of_nonneg_right hsm (by positivity) + _ = 1/8000 := by field_simp + exact hc h hh hh1 hsmall U hU + +end + +def osc (β : X) (h : ℝ) (x : X) : ℂ := Complex.exp (((inner ℝ β x / h : ℝ) : ℂ)*Complex.I) + +lemma norm_osc (β : X) (h : ℝ) (x : X) : ‖osc β h x‖ = 1 := by + simp [osc, Complex.norm_exp] + +lemma smooth_osc (β : X) (h : ℝ) : ContDiff ℝ (⊤ : ℕ∞) (osc β h) := by + exact ((Complex.ofRealCLM.contDiff.comp ((innerSL ℝ β).contDiff.div_const h)).mul + contDiff_const).cexp + +lemma fderiv_osc (β : X) (h : ℝ) (x v : X) : + fderiv ℝ (osc β h) x v = osc β h x * (((inner ℝ β v / h : ℝ) : ℂ)*Complex.I) := by + let L : X →L[ℝ] ℂ := Complex.ofRealCLM.comp ((h⁻¹ : ℝ) • innerSL ℝ β) + have hL : ∀ x, L x = ((inner ℝ β x/h : ℝ) : ℂ) := by + intro x + simp only [L, ContinuousLinearMap.comp_apply, smul_apply, smul_eq_mul, + Complex.ofRealCLM_apply ] + congr 1 + change h⁻¹ * inner ℝ β x = inner ℝ β x/h + ring + have hd := ((L.hasFDerivAt (x := x)).mul_const Complex.I).cexp + have he := congrArg (fun K : X →L[ℝ] ℂ => K v) hd.fderiv + simp only [smul_apply, smul_eq_mul, hL] at he + change fderiv ℝ (osc β h) x v = osc β h x*(Complex.I * (((inner ℝ β v/h : ℝ) : ℂ))) at he + rw [he] + ring + +lemma semideriv_osc (β : X) (h : ℝ) (hh : 0 < h) (x v : X) : + h*‖fderiv ℝ (osc β h) x v‖ ≤ ‖β‖*‖v‖ := by + rw [fderiv_osc, norm_mul, norm_osc, one_mul, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_div, abs_of_pos hh] + rw [mul_div_cancel₀ _ hh.ne'] + exact abs_real_inner_le_norm β v + +def oscCut (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (x : X) : ℂ := + (cutoff R hR x : ℂ)*osc β h x + +lemma compact_oscCut (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) : + HasCompactSupport (oscCut R hR β h) := + ((cutoff R hR).hasCompactSupport.comp_left (g := Complex.ofReal) (by simp)).mul_right + +lemma smooth_oscCut (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) : + ContDiff ℝ (⊤ : ℕ∞) (oscCut R hR β h) := + (Complex.ofRealCLM.contDiff.comp (cutoff R hR).contDiff).mul (smooth_osc β h) + +lemma temperate_oscCut (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) : + (oscCut R hR β h).HasTemperateGrowth := + (compact_oscCut R hR β h).hasTemperateGrowth (smooth_oscCut R hR β h) + +def O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) : S →L[ℂ] S := mult (oscCut R hR β h) + +lemma O_apply (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (hf : BallSupported R f) (x : X) : O R hR β h f x = osc β h x*f x := by + rw [O, mult_apply _ (temperate_oscCut R hR β h)] + by_cases hx : f x = 0 + · simp only [hx, mul_zero] + · have hc : cutoff R hR x = 1 := (cutoff R hR).one_of_mem_closedBall (by + simp only [Metric.mem_closedBall, dist_zero_right] + change ‖x‖ ≤ R+1 + linarith [hf x hx]) + simp only [oscCut, hc, Complex.ofReal_one, one_mul] + +lemma BallSupported.O {R : ℝ} {f : S} (hf : BallSupported R f) (hR : 1 ≤ R) (β : X) (h : ℝ) : + BallSupported R (O R hR β h f) := hf.mult _ (temperate_oscCut R hR β h) + +lemma O_inverse (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) (hf : BallSupported R f) : + O R hR (-β) h (O R hR β h f) = f := by + ext x + rw [O_apply R hR (-β) h _ (hf.O hR β h), O_apply R hR β h f hf] + simp only [osc, ← mul_assoc, ← Complex.exp_add, inner_neg_left, neg_div, Complex.ofReal_neg] + rw [neg_mul, neg_add_cancel, Complex.exp_zero, one_mul] + +lemma osc_multiplier_bounds (R : ℝ) (hR : 1 ≤ R) (β : X) : + ∃ C : ℝ, 0 < C ∧ ∀ h : ℝ, 0 < h → h ≤ 1 → ∀ f : S, + norm2 (J h 1 (O R hR β h f)) ≤ C*norm2 (J h 1 f) ∧ + norm2 (J h (-1) (O R hR β h f)) ≤ C*norm2 (J h (-1) f) := by + let ac : X → ℂ := fun x => (cutoff R hR x : ℂ) + have hac : ContDiff ℝ (⊤ : ℕ∞) ac := + Complex.ofRealCLM.contDiff.comp (cutoff R hR).contDiff + have hacc : HasCompactSupport ac := + (cutoff R hR).hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + obtain ⟨x₀, hx₀⟩ := (hac.continuous_fderiv (by simp)).norm.exists_forall_ge_of_hasCompactSupport + (hacc.fderiv ℝ).norm + let D := ‖fderiv ℝ ac x₀‖ + have hD : 0 ≤ D := norm_nonneg _ + have hdc (x : X) (i : Fin 3) : ‖fderiv ℝ ac x (e i)‖ ≤ D := by + have he : ‖e i‖ = 1 := by simp [e, PiLp.norm_single] + have hc := (fderiv ℝ ac x).le_opNorm (e i) + rw [he, mul_one] at hc + exact hc.trans (hx₀ x) + have hacb (x : X) : ‖ac x‖ ≤ 1 := by + simp only [ac, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (cutoff R hR).nonneg] + exact (cutoff R hR).le_one + refine ⟨3*(1+(D+‖β‖)), by positivity, fun h hh hh1 f => ?_⟩ + have hb (x : X) : ‖oscCut R hR β h x‖ ≤ 1 := by + simp only [oscCut, norm_mul, norm_osc, mul_one] + exact hacb x + have hd (x : X) (i : Fin 3) : h*‖fderiv ℝ (oscCut R hR β h) x (e i)‖ ≤ D+‖β‖ := by + have he : ‖e i‖ = 1 := by simp [e, PiLp.norm_single] + have hosc := semideriv_osc β h hh x (e i) + rw [he, mul_one] at hosc + have heq : oscCut R hR β h = ac * osc β h := rfl + rw [heq, fderiv_mul (hac.differentiable (by simp) x) ((smooth_osc β h).differentiable (by simp) x)] + simp only [add_apply, smul_apply, smul_eq_mul] + have ht := norm_add_le (ac x*fderiv ℝ (osc β h) x (e i)) + (osc β h x*fderiv ℝ ac x (e i)) + rw [norm_mul, norm_mul, norm_osc, one_mul] at ht + have ht' := mul_le_mul_of_nonneg_left ht hh.le + have hab := mul_le_mul_of_nonneg_right (hacb x) (norm_nonneg (fderiv ℝ (osc β h) x (e i))) + have hab' := mul_le_mul_of_nonneg_left hab hh.le + have hdc' := mul_le_mul_of_nonneg_left (hdc x i) hh.le + have hD' := mul_le_mul_of_nonneg_right hh1 hD + nlinarith only [ht', hab', hdc', hD', hosc] + exact ⟨mult_H1 h hh.le _ (temperate_oscCut R hR β h) 1 (D+‖β‖) + (by norm_num) (by positivity) hb hd f, + mult_Hneg1 h hh.le _ (temperate_oscCut R hR β h) 1 (D+‖β‖) + (by norm_num) (by positivity) hb hd f⟩ + +lemma BallSupported.sub {R : ℝ} {f g : S} (hf : BallSupported R f) + (hg : BallSupported R g) : BallSupported R (f-g) := by + simpa only [neg_one_smul, sub_eq_add_neg] using hf.add (hg.smul (-1)) + +lemma BallSupported.zero (R : ℝ) : BallSupported R (0 : S) := by + intro x hx; exact (hx (by simp)).elim + +lemma BallSupported.sum {ι : Type*} (T : Finset ι) {R : ℝ} (f : ι → S) + (hf : ∀ i ∈ T, BallSupported R (f i)) : BallSupported R (∑ i ∈ T, f i) := by + classical + induction T using Finset.induction_on with + | empty => simpa using BallSupported.zero R + | @insert i T hi ih => + rw [Finset.sum_insert hi] + exact (hf i (Finset.mem_insert_self _ _)).add + (ih (fun j hj => hf j (Finset.mem_insert_of_mem hj))) + +lemma BallSupported.lap {R : ℝ} {f : S} (hf : BallSupported R f) : + BallSupported R (lap f) := by + rw [lap_apply] + exact ((hf.d (e 0)).d (e 0) |>.add ((hf.d (e 1)).d (e 1))).add ((hf.d (e 2)).d (e 2)) + +lemma BallSupported.P_zero {R : ℝ} {f : S} (hf : BallSupported R f) (h : ℝ) : + BallSupported R (P h (-1) 0 f) := by + have he : P h (-1) 0 f = ((-h^2 : ℝ) : ℂ) • ElasticitySchwartzCarleman.lap f - f - ((2*h : ℝ) : ℂ) • ElasticitySchwartzCarleman.d (e 0) f := by + rw [P_expanded]; simp + rw [he] + exact ((hf.lap.smul _).sub hf).sub ((hf.d _).smul _) + +lemma BallSupported.conjugatedDeriv_zero {R : ℝ} {f : S} (hf : BallSupported R f) + (h : ℝ) (i : Fin 3) : BallSupported R (conjugatedDeriv h 0 i f) := by + unfold conjugatedDeriv + simp only [G, LinearMap.smul_apply, LinearMap.id_apply, + Complex.ofReal_zero, zero_smul, add_zero] + split_ifs + · exact ((hf.d _).smul _).sub ((hf.smul _).smul _) + · simpa only [sub_zero] using (hf.d _).smul ((h^2 : ℝ) : ℂ) + +lemma BallSupported.lowerOrder_zero {R : ℝ} {f : S} (hf : BallSupported R f) + (h : ℝ) (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) : + BallSupported R (lowerOrder h 0 a v f) := + (BallSupported.sum Finset.univ _ (fun i _ => (hf.conjugatedDeriv_zero h i).mult (a i) (ha i))).add + ((hf.mult v hv).smul _) + +lemma BallSupported.lowerSystem_zero {n : ℕ} {R : ℝ} (h : ℝ) + (U : Fin n → S) (hU : ∀ i, BallSupported R (U i)) + (a : Fin 3 → Fin n → Fin n → X → ℂ) (v : Fin n → Fin n → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) (i : Fin n) : + BallSupported R (lowerSystem h 0 a v U i) := + BallSupported.sum Finset.univ _ (fun j _ => + (hU j).lowerOrder_zero h _ _ (fun k => ha k i j) (hv i j)) + +/-- The actual conjugated differential operator, with a local cutoff that +is identically one on the support, not an abstract operator hypothesis. -/ +def phaseSystem (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U : Fin 4 → S) (i : Fin 4) : S := + O R hR (-β) h (P h (-1) 0 (O R hR β h (U i))+ + lowerSystem h 0 a v (fun j => O R hR β h (U j)) i) + +lemma system_four_phase (R : ℝ) (hR : 1 ≤ R) (β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (A V : ℝ) (hA : 0 ≤ A) (hV : 0 ≤ V) + (haA : ∀ k i j x, ‖a k i j x‖ ≤ A) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ U : Fin 4 → S, (∀ i, BallSupported R (U i)) → + sobNorm h 1 U ≤ (C/h)*sobNorm h (-1) (phaseSystem R hR β h a v U) := by + obtain ⟨Cp, hCp, hp⟩ := osc_multiplier_bounds R hR β + obtain ⟨Cm, hCm, hm⟩ := osc_multiplier_bounds R hR (-β) + obtain ⟨C, h₀, hC, hh₀, hc⟩ := system_four_real R hR a v ha hv A V hA hV haA hvV + refine ⟨Cm*C*Cp, min h₀ 1, by positivity, by positivity, fun h hh hhsmall U hU => ?_⟩ + have hh1 := hhsmall.trans (min_le_right h₀ 1) + have hh0 := hhsmall.trans (min_le_left h₀ 1) + let Up : Fin 4 → S := fun i => O R hR β h (U i) + have hUp (i : Fin 4) : BallSupported R (Up i) := (hU i).O hR β h + let F : Fin 4 → S := fun i => P h (-1) 0 (Up i)+lowerSystem h 0 a v Up i + have hF (i : Fin 4) : BallSupported R (F i) := + ((hUp i).P_zero h).add (BallSupported.lowerSystem_zero h Up hUp a v ha hv i) + have hinv : (fun i => O R hR (-β) h (Up i)) = U := + funext (fun i => O_inverse R hR β h (U i) (hU i)) + have hout : (fun i => O R hR β h (phaseSystem R hR β h a v U i)) = F := by + funext i + change O R hR β h (O R hR (-β) h (F i)) = F i + simpa only [neg_neg] using O_inverse R hR (-β) h (F i) (hF i) + have hl := sobNorm_map_bound h 1 Cm hCm.le (O R hR (-β) h) + (fun f => (hm h hh hh1 f).1) Up + rw [hinv] at hl + have ht := hc h hh hh0 Up hUp + have hr := sobNorm_map_bound h (-1) Cp hCp.le (O R hR β h) + (fun f => (hp h hh hh1 f).2) (phaseSystem R hR β h a v U) + rw [hout] at hr + calc + _ ≤ Cm*sobNorm h 1 Up := hl + _ ≤ Cm*((C/h)*sobNorm h (-1) F) := mul_le_mul_of_nonneg_left ht hCm.le + _ ≤ Cm*((C/h)*(Cp*sobNorm h (-1) (phaseSystem R hR β h a v U))) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hr (by positivity)) hCm.le + _ = _ := by ring + +def oscRate (β : X) (h : ℝ) (v : X) : ℂ := ((inner ℝ β v/h : ℝ) : ℂ)*Complex.I + +lemma d_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (hf : BallSupported R f) (v : X) : + d v (O R hR β h f) = O R hR β h (d v f+oscRate β h v • f) := by + ext x + rw [O_apply R hR β h _ ((hf.d v).add (hf.smul _)), d_apply] + have he : (O R hR β h f : X → ℂ) = fun x => osc β h x*f x := + funext (O_apply R hR β h f hf) + rw [he] + change fderiv ℝ (osc β h * (f : X → ℂ)) x v = _ + rw [fderiv_mul ((smooth_osc β h).differentiable (by simp) x) (f.differentiable x)] + simp only [add_apply, smul_apply, smul_eq_mul, d_apply, fderiv_osc, oscRate] + ring + +lemma lap_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (hf : BallSupported R f) : + lap (O R hR β h f) = O R hR β h + (lap f + (∑ i : Fin 3, (2*oscRate β h (e i)) • d (e i) f) + + (∑ i : Fin 3, (oscRate β h (e i))^2) • f) := by + have he (v : X) : d v (d v (O R hR β h f)) = O R hR β h + (d v (d v f)+(2*oscRate β h v) • d v f+(oscRate β h v)^2 • f) := by + rw [d_O R hR β h f hf v, d_O R hR β h _ ((hf.d v).add (hf.smul _)) v] + simp only [map_add, map_smul] + module + simp only [lap_apply, he, Fin.sum_univ_three, map_add, map_smul] + module + +def Pbeta (h : ℝ) (β : X) (f : S) : S := + ((-h^2 : ℝ) : ℂ) • (lap f + (∑ i : Fin 3, (2*oscRate β h (e i)) • d (e i) f) + + (∑ i : Fin 3, (oscRate β h (e i))^2) • f) - f - + ((2*h : ℝ) : ℂ) • (d (e 0) f+oscRate β h (e 0) • f) + +lemma P_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) (hf : BallSupported R f) : + P h (-1) 0 (O R hR β h f) = O R hR β h (Pbeta h β f) := by + rw [P_expanded, lap_O R hR β h f hf, d_O R hR β h f hf] + simp only [Pbeta, map_add, map_smul, map_sub] + push_cast + module + +def betaDeriv (h : ℝ) (β : X) (i : Fin 3) (f : S) : S := + ((h^2 : ℝ) : ℂ) • (d (e i) f+oscRate β h (e i) • f) + + (if i=0 then (h:ℂ) • f else 0) + +lemma conjugatedDeriv_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (hf : BallSupported R f) (i : Fin 3) : + conjugatedDeriv h 0 i (O R hR β h f) = O R hR β h (betaDeriv h β i f) := by + simp only [conjugatedDeriv, betaDeriv, d_O R hR β h f hf, G, + LinearMap.add_apply, LinearMap.smul_apply, LinearMap.id_apply, map_add, map_smul] + split_ifs <;> simp only [map_zero, map_smul] <;> push_cast <;> module + +lemma mult_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (a : X → ℂ) (ha : a.HasTemperateGrowth) : + mult a (O R hR β h f) = O R hR β h (mult a f) := by + ext x + simp only [O, mult_apply _ ha, mult_apply _ (temperate_oscCut R hR β h)] + ring + +def lowerBeta (h : ℝ) (β : X) (a : Fin 3 → X → ℂ) (v : X → ℂ) (f : S) : S := + (∑ i : Fin 3, mult (a i) (betaDeriv h β i f)) + ((h^2 : ℝ) : ℂ) • mult v f + +lemma lowerOrder_O (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) (f : S) + (hf : BallSupported R f) (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) : + lowerOrder h 0 a v (O R hR β h f) = O R hR β h (lowerBeta h β a v f) := by + simp only [lowerOrder, lowerBeta, conjugatedDeriv_O R hR β h f hf, + mult_O R hR β h _ _ hv, mult_O R hR β h _ _ (ha _), map_add, map_smul, map_sum] + +lemma BallSupported.Pbeta {R : ℝ} {f : S} (hf : BallSupported R f) (h : ℝ) (β : X) : + BallSupported R (Pbeta h β f) := by + unfold ElasticityNegativeOrder.Pbeta + apply BallSupported.sub + · apply BallSupported.sub + · apply BallSupported.smul + apply BallSupported.add + · exact hf.lap.add (BallSupported.sum Finset.univ _ (fun i _ => (hf.d _).smul _)) + · exact hf.smul _ + · exact hf + · exact ((hf.d _).add (hf.smul _)).smul _ + +lemma BallSupported.betaDeriv {R : ℝ} {f : S} (hf : BallSupported R f) + (h : ℝ) (β : X) (i : Fin 3) : BallSupported R (betaDeriv h β i f) := by + unfold ElasticityNegativeOrder.betaDeriv + split_ifs + · exact (((hf.d _).add (hf.smul _)).smul _).add (hf.smul _) + · simpa only [add_zero] using ((hf.d _).add (hf.smul _)).smul ((h^2 : ℝ) : ℂ) + +lemma BallSupported.lowerBeta {R : ℝ} {f : S} (hf : BallSupported R f) + (h : ℝ) (β : X) (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) : + BallSupported R (lowerBeta h β a v f) := + (BallSupported.sum Finset.univ _ (fun i _ => (hf.betaDeriv h β i).mult (a i) (ha i))).add + ((hf.mult v hv).smul _) + +def betaSystem (h : ℝ) (β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U : Fin 4 → S) (i : Fin 4) : S := + Pbeta h β (U i) + ∑ j, lowerBeta h β (fun k => a k i j) (v i j) (U j) + +lemma phaseSystem_eq_betaSystem (R : ℝ) (hR : 1 ≤ R) (β : X) (h : ℝ) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (U : Fin 4 → S) (hU : ∀ i, BallSupported R (U i)) : + phaseSystem R hR β h a v U = betaSystem h β a v U := by + funext i + simp only [phaseSystem, P_O R hR β h (U i) (hU i), lowerSystem, + lowerOrder_O R hR β h _ (hU _) _ _ (fun k => ha k i _) (hv i _), ← map_sum, ← map_add] + exact O_inverse R hR β h _ (((hU i).Pbeta h β).add + (BallSupported.sum Finset.univ _ (fun j _ => (hU j).lowerBeta h β _ _ (fun k => ha k i j) (hv i j)))) + +def rot (A : X ≃ₗᵢ[ℝ] X) : S →L[ℂ] S := + SchwartzMap.compCLMOfContinuousLinearEquiv ℂ A.toContinuousLinearEquiv + +@[simp] lemma rot_apply (A : X ≃ₗᵢ[ℝ] X) (f : S) (x : X) : rot A f x = f (A x) := rfl + +lemma rot_inverse (A : X ≃ₗᵢ[ℝ] X) (f : S) : rot A.symm (rot A f) = f := by + ext x + simp only [rot_apply, A.apply_symm_apply] + +lemma fourier_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) : 𝓕 (rot A f) = rot A (𝓕 f) := by + ext x + exact Real.fourier_comp_linearIsometry A f x + +lemma fourierInv_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) : 𝓕⁻ (rot A f) = rot A (𝓕⁻ f) := by + ext x + change (𝓕⁻ (rot A f)) x = (𝓕⁻ f) (A x) + simp only [SchwartzMap.fourierInv_coe] + exact Real.fourierInv_comp_linearIsometry A f x + +lemma M_rot (A : X ≃ₗᵢ[ℝ] X) (h s : ℝ) (f : S) : + M h s (rot A f) = rot A (M h s f) := by + ext x + simp only [M_apply, rot_apply, weight, ← map_smul A, A.norm_map] + +lemma J_rot (A : X ≃ₗᵢ[ℝ] X) (h s : ℝ) (f : S) : + J h s (rot A f) = rot A (J h s f) := by + simp only [J, fourier_rot, M_rot, fourierInv_rot] + +lemma mass_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) : mass (rot A f) = mass f := by + change (∫ x : X, star (f (A x))*f (A x)).re = (∫ x : X, star (f x)*f x).re + exact congrArg Complex.re (A.measurePreserving.integral_comp + A.toHomeomorph.measurableEmbedding (fun x : X => star (f x)*f x)) + +lemma norm2_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) : norm2 (rot A f) = norm2 f := by + have he : norm2 (rot A f)^2 = norm2 f^2 := by rw [norm2_sq_mass, mass_rot, norm2_sq_mass] + nlinarith [norm2_nonneg (rot A f), norm2_nonneg f] + +lemma sobNorm_rot {n : ℕ} (A : X ≃ₗᵢ[ℝ] X) (h s : ℝ) (U : Fin n → S) : + sobNorm h s (fun i => rot A (U i)) = sobNorm h s U := by + simp only [sobNorm, J_rot, norm2_rot] + +lemma BallSupported.rot {R : ℝ} {f : S} (hf : BallSupported R f) (A : X ≃ₗᵢ[ℝ] X) : + BallSupported R (rot A f) := by + intro x hx + have ht := hf (A x) hx + rwa [A.norm_map] at ht + +lemma d_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) (v : X) : + d v (rot A f) = rot A (d (A v) f) := + SchwartzMap.lineDerivOp_compCLMOfContinuousLinearEquiv ℂ v A.toContinuousLinearEquiv f + +lemma lap_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) : lap (rot A f) = rot A (lap f) := by + have ht := J_rot A 1 2 f + simp only [J_two, Complex.ofReal_one, one_pow, one_smul, map_sub] at ht + exact (sub_right_inj.mp ht) + +lemma d_sum_basis (v : X) (f : S) : d v f = ∑ i : Fin 3, (v i : ℂ) • d (e i) f := by + ext x + simp only [d_apply, sum_apply, smul_apply, smul_eq_mul] + have hv : v = ∑ i : Fin 3, (v i) • e i := by + ext j + simp only [e, Fin.sum_univ_three, PiLp.add_apply, PiLp.smul_apply, + PiLp.single_apply, smul_eq_mul] + fin_cases j <;> simp + conv_lhs => rw [hv] + simp only [map_sum, map_smul, Complex.real_smul] + +lemma exists_rotation (α : X) (hα : ‖α‖ = 1) : ∃ A : X ≃ₗᵢ[ℝ] X, A (e 0) = α := by + refine ⟨(ℝ ∙ (e 0-α))ᗮ.reflection, ?_⟩ + exact Submodule.reflection_sub (by simpa only [e, PiLp.norm_single, norm_one] using hα.symm) + +/-- Minus the semiclassical conjugated Laplacian for the real/imaginary +parts α,β of the phase. The last term vanishes exactly for null phases. -/ +def Pdir (h : ℝ) (α β : X) (f : S) : S := + ((-h^2 : ℝ) : ℂ) • lap f - ((2*h : ℝ) : ℂ) • d α f - + (((2*h : ℝ) : ℂ)*Complex.I) • d β f - + (((‖α‖^2-‖β‖^2 : ℝ) : ℂ)+2*Complex.I*(inner ℝ α β : ℂ)) • f + +lemma Pbeta_eq_Pdir (h : ℝ) (hh : h ≠ 0) (β : X) (f : S) : + Pbeta h β f = Pdir h (e 0) β f := by + ext x + simp only [Pbeta, Pdir, oscRate, e, EuclideanSpace.inner_single_right, + EuclideanSpace.inner_single_left, conj_trivial, one_mul, + d_sum_basis β f, Fin.sum_univ_three, PiLp.norm_single, norm_one, one_pow, + EuclideanSpace.real_norm_sq_eq, sub_apply, add_apply, smul_apply, smul_eq_mul] + have hc : (h : ℂ) ≠ 0 := by exact_mod_cast hh + push_cast + field_simp [hc] + ring_nf + simp only [Complex.I_sq] + ring + +def dirDeriv (h : ℝ) (α β : X) (i : Fin 3) (f : S) : S := + ((h^2 : ℝ) : ℂ) • d (e i) f + ((h : ℂ)*((α i : ℂ)+Complex.I*(β i : ℂ))) • f + +lemma betaDeriv_eq_dirDeriv (h : ℝ) (hh : h ≠ 0) (β : X) (i : Fin 3) (f : S) : + betaDeriv h β i f = dirDeriv h (e 0) β i f := by + ext x + simp only [betaDeriv, dirDeriv, oscRate, e, EuclideanSpace.inner_single_right, + conj_trivial, one_mul, PiLp.single_apply, add_apply, smul_apply, smul_eq_mul] + have hc : (h : ℂ) ≠ 0 := by exact_mod_cast hh + split_ifs <;> simp only [smul_apply, smul_eq_mul, zero_apply] <;> + push_cast <;> field_simp [hc] <;> ring + +lemma Pdir_rot (A : X ≃ₗᵢ[ℝ] X) (h : ℝ) (α β : X) (f : S) : + Pdir h α β (rot A f) = rot A (Pdir h (A α) (A β) f) := by + simp only [Pdir, lap_rot, d_rot, A.norm_map, A.inner_map_map, map_sub, map_smul] + +lemma d_basis_rot (A : X ≃ₗᵢ[ℝ] X) (f : S) (i : Fin 3) : + rot A (d (e i) f) = ∑ k : Fin 3, ((A (e k) i : ℝ) : ℂ) • d (e k) (rot A f) := by + have he : A.symm (e i) = WithLp.toLp 2 (fun k : Fin 3 => A (e k) i) := by + ext k + have hi := A.inner_map_map (A.symm (e i)) (e k) + simp only [A.apply_symm_apply, e, EuclideanSpace.inner_single_left, + EuclideanSpace.inner_single_right, conj_trivial, one_mul] at hi + exact hi.symm + have hd := d_rot A f (A.symm (e i)) + rw [A.apply_symm_apply] at hd + rw [← hd, d_sum_basis, he] + +lemma basis_expansion (v : X) : v = ∑ i : Fin 3, (v i) • e i := by + ext j + simp only [e, Fin.sum_univ_three, PiLp.add_apply, PiLp.smul_apply, + PiLp.single_apply, smul_eq_mul] + fin_cases j <;> simp + +lemma map_coord (A : X ≃ₗᵢ[ℝ] X) (v : X) (i : Fin 3) : + A v i = ∑ k : Fin 3, A (e k) i * v k := by + conv_lhs => rw [basis_expansion v] + simp only [Fin.sum_univ_three, map_add, map_smul, PiLp.add_apply, PiLp.smul_apply, + smul_eq_mul] + ring + +lemma dirDeriv_basis_rot (A : X ≃ₗᵢ[ℝ] X) (h : ℝ) (α β : X) (f : S) (i : Fin 3) : + rot A (dirDeriv h (A α) (A β) i f) = + ∑ k : Fin 3, (A (e k) i : ℂ) • dirDeriv h α β k (rot A f) := by + simp only [dirDeriv, map_add, map_smul, d_basis_rot, map_coord A α i, map_coord A β i, + Fin.sum_univ_three] + push_cast + module + +lemma temperate_comp_rot (A : X ≃ₗᵢ[ℝ] X) (a : X → ℂ) (ha : a.HasTemperateGrowth) : + (fun x => a (A x)).HasTemperateGrowth := + ha.comp A.toContinuousLinearEquiv.toContinuousLinearMap.hasTemperateGrowth + +lemma mult_rot (A : X ≃ₗᵢ[ℝ] X) (a : X → ℂ) (ha : a.HasTemperateGrowth) (f : S) : + rot A (mult a f) = mult (fun x => a (A x)) (rot A f) := by + ext x + simp only [rot_apply, mult_apply _ ha, mult_apply _ (temperate_comp_rot A a ha)] + +def lowerDir (h : ℝ) (α β : X) (a : Fin 3 → X → ℂ) (v : X → ℂ) (f : S) : S := + (∑ i : Fin 3, mult (a i) (dirDeriv h α β i f)) + ((h^2 : ℝ) : ℂ) • mult v f + +def dirSystem (h : ℝ) (α β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U : Fin 4 → S) (i : Fin 4) : S := + Pdir h α β (U i) + ∑ j, lowerDir h α β (fun k => a k i j) (v i j) (U j) + +lemma betaSystem_eq_dirSystem (h : ℝ) (hh : h ≠ 0) (β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U : Fin 4 → S) : betaSystem h β a v U = dirSystem h (e 0) β a v U := by + funext i + simp only [betaSystem, dirSystem, Pbeta_eq_Pdir h hh, lowerBeta, lowerDir, + betaDeriv_eq_dirDeriv h hh] + +def rotCoeff (A : X ≃ₗᵢ[ℝ] X) (a : Fin 3 → X → ℂ) (k : Fin 3) (x : X) : ℂ := + ∑ i : Fin 3, (A (e k) i : ℂ)*a i (A x) + +lemma temperate_rotCoeff (A : X ≃ₗᵢ[ℝ] X) (a : Fin 3 → X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (k : Fin 3) : + (rotCoeff A a k).HasTemperateGrowth := by + apply Function.HasTemperateGrowth.sum + intro i _ + exact (Function.HasTemperateGrowth.const _).mul (temperate_comp_rot A (a i) (ha i)) + +lemma norm_rotCoord_le (A : X ≃ₗᵢ[ℝ] X) (k i : Fin 3) : ‖(A (e k) i : ℂ)‖ ≤ 1 := by + rw [Complex.norm_real] + have ht := PiLp.norm_apply_le (A (e k)) i + rw [A.norm_map] at ht + simpa only [e, PiLp.norm_single, norm_one] using ht + +lemma norm_rotCoeff_le (A : X ≃ₗᵢ[ℝ] X) (a : Fin 3 → X → ℂ) + (C : ℝ) (_hC : 0 ≤ C) (ha : ∀ i x, ‖a i x‖ ≤ C) (k : Fin 3) (x : X) : + ‖rotCoeff A a k x‖ ≤ 3*C := by + calc + _ ≤ ∑ i : Fin 3, ‖(A (e k) i : ℂ)*a i (A x)‖ := norm_sum_le _ _ + _ ≤ ∑ _i : Fin 3, C := by + apply Finset.sum_le_sum + intro i _ + rw [norm_mul] + exact (mul_le_mul (norm_rotCoord_le A k i) (ha i (A x)) (norm_nonneg _) (by norm_num)).trans_eq (one_mul C) + _ = _ := by simp + +lemma lowerDir_rot (A : X ≃ₗᵢ[ℝ] X) (h : ℝ) (α β : X) + (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i, (a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) (f : S) : + rot A (lowerDir h (A α) (A β) a v f) = + lowerDir h α β (rotCoeff A a) (fun x => v (A x)) (rot A f) := by + simp only [lowerDir, map_add, map_sum, map_smul, mult_rot A _ hv, + mult_rot A _ (ha _), dirDeriv_basis_rot] + congr 1 + ext x + simp only [mult_apply _ (temperate_comp_rot A _ (ha _)), + mult_apply _ (temperate_rotCoeff A a ha _), rotCoeff, smul_apply, smul_eq_mul, + Fin.sum_univ_three, add_apply] + ring + +lemma dirSystem_rot (A : X ≃ₗᵢ[ℝ] X) (h : ℝ) (α β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) (U : Fin 4 → S) : + (fun i => rot A (dirSystem h (A α) (A β) a v U i)) = + dirSystem h α β (fun k i j => rotCoeff A (fun l => a l i j) k) + (fun i j x => v i j (A x)) (fun i => rot A (U i)) := by + funext i + simp only [dirSystem, map_add, map_sum, ← Pdir_rot, + lowerDir_rot A h α β _ _ (fun k => ha k i _) (hv i _)] + +lemma system_four_unit_direction (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : ‖α‖ = 1) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (M V : ℝ) (hM : 0 ≤ M) (hV : 0 ≤ V) + (haM : ∀ k i j x, ‖a k i j x‖ ≤ M) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ U : Fin 4 → S, (∀ i, BallSupported R (U i)) → + sobNorm h 1 U ≤ (C/h)*sobNorm h (-1) (dirSystem h α β a v U) := by + obtain ⟨Q, hQ⟩ := exists_rotation α hα + let ar : Fin 3 → Fin 4 → Fin 4 → X → ℂ := + fun k i j => rotCoeff Q (fun l => a l i j) k + let vr : Fin 4 → Fin 4 → X → ℂ := fun i j x => v i j (Q x) + have har (k : Fin 3) (i j : Fin 4) : (ar k i j).HasTemperateGrowth := + temperate_rotCoeff Q _ (fun l => ha l i j) k + have hvr (i j : Fin 4) : (vr i j).HasTemperateGrowth := + temperate_comp_rot Q _ (hv i j) + have harM (k : Fin 3) (i j : Fin 4) (x : X) : ‖ar k i j x‖ ≤ 3*M := + norm_rotCoeff_le Q _ M hM (fun l x => haM l i j x) k x + obtain ⟨C, h₀, hC, hh₀, hc⟩ := system_four_phase R hR (Q.symm β) ar vr har hvr + (3*M) V (by positivity) hV harM (fun i j x => hvV i j (Q x)) + refine ⟨C, h₀, hC, hh₀, fun h hh hhsmall U hU => ?_⟩ + have ht := hc h hh hhsmall (fun i => rot Q (U i)) (fun i => (hU i).rot Q) + rw [phaseSystem_eq_betaSystem R hR _ h ar vr har hvr _ (fun i => (hU i).rot Q), + betaSystem_eq_dirSystem h hh.ne', sobNorm_rot] at ht + have he := dirSystem_rot Q h (e 0) (Q.symm β) a v ha hv U + simp only [hQ, Q.apply_symm_apply] at he + change (fun i => rot Q (dirSystem h α β a v U i)) = + dirSystem h (e 0) (Q.symm β) ar vr (fun i => rot Q (U i)) at he + rw [← he, sobNorm_rot] at ht + exact ht + +lemma Pdir_null (h : ℝ) (α β : X) (hn : ‖α‖ = ‖β‖) (hi : inner ℝ α β = 0) (f : S) : + Pdir h α β f = ((-h^2 : ℝ) : ℂ) • lap f - + ((2*h : ℝ) : ℂ) • d α f - (((2*h : ℝ) : ℂ)*Complex.I) • d β f := by + simp only [Pdir, hn, sub_self, hi, Complex.ofReal_zero, mul_zero, add_zero, + zero_smul, sub_zero] + +lemma weight_one_sq (h : ℝ) (x : X) : (weight h 1 x)^2 = 1+‖(2*Real.pi*h) • x‖^2 := by + rw [pow_two, ← weight_add] + norm_num [weight] + +lemma weight_hscale_one (r h : ℝ) (hr : 0 ≤ r) (x : X) : + weight (r*h) 1 x ≤ (1+r)*weight h 1 x := by + have he : (2*Real.pi*(r*h)) • x = r • ((2*Real.pi*h) • x) := by + rw [smul_smul] + congr 1 + ring + have hs := weight_one_sq (r*h) x + rw [he, norm_smul, Real.norm_eq_abs, abs_of_nonneg hr] at hs + have hs' := weight_one_sq h x + apply (sq_le_sq₀ (weight_pos (r*h) 1 x).le (mul_nonneg (by linarith) (weight_pos h 1 x).le)).mp + rw [mul_pow, hs, hs', mul_pow] + have hn : 0 ≤ ‖(2*Real.pi*h) • x‖^2 := sq_nonneg _ + nlinarith [mul_nonneg hr hn, sq_nonneg r] + +lemma weight_hscale_neg_one (r h : ℝ) (hr : 0 ≤ r) (x : X) : + weight h (-1) x ≤ (1+r)*weight (r*h) (-1) x := by + rw [weight_neg, weight_neg] + have ht := weight_hscale_one r h hr x + rw [← one_div, ← div_eq_mul_inv] + apply (div_le_div_iff₀ (weight_pos h 1 x) (weight_pos (r*h) 1 x)).2 + simpa only [one_mul] using ht + +lemma norm2_J_of_weight_bound (h k s t C : ℝ) + (hbound : ∀ x : X, weight h s x ≤ C*weight k t x) (f : S) : + norm2 (J h s f) ≤ C*norm2 (J k t f) := by + rw [norm2_J, norm2_J] + apply norm2_bound + intro x + simp only [M_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (weight_pos h s x), abs_of_pos (weight_pos k t x)] + calc + _ ≤ (C*weight k t x)*‖𝓕 f x‖ := mul_le_mul_of_nonneg_right (hbound x) (norm_nonneg _) + _ = _ := by ring + +lemma norm2_J_hscale_one (r h : ℝ) (hr : 0 ≤ r) (f : S) : + norm2 (J (r*h) 1 f) ≤ (1+r)*norm2 (J h 1 f) := + norm2_J_of_weight_bound _ _ _ _ _ (weight_hscale_one r h hr) f + +lemma norm2_J_hscale_neg_one (r h : ℝ) (hr : 0 ≤ r) (f : S) : + norm2 (J h (-1) f) ≤ (1+r)*norm2 (J (r*h) (-1) f) := + norm2_J_of_weight_bound _ _ _ _ _ (weight_hscale_neg_one r h hr) f + +lemma sobNorm_component_bound {n : ℕ} (h k s t C : ℝ) (hC : 0 ≤ C) + (U V : Fin n → S) (hb : ∀ i, norm2 (J h s (U i)) ≤ C*norm2 (J k t (V i))) : + sobNorm h s U ≤ C*sobNorm k t V := by + have hs : ∑ i, (norm2 (J h s (U i)))^2 ≤ C^2 * ∑ i, (norm2 (J k t (V i)))^2 := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + nlinarith [hb i, norm2_nonneg (J h s (U i)), norm2_nonneg (J k t (V i))] + rw [sobNorm, sobNorm] + have hp : 0 ≤ ∑ i, (norm2 (J h s (U i)))^2 := Finset.sum_nonneg (fun i _ => sq_nonneg _) + have hq : 0 ≤ ∑ i, (norm2 (J k t (V i)))^2 := Finset.sum_nonneg (fun i _ => sq_nonneg _) + apply (sq_le_sq₀ (Real.sqrt_nonneg _) (mul_nonneg hC (Real.sqrt_nonneg _))).mp + rw [mul_pow, Real.sq_sqrt hp, Real.sq_sqrt hq] + exact hs + +lemma sobNorm_hscale_one {n : ℕ} (r h : ℝ) (hr : 0 ≤ r) (U : Fin n → S) : + sobNorm (r*h) 1 U ≤ (1+r)*sobNorm h 1 U := + sobNorm_component_bound _ _ _ _ _ (by positivity) U U (fun i => norm2_J_hscale_one r h hr (U i)) + +lemma sobNorm_hscale_neg_one {n : ℕ} (r h : ℝ) (hr : 0 ≤ r) (U : Fin n → S) : + sobNorm h (-1) U ≤ (1+r)*sobNorm (r*h) (-1) U := + sobNorm_component_bound _ _ _ _ _ (by positivity) U U (fun i => norm2_J_hscale_neg_one r h hr (U i)) + +lemma d_real_smul (r : ℝ) (v : X) (f : S) : d (r • v) f = (r : ℂ) • d v f := by + ext x + simp only [d_apply, map_smul, smul_apply, Complex.real_smul, smul_eq_mul] + +lemma Pdir_scale (r h : ℝ) (α β : X) (f : S) : + Pdir (r*h) (r • α) (r • β) f = ((r^2 : ℝ) : ℂ) • Pdir h α β f := by + simp only [Pdir, d_real_smul, norm_smul, Real.norm_eq_abs, mul_pow, sq_abs, + real_inner_smul_left, real_inner_smul_right] + push_cast + module + +lemma dirDeriv_scale (r h : ℝ) (α β : X) (i : Fin 3) (f : S) : + dirDeriv (r*h) (r • α) (r • β) i f = ((r^2 : ℝ) : ℂ) • dirDeriv h α β i f := by + simp only [dirDeriv, PiLp.smul_apply, smul_eq_mul] + push_cast + module + +lemma lowerDir_scale (r h : ℝ) (α β : X) (a : Fin 3 → X → ℂ) (v : X → ℂ) (f : S) : + lowerDir (r*h) (r • α) (r • β) a v f = ((r^2 : ℝ) : ℂ) • lowerDir h α β a v f := by + simp only [lowerDir, dirDeriv_scale, map_smul, Fin.sum_univ_three] + push_cast + module + +lemma dirSystem_scale (r h : ℝ) (α β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U : Fin 4 → S) : + dirSystem (r*h) (r • α) (r • β) a v U = + fun i => ((r^2 : ℝ) : ℂ) • dirSystem h α β a v U i := by + funext i + simp only [dirSystem, Pdir_scale, lowerDir_scale, Finset.smul_sum, smul_add] + +lemma sobNorm_smul {n : ℕ} (h s : ℝ) (c : ℂ) (U : Fin n → S) : + sobNorm h s (fun i => c • U i) = ‖c‖*sobNorm h s U := by + simp only [sobNorm, J_smul, norm2_const_smul, mul_pow, ← Finset.mul_sum] + rw [Real.sqrt_mul (sq_nonneg _), Real.sqrt_sq (norm_nonneg _)] + +lemma system_four_direction (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : α ≠ 0) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j, (a k i j).HasTemperateGrowth) + (hv : ∀ i j, (v i j).HasTemperateGrowth) + (M V : ℝ) (hM : 0 ≤ M) (hV : 0 ≤ V) + (haM : ∀ k i j x, ‖a k i j x‖ ≤ M) (hvV : ∀ i j x, ‖v i j x‖ ≤ V) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ U : Fin 4 → S, (∀ i, BallSupported R (U i)) → + sobNorm h 1 U ≤ (C/h)*sobNorm h (-1) (dirSystem h α β a v U) := by + let r := ‖α‖ + have hr : 0 < r := norm_pos_iff.mpr hα + let α' := r⁻¹ • α + let β' := r⁻¹ • β + have hα' : ‖α'‖ = 1 := by + simp only [α', norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos hr] + change r⁻¹*r = 1 + exact inv_mul_cancel₀ hr.ne' + have hrα : r • α' = α := by simp only [α', smul_smul, mul_inv_cancel₀ hr.ne', one_smul] + have hrβ : r • β' = β := by simp only [β', smul_smul, mul_inv_cancel₀ hr.ne', one_smul] + obtain ⟨C, h₀, hC, hh₀, hc⟩ := system_four_unit_direction R hR α' β' hα' a v ha hv M V hM hV haM hvV + refine ⟨(1+r)^2*C/r, r*h₀, by positivity, by positivity, fun h hh hhsmall U hU => ?_⟩ + have hh' : 0 < h/r := div_pos hh hr + have hh'₀ : h/r ≤ h₀ := (div_le_iff₀ hr).2 (by nlinarith [hhsmall]) + have heh : r*(h/r) = h := by field_simp [hr.ne'] + have hl := sobNorm_hscale_one r (h/r) hr.le U + rw [heh] at hl + have ht := hc (h/r) hh' hh'₀ U hU + have he := dirSystem_scale r (h/r) α' β' a v U + rw [heh, hrα, hrβ] at he + have hen : sobNorm (h/r) (-1) (dirSystem h α β a v U) = + r^2*sobNorm (h/r) (-1) (dirSystem (h/r) α' β' a v U) := by + rw [he, sobNorm_smul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (sq_nonneg r)] + have hen' : sobNorm (h/r) (-1) (dirSystem (h/r) α' β' a v U) = + sobNorm (h/r) (-1) (dirSystem h α β a v U)/r^2 := by + apply (eq_div_iff (pow_ne_zero 2 hr.ne')).2 + nlinarith only [hen] + rw [hen'] at ht + have ho := sobNorm_hscale_neg_one r (h/r) hr.le (dirSystem h α β a v U) + rw [heh] at ho + calc + _ ≤ (1+r)*sobNorm (h/r) 1 U := hl + _ ≤ (1+r)*((C/(h/r))*(sobNorm (h/r) (-1) (dirSystem h α β a v U)/r^2)) := + mul_le_mul_of_nonneg_left ht (by positivity) + _ ≤ (1+r)*((C/(h/r))*(((1+r)*sobNorm h (-1) (dirSystem h α β a v U))/r^2)) := by + gcongr + _ = _ := by field_simp [hr.ne', hh.ne'] + +end ElasticityNegativeOrder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCalculus.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfcb5b7ba5b751809e50223ccf07fe77b4b69429 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCalculus.lean @@ -0,0 +1,414 @@ +import Mathlib + +namespace OAI + +section +/-! Literal first and second coordinate chain rules. The maps are genuine +Frechet-smooth maps; a tensor pullback will use these identities, rather +than postulating a transformed elasticity operator. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryChainRule +abbrev Y := Fin 3 → ℝ +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def dd (f : E → ℂ) (v : E) (x : E) : ℂ := fderiv ℝ f x v +def cp (f : Y → ℂ) (α : Fin 3) : Y → ℂ := dd f (Pi.single α 1) +def jac (ψ : E → Y) (v : E) (α : Fin 3) (x : E) : ℝ := fderiv ℝ ψ x v α + +def hess (ψ : E → Y) (v w : E) (α : Fin 3) (x : E) : ℝ := + fderiv ℝ (jac ψ w α) x v + +lemma smooth_dd {f : E → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v : E) : + ContDiff ℝ (⊤ : ℕ∞) (dd f v) := + (hf.fderiv_right (by simp)).clm_apply contDiff_const + +lemma smooth_jac {ψ : E → Y} (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (v : E) (α : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (jac ψ v α) := + (contDiff_apply ℝ ℝ α).comp ((hψ.fderiv_right (by simp)).clm_apply contDiff_const) + +lemma fderiv_basis (f : Y → ℂ) (x v : Y) : + fderiv ℝ f x v=∑ α, (v α:ℂ)*cp f α x := by + have hv : v=∑ α : Fin 3, v α • Pi.single α (1:ℝ) := by + ext i + simp [Pi.single_apply] + calc + _ = fderiv ℝ f x (∑ α, v α • Pi.single α (1:ℝ)) := congrArg _ hv + _ = _ := by + rw [map_sum] + apply Finset.sum_congr rfl + intro α _ + rw [map_smul] + exact Complex.real_smul + +lemma dd_comp {f : Y → ℂ} {ψ : E → Y} (hf : Differentiable ℝ f) + (hψ : Differentiable ℝ ψ) (v x : E) : + dd (fun x => f (ψ x)) v x=∑ α, (jac ψ v α x:ℂ)*cp f α (ψ x) := by + change fderiv ℝ (f ∘ ψ) x v=_ + rw [fderiv_comp x (hf _) (hψ x), ContinuousLinearMap.comp_apply, fderiv_basis] + rfl + +lemma dd_sum {ι : Type*} (s : Finset ι) (f : ι → E → ℂ) + (hf : ∀ i∈s, Differentiable ℝ (f i)) (v x : E) : + dd (fun z => ∑ i∈s, f i z) v x=∑ i∈s, dd (f i) v x := by + rw [dd, fderiv_fun_sum (fun i hi => hf i hi x), sum_apply] + rfl + +lemma dd_mul {f g : E → ℂ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (v x : E) : dd (fun z => f z*g z) v x=dd f v x*g x+f x*dd g v x := by + rw [dd, fderiv_fun_mul (hf x) (hg x)] + simp only [add_apply, smul_apply, smul_eq_mul, dd] + ring + +lemma dd_ofReal {f : E → ℝ} (hf : Differentiable ℝ f) (v x : E) : + dd (fun z => (f z:ℂ)) v x=(fderiv ℝ f x v:ℂ) := by + exact congrArg (fun A : E →L[ℝ] ℂ => A v) + (Complex.ofRealCLM.hasFDerivAt.comp x (hf x).hasFDerivAt).fderiv + +/-- The second chain rule with the exact Hessian-of-coordinate lower term. -/ +theorem dd_dd_comp {f : Y → ℂ} {ψ : E → Y} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (v w x : E) : + dd (dd (fun z => f (ψ z)) w) v x= + (∑ β, (hess ψ v w β x:ℂ)*cp f β (ψ x))+ + ∑ β, ∑ α, (jac ψ w β x:ℂ)*(jac ψ v α x:ℂ)*cp (cp f β) α (ψ x) := by + have heq : dd (fun z => f (ψ z)) w= + fun z => ∑ β, (jac ψ w β z:ℂ)*cp f β (ψ z) := + funext (dd_comp (hf.differentiable (by simp)) (hψ.differentiable (by simp)) w) + rw [heq, dd_sum] + · have hc (β : Fin 3) : Differentiable ℝ (cp f β) := + (smooth_dd hf _).differentiable (by simp) + have hJ (β : Fin 3) : Differentiable ℝ (jac ψ w β) := + (smooth_jac hψ w β).differentiable (by simp) + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro β _ + rw [dd_mul (f := fun z => (jac ψ w β z : ℂ)) (g := fun z => cp f β (ψ z)) + (Complex.ofRealCLM.differentiable.comp (hJ β)) + ((hc β).comp (hψ.differentiable (by simp))), dd_ofReal (hJ β), + dd_comp (hc β) (hψ.differentiable (by simp)), Finset.mul_sum] + simp only [hess, mul_assoc] + · intro β _ + exact (Complex.ofRealCLM.differentiable.comp ((smooth_jac hψ w β).differentiable (by simp))).mul + (((smooth_dd hf _).differentiable (by simp)).comp (hψ.differentiable (by simp))) + +end ElasticityBoundaryChainRule + +end +end +section +/-! Literal smooth polynomial amplitudes in boundary coordinates, including +actual Frechet derivatives and polynomial growth. -/ +noncomputable section +open MvPolynomial +open scoped BigOperators +namespace ElasticityBoundaryMVCalculus +abbrev Y := Fin 3 → ℝ +abbrev MP := MvPolynomial (Fin 3) ℂ + +def complexCoord (i : Fin 3) : Y →L[ℝ] ℂ := + Complex.ofRealCLM.comp (ContinuousLinearMap.proj i) + +@[simp] lemma complexCoord_apply (i : Fin 3) (y : Y) : complexCoord i y=(y i : ℂ) := rfl + +def value (p : MP) (y : Y) : ℂ := eval (fun i => (y i : ℂ)) p + +@[simp] lemma value_C (c : ℂ) (y : Y) : value (C c) y=c := by simp [value] +@[simp] lemma value_X (i : Fin 3) (y : Y) : value (X i) y=(y i : ℂ) := by simp [value] +@[simp] lemma value_zero (y : Y) : value 0 y=0 := by simp [value] +@[simp] lemma value_one (y : Y) : value 1 y=1 := by simp [value] +@[simp] lemma value_add (p q : MP) (y : Y) : value (p+q) y=value p y+value q y := by simp [value] +@[simp] lemma value_sub (p q : MP) (y : Y) : value (p-q) y=value p y-value q y := by simp [value] +@[simp] lemma value_mul (p q : MP) (y : Y) : value (p*q) y=value p y*value q y := by simp [value] +@[simp] lemma value_smul (c : ℂ) (p : MP) (y : Y) : value (c • p) y=c*value p y := by + simp [value, smul_eq_C_mul] + +lemma value_C_fn (c : ℂ) : value (C c) = (fun _ => c) := funext (value_C c) +lemma value_add_fn (p q : MP) : value (p+q)=value p+value q := funext (value_add p q) +lemma value_mul_fn (p q : MP) : value (p*q)=value p*value q := funext (value_mul p q) +lemma value_X_fn (i : Fin 3) : value (X i)=complexCoord i := funext (value_X i) + +lemma smooth_value (p : MP) : ContDiff ℝ (⊤ : ℕ∞) (value p) := by + induction p using MvPolynomial.induction_on with + | C c => rw [value_C_fn]; exact contDiff_const + | add p q hp hq => rw [value_add_fn]; exact hp.add hq + | mul_X p i hp => rw [value_mul_fn, value_X_fn]; exact hp.mul (complexCoord i).contDiff + +def differential (p : MP) (y : Y) : Y →L[ℝ] ℂ := + ∑ i, value (pderiv i p) y • complexCoord i + +@[simp] lemma differential_C (c : ℂ) (y : Y) : differential (C c) y=0 := by + apply ContinuousLinearMap.ext + intro z + simp [differential, sum_apply, smul_apply] + +@[simp] lemma differential_add (p q : MP) (y : Y) : + differential (p+q) y=differential p y+differential q y := by + apply ContinuousLinearMap.ext + intro z + simp [differential, sum_apply, smul_apply, add_mul, Finset.sum_add_distrib] + +lemma differential_mul_X (p : MP) (j : Fin 3) (y : Y) : + differential (p*X j) y = value p y • complexCoord j + (y j : ℂ) • differential p y := by + apply ContinuousLinearMap.ext + intro z + simp only [differential, pderiv_mul, value_add, value_mul, pderiv_X, Pi.single_apply, + sum_apply, add_apply, + smul_apply, complexCoord_apply, smul_eq_mul] + simp only [value_X, add_mul, Finset.sum_add_distrib] + have h (i : Fin 3) : value (if j=i then 1 else 0 : MP) y = if j=i then 1 else 0 := by + split_ifs <;> simp + simp only [h, mul_ite, mul_one, mul_zero, ite_mul, zero_mul, + Finset.sum_ite_eq, Finset.mem_univ, ite_true] + rw [Finset.mul_sum] + rw [add_comm] + congr 1 + apply Finset.sum_congr rfl + intro i _ + ring + +/-- The evaluated formal partial derivatives are the actual Frechet derivative. -/ +theorem hasFDerivAt_value (p : MP) (y : Y) : HasFDerivAt (value p) (differential p y) y := by + induction p using MvPolynomial.induction_on with + | C c => rw [value_C_fn, differential_C]; exact hasFDerivAt_const c y + | add p q hp hq => rw [value_add_fn, differential_add]; exact hp.add hq + | mul_X p i hp => + rw [value_mul_fn, value_X_fn, differential_mul_X] + exact hp.mul ((complexCoord i).hasFDerivAt (x := y)) + +lemma differential_basis (p : MP) (y : Y) (i : Fin 3) : + differential p y (Pi.single i 1) = value (pderiv i p) y := by + simp [differential, Pi.single_apply, apply_ite Complex.ofReal, mul_ite] + +theorem fderiv_value_basis (p : MP) (y : Y) (i : Fin 3) : + fderiv ℝ (value p) y (Pi.single i 1)=value (pderiv i p) y := by + rw [(hasFDerivAt_value p y).fderiv, differential_basis] + +/-- Every fixed amplitude is bounded by a uniform polynomial moment, so the +Gaussian/exponential majorants used for its remainder are honest integrable functions. -/ +theorem polynomialGrowth (p : MP) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ d : ℕ, ∀ y : Y, ‖value p y‖ ≤ C*(1+‖y‖)^d := by + induction p using MvPolynomial.induction_on with + | C c => exact ⟨‖c‖, norm_nonneg _, 0, fun y => by simp⟩ + | add p q hp hq => + obtain ⟨A,hA,a,ha⟩ := hp + obtain ⟨B,hB,b,hb⟩ := hq + refine ⟨A+B,add_nonneg hA hB,max a b,fun y => ?_⟩ + have hbase : 1 ≤ 1+‖y‖ := by linarith [norm_nonneg y] + calc + _ ≤ ‖value p y‖+‖value q y‖ := by rw [value_add]; exact norm_add_le _ _ + _ ≤ A*(1+‖y‖)^a+B*(1+‖y‖)^b := add_le_add (ha y) (hb y) + _ ≤ A*(1+‖y‖)^(max a b)+B*(1+‖y‖)^(max a b) := + add_le_add (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hbase (le_max_left _ _)) hA) + (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hbase (le_max_right _ _)) hB) + _ = _ := by ring + | mul_X p i hp => + obtain ⟨A,hA,a,ha⟩ := hp + refine ⟨A,hA,a+1,fun y => ?_⟩ + have hcoord : ‖(y i : ℂ)‖ ≤ 1+‖y‖ := by + rw [Complex.norm_real] + exact (norm_le_pi_norm y i).trans (by linarith) + calc + _ = ‖value p y‖*‖(y i : ℂ)‖ := by rw [value_mul, value_X, norm_mul] + _ ≤ (A*(1+‖y‖)^a)*(1+‖y‖) := + mul_le_mul (ha y) hcoord (norm_nonneg _) (by positivity) + _ = _ := by rw [pow_succ]; ring + +end ElasticityBoundaryMVCalculus + +end +end +section +/-! Exact anisotropic boundary scaling, retaining the physical dimension-three +Jacobian δ⁴. No asymptotic change-of-variable formula is postulated. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryScaling +abbrev Y := Fin 3 → ℝ + +def scaleFactor (δ : ℝ) (i : Fin 3) : ℝ := if i=2 then δ^2 else δ + +def scale (δ : ℝ) : Y →L[ℝ] Y := + ContinuousLinearMap.pi (fun i => + (scaleFactor δ i • ContinuousLinearMap.id ℝ ℝ).comp (ContinuousLinearMap.proj i)) + +@[simp] lemma scale_apply (δ : ℝ) (y : Y) (i : Fin 3) : + scale δ y i = scaleFactor δ i * y i := rfl + +lemma scale_zero (y : Y) : scale 0 y = 0 := by + ext i + simp [scaleFactor] + +lemma scale_comp (δ ε : ℝ) (y : Y) : scale δ (scale ε y) = scale (δ*ε) y := by + ext i + simp only [scale_apply, scaleFactor] + split_ifs <;> ring + +@[simp] lemma scale_one (y : Y) : scale 1 y = y := by + ext i + simp [scaleFactor] + +lemma scale_inv (δ : ℝ) (hδ : δ≠0) (y : Y) : scale δ (scale δ⁻¹ y) = y := by + rw [scale_comp, mul_inv_cancel₀ hδ, scale_one] + +lemma scale_injective (δ : ℝ) (hδ : δ≠0) : Function.Injective (scale δ) := by + intro y z h + have := congrArg (scale δ⁻¹) h + simpa only [scale_comp, inv_mul_cancel₀ hδ, scale_one] using this + +lemma scale_surjective (δ : ℝ) (hδ : δ≠0) : Function.Surjective (scale δ) := + fun y => ⟨scale δ⁻¹ y, scale_inv δ hδ y⟩ + +lemma scale_det (δ : ℝ) : (scale δ).det = δ^4 := by + change LinearMap.det (LinearMap.pi (fun i : Fin 3 => + (scaleFactor δ i • (LinearMap.id : ℝ →ₗ[ℝ] ℝ)).comp (LinearMap.proj i))) = _ + rw [LinearMap.det_pi] + simp [scaleFactor, Fin.prod_univ_three] + ring + +lemma scale_norm_le {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (y : Y) : + ‖scale δ y‖ ≤ δ*‖y‖ := by + apply (pi_norm_le_iff_of_nonneg (mul_nonneg hδ (norm_nonneg y))).mpr + intro i + have hc : |scaleFactor δ i| ≤ δ := by + unfold scaleFactor + split_ifs + · rw [abs_of_nonneg (sq_nonneg δ)] + nlinarith + · rw [abs_of_nonneg hδ] + simpa only [scale_apply, Real.norm_eq_abs, abs_mul] using + mul_le_mul hc (norm_le_pi_norm y i) (abs_nonneg (y i)) hδ + +lemma continuous_scale_at (y : Y) : Continuous (fun δ : ℝ => scale δ y) := by + apply continuous_pi + intro i + simp only [scale_apply, scaleFactor] + split_ifs <;> fun_prop + +lemma scale_tendsto_zero (y : Y) : Filter.Tendsto (fun δ : ℝ => scale δ y) (nhds 0) (nhds 0) := by + simpa only [scale_zero] using (continuous_scale_at y).tendsto 0 + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Exact full-space change of variables; valid even when the integral is the +Bochner fallback zero, and for vector-valued functions. -/ +theorem integral_scale {δ : ℝ} (hδ : δ≠0) (f : Y → F) : + (∫ y, f y) = δ^4 • ∫ y, f (scale δ y) := by + have h := integral_image_eq_integral_abs_det_fderiv_smul (volume : Measure Y) + (f := scale δ) (f' := fun _ => scale δ) MeasurableSet.univ + (fun y _ => (scale δ).hasFDerivAt.hasFDerivWithinAt) + (scale_injective δ hδ).injOn f + simpa only [image_univ, (scale_surjective δ hδ).range_eq, Measure.restrict_univ, + scale_det, abs_of_nonneg (show 0 ≤ δ^4 by positivity), integral_smul] using h + +lemma scaled_integrable_iff {δ : ℝ} (hδ : δ≠0) (f : Y → F) : + Integrable (fun y => f (scale δ y)) ↔ Integrable f := by + have h := integrableOn_image_iff_integrableOn_abs_det_fderiv_smul (volume : Measure Y) + (f := scale δ) (f' := fun _ => scale δ) MeasurableSet.univ + (fun y _ => (scale δ).hasFDerivAt.hasFDerivWithinAt) + (scale_injective δ hδ).injOn f + have hp : δ^4 ≠ 0 := pow_ne_zero _ hδ + simpa only [image_univ, (scale_surjective δ hδ).range_eq, integrableOn_univ, + scale_det, abs_of_nonneg (show 0 ≤ δ^4 by positivity), integrable_fun_smul_iff hp] using h.symm + +end ElasticityBoundaryScaling + +end +end +section +/-! Integrable polynomial majorants for the physical anisotropic boundary-layer +profiles. The decay and all moments are proved, not assumed symbol bounds. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryWeights +abbrev Y := Fin 3 → ℝ + +def factor (b : ℝ) (i : Fin 3) (t : ℝ) : ℝ := + if i = 2 then (Ioi (0 : ℝ)).indicator (fun s => Real.exp (-b*s)) t + else Real.exp (-b*t^2) + +def weight (b : ℝ) (y : Y) : ℝ := ∏ i, factor b i (y i) + +lemma factor_nonneg (b : ℝ) (i : Fin 3) (t : ℝ) : 0 ≤ factor b i t := by + unfold factor + split_ifs + · exact indicator_nonneg (fun _ _ => (Real.exp_pos _).le) _ + · exact (Real.exp_pos _).le + +lemma weight_nonneg (b : ℝ) (y : Y) : 0 ≤ weight b y := + Finset.prod_nonneg (fun i _ => factor_nonneg b i (y i)) + +lemma measurable_factor (b : ℝ) (i : Fin 3) : Measurable (factor b i) := by + unfold factor + by_cases hi : i = 2 + · simp only [hi, ite_true] + exact (by fun_prop : Measurable (fun s : ℝ => Real.exp (-b*s))).indicator measurableSet_Ioi + · simp only [hi, ite_false] + fun_prop + +lemma measurable_weight (b : ℝ) : Measurable (weight b) := by + unfold weight + exact Finset.measurable_prod _ (fun i _ => (measurable_factor b i).comp (measurable_pi_apply i)) + +lemma integrable_factor_pow {b : ℝ} (hb : 0 < b) (i : Fin 3) (n : ℕ) : + Integrable (fun t : ℝ => |t|^n * factor b i t) := by + by_cases hi : i = 2 + · have h : IntegrableOn (fun t : ℝ => t^n * Real.exp (-b*t)) (Ioi 0) := by + simpa only [Real.rpow_natCast, Real.rpow_one] using + (integrableOn_rpow_mul_exp_neg_mul_rpow (s := (n : ℝ)) (p := 1) + (by have := Nat.cast_nonneg (α := ℝ) n; linarith) (by norm_num) hb) + have h' : (fun t : ℝ => |t|^n * factor b i t) = + (Ioi (0 : ℝ)).indicator (fun t => t^n * Real.exp (-b*t)) := by + funext t + by_cases ht : t ∈ Ioi (0 : ℝ) + · simp [factor, hi, ht, abs_of_pos (mem_Ioi.mp ht)] + · simp [factor, hi, ht] + rw [h'] + exact h.integrable_indicator measurableSet_Ioi + · have h : Integrable (fun t : ℝ => t^n * Real.exp (-b*t^2)) := by + simpa only [Real.rpow_natCast] using + (integrable_rpow_mul_exp_neg_mul_sq (s := (n : ℝ)) hb (by have := Nat.cast_nonneg (α := ℝ) n; linarith)) + simpa only [factor, hi, ite_false, Real.norm_eq_abs, abs_mul, abs_pow, + abs_of_pos (Real.exp_pos _)] using h.norm + +lemma integrable_factor {b : ℝ} (hb : 0 < b) (i : Fin 3) : Integrable (factor b i) := by + simpa using integrable_factor_pow hb i 0 + +lemma integrable_weight {b : ℝ} (hb : 0 < b) : Integrable (weight b) := + Integrable.fintype_prod (fun i => integrable_factor hb i) + +lemma integrable_coordinate_moment {b : ℝ} (hb : 0 < b) (i : Fin 3) (n : ℕ) : + Integrable (fun y : Y => |y i|^n * weight b y) := by + let g : Fin 3 → ℝ → ℝ := fun j t => (if i=j then |t|^n else 1) * factor b j t + have hg (j : Fin 3) : Integrable (g j) := by + by_cases hij : i=j + · simpa [g, hij] using integrable_factor_pow hb j n + · simpa [g, hij] using integrable_factor hb j + have h := Integrable.fintype_prod hg + simp only [g, Finset.prod_mul_distrib, Finset.prod_ite_eq, Finset.mem_univ, ite_true] at h + exact h + +lemma norm_pow_le_sum (y : Y) (n : ℕ) : ‖y‖^n ≤ ∑ i, |y i|^n := by + obtain ⟨⟨i, hi⟩, _⟩ := IsGreatest.pi_norm y + rw [← hi] + exact Finset.single_le_sum (fun j _ => pow_nonneg (abs_nonneg (y j)) n) (Finset.mem_univ i) + +/-- Every finite radial moment of the Gaussian-tangential, exponential-normal +profile is integrable over the full coordinate space (zero for t≤0). -/ +theorem integrable_norm_moment {b : ℝ} (hb : 0 < b) (n : ℕ) : + Integrable (fun y : Y => ‖y‖^n * weight b y) := by + have h := integrable_finsetSum Finset.univ (fun i _ => integrable_coordinate_moment hb i n) + apply h.mono' ((continuous_norm.measurable.pow_const n).mul (measurable_weight b)).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun y => by + change ‖‖y‖^n * weight b y‖ ≤ _ + rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (pow_nonneg (norm_nonneg y) n) (weight_nonneg b y)), + ← Finset.sum_mul] + exact mul_le_mul_of_nonneg_right (norm_pow_le_sum y n) (weight_nonneg b y)) + +end ElasticityBoundaryWeights + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCharts.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..a63129208a93665fb1287a35e652dc5c7a275ac0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryCharts.lean @@ -0,0 +1,588 @@ +import OAI.MathematicalPhysics.Elasticity.Basic +import OAI.MathematicalPhysics.Elasticity.Extension +import OAI.MathematicalPhysics.Elasticity.BoundaryLayers + +namespace OAI + +section +/-! Smooth boundary geometry in open partial homeomorphism charts. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace Elasticity + +def SourceSmoothBoundary (Ω : Set X) : Prop := + ∀ x ∈ frontier Ω, ∃ e : OpenPartialHomeomorph X X, + x ∈ e.source ∧ + ContDiffOn ℝ (⊤ : ℕ∞) e e.source ∧ + ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target ∧ + e x 0 = 0 ∧ + ∀ y ∈ e.source, y ∈ Ω ↔ 0 < e y 0 + +def SourceDomain (Ω : Set X) : Prop := + IsOpen Ω ∧ IsConnected Ω ∧ Bornology.IsBounded Ω ∧ SourceSmoothBoundary Ω + +lemma SourceSmoothBoundary.to_inherited {Ω : Set X} (h : SourceSmoothBoundary Ω) : + SmoothBoundary Ω := by + intro x hx + obtain ⟨e, hxs, he, hi, h0, hΩ⟩ := h x hx + exact ⟨e, hxs, he, hi, h0, hΩ⟩ + +lemma SourceDomain.to_inherited {Ω : Set X} (h : SourceDomain Ω) : Domain Ω := + ⟨h.1, h.2.1, h.2.2.1, h.2.2.2.to_inherited⟩ + +variable (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {x : X} (hx : x ∈ e.source) + +include he hi hx + +lemma chart_fderiv_left_inverse : + (fderiv ℝ e.symm (e x)).comp (fderiv ℝ e x) = ContinuousLinearMap.id ℝ X := by + have hd := (he.differentiableOn (by simp)).differentiableAt (e.open_source.mem_nhds hx) + have hd' := (hi.differentiableOn (by simp)).differentiableAt + (e.open_target.mem_nhds (e.map_source hx)) + have hEq : e.symm ∘ e =ᶠ[𝓝 x] id := by + filter_upwards [e.open_source.mem_nhds hx] with y hy + exact e.left_inv hy + rw [← fderiv_comp x hd' hd, hEq.fderiv_eq, fderiv_id] + +lemma chart_fderiv_right_inverse : + (fderiv ℝ e x).comp (fderiv ℝ e.symm (e x)) = ContinuousLinearMap.id ℝ X := by + simpa only [OpenPartialHomeomorph.symm_symm, e.left_inv hx] using + chart_fderiv_left_inverse e.symm hi he (e.map_source hx) + +/-- The derivative of a smooth open boundary chart is continuously invertible. -/ +def chartDerivativeEquiv : X ≃L[ℝ] X := { + toLinearEquiv := { + toLinearMap := (fderiv ℝ e x).toLinearMap + invFun := fderiv ℝ e.symm (e x) + left_inv := fun v => by + have h := congrArg (fun J : X →L[ℝ] X => J v) (chart_fderiv_left_inverse e he hi hx) + exact h + right_inv := fun v => by + have h := congrArg (fun J : X →L[ℝ] X => J v) (chart_fderiv_right_inverse e he hi hx) + exact h } + continuous_toFun := (fderiv ℝ e x).continuous + continuous_invFun := (fderiv ℝ e.symm (e x)).continuous } + +@[simp] lemma chartDerivativeEquiv_apply (v : X) : + chartDerivativeEquiv e he hi hx v = fderiv ℝ e x v := rfl + +end Elasticity + +end +end +section +/-! Orthogonal normalization of an honest physical boundary chart. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace Elasticity + +/-- Normal covector of a linear boundary-coordinate map, represented in the +fixed Euclidean coordinates by Riesz duality. -/ +def coordinateNormal (B : X ≃L[ℝ] X) : X := + (InnerProductSpace.toDual ℝ X).symm + ((EuclideanSpace.proj (0 : Fin 3)).comp B.toContinuousLinearMap) + +lemma coordinateNormal_inner (B : X ≃L[ℝ] X) (z : X) : + inner ℝ (coordinateNormal B) z = B z 0 := by + exact InnerProductSpace.toDual_symm_apply + +lemma coordinateNormal_ne_zero (B : X ≃L[ℝ] X) : coordinateNormal B ≠ 0 := by + intro h + have hi := coordinateNormal_inner B (B.symm (EuclideanSpace.single 0 1)) + rw [h, inner_zero_left, B.apply_symm_apply] at hi + simp at hi + +/-- A physical orthogonal frame whose first vector is the inward normal. -/ +def coordinateFrame (B : X ≃L[ℝ] X) : X ≃ₗᵢ[ℝ] X := + (ℝ ∙ (EuclideanSpace.single 2 1 - ‖coordinateNormal B‖⁻¹ • coordinateNormal B))ᗮ.reflection + +lemma coordinateFrame_first (B : X ≃L[ℝ] X) : + coordinateFrame B (EuclideanSpace.single 2 1) = + ‖coordinateNormal B‖⁻¹ • coordinateNormal B := by + apply Submodule.reflection_sub + rw [PiLp.norm_single, norm_one, norm_smul, Real.norm_eq_abs, + abs_inv, abs_of_nonneg (norm_nonneg _), inv_mul_cancel₀] + exact norm_ne_zero_iff.mpr (coordinateNormal_ne_zero B) + +/-- This normalization preserves the physical half-space without changing its +positive side. It also keeps the physical metric Euclidean at the base point. -/ +theorem coordinateFrame_normal (B : X ≃L[ℝ] X) (z : X) : + B (coordinateFrame B z) 0 = ‖coordinateNormal B‖ * z 2 := by + have hn : ‖coordinateNormal B‖ ≠ 0 := norm_ne_zero_iff.mpr (coordinateNormal_ne_zero B) + have h : ‖coordinateNormal B‖ • coordinateFrame B (EuclideanSpace.single 2 1) = + coordinateNormal B := by + rw [coordinateFrame_first, smul_smul, mul_inv_cancel₀ hn, one_smul] + calc + B (coordinateFrame B z) 0 = inner ℝ (coordinateNormal B) (coordinateFrame B z) := + (coordinateNormal_inner B _).symm + _ = inner ℝ (‖coordinateNormal B‖ • coordinateFrame B (EuclideanSpace.single 2 1)) + (coordinateFrame B z) := congrArg (fun v => inner ℝ v (coordinateFrame B z)) h.symm + _ = ‖coordinateNormal B‖ * z 2 := by + rw [inner_smul_left, (coordinateFrame B).inner_map_map, EuclideanSpace.inner_single_left] + simp + +lemma coordinateFrame_positive (B : X ≃L[ℝ] X) (z : X) : + 0 < B (coordinateFrame B z) 0 ↔ 0 < z 2 := by + rw [coordinateFrame_normal] + exact mul_pos_iff_of_pos_left (norm_pos_iff.mpr (coordinateNormal_ne_zero B)) + +end Elasticity + +end +end +section +/-! Honest boundary coordinates with orthogonal physical derivative at the +base point. The inward normal is coordinate 2, matching the frozen physical +half-space ODE. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace Elasticity + +variable (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {x : X} (hx : x ∈ e.source) + +def normalizedLinear : X ≃L[ℝ] X := + (coordinateFrame (chartDerivativeEquiv e he hi hx)).toContinuousLinearEquiv.trans + (chartDerivativeEquiv e he hi hx) + +def normalizedAffine : X ≃ₜ X := + (normalizedLinear e he hi hx).toHomeomorph.trans (Homeomorph.addRight (e x)) + +def normalizedParam : OpenPartialHomeomorph X X := + (normalizedAffine e he hi hx).toOpenPartialHomeomorph.trans e.symm + +@[simp] lemma normalizedAffine_apply (z : X) : + normalizedAffine e he hi hx z = normalizedLinear e he hi hx z + e x := rfl + +@[simp] lemma normalizedParam_apply (z : X) : + normalizedParam e he hi hx z = e.symm (normalizedLinear e he hi hx z + e x) := rfl + +lemma normalizedParam_source : + (normalizedParam e he hi hx).source = + {z | normalizedLinear e he hi hx z + e x ∈ e.target} := by + ext z + simp [normalizedParam] + +@[simp] lemma normalizedParam_target : + (normalizedParam e he hi hx).target = e.source := by + ext z + simp [normalizedParam] + +lemma normalizedParam_zero_source : (0 : X) ∈ (normalizedParam e he hi hx).source := by + rw [normalizedParam_source] + simpa using e.map_source hx + +@[simp] lemma normalizedParam_zero : normalizedParam e he hi hx 0 = x := by + simp [e.left_inv hx] + +lemma normalizedParam_contDiff : + ContDiffOn ℝ (⊤ : ℕ∞) (normalizedParam e he hi hx) + (normalizedParam e he hi hx).source := by + have ha : ContDiff ℝ (⊤ : ℕ∞) (fun z => normalizedLinear e he hi hx z + e x) := + (normalizedLinear e he hi hx).contDiff.add contDiff_const + change ContDiffOn ℝ (⊤ : ℕ∞) (fun z => e.symm (normalizedLinear e he hi hx z + e x)) _ + apply hi.comp ha.contDiffOn + intro z hz + simpa only [normalizedParam_source, Set.mem_ofPred_eq] using hz + +lemma normalizedParam_symm_contDiff : + ContDiffOn ℝ (⊤ : ℕ∞) (normalizedParam e he hi hx).symm + (normalizedParam e he hi hx).target := by + rw [normalizedParam_target] + have hs : ContDiffOn ℝ (⊤ : ℕ∞) (fun y => e y - e x) e.source := + he.sub contDiffOn_const + exact ((normalizedLinear e he hi hx).symm.contDiff.comp_contDiffOn hs) + +lemma normalizedParam_fderiv : + HasFDerivAt (normalizedParam e he hi hx) + (coordinateFrame (chartDerivativeEquiv e he hi hx)).toContinuousLinearEquiv.toContinuousLinearMap 0 := by + let B := chartDerivativeEquiv e he hi hx + let Q := coordinateFrame B + have hb : HasFDerivAt e.symm B.symm.toContinuousLinearMap (e x) := + ((hi.differentiableOn (by simp)).differentiableAt + (e.open_target.mem_nhds (e.map_source hx))).hasFDerivAt + have ha := ((normalizedLinear e he hi hx).hasFDerivAt (x := (0 : X))).add_const (e x) + have hcomp := (by simpa using hb : HasFDerivAt e.symm B.symm.toContinuousLinearMap + (normalizedLinear e he hi hx 0 + e x)).comp 0 ha + have hQ : B.symm.toContinuousLinearMap.comp + (normalizedLinear e he hi hx).toContinuousLinearMap = + Q.toContinuousLinearEquiv.toContinuousLinearMap := by + apply ContinuousLinearMap.ext + intro z + exact B.symm_apply_apply (Q z) + rw [hQ] at hcomp + exact hcomp + +lemma normalizedParam_halfspace {Ω : Set X} (h0 : e x 0 = 0) + (hΩ : ∀ y ∈ e.source, y ∈ Ω ↔ 0 < e y 0) + {z : X} (hz : z ∈ (normalizedParam e he hi hx).source) : + normalizedParam e he hi hx z ∈ Ω ↔ 0 < z 2 := by + have ht : normalizedLinear e he hi hx z + e x ∈ e.target := + by simpa only [normalizedParam_source, Set.mem_ofPred_eq] using hz + rw [normalizedParam_apply, hΩ _ (e.map_target ht), e.right_inv ht] + change 0 < (chartDerivativeEquiv e he hi hx) + (coordinateFrame (chartDerivativeEquiv e he hi hx) z) 0 + e x 0 ↔ _ + rw [h0, add_zero] + exact coordinateFrame_positive _ z + +/-- Normalized local physical parametrizations exist at every boundary point +of a domain with smooth open boundary charts. No regularity is imposed on the +Lamé moduli here. -/ +theorem SourceSmoothBoundary.normalized {Ω : Set X} (h : SourceSmoothBoundary Ω) + {x : X} (hx : x ∈ frontier Ω) : + ∃ (φ : OpenPartialHomeomorph X X) (Q : X ≃ₗᵢ[ℝ] X), + (0 : X) ∈ φ.source ∧ φ 0 = x ∧ + ContDiffOn ℝ (⊤ : ℕ∞) φ φ.source ∧ + ContDiffOn ℝ (⊤ : ℕ∞) φ.symm φ.target ∧ + HasFDerivAt φ Q.toContinuousLinearEquiv.toContinuousLinearMap 0 ∧ + ∀ z ∈ φ.source, φ z ∈ Ω ↔ 0 < z 2 := by + obtain ⟨e, hxs, he, hi, h0, hΩ⟩ := h x hx + exact ⟨normalizedParam e he hi hxs, coordinateFrame (chartDerivativeEquiv e he hi hxs), + normalizedParam_zero_source e he hi hxs, normalizedParam_zero e he hi hxs, + normalizedParam_contDiff e he hi hxs, normalizedParam_symm_contDiff e he hi hxs, + normalizedParam_fderiv e he hi hxs, + fun _ hz => normalizedParam_halfspace e he hi hxs h0 hΩ hz⟩ + +end Elasticity + +end +end +section +/-! The boundary-coordinate differential operator is obtained from literal +physical elasticity by the chain rule and a fixed Euclidean rotation. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryChartOperator +open ElasticityBoundaryChainRule ElasticityBoundaryPullback ElasticityBoundaryRotation + ElasticityBoundaryFrameOperator ElasticityBoundaryPhysicalStrong + ElasticityBoundarySmoothOperator ElasticityBoundaryLayerOperator ElasticityBoundaryStrongLayer +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +def basis (i : I) : X := EuclideanSpace.single i 1 + +def chartPrincipal (Q : X ≃ₗᵢ[ℝ] X) (Φ : Y → X) (ψ : X → Y) + (l m : X → ℂ) : SmoothTensor := + fun s α r β y => principalPull basis + (mixedTensor (fun s i => frameMatrix Q i s) (frameMatrix Q) (coeff l m)) ψ s α r β (Φ y) + +def chartLower (Q : X ≃ₗᵢ[ℝ] X) (Φ : Y → X) (ψ : X → Y) + (l m : X → ℂ) : SmoothLower := + fun s r β y => lowerPull basis + (mixedTensor (fun s i => frameMatrix Q i s) (frameMatrix Q) (coeff l m)) + (mixedLower (fun s i => frameMatrix Q i s) (frameMatrix Q) (lower basis l m)) ψ s r β (Φ y) + +lemma smooth_jac {ψ : X → Y} (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (v : X) (α : I) : + ContDiff ℝ (⊤ : ℕ∞) (jac ψ v α) := by + exact contDiff_apply ℝ ℝ α |>.comp ((hψ.fderiv_right (by simp)).clm_apply contDiff_const) + +lemma smooth_hess {ψ : X → Y} (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (v w : X) (α : I) : + ContDiff ℝ (⊤ : ℕ∞) (hess ψ v w α) := by + exact ((smooth_jac hψ w α).fderiv_right (by simp)).clm_apply contDiff_const + +lemma smooth_chartPrincipal (Q : X ≃ₗᵢ[ℝ] X) {Φ : Y → X} {ψ : X → Y} + (hΦ : ContDiff ℝ (⊤ : ℕ∞) Φ) (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (s α r β : I) : ContDiff ℝ (⊤ : ℕ∞) (chartPrincipal Q Φ ψ l m s α r β) := by + apply ContDiff.comp _ hΦ + apply ContDiff.sum; intro k _ + apply ContDiff.sum; intro v _ + apply ContDiff.mul + · apply ContDiff.mul + · apply ContDiff.sum; intro i _ + apply ContDiff.sum; intro j _ + apply ContDiff.mul _ contDiff_const + apply ContDiff.mul contDiff_const + unfold coeff elasticityTensor + exact (hl.mul contDiff_const |>.mul contDiff_const).add (hm.mul contDiff_const) + · exact Complex.ofRealCLM.contDiff.comp (smooth_jac hψ (basis k) α) + · exact Complex.ofRealCLM.contDiff.comp (smooth_jac hψ (basis v) β) + +lemma smooth_chartLower (Q : X ≃ₗᵢ[ℝ] X) {Φ : Y → X} {ψ : X → Y} + (hΦ : ContDiff ℝ (⊤ : ℕ∞) Φ) (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (s r β : I) : ContDiff ℝ (⊤ : ℕ∞) (chartLower Q Φ ψ l m s r β) := by + apply ContDiff.comp _ hΦ + apply ContDiff.add + · apply ContDiff.sum; intro k _ + apply ContDiff.sum; intro v _ + apply ContDiff.mul + · apply ContDiff.sum; intro i _ + apply ContDiff.sum; intro j _ + apply ContDiff.mul _ contDiff_const + apply ContDiff.mul contDiff_const + unfold coeff elasticityTensor + exact (hl.mul contDiff_const |>.mul contDiff_const).add (hm.mul contDiff_const) + · exact Complex.ofRealCLM.contDiff.comp (smooth_hess hψ (basis k) (basis v) β) + · apply ContDiff.sum; intro v _ + apply ContDiff.mul + · apply ContDiff.sum; intro i _ + apply ContDiff.sum; intro j _ + apply ContDiff.mul _ contDiff_const + apply ContDiff.mul contDiff_const + unfold lower + exact (((smooth_dd hl _).mul contDiff_const).add + ((smooth_dd hm _).mul contDiff_const)).add ((smooth_dd hm _).mul contDiff_const) + · exact Complex.ofRealCLM.contDiff.comp (smooth_jac hψ (basis v) β) + +lemma chartPrincipal_frozen (Q : X ≃ₗᵢ[ℝ] X) (Φ : Y → X) (ψ : X → Y) + (l m : X → ℂ) (hj : ∀ k α, (jac ψ (basis k) α (Φ 0):ℂ)=frameMatrix Q k α) + (s α r β : I) : + chartPrincipal Q Φ ψ l m s α r β 0=elasticityTensor (l (Φ 0)) (m (Φ 0)) s α r β := by + have he : chartPrincipal Q Φ ψ l m s α r β 0= + rotateTensor (frameMatrix Q) (elasticityTensor (l (Φ 0)) (m (Φ 0))) s α r β := by + unfold chartPrincipal principalPull mixedTensor coeff rotateTensor + simp only [hj, Finset.sum_mul] + calc + _ = ∑ k, ∑ i, ∑ v, ∑ j, frameMatrix Q i s * + elasticityTensor (l (Φ 0)) (m (Φ 0)) i k j v * frameMatrix Q j r * + frameMatrix Q k α * frameMatrix Q v β := by + apply Finset.sum_congr rfl; intro k _ + exact Finset.sum_comm + _ = ∑ i, ∑ k, ∑ v, ∑ j, frameMatrix Q i s * + elasticityTensor (l (Φ 0)) (m (Φ 0)) i k j v * frameMatrix Q j r * + frameMatrix Q k α * frameMatrix Q v β := Finset.sum_comm + _ = _ := by + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro k _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro v _ + ring + rw [he,rotate_isotropic] + +/-- Exact equality with the true physical stress divergence after pullback. +The inverse chart equality is used literally, not replaced by a formal symbol. -/ +theorem physical_chart_operator (Q : X ≃ₗᵢ[ℝ] X) (Φ : Y → X) {ψ : X → Y} + (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) {l m : X → ℂ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → Y → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (y : Y) (hy : ψ (Φ y)=y) (s : I) : + (∑ i, frameMatrix Q i s*(∑ k, dd + (stress basis l m (mix (frameMatrix Q) (fun j x => u j (ψ x))) i k) (basis k) (Φ y)))= + strong (chartPrincipal Q Φ ψ l m) (chartLower Q Φ ψ l m) u s y := by + have hS (i : I) := stress_divergence basis hl hm + (mix (frameMatrix Q) (fun j x => u j (ψ x))) + (smooth_mix _ _ (fun j => (hu j).comp hψ)) i (Φ y) + simp_rw [hS] + refine (directional_mix basis (fun s i => frameMatrix Q i s) (frameMatrix Q) + (coeff l m) (lower basis l m) (fun j => u j ∘ ψ) (fun j => (hu j).comp hψ) s (Φ y)).trans ?_ + refine (directional_comp basis _ _ hψ u hu s (Φ y)).trans ?_ + rw [hy] + rfl + +end ElasticityBoundaryChartOperator + +end +end +section +/-! Smooth compact extensions of genuine local maps, in arbitrary finite + dimensional physical and coordinate spaces. -/ +noncomputable section +open Set Filter Metric +open scoped Topology +namespace ElasticityBoundary +variable {E : Type} {F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] + +omit [FiniteDimensional ℝ E] in +lemma contDiff_cutoff_smul {U : Set E} (hU : IsOpen U) (f : E → F) (χ : E → ℝ) + (hf : ContDiffOn ℝ (⊤ : ℕ∞) f U) (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (hs : tsupport χ⊆U) : ContDiff ℝ (⊤ : ℕ∞) (fun x => χ x • f x) := by + rw [contDiff_iff_contDiffAt] + intro x + by_cases hx : x∈U + · exact hχ.contDiffAt.smul ((hf x hx).contDiffAt (hU.mem_nhds hx)) + · have hn : x∉tsupport χ := fun hh => hx (hs hh) + have he := notMem_tsupport_iff_eventuallyEq.mp hn + apply (contDiffAt_const (c := (0 : F))).congr_of_eventuallyEq + filter_upwards [he] with y hy + simp [hy] + +/-- The output may itself be an actual chart or vector displacement. -/ +theorem smooth_vector_extension {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) + (hKU : K⊆U) (f : E → F) (hf : ContDiffOn ℝ (⊤ : ℕ∞) f U) : + ∃ g : E → F, ContDiff ℝ (⊤ : ℕ∞) g ∧ HasCompactSupport g ∧ g =ᶠ[𝓝ˢ K] f := by + obtain ⟨χ,hχ,hc,hs,h1,_⟩ := compact_smooth_cutoff hK hU hKU + refine ⟨fun x => χ x • f x,contDiff_cutoff_smul hU f χ hf hχ hs,?_,?_⟩ + · exact hc.smul_right + · filter_upwards [h1] with x hx + simp [hx] + +end ElasticityBoundary + +end +end +section +/-! Transferring a trial supported in an honest chart produces an actual + globally smooth compact physical field, without imposing artificial boundary + data. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundary +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def chartTransfer (e : OpenPartialHomeomorph E E) (η : E → ℝ) (u : E → F) (x : E) : F := + η x • u (e.symm x) + +omit [FiniteDimensional ℝ E] in +lemma smooth_chartTransfer (e : OpenPartialHomeomorph E E) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {η : E → ℝ} (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hs : tsupport η⊆e.target) + {u : E → F} (hu : ContDiff ℝ (⊤ : ℕ∞) u) : + ContDiff ℝ (⊤ : ℕ∞) (chartTransfer e η u) := by + apply contDiff_cutoff_smul e.open_target _ η _ hη hs + exact hu.comp_contDiffOn hi + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +lemma chartTransfer_apply (e : OpenPartialHomeomorph E E) {K : Set E} + {η : E → ℝ} (hη : ∀ x∈e '' K, η x=1) + {u : E → F} (hu : Function.support u⊆K) {y : E} (hy : y∈e.source) : + chartTransfer e η u (e y)=u y := by + unfold chartTransfer + rw [e.left_inv hy] + by_cases h : u y=0 + · simp [h] + · rw [hη _ (mem_image_of_mem e (hu h)),one_smul] + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +lemma chartTransfer_zero (e : OpenPartialHomeomorph E E) {η : E → ℝ} + (hs : tsupport η⊆e.target) (u : E → F) {x : E} (hx : x∉e.target) : + chartTransfer e η u x=0 := by + have hn : x∉tsupport η := fun h => hx (hs h) + simp [chartTransfer, image_eq_zero_of_notMem_tsupport hn] + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +lemma compact_chartTransfer (e : OpenPartialHomeomorph E E) {η : E → ℝ} + (hc : HasCompactSupport η) (u : E → F) : HasCompactSupport (chartTransfer e η u) := by + exact hc.smul_right + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +lemma chartTransfer_support (e : OpenPartialHomeomorph E E) {K : Set E} + {η : E → ℝ} (hs : tsupport η⊆e.target) + {u : E → F} (hu : Function.support u⊆K) : + Function.support (chartTransfer e η u)⊆e '' K := by + intro x hx + have ht : x∈e.target := by + by_contra hn + exact hx (chartTransfer_zero e hs u hn) + have hn : u (e.symm x)≠0 := by + intro hz + exact hx (by simp [chartTransfer,hz]) + exact ⟨e.symm x,hu hn,e.right_inv ht⟩ + +/-- Cutoffs and both globally smooth chart extensions exist from honest source + hypotheses. The extensions agree near the whole compact supports used in the + physical change of variables. -/ +theorem compact_chart_data (e : OpenPartialHomeomorph E E) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {K : Set E} (hK : IsCompact K) (hs : K⊆e.source) : + ∃ (η : E → ℝ) (Φ Ψ : E → E), + ContDiff ℝ (⊤ : ℕ∞) η ∧ HasCompactSupport η ∧ tsupport η⊆e.target ∧ + η =ᶠ[𝓝ˢ (e '' K)] (fun _ => 1) ∧ + ContDiff ℝ (⊤ : ℕ∞) Φ ∧ Φ =ᶠ[𝓝ˢ K] e ∧ + ContDiff ℝ (⊤ : ℕ∞) Ψ ∧ Ψ =ᶠ[𝓝ˢ (tsupport η)] e.symm := by + have hKe : IsCompact (e '' K) := hK.image_of_continuousOn (e.continuousOn.mono hs) + have hst : e '' K⊆e.target := by + rintro x ⟨y,hy,rfl⟩ + exact e.map_source (hs hy) + obtain ⟨η,hη,hc,hηs,hη1,_⟩ := compact_smooth_cutoff hKe e.open_target hst + obtain ⟨Φ,hΦ,_,hΦe⟩ := smooth_vector_extension hK e.open_source hs e he + obtain ⟨Ψ,hΨ,_,hΨe⟩ := smooth_vector_extension hc e.open_target hηs e.symm hi + exact ⟨η,Φ,Ψ,hη,hc,hηs,hη1,hΦ,hΦe,hΨ,hΨe⟩ + +end ElasticityBoundary + +end +end +section +/-! Locality and true support control for the physical differential operator +and the compact chart transfer. These use germs, not formal coefficients. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryOperatorLocal +open ElasticityBoundaryChainRule ElasticityBoundaryPullback ElasticityBoundaryPhysicalStrong + ElasticityBoundary +abbrev I := Fin 3 +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + +lemma dd_germ {f g : E → ℂ} {x : E} (h : f =ᶠ[𝓝 x] g) (v : E) : + dd f v =ᶠ[𝓝 x] dd g v := by + filter_upwards [h.fderiv (𝕜 := ℝ)] with y hy + exact congrArg (fun A : E →L[ℝ] ℂ => A v) hy + +lemma dd_germ_eq {f g : E → ℂ} {x : E} (h : f =ᶠ[𝓝 x] g) (v : E) : + dd f v x=dd g v x := (dd_germ h v).eq_of_nhds + +lemma directional_germ_eq (e : I → E) (a : Tensor E) (b : Lower E) + {u v : I → E → ℂ} {x : E} (h : ∀ j, u j =ᶠ[𝓝 x] v j) (i : I) : + directional e a b u i x=directional e a b v i x := by + unfold directional + congr 1 + · apply Finset.sum_congr rfl; intro k _ + apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro l _ + rw [dd_germ_eq (dd_germ (h j) (e l)) (e k)] + · apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro l _ + rw [dd_germ_eq (h j) (e l)] + +lemma directional_zero (e : I → E) (a : Tensor E) (b : Lower E) (i : I) (x : E) : + directional e a b (fun _ _ => 0) i x=0 := by + have hz (v : E) : dd (fun _ : E => (0:ℂ)) v=(fun _ => 0) := by + funext y + simp [dd] + simp only [directional,hz,mul_zero,Finset.sum_const_zero,add_zero] + +lemma directional_support (e : I → E) (a : Tensor E) (b : Lower E) + {K : Set E} (hK : IsClosed K) (u : I → E → ℂ) + (hu : ∀ j, Function.support (u j)⊆K) (i : I) : + Function.support (directional e a b u i)⊆K := by + intro x hx + by_contra hn + have hg (j : I) : u j =ᶠ[𝓝 x] (fun _ => 0) := by + apply notMem_tsupport_iff_eventuallyEq.mp + exact fun h => hn (closure_minimal (hu j) hK h) + have heq := directional_germ_eq e a b hg i + rw [directional_zero] at heq + exact hx heq + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +omit [NormedSpace ℝ E] in +lemma chartTransfer_germ (e : OpenPartialHomeomorph E E) {K : Set E} + {η : E → ℝ} (hη : ∀ x∈e '' K, η x=1) + {u : E → F} (hu : Function.support u⊆K) {x : E} (hx : x∈e.target) : + chartTransfer e η u =ᶠ[𝓝 x] (fun z => u (e.symm z)) := by + filter_upwards [e.open_target.mem_nhds hx] with z hz + have h := chartTransfer_apply e hη hu (e.map_target hz) + simpa only [e.right_inv hz] using h + +omit [NormedSpace ℝ E] in +lemma chartTransfer_extension_germ (e : OpenPartialHomeomorph E E) {K : Set E} + {η : E → ℝ} (hη : ∀ x∈e '' K, η x=1) + {u : E → F} (hu : Function.support u⊆K) {x : E} (hx : x∈e.target) + {Ψ : E → E} (hΨ : Ψ =ᶠ[𝓝 x] e.symm) : + chartTransfer e η u =ᶠ[𝓝 x] (fun z => u (Ψ z)) := by + filter_upwards [chartTransfer_germ e hη hu hx,hΨ] with z hz hΨz + rw [hz,hΨz] + +end ElasticityBoundaryOperatorLocal + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryData.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryData.lean new file mode 100644 index 0000000000000000000000000000000000000000..e51f2ade2f6485b0fedcffb6bc678a012fed247d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryData.lean @@ -0,0 +1,1100 @@ +import OAI.MathematicalPhysics.Elasticity.Restriction +import OAI.MathematicalPhysics.Elasticity.BoundaryPackets + +namespace OAI + +noncomputable section + +namespace Elasticity + +section +/-! Mixed physical quasimodes. Unlike a quadratic same-system remainder, +this controls the coefficient-difference energy of a trial for each system. +It is the precise physical-DN bridge for the normal-jet induction. -/ +open Set MeasureTheory +variable {Ω : Set X} {lam mu : X → ℝ} + +lemma DN_trace_symm (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u v : H1Hilbert Ω) : + DN Ω lam mu (trace Ω (h1Equiv Ω u)) (trace Ω (h1Equiv Ω v)) = + DN Ω lam mu (trace Ω (h1Equiv Ω v)) (trace Ω (h1Equiv Ω u)) := by + have huv := DN_quasimode_identity ha hO hB u v + have hvu := DN_quasimode_identity ha hO hB v u + have he := energy_symm (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) (h1Equiv Ω u) (h1Equiv Ω v) + have hz : zeroTraceEnergy (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) (physicalError ha hO hB u) + (physicalError ha hO hB v) = + zeroTraceEnergy (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) (physicalError ha hO hB v) + (physicalError ha hO hB u) := jetEnergy_symm _ _ _ _ + linarith + +lemma DN_one_sided_error (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u v : H1Hilbert Ω) : + energy Ω lam mu (h1Equiv Ω u) (h1Equiv Ω v) - + DN Ω lam mu (trace Ω (h1Equiv Ω u)) (trace Ω (h1Equiv Ω v)) = + jetEnergy (ha.1.boundedCoefficient hO hB) (ha.2.1.boundedCoefficient hO hB) + (physicalError ha hO hB u).val v.val := by + let U := physicalProjection (lam := lam) (mu := mu) u + let hl := ha.1.boundedCoefficient hO hB + let hm := ha.2.1.boundedCoefficient hO hB + rw [DN_eq_energy ha hO hB] + have hU : dirichletSolution Ω lam mu (trace Ω (h1Equiv Ω u)) = h1Equiv Ω U := + (Equiv.apply_symm_apply _ _).symm + rw [hU, ← jetEnergy_eq_energy hl hm u v, ← jetEnergy_eq_energy hl hm U v] + exact (congrArg (fun f : JetH Ω →L[ℝ] ℝ => f v.val) + ((jetEnergy hl hm).map_sub u.val U.val)).symm + +lemma mixed_error_identity {l₁ m₁ l₂ m₂ : X → ℝ} + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hDN : DN Ω l₁ m₁ = DN Ω l₂ m₂) (u v : H1Hilbert Ω) : + energy Ω l₁ m₁ (h1Equiv Ω u) (h1Equiv Ω v) - + energy Ω l₂ m₂ (h1Equiv Ω u) (h1Equiv Ω v) = + jetEnergy (ha₁.1.boundedCoefficient hO hB) (ha₁.2.1.boundedCoefficient hO hB) + (physicalError ha₁ hO hB u).val v.val - + jetEnergy (ha₂.1.boundedCoefficient hO hB) (ha₂.2.1.boundedCoefficient hO hB) + u.val (physicalError ha₂ hO hB v).val := by + have h₁ := DN_one_sided_error ha₁ hO hB u v + have h₂ := DN_one_sided_error ha₂ hO hB v u + rw [energy_symm (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB), DN_trace_symm ha₂ hO hB v u, + jetEnergy_symm] at h₂ + rw [hDN] at h₁ + linarith + +/-- Equal physical DN maps control the *same mixed fields* in the two +coefficient energies, using only the residual in its own system. -/ +theorem equal_DN_mixed_quasimode_bound {l₁ m₁ l₂ m₂ : X → ℝ} + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hDN : DN Ω l₁ m₁ = DN Ω l₂ m₂) : + ∃ C₁ C₂ : ℝ, 0 < C₁ ∧ 0 < C₂ ∧ ∀ u v : H1Hilbert Ω, + |energy Ω l₁ m₁ (h1Equiv Ω u) (h1Equiv Ω v) - + energy Ω l₂ m₂ (h1Equiv Ω u) (h1Equiv Ω v)| ≤ + C₁ * ‖physicalResidual (ha₁.1.boundedCoefficient hO hB) + (ha₁.2.1.boundedCoefficient hO hB) u‖ * ‖v‖ + + C₂ * ‖u‖ * ‖physicalResidual (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB) v‖ := by + obtain ⟨c₁, hc₁, hb₁⟩ := physicalError_bound ha₁ hO hB + obtain ⟨c₂, hc₂, hb₂⟩ := physicalError_bound ha₂ hO hB + let E₁ := jetEnergy (ha₁.1.boundedCoefficient hO hB) (ha₁.2.1.boundedCoefficient hO hB) + let E₂ := jetEnergy (ha₂.1.boundedCoefficient hO hB) (ha₂.2.1.boundedCoefficient hO hB) + refine ⟨(‖E₁‖+1)/c₁, (‖E₂‖+1)/c₂, by positivity, by positivity, ?_⟩ + intro u v + rw [mixed_error_identity ha₁ ha₂ hO hB hDN] + let r₁ := physicalResidual (ha₁.1.boundedCoefficient hO hB) + (ha₁.2.1.boundedCoefficient hO hB) u + let r₂ := physicalResidual (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB) v + have h₁ : |E₁ (physicalError ha₁ hO hB u).val v.val| ≤ + ((‖E₁‖+1)/c₁) * ‖r₁‖ * ‖v‖ := by + calc + _ ≤ ‖E₁‖ * ‖physicalError ha₁ hO hB u‖ * ‖v‖ := E₁.le_opNorm₂ _ _ + _ ≤ (‖E₁‖+1) * (‖r₁‖/c₁) * ‖v‖ := + mul_le_mul_of_nonneg_right + (mul_le_mul (by linarith) (hb₁ u) (by positivity) (by positivity)) + (norm_nonneg v) + _ = _ := by ring + have h₂ : |E₂ u.val (physicalError ha₂ hO hB v).val| ≤ + ((‖E₂‖+1)/c₂) * ‖u‖ * ‖r₂‖ := by + calc + _ ≤ ‖E₂‖ * ‖u‖ * ‖physicalError ha₂ hO hB v‖ := E₂.le_opNorm₂ _ _ + _ ≤ ((‖E₂‖+1) * ‖u‖) * (‖r₂‖/c₂) := + mul_le_mul (mul_le_mul_of_nonneg_right (by linarith) (norm_nonneg u)) + (hb₂ v) (by positivity) (by positivity) + _ = _ := by ring + exact (abs_sub _ _).trans (add_le_add h₁ h₂) + +end +/-! Complex boundary tests use only the real physical DN map. The following +is derived from four real identities; no equality of an augmented or assumed +complex DN map is introduced. -/ +open Set +variable {Ω : Set X} + +abbrev ComplexTrial (Ω : Set X) := H1Hilbert Ω × H1Hilbert Ω + +def complexTrialSize (u : ComplexTrial Ω) : ℝ := ‖u.1‖+‖u.2‖ + +def complexTrialEnergy (l m : X → ℝ) (u v : ComplexTrial Ω) : ℂ := + (energy Ω l m (h1Equiv Ω u.1) (h1Equiv Ω v.1):ℂ)+ + (energy Ω l m (h1Equiv Ω u.2) (h1Equiv Ω v.2):ℂ)+ + Complex.I*((energy Ω l m (h1Equiv Ω u.2) (h1Equiv Ω v.1):ℂ)- + (energy Ω l m (h1Equiv Ω u.1) (h1Equiv Ω v.2):ℂ)) + +def complexResidualSize {l m : X → ℝ} (hl : BoundedCoefficient Ω l) + (hm : BoundedCoefficient Ω m) (u : ComplexTrial Ω) : ℝ := + ‖physicalResidual hl hm u.1‖+‖physicalResidual hl hm u.2‖ + +lemma norm_complex_four (a b c d : ℝ) : + ‖(a:ℂ)+b+Complex.I*((c:ℂ)-d)‖≤|a|+|b|+|c|+|d| := by + calc + _ ≤ ‖(a:ℂ)+b‖+‖Complex.I*((c:ℂ)-d)‖ := norm_add_le _ _ + _ ≤ (‖(a:ℂ)‖+‖(b:ℂ)‖)+(‖(c:ℂ)‖+‖(d:ℂ)‖) := by + rw [norm_mul,Complex.norm_I,one_mul] + exact add_le_add (norm_add_le _ _) (norm_sub_le _ _) + _ = _ := by simp only [Complex.norm_real,Real.norm_eq_abs]; ring + +/-- Genuine sesquilinear mixed energy from equality of the real physical DN +maps. Each of the four trial components may have its own arbitrary trace. -/ +theorem equal_DN_complex_mixed_bound {l₁ m₁ l₂ m₂ : X → ℝ} + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + ∃ C₁ C₂ : ℝ, 0 ?_⟩ + let E (a b : H1Hilbert Ω) := energy Ω l₁ m₁ (h1Equiv Ω a) (h1Equiv Ω b)- + energy Ω l₂ m₂ (h1Equiv Ω a) (h1Equiv Ω b) + have he : complexTrialEnergy l₁ m₁ u v-complexTrialEnergy l₂ m₂ u v= + (E u.1 v.1:ℂ)+E u.2 v.2+Complex.I*((E u.2 v.1:ℂ)-E u.1 v.2) := by + unfold complexTrialEnergy E + push_cast + ring + rw [he] + refine (norm_complex_four _ _ _ _).trans ?_ + have hh := add_le_add + (add_le_add (add_le_add (h u.1 v.1) (h u.2 v.2)) (h u.2 v.1)) (h u.1 v.2) + change |E u.1 v.1|+|E u.2 v.2|+|E u.2 v.1|+|E u.1 v.2|≤_ at hh + refine hh.trans_eq ?_ + unfold complexResidualSize complexTrialSize + ring + +end Elasticity +namespace Elasticity +/-! Genuine strong-to-variational residual estimate for boundary trial fields. +All pairings are on the actual physical H10 space, extended by its defining +density, not a separately assumed boundary test class. -/ +open MeasureTheory Set +open scoped BigOperators +variable {Ω : Set X} {lam mu : X → ℝ} + +def jetStress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : JetH Ω) (i j : Fin 3) : ScalarL2 Ω := + (if i=j then hl.mulL (jetDiv Ω u) else 0) + (2 : ℝ) • hm.mulL (jetStrain Ω i j u) + +lemma jetStrain_symm (u : JetH Ω) (i j : Fin 3) : + jetStrain Ω i j u = jetStrain Ω j i u := by + simp only [jetStrain, add_comm] + +lemma jetEnergy_stress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u v : JetH Ω) : + jetEnergy hl hm u v = ∑ i, ∑ j, inner ℝ (jetStress hl hm u i j) (jetEntry Ω i j v) := by + have hv (i j : Fin 3) : jetStrain Ω i j v = + (1/2 : ℝ) • (jetEntry Ω i j v + jetEntry Ω j i v) := rfl + have hs : (∑ i, ∑ j, inner ℝ (hm.mulL (jetStrain Ω i j u)) (jetEntry Ω j i v)) = + ∑ i, ∑ j, inner ℝ (hm.mulL (jetStrain Ω i j u)) (jetEntry Ω i j v) := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [jetStrain_symm u j i] + have hd (i j : Fin 3) : + inner ℝ (if i = j then hl.mulL (jetDiv Ω u) else 0) (jetEntry Ω i j v) = + if i = j then inner ℝ (hl.mulL (jetDiv Ω u)) (jetEntry Ω i j v) else 0 := by + by_cases h : i = j <;> simp [h] + rw [jetEnergy_apply] + simp only [hv, inner_smul_right, inner_add_right, mul_add, Finset.sum_add_distrib, + ← Finset.mul_sum, hs] + simp only [jetStress, inner_add_left, real_inner_smul_left, + Finset.sum_add_distrib, ← Finset.mul_sum, hd, + Finset.sum_ite_eq, Finset.mem_univ, ite_true] + simp only [jetDiv, sum_apply, inner_sum] + ring + +/-- Smooth scalar integration by parts with a compactly supported interior test. -/ +lemma boundary_smooth_ibp {f : X → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ) ⊆ Ω) (j : Fin 3) : + (∫ x, f x*ElasticityKorn.d (coordVector j) g x ∂(volume.restrict Ω)) = + -(∫ x, fderiv ℝ f x (coordVector j)*g x ∂(volume.restrict Ω)) := by + have hg : ContDiff ℝ (⊤ : ℕ∞) (g : X → ℝ) := g.smooth _ + have hd : Continuous (fun x => fderiv ℝ f x (coordVector j)) := + (hf.continuous_fderiv (by simp)).clm_apply continuous_const + have hgd : Continuous (fun x => fderiv ℝ (g : X → ℝ) x (coordVector j)) := + (hg.continuous_fderiv (by simp)).clm_apply continuous_const + rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + have hz := image_eq_zero_of_notMem_tsupport (f := (ElasticityKorn.d (coordVector j) g : X → ℝ)) + (fun ht => hx (hs ((tsupport_fderiv_apply_subset ℝ (coordVector j)) ht))) + rw [hz,mul_zero]), + setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + rw [image_eq_zero_of_notMem_tsupport (f := (g : X → ℝ)) (fun ht => hx (hs ht)),mul_zero])] + exact integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + ((hd.mul hg.continuous).integrable_of_hasCompactSupport (hc.mul_left)) + ((hf.continuous.mul hgd).integrable_of_hasCompactSupport ((hc.fderiv_apply ℝ _).mul_left)) + ((hf.continuous.mul hg.continuous).integrable_of_hasCompactSupport (hc.mul_left)) + (fun x _ => hf.differentiable (by simp) x) (fun x _ => hg.differentiable (by simp) x) + +lemma boundary_L2_schwartz_pair (f : ScalarL2 Ω) (g : SchwartzMap X ℝ) : + inner ℝ f (schwartzR Ω g) = ∫ x, f x*g x ∂(volume.restrict Ω) := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [g.coeFn_toLp 2 (volume.restrict Ω)] with x hx + change inner ℝ (f x) (g.toLp 2 (volume.restrict Ω) x)=_ + rw [hx, real_inner_comm] + rfl + +/-- The actual L2 force pairing, with no regularity required of the test. -/ +def boundaryForcePair (F : Fin 3 → ScalarL2 Ω) : JetH Ω →L[ℝ] ℝ := + ∑ i, (innerSL ℝ (F i)).comp (jetScalar Ω none i) + +lemma boundaryForcePair_apply (F : Fin 3 → ScalarL2 Ω) (v : JetH Ω) : + boundaryForcePair F v = ∑ i, inner ℝ (F i) (jetScalar Ω none i v) := by + simp [boundaryForcePair, sum_apply] + +/-- Smooth stresses with their literal divergence give exactly the physical +variational residual. The same statement permits local coefficient extensions: +only equality to the actual stress on Ω is required. -/ +theorem physicalResidual_of_smooth_stress + (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) (s : Fin 3 → Fin 3 → X → ℝ) + (hs : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (s i j)) + (hes : ∀ i j, jetStress hl hm u.val i j =ᵐ[volume.restrict Ω] s i j) + (hd : ∀ i j, MemLp (fun x => fderiv ℝ (s i j) x (coordVector j)) 2 (volume.restrict Ω)) : + physicalResidual hl hm u = + -(boundaryForcePair (fun i => ∑ j, (hd i j).toLp _)).comp (H10Hilbert Ω).subtypeL := by + apply ContinuousLinearMap.ext + intro v + change jetEnergy hl hm u.val v.val = + -boundaryForcePair (fun i => ∑ j, (hd i j).toLp _) v.val + apply h10_induction_closed (P := fun w => jetEnergy hl hm u.val w = + -boundaryForcePair (fun i => ∑ j, (hd i j).toLp _) w) + · exact isClosed_eq (jetEnergy hl hm u.val).continuous + (boundaryForcePair (fun i => ∑ j, (hd i j).toLp _)).continuous.neg + · intro w hw + obtain ⟨G, hG, h0, h1⟩ := jet_test_representation w hw + rw [jetEnergy_stress, boundaryForcePair_apply] + simp only [h0, h1, sum_inner, ← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [boundary_L2_schwartz_pair, boundary_L2_schwartz_pair] + have hab := boundary_smooth_ibp (hs i j) (G i) + (Metric.isCompact_iff_isClosed_bounded.mpr ⟨isClosed_tsupport _, hB.subset (hG i)⟩) (hG i) j + calc + _ = ∫ x, s i j x * ElasticityKorn.d (coordVector j) (G i) x ∂(volume.restrict Ω) := by + apply integral_congr_ae + filter_upwards [hes i j] with x hx + rw [hx] + rfl + _ = _ := hab + _ = _ := by + congr 1 + apply integral_congr_ae + filter_upwards [(hd i j).coeFn_toLp] with x hx + rw [hx] + +lemma jetScalar_value_norm_le (v : JetH Ω) (i : Fin 3) : + ‖jetScalar Ω none i v‖ ≤ ‖v‖ := by + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [jet_norm_sq] + have h1 : ‖jetScalar Ω none i v‖ ^ 2 ≤ jetValueSq Ω v := by + apply Finset.single_le_sum (f := fun j => ‖jetScalar Ω none j v‖ ^ 2) + · intro j _; exact sq_nonneg _ + · exact Finset.mem_univ i + have h2 : 0 ≤ jetGradSq Ω v := + Finset.sum_nonneg (fun i _ => Finset.sum_nonneg (fun j _ => sq_nonneg _)) + linarith + +lemma boundaryForcePair_norm_le (F : Fin 3 → ScalarL2 Ω) : + ‖boundaryForcePair F‖ ≤ ∑ i, ‖F i‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + intro v + rw [boundaryForcePair_apply] + calc + ‖∑ i, inner ℝ (F i) (jetScalar Ω none i v)‖ ≤ + ∑ i, ‖inner ℝ (F i) (jetScalar Ω none i v)‖ := norm_sum_le _ _ + _ ≤ ∑ i, ‖F i‖ * ‖v‖ := by + apply Finset.sum_le_sum + intro i _ + exact (norm_inner_le_norm _ _).trans + (mul_le_mul_of_nonneg_left (jetScalar_value_norm_le v i) (norm_nonneg _)) + _ = _ := by rw [Finset.sum_mul] + +/-- The actual dual residual obeys an L2 strong-residual bound; no boundary +regularity of the test space or unproved trace density is used. -/ +theorem physicalResidual_norm_le_of_smooth_stress + (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) (s : Fin 3 → Fin 3 → X → ℝ) + (hs : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (s i j)) + (hes : ∀ i j, jetStress hl hm u.val i j =ᵐ[volume.restrict Ω] s i j) + (hd : ∀ i j, MemLp (fun x => fderiv ℝ (s i j) x (coordVector j)) 2 (volume.restrict Ω)) : + ‖physicalResidual hl hm u‖ ≤ ∑ i, ‖∑ j, (hd i j).toLp _‖ := by + rw [physicalResidual_of_smooth_stress hl hm hB u s hs hes hd] + apply ContinuousLinearMap.opNorm_le_bound _ (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + intro v + change ‖-boundaryForcePair (fun i => ∑ j, (hd i j).toLp _) v.val‖ ≤ _ + rw [norm_neg] + exact ((boundaryForcePair (fun i => ∑ j, (hd i j).toLp _)).le_opNorm v.val).trans + (mul_le_mul_of_nonneg_right (boundaryForcePair_norm_le _) (norm_nonneg _)) + +end Elasticity +namespace Elasticity +/-! Actual smooth physical displacements give the exact H1 trial objects used + by the physical DN map. This is a constructor, not a trace assumption. -/ +open Set MeasureTheory +open scoped BigOperators +variable {Ω : Set X} + +def smoothTrial (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) : H1Hilbert Ω := + (h1Equiv Ω).symm ⟨(hf.toLp f,fun j => (hd j).toLp _), + subset_closure ⟨f,hf,hd,hs,rfl,rfl⟩⟩ + +@[simp] lemma smoothTrial_value (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) : + (smoothTrial f hs hf hd).val none=hf.toLp f := rfl + +@[simp] lemma smoothTrial_deriv (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) (j : Fin 3) : + (smoothTrial f hs hf hd).val (some j)=(hd j).toLp _ := rfl + +lemma smoothTrial_entry_ae (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) (i j : Fin 3) : + jetEntry Ω i j (smoothTrial f hs hf hd).val =ᵐ[volume.restrict Ω] + fun x => (coordDeriv f j x) i := by + filter_upwards [jetEntry_ae (smoothTrial f hs hf hd).val i j,(hd j).coeFn_toLp] with x hx hy + exact hx.trans (congrArg (fun v : V => v i) hy) + +lemma smoothTrial_stress_ae {l m : X → ℝ} (hl : BoundedCoefficient Ω l) (hm : BoundedCoefficient Ω m) + (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) (i j : Fin 3) : + jetStress hl hm (smoothTrial f hs hf hd).val i j =ᵐ[volume.restrict Ω] + fun x => (if i=j then l x*(∑ k, (coordDeriv f k x) k) else 0)+ + m x*((coordDeriv f j x) i+(coordDeriv f i x) j) := by + let u := (smoothTrial f hs hf hd).val + have hda : ∀ᵐ x ∂(volume.restrict Ω),∀ k, u (some k) x=coordDeriv f k x := + Filter.eventually_all.mpr (fun k => (hd k).coeFn_toLp) + have hzero : (0 : ScalarL2 Ω) =ᵐ[volume.restrict Ω] fun _ => 0 := Lp.coeFn_zero _ _ _ + by_cases hij : i=j + · filter_upwards [Lp.coeFn_add (hl.mulL (jetDiv Ω u)) ((2:ℝ) • hm.mulL (jetStrain Ω i j u)), + Lp.coeFn_smul (2:ℝ) (hm.mulL (jetStrain Ω i j u)), hl.mulL_ae (jetDiv Ω u), + hm.mulL_ae (jetStrain Ω i j u), jetDiv_ae u,jetStrain_ae u i j,hda] with x h0 h1 h2 h3 h4 h5 h6 + change ((if i=j then hl.mulL (jetDiv Ω u) else 0)+(2:ℝ) • hm.mulL (jetStrain Ω i j u)) x=_ + simp only [hij,ite_true] at * + rw [h0] + simp only [Pi.add_apply] + rw [h1] + simp only [Pi.smul_apply,smul_eq_mul,h2,h3,h4,h5,h6] + ring + · filter_upwards [Lp.coeFn_add (0 : ScalarL2 Ω) ((2:ℝ) • hm.mulL (jetStrain Ω i j u)), + Lp.coeFn_smul (2:ℝ) (hm.mulL (jetStrain Ω i j u)),hzero, + hm.mulL_ae (jetStrain Ω i j u),jetStrain_ae u i j,hda] with x h0 h1 hz h3 h5 h6 + change ((if i=j then hl.mulL (jetDiv Ω u) else 0)+(2:ℝ) • hm.mulL (jetStrain Ω i j u)) x=_ + simp only [hij,ite_false] + rw [h0] + simp only [Pi.add_apply] + rw [h1] + simp only [Pi.smul_apply,smul_eq_mul,hz,h3,h5,h6] + ring + +lemma smooth_compact_coordDeriv {f : X → V} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hc : HasCompactSupport f) (j : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (coordDeriv f j) ∧ HasCompactSupport (coordDeriv f j) := by + exact ⟨(hf.fderiv_right (by simp)).clm_apply contDiff_const,hc.fderiv_apply ℝ _⟩ + +lemma smooth_compact_memLp {f : X → V} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hc : HasCompactSupport f) : + MemLp f 2 (volume.restrict Ω) ∧ ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω) := by + refine ⟨(hf.continuous.memLp_of_hasCompactSupport hc).restrict _,fun j => ?_⟩ + obtain ⟨hs,hc'⟩ := smooth_compact_coordDeriv hf hc j + exact (hs.continuous.memLp_of_hasCompactSupport hc').restrict _ + +end Elasticity +namespace Elasticity +/-! Exact agreement of the variational trial energy with classical smooth +physical fields and their literal derivatives. -/ +open Set MeasureTheory +open scoped BigOperators +variable {Ω : Set X} + +lemma smoothTrial_gradient_ae (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) : + gradient (h1Equiv Ω (smoothTrial f hs hf hd)).val =ᵐ[volume.restrict Ω] + (fun x j => coordDeriv f j x) := by + have hh := Filter.eventually_all.mpr (fun j => (hd j).coeFn_toLp) + filter_upwards [hh] with x hx + exact funext hx + +lemma smoothTrial_energy (l m : X → ℝ) (f g : X → V) + (hsf : ContDiff ℝ (⊤ : ℕ∞) f) (hsg : ContDiff ℝ (⊤ : ℕ∞) g) + (hf : MemLp f 2 (volume.restrict Ω)) (hg : MemLp g 2 (volume.restrict Ω)) + (hdf : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) + (hdg : ∀ j, MemLp (coordDeriv g j) 2 (volume.restrict Ω)) : + energy Ω l m (h1Equiv Ω (smoothTrial f hsf hf hdf)) (h1Equiv Ω (smoothTrial g hsg hg hdg))= + ∫ x in Ω, elasticDensity (l x) (m x) (fun j => coordDeriv f j x) (fun j => coordDeriv g j x) := by + rw [energy_eq_ambient] + apply integral_congr_ae + filter_upwards [smoothTrial_gradient_ae f hsf hf hdf,smoothTrial_gradient_ae g hsg hg hdg] with x h1 h2 + exact congrArg₂ (elasticDensity (l x) (m x)) h1 h2 + +/-- Projection of a complex physical displacement to an actual real trial +field. The map `w` will be real or imaginary part. -/ +def realField (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) (x : X) : V := + WithLp.toLp 2 (fun i => w (u i x)) + +lemma smooth_realField (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) + (hu : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (u i)) : ContDiff ℝ (⊤ : ℕ∞) (realField w u) := by + exact PiLp.contDiff_toLp.comp (contDiff_pi.mpr (fun i => w.contDiff.comp (hu i))) + +lemma realField_derivative (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) + (hu : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (u i)) (i j : Fin 3) (x : X) : + coordDeriv (realField w u) j x i= + w (ElasticityBoundaryChainRule.dd (u i) (coordVector j) x) := by + have h1 := (EuclideanSpace.proj i : V →L[ℝ] ℝ).hasFDerivAt.comp x + (((smooth_realField w u hu).differentiable (by simp)) x).hasFDerivAt + have h2 := w.hasFDerivAt.comp x (((hu i).differentiable (by simp)) x).hasFDerivAt + have he : (EuclideanSpace.proj i : V →L[ℝ] ℝ) ∘ realField w u=w ∘ u i := rfl + rw [he] at h1 + have hh := congrArg (fun A : X →L[ℝ] ℝ => A (coordVector j)) (h1.unique h2) + exact hh + +lemma realField_support (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) {K : Set X} + (hu : ∀ i, Function.support (u i)⊆K) : Function.support (realField w u)⊆K := by + intro x hx + by_contra hn + apply hx + ext i + have hz : u i x=0 := Function.notMem_support.mp (fun h => hn (hu i h)) + simp [realField,hz] + +lemma compact_realField (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) {K : Set X} + (hK : IsCompact K) (hu : ∀ i, Function.support (u i)⊆K) : HasCompactSupport (realField w u) := by + exact hK.of_isClosed_subset (isClosed_tsupport _) (closure_minimal (realField_support w u hu) hK.isClosed) + +end Elasticity +namespace ElasticityBoundaryProjectedStress +/-! The complex quasimode's real and imaginary stresses are the literal real +physical stresses used by the DN map. -/ +open Set MeasureTheory +open scoped BigOperators +open Elasticity ElasticityBoundaryChainRule ElasticityBoundaryPhysicalStrong + ElasticityBoundaryChartOperator ElasticityBoundaryPhysicalTransfer +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +def realStress (w : ℂ →L[ℝ] ℝ) (l m : X → ℝ) (u : I → X → ℂ) (i j : I) : X → ℝ := + fun x => w (stress basis (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i j x) + +lemma smooth_stress {l m : X → ℂ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → X → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i j : I) : + ContDiff ℝ (⊤ : ℕ∞) (stress basis l m u i j) := by + change ContDiff ℝ (⊤ : ℕ∞) (fun x => + (if i=j then l x*divergence basis u x else 0)+ + m x*(dd (u i) (basis j) x+dd (u j) (basis i) x)) + by_cases hij : i=j + · simp only [hij,ite_true] + exact (hl.mul (smooth_divergence basis u hu)).add + (hm.mul ((smooth_dd (hu j) _).add (smooth_dd (hu j) _))) + · simp only [hij,ite_false,zero_add] + exact hm.mul ((smooth_dd (hu i) _).add (smooth_dd (hu j) _)) + +lemma compact_stress (l m : X → ℂ) (u : I → X → ℂ) + (hu : ∀ j, HasCompactSupport (u j)) (i j : I) : + HasCompactSupport (stress basis l m u i j) := by + have hd : HasCompactSupport (divergence basis u) := by + change HasCompactSupport (fun x => ∑ k, dd (u k) (basis k) x) + simp only [Fin.sum_univ_three] + exact (((hu 0).fderiv_apply ℝ _).add ((hu 1).fderiv_apply ℝ _)).add ((hu 2).fderiv_apply ℝ _) + have hs : HasCompactSupport (fun x => m x*(dd (u i) (basis j) x+dd (u j) (basis i) x)) := + ((hu i).fderiv_apply ℝ _ |>.add ((hu j).fderiv_apply ℝ _)).mul_left + change HasCompactSupport (fun x => (if i=j then l x*divergence basis u x else 0)+ + m x*(dd (u i) (basis j) x+dd (u j) (basis i) x)) + by_cases hij : i=j + · simp only [hij,ite_true] + have hl : HasCompactSupport (fun x => l x*divergence basis u x) := hd.mul_left + convert hl.add hs using 1 + subst i + rfl + · simpa only [hij,ite_false,zero_add] using hs + +lemma project_mul (w : ℂ →L[ℝ] ℝ) (c : ℝ) (z : ℂ) : w ((c:ℂ)*z)=c*w z := by + rw [← Complex.real_smul,map_smul,smul_eq_mul] + +lemma realStress_eq (w : ℂ →L[ℝ] ℝ) (l m : X → ℝ) (u : I → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i j : I) (x : X) : + realStress w l m u i j x= + (if i=j then l x*(∑ k, coordDeriv (realField w u) k x k) else 0)+ + m x*(coordDeriv (realField w u) j x i+coordDeriv (realField w u) i x j) := by + simp only [realStress,stress,map_add,project_mul,divergence, + realField_derivative w u hu] + by_cases hij : i=j <;> simp only [hij,ite_true,ite_false,map_zero,project_mul,map_sum] + all_goals rfl + +lemma smooth_realStress (w : ℂ →L[ℝ] ℝ) {l m : X → ℝ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → X → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i j : I) : + ContDiff ℝ (⊤ : ℕ∞) (realStress w l m u i j) := + w.contDiff.comp (smooth_stress (Complex.ofRealCLM.contDiff.comp hl) + (Complex.ofRealCLM.contDiff.comp hm) u hu i j) + +lemma compact_realStress (w : ℂ →L[ℝ] ℝ) (l m : X → ℝ) (u : I → X → ℂ) + (hu : ∀ j, HasCompactSupport (u j)) (i j : I) : + HasCompactSupport (realStress w l m u i j) := + (compact_stress _ _ u hu i j).comp_left (g := w) (map_zero w) + +lemma derivative_project {f : X → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (w : ℂ →L[ℝ] ℝ) (v x : X) : + fderiv ℝ (fun z => w (f z)) x v=w (dd f v x) := by + rw [show (fun z => w (f z))=w ∘ f from rfl, + (w.hasFDerivAt.comp x (hf.differentiable (by simp) x).hasFDerivAt).fderiv] + rfl + +lemma realStress_divergence (w : ℂ →L[ℝ] ℝ) {l m : X → ℝ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → X → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) (x : X) : + (∑ j, fderiv ℝ (realStress w l m u i j) x (coordVector j))= + w (force (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i x) := by + have hlc := Complex.ofRealCLM.contDiff.comp hl + have hmc := Complex.ofRealCLM.contDiff.comp hm + have he (j : I) : fderiv ℝ (realStress w l m u i j) x (coordVector j)= + w (dd (stress basis (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i j) (basis j) x) := + derivative_project (smooth_stress hlc hmc u hu i j) w _ x + simp only [he] + rw [← map_sum] + exact congrArg w (stress_divergence basis hlc hmc u hu i x) + +end ElasticityBoundaryProjectedStress +/-! Squared physical H10-dual residual estimates in terms of the genuine +strong-force mass. This is the bridge from chart quasimodes to the DN map. -/ +section +open Set MeasureTheory +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} + +lemma L2_norm_sq_mass (v : ScalarL2 Ω) : ‖v‖^2=∫ x in Ω, ‖v x‖^2 := by + rw [← real_inner_self_eq_norm_sq,L2.inner_def] + simp only [real_inner_self_eq_norm_sq] + +lemma sum_toLp_norm_sq (f : Fin 3 → X → ℝ) (hf : ∀ j, MemLp (f j) 2 (volume.restrict Ω)) : + ‖∑ j, (hf j).toLp (f j)‖^2=∫ x in Ω, ‖∑ j, f j x‖^2 := by + rw [L2_norm_sq_mass] + apply integral_congr_ae + have hall := Filter.eventually_all.mpr (fun j => (hf j).coeFn_toLp) + filter_upwards [Lp.coeFn_finsetSum Finset.univ (fun j => (hf j).toLp (f j)),hall] with x hx hy + simp only [hx,Finset.sum_apply,hy] + +lemma sum_three_sq (v : Fin 3 → ℝ) : (∑ i, v i)^2≤3*∑ i, (v i)^2 := by + simp only [Fin.sum_univ_three] + nlinarith [sq_nonneg (v 0-v 1),sq_nonneg (v 0-v 2),sq_nonneg (v 1-v 2)] + +lemma physicalResidual_sq_mass {l m : X → ℝ} + (hl : BoundedCoefficient Ω l) (hm : BoundedCoefficient Ω m) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) (s : Fin 3 → Fin 3 → X → ℝ) + (hs : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (s i j)) + (hes : ∀ i j, jetStress hl hm u.val i j =ᵐ[volume.restrict Ω] s i j) + (hd : ∀ i j, MemLp (fun x => fderiv ℝ (s i j) x (coordVector j)) 2 (volume.restrict Ω)) : + ‖physicalResidual hl hm u‖^2≤3*∑ i, + (∫ x in Ω, ‖∑ j, fderiv ℝ (s i j) x (coordVector j)‖^2) := by + have h := physicalResidual_norm_le_of_smooth_stress hl hm hB u s hs hes hd + have h0 : 0≤∑ i, ‖∑ j, (hd i j).toLp _‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + apply ((sq_le_sq₀ (norm_nonneg (physicalResidual hl hm u)) h0).mpr h).trans + have hsq := sum_three_sq (fun i => ‖∑ j, (hd i j).toLp _‖) + simpa only [sum_toLp_norm_sq] using hsq + +end Elasticity +namespace ElasticityBoundaryResidualMass +open Elasticity ElasticityBoundaryProjectedStress ElasticityBoundaryPhysicalTransfer + ElasticityBoundaryChartOperator ElasticityBoundaryPhysicalStrong ElasticityBoundaryChainRule +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +lemma projected_force_mass_le {Ω : Set X} (w : ℂ →L[ℝ] ℝ) {F : X → ℂ} + (hF : MemLp F 2 (volume.restrict Ω)) : + (∫ x in Ω, ‖w (F x)‖^2)≤‖w‖^2*(∫ x in Ω, ‖F x‖^2) := by + have hInt := (memLp_two_iff_integrable_sq_norm hF.aestronglyMeasurable).mp hF + have hwF : MemLp (fun x => w (F x)) 2 (volume.restrict Ω) := hF.continuousLinearMap_comp w + rw [← integral_const_mul] + apply integral_mono ((memLp_two_iff_integrable_sq_norm hwF.aestronglyMeasurable).mp hwF) + (hInt.const_mul _) + intro x + simpa only [mul_pow] using pow_le_pow_left₀ (norm_nonneg _) (w.le_opNorm (F x)) 2 + +/-- Each real projection is an actual finite-energy smooth trial and its +physical variational residual is controlled by the literal complex force. -/ +theorem projected_trial_residual {Ω : Set X} (w : ℂ →L[ℝ] ℝ) {l m : X → ℝ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hbl : BoundedCoefficient Ω l) (hbm : BoundedCoefficient Ω m) + (hB : Bornology.IsBounded Ω) + (u : I → X → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (hcu : ∀ j, HasCompactSupport (u j)) + (hf : MemLp (realField w u) 2 (volume.restrict Ω)) + (hdf : ∀ j, MemLp (coordDeriv (realField w u) j) 2 (volume.restrict Ω)) + (hF : ∀ i, MemLp (force (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i) 2 (volume.restrict Ω)) : + ‖physicalResidual hbl hbm (smoothTrial (realField w u) (smooth_realField w u hu) hf hdf)‖^2≤ + 3*‖w‖^2*∑ i, (∫ x in Ω, ‖force (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i x‖^2) := by + have hs := smooth_realStress w hl hm u hu + have hc := compact_realStress w l m u hcu + have hd (i j : I) : MemLp (fun x => fderiv ℝ (realStress w l m u i j) x (coordVector j)) 2 + (volume.restrict Ω) := + (((hs i j).continuous_fderiv (by simp)).clm_apply continuous_const).memLp_of_hasCompactSupport + ((hc i j).fderiv_apply ℝ _) |>.restrict _ + have hes (i j : I) : jetStress hbl hbm + (smoothTrial (realField w u) (smooth_realField w u hu) hf hdf).val i j =ᵐ[volume.restrict Ω] + realStress w l m u i j := by + filter_upwards [smoothTrial_stress_ae hbl hbm (realField w u) (smooth_realField w u hu) hf hdf i j] + with x hx + exact hx.trans (realStress_eq w l m u hu i j x).symm + apply (physicalResidual_sq_mass hbl hbm hB _ (realStress w l m u) hs hes hd).trans + simp only [realStress_divergence w hl hm u hu] + calc + _ ≤ 3*∑ i, (‖w‖^2*(∫ x in Ω, ‖force (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) u i x‖^2)) := + mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun i _ => projected_force_mass_le w (hF i))) (by norm_num) + _ = _ := by rw [← Finset.mul_sum,mul_assoc] + +end ElasticityBoundaryResidualMass + +end +/-! Exact H1 masses of the physical complex trial projections, and bounds by +literal scalar component derivatives. -/ +section +open Set MeasureTheory +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} + +lemma vector_toLp_norm_sq (f : X → V) (hf : MemLp f 2 (volume.restrict Ω)) : + ‖hf.toLp f‖^2=∑ i, (∫ x in Ω, ‖f x i‖^2) := by + rw [← real_inner_self_eq_norm_sq,L2.inner_def] + have hi (i : Fin 3) : IntegrableOn (fun x => ‖f x i‖^2) Ω := by + have hh := hf.continuousLinearMap_comp (EuclideanSpace.proj i : V →L[ℝ] ℝ) + exact (memLp_two_iff_integrable_sq_norm hh.aestronglyMeasurable).mp hh + rw [← integral_finsetSum _ (fun i _ => hi i)] + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with x hx + rw [hx,real_inner_self_eq_norm_sq,PiLp.norm_sq_eq_of_L2] + +lemma smoothTrial_norm_sq (f : X → V) (hs : ContDiff ℝ (⊤ : ℕ∞) f) + (hf : MemLp f 2 (volume.restrict Ω)) + (hd : ∀ j, MemLp (coordDeriv f j) 2 (volume.restrict Ω)) : + ‖smoothTrial f hs hf hd‖^2=(∑ i, (∫ x in Ω, ‖f x i‖^2))+ + ∑ j, ∑ i, (∫ x in Ω, ‖coordDeriv f j x i‖^2) := by + change ‖(smoothTrial f hs hf hd).val‖^2=_ + rw [PiLp.norm_sq_eq_of_L2,Fintype.sum_option] + simp only [smoothTrial_value,smoothTrial_deriv,vector_toLp_norm_sq] + +end Elasticity +namespace ElasticityBoundaryTrialMass +open Elasticity ElasticityBoundaryResidualMass ElasticityBoundaryChainRule +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +lemma projected_trial_mass {Ω : Set X} (w : ℂ →L[ℝ] ℝ) + (u : I → X → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (hm : ∀ j, MemLp (u j) 2 (volume.restrict Ω)) + (hdm : ∀ i j, MemLp (dd (u i) (coordVector j)) 2 (volume.restrict Ω)) + (hf : MemLp (realField w u) 2 (volume.restrict Ω)) + (hdf : ∀ j, MemLp (coordDeriv (realField w u) j) 2 (volume.restrict Ω)) : + ‖smoothTrial (realField w u) (smooth_realField w u hu) hf hdf‖^2≤ + ‖w‖^2*((∑ i, (∫ x in Ω, ‖u i x‖^2))+ + ∑ j, ∑ i, (∫ x in Ω, ‖dd (u i) (coordVector j) x‖^2)) := by + rw [smoothTrial_norm_sq,mul_add] + simp only [Finset.mul_sum] + apply add_le_add + · apply Finset.sum_le_sum + intro i _ + exact projected_force_mass_le w (hm i) + · apply Finset.sum_le_sum + intro j _ + apply Finset.sum_le_sum + intro i _ + simp only [realField_derivative w u hu] + exact projected_force_mass_le w (hdm i j) + +end ElasticityBoundaryTrialMass + +end +namespace Elasticity +/-! Complex geometric displacements as genuine pairs of real H1 trials. -/ +open Set MeasureTheory +open scoped BigOperators +variable {Ω : Set X} + +lemma classicalDensity_integrable {l m : X → ℝ} (hl : BoundedCoefficient Ω l) + (hm : BoundedCoefficient Ω m) (P Q : X → Fin 3 → V) + (hP : ∀ j, MemLp (fun x => P x j) 2 (volume.restrict Ω)) + (hQ : ∀ j, MemLp (fun x => Q x j) 2 (volume.restrict Ω)) : + IntegrableOn (fun x => elasticDensity (l x) (m x) (P x) (Q x)) Ω := by + have hp (i j : Fin 3) : MemLp (fun x => P x j i) 2 (volume.restrict Ω) := (hP j).continuousLinearMap_comp (EuclideanSpace.proj i : V →L[ℝ] ℝ) + have hq (i j : Fin 3) : MemLp (fun x => Q x j i) 2 (volume.restrict Ω) := (hQ j).continuousLinearMap_comp (EuclideanSpace.proj i : V →L[ℝ] ℝ) + have hdP : MemLp (fun x => ∑ i, P x i i) 2 (volume.restrict Ω) := + memLp_finsetSum _ (fun i _ => hp i i) + have hdQ : MemLp (fun x => ∑ i, Q x i i) 2 (volume.restrict Ω) := + memLp_finsetSum _ (fun i _ => hq i i) + have hsP (i j : Fin 3) : MemLp (fun x => (P x j i+P x i j)/2) 2 (volume.restrict Ω) := by + simpa only [div_eq_mul_inv,Pi.add_apply] using ((hp i j).add (hp j i)).mul_const (2:ℝ)⁻¹ + have hsQ (i j : Fin 3) : MemLp (fun x => (Q x j i+Q x i j)/2) 2 (volume.restrict Ω) := by + simpa only [div_eq_mul_inv,Pi.add_apply] using ((hq i j).add (hq j i)).mul_const (2:ℝ)⁻¹ + have hL := (hl.mul_memLp_fun hdP).integrable_mul hdQ + have hS (i j) := (hm.mul_memLp_fun (hsP i j)).integrable_mul (hsQ i j) + have hsum := integrable_finsetSum Finset.univ (fun i _ => + integrable_finsetSum Finset.univ (fun j _ => hS i j)) + apply (hL.add (hsum.const_mul 2)).congr + exact Filter.Eventually.of_forall (fun x => by + simp only [elasticDensity,Pi.mul_apply,Pi.add_apply,Finset.mul_sum,mul_assoc]) + +def projectedTrial (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) {K : Set X} (hK : IsCompact K) + (hus : ∀ j, Function.support (u j)⊆K) : H1Hilbert Ω := + smoothTrial (realField w u) (smooth_realField w u hu) + (smooth_compact_memLp (smooth_realField w u hu) (compact_realField w u hK hus)).1 + (smooth_compact_memLp (smooth_realField w u hu) (compact_realField w u hK hus)).2 + +def complexFieldTrial (u : Fin 3 → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) {K : Set X} (hK : IsCompact K) + (hus : ∀ j, Function.support (u j)⊆K) : ComplexTrial Ω := + (projectedTrial Complex.reCLM u hu hK hus,projectedTrial Complex.imCLM u hu hK hus) + +def realMatrix (w : ℂ →L[ℝ] ℝ) (P : Fin 3 → Fin 3 → ℂ) : Fin 3 → V := + fun j => WithLp.toLp 2 (fun i => w (P i j)) + +def complexDensity (l m : ℝ) (P Q : Fin 3 → Fin 3 → ℂ) : ℂ := + (elasticDensity l m (realMatrix Complex.reCLM P) (realMatrix Complex.reCLM Q):ℂ)+ + (elasticDensity l m (realMatrix Complex.imCLM P) (realMatrix Complex.imCLM Q):ℂ)+ + Complex.I*((elasticDensity l m (realMatrix Complex.imCLM P) (realMatrix Complex.reCLM Q):ℂ)- + (elasticDensity l m (realMatrix Complex.reCLM P) (realMatrix Complex.imCLM Q):ℂ)) + +def fieldGradient (u : Fin 3 → X → ℂ) (x : X) (i j : Fin 3) : ℂ := + ElasticityBoundaryChainRule.dd (u i) (coordVector j) x + +lemma realMatrix_gradient (w : ℂ →L[ℝ] ℝ) (u : Fin 3 → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (x : X) : + realMatrix w (fieldGradient u x)=(fun j => coordDeriv (realField w u) j x) := by + funext j + ext i + exact (realField_derivative w u hu i j x).symm + +lemma complexFieldTrial_energy {l m : X → ℝ} (hl : BoundedCoefficient Ω l) + (hm : BoundedCoefficient Ω m) (u v : Fin 3 → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (hv : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (v j)) + {K L : Set X} (hK : IsCompact K) (hL : IsCompact L) + (hus : ∀ j, Function.support (u j)⊆K) (hvs : ∀ j, Function.support (v j)⊆L) : + complexTrialEnergy (Ω := Ω) l m (complexFieldTrial u hu hK hus) (complexFieldTrial v hv hL hvs)= + ∫ x in Ω, complexDensity (l x) (m x) (fieldGradient u x) (fieldGradient v x) := by + have hi (w z : ℂ →L[ℝ] ℝ) : Integrable (fun x => + elasticDensity (l x) (m x) (realMatrix w (fieldGradient u x)) + (realMatrix z (fieldGradient v x))) (volume.restrict Ω) := by + simp only [realMatrix_gradient w u hu,realMatrix_gradient z v hv] + exact classicalDensity_integrable hl hm _ _ + (smooth_compact_memLp (smooth_realField w u hu) (compact_realField w u hK hus)).2 + (smooth_compact_memLp (smooth_realField z v hv) (compact_realField z v hL hvs)).2 + have he (w z : ℂ →L[ℝ] ℝ) := smoothTrial_energy (Ω := Ω) l m (realField w u) (realField z v) + (smooth_realField w u hu) (smooth_realField z v hv) + (smooth_compact_memLp (smooth_realField w u hu) (compact_realField w u hK hus)).1 + (smooth_compact_memLp (smooth_realField z v hv) (compact_realField z v hL hvs)).1 + (smooth_compact_memLp (smooth_realField w u hu) (compact_realField w u hK hus)).2 + (smooth_compact_memLp (smooth_realField z v hv) (compact_realField z v hL hvs)).2 + simp only [complexTrialEnergy,complexFieldTrial,projectedTrial,he,complexDensity] + simp only [← realMatrix_gradient _ u hu,← realMatrix_gradient _ v hv] + rw [integral_add ((hi _ _).ofReal.add (hi _ _).ofReal) + (((hi _ _).ofReal.sub (hi _ _).ofReal).const_mul _), + integral_add (hi _ _).ofReal (hi _ _).ofReal,integral_const_mul, + integral_sub (hi _ _).ofReal (hi _ _).ofReal] + simp only [integral_complex_ofReal] + +end Elasticity +namespace ElasticityBoundaryPacket +/-! Actual smooth compact physical fields selected from the curved boundary +parametrix, on an arbitrary honest smooth domain. -/ +open Set MeasureTheory Filter +open scoped Topology BigOperators +open Elasticity ElasticityBoundaryPhysicalTransfer ElasticityBoundaryForceSupport + ElasticityBoundaryCutoffLayer ElasticityBoundaryCutoffParametrix ElasticityBoundaryPacketMass + ElasticityBoundaryGradientMass ElasticityBoundaryGradientTransfer ElasticityBoundaryPhysicalMass + ElasticityBoundaryChainRule ElasticityBoundaryChartOperator ElasticityBoundaryStrongLayer + ElasticityBoundaryLocalParametrix ElasticityBoundaryMVNormal ElasticityBoundaryActualTower + ElasticityBoundaryProfileBounds ElasticityBoundaryLayerOperator + +variable {Ω : Set X} {x : X} + +def Setup.field (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) : I → X → ℂ := + transferred s.e s.η s.Q (cutoffLayer s.cutoff q δ) + +lemma Setup.cutoff_layer_support (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) (j : I) : + Function.support (fun y : X => cutoffLayer s.cutoff q δ j y.ofLp)⊆s.K := by + intro y hy + apply s.cutoff_support + intro hz + exact hy (by simp [cutoffLayer,hz]) + +lemma Setup.field_smooth (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (s.field q δ i) := + smooth_transferred s.e s.inverse_smooth s.η_smooth s.η_support s.Q _ + (smooth_cutoffLayer s.cutoff_smooth q δ) i + +lemma Setup.field_support (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) (i : I) : + Function.support (s.field q δ i)⊆s.e '' s.K := + support_transferred s.e s.η_support s.Q _ (s.cutoff_layer_support q δ) i + +lemma Setup.image_compact (s : Setup Ω x) : IsCompact (s.e '' s.K) := + compact_image s.e s.compact s.source + +lemma Setup.field_compact (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) (i : I) : + HasCompactSupport (s.field q δ i) := + s.image_compact.of_isClosed_subset (isClosed_tsupport _) + (closure_minimal (s.field_support q δ i) s.image_compact.isClosed) + +lemma Setup.field_value_mass (s : Setup Ω x) (hΩ : MeasurableSet Ω) (q : Polynomial W) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → ∀ i, + (∫ z in Ω, ‖s.field q δ i z‖^2)≤C := by + obtain ⟨A,hA,hbound⟩ := transferred_value_mass s.e s.smooth s.compact s.source + hΩ measurable_H s.inside s.η_support s.η_one s.Q s.Φ s.Φ_smooth s.Φ_germ + choose B hB hBbound using cutoff_value_bound s.cutoff_smooth s.cutoff_compact q + refine ⟨A*∑ j, B j,mul_nonneg hA (Finset.sum_nonneg (fun j _ => hB j)),fun δ hδ hδ1 i => ?_⟩ + apply (hbound _ (smooth_cutoffLayer s.cutoff_smooth q δ) (s.cutoff_layer_support q δ) i).trans + apply mul_le_mul_of_nonneg_left _ hA + apply Finset.sum_le_sum + intro j _ + rw [integral_ofLp (fun y => ‖cutoffLayer s.cutoff q δ j y‖^2)] + exact ((hBbound j δ hδ hδ1).2).trans (mul_le_of_le_one_right (hB j) (pow_le_one₀ hδ.le hδ1)) + +lemma Setup.field_gradient_mass (s : Setup Ω x) (hΩ : MeasurableSet Ω) (q : Polynomial W) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → ∀ i d, + (∫ z in Ω, ‖dd (s.field q δ i) (basis d) z‖^2)≤C := by + obtain ⟨A,hA,hbound⟩ := transferred_gradient_mass s.e s.smooth s.compact s.source + hΩ measurable_H s.inside s.η_support s.η_one s.Q s.Φ s.Ψ s.Φ_smooth s.Ψ_smooth s.Φ_germ s.Ψ_germ + choose B hB hBbound using cutoff_gradient_bound s.cutoff_smooth s.cutoff_compact q + refine ⟨A*∑ j, ∑ α, B j α,mul_nonneg hA + (Finset.sum_nonneg (fun j _ => Finset.sum_nonneg (fun α _ => hB j α))),fun δ hδ hδ1 i d => ?_⟩ + apply (hbound _ (smooth_cutoffLayer s.cutoff_smooth q δ) (s.cutoff_layer_support q δ) i d).trans + apply mul_le_mul_of_nonneg_left _ hA + apply Finset.sum_le_sum; intro j _ + apply Finset.sum_le_sum; intro α _ + rw [integral_ofLp (fun y => ‖dpart (cutoffLayer s.cutoff q δ j) α y‖^2)] + exact (hBbound j α δ hδ hδ1).2 + +/-- Uniform strong force of arbitrary order for the literal physical Lamé +operator; its lower terms and the actual curved chart are retained. -/ +lemma Setup.field_force_mass (s : Setup Ω x) (hΩ : MeasurableSet Ω) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hm0 : m x≠0) (he0 : l x+2*m x≠0) (hp0 : l x+3*m x≠0) + (p₀ : W) (h₀ : normal (l x) (m x) p₀=0) (N : ℕ) : + ∃ p : ℕ → W, p 0=p₀ ∧ (∀ n, 0 hB i)), + fun δ hδ hδ1 i => ?_⟩ + apply (hAbound _ (smooth_cutoffLayer s.cutoff_smooth _ δ) (s.cutoff_layer_support _ δ) i).trans + calc + _ ≤ A*∑ j, (B j*δ^(2*N)) := by + apply mul_le_mul_of_nonneg_left _ hA + apply Finset.sum_le_sum; intro j _ + rw [integral_ofLp (fun y => ‖strong (ElasticityBoundaryPhysicalMass.principal s.Q s.Φ s.Ψ l m) + (ElasticityBoundaryPhysicalMass.lower s.Q s.Φ s.Ψ l m) (cutoffLayer s.cutoff (amplitude p (N+1)) δ) j y‖^2)] + exact (hBbound j δ hδ hδ1).2 + _ = _ := by rw [← Finset.sum_mul,mul_assoc] + +end ElasticityBoundaryPacket +namespace ElasticityBoundaryPacket +/-! The physical quasimodes are genuine elements of the H1/trace construction +used by the real DN map, with uniform norm and arbitrary dual-residual decay. -/ +open Set MeasureTheory +open scoped BigOperators ENNReal NNReal +open Elasticity ElasticityBoundaryPhysicalTransfer ElasticityBoundaryForceSupport + ElasticityBoundaryProjectedStress ElasticityBoundaryPhysicalStrong ElasticityBoundaryChainRule + ElasticityBoundaryResidualMass ElasticityBoundaryTrialMass ElasticityBoundaryActualTower + ElasticityBoundaryMVNormal ElasticityBoundaryChartOperator + +variable {Ω : Set X} {x : X} + +lemma smooth_force {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) + (hm : ContDiff ℝ (⊤ : ℕ∞) m) (u : I → X → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (force l m u i) := by + have he : force l m u i=(fun z => ∑ j, dd (stress basis l m u i j) (basis j) z) := + funext (fun z => (stress_divergence basis hl hm u hu i z).symm) + rw [he] + exact ContDiff.sum (fun j _ => smooth_dd (smooth_stress hl hm u hu i j) _) + +lemma compact_force (l m : X → ℂ) (u : I → X → ℂ) {K : Set X} + (hK : IsCompact K) (hus : ∀ j, Function.support (u j)⊆K) (i : I) : + HasCompactSupport (force l m u i) := + hK.of_isClosed_subset (isClosed_tsupport _) + (closure_minimal (force_support l m u hK.isClosed hus i) hK.isClosed) + +lemma coarse_sq_bound {A t r : ℝ} (hA : 0≤A) (ht : 0≤t) (hr : 0≤r) + (h : r^2≤A*t^2) : r≤(A+1)*t := by + apply (sq_le_sq₀ hr (mul_nonneg (by positivity) ht)).mp + have hC : A≤(A+1)^2 := by nlinarith [sq_nonneg A] + calc + _ ≤ A*t^2 := h + _ ≤ (A+1)^2*t^2 := mul_le_mul_of_nonneg_right hC (sq_nonneg t) + _ = _ := (mul_pow _ _ _).symm + +def Setup.trial (s : Setup Ω x) (q : Polynomial W) (δ : ℝ) : ComplexTrial Ω := + complexFieldTrial (s.field q δ) (s.field_smooth q δ) s.image_compact (s.field_support q δ) + +lemma Setup.trial_size (s : Setup Ω x) (hΩ : MeasurableSet Ω) (q : Polynomial W) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → complexTrialSize (s.trial q δ)≤C := by + obtain ⟨A,hA,hAb⟩ := s.field_value_mass hΩ q + obtain ⟨B,hB,hBb⟩ := s.field_gradient_mass hΩ q + let T := 3*A+9*B + have hT : 0≤T := by dsimp [T]; positivity + have hb (w : ℂ →L[ℝ] ℝ) (δ : ℝ) (hδ : 0<δ) (hδ1 : δ≤1) : + ‖projectedTrial (Ω := Ω) w (s.field q δ) (s.field_smooth q δ) s.image_compact (s.field_support q δ)‖≤ + (T+1)*‖w‖ := by + apply coarse_sq_bound hT (norm_nonneg _) (norm_nonneg _) + have hu := s.field_smooth q δ + have hc := s.field_compact q δ + have hm (i) := (hu i).continuous.memLp_of_hasCompactSupport (hc i) (p := (2:ℝ≥0∞)) (μ := volume) |>.restrict Ω + have hdm (i j) := (smooth_dd (hu i) (coordVector j)).continuous.memLp_of_hasCompactSupport + ((hc i).fderiv_apply ℝ _) (p := (2:ℝ≥0∞)) (μ := volume) |>.restrict Ω + apply (projected_trial_mass w _ hu hm hdm _ _).trans + have hreal : (∑ i, (∫ z in Ω, ‖s.field q δ i z‖^2))+ + (∑ j, ∑ i, (∫ z in Ω, ‖dd (s.field q δ i) (coordVector j) z‖^2))≤T := by + have h1 := Finset.sum_le_sum (fun i (_ : i∈(Finset.univ : Finset I)) => hAb δ hδ hδ1 i) + have h2 := Finset.sum_le_sum (fun j (_ : j∈(Finset.univ : Finset I)) => + Finset.sum_le_sum (fun i (_ : i∈(Finset.univ : Finset I)) => hBb δ hδ hδ1 i j)) + have h1' : (∑ i, (∫ z in Ω, ‖s.field q δ i z‖^2))≤3*A := by simpa using h1 + have h2' : (∑ j, ∑ i, (∫ z in Ω, ‖dd (s.field q δ i) (coordVector j) z‖^2))≤9*B := by + have hh : (∑ j, ∑ i, (∫ z in Ω, ‖dd (s.field q δ i) (coordVector j) z‖^2))≤(3:ℝ)*(3*B) := by + simpa [basis,coordVector] using h2 + exact hh.trans_eq (by ring) + exact add_le_add h1' h2' + simpa only [mul_comm] using mul_le_mul_of_nonneg_left hreal (sq_nonneg ‖w‖) + refine ⟨(T+1)*(‖Complex.reCLM‖+‖Complex.imCLM‖),mul_nonneg (by positivity) (by positivity), + fun δ hδ hδ1 => ?_⟩ + exact (add_le_add (hb Complex.reCLM δ hδ hδ1) (hb Complex.imCLM δ hδ hδ1)).trans_eq (mul_add _ _ _).symm + +lemma Setup.trial_residual (s : Setup Ω x) (hB : Bornology.IsBounded Ω) + {l m : X → ℝ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hbl : BoundedCoefficient Ω l) (hbm : BoundedCoefficient Ω m) + (q : Polynomial W) (N : ℕ) {C : ℝ} (hC : 0≤C) + (hforce : ∀ δ : ℝ, 0<δ → δ≤1 → ∀ i, + (∫ z in Ω, ‖force (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) (s.field q δ) i z‖^2)≤C*δ^(2*N)) : + ∃ A : ℝ, 0≤A ∧ ∀ δ : ℝ, 0<δ → δ≤1 → + complexResidualSize hbl hbm (s.trial q δ)≤A*δ^N := by + have hb (w : ℂ →L[ℝ] ℝ) (δ : ℝ) (hδ : 0<δ) (hδ1 : δ≤1) : + ‖physicalResidual hbl hbm + (projectedTrial w (s.field q δ) (s.field_smooth q δ) s.image_compact (s.field_support q δ))‖≤ + (9*C+1)*(‖w‖*δ^N) := by + refine coarse_sq_bound (A := 9*C) (t := ‖w‖*δ^N) (mul_nonneg (by norm_num) hC) (mul_nonneg (norm_nonneg _) (pow_nonneg hδ.le _)) + (norm_nonneg (physicalResidual hbl hbm + (projectedTrial w (s.field q δ) (s.field_smooth q δ) s.image_compact (s.field_support q δ)))) ?_ + have hu := s.field_smooth q δ + have hc := s.field_compact q δ + have hlc := Complex.ofRealCLM.contDiff.comp hl + have hmc := Complex.ofRealCLM.contDiff.comp hm + have hf (i) := (smooth_force hlc hmc _ hu i).continuous.memLp_of_hasCompactSupport + (compact_force _ _ _ s.image_compact (s.field_support q δ) i) (p := (2:ℝ≥0∞)) (μ := volume) |>.restrict Ω + apply (projected_trial_residual w hl hm hbl hbm hB _ hu hc _ _ hf).trans + calc + _ ≤ 3*‖w‖^2*∑ i : I, (C*δ^(2*N)) := mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (fun i _ => hforce δ hδ hδ1 i)) (by positivity) + _ = _ := by simp only [Fin.sum_univ_three]; rw [pow_mul]; ring + refine ⟨(9*C+1)*(‖Complex.reCLM‖+‖Complex.imCLM‖),by positivity,fun δ hδ hδ1 => ?_⟩ + apply (add_le_add (hb Complex.reCLM δ hδ hδ1) (hb Complex.imCLM δ hδ hδ1)).trans_eq + ring + +end ElasticityBoundaryPacket +namespace ElasticityBoundaryPacket + +section +/-! Arbitrary-order actual physical boundary packets. All coefficient and +ellipticity assumptions here follow from the admissibility. -/ +open Set MeasureTheory +open scoped BigOperators +open Elasticity ElasticityBoundaryMVNormal ElasticityBoundaryActualTower + +variable {Ω : Set X} {x : X} + +lemma amplitude_zero (p : ℕ → W) (N : ℕ) : (amplitude p N).coeff 0=p 0 := by + simp [amplitude,Polynomial.finsetSum_coeff,Polynomial.coeff_monomial] + +lemma ellipticity_at {l m : X → ℝ} (ha : Admissible Ω l m) (hx : x∈closure Ω) : + (m x:ℂ)≠0 ∧ (l x:ℂ)+2*m x≠0 ∧ (l x:ℂ)+3*m x≠0 := by + obtain ⟨hm,he⟩ := ha.2.2 x hx + have h2 : 0 ?_⟩ + exact ⟨hAb δ hδ hδ1,hBb δ hδ hδ1⟩ + +end +/-! Equal full real physical DN maps control two genuine, independently +corrected physical packets; the traces need not coincide. -/ +open Set +open scoped BigOperators +open Elasticity ElasticityBoundaryMVNormal +variable {Ω : Set X} {x : X} + +lemma Setup.paired_packets (s : Setup Ω x) {l₁ m₁ l₂ m₂ : X → ℝ} + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) (hx : x∈closure Ω) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) + (p₀ q₀ : W) (hp₀ : normal (l₁ x) (m₁ x) p₀=0) (hq₀ : normal (l₂ x) (m₂ x) q₀=0) + (N : ℕ) : + ∃ p q : Polynomial W, p.coeff 0=p₀ ∧ q.coeff 0=q₀ ∧ + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → + ‖complexTrialEnergy l₁ m₁ (s.trial p δ) (s.trial q δ)- + complexTrialEnergy l₂ m₂ (s.trial p δ) (s.trial q δ)‖≤C*δ^N := by + obtain ⟨p,hp,A₁,B₁,hA₁,hB₁,hpB⟩ := s.packet hl₁ hm₁ ha₁ hO hB hx p₀ hp₀ N + obtain ⟨q,hq,A₂,B₂,hA₂,hB₂,hqB⟩ := s.packet hl₂ hm₂ ha₂ hO hB hx q₀ hq₀ N + obtain ⟨C₁,C₂,hC₁,hC₂,hE⟩ := equal_DN_complex_mixed_bound ha₁ ha₂ hO hB hDN + refine ⟨p,q,hp,hq,C₁*B₁*A₂+C₂*A₁*B₂,by positivity,fun δ hδ hδ1 => ?_⟩ + apply (hE _ _).trans + obtain ⟨hpS,hpR⟩ := hpB δ hδ hδ1 + obtain ⟨hqS,hqR⟩ := hqB δ hδ hδ1 + have hRS₂ : 0≤complexResidualSize (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB) (s.trial q δ) := add_nonneg (ContinuousLinearMap.opNorm_nonneg _) (ContinuousLinearMap.opNorm_nonneg _) + have hS₂ : 0≤complexTrialSize (s.trial q δ) := add_nonneg (norm_nonneg _) (norm_nonneg _) + calc + _ ≤ C₁*(B₁*δ^N)*A₂+C₂*A₁*(B₂*δ^N) := add_le_add + (mul_le_mul (mul_le_mul_of_nonneg_left hpR hC₁.le) hqS hS₂ + (mul_nonneg hC₁.le (mul_nonneg hB₁ (pow_nonneg hδ.le _)))) + (mul_le_mul (mul_le_mul_of_nonneg_left hpS hC₂.le) hqR hRS₂ + (mul_nonneg hC₂.le hA₁)) + _ = _ := by ring + +end ElasticityBoundaryPacket + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryEnergy.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..95d18832e65a0a7a98d9e82c6d5fcfd88c074300 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryEnergy.lean @@ -0,0 +1,775 @@ +import OAI.MathematicalPhysics.Elasticity.BoundaryData + +namespace OAI + +noncomputable section + +namespace ElasticityBoundaryTensorPull +/-! Finite sesquilinear tensor change of coordinates. The real change of +variables assumption is explicit and is proved for the actual Jacobian. -/ +open scoped BigOperators + +lemma sum_four_exchange {ι κ σ τ A : Type*} [Fintype ι] [Fintype κ] + [Fintype σ] [Fintype τ] [AddCommMonoid A] (f : ι → κ → σ → τ → A) : + (∑ i, ∑ j, ∑ r, ∑ s, f i j r s)=∑ r, ∑ s, ∑ i, ∑ j, f i j r s := by + calc + _ = ∑ i, ∑ r, ∑ j, ∑ s, f i j r s := by + apply Finset.sum_congr rfl; intro i _; exact Finset.sum_comm + _ = ∑ r, ∑ i, ∑ j, ∑ s, f i j r s := Finset.sum_comm + _ = ∑ r, ∑ i, ∑ s, ∑ j, f i j r s := by + apply Finset.sum_congr rfl; intro r _ + apply Finset.sum_congr rfl; intro i _; exact Finset.sum_comm + _ = _ := by apply Finset.sum_congr rfl; intro r _; exact Finset.sum_comm + +lemma sesqui_pull {ι κ : Type*} [Fintype ι] [Fintype κ] + (a : ι → ι → ℂ) (R : ι → κ → ℂ) (hR : ∀ i j, star (R i j)=R i j) + (u v : κ → ℂ) : + (∑ i, ∑ j, a i j*(∑ r, R i r*u r)*star (∑ s, R j s*v s))= + ∑ r, ∑ s, (∑ i, ∑ j, R i r*a i j*R j s)*u r*star (v s) := by + simp only [star_sum,star_mul,hR,Finset.mul_sum,Finset.sum_mul] + rw [sum_four_exchange,Finset.sum_comm] + apply Finset.sum_congr rfl; intro r _ + apply Finset.sum_congr rfl; intro s _ + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro j _ + ring + +end ElasticityBoundaryTensorPull +namespace Elasticity +/-! The complex physical variational density is exactly the Hermitian +contraction of the literal isotropic elasticity tensor. -/ +open scoped BigOperators +open ElasticityBoundaryLayerOperator +abbrev CMatrix := Fin 3 → Fin 3 → ℂ + +def tensorDensity (a : Fin 3 → Fin 3 → Fin 3 → Fin 3 → ℂ) (P Q : CMatrix) : ℂ := + ∑ i, ∑ α, ∑ j, ∑ β, a i α j β*P i α*star (Q j β) + +def sesquiDensity (l m : ℂ) (P Q : CMatrix) : ℂ := + l*(∑ i, P i i)*star (∑ i, Q i i)+ + (m/2)*∑ i, ∑ j, (P i j+P j i)*star (Q i j+Q j i) + +lemma complexDensity_sesqui (l m : ℝ) (P Q : CMatrix) : + complexDensity l m P Q=sesquiDensity (l:ℂ) (m:ℂ) P Q := by + apply Complex.ext <;> + simp only [complexDensity,realMatrix,elasticDensity,sesquiDensity, + Fin.sum_univ_three,PiLp.toLp_apply,Complex.reCLM_apply,Complex.imCLM_apply, + 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, + Complex.div_ofNat_re,Complex.div_ofNat_im] <;> ring + +lemma tensorDensity_isotropic (l m : ℂ) (P Q : CMatrix) : + tensorDensity (elasticityTensor l m) P Q=sesquiDensity l m P Q := by + unfold tensorDensity elasticityTensor + simp only [add_mul,mul_add,Finset.sum_add_distrib,mul_ite,ite_mul,mul_one,mul_zero, + zero_mul,Finset.sum_ite_irrel,Fintype.sum_ite_eq,Finset.sum_const_zero] + simp only [sesquiDensity,Fin.sum_univ_three,star_add] + ring + +lemma complexDensity_tensor (l m : ℝ) (P Q : CMatrix) : + complexDensity l m P Q=tensorDensity (elasticityTensor (l:ℂ) (m:ℂ)) P Q := by + rw [complexDensity_sesqui,tensorDensity_isotropic] + +end Elasticity +namespace ElasticityBoundaryDensityPull +open Set Filter +open scoped Topology BigOperators + +section +/-! The exact physical elastic density under the honest boundary chart. -/ +open Elasticity ElasticityBoundaryTensorPull ElasticityBoundaryRotation + ElasticityBoundaryGradientTransfer ElasticityBoundaryFrameInverse + ElasticityBoundaryChainRule ElasticityBoundaryChartOperator ElasticityBoundaryPhysicalMass + ElasticityBoundaryPhysicalTransfer ElasticityBoundaryPullback ElasticityBoundaryFrameOperator + ElasticityBoundaryPhysicalStrong ElasticityBoundaryStrongLayer ElasticityBoundaryCompactMatrix + ElasticityBoundaryLayerOperator +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +def pullMatrix (Q J U : I → I → ℂ) (i k : I) : ℂ := + ∑ s, ∑ α, (Q i s*J k α)*U s α + +def pullTensor (Q J : I → I → ℂ) (a : I → I → I → I → ℂ) + (s α r β : I) : ℂ := + ∑ i, ∑ k, ∑ j, ∑ v, (Q i s*J k α)*a i k j v*(Q j r*J v β) + +lemma tensor_pull (Q J : I → I → ℂ) (hQ : ∀ i j, star (Q i j)=Q i j) + (hJ : ∀ i j, star (J i j)=J i j) (a : I → I → I → I → ℂ) (U V : CMatrix) : + tensorDensity a (pullMatrix Q J U) (pullMatrix Q J V)=tensorDensity (pullTensor Q J a) U V := by + have hh := sesqui_pull (fun p q : I×I => a p.1 p.2 q.1 q.2) + (fun p q : I×I => Q p.1 q.1*J p.2 q.2) + (fun p q => by rw [star_mul,hQ,hJ]; ring) (fun p : I×I => U p.1 p.2) (fun p : I×I => V p.1 p.2) + simpa only [Fintype.sum_prod_type,tensorDensity,pullMatrix,pullTensor] using hh + +lemma principal_pullTensor (Q : X ≃ₗᵢ[ℝ] X) (Φ Ψ : X → X) (l m : X → ℂ) + (y : X) (s α r β : I) : + ElasticityBoundaryPhysicalMass.principal Q Φ Ψ l m s α r β y.ofLp= + pullTensor (frameMatrix Q) (fun k a => jacobian Φ Ψ k a y) + (elasticityTensor (l (Φ y)) (m (Φ y))) s α r β := by + unfold ElasticityBoundaryPhysicalMass.principal chartPrincipal principalPull mixedTensor coeff pullTensor + simp only [WithLp.toLp_ofLp,Finset.sum_mul] + rw [sum_four_exchange] + apply Finset.sum_congr rfl; intro i _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl; intro k _ + apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro v _ + simp only [jacobian] + ring + +lemma gradient_pullMatrix (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hηs : tsupport η⊆e.target) + (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ y=e y) (hΨe : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + {y : X} (hy : y∈e.source) : + fieldGradient (transferred e η Q u) (e y)= + pullMatrix (frameMatrix Q) (fun k a => jacobian Φ Ψ k a y) (fun i α => dpart (u i) α y.ofLp) := by + funext i d + have hh := frame_inverse Q (fun j => dd (transferred e η Q u j) (basis d) (e y)) i + simp only [gradient_all e hK hs hηs hη Q u hu hus Φ Ψ hΨ hΦ hΨe hy] at hh + change dd (transferred e η Q u i) (basis d) (e y) = _ + rw [← hh] + simp only [row,pullMatrix,Finset.mul_sum,mul_assoc] + +lemma density_chart (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hηs : tsupport η⊆e.target) + (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u v : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (hv : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (v j)) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (hvs : ∀ j, Function.support (fun z : X => v j z.ofLp)⊆K) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ y=e y) (hΨe : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + (l m : X → ℝ) {y : X} (hy : y∈K) : + complexDensity (l (e y)) (m (e y)) (fieldGradient (transferred e η Q u) (e y)) + (fieldGradient (transferred e η Q v) (e y))= + tensorDensity (fun i α j β => ElasticityBoundaryPhysicalMass.principal Q Φ Ψ + (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y.ofLp) + (fun i α => dpart (u i) α y.ofLp) (fun i α => dpart (v i) α y.ofLp) := by + rw [complexDensity_tensor,gradient_pullMatrix e hK hs hηs hη Q u hu hus Φ Ψ hΨ hΦ hΨe (hs hy), + gradient_pullMatrix e hK hs hηs hη Q v hv hvs Φ Ψ hΨ hΦ hΨe (hs hy)] + have hR (i j : I) : star (frameMatrix Q i j)=frameMatrix Q i j := Complex.conj_ofReal _ + have hJ (i j : I) : star (jacobian Φ Ψ i j y)=jacobian Φ Ψ i j y := Complex.conj_ofReal _ + rw [tensor_pull _ _ hR hJ] + simp only [principal_pullTensor,hΦ y hy] + +end +/-! The exact tensor-density identity extends over the whole honest chart; +all derivatives vanish outside the actual compact packet support. -/ +open Elasticity ElasticityBoundaryGradientTransfer ElasticityBoundaryPhysicalTransfer + ElasticityBoundaryChainRule ElasticityBoundaryChartOperator ElasticityBoundaryPhysicalMass + ElasticityBoundaryStrongLayer ElasticityBoundaryForceSupport + +lemma tensor_zero_left (a : I → I → I → I → ℂ) (V : CMatrix) : + tensorDensity a 0 V=0 := by simp [tensorDensity] + +lemma physical_density_support {K : Set X} (hK : IsClosed K) (l m : X → ℝ) + (u v : I → X → ℂ) (hus : ∀ i, Function.support (u i)⊆K) : + Function.support (fun z => complexDensity (l z) (m z) (fieldGradient u z) (fieldGradient v z))⊆K := by + intro z hz + by_contra hn + have ht : fieldGradient u z=0 := by + funext i d + exact Function.notMem_support.mp (fun h => hn (dd_support hK (hus i) (basis d) h)) + exact hz (by dsimp only; rw [complexDensity_tensor,ht,tensor_zero_left]) + +lemma chart_density_support {K : Set X} (hK : IsClosed K) + (a : X → I → I → I → I → ℂ) (u v : I → Y → ℂ) + (hus : ∀ i, Function.support (fun z : X => u i z.ofLp)⊆K) : + Function.support (fun z : X => tensorDensity (a z) + (fun i α => dpart (u i) α z.ofLp) (fun i α => dpart (v i) α z.ofLp))⊆K := by + intro z hz + by_contra hn + have ht : (fun i α => dpart (u i) α z.ofLp)=(0:CMatrix) := by + funext i d + exact Function.notMem_support.mp (fun h => hn (dpart_support_lifted hK (hus i) d h)) + exact hz (by dsimp only; rw [ht,tensor_zero_left]) + +lemma density_chart_all (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hηs : tsupport η⊆e.target) + (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u v : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (hv : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (v j)) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (hvs : ∀ j, Function.support (fun z : X => v j z.ofLp)⊆K) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ y=e y) (hΨe : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + (l m : X → ℝ) {y : X} (hy : y∈e.source) : + complexDensity (l (e y)) (m (e y)) (fieldGradient (transferred e η Q u) (e y)) + (fieldGradient (transferred e η Q v) (e y))= + tensorDensity (fun i α j β => ElasticityBoundaryPhysicalMass.principal Q Φ Ψ + (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y.ofLp) + (fun i α => dpart (u i) α y.ofLp) (fun i α => dpart (v i) α y.ofLp) := by + by_cases hyK : y∈K + · exact density_chart e hK hs hηs hη Q u v hu hv hus hvs Φ Ψ hΨ hΦ hΨe l m hyK + · have hn : e y∉e '' K := by + rintro ⟨z,hz,he⟩ + exact hyK (e.injOn (hs hz) hy he ▸ hz) + rw [Function.notMem_support.mp (fun h => hn + (physical_density_support (compact_image e hK hs).isClosed l m _ _ + (support_transferred e hηs Q u hus) h)), + Function.notMem_support.mp (fun h => hyK (chart_density_support hK.isClosed + (fun z i α j β => ElasticityBoundaryPhysicalMass.principal Q Φ Ψ + (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β z.ofLp) u v hus h))] + +end ElasticityBoundaryDensityPull +namespace ElasticityBoundaryEnergyChart +/-! Exact complex physical energy change of variables for the actual packets. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (μ : Measure E) [μ.IsAddHaarMeasure] + +/-- A compactly supported physical integrand pulls back with its exact +Jacobian, including the domain's half-space indicator. -/ +theorem compact_chart_integral_complex (e : OpenPartialHomeomorph E E) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + {K Ω H : Set E} (hs : K⊆e.source) (hΩ : MeasurableSet Ω) (hH : MeasurableSet H) + (hhalf : ∀ y∈e.source, e y∈Ω ↔ y∈H) + {Φ : E → E} (hΦ : ∀ y∈K, Φ =ᶠ[𝓝 y] e) + (f g : E → ℂ) (hf : Function.support f⊆e '' K) (hg : Function.support g⊆K) + (hfg : ∀ y∈e.source, f (e y)=g y) : + (∫ x in Ω, f x ∂μ)=(∫ y in H, |(fderiv ℝ Φ y).det| • g y ∂μ) := by + have hd (y : E) (hy : y∈e.source) : HasFDerivAt e (fderiv ℝ e y) y := + ((he.differentiableOn (by simp)).differentiableAt (e.open_source.mem_nhds hy)).hasFDerivAt + rw [← integral_indicator hΩ] + rw [← setIntegral_eq_integral_of_forall_compl_eq_zero (s := e.target) (f := Ω.indicator f) + (fun x hx => by + have hh : f x=0 := by + by_contra hn + obtain ⟨y,hy,rfl⟩ := hf hn + exact hx (e.map_source (hs hy)) + simp only [indicator,hh,ite_self])] + rw [integral_target_eq_integral_abs_det_fderiv_smul μ hd] + have heq : (∫ y in e.source, |(fderiv ℝ e y).det| • Ω.indicator f (e y) ∂μ)= + ∫ y in e.source, H.indicator (fun z => |(fderiv ℝ Φ z).det| • g z) y ∂μ := by + apply setIntegral_congr_fun e.open_source.measurableSet + intro y hy + dsimp only + by_cases hyK : y∈K + · rw [← (hΦ y hyK).fderiv_eq] + by_cases hyH : y∈H + · rw [indicator_of_mem ((hhalf y hy).mpr hyH),indicator_of_mem hyH,hfg y hy] + · rw [indicator_of_notMem (fun h => hyH ((hhalf y hy).mp h)),indicator_of_notMem hyH,smul_zero] + · have hz : g y=0 := Function.notMem_support.mp (fun h => hyK (hg h)) + simp only [indicator, hfg y hy] + simp only [hz,smul_zero,ite_self] + rw [heq] + rw [setIntegral_eq_integral_of_forall_compl_eq_zero] + · exact integral_indicator hH + · intro y hy + have hz : g y=0 := Function.notMem_support.mp (fun h => hy (hs (hg h))) + simp only [indicator,hz,smul_zero,ite_self] + +end ElasticityBoundaryEnergyChart +namespace ElasticityBoundaryPacket +/-! Smooth compact localization of the literal pulled physical energy tensor. +The true chart Jacobian is retained, including its nonzero value at the center. -/ +open Set Filter +open scoped Topology BigOperators +open Elasticity ElasticityBoundary ElasticityBoundaryPhysicalMass + ElasticityBoundaryChartOperator ElasticityBoundaryLayerOperator + +variable {Ω : Set X} {x : X} + +def Setup.jacobian (s : Setup Ω x) (y : Y) : ℝ := + |(fderiv ℝ s.Φ (WithLp.toLp 2 y)).det| + +def Setup.rawCoeff (s : Setup Ω x) (l m : X → ℂ) (i α j β : I) (y : Y) : ℂ := + (s.jacobian y:ℂ)*principal s.Q s.Φ s.Ψ l m i α j β y + +lemma Setup.jacobian_continuous (s : Setup Ω x) : Continuous s.jacobian := + ((ContinuousLinearMap.continuous_det.comp (s.Φ_smooth.continuous_fderiv (by simp))).abs).comp + (PiLp.continuous_toLp 2 (fun _ : I => ℝ)) + +lemma Setup.jacobian_pos (s : Setup Ω x) : 0 (ρ (WithLp.toLp 2 y):ℂ) + have hρcc : HasCompactSupport ρc := + (hρc.comp_homeomorph (PiLp.homeomorph 2 (fun _ : I => ℝ)).symm).comp_left + (g := Complex.ofReal) Complex.ofReal_zero + refine ⟨fun i α j β y => ρc y*s.rawCoeff l m i α j β y,?_,?_,?_⟩ + · intro i α j β + exact (Complex.continuous_ofReal.comp (hρ.continuous.comp + (PiLp.continuous_toLp 2 (fun _ : I => ℝ)))).mul (s.rawCoeff_continuous hl hm i α j β) + · intro i α j β + exact hρcc.mul_right + · intro i α j β y hy + simp only [ρc,hρ1.self_of_nhdsSet _ hy,Complex.ofReal_one,one_mul] + +end ElasticityBoundaryPacket +namespace ElasticityBoundaryLimit +/-! Genuine Gaussian boundary scaling limits for the finite corrected +amplitudes. Dominated convergence is proved from the uniform polynomial +majorants and the actual half-space weight. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryScaling ElasticityBoundaryWeights ElasticityBoundaryOrderBound + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundaryCutoffParametrix + ElasticityBoundaryProfileBounds ElasticityBoundaryCutoffLayer +abbrev Y := Fin 3 → ℝ + +lemma eventually_small_positive : ∀ᶠ δ : ℝ in 𝓝[>] 0, 0<δ ∧ δ≤1 := by + filter_upwards [self_mem_nhdsWithin, + (eventually_lt_nhds (by norm_num : (0:ℝ)<1)).filter_mono nhdsWithin_le_nhds] with δ hδ h1 + exact ⟨hδ,h1.le⟩ + +lemma OrderBound.conj {F : ℝ → Y → ℂ} {k : ℕ} (hF : OrderBound F k) : + OrderBound (fun δ y => star (F δ y)) k := by + obtain ⟨A,hA,n,h⟩ := hF + exact ⟨A,hA,n,fun δ hδ h1 y => by simpa only [norm_star] using h δ hδ h1 y⟩ + +/-- Domination uses the full Gaussian-normal weight, and is uniform for every +small positive scale. No convergence of the physical DN symbol is assumed. -/ +theorem weighted_tendsto {F : ℝ → Y → ℂ} {f : Y → ℂ} + (hF : OrderBound F 0) (hc : ∀ δ, Continuous (F δ)) + (ht : ∀ y, Tendsto (fun δ => F δ y) (𝓝[>] 0) (𝓝 (f y))) + {b : ℝ} (hb : 0 ∫ y, weight b y • F δ y) (𝓝[>] 0) (𝓝 (∫ y, weight b y • f y)) := by + obtain ⟨A,hA,n,hB⟩ := hF + let g : Y → ℝ := fun y => (A*2^n)*(weight b y+‖y‖^n*weight b y) + have hg : Integrable g := ((integrable_weight hb).add (integrable_norm_moment hb n)).const_mul _ + apply tendsto_integral_filter_of_dominated_convergence g + · exact Eventually.of_forall (fun δ => (measurable_weight b).aestronglyMeasurable.smul + (hc δ).aestronglyMeasurable) + · filter_upwards [eventually_small_positive] with δ hδ + exact Eventually.of_forall (fun y => by + rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg (weight_nonneg b y)] + have h := hB δ hδ.1 hδ.2 y + simp only [pow_zero,mul_one] at h + calc + _ ≤ weight b y*(A*(1+‖y‖)^n) := mul_le_mul_of_nonneg_left h (weight_nonneg b y) + _ ≤ weight b y*(A*(2^n*(1+‖y‖^n))) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (one_add_pow_le (norm_nonneg y) n) hA) + (weight_nonneg b y) + _ = g y := by dsimp [g]; ring) + · exact hg + · exact Eventually.of_forall (fun y => tendsto_const_nhds.smul (ht y)) + +lemma continuous_value_parameter (q : Polynomial MP) (y : Y) : + Continuous (fun δ : ℝ => value (atParameter q δ) y) := by + induction q using Polynomial.induction_on' with + | add p q hp hq => + have he : (fun δ : ℝ => value (atParameter (p+q) δ) y)= + (fun δ => value (atParameter p δ) y+value (atParameter q δ) y) := by + funext δ + rw [atParameter_add,value_add] + rw [he] + exact hp.add hq + | monomial n p => + simp_rw [value_parameter_monomial] + exact continuous_const.mul (Complex.continuous_ofReal.pow n) + +lemma value_parameter_zero (q : Polynomial MP) (y : Y) : + value (atParameter q 0) y=value (q.coeff 0) y := by + simp only [atParameter,Complex.ofReal_zero,map_zero,← Polynomial.coeff_zero_eq_eval_zero] + +lemma PD_coeff_zero (q : Polynomial MP) (β : Fin 3) : + (PD β q).coeff 0=E₀ β (q.coeff 0) := by + simp [PD_apply,coeffMap_coeff] + +lemma firstScaled_tendsto {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (h0 : χ 0=1) + (q : Polynomial W) (j β : Fin 3) (y : Y) : + Tendsto (fun δ => firstScaled χ q δ j β y) (𝓝[>] 0) + (𝓝 (value (E₀ β (q.coeff 0 j)) y)) := by + have hχt : Tendsto (fun δ => χ (scale δ y)) (𝓝 (0:ℝ)) (𝓝 1) := by + simpa only [Function.comp_def,h0] using hχ.continuous.continuousAt.tendsto.comp (scale_tendsto_zero y) + have hpt : Tendsto (fun δ => value (atParameter (PD β (unpack j q)) δ) y) + (𝓝 (0:ℝ)) (𝓝 (value (E₀ β (q.coeff 0 j)) y)) := by + simpa only [value_parameter_zero,PD_coeff_zero,unpack,coeffMap_coeff,LinearMap.proj_apply] + using (continuous_value_parameter (PD β (unpack j q)) y).tendsto 0 + have hdt := (smooth_dpart hχ β).continuous.continuousAt.tendsto.comp (scale_tendsto_zero y) + have hqt := (continuous_value_parameter (unpack j q) y).tendsto 0 + have ht := (hχt.mul hpt).add (((Complex.continuous_ofReal.tendsto 0).pow 2).mul hdt |>.mul hqt) + simpa only [Complex.ofReal_zero,zero_pow (by norm_num : 2≠0),zero_mul,one_mul,add_zero,Function.comp_def,firstScaled] + using ht.mono_left nhdsWithin_le_nhds + +lemma amplitude_coeff_zero (p : ℕ → W) (N : ℕ) : (amplitude p N).coeff 0=p 0 := by + simp [amplitude,Polynomial.finsetSum_coeff,Polynomial.coeff_monomial] + +end ElasticityBoundaryLimit +namespace ElasticityBoundaryEnergyLimit +/-! Actual normalized mixed energy limits of the corrected, cut-off boundary +layers. The coefficient has its genuine normal factor and arbitrary compact +smooth remainder; all Jacobian and physical-derivative powers are exact. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryScaling ElasticityBoundaryWeights ElasticityBoundaryOrderBound + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundaryCutoffParametrix ElasticityBoundaryLimit + ElasticityBoundaryProfileBounds ElasticityBoundaryCutoffLayer ElasticityBoundaryProfile + ElasticityBoundaryCutoffBound +abbrev Y := Fin 3 → ℝ + +lemma normal_power_bound (n : ℕ) : OrderBound (fun (_ : ℝ) (y : Y) => (y 2:ℂ)^n) 0 := by + refine ⟨1,by norm_num,n,fun δ _ _ y => ?_⟩ + simp only [pow_zero,mul_one,one_mul,norm_pow,Complex.norm_real] + exact pow_le_pow_left₀ (norm_nonneg _) ((norm_le_pi_norm y 2).trans (by linarith [norm_nonneg y])) n + +def mixedScaled (n : ℕ) (H χ : Y → ℂ) (p q : Polynomial W) + (i α j β : Fin 3) (δ : ℝ) (y : Y) : ℂ := + (y 2:ℂ)^n*H (scale δ y)*firstScaled χ p δ i α y*star (firstScaled χ q δ j β y) + +lemma mixed_scaled_bound (n : ℕ) {H χ : Y → ℂ} (hH : Continuous H) (hcH : HasCompactSupport H) + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) + (p q : Polynomial W) (i α j β : Fin 3) : + OrderBound (mixedScaled n H χ p q i α j β) 0 := by + exact (((normal_power_bound n).mul (compact_scaled hH hcH)).mul + (first_scaled_bound hχ hcχ p i α)).mul (OrderBound.conj (first_scaled_bound hχ hcχ q j β)) + +lemma mixed_scaled_continuous (n : ℕ) {H χ : Y → ℂ} (hH : Continuous H) + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (p q : Polynomial W) (i α j β : Fin 3) (δ : ℝ) : + Continuous (mixedScaled n H χ p q i α j β δ) := + (((Complex.continuous_ofReal.comp (continuous_apply 2)).pow n |>.mul + (hH.comp (scale δ).continuous)).mul (first_scaled_continuous hχ p δ i α)).mul + (first_scaled_continuous hχ q δ j β).star + +/-- The coefficient at the base point is extracted from the exact mixed +boundary energy. Corrections of every positive parameter order disappear. -/ +theorem mixed_scaled_limit (n : ℕ) {H χ : Y → ℂ} (hH : Continuous H) (hcH : HasCompactSupport H) + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) (h0 : χ 0=1) + (p q : Polynomial W) (i α j β : Fin 3) : + Tendsto (fun δ => ∫ y, weight 2 y • mixedScaled n H χ p q i α j β δ y) (𝓝[>] 0) + (𝓝 (∫ y : Y, weight 2 y • ((y 2:ℂ)^n*H 0* + value (E₀ α (p.coeff 0 i)) y*star (value (E₀ β (q.coeff 0 j)) y)))) := by + apply weighted_tendsto (mixed_scaled_bound n hH hcH hχ hcχ p q i α j β) + (mixed_scaled_continuous n hH hχ p q i α j β) _ (by norm_num) + intro y + have hHt : Tendsto (fun δ => H (scale δ y)) (𝓝[>] 0) (𝓝 (H 0)) := + (hH.tendsto 0 |>.comp (scale_tendsto_zero y)).mono_left nhdsWithin_le_nhds + exact ((tendsto_const_nhds.mul hHt).mul (firstScaled_tendsto hχ h0 p i α y)).mul + (firstScaled_tendsto hχ h0 q j β y).star + +end ElasticityBoundaryEnergyLimit +namespace ElasticityBoundaryMixedScaling +/-! Exact physical mixed-energy Jacobian cancellation, followed by the actual +boundary limit. These integrals contain literal Frechet derivatives of the +cut-off corrected fields. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryScaling ElasticityBoundaryWeights ElasticityBoundaryOrderBound + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundaryCutoffParametrix ElasticityBoundaryLimit + ElasticityBoundaryProfileBounds ElasticityBoundaryCutoffLayer ElasticityBoundaryProfile + ElasticityBoundaryCutoffBound ElasticityBoundaryEnergyLimit ElasticityBoundaryStrongLayer +abbrev Y := Fin 3 → ℝ + +lemma envelope_product_weight (δ : ℝ) (g : Y → ℂ) (y : Y) : + halfspace.indicator (fun z => envelope δ z*star (envelope δ z)*g z) y= + weight 2 y • g y := by + have h := profile_square_weight δ (C 1) y + simp only [profile,value_C,mul_one,norm_one,one_pow,one_mul] at h + change halfspace.indicator (fun z => ‖envelope δ z‖^2) y=weight 2 y at h + by_cases hy : y∈halfspace + · rw [indicator_of_mem hy] at h ⊢ + rw [show envelope δ y*star (envelope δ y)=(‖envelope δ y‖:ℂ)^2 from Complex.mul_conj' _] + rw [← Complex.ofReal_pow,h,Complex.real_smul] + · rw [indicator_of_notMem hy] at h ⊢ + rw [← h,zero_smul] + +lemma integral_envelope_mixed (δ : ℝ) (g : Y → ℂ) : + (∫ y in halfspace, envelope δ y*star (envelope δ y)*g y)= + ∫ y, weight 2 y • g y := by + rw [← integral_indicator measurable_halfspace] + exact integral_congr_ae (Eventually.of_forall (envelope_product_weight δ g)) + +def mixedEnergy (n : ℕ) (H χ : Y → ℂ) (p q : Polynomial W) + (i α j β : Fin 3) (δ : ℝ) : ℂ := + ∫ z in halfspace, (z 2:ℂ)^n*H z*dpart (cutoffLayer χ p δ i) α z* + star (dpart (cutoffLayer χ q δ j) β z) + +/-- The factor delta^(2n) comes from the true normal coordinate, while the +volume delta^4 cancels the two true first derivatives delta^-2. -/ +theorem mixedEnergy_scaled (n : ℕ) (H : Y → ℂ) {χ : Y → ℂ} + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (p q : Polynomial W) (i α j β : Fin 3) + {δ : ℝ} (hδ : δ≠0) : + ((δ^(2*n))⁻¹:ℝ) • mixedEnergy n H χ p q i α j β δ= + ∫ y, weight 2 y • mixedScaled n H χ p q i α j β δ y := by + unfold mixedEnergy + rw [integralOn_scale hδ] + have he (y : Y) : + ((scale δ y 2:ℝ):ℂ)^n*H (scale δ y)*dpart (cutoffLayer χ p δ i) α (scale δ y)* + star (dpart (cutoffLayer χ q δ j) β (scale δ y))= + (δ^(2*n)*(δ^4)⁻¹:ℝ) • (envelope δ y*star (envelope δ y)* + mixedScaled n H χ p q i α j β δ y) := by + rw [first_scaled_identity hχ hδ,first_scaled_identity hχ hδ] + simp only [scale_apply,scaleFactor,ite_true,Complex.real_smul,star_mul,Complex.star_def, + Complex.conj_ofReal,mixedScaled] + push_cast + rw [mul_pow,← pow_mul] + have hd : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + field_simp + simp_rw [he] + rw [integral_smul,integral_envelope_mixed,smul_smul,smul_smul] + have hs : ((δ^(2*n))⁻¹*δ^4)*(δ^(2*n)*(δ^4)⁻¹)=1 := by field_simp + rw [hs,one_smul] + +theorem mixedEnergy_limit (n : ℕ) {H χ : Y → ℂ} (hH : Continuous H) (hcH : HasCompactSupport H) + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) (h0 : χ 0=1) + (p q : Polynomial W) (i α j β : Fin 3) : + Tendsto (fun δ => ((δ^(2*n))⁻¹:ℝ) • mixedEnergy n H χ p q i α j β δ) (𝓝[>] 0) + (𝓝 (∫ y : Y, weight 2 y • ((y 2:ℂ)^n*H 0* + value (E₀ α (p.coeff 0 i)) y*star (value (E₀ β (q.coeff 0 j)) y)))) := by + apply (mixed_scaled_limit n hH hcH hχ hcχ h0 p q i α j β).congr' + filter_upwards [eventually_small_positive] with δ hδ + exact (mixedEnergy_scaled n H hχ p q i α j β hδ.1.ne').symm + +end ElasticityBoundaryMixedScaling +namespace ElasticityBoundaryPacket +/-! Exact physical variational packet energy, with its true compact chart +Jacobian, equals the finite mixed coordinate-energy integrals. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open Elasticity ElasticityBoundaryDensityPull ElasticityBoundaryEnergyChart + ElasticityBoundaryPacketMass ElasticityBoundaryPhysicalMass ElasticityBoundaryCutoffLayer + ElasticityBoundaryStrongLayer ElasticityBoundaryMixedScaling ElasticityBoundaryGradientTransfer + ElasticityBoundaryChartOperator ElasticityBoundaryMVNormal ElasticityBoundaryPhysicalTransfer + ElasticityBoundaryCutoffParametrix ElasticityBoundaryActualTower + +variable {Ω : Set X} {x : X} + +lemma Setup.energy_chart (s : Setup Ω x) (hΩ : MeasurableSet Ω) {l m : X → ℝ} + (hl : BoundedCoefficient Ω l) (hm : BoundedCoefficient Ω m) (p q : Polynomial W) (δ : ℝ) : + complexTrialEnergy l m (s.trial p δ) (s.trial q δ)= + ∫ y in ElasticityBoundaryProfileBounds.halfspace, + tensorDensity (fun i α j β => s.rawCoeff (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y) + (fun i α => dpart (cutoffLayer s.cutoff p δ i) α y) + (fun i α => dpart (cutoffLayer s.cutoff q δ i) α y) := by + rw [Setup.trial,Setup.trial,complexFieldTrial_energy hl hm] + have he := compact_chart_integral_complex volume s.e s.smooth s.source hΩ measurable_H s.inside + s.Φ_germ + (fun z => complexDensity (l z) (m z) (fieldGradient (s.field p δ) z) (fieldGradient (s.field q δ) z)) + (fun y : X => tensorDensity (fun i α j β => principal s.Q s.Φ s.Ψ + (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y.ofLp) + (fun i α => dpart (cutoffLayer s.cutoff p δ i) α y.ofLp) + (fun i α => dpart (cutoffLayer s.cutoff q δ i) α y.ofLp)) + (physical_density_support s.image_compact.isClosed l m _ _ (s.field_support p δ)) + (chart_density_support s.compact.isClosed _ _ _ (s.cutoff_layer_support p δ)) + (fun y hy => density_chart_all s.e s.compact s.source s.η_support s.η_one s.Q _ _ + (smooth_cutoffLayer s.cutoff_smooth p δ) (smooth_cutoffLayer s.cutoff_smooth q δ) + (s.cutoff_layer_support p δ) (s.cutoff_layer_support q δ) s.Φ s.Ψ s.Ψ_smooth + (fun z hz => (s.Φ_germ z hz).eq_of_nhds) s.Ψ_germ l m hy) + rw [he] + rw [← integral_ofLp (fun y => tensorDensity (fun i α j β => + s.rawCoeff (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y) + (fun i α => dpart (cutoffLayer s.cutoff p δ i) α y) + (fun i α => dpart (cutoffLayer s.cutoff q δ i) α y))] + apply integral_congr_ae + exact Eventually.of_forall (fun y => by + simp only [tensorDensity,Setup.rawCoeff,Setup.jacobian,WithLp.toLp_ofLp, + Complex.real_smul,Finset.mul_sum] + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro α _ + apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro β _ + ring) + +lemma Setup.energy_compact_tensor (s : Setup Ω x) (hΩ : MeasurableSet Ω) {l m : X → ℝ} + (hl : BoundedCoefficient Ω l) (hm : BoundedCoefficient Ω m) + (H : I → I → I → I → Y → ℂ) + (hH : ∀ i α j β y, WithLp.toLp 2 y∈s.K → H i α j β y= + s.rawCoeff (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y) + (p q : Polynomial W) (δ : ℝ) : + complexTrialEnergy l m (s.trial p δ) (s.trial q δ)= + ∫ y in ElasticityBoundaryProfileBounds.halfspace, + tensorDensity (fun i α j β => H i α j β y) + (fun i α => dpart (cutoffLayer s.cutoff p δ i) α y) + (fun i α => dpart (cutoffLayer s.cutoff q δ i) α y) := by + rw [s.energy_chart hΩ hl hm] + apply integral_congr_ae + apply Eventually.of_forall + intro y + by_cases hy : WithLp.toLp 2 y∈s.K + · simp only [hH _ _ _ _ y hy] + · have hdp (i α : I) : dpart (cutoffLayer s.cutoff p δ i) α y=0 := + Function.notMem_support.mp (fun h => hy + (dpart_support_lifted s.compact.isClosed (s.cutoff_layer_support p δ i) α h)) + simp only [tensorDensity,hdp,mul_zero,zero_mul,Finset.sum_const_zero] + +lemma Setup.energy_sum (s : Setup Ω x) (hΩ : MeasurableSet Ω) {l m : X → ℝ} + (hl : BoundedCoefficient Ω l) (hm : BoundedCoefficient Ω m) + (H : I → I → I → I → Y → ℂ) + (hHc : ∀ i α j β, Continuous (H i α j β)) + (hHs : ∀ i α j β, HasCompactSupport (H i α j β)) + (hH : ∀ i α j β y, WithLp.toLp 2 y∈s.K → H i α j β y= + s.rawCoeff (fun z => (l z:ℂ)) (fun z => (m z:ℂ)) i α j β y) + (p q : Polynomial W) (δ : ℝ) : + complexTrialEnergy l m (s.trial p δ) (s.trial q δ)= + ∑ i, ∑ α, ∑ j, ∑ β, mixedEnergy 0 (H i α j β) s.cutoff p q i α j β δ := by + rw [s.energy_compact_tensor hΩ hl hm H hH] + have hInt (i α j β : I) : Integrable (fun y => H i α j β y* + dpart (cutoffLayer s.cutoff p δ i) α y*star (dpart (cutoffLayer s.cutoff q δ j) β y)) := + (((hHc i α j β).mul (smooth_dpart (smooth_cutoffLayer s.cutoff_smooth p δ i) α).continuous).mul + (smooth_dpart (smooth_cutoffLayer s.cutoff_smooth q δ j) β).continuous.star).integrable_of_hasCompactSupport + ((hHs i α j β).mul_right.mul_right) + simp only [tensorDensity,mixedEnergy,pow_zero,one_mul] + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun α _ => + integrable_finsetSum _ (fun j _ => integrable_finsetSum _ (fun β _ => (hInt i α j β).integrableOn))))] + apply Finset.sum_congr rfl; intro i _ + rw [integral_finsetSum _ (fun α _ => integrable_finsetSum _ (fun j _ => + integrable_finsetSum _ (fun β _ => (hInt i α j β).integrableOn)))] + apply Finset.sum_congr rfl; intro α _ + rw [integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun β _ => (hInt i α j β).integrableOn))] + apply Finset.sum_congr rfl; intro j _ + exact integral_finsetSum _ (fun β _ => (hInt i α j β).integrableOn) + +end ElasticityBoundaryPacket +namespace ElasticityBoundaryPacket +/-! The actual variational energy difference extracts a true normal factor of +the coefficient difference. No equality in a boundary neighborhood is used. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open Elasticity ElasticityBoundaryMixedScaling ElasticityBoundaryMVNormal + ElasticityBoundaryCutoffLayer ElasticityBoundaryStrongLayer ElasticityBoundaryDensityPull + ElasticityBoundaryGradientTransfer ElasticityBoundaryProfileBounds +variable {Ω : Set X} {x : X} + +lemma mixed_integrable (n : ℕ) {H χ : Y → ℂ} (hH : Continuous H) (hcH : HasCompactSupport H) + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (p q : Polynomial W) (i α j β : I) (δ : ℝ) : + Integrable (fun y => (y 2:ℂ)^n*H y*dpart (cutoffLayer χ p δ i) α y* + star (dpart (cutoffLayer χ q δ j) β y)) := + ((((Complex.continuous_ofReal.comp (continuous_apply 2)).pow n |>.mul hH).mul + (smooth_dpart (smooth_cutoffLayer hχ p δ i) α).continuous).mul + (smooth_dpart (smooth_cutoffLayer hχ q δ j) β).continuous.star).integrable_of_hasCompactSupport + (hcH.mul_left.mul_right.mul_right) + +lemma Setup.energy_difference_normal (s : Setup Ω x) (hΩ : MeasurableSet Ω) + {l₁ m₁ l₂ m₂ : X → ℝ} + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (hb₁ : BoundedCoefficient Ω l₁) (hc₁ : BoundedCoefficient Ω m₁) + (hb₂ : BoundedCoefficient Ω l₂) (hc₂ : BoundedCoefficient Ω m₂) + (n : ℕ) (H : I → I → I → I → Y → ℂ) + (hH : ∀ i α j β y, WithLp.toLp 2 y∈s.K → + s.rawCoeff (fun z => (l₁ z:ℂ)) (fun z => (m₁ z:ℂ)) i α j β y- + s.rawCoeff (fun z => (l₂ z:ℂ)) (fun z => (m₂ z:ℂ)) i α j β y=(y 2:ℂ)^n*H i α j β y) + (p q : Polynomial W) (δ : ℝ) : + complexTrialEnergy l₁ m₁ (s.trial p δ) (s.trial q δ)- + complexTrialEnergy l₂ m₂ (s.trial p δ) (s.trial q δ)= + ∑ i, ∑ α, ∑ j, ∑ β, mixedEnergy n (H i α j β) s.cutoff p q i α j β δ := by + obtain ⟨H₁,hH₁,hH₁c,hE₁⟩ := s.compact_energy_coefficients + (Complex.ofRealCLM.contDiff.comp hl₁) (Complex.ofRealCLM.contDiff.comp hm₁) + obtain ⟨H₂,hH₂,hH₂c,hE₂⟩ := s.compact_energy_coefficients + (Complex.ofRealCLM.contDiff.comp hl₂) (Complex.ofRealCLM.contDiff.comp hm₂) + rw [s.energy_sum hΩ hb₁ hc₁ H₁ hH₁ hH₁c hE₁,s.energy_sum hΩ hb₂ hc₂ H₂ hH₂ hH₂c hE₂] + simp only [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl; intro i _ + apply Finset.sum_congr rfl; intro α _ + apply Finset.sum_congr rfl; intro j _ + apply Finset.sum_congr rfl; intro β _ + unfold mixedEnergy + rw [← integral_sub (mixed_integrable 0 (hH₁ i α j β) (hH₁c i α j β) s.cutoff_smooth p q i α j β δ).integrableOn + (mixed_integrable 0 (hH₂ i α j β) (hH₂c i α j β) s.cutoff_smooth p q i α j β δ).integrableOn] + apply integral_congr_ae + apply Eventually.of_forall + intro y + simp only [pow_zero,one_mul,← sub_mul] + by_cases hy : WithLp.toLp 2 y∈s.K + · rw [hE₁ _ _ _ _ y hy,hE₂ _ _ _ _ y hy] + exact congrArg (fun a : ℂ => a*dpart (cutoffLayer s.cutoff p δ i) α y* + star (dpart (cutoffLayer s.cutoff q δ j) β y)) (hH i α j β y hy) + · have hp : dpart (cutoffLayer s.cutoff p δ i) α y=0 := + Function.notMem_support.mp (fun h => hy + (dpart_support_lifted s.compact.isClosed (s.cutoff_layer_support p δ i) α h)) + simp only [hp,mul_zero,zero_mul] + +end ElasticityBoundaryPacket +namespace ElasticityBoundaryPacket +/-! Direct extraction of every factored normal coefficient by the real physical +DN map and the genuine physical localized asymptotic tests. -/ +open Set Filter MeasureTheory +open scoped Topology BigOperators +open Elasticity ElasticityBoundaryMVNormal ElasticityBoundaryMixedScaling + ElasticityBoundaryLimit ElasticityBoundaryMVCalculus ElasticityBoundaryWeights + ElasticityBoundaryTensorSeries ElasticityBoundaryParameter +variable {Ω : Set X} {x : X} + +lemma normalized_tendsto_zero (n : ℕ) {f : ℝ → ℂ} {C : ℝ} + (hf : ∀ δ : ℝ, 0<δ → δ≤1 → ‖f δ‖≤C*δ^(2*n+1)) : + Tendsto (fun δ => ((δ^(2*n))⁻¹:ℝ) • f δ) (𝓝[>] 0) (𝓝 0) := by + apply squeeze_zero_norm' (a := fun δ => C*δ) + · filter_upwards [eventually_small_positive] with δ hδ + rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg (inv_nonneg.mpr (pow_nonneg hδ.1.le _))] + apply (mul_le_mul_of_nonneg_left (hf δ hδ.1 hδ.2) + (inv_nonneg.mpr (pow_nonneg hδ.1.le _))).trans_eq + rw [pow_succ] + field_simp [hδ.1.ne'] + · simpa using (tendsto_const_nhds.mul (tendsto_id.mono_left nhdsWithin_le_nhds) : + Tendsto (fun δ : ℝ => C*δ) (𝓝[>] 0) (𝓝 (C*0))) + +def frozenPair (n : ℕ) (a : I → I → I → I → ℂ) (p q : W) : ℂ := + ∑ i, ∑ α, ∑ j, ∑ β, ∫ y : Y, weight 2 y • ((y 2:ℂ)^n*a i α j β* + value (E₀ α (p i)) y*star (value (E₀ β (q j)) y)) + +/-- Any actual normal factor of the pulled tensor is detected. The hypothesis +is an exact factorization on the packet support, not a boundary agreement +assumption and not an abstract conclusion-carrying jet interface. -/ +lemma Setup.extract_normal (s : Setup Ω x) {l₁ m₁ l₂ m₂ : X → ℝ} + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) (hx : x∈closure Ω) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) + (n : ℕ) (H : I → I → I → I → Y → ℂ) + (hHc : ∀ i α j β, Continuous (H i α j β)) + (hHs : ∀ i α j β, HasCompactSupport (H i α j β)) + (hH : ∀ i α j β y, WithLp.toLp 2 y∈s.K → + s.rawCoeff (fun z => (l₁ z:ℂ)) (fun z => (m₁ z:ℂ)) i α j β y- + s.rawCoeff (fun z => (l₂ z:ℂ)) (fun z => (m₂ z:ℂ)) i α j β y=(y 2:ℂ)^n*H i α j β y) + (p₀ q₀ : W) (hp₀ : normal (l₁ x) (m₁ x) p₀=0) (hq₀ : normal (l₂ x) (m₂ x) q₀=0) : + frozenPair n (fun i α j β => H i α j β 0) p₀ q₀=0 := by + obtain ⟨p,q,hp,hq,C,_hC,hEst⟩ := s.paired_packets hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ + hO hB hx hDN p₀ q₀ hp₀ hq₀ (2*n+1) + have he (δ : ℝ) := s.energy_difference_normal hO.measurableSet hl₁ hm₁ hl₂ hm₂ + (ha₁.1.boundedCoefficient hO hB) (ha₁.2.1.boundedCoefficient hO hB) + (ha₂.1.boundedCoefficient hO hB) (ha₂.2.1.boundedCoefficient hO hB) n H hH p q δ + have ht := normalized_tendsto_zero n hEst + have hlim := tendsto_finsetSum Finset.univ (fun i _ => tendsto_finsetSum Finset.univ + (fun α _ => tendsto_finsetSum Finset.univ (fun j _ => tendsto_finsetSum Finset.univ + (fun β _ => mixedEnergy_limit n (hHc i α j β) (hHs i α j β) s.cutoff_smooth + s.cutoff_compact s.cutoff_one.eq_of_nhds p q i α j β)))) + have ht' : Tendsto (fun δ => ∑ i, ∑ α, ∑ j, ∑ β, + ((δ^(2*n))⁻¹:ℝ) • mixedEnergy n (H i α j β) s.cutoff p q i α j β δ) + (𝓝[>] 0) (𝓝 0) := by + simpa only [he,Finset.smul_sum] using ht + have hEq := tendsto_nhds_unique hlim ht' + simpa only [frozenPair,hp,hq] using hEq + +end ElasticityBoundaryPacket + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryJets.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..035a3a954b15d21e0d0ec325280377ff830679d0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryJets.lean @@ -0,0 +1,677 @@ +import OAI.MathematicalPhysics.Elasticity.CommonExterior +import OAI.MathematicalPhysics.Elasticity.BoundaryValues + +namespace OAI + +section +/-! Projection-stable packet supports are constructed inside honest open charts. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundary ElasticityBoundaryNormalTaylor + ElasticityBoundaryInverseGeometry ElasticityBoundaryGradientTransfer +lemma setup_ball_exists {Ω : Set X} (h : SourceSmoothBoundary Ω) {x : X} (hx : x∈frontier Ω) : + ∃ s : Setup Ω x, ∃ r : ℝ, 0 Metric.ball_subset_closedBall (hχs hz) + obtain ⟨η,Φ,Ψ,hη,hηc,hηs,hη1,hΦ,hΦe,hΨ,hΨe⟩ := compact_chart_data e he hi hK hrs + have hηK : ∀ z∈e '' K, η z=1 := fun z hz => hη1.self_of_nhdsSet hz + have hKη : e '' K⊆tsupport η := by + intro z hz + exact subset_tsupport η (show η z≠0 from by rw [hηK z hz]; exact one_ne_zero) + let χc : Y → ℂ := fun y => (χ (WithLp.toLp 2 y):ℂ) + have hχcs : ContDiff ℝ (⊤ : ℕ∞) χc := + Complex.ofRealCLM.contDiff.comp (hχ.comp PiLp.contDiff_toLp) + have hχcc : HasCompactSupport χc := + (hχc.comp_homeomorph (PiLp.homeomorph 2 (fun _ : I => ℝ)).symm).comp_left + (g := Complex.ofReal) Complex.ofReal_zero + have hχc0 : χc =ᶠ[𝓝 (0:Y)] fun _ => 1 := by + have hh : χ =ᶠ[𝓝 (0:X)] fun _ => 1 := by + change ∀ᶠ z in 𝓝 (0:X), χ z=1 + simpa only [nhdsSet_singleton] using hχ0 + have ht : Tendsto (WithLp.toLp 2 : Y → X) (𝓝 (0:Y)) (𝓝 (0:X)) := + (PiLp.continuous_toLp 2 (fun _ : I => ℝ)).continuousAt + filter_upwards [hh.comp_tendsto ht] with y hy + change χ (WithLp.toLp 2 y)=1 at hy + simp only [χc,hy,Complex.ofReal_one] + refine ⟨{ + e := e, Q := Q, at_zero := he0, center := hec, smooth := he, + inverse_smooth := hi, deriv := hQ, inside := hhalf, K := K, compact := hK, + source := hrs, cutoff := χc, cutoff_smooth := hχcs, cutoff_compact := hχcc, + cutoff_one := hχc0, cutoff_support := ?_, η := η, η_smooth := hη, + η_compact := hηc, η_support := hηs, η_one := hηK, Φ := Φ, Ψ := Ψ, + Φ_smooth := hΦ, Ψ_smooth := hΨ, Φ_germ := ?_, Ψ_germ := ?_ },r,hr,rfl⟩ + · intro z hz + apply hχK + apply subset_tsupport χ + intro hc + exact hz (by simp [χc,hc]) + · intro y hy + exact hΦe.filter_mono (nhds_le_nhdsSet hy) + · intro z hz + exact hΨe.filter_mono (nhds_le_nhdsSet (hKη hz)) + +lemma projection_norm_le (y : Y) : + ‖WithLp.toLp 2 (projection y)‖ ≤ ‖(WithLp.toLp 2 y : X)‖ := by + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [EuclideanSpace.real_norm_sq_eq,projection] + apply Finset.sum_le_sum + intro i _ + by_cases hi : i=2 + · subst i + simp only [Pi.sub_apply,Pi.smul_apply,en,Pi.single_eq_same,smul_eq_mul,mul_one,sub_self,zero_pow (by omega : 2≠0)] + exact sq_nonneg _ + · simp [en,hi] + +lemma projection_mem {r : ℝ} {y : Y} (hy : WithLp.toLp 2 y∈Metric.closedBall (0:X) r) : + WithLp.toLp 2 (projection y)∈Metric.closedBall (0:X) r := by + exact Metric.mem_closedBall.mpr (by + simpa only [dist_zero_right] using (projection_norm_le y).trans (by + simpa only [Metric.mem_closedBall,dist_zero_right] using hy)) + +end ElasticityBoundaryPacket + +end +end +section +/-! Flat finite jets remain flat under arbitrary honest smooth coordinates. +This is a consequence of the actual Faà di Bruno formula. -/ +noncomputable section +namespace ElasticityBoundaryFlatComposition +variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] + +lemma comp_flat {f : F → G} {g : E → F} {x : E} (n : ℕ) + (hf : ContDiffAt ℝ (⊤ : ℕ∞) f (g x)) (hg : ContDiffAt ℝ (⊤ : ℕ∞) g x) + (hz : ∀ k≤n, iteratedFDeriv ℝ k f (g x)=0) : + iteratedFDeriv ℝ n (f ∘ g) x=0 := by + rw [iteratedFDeriv_comp hf hg (by exact_mod_cast le_top)] + unfold FormalMultilinearSeries.taylorComp + apply Finset.sum_eq_zero + intro c _ + ext v + simp only [FormalMultilinearSeries.compAlongOrderedFinpartition_apply, + ftaylorSeries, hz c.length c.length_le,zero_apply] + +end ElasticityBoundaryFlatComposition + +end +end +section +/-! The flattened zero plane consists of actual boundary points; lower +physical jets give actual normal Taylor remainders on a ball packet support. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryNormalTaylor ElasticityBoundaryFlatComposition +variable {Ω : Set X} {x : X} + +lemma Setup.plane_frontier (s : Setup Ω x) (hO : IsOpen Ω) + {y : X} (hy : y∈s.e.source) (hz : y 2=0) : s.e y∈frontier Ω := by + have hn : s.e y∉Ω := by + rw [s.inside y hy,hz] + exact lt_irrefl 0 + have hct : Continuous (fun t : ℝ => y+t • EuclideanSpace.single 2 (1:ℝ)) := + continuous_const.add (continuous_id.smul continuous_const) + have ht : Tendsto (fun t : ℝ => y+t • EuclideanSpace.single 2 (1:ℝ)) (𝓝[>] 0) (𝓝 y) := by + simpa only [zero_smul,add_zero] using hct.continuousAt.tendsto.mono_left + (nhdsWithin_le_nhds : 𝓝[>] (0:ℝ) ≤ 𝓝 0) + have hm : ∀ᶠ t : ℝ in 𝓝[>] 0, s.e (y+t • EuclideanSpace.single 2 (1:ℝ))∈Ω := by + filter_upwards [ht (s.e.open_source.mem_nhds hy),self_mem_nhdsWithin] with t hty htp + rw [s.inside _ hty] + simpa [hz,PiLp.single_apply] using htp + have hc : s.e y∈closure Ω := mem_closure_of_tendsto + (((s.smooth.continuousOn y hy).continuousAt (s.e.open_source.mem_nhds hy)).tendsto.comp ht) hm + rw [hO.frontier_eq] + exact ⟨hc,hn⟩ + +def Setup.chartFunction (s : Setup Ω x) (f : X → ℝ) : Y → ℝ := + fun y => f (s.Φ (WithLp.toLp 2 y)) + +lemma Setup.chartFunction_smooth (s : Setup Ω x) {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) : ContDiff ℝ (⊤ : ℕ∞) (s.chartFunction f) := + hf.comp (s.Φ_smooth.comp PiLp.contDiff_toLp) + +lemma Setup.chart_flat (s : Setup Ω x) (hO : IsOpen Ω) {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + (hz : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k f z=0) + {y : Y} (hy : WithLp.toLp 2 y∈s.K) (hy0 : y 2=0) : + iteratedFDeriv ℝ n (s.chartFunction f) y=0 := by + apply comp_flat n hf.contDiffAt (s.Φ_smooth.comp PiLp.contDiff_toLp).contDiffAt + intro k hk + change iteratedFDeriv ℝ k f (s.Φ (WithLp.toLp 2 y))=0 + rw [(s.Φ_germ _ hy).eq_of_nhds] + exact hz k hk _ (s.plane_frontier hO (s.source hy) hy0) + +lemma Setup.chart_normal_factor (s : Setup Ω x) (hO : IsOpen Ω) {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + (hz : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k f z=0) + {r : ℝ} (hK : s.K=Metric.closedBall 0 r) {y : Y} (hy : WithLp.toLp 2 y∈s.K) : + s.chartFunction f y=(y 2)^(n+1)*quotient n (s.chartFunction f) y := by + apply normal_factor (s.chartFunction_smooth hf) n y + intro k hk + rw [normalJet,s.chart_flat hO hf k (fun j hj => hz j (hj.trans hk))] + · rfl + · rw [hK] at hy ⊢ + exact projection_mem hy + · exact projection_two y + +end ElasticityBoundaryPacket + +end +end +section +/-! Pointwise linearity of the literal pulled energy tensor in the two +scalar Lamé values. Geometric coefficients are not frozen off-center. -/ +noncomputable section +open Set Filter +open scoped BigOperators Topology +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryPhysicalMass ElasticityBoundaryChartOperator + ElasticityBoundaryPullback ElasticityBoundaryFrameOperator ElasticityBoundaryPhysicalStrong + ElasticityBoundaryLayerOperator +variable {Ω : Set X} {x : X} + +lemma elasticityTensor_decomp (l m : ℂ) (i α j β : I) : + elasticityTensor l m i α j β=l*elasticityTensor 1 0 i α j β+ + m*elasticityTensor 0 1 i α j β := by + unfold elasticityTensor + ring + +lemma Setup.rawCoeff_decomp (s : Setup Ω x) (l m : X → ℂ) (i α j β : I) (y : Y) : + s.rawCoeff l m i α j β y= + l (s.Φ (WithLp.toLp 2 y))*s.rawCoeff (fun _ => 1) (fun _ => 0) i α j β y+ + m (s.Φ (WithLp.toLp 2 y))*s.rawCoeff (fun _ => 0) (fun _ => 1) i α j β y := by + unfold Setup.rawCoeff ElasticityBoundaryPhysicalMass.principal chartPrincipal principalPull mixedTensor coeff + simp only [Finset.sum_mul,Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl; intro k _ + apply Finset.sum_congr rfl; intro v _ + apply Finset.sum_congr rfl; intro a _ + apply Finset.sum_congr rfl; intro b _ + rw [elasticityTensor_decomp (l _) (m _)] + ring + +def Setup.linearCoeff (s : Setup Ω x) (l m : Y → ℂ) (i α j β : I) (y : Y) : ℂ := + l y*s.rawCoeff (fun _ => 1) (fun _ => 0) i α j β y+ + m y*s.rawCoeff (fun _ => 0) (fun _ => 1) i α j β y + +lemma Setup.linearCoeff_continuous (s : Setup Ω x) {l m : Y → ℂ} + (hl : Continuous l) (hm : Continuous m) (i α j β : I) : + Continuous (s.linearCoeff l m i α j β) := + (hl.mul (s.rawCoeff_continuous contDiff_const contDiff_const i α j β)).add + (hm.mul (s.rawCoeff_continuous contDiff_const contDiff_const i α j β)) + +lemma Setup.linearCoeff_zero (s : Setup Ω x) (l m : Y → ℂ) (i α j β : I) : + s.linearCoeff l m i α j β 0=(s.jacobian 0:ℂ)*elasticityTensor (l 0) (m 0) i α j β := by + rw [Setup.linearCoeff,s.rawCoeff_zero,s.rawCoeff_zero,elasticityTensor_decomp (l 0) (m 0)] + ring + +lemma Setup.localize_linearCoeff (s : Setup Ω x) {l m : Y → ℂ} + (hl : Continuous l) (hm : Continuous m) : + ∃ H : I → I → I → I → Y → ℂ, + (∀ i α j β, Continuous (H i α j β)) ∧ + (∀ i α j β, HasCompactSupport (H i α j β)) ∧ + (∀ i α j β y, WithLp.toLp 2 y∈s.K → H i α j β y=s.linearCoeff l m i α j β y) := by + obtain ⟨ρ,hρ,hρc,_,hρ1,_⟩ := ElasticityBoundary.compact_smooth_cutoff + s.compact isOpen_univ (subset_univ s.K) + let ρc : Y → ℂ := fun y => (ρ (WithLp.toLp 2 y):ℂ) + have hρcc : HasCompactSupport ρc := + (hρc.comp_homeomorph (PiLp.homeomorph 2 (fun _ : I => ℝ)).symm).comp_left + (g := Complex.ofReal) Complex.ofReal_zero + refine ⟨fun i α j β y => ρc y*s.linearCoeff l m i α j β y,?_,?_,?_⟩ + · intro i α j β + exact (Complex.continuous_ofReal.comp (hρ.continuous.comp + (PiLp.continuous_toLp 2 (fun _ : I => ℝ)))).mul (s.linearCoeff_continuous hl hm i α j β) + · intro i α j β + exact hρcc.mul_right + · intro i α j β y hy + simp only [ρc,hρ1.self_of_nhdsSet _ hy,Complex.ofReal_one,one_mul] + +end ElasticityBoundaryPacket + +end +end +section +/-! Actual normal jet induction step from the physical DN map. The quotient +is the concrete Taylor integral; no pseudodifferential symbol or jet conclusion +is postulated. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryNormalTaylor +variable {Ω : Set X} {x : X} + +lemma Setup.boundary_normal_step (s : Setup Ω x) {l₁ m₁ l₂ m₂ : X → ℝ} + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) (hx : x∈closure Ω) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) + (n : ℕ) (hzl : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k (l₁-l₂) z=0) + (hzm : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k (m₁-m₂) z=0) + {r : ℝ} (hK : s.K=Metric.closedBall 0 r) : + normalJet (n+1) (s.chartFunction (l₁-l₂)) 0=0 ∧ + normalJet (n+1) (s.chartFunction (m₁-m₂)) 0=0 := by + let L := quotient n (s.chartFunction (l₁-l₂)) + let M := quotient n (s.chartFunction (m₁-m₂)) + have hLc : Continuous (fun y => (L y:ℂ)) := Complex.continuous_ofReal.comp + (quotient_continuous (s.chartFunction_smooth (hl₁.sub hl₂)) n) + have hMc : Continuous (fun y => (M y:ℂ)) := Complex.continuous_ofReal.comp + (quotient_continuous (s.chartFunction_smooth (hm₁.sub hm₂)) n) + obtain ⟨H,hHc,hHs,hHe⟩ := s.localize_linearCoeff hLc hMc + have hH (i α j β : I) (y : Y) (hy : WithLp.toLp 2 y∈s.K) : + s.rawCoeff (fun z => (l₁ z:ℂ)) (fun z => (m₁ z:ℂ)) i α j β y- + s.rawCoeff (fun z => (l₂ z:ℂ)) (fun z => (m₂ z:ℂ)) i α j β y=(y 2:ℂ)^(n+1)*H i α j β y := by + rw [hHe i α j β y hy,Setup.linearCoeff, + s.rawCoeff_decomp (fun z => (l₁ z:ℂ)) (fun z => (m₁ z:ℂ)), + s.rawCoeff_decomp (fun z => (l₂ z:ℂ)) (fun z => (m₂ z:ℂ))] + have hl := s.chart_normal_factor hO (hl₁.sub hl₂) n hzl hK hy + have hm := s.chart_normal_factor hO (hm₁.sub hm₂) n hzm hK hy + change l₁ (s.Φ (WithLp.toLp 2 y))-l₂ (s.Φ (WithLp.toLp 2 y))=(y 2)^(n+1)*L y at hl + change m₁ (s.Φ (WithLp.toLp 2 y))-m₂ (s.Φ (WithLp.toLp 2 y))=(y 2)^(n+1)*M y at hm + have hlc : (l₁ (s.Φ (WithLp.toLp 2 y)):ℂ)-(l₂ (s.Φ (WithLp.toLp 2 y)):ℂ)= + (y 2:ℂ)^(n+1)*(L y:ℂ) := by exact_mod_cast hl + have hmc : (m₁ (s.Φ (WithLp.toLp 2 y)):ℂ)-(m₂ (s.Φ (WithLp.toLp 2 y)):ℂ)= + (y 2:ℂ)^(n+1)*(M y:ℂ) := by exact_mod_cast hm + linear_combination hlc*s.rawCoeff (fun _ => 1) (fun _ => 0) i α j β y + + hmc*s.rawCoeff (fun _ => 0) (fun _ => 1) i α j β y + have hH0 : (fun i α j β => H i α j β 0)= + (fun i α j β => (s.jacobian 0:ℂ)*ElasticityBoundaryLayerOperator.elasticityTensor + (L 0) (M 0) i α j β) := by + funext i α j β + rw [hHe i α j β 0 (by simpa using s.zero_mem),s.linearCoeff_zero] + have hpair := pair_separates (n+1) (l₁ x) (m₁ x) (l₂ x) (m₂ x) (s.jacobian 0) + (L 0) (M 0) + (admissible_frozen_ne ha₁ hx).1 (admissible_frozen_ne ha₂ hx).1 + (admissible_frozen_ne ha₁ hx).2 (admissible_frozen_ne ha₂ hx).2 + (Complex.ofReal_ne_zero.mpr s.jacobian_pos.ne') (by + intro p q hp hq + rw [← hH0] + exact s.extract_normal hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hO hB hx hDN (n+1) H hHc hHs hH p q hp hq) + have hL : L 0=0 := Complex.ofReal_eq_zero.mp hpair.1 + have hM : M 0=0 := Complex.ofReal_eq_zero.mp hpair.2 + have hfac : ((n+1).factorial:ℝ)⁻¹≠0 := inv_ne_zero (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero _)) + dsimp only [L] at hL + dsimp only [M] at hM + rw [quotient_zero] at hL hM + exact ⟨(smul_eq_zero.mp hL).resolve_left hfac,(smul_eq_zero.mp hM).resolve_left hfac⟩ + +end ElasticityBoundaryPacket + +end +end +section +/-! Schwarz symmetry at every finite order for real C-infinity functions. +The analytic-only generic-field theorem is not used. -/ +noncomputable section +namespace ElasticityBoundaryJetSymmetry +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +def dir (v : E) (f : E → F) : E → F := fun x => fderiv ℝ f x v + +def word : List E → (E → F) → E → F + | [], f => f + | v::vs, f => dir v (word vs f) + +lemma dir_smooth {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v : E) : + ContDiff ℝ (⊤ : ℕ∞) (dir v f) := + (hf.fderiv_right (by simp)).clm_apply contDiff_const + +lemma word_smooth {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (vs : List E) : + ContDiff ℝ (⊤ : ℕ∞) (word vs f) := by + induction vs with + | nil => exact hf + | cons v vs ih => exact dir_smooth ih v + +lemma dir_comm {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v w : E) : + dir v (dir w f)=dir w (dir v f) := by + funext x + have hd : DifferentiableAt ℝ (fderiv ℝ f) x := + ((hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp)).differentiableAt + have hs := (hf.contDiffAt (x := x)).isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact (WithTop.coe_le_coe.mpr (show (2:ℕ∞)≤⊤ from le_top))) + have he (z : E) : fderiv ℝ (dir z f) x=(fderiv ℝ (fderiv ℝ f) x).flip z := by + unfold dir + rw [fderiv_clm_apply hd (differentiableAt_const z)] + simp + change fderiv ℝ (dir w f) x v=fderiv ℝ (dir v f) x w + rw [he,he] + exact hs v w + +lemma word_perm {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) {vs ws : List E} + (h : vs.Perm ws) : word vs f=word ws f := by + induction h with + | nil => rfl + | cons v h ih => simp only [word,ih] + | swap v w vs => exact dir_comm (word_smooth hf vs) w v + | trans h₁ h₂ ih₁ ih₂ => exact ih₁.trans ih₂ + +lemma word_ofFn {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) (v : Fin n → E) (x : E) : + word (List.ofFn v) f x=iteratedFDeriv ℝ n f x v := by + induction n generalizing x with + | zero => simp [word] + | succ n ih => + rw [List.ofFn_succ] + change fderiv ℝ (word (List.ofFn (fun i => v i.succ)) f) x (v 0)=_ + have he : word (List.ofFn (fun i => v i.succ)) f= + (fun y => iteratedFDeriv ℝ n f y (fun i => v i.succ)) := by + funext y + exact ih _ y + rw [he,fderiv_continuousMultilinear_apply_const + (hf.differentiable_iteratedFDeriv (by exact_mod_cast (WithTop.coe_lt_top n))).differentiableAt] + rfl + +lemma iterated_perm {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + (σ : Equiv.Perm (Fin n)) (v : Fin n → E) (x : E) : + iteratedFDeriv ℝ n f x (fun i => v (σ i))=iteratedFDeriv ℝ n f x v := by + rw [← word_ofFn hf,← word_ofFn hf] + exact congrFun (word_perm hf (σ.ofFn_comp_perm v)) x + +end ElasticityBoundaryJetSymmetry + +end +end +section +/-! Lower full jets vanish on a hypersurface, and the next pure-normal jet +then determines the entire next tensor. No analyticity is used. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryFlatHyperplane +open ElasticityBoundaryJetSymmetry ElasticityBoundaryNormalTaylor +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +lemma tangent_deriv_zero {g : Y → F} (hg : DifferentiableAt ℝ g 0) + {r : ℝ} (hr : 0 t • v) := continuous_id.smul continuous_const + have ht : Tendsto (fun t : ℝ => t • v) (𝓝 0) (𝓝 (0:Y)) := by + simpa only [zero_smul] using hc.continuousAt.tendsto (x := (0:ℝ)) + have he : (fun t : ℝ => g (t • v)) =ᶠ[𝓝 0] fun _ => 0 := by + filter_upwards [ht (Metric.isOpen_ball.mem_nhds (Metric.mem_ball_self hr))] with t ht + exact hz _ ht (by simp [hv]) + have hd := (show DifferentiableAt ℝ g ((0:Y)+(0:ℝ) • v) by simpa using hg).deriv_comp_add_smul + simp only [zero_add,zero_smul] at hd + rw [← hd,he.deriv_eq,deriv_const] + +lemma flat_step {f : Y → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + {r : ℝ} (hr : 0 ∑ i : Fin 3, u k i • Pi.single i (1:ℝ)) := by + funext k i + simp [Pi.single_apply] + rw [he] + change (iteratedFDeriv ℝ (n+1) f 0).toMultilinearMap (fun k => ∑ i : Fin 3, u k i • Pi.single i (1:ℝ))=0 + rw [MultilinearMap.map_sum] + apply Finset.sum_eq_zero + intro j _ + rw [MultilinearMap.map_smul_univ] + suffices (iteratedFDeriv ℝ (n+1) f 0) (fun k => Pi.single (j k) (1:ℝ))=0 by + change (∏ i, u i (j i)) • (iteratedFDeriv ℝ (n+1) f 0) (fun i => Pi.single (j i) (1:ℝ))=0 + rw [this,smul_zero] + by_cases h : ∀ k, j k=2 + · simpa only [h,en,normalJet] using hn + · push Not at h + obtain ⟨k,hk⟩ := h + exact hany _ k (by simp [Ne.symm hk]) + +end ElasticityBoundaryFlatHyperplane + +end +end +section +/-! Full jet flatness in honest boundary coordinates and back in the fixed +physical Euclidean coordinates. No jet transformation is assumed. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryNormalTaylor ElasticityBoundaryFlatComposition + ElasticityBoundaryFlatHyperplane +variable {Ω : Set X} {x : X} + +lemma Setup.chart_full_step (s : Setup Ω x) (hO : IsOpen Ω) {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + (hz : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k f z=0) + {r : ℝ} (hr : 0 ℝ)).continuousAt + obtain ⟨ε,hε,hE⟩ := Metric.mem_nhds_iff.mp + (ht (Metric.isOpen_ball.mem_nhds (Metric.mem_ball_self hr))) + apply flat_step (s.chartFunction_smooth hf) n hε _ hn + intro y hy hy0 + exact s.chart_flat hO hf n hz (by rw [hK]; exact Metric.ball_subset_closedBall (hE hy)) hy0 + +lemma Setup.Ψ_zero (s : Setup Ω x) : s.Ψ x=0 := by + have hx : x∈s.e '' s.K := ⟨0,s.zero_mem,s.center⟩ + exact (s.Ψ_germ x hx).eq_of_nhds.trans + ((congrArg s.e.symm s.center).symm.trans (s.e.left_inv s.at_zero)) + +lemma Setup.inverse_germ (s : Setup Ω x) : + (fun z => s.Φ (s.Ψ z)) =ᶠ[𝓝 x] fun z => z := by + have hx : x∈s.e '' s.K := ⟨0,s.zero_mem,s.center⟩ + have ht : Tendsto s.Ψ (𝓝 x) (𝓝 (0:X)) := by + simpa only [s.Ψ_zero] using s.Ψ_smooth.continuous.continuousAt.tendsto (x := x) + have hxt : x∈s.e.target := by simpa only [s.center] using s.e.map_source s.at_zero + filter_upwards [(s.Φ_germ 0 s.zero_mem).comp_tendsto ht,s.Ψ_germ x hx, + s.e.open_target.mem_nhds hxt] with z hΦ hΨ hz + change s.Φ (s.Ψ z)=s.e (s.Ψ z) at hΦ + rw [hΦ,hΨ,s.e.right_inv hz] + +lemma Setup.physical_flat_of_chart (s : Setup Ω x) {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) + (hz : ∀ k≤n, iteratedFDeriv ℝ k (s.chartFunction f) 0=0) : + iteratedFDeriv ℝ n f x=0 := by + let g : X → Y := fun z => (s.Ψ z).ofLp + have hg : ContDiff ℝ (⊤ : ℕ∞) g := PiLp.contDiff_ofLp.comp s.Ψ_smooth + have hg0 : g x=0 := by simp only [g,s.Ψ_zero,WithLp.ofLp_zero] + have hcomp : iteratedFDeriv ℝ n (s.chartFunction f ∘ g) x=0 := by + apply comp_flat n (s.chartFunction_smooth hf).contDiffAt hg.contDiffAt + intro k hk + rw [hg0] + exact hz k hk + have he : (s.chartFunction f ∘ g) =ᶠ[𝓝 x] f := by + filter_upwards [s.inverse_germ] with z hz + change f (s.Φ (s.Ψ z))=f z + rw [hz] + rw [← (he.iteratedFDeriv ℝ n).eq_of_nhds] + exact hcomp + +end ElasticityBoundaryPacket + +end +end +section +/-! All actual Frechet boundary jets from the physical DN map. Induction is +global along the boundary, so tangential derivatives of lower jets are zero; +only the pure normal step uses oscillatory solutions. -/ +noncomputable section +open Set +open scoped Topology +namespace ElasticityBoundaryPacket +open Elasticity +variable {Ω : Set X} + +lemma boundary_flat_difference_global {l₁ m₁ l₂ m₂ : X → ℝ} + (hS : SourceSmoothBoundary Ω) (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + ∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n (l₁-l₂) x=0 ∧ + iteratedFDeriv ℝ n (m₁-m₂) x=0 := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + cases n with + | zero => + intro x hx + have hv := boundary_values_global hS hO hB hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hDN hx + constructor + · ext v + simp only [iteratedFDeriv_zero_apply,Pi.sub_apply,hv.1,sub_self,zero_apply] + · ext v + simp only [iteratedFDeriv_zero_apply,Pi.sub_apply,hv.2,sub_self,zero_apply] + | succ n => + intro x hx + obtain ⟨s,r,hr,hK⟩ := setup_ball_exists hS hx + have hzl : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k (l₁-l₂) z=0 := + fun k hk z hz => (ih k (Nat.lt_succ_of_le hk) z hz).1 + have hzm : ∀ k≤n, ∀ z∈frontier Ω, iteratedFDeriv ℝ k (m₁-m₂) z=0 := + fun k hk z hz => (ih k (Nat.lt_succ_of_le hk) z hz).2 + have hn := s.boundary_normal_step hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hO hB + (frontier_subset_closure hx) hDN n hzl hzm hK + have hlf := s.chart_full_step hO (hl₁.sub hl₂) n hzl hr hK hn.1 + have hmf := s.chart_full_step hO (hm₁.sub hm₂) n hzm hr hK hn.2 + constructor + · apply s.physical_flat_of_chart (hl₁.sub hl₂) (n+1) + intro k hk + obtain hk|hk := lt_or_eq_of_le hk + · exact s.chart_flat hO (hl₁.sub hl₂) k + (fun j hj => hzl j (hj.trans (Nat.le_of_lt_succ hk))) + (by simpa using s.zero_mem) rfl + · subst k + exact hlf + · apply s.physical_flat_of_chart (hm₁.sub hm₂) (n+1) + intro k hk + obtain hk|hk := lt_or_eq_of_le hk + · exact s.chart_flat hO (hm₁.sub hm₂) k + (fun j hj => hzm j (hj.trans (Nat.le_of_lt_succ hk))) + (by simpa using s.zero_mem) rfl + · subst k + exact hmf + +lemma boundary_jets_global {l₁ m₁ l₂ m₂ : X → ℝ} + (hS : SourceSmoothBoundary Ω) (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + (∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n l₂ x=iteratedFDeriv ℝ n l₁ x) ∧ + (∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n m₂ x=iteratedFDeriv ℝ n m₁ x) := by + have h := boundary_flat_difference_global hS hO hB hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hDN + constructor + · intro n x hx + have hz := (h n x hx).1 + rw [iteratedFDeriv_sub (hl₁.of_le (by exact_mod_cast le_top)) + (hl₂.of_le (by exact_mod_cast le_top))] at hz + exact (sub_eq_zero.mp hz).symm + · intro n x hx + have hz := (h n x hx).2 + rw [iteratedFDeriv_sub (hm₁.of_le (by exact_mod_cast le_top)) + (hm₂.of_le (by exact_mod_cast le_top))] at hz + exact (sub_eq_zero.mp hz).symm + +end ElasticityBoundaryPacket + +end +end +section +/- The exact physical DN localization proofs are reused, not duplicated. -/ + +end +section +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundary +variable {Ω : Set X} + +lemma admissible_boundary_values (hD : SourceDomain Ω) (l₁ m₁ l₂ m₂ : X → ℝ) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + ∀ x∈frontier Ω, l₁ x=l₂ x ∧ m₁ x=m₂ x := by + obtain ⟨U₁,hU₁,hs₁,hl₁,hm₁⟩ := ha₁.common_neighborhood + obtain ⟨U₂,hU₂,hs₂,hl₂,hm₂⟩ := ha₂.common_neighborhood + obtain ⟨L₁,M₁,hL₁,hM₁,heL₁,heM₁,hp₁,_,_⟩ := + admissible_global_extension hD.2.2.1.isCompact_closure hU₁ hs₁ l₁ m₁ hl₁ hm₁ ha₁.2.2 + obtain ⟨L₂,M₂,hL₂,hM₂,heL₂,heM₂,hp₂,_,_⟩ := + admissible_global_extension hD.2.2.1.isCompact_closure hU₂ hs₂ l₂ m₂ hl₂ hm₂ ha₂.2.2 + have hd : DN Ω L₁ M₁=DN Ω L₂ M₂ := + (DN_coeff_congr hD.1.measurableSet + (fun x hx => heL₁.self_of_nhdsSet (subset_closure hx)) + (fun x hx => heM₁.self_of_nhdsSet (subset_closure hx))).trans + (hDN.trans (DN_coeff_congr hD.1.measurableSet + (fun x hx => heL₂.self_of_nhdsSet (subset_closure hx)) + (fun x hx => heM₂.self_of_nhdsSet (subset_closure hx))).symm) + intro x hx + have hc := frontier_subset_closure hx + have h := boundary_values_global hD.2.2.2 hD.1 hD.2.2.1 hL₁ hM₁ hL₂ hM₂ + (admissible_of_global hL₁ hM₁ hp₁) (admissible_of_global hL₂ hM₂ hp₂) hd hx + simpa only [heL₁.self_of_nhdsSet hc,heM₁.self_of_nhdsSet hc, + heL₂.self_of_nhdsSet hc,heM₂.self_of_nhdsSet hc] using h + +end ElasticityBoundaryPacket + +end +end +section +/-! Smooth-on-closure all-jet determination from the actual real physical DN +map, for every bounded connected domain with honest C-infinity boundary. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundary +variable {Ω : Set X} + +theorem admissible_boundary_jets (hD : SourceDomain Ω) (l₁ m₁ l₂ m₂ : X → ℝ) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + (∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n l₂ x=iteratedFDeriv ℝ n l₁ x) ∧ + (∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n m₂ x=iteratedFDeriv ℝ n m₁ x) := by + obtain ⟨U₁,hU₁,hs₁,hl₁,hm₁⟩ := ha₁.common_neighborhood + obtain ⟨U₂,hU₂,hs₂,hl₂,hm₂⟩ := ha₂.common_neighborhood + obtain ⟨L₁,M₁,hL₁,hM₁,heL₁,heM₁,hp₁,_,_⟩ := + admissible_global_extension hD.2.2.1.isCompact_closure hU₁ hs₁ l₁ m₁ hl₁ hm₁ ha₁.2.2 + obtain ⟨L₂,M₂,hL₂,hM₂,heL₂,heM₂,hp₂,_,_⟩ := + admissible_global_extension hD.2.2.1.isCompact_closure hU₂ hs₂ l₂ m₂ hl₂ hm₂ ha₂.2.2 + have hd : DN Ω L₁ M₁=DN Ω L₂ M₂ := + (DN_coeff_congr hD.1.measurableSet + (fun x hx => heL₁.self_of_nhdsSet (subset_closure hx)) + (fun x hx => heM₁.self_of_nhdsSet (subset_closure hx))).trans + (hDN.trans (DN_coeff_congr hD.1.measurableSet + (fun x hx => heL₂.self_of_nhdsSet (subset_closure hx)) + (fun x hx => heM₂.self_of_nhdsSet (subset_closure hx))).symm) + have h := boundary_jets_global hD.2.2.2 hD.1 hD.2.2.1 hL₁ hM₁ hL₂ hM₂ + (admissible_of_global hL₁ hM₁ hp₁) (admissible_of_global hL₂ hM₂ hp₂) hd + have je {f g : X → ℝ} (he : f =ᶠ[𝓝ˢ (closure Ω)] g) (n : ℕ) (x : X) (hx : x∈frontier Ω) : + iteratedFDeriv ℝ n f x=iteratedFDeriv ℝ n g x := + ((he.filter_mono (nhds_le_nhdsSet (frontier_subset_closure hx))).iteratedFDeriv ℝ n).eq_of_nhds + constructor + · intro n x hx + simpa only [je heL₁ n x hx,je heL₂ n x hx] using h.1 n x hx + · intro n x hx + simpa only [je heM₁ n x hx,je heM₂ n x hx] using h.2 n x hx + +end ElasticityBoundaryPacket + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryLayers.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryLayers.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f8e47a6872390040139c26938de9a348e3ba575 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryLayers.lean @@ -0,0 +1,1266 @@ +import OAI.MathematicalPhysics.Elasticity.BoundarySymbols + +namespace OAI + +section +/-! Uniform multivariable Taylor estimates for anisotropically rescaled boundary +layers. The constants are proved for actual smooth compactly supported physical +coefficient extensions; no symbol/asymptotic identification is assumed. -/ +noncomputable section +open Set +open scoped BigOperators +namespace ElasticityBoundaryTaylor +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +def line (z : E) : ℝ →L[ℝ] E := (ContinuousLinearMap.id ℝ ℝ).smulRight z + +@[simp] lemma line_apply (z : E) (t : ℝ) : line z t = t • z := rfl + +lemma iteratedDeriv_line {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (k : ℕ) (z : E) (t : ℝ) : + iteratedDeriv k (fun t : ℝ => f (t • z)) t = + iteratedFDeriv ℝ k f (t • z) (fun _ => z) := by + rw [iteratedDeriv_eq_iteratedFDeriv] + change iteratedFDeriv ℝ k (f ∘ line z) t (fun _ => 1) = _ + rw [(line z).iteratedFDeriv_comp_right hf t (mod_cast le_top), + ContinuousMultilinearMap.compContinuousLinearMap_apply] + simp only [line_apply, one_smul] + +def radialTaylor (f : E → F) (n : ℕ) (z : E) : F := + ∑ k ∈ Finset.range (n+1), (k.factorial : ℝ)⁻¹ • + iteratedFDeriv ℝ k f 0 (fun _ => z) + +lemma radialTaylor_eq_line {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (n : ℕ) (z : E) : + radialTaylor f n z = taylorWithinEval (fun t : ℝ => f (t • z)) n (Icc 0 1) 0 1 := by + rw [taylor_within_apply] + apply Finset.sum_congr rfl + intro k hk + have hg : ContDiff ℝ (⊤ : ℕ∞) (fun t : ℝ => f (t • z)) := + hf.comp (contDiff_id.smul contDiff_const) + rw [iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_Icc (by norm_num)) + (hg.of_le (mod_cast le_top)).contDiffAt (by simp), iteratedDeriv_line hf] + simp + +lemma radialTaylor_remainder {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (n : ℕ) {C : ℝ} (hC : ∀ x, ‖iteratedFDeriv ℝ (n+1) f x‖ ≤ C) (z : E) : + ‖f z - radialTaylor f n z‖ ≤ C * ‖z‖^(n+1) / (n.factorial : ℝ) := by + have hg : ContDiff ℝ (⊤ : ℕ∞) (fun t : ℝ => f (t • z)) := + hf.comp (contDiff_id.smul contDiff_const) + have hbound (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : + ‖iteratedDerivWithin (n+1) (fun t : ℝ => f (t • z)) (Icc 0 1) t‖ ≤ + C * ‖z‖^(n+1) := by + rw [iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_Icc (by norm_num)) + (hg.of_le (mod_cast le_top)).contDiffAt ht, iteratedDeriv_line hf] + exact (ContinuousMultilinearMap.le_opNorm _ _).trans (by + simpa using mul_le_mul_of_nonneg_right (hC (t • z)) (pow_nonneg (norm_nonneg z) (n+1))) + have h := taylor_mean_remainder_bound (f := fun t : ℝ => f (t • z)) + (a := 0) (b := 1) (n := n) (x := 1) (by norm_num) + (hg.of_le (mod_cast le_top)).contDiffOn (by simp) hbound + simpa only [radialTaylor_eq_line hf, one_smul, sub_zero, one_pow, mul_one] using h + +lemma compact_iteratedFDeriv_bound {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hc : HasCompactSupport f) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C := by + obtain ⟨C, hC⟩ := ((hf.of_le (show (n : WithTop ℕ∞) ≤ (⊤ : ℕ∞) from by + exact_mod_cast le_top)).continuous_iteratedFDeriv').bounded_above_of_compact_support + (hc.iteratedFDeriv n) + exact ⟨max C 0, le_max_right _ _, fun x => (hC x).trans (le_max_left _ _)⟩ + +/-- Every smooth compactly supported coefficient has a global polynomially +weighted Taylor remainder estimate, at every finite order. -/ +theorem compact_radialTaylor_remainder {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hc : HasCompactSupport f) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ z, + ‖f z - radialTaylor f n z‖ ≤ C * ‖z‖^(n+1) := by + obtain ⟨C, hC, hbound⟩ := compact_iteratedFDeriv_bound hf hc (n+1) + refine ⟨C/(n.factorial : ℝ), div_nonneg hC (Nat.cast_nonneg _), fun z => ?_⟩ + simpa only [div_mul_eq_mul_div] using radialTaylor_remainder hf n hbound z + +end ElasticityBoundaryTaylor + +end +end +section +/-! Literal polynomial representations of the actual Frechet Taylor jets and +of their anisotropic parameter dependence. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryTaylorPolynomial +open MvPolynomial ElasticityBoundaryTaylor ElasticityBoundaryMVCalculus ElasticityBoundaryScaling +abbrev Y := Fin 3 → ℝ + +/-- The diagonal of a real multilinear map, expanded in the fixed coordinates. -/ +def diagonal {n : ℕ} (T : ContinuousMultilinearMap ℝ (fun _ : Fin n => Y) ℂ) : MP := + ∑ j : Fin n → Fin 3, C (T (fun k => Pi.single (j k) 1)) * ∏ k, X (j k) + +lemma value_diagonal {n : ℕ} (T : ContinuousMultilinearMap ℝ (fun _ : Fin n => Y) ℂ) + (y : Y) : value (diagonal T) y = T (fun _ => y) := by + classical + have hy : (fun _ : Fin n => y) = (fun _ : Fin n => ∑ i : Fin 3, y i • Pi.single i (1:ℝ)) := by + funext k i + simp [Pi.single_apply] + rw [hy] + change _ = T.toMultilinearMap (fun _ => ∑ i : Fin 3, y i • Pi.single i (1:ℝ)) + rw [T.toMultilinearMap.map_sum] + simp only [diagonal, value, eval_sum, eval_mul, eval_C, eval_prod, eval_X] + apply Finset.sum_congr rfl + intro j _ + rw [T.toMultilinearMap.map_smul_univ] + simp only [Complex.real_smul, Complex.ofReal_prod] + change T (fun k => Pi.single (j k) 1) * _ = _ * T (fun k => Pi.single (j k) 1) + exact mul_comm _ _ + +def taylor (f : Y → ℂ) (n : ℕ) : MP := + ∑ k ∈ Finset.range (n+1), ((k.factorial : ℂ)⁻¹) • diagonal (iteratedFDeriv ℝ k f 0) + +lemma value_taylor (f : Y → ℂ) (n : ℕ) (y : Y) : + value (taylor f n) y = radialTaylor f n y := by + simp only [taylor, value, eval_sum, radialTaylor] + apply Finset.sum_congr rfl + intro k _ + change value (((k.factorial : ℂ)⁻¹) • diagonal (iteratedFDeriv ℝ k f 0)) y = _ + rw [value_smul, value_diagonal] + simp [Complex.real_smul] + +def weightOrder (i : Fin 3) : ℕ := if i=2 then 2 else 1 + +def parameterize : MP →ₐ[ℂ] Polynomial MP := + MvPolynomial.aeval (fun i => Polynomial.C (X i) * Polynomial.X^(weightOrder i)) + +lemma eval_parameterize (p : MP) (δ : ℝ) : + (parameterize p).eval (C (δ:ℂ)) = + MvPolynomial.aeval (fun i => C ((scaleFactor δ i : ℝ):ℂ)*X i) p := by + induction p using MvPolynomial.induction_on with + | C c => simp [parameterize] + | add p q hp hq => simp only [map_add, Polynomial.eval_add, hp, hq] + | mul_X p i hp => + simp only [map_mul, Polynomial.eval_mul, hp] + congr 1 + simp only [parameterize, aeval_X, Polynomial.eval_mul, Polynomial.eval_C, + Polynomial.eval_pow, Polynomial.eval_X] + unfold weightOrder scaleFactor + split_ifs <;> simp only [Complex.ofReal_pow, map_pow, pow_one] <;> ring + +lemma value_parameterize (p : MP) (δ : ℝ) (y : Y) : + value ((parameterize p).eval (C (δ:ℂ))) y = value p (scale δ y) := by + rw [eval_parameterize] + induction p using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add, value_add, hp, hq] + | mul_X p i hp => + rw [map_mul, aeval_X, value_mul, hp, value_mul, value_C, value_X, value_mul, value_X] + simp only [scale_apply, Complex.ofReal_mul] + +lemma value_parameterized_taylor (f : Y → ℂ) (n : ℕ) (δ : ℝ) (y : Y) : + value ((parameterize (taylor f n)).eval (C (δ:ℂ))) y = + radialTaylor f n (scale δ y) := by rw [value_parameterize, value_taylor] + +end ElasticityBoundaryTaylorPolynomial + +end +end +section +/-! Corrected amplitudes for the literal Taylor tensor differential operator. +The operator coefficients are computed, rather than a formal sequence assumed. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryActualTower +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryTensorSeries ElasticityBoundaryMVTower ElasticityBoundaryTaylorPolynomial + +lemma operator_monomial (a : Tensor) (b : Lower) (n : ℕ) (p : W) : + operator a b (Polynomial.monomial n p)= + Polynomial.X^n*operator a b (Polynomial.C p) := by + have h : Polynomial.monomial n p = Polynomial.monomial n 1*Polynomial.C p := by + rw [Polynomial.monomial_mul_C, one_mul] + rw [h, operator_monomial_mul, Polynomial.monomial_one_right_eq_X_pow] + +def amplitude (p : ℕ → W) (N : ℕ) : Polynomial W := + ∑ n ∈ Finset.range (N+1), Polynomial.monomial n (p n) + +lemma coefficient_operator_amplitude (a : Tensor) (b : Lower) (p : ℕ → W) + {N d : ℕ} (hd : d≤N) : + (operator a b (amplitude p N)).coeff d = + ∑ k ∈ Finset.range (d+1), coefficient a b k (p (d-k)) := by + simp only [amplitude, map_sum, operator_monomial, Polynomial.finsetSum_coeff, + Polynomial.coeff_X_pow_mul', ← coefficient_apply] + have hsub : (∑ n ∈ Finset.range (N+1), if n≤d then coefficient a b (d-n) (p n) else 0) = + ∑ n ∈ Finset.range (d+1), coefficient a b (d-n) (p n) := by + rw [← Finset.sum_subset (Finset.range_mono (show d+1≤N+1 by omega)) + (f := fun n => if n≤d then coefficient a b (d-n) (p n) else 0)] + · apply Finset.sum_congr rfl + intro n hn + rw [ite_eq_left (by simp only [Finset.mem_range] at hn; omega)] + · intro n _ hn + rw [ite_eq_right (by simp only [Finset.mem_range] at hn; omega)] + rw [hsub, ← Finset.sum_range_reflect] + apply Finset.sum_congr rfl + intro k hk + simp only [Finset.mem_range] at hk + congr 2 + omega + +/-- A true finite polynomial family cancels the literal tensor operator to +any requested order. This is not an assumption about an unknown symbol. -/ +theorem finite_tensor_amplitude (a : Tensor) (b : Lower) (l m : ℂ) + (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (ha : ∀ i α j β, (a i α j β).coeff 0=C (ElasticityBoundaryLayerOperator.elasticityTensor l m i α j β)) + (p₀ : W) (h₀ : normal l m p₀=0) (N : ℕ) : + ∃ (p : ℕ → W) (R : Polynomial W), p 0=p₀ ∧ + (∀ n, 0 simp [parameterize] + | add p q hp hq => simp only [map_add, Polynomial.eval_add, hp, hq, value_add] + | mul_X p i hp => + have hw : weightOrder i≠0 := by unfold weightOrder; split_ifs <;> decide + simp only [map_mul, Polynomial.eval_mul, parameterize, aeval_X, + Polynomial.eval_C, Polynomial.eval_pow, Polynomial.eval_X, zero_pow hw, + mul_zero, value_mul, value_X, Pi.zero_apply, Complex.ofReal_zero, map_zero] + +lemma taylor_coeff_zero {f : (Fin 3 → ℝ) → ℂ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hc : HasCompactSupport f) (N : ℕ) : + (parameterize (taylor f N)).coeff 0=C (f 0) := by + rw [parameterize_coeff_zero, value_taylor] + obtain ⟨A,_,hA⟩ := ElasticityBoundaryTaylor.compact_radialTaylor_remainder hf hc N + have hz : f 0-ElasticityBoundaryTaylor.radialTaylor f N 0=0 := by + apply norm_eq_zero.mp + exact le_antisymm (by simpa using hA 0) (norm_nonneg _) + rw [(sub_eq_zero.mp hz).symm] + +end ElasticityBoundaryActualTower + +end +end +section +/-! Honest L2 bounds and exact change of variables for physical boundary layers. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryProfileBounds +open ElasticityBoundaryMVCalculus ElasticityBoundaryScaling ElasticityBoundaryWeights + ElasticityBoundaryProfile +abbrev Y := Fin 3 → ℝ + +def halfspace : Set Y := {y | 0 ?_⟩ + calc + _ ≤ (A*(1+‖y‖)^n)^2 := pow_le_pow_left₀ (norm_nonneg _) (h y) 2 + _ = A^2*(1+‖y‖)^(2*n) := by rw [mul_pow, ← pow_mul]; ring + _ ≤ A^2*(2^(2*n)*(1+‖y‖^(2*n))) := + mul_le_mul_of_nonneg_left (one_add_pow_le (norm_nonneg y) _) (sq_nonneg A) + _ = _ := by ring + +lemma integrable_polynomial_square_weight (p : MP) {b : ℝ} (hb : 0 ‖value p y‖^2*weight b y) := by + obtain ⟨C,hC,n,h⟩ := polynomial_square_bound p + have hI := ((integrable_weight hb).add (integrable_norm_moment hb n)).const_mul C + apply hI.mono' (((smooth_value p).continuous.norm.pow 2).measurable.mul + (measurable_weight b)).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun y => by + change |‖value p y‖^2 * weight b y| ≤ C * (weight b y + ‖y‖^n * weight b y) + rw [abs_of_nonneg (mul_nonneg (sq_nonneg _) (weight_nonneg b y))] + convert mul_le_mul_of_nonneg_right (h y) (weight_nonneg b y) using 1 + ring) + +lemma integrableOn_profile_square (δ : ℝ) (p : MP) : + IntegrableOn (fun y => ‖profile δ p y‖^2) halfspace := by + have h := integrable_polynomial_square_weight p (by norm_num : (0:ℝ)<2) + rw [← integrable_indicator_iff measurable_halfspace] + apply h.congr + exact Filter.Eventually.of_forall (fun y => (profile_square_weight δ p y).symm) + +lemma memLp_profile (δ : ℝ) (p : MP) : MemLp (profile δ p) 2 (volume.restrict halfspace) := + (memLp_two_iff_integrable_sq_norm (smooth_profile δ p).continuous.aestronglyMeasurable).mpr + (integrableOn_profile_square δ p) + +lemma integral_profile_square (δ : ℝ) (p : MP) : + (∫ y in halfspace, ‖profile δ p y‖^2) = ∫ y : Y, ‖value p y‖^2*weight 2 y := by + rw [← integral_indicator measurable_halfspace] + exact integral_congr_ae (Filter.Eventually.of_forall (profile_square_weight δ p)) + +lemma scale_mem_halfspace {δ : ℝ} (hδ : δ≠0) (y : Y) : scale δ y ∈ halfspace ↔ y∈halfspace := by + change 0 f (scale δ y)) y := by + classical + change (if scale δ y ∈ halfspace then _ else 0) = (if y∈halfspace then _ else 0) + rw [scale_mem_halfspace hδ] + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem integralOn_scale {δ : ℝ} (hδ : δ≠0) (f : Y → F) : + (∫ y in halfspace, f y) = δ^4 • ∫ y in halfspace, f (scale δ y) := by + rw [← integral_indicator measurable_halfspace, integral_scale hδ] + simp_rw [scale_indicator hδ] + rw [integral_indicator measurable_halfspace] + +lemma integrableOn_scaled_iff {δ : ℝ} (hδ : δ≠0) (f : Y → F) : + IntegrableOn (fun y => f (scale δ y)) halfspace ↔ IntegrableOn f halfspace := by + rw [← integrable_indicator_iff measurable_halfspace, ← integrable_indicator_iff measurable_halfspace] + simpa only [scale_indicator hδ] using (scaled_integrable_iff hδ (halfspace.indicator f)) + +lemma physicalProfile_scale {δ : ℝ} (hδ : δ≠0) (p : MP) (y : Y) : + physicalProfile δ p (scale δ y)=profile δ p y := by + simp only [physicalProfile, scale_comp, inv_mul_cancel₀ hδ, scale_one] + +/-- Exact delta^4 factor in the true unscaled L2 mass. -/ +theorem integral_physicalProfile_square {δ : ℝ} (hδ : δ≠0) (p : MP) : + (∫ y in halfspace, ‖physicalProfile δ p y‖^2) = + δ^4 * ∫ y : Y, ‖value p y‖^2*weight 2 y := by + rw [integralOn_scale hδ] + simp_rw [physicalProfile_scale hδ] + rw [integral_profile_square] + rfl + +lemma memLp_physicalProfile {δ : ℝ} (hδ : δ≠0) (p : MP) : + MemLp (physicalProfile δ p) 2 (volume.restrict halfspace) := by + apply (memLp_two_iff_integrable_sq_norm + (smooth_physicalProfile δ p).continuous.aestronglyMeasurable).mpr + change IntegrableOn (fun x => ‖physicalProfile δ p x‖^2) halfspace + rw [← integrableOn_scaled_iff hδ] + simpa only [physicalProfile_scale hδ] using integrableOn_profile_square δ p + +end ElasticityBoundaryProfileBounds + +end +end +section +/-! Uniform true L2/H1 estimates for finite corrected boundary amplitudes. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryParameterBounds +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryProfile + ElasticityBoundaryProfileBounds ElasticityBoundaryWeights ElasticityBoundaryParameter +abbrev Y := Fin 3 → ℝ + +def atParameter (q : Polynomial MP) (δ : ℝ) : MP := q.eval (C (δ:ℂ)) + +lemma atParameter_add (q r : Polynomial MP) (δ : ℝ) : + atParameter (q+r) δ=atParameter q δ+atParameter r δ := Polynomial.eval_add + +lemma value_parameter_monomial (n : ℕ) (p : MP) (δ : ℝ) (y : Y) : + value (atParameter (Polynomial.monomial n p) δ) y=value p y*(δ:ℂ)^n := by + simp [atParameter,value] + +lemma parameterGrowth (q : Polynomial MP) : + ∃ A : ℝ, 0≤A ∧ ∃ n : ℕ, ∀ δ : ℝ, 0≤δ → δ≤1 → ∀ y : Y, + ‖value (atParameter q δ) y‖ ≤ A*(1+‖y‖)^n := by + induction q using Polynomial.induction_on' with + | add p q hp hq => + obtain ⟨A,hA,a,ha⟩ := hp + obtain ⟨B,hB,b,hb⟩ := hq + refine ⟨A+B,add_nonneg hA hB,max a b,fun δ hδ hδ1 y => ?_⟩ + have hr : 1≤1+‖y‖ := by linarith [norm_nonneg y] + calc + _ ≤ ‖value (atParameter p δ) y‖+‖value (atParameter q δ) y‖ := by + rw [atParameter_add,value_add]; exact norm_add_le _ _ + _ ≤ A*(1+‖y‖)^a+B*(1+‖y‖)^b := add_le_add (ha δ hδ hδ1 y) (hb δ hδ hδ1 y) + _ ≤ A*(1+‖y‖)^(max a b)+B*(1+‖y‖)^(max a b) := + add_le_add (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hr (le_max_left _ _)) hA) + (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hr (le_max_right _ _)) hB) + _ = _ := by ring + | monomial k p => + obtain ⟨A,hA,a,ha⟩ := polynomialGrowth p + refine ⟨A,hA,a,fun δ hδ hδ1 y => ?_⟩ + rw [value_parameter_monomial, norm_mul, norm_pow, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hδ] + exact (mul_le_of_le_one_right (norm_nonneg _) (pow_le_one₀ hδ hδ1)).trans (ha y) + +lemma parameter_square_bound (q : Polynomial MP) : + ∃ C : ℝ, 0≤C ∧ ∃ n : ℕ, ∀ δ : ℝ, 0≤δ → δ≤1 → ∀ y : Y, + ‖value (atParameter q δ) y‖^2 ≤ C*(1+‖y‖^n) := by + obtain ⟨A,hA,n,ha⟩ := parameterGrowth q + refine ⟨A^2*2^(2*n),by positivity,2*n,fun δ hδ hδ1 y => ?_⟩ + calc + _ ≤ (A*(1+‖y‖)^n)^2 := pow_le_pow_left₀ (norm_nonneg _) (ha δ hδ hδ1 y) 2 + _ = A^2*(1+‖y‖)^(2*n) := by rw [mul_pow, ← pow_mul]; ring + _ ≤ A^2*(2^(2*n)*(1+‖y‖^(2*n))) := + mul_le_mul_of_nonneg_left (one_add_pow_le (norm_nonneg y) _) (sq_nonneg A) + _ = _ := by ring + +lemma parameter_mass_bound (q : Polynomial MP) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0≤δ → δ≤1 → + (∫ y : Y, ‖value (atParameter q δ) y‖^2*weight 2 y) ≤ C := by + obtain ⟨A,hA,n,ha⟩ := parameter_square_bound q + let g : Y → ℝ := fun y => A*(weight 2 y+‖y‖^n*weight 2 y) + have hi : Integrable g := ((integrable_weight (by norm_num : (0:ℝ)<2)).add + (integrable_norm_moment (by norm_num : (0:ℝ)<2) n)).const_mul A + refine ⟨∫ y, g y, integral_nonneg (fun y => ?_), fun δ hδ hδ1 => ?_⟩ + · exact mul_nonneg hA (add_nonneg (weight_nonneg _ _) + (mul_nonneg (pow_nonneg (norm_nonneg _) _) (weight_nonneg _ _))) + · apply integral_mono (integrable_polynomial_square_weight _ (by norm_num)) hi + intro y + have h := mul_le_mul_of_nonneg_right (ha δ hδ hδ1 y) (weight_nonneg 2 y) + convert h using 1 + dsimp [g]; ring + +/-- No inverse powers remain in the true L2 norm of a first physical partial: +the inverse delta^4 differential factor and delta^4 Jacobian cancel exactly. -/ +lemma integral_physical_partial {δ : ℝ} (hδ : δ≠0) (p : MP) (j : Fin 3) : + (∫ z in halfspace, ‖fderiv ℝ (physicalProfile δ p) z (Pi.single j 1)‖^2) = + ∫ y : Y, ‖value (D δ j p) y‖^2*weight 2 y := by + simp_rw [fderiv_physicalProfile_basis hδ, norm_smul, Real.norm_eq_abs, + abs_inv, abs_of_nonneg (sq_nonneg δ), mul_pow] + rw [integral_const_mul, integral_physicalProfile_square hδ] + have hs : ((δ^2)⁻¹)^2*δ^4=1 := by field_simp + rw [← mul_assoc, hs, one_mul] + +/-- The actual corrected physical profiles, for a fixed finite polynomial +family, have uniformly bounded first-partial L2 masses. -/ +theorem uniform_physical_partial (q : Polynomial MP) (j : Fin 3) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → + (∫ z in halfspace, ‖fderiv ℝ (physicalProfile δ (atParameter q δ)) z + (Pi.single j 1)‖^2) ≤ C := by + obtain ⟨C,hC,h⟩ := parameter_mass_bound (PD j q) + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + rw [integral_physical_partial hδ.ne'] + change (∫ y : Y, ‖value (D δ j (q.eval (MvPolynomial.C (δ:ℂ)))) y‖^2*weight 2 y) ≤ C + rw [← eval_PD] + exact h δ hδ.le hδ1 + +end ElasticityBoundaryParameterBounds + +end +end +section +/-! Uniform polynomial-growth estimates for the actual smooth coefficient +Taylor errors, multiplied by a finite amplitude family. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryOrderBound +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryParameterBounds + ElasticityBoundaryTaylorPolynomial ElasticityBoundaryTaylor ElasticityBoundaryScaling + ElasticityBoundaryProfileBounds ElasticityBoundaryWeights +abbrev Y := Fin 3 → ℝ + +/-- A quantitative bound, with constants independent of concentration and +of the half-space point. The polynomial spatial weight is integrable against +our Gaussian/normal exponential. -/ +def OrderBound (f : ℝ → Y → ℂ) (k : ℕ) : Prop := + ∃ A : ℝ, 0≤A ∧ ∃ n : ℕ, ∀ δ : ℝ, 0<δ → δ≤1 → ∀ y : Y, + ‖f δ y‖ ≤ A*δ^k*(1+‖y‖)^n + +lemma OrderBound.zero (k : ℕ) : OrderBound (fun _ _ => 0) k := by + exact ⟨0,le_rfl,0,fun _ _ _ _ => by simp⟩ + +lemma OrderBound.add {f g : ℝ → Y → ℂ} {k : ℕ} + (hf : OrderBound f k) (hg : OrderBound g k) : OrderBound (fun δ y => f δ y+g δ y) k := by + obtain ⟨A,hA,a,ha⟩ := hf + obtain ⟨B,hB,b,hb⟩ := hg + refine ⟨A+B,add_nonneg hA hB,max a b,fun δ hδ hδ1 y => ?_⟩ + have hr : 1≤1+‖y‖ := by linarith [norm_nonneg y] + calc + _ ≤ ‖f δ y‖+‖g δ y‖ := norm_add_le _ _ + _ ≤ A*δ^k*(1+‖y‖)^a+B*δ^k*(1+‖y‖)^b := + add_le_add (ha δ hδ hδ1 y) (hb δ hδ hδ1 y) + _ ≤ A*δ^k*(1+‖y‖)^(max a b)+B*δ^k*(1+‖y‖)^(max a b) := + add_le_add (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hr (le_max_left _ _)) + (mul_nonneg hA (pow_nonneg hδ.le _))) + (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hr (le_max_right _ _)) + (mul_nonneg hB (pow_nonneg hδ.le _))) + _ = _ := by ring + +lemma OrderBound.sum {ι : Type*} (s : Finset ι) (f : ι → ℝ → Y → ℂ) {k : ℕ} + (h : ∀ i∈s, OrderBound (f i) k) : OrderBound (fun δ y => ∑ i∈s, f i δ y) k := by + classical + induction s using Finset.induction_on with + | empty => simpa only [Finset.sum_empty] using OrderBound.zero k + | @insert i s hi ih => + simpa only [Finset.sum_insert hi] using (h i (Finset.mem_insert_self _ _)).add + (ih (fun j hj => h j (Finset.mem_insert_of_mem hj))) + +lemma OrderBound.mul {f g : ℝ → Y → ℂ} {k l : ℕ} + (hf : OrderBound f k) (hg : OrderBound g l) : OrderBound (fun δ y => f δ y*g δ y) (k+l) := by + obtain ⟨A,hA,a,ha⟩ := hf + obtain ⟨B,hB,b,hb⟩ := hg + refine ⟨A*B,mul_nonneg hA hB,a+b,fun δ hδ hδ1 y => ?_⟩ + rw [norm_mul] + calc + _ ≤ (A*δ^k*(1+‖y‖)^a)*(B*δ^l*(1+‖y‖)^b) := + mul_le_mul (ha δ hδ hδ1 y) (hb δ hδ hδ1 y) (norm_nonneg _) + (by positivity) + _ = _ := by rw [pow_add, pow_add]; ring + +lemma OrderBound.weaken {f : ℝ → Y → ℂ} {k l : ℕ} (hf : OrderBound f k) (hl : l≤k) : + OrderBound f l := by + obtain ⟨A,hA,n,h⟩ := hf + refine ⟨A,hA,n,fun δ hδ hδ1 y => ?_⟩ + exact (h δ hδ hδ1 y).trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one hδ.le hδ1 hl) hA) (by positivity)) + +lemma parameter_bound (p : Polynomial MP) : + OrderBound (fun δ y => value (atParameter p δ) y) 0 := by + obtain ⟨A,hA,n,h⟩ := parameterGrowth p + exact ⟨A,hA,n,fun δ hδ hδ1 y => by simpa using h δ hδ.le hδ1 y⟩ + +lemma power_bound (k : ℕ) : OrderBound (fun δ _ => (δ:ℂ)^k) k := by + refine ⟨1,by norm_num,0,fun δ hδ _ _ => ?_⟩ + simp [norm_pow, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hδ] + +lemma parameter_factor_bound (p : Polynomial MP) (k : ℕ) : + OrderBound (fun δ y => value (atParameter (Polynomial.X^k*p) δ) y) k := by + have h := (power_bound k).mul (parameter_bound p) + simpa [atParameter,value] using h + +/-- The actual smooth coefficient minus its literal Taylor polynomial carries +the prescribed power of delta uniformly, not only at each fixed spatial point. -/ +lemma taylor_error_bound {f : Y → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hc : HasCompactSupport f) (N : ℕ) : + OrderBound (fun δ y => f (scale δ y)- + value (atParameter (parameterize (taylor f N)) δ) y) (N+1) := by + obtain ⟨A,hA,h⟩ := compact_radialTaylor_remainder hf hc N + refine ⟨A,hA,N+1,fun δ hδ hδ1 y => ?_⟩ + change ‖f (scale δ y)-value ((parameterize (taylor f N)).eval (C (δ:ℂ))) y‖ ≤ _ + rw [value_parameterized_taylor] + calc + _ ≤ A*‖scale δ y‖^(N+1) := h _ + _ ≤ A*(δ*‖y‖)^(N+1) := mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) (scale_norm_le hδ.le hδ1 y) _) hA + _ = A*δ^(N+1)*‖y‖^(N+1) := by rw [mul_pow]; ring + _ ≤ _ := mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg y) + (by linarith : ‖y‖≤1+‖y‖) _) (by positivity) + +/-- Every such explicit bound gives a genuine weighted L2 estimate. -/ +theorem OrderBound.square_mass {f : ℝ → Y → ℂ} {k : ℕ} (hf : OrderBound f k) + (hm : ∀ δ, Continuous (f δ)) {b : ℝ} (hb : 0 ‖f δ y‖^2*weight b y) ∧ + (∫ y, ‖f δ y‖^2*weight b y) ≤ C*δ^(2*k) := by + obtain ⟨A,hA,n,h⟩ := hf + let g : Y → ℝ := fun y => A^2*2^(2*n)*(weight b y+‖y‖^(2*n)*weight b y) + have hi : Integrable g := ((integrable_weight hb).add + (integrable_norm_moment hb (2*n))).const_mul (A^2*2^(2*n)) + have hg (y : Y) : 0≤g y := by + dsimp [g] + exact mul_nonneg (by positivity) (add_nonneg (weight_nonneg _ _) + (mul_nonneg (by positivity) (weight_nonneg _ _))) + refine ⟨∫ y, g y, integral_nonneg hg,fun δ hδ hδ1 => ?_⟩ + have hp (y : Y) : ‖f δ y‖^2*weight b y ≤ δ^(2*k)*g y := by + have hsq := pow_le_pow_left₀ (norm_nonneg _) (h δ hδ hδ1 y) 2 + have hpoly := one_add_pow_le (norm_nonneg y) (2*n) + have hbase : ‖f δ y‖^2 ≤ (A^2*δ^(2*k))*(2^(2*n)*(1+‖y‖^(2*n))) := by + calc + _ ≤ (A*δ^k*(1+‖y‖)^n)^2 := hsq + _ = (A^2*δ^(2*k))*(1+‖y‖)^(2*n) := by simp only [mul_pow, ← pow_mul]; ring + _ ≤ _ := mul_le_mul_of_nonneg_left hpoly (by positivity) + calc + _ ≤ ((A^2*δ^(2*k))*(2^(2*n)*(1+‖y‖^(2*n))))*weight b y := + mul_le_mul_of_nonneg_right hbase (weight_nonneg b y) + _ = _ := by dsimp [g]; ring + have hI : Integrable (fun y => ‖f δ y‖^2*weight b y) := by + apply (hi.const_mul (δ^(2*k))).mono' + (((hm δ).norm.pow 2).measurable.mul (measurable_weight b)).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun y => by + change |‖f δ y‖^2*weight b y| ≤ δ^(2*k)*g y + rw [abs_of_nonneg (mul_nonneg (sq_nonneg _) (weight_nonneg b y))] + exact hp y) + refine ⟨hI, ?_⟩ + have hbound := integral_mono hI (hi.const_mul (δ^(2*k))) hp + rw [integral_const_mul, mul_comm] at hbound + exact hbound + +end ElasticityBoundaryOrderBound + +end +end +section +/-! The genuine smooth variable-coefficient operator applied to constructed +finite boundary amplitudes. The remaining error is estimated, not discarded. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundarySmoothOperator +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundaryTaylorPolynomial ElasticityBoundaryOrderBound + ElasticityBoundaryScaling ElasticityBoundaryLayerOperator ElasticityBoundaryWeights +abbrev Y := Fin 3 → ℝ +abbrev SmoothTensor := Fin 3 → Fin 3 → Fin 3 → Fin 3 → Y → ℂ +abbrev SmoothLower := Fin 3 → Fin 3 → Fin 3 → Y → ℂ + +def tensorTaylor (a : SmoothTensor) (N : ℕ) : Tensor := + fun i α j β => parameterize (taylor (a i α j β) N) +def lowerTaylor (b : SmoothLower) (N : ℕ) : Lower := + fun i j β => parameterize (taylor (b i j β) N) + +/-- The scaled amplitude of the literal differential expression; the PD +operators are already identified with true scaled first/second derivatives. -/ +def scaledOperator (a : SmoothTensor) (b : SmoothLower) (q : Polynomial W) + (δ : ℝ) (i : Fin 3) (y : Y) : ℂ := + (∑ α, ∑ j, ∑ β, a i α j β (scale δ y) * + value (atParameter (PD α (PD β (unpack j q))) δ) y) + + (δ:ℂ)^2 * ∑ j, ∑ β, b i j β (scale δ y) * + value (atParameter (PD β (unpack j q)) δ) y + +lemma polynomial_operator_value (a : Tensor) (b : Lower) (q : Polynomial W) + (δ : ℝ) (i : Fin 3) (y : Y) : + value (atParameter (unpack i (operator a b q)) δ) y = + (∑ α, ∑ j, ∑ β, value (atParameter (a i α j β) δ) y * + value (atParameter (PD α (PD β (unpack j q))) δ) y) + + (δ:ℂ)^2 * ∑ j, ∑ β, value (atParameter (b i j β) δ) y * + value (atParameter (PD β (unpack j q)) δ) y := by + rw [unpack_operator] + simp [atParameter, value, Polynomial.eval_finsetSum] + +def scaledError (a : SmoothTensor) (b : SmoothLower) (q : Polynomial W) + (N : ℕ) (δ : ℝ) (i : Fin 3) (y : Y) : ℂ := + (∑ α, ∑ j, ∑ β, (a i α j β (scale δ y)- + value (atParameter (tensorTaylor a N i α j β) δ) y) * + value (atParameter (PD α (PD β (unpack j q))) δ) y) + + (δ:ℂ)^2 * ∑ j, ∑ β, (b i j β (scale δ y)- + value (atParameter (lowerTaylor b N i j β) δ) y) * + value (atParameter (PD β (unpack j q)) δ) y + +lemma scaledOperator_decomposition (a : SmoothTensor) (b : SmoothLower) (q : Polynomial W) + (N : ℕ) (δ : ℝ) (i : Fin 3) (y : Y) : + scaledOperator a b q δ i y = + value (atParameter (unpack i (operator (tensorTaylor a N) (lowerTaylor b N) q)) δ) y + + scaledError a b q N δ i y := by + rw [polynomial_operator_value] + simp only [scaledOperator, scaledError, sub_mul, Finset.sum_sub_distrib, mul_sub] + ring + +lemma error_order_bound (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β) ∧ HasCompactSupport (b i j β)) + (q : Polynomial W) (N : ℕ) (i : Fin 3) : + OrderBound (fun δ y => scaledError a b q N δ i y) (N+1) := by + have hA : OrderBound (fun δ y => ∑ α, ∑ j, ∑ β, (a i α j β (scale δ y)- + value (atParameter (tensorTaylor a N i α j β) δ) y) * + value (atParameter (PD α (PD β (unpack j q))) δ) y) (N+1) := by + apply OrderBound.sum + intro α _ + apply OrderBound.sum + intro j _ + apply OrderBound.sum + intro β _ + simpa only [Nat.add_zero, tensorTaylor] using + (taylor_error_bound (ha i α j β).1 (ha i α j β).2 N).mul + (parameter_bound (PD α (PD β (unpack j q)))) + have hB : OrderBound (fun δ y => ∑ j, ∑ β, (b i j β (scale δ y)- + value (atParameter (lowerTaylor b N i j β) δ) y) * + value (atParameter (PD β (unpack j q)) δ) y) (N+1) := by + apply OrderBound.sum + intro j _ + apply OrderBound.sum + intro β _ + simpa only [Nat.add_zero, lowerTaylor] using + (taylor_error_bound (hb i j β).1 (hb i j β).2 N).mul + (parameter_bound (PD β (unpack j q))) + exact hA.add (((power_bound 2).mul hB).weaken (by omega)) + +lemma unpack_X_pow_mul (i : Fin 3) (k : ℕ) (q : Polynomial W) : + unpack i (Polynomial.X^k*q)=Polynomial.X^k*unpack i q := by + simpa only [Polynomial.monomial_one_right_eq_X_pow] using unpack_monomial_mul i k q + +lemma scaledOperator_order_bound (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β) ∧ HasCompactSupport (b i j β)) + (q R : Polynomial W) (N : ℕ) + (hR : operator (tensorTaylor a N) (lowerTaylor b N) q=Polynomial.X^(N+1)*R) + (i : Fin 3) : OrderBound (fun δ y => scaledOperator a b q δ i y) (N+1) := by + simp_rw [scaledOperator_decomposition a b q N, hR, unpack_X_pow_mul] + exact (parameter_factor_bound (unpack i R) (N+1)).add (error_order_bound a b ha hb q N i) + +lemma continuous_scaledOperator (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, Continuous (a i α j β)) (hb : ∀ i j β, Continuous (b i j β)) + (q : Polynomial W) (δ : ℝ) (i : Fin 3) : Continuous (scaledOperator a b q δ i) := by + apply Continuous.add + · apply continuous_finsetSum + intro α _ + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact ((ha i α j β).comp (scale δ).continuous).mul (smooth_value _).continuous + · apply continuous_const.mul + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact ((hb i j β).comp (scale δ).continuous).mul (smooth_value _).continuous + +/-- For every smooth compact coefficient tensor with the physical frozen +value, the constructed amplitudes have a genuine arbitrarily small scaled +residual in weighted L2. No near-constantness is required. -/ +theorem finite_smooth_amplitude (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β) ∧ HasCompactSupport (b i j β)) + (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (ha0 : ∀ i α j β, a i α j β 0=elasticityTensor l m i α j β) + (p₀ : W) (h₀ : normal l m p₀=0) (N : ℕ) : + ∃ p : ℕ → W, p 0=p₀ ∧ (∀ n, 0 ‖scaledOperator a b (amplitude p N) δ i y‖^2*weight 2 y) ∧ + (∫ y, ‖scaledOperator a b (amplitude p N) δ i y‖^2*weight 2 y) ≤ C*δ^(2*(N+1)) := by + have hta0 : ∀ i α j β, (tensorTaylor a N i α j β).coeff 0=C (elasticityTensor l m i α j β) := by + intro i α j β + rw [tensorTaylor, taylor_coeff_zero (ha i α j β).1 (ha i α j β).2, ha0] + obtain ⟨p,R,hp0,hpb,hR⟩ := finite_tensor_amplitude (tensorTaylor a N) (lowerTaylor b N) + l m hm he hp hta0 p₀ h₀ N + refine ⟨p,hp0,hpb,fun i => ?_⟩ + exact (scaledOperator_order_bound a b ha hb (amplitude p N) R N hR i).square_mass + (fun δ => continuous_scaledOperator a b (fun i α j β => (ha i α j β).1.continuous) + (fun i j β => (hb i j β).1.continuous) _ δ i) (by norm_num) + +end ElasticityBoundarySmoothOperator + +end +end +section +/-! Literal unscaled differential residuals of the constructed boundary fields. +The estimates are in the actual half-space L2 norm, not a formal series norm. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryStrongLayer +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundarySmoothOperator ElasticityBoundaryProfile + ElasticityBoundaryProfileBounds ElasticityBoundaryScaling ElasticityBoundaryLayerOperator + ElasticityBoundaryWeights +abbrev Y := Fin 3 → ℝ + +def dpart (f : Y → ℂ) (j : Fin 3) (z : Y) : ℂ := + fderiv ℝ f z (Pi.single j 1) + +def strong (a : SmoothTensor) (b : SmoothLower) (u : Fin 3 → Y → ℂ) (i : Fin 3) (z : Y) : ℂ := + (∑ α, ∑ j, ∑ β, a i α j β z * dpart (dpart (u j) β) α z) + + ∑ j, ∑ β, b i j β z * dpart (u j) β z + +def layer (q : Polynomial W) (δ : ℝ) (j : Fin 3) : Y → ℂ := + physicalProfile δ (atParameter (unpack j q) δ) + +lemma D_atParameter (δ : ℝ) (j : Fin 3) (p : Polynomial MP) : + D δ j (atParameter p δ)=atParameter (PD j p) δ := (eval_PD j p δ).symm + +lemma partial_layer {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (j β : Fin 3) (z : Y) : + dpart (layer q δ j) β z = ((δ^2)⁻¹:ℝ) • + physicalProfile δ (atParameter (PD β (unpack j q)) δ) z := by + rw [dpart, layer, fderiv_physicalProfile_basis hδ, D_atParameter] + +lemma second_layer {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (j α β : Fin 3) (z : Y) : + dpart (dpart (layer q δ j) β) α z = ((δ^4)⁻¹:ℝ) • + physicalProfile δ (atParameter (PD α (PD β (unpack j q))) δ) z := by + change fderiv ℝ (fun x => fderiv ℝ (physicalProfile δ (atParameter (unpack j q) δ)) x + (Pi.single β 1)) z (Pi.single α 1)=_ + rw [second_physicalProfile hδ, D_atParameter, D_atParameter] + +/-- The computed scaled operator is exactly the actual strong differential +residual, including all coefficient-gradient/lower terms. -/ +theorem strong_layer_scale (a : SmoothTensor) (b : SmoothLower) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (i : Fin 3) (y : Y) : + strong a b (layer q δ) i (scale δ y) = + ((δ^4)⁻¹:ℝ) • (envelope δ y*scaledOperator a b q δ i y) := by + simp only [strong, second_layer hδ, partial_layer hδ, physicalProfile_scale hδ, + profile, Complex.real_smul, Complex.ofReal_inv, Complex.ofReal_pow] + have h24 : ((δ:ℂ)^2)⁻¹=((δ:ℂ)^4)⁻¹*(δ:ℂ)^2 := by + have hd : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + field_simp + rw [h24] + have hA (c v : ℂ) : c*(((δ:ℂ)^4)⁻¹*(envelope δ y*v)) = + (((δ:ℂ)^4)⁻¹*envelope δ y)*(c*v) := by ring + have hB (c v : ℂ) : c*((((δ:ℂ)^4)⁻¹*(δ:ℂ)^2)*(envelope δ y*v)) = + ((((δ:ℂ)^4)⁻¹*envelope δ y)*(δ:ℂ)^2)*(c*v) := by ring + simp_rw [hA, hB, ← Finset.mul_sum] + unfold scaledOperator + ring + +lemma envelope_product_indicator (δ : ℝ) (f : Y → ℂ) (y : Y) : + halfspace.indicator (fun y => ‖envelope δ y*f y‖^2) y=‖f y‖^2*weight 2 y := by + have h := profile_square_weight δ (C (f y)) y + change halfspace.indicator (fun z => ‖profile δ (C (f y)) z‖^2) y= _ at h + by_cases hy : y∈halfspace + · simpa only [Set.indicator_of_mem hy, profile, value_C] using h + · simpa only [Set.indicator_of_notMem hy, value_C] using h + +lemma integral_envelope_product (δ : ℝ) (f : Y → ℂ) : + (∫ y in halfspace, ‖envelope δ y*f y‖^2)=∫ y : Y, ‖f y‖^2*weight 2 y := by + rw [← integral_indicator measurable_halfspace] + exact integral_congr_ae (Filter.Eventually.of_forall (envelope_product_indicator δ f)) + +lemma integrable_envelope_product_iff (δ : ℝ) (f : Y → ℂ) : + IntegrableOn (fun y => ‖envelope δ y*f y‖^2) halfspace ↔ + Integrable (fun y => ‖f y‖^2*weight 2 y) := by + rw [← integrable_indicator_iff measurable_halfspace] + have h : halfspace.indicator (fun y => ‖envelope δ y*f y‖^2) = + (fun y => ‖f y‖^2*weight 2 y) := funext (envelope_product_indicator δ f) + rw [h] + +lemma strong_layer_mass (a : SmoothTensor) (b : SmoothLower) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (i : Fin 3) : + (∫ z in halfspace, ‖strong a b (layer q δ) i z‖^2) = + (δ^4)⁻¹ * ∫ y : Y, ‖scaledOperator a b q δ i y‖^2*weight 2 y := by + rw [integralOn_scale hδ] + simp_rw [strong_layer_scale a b hδ, norm_smul, Real.norm_eq_abs, abs_inv, + abs_of_nonneg (show 0≤δ^4 by positivity)] + simp_rw [mul_pow] + rw [integral_const_mul, integral_envelope_product] + change δ^4*(((δ^4)⁻¹)^2*_)=_ + have hpow : δ^4*((δ^4)⁻¹)^2=(δ^4)⁻¹ := by field_simp + rw [← mul_assoc, hpow] + +lemma integrable_strong_layer_square (a : SmoothTensor) (b : SmoothLower) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (i : Fin 3) + (h : Integrable (fun y => ‖scaledOperator a b q δ i y‖^2*weight 2 y)) : + IntegrableOn (fun z => ‖strong a b (layer q δ) i z‖^2) halfspace := by + rw [← integrableOn_scaled_iff hδ] + simp_rw [strong_layer_scale a b hδ, norm_smul, mul_pow] + exact ((integrable_envelope_product_iff δ _).mpr h).const_mul _ + +lemma continuous_strong_layer (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, Continuous (a i α j β)) (hb : ∀ i j β, Continuous (b i j β)) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (i : Fin 3) : + Continuous (strong a b (layer q δ) i) := by + have h : strong a b (layer q δ) i = fun z => + (∑ α, ∑ j, ∑ β, a i α j β z * (((δ^4)⁻¹:ℝ) • + physicalProfile δ (atParameter (PD α (PD β (unpack j q))) δ) z)) + + ∑ j, ∑ β, b i j β z * (((δ^2)⁻¹:ℝ) • + physicalProfile δ (atParameter (PD β (unpack j q)) δ) z) := by + funext z + simp only [strong, second_layer hδ, partial_layer hδ] + rw [h] + apply Continuous.add + · apply continuous_finsetSum + intro α _ + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (ha i α j β).mul ((smooth_physicalProfile δ _).continuous.const_smul ((δ^4)⁻¹:ℝ)) + · apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (hb i j β).mul ((smooth_physicalProfile δ _).continuous.const_smul ((δ^2)⁻¹:ℝ)) + +/-- Genuine arbitrary-order half-space strong residuals of finite smooth +boundary trial fields. The norm is the actual unscaled L2 norm. -/ +theorem finite_strong_layer (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β) ∧ HasCompactSupport (b i j β)) + (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (ha0 : ∀ i α j β, a i α j β 0=elasticityTensor l m i α j β) + (p₀ : W) (h₀ : normal l m p₀=0) (N : ℕ) : + ∃ p : ℕ → W, p 0=p₀ ∧ (∀ n, 0 ?_⟩ + obtain ⟨C,hC,hI⟩ := hpN i + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + obtain ⟨hInt,hBound⟩ := hI δ hδ hδ1 + refine ⟨(memLp_two_iff_integrable_sq_norm + (continuous_strong_layer a b (fun i α j β => (ha i α j β).1.continuous) + (fun i j β => (hb i j β).1.continuous) hδ.ne' _ i).aestronglyMeasurable).mpr + (integrable_strong_layer_square a b hδ.ne' _ i hInt), ?_⟩ + rw [strong_layer_mass a b hδ.ne'] + calc + _ ≤ (δ^4)⁻¹*(C*δ^(2*(N+1+1))) := + mul_le_mul_of_nonneg_left hBound (by positivity) + _ = C*δ^(2*N) := by + rw [show 2*(N+1+1)=4+2*N by omega, pow_add] + field_simp + +end ElasticityBoundaryStrongLayer + +end +end +section +/-! True pullback of a second-order physical system. The coefficient Hessian +term is retained, and no equivalence of augmented and physical DN data is used. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryPullback +open ElasticityBoundaryChainRule ElasticityBoundarySmoothOperator ElasticityBoundaryStrongLayer +abbrev I := Fin 3 +abbrev Y := Fin 3 → ℝ +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] +abbrev Tensor (E : Type*) := I → I → I → I → E → ℂ +abbrev Lower (E : Type*) := I → I → I → E → ℂ + +def directional (e : I → E) (a : Tensor E) (b : Lower E) (u : I → E → ℂ) (i : I) (x : E) : ℂ := + (∑ k, ∑ j, ∑ l, a i k j l x*dd (dd (u j) (e l)) (e k) x)+ + ∑ j, ∑ l, b i j l x*dd (u j) (e l) x + +def principalPull (e : I → E) (a : Tensor E) (ψ : E → Y) : Tensor E := + fun i α j β x => ∑ k, ∑ l, a i k j l x*(jac ψ (e k) α x:ℂ)*(jac ψ (e l) β x:ℂ) + +def lowerPull (e : I → E) (a : Tensor E) (b : Lower E) (ψ : E → Y) : Lower E := + fun i j β x => (∑ k, ∑ l, a i k j l x*(hess ψ (e k) (e l) β x:ℂ))+ + ∑ l, b i j l x*(jac ψ (e l) β x:ℂ) + +lemma shuffle3 {R : Type*} [AddCommMonoid R] (f : I → I → I → R) : + (∑ i, ∑ j, ∑ k, f i j k)=∑ j, ∑ k, ∑ i, f i j k := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + exact Finset.sum_comm + +lemma shuffle5 {R : Type*} [AddCommMonoid R] (f : I → I → I → I → I → R) : + (∑ k, ∑ j, ∑ l, ∑ β, ∑ α, f k j l β α)= + ∑ α, ∑ j, ∑ β, ∑ k, ∑ l, f k j l β α := by + simp_rw [Finset.sum_comm (f := fun β α => f _ _ _ β α)] + simp_rw [Finset.sum_comm (f := fun l α => ∑ β, f _ _ l β α)] + simp_rw [Finset.sum_comm (f := fun j α => ∑ l, ∑ β, f _ j l β α)] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro α _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + simp_rw [Finset.sum_comm (f := fun l β => f _ j l β α)] + exact Finset.sum_comm + +/-- The actual system under a smooth coordinate map, including all lower +terms from its Hessian. No coordinate Jacobian is silently discarded. -/ +theorem directional_comp (e : I → E) (a : Tensor E) (b : Lower E) + {ψ : E → Y} (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) (x : E) : + directional e a b (fun j z => u j (ψ z)) i x = + (∑ α, ∑ j, ∑ β, principalPull e a ψ i α j β x*cp (cp (u j) β) α (ψ x))+ + ∑ j, ∑ β, lowerPull e a b ψ i j β x*cp (u j) β (ψ x) := by + simp only [directional, dd_dd_comp (hu _) hψ, + dd_comp ((hu _).differentiable (by simp)) (hψ.differentiable (by simp)), + mul_add, Finset.mul_sum, Finset.sum_add_distrib] + have hp : (∑ k, ∑ j, ∑ l, ∑ β, ∑ α, + a i k j l x*((jac ψ (e l) β x:ℂ)*(jac ψ (e k) α x:ℂ)*cp (cp (u j) β) α (ψ x))) = + ∑ α, ∑ j, ∑ β, principalPull e a ψ i α j β x*cp (cp (u j) β) α (ψ x) := by + rw [shuffle5] + unfold principalPull + simp only [Finset.sum_mul] + apply Finset.sum_congr rfl + intro α _ + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro β _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro l _ + ring + rw [hp] + unfold lowerPull + simp only [add_mul, Finset.sum_add_distrib, Finset.sum_mul] + have hh : (∑ k, ∑ j, ∑ l, ∑ β, + a i k j l x*((hess ψ (e k) (e l) β x:ℂ)*cp (u j) β (ψ x))) = + ∑ j, ∑ β, ∑ k, ∑ l, a i k j l x*(hess ψ (e k) (e l) β x:ℂ)*cp (u j) β (ψ x) := by + simp_rw [Finset.sum_comm (f := fun l β => a i _ _ l x*(_*cp (u _) β (ψ x)))] + rw [shuffle3] + simp only [mul_assoc] + have hb : (∑ j, ∑ l, ∑ α, b i j l x*((jac ψ (e l) α x:ℂ)*cp (u j) α (ψ x)))= + ∑ j, ∑ β, ∑ l, b i j l x*(jac ψ (e l) β x:ℂ)*cp (u j) β (ψ x) := by + apply Finset.sum_congr rfl + intro j _ + rw [Finset.sum_comm] + simp only [mul_assoc] + rw [hh,hb] + abel + +end ElasticityBoundaryPullback + +end +end +section +/-! Orthogonal covariance of the literal isotropic tensor in physical +coordinates. The frame is an actual Euclidean isometry, not a gauge freedom. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryRotation +open ElasticityBoundaryLayerOperator +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +def frameMatrix (Q : X ≃ₗᵢ[ℝ] X) (i j : I) : ℂ := (Q (EuclideanSpace.single j 1) i : ℂ) + +lemma frameMatrix_orthogonal (Q : X ≃ₗᵢ[ℝ] X) (j k : I) : + (∑ i, frameMatrix Q i j*frameMatrix Q i k)=if j=k then 1 else 0 := by + have hreal : (∑ i, Q (EuclideanSpace.single j 1) i*Q (EuclideanSpace.single k 1) i)= + if j=k then 1 else 0 := by + calc + _ = inner ℝ (Q (EuclideanSpace.single k 1)) (Q (EuclideanSpace.single j 1)) := by + rw [EuclideanSpace.inner_eq_star_dotProduct] + rfl + _ = inner ℝ (EuclideanSpace.single k 1) (EuclideanSpace.single j 1) := Q.inner_map_map _ _ + _ = _ := by simp [EuclideanSpace.inner_single_left, PiLp.single_apply, eq_comm] + simpa only [frameMatrix, ← Complex.ofReal_mul, ← Complex.ofReal_sum, apply_ite, + Complex.ofReal_one, Complex.ofReal_zero] using congrArg Complex.ofReal hreal + +def rotateTensor (Q : I → I → ℂ) (a : I → I → I → I → ℂ) (s α r β : I) : ℂ := + ∑ i, ∑ k, ∑ j, ∑ l, Q i s*Q k α*a i k j l*Q j r*Q l β + +def columnDot (Q : I → I → ℂ) (i j : I) : ℂ := ∑ k, Q k i*Q k j + +lemma rotate_isotropic_formula (Q : I → I → ℂ) (l m : ℂ) (s α r β : I) : + rotateTensor Q (elasticityTensor l m) s α r β = + l*columnDot Q s α*columnDot Q r β+ + m*(columnDot Q s r*columnDot Q α β+columnDot Q s β*columnDot Q α r) := by + unfold rotateTensor elasticityTensor + simp only [mul_add, add_mul, Finset.sum_add_distrib] + simp only [mul_ite, ite_mul, mul_one, mul_zero, zero_mul, + Finset.sum_ite_irrel, Fintype.sum_ite_eq, Finset.sum_const_zero] + unfold columnDot + simp only [Finset.mul_sum, Finset.sum_mul] + congr 1 + · rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + · congr 1 + · rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + · rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +/-- Simultaneously transporting displacement and spatial coordinates by the +same actual orthogonal frame leaves the frozen physical tensor unchanged. -/ +theorem rotate_isotropic (Q : X ≃ₗᵢ[ℝ] X) (l m : ℂ) (s α r β : I) : + rotateTensor (frameMatrix Q) (elasticityTensor l m) s α r β=elasticityTensor l m s α r β := by + rw [rotate_isotropic_formula] + simp only [columnDot, frameMatrix_orthogonal, elasticityTensor] + +end ElasticityBoundaryRotation + +end +end +section +/-! Exact constant-frame transformation of the strong differential operator. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryFrameOperator +open ElasticityBoundaryChainRule ElasticityBoundaryPullback ElasticityBoundaryRotation +abbrev I := Fin 3 +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def mix (Q : I → I → ℂ) (u : I → E → ℂ) (i : I) (x : E) : ℂ := ∑ j, Q i j*u j x + +def mixedTensor (R S : I → I → ℂ) (a : Tensor E) : Tensor E := + fun s k r l x => ∑ i, ∑ j, R s i*a i k j l x*S j r + +def mixedLower (R S : I → I → ℂ) (b : Lower E) : Lower E := + fun s r l x => ∑ i, ∑ j, R s i*b i j l x*S j r + +lemma smooth_mix (Q : I → I → ℂ) (u : I → E → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (mix Q u i) := by + exact ContDiff.sum (fun j _ => contDiff_const.mul (hu j)) + +lemma dd_mix (Q : I → I → ℂ) (u : I → E → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) (v x : E) : + dd (mix Q u i) v x=∑ j, Q i j*dd (u j) v x := by + change dd (fun z => ∑ j, Q i j*u j z) v x=_ + rw [dd_sum Finset.univ (fun j z => Q i j*u j z) + (fun j _ => (contDiff_const.mul (hu j)).differentiable (by simp))] + apply Finset.sum_congr rfl + intro j _ + rw [dd_mul (differentiable_const _) ((hu j).differentiable (by simp))] + have hz : dd (fun _ : E => Q i j) v x=0 := by simp [dd] + rw [hz,zero_mul,zero_add] + +lemma dd_dd_mix (Q : I → I → ℂ) (u : I → E → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) (v w x : E) : + dd (dd (mix Q u i) w) v x=∑ j, Q i j*dd (dd (u j) w) v x := by + have he : dd (mix Q u i) w=mix Q (fun j => dd (u j) w) i := by + funext z + exact dd_mix Q u hu i w z + rw [he] + exact dd_mix Q _ (fun j => smooth_dd (hu j) w) i v x + +lemma shuffle4 {R : Type*} [AddCommMonoid R] (f : I → I → I → I → R) : + (∑ i, ∑ j, ∑ l, ∑ r, f i j l r)=∑ r, ∑ l, ∑ i, ∑ j, f i j l r := by + simp_rw [Finset.sum_comm (f := fun l r => f _ _ l r)] + simp_rw [Finset.sum_comm (f := fun j r => ∑ l, f _ j l r)] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro r _ + simp_rw [Finset.sum_comm (f := fun j l => f _ j l r)] + exact Finset.sum_comm + +/-- Input displacement and output equation rotation retain every literal term. -/ +theorem directional_mix (e : I → E) (R S : I → I → ℂ) (a : Tensor E) (b : Lower E) + (u : I → E → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (s : I) (x : E) : + (∑ i, R s i*directional e a b (mix S u) i x)= + directional e (mixedTensor R S a) (mixedLower R S b) u s x := by + simp only [directional, dd_dd_mix S u hu, dd_mix S u hu, + mul_add, Finset.mul_sum, Finset.sum_add_distrib] + unfold mixedTensor mixedLower + simp only [Finset.sum_mul] + congr 1 + · rw [shuffle5, Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro r _ + apply Finset.sum_congr rfl + intro l _ + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + · rw [shuffle4] + apply Finset.sum_congr rfl + intro r _ + apply Finset.sum_congr rfl + intro l _ + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +end ElasticityBoundaryFrameOperator + +end +end +section +/-! The strong expression is the divergence of the actual isotropic stress, +with every Lamé-gradient term retained. It is not an independently prescribed +system. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryPhysicalStrong +open ElasticityBoundaryChainRule ElasticityBoundaryPullback ElasticityBoundaryLayerOperator +abbrev I := Fin 3 +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def divergence (e : I → E) (u : I → E → ℂ) (x : E) : ℂ := ∑ j, dd (u j) (e j) x + +def stress (e : I → E) (l m : E → ℂ) (u : I → E → ℂ) (i k : I) (x : E) : ℂ := + (if i=k then l x*divergence e u x else 0)+ + m x*(dd (u i) (e k) x+dd (u k) (e i) x) + +def coeff (l m : E → ℂ) : Tensor E := fun i k j r x => elasticityTensor (l x) (m x) i k j r + +def lower (e : I → E) (l m : E → ℂ) : Lower E := fun i j β x => + dd l (e i) x*(if j=β then 1 else 0)+dd m (e β) x*(if i=j then 1 else 0)+ + dd m (e j) x*(if i=β then 1 else 0) + +lemma dd_add {f g : E → ℂ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) (v x : E) : + dd (fun z => f z+g z) v x=dd f v x+dd g v x := by + rw [dd, fderiv_fun_add (hf x) (hg x), add_apply] + rfl + +lemma dd_ite (P : Prop) [Decidable P] (f g : E → ℂ) (v x : E) : + dd (fun z => if P then f z else g z) v x=if P then dd f v x else dd g v x := by + by_cases h : P <;> simp [h] + +lemma smooth_divergence (e : I → E) (u : I → E → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) : ContDiff ℝ (⊤ : ℕ∞) (divergence e u) := by + exact ContDiff.sum (fun j _ => smooth_dd (hu j) _) + +lemma stress_derivative (e : I → E) {l m : E → ℂ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → E → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i k : I) (x : E) : + dd (stress e l m u i k) (e k) x = + (if i=k then dd l (e k) x*divergence e u x+l x*(∑ j, dd (dd (u j) (e j)) (e k) x) else 0)+ + dd m (e k) x*(dd (u i) (e k) x+dd (u k) (e i) x)+ + m x*(dd (dd (u i) (e k)) (e k) x+dd (dd (u k) (e i)) (e k) x) := by + have hd := smooth_divergence e u hu + have hsum (v : E) : dd (divergence e u) v x=∑ j, dd (dd (u j) (e j)) v x := by + exact dd_sum Finset.univ (fun j => dd (u j) (e j)) + (fun j _ => (smooth_dd (hu j) _).differentiable (by simp)) v x + have h0 : Differentiable ℝ (fun z => if i=k then l z*divergence e u z else 0) := by + by_cases h : i=k + · simpa [h] using (hl.mul hd).differentiable (by simp) + · simp only [h,ite_false] + exact differentiable_const 0 + change dd (fun z => (if i=k then l z*divergence e u z else 0)+ + m z*(dd (u i) (e k) z+dd (u k) (e i) z)) (e k) x=_ + rw [dd_add h0 ((hm.mul ((smooth_dd (hu i) _).add (smooth_dd (hu k) _))).differentiable (by simp)), + dd_ite, dd_mul (hl.differentiable (by simp)) (hd.differentiable (by simp)), hsum, + dd_mul (hm.differentiable (by simp)) + (((smooth_dd (hu i) _).add (smooth_dd (hu k) _)).differentiable (by simp)), + dd_add ((smooth_dd (hu i) _).differentiable (by simp)) ((smooth_dd (hu k) _).differentiable (by simp))] + have hz : dd (fun _ : E => (0 : ℂ)) (e k) x=0 := by simp [dd] + rw [hz] + ring + +lemma tensor_contract (l m : ℂ) (d : I → I → I → ℂ) (i : I) : + (∑ k, ∑ j, ∑ β, elasticityTensor l m i k j β*d j k β)= + l*(∑ j, d j i j)+m*(∑ k, d i k k)+m*(∑ k, d k k i) := by + simp only [elasticityTensor, add_mul, mul_add, Finset.sum_add_distrib] + simp only [mul_ite, ite_mul, mul_one, mul_zero, zero_mul, + Finset.sum_ite_irrel, Fintype.sum_ite_eq, Finset.sum_const_zero] + simp only [← Finset.mul_sum] + ring + +lemma lower_contract (dl dm : I → ℂ) (d : I → I → ℂ) (i : I) : + (∑ j, ∑ β, (dl i*(if j=β then 1 else 0)+dm β*(if i=j then 1 else 0)+ + dm j*(if i=β then 1 else 0))*d j β)= + dl i*(∑ j, d j j)+(∑ k, dm k*d i k)+∑ k, dm k*d k i := by + simp only [add_mul, Finset.sum_add_distrib, mul_ite, ite_mul, mul_one, mul_zero, zero_mul, + Finset.sum_ite_irrel, Fintype.sum_ite_eq, Finset.sum_const_zero] + rw [← Finset.mul_sum] + +/-- Divergence of the physical Lamé stress equals the constructed literal +second-order system, including its exact first-order coefficient terms. -/ +theorem stress_divergence (e : I → E) {l m : E → ℂ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → E → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) (x : E) : + (∑ k, dd (stress e l m u i k) (e k) x)=directional e (coeff l m) (lower e l m) u i x := by + simp only [stress_derivative e hl hm u hu, Finset.sum_add_distrib, + Finset.sum_ite_eq, Finset.mem_univ, ite_true, mul_add, ← Finset.mul_sum] + change _ = (∑ k, ∑ j, ∑ β, elasticityTensor (l x) (m x) i k j β*dd (dd (u j) (e β)) (e k) x)+ + ∑ j, ∑ β, (dd l (e i) x*(if j=β then 1 else 0)+dd m (e β) x*(if i=j then 1 else 0)+ + dd m (e j) x*(if i=β then 1 else 0))*dd (u j) (e β) x + rw [tensor_contract] + rw [lower_contract (fun k => dd l (e k) x) (fun k => dd m (e k) x) (fun j β => dd (u j) (e β) x) i] + simp only [divergence] + ring + +end ElasticityBoundaryPhysicalStrong + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryPackets.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryPackets.lean new file mode 100644 index 0000000000000000000000000000000000000000..f64aae5bac53e32cb266733363caee0635a64f39 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryPackets.lean @@ -0,0 +1,1031 @@ +import OAI.MathematicalPhysics.Elasticity.Variational +import OAI.MathematicalPhysics.Elasticity.BoundaryParametrix + +namespace OAI + +section +/-! The exact inverse derivative at normalized physical boundary charts. -/ +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundaryInverseGeometry +open Elasticity ElasticityBoundaryChainRule ElasticityBoundaryRotation +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +lemma inverse_derivative (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {x : X} (hx : x∈e.source) (Q : X ≃ₗᵢ[ℝ] X) + (hQ : HasFDerivAt e Q.toContinuousLinearEquiv.toContinuousLinearMap x) : + HasFDerivAt e.symm Q.symm.toContinuousLinearEquiv.toContinuousLinearMap (e x) := by + have hd := (hi.differentiableOn (by simp)).differentiableAt + (e.open_target.mem_nhds (e.map_source hx)) + have hinv := chart_fderiv_left_inverse e he hi hx + rw [hQ.fderiv] at hinv + have hf : fderiv ℝ e.symm (e x)=Q.symm.toContinuousLinearEquiv.toContinuousLinearMap := by + apply ContinuousLinearMap.ext + intro v + have h := congrArg (fun A : X →L[ℝ] X => A (Q.symm v)) hinv + change fderiv ℝ e.symm (e x) (Q (Q.symm v))=Q.symm v at h + change fderiv ℝ e.symm (e x) v=Q.symm v + simpa only [Q.apply_symm_apply] using h + rw [← hf] + exact hd.hasFDerivAt + +lemma inverse_frame_entry (Q : X ≃ₗᵢ[ℝ] X) (k α : I) : + Q.symm (EuclideanSpace.single k 1) α=Q (EuclideanSpace.single α 1) k := by + have h := Q.inner_map_eq_flip (EuclideanSpace.single α 1) (EuclideanSpace.single k 1) + simpa only [EuclideanSpace.inner_single_left, EuclideanSpace.inner_single_right, + map_one, one_mul, mul_one, starRingEnd_apply, star_trivial] using h.symm + +lemma coordinate_inverse_jac (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {x : X} (hx : x∈e.source) (Q : X ≃ₗᵢ[ℝ] X) + (hQ : HasFDerivAt e Q.toContinuousLinearEquiv.toContinuousLinearMap x) + {Ψ : X → X} (hΨ : Ψ =ᶠ[𝓝 (e x)] e.symm) (k α : I) : + (jac (fun z => (Ψ z).ofLp) (EuclideanSpace.single k 1) α (e x):ℂ)=frameMatrix Q k α := by + have hder := (inverse_derivative e he hi hx Q hQ).congr_of_eventuallyEq hΨ + have hcoords := (PiLp.continuousLinearEquiv 2 ℝ (fun _ : I => ℝ)).hasFDerivAt.comp (e x) hder + change ((fderiv ℝ (fun z => (Ψ z).ofLp) (e x) (EuclideanSpace.single k 1)) α:ℂ)=_ + change HasFDerivAt (fun z => (Ψ z).ofLp) _ (e x) at hcoords + rw [hcoords.fderiv] + change (Q.symm (EuclideanSpace.single k 1) α:ℂ)=_ + rw [inverse_frame_entry] + rfl + +end ElasticityBoundaryInverseGeometry + +end +end +section +/-! Exact inversion of the fixed physical orthogonal frame, including +quantitative component control needed for the genuine residual norm. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryFrameInverse +open ElasticityBoundaryRotation ElasticityBoundaryInverseGeometry ElasticityBoundaryFrameOperator +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +lemma frameMatrix_symm (Q : X ≃ₗᵢ[ℝ] X) (i j : I) : + frameMatrix Q.symm i j=frameMatrix Q j i := by + exact congrArg Complex.ofReal (inverse_frame_entry Q j i) + +lemma frameMatrix_rows (Q : X ≃ₗᵢ[ℝ] X) (i j : I) : + (∑ s, frameMatrix Q i s*frameMatrix Q j s)=if i=j then 1 else 0 := by + simpa only [frameMatrix_symm] using frameMatrix_orthogonal Q.symm i j + +lemma frame_inverse (Q : X ≃ₗᵢ[ℝ] X) (v : I → ℂ) (i : I) : + (∑ s, frameMatrix Q i s*(∑ j, frameMatrix Q j s*v j))=v i := by + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + simp_rw [← mul_assoc,← Finset.sum_mul,frameMatrix_rows] + simp + +lemma norm_sq_sum_three (v : I → ℂ) : ‖∑ i, v i‖^2 ≤ 3*∑ i, ‖v i‖^2 := by + have h := norm_sum_le Finset.univ v + have h0 : 0≤∑ i, ‖v i‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + have hs : (∑ i, ‖v i‖)^2≤3*∑ i, ‖v i‖^2 := by + simp only [Fin.sum_univ_three] + nlinarith [sq_nonneg (‖v 0‖-‖v 1‖),sq_nonneg (‖v 0‖-‖v 2‖),sq_nonneg (‖v 1‖-‖v 2‖)] + exact (sq_le_sq₀ (norm_nonneg _) h0 |>.mpr h).trans hs + +lemma norm_frame_entry (Q : X ≃ₗᵢ[ℝ] X) (i j : I) : ‖frameMatrix Q i j‖≤1 := by + have h := PiLp.norm_apply_le (p := (2:ENNReal)) (Q (EuclideanSpace.single j 1)) i + simpa only [frameMatrix,Complex.norm_real,Q.norm_map,EuclideanSpace.single,PiLp.norm_single,Real.norm_eq_abs,abs_one] using h + +lemma physical_component_bound (Q : X ≃ₗᵢ[ℝ] X) (v : I → ℂ) (i : I) : + ‖v i‖^2≤3*∑ s, ‖∑ j, frameMatrix Q j s*v j‖^2 := by + conv_lhs => rw [← frame_inverse Q v i] + apply (norm_sq_sum_three _).trans + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply Finset.sum_le_sum + intro s _ + rw [norm_mul,mul_pow] + exact mul_le_of_le_one_left (sq_nonneg _) (pow_le_one₀ (norm_nonneg _) (norm_frame_entry Q i s)) + +end ElasticityBoundaryFrameInverse + +end +end +section +/-! Support-complete physical force identification. The coordinate expression +is valid on the entire chart source, including all zero regions, and the +physical force is supported in the genuine compact image. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryForceSupport +open ElasticityBoundary ElasticityBoundaryPhysicalTransfer ElasticityBoundaryOperatorLocal + ElasticityBoundaryLocalParametrix ElasticityBoundaryStrongLayer + ElasticityBoundaryChartOperator ElasticityBoundaryFrameOperator + ElasticityBoundaryFrameInverse ElasticityBoundaryRotation +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +lemma compact_image (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) : IsCompact (e '' K) := + hK.image_of_continuousOn (e.continuousOn.mono hs) + +lemma force_support (l m : X → ℂ) (u : I → X → ℂ) {K : Set X} + (hK : IsClosed K) (hu : ∀ j, Function.support (u j)⊆K) (i : I) : + Function.support (force l m u i)⊆K := + directional_support basis _ _ hK u hu i + +lemma transferred_force_support (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hη : tsupport η⊆e.target) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) (l m : X → ℂ) (i : I) : + Function.support (force l m (transferred e η Q u) i)⊆e '' K := + force_support l m _ (compact_image e hK hs).isClosed (support_transferred e hη Q u hu) i + +lemma strong_support_lifted (a : ElasticityBoundarySmoothOperator.SmoothTensor) + (b : ElasticityBoundarySmoothOperator.SmoothLower) {K : Set X} (hK : IsClosed K) + (u : I → Y → ℂ) (hu : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) (i : I) : + Function.support (fun z : X => strong a b u i z.ofLp)⊆K := by + intro x hx + have hcl : IsClosed {y : Y | WithLp.toLp 2 y∈K} := hK.preimage (PiLp.continuous_toLp 2 (fun _ : I => ℝ)) + have hh : ∀ j, Function.support (u j)⊆{y : Y | WithLp.toLp 2 y∈K} := by + intro j y hy + exact hu j hy + exact strong_support a b hcl u hh i hx + +/-- No operator identity is required outside the actual support: locality +proves both sides vanish there. -/ +theorem transferred_force_all (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hηs : tsupport η⊆e.target) + (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ y=e y) (hΨe : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (x : X) (hx : x∈e.source) (s : I) : + (∑ i, frameMatrix Q i s*force l m (transferred e η Q u) i (e x))= + strong (chartPrincipal Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) + (chartLower Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) u s x.ofLp := by + by_cases hxK : x∈K + · exact transferred_force e hs hη Q u hus hu Φ Ψ hΨ hl hm x.ofLp hxK + (hΦ x hxK) (hΨe _ (mem_image_of_mem e hxK)) s + · have hn : e x∉e '' K := by + rintro ⟨y,hy,he⟩ + exact hxK (e.injOn (hs hy) hx he ▸ hy) + have hz (i : I) : force l m (transferred e η Q u) i (e x)=0 := + Function.notMem_support.mp (fun h => hn (transferred_force_support e hK hs hηs Q u hus l m i h)) + have hr : strong (chartPrincipal Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) + (chartLower Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) u s x.ofLp=0 := + Function.notMem_support.mp (fun h => hxK (strong_support_lifted _ _ hK.isClosed u hus s h)) + simp only [hz,mul_zero,Finset.sum_const_zero,hr] + +end ElasticityBoundaryForceSupport + +end +end +section +/-! Honest physical boundary change of variables. The Jacobian is not +normalized away: it is retained exactly and bounded only on the actual +compact trial support. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology +namespace ElasticityBoundaryChartIntegral +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (μ : Measure E) [μ.IsAddHaarMeasure] + +/-- A compactly supported physical integrand pulls back with its exact +Jacobian, including the domain's half-space indicator. -/ +theorem compact_chart_integral (e : OpenPartialHomeomorph E E) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + {K Ω H : Set E} (hs : K⊆e.source) (hΩ : MeasurableSet Ω) (hH : MeasurableSet H) + (hhalf : ∀ y∈e.source, e y∈Ω ↔ y∈H) + {Φ : E → E} (hΦ : ∀ y∈K, Φ =ᶠ[𝓝 y] e) + (f g : E → ℝ) (hf : Function.support f⊆e '' K) (hg : Function.support g⊆K) + (hfg : ∀ y∈e.source, f (e y)=g y) : + (∫ x in Ω, f x ∂μ)=(∫ y in H, |(fderiv ℝ Φ y).det| *g y ∂μ) := by + have hd (y : E) (hy : y∈e.source) : HasFDerivAt e (fderiv ℝ e y) y := + ((he.differentiableOn (by simp)).differentiableAt (e.open_source.mem_nhds hy)).hasFDerivAt + rw [← integral_indicator hΩ] + rw [← setIntegral_eq_integral_of_forall_compl_eq_zero (s := e.target) (f := Ω.indicator f) + (fun x hx => by + have hh : f x=0 := by + by_contra hn + obtain ⟨y,hy,rfl⟩ := hf hn + exact hx (e.map_source (hs hy)) + simp only [indicator,hh,ite_self])] + rw [integral_target_eq_integral_abs_det_fderiv_smul μ hd] + have heq : (∫ y in e.source, |(fderiv ℝ e y).det| • Ω.indicator f (e y) ∂μ)= + ∫ y in e.source, H.indicator (fun z => |(fderiv ℝ Φ z).det| *g z) y ∂μ := by + apply setIntegral_congr_fun e.open_source.measurableSet + intro y hy + dsimp only + by_cases hyK : y∈K + · rw [← (hΦ y hyK).fderiv_eq] + by_cases hyH : y∈H + · rw [indicator_of_mem ((hhalf y hy).mpr hyH),indicator_of_mem hyH,hfg y hy] + rfl + · rw [indicator_of_notMem (fun h => hyH ((hhalf y hy).mp h)),indicator_of_notMem hyH,smul_zero] + · have hz : g y=0 := Function.notMem_support.mp (fun h => hyK (hg h)) + simp only [indicator, hfg y hy] + simp only [hz,mul_zero,smul_eq_mul,ite_self] + rw [heq] + rw [setIntegral_eq_integral_of_forall_compl_eq_zero] + · exact integral_indicator hH + · intro y hy + have hz : g y=0 := Function.notMem_support.mp (fun h => hy (hs (hg h))) + simp only [indicator,hz,mul_zero,ite_self] + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma compact_abs_det_bound {K : Set E} (hK : IsCompact K) {Φ : E → E} + (hΦ : ContDiff ℝ (⊤ : ℕ∞) Φ) : + ∃ C : ℝ, 0≤C ∧ ∀ y∈K, |(fderiv ℝ Φ y).det|≤C := by + have hc : Continuous (fun y => |(fderiv ℝ Φ y).det|) := by + exact (ContinuousLinearMap.continuous_det.comp (hΦ.continuous_fderiv (by simp))).abs + obtain ⟨C,hC⟩ := (hK.image hc).bddAbove + exact ⟨max C 0,le_max_right _ _,fun y hy => (hC (mem_image_of_mem _ hy)).trans (le_max_left _ _)⟩ + +omit [FiniteDimensional ℝ E] in +/-- The physical mass bound used for actual localized stress residuals. -/ +theorem compact_jacobian_mass_bound {K H : Set E} (hK : IsCompact K) + {Φ : E → E} (hΦ : ContDiff ℝ (⊤ : ℕ∞) Φ) : + ∃ C : ℝ, 0≤C ∧ ∀ g : E → ℝ, Continuous g → HasCompactSupport g → + Function.support g⊆K → (∀ y, 0≤g y) → + (∫ y in H, |(fderiv ℝ Φ y).det| *g y ∂μ)≤C*(∫ y in H, g y ∂μ) := by + obtain ⟨C,hC,hb⟩ := compact_abs_det_bound hK hΦ + refine ⟨C,hC,fun g hg hc hs hn => ?_⟩ + have hdet : Continuous (fun y => |(fderiv ℝ Φ y).det|) := + (ContinuousLinearMap.continuous_det.comp (hΦ.continuous_fderiv (by simp))).abs + have hInt : Integrable (fun y => |(fderiv ℝ Φ y).det| *g y) μ := + (hdet.mul hg).integrable_of_hasCompactSupport hc.mul_left + rw [← integral_const_mul] + apply integral_mono hInt.integrableOn ((hg.integrable_of_hasCompactSupport hc).const_mul C).integrableOn + intro y + by_cases hy : y∈K + · exact mul_le_mul_of_nonneg_right (hb y hy) (hn y) + · have hz : g y=0 := Function.notMem_support.mp (fun h => hy (hs h)) + simp only [hz,mul_zero,le_refl] + +end ElasticityBoundaryChartIntegral + +end +end +section +/-! A quantitative physical L2 transfer through an honest boundary chart. +The constants are independent of trial fields and concentration parameters. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryChartMass +open ElasticityBoundaryChartIntegral ElasticityBoundaryFrameInverse + ElasticityBoundaryFrameOperator ElasticityBoundaryRotation +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +def inverseMix (Q : X ≃ₗᵢ[ℝ] X) (g : I → X → ℂ) (i : I) (y : X) : ℂ := + ∑ j, frameMatrix Q i j*g j y + +lemma inverseMix_support (Q : X ≃ₗᵢ[ℝ] X) (g : I → X → ℂ) {K : Set X} + (hg : ∀ j, Function.support (g j)⊆K) (i : I) : + Function.support (inverseMix Q g i)⊆K := by + intro y hy + by_contra hn + apply hy + apply Finset.sum_eq_zero + intro j _ + have hz : g j y=0 := Function.notMem_support.mp (fun h => hn (hg j h)) + rw [hz,mul_zero] + +lemma inverseMix_bound (Q : X ≃ₗᵢ[ℝ] X) (g : I → X → ℂ) (i : I) (y : X) : + ‖inverseMix Q g i y‖^2≤3*∑ j, ‖g j y‖^2 := by + apply (norm_sq_sum_three _).trans + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply Finset.sum_le_sum + intro j _ + rw [norm_mul,mul_pow] + exact mul_le_of_le_one_left (sq_nonneg _) (pow_le_one₀ (norm_nonneg _) (norm_frame_entry Q i j)) + +lemma norm_sq_integrableOn {g : X → ℂ} {K : Set X} (hK : IsCompact K) + (hg : Continuous g) (hs : Function.support g⊆K) (H : Set X) : + IntegrableOn (fun y => ‖g y‖^2) H := by + have hc : HasCompactSupport g := hK.of_isClosed_subset (isClosed_tsupport _) + (closure_minimal hs hK.isClosed) + have hc' : HasCompactSupport (fun y => ‖g y‖^2) := + hc.norm.comp_left (g := fun r : ℝ => r^2) (by norm_num) + exact ((hg.norm.pow 2).integrable_of_hasCompactSupport hc').integrableOn + +/-- Uniform transfer of the exact strong residual. There is no assumed +physical/augmented DN equality and no suppressed determinant. -/ +theorem chart_frame_mass_bound (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + {K Ω H : Set X} (hK : IsCompact K) (hs : K⊆e.source) + (hΩ : MeasurableSet Ω) (hH : MeasurableSet H) + (hhalf : ∀ y∈e.source, e y∈Ω ↔ y∈H) + {Φ : X → X} (hΦs : ContDiff ℝ (⊤ : ℕ∞) Φ) (hΦ : ∀ y∈K, Φ =ᶠ[𝓝 y] e) + (Q : X ≃ₗᵢ[ℝ] X) : + ∃ C : ℝ, 0≤C ∧ ∀ (f g : I → X → ℂ), + (∀ i, Function.support (f i)⊆e '' K) → + (∀ j, Continuous (g j)) → (∀ j, Function.support (g j)⊆K) → + (∀ y∈e.source, ∀ s, (∑ i, frameMatrix Q i s*f i (e y))=g s y) → + ∀ i, (∫ x in Ω, ‖f i x‖^2)≤C*∑ s, (∫ y in H, ‖g s y‖^2) := by + obtain ⟨C,hC,hb⟩ := compact_jacobian_mass_bound (volume : Measure X) (H := H) hK hΦs + refine ⟨C*3,mul_nonneg hC (by norm_num),fun f g hfs hgc hgs hfg i => ?_⟩ + have hscale : ∀ y∈e.source, f i (e y)=inverseMix Q g i y := by + intro y hy + rw [← frame_inverse Q (fun j => f j (e y)) i] + simp only [inverseMix, hfg y hy] + have hcont : Continuous (inverseMix Q g i) := + continuous_finsetSum _ (fun j _ => continuous_const.mul (hgc j)) + have hsup : Function.support (fun y => ‖inverseMix Q g i y‖^2)⊆K := by + intro y hy + apply inverseMix_support Q g hgs i + intro hz + exact hy (by simp [hz]) + have hcc : HasCompactSupport (fun y => ‖inverseMix Q g i y‖^2) := + hK.of_isClosed_subset (isClosed_tsupport _) (closure_minimal hsup hK.isClosed) + have hfsq : Function.support (fun x => ‖f i x‖^2)⊆e '' K := by + intro x hx + apply hfs i + intro hz + exact hx (by simp [hz]) + rw [compact_chart_integral (volume : Measure X) e he hs hΩ hH hhalf hΦ + (fun x => ‖f i x‖^2) (fun y => ‖inverseMix Q g i y‖^2) hfsq hsup + (fun y hy => congrArg (fun z : ℂ => ‖z‖^2) (hscale y hy))] + apply (hb _ (hcont.norm.pow 2) hcc hsup (fun _ => sq_nonneg _)).trans + have hgi (j : I) : IntegrableOn (fun y => ‖g j y‖^2) H := + norm_sq_integrableOn hK (hgc j) (hgs j) H + have hsum : (∫ y in H, ‖inverseMix Q g i y‖^2)≤3*∑ j, (∫ y in H, ‖g j y‖^2) := by + rw [← integral_finsetSum _ (fun j _ => hgi j),← integral_const_mul] + exact integral_mono ((hcont.norm.pow 2).integrable_of_hasCompactSupport hcc).integrableOn + ((integrable_finsetSum _ (fun j _ => hgi j)).const_mul 3) (inverseMix_bound Q g i) + calc + _ ≤ C*(3*∑ j, (∫ y in H, ‖g j y‖^2)) := mul_le_mul_of_nonneg_left hsum hC + _ = _ := by ring + +/-- The coordinate product measure is the actual Euclidean volume, not a +normalization chosen during the argument. -/ +lemma integral_ofLp {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + (g : Y → F) (H : Set Y) : + (∫ x : X in (WithLp.ofLp ⁻¹' H), g x.ofLp)=(∫ y in H, g y) := + (PiLp.volume_preserving_ofLp I).setIntegral_preimage_emb + (MeasurableEquiv.toLp 2 Y).symm.measurableEmbedding g H + +end ElasticityBoundaryChartMass + +end +end +section +/-! The honest physical strong residual has the same quantitative L2 scale as +its fully curved coordinate expression. -/ +noncomputable section +open Set MeasureTheory Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryPhysicalMass +open ElasticityBoundary ElasticityBoundaryPhysicalTransfer ElasticityBoundaryForceSupport + ElasticityBoundaryChartMass ElasticityBoundaryChartOperator ElasticityBoundaryRotation + ElasticityBoundarySmoothOperator ElasticityBoundaryStrongLayer ElasticityBoundaryCutoffLayer + ElasticityBoundaryFrameOperator +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +lemma smooth_strong (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β)) + (u : I → Y → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (strong a b u i) := by + exact (ContDiff.sum (fun α _ => ContDiff.sum (fun j _ => ContDiff.sum (fun β _ => + (ha i α j β).mul (smooth_dpart (smooth_dpart (hu j) β) α))))).add + (ContDiff.sum (fun j _ => ContDiff.sum (fun β _ => (hb i j β).mul (smooth_dpart (hu j) β)))) + +def principal (Q : X ≃ₗᵢ[ℝ] X) (Φ Ψ : X → X) (l m : X → ℂ) : SmoothTensor := + chartPrincipal Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m + +def lower (Q : X ≃ₗᵢ[ℝ] X) (Φ Ψ : X → X) (l m : X → ℂ) : SmoothLower := + chartLower Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m + +/-- The multiplicative constant depends only on the fixed chart, not on the +field, its frequency, or the chosen finite parametrix order. -/ +theorem transferred_mass_bound (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + {K Ω H : Set X} (hK : IsCompact K) (hs : K⊆e.source) + (hΩ : MeasurableSet Ω) (hH : MeasurableSet H) + (hhalf : ∀ y∈e.source, e y∈Ω ↔ y∈H) + {η : X → ℝ} (hηs : tsupport η⊆e.target) (hη : ∀ z∈e '' K, η z=1) + (Q : X ≃ₗᵢ[ℝ] X) (Φ Ψ : X → X) + (hΦs : ContDiff ℝ (⊤ : ℕ∞) Φ) (hΨs : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ =ᶠ[𝓝 y] e) (hΨ : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + : + ∃ C : ℝ, 0≤C ∧ ∀ (u : I → Y → ℂ), + (∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) → + (∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) → + ∀ i, (∫ x in Ω, ‖force l m (transferred e η Q u) i x‖^2)≤ + C*∑ s, (∫ y in H, ‖strong (principal Q Φ Ψ l m) (lower Q Φ Ψ l m) u s y.ofLp‖^2) := by + have ha := smooth_chartPrincipal Q (hΦs.comp PiLp.contDiff_toLp) + (PiLp.contDiff_ofLp.comp hΨs) hl hm + have hb := smooth_chartLower Q (hΦs.comp PiLp.contDiff_toLp) + (PiLp.contDiff_ofLp.comp hΨs) hl hm + obtain ⟨C,hC,hbound⟩ := chart_frame_mass_bound e he hK hs hΩ hH hhalf hΦs hΦ Q + refine ⟨C,hC,fun u hu hus i => ?_⟩ + apply hbound (force l m (transferred e η Q u)) + (fun s y => strong (principal Q Φ Ψ l m) (lower Q Φ Ψ l m) u s y.ofLp) + · exact transferred_force_support e hK hs hηs Q u hus l m + · exact fun s => ((smooth_strong _ _ ha hb u hu s).comp PiLp.contDiff_ofLp).continuous + · exact strong_support_lifted _ _ hK.isClosed u hus + · intro y hy s + exact transferred_force_all e hK hs hηs hη Q u hus hu Φ Ψ hΨs + (fun x hx => (hΦ x hx).eq_of_nhds) hΨ hl hm y hy s + +end ElasticityBoundaryPhysicalMass + +end +end +section +/-! Uniform compactly supported matrix-multiplier mass estimates, for the +true coordinate Jacobian acting on first derivatives of boundary layers. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryCompactMatrix +open ElasticityBoundaryChartMass ElasticityBoundaryFrameInverse +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I + +lemma compact_array_bound {K : Set X} (hK : IsCompact K) (a : I → I → X → ℂ) + (ha : ∀ r j, Continuous (a r j)) : + ∃ B : ℝ, 0≤B ∧ ∀ y∈K, ∀ r j, ‖a r j y‖^2≤B := by + have hc : Continuous (fun y => ∑ r, ∑ j, ‖a r j y‖^2) := + continuous_finsetSum _ (fun r _ => continuous_finsetSum _ (fun j _ => (ha r j).norm.pow 2)) + obtain ⟨B,hB⟩ := (hK.image hc).bddAbove + refine ⟨max B 0,le_max_right _ _,fun y hy r j => ?_⟩ + have h1 : ‖a r j y‖^2≤∑ k, ‖a r k y‖^2 := + Finset.single_le_sum (f := fun k => ‖a r k y‖^2) (fun k _ => sq_nonneg _) (Finset.mem_univ j) + have h2 : (∑ k, ‖a r k y‖^2)≤∑ s, ∑ k, ‖a s k y‖^2 := + Finset.single_le_sum (f := fun s => ∑ k, ‖a s k y‖^2) (fun s _ => Finset.sum_nonneg (fun k _ => sq_nonneg _)) (Finset.mem_univ r) + exact h1.trans (h2.trans ((hB (mem_image_of_mem _ hy)).trans (le_max_left _ _))) + +def row (a : I → I → X → ℂ) (r : I) (v : I → X → ℂ) (y : X) : ℂ := ∑ j, a r j y*v j y + +lemma row_support (a : I → I → X → ℂ) (r : I) (v : I → X → ℂ) {K : Set X} + (hv : ∀ j, Function.support (v j)⊆K) : Function.support (row a r v)⊆K := by + intro y hy + by_contra hn + apply hy + apply Finset.sum_eq_zero + intro j _ + have hz : v j y=0 := Function.notMem_support.mp (fun h => hn (hv j h)) + rw [hz,mul_zero] + +lemma continuous_row (a : I → I → X → ℂ) (ha : ∀ r j, Continuous (a r j)) + (r : I) (v : I → X → ℂ) (hv : ∀ j, Continuous (v j)) : Continuous (row a r v) := + continuous_finsetSum _ (fun j _ => (ha r j).mul (hv j)) + +lemma row_bound (a : I → I → X → ℂ) (r : I) (v : I → X → ℂ) {K : Set X} + (hv : ∀ j, Function.support (v j)⊆K) {B : ℝ} + (hb : ∀ y∈K, ∀ r j, ‖a r j y‖^2≤B) (y : X) : + ‖row a r v y‖^2≤3*B*∑ j, ‖v j y‖^2 := by + by_cases hy : y∈K + · apply (norm_sq_sum_three _).trans + rw [mul_assoc] + apply mul_le_mul_of_nonneg_left _ (by norm_num) + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro j _ + rw [norm_mul,mul_pow] + exact mul_le_mul_of_nonneg_right (hb y hy r j) (sq_nonneg _) + · have hz (j : I) : v j y=0 := Function.notMem_support.mp (fun h => hy (hv j h)) + simp only [row,hz,mul_zero,Finset.sum_const_zero,norm_zero,zero_pow (by omega : 2≠0),le_refl] + +lemma row_mass_bound {K H : Set X} (hK : IsCompact K) (a : I → I → X → ℂ) + (ha : ∀ r j, Continuous (a r j)) {B : ℝ} + (hb : ∀ y∈K, ∀ r j, ‖a r j y‖^2≤B) + (r : I) (v : I → X → ℂ) (hvc : ∀ j, Continuous (v j)) + (hvs : ∀ j, Function.support (v j)⊆K) : + (∫ y in H, ‖row a r v y‖^2)≤3*B*∑ j, (∫ y in H, ‖v j y‖^2) := by + have hi (j : I) := norm_sq_integrableOn hK (hvc j) (hvs j) H + rw [← integral_finsetSum _ (fun j _ => hi j),← integral_const_mul] + exact integral_mono (norm_sq_integrableOn hK (continuous_row a ha r v hvc) (row_support a r v hvs) H) + ((integrable_finsetSum _ (fun j _ => hi j)).const_mul _) (row_bound a r v hvs hb) + +end ElasticityBoundaryCompactMatrix + +end +end +section +/-! Literal first derivatives of the compact physical trial and their exact +rotated chart expression. No trace reconstruction is assumed. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryGradientTransfer +open ElasticityBoundaryPhysicalMass ElasticityBoundaryPhysicalTransfer ElasticityBoundaryForceSupport + ElasticityBoundaryChartMass ElasticityBoundaryChartOperator ElasticityBoundaryFrameOperator + ElasticityBoundaryRotation ElasticityBoundaryFrameInverse ElasticityBoundaryOperatorLocal + ElasticityBoundaryChainRule ElasticityBoundaryStrongLayer ElasticityBoundaryCompactMatrix +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +lemma frame_forward (Q : X ≃ₗᵢ[ℝ] X) (v : I → ℂ) (s : I) : + (∑ i, frameMatrix Q i s*(∑ j, frameMatrix Q i j*v j))=v s := by + simpa only [frameMatrix_symm] using frame_inverse Q.symm v s + +lemma dd_support {f : X → ℂ} {K : Set X} (hK : IsClosed K) + (hf : Function.support f⊆K) (v : X) : Function.support (dd f v)⊆K := by + intro x hx + apply closure_minimal hf hK + exact tsupport_fderiv_apply_subset ℝ v (subset_tsupport _ hx) + +lemma dpart_support_lifted {f : Y → ℂ} {K : Set X} (hK : IsClosed K) + (hf : Function.support (fun z : X => f z.ofLp)⊆K) (α : I) : + Function.support (fun z : X => dpart f α z.ofLp)⊆K := by + have hcl : IsClosed {y : Y | WithLp.toLp 2 y∈K} := + hK.preimage (PiLp.continuous_toLp 2 (fun _ : I => ℝ)) + have hs : Function.support f⊆{y : Y | WithLp.toLp 2 y∈K} := by + intro y hy + exact hf hy + intro x hx + exact closure_minimal hs hcl (tsupport_fderiv_apply_subset ℝ (Pi.single α 1) (subset_tsupport _ hx)) + +def jacobian (Φ Ψ : X → X) (d α : I) (y : X) : ℂ := + (jac (fun z => (Ψ z).ofLp) (basis d) α (Φ y):ℂ) + +lemma smooth_jacobian {Φ Ψ : X → X} (hΦ : ContDiff ℝ (⊤ : ℕ∞) Φ) + (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) (d α : I) : + ContDiff ℝ (⊤ : ℕ∞) (jacobian Φ Ψ d α) := + Complex.ofRealCLM.contDiff.comp ((ElasticityBoundaryChainRule.smooth_jac + (PiLp.contDiff_ofLp.comp hΨ) (basis d) α).comp hΦ) + +lemma gradient_at_support (e : OpenPartialHomeomorph X X) {K : Set X} (hs : K⊆e.source) + {η : X → ℝ} (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + {y : X} (hy : y∈K) (hΦy : Φ y=e y) (hΨy : Ψ =ᶠ[𝓝 (e y)] e.symm) (s d : I) : + (∑ i, frameMatrix Q i s*dd (transferred e η Q u i) (basis d) (e y))= + row (jacobian Φ Ψ) d (fun α z => dpart (u s) α z.ofLp) y := by + have he (i : I) : dd (transferred e η Q u i) (basis d) (e y)= + ∑ j, frameMatrix Q i j*row (jacobian Φ Ψ) d (fun α z => dpart (u j) α z.ofLp) y := by + rw [dd_germ_eq (transferred_germ e hη Q u hus (e.map_source (hs hy)) hΨy i)] + have hum (j : I) : ContDiff ℝ (⊤ : ℕ∞) (fun z => u j (Ψ z).ofLp) := + (hu j).comp (PiLp.contDiff_ofLp.comp hΨ) + rw [dd_mix (frameMatrix Q) _ hum] + apply Finset.sum_congr rfl + intro j _ + apply congrArg (fun z => frameMatrix Q i j*z) + have hps : Differentiable ℝ (fun z => (Ψ z).ofLp) := + (PiLp.contDiff_ofLp.comp hΨ).differentiable (by simp) + rw [dd_comp ((hu j).differentiable (by simp)) hps] + have hid : (Ψ (e y)).ofLp=y.ofLp := by rw [hΨy.eq_of_nhds,e.left_inv (hs hy)] + simp only [hid,row,jacobian,hΦy] + rfl + simp only [he,frame_forward] + +lemma gradient_all (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : IsCompact K) (hs : K⊆e.source) {η : X → ℝ} (hηs : tsupport η⊆e.target) + (hη : ∀ z∈e '' K, η z=1) (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ y=e y) (hΨe : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + {y : X} (hy : y∈e.source) (s d : I) : + (∑ i, frameMatrix Q i s*dd (transferred e η Q u i) (basis d) (e y))= + row (jacobian Φ Ψ) d (fun α z => dpart (u s) α z.ofLp) y := by + by_cases hyK : y∈K + · exact gradient_at_support e hs hη Q u hu hus Φ Ψ hΨ hyK (hΦ y hyK) + (hΨe _ (mem_image_of_mem e hyK)) s d + · have hn : e y∉e '' K := by + rintro ⟨z,hz,he⟩ + exact hyK (e.injOn (hs hz) hy he ▸ hz) + have hz (i : I) : dd (transferred e η Q u i) (basis d) (e y)=0 := + Function.notMem_support.mp (fun h => hn (dd_support (compact_image e hK hs).isClosed + (support_transferred e hηs Q u hus i) (basis d) h)) + have hr : row (jacobian Φ Ψ) d (fun α z => dpart (u s) α z.ofLp) y=0 := + Function.notMem_support.mp (fun h => hyK (row_support _ _ _ + (fun α => dpart_support_lifted hK.isClosed (hus s) α) h)) + simp only [hz,mul_zero,Finset.sum_const_zero,hr] + +end ElasticityBoundaryGradientTransfer + +end +end +section +/-! Uniform physical H1 control through the honest chart. Both the coordinate +Jacobian and the orthogonal output frame are accounted for. -/ +noncomputable section +open Set MeasureTheory Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryGradientMass +open ElasticityBoundaryGradientTransfer ElasticityBoundaryPhysicalTransfer + ElasticityBoundaryChartMass ElasticityBoundaryCompactMatrix ElasticityBoundaryForceSupport + ElasticityBoundaryFrameOperator ElasticityBoundaryRotation ElasticityBoundaryChainRule + ElasticityBoundaryStrongLayer ElasticityBoundaryChartOperator +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +lemma transferred_value (e : OpenPartialHomeomorph X X) {K : Set X} + {η : X → ℝ} (hη : ∀ z∈e '' K, η z=1) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + {y : X} (hy : y∈e.source) (s : I) : + (∑ i, frameMatrix Q i s*transferred e η Q u i (e y))=u s y.ofLp := by + have he (i : I) := (transferred_germ e hη Q u hus (e.map_source hy) + (Filter.EventuallyEq.refl (𝓝 (e y)) e.symm) i).eq_of_nhds + simp only [ElasticityBoundaryFrameOperator.mix,e.left_inv hy] at he + simp only [he,frame_forward] + +variable (e : OpenPartialHomeomorph X X) + (he : ContDiffOn ℝ (⊤ : ℕ∞) e e.source) + {K Ω H : Set X} (hK : IsCompact K) (hs : K⊆e.source) + (hΩ : MeasurableSet Ω) (hH : MeasurableSet H) + (hhalf : ∀ y∈e.source, e y∈Ω ↔ y∈H) + {η : X → ℝ} (hηs : tsupport η⊆e.target) (hη : ∀ z∈e '' K, η z=1) + (Q : X ≃ₗᵢ[ℝ] X) (Φ Ψ : X → X) + (hΦs : ContDiff ℝ (⊤ : ℕ∞) Φ) (hΨs : ContDiff ℝ (⊤ : ℕ∞) Ψ) + (hΦ : ∀ y∈K, Φ =ᶠ[𝓝 y] e) (hΨ : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm) + +include he hK hs hΩ hH hhalf hηs hη hΦs hΦ in +lemma transferred_value_mass : ∃ C : ℝ, 0≤C ∧ ∀ (u : I → Y → ℂ), + (∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) → + (∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) → + ∀ i, (∫ x in Ω, ‖transferred e η Q u i x‖^2)≤ + C*∑ s, (∫ y in H, ‖u s y.ofLp‖^2) := by + obtain ⟨C,hC,hb⟩ := chart_frame_mass_bound e he hK hs hΩ hH hhalf hΦs hΦ Q + refine ⟨C,hC,fun u hu hus i => hb (transferred e η Q u) (fun s y => u s y.ofLp) + (support_transferred e hηs Q u hus) + (fun s => ((hu s).comp PiLp.contDiff_ofLp).continuous) hus ?_ i⟩ + exact fun y hy s => transferred_value e hη Q u hus hy s + +include he hK hs hΩ hH hhalf hηs hη hΦs hΨs hΦ hΨ in +lemma transferred_gradient_mass : ∃ C : ℝ, 0≤C ∧ ∀ (u : I → Y → ℂ), + (∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) → + (∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) → + ∀ i d, (∫ x in Ω, ‖dd (transferred e η Q u i) (basis d) x‖^2)≤ + C*∑ s, ∑ α, (∫ y in H, ‖dpart (u s) α y.ofLp‖^2) := by + obtain ⟨C,hC,hb⟩ := chart_frame_mass_bound e he hK hs hΩ hH hhalf hΦs hΦ Q + have hJ (d α : I) := (smooth_jacobian hΦs hΨs d α).continuous + obtain ⟨B,hB,hbB⟩ := compact_array_bound hK (jacobian Φ Ψ) hJ + refine ⟨C*(3*B),mul_nonneg hC (mul_nonneg (by norm_num) hB),fun u hu hus i d => ?_⟩ + have hds (s α : I) := dpart_support_lifted hK.isClosed (hus s) α + have hdc (s α : I) : Continuous (fun y : X => dpart (u s) α y.ofLp) := + ((ElasticityBoundaryCutoffLayer.smooth_dpart (hu s) α).comp PiLp.contDiff_ofLp).continuous + have h1 := hb (fun i => dd (transferred e η Q u i) (basis d)) + (fun s => row (jacobian Φ Ψ) d (fun α y => dpart (u s) α y.ofLp)) + (fun i => dd_support (compact_image e hK hs).isClosed (support_transferred e hηs Q u hus i) _) + (fun s => continuous_row _ hJ _ _ (hdc s)) (fun s => row_support _ _ _ (hds s)) + (fun y hy s => gradient_all e hK hs hηs hη Q u hu hus Φ Ψ hΨs + (fun y hy => (hΦ y hy).eq_of_nhds) hΨ hy s d) i + apply h1.trans + calc + _ ≤ C*∑ s, (3*B*∑ α, (∫ y in H, ‖dpart (u s) α y.ofLp‖^2)) := + mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun s _ => + row_mass_bound hK _ hJ hbB d _ (hdc s) (hds s))) hC + _ = _ := by rw [← Finset.mul_sum]; ring + +end ElasticityBoundaryGradientMass + +end +end +section +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundary + ElasticityBoundaryInverseGeometry ElasticityBoundaryGradientTransfer + ElasticityBoundaryPhysicalMass ElasticityBoundaryChartOperator + ElasticityBoundaryLayerOperator ElasticityBoundaryPhysicalTransfer +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +structure Setup (Ω : Set X) (x : X) where + e : OpenPartialHomeomorph X X + Q : X ≃ₗᵢ[ℝ] X + at_zero : (0:X)∈e.source + center : e 0=x + smooth : ContDiffOn ℝ (⊤ : ℕ∞) e e.source + inverse_smooth : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target + deriv : HasFDerivAt e Q.toContinuousLinearEquiv.toContinuousLinearMap 0 + inside : ∀ y∈e.source, e y∈Ω ↔ 0 1 + cutoff_support : Function.support (fun z : X => cutoff z.ofLp)⊆K + η : X → ℝ + η_smooth : ContDiff ℝ (⊤ : ℕ∞) η + η_compact : HasCompactSupport η + η_support : tsupport η⊆e.target + η_one : ∀ z∈e '' K, η z=1 + Φ : X → X + Ψ : X → X + Φ_smooth : ContDiff ℝ (⊤ : ℕ∞) Φ + Ψ_smooth : ContDiff ℝ (⊤ : ℕ∞) Ψ + Φ_germ : ∀ y∈K, Φ =ᶠ[𝓝 y] e + Ψ_germ : ∀ z∈e '' K, Ψ =ᶠ[𝓝 z] e.symm + +lemma setup_exists {Ω : Set X} (h : SourceSmoothBoundary Ω) {x : X} (hx : x∈frontier Ω) : + Nonempty (Setup Ω x) := by + obtain ⟨e,Q,he0,hec,he,hi,hQ,hhalf⟩ := h.normalized hx + obtain ⟨χ,hχ,hχc,hχs,hχ0,_⟩ := compact_smooth_cutoff (isCompact_singleton (x := (0:X))) + e.open_source (singleton_subset_iff.mpr he0) + let K := tsupport χ + obtain ⟨η,Φ,Ψ,hη,hηc,hηs,hη1,hΦ,hΦe,hΨ,hΨe⟩ := compact_chart_data e he hi hχc hχs + have hηK : ∀ z∈e '' K, η z=1 := fun z hz => hη1.self_of_nhdsSet hz + have hKη : e '' K⊆tsupport η := by + intro z hz + exact subset_tsupport η (show η z≠0 from by rw [hηK z hz]; exact one_ne_zero) + let χc : Y → ℂ := fun y => (χ (WithLp.toLp 2 y):ℂ) + have hχcs : ContDiff ℝ (⊤ : ℕ∞) χc := + Complex.ofRealCLM.contDiff.comp (hχ.comp PiLp.contDiff_toLp) + have hχcc : HasCompactSupport χc := + (hχc.comp_homeomorph (PiLp.homeomorph 2 (fun _ : I => ℝ)).symm).comp_left + (g := Complex.ofReal) Complex.ofReal_zero + have hχc0 : χc =ᶠ[𝓝 (0:Y)] fun _ => 1 := by + have hh : χ =ᶠ[𝓝 (0:X)] fun _ => 1 := by + change ∀ᶠ z in 𝓝 (0:X), χ z=1 + simpa only [nhdsSet_singleton] using hχ0 + have ht : Tendsto (WithLp.toLp 2 : Y → X) (𝓝 (0:Y)) (𝓝 (0:X)) := + (PiLp.continuous_toLp 2 (fun _ : I => ℝ)).continuousAt + filter_upwards [hh.comp_tendsto ht] with y hy + change χ (WithLp.toLp 2 y)=1 at hy + simp only [χc,hy,Complex.ofReal_one] + refine ⟨{ + e := e, Q := Q, at_zero := he0, center := hec, smooth := he, + inverse_smooth := hi, deriv := hQ, inside := hhalf, K := K, compact := hχc, + source := hχs, cutoff := χc, cutoff_smooth := hχcs, cutoff_compact := hχcc, + cutoff_one := hχc0, cutoff_support := ?_, η := η, η_smooth := hη, + η_compact := hηc, η_support := hηs, η_one := hηK, Φ := Φ, Ψ := Ψ, + Φ_smooth := hΦ, Ψ_smooth := hΨ, Φ_germ := ?_, Ψ_germ := ?_ }⟩ + · intro z hz + apply subset_tsupport χ + intro hc + exact hz (by simp [χc,hc]) + · intro y hy + exact hΦe.filter_mono (nhds_le_nhdsSet hy) + · intro z hz + exact hΨe.filter_mono (nhds_le_nhdsSet (hKη hz)) + +lemma Setup.zero_mem {Ω : Set X} {x : X} (s : Setup Ω x) : (0:X)∈s.K := by + apply s.cutoff_support + change s.cutoff 0≠0 + rw [s.cutoff_one.eq_of_nhds] + exact one_ne_zero + +lemma Setup.Φ_zero {Ω : Set X} {x : X} (s : Setup Ω x) : s.Φ 0=x := + (s.Φ_germ 0 s.zero_mem).eq_of_nhds.trans s.center + +lemma Setup.frozen {Ω : Set X} {x : X} (s : Setup Ω x) (l m : X → ℂ) + (i α j β : I) : principal s.Q s.Φ s.Ψ l m i α j β 0=elasticityTensor (l x) (m x) i α j β := by + unfold ElasticityBoundaryPhysicalMass.principal + rw [chartPrincipal_frozen] + · simp only [WithLp.toLp_zero,s.Φ_zero] + · intro k a + simp only [WithLp.toLp_zero] + rw [(s.Φ_germ 0 s.zero_mem).eq_of_nhds] + exact coordinate_inverse_jac s.e s.smooth s.inverse_smooth s.at_zero s.Q s.deriv + (s.Ψ_germ _ (mem_image_of_mem s.e s.zero_mem)) k a + +end ElasticityBoundaryPacket + +end +end +section +/-! Value mass and the exact identification of Euclidean and product Lebesgue +measure used by the physical boundary packets. -/ +noncomputable section +open Set MeasureTheory +open scoped BigOperators +namespace ElasticityBoundaryPacketMass +open ElasticityBoundaryCutoffParametrix ElasticityBoundaryCutoffLayer + ElasticityBoundaryProfile ElasticityBoundaryParameter ElasticityBoundaryParameterBounds + ElasticityBoundaryOrderBound ElasticityBoundaryCutoffBound ElasticityBoundaryScaling + ElasticityBoundaryWeights ElasticityBoundaryStrongLayer ElasticityBoundaryMVCalculus + ElasticityBoundaryTensorSeries ElasticityBoundaryProfileBounds ElasticityBoundaryMVNormal ElasticityBoundaryActualTower +abbrev I := Fin 3 +abbrev Y := I → ℝ +abbrev X := EuclideanSpace ℝ I + +def H : Set X := {y | 0 (0:ℝ))) + (EuclideanSpace.proj 2).continuous).measurableSet + +lemma integral_ofLp {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + (f : Y → F) : (∫ x in H, f x.ofLp)=∫ y in halfspace, f y := by + rw [← integral_indicator measurable_H,← integral_indicator measurable_halfspace] + have hh (x : X) : H.indicator (fun x => f x.ofLp) x=halfspace.indicator f x.ofLp := rfl + simp_rw [hh] + exact (PiLp.volume_preserving_ofLp I).integral_comp + (PiLp.homeomorph 2 (fun _ : I => ℝ)).measurableEmbedding _ + +/-- The lower-order value term even decays as delta^4. -/ +lemma cutoff_value_bound {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (hc : HasCompactSupport χ) (q : Polynomial W) (j : I) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → + MemLp (cutoffLayer χ q δ j) 2 (volume.restrict halfspace) ∧ + (∫ z in halfspace, ‖cutoffLayer χ q δ j z‖^2)≤C*δ^4 := by + have hb : OrderBound (fun δ y => χ (scale δ y)*value (atParameter (unpack j q) δ) y) 0 := by + simpa only [Nat.zero_add] using (compact_scaled hχ.continuous hc).mul (parameter_bound (unpack j q)) + have hcont (δ : ℝ) : Continuous (fun y => χ (scale δ y)*value (atParameter (unpack j q) δ) y) := + (hχ.continuous.comp (scale δ).continuous).mul (smooth_value _).continuous + obtain ⟨C,hC,hI⟩ := hb.square_mass hcont (by norm_num : (0:ℝ)<2) + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + obtain ⟨hInt,hB⟩ := hI δ hδ hδ1 + have hid (y : Y) : cutoffLayer χ q δ j (scale δ y)= + (1:ℝ) • (envelope δ y*(χ (scale δ y)*value (atParameter (unpack j q) δ) y)) := by + simp only [cutoffLayer,layer,physicalProfile_scale hδ.ne',profile,one_smul] + ring + refine ⟨(memLp_two_iff_integrable_sq_norm + (smooth_cutoffLayer hχ q δ j).continuous.aestronglyMeasurable).mpr + (scaled_envelope_integrable hδ.ne' _ _ _ hid hInt), ?_⟩ + rw [scaled_envelope_mass hδ.ne' _ _ _ hid] + simp only [one_pow,mul_one,Nat.mul_zero,pow_zero] at hB ⊢ + simpa only [mul_comm] using mul_le_mul_of_nonneg_left hB (pow_nonneg hδ.le 4) + +end ElasticityBoundaryPacketMass + +end +end +section +/-! +Exact physical-DN remainder identity needed for boundary high-frequency tests. +All objects below use the physical energy and full trace quotient. +There are no additional main hypotheses; the estimates hold for any trial field. +-/ +noncomputable section +open Set MeasureTheory +namespace Elasticity +variable {Ω : Set X} {lam mu : X → ℝ} + +/-- The variational residual, acting on all zero-trace test fields. -/ +def physicalResidual (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1Hilbert Ω) : H10Hilbert Ω →L[ℝ] ℝ := + (jetEnergy hl hm u.val).comp (H10Hilbert Ω).subtypeL + +/-- The actual physical solution with the same trace as the trial field. -/ +def physicalProjection (u : H1Hilbert Ω) : H1Hilbert Ω := + (h1Equiv Ω).symm (dirichletSolution Ω lam mu (trace Ω (h1Equiv Ω u))) + +lemma physicalProjection_weak (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) : + WeakSolution Ω lam mu (h1Equiv Ω (physicalProjection (lam := lam) (mu := mu) u)) := by + simpa only [physicalProjection, Equiv.apply_symm_apply] using + (dirichletSolution_spec ha hO hB (trace Ω (h1Equiv Ω u))).2 + +lemma physicalProjection_trace (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) : + trace Ω (h1Equiv Ω (physicalProjection (lam := lam) (mu := mu) u)) = + trace Ω (h1Equiv Ω u) := by + simpa only [physicalProjection, Equiv.apply_symm_apply] using + (dirichletSolution_spec ha hO hB (trace Ω (h1Equiv Ω u))).1 + +/-- The exact zero-trace correction, not an assumed quasimode remainder. -/ +def physicalError (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) : H10Hilbert Ω := + ⟨u.val - (physicalProjection (lam := lam) (mu := mu) u).val, + (sameTrace_h1Equiv u _).mp ((trace_eq_iff _ _).mp + (physicalProjection_trace ha hO hB u).symm)⟩ + +lemma error_residual (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u : H1Hilbert Ω) (v : H10Hilbert Ω) : + zeroTraceEnergy (ha.1.boundedCoefficient hO hB) (ha.2.1.boundedCoefficient hO hB) + (physicalError ha hO hB u) v = + physicalResidual (ha.1.boundedCoefficient hO hB) (ha.2.1.boundedCoefficient hO hB) u v := by + let hl := ha.1.boundedCoefficient hO hB + let hm := ha.2.1.boundedCoefficient hO hB + have hw := (weakSolution_h1Equiv hl hm _).mp (physicalProjection_weak ha hO hB u) v + change jetEnergy hl hm (u.val - (physicalProjection (lam := lam) (mu := mu) u).val) + v.val = jetEnergy hl hm u.val v.val + rw [map_sub, sub_apply, hw, sub_zero] + +/-- Coercivity gives a uniform correction bound in the honest Hilbert norm. -/ +theorem physicalError_bound (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) : + ∃ c : ℝ, 0 < c ∧ ∀ u : H1Hilbert Ω, + ‖physicalError ha hO hB u‖ ≤ + ‖physicalResidual (ha.1.boundedCoefficient hO hB) (ha.2.1.boundedCoefficient hO hB) u‖ / c := by + obtain ⟨c, hc, hco⟩ := physical_coercive ha hO hB + refine ⟨c, hc, ?_⟩ + intro u + let e := physicalError ha hO hB u + let r := physicalResidual (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) u + have h1 : c * ‖e‖ * ‖e‖ ≤ r e := by + simpa only [e, r, error_residual] using hco e + have h2 : r e ≤ ‖r‖ * ‖e‖ := (le_abs_self _).trans (r.le_opNorm e) + by_cases he : ‖e‖ = 0 + · change ‖e‖ ≤ ‖r‖ / c + rw [he] + positivity + · have he' : 0 < ‖e‖ := lt_of_le_of_ne (norm_nonneg e) (Ne.symm he) + have hh : c * ‖e‖ ≤ ‖r‖ := (mul_le_mul_iff_left₀ he').mp (h1.trans h2) + exact (le_div_iff₀ hc).mpr (by simpa only [mul_comm] using hh) + +/-- Exact error identity for the bilinear full physical DN pairing. -/ +theorem DN_quasimode_identity (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u v : H1Hilbert Ω) : + energy Ω lam mu (h1Equiv Ω u) (h1Equiv Ω v) - + DN Ω lam mu (trace Ω (h1Equiv Ω u)) (trace Ω (h1Equiv Ω v)) = + zeroTraceEnergy (ha.1.boundedCoefficient hO hB) (ha.2.1.boundedCoefficient hO hB) + (physicalError ha hO hB u) (physicalError ha hO hB v) := by + let hl := ha.1.boundedCoefficient hO hB + let hm := ha.2.1.boundedCoefficient hO hB + let U := physicalProjection (lam := lam) (mu := mu) u + let V := physicalProjection (lam := lam) (mu := mu) v + have hw := (weakSolution_h1Equiv hl hm V).mp (physicalProjection_weak ha hO hB v) + (physicalError ha hO hB u) + have he : jetEnergy hl hm (u.val - U.val) V.val = 0 := by + rw [jetEnergy_symm] + exact hw + rw [DN_eq_energy ha hO hB] + have hU : dirichletSolution Ω lam mu (trace Ω (h1Equiv Ω u)) = h1Equiv Ω U := + (Equiv.apply_symm_apply _ _).symm + rw [hU, ← jetEnergy_eq_energy hl hm u v, ← jetEnergy_eq_energy hl hm U v] + change jetEnergy hl hm u.val v.val - jetEnergy hl hm U.val v.val = + jetEnergy hl hm (u.val - U.val) (v.val - V.val) + have hsub : jetEnergy hl hm (u.val - U.val) v.val = + jetEnergy hl hm u.val v.val - jetEnergy hl hm U.val v.val := by + exact congrArg (fun f : JetH Ω →L[ℝ] ℝ => f v.val) + ((jetEnergy hl hm).map_sub u.val U.val) + rw [map_sub (jetEnergy hl hm (u.val - U.val)) v.val V.val, he, sub_zero] + exact hsub.symm + +/-- The DN error is quadratic in the dual residual, uniformly over all trials. +This bound loses no derivative and uses no pointwise boundary assumptions. -/ +theorem DN_quasimode_bound (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) : + ∃ C : ℝ, 0 < C ∧ ∀ u v : H1Hilbert Ω, + |energy Ω lam mu (h1Equiv Ω u) (h1Equiv Ω v) - + DN Ω lam mu (trace Ω (h1Equiv Ω u)) (trace Ω (h1Equiv Ω v))| ≤ + C * ‖physicalResidual (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) u‖ * + ‖physicalResidual (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) v‖ := by + obtain ⟨c, hc, hbound⟩ := physicalError_bound ha hO hB + refine ⟨c⁻¹, inv_pos.mpr hc, ?_⟩ + intro u v + rw [DN_quasimode_identity ha hO hB, error_residual] + let r := physicalResidual (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) u + let s := physicalResidual (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) v + change |r (physicalError ha hO hB v)| ≤ c⁻¹ * ‖r‖ * ‖s‖ + calc + |r (physicalError ha hO hB v)| ≤ ‖r‖ * ‖physicalError ha hO hB v‖ := + r.le_opNorm _ + _ ≤ ‖r‖ * (‖s‖ / c) := mul_le_mul_of_nonneg_left (hbound v) (norm_nonneg r) + _ = c⁻¹ * ‖r‖ * ‖s‖ := by ring + +/-- An exact quantitative comparison for two actual equal physical DN maps. +The trials may differ, provided their traces agree; the errors are calculated +separately in the two genuine physical systems. -/ +theorem equal_DN_quasimode_bound {l₁ m₁ l₂ m₂ : X → ℝ} + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hDN : DN Ω l₁ m₁ = DN Ω l₂ m₂) : + ∃ C₁ C₂ : ℝ, 0 < C₁ ∧ 0 < C₂ ∧ + ∀ u₁ v₁ u₂ v₂ : H1Hilbert Ω, + trace Ω (h1Equiv Ω u₁) = trace Ω (h1Equiv Ω u₂) → + trace Ω (h1Equiv Ω v₁) = trace Ω (h1Equiv Ω v₂) → + |energy Ω l₁ m₁ (h1Equiv Ω u₁) (h1Equiv Ω v₁) - + energy Ω l₂ m₂ (h1Equiv Ω u₂) (h1Equiv Ω v₂)| ≤ + C₁ * ‖physicalResidual (ha₁.1.boundedCoefficient hO hB) + (ha₁.2.1.boundedCoefficient hO hB) u₁‖ * + ‖physicalResidual (ha₁.1.boundedCoefficient hO hB) + (ha₁.2.1.boundedCoefficient hO hB) v₁‖ + + C₂ * ‖physicalResidual (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB) u₂‖ * + ‖physicalResidual (ha₂.1.boundedCoefficient hO hB) + (ha₂.2.1.boundedCoefficient hO hB) v₂‖ := by + obtain ⟨C₁, hC₁, h₁⟩ := DN_quasimode_bound ha₁ hO hB + obtain ⟨C₂, hC₂, h₂⟩ := DN_quasimode_bound ha₂ hO hB + refine ⟨C₁, C₂, hC₁, hC₂, ?_⟩ + intro u₁ v₁ u₂ v₂ hu hv + have he : DN Ω l₁ m₁ (trace Ω (h1Equiv Ω u₁)) (trace Ω (h1Equiv Ω v₁)) = + DN Ω l₂ m₂ (trace Ω (h1Equiv Ω u₂)) (trace Ω (h1Equiv Ω v₂)) := by + rw [hDN, hu, hv] + have hi := abs_sub_le + (energy Ω l₁ m₁ (h1Equiv Ω u₁) (h1Equiv Ω v₁)) + (DN Ω l₁ m₁ (trace Ω (h1Equiv Ω u₁)) (trace Ω (h1Equiv Ω v₁))) + (energy Ω l₂ m₂ (h1Equiv Ω u₂) (h1Equiv Ω v₂)) + have hb₂ := h₂ u₂ v₂ + rw [← he, abs_sub_comm] at hb₂ + exact hi.trans (add_le_add (h₁ u₁ v₁) hb₂) + +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundaryParametrix.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryParametrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7a7b15caf3cce7e01bf6aabadbb40764337451d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundaryParametrix.lean @@ -0,0 +1,635 @@ +import OAI.MathematicalPhysics.Elasticity.BoundaryCharts + +namespace OAI + +section +/-! Physical displacements obtained from compact chart fields. Their literal +strong Lamé force is the constructed curved-coordinate operator on the +whole trial support, rather than a formally equated auxiliary DN system. -/ +noncomputable section +open Set Filter +open scoped Topology BigOperators +namespace ElasticityBoundaryPhysicalTransfer +open ElasticityBoundary ElasticityBoundaryChainRule ElasticityBoundaryPullback + ElasticityBoundaryPhysicalStrong ElasticityBoundaryRotation ElasticityBoundaryFrameOperator + ElasticityBoundaryChartOperator ElasticityBoundaryOperatorLocal ElasticityBoundaryStrongLayer +abbrev I := Fin 3 +abbrev X := EuclideanSpace ℝ I +abbrev Y := I → ℝ + +def lifted (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) (i : I) (z : X) : ℂ := + mix (frameMatrix Q) u i z.ofLp + +def transferred (e : OpenPartialHomeomorph X X) (η : X → ℝ) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) (i : I) : X → ℂ := + chartTransfer e η (lifted Q u i) + +def force (l m : X → ℂ) (u : I → X → ℂ) : I → X → ℂ := + directional basis (coeff l m) (lower basis l m) u + +lemma smooth_lifted (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (lifted Q u i) := + (smooth_mix (frameMatrix Q) u hu i).comp PiLp.contDiff_ofLp + +lemma smooth_transferred (e : OpenPartialHomeomorph X X) + (hi : ContDiffOn ℝ (⊤ : ℕ∞) e.symm e.target) + {η : X → ℝ} (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hs : tsupport η⊆e.target) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : I) : + ContDiff ℝ (⊤ : ℕ∞) (transferred e η Q u i) := + smooth_chartTransfer e hi hη hs (smooth_lifted Q u hu i) + +lemma support_lifted (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) {K : Set X} + (hu : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) (i : I) : + Function.support (lifted Q u i)⊆K := by + intro x hx + by_contra hn + apply hx + change (∑ j, frameMatrix Q i j*u j x.ofLp)=0 + apply Finset.sum_eq_zero + intro j _ + have hz : u j x.ofLp=0 := Function.notMem_support.mp (fun hh => hn (hu j hh)) + rw [hz,mul_zero] + +lemma support_transferred (e : OpenPartialHomeomorph X X) {η : X → ℝ} + (hs : tsupport η⊆e.target) (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) {K : Set X} + (hu : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) (i : I) : + Function.support (transferred e η Q u i)⊆e '' K := + chartTransfer_support e hs (support_lifted Q u hu i) + +lemma transferred_germ (e : OpenPartialHomeomorph X X) {K : Set X} + {η : X → ℝ} (hη : ∀ z∈e '' K, η z=1) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hu : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) {x : X} (hx : x∈e.target) + {Ψ : X → X} (hΨ : Ψ =ᶠ[𝓝 x] e.symm) (i : I) : + transferred e η Q u i =ᶠ[𝓝 x] + mix (frameMatrix Q) (fun j z => u j (Ψ z).ofLp) i := + chartTransfer_extension_germ e hη (support_lifted Q u hu i) hx hΨ + +lemma chart_force (Q : X ≃ₗᵢ[ℝ] X) (Φ : Y → X) {ψ : X → Y} + (hψ : ContDiff ℝ (⊤ : ℕ∞) ψ) {l m : X → ℂ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (u : I → Y → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (y : Y) (hy : ψ (Φ y)=y) (s : I) : + (∑ i, frameMatrix Q i s*force l m (mix (frameMatrix Q) (fun j x => u j (ψ x))) i (Φ y))= + strong (chartPrincipal Q Φ ψ l m) (chartLower Q Φ ψ l m) u s y := by + calc + _ = ∑ i, frameMatrix Q i s*(∑ k, dd + (stress basis l m (mix (frameMatrix Q) (fun j x => u j (ψ x))) i k) (basis k) (Φ y)) := by + apply Finset.sum_congr rfl + intro i _ + apply congrArg (fun z => frameMatrix Q i s*z) + exact (stress_divergence basis hl hm _ + (fun j => smooth_mix (frameMatrix Q) _ (fun k => (hu k).comp hψ) j) i (Φ y)).symm + _ = _ := physical_chart_operator Q Φ hψ hl hm u hu y hy s + +/-- The exact coordinate operator controls the genuine transferred physical +force at every point of the compact trial support. -/ +theorem transferred_force (e : OpenPartialHomeomorph X X) {K : Set X} + (hK : K⊆e.source) {η : X → ℝ} (hη : ∀ z∈e '' K, η z=1) + (Q : X ≃ₗᵢ[ℝ] X) (u : I → Y → ℂ) + (hus : ∀ j, Function.support (fun z : X => u j z.ofLp)⊆K) + (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) + (Φ Ψ : X → X) (hΨ : ContDiff ℝ (⊤ : ℕ∞) Ψ) + {l m : X → ℂ} (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (y : Y) (hy : WithLp.toLp 2 y∈K) + (hΦy : Φ (WithLp.toLp 2 y)=e (WithLp.toLp 2 y)) + (hΨy : Ψ =ᶠ[𝓝 (e (WithLp.toLp 2 y))] e.symm) (s : I) : + (∑ i, frameMatrix Q i s*force l m (transferred e η Q u) i (e (WithLp.toLp 2 y)))= + strong (chartPrincipal Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) + (chartLower Q (fun z => Φ (WithLp.toLp 2 z)) (fun z => (Ψ z).ofLp) l m) u s y := by + have hx := e.map_source (hK hy) + have hg := transferred_germ e hη Q u hus hx hΨy + have hid : (Ψ (Φ (WithLp.toLp 2 y))).ofLp=y := by + rw [hΦy,hΨy.eq_of_nhds,e.left_inv (hK hy)] + calc + _ = ∑ i, frameMatrix Q i s*force l m + (mix (frameMatrix Q) (fun j z => u j (Ψ z).ofLp)) i (e (WithLp.toLp 2 y)) := by + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun z => frameMatrix Q i s*z) + (directional_germ_eq basis (coeff l m) (lower basis l m) hg i) + _ = _ := by + rw [← hΦy] + exact chart_force Q (fun z => Φ (WithLp.toLp 2 z)) + (PiLp.contDiff_ofLp.comp hΨ) hl hm u hu y hid s + +end ElasticityBoundaryPhysicalTransfer + +end +end +section +/-! Pointwise all-order cutoff bounds. These bounds feed exactly the same +weighted-mass estimate used for the smooth coefficient Taylor error. -/ +noncomputable section +open Set +namespace ElasticityBoundaryCutoffBound +open ElasticityBoundaryOrderBound ElasticityBoundaryScaling +abbrev Y := Fin 3 → ℝ + +lemma bounded_scaled {f : Y → ℂ} {M : ℝ} (hM : 0≤M) (hf : ∀ y, ‖f y‖≤M) : + OrderBound (fun δ y => f (scale δ y)) 0 := by + exact ⟨M,hM,0,fun δ _ _ y => by simpa using hf (scale δ y)⟩ + +lemma compact_scaled {f : Y → ℂ} (hf : Continuous f) (hc : HasCompactSupport f) : + OrderBound (fun δ y => f (scale δ y)) 0 := by + obtain ⟨M,hM⟩ := hf.bounded_above_of_compact_support hc + exact bounded_scaled (le_trans (norm_nonneg (f 0)) (hM 0)) + hM + +/-- A bounded coefficient vanishing on a fixed neighborhood of the base +point yields every power of the true concentration parameter. -/ +theorem flat_scaled {f : Y → ℂ} {M r : ℝ} (hM : 0≤M) (hr : 0 f (scale δ y)) N := by + refine ⟨M/r^N,by positivity,N,fun δ hδ hδ1 y => ?_⟩ + change ‖f (scale δ y)‖ ≤ _ + by_cases hy : ‖scale δ y‖ f (scale δ y)) N := by + obtain ⟨M,hM⟩ := hf.bounded_above_of_compact_support hc + obtain ⟨r,hr,hrf⟩ := Metric.mem_nhds_iff.mp hz + apply flat_scaled (le_trans (norm_nonneg (f 0)) (hM 0)) hr + hM + intro y hy + exact hrf (by simpa only [Metric.mem_ball, dist_zero_right] using hy) + +end ElasticityBoundaryCutoffBound + +end +end +section +/-! Cut off actual boundary fields. The complete product-rule residual is +retained; its derivatives are flat at the concentration point. -/ +noncomputable section +open Set MeasureTheory Filter +open scoped BigOperators Topology +namespace ElasticityBoundaryCutoffLayer +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundarySmoothOperator ElasticityBoundaryProfile + ElasticityBoundaryProfileBounds ElasticityBoundaryScaling ElasticityBoundaryLayerOperator + ElasticityBoundaryWeights ElasticityBoundaryStrongLayer ElasticityBoundaryOrderBound + ElasticityBoundaryCutoffBound +abbrev Y := Fin 3 → ℝ + +lemma smooth_dpart {f : Y → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (j : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (dpart f j) := + (hf.fderiv_right (by simp)).clm_apply contDiff_const + +lemma compact_dpart {f : Y → ℂ} (hf : HasCompactSupport f) (j : Fin 3) : + HasCompactSupport (dpart f j) := HasCompactSupport.fderiv_apply ℝ hf _ + +lemma dpart_eventually_zero {f : Y → ℂ} {c : ℂ} (hf : f =ᶠ[𝓝 (0:Y)] fun _ => c) + (j : Fin 3) : dpart f j =ᶠ[𝓝 (0:Y)] 0 := by + filter_upwards [hf.fderiv (𝕜 := ℝ)] with y hy + simp only [dpart, hy, fderiv_const_apply, zero_apply, Pi.zero_apply] + +lemma dpart_mul {f g : Y → ℂ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (j : Fin 3) (y : Y) : + dpart (fun z => f z*g z) j y=dpart f j y*g y+f y*dpart g j y := by + rw [dpart, fderiv_fun_mul (hf y) (hg y)] + simp only [add_apply, smul_apply, smul_eq_mul, dpart] + ring + +lemma second_mul {f g : Y → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (α β : Fin 3) (y : Y) : + dpart (dpart (fun z => f z*g z) β) α y = + dpart (dpart f β) α y*g y+dpart f β y*dpart g α y+ + (dpart f α y*dpart g β y+f y*dpart (dpart g β) α y) := by + have heq : dpart (fun z => f z*g z) β = fun z => dpart f β z*g z+f z*dpart g β z := + funext (fun z => dpart_mul (hf.differentiable (by simp)) (hg.differentiable (by simp)) β z) + rw [heq, dpart, fderiv_fun_add + (((smooth_dpart hf β).mul hg).differentiable (by simp) y) + ((hf.mul (smooth_dpart hg β)).differentiable (by simp) y), add_apply] + change dpart (fun z => dpart f β z*g z) α y+dpart (fun z => f z*dpart g β z) α y=_ + rw [dpart_mul ((smooth_dpart hf β).differentiable (by simp)) (hg.differentiable (by simp)), + dpart_mul (hf.differentiable (by simp)) ((smooth_dpart hg β).differentiable (by simp))] + +/-- All cutoff product terms, before taking an absolute value or norm. -/ +def cutoffCorrection (a : SmoothTensor) (b : SmoothLower) (χ : Y → ℂ) + (q : Polynomial W) (δ : ℝ) (i : Fin 3) (y : Y) : ℂ := + (δ:ℂ)^2 * (∑ α, ∑ j, ∑ β, a i α j β (scale δ y) * + (dpart χ β (scale δ y)*value (atParameter (PD α (unpack j q)) δ) y+ + dpart χ α (scale δ y)*value (atParameter (PD β (unpack j q)) δ) y)) + + (δ:ℂ)^4 * ((∑ α, ∑ j, ∑ β, a i α j β (scale δ y) * + dpart (dpart χ β) α (scale δ y)*value (atParameter (unpack j q) δ) y)+ + ∑ j, ∑ β, b i j β (scale δ y)*dpart χ β (scale δ y)* + value (atParameter (unpack j q) δ) y) + +def cutoffScaled (a : SmoothTensor) (b : SmoothLower) (χ : Y → ℂ) + (q : Polynomial W) (δ : ℝ) (i : Fin 3) (y : Y) : ℂ := + χ (scale δ y)*scaledOperator a b q δ i y+cutoffCorrection a b χ q δ i y + +lemma correction_order_bound (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, Continuous (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, Continuous (b i j β) ∧ HasCompactSupport (b i j β)) + {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hc : HasCompactSupport χ) + (hχ0 : χ =ᶠ[𝓝 (0:Y)] fun _ => 1) (q : Polynomial W) (N : ℕ) (i : Fin 3) : + OrderBound (fun δ y => cutoffCorrection a b χ q δ i y) N := by + have hd (α : Fin 3) := compact_flat_scaled (smooth_dpart hχ α).continuous + (compact_dpart hc α) (dpart_eventually_zero hχ0 α) N + have hdd (α β : Fin 3) := compact_flat_scaled (smooth_dpart (smooth_dpart hχ β) α).continuous + (compact_dpart (compact_dpart hc β) α) + (dpart_eventually_zero (dpart_eventually_zero hχ0 β) α) N + have hA : OrderBound (fun δ y => ∑ α, ∑ j, ∑ β, a i α j β (scale δ y) * + (dpart χ β (scale δ y)*value (atParameter (PD α (unpack j q)) δ) y+ + dpart χ α (scale δ y)*value (atParameter (PD β (unpack j q)) δ) y)) N := by + apply OrderBound.sum + intro α _ + apply OrderBound.sum + intro j _ + apply OrderBound.sum + intro β _ + simpa only [Nat.add_zero, Nat.zero_add] using + (compact_scaled (ha i α j β).1 (ha i α j β).2).mul + (((hd β).mul (parameter_bound (PD α (unpack j q)))).add + ((hd α).mul (parameter_bound (PD β (unpack j q))))) + have hB : OrderBound (fun δ y => ∑ α, ∑ j, ∑ β, a i α j β (scale δ y) * + dpart (dpart χ β) α (scale δ y)*value (atParameter (unpack j q) δ) y) N := by + apply OrderBound.sum + intro α _ + apply OrderBound.sum + intro j _ + apply OrderBound.sum + intro β _ + simpa only [Nat.add_zero, Nat.zero_add] using + ((compact_scaled (ha i α j β).1 (ha i α j β).2).mul (hdd α β)).mul + (parameter_bound (unpack j q)) + have hC : OrderBound (fun δ y => ∑ j, ∑ β, b i j β (scale δ y)*dpart χ β (scale δ y)* + value (atParameter (unpack j q) δ) y) N := by + apply OrderBound.sum + intro j _ + apply OrderBound.sum + intro β _ + simpa only [Nat.add_zero, Nat.zero_add] using + ((compact_scaled (hb i j β).1 (hb i j β).2).mul (hd β)).mul + (parameter_bound (unpack j q)) + exact (((power_bound 2).mul hA).weaken (by omega)).add + (((power_bound 4).mul (hB.add hC)).weaken (by omega)) + +def cutoffLayer (χ : Y → ℂ) (q : Polynomial W) (δ : ℝ) (j : Fin 3) (z : Y) : ℂ := + χ z*layer q δ j z + +lemma smooth_cutoffLayer {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (q : Polynomial W) (δ : ℝ) (j : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (cutoffLayer χ q δ j) := + hχ.mul (smooth_physicalProfile δ _) + +lemma compact_cutoffLayer {χ : Y → ℂ} (hχ : HasCompactSupport χ) + (q : Polynomial W) (δ : ℝ) (j : Fin 3) : + HasCompactSupport (cutoffLayer χ q δ j) := hχ.mul_right + +lemma first_cutoff {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (q : Polynomial W) (δ : ℝ) (j β : Fin 3) (y : Y) : + dpart (cutoffLayer χ q δ j) β y = + dpart χ β y*layer q δ j y+χ y*dpart (layer q δ j) β y := + dpart_mul (hχ.differentiable (by simp)) ((smooth_physicalProfile δ _).differentiable (by simp)) β y + +lemma second_cutoff {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (q : Polynomial W) (δ : ℝ) (j α β : Fin 3) (y : Y) : + dpart (dpart (cutoffLayer χ q δ j) β) α y = + dpart (dpart χ β) α y*layer q δ j y+dpart χ β y*dpart (layer q δ j) α y+ + (dpart χ α y*dpart (layer q δ j) β y+χ y*dpart (dpart (layer q δ j) β) α y) := + second_mul hχ (smooth_physicalProfile δ _) α β y + +/-- Literal product-rule residual of the localized physical boundary layer. -/ +theorem strong_cutoff_scale (a : SmoothTensor) (b : SmoothLower) + {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (i : Fin 3) (y : Y) : + strong a b (cutoffLayer χ q δ) i (scale δ y) = + ((δ^4)⁻¹:ℝ) • (envelope δ y*cutoffScaled a b χ q δ i y) := by + have hd : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + have hterm (a c cb ca cab u ua ub uab : ℂ) : + a*(cab*(envelope δ y*u)+cb*(((δ:ℂ)^2)⁻¹*(envelope δ y*ua))+ + (ca*(((δ:ℂ)^2)⁻¹*(envelope δ y*ub))+ + c*(((δ:ℂ)^4)⁻¹*(envelope δ y*uab)))) = + ((δ:ℂ)^4)⁻¹*envelope δ y*(c*(a*uab)+(δ:ℂ)^2*(a*(cb*ua+ca*ub))+ + (δ:ℂ)^4*(a*cab*u)) := by field_simp [hd]; ring + have hlower (b c cb u ub : ℂ) : + b*(cb*(envelope δ y*u)+c*(((δ:ℂ)^2)⁻¹*(envelope δ y*ub))) = + ((δ:ℂ)^4)⁻¹*envelope δ y*((δ:ℂ)^2*(c*(b*ub))+(δ:ℂ)^4*(b*cb*u)) := by + field_simp [hd]; ring + simp only [strong, second_cutoff hχ, first_cutoff hχ, second_layer hδ, partial_layer hδ] + simp only [layer, physicalProfile_scale hδ, profile, Complex.real_smul, + Complex.ofReal_inv, Complex.ofReal_pow] + simp_rw [hterm, hlower, mul_add, Finset.sum_add_distrib, ← Finset.mul_sum] + unfold cutoffScaled cutoffCorrection scaledOperator + simp only [mul_add, Finset.sum_add_distrib, ← mul_assoc] + ring + +lemma continuous_cutoffScaled (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, Continuous (a i α j β)) (hb : ∀ i j β, Continuous (b i j β)) + {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (q : Polynomial W) (δ : ℝ) (i : Fin 3) : Continuous (cutoffScaled a b χ q δ i) := by + have hc := hχ.continuous.comp (scale δ).continuous + apply Continuous.add (hc.mul (continuous_scaledOperator a b ha hb q δ i)) + apply Continuous.add + · apply continuous_const.mul + apply continuous_finsetSum + intro α _ + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact ((ha i α j β).comp (scale δ).continuous).mul + ((((smooth_dpart hχ β).continuous.comp (scale δ).continuous).mul (smooth_value _).continuous).add + (((smooth_dpart hχ α).continuous.comp (scale δ).continuous).mul (smooth_value _).continuous)) + · apply continuous_const.mul + apply Continuous.add + · apply continuous_finsetSum + intro α _ + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (((ha i α j β).comp (scale δ).continuous).mul + ((smooth_dpart (smooth_dpart hχ β) α).continuous.comp (scale δ).continuous)).mul + (smooth_value _).continuous + · apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (((hb i j β).comp (scale δ).continuous).mul + ((smooth_dpart hχ β).continuous.comp (scale δ).continuous)).mul (smooth_value _).continuous + +end ElasticityBoundaryCutoffLayer + +end +end +section +/-! Compactly supported actual half-space quasimodes with arbitrary strong +residual order and uniform H1 bounds. All scalings are those of the physical +boundary layer, not a formal symbol expansion. -/ +noncomputable section +open Set MeasureTheory Filter +open scoped BigOperators Topology +namespace ElasticityBoundaryCutoffParametrix +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryParameter ElasticityBoundaryParameterBounds ElasticityBoundaryTensorSeries + ElasticityBoundaryActualTower ElasticityBoundarySmoothOperator ElasticityBoundaryProfile + ElasticityBoundaryProfileBounds ElasticityBoundaryScaling ElasticityBoundaryLayerOperator + ElasticityBoundaryWeights ElasticityBoundaryStrongLayer ElasticityBoundaryOrderBound + ElasticityBoundaryCutoffBound ElasticityBoundaryCutoffLayer +abbrev Y := Fin 3 → ℝ + +lemma scaled_envelope_mass {δ : ℝ} (hδ : δ≠0) (r : ℝ) (F g : Y → ℂ) + (hF : ∀ y, F (scale δ y)=r • (envelope δ y*g y)) : + (∫ z in halfspace, ‖F z‖^2)=δ^4*r^2*∫ y : Y, ‖g y‖^2*weight 2 y := by + rw [integralOn_scale hδ] + simp_rw [hF, norm_smul, mul_pow, Real.norm_eq_abs, sq_abs] + rw [integral_const_mul, integral_envelope_product] + ring + +lemma scaled_envelope_integrable {δ : ℝ} (hδ : δ≠0) (r : ℝ) (F g : Y → ℂ) + (hF : ∀ y, F (scale δ y)=r • (envelope δ y*g y)) + (hg : Integrable (fun y => ‖g y‖^2*weight 2 y)) : + IntegrableOn (fun z => ‖F z‖^2) halfspace := by + rw [← integrableOn_scaled_iff hδ] + simp_rw [hF, norm_smul, mul_pow] + exact ((integrable_envelope_product_iff δ g).mpr hg).const_mul _ + +lemma continuous_strong (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, Continuous (a i α j β)) (hb : ∀ i j β, Continuous (b i j β)) + (u : Fin 3 → Y → ℂ) (hu : ∀ j, ContDiff ℝ (⊤ : ℕ∞) (u j)) (i : Fin 3) : + Continuous (strong a b u i) := by + apply Continuous.add + · apply continuous_finsetSum + intro α _ + apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (ha i α j β).mul (smooth_dpart (smooth_dpart (hu j) β) α).continuous + · apply continuous_finsetSum + intro j _ + apply continuous_finsetSum + intro β _ + exact (hb i j β).mul (smooth_dpart (hu j) β).continuous + +/-- A localized smooth physical trial field with arbitrary small strong force. -/ +theorem finite_cutoff_layer (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β) ∧ HasCompactSupport (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β) ∧ HasCompactSupport (b i j β)) + {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hc : HasCompactSupport χ) + (hχ0 : χ =ᶠ[𝓝 (0:Y)] fun _ => 1) + (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (ha0 : ∀ i α j β, a i α j β 0=elasticityTensor l m i α j β) + (p₀ : W) (h₀ : normal l m p₀=0) (N : ℕ) : + ∃ p : ℕ → W, p 0=p₀ ∧ (∀ n, 0 ?_⟩ + let q := amplitude p (N+1) + have hq := scaledOperator_order_bound a b ha hb q R (N+1) hR i + have ho : OrderBound (fun δ y => cutoffScaled a b χ q δ i y) (N+1+1) := by + have hmain : OrderBound (fun δ y => χ (scale δ y)*scaledOperator a b q δ i y) (N+1+1) := by + simpa only [Nat.zero_add] using (compact_scaled hχ.continuous hc).mul hq + exact hmain.add + (correction_order_bound a b (fun i α j β => ⟨(ha i α j β).1.continuous,(ha i α j β).2⟩) + (fun i j β => ⟨(hb i j β).1.continuous,(hb i j β).2⟩) hχ hc hχ0 q (N+1+1) i) + obtain ⟨C,hC,hI⟩ := ho.square_mass + (fun δ => continuous_cutoffScaled a b (fun i α j β => (ha i α j β).1.continuous) + (fun i j β => (hb i j β).1.continuous) hχ q δ i) (by norm_num : (0:ℝ)<2) + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + obtain ⟨hInt,hBound⟩ := hI δ hδ hδ1 + have hid := strong_cutoff_scale a b hχ hδ.ne' q i + have hcont := continuous_strong a b (fun i α j β => (ha i α j β).1.continuous) + (fun i j β => (hb i j β).1.continuous) (cutoffLayer χ q δ) (smooth_cutoffLayer hχ q δ) i + refine ⟨(memLp_two_iff_integrable_sq_norm hcont.aestronglyMeasurable).mpr + (scaled_envelope_integrable hδ.ne' _ _ _ hid hInt), ?_⟩ + rw [scaled_envelope_mass hδ.ne' _ _ _ hid] + calc + _ ≤ δ^4*((δ^4)⁻¹)^2*(C*δ^(2*(N+1+1))) := mul_le_mul_of_nonneg_left hBound (by positivity) + _ = C*δ^(2*N) := by + rw [show 2*(N+1+1)=4+2*N by omega, pow_add] + field_simp + +/-- Amplitude of a genuine first derivative, including the cutoff derivative. -/ +def firstScaled (χ : Y → ℂ) (q : Polynomial W) (δ : ℝ) (j β : Fin 3) (y : Y) : ℂ := + χ (scale δ y)*value (atParameter (PD β (unpack j q)) δ) y+ + (δ:ℂ)^2*dpart χ β (scale δ y)*value (atParameter (unpack j q) δ) y + +lemma first_scaled_identity {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + {δ : ℝ} (hδ : δ≠0) (q : Polynomial W) (j β : Fin 3) (y : Y) : + dpart (cutoffLayer χ q δ j) β (scale δ y)= + ((δ^2)⁻¹:ℝ) • (envelope δ y*firstScaled χ q δ j β y) := by + rw [first_cutoff hχ, partial_layer hδ] + simp only [layer, physicalProfile_scale hδ, profile, Complex.real_smul, + Complex.ofReal_inv, Complex.ofReal_pow, firstScaled] + have hd : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + field_simp + ring + +lemma first_scaled_bound {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (hc : HasCompactSupport χ) (q : Polynomial W) (j β : Fin 3) : + OrderBound (fun δ y => firstScaled χ q δ j β y) 0 := by + have hmain : OrderBound (fun δ y => χ (scale δ y)*value (atParameter (PD β (unpack j q)) δ) y) 0 := by + simpa only [Nat.zero_add] using (compact_scaled hχ.continuous hc).mul + (parameter_bound (PD β (unpack j q))) + have herr : OrderBound (fun δ y => (δ:ℂ)^2*dpart χ β (scale δ y)*value (atParameter (unpack j q) δ) y) 0 := by + have h := (((power_bound 2).mul (compact_scaled (smooth_dpart hχ β).continuous (compact_dpart hc β))).mul + (parameter_bound (unpack j q))).weaken (show 0≤2+0+0 by omega) + exact h + exact hmain.add herr + +lemma first_scaled_continuous {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (q : Polynomial W) (δ : ℝ) (j β : Fin 3) : Continuous (firstScaled χ q δ j β) := by + exact ((hχ.continuous.comp (scale δ).continuous).mul (smooth_value _).continuous).add + ((continuous_const.mul ((smooth_dpart hχ β).continuous.comp (scale δ).continuous)).mul + (smooth_value _).continuous) + +/-- The actual physical gradient is uniformly L2 bounded; its delta^-2 +factor is canceled by the genuine anisotropic delta^4 volume factor. -/ +theorem cutoff_gradient_bound {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (hc : HasCompactSupport χ) (q : Polynomial W) (j β : Fin 3) : + ∃ C : ℝ, 0≤C ∧ ∀ δ : ℝ, 0<δ → δ≤1 → + MemLp (dpart (cutoffLayer χ q δ j) β) 2 (volume.restrict halfspace) ∧ + (∫ z in halfspace, ‖dpart (cutoffLayer χ q δ j) β z‖^2) ≤ C := by + obtain ⟨C,hC,hI⟩ := (first_scaled_bound hχ hc q j β).square_mass + (fun δ => first_scaled_continuous hχ q δ j β) (by norm_num : (0:ℝ)<2) + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + obtain ⟨hInt,hB⟩ := hI δ hδ hδ1 + have hid := first_scaled_identity hχ hδ.ne' q j β + refine ⟨(memLp_two_iff_integrable_sq_norm + (smooth_dpart (smooth_cutoffLayer hχ q δ j) β).continuous.aestronglyMeasurable).mpr + (scaled_envelope_integrable hδ.ne' _ _ _ hid hInt), ?_⟩ + rw [scaled_envelope_mass hδ.ne' _ _ _ hid] + have hpow : δ^4*((δ^2)⁻¹)^2=1 := by field_simp + rw [hpow,one_mul] + simpa only [Nat.mul_zero,pow_zero,mul_one] using hB + +end ElasticityBoundaryCutoffParametrix + +end +end +section +/-! Local boundary layers for arbitrary smooth coefficients. Auxiliary compact +coefficient extensions are removed on the actual trial support; thus no +artificial compactness or global geometry assumption is imposed on a chart. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryLocalParametrix +open ElasticityBoundaryCutoffParametrix ElasticityBoundaryCutoffLayer + ElasticityBoundaryStrongLayer ElasticityBoundarySmoothOperator + ElasticityBoundaryMVNormal ElasticityBoundaryActualTower ElasticityBoundaryMVTower + ElasticityBoundaryLayerOperator ElasticityBoundaryProfile ElasticityBoundaryOperatorLocal + ElasticityBoundary ElasticityBoundaryProfileBounds +abbrev I := Fin 3 +abbrev Y := I → ℝ + +lemma strong_support (a : SmoothTensor) (b : SmoothLower) {K : Set Y} (hK : IsClosed K) + (u : I → Y → ℂ) (hu : ∀ j, Function.support (u j)⊆K) (i : I) : + Function.support (strong a b u i)⊆K := + directional_support (fun j => Pi.single j 1) a b hK u hu i + +lemma strong_mul_coeff (κ : Y → ℂ) (a : SmoothTensor) (b : SmoothLower) + (u : I → Y → ℂ) (i : I) (y : Y) : + strong (fun i α j β z => κ z*a i α j β z) (fun i j β z => κ z*b i j β z) u i y= + κ y*strong a b u i y := by + simp only [strong,mul_assoc,← Finset.mul_sum,mul_add] + +lemma localize_strong (κ : Y → ℂ) (a : SmoothTensor) (b : SmoothLower) + {K : Set Y} (hK : IsClosed K) (hκ : ∀ y∈K, κ y=1) + (u : I → Y → ℂ) (hu : ∀ j, Function.support (u j)⊆K) : + strong (fun i α j β z => κ z*a i α j β z) (fun i j β z => κ z*b i j β z) u= + strong a b u := by + funext i y + rw [strong_mul_coeff] + by_cases hy : y∈K + · rw [hκ y hy,one_mul] + · have hz : strong a b u i y=0 := Function.notMem_support.mp + (fun h => hy (strong_support a b hK u hu i h)) + rw [hz,mul_zero] + +lemma cutoff_support {χ : Y → ℂ} (q : Polynomial W) (δ : ℝ) (j : I) : + Function.support (cutoffLayer χ q δ j)⊆tsupport χ := by + intro y hy + apply subset_tsupport χ + intro hz + exact hy (by simp [cutoffLayer,hz]) + +lemma compact_coefficients (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β)) + {K : Set Y} (hK : IsCompact K) : + ∃ (a' : SmoothTensor) (b' : SmoothLower), + (∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a' i α j β) ∧ HasCompactSupport (a' i α j β)) ∧ + (∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b' i j β) ∧ HasCompactSupport (b' i j β)) ∧ + (∀ y∈K, ∀ i α j β, a' i α j β y=a i α j β y) ∧ + ∀ u : I → Y → ℂ, (∀ j, Function.support (u j)⊆K) → strong a' b' u=strong a b u := by + obtain ⟨κ,hκ,hκc,_,hκ1,_⟩ := compact_smooth_cutoff hK isOpen_univ (subset_univ _) + let κc : Y → ℂ := fun y => (κ y:ℂ) + have hκcs : ContDiff ℝ (⊤ : ℕ∞) κc := Complex.ofRealCLM.contDiff.comp hκ + have hκcc : HasCompactSupport κc := + hκc.comp_left (g := Complex.ofReal) Complex.ofReal_zero + have hκK (y : Y) (hy : y∈K) : κc y=1 := by + change (κ y:ℂ)=1 + exact_mod_cast hκ1.self_of_nhdsSet y hy + refine ⟨(fun i α j β z => κc z*a i α j β z), + (fun i j β z => κc z*b i j β z),?_,?_,?_,?_⟩ + · exact fun i α j β => ⟨hκcs.mul (ha i α j β),hκcc.mul_right⟩ + · exact fun i j β => ⟨hκcs.mul (hb i j β),hκcc.mul_right⟩ + · intro y hy i α j β + dsimp only + rw [hκK y hy,one_mul] + · exact fun u hu => localize_strong κc a b hK.isClosed hκK u hu + +/-- The true arbitrary-order strong quasimode theorem needs only local +smoothness of the physical pullback. Compact coefficients used during the +Taylor construction leave the literal final operator unchanged. -/ +theorem finite_local_layer (a : SmoothTensor) (b : SmoothLower) + (ha : ∀ i α j β, ContDiff ℝ (⊤ : ℕ∞) (a i α j β)) + (hb : ∀ i j β, ContDiff ℝ (⊤ : ℕ∞) (b i j β)) + {χ : Y → ℂ} (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hc : HasCompactSupport χ) + (hχ0 : χ =ᶠ[𝓝 (0:Y)] fun _ => 1) + (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (ha0 : ∀ i α j β, a i α j β 0=elasticityTensor l m i α j β) + (p₀ : W) (h₀ : normal l m p₀=0) (N : ℕ) : + ∃ p : ℕ → W, p 0=p₀ ∧ (∀ n, 0 ?_⟩ + obtain ⟨C,hC,hB⟩ := hpB i + refine ⟨C,hC,fun δ hδ hδ1 => ?_⟩ + have heq := hEq (cutoffLayer χ (amplitude p (N+1)) δ) (cutoff_support _ δ) + simpa only [heq] using hB δ hδ hδ1 + +end ElasticityBoundaryLocalParametrix + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/BoundarySymbols.lean b/lean/OAI/MathematicalPhysics/Elasticity/BoundarySymbols.lean new file mode 100644 index 0000000000000000000000000000000000000000..9369c75f22cde439ac35c00182b7d258b9f3eaff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/BoundarySymbols.lean @@ -0,0 +1,1134 @@ +import OAI.MathematicalPhysics.Elasticity.BoundaryCalculus + +namespace OAI + +section +/-! Literal anisotropic oscillatory Gaussian boundary profiles, with actual +Frechet derivatives. The small parameter is never assigned a symbolic DN map. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryProfile +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryScaling ElasticityBoundaryWeights +-- All coordinate spaces here carry the standard finite-product Euclidean topology. +abbrev Y := Fin 3 → ℝ + +def phase (δ : ℝ) : MP := C (Complex.I / (δ : ℂ))*X 0-X 2-((X 0)^2+(X 1)^2) +def envelope (δ : ℝ) (y : Y) : ℂ := Complex.exp (value (phase δ) y) +def profile (δ : ℝ) (p : MP) (y : Y) : ℂ := envelope δ y*value p y + +def conjugateDerivative (δ : ℝ) (j : Fin 3) : MP →ₗ[ℂ] MP := + (pderiv j).toLinearMap + LinearMap.mulLeft ℂ (pderiv j (phase δ)) + +lemma conjugateDerivative_apply (δ : ℝ) (j : Fin 3) (p : MP) : + conjugateDerivative δ j p=pderiv j p+pderiv j (phase δ)*p := rfl + +lemma smooth_profile (δ : ℝ) (p : MP) : ContDiff ℝ (⊤ : ℕ∞) (profile δ p) := + ((smooth_value (phase δ)).cexp).mul (smooth_value p) + +/-- Each formal conjugated partial is exactly the Frechet derivative of the +actual function in a coordinate direction. -/ +theorem fderiv_profile_basis (δ : ℝ) (p : MP) (y : Y) (j : Fin 3) : + fderiv ℝ (profile δ p) y (Pi.single j 1)=profile δ (conjugateDerivative δ j p) y := by + have h := ((hasFDerivAt_value (phase δ) y).cexp).mul (hasFDerivAt_value p y) + change HasFDerivAt (profile δ p) _ y at h + rw [h.fderiv] + simp only [add_apply, smul_apply, smul_eq_mul, differential_basis] + simp only [profile, envelope, conjugateDerivative_apply, value_add, value_mul] + ring + +/-- Polynomial dependence on the concentration parameter after multiplying the +physical derivative by delta squared. -/ +def D (δ : ℝ) (j : Fin 3) : MP →ₗ[ℂ] MP := + if j=0 then Complex.I • LinearMap.id + (δ:ℂ) • + ((pderiv 0).toLinearMap-(2:ℂ) • LinearMap.mulLeft ℂ (X 0)) + else if j=1 then (δ:ℂ) • ((pderiv 1).toLinearMap-(2:ℂ) • LinearMap.mulLeft ℂ (X 1)) + else (pderiv 2).toLinearMap-LinearMap.id + +lemma phase_partial (δ : ℝ) (j : Fin 3) : pderiv j (phase δ) = + ![C (Complex.I/(δ:ℂ))-(2:ℂ) • X 0, -(2:ℂ) • X 1, -1] j := by + fin_cases j <;> + simp [phase, smul_eq_C_mul] <;> ring_nf <;> exact (map_natCast C 2).symm + +lemma conjugate_zero (δ : ℝ) (p : MP) : + conjugateDerivative δ 0 p = (Complex.I/(δ:ℂ)) • p + + (pderiv 0 p-(2:ℂ) • (X 0*p)) := by + simp [conjugateDerivative_apply, phase_partial, smul_eq_C_mul] + ring + +lemma conjugate_one (δ : ℝ) (p : MP) : + conjugateDerivative δ 1 p = pderiv 1 p-(2:ℂ) • (X 1*p) := by + simp [conjugateDerivative_apply, phase_partial, smul_eq_C_mul] + ring + +lemma conjugate_two (δ : ℝ) (p : MP) : + conjugateDerivative δ 2 p = pderiv 2 p-p := by + simp [conjugateDerivative_apply, phase_partial, sub_eq_add_neg] + +lemma D_eq_scaled {δ : ℝ} (hδ : δ≠0) (j : Fin 3) (p : MP) : + D δ j p = ((δ^2*scaleFactor δ⁻¹ j : ℝ):ℂ) • conjugateDerivative δ j p := by + have hs : δ^2*scaleFactor δ⁻¹ j = if j=2 then 1 else δ := by + unfold scaleFactor + split_ifs <;> field_simp + rw [hs] + have hc : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + have hid : (δ:ℂ)*(Complex.I/(δ:ℂ))=Complex.I := by field_simp + fin_cases j <;> simp [D, conjugate_zero, conjugate_one, conjugate_two, + smul_add, smul_smul, hid] + +lemma scale_basis (δ : ℝ) (j : Fin 3) : + scale δ (Pi.single j 1)=scaleFactor δ j • (Pi.single j 1) := by + ext i + by_cases hi : i=j + · subst i; simp + · simp [hi] + +def physicalProfile (δ : ℝ) (p : MP) (z : Y) : ℂ := profile δ p (scale δ⁻¹ z) + +lemma smooth_physicalProfile (δ : ℝ) (p : MP) : + ContDiff ℝ (⊤ : ℕ∞) (physicalProfile δ p) := + (smooth_profile δ p).comp (scale δ⁻¹).contDiff + +/-- The true derivative in unscaled boundary coordinates. -/ +theorem fderiv_physicalProfile_basis {δ : ℝ} (hδ : δ≠0) (p : MP) (z : Y) (j : Fin 3) : + fderiv ℝ (physicalProfile δ p) z (Pi.single j 1) = + ((δ^2)⁻¹:ℝ) • physicalProfile δ (D δ j p) z := by + change fderiv ℝ (profile δ p ∘ scale δ⁻¹) z _=_ + rw [fderiv_comp z ((smooth_profile δ p).differentiable (by simp)).differentiableAt + (scale δ⁻¹).differentiableAt, ContinuousLinearMap.fderiv, + ContinuousLinearMap.comp_apply, scale_basis, map_smul, + fderiv_profile_basis, D_eq_scaled hδ] + simp only [physicalProfile, profile, value_smul, Complex.real_smul] + have hc : (δ:ℂ)≠0 := Complex.ofReal_ne_zero.mpr hδ + push_cast + field_simp + +lemma phase_real (δ : ℝ) (y : Y) : (value (phase δ) y).re = -y 2-(y 0)^2-(y 1)^2 := by + simp [phase, value, Complex.div_re, ← Complex.ofReal_pow] + ring + +lemma envelope_norm (δ : ℝ) (y : Y) : + ‖envelope δ y‖=Real.exp (-y 2-(y 0)^2-(y 1)^2) := by + rw [envelope, Complex.norm_exp, phase_real] + +/-- Modulus squared is the proved integrable Gaussian/normal weight; the fast +oscillation does not alter it at any nonzero scale. -/ +theorem profile_square_weight (δ : ℝ) (p : MP) (y : Y) : + ({y : Y | 0 ‖profile δ p y‖^2) y = + ‖value p y‖^2 * weight 2 y := by + by_cases hy : 0 simp only [map_add, Polynomial.coeff_add, hp, hq] + | monomial k a => + rw [coeffMap_monomial] + simp only [Polynomial.coeff_monomial] + split_ifs <;> simp + +lemma coeffMap_C (T : A →ₗ[ℂ] B) (a : A) : + coeffMap T (Polynomial.C a)=Polynomial.C (T a) := by + simpa only [Polynomial.monomial_zero_left] using coeffMap_monomial T 0 a + +lemma coeffMap_X_mul (T : A →ₗ[ℂ] B) (q : Polynomial A) : + coeffMap T (Polynomial.X*q)=Polynomial.X*coeffMap T q := by + apply Polynomial.ext + intro n + cases n <;> simp [coeffMap_coeff, Polynomial.coeff_X_mul] + +lemma coeffMap_monomial_one_mul (T : A →ₗ[ℂ] B) (n : ℕ) (q : Polynomial A) : + coeffMap T (Polynomial.monomial n 1*q)=Polynomial.monomial n 1*coeffMap T q := by + rw [Polynomial.monomial_one_right_eq_X_pow, Polynomial.monomial_one_right_eq_X_pow] + induction n with + | zero => simp + | succ n ih => + rw [pow_succ', mul_assoc, coeffMap_X_mul, ih, ← mul_assoc, ← pow_succ'] + +lemma eval_coeffMap (T : A →ₗ[ℂ] B) (q : Polynomial A) (c : ℂ) : + (coeffMap T q).eval (algebraMap ℂ B c)=T (q.eval (algebraMap ℂ A c)) := by + induction q using Polynomial.induction_on' with + | add p q hp hq => simp only [map_add, Polynomial.eval_add, hp, hq] + | monomial n a => + rw [coeffMap_monomial, Polynomial.eval_monomial, Polynomial.eval_monomial] + simp only [← map_pow] + rw [mul_comm, ← Algebra.smul_def, mul_comm a, ← Algebra.smul_def, T.map_smul] + +/-- The parameter-independent and linear parts of the actual scaled derivative. -/ +def E₀ (j : Fin 3) : MP →ₗ[ℂ] MP := + if j=0 then Complex.I • LinearMap.id else if j=1 then 0 + else (pderiv 2).toLinearMap-LinearMap.id + +def E₁ (j : Fin 3) : MP →ₗ[ℂ] MP := + if j=0 then (pderiv 0).toLinearMap-(2:ℂ) • LinearMap.mulLeft ℂ (X 0) + else if j=1 then (pderiv 1).toLinearMap-(2:ℂ) • LinearMap.mulLeft ℂ (X 1) else 0 + +lemma D_expansion (δ : ℝ) (j : Fin 3) : D δ j = E₀ j+(δ:ℂ) • E₁ j := by + fin_cases j <;> simp [D,E₀,E₁] + +def PD (j : Fin 3) : Polynomial MP →ₗ[ℂ] Polynomial MP := + coeffMap (E₀ j) + (LinearMap.mulLeft ℂ Polynomial.X).comp (coeffMap (E₁ j)) + +lemma PD_apply (j : Fin 3) (q : Polynomial MP) : + PD j q=coeffMap (E₀ j) q+Polynomial.X*coeffMap (E₁ j) q := rfl + +lemma eval_PD (j : Fin 3) (q : Polynomial MP) (δ : ℝ) : + (PD j q).eval (C (δ:ℂ)) = D δ j (q.eval (C (δ:ℂ))) := by + rw [PD_apply, Polynomial.eval_add, Polynomial.eval_mul, Polynomial.eval_X] + have hC : C (δ:ℂ) = algebraMap ℂ MP (δ:ℂ) := rfl + rw [hC, eval_coeffMap, eval_coeffMap, D_expansion] + change _ = E₀ j (q.eval (algebraMap ℂ MP (δ:ℂ))) + + (δ:ℂ) • E₁ j (q.eval (algebraMap ℂ MP (δ:ℂ))) + rw [Algebra.smul_def] + +lemma PD_monomial_one_mul (j : Fin 3) (n : ℕ) (q : Polynomial MP) : + PD j (Polynomial.monomial n 1*q)=Polynomial.monomial n 1*PD j q := by + rw [PD_apply, coeffMap_monomial_one_mul, coeffMap_monomial_one_mul, PD_apply] + ring + +end ElasticityBoundaryParameter + +end +end +section +/-! Flat-boundary calculation for the missing DN-to-all-jets step. +This is ONLY the constant-coefficient principal boundary symbol, not the +boundary localization theorem. Frequency is the unit first tangential +covector, the domain is t>0, and the outward normal is -e₃. +-/ +noncomputable section +open scoped Matrix +namespace ElasticityBoundarySymbol +abbrev F := Fin 3 → ℂ + +def slope (l m : ℂ) (f : F) : F := + ![-((l+m)/(l+3*m))*(f 0+Complex.I*f 2),0, + ((l+m)/(l+3*m))*(f 2-Complex.I*f 0)] + +def solution (l m : ℂ) (f : F) (t : ℝ) : F := + fun j => Complex.exp (-(t : ℂ))*(f j+(t : ℂ)*slope l m f j) + +def first (l m : ℂ) (f : F) (t : ℝ) : F := + fun j => Complex.exp (-(t : ℂ))*(slope l m f j-f j-(t : ℂ)*slope l m f j) + +def second (l m : ℂ) (f : F) (t : ℝ) : F := + fun j => Complex.exp (-(t : ℂ))*(f j+((t : ℂ)-2)*slope l m f j) + +lemma solution_derivative (l m : ℂ) (f : F) (t : ℝ) (j : Fin 3) : + HasDerivAt (fun s => solution l m f s j) (first l m f t j) t := by + have he : HasDerivAt (fun s : ℝ => Complex.exp (-(s : ℂ))) + (-Complex.exp (-(t : ℂ))) t := by + simpa using ((Complex.ofRealCLM.hasDerivAt (x := t)).neg).cexp + convert he.mul ((Complex.ofRealCLM.hasDerivAt.mul_const (slope l m f j)).const_add (f j)) using 1 <;> + first | rfl | (dsimp [solution,first]; ring) + +lemma first_derivative (l m : ℂ) (f : F) (t : ℝ) (j : Fin 3) : + HasDerivAt (fun s => first l m f s j) (second l m f t j) t := by + have he : HasDerivAt (fun s : ℝ => Complex.exp (-(s : ℂ))) + (-Complex.exp (-(t : ℂ))) t := by + simpa using ((Complex.ofRealCLM.hasDerivAt (x := t)).neg).cexp + convert he.mul ((Complex.ofRealCLM.hasDerivAt.mul_const (slope l m f j)).const_sub + (slope l m f j-f j)) using 1 <;> + first | rfl | (dsimp [first,second]; ring) + +@[simp] lemma solution_boundary (l m : ℂ) (f : F) : solution l m f 0=f := by + ext j + simp [solution] + +def fourierDiv (l m : ℂ) (f : F) (t : ℝ) : ℂ := + Complex.I*solution l m f t 0+first l m f t 2 + +def fourierGradDiv (l m : ℂ) (f : F) (t : ℝ) : F := + ![Complex.I*fourierDiv l m f t,0, + Complex.I*first l m f t 0+second l m f t 2] + +def fourierPhysical (l m : ℂ) (f : F) (t : ℝ) : F := + fun j => m*(second l m f t j-solution l m f t j)+(l+m)*fourierGradDiv l m f t j + +/-- Literal Fourier-transformed constant elasticity PDE, not a prescribed +symbol assigned by definition to the DN map. -/ +theorem solution_physical (l m : ℂ) (hp : l+3*m≠0) (f : F) (t : ℝ) : + fourierPhysical l m f t=0 := by + have hq : m*3+l≠0 := by convert hp using 1; ring + ext j + fin_cases j <;> + dsimp [fourierPhysical,fourierGradDiv,fourierDiv,solution,first,second,slope] + all_goals field_simp [hp] + all_goals ring_nf + all_goals norm_num + all_goals field_simp [hq] + all_goals ring + +def traction (l m : ℂ) (f : F) : F := + ![-m*(first l m f 0 0+Complex.I*f 2),-m*first l m f 0 1, + -l*fourierDiv l m f 0-2*m*first l m f 0 2] + +def symbol (l m : ℂ) : Matrix (Fin 3) (Fin 3) ℂ := + !![2*m*(l+2*m)/(l+3*m),0,-Complex.I*(2*m^2/(l+3*m)); + 0,m,0; + Complex.I*(2*m^2/(l+3*m)),0,2*m*(l+2*m)/(l+3*m)] + +theorem traction_symbol (l m : ℂ) (hp : l+3*m≠0) (f : F) : + traction l m f=(symbol l m).mulVec f := by + have hq : l+m*3≠0 := by convert hp using 1; ring + have hq' : m*3+l≠0 := by convert hp using 1; ring + ext j + fin_cases j <;> + simp [traction,first,fourierDiv,solution,slope,symbol,Matrix.mulVec, + dotProduct,Fin.sum_univ_three] + all_goals ring_nf + all_goals field_simp [hq,hq'] + all_goals ring + +/-- Both constants are encoded in the principal symbol. -/ +theorem symbol_injective {l₁ m₁ l₂ m₂ : ℂ} (hm : m₁≠0) + (hp₁ : l₁+3*m₁≠0) (hp₂ : l₂+3*m₂≠0) + (hs : symbol l₁ m₁=symbol l₂ m₂) : l₁=l₂ ∧ m₁=m₂ := by + have he : m₁=m₂ := by + simpa [symbol] using congrArg (fun A : Matrix (Fin 3) (Fin 3) ℂ => A 1 1) hs + subst m₂ + have h02 : -Complex.I*(2*m₁^2/(l₁+3*m₁)) = -Complex.I*(2*m₁^2/(l₂+3*m₁)) := by + simpa [symbol] using congrArg (fun A : Matrix (Fin 3) (Fin 3) ℂ => A 0 2) hs + have hd := (mul_left_cancel₀ (neg_ne_zero.mpr Complex.I_ne_zero) h02) + have hx := (div_eq_div_iff hp₁ hp₂).mp hd + have hn : (2 : ℂ)*m₁^2≠0 := mul_ne_zero two_ne_zero (pow_ne_zero _ hm) + have hden := mul_left_cancel₀ hn hx + exact ⟨(add_right_cancel hden).symm,rfl⟩ + +theorem real_symbol_injective {l₁ m₁ l₂ m₂ : ℝ} + (hm₁ : 0 < m₁) (he₁ : 0<3*l₁+2*m₁) (hm₂ : 0 < m₂) (he₂ : 0<3*l₂+2*m₂) + (hs : symbol (l₁ : ℂ) (m₁ : ℂ)=symbol (l₂ : ℂ) (m₂ : ℂ)) : l₁=l₂ ∧ m₁=m₂ := by + have hp₁ : l₁+3*m₁≠0 := ne_of_gt (by linarith) + have hp₂ : l₂+3*m₂≠0 := ne_of_gt (by linarith) + have hp₁' : (l₁ : ℂ)+3*(m₁ : ℂ)≠0 := by exact_mod_cast hp₁ + have hp₂' : (l₂ : ℂ)+3*(m₂ : ℂ)≠0 := by exact_mod_cast hp₂ + have hh := symbol_injective (Complex.ofReal_ne_zero.mpr hm₁.ne') hp₁' hp₂' hs + exact ⟨Complex.ofReal_injective hh.1,Complex.ofReal_injective hh.2⟩ + +end ElasticityBoundarySymbol + +end +end +section +/-! +Polynomial-amplitude inversion for the frozen physical half-space operator. +This is the arbitrary-order normal ODE used in a boundary-layer construction: +every exp(-t)-polynomial forcing has an exp(-t)-polynomial solution with +zero boundary value. No pseudodifferential solvability is assumed. +-/ +noncomputable section +open Polynomial +namespace ElasticityBoundarySymbol +abbrev P := Polynomial ℂ + +/-- Differentiation of the polynomial amplitude after factoring out exp(-t). -/ +def shiftedDerivative (c : ℂ) : P →ₗ[ℂ] P := + Polynomial.derivative - c • LinearMap.id + +@[simp] lemma shiftedDerivative_apply (c : ℂ) (p : P) : + shiftedDerivative c p = derivative p - c • p := rfl + +lemma polynomial_derivative_surjective : Function.Surjective (Polynomial.derivative : P →ₗ[ℂ] P) := by + intro p + induction p using Polynomial.induction_on' with + | add p q hp hq => + obtain ⟨u, hu⟩ := hp + obtain ⟨v, hv⟩ := hq + exact ⟨u+v, by rw [map_add, hu, hv]⟩ + | monomial n a => + refine ⟨monomial (n+1) (a / (n+1)), ?_⟩ + rw [derivative_monomial_succ, div_mul_cancel₀] + exact Nat.cast_add_one_ne_zero n + +/-- Although differentiation is nilpotent only degree by degree, each nonzero +scalar shift is onto the whole space of finite polynomials. -/ +lemma shiftedDerivative_surjective (c : ℂ) (hc : c≠0) : + Function.Surjective (shiftedDerivative c) := by + have hm : ∀ n : ℕ, ∀ a : ℂ, ∃ q : P, shiftedDerivative c q=monomial n a := by + intro n + induction n with + | zero => + intro a + refine ⟨C (-a/c), ?_⟩ + simp only [shiftedDerivative_apply, derivative_C, zero_sub, smul_C] + rw [← map_neg, monomial_zero_left] + congr 1 + simp only [smul_eq_mul, neg_div, mul_neg, neg_neg] + exact mul_div_cancel₀ a hc + | succ n ih => + intro a + obtain ⟨q, hq⟩ := ih (a * (n+1)) + let p : P := monomial (n+1) a + have hd : derivative p=monomial n (a*(n+1)) := derivative_monomial_succ a n + refine ⟨c⁻¹ • (q-p), ?_⟩ + rw [map_smul, map_sub, hq, ← hd, shiftedDerivative_apply] + rw [sub_sub_cancel, smul_smul, inv_mul_cancel₀ hc, one_smul] + intro p + induction p using Polynomial.induction_on' with + | add p q hp hq => + obtain ⟨u, hu⟩ := hp + obtain ⟨v, hv⟩ := hq + exact ⟨u+v, by rw [map_add, hu, hv]⟩ + | monomial n a => exact hm n a + +/-- The amplitude operator for d²/dt²-1 on exp(-t) times a polynomial. -/ +def laplaceAmplitude : P →ₗ[ℂ] P := + Polynomial.derivative.comp (shiftedDerivative 2) + +lemma laplaceAmplitude_apply (p : P) : + laplaceAmplitude p=derivative (derivative p)-(2 : ℂ) • derivative p := by + simp [laplaceAmplitude, shiftedDerivative] + +lemma laplaceAmplitude_surjective : Function.Surjective laplaceAmplitude := + polynomial_derivative_surjective.comp (shiftedDerivative_surjective 2 two_ne_zero) + +lemma laplaceAmplitude_commutes (p : P) : + laplaceAmplitude (shiftedDerivative 1 p)=shiftedDerivative 1 (laplaceAmplitude p) := by + simp only [laplaceAmplitude_apply, shiftedDerivative_apply, map_sub, map_smul, + one_smul] + module + +lemma shiftedDerivative_sq (p : P) : + shiftedDerivative 1 (shiftedDerivative 1 p)=laplaceAmplitude p+p := by + simp only [laplaceAmplitude_apply, shiftedDerivative_apply, map_sub, one_smul] + module + +/-- The actual Fourier-transformed isotropic physical elasticity operator on +polynomial amplitudes, tangential covector (1,0), inward normal t. -/ +def polynomialPhysical (l m : ℂ) (p : Fin 3 → P) : Fin 3 → P := + ![m • laplaceAmplitude (p 0) - (l+m) • p 0 + + (Complex.I*(l+m)) • shiftedDerivative 1 (p 2), + m • laplaceAmplitude (p 1), + (Complex.I*(l+m)) • shiftedDerivative 1 (p 0) + + (l+2*m) • laplaceAmplitude (p 2) + (l+m) • p 2] + +/-- A polynomial differential adjugate; the middle polarization uses the same +scalar determinant, so all three components admit one uniform construction. -/ +def polynomialAdjugate (l m : ℂ) (p : Fin 3 → P) : Fin 3 → P := + ![(l+2*m) • laplaceAmplitude (p 0) + (l+m) • p 0 - + (Complex.I*(l+m)) • shiftedDerivative 1 (p 2), + (l+2*m) • laplaceAmplitude (p 1), + -(Complex.I*(l+m)) • shiftedDerivative 1 (p 0) + + m • laplaceAmplitude (p 2) - (l+m) • p 2] + +lemma polynomial_adjugate_identity (l m : ℂ) (p : Fin 3 → P) : + polynomialPhysical l m (polynomialAdjugate l m p) = + fun i => (m*(l+2*m)) • laplaceAmplitude (laplaceAmplitude (p i)) := by + funext i + fin_cases i <;> simp [polynomialPhysical, polynomialAdjugate, + laplaceAmplitude_apply, smul_add, smul_sub, smul_smul] + all_goals match_scalars + all_goals ring_nf + all_goals try simp only [Complex.I_sq] + all_goals ring + +/-- No exceptional polynomial degree occurs in the normal recurrence. -/ +theorem polynomialPhysical_surjective (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) : + Function.Surjective (polynomialPhysical l m) := by + intro p + have hq : ∀ i : Fin 3, ∃ q : P, + laplaceAmplitude (laplaceAmplitude q)=(m*(l+2*m))⁻¹ • p i := by + intro i + exact (laplaceAmplitude_surjective.comp laplaceAmplitude_surjective) _ + choose q hq using hq + refine ⟨polynomialAdjugate l m q, ?_⟩ + rw [polynomial_adjugate_identity] + funext i + rw [hq, smul_smul, mul_inv_cancel₀ (mul_ne_zero hm he), one_smul] + +end ElasticityBoundarySymbol + +end +end +section +/-! Zero-Dirichlet inversion, with a literal exponential-polynomial ODE +interpretation. This is the normal component of the boundary quasimode +recursion, not a replacement for variable-coefficient boundary localization. -/ +noncomputable section +open Polynomial +namespace ElasticityBoundarySymbol + +def homogeneousPolynomial (l m : ℂ) (f : F) (i : Fin 3) : P := + C (f i) + X * C (slope l m f i) + +@[simp] lemma homogeneousPolynomial_boundary (l m : ℂ) (f : F) (i : Fin 3) : + (homogeneousPolynomial l m f i).eval 0 = f i := by + simp [homogeneousPolynomial] + +lemma homogeneousPolynomial_physical (l m : ℂ) (hp : l+3*m≠0) (f : F) : + polynomialPhysical l m (homogeneousPolynomial l m f) = 0 := by + have hp' : m*3+l≠0 := by convert hp using 1; ring + have hp'' : l+m*3≠0 := by simpa only [mul_comm] using hp + funext i + apply Polynomial.funext + intro z + fin_cases i <;> + simp [polynomialPhysical, homogeneousPolynomial, laplaceAmplitude_apply, + shiftedDerivative_apply, slope, smul_eq_C_mul] + all_goals field_simp [hp, hp'] + all_goals ring_nf + all_goals simp only [Complex.I_sq] + all_goals field_simp [hp''] + all_goals ring + +lemma polynomialPhysical_sub (l m : ℂ) (p q : Fin 3 → P) : + polynomialPhysical l m (p-q) = polynomialPhysical l m p - polynomialPhysical l m q := by + funext i + fin_cases i <;> simp [polynomialPhysical, smul_sub] <;> abel + +/-- Every polynomial forcing has a decaying-polynomial solution with exactly +zero Dirichlet data. No exceptional normal order is excluded. -/ +theorem polynomialPhysical_zero_boundary_surjective (l m : ℂ) + (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) (p : Fin 3 → P) : + ∃ q : Fin 3 → P, polynomialPhysical l m q = p ∧ ∀ i, (q i).eval 0 = 0 := by + obtain ⟨q, hq⟩ := polynomialPhysical_surjective l m hm he p + let f : F := fun i => (q i).eval 0 + refine ⟨q-homogeneousPolynomial l m f, ?_, ?_⟩ + · rw [polynomialPhysical_sub, hq, homogeneousPolynomial_physical l m hp, sub_zero] + · intro i + simp [f] + +def decayingPolynomial (p : P) (t : ℝ) : ℂ := + Complex.exp (-(t : ℂ)) * p.eval (t : ℂ) + +lemma decayingPolynomial_derivative (p : P) (t : ℝ) : + HasDerivAt (decayingPolynomial p) (decayingPolynomial (shiftedDerivative 1 p) t) t := by + have he : HasDerivAt (fun s : ℝ => Complex.exp (-(s : ℂ))) + (-Complex.exp (-(t : ℂ))) t := by + simpa using ((Complex.ofRealCLM.hasDerivAt (x := t)).neg).cexp + have hp : HasDerivAt (fun s : ℝ => p.eval (s : ℂ)) (p.derivative.eval (t : ℂ)) t := by + exact (p.hasDerivAt (t : ℂ)).comp_ofReal + convert he.mul hp using 1 <;> + first | rfl | (simp [decayingPolynomial, shiftedDerivative_apply]; ring) + +lemma decayingPolynomial_laplace (p : P) (t : ℝ) : + decayingPolynomial (shiftedDerivative 1 (shiftedDerivative 1 p)) t - + decayingPolynomial p t = decayingPolynomial (laplaceAmplitude p) t := by + rw [shiftedDerivative_sq] + simp [decayingPolynomial, mul_add] + +/-- Physical Fourier ODE, retaining the normal derivatives instead of assigning +a boundary symbol by definition. -/ +def decayingPhysical (l m : ℂ) (q : Fin 3 → P) (t : ℝ) : F := + ![m * (decayingPolynomial (shiftedDerivative 1 (shiftedDerivative 1 (q 0))) t - + decayingPolynomial (q 0) t) - (l+m) * decayingPolynomial (q 0) t + + Complex.I*(l+m)*decayingPolynomial (shiftedDerivative 1 (q 2)) t, + m * (decayingPolynomial (shiftedDerivative 1 (shiftedDerivative 1 (q 1))) t - + decayingPolynomial (q 1) t), + Complex.I*(l+m)*decayingPolynomial (shiftedDerivative 1 (q 0)) t + + (l+2*m) * (decayingPolynomial (shiftedDerivative 1 (shiftedDerivative 1 (q 2))) t - + decayingPolynomial (q 2) t) + (l+m)*decayingPolynomial (q 2) t] + +lemma decayingPhysical_eq (l m : ℂ) (q : Fin 3 → P) (t : ℝ) : + decayingPhysical l m q t = fun i => decayingPolynomial (polynomialPhysical l m q i) t := by + funext i + fin_cases i <;> + simp [decayingPhysical, polynomialPhysical, laplaceAmplitude_apply, + decayingPolynomial, smul_eq_C_mul] <;> ring + +/-- Literal ODE solution for each exp(-t)-polynomial forcing, with zero boundary. +Its first and second derivatives are certified above. -/ +theorem decayingPhysical_zero_boundary_surjective (l m : ℂ) + (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) (p : Fin 3 → P) : + ∃ q : Fin 3 → P, + (∀ t, decayingPhysical l m q t = fun i => decayingPolynomial (p i) t) ∧ + ∀ i, decayingPolynomial (q i) 0 = 0 := by + obtain ⟨q, hq, hb⟩ := polynomialPhysical_zero_boundary_surjective l m hm he hp p + exact ⟨q, fun t => by rw [decayingPhysical_eq, hq], + fun i => by simp [decayingPolynomial, hb]⟩ + +end ElasticityBoundarySymbol + +end +end +section +/-! Tangential polynomial amplitudes and the zero-boundary normal right inverse. +These are finite polynomials, rather than a formal assumption that a localized +physical parametrix exists. -/ +noncomputable section +open Polynomial +open scoped BigOperators +namespace ElasticityBoundaryRecursion +open ElasticityBoundarySymbol +abbrev V := Fin 3 → P +abbrev TangentialIndex := Fin 2 →₀ ℕ +abbrev Amplitude := TangentialIndex →₀ V + +def normalOperator (l m : ℂ) : V →ₗ[ℂ] V := + LinearMap.pi + ![m • laplaceAmplitude.comp (LinearMap.proj 0) - (l+m) • LinearMap.proj 0 + + (Complex.I*(l+m)) • (shiftedDerivative 1).comp (LinearMap.proj 2), + m • laplaceAmplitude.comp (LinearMap.proj 1), + (Complex.I*(l+m)) • (shiftedDerivative 1).comp (LinearMap.proj 0) + + (l+2*m) • laplaceAmplitude.comp (LinearMap.proj 2) + (l+m) • LinearMap.proj 2] + +@[simp] lemma normalOperator_apply (l m : ℂ) (p : V) : + normalOperator l m p = polynomialPhysical l m p := by + funext i + fin_cases i <;> rfl + +def boundary : V →ₗ[ℂ] (Fin 3 → ℂ) where + toFun p i := (p i).eval 0 + map_add' p q := by ext i; simp + map_smul' c p := by ext i; simp + +@[simp] lemma boundary_apply (p : V) (i : Fin 3) : boundary p i = (p i).eval 0 := rfl + +def zeroBoundary : Submodule ℂ V := LinearMap.ker boundary + +def zeroNormalOperator (l m : ℂ) : zeroBoundary →ₗ[ℂ] V := + (normalOperator l m).comp zeroBoundary.subtype + +lemma zeroNormalOperator_surjective (l m : ℂ) (hm : m≠0) + (he : l+2*m≠0) (hp : l+3*m≠0) : Function.Surjective (zeroNormalOperator l m) := by + intro p + obtain ⟨q, hq, hb⟩ := polynomialPhysical_zero_boundary_surjective l m hm he hp p + refine ⟨⟨q, by change boundary q=0; ext i; exact hb i⟩, ?_⟩ + simpa only [zeroNormalOperator, LinearMap.comp_apply, Submodule.subtype_apply, + normalOperator_apply] using hq + +/-- A genuine linear right inverse on the zero boundary subspace. -/ +theorem exists_normalInverse (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) : + ∃ S : V →ₗ[ℂ] V, (normalOperator l m).comp S = LinearMap.id ∧ + boundary.comp S = 0 := by + obtain ⟨S, hS⟩ := (zeroNormalOperator l m).exists_rightInverse_of_surjective + (LinearMap.range_eq_top.mpr (zeroNormalOperator_surjective l m hm he hp)) + refine ⟨zeroBoundary.subtype.comp S, ?_, ?_⟩ + · exact hS + · apply LinearMap.ext + intro p + funext i + exact congrFun (S p).property i + +/-- Applying the physical normal operator to each tangential monomial. -/ +def normalAmplitude (l m : ℂ) : Amplitude →ₗ[ℂ] Amplitude := + Finsupp.mapRange.linearMap (normalOperator l m) + +def boundaryAmplitude : Amplitude →ₗ[ℂ] (TangentialIndex →₀ (Fin 3 → ℂ)) := + Finsupp.mapRange.linearMap boundary + +@[simp] lemma normalAmplitude_apply (l m : ℂ) (p : Amplitude) (a : TangentialIndex) : + normalAmplitude l m p a = polynomialPhysical l m (p a) := normalOperator_apply l m (p a) + +@[simp] lemma boundaryAmplitude_apply (p : Amplitude) (a : TangentialIndex) (i : Fin 3) : + boundaryAmplitude p a i = (p a i).eval 0 := rfl + +theorem exists_amplitudeInverse (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) : + ∃ S : Amplitude →ₗ[ℂ] Amplitude, (normalAmplitude l m).comp S=LinearMap.id ∧ + boundaryAmplitude.comp S=0 := by + obtain ⟨S, hS, hB⟩ := exists_normalInverse l m hm he hp + refine ⟨Finsupp.mapRange.linearMap S, ?_, ?_⟩ + · apply LinearMap.ext + intro p + apply Finsupp.ext + intro a + funext i + exact congrFun (LinearMap.congr_fun hS (p a)) i + · apply LinearMap.ext + intro p + apply Finsupp.ext + intro a + funext i + exact congrFun (LinearMap.congr_fun hB (p a)) i + +/-- Successive coefficients of a triangular polynomial-amplitude equation. +The zeroth coefficient is prescribed; all positive coefficients have zero +physical boundary values. -/ +theorem triangular_amplitudes (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (A : ℕ → (Amplitude →ₗ[ℂ] Amplitude)) (hA : A 0=normalAmplitude l m) + (p₀ : Amplitude) (h₀ : normalAmplitude l m p₀=0) : + ∃ p : ℕ → Amplitude, p 0=p₀ ∧ + (∀ n, 0 + if hn : n=0 then p₀ else -S (∑ k : Fin n, + A (k.val+1) (prev (n-(k.val+1)) (by omega))) + have hrec (n : ℕ) : p n = if hn : n=0 then p₀ else -S (∑ k : Fin n, + A (k.val+1) (p (n-(k.val+1)))) := by + conv_lhs => unfold p; rw [Nat.strongRec_eq] + have hzero : p 0=p₀ := by rw [hrec]; simp + refine ⟨p, hzero, ?_, ?_⟩ + · intro n hn + rw [hrec, dite_eq_right (by omega), map_neg] + have hb := LinearMap.congr_fun hB (∑ k : Fin n, A (k.val+1) (p (n-(k.val+1)))) + simpa using congrArg Neg.neg hb + · intro n + have hsum : (∑ k ∈ Finset.range (n+1), A k (p (n-k))) = + A 0 (p n) + ∑ k : Fin n, A (k.val+1) (p (n-(k.val+1))) := by + rw [Finset.sum_range_succ'] + rw [← Fin.sum_univ_eq_sum_range] + simp only [Nat.sub_zero] + exact add_comm _ _ + rw [hsum, hA] + by_cases hn : n=0 + · subst n + simpa [hzero] using h₀ + · rw [hrec, dite_eq_right hn, map_neg] + have hs := LinearMap.congr_fun hS (∑ k : Fin n, A (k.val+1) (p (n-(k.val+1)))) + change normalAmplitude l m (S _) = _ at hs + rw [hs, LinearMap.id_apply, neg_add_cancel] + +end ElasticityBoundaryRecursion + +end +end +section +/-! The normal inverse on literal multivariable polynomial amplitudes. No +identification of formal symbols with physical derivatives is assumed: the +normal operator here consists of the actual formal partial derivatives, whose +evaluations agree with the corresponding Fréchet derivatives. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryMVNormal +open MvPolynomial ElasticityBoundarySymbol ElasticityBoundaryMVCalculus +abbrev W := Fin 3 → MP + +def d : MP →ₗ[ℂ] MP := (pderiv 2).toLinearMap +def shift : MP →ₗ[ℂ] MP := d - LinearMap.id +def lap : MP →ₗ[ℂ] MP := d.comp (d - (2:ℂ) • LinearMap.id) + +@[simp] lemma d_apply (p : MP) : d p=pderiv 2 p := rfl +@[simp] lemma shift_apply (p : MP) : shift p=pderiv 2 p-p := rfl +lemma lap_apply (p : MP) : lap p=pderiv 2 (pderiv 2 p)-(2:ℂ) • pderiv 2 p := by + simp [lap, d] + +def normal (l m : ℂ) : W →ₗ[ℂ] W := + LinearMap.pi + ![m • lap.comp (LinearMap.proj 0) - (l+m) • LinearMap.proj 0 + + (Complex.I*(l+m)) • shift.comp (LinearMap.proj 2), + m • lap.comp (LinearMap.proj 1), + (Complex.I*(l+m)) • shift.comp (LinearMap.proj 0) + + (l+2*m) • lap.comp (LinearMap.proj 2) + (l+m) • LinearMap.proj 2] + +lemma normal_apply (l m : ℂ) (p : W) : normal l m p = + ![m • lap (p 0) - (l+m) • p 0 + (Complex.I*(l+m)) • shift (p 2), + m • lap (p 1), (Complex.I*(l+m)) • shift (p 0) + + (l+2*m) • lap (p 2) + (l+m) • p 2] := by funext i; fin_cases i <;> rfl + +def lift : P →ₐ[ℂ] MP := Polynomial.aeval (X 2) + +@[simp] lemma lift_C (c : ℂ) : lift (Polynomial.C c)=C c := by simp [lift] +@[simp] lemma lift_X : lift Polynomial.X=X 2 := by simp [lift] + +lemma d_lift (p : P) : d (lift p)=lift (Polynomial.derivative p) := by + induction p using Polynomial.induction_on' with + | add p q hp hq => simp only [map_add, hp, hq] + | monomial n c => + simp only [d_apply, lift, Polynomial.aeval_monomial, algebraMap_eq, + Polynomial.derivative_monomial, pderiv_C_mul, pderiv_pow, pderiv_X_self, mul_one, + map_mul, map_natCast] + ring + +lemma pderiv_lift (p : P) : pderiv 2 (lift p)=lift (Polynomial.derivative p) := d_lift p + +lemma shift_lift (p : P) : shift (lift p)=lift (shiftedDerivative 1 p) := by + change d (lift p)-lift p=_ + rw [d_lift, shiftedDerivative_apply, one_smul, map_sub] + +lemma lap_lift (p : P) : lap (lift p)=lift (laplaceAmplitude p) := by + change d (d (lift p)-(2:ℂ) • lift p)=_ + rw [map_sub, map_smul, d_lift, d_lift, laplaceAmplitude_apply, map_sub, map_smul] + +lemma normal_lift (l m : ℂ) (p : Fin 3 → P) : + normal l m (fun i => lift (p i)) = fun i => lift (polynomialPhysical l m p i) := by + funext i + fin_cases i <;> + simp [normal_apply, polynomialPhysical, lap_lift, pderiv_lift] + +lemma shift_mul {b : MP} (hb : pderiv 2 b=0) (p : MP) : + shift (b*p)=b*shift p := by simp only [shift_apply, pderiv_mul, hb, zero_mul, zero_add]; ring +lemma lap_mul {b : MP} (hb : pderiv 2 b=0) (p : MP) : lap (b*p)=b*lap p := by + simp only [lap_apply, pderiv_mul, hb, zero_mul, zero_add, smul_eq_C_mul] + ring +lemma normal_mul (l m : ℂ) {b : MP} (hb : pderiv 2 b=0) (p : W) : + normal l m (fun i => b*p i) = fun i => b*normal l m p i := by + funext i + fin_cases i <;> simp [normal_apply, shift_mul hb, lap_mul hb, smul_eq_C_mul] <;> ring + +/-- The actual restriction of a polynomial to the flat boundary. -/ +def boundaryRing : MP →ₐ[ℂ] MP := MvPolynomial.aeval (fun i => if i=2 then 0 else X i) +def boundary : W →ₗ[ℂ] W := LinearMap.pi (fun i => boundaryRing.toLinearMap.comp (LinearMap.proj i)) +@[simp] lemma boundary_apply (p : W) (i : Fin 3) : boundary p i=boundaryRing (p i) := rfl + +lemma boundary_lift (p : P) : boundaryRing (lift p)=C (p.eval 0) := by + induction p using Polynomial.induction_on with + | C c => simp [lift, boundaryRing] + | add p q hp hq => simp only [map_add, hp, hq, Polynomial.eval_add] + | monomial n c _ => simp [lift, boundaryRing] + +lemma monomial_split (a : Fin 3 →₀ ℕ) (c : ℂ) : + monomial (a.erase 2) 1 * lift (Polynomial.monomial (a 2) c) = monomial a c := by + simp only [lift, Polynomial.aeval_monomial, algebraMap_eq, C_mul_X_pow_eq_monomial, + monomial_mul_monomial, one_mul, Finsupp.erase_add_single] + +lemma normal_zeroBoundary_surjective (l m : ℂ) (hm : m≠0) + (he : l+2*m≠0) (hp : l+3*m≠0) : + Function.Surjective ((normal l m).comp (LinearMap.ker boundary).subtype) := by + let R := LinearMap.range ((normal l m).comp (LinearMap.ker boundary).subtype) + have hmono (i : Fin 3) (a : Fin 3 →₀ ℕ) (c : ℂ) : Pi.single i (monomial a c) ∈ R := by + let p : Fin 3 → P := Pi.single i (Polynomial.monomial (a 2) c) + obtain ⟨q,hq,hb⟩ := polynomialPhysical_zero_boundary_surjective l m hm he hp p + let b : MP := monomial (a.erase 2) 1 + have hbd : pderiv 2 b=0 := by simp [b] + let v : W := fun j => b*lift (q j) + have hv : v ∈ LinearMap.ker boundary := by + change boundary v=0 + funext j + simp [v, boundary_lift, hb] + refine ⟨⟨v,hv⟩, ?_⟩ + change normal l m v = Pi.single i (monomial a c) + rw [show v=(fun j => b*lift (q j)) from rfl, normal_mul l m hbd, normal_lift, hq] + funext j + by_cases hj : j=i + · subst j + simpa [p,b] using monomial_split a c + · simp [p,hj] + have hsingle (i : Fin 3) (p : MP) : Pi.single i p ∈ R := by + induction p using MvPolynomial.induction_on' with + | add p q hp hq => simpa only [Pi.single_add] using R.add_mem hp hq + | monomial a c => exact hmono i a c + intro p + have hsum : (∑ i, Pi.single i (p i)) ∈ R := R.sum_mem (fun i _ => hsingle i (p i)) + have heq : (∑ i, Pi.single i (p i)) = p := by + funext j; simp [Pi.single_apply] + rw [heq] at hsum + exact hsum + +/-- A literal multivariable-polynomial right inverse with zero boundary values. -/ +theorem exists_inverse (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) : + ∃ S : W →ₗ[ℂ] W, (normal l m).comp S=LinearMap.id ∧ boundary.comp S=0 := by + obtain ⟨S,hS⟩ := ((normal l m).comp (LinearMap.ker boundary).subtype).exists_rightInverse_of_surjective + (LinearMap.range_eq_top.mpr (normal_zeroBoundary_surjective l m hm he hp)) + refine ⟨(LinearMap.ker boundary).subtype.comp S,hS,?_⟩ + apply LinearMap.ext + intro p + exact (S p).property + +end ElasticityBoundaryMVNormal + +end +end +section +/-! Actual second derivatives and the literal frozen elasticity operator on +boundary profiles. The coefficients below act on physical tensor indices. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryLayerOperator +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryProfile ElasticityBoundaryMVNormal +abbrev Y := Fin 3 → ℝ + +lemma second_physicalProfile {δ : ℝ} (hδ : δ≠0) (p : MP) (z : Y) (α β : Fin 3) : + fderiv ℝ (fun x => fderiv ℝ (physicalProfile δ p) x (Pi.single β 1)) z (Pi.single α 1) = + ((δ^4)⁻¹:ℝ) • physicalProfile δ (D δ α (D δ β p)) z := by + simp_rw [fderiv_physicalProfile_basis hδ] + change fderiv ℝ (((δ^2)⁻¹:ℝ) • physicalProfile δ (D δ β p)) z _ = _ + rw [fderiv_const_smul ((smooth_physicalProfile δ (D δ β p)).differentiable (by simp)).differentiableAt] + rw [smul_apply, fderiv_physicalProfile_basis hδ, smul_smul] + congr 1 + field_simp + +/-- The isotropic elasticity tensor in fixed (orthonormal) coordinates. -/ +def elasticityTensor (l m : ℂ) (i α j β : Fin 3) : ℂ := + l*(if i=α then 1 else 0)*(if j=β then 1 else 0) + + m*((if i=j then 1 else 0)*(if α=β then 1 else 0) + + (if i=β then 1 else 0)*(if α=j then 1 else 0)) + +/-- A principal tensor acts on actual polynomial conjugated derivatives. -/ +def principal (a : Fin 3 → Fin 3 → Fin 3 → Fin 3 → MP) (δ : ℝ) : W →ₗ[ℂ] W := + LinearMap.pi (fun i => ∑ α, ∑ j, ∑ β, + (LinearMap.mulLeft ℂ (a i α j β)).comp ((D δ α).comp ((D δ β).comp (LinearMap.proj j)))) + +lemma principal_apply (a : Fin 3 → Fin 3 → Fin 3 → Fin 3 → MP) (δ : ℝ) (p : W) (i : Fin 3) : + principal a δ p i = ∑ α, ∑ j, ∑ β, a i α j β * D δ α (D δ β (p j)) := by + simp [principal, LinearMap.sum_apply] + +lemma D_zero (j : Fin 3) (p : MP) : + D 0 j p = ![Complex.I • p, 0, pderiv 2 p-p] j := by + fin_cases j <;> simp [D] + +/-- The leading operator in the high-frequency construction is precisely the +normal operator for which a zero-boundary inverse was proved. -/ +theorem principal_leading_is_normal (l m : ℂ) : + principal (fun i α j β => C (elasticityTensor l m i α j β)) 0 = normal l m := by + apply LinearMap.ext + intro p + funext i + rw [principal_apply, normal_apply] + have hI : (C Complex.I : MP)^2 = -1 := by rw [← map_pow, Complex.I_sq, map_neg, map_one] + have h2 : C (2:ℂ) = (2:MP) := map_natCast C 2 + fin_cases i <;> + simp [Fin.sum_univ_three, elasticityTensor, D_zero, lap_apply, shift_apply, map_sub, + smul_eq_C_mul, map_add, map_mul, + smul_sub, h2] <;> ring_nf <;> simp only [hI] <;> ring + +end ElasticityBoundaryLayerOperator + +end +end +section +/-! The finite-parameter differential operator of the actual Taylor-expanded +divergence tensor. No leading normal operator is stipulated. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryTensorSeries +open MvPolynomial ElasticityBoundaryMVCalculus ElasticityBoundaryMVNormal + ElasticityBoundaryProfile ElasticityBoundaryParameter ElasticityBoundaryLayerOperator + +abbrev Tensor := Fin 3 → Fin 3 → Fin 3 → Fin 3 → Polynomial MP +abbrev Lower := Fin 3 → Fin 3 → Fin 3 → Polynomial MP + +def pack : (Fin 3 → Polynomial MP) →ₗ[ℂ] Polynomial W := + ∑ i, (coeffMap (LinearMap.single ℂ (fun _ : Fin 3 => MP) i)).comp (LinearMap.proj i) + +def unpack (i : Fin 3) : Polynomial W →ₗ[ℂ] Polynomial MP := coeffMap (LinearMap.proj i) + +lemma pack_coeff (q : Fin 3 → Polynomial MP) (n : ℕ) (i : Fin 3) : + (pack q).coeff n i = (q i).coeff n := by + simp [pack, LinearMap.sum_apply, Polynomial.finsetSum_coeff, coeffMap_coeff, + Pi.single_apply] + +lemma unpack_pack (q : Fin 3 → Polynomial MP) (i : Fin 3) : unpack i (pack q)=q i := by + apply Polynomial.ext + intro n + exact pack_coeff q n i + +lemma pack_unpack (q : Polynomial W) : pack (fun i => unpack i q)=q := by + ext n i + simp [pack_coeff,unpack] + +lemma eval_unpack (q : Polynomial W) (δ : ℝ) (i : Fin 3) : + (unpack i q).eval (C (δ:ℂ))=(q.eval (algebraMap ℂ W (δ:ℂ))) i := by + have h := eval_coeffMap (A := W) (B := MP) (LinearMap.proj i) q (δ:ℂ) + change _ = (q.eval (algebraMap ℂ W (δ:ℂ))) i at h + exact h + +lemma eval_pack (q : Fin 3 → Polynomial MP) (δ : ℝ) (i : Fin 3) : + (pack q).eval (algebraMap ℂ W (δ:ℂ)) i=(q i).eval (C (δ:ℂ)) := by + rw [← eval_unpack, unpack_pack] + +lemma pack_monomial_mul (n : ℕ) (q : Fin 3 → Polynomial MP) : + pack (fun i => Polynomial.monomial n 1*q i)=Polynomial.monomial n 1*pack q := by + simp only [pack, LinearMap.sum_apply, LinearMap.comp_apply, LinearMap.proj_apply, + coeffMap_monomial_one_mul, Finset.mul_sum] + +def operator (a : Tensor) (b : Lower) : Polynomial W →ₗ[ℂ] Polynomial W := + pack.comp (LinearMap.pi fun i => + (∑ α, ∑ j, ∑ β, (LinearMap.mulLeft ℂ (a i α j β)).comp + ((PD α).comp ((PD β).comp (unpack j)))) + + ((LinearMap.mulLeft ℂ (Polynomial.X^2)).comp + (∑ j, ∑ β, (LinearMap.mulLeft ℂ (b i j β)).comp ((PD β).comp (unpack j))))) + +lemma unpack_operator (a : Tensor) (b : Lower) (q : Polynomial W) (i : Fin 3) : + unpack i (operator a b q) = + (∑ α, ∑ j, ∑ β, a i α j β * PD α (PD β (unpack j q))) + + Polynomial.X^2 * (∑ j, ∑ β, b i j β * PD β (unpack j q)) := by + simp only [operator, LinearMap.comp_apply, unpack_pack, LinearMap.pi_apply, + LinearMap.add_apply, LinearMap.sum_apply, LinearMap.mulLeft_apply] + +/-- Evaluation reproduces the actual scaled principal part and the delta^2 +lower-order coefficient-gradient part of a divergence-form operator. -/ +theorem eval_operator (a : Tensor) (b : Lower) (q : Polynomial W) (δ : ℝ) (i : Fin 3) : + (operator a b q).eval (algebraMap ℂ W (δ:ℂ)) i = + principal (fun i α j β => (a i α j β).eval (C (δ:ℂ))) δ + (q.eval (algebraMap ℂ W (δ:ℂ))) i + + (δ:ℂ)^2 • (∑ j, ∑ β, (b i j β).eval (C (δ:ℂ)) * + D δ β ((q.eval (algebraMap ℂ W (δ:ℂ))) j)) := by + rw [← eval_unpack, unpack_operator] + simp only [Polynomial.eval_add, Polynomial.eval_finsetSum, Polynomial.eval_mul, + Polynomial.eval_pow, Polynomial.eval_X, eval_PD, eval_unpack, principal_apply, + smul_eq_C_mul, map_pow] + +lemma unpack_monomial_mul (i : Fin 3) (n : ℕ) (q : Polynomial W) : + unpack i (Polynomial.monomial n 1*q)=Polynomial.monomial n 1*unpack i q := by + unfold unpack + exact coeffMap_monomial_one_mul (A := W) (B := MP) (LinearMap.proj i) n q + +lemma unpack_operator_monomial_mul (a : Tensor) (b : Lower) (n : ℕ) + (q : Polynomial W) (i : Fin 3) : + unpack i (operator a b (Polynomial.monomial n 1*q)) = + Polynomial.monomial n 1*unpack i (operator a b q) := by + rw [unpack_operator, unpack_operator] + simp only [unpack_monomial_mul, PD_monomial_one_mul] + have hm (c p : Polynomial MP) : c*(Polynomial.monomial n 1*p)= + Polynomial.monomial n 1*(c*p) := mul_left_comm _ _ _ + simp_rw [hm, ← Finset.mul_sum] + rw [hm, ← mul_add] + +lemma operator_monomial_mul (a : Tensor) (b : Lower) (n : ℕ) (q : Polynomial W) : + operator a b (Polynomial.monomial n 1*q)=Polynomial.monomial n 1*operator a b q := by + rw [← pack_unpack (operator a b (Polynomial.monomial n 1*q))] + simp_rw [unpack_operator_monomial_mul] + rw [pack_monomial_mul, pack_unpack] + +def coefficient (a : Tensor) (b : Lower) (k : ℕ) : W →ₗ[ℂ] W := + ((Polynomial.lcoeff W k).restrictScalars ℂ).comp + ((operator a b).comp (Polynomial.CAlgHom (R := ℂ) (A := W)).toLinearMap) + +lemma coefficient_apply (a : Tensor) (b : Lower) (k : ℕ) (p : W) : + coefficient a b k p = (operator a b (Polynomial.C p)).coeff k := rfl + +/-- Its leading coefficient is exactly the proved normal operator whenever +its actual tensor at the base point is the isotropic physical tensor. -/ +theorem coefficient_zero (a : Tensor) (b : Lower) (l m : ℂ) + (ha : ∀ i α j β, (a i α j β).coeff 0=C (elasticityTensor l m i α j β)) : + coefficient a b 0=normal l m := by + apply LinearMap.ext + intro p + funext i + rw [coefficient_apply, Polynomial.coeff_zero_eq_eval_zero] + have h := eval_operator a b (Polynomial.C p) 0 i + simp only [Complex.ofReal_zero, map_zero, Polynomial.eval_C, + zero_pow (by norm_num : (2:ℕ)≠0), zero_smul, add_zero] at h + simp_rw [← Polynomial.coeff_zero_eq_eval_zero, ha] at h + rw [principal_leading_is_normal] at h + simpa only [Polynomial.coeff_zero_eq_eval_zero] using h + +end ElasticityBoundaryTensorSeries + +end +end +section +/-! Finite-order polynomial amplitudes with an exact high-order residual +factor, for use in actual smooth boundary profiles. -/ +noncomputable section +open scoped BigOperators +namespace ElasticityBoundaryMVTower +open ElasticityBoundaryMVNormal + +/-- Successive coefficients of a triangular polynomial-amplitude equation. +The zeroth coefficient is prescribed; all positive coefficients have zero +physical boundary values. -/ +theorem triangular_amplitudes (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (A : ℕ → (W →ₗ[ℂ] W)) (hA : A 0=normal l m) + (p₀ : W) (h₀ : normal l m p₀=0) : + ∃ p : ℕ → W, p 0=p₀ ∧ + (∀ n, 0 + if hn : n=0 then p₀ else -S (∑ k : Fin n, + A (k.val+1) (prev (n-(k.val+1)) (by omega))) + have hrec (n : ℕ) : p n = if hn : n=0 then p₀ else -S (∑ k : Fin n, + A (k.val+1) (p (n-(k.val+1)))) := by + conv_lhs => unfold p; rw [Nat.strongRec_eq] + have hzero : p 0=p₀ := by rw [hrec]; simp + refine ⟨p, hzero, ?_, ?_⟩ + · intro n hn + rw [hrec, dite_eq_right (by omega), map_neg] + have hb := LinearMap.congr_fun hB (∑ k : Fin n, A (k.val+1) (p (n-(k.val+1)))) + simpa using congrArg Neg.neg hb + · intro n + have hsum : (∑ k ∈ Finset.range (n+1), A k (p (n-k))) = + A 0 (p n) + ∑ k : Fin n, A (k.val+1) (p (n-(k.val+1))) := by + rw [Finset.sum_range_succ'] + rw [← Fin.sum_univ_eq_sum_range] + simp only [Nat.sub_zero] + exact add_comm _ _ + rw [hsum, hA] + by_cases hn : n=0 + · subst n + simpa [hzero] using h₀ + · rw [hrec, dite_eq_right hn, map_neg] + have hs := LinearMap.congr_fun hS (∑ k : Fin n, A (k.val+1) (p (n-(k.val+1)))) + change normal l m (S _) = _ at hs + rw [hs, LinearMap.id_apply, neg_add_cancel] + +/-- The literal residual polynomial of two finite operator/amplitude series. -/ +def residualPolynomial (A : ℕ → W →ₗ[ℂ] W) (p : ℕ → W) (K N : ℕ) : Polynomial W := + ∑ k ∈ Finset.range (K+1), ∑ n ∈ Finset.range (N+1), + Polynomial.monomial (k+n) (A k (p n)) + +lemma residual_coefficient (A : ℕ → W →ₗ[ℂ] W) (p : ℕ → W) {K N d : ℕ} + (hK : d≤K) (hN : d≤N) : + (residualPolynomial A p K N).coeff d = + ∑ k ∈ Finset.range (d+1), A k (p (d-k)) := by + classical + simp only [residualPolynomial, Polynomial.finsetSum_coeff, Polynomial.coeff_monomial] + have hi (k : ℕ) : (∑ n ∈ Finset.range (N+1), if k+n=d then A k (p n) else 0) = + if k≤d then A k (p (d-k)) else 0 := by + by_cases hk : k≤d + · rw [ite_eq_left hk] + rw [Finset.sum_eq_single (d-k)] + · simp [Nat.add_sub_of_le hk] + · intro n _ hn + rw [ite_eq_right (by omega)] + · intro hn + exact False.elim (hn (Finset.mem_range.mpr (by omega))) + · rw [ite_eq_right hk] + apply Finset.sum_eq_zero + intro n _ + rw [ite_eq_right (by omega)] + simp_rw [hi] + have hs : (∑ k ∈ Finset.range (K+1), if k≤d then A k (p (d-k)) else 0) = + ∑ k ∈ Finset.range (d+1), if k≤d then A k (p (d-k)) else 0 := by + symm + apply Finset.sum_subset (Finset.range_mono (by omega)) + intro k _ hk + rw [ite_eq_right (by simp only [Finset.mem_range] at hk; omega)] + rw [hs] + apply Finset.sum_congr rfl + intro k hk + rw [ite_eq_left (by simp only [Finset.mem_range] at hk; omega)] + +/-- All orders up to N cancel as an exact polynomial identity, leaving an +actual finite polynomial times delta^(N+1), not just a formal asymptotic. -/ +theorem residual_high_order_factor (A : ℕ → W →ₗ[ℂ] W) (p : ℕ → W) {K N : ℕ} + (hKN : N≤K) + (hc : ∀ n, ∑ k ∈ Finset.range (n+1), A k (p (n-k))=0) : + ∃ R : Polynomial W, residualPolynomial A p K N=Polynomial.X^(N+1)*R := by + have hd : Polynomial.X^(N+1) ∣ residualPolynomial A p K N := by + apply Polynomial.X_pow_dvd_iff.mpr + intro d hd + rw [residual_coefficient A p (by omega) (by omega), hc] + obtain ⟨R,hR⟩ := hd + exact ⟨R,hR⟩ + +/-- A finite correction family for every prescribed leading physical normal +solution, with zero boundary corrections and exact arbitrary-order cancellation. -/ +theorem finite_physical_amplitudes (l m : ℂ) (hm : m≠0) (he : l+2*m≠0) (hp : l+3*m≠0) + (A : ℕ → W →ₗ[ℂ] W) (hA : A 0=normal l m) + (p₀ : W) (h₀ : normal l m p₀=0) (N K : ℕ) (hKN : N≤K) : + ∃ (p : ℕ → W) (R : Polynomial W), p 0=p₀ ∧ + (∀ n, 0 (y 2)^n*weight 2 y) := by + apply (integrable_coordinate_moment (by norm_num : (0:ℝ)<2) 2 n).congr + exact Filter.Eventually.of_forall (fun y => by + dsimp only + by_cases hy : 0 1,by norm_num⟩ + exact (ho.measure_pos volume hne).trans_le (measure_mono (fun y hy => + (mul_pos (pow_pos hy _) (weight_pos 2 hy)).ne')) + +lemma normalMoment_complex (n : ℕ) : + (∫ y : Y, weight 2 y • (y 2:ℂ)^n)=(normalMoment n:ℂ) := by + simp only [Complex.real_smul,← Complex.ofReal_pow,← Complex.ofReal_mul] + rw [integral_complex_ofReal] + congr 1 + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun y => mul_comm _ _) + +end ElasticityBoundaryWeights + +end +end +section +/-! The finite leading packet pairing is precisely the integrated Hermitian +isotropic density, against a strictly positive normal Gaussian moment. -/ +noncomputable section +open Set Filter MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryMVNormal ElasticityBoundaryMVCalculus + ElasticityBoundaryWeights ElasticityBoundaryOrderBound ElasticityBoundaryProfileBounds + ElasticityBoundaryLimit ElasticityBoundaryParameter ElasticityBoundaryEnergyLimit + ElasticityBoundaryCutoffBound + +lemma polynomial_bound (p : MP) : OrderBound (fun _ y => value p y) 0 := by + obtain ⟨A,hA,n,h⟩ := polynomialGrowth p + exact ⟨A,hA,n,fun _ _ _ y => by simpa using h y⟩ + +lemma weighted_integrable {f : Y → ℂ} (hf : Continuous f) + (hF : OrderBound (fun _ => f) 0) {b : ℝ} (hb : 0 weight b y • f y) := by + obtain ⟨A,hA,n,hB⟩ := hF + let g : Y → ℝ := fun y => (A*2^n)*(weight b y+‖y‖^n*weight b y) + have hg : Integrable g := ((integrable_weight hb).add (integrable_norm_moment hb n)).const_mul _ + apply hg.mono' ((measurable_weight b).aestronglyMeasurable.smul hf.aestronglyMeasurable) + exact Eventually.of_forall (fun y => by + change ‖weight b y • f y‖≤g y + rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg (weight_nonneg b y)] + have h := hB 1 (by norm_num) le_rfl y + simp only [pow_zero,mul_one] at h + calc + _ ≤ weight b y*(A*(1+‖y‖)^n) := mul_le_mul_of_nonneg_left h (weight_nonneg b y) + _ ≤ weight b y*(A*(2^n*(1+‖y‖^n))) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (one_add_pow_le (norm_nonneg y) n) hA) + (weight_nonneg b y) + _ = g y := by dsimp [g]; ring) + +lemma frozen_integrable (n : ℕ) (c : ℂ) (p q : MP) : + Integrable (fun y : Y => weight 2 y • ((y 2:ℂ)^n*c*value p y*star (value q y))) := by + apply weighted_integrable + · exact ((((Complex.continuous_ofReal.comp (continuous_apply 2)).pow n).mul continuous_const).mul + (smooth_value p).continuous).mul (smooth_value q).continuous.star + · have hc : OrderBound (fun (_ : ℝ) (_ : Y) => c) 0 := by + exact ⟨‖c‖,norm_nonneg _,0,fun _ _ _ _ => by simp⟩ + exact (((normal_power_bound n).mul hc).mul (polynomial_bound p)).mul (OrderBound.conj (polynomial_bound q)) + · norm_num + +lemma frozenPair_integral (n : ℕ) (a : I → I → I → I → ℂ) (p q : W) : + frozenPair n a p q=∫ y : Y, weight 2 y • ((y 2:ℂ)^n* + tensorDensity a (fun i α => value (E₀ α (p i)) y) (fun j β => value (E₀ β (q j)) y)) := by + have hi (i α j β : I) := frozen_integrable n (a i α j β) (E₀ α (p i)) (E₀ β (q j)) + have hfun (y : Y) : weight 2 y • ((y 2:ℂ)^n* + tensorDensity a (fun i α => value (E₀ α (p i)) y) (fun j β => value (E₀ β (q j)) y))= + ∑ i, ∑ α, ∑ j, ∑ β, weight 2 y • ((y 2:ℂ)^n*a i α j β* + value (E₀ α (p i)) y*star (value (E₀ β (q j)) y)) := by + simp only [tensorDensity,Finset.mul_sum,Finset.smul_sum,mul_assoc] + simp_rw [hfun] + unfold frozenPair + symm + rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun α _ => + integrable_finsetSum _ (fun j _ => integrable_finsetSum _ (fun β _ => hi i α j β))))] + apply Finset.sum_congr rfl; intro i _ + rw [integral_finsetSum _ (fun α _ => integrable_finsetSum _ (fun j _ => + integrable_finsetSum _ (fun β _ => hi i α j β)))] + apply Finset.sum_congr rfl; intro α _ + rw [integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun β _ => hi i α j β))] + apply Finset.sum_congr rfl; intro j _ + exact integral_finsetSum _ (fun β _ => hi i α j β) + +lemma frozenPair_constant (n : ℕ) (a : I → I → I → I → ℂ) (p q : W) (c : ℂ) + (h : ∀ y : Y, tensorDensity a (fun i α => value (E₀ α (p i)) y) + (fun j β => value (E₀ β (q j)) y)=c) : + frozenPair n a p q=(normalMoment n:ℂ)*c := by + rw [frozenPair_integral] + simp only [h,Complex.real_smul,← mul_assoc] + rw [integral_mul_const] + congr 1 + exact normalMoment_complex n + +end ElasticityBoundaryPacket + +end +end +section +/-! Exact transverse and longitudinal frozen physical tests. Both are genuine +solutions of the normal isotropic elasticity equation. -/ +noncomputable section +open scoped BigOperators Matrix +namespace ElasticityBoundaryLeading +open Elasticity ElasticityBoundarySymbol ElasticityBoundaryMVNormal + ElasticityBoundaryMVCalculus ElasticityBoundaryParameter ElasticityBoundaryLayerOperator +abbrev I := Fin 3 +abbrev Y := I → ℝ + +def leading (l m : ℂ) (f : F) : W := fun i => lift (homogeneousPolynomial l m f i) + +def grad (p : W) (y : Y) : CMatrix := fun i α => value (E₀ α (p i)) y + +lemma leading_normal (l m : ℂ) (hp : l+3*m≠0) (f : F) : normal l m (leading l m f)=0 := by + change normal l m (fun i => lift (homogeneousPolynomial l m f i))=0 + rw [normal_lift,homogeneousPolynomial_physical l m hp] + ext i + simp + +lemma leading_apply (l m : ℂ) (f : F) (i : I) : + leading l m f i=MvPolynomial.C (f i)+MvPolynomial.X 2*MvPolynomial.C (ElasticityBoundarySymbol.slope l m f i) := by + simp only [leading,homogeneousPolynomial,map_add,map_mul,lift_C,lift_X] + +lemma grad_leading (l m : ℂ) (f : F) (y : Y) (i α : I) : + grad (leading l m f) y i α= + if α=0 then Complex.I*(f i+(y 2:ℂ)*ElasticityBoundarySymbol.slope l m f i) + else if α=1 then 0 else ElasticityBoundarySymbol.slope l m f i-f i-(y 2:ℂ)*ElasticityBoundarySymbol.slope l m f i := by + rw [grad,leading_apply] + fin_cases α <;> simp [E₀,value_smul] <;> ring + +lemma tensorDensity_factor (D : ℂ) (a : I → I → I → I → ℂ) (P Q : CMatrix) : + tensorDensity (fun i α j β => D*a i α j β) P Q=D*tensorDensity a P Q := by + simp only [tensorDensity,Finset.mul_sum,mul_assoc] + +lemma transverse_density (l₁ m₁ l₂ m₂ L M : ℂ) (y : Y) : + tensorDensity (elasticityTensor L M) + (grad (leading l₁ m₁ ![0,1,0]) y) (grad (leading l₂ m₂ ![0,1,0]) y)=2*M := by + rw [tensorDensity_isotropic] + simp only [sesquiDensity,Fin.sum_univ_three,grad_leading] + simp [ElasticityBoundarySymbol.slope] + ring + +lemma longitudinal_trace (l m : ℂ) (hp : l+3*m≠0) (y : Y) : + (∑ i, grad (leading l m ![1,0,0]) y i i)=Complex.I*(2*m/(l+3*m)) := by + simp [Fin.sum_univ_three,grad_leading,ElasticityBoundarySymbol.slope] + have hp' : l+m*3≠0 := by simpa only [mul_comm] using hp + field_simp [hp,hp'] + ring + +lemma longitudinal_density (l₁ m₁ l₂ m₂ : ℂ) (hp₁ : l₁+3*m₁≠0) (hp₂ : l₂+3*m₂≠0) + (L : ℂ) (y : Y) : + tensorDensity (elasticityTensor L 0) + (grad (leading l₁ m₁ ![1,0,0]) y) (grad (leading l₂ m₂ ![1,0,0]) y)= + L*(Complex.I*(2*m₁/(l₁+3*m₁)))*star (Complex.I*(2*m₂/(l₂+3*m₂))) := by + rw [tensorDensity_isotropic] + simp only [sesquiDensity,zero_div,zero_mul,add_zero,longitudinal_trace l₁ m₁ hp₁, + longitudinal_trace l₂ m₂ hp₂] + +lemma longitudinal_trace_ne (l m : ℂ) (hm : m≠0) (hp : l+3*m≠0) : + Complex.I*(2*m/(l+3*m))≠0 := + mul_ne_zero Complex.I_ne_zero (div_ne_zero (mul_ne_zero (by norm_num) hm) hp) + +end ElasticityBoundaryLeading + +end +end +section +/-! Nondegenerate extraction of the two genuine isotropic scalar coefficients. +Tests are the actual frozen normal solutions, not arbitrary symbol data. -/ +noncomputable section +open scoped Matrix BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryLeading ElasticityBoundaryWeights + ElasticityBoundarySymbol ElasticityBoundaryMVNormal ElasticityBoundaryParameter ElasticityBoundaryLayerOperator + +lemma pair_separates (n : ℕ) (l₁ m₁ l₂ m₂ D L M : ℂ) + (hm₁ : m₁≠0) (hm₂ : m₂≠0) (hp₁ : l₁+3*m₁≠0) (hp₂ : l₂+3*m₂≠0) + (hD : D≠0) + (h : ∀ p q : W, normal l₁ m₁ p=0 → normal l₂ m₂ q=0 → + frozenPair n (fun i α j β => D*elasticityTensor L M i α j β) p q=0) : L=0 ∧ M=0 := by + have hmoment : (normalMoment n:ℂ)≠0 := Complex.ofReal_ne_zero.mpr (normalMoment_pos n).ne' + have hM : M=0 := by + have hh := h (leading l₁ m₁ ![0,1,0]) (leading l₂ m₂ ![0,1,0]) + (leading_normal l₁ m₁ hp₁ _) (leading_normal l₂ m₂ hp₂ _) + have he := frozenPair_constant n (fun i α j β => D*elasticityTensor L M i α j β) + (leading l₁ m₁ ![0,1,0]) (leading l₂ m₂ ![0,1,0]) (D*(2*M)) (fun y => by + change tensorDensity _ (grad _ y) (grad _ y)=_ + rw [tensorDensity_factor,transverse_density]) + rw [he] at hh + exact (mul_eq_zero.mp ((mul_eq_zero.mp ((mul_eq_zero.mp hh).resolve_left hmoment)).resolve_left hD)).resolve_left + (by norm_num) + refine ⟨?_,hM⟩ + have hh := h (leading l₁ m₁ ![1,0,0]) (leading l₂ m₂ ![1,0,0]) + (leading_normal l₁ m₁ hp₁ _) (leading_normal l₂ m₂ hp₂ _) + have he := frozenPair_constant n (fun i α j β => D*elasticityTensor L M i α j β) + (leading l₁ m₁ ![1,0,0]) (leading l₂ m₂ ![1,0,0]) + (D*(L*(Complex.I*(2*m₁/(l₁+3*m₁)))*star (Complex.I*(2*m₂/(l₂+3*m₂))))) (fun y => by + change tensorDensity _ (grad _ y) (grad _ y)=_ + rw [hM,tensorDensity_factor,longitudinal_density l₁ m₁ l₂ m₂ hp₁ hp₂]) + rw [he] at hh + have ht₁ := longitudinal_trace_ne l₁ m₁ hm₁ hp₁ + have ht₂ : star (Complex.I*(2*m₂/(l₂+3*m₂)))≠0 := star_ne_zero.mpr + (longitudinal_trace_ne l₂ m₂ hm₂ hp₂) + exact (mul_eq_zero.mp ((mul_eq_zero.mp ((mul_eq_zero.mp + ((mul_eq_zero.mp hh).resolve_left hmoment)).resolve_left hD)).resolve_right ht₂)).resolve_right ht₁ + +end ElasticityBoundaryPacket + +end +end +section +/-! Boundary values of BOTH Lamé parameters from the literal physical DN map +on an arbitrary honest smooth domain. This is not a near-boundary assumption. -/ +noncomputable section +open Set +open scoped Topology BigOperators +namespace ElasticityBoundaryPacket +open Elasticity ElasticityBoundaryLayerOperator +variable {Ω : Set X} {x : X} + +lemma elasticityTensor_sub (l₁ m₁ l₂ m₂ : ℂ) (i α j β : I) : + elasticityTensor l₁ m₁ i α j β-elasticityTensor l₂ m₂ i α j β= + elasticityTensor (l₁-l₂) (m₁-m₂) i α j β := by + unfold elasticityTensor + ring + +lemma admissible_frozen_ne {l m : X → ℝ} (ha : Admissible Ω l m) (hx : x∈closure Ω) : + (m x:ℂ)≠0 ∧ (l x:ℂ)+3*(m x:ℂ)≠0 := by + obtain ⟨hm,he⟩ := ha.2.2 x hx + constructor + · exact Complex.ofReal_ne_zero.mpr hm.ne' + · have hp : 0 H₁ i α j β y-H₂ i α j β y + have hHc : ∀ i α j β, Continuous (H i α j β) := fun i α j β => + (hH₁c i α j β).sub (hH₂c i α j β) + have hHs : ∀ i α j β, HasCompactSupport (H i α j β) := fun i α j β => + (hH₁s i α j β).sub (hH₂s i α j β) + have hH (i α j β : I) (y : Y) (hy : WithLp.toLp 2 y∈s.K) : + s.rawCoeff (fun z => (l₁ z:ℂ)) (fun z => (m₁ z:ℂ)) i α j β y- + s.rawCoeff (fun z => (l₂ z:ℂ)) (fun z => (m₂ z:ℂ)) i α j β y=(y 2:ℂ)^0*H i α j β y := by + simp only [pow_zero,one_mul,H,hH₁ i α j β y hy,hH₂ i α j β y hy] + rfl + have hH0 : (fun i α j β => H i α j β 0)= + (fun i α j β => (s.jacobian 0:ℂ)*elasticityTensor + ((l₁ x:ℂ)-(l₂ x:ℂ)) ((m₁ x:ℂ)-(m₂ x:ℂ)) i α j β) := by + funext i α j β + have h0 := hH i α j β 0 (by simpa using s.zero_mem) + simp only [pow_zero,one_mul] at h0 + rw [← h0] + rw [s.rawCoeff_zero,s.rawCoeff_zero,← mul_sub,elasticityTensor_sub] + have hpair := pair_separates 0 (l₁ x) (m₁ x) (l₂ x) (m₂ x) (s.jacobian 0) + ((l₁ x:ℂ)-(l₂ x:ℂ)) ((m₁ x:ℂ)-(m₂ x:ℂ)) + (admissible_frozen_ne ha₁ hx).1 (admissible_frozen_ne ha₂ hx).1 + (admissible_frozen_ne ha₁ hx).2 (admissible_frozen_ne ha₂ hx).2 + (Complex.ofReal_ne_zero.mpr s.jacobian_pos.ne') (by + intro p q hp hq + rw [← hH0] + exact s.extract_normal hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hO hB hx hDN 0 H hHc hHs hH p q hp hq) + exact ⟨Complex.ofReal_injective (sub_eq_zero.mp hpair.1), + Complex.ofReal_injective (sub_eq_zero.mp hpair.2)⟩ + +lemma boundary_values_global {l₁ m₁ l₂ m₂ : X → ℝ} + (hS : SourceSmoothBoundary Ω) (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁) (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) + (hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂) (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) + (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) (hx : x∈frontier Ω) : l₁ x=l₂ x ∧ m₁ x=m₂ x := by + obtain ⟨s⟩ := setup_exists hS hx + exact s.boundary_values hl₁ hm₁ hl₂ hm₂ ha₁ ha₂ hO hB (frontier_subset_closure hx) hDN + +end ElasticityBoundaryPacket + +end +end +section +/-! Honest continuous normal Taylor quotients, obtained from the integral +remainder. These are actual functions of the coefficients, not assumed jets. -/ +noncomputable section +open Set MeasureTheory +open scoped Topology BigOperators +namespace ElasticityBoundaryNormalTaylor +abbrev Y := Fin 3 → ℝ + +def en : Y := Pi.single 2 1 + +def projection (y : Y) : Y := y-(y 2) • en + +def travel (y : Y) (t : ℝ) : Y := projection y+t • ((y 2) • en) + +@[simp] lemma en_apply_two : en 2=1 := by simp [en] +@[simp] lemma projection_two (y : Y) : projection y 2=0 := by simp [projection] +@[simp] lemma projection_zero : projection 0=0 := by simp [projection] +@[simp] lemma travel_zero (t : ℝ) : travel 0 t=0 := by simp [travel] +@[simp] lemma travel_one (y : Y) : travel y 1=y := by simp [travel,projection] + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +def normalJet (n : ℕ) (f : Y → F) (y : Y) : F := + iteratedFDeriv ℝ n f y (fun _ => en) + +def quotient (n : ℕ) (f : Y → F) (y : Y) : F := + (n.factorial:ℝ)⁻¹ • ∫ t in (0:ℝ)..1, (1-t)^n • normalJet (n+1) f (travel y t) + +omit [CompleteSpace F] in +lemma normalJet_continuous {f : Y → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) : + Continuous (normalJet n f) := + (ContinuousMultilinearMap.apply ℝ (fun _ : Fin n => Y) F (fun _ => en)).continuous.comp + (hf.continuous_iteratedFDeriv (by exact_mod_cast le_top)) + +lemma travel_continuous : Continuous (fun z : Y × ℝ => travel z.1 z.2) := by + unfold travel projection + fun_prop + +omit [CompleteSpace F] in +lemma quotient_continuous {f : Y → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) : + Continuous (quotient n f) := by + have hc : Continuous (Function.uncurry (fun y (t:ℝ) => (1-t)^n • normalJet (n+1) f (travel y t))) := + ((continuous_const.sub continuous_snd).pow n).smul + ((normalJet_continuous hf (n+1)).comp travel_continuous) + have h := continuous_parametric_integral_of_continuous (μ := volume) hc (isCompact_Icc (a := (0:ℝ)) (b := 1)) + have he (y : Y) : (∫ t in (0:ℝ)..1, (1-t)^n • normalJet (n+1) f (travel y t))= + ∫ t in Icc (0:ℝ) 1, (1-t)^n • normalJet (n+1) f (travel y t) := by + rw [intervalIntegral.integral_of_le (by norm_num),integral_Icc_eq_integral_Ioc] + change Continuous (fun y : Y => (n.factorial:ℝ)⁻¹ • ∫ t in (0:ℝ)..1, (1-t)^n • normalJet (n+1) f (travel y t)) + simp_rw [he] + exact (continuous_const : Continuous (fun _ : Y => (n.factorial:ℝ)⁻¹)).smul h + +lemma normal_factor {f : Y → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (n : ℕ) (y : Y) + (hz : ∀ k≤n, normalJet k f (projection y)=0) : + f y=(y 2)^(n+1) • quotient n f y := by + have h := map_add_eq_sum_add_integral_iteratedFDeriv + (f := f) (x := projection y) (y := (y 2) • en) (n := n) + (fun _ _ => hf.contDiffAt.of_le (by exact_mod_cast le_top)) + have hv (k : ℕ) (z : Y) : + iteratedFDeriv ℝ k f z (fun _ => (y 2) • en)=(y 2)^k • normalJet k f z := by + rw [ContinuousMultilinearMap.map_smul_univ] + simp only [Finset.prod_const,Finset.card_univ,Fintype.card_fin,normalJet] + rw [show projection y+y 2 • en=y by simp [projection]] at h + rw [Finset.sum_eq_zero (fun k hk => by + have hk' : k (1-t)^n • ((y 2)^(n+1) • normalJet (n+1) f + (projection y+t • (y 2 • en))))= + (fun t => (y 2)^(n+1) • ((1-t)^n • normalJet (n+1) f (travel y t))) from by + funext t; rw [smul_comm]; rfl] at h + rw [intervalIntegral.integral_smul] at h + simpa only [quotient,smul_comm (n.factorial:ℝ)⁻¹] using h + +lemma quotient_zero (n : ℕ) (f : Y → F) : + quotient n f 0=((n+1).factorial:ℝ)⁻¹ • normalJet (n+1) f 0 := by + simp only [quotient,travel_zero] + rw [intervalIntegral.integral_smul_const] + have hi : (∫ t in (0:ℝ)..1, (1-t)^n)=(n+1:ℝ)⁻¹ := by + rw [intervalIntegral.integral_comp_sub_left (fun t : ℝ => t^n) 1] + simp [integral_pow] + rw [hi,smul_smul] + congr 1 + simp only [Nat.factorial_succ,Nat.cast_mul,Nat.cast_add,Nat.cast_one,mul_inv_rev] + +end ElasticityBoundaryNormalTaylor + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/CGO.lean b/lean/OAI/MathematicalPhysics/Elasticity/CGO.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4330a72cb1688dd41ed1f91e6765482ee630c2a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/CGO.lean @@ -0,0 +1,1053 @@ +import OAI.MathematicalPhysics.Elasticity.ForcedTransport + +namespace OAI + +noncomputable section + +namespace ElasticityAugmented +open Set +open scoped BigOperators +section Algebra +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable (D : Fin 3 → Derivation ℂ A A) +lemma leadingR_add (θ : Fin 3 → ℂ) (lam m : A) (u v : Fin 3 → A) (b c : A) : + leadingR D θ lam m (u+v) (b+c)=leadingR D θ lam m u b+leadingR D θ lam m v c := + (leadingRpair D θ lam m).map_add (u,b) (v,c) +lemma leadingS_add (θ : Fin 3 → ℂ) (lam m : A) (u v : Fin 3 → A) (b c : A) : + leadingS D θ lam m (u+v) (b+c)=leadingS D θ lam m u b+leadingS D θ lam m v c := by + simp only [leadingS,direction,Pi.add_apply,map_add,smul_add,Finset.sum_add_distrib,mul_add] + ring +lemma normal_add (θ : Fin 3 → ℂ) (u v : Fin 3 → A) : normal θ (u+v)=normal θ u+normal θ v := + (normalPair θ).map_add (u,0) (v,0) +end Algebra + +def localAmp (U : Set X) (a : Amplitude Smooth) : Amplitude (LocalSmooth U) := + ((fun i => restrictSmooth U (a.1 i)),restrictSmooth U a.2) +def CompatibleOn {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (lam m : Smooth) + (a : Amplitude Smooth) : Prop := + normal θ (R (localCoord hU) (restrictSmooth U lam) (restrictSmooth U m) (localAmp U a).1 (localAmp U a).2)= + leadingP (localCoord hU) θ (restrictSmooth U m) + (div (localCoord hU) (localAmp U a).1-(localAmp U a).2) + +def RecursOn {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (lam m : Smooth) + (a b : Amplitude Smooth) : Prop := + leadingR (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U m) (localAmp U b).1 (localAmp U b).2= + -R (localCoord hU) (restrictSmooth U lam) (restrictSmooth U m) (localAmp U a).1 (localAmp U a).2 ∧ + leadingS (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U m) (localAmp U b).1 (localAmp U b).2= + -S (localCoord hU) (restrictSmooth U lam) (restrictSmooth U m) (localAmp U a).1 (localAmp U a).2 ∧ + normal θ b.1=-(div coord a.1-a.2) + +lemma recurs_compatible {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (lam m : Smooth) + (a b : Amplitude Smooth) (h : RecursOn hU θ lam m a b) : CompatibleOn hU θ lam m b := by + obtain ⟨hR,hS,hn⟩ := h + apply recursive_normal_compatibility (localCoord hU) (localCoord_commute hU) θ + (restrictSmooth U lam) (restrictSmooth U m) (localAmp U b).1 (localAmp U a).1 + (localAmp U b).2 (localAmp U a).2 hR hS + have hh := congrArg (restrictSmooth U) hn + simpa only [restrict_normal,map_neg,map_sub,restrict_div hU,localAmp] using hh + +/-- One actual smooth recursive step, solving all three physical equations. +The open-region restriction algebra certifies differentiated compatibility; +continuity extends the tangent source to its compact closure for transport. -/ +theorem exists_physical_recursion_step {U : Set X} (hU : IsOpen U) (hC : IsCompact (closure U)) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) + (a : Amplitude Smooth) (ha : CompatibleOn hU θ (k-r*r) (r*r) a) : + ∃ b : Amplitude Smooth, RecursOn hU θ (k-r*r) (r*r) a b ∧ + CompatibleOn hU θ (k-r*r) (r*r) b := by + obtain ⟨n,hn⟩ := exists_normalizing_vector θ hne + let p : Fin 3 → Smooth := fun i => -(n i • (div coord a.1-a.2)) + let H : Fin 3 → Smooth := -R coord (k-r*r) (r*r) a.1 a.2-leadingR coord θ (k-r*r) (r*r) p 0 + let K : Smooth := -S coord (k-r*r) (r*r) a.1 a.2-leadingS coord θ (k-r*r) (r*r) p 0 + have hp (i) : restrictSmooth U (p i)=-(n i • + (div (localCoord hU) (localAmp U a).1-(localAmp U a).2)) := by + simp only [p,map_neg,map_smul,map_sub,restrict_div hU,localAmp] + have ht : restrictSmooth U (normal θ H)=0 := by + rw [restrict_normal] + have hh := residual_source_tangent (localCoord hU) θ n hθ hn + (restrictSmooth U (k-r*r)) (restrictSmooth U (r*r)) + (localAmp U a).1 (localAmp U a).2 ha + simpa only [H,Pi.sub_apply,Pi.neg_apply,map_sub,map_neg,restrict_R hU, + restrict_leadingR hU,map_zero,hp,localAmp,Pi.sub_def,Pi.neg_def] using hh + have hH : ∀ x∈closure U,((normal θ H : Smooth) : X → ℂ) x=0 := by + have he : EqOn ((normal θ H : Smooth) : X → ℂ) 0 U := + (restrictSmooth_zero_iff U _).mp ht + exact he.closure (smooth_coe (normal θ H)).continuous continuous_const + obtain ⟨u,b,hu,he⟩ := exists_physical_forced_transport θ hθ hne k r hr hk hl H K hC hH + let c : Amplitude Smooth := (p+u,b) + have hc : RecursOn hU θ (k-r*r) (r*r) a c := by + refine ⟨?_,?_,?_⟩ + · funext i + simp only [localAmp,Pi.neg_apply] + rw [← restrict_leadingR hU,← restrict_R hU,← map_neg] + apply (restrictSmooth_eq_iff U _ _).mpr + intro x hx + have hh := (he x (subset_closure hx)).1 i + have hadd := congrArg (fun v : Fin 3 → Smooth => (v i : X → ℂ) x) + (leadingR_add coord θ (k-r*r) (r*r) p u 0 b) + simp only [zero_add] at hadd + change ((leadingR coord θ (k-r*r) (r*r) (p+u) b i : Smooth) : X → ℂ) x= + -((R coord (k-r*r) (r*r) a.1 a.2 i : Smooth) : X → ℂ) x + change ((leadingR coord θ (k-r*r) (r*r) (p+u) b i : Smooth) : X → ℂ) x= + ((leadingR coord θ (k-r*r) (r*r) p 0 i : Smooth) : X → ℂ) x+ + ((leadingR coord θ (k-r*r) (r*r) u b i : Smooth) : X → ℂ) x at hadd + change ((leadingR coord θ (k-r*r) (r*r) u b i : Smooth) : X → ℂ) x= + -((R coord (k-r*r) (r*r) a.1 a.2 i : Smooth) : X → ℂ) x- + ((leadingR coord θ (k-r*r) (r*r) p 0 i : Smooth) : X → ℂ) x at hh + linear_combination hadd+hh + · simp only [localAmp] + rw [← restrict_leadingS hU,← restrict_S hU,← map_neg] + apply (restrictSmooth_eq_iff U _ _).mpr + intro x hx + have hh := (he x (subset_closure hx)).2 + have hadd := congrArg (fun v : Smooth => (v : X → ℂ) x) + (leadingS_add coord θ (k-r*r) (r*r) p u 0 b) + simp only [zero_add] at hadd + change ((leadingS coord θ (k-r*r) (r*r) (p+u) b : Smooth) : X → ℂ) x= + -((S coord (k-r*r) (r*r) a.1 a.2 : Smooth) : X → ℂ) x + change ((leadingS coord θ (k-r*r) (r*r) (p+u) b : Smooth) : X → ℂ) x= + ((leadingS coord θ (k-r*r) (r*r) p 0 : Smooth) : X → ℂ) x+ + ((leadingS coord θ (k-r*r) (r*r) u b : Smooth) : X → ℂ) x at hadd + change ((leadingS coord θ (k-r*r) (r*r) u b : Smooth) : X → ℂ) x= + -((S coord (k-r*r) (r*r) a.1 a.2 : Smooth) : X → ℂ) x- + ((leadingS coord θ (k-r*r) (r*r) p 0 : Smooth) : X → ℂ) x at hh + linear_combination hadd+hh + · change normal θ (p+u)=_ + rw [normal_add,hu,add_zero] + exact normal_particular θ n hn _ + exact ⟨c,hc,recurs_compatible hU θ (k-r*r) (r*r) a c hc⟩ +end ElasticityAugmented +section +open Set +open scoped BigOperators +namespace ElasticityAugmented + +/-- Every compatible smooth amplitude has an actual infinite recursive sequence; +only its finite truncations are used. There is no formal-solvability hypothesis. -/ +theorem exists_recursive_series {U : Set X} (hU : IsOpen U) (hC : IsCompact (closure U)) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) + (a₀ : Amplitude Smooth) (ha₀ : CompatibleOn hU θ (k-r*r) (r*r) a₀) : + ∃ a : ℕ → Amplitude Smooth, a 0=a₀ ∧ + (∀ j,RecursOn hU θ (k-r*r) (r*r) (a j) (a (j+1))) ∧ + ∀ j,CompatibleOn hU θ (k-r*r) (r*r) (a j) := by + let E := {a : Amplitude Smooth // CompatibleOn hU θ (k-r*r) (r*r) a} + have hex (a : E) := exists_physical_recursion_step hU hC θ hθ hne k r hr hk hl a.val a.property + let step : E → E := fun a => ⟨Classical.choose (hex a),(Classical.choose_spec (hex a)).2⟩ + have hstep (a : E) : RecursOn hU θ (k-r*r) (r*r) a.val (step a).val := + (Classical.choose_spec (hex a)).1 + let seq : ℕ → E := Nat.rec ⟨a₀,ha₀⟩ (fun _ a => step a) + refine ⟨fun j => (seq j).val,rfl,?_,fun j => (seq j).property⟩ + intro j + exact hstep (seq j) + +/-- The given genuine leading frame develops to physical compatible amplitudes, +with all three recursive equations on the same open region. -/ +theorem exists_physical_formal_frame {U : Set X} (hU : IsOpen U) (hC : IsCompact (closure U)) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + ∃ a : Fin 3 → ℕ → Amplitude Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ ν,normal θ (a ν 0).1=0) ∧ + (∀ ν,leadingR (localCoord hU) θ (restrictSmooth U (k-r*r)) (restrictSmooth U (r*r)) + (localAmp U (a ν 0)).1 (localAmp U (a ν 0)).2=0 ∧ + leadingS (localCoord hU) θ (restrictSmooth U (k-r*r)) (restrictSmooth U (r*r)) + (localAmp U (a ν 0)).1 (localAmp U (a ν 0)).2=0) ∧ + (∀ ν j,RecursOn hU θ (k-r*r) (r*r) (a ν j) (a ν (j+1))) ∧ + ∀ ν x, ((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (a ν 0).1 i : X → ℂ) x), + (changeS k r hr (a ν 0).1 (a ν 0).2 : X → ℂ) x) := by + obtain ⟨a₀,b₀,B,hn₀,he₀,hB⟩ := exists_physical_leading_frame θ hθ hne k r hr hk hl hC + have hR₀ (ν) : leadingR (localCoord hU) θ (restrictSmooth U (k-r*r)) (restrictSmooth U (r*r)) + (localAmp U (a₀ ν,b₀ ν)).1 (localAmp U (a₀ ν,b₀ ν)).2=0 := by + funext i + simp only [localAmp,Pi.zero_apply] + rw [← restrict_leadingR hU] + exact (restrictSmooth_zero_iff U _).mpr (fun x hx => (he₀ ν x (subset_closure hx)).1 i) + have hS₀ (ν) : leadingS (localCoord hU) θ (restrictSmooth U (k-r*r)) (restrictSmooth U (r*r)) + (localAmp U (a₀ ν,b₀ ν)).1 (localAmp U (a₀ ν,b₀ ν)).2=0 := by + simp only [localAmp] + rw [← restrict_leadingS hU] + exact (restrictSmooth_zero_iff U _).mpr (fun x hx => (he₀ ν x (subset_closure hx)).2) + have hc₀ (ν) : CompatibleOn hU θ (k-r*r) (r*r) (a₀ ν,b₀ ν) := by + apply leading_stage_compatibility (localCoord hU) (localCoord_commute hU) θ _ _ + (localAmp U (a₀ ν,b₀ ν)).1 (localAmp U (a₀ ν,b₀ ν)).2 (hR₀ ν) (hS₀ ν) + change normal θ (fun i => restrictSmooth U (a₀ ν i))=0 + rw [← restrict_normal,hn₀ ν,map_zero] + choose a ha hrec hc using (fun ν => exists_recursive_series hU hC θ hθ hne k r hr hk hl (a₀ ν,b₀ ν) (hc₀ ν)) + refine ⟨a,B,?_,?_,hrec,?_⟩ + · intro ν + rw [ha ν] + exact hn₀ ν + · intro ν + rw [ha ν] + exact ⟨hR₀ ν,hS₀ ν⟩ + · intro ν x + rw [ha ν] + exact hB ν x +end ElasticityAugmented + +end +namespace ElasticityAugmented +open Set +open scoped BigOperators + +def localAmpLM (U : Set X) : Amplitude Smooth →ₗ[ℂ] Amplitude (LocalSmooth U) where + toFun := localAmp U + map_add' a b := by ext i <;> simp [localAmp,map_add] + map_smul' c a := by ext i <;> simp [localAmp,map_smul] +lemma localAmp_truncation (U : Set X) (h : ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) : + localAmp U (truncation h N a)=truncation h N (fun j => localAmp U (a j)) := by + exact map_sum (localAmpLM U) _ _ |>.trans (by simp only [map_smul]; rfl) +lemma restrict_shifted {U : Set X} (hU : IsOpen U) (z : Fin 3 → ℂ) (i : Fin 3) (f : Smooth) : + restrictSmooth U (shifted coord z i f)=shifted (localCoord hU) z i (restrictSmooth U f) := by + simp only [shifted_apply,map_add,map_smul,localCoord_restrict] +lemma restrict_LT {U : Set X} (hU : IsOpen U) (z : Fin 3 → ℂ) (lam m : Smooth) + (a : Fin 3 → Smooth) (i : Fin 3) : + restrictSmooth U (LT (shifted coord z) lam m a i)= + LT (shifted (localCoord hU) z) (restrictSmooth U lam) (restrictSmooth U m) + (fun j => restrictSmooth U (a j)) i := by + simp only [LT,divT,restrict_shifted hU,map_mul,map_sum,map_add] + +/-- Literal finite physical residual on an open region. All compatibility +identities are local equalities, not strengthened global transport hypotheses. -/ +theorem physical_truncation_residual_on {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (lam m : Smooth) + (h : ℂ) (hh : h≠0) (N : ℕ) (a : ℕ → Amplitude Smooth) + (hR₀ : leadingR (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U m) + (localAmp U (a 0)).1 (localAmp U (a 0)).2=0) + (hn₀ : normal θ (a 0).1=0) + (hrec : ∀ j localAmp U (a j)) + hR₀ (fun j hj => (hrec j hj).1) hn₀' hnrec i + apply (restrictSmooth_eq_iff U _ _).mp + rw [restrict_LT hU] + change LT (shifted (localCoord hU) (h⁻¹ • θ)) (restrictSmooth U lam) (restrictSmooth U m) + (localAmp U (truncation h N a)).1 i=_ + rw [localAmp_truncation,hhres] + simp only [map_smul,map_add,map_mul,map_sub,restrict_R hU,localCoord_restrict,restrict_div hU,localAmp] + rw [← restrict_div hU,localCoord_restrict] +end ElasticityAugmented +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma exists_bounded_integer_multiplier (k : ℤ) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection (k : ℝ) (L f)=smulLeftCLM ℂ g (sobolevInjection (k : ℝ) f) := by + cases k with + | ofNat n => exact exists_bounded_nat_multiplier n hg hc + | negSucc n => + simpa only [Int.cast_negSucc,Nat.cast_add,Nat.cast_one] using + exists_bounded_negative_multiplier (n+1) hg hc + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma nested_multiplier {g η : E → ℂ} (hg : g.HasTemperateGrowth) + (hη : η.HasTemperateGrowth) (h1 : Set.EqOn η 1 (tsupport g)) (u : 𝓢'(E,ℂ)) : + smulLeftCLM ℂ g (smulLeftCLM ℂ η u)=smulLeftCLM ℂ g u := by + have he : η*g=g := by + ext x + change η x*g x=g x + by_cases hx : x ∈ tsupport g + · rw [h1 hx] + simp only [Pi.one_apply,one_mul] + · rw [image_eq_zero_of_notMem_tsupport hx,mul_zero] + rw [smulLeftCLM_smulLeftCLM_apply hη hg,he] + +omit [MeasurableSpace E] [BorelSpace E] in +lemma laplacian_product_divergence {ι : Type*} [Fintype ι] + (b : OrthonormalBasis ι ℝ E) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (u : 𝓢'(E,ℂ)) : + Δ (smulLeftCLM ℂ g u)=smulLeftCLM ℂ g (Δ u)+ + ∑ i, ((2 : ℂ) • ∂_{b i} (smulLeftCLM ℂ (fun x => fderiv ℝ g x (b i)) u)- + smulLeftCLM ℂ (fun x => fderiv ℝ (fun y => fderiv ℝ g y (b i)) x (b i)) u) := by + rw [laplacian_product b hg hc] + congr 1 + apply Finset.sum_congr rfl + intro i _ + have hgd := smooth_derivative hg (b i) + have hcd := compact_derivative hc (b i) + rw [distribution_leibniz (hcd.hasTemperateGrowth hgd) _ + ((compact_derivative hcd (b i)).hasTemperateGrowth (smooth_derivative hgd (b i)))] + module + +/-- A nested-cutoff interior norm estimate for the genuine distributional +Laplacian. All multiplier and derivative constants are produced by previously +proved closed graph arguments. The result includes the initial negative order. -/ +theorem quantitative_cutoff_gain (k : ℤ) {χ η : E → ℂ} + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (h1 : Set.EqOn η 1 (tsupport χ)) : + ∃ C : ℝ, 0 fderiv ℝ χ x (b i)) (sobolevInjection s f))- + smulLeftCLM ℂ (fun x => fderiv ℝ (fun y => fderiv ℝ χ y (b i)) x (b i)) (sobolevInjection s f)) := by + dsimp only [s] at hD hJ ⊢ + simp only [A,sum_apply,sub_apply,smul_apply,ContinuousLinearMap.comp_apply, + map_sum,map_sub,map_smul,hD,hJ,hM₁,hM₂] + obtain ⟨K,hK,hgain⟩ := quantitative_laplacian_gain (E := E) s + refine ⟨K*(‖M‖+‖N‖+‖A‖+1),by positivity,fun u f g hf hg => ?_⟩ + have hMf : sobolevInjection s (M f)=smulLeftCLM ℂ χ u := by + rw [hM,hf] + exact nested_multiplier (hcχ.hasTemperateGrowth hχ) (hcη.hasTemperateGrowth hη) h1 u + have hsource : sobolevInjection (s-1) (N g+A f)=Δ (smulLeftCLM ℂ χ u) := by + rw [map_add,hN,hg,hA,hf,laplacian_product_divergence b hχ hcχ] + rw [nested_multiplier (hcχ.hasTemperateGrowth hχ) (hcη.hasTemperateGrowth hη) h1] + congr 1 + apply Finset.sum_congr rfl + intro i _ + have hdi := smooth_derivative hχ (b i) + have hcdi := compact_derivative hcχ (b i) + rw [nested_multiplier (hcdi.hasTemperateGrowth hdi) (hcη.hasTemperateGrowth hη) + (fun x hx => h1 ((derivative_support_subset χ (b i)) hx)), + nested_multiplier ((compact_derivative hcdi (b i)).hasTemperateGrowth (smooth_derivative hdi (b i))) + (hcη.hasTemperateGrowth hη) + (fun x hx => h1 ((derivative_support_subset χ (b i)) + ((derivative_support_subset _ (b i)) hx)))] + obtain ⟨q,hq,hqn⟩ := hgain (M f) (N g+A f) (hMf ▸ hsource.symm) + refine ⟨q,hq.trans hMf,hqn.trans ?_⟩ + have hMn := M.le_opNorm f + have hNn := N.le_opNorm g + have hAn := A.le_opNorm f + have hsumn := norm_add_le (N g) (A f) + have hsum : ‖M f‖+‖N g+A f‖ ≤ (‖M‖+‖N‖+‖A‖+1)*(‖f‖+‖g‖) := by + have hNN := mul_nonneg (norm_nonneg N) (norm_nonneg f) + have hMM := mul_nonneg (norm_nonneg M) (norm_nonneg g) + have hAA := mul_nonneg (norm_nonneg A) (norm_nonneg g) + nlinarith [norm_nonneg f,norm_nonneg g] + calc + K*(‖M f‖+‖N g+A f‖) ≤ K*((‖M‖+‖N‖+‖A‖+1)*(‖f‖+‖g‖)) := mul_le_mul_of_nonneg_left hsum hK.le + _ = _ := by ring +end ElasticityRegularity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +/-- A genuine localized first derivative has a bounded realization from the +larger cutoff's Sobolev data. This also holds at negative integers. -/ +theorem exists_localized_derivative (k : ℤ) {a η : E → ℂ} + (ha : ContDiff ℝ (⊤ : ℕ∞) a) (hca : HasCompactSupport a) + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (h1 : Set.EqOn η 1 (tsupport a)) (v : E) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ u f, sobolevInjection (k : ℝ) f=smulLeftCLM ℂ η u → + sobolevInjection ((k : ℝ)-1) (L f)=smulLeftCLM ℂ a (∂_{v} u) := by + obtain ⟨M,hM⟩ := exists_bounded_integer_multiplier k ha hca + obtain ⟨D,hD⟩ := exists_bounded_sobolev_derivative (k : ℝ) v + obtain ⟨J,hJ⟩ := exists_bounded_sobolev_inclusion (E := E) (show (k : ℝ)-1 ≤ k by linarith) + obtain ⟨N,hN⟩ := exists_bounded_integer_multiplier k (smooth_derivative ha v) + (compact_derivative hca v) + refine ⟨D.comp M-J.comp N,fun u f hf => ?_⟩ + simp only [sub_apply,ContinuousLinearMap.comp_apply,map_sub,hD,hM,hJ,hN,hf] + rw [nested_multiplier (hca.hasTemperateGrowth ha) (hcη.hasTemperateGrowth hη) h1, + nested_multiplier ((compact_derivative hca v).hasTemperateGrowth (smooth_derivative ha v)) + (hcη.hasTemperateGrowth hη) (fun x hx => h1 ((derivative_support_subset a v) hx)), + distribution_leibniz (hca.hasTemperateGrowth ha) v + ((compact_derivative hca v).hasTemperateGrowth (smooth_derivative ha v))] + module + +/-- A bounded zeroth-order realization with one order of harmless loss. -/ +theorem exists_localized_multiplier (k : ℤ) {a η : E → ℂ} + (ha : ContDiff ℝ (⊤ : ℕ∞) a) (hca : HasCompactSupport a) + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (h1 : Set.EqOn η 1 (tsupport a)) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ u f, sobolevInjection (k : ℝ) f=smulLeftCLM ℂ η u → + sobolevInjection ((k : ℝ)-1) (L f)=smulLeftCLM ℂ a u := by + obtain ⟨M,hM⟩ := exists_bounded_integer_multiplier k ha hca + obtain ⟨J,hJ⟩ := exists_bounded_sobolev_inclusion (E := E) (show (k : ℝ)-1 ≤ k by linarith) + refine ⟨J.comp M,fun u f hf => ?_⟩ + simp only [ContinuousLinearMap.comp_apply,hJ,hM,hf] + exact nested_multiplier (hca.hasTemperateGrowth ha) (hcη.hasTemperateGrowth hη) h1 u + +end ElasticityRegularity +section +open scoped BigOperators +namespace ElasticityRegularity +/-- The precise polynomial loss for the shifted scalar-principal system. -/ +theorem quadratic_parameter_norm {W ι : Type*} [NormedAddCommGroup W] + [NormedSpace ℂ W] [Fintype ι] (R₀ R₂ : W) (R₁ : ι → W) : + ∃ C : ℝ, 0 ?_⟩ + let Z := ∑ i, ‖z i‖ + have hZ : 0≤Z := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + have hS : 0≤S := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + have hz (i : ι) : ‖z i‖≤Z := Finset.single_le_sum (fun j _ => norm_nonneg (z j)) (Finset.mem_univ i) + have hr (i : ι) : ‖R₁ i‖≤S := Finset.single_le_sum (fun j _ => norm_nonneg (R₁ j)) (Finset.mem_univ i) + have hlin : ‖∑ i, z i • R₁ i‖ ≤ Z*S := by + calc + ‖∑ i, z i • R₁ i‖ ≤ ∑ i, ‖z i • R₁ i‖ := norm_sum_le _ _ + _ = ∑ i, ‖z i‖*‖R₁ i‖ := by simp only [norm_smul] + _ ≤ ∑ i, ‖z i‖*S := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hr i) (norm_nonneg _)) + _ = Z*S := (Finset.sum_mul _ _ _).symm + have hquad : ‖∑ i, z i*z i‖ ≤ Z^2 := by + calc + ‖∑ i, z i*z i‖ ≤ ∑ i, ‖z i*z i‖ := norm_sum_le _ _ + _ = ∑ i, ‖z i‖*‖z i‖ := by simp only [norm_mul] + _ ≤ ∑ i, ‖z i‖*Z := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hz i) (norm_nonneg _)) + _ = Z^2 := by rw [← Finset.sum_mul]; change Z*Z=Z^2; ring + have hn : ‖R₀+(∑ i, z i • R₁ i)+(∑ i, z i*z i) • R₂‖ ≤ ‖R₀‖+Z*S+Z^2*‖R₂‖ := by + calc + _ ≤ ‖R₀+(∑ i, z i • R₁ i)‖+‖(∑ i, z i*z i) • R₂‖ := norm_add_le _ _ + _ ≤ ‖R₀‖+Z*S+Z^2*‖R₂‖ := by + rw [norm_smul] + exact add_le_add ((norm_add_le _ _).trans (add_le_add_right hlin _)) + (mul_le_mul_of_nonneg_right hquad (norm_nonneg _)) + apply hn.trans + change ‖R₀‖+Z*S+Z^2*‖R₂‖ ≤ (‖R₀‖+S+‖R₂‖+1)*(1+Z)^2 + have hW : 1 ≤ (1+Z)^2 := by nlinarith + have hL : Z ≤ (1+Z)^2 := by nlinarith + have hQ : Z^2 ≤ (1+Z)^2 := by nlinarith + calc + _ ≤ ‖R₀‖*(1+Z)^2+S*(1+Z)^2+‖R₂‖*(1+Z)^2 := by + have h₀ := mul_le_mul_of_nonneg_left hW (norm_nonneg R₀) + have h₁ := mul_le_mul_of_nonneg_left hL hS + have h₂ := mul_le_mul_of_nonneg_left hQ (norm_nonneg R₂) + nlinarith + _ ≤ _ := by nlinarith [sq_nonneg (1+Z)] +end ElasticityRegularity + +end +namespace ElasticityDistribution +open MeasureTheory TemperedDistribution + +section +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open ElasticityAugmented ElasticityRegularity +abbrev H := Lp ℂ 2 (volume : Measure X) +abbrev HV := Fin 4 → H + +def lowerPart (z : Fin 3 → ℂ) (A : Fin 3 → Fin 4 → Fin 4 → Coeff) + (V : Fin 4 → Fin 4 → Coeff) (U : Fin 4 → Dist) (i : Fin 4) : Dist := + (∑ k, ∑ j, A k i j • sd z k (U j))+(∑ j, V i j • U j)+ + (∑ k, (2*z k) • dd k (U i))+(∑ k, z k*z k) • U i + +lemma cutoff_coeff {η : X → ℂ} (hη : η.HasTemperateGrowth) (a : Coeff) (u : Dist) : + smulLeftCLM ℂ η (a • u)=smulLeftCLM ℂ (η*eval a) u := by + rw [smul_def,smulLeftCLM_smulLeftCLM_apply (growth a) hη,mul_comm] + +lemma coeff_complex_smul (a : Coeff) (c : ℂ) (u : Dist) : a • (c • u)=c • (a • u) := + (smul_comm c a u).symm + +/-- The actual lower-order shifted augmented operator, localized on a smaller +cutoff, is polynomial in the phase with bounded Sobolev coefficients. -/ +theorem exists_lower_realization (k : ℤ) {η ξ : X → ℂ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (hξ : ContDiff ℝ (⊤ : ℕ∞) ξ) (hcξ : HasCompactSupport ξ) + (h1 : Set.EqOn ξ 1 (tsupport η)) + (A : Fin 3 → Fin 4 → Fin 4 → Coeff) (V : Fin 4 → Fin 4 → Coeff) (i : Fin 4) : + ∃ L₀ L₂ : HV →L[ℂ] H, ∃ L₁ : Fin 3 → HV →L[ℂ] H, + ∀ (z : Fin 3 → ℂ) (U : Fin 4 → Dist) (f : HV), + (∀ j, sobolevInjection (k : ℝ) (f j)=smulLeftCLM ℂ ξ (U j)) → + sobolevInjection ((k : ℝ)-1) + ((L₀+(∑ d, z d • L₁ d)+(∑ d, z d*z d) • L₂) f)= + smulLeftCLM ℂ η (lowerPart z A V U i) := by + have hmA (d : Fin 3) (j : Fin 4) := exists_localized_multiplier k + (hη.mul (eval_smooth (A d i j))) hcη.mul_right hξ hcξ + (fun x hx => h1 (tsupport_mul_subset_left hx)) + choose M hM using hmA + have hdA (d : Fin 3) (j : Fin 4) := exists_localized_derivative k + (hη.mul (eval_smooth (A d i j))) hcη.mul_right hξ hcξ + (fun x hx => h1 (tsupport_mul_subset_left hx)) (e d) + choose D hD using hdA + have hmV (j : Fin 4) := exists_localized_multiplier k + (hη.mul (eval_smooth (V i j))) hcη.mul_right hξ hcξ + (fun x hx => h1 (tsupport_mul_subset_left hx)) + choose N hN using hmV + have hdη (d : Fin 3) := exists_localized_derivative k hη hcη hξ hcξ h1 (e d) + choose T hT using hdη + obtain ⟨J,hJ⟩ := exists_localized_multiplier k hη hcη hξ hcξ h1 + let pr (j : Fin 4) : HV →L[ℂ] H := ContinuousLinearMap.proj j + let L₀ : HV →L[ℂ] H := (∑ d, ∑ j, (D d j).comp (pr j))+(∑ j, (N j).comp (pr j)) + let L₁ (d : Fin 3) : HV →L[ℂ] H := (∑ j, (M d j).comp (pr j))+(2 : ℂ) • (T d).comp (pr i) + let L₂ : HV →L[ℂ] H := J.comp (pr i) + refine ⟨L₀,L₂,L₁,fun z U f hf => ?_⟩ + have hM' (d : Fin 3) (j : Fin 4) := hM d j (U j) (f j) (hf j) + have hD' (d : Fin 3) (j : Fin 4) := hD d j (U j) (f j) (hf j) + have hN' (j : Fin 4) := hN j (U j) (f j) (hf j) + have hT' (d : Fin 3) := hT d (U i) (f i) (hf i) + have hJ' := hJ (U i) (f i) (hf i) + simp only [L₀,L₁,L₂,pr,lowerPart,add_apply,sum_apply,smul_apply, + ContinuousLinearMap.comp_apply,ContinuousLinearMap.proj_apply,map_add,map_sum,map_smul, + hM',hD',hN',hT',hJ',sd_apply,smul_add,cutoff_coeff (hcη.hasTemperateGrowth hη), + Finset.sum_add_distrib,Finset.smul_sum,← smul_smul,dd_apply] + simp only [smul_smul,mul_comm,Pi.mul_def] + abel + +/-- A fixed quadratic phase loss, with no elliptic estimate assumed. -/ +theorem lower_realization_bound (k : ℤ) {η ξ : X → ℂ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (hξ : ContDiff ℝ (⊤ : ℕ∞) ξ) (hcξ : HasCompactSupport ξ) + (h1 : Set.EqOn ξ 1 (tsupport η)) + (A : Fin 3 → Fin 4 → Fin 4 → Coeff) (V : Fin 4 → Fin 4 → Coeff) (i : Fin 4) : + ∃ C : ℝ, 0 ⟨_,hL z U f hf,?_⟩⟩ + exact ((L₀+(∑ d, z d • L₁ d)+(∑ d, z d*z d) • L₂).le_opNorm f).trans + (mul_le_mul_of_nonneg_right (hn z) (norm_nonneg f)) + +lemma normalized_laplacian (z : Fin 3 → ℂ) (lam m n o : Coeff) + (hn : n*m=1) (ho : o*(lam+m+m)=1) (U : Fin 4 → Dist) (i : Fin 4) : + normPair z lam m n o (fun j => U j.succ) (U 0) i = + Δ (U i)+lowerPart z (coeffA dc lam m n o) (coeffV dc lam m n o) U i := by + rw [normalized_matrix z lam m n o hn ho,lapd_expand,lowerPart] + abel + +/-- One genuine interior regularity gain, with a phase-uniform polynomial bound. +There are no unproved local regularity assumptions: the input is actual Sobolev +representatives at the previous, possibly negative, integer order. -/ +theorem scalar_principal_quantitative_gain (k : ℤ) {Ω : Set X} {χ η ξ : X → ℂ} + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (hξ : ContDiff ℝ (⊤ : ℕ∞) ξ) (hcξ : HasCompactSupport ξ) + (h1 : Set.EqOn η 1 (tsupport χ)) (h2 : Set.EqOn ξ 1 (tsupport η)) + (hsη : tsupport η ⊆ Ω) + (A : Fin 3 → Fin 4 → Fin 4 → Coeff) (V : Fin 4 → Fin 4 → Coeff) : + ∃ C : ℝ, 0 hLp i) Finset.univ_nonempty + refine ⟨C,by dsimp [C]; positivity,fun z U F f g heq hf hg => ?_⟩ + have hZi : 0≤∑ d, ‖z d‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + let W := (1+∑ d, ‖z d‖)^2 + have hW : 1 ≤ W := by dsimp [W]; nlinarith + have hW0 : 0≤W := le_trans zero_le_one hW + have hbase : ‖f‖+‖g‖ ≤ W*(‖f‖+‖g‖) := by nlinarith [norm_nonneg f,norm_nonneg g] + have hcomp (i : Fin 4) : ∃ q : H, + sobolevInjection ((k : ℝ)+1) q=smulLeftCLM ℂ χ (U i) ∧ + ‖q‖ ≤ C*W*(‖f‖+‖g‖) := by + obtain ⟨r,hr,hrn⟩ := hL i z U f hf + have hmid : sobolevInjection (k : ℝ) (M (f i))=smulLeftCLM ℂ η (U i) := by + rw [hM,hf] + exact nested_multiplier (hcη.hasTemperateGrowth hη) (hcξ.hasTemperateGrowth hξ) h2 _ + have hΔ : sobolevInjection ((k : ℝ)-1) (g i-r)=smulLeftCLM ℂ η (Δ (U i)) := by + rw [map_sub,hg,hr] + have hh := (heq i).cutoff hη hcη hsη + rw [map_add] at hh + exact (eq_sub_of_add_eq hh).symm + obtain ⟨q,hq,hqn⟩ := hgain (U i) (M (f i)) (g i-r) hmid hΔ + refine ⟨q,hq,hqn.trans ?_⟩ + have hnM : ‖M (f i)‖ ≤ ‖M‖*(W*(‖f‖+‖g‖)) := by + apply (M.le_opNorm _).trans + apply mul_le_mul_of_nonneg_left _ (norm_nonneg M) + exact (norm_le_pi_norm f i).trans ((le_add_of_nonneg_right (norm_nonneg g)).trans hbase) + have hng : ‖g i‖ ≤ W*(‖f‖+‖g‖) := + (norm_le_pi_norm g i).trans ((le_add_of_nonneg_left (norm_nonneg f)).trans hbase) + have hnr : ‖r‖ ≤ (∑ j, L j)*(W*(‖f‖+‖g‖)) := by + apply hrn.trans + change L i*W*‖f‖ ≤ (∑ j, L j)*(W*(‖f‖+‖g‖)) + have hLi : L i≤∑ j, L j := Finset.single_le_sum (fun j _ => (hLp j).le) (Finset.mem_univ i) + calc + _ ≤ (∑ j, L j)*W*(‖f‖+‖g‖) := by gcongr; exact le_add_of_nonneg_right (norm_nonneg g) + _ = _ := by ring + have hb : ‖M (f i)‖+‖g i-r‖ ≤ (‖M‖+(∑ j, L j)+1)*(W*(‖f‖+‖g‖)) := by + have hh := norm_sub_le (g i) r + nlinarith + calc + _ ≤ K*((‖M‖+(∑ j, L j)+1)*(W*(‖f‖+‖g‖))) := mul_le_mul_of_nonneg_left hb hK.le + _ = _ := by dsimp [C]; ring + choose q hq hqn using hcomp + refine ⟨q,hq,?_⟩ + exact (pi_norm_le_iff_of_nonneg (by dsimp [C,W]; positivity)).mpr hqn + +/-- The preceding estimate applies to the actual normalized physical system. -/ +theorem normalized_quantitative_gain (k : ℤ) {Ω : Set X} {χ η ξ : X → ℂ} + (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) (hcχ : HasCompactSupport χ) + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) + (hξ : ContDiff ℝ (⊤ : ℕ∞) ξ) (hcξ : HasCompactSupport ξ) + (h1 : Set.EqOn η 1 (tsupport χ)) (h2 : Set.EqOn ξ 1 (tsupport η)) + (hsη : tsupport η ⊆ Ω) (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) : + ∃ C : ℝ, 0 U j.succ) (U 0) i) (F i)) → + (∀ i, sobolevInjection (k : ℝ) (f i)=smulLeftCLM ℂ ξ (U i)) → + (∀ i, sobolevInjection ((k : ℝ)-1) (g i)=smulLeftCLM ℂ η (F i)) → + ∃ q : HV, (∀ i, sobolevInjection ((k : ℝ)+1) (q i)=smulLeftCLM ℂ χ (U i)) ∧ + ‖q‖ ≤ C*(1+∑ d, ‖z d‖)^2*(‖f‖+‖g‖) := by + obtain ⟨C,hC,hgain⟩ := scalar_principal_quantitative_gain k hχ hcχ hη hcη hξ hcξ h1 h2 hsη + (coeffA dc lam m n o) (coeffV dc lam m n o) + refine ⟨C,hC,fun z U F f g heq hf hg => hgain z U F f g (fun i => ?_) hf hg⟩ + simpa only [normalized_laplacian z lam m n o hn ho] using heq i +end +open scoped SchwartzMap LineDeriv Laplacian BigOperators ENNReal +open ElasticityAugmented ElasticityRegularity +abbrev H3 := Fin 3 → ElasticityDistribution.H +lemma complex_zero_dist (u : Dist) : (0 : ℂ) • u=0 := zero_smul ℂ u +lemma complex_smul_dist_zero (c : ℂ) : c • (0 : Dist)=0 := @smul_zero ℂ Dist _ _ c + +def lpProj (i : Fin 3) : H3 →L[ℂ] Dist := + (Lp.toTemperedDistributionCLM ℂ (volume : Measure X) 2).comp (ContinuousLinearMap.proj i) +def divZeroCLM : H3 →L[ℂ] Dist := + ∑ i, (LineDeriv.lineDerivOpCLM ℂ Dist (e i)).comp (lpProj i) +lemma divZeroCLM_apply (f : H3) : divZeroCLM f=divd 0 (fun j => (f j : Dist)) := by + simp only [divZeroCLM,sum_apply,ContinuousLinearMap.comp_apply,lpProj, + ContinuousLinearMap.proj_apply,Lp.toTemperedDistributionCLM_apply, + divd,sd_apply,Pi.zero_apply,complex_zero_dist,add_zero,dd_apply,LineDeriv.lineDerivOpCLM_apply] +lemma divd_affine (z : Fin 3 → ℂ) (U : Fin 3 → Dist) : + divd z U=divd 0 U+∑ i, z i • U i := by + simp only [divd,sd_apply,Pi.zero_apply,complex_zero_dist,add_zero,Finset.sum_add_distrib] + +/-- A bounded Sobolev realization of an actual affine distribution family. All +mapping properties are proved in the concrete applications below. -/ +theorem affine_cutoff_bound (s : ℝ) {η : X → ℂ} + (T₀ : H3 →L[ℂ] Dist) (T₁ : Fin 3 → H3 →L[ℂ] Dist) + (h₀ : ∀ f, MemSobolev s 2 (smulLeftCLM ℂ η (T₀ f))) + (h₁ : ∀ d f, MemSobolev s 2 (smulLeftCLM ℂ η (T₁ d f))) : + ∃ C : ℝ, 0 (memSobolev_iff_range s _).mp (h₀ f)) + have hL₁ (d : Fin 3) := exists_continuous_lift (sobolevInjection s) (sobolevInjection_injective s) + ((smulLeftCLM ℂ η).comp (T₁ d)) (fun f => (memSobolev_iff_range s _).mp (h₁ d f)) + choose L₁ hL₁ using hL₁ + obtain ⟨C,hC,hb⟩ := quadratic_parameter_norm L₀ (0 : H3 →L[ℂ] ElasticityDistribution.H) L₁ + refine ⟨C,hC,fun z f => ⟨(L₀+∑ d, z d • L₁ d) f,?_,?_⟩⟩ + · simp only [add_apply,sum_apply,smul_apply,map_add,map_sum,map_smul,hL₀,hL₁, + ContinuousLinearMap.comp_apply] + · have hh := hb z + simp only [smul_zero,add_zero] at hh + exact ((L₀+∑ d, z d • L₁ d).le_opNorm f).trans + (mul_le_mul_of_nonneg_right hh (norm_nonneg f)) + +/-- Localized actual physical augmentation starts in H^-1 with polynomial phase +loss; its scalar component is the shifted divergence, not a new unknown. -/ +theorem augmentation_cutoff_bound {η : X → ℂ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) : + ∃ C : ℝ, 0 (f j : Dist))) (fun j => (f j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖q‖ ≤ C*(1+∑ d, ‖z d‖)^2*‖f‖ := by + have hf (f : H3) (i : Fin 3) := lp_local_zero Set.univ (f i) + obtain ⟨D,hD,hbD⟩ := affine_cutoff_bound (-1) divZeroCLM lpProj + (fun f => by + rw [divZeroCLM_apply] + simpa only [zero_sub] using LocalSobolev.divergence (hf f) 0 η hη hcη (Set.subset_univ _)) + (fun i f => (hf f i η hη hcη (Set.subset_univ _)).mono (by norm_num)) + have hc (i : Fin 3) := affine_cutoff_bound (-1) (lpProj i) (fun _ => 0) + (fun f => (hf f i η hη hcη (Set.subset_univ _)).mono (by norm_num)) + (fun _ _ => by simp only [zero_apply,map_zero]; exact memSobolev_fun_zero X ℂ _ _) + choose B hB hb using hc + let C := D+∑ i, B i + have hs : 0≤∑ i, B i := Finset.sum_nonneg (fun i _ => (hB i).le) + refine ⟨C,by dsimp [C]; positivity,fun z f => ?_⟩ + obtain ⟨q₀,hq₀,hn₀⟩ := hbD z f + have hv (i : Fin 3) := hb i z f + choose q hq hn using hv + refine ⟨Fin.cons q₀ q,?_,?_⟩ + · intro i + refine Fin.cases ?_ (fun i => ?_) i + · rw [Fin.cons_zero,divd_affine] + simpa only [Fin.cons_zero,divZeroCLM_apply,lpProj,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.proj_apply,Lp.toTemperedDistributionCLM_apply] using hq₀ + · simpa only [Fin.cons_succ,zero_apply,complex_smul_dist_zero,Finset.sum_const_zero,add_zero,lpProj, + ContinuousLinearMap.comp_apply,ContinuousLinearMap.proj_apply, + Lp.toTemperedDistributionCLM_apply] using hq i + · apply (pi_norm_le_iff_of_nonneg (by dsimp [C]; positivity)).mpr + intro i + refine Fin.cases ?_ (fun i => ?_) i + · apply hn₀.trans + gcongr + exact le_add_of_nonneg_right hs + · apply (hn i).trans + gcongr + have hh : B i≤∑ j, B j := Finset.single_le_sum (fun j _ => (hB j).le) (Finset.mem_univ i) + exact hh.trans (le_add_of_nonneg_left hD.le) + +/-- The source of the actual normalized system is also H^-1, with a uniform +polynomial phase bound depending on the fixed coefficients and cutoff only. -/ +theorem normSource_cutoff_bound {η : X → ℂ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) (m n o : Coeff) : + ∃ C : ℝ, 0 (f j : Dist)) i)) ∧ + ‖q‖ ≤ C*(1+∑ d, ‖z d‖)^2*‖f‖ := by + let T₀ : H3 →L[ℂ] Dist := (smulLeftCLM ℂ (eval o)).comp + (divZeroCLM-(2 : ℂ) • (smulLeftCLM ℂ (eval n)).comp + (∑ i, (smulLeftCLM ℂ (eval (dc i m))).comp (lpProj i))) + let T₁ (i : Fin 3) : H3 →L[ℂ] Dist := (smulLeftCLM ℂ (eval o)).comp (lpProj i) + have hT₀ (f : H3) : T₀ f=normSource 0 m n o (fun j => (f j : Dist)) 0 := by + simp only [T₀,ContinuousLinearMap.comp_apply,sub_apply,smul_apply,sum_apply, + divZeroCLM_apply,lpProj,ContinuousLinearMap.proj_apply,Lp.toTemperedDistributionCLM_apply, + normSource,Fin.cons_zero,smul_def] + have hT₁ (i : Fin 3) (f : H3) : T₁ i f=o • (f i : Dist) := rfl + have hf (f : H3) (i : Fin 3) := lp_local_zero Set.univ (f i) + obtain ⟨D,hD,hbD⟩ := affine_cutoff_bound (-1) T₀ T₁ + (fun f => by rw [hT₀]; simpa only [zero_sub] using normSource_local 0 m n o _ (hf f) 0 η hη hcη (Set.subset_univ _)) + (fun i f => ((LocalSobolev.coeff (hf f i) o) η hη hcη (Set.subset_univ _)).mono (by norm_num)) + have hc (i : Fin 3) := affine_cutoff_bound (-1) + ((smulLeftCLM ℂ (eval n)).comp (lpProj i)) (fun _ => 0) + (fun f => ((LocalSobolev.coeff (hf f i) n) η hη hcη (Set.subset_univ _)).mono (by norm_num)) + (fun _ _ => by simp only [zero_apply,map_zero]; exact memSobolev_fun_zero X ℂ _ _) + choose B hB hb using hc + let C := D+∑ i, B i + have hs : 0≤∑ i, B i := Finset.sum_nonneg (fun i _ => (hB i).le) + refine ⟨C,by dsimp [C]; positivity,fun z f => ?_⟩ + obtain ⟨q₀,hq₀,hn₀⟩ := hbD z f + have hv (i : Fin 3) := hb i z f + choose q hq hn using hv + refine ⟨Fin.cons q₀ q,?_,?_⟩ + · intro i + refine Fin.cases ?_ (fun i => ?_) i + · rw [Fin.cons_zero,hq₀,hT₀] + congr 1 + simp only [normSource,Fin.cons_zero,hT₁] + rw [divd_affine z] + simp only [smul_def,map_sub,map_add,map_sum,map_smul] + abel + · simpa only [Fin.cons_succ,zero_apply,complex_smul_dist_zero,Finset.sum_const_zero,add_zero,lpProj, + ContinuousLinearMap.comp_apply,ContinuousLinearMap.proj_apply, + Lp.toTemperedDistributionCLM_apply,normSource,smul_def] using hq i + · apply (pi_norm_le_iff_of_nonneg (by dsimp [C]; positivity)).mpr + intro i + refine Fin.cases ?_ (fun i => ?_) i + · apply hn₀.trans + gcongr + exact le_add_of_nonneg_right hs + · apply (hn i).trans + gcongr + have hh : B i≤∑ j, B j := Finset.single_le_sum (fun j _ => (hB j).le) (Finset.mem_univ i) + exact hh.trans (le_add_of_nonneg_left hD.le) +end ElasticityDistribution +namespace ElasticityDistribution +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open ElasticityAugmented ElasticityRegularity + +lemma norm_pi_map_le (L : ElasticityDistribution.H →L[ℂ] ElasticityDistribution.H) (f : HV) : + ‖fun i => L (f i)‖ ≤ ‖L‖*‖f‖ := by + apply (pi_norm_le_iff_of_nonneg (mul_nonneg (norm_nonneg L) (norm_nonneg f))).mpr + intro i + exact (L.le_opNorm _).trans (mul_le_mul_of_nonneg_left (norm_le_pi_norm f i) (norm_nonneg L)) + +/-- Two interior gains for a genuine physical L2 solution, starting with its +actual H^-1 divergence, suffice for a polynomially bounded H^1 augmented +remainder. Arbitrarily high finite CGO expansions absorb this fixed loss. -/ +theorem physical_quantitative_H1 {Ω : Set X} (χ : Fin 5 → X → ℂ) + (hχ : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (χ i)) (hcχ : ∀ i, HasCompactSupport (χ i)) + (hnest : ∀ i : Fin 4, Set.EqOn (χ i.succ) 1 (tsupport (χ i.castSucc))) + (hs : ∀ i, tsupport (χ i) ⊆ Ω) + (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) : + ∃ C : ℝ, 0 (r j : Dist)) i) (F i : Dist)) → + ∃ q : HV, (∀ i, sobolevInjection 1 (q i)=smulLeftCLM ℂ (χ 0) + ((Fin.cons (divd z (fun j => (r j : Dist))) (fun j => (r j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖q‖ ≤ C*(1+∑ d, ‖z d‖)^6*(‖r‖+‖F‖) := by + obtain ⟨A,hA,haug⟩ := augmentation_cutoff_bound (hχ 4) (hcχ 4) + obtain ⟨B,hB,hsrc₃⟩ := normSource_cutoff_bound (hχ 3) (hcχ 3) m n o + obtain ⟨D,hD,hsrc₁⟩ := normSource_cutoff_bound (hχ 1) (hcχ 1) m n o + obtain ⟨J,hJ⟩ := exists_bounded_sobolev_inclusion (E := X) (s := -1) (t := -2) (by norm_num) + obtain ⟨K,hK,hgain₁⟩ := normalized_quantitative_gain (-1) (hχ 2) (hcχ 2) + (hχ 3) (hcχ 3) (hχ 4) (hcχ 4) (hnest 2) (hnest 3) (hs 3) lam m n o hn ho + obtain ⟨L,hL,hgain₂⟩ := normalized_quantitative_gain 0 (hχ 0) (hcχ 0) + (hχ 1) (hcχ 1) (hχ 2) (hcχ 2) (hnest 0) (hnest 1) (hs 1) lam m n o hn ho + let T := K*(A+‖J‖*B) + let C := L*(T+D) + have hT : 0 ?_⟩ + let U : Fin 4 → Dist := Fin.cons (divd z (fun j => (r j : Dist))) (fun j => (r j : Dist)) + let FF := normSource z m n o (fun j => (F j : Dist)) + have hsys : ∀ i, LocalEq Ω (normPair z lam m n o (fun j => U j.succ) (U 0) i) (FF i) := + local_normalized_system z lam m n o _ _ heq + obtain ⟨f,hf,hfn⟩ := haug z r + obtain ⟨g₃,hg₃,hgn₃⟩ := hsrc₃ z F + obtain ⟨g₁,hg₁,hgn₁⟩ := hsrc₁ z F + have hg₂ (i : Fin 4) : sobolevInjection (-2) (J (g₃ i))=smulLeftCLM ℂ (χ 3) (FF i) := by + rw [hJ,hg₃] + have hf' (i : Fin 4) : sobolevInjection ((-1 : ℤ) : ℝ) (f i)=smulLeftCLM ℂ (χ 4) (U i) := by + simpa only [Int.cast_neg,Int.cast_one] using hf i + have hg₂' (i : Fin 4) : sobolevInjection (((-1 : ℤ) : ℝ)-1) (J (g₃ i))= + smulLeftCLM ℂ (χ 3) (FF i) := by convert hg₂ i using 2; norm_num + obtain ⟨v,hv,hvn⟩ := hgain₁ z U FF f (fun i => J (g₃ i)) hsys hf' hg₂' + have hv' (i : Fin 4) : sobolevInjection ((0 : ℤ) : ℝ) (v i)=smulLeftCLM ℂ (χ 2) (U i) := by + simpa only [Int.cast_neg,Int.cast_one,Int.cast_zero,neg_add_cancel] using hv i + have hg₁' (i : Fin 4) : sobolevInjection (((0 : ℤ) : ℝ)-1) (g₁ i)= + smulLeftCLM ℂ (χ 1) (FF i) := by simpa only [Int.cast_zero,zero_sub] using hg₁ i + obtain ⟨q,hq,hqn⟩ := hgain₂ z U FF v g₁ hsys hv' hg₁' + refine ⟨q,fun i => by simpa only [Int.cast_zero,zero_add] using hq i,?_⟩ + let W := (1+∑ d, ‖z d‖)^2 + let R := ‖r‖+‖F‖ + have hW : 1≤W := by + have hh : 0≤∑ d, ‖z d‖ := Finset.sum_nonneg (fun _ _ => norm_nonneg _) + dsimp [W]; nlinarith + have hW0 : 0≤W := zero_le_one.trans hW + have hR : 0≤R := add_nonneg (norm_nonneg r) (norm_nonneg F) + have hrR : ‖r‖≤R := le_add_of_nonneg_right (norm_nonneg F) + have hFR : ‖F‖≤R := le_add_of_nonneg_left (norm_nonneg r) + have hjn : ‖fun i => J (g₃ i)‖ ≤ ‖J‖*(B*W*‖F‖) := + (norm_pi_map_le J g₃).trans (mul_le_mul_of_nonneg_left hgn₃ (norm_nonneg J)) + have hvn' : ‖v‖≤T*W^2*R := by + apply hvn.trans + change K*W*(‖f‖+‖fun i => J (g₃ i)‖)≤T*W^2*R + calc + _ ≤ K*W*(A*W*‖r‖+‖J‖*(B*W*‖F‖)) := by gcongr + _ ≤ K*W*(A*W*R+‖J‖*(B*W*R)) := by gcongr + _ = _ := by dsimp [T]; ring + have hgn₁' : ‖g₁‖≤D*W^2*R := by + apply hgn₁.trans + change D*W*‖F‖≤D*W^2*R + have hWW : W≤W^2 := by nlinarith + gcongr + calc + _ ≤ L*W*(‖v‖+‖g₁‖) := hqn + _ ≤ L*W*(T*W^2*R+D*W^2*R) := by gcongr + _ = C*(1+∑ d, ‖z d‖)^6*(‖r‖+‖F‖) := by dsimp [C,W,R]; ring +end ElasticityDistribution +namespace ElasticityDistribution +open MeasureTheory TemperedDistribution +open scoped ENNReal SchwartzMap BigOperators +open ElasticityAugmented ElasticityRegularity ElasticityCoeffBounds + +section +open ElasticityPhysicalAlgebra (phase) + +lemma norm_ofLp_le (u : ElasticityPhysicalDual.H) : ‖(fun i => u i : H3)‖ ≤ ‖u‖ := by + exact (pi_norm_le_iff_of_nonneg (norm_nonneg u)).mpr (fun i => PiLp.norm_apply_le u i) + +lemma phase_envelope (α β : X) {h : ℝ} (hh : 0 (w j : Dist)) i) (f i : Dist)) ∧ + (∀ i, sobolevInjection 1 (q i)=smulLeftCLM ℂ (χ 0) + ((Fin.cons (divd (phase h α β) (fun j => (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖ ≤ C*‖ElasticityPhysicalDual.embed f‖ ∧ + ‖q‖ ≤ C*h⁻¹^6*‖ElasticityPhysicalDual.embed f‖ := by + obtain ⟨A,h₀,hA,hh₀,hsol⟩ := weak_smooth_solvability R hR Ω hΩ α β hα lam m hl hm hrl hrm hm0 he0 + let n := inverseCoeff m hm hm0 + let o := inverseCoeff (lam+m+m) ((hl.add hm).add hm) he0 + have hn : n*exteriorCoeff m hm=1 := inverseCoeff_mul m hm hm0 + have ho : o*(exteriorCoeff lam hl+exteriorCoeff m hm+exteriorCoeff m hm)=1 := by + apply Subtype.ext + exact reciprocal_mul (lam+m+m) he0 + obtain ⟨B,hB,hest⟩ := physical_quantitative_H1 χ hχ hcχ hnest hs + (exteriorCoeff lam hl) (exteriorCoeff m hm) n o hn ho + let K := 1+∑ i, ‖(α i : ℂ)+Complex.I*(β i : ℂ)‖ + let C := A+B*K^6*(A+1) + have hK : 0 ?_⟩ + obtain ⟨w,hw,heq,_⟩ := hsol h hh (hsmall.trans (min_le_left _ _)) f + let ff : H3 := fun i => ElasticityBessel.L2 (f i) + have hfeq (i : Fin 3) : (ff i : Dist)=(f i : Dist) := by + simp only [ff,ElasticityBessel.L2,SchwartzMap.toLpCLM_apply,Lp.toTemperedDistribution_toLp_eq] + have heq' : ∀ i, LocalEq Ω (phys (phase h α β) (exteriorCoeff lam hl) (exteriorCoeff m hm) + (fun j => (w j : Dist)) i) (ff i : Dist) := by simpa only [hfeq] using heq + obtain ⟨q,hq,hqn⟩ := hest (phase h α β) (fun i => w i) ff heq' + have hf : ‖ff‖≤‖ElasticityPhysicalDual.embed f‖ := by + exact norm_ofLp_le (ElasticityPhysicalDual.embed f) + have hr : ‖(fun i => w i : H3)‖≤A*‖ElasticityPhysicalDual.embed f‖ := + (norm_ofLp_le w).trans hw + have hph : 1+∑ i, ‖phase h α β i‖ ≤ h⁻¹*K := phase_envelope α β hh (hsmall.trans (min_le_right _ _)) + have hB' : B*K^6*(A+1)≤C := le_add_of_nonneg_left hA.le + have hA' : A≤C := le_add_of_nonneg_right (by positivity) + refine ⟨w,q,heq,hq,hw.trans (mul_le_mul_of_nonneg_right hA' (norm_nonneg _)),?_⟩ + calc + ‖q‖ ≤ B*(1+∑ i, ‖phase h α β i‖)^6*(‖(fun i => w i : H3)‖+‖ff‖) := hqn + _ ≤ B*(h⁻¹*K)^6*(A*‖ElasticityPhysicalDual.embed f‖+‖ElasticityPhysicalDual.embed f‖) := by gcongr + _ = (B*K^6*(A+1))*h⁻¹^6*‖ElasticityPhysicalDual.embed f‖ := by ring + _ ≤ C*h⁻¹^6*‖ElasticityPhysicalDual.embed f‖ := by gcongr +end +open ElasticityPhysicalAlgebra (phase physical) + +/-- The quantitative correction and classical representative are the SAME +physical solution. In particular no smooth solvability estimate is postulated. -/ +theorem classical_quantitative_correction (R : ℝ) (hR : 1≤R) + (Ω Ω' : Set X) (hΩ : Ω ⊆ Metric.closedBall 0 R) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (α β : X) (hα : α ≠ 0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hrl : ∀ x, star ((lam : X → ℂ) x)=(lam : X → ℂ) x) + (hrm : ∀ x, star ((m : X → ℂ) x)=(m : X → ℂ) x) + (hm0 : ∀ x, (m : X → ℂ) x ≠ 0) + (he0 : ∀ x, ((lam+m+m : Smooth) : X → ℂ) x ≠ 0) + (χ : Fin 5 → X → ℂ) (hχ : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (χ i)) + (hcχ : ∀ i, HasCompactSupport (χ i)) + (hnest : ∀ i : Fin 4, Set.EqOn (χ i.succ) 1 (tsupport (χ i.castSucc))) + (hs : ∀ i, tsupport (χ i) ⊆ Ω) (h1 : Set.EqOn (χ 0) 1 Ω') : + ∃ C h₀ : ℝ, 0 (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖ ≤ C*‖ElasticityPhysicalDual.embed f‖ ∧ + ‖q‖ ≤ C*h⁻¹^6*‖ElasticityPhysicalDual.embed f‖ := by + obtain ⟨C,h₀,hC,hh₀,hsol⟩ := physical_quantitative_correction R hR Ω hΩ α β hα + lam m hl hm hrl hrm hm0 he0 χ hχ hcχ hnest hs + refine ⟨C,h₀,hC,hh₀,fun h hh hsmall f => ?_⟩ + obtain ⟨w,q,heq,hq,hw,hqn⟩ := hsol h hh hsmall f + let n := inverseCoeff m hm hm0 + let o := inverseCoeff (lam+m+m) ((hl.add hm).add hm) he0 + have hn : n*exteriorCoeff m hm=1 := inverseCoeff_mul m hm hm0 + have ho : o*(exteriorCoeff lam hl+exteriorCoeff m hm+exteriorCoeff m hm)=1 := by + apply Subtype.ext + exact reciprocal_mul (lam+m+m) he0 + obtain ⟨v,hv,hphys⟩ := classical_representative hΩ' hsub (phase h α β) + (exteriorCoeff lam hl) (exteriorCoeff m hm) n o hn ho w f heq (hχ 0) (hcχ 0) (hs 0) h1 + exact ⟨w,q,v,hv,hphys,hq,hw,hqn⟩ +end ElasticityDistribution +namespace ElasticityDistribution +open MeasureTheory TemperedDistribution +open scoped ENNReal SchwartzMap BigOperators +open ElasticityAugmented ElasticityRegularity ElasticityCoeffBounds +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalDual (embed) + +/-- The two true terms in the physical residual at truncation order eight. -/ +def finiteResidual (h : ℝ) (f₀ f₁ : Fin 3 → S) : Fin 3 → S := + (h : ℂ)^8 • f₀+(h : ℂ)^7 • f₁ + +lemma finiteResidual_bound (h : ℝ) (hh : 0≤h) (h1 : h≤1) (f₀ f₁ : Fin 3 → S) : + ‖embed (finiteResidual h f₀ f₁)‖ ≤ h^7*(‖embed f₀‖+‖embed f₁‖) := by + have hp : h^8≤h^7 := by nlinarith [pow_nonneg hh 7] + calc + ‖embed (finiteResidual h f₀ f₁)‖ ≤ ‖(h : ℂ)^8 • embed f₀‖+‖(h : ℂ)^7 • embed f₁‖ := by + simpa only [finiteResidual,map_add,map_smul] using + norm_add_le ((h : ℂ)^8 • embed f₀) ((h : ℂ)^7 • embed f₁) + _ = h^8*‖embed f₀‖+h^7*‖embed f₁‖ := by + simp only [norm_smul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hh] + _ ≤ h^7*(‖embed f₀‖+‖embed f₁‖) := by nlinarith [norm_nonneg (embed f₀)] + +/-- Finite physical CGO residuals have a classical correction whose full +physical-divergence H1 error tends to zero at an explicit linear rate. -/ +theorem finite_classical_correction (R : ℝ) (hR : 1≤R) + (Ω Ω' : Set X) (hΩ : Ω ⊆ Metric.closedBall 0 R) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (α β : X) (hα : α ≠ 0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hrl : ∀ x, star ((lam : X → ℂ) x)=(lam : X → ℂ) x) + (hrm : ∀ x, star ((m : X → ℂ) x)=(m : X → ℂ) x) + (hm0 : ∀ x, (m : X → ℂ) x ≠ 0) + (he0 : ∀ x, ((lam+m+m : Smooth) : X → ℂ) x ≠ 0) + (χ : Fin 5 → X → ℂ) (hχ : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (χ i)) + (hcχ : ∀ i, HasCompactSupport (χ i)) + (hnest : ∀ i : Fin 4, Set.EqOn (χ i.succ) 1 (tsupport (χ i.castSucc))) + (hs : ∀ i, tsupport (χ i) ⊆ Ω) (h1 : Set.EqOn (χ 0) 1 Ω') + (f₀ f₁ : Fin 3 → S) : + ∃ C h₀ : ℝ, 0 (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖ ≤ C*h^7 ∧ ‖q‖ ≤ C*h := by + obtain ⟨A,h₀,hA,hh₀,hsol⟩ := classical_quantitative_correction R hR Ω Ω' hΩ hΩ' hsub + α β hα lam m hl hm hrl hrm hm0 he0 χ hχ hcχ hnest hs h1 + let K := ‖embed f₀‖+‖embed f₁‖ + let C := A*(K+1) + have hK : 0≤K := add_nonneg (norm_nonneg _) (norm_nonneg _) + have hC : 0 ?_⟩ + obtain ⟨w,q,v,hv,hphys,hq,hw,hqn⟩ := hsol h hh (hsmall.trans (min_le_left _ _)) + (finiteResidual h f₀ f₁) + have hf := finiteResidual_bound h hh.le (hsmall.trans (min_le_right _ _)) f₀ f₁ + have hAK : A*K≤C := by dsimp [C]; nlinarith + refine ⟨w,q,v,hv,hphys,hq,?_,?_⟩ + · calc + ‖w‖ ≤ A*(h^7*K) := hw.trans (mul_le_mul_of_nonneg_left hf hA.le) + _ ≤ C*h^7 := by nlinarith [pow_nonneg hh.le 7] + · calc + ‖q‖ ≤ A*h⁻¹^6*(h^7*K) := hqn.trans (mul_le_mul_of_nonneg_left hf (by positivity)) + _ = (A*K)*h := by field_simp + _ ≤ C*h := mul_le_mul_of_nonneg_right hAK hh.le + +lemma correction_cancels_residual (Ω : Set X) (z : Fin 3 → ℂ) (lam m : X → ℂ) + (u v f : Fin 3 → S) + (hu : ∀ i, Set.EqOn (physical z lam m u i : X → ℂ) (f i : X → ℂ) Ω) + (hv : ∀ i, Set.EqOn (physical z lam m v i : X → ℂ) (f i : X → ℂ) Ω) : + ∀ i, Set.EqOn (physical z lam m (u-v) i : X → ℂ) 0 Ω := by + have he := (ElasticityPhysicalDual.physicalLM z lam m).map_sub u v + change physical z lam m (u-v)=physical z lam m u-physical z lam m v at he + intro i x hx + rw [he] + change physical z lam m u i x-physical z lam m v i x=0 + rw [hu i hx,hv i hx,sub_self] +end ElasticityDistribution + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Carleman.lean b/lean/OAI/MathematicalPhysics/Elasticity/Carleman.lean new file mode 100644 index 0000000000000000000000000000000000000000..5215de0a39ec2404c896f7e16ab18434538bf1bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Carleman.lean @@ -0,0 +1,700 @@ +import OAI.MathematicalPhysics.Elasticity.Bessel +import OAI.MathematicalPhysics.Elasticity.Augmented + +namespace OAI + +noncomputable section + +open MeasureTheory Complex SchwartzMap +open scoped BigOperators FourierTransform SchwartzMap LineDeriv ENNReal +namespace ElasticityPhysicalEstimate +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +abbrev X := ElasticityBessel.X + +lemma J_sum {ι : Type*} (T : Finset ι) (h s : ℝ) (f : ι → S) : + J h s (∑ i ∈ T, f i) = ∑ i ∈ T, J h s (f i) := by + simp only [J, FourierTransform.fourier_sum, map_sum, FourierTransform.fourierInv_sum] + +lemma negNorm_sum_le {ι : Type*} (T : Finset ι) (h : ℝ) (f : ι → S) : + norm2 (J h (-1) (∑ i ∈ T, f i)) ≤ ∑ i ∈ T, norm2 (J h (-1) (f i)) := by + rw [J_sum] + exact norm2_sum_le _ _ + +lemma sumNorm_three_le (h s : ℝ) (U : Fin 3 → S) : + sumNorm h s U ≤ 2*sobNorm h s U := by + have hn : 0 ≤ ∑ i, norm2 (J h s (U i))^2 := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hs := Real.sq_sqrt hn + have ht := sq_sum_le_card_mul_sum_sq + (s := Finset.univ) (f := fun i => norm2 (J h s (U i))) + norm_num only [Finset.card_univ, Fintype.card_fin, Nat.cast_ofNat] at ht + dsimp only [sobNorm, sumNorm] + nlinarith only [hs, ht, hn, Real.sqrt_nonneg (∑ i, norm2 (J h s (U i))^2)] + +lemma dirDeriv_negNorm (h : ℝ) (hh : 0 ≤ h) (α β : X) (i : Fin 3) (f : S) : + norm2 (J h (-1) (dirDeriv h α β i f)) ≤ + h*(1+‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 f := by + have hd := semideriv_bound h 0 hh i f + norm_num only [zero_sub, J_zero] at hd + have hz := norm2_J_nonpos h (-1) (by norm_num) f + have hn := norm2_nonneg f + simp only [dirDeriv, J_add, J_smul] + calc + _ ≤ norm2 (((h^2 : ℝ) : ℂ) • J h (-1) (d (e i) f)) + + norm2 (((h : ℂ)*((α i : ℂ)+Complex.I*(β i : ℂ))) • J h (-1) f) := norm2_add_le _ _ + _ = h^2*norm2 (J h (-1) (d (e i) f)) + + (h*‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 (J h (-1) f) := by + simp only [norm2_const_smul, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hh, abs_of_nonneg (sq_nonneg h)] + _ ≤ h*norm2 f+(h*‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 f := by + have hd' := mul_le_mul_of_nonneg_left hd hh + have hz' := mul_le_mul_of_nonneg_left hz (mul_nonneg hh (norm_nonneg ((α i : ℂ)+Complex.I*(β i : ℂ)))) + nlinarith only [hd', hz'] + _ = _ := by ring + +/-- The actual normalized forcing generated by a physical forcing F. +Here n=1/μ, o=1/(λ+2μ), and c_i=-2(∂ᵢμ)/μ. +The scalar entry contains the conjugated divergence. -/ +def augmentedForcing (h : ℝ) (α β : X) (n o : X → ℂ) (c : Fin 3 → X → ℂ) + (F : Fin 3 → S) : Fin 4 → S := + Fin.cons (mult o (∑ i, (dirDeriv h α β i (F i) + ((h^2 : ℝ) : ℂ) • mult (c i) (F i)))) + (fun i => ((h^2 : ℝ) : ℂ) • mult n (F i)) + +lemma forcing_bound (h : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) (α β : X) + (n o : X → ℂ) (c : Fin 3 → X → ℂ) + (hn : n.HasTemperateGrowth) (ho : o.HasTemperateGrowth) + (hc : ∀ i, (c i).HasTemperateGrowth) + (A D Z : ℝ) (hA : 0 ≤ A) (hD : 0 ≤ D) (hZ : 0 ≤ Z) + (hnA : ∀ x, ‖n x‖ ≤ A) (hoA : ∀ x, ‖o x‖ ≤ A) + (hcA : ∀ i x, ‖c i x‖ ≤ A) + (hod : ∀ x i, h*‖fderiv ℝ o x (e i)‖ ≤ D) + (hz : ∀ i, ‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ ≤ Z) + (F : Fin 3 → S) : + sobNorm h (-1) (augmentedForcing h α β n o c F) ≤ + 2*(A+3*(A+D)*(1+Z+A))*h*sobNorm h 0 F := by + have hM : 0 ≤ 3*(A+D) := by positivity + have hm (i : Fin 3) : norm2 (J h (-1) (((h^2 : ℝ) : ℂ) • mult (c i) (F i))) ≤ + h*A*norm2 (F i) := by + rw [J_smul, norm2_const_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (sq_nonneg h)] + calc + _ ≤ h^2*norm2 (mult (c i) (F i)) := + mul_le_mul_of_nonneg_left (norm2_J_nonpos _ _ (by norm_num) _) (sq_nonneg h) + _ ≤ h^2*(A*norm2 (F i)) := + mul_le_mul_of_nonneg_left (norm2_mult _ (hc i) A (hcA i) _) (sq_nonneg h) + _ ≤ h*A*norm2 (F i) := by + have ht : h^2 ≤ h := by nlinarith only [hh, hh1] + nlinarith [mul_le_mul_of_nonneg_right ht (mul_nonneg hA (norm2_nonneg (F i)))] + have hd (i : Fin 3) : norm2 (J h (-1) (dirDeriv h α β i (F i))) ≤ + h*(1+Z)*norm2 (F i) := by + exact (dirDeriv_negNorm h hh α β i _).trans + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (show 1+‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ ≤ 1+Z by linarith [hz i]) hh) + (norm2_nonneg (F i))) + have hs : norm2 (J h (-1) (augmentedForcing h α β n o c F 0)) ≤ + 3*(A+D)*h*(1+Z+A)*sumNorm h 0 F := by + change norm2 (J h (-1) (mult o _)) ≤ _ + calc + _ ≤ 3*(A+D)*norm2 (J h (-1) (∑ i, (dirDeriv h α β i (F i) + + ((h^2 : ℝ) : ℂ) • mult (c i) (F i)))) := mult_Hneg1 h hh o ho A D hA hD hoA hod _ + _ ≤ 3*(A+D)*(∑ i, norm2 (J h (-1) (dirDeriv h α β i (F i) + + ((h^2 : ℝ) : ℂ) • mult (c i) (F i)))) := + mul_le_mul_of_nonneg_left (negNorm_sum_le Finset.univ h _) hM + _ ≤ 3*(A+D)*(∑ i, h*(1+Z+A)*norm2 (F i)) := by + gcongr with i + rw [J_add] + exact (norm2_add_le _ _).trans (by nlinarith only [hd i, hm i]) + _ = _ := by simp only [sumNorm, J_zero, ← Finset.mul_sum]; ring + have ht (i : Fin 3) : norm2 (J h (-1) (augmentedForcing h α β n o c F i.succ)) ≤ + h*A*norm2 (F i) := by + change norm2 (J h (-1) (((h^2 : ℝ) : ℂ) • mult n (F i))) ≤ _ + rw [J_smul, norm2_const_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (sq_nonneg h)] + calc + _ ≤ h^2*norm2 (mult n (F i)) := + mul_le_mul_of_nonneg_left (norm2_J_nonpos _ _ (by norm_num) _) (sq_nonneg h) + _ ≤ h^2*(A*norm2 (F i)) := + mul_le_mul_of_nonneg_left (norm2_mult _ hn A hnA _) (sq_nonneg h) + _ ≤ h*A*norm2 (F i) := by + have ht : h^2 ≤ h := by nlinarith only [hh, hh1] + nlinarith [mul_le_mul_of_nonneg_right ht (mul_nonneg hA (norm2_nonneg (F i)))] + calc + _ ≤ sumNorm h (-1) (augmentedForcing h α β n o c F) := sobNorm_le_sumNorm _ _ _ + _ ≤ (A+3*(A+D)*(1+Z+A))*h*sumNorm h 0 F := by + rw [sumNorm, Fin.sum_univ_succ] + have hts := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => ht i) + simp only [← Finset.mul_sum] at hts + have hsum : (∑ i, norm2 (F i)) = sumNorm h 0 F := by simp only [sumNorm, J_zero] + rw [hsum] at hts + nlinarith only [hs, hts] + _ ≤ (A+3*(A+D)*(1+Z+A))*h*(2*sobNorm h 0 F) := by + gcongr + exact sumNorm_three_le _ _ _ + _ = _ := by ring + +lemma dirDeriv_norm (h : ℝ) (hh : 0 ≤ h) (α β : X) (i : Fin 3) (f : S) : + norm2 (dirDeriv h α β i f) ≤ + h*(1+‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 (J h 1 f) := by + have hd := semideriv_bound h 1 hh i f + norm_num only [sub_self, J_zero] at hd + have hz := norm2_J_one_ge h f + simp only [dirDeriv] + calc + _ ≤ norm2 (((h^2 : ℝ) : ℂ) • d (e i) f) + + norm2 (((h : ℂ)*((α i : ℂ)+Complex.I*(β i : ℂ))) • f) := norm2_add_le _ _ + _ = h^2*norm2 (d (e i) f) + + (h*‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 f := by + simp only [norm2_const_smul, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hh, abs_of_nonneg (sq_nonneg h)] + _ ≤ h*norm2 (J h 1 f)+(h*‖((α i : ℂ)+Complex.I*(β i : ℂ))‖)*norm2 (J h 1 f) := by + have hd' := mul_le_mul_of_nonneg_left hd hh + have hz' := mul_le_mul_of_nonneg_left hz (mul_nonneg hh (norm_nonneg ((α i : ℂ)+Complex.I*(β i : ℂ)))) + nlinarith only [hd', hz'] + _ = _ := by ring + +lemma lowerDir_norm (h : ℝ) (hh : 0 ≤ h) (hh1 : h ≤ 1) (α β : X) + (a : Fin 3 → X → ℂ) (v : X → ℂ) + (ha : ∀ i,(a i).HasTemperateGrowth) (hv : v.HasTemperateGrowth) + (A V Z : ℝ) (hA : 0≤A) (hV : 0≤V) + (haA : ∀ i x,‖a i x‖≤A) (hvV : ∀ x,‖v x‖≤V) + (hz : ∀ i,‖((α i : ℂ)+Complex.I*(β i : ℂ))‖≤Z) (f : S) : + norm2 (lowerDir h α β a v f) ≤ (3*A*(1+Z)+V)*h*norm2 (J h 1 f) := by + have hd (i : Fin 3) : norm2 (mult (a i) (dirDeriv h α β i f)) ≤ + A*(h*(1+Z)*norm2 (J h 1 f)) := by + apply (norm2_mult (a i) (ha i) A (haA i) _).trans + apply mul_le_mul_of_nonneg_left _ hA + apply (dirDeriv_norm h hh α β i f).trans + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (add_le_add_right (hz i) 1) hh) (norm2_nonneg _) + have hs := norm2_sum_le Finset.univ (fun i : Fin 3 => mult (a i) (dirDeriv h α β i f)) + have hs' := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hd i) + norm_num only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] at hs' + have hv' := norm2_mult v hv V hvV f + have hn := norm2_J_one_ge h f + have hsq : h^2≤h := by nlinarith + have hv'' : h^2*norm2 (mult v f) ≤ h*V*norm2 (J h 1 f) := by + calc + _ ≤ h^2*(V*norm2 f) := mul_le_mul_of_nonneg_left hv' (sq_nonneg h) + _ ≤ h*(V*norm2 (J h 1 f)) := + (mul_le_mul_of_nonneg_right hsq (mul_nonneg hV (norm2_nonneg _))).trans + (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hn hV) hh) + _ = _ := by ring + have ht := norm2_add_le (∑ i : Fin 3,mult (a i) (dirDeriv h α β i f)) + (((h^2 : ℝ) : ℂ) • mult v f) + rw [norm2_const_smul,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (sq_nonneg h)] at ht + change norm2 ((∑ i : Fin 3,mult (a i) (dirDeriv h α β i f))+ + (((h^2 : ℝ) : ℂ) • mult v f))≤_ + nlinarith only [ht,hs,hs',hv''] + +lemma system_difference_bound (h : ℝ) (hh : 0≤h) (hh1 : h≤1) (α β : X) + (a b : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v w : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j,(a k i j).HasTemperateGrowth) (hb : ∀ k i j,(b k i j).HasTemperateGrowth) + (hv : ∀ i j,(v i j).HasTemperateGrowth) (hw : ∀ i j,(w i j).HasTemperateGrowth) + (A V Z : ℝ) (hA : 0≤A) (hV : 0≤V) (hZ : 0≤Z) + (haA : ∀ k i j x,‖a k i j x‖≤A) (hbA : ∀ k i j x,‖b k i j x‖≤A) + (hvV : ∀ i j x,‖v i j x‖≤V) (hwV : ∀ i j x,‖w i j x‖≤V) + (hz : ∀ i,‖((α i : ℂ)+Complex.I*(β i : ℂ))‖≤Z) (U : Fin 4 → S) : + sobNorm h (-1) (dirSystem h α β a v U-dirSystem h α β b w U) ≤ + 16*(3*A*(1+Z)+V)*h*sobNorm h 1 U := by + let K := (3*A*(1+Z)+V)*h + have hK : 0≤K := by dsimp [K]; positivity + have hi (i : Fin 4) : norm2 ((dirSystem h α β a v U-dirSystem h α β b w U) i) ≤ + 2*K*sumNorm h 1 U := by + have he : (dirSystem h α β a v U-dirSystem h α β b w U) i = + (∑ j,lowerDir h α β (fun k => a k i j) (v i j) (U j))- + (∑ j,lowerDir h α β (fun k => b k i j) (w i j) (U j)) := by + simp only [Pi.sub_apply,dirSystem]; abel + rw [he] + have hn : ∀ f : S,norm2 (-f)=norm2 f := by intro f; simp only [norm2,map_neg,norm_neg] + rw [sub_eq_add_neg] + apply (norm2_add_le _ _).trans + rw [hn] + have h1 := (norm2_sum_le Finset.univ (fun j => lowerDir h α β (fun k => a k i j) (v i j) (U j))).trans + (Finset.sum_le_sum (fun j _ => lowerDir_norm h hh hh1 α β (fun k => a k i j) (v i j) + (fun k => ha k i j) (hv i j) A V Z hA hV (fun k => haA k i j) (hvV i j) hz (U j))) + have h2 := (norm2_sum_le Finset.univ (fun j => lowerDir h α β (fun k => b k i j) (w i j) (U j))).trans + (Finset.sum_le_sum (fun j _ => lowerDir_norm h hh hh1 α β (fun k => b k i j) (w i j) + (fun k => hb k i j) (hw i j) A V Z hA hV (fun k => hbA k i j) (hwV i j) hz (U j))) + simp only [← Finset.mul_sum] at h1 h2 + change _≤2*K*(∑ j,norm2 (J h 1 (U j))) + dsimp [K] + linarith only [h1,h2] + have hn := Finset.sum_le_sum (s := Finset.univ) (fun i _ => + (norm2_J_nonpos h (-1) (by norm_num) _).trans (hi i)) + norm_num only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] at hn + apply (sobNorm_le_sumNorm h (-1) _).trans + change sumNorm h (-1) _≤_ + apply hn.trans + have hf := mul_le_mul_of_nonneg_left (sumNorm_four_le h 1 U) (by positivity : 0≤4*(2*K)) + dsimp [K] at hf + nlinarith only [hf] + +/-- The exact compact comparison estimate: the common second-order principal +part cancels, and the h factor in its actual lower-order forcing cancels the +Carleman 1/h loss. This dependency does not assert that the physical DN transfer +has already supplied the forcing identity. -/ +theorem compact_comparison_estimate (R : ℝ) (hR : 1≤R) (α β : X) (hα : α≠0) + (a b : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v w : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j,(a k i j).HasTemperateGrowth) (hb : ∀ k i j,(b k i j).HasTemperateGrowth) + (hv : ∀ i j,(v i j).HasTemperateGrowth) (hw : ∀ i j,(w i j).HasTemperateGrowth) + (A V Z : ℝ) (hA : 0≤A) (hV : 0≤V) (hZ : 0≤Z) + (haA : ∀ k i j x,‖a k i j x‖≤A) (hbA : ∀ k i j x,‖b k i j x‖≤A) + (hvV : ∀ i j x,‖v i j x‖≤V) (hwV : ∀ i j x,‖w i j x‖≤V) + (hz : ∀ i,‖((α i : ℂ)+Complex.I*(β i : ℂ))‖≤Z) : + ∃ C h₀ : ℝ,0 ?_⟩ + have h1 := hest h hh (hsmall.trans (min_le_left _ _)) W hW + rw [he] at h1 + have h2 := system_difference_bound h hh.le (hsmall.trans (min_le_right _ _)) α β a b v w ha hb hv hw + A V Z hA hV hZ haA hbA hvV hwV hz U + calc + _ ≤ (C/h)*sobNorm h (-1) (dirSystem h α β a v U-dirSystem h α β b w U) := h1 + _ ≤ (C/h)*(B*h*sobNorm h 1 U) := mul_le_mul_of_nonneg_left h2 (by positivity) + _ = C*B*sobNorm h 1 U := by field_simp + _ ≤ C*(1+B)*sobNorm h 1 U := by + apply mul_le_mul_of_nonneg_right _ (Real.sqrt_nonneg _) + gcongr + linarith +end ElasticityPhysicalEstimate + +namespace ElasticityPhysicalAlgebra +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +abbrev X := ElasticityBessel.X +abbrev Smooth := ElasticityAugmented.Smooth + +lemma temperate_fderiv (a : X → ℂ) (ha : a.HasTemperateGrowth) : + (fderiv ℝ a).HasTemperateGrowth := by + refine ⟨ha.1.fderiv_right (by simp), fun N => ?_⟩ + obtain ⟨k, C, h⟩ := ha.2 (N+1) + refine ⟨k, C, fun x => ?_⟩ + simpa only [iteratedFDeriv_succ_eq_comp_right, Function.comp_apply, LinearIsometryEquiv.norm_map] using h x + +lemma temperate_partial (a : X → ℂ) (ha : a.HasTemperateGrowth) (v : X) : + (fun x => fderiv ℝ a x v).HasTemperateGrowth := by + exact (ContinuousLinearMap.apply ℝ ℂ v).hasTemperateGrowth.comp (temperate_fderiv a ha) + +/-- The genuine embedding of Schwartz functions into the smooth differential algebra. -/ +def toSmooth : S →ₗ[ℂ] Smooth where + toFun f := ⟨f, f.smooth (⊤ : ℕ∞)⟩ + map_add' f g := by apply Subtype.ext; rfl + map_smul' a f := by apply Subtype.ext; rfl + +@[simp] lemma toSmooth_apply (f : S) (x : X) : (toSmooth f : X → ℂ) x = f x := rfl + +lemma toSmooth_injective : Function.Injective toSmooth := by + intro f g h + ext x + exact congrArg (fun a : Smooth => (a : X → ℂ) x) h + +lemma toSmooth_d (f : S) (i : Fin 3) : + toSmooth (d (e i) f) = ElasticityAugmented.coord i (toSmooth f) := by + apply Subtype.ext + rfl + +lemma toSmooth_mult (a : Smooth) (ha : (a : X → ℂ).HasTemperateGrowth) (f : S) : + toSmooth (mult a f) = a*toSmooth f := by + apply Subtype.ext + funext x + exact mult_apply a ha f x + +/-- Constant complex phase shift, still an actual differential operator on Schwartz maps. -/ +def shiftD (z : Fin 3 → ℂ) (i : Fin 3) : S →ₗ[ℂ] S := d (e i) + z i • LinearMap.id + +lemma shiftD_apply (z : Fin 3 → ℂ) (i : Fin 3) (f : S) : + shiftD z i f = d (e i) f + z i • f := rfl + +lemma toSmooth_shiftD (z : Fin 3 → ℂ) (i : Fin 3) (f : S) : + toSmooth (shiftD z i f) = ElasticityAugmented.shifted ElasticityAugmented.coord z i (toSmooth f) := by + simp only [shiftD_apply, map_add, map_smul, toSmooth_d, ElasticityAugmented.shifted_apply] + +/-- The conjugated physical stress-divergence, without treating its shifted derivatives as derivations. -/ +def physical (z : Fin 3 → ℂ) (lam m : X → ℂ) (u : Fin 3 → S) (i : Fin 3) : S := + shiftD z i (mult lam (∑ j, shiftD z j (u j))) + + ∑ j, shiftD z j (mult m (shiftD z j (u i) + shiftD z i (u j))) + +lemma toSmooth_physical (z : Fin 3 → ℂ) (lam m : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (u : Fin 3 → S) (i : Fin 3) : + toSmooth (physical z lam m u i) = + ElasticityAugmented.LT (ElasticityAugmented.shifted ElasticityAugmented.coord z) + lam m (fun j => toSmooth (u j)) i := by + simp only [physical, ElasticityAugmented.LT, ElasticityAugmented.divT, map_add, map_sum, + toSmooth_shiftD, toSmooth_mult lam hl, toSmooth_mult m hm, + Finset.mul_sum, mul_add] + +def phase (h : ℝ) (α β : X) (i : Fin 3) : ℂ := + ((α i : ℂ)+Complex.I*(β i : ℂ))/(h : ℂ) + +lemma dirDeriv_eq_shiftD (h : ℝ) (hh : h ≠ 0) (α β : X) (i : Fin 3) (f : S) : + dirDeriv h α β i f = ((h^2 : ℝ) : ℂ) • shiftD (phase h α β) i f := by + rw [dirDeriv, shiftD_apply, smul_add, smul_smul] + congr 1 + congr 1 + simp only [phase] + have hc : (h : ℂ) ≠ 0 := by exact_mod_cast hh + push_cast + field_simp [hc] + +def lapShift (z : Fin 3 → ℂ) (f : S) : S := ∑ i, shiftD z i (shiftD z i f) + +def divShift (z : Fin 3 → ℂ) (u : Fin 3 → S) : S := ∑ i, shiftD z i (u i) + +lemma toSmooth_lapShift (z : Fin 3 → ℂ) (f : S) : + toSmooth (lapShift z f) = + ElasticityAugmented.lapT (ElasticityAugmented.shifted ElasticityAugmented.coord z) (toSmooth f) := by + simp only [lapShift, ElasticityAugmented.lapT, map_sum, toSmooth_shiftD] + +lemma toSmooth_divShift (z : Fin 3 → ℂ) (u : Fin 3 → S) : + toSmooth (divShift z u) = + ElasticityAugmented.divT (ElasticityAugmented.shifted ElasticityAugmented.coord z) (fun i => toSmooth (u i)) := by + simp only [divShift, ElasticityAugmented.divT, map_sum, toSmooth_shiftD] + +lemma Pdir_eq_lapShift (h : ℝ) (hh : h ≠ 0) (α β : X) (f : S) : + Pdir h α β f = -((h^2 : ℝ) : ℂ) • lapShift (phase h α β) f := by + ext x + simp only [Pdir, lapShift, shiftD_apply, map_add, map_smul, lap_apply, + d_sum_basis α f, d_sum_basis β f, + EuclideanSpace.real_norm_sq_eq, PiLp.inner_apply, RCLike.inner_apply, + conj_trivial, Fin.sum_univ_three, add_apply, sub_apply, + smul_apply, smul_eq_mul, phase] + have hc : (h : ℂ) ≠ 0 := by exact_mod_cast hh + push_cast + field_simp [hc] + ring_nf + simp only [Complex.I_sq] + ring + +lemma shiftD_supported (z : Fin 3 → ℂ) (i : Fin 3) {R : ℝ} {f : S} + (hf : BallSupported R f) : BallSupported R (shiftD z i f) := + (hf.d _).add (hf.smul _) + +lemma divShift_supported (z : Fin 3 → ℂ) {R : ℝ} (u : Fin 3 → S) + (hu : ∀ i, BallSupported R (u i)) : BallSupported R (divShift z u) := by + exact BallSupported.sum _ _ (fun i _ => shiftD_supported z i (hu i)) + +end ElasticityPhysicalAlgebra + +open scoped BigOperators +namespace ElasticityAugmented +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable (D : Fin 3 → Derivation ℂ A A) (T : Fin 3 → A →ₗ[ℂ] A) + +def coeffA (lam m n o : A) (k : Fin 3) : Fin 4 → Fin 4 → A := + Fin.cons + (Fin.cons (2*o*(D k (lam+m)-(lam+m)*n*D k m)) + (fun j => 2*o*(D k (D j m)-2*n*D k m*D j m))) + (fun i => Fin.cons (if k=i then (lam+m)*n else 0) + (fun j => (if j=i then n*D k m else 0) + (if k=i then n*D j m else 0))) + +def coeffV (lam m n o : A) : Fin 4 → Fin 4 → A := + Fin.cons + (Fin.cons (o*(lap D lam-2*n*(∑ i, D i m*D i lam))) (fun _ => 0)) + (fun i => Fin.cons (n*D i lam) (fun _ => 0)) + +def normalizedPair (lam m n o : A) (u : Fin 3 → A) (b : A) : Fin 4 → A := + Fin.cons (o*(ST D T lam m u b-2*n*(∑ i, D i m*RT D T lam m u b i))) + (fun i => n*RT D T lam m u b i) + +lemma normalizedPair_matrix (lam m n o : A) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (U : Fin 4 → A) (i : Fin 4) : + normalizedPair D T lam m n o (fun j => U j.succ) (U 0) i = + lapT T (U i) + (∑ k, ∑ j, coeffA D lam m n o k i j * T k (U j)) + + (∑ j, coeffV D lam m n o i j*U j) := by + refine Fin.cases ?_ (fun i => ?_) i + · change o*(ST D T lam m _ _-2*n*(∑ i, D i m*RT D T lam m _ _ i)) = _ + rw [normalized_scalar D T lam m n o hn ho] + simp only [coeffA, coeffV, Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ, + zero_mul, Finset.sum_const_zero, add_zero, Finset.sum_add_distrib] + ring + · change n*RT D T lam m _ _ i = _ + rw [normalized_vector D T lam m n hn] + simp only [coeffA, coeffV, Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ, + zero_mul, Finset.sum_const_zero, add_zero, add_mul, ite_mul, + Finset.sum_add_distrib, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + ring + +end ElasticityAugmented + +open MeasureTheory Complex SchwartzMap +open scoped BigOperators FourierTransform SchwartzMap LineDeriv ENNReal +open Set MeasureTheory SchwartzMap +open scoped BigOperators SchwartzMap Topology +namespace ElasticityPhysicalEstimate + +section +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder ElasticityPhysicalAlgebra +open ElasticityAugmented (coord coeffA coeffV normalizedPair shifted) + +/-- The actual normalized matrix coefficients, with the sign of the Carleman operator. -/ +def aPhys (lam m n o : Smooth) (k : Fin 3) (i j : Fin 4) : X → ℂ := + -((coeffA coord lam m n o k i j : Smooth) : X → ℂ) +def vPhys (lam m n o : Smooth) (i j : Fin 4) : X → ℂ := + -((coeffV coord lam m n o i j : Smooth) : X → ℂ) +def cPhys (m n : Smooth) (i : Fin 3) : X → ℂ := (-2*n*coord i m : Smooth) + +lemma aPhys_growth (lam m n o : Smooth) + (ha : ∀ k i j, ((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (k : Fin 3) (i j : Fin 4) : (aPhys lam m n o k i j).HasTemperateGrowth := + (ha k i j).neg +lemma vPhys_growth (lam m n o : Smooth) + (hv : ∀ i j, ((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (i j : Fin 4) : (vPhys lam m n o i j).HasTemperateGrowth := + (hv i j).neg + +lemma toSmooth_aPhys (lam m n o : Smooth) + (ha : ∀ k i j, ((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (k : Fin 3) (i j : Fin 4) (f : S) : + toSmooth (mult (aPhys lam m n o k i j) f) = -coeffA coord lam m n o k i j*toSmooth f := by + exact toSmooth_mult (-coeffA coord lam m n o k i j) ((ha k i j).neg) f +lemma toSmooth_vPhys (lam m n o : Smooth) + (hv : ∀ i j, ((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (i j : Fin 4) (f : S) : + toSmooth (mult (vPhys lam m n o i j) f) = -coeffV coord lam m n o i j*toSmooth f := by + exact toSmooth_mult (-coeffV coord lam m n o i j) ((hv i j).neg) f + +lemma toSmooth_dirSystem (h : ℝ) (hh : h ≠ 0) (α β : X) + (lam m n o : Smooth) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (ha : ∀ k i j, ((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hv : ∀ i j, ((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (U : Fin 4 → S) (i : Fin 4) : + toSmooth (dirSystem h α β (aPhys lam m n o) (vPhys lam m n o) U i) = + -((h^2 : ℝ) : ℂ) • normalizedPair coord (shifted coord (phase h α β)) lam m n o + (fun j => toSmooth (U j.succ)) (toSmooth (U 0)) i := by + rw [ElasticityAugmented.normalizedPair_matrix coord _ lam m n o hn ho (fun j => toSmooth (U j)) i] + simp only [dirSystem, lowerDir, Pdir_eq_lapShift h hh, dirDeriv_eq_shiftD h hh, + map_add, map_sum, map_smul, toSmooth_shiftD, + toSmooth_aPhys lam m n o ha, toSmooth_vPhys lam m n o hv, + smul_add, Finset.smul_sum, neg_smul] + simp only [map_neg, map_smul, toSmooth_lapShift, Fin.sum_univ_succ, + Algebra.smul_def] + ring + +lemma toSmooth_forcing (h : ℝ) (hh : h ≠ 0) (α β : X) + (m n o : Smooth) + (hn : (n : X → ℂ).HasTemperateGrowth) (ho : (o : X → ℂ).HasTemperateGrowth) + (hc : ∀ i, (cPhys m n i).HasTemperateGrowth) + (F : Fin 3 → S) (i : Fin 4) : + toSmooth (augmentedForcing h α β n o (cPhys m n) F i) = + ((h^2 : ℝ) : ℂ) • Fin.cons (α := fun _ : Fin 4 => Smooth) + (o*(ElasticityAugmented.divT (shifted coord (phase h α β)) (fun j => toSmooth (F j)) - + 2*n*(∑ j, coord j m*toSmooth (F j)))) + (fun j => n*toSmooth (F j)) i := by + refine Fin.cases ?_ (fun i => ?_) i + · simp only [augmentedForcing, Fin.cons_zero, map_sum, map_add, map_smul, + dirDeriv_eq_shiftD h hh, toSmooth_mult o ho, toSmooth_shiftD] + have hcm (j : Fin 3) : toSmooth (mult (cPhys m n j) (F j)) = + (-2*n*coord j m)*toSmooth (F j) := toSmooth_mult _ (hc j) _ + simp only [hcm, ElasticityAugmented.divT, Fin.sum_univ_three, Algebra.smul_def] + ring + · simp only [augmentedForcing, Fin.cons_succ, map_smul, toSmooth_mult n hn] + +lemma physical_system_identity (h : ℝ) (hh : h ≠ 0) (α β : X) + (lam m n o : Smooth) (hinv : n*m=1) (hoinv : o*(lam+m+m)=1) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hn : (n : X → ℂ).HasTemperateGrowth) (ho : (o : X → ℂ).HasTemperateGrowth) + (ha : ∀ k i j, ((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hv : ∀ i j, ((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hc : ∀ i, (cPhys m n i).HasTemperateGrowth) + (u : Fin 3 → S) : + dirSystem h α β (aPhys lam m n o) (vPhys lam m n o) + (Fin.cons (divShift (phase h α β) u) u) = + fun i => -augmentedForcing h α β n o (cPhys m n) (physical (phase h α β) lam m u) i := by + funext i + apply toSmooth_injective + rw [map_neg, toSmooth_dirSystem h hh α β lam m n o hinv hoinv ha hv, + toSmooth_forcing h hh α β m n o hn ho hc] + simp only [Fin.cons_zero, Fin.cons_succ, toSmooth_divShift, + toSmooth_physical _ lam m hl hm, neg_smul] + congr 1 + refine Fin.cases ?_ (fun i => ?_) i + · simp only [normalizedPair, Fin.cons_zero] + rw [ElasticityAugmented.shifted_physical_divergence coord _ _ _ _ ElasticityAugmented.coord_commute] + simp only [ElasticityAugmented.shifted_physical_expansion coord _ _ _ _ ElasticityAugmented.coord_commute] + · simp only [normalizedPair, Fin.cons_succ, + ElasticityAugmented.shifted_physical_expansion coord _ _ _ _ ElasticityAugmented.coord_commute] + +lemma norm_tail_le (h : ℝ) (b : S) (u : Fin 3 → S) : + sobNorm h 0 u ≤ sobNorm h 1 (Fin.cons b u) := by + unfold sobNorm + apply Real.sqrt_le_sqrt + rw [Fin.sum_univ_succ] + simp only [J_zero] + exact (Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => + pow_le_pow_left₀ (norm2_nonneg (u i)) (norm2_J_one_ge h (u i)) 2)).trans + (le_add_of_nonneg_left (sq_nonneg _)) + +/-- The physical adjoint-test estimate obtained from the actual scalar-principal +augmented operator. All coefficients and forcing terms are explicit. -/ +theorem physical_test_estimate (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : α ≠ 0) + (lam m n o : Smooth) (hinv : n*m=1) (hoinv : o*(lam+m+m)=1) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hn : (n : X → ℂ).HasTemperateGrowth) (ho : (o : X → ℂ).HasTemperateGrowth) + (ha : ∀ k i j, ((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hv : ∀ i j, ((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hc : ∀ i, (cPhys m n i).HasTemperateGrowth) + (M V A D Z : ℝ) (hM : 0 ≤ M) (hV : 0 ≤ V) (hA : 0 ≤ A) (hD : 0 ≤ D) (hZ : 0 ≤ Z) + (haM : ∀ k i j x, ‖aPhys lam m n o k i j x‖ ≤ M) + (hvV : ∀ i j x, ‖vPhys lam m n o i j x‖ ≤ V) + (hnA : ∀ x, ‖(n : X → ℂ) x‖ ≤ A) (hoA : ∀ x, ‖(o : X → ℂ) x‖ ≤ A) + (hcA : ∀ i x, ‖cPhys m n i x‖ ≤ A) + (hod : ∀ x i, ‖fderiv ℝ (o : X → ℂ) x (e i)‖ ≤ D) + (hz : ∀ i, ‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ ≤ Z) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ u : Fin 3 → S, (∀ i, BallSupported R (u i)) → + sobNorm h 0 u ≤ C*sobNorm h 0 (physical (phase h α β) lam m u) := by + obtain ⟨C, h₀, hC, hh₀, hest⟩ := system_four_direction R hR α β hα + (aPhys lam m n o) (vPhys lam m n o) (aPhys_growth lam m n o ha) + (vPhys_growth lam m n o hv) M V hM hV haM hvV + let K := 2*(A+3*(A+D)*(1+Z+A)) + have hK : 0 ≤ K := by dsimp [K]; positivity + refine ⟨C*(1+K), min h₀ 1, mul_pos hC (by positivity), lt_min hh₀ zero_lt_one, ?_⟩ + intro h hh hsmall u hu + have hs0 := (le_min_iff.mp hsmall).1 + have hs1 := (le_min_iff.mp hsmall).2 + let F := physical (phase h α β) lam m u + have hb := forcing_bound h hh.le hs1 α β n o (cPhys m n) hn ho hc A D Z hA hD hZ hnA hoA hcA + (fun x i => (mul_le_mul_of_nonneg_right hs1 (norm_nonneg _)).trans (by simpa using hod x i)) hz F + have hu' : ∀ i, BallSupported R (Fin.cons (α := fun _ : Fin 4 => S) (divShift (phase h α β) u) u i) := by + intro i + exact Fin.cases (divShift_supported _ u hu) hu i + have huest := hest h hh hs0 (Fin.cons (divShift (phase h α β) u) u) hu' + rw [physical_system_identity h hh.ne' α β lam m n o hinv hoinv hl hm hn ho ha hv hc u] at huest + have hneg : sobNorm h (-1) (fun i => -augmentedForcing h α β n o (cPhys m n) F i) = + sobNorm h (-1) (augmentedForcing h α β n o (cPhys m n) F) := by + simpa only [neg_one_smul, norm_neg, norm_one, one_mul] using + sobNorm_smul h (-1) (-1 : ℂ) (augmentedForcing h α β n o (cPhys m n) F) + change sobNorm h 1 (Fin.cons (divShift (phase h α β) u) u) ≤ + (C/h)*sobNorm h (-1) (fun i => -augmentedForcing h α β n o (cPhys m n) F i) at huest + rw [hneg] at huest + calc + _ ≤ sobNorm h 1 (Fin.cons (divShift (phase h α β) u) u) := norm_tail_le h _ u + _ ≤ (C/h)*sobNorm h (-1) (augmentedForcing h α β n o (cPhys m n) F) := huest + _ ≤ (C/h)*(K*h*sobNorm h 0 F) := mul_le_mul_of_nonneg_left hb (div_nonneg hC.le hh.le) + _ = C*K*sobNorm h 0 F := by field_simp + _ ≤ C*(1+K)*sobNorm h 0 F := + mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (by linarith : K ≤ 1+K) hC.le) + (Real.sqrt_nonneg _) + +end + +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder ElasticityPhysicalAlgebra +open ElasticityAugmented (coord coeffA coeffV) + +lemma deriv_zero_on {B : Set X} (hB : IsOpen B) (f : S) (hf : EqOn (f : X → ℂ) 0 B) + (v : X) : EqOn (d v f : X → ℂ) 0 B := by + intro x hx + have he : (f : X → ℂ)=ᶠ[𝓝 x] 0 := by + filter_upwards [hB.mem_nhds hx] with y hy using hf hy + change fderiv ℝ (f : X → ℂ) x v=0 + rw [he.fderiv_eq] + simp only [fderiv_zero] + rfl + +lemma dirDeriv_zero_on {B : Set X} (hB : IsOpen B) (h : ℝ) (α β : X) + (f : S) (hf : EqOn (f : X → ℂ) 0 B) (i : Fin 3) : + EqOn (dirDeriv h α β i f : X → ℂ) 0 B := by + intro x hx + simp only [dirDeriv,add_apply,smul_apply,deriv_zero_on hB f hf (e i) hx,hf hx, + smul_zero,add_zero,Pi.zero_apply] + +/-- A local physical solution satisfies the actual normalized four-system, +including its scalar row, on the same open set. -/ +theorem physical_dirSystem_on {B : Set X} (hB : IsOpen B) + (h : ℝ) (hh : h≠0) (α β : X) + (lam m n o : Smooth) (hinv : n*m=1) (hoinv : o*(lam+m+m)=1) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hn : (n : X → ℂ).HasTemperateGrowth) (ho : (o : X → ℂ).HasTemperateGrowth) + (ha : ∀ k i j,((coeffA coord lam m n o k i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hv : ∀ i j,((coeffV coord lam m n o i j : Smooth) : X → ℂ).HasTemperateGrowth) + (hc : ∀ i,(cPhys m n i).HasTemperateGrowth) + (u : Fin 3 → S) (hu : ∀ i,EqOn (physical (phase h α β) lam m u i : X → ℂ) 0 B) : + ∀ i,EqOn (dirSystem h α β (aPhys lam m n o) (vPhys lam m n o) + (Fin.cons (divShift (phase h α β) u) u) i : X → ℂ) 0 B := by + rw [physical_system_identity h hh α β lam m n o hinv hoinv hl hm hn ho ha hv hc u] + intro i x hx + refine Fin.cases ?_ (fun i => ?_) i + · simp only [augmentedForcing,Fin.cons_zero,neg_apply,mult_apply _ ho, + sum_apply,add_apply,smul_apply,mult_apply _ (hc _), + dirDeriv_zero_on hB h α β _ (hu _) _ hx,hu _ hx,Pi.zero_apply, + smul_zero,mul_zero,add_zero,Finset.sum_const_zero,neg_zero] + · simp only [augmentedForcing,Fin.cons_succ,neg_apply,smul_apply, + mult_apply _ hn,hu _ hx,Pi.zero_apply,mul_zero,smul_zero,neg_zero] + +lemma dirSystem_sub (h : ℝ) (α β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (U W : Fin 4 → S) : + dirSystem h α β a v (U-W)=dirSystem h α β a v U-dirSystem h α β a v W := by + have hd (i : Fin 3) (f g : S) : dirDeriv h α β i (f-g)=dirDeriv h α β i f-dirDeriv h α β i g := by + simp only [dirDeriv,map_sub,smul_sub] + module + have hl (a : Fin 3 → X → ℂ) (v : X → ℂ) (f g : S) : + lowerDir h α β a v (f-g)=lowerDir h α β a v f-lowerDir h α β a v g := by + simp only [lowerDir,hd,map_sub,smul_sub,Finset.sum_sub_distrib] + abel + have hp (f g : S) : Pdir h α β (f-g)=Pdir h α β f-Pdir h α β g := by + simp only [Pdir,map_sub,smul_sub] + module + funext i + simp only [dirSystem,Pi.sub_apply,hp,hl,Finset.sum_sub_distrib] + abel + +lemma deriv_supported {K : Set X} (f : S) (hf : tsupport (f : X → ℂ)⊆K) (v : X) : + tsupport (d v f : X → ℂ)⊆K := + (tsupport_fderiv_apply_subset ℝ v).trans hf + +lemma dirSystem_zero_outside {K : Set X} (h : ℝ) (α β : X) + (a : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j,(a k i j).HasTemperateGrowth) (hv : ∀ i j,(v i j).HasTemperateGrowth) + (W : Fin 4 → S) (hW : ∀ i,tsupport (W i : X → ℂ)⊆K) {x : X} (hx : x∉K) (i : Fin 4) : + dirSystem h α β a v W i x=0 := by + have hz (f : S) (hf : tsupport (f : X → ℂ)⊆K) : f x=0 := + image_eq_zero_of_notMem_tsupport (fun ht => hx (hf ht)) + have hd (i : Fin 4) (q : X) : d q (W i) x=0 := hz _ (deriv_supported _ (hW i) q) + have hdd (i : Fin 4) (q r : X) : d q (d r (W i)) x=0 := + hz _ (deriv_supported _ (deriv_supported _ (hW i) r) q) + simp only [dirSystem,Pdir,lowerDir,dirDeriv,lap_apply, + add_apply,sub_apply,smul_apply,sum_apply,mult_apply _ (ha _ _ _),mult_apply _ (hv _ _), + hd,hdd,hz _ (hW _),smul_zero,mul_zero,add_zero,sub_zero,Finset.sum_const_zero] + +lemma dirSystem_difference_zero_outside {K : Set X} (h : ℝ) (α β : X) + (a b : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v w : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j,(a k i j).HasTemperateGrowth) (hb : ∀ k i j,(b k i j).HasTemperateGrowth) + (hv : ∀ i j,(v i j).HasTemperateGrowth) (hw : ∀ i j,(w i j).HasTemperateGrowth) + (hea : ∀ k i j x,x∉K → a k i j x=b k i j x) + (hev : ∀ i j x,x∉K → v i j x=w i j x) + (U : Fin 4 → S) {x : X} (hx : x∉K) (i : Fin 4) : + (dirSystem h α β a v U-dirSystem h α β b w U) i x=0 := by + simp only [Pi.sub_apply,sub_apply,dirSystem,lowerDir,add_apply,sum_apply,smul_apply, + mult_apply _ (ha _ _ _),mult_apply _ (hb _ _ _),mult_apply _ (hv _ _),mult_apply _ (hw _ _), + hea _ _ _ x hx,hev _ _ x hx,sub_self] + +/-- A genuine local pair of homogeneous normalized solutions with compact +supported difference has the global compact forcing identity used by Carleman. +Only equality of the lower-order coefficients off K is required; no artificial +second-order difference term is introduced. -/ +theorem compact_forcing_identity {B K : Set X} (hKB : K⊆B) (h : ℝ) (α β : X) + (a b : Fin 3 → Fin 4 → Fin 4 → X → ℂ) (v w : Fin 4 → Fin 4 → X → ℂ) + (ha : ∀ k i j,(a k i j).HasTemperateGrowth) (hb : ∀ k i j,(b k i j).HasTemperateGrowth) + (hv : ∀ i j,(v i j).HasTemperateGrowth) (hw : ∀ i j,(w i j).HasTemperateGrowth) + (hea : ∀ k i j x,x∉K → a k i j x=b k i j x) + (hev : ∀ i j x,x∉K → v i j x=w i j x) + (U V : Fin 4 → S) (hs : ∀ i,tsupport ((V-U) i : X → ℂ)⊆K) + (hU : ∀ i,EqOn (dirSystem h α β a v U i : X → ℂ) 0 B) + (hV : ∀ i,EqOn (dirSystem h α β b w V i : X → ℂ) 0 B) : + dirSystem h α β b w (V-U)=dirSystem h α β a v U-dirSystem h α β b w U := by + funext i + ext x + by_cases hx : x∈K + · rw [dirSystem_sub] + simp only [Pi.sub_apply,sub_apply,hU i (hKB hx),hV i (hKB hx),Pi.zero_apply] + · rw [dirSystem_zero_outside h α β b w hb hw (V-U) hs hx i, + dirSystem_difference_zero_outside h α β a b v w ha hb hv hw hea hev U hx i] +end ElasticityPhysicalEstimate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/CommonExterior.lean b/lean/OAI/MathematicalPhysics/Elasticity/CommonExterior.lean new file mode 100644 index 0000000000000000000000000000000000000000..49799182ec5e0e79322e1b3f2e78cb05f3992148 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/CommonExterior.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.Elasticity.Transfer + +namespace OAI + +section +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundary +attribute [local instance] Classical.propDecidable +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +omit [FiniteDimensional ℝ E] in +lemma extension_jets {K : Set E} {f g : E → ℝ} (h : f =ᶠ[𝓝ˢ K] g) + {x : E} (hx : x∈K) (n : ℕ) : iteratedFDeriv ℝ n f x=iteratedFDeriv ℝ n g x := by + exact ((h.filter_mono (nhds_le_nhdsSet hx)).iteratedFDeriv ℝ n).self_of_nhds + +/-- Once actual boundary jets have been determined, the source common exterior +reduction follows, including every bounded component of the exterior. -/ +theorem common_exterior_of_all_jets {Ω U₁ U₂ : Set E} (hc : IsCompact (closure Ω)) + (hU₁ : IsOpen U₁) (hU₂ : IsOpen U₂) (h₁ : closure Ω⊆U₁) (h₂ : closure Ω⊆U₂) + (l₁ m₁ l₂ m₂ : E → ℝ) + (hl₁ : ContDiffOn ℝ (⊤ : ℕ∞) l₁ U₁) (hm₁ : ContDiffOn ℝ (⊤ : ℕ∞) m₁ U₁) + (hl₂ : ContDiffOn ℝ (⊤ : ℕ∞) l₂ U₂) (hm₂ : ContDiffOn ℝ (⊤ : ℕ∞) m₂ U₂) + (hp₁ : ∀ x∈closure Ω, 0 < m₁ x ∧ 0 < 3*l₁ x+2*m₁ x) + (hp₂ : ∀ x∈closure Ω, 0 < m₂ x ∧ 0 < 3*l₂ x+2*m₂ x) + (hjl : ∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n l₂ x=iteratedFDeriv ℝ n l₁ x) + (hjm : ∀ n : ℕ, ∀ x∈frontier Ω, iteratedFDeriv ℝ n m₂ x=iteratedFDeriv ℝ n m₁ x) : + ∃ L₁ M₁ L₂ M₂ : E → ℝ, + ContDiff ℝ (⊤ : ℕ∞) L₁ ∧ ContDiff ℝ (⊤ : ℕ∞) M₁ ∧ + ContDiff ℝ (⊤ : ℕ∞) L₂ ∧ ContDiff ℝ (⊤ : ℕ∞) M₂ ∧ + EqOn L₁ l₁ Ω ∧ EqOn M₁ m₁ Ω ∧ EqOn L₂ l₂ Ω ∧ EqOn M₂ m₂ Ω ∧ + (∀ x, 0 < M₁ x ∧ 0 < 3*L₁ x+2*M₁ x) ∧ + (∀ x, 0 < M₂ x ∧ 0 < 3*L₂ x+2*M₂ x) ∧ + EqOn L₂ L₁ Ωᶜ ∧ EqOn M₂ M₁ Ωᶜ ∧ + ∃ K, IsCompact K ∧ ∀ x∉K, L₁ x=0 ∧ M₁ x=1 ∧ L₂ x=0 ∧ M₂ x=1 := by + obtain ⟨L₁,M₁,hL₁,hM₁,heL₁,heM₁,hp,hcL,hcM⟩ := + admissible_global_extension hc hU₁ h₁ l₁ m₁ hl₁ hm₁ hp₁ + obtain ⟨F,hF,_,heF⟩ := smooth_global_extension hc hU₂ h₂ l₂ hl₂ + obtain ⟨G,hG,_,heG⟩ := smooth_global_extension hc hU₂ h₂ m₂ hm₂ + let L₂ := Ω.piecewise F L₁ + let M₂ := Ω.piecewise G M₁ + have hL₂ : ContDiff ℝ (⊤ : ℕ∞) L₂ := by + apply smooth_piecewise_all_jets Ω F L₁ hF hL₁ + intro n x hx + rw [extension_jets heF (frontier_subset_closure hx),extension_jets heL₁ (frontier_subset_closure hx)] + exact hjl n x hx + have hM₂ : ContDiff ℝ (⊤ : ℕ∞) M₂ := by + apply smooth_piecewise_all_jets Ω G M₁ hG hM₁ + intro n x hx + rw [extension_jets heG (frontier_subset_closure hx),extension_jets heM₁ (frontier_subset_closure hx)] + exact hjm n x hx + have heL₂ : EqOn L₂ l₂ Ω := by + intro x hx + exact (piecewise_eq_of_mem Ω F L₁ hx).trans (heF.self_of_nhdsSet (subset_closure hx)) + have heM₂ : EqOn M₂ m₂ Ω := by + intro x hx + exact (piecewise_eq_of_mem Ω G M₁ hx).trans (heG.self_of_nhdsSet (subset_closure hx)) + refine ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂, + fun x hx => heL₁.self_of_nhdsSet (subset_closure hx), + fun x hx => heM₁.self_of_nhdsSet (subset_closure hx),heL₂,heM₂,hp,?_,?_,?_,?_,?_,?_⟩ + · intro x + by_cases hx : x∈Ω + · rw [heL₂ hx,heM₂ hx] + exact hp₂ x (subset_closure hx) + · simpa only [L₂,M₂,piecewise_eq_of_notMem Ω _ _ hx] using hp x + · intro x hx + exact piecewise_eq_of_notMem Ω F L₁ hx + · intro x hx + exact piecewise_eq_of_notMem Ω G M₁ hx + · exact closure Ω ∪ tsupport L₁ ∪ tsupport (fun x => M₁ x-1) + · exact (hc.union hcL).union hcM + · intro x hx + have hO : x∉Ω := fun hh => hx (Or.inl (Or.inl (subset_closure hh))) + have hL : L₁ x=0 := image_eq_zero_of_notMem_tsupport (fun hh => hx (Or.inl (Or.inr hh))) + have hz : (fun x => M₁ x-1) x=0 := image_eq_zero_of_notMem_tsupport (f := fun y => M₁ y-1) (fun hh => hx (Or.inr hh)) + have hM : M₁ x=1 := sub_eq_zero.mp hz + exact ⟨hL,hM,(piecewise_eq_of_notMem Ω F L₁ hO).trans hL, + (piecewise_eq_of_notMem Ω G M₁ hO).trans hM⟩ +end ElasticityBoundary + +end +end +section +noncomputable section +open Set MeasureTheory +namespace Elasticity + +def BoundaryJetDetermination : Prop := + ∀ (Ω : Set X),Domain Ω → ∀ (l₁ m₁ l₂ m₂ : X → ℝ), + Admissible Ω l₁ m₁ → Admissible Ω l₂ m₂ → + DN Ω l₁ m₁=DN Ω l₂ m₂ → + (∀ n : ℕ,∀ x∈frontier Ω,iteratedFDeriv ℝ n l₂ x=iteratedFDeriv ℝ n l₁ x) ∧ + (∀ n : ℕ,∀ x∈frontier Ω,iteratedFDeriv ℝ n m₂ x=iteratedFDeriv ℝ n m₁ x) + +lemma Admissible.common_neighborhood {Ω : Set X} {l m : X → ℝ} (h : Admissible Ω l m) : + ∃ U : Set X,IsOpen U ∧ closure Ω⊆U ∧ + ContDiffOn ℝ (⊤ : ℕ∞) l U ∧ ContDiffOn ℝ (⊤ : ℕ∞) m U := by + obtain ⟨U,hU,hsub,hLu⟩ := h.1 + obtain ⟨V,hV,hsub',hMv⟩ := h.2.1 + exact ⟨U∩V,hU.inter hV,subset_inter hsub hsub',hLu.mono inter_subset_left, + hMv.mono inter_subset_right⟩ + +lemma admissible_of_global {Ω : Set X} {l m : X → ℝ} + (hl : ContDiff ℝ (⊤ : ℕ∞) l) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hp : ∀ x,0 < m x ∧ 0<3*l x+2*m x) : Admissible Ω l m := + ⟨⟨univ,isOpen_univ,subset_univ _,hl.contDiffOn⟩, + ⟨univ,isOpen_univ,subset_univ _,hm.contDiffOn⟩,fun x _ => hp x⟩ + +/-- The extension and DN-localization part of the boundary reduction is fully +proved. The all-jet premise here is explicitly the still-missing boundary +input; this declaration is NOT the main inverse theorem. -/ +theorem admissible_common_exterior_of_jets {Ω : Set X} (hD : Domain Ω) + (l₁ m₁ l₂ m₂ : X → ℝ) (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hjl : ∀ n : ℕ,∀ x∈frontier Ω,iteratedFDeriv ℝ n l₂ x=iteratedFDeriv ℝ n l₁ x) + (hjm : ∀ n : ℕ,∀ x∈frontier Ω,iteratedFDeriv ℝ n m₂ x=iteratedFDeriv ℝ n m₁ x) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + ∃ L₁ M₁ L₂ M₂ : X → ℝ, + ContDiff ℝ (⊤ : ℕ∞) L₁ ∧ ContDiff ℝ (⊤ : ℕ∞) M₁ ∧ + ContDiff ℝ (⊤ : ℕ∞) L₂ ∧ ContDiff ℝ (⊤ : ℕ∞) M₂ ∧ + EqOn L₁ l₁ Ω ∧ EqOn M₁ m₁ Ω ∧ EqOn L₂ l₂ Ω ∧ EqOn M₂ m₂ Ω ∧ + (∀ x,0 < M₁ x ∧ 0<3*L₁ x+2*M₁ x) ∧ + (∀ x,0 < M₂ x ∧ 0<3*L₂ x+2*M₂ x) ∧ + EqOn L₂ L₁ Ωᶜ ∧ EqOn M₂ M₁ Ωᶜ ∧ + DN Ω L₁ M₁=DN Ω L₂ M₂ ∧ + ∃ K,IsCompact K ∧ ∀ x∉K,L₁ x=0 ∧ M₁ x=1 ∧ L₂ x=0 ∧ M₂ x=1 := by + obtain ⟨U₁,hU₁,hs₁,hl₁,hm₁⟩ := ha₁.common_neighborhood + obtain ⟨U₂,hU₂,hs₂,hl₂,hm₂⟩ := ha₂.common_neighborhood + obtain ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂,heL₁,heM₁,heL₂,heM₂,hp₁,hp₂,hexL,hexM,hK⟩ := + ElasticityBoundary.common_exterior_of_all_jets hD.2.2.1.isCompact_closure + hU₁ hU₂ hs₁ hs₂ l₁ m₁ l₂ m₂ hl₁ hm₁ hl₂ hm₂ ha₁.2.2 ha₂.2.2 hjl hjm + refine ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂,heL₁,heM₁,heL₂,heM₂,hp₁,hp₂,hexL,hexM,?_,hK⟩ + exact (DN_coeff_congr hD.1.measurableSet heL₁ heM₁).trans + (hDN.trans (DN_coeff_congr hD.1.measurableSet heL₂ heM₂).symm) +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/CommonFrame.lean b/lean/OAI/MathematicalPhysics/Elasticity/CommonFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..625ba3bf45f12f1639643e584f519f21d2d78a01 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/CommonFrame.lean @@ -0,0 +1,400 @@ +import OAI.MathematicalPhysics.Elasticity.Smoothing + +namespace OAI + +section +noncomputable section +open Set MeasureTheory Filter TemperedDistribution +open scoped BigOperators SchwartzMap Topology +namespace Elasticity +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityDistribution (Coeff Dist LocalEq AugHilbert leadingRd leadingSd normald) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityNegativeOrder (sobNorm) +open ElasticityCGO + +theorem dn_smooth_transport_column {Ω B B' B₀ : Set X} + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hB : IsOpen B) + (hBB : Bornology.IsBounded B) (hB' : IsOpen B') (hsub : B'⊆B) (hcl : closure Ω⊆B') + (R : ℝ) (hR : 1≤R) (hKR : closure Ω⊆Metric.closedBall 0 R) + (hBR : B⊆Metric.ball 0 R) (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) + (χ g η : Smooth) (hcχ : HasCompactSupport (χ : X → ℂ)) + (hc : HasCompactSupport (g : X → ℂ)) (hs : tsupport (g : X → ℂ)⊆B) + (hχ : EqOn (χ : X → ℂ) 1 B) (hg : EqOn (g : X → ℂ) 1 B') + (hcη : HasCompactSupport (η : X → ℂ)) (hsη : tsupport (η : X → ℂ)⊆Metric.ball 0 R) + (hη : EqOn (η : X → ℂ) 1 B) + (a : ℕ → Amplitude Smooth) + (ha : PhysicalColumn R hR α β (smoothOfReal (lam 0) (hl 0)) (smoothOfReal (m 0) (hm 0)) a) + (h₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,EqOn (fun x => ((normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(ElasticityAugmented.div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) (Metric.ball 0 R)) + (hB₀ : IsOpen B₀) (hKB₀ : closure Ω⊆B₀) + (ρ : Smooth) (hcρ : HasCompactSupport (ρ : X → ℂ)) + (hρs : tsupport (ρ : X → ℂ)⊆B') (hρ1 : EqOn (ρ : X → ℂ) 1 B₀) : + let θ := fun i => (α i : ℂ)+Complex.I*(β i : ℂ) + ∃ v : Fin 4 → Smooth, + (∀ i,tsupport ((v i-(Fin.cons (a 0).2 (a 0).1 : Fin 4 → Smooth) i : Smooth) : X → ℂ)⊆closure Ω) ∧ + (∀ i,EqOn (leadingR coord θ (smoothOfReal (lam 1) (hl 1)) (smoothOfReal (m 1) (hm 1)) + (fun j => v j.succ) (v 0) i).val 0 B') ∧ + EqOn (leadingS coord θ (smoothOfReal (lam 1) (hl 1)) (smoothOfReal (m 1) (hm 1)) + (fun j => v j.succ) (v 0)).val 0 B' ∧ + normal θ (fun j => v j.succ)=0 := by + intro θ + let l := smoothOfReal (lam 1) (hl 1) + let μ := smoothOfReal (m 1) (hm 1) + let L : Coeff := ⟨l,(hcll 1).growth⟩ + let M : Coeff := ⟨μ,(hclm 1).growth⟩ + have hm0 : ∀ x,(μ : X → ℂ) x≠0 := fun x => Complex.ofReal_ne_zero.mpr (hp 1 x).1.ne' + have he0 : ∀ x,((l+μ+μ : Smooth) : X → ℂ) x≠0 := by + intro x + change (lam 1 x : ℂ)+(m 1 x : ℂ)+(m 1 x : ℂ)≠0 + exact_mod_cast (real_longitudinal_positive (lam 1) (m 1) (hp 1) x).ne' + let n := ElasticityDistribution.inverseCoeff μ (hclm 1) hm0 + let o := ElasticityDistribution.inverseCoeff (l+μ+μ) (((hcll 1).add (hclm 1)).add (hclm 1)) he0 + have hn : n*M=1 := ElasticityDistribution.inverseCoeff_mul μ (hclm 1) hm0 + have ho : o*(L+M+M)=1 := by + apply Subtype.ext + exact ElasticityCoeffBounds.reciprocal_mul (l+μ+μ) he0 + have hne : θ≠0 := by + intro hz + apply hα + ext i + change α i=0 + have hh := congrArg Complex.re (congrFun hz i) + simpa [θ] using hh + obtain ⟨W,hRW,hS,hN,hE⟩ := dn_weak_transport_column hΩ hOB hB hBB hB' hsub hcl + R hR hKR hBR α β hα hθ lam m hl hm hp hcll hclm he hDN χ g η hcχ hc hs hχ hg + hcη hsη hη a ha h₀ hrec + obtain ⟨v,hv,hvs⟩ := ElasticityDistribution.weak_leading_smooth hOB.isCompact_closure hB₀ hKB₀ + θ hθ hne L M n o hn ho W (localizedLeading R hR a η) hE hRW hS + ρ (smooth_coe ρ) hcρ hρs hρ1 + have hR' : ∀ i,LocalEq B' (leadingRd θ L M (fun j => (v j.succ : Dist)) (v 0 : Dist) i) 0 := by + simpa only [hv] using hRW + have hS' : LocalEq B' (leadingSd θ L M (fun j => (v j.succ : Dist)) (v 0 : Dist)) 0 := by + simpa only [hv] using hS + have hN' : LocalEq B' (normald θ (fun j => (v j.succ : Dist))) 0 := by + simpa only [hv] using hN + exact ElasticityDistribution.smooth_column_patch hB' hcl θ L M v (localizedLeading R hR a η) + (Fin.cons (a 0).2 (a 0).1) hvs + (fun i => (localizedLeading_eqOn hB R hR hBR a η hcη hη i).mono hsub) hR' hS' hN' h₀ +end Elasticity + +end +end +section +noncomputable section +open Set +open scoped BigOperators +namespace Elasticity +open ElasticityAugmented ElasticityCGO +open ElasticityCoeffBounds (ExteriorConstant) +/-- Three actual transferred physical leading columns, in the same constrained +fiber as the original globally independent frame. The new columns need not be +assumed independent. -/ +theorem dn_common_leading_frame {Ω : Set X} (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) + (r₀ : ℝ) (hr₀ : 1≤r₀) (hK : closure Ω⊆Metric.closedBall 0 r₀) + (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) : + let θ := fun i => (α i : ℂ)+Complex.I*(β i : ℂ) + let l := fun q => smoothOfReal (lam q) (hl q) + let μ := fun q => smoothOfReal (m q) (hm q) + let r := positiveRoot (m 0) (hm 0) (fun x => (hp 0 x).1) + let hr := positiveRoot_nonzero (m 0) (hm 0) (fun x => (hp 0 x).1) + ∃ a : Fin 2 → Fin 3 → Amplitude Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ q ν,normal θ (a q ν).1=0) ∧ + (∀ q ν i,EqOn ((leadingR coord θ (l q) (μ q) (a q ν).1 (a q ν).2 i : Smooth) : X → ℂ) 0 (Metric.ball 0 (r₀+3))) ∧ + (∀ q ν,EqOn ((leadingS coord θ (l q) (μ q) (a q ν).1 (a q ν).2 : Smooth) : X → ℂ) 0 (Metric.ball 0 (r₀+3))) ∧ + (∀ ν i,tsupport ((((Fin.cons (a 1 ν).2 (a 1 ν).1 : Fin 4 → Smooth) i- + (Fin.cons (a 0 ν).2 (a 0 ν).1 : Fin 4 → Smooth) i : Smooth)) : X → ℂ)⊆closure Ω) ∧ + ∀ ν x,((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (a 0 ν).1 i : X → ℂ) x), + (changeS (l 0+μ 0) r hr (a 0 ν).1 (a 0 ν).2 : X → ℂ) x) := by + intro θ l μ r hr + let R := r₀+7 + have hR : 1≤R := by dsimp [R]; linarith + have hne : θ≠0 := by + intro hz + apply hα + ext i + change α i=0 + have hh := congrArg Complex.re (congrFun hz i) + simpa [θ] using hh + have hC : IsCompact (closure (Metric.ball (0 : X) R)) := + (isCompact_closedBall (0 : X) R).of_isClosed_subset isClosed_closure + (closure_minimal Metric.ball_subset_closedBall Metric.isClosed_closedBall) + obtain ⟨a,B,hn,hL,hrec,hB⟩ := exists_real_physical_series Metric.isOpen_ball hC θ hθ hne + (lam 0) (m 0) (hl 0) (hm 0) (hp 0) + let χ : Fin 5 → Smooth := fun i => ⟨fiveCutoff r₀ hr₀ i,fiveCutoff_smooth r₀ hr₀ i⟩ + have hball {s t : ℝ} (hst : s Complex.conj_ofReal _) (fun x => Complex.conj_ofReal _) + (fun x => Complex.ofReal_ne_zero.mpr (hp 0 x).1.ne') (fun x => ?_) + (a ν) (hL ν).1 (hn ν) (fun j _ => hrec ν j) + change (lam 0 x : ℂ)+(m 0 x : ℂ)+(m 0 x : ℂ)≠0 + exact_mod_cast (real_longitudinal_positive (lam 0) (m 0) (hp 0) x).ne' + have hex (ν : Fin 3) := dn_smooth_transport_column hΩ hOB Metric.isOpen_ball Metric.isBounded_ball + (B := Metric.ball 0 (r₀+5)) (B' := Metric.ball 0 (r₀+3)) Metric.isOpen_ball + (Metric.ball_subset_ball (by linarith)) hcb R hR + (hK.trans (Metric.closedBall_subset_closedBall (by dsimp [R]; linarith))) + (Metric.ball_subset_ball (by dsimp [R]; linarith)) α β hα hθ lam m hl hm hp hcll hclm he hDN + (χ 4) (χ 2) (χ 4) (fiveCutoff_compact r₀ hr₀ 4) (fiveCutoff_compact r₀ hr₀ 2) + ((fiveCutoff_support r₀ hr₀ 2).trans (hball (by norm_num; linarith))) + (fun x hx => fiveCutoff_one r₀ hr₀ 4 (by convert Metric.ball_subset_closedBall hx using 1; norm_num [add_assoc])) + (fun x hx => fiveCutoff_one r₀ hr₀ 2 (by convert Metric.ball_subset_closedBall hx using 1; norm_num [add_assoc])) + (fiveCutoff_compact r₀ hr₀ 4) ((fiveCutoff_support r₀ hr₀ 4).trans (hball (by norm_num; dsimp [R]; linarith))) + (fun x hx => fiveCutoff_one r₀ hr₀ 4 (by convert Metric.ball_subset_closedBall hx using 1; norm_num [add_assoc])) + (a ν) (hpc ν) (hn ν) + (fun j _ x _ => congrArg (fun f : Smooth => (f : X → ℂ) x) (hrec ν j).2.2) + (B₀ := Metric.ball 0 (r₀+1)) Metric.isOpen_ball (hK.trans (hball (by linarith))) + (χ 0) (fiveCutoff_compact r₀ hr₀ 0) + ((fiveCutoff_support r₀ hr₀ 0).trans (hball (by norm_num))) + (fun x hx => fiveCutoff_one r₀ hr₀ 0 (by convert Metric.ball_subset_closedBall hx using 1; norm_num [add_assoc])) + choose v hvs hvR hvS hvn using hex + let A : Fin 2 → Fin 3 → Amplitude Smooth := ![(fun ν => a ν 0),fun ν => ((fun i => v ν i.succ),v ν 0)] + have hR₀ (ν i) : EqOn ((leadingR coord θ (l 0) (μ 0) (a ν 0).1 (a ν 0).2 i : Smooth) : X → ℂ) 0 + (Metric.ball 0 (r₀+3)) := by + have hh := congrFun (hL ν).1 i + dsimp only [localAmp] at hh + rw [← restrict_leadingR Metric.isOpen_ball] at hh + intro x hx + exact (restrictSmooth_zero_iff _ _).mp hh x (Metric.ball_subset_ball (by dsimp [R]; linarith) hx) + have hS₀ (ν) : EqOn ((leadingS coord θ (l 0) (μ 0) (a ν 0).1 (a ν 0).2 : Smooth) : X → ℂ) 0 + (Metric.ball 0 (r₀+3)) := by + have hh := (hL ν).2 + dsimp only [localAmp] at hh + rw [← restrict_leadingS Metric.isOpen_ball] at hh + intro x hx + exact (restrictSmooth_zero_iff _ _).mp hh x (Metric.ball_subset_ball (by dsimp [R]; linarith) hx) + refine ⟨A,B,?_,?_,?_,?_,hB⟩ + · intro q ν + fin_cases q + · exact hn ν + · exact hvn ν + · intro q ν i + fin_cases q + · exact hR₀ ν i + · exact hvR ν i + · intro q ν + fin_cases q + · exact hS₀ ν + · exact hvS ν + · intro ν i + refine Fin.cases ?_ (fun j => ?_) i + · exact hvs ν 0 + · exact hvs ν j.succ +end Elasticity + +end +end +section +noncomputable section +open Set +open scoped BigOperators +namespace ElasticityAugmented +lemma smooth_sum_eval {ι : Type*} [Fintype ι] (f : ι → Smooth) (x : X) : + ((∑ i,f i : Smooth) : X → ℂ) x=∑ i,(f i : X → ℂ) x := by + exact map_sum ((Pi.evalRingHom (fun _ : X => ℂ) x).comp Smooth.val.toRingHom) f Finset.univ +lemma eqOn_coord {U : Set X} (hU : IsOpen U) (f g : Smooth) + (he : EqOn (f : X → ℂ) g U) (i : Fin 3) : + EqOn (coord i f : X → ℂ) (coord i g) U := by + apply (restrictSmooth_eq_iff U _ _).mp + rw [← localCoord_restrict hU,← localCoord_restrict hU,(restrictSmooth_eq_iff U f g).mpr he] +lemma eqOn_direction {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (f g : Smooth) + (he : EqOn (f : X → ℂ) g U) : + EqOn (direction (A := Smooth) coord θ f : X → ℂ) (direction (A := Smooth) coord θ g) U := by + apply (restrictSmooth_eq_iff U _ _).mp + rw [restrict_direction hU,restrict_direction hU,(restrictSmooth_eq_iff U f g).mpr he] +lemma eqOn_logarithmicGrad {U : Set X} (hU : IsOpen U) (r₀ r₁ : Smooth) + (hr₀ : ∀ x,(r₀ : X → ℂ) x≠0) (hr₁ : ∀ x,(r₁ : X → ℂ) x≠0) + (he : EqOn (r₀ : X → ℂ) r₁ U) (i : Fin 3) : + EqOn (logarithmicGrad r₀ hr₀ i : X → ℂ) (logarithmicGrad r₁ hr₁ i) U := by + intro x hx + change 2*((r₀ : X → ℂ) x)⁻¹*(coord i r₀ : X → ℂ) x= + 2*((r₁ : X → ℂ) x)⁻¹*(coord i r₁ : X → ℂ) x + rw [he hx,eqOn_coord hU r₀ r₁ he i hx] +lemma eqOn_physical_change {U : Set X} (hU : IsOpen U) (k₀ k₁ r₀ r₁ : Smooth) + (hr₀ : ∀ x,(r₀ : X → ℂ) x≠0) (hr₁ : ∀ x,(r₁ : X → ℂ) x≠0) + (a₀ a₁ : Fin 3 → Smooth) (b₀ b₁ : Smooth) + (hk : EqOn (k₀ : X → ℂ) k₁ U) (hr : EqOn (r₀ : X → ℂ) r₁ U) + (ha : ∀ i,EqOn (a₀ i : X → ℂ) (a₁ i) U) (hb : EqOn (b₀ : X → ℂ) b₁ U) : + (∀ i,EqOn (changeP r₀ a₀ i : X → ℂ) (changeP r₁ a₁ i) U) ∧ + EqOn (changeS k₀ r₀ hr₀ a₀ b₀ : X → ℂ) (changeS k₁ r₁ hr₁ a₁ b₁) U := by + have hp (i) : EqOn (changeP r₀ a₀ i : X → ℂ) (changeP r₁ a₁ i) U := by + intro x hx + change (r₀ : X → ℂ) x*(a₀ i : X → ℂ) x=(r₁ : X → ℂ) x*(a₁ i : X → ℂ) x + rw [hr hx,ha i hx] + refine ⟨hp,fun x hx => ?_⟩ + simp only [changeS,Subalgebra.coe_smul,Subalgebra.coe_add,Subalgebra.coe_mul, + smooth_sum_eval,Pi.smul_apply,Pi.add_apply,Pi.mul_apply,smoothInv_apply] + rw [hk hx,hr hx,hb hx] + rw [show (∑ i,(logarithmicGrad r₀ hr₀ i : X → ℂ) x*(changeP r₀ a₀ i : X → ℂ) x)= + ∑ i,(logarithmicGrad r₁ hr₁ i : X → ℂ) x*(changeP r₁ a₁ i : X → ℂ) x from + Finset.sum_congr rfl (fun i _ => by rw [eqOn_logarithmicGrad hU r₀ r₁ hr₀ hr₁ hr i hx,hp i hx])] +lemma eqOn_transport {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (k₀ k₁ r₀ r₁ : Smooth) + (hr₀ : ∀ x,(r₀ : X → ℂ) x≠0) (hr₁ : ∀ x,(r₁ : X → ℂ) x≠0) + (hk₀ : ∀ x,(k₀ : X → ℂ) x≠0) (hk₁ : ∀ x,(k₁ : X → ℂ) x≠0) + (hl₀ : ∀ x,((k₀+r₀*r₀ : Smooth) : X → ℂ) x≠0) + (hl₁ : ∀ x,((k₁+r₁*r₁ : Smooth) : X → ℂ) x≠0) + (hk : EqOn (k₀ : X → ℂ) k₁ U) (hr : EqOn (r₀ : X → ℂ) r₁ U) : + EqOn (transportT θ k₀ r₀ hk₀ hl₀ : X → ℂ) (transportT θ k₁ r₁ hk₁ hl₁) U ∧ + ∀ i,EqOn (transportQ θ k₀ r₀ hr₀ hk₀ hl₀ i : X → ℂ) + (transportQ θ k₁ r₁ hr₁ hk₁ hl₁ i) U := by + have hl : EqOn ((k₀+r₀*r₀ : Smooth) : X → ℂ) (k₁+r₁*r₁ : Smooth) U := by + intro x hx + change (k₀ : X → ℂ) x+(r₀ : X → ℂ) x*(r₀ : X → ℂ) x=_ + rw [hk hx,hr hx] + rfl + have hγ : EqOn (thetaGamma θ r₀ hr₀ : X → ℂ) (thetaGamma θ r₁ hr₁) U := by + intro x hx + simp only [thetaGamma,smooth_sum_eval,Subalgebra.coe_smul,Pi.smul_apply] + exact Finset.sum_congr rfl (fun i _ => by rw [eqOn_logarithmicGrad hU r₀ r₁ hr₀ hr₁ hr i hx]) + constructor + · intro x hx + simp only [transportT,Subalgebra.coe_sub,Subalgebra.coe_mul,Pi.sub_apply,Pi.mul_apply,smoothInv_apply] + rw [hk hx,hl hx,eqOn_direction hU θ k₀ k₁ hk hx, + eqOn_direction hU θ (k₀+r₀*r₀) (k₁+r₁*r₁) hl hx] + · intro i x hx + simp only [transportQ,Subalgebra.coe_smul,Subalgebra.coe_sub,Subalgebra.coe_mul, + Pi.smul_apply,Pi.sub_apply,Pi.mul_apply,smoothInv_apply] + rw [hr hx,hk hx,hl hx,hγ hx,eqOn_direction hU θ k₀ k₁ hk hx, + eqOn_logarithmicGrad hU r₀ r₁ hr₀ hr₁ hr i hx, + eqOn_direction hU θ _ _ (eqOn_logarithmicGrad hU r₀ r₁ hr₀ hr₁ hr i) hx] +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators +namespace Elasticity +open ElasticityAugmented ElasticityCGO +open ElasticityCoeffBounds (ExteriorConstant) +lemma null_real_imag (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) : + ∃ α β : X,α≠0 ∧ θ=fun i => (α i : ℂ)+Complex.I*(β i : ℂ) := by + let J := ElasticityParameter.characteristicPlane ElasticityParameter.basis θ + refine ⟨J 1,J Complex.I,?_,?_⟩ + · intro hh + have hz : J 1=J 0 := by rw [hh,map_zero] + exact one_ne_zero (ElasticityParameter.null_plane_injective θ hθ hne hz) + · funext i + have ha : J 1 i=(θ i).re := by + simp only [J,ElasticityParameter.characteristicPlane,add_apply, + ContinuousLinearMap.smulRight_apply,Complex.reCLM_apply,Complex.imCLM_apply, + Complex.one_re,Complex.one_im,one_smul,zero_smul,add_zero] + exact ElasticityParameter.basis_sum_apply _ i + have hb : J Complex.I i=(θ i).im := by + simp only [J,ElasticityParameter.characteristicPlane,add_apply, + ContinuousLinearMap.smulRight_apply,Complex.reCLM_apply,Complex.imCLM_apply, + Complex.I_re,Complex.I_im,one_smul,zero_smul,zero_add] + exact ElasticityParameter.basis_sum_apply _ i + rw [ha,hb,mul_comm] + exact (Complex.re_add_im (θ i)).symm + +/-- The DN-derived common physical frame in the exact normal variables. +All coefficients and the exterior identification are still the actual Lamé pair. -/ +theorem dn_common_normal_frame {Ω : Set X} (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) + (r₀ : ℝ) (hr₀ : 1≤r₀) (hK : closure Ω⊆Metric.closedBall 0 r₀) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) : + let k := fun q => smoothOfReal (lam q) (hl q)+smoothOfReal (m q) (hm q) + let r := fun q => positiveRoot (m q) (hm q) (fun x => (hp q x).1) + let hr := fun q => positiveRoot_nonzero (m q) (hm q) (fun x => (hp q x).1) + ∃ hk : ∀ q x,(k q : X → ℂ) x≠0, + ∃ hL : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0, + ∃ p : Fin 2 → Fin 3 → Fin 3 → Smooth,∃ s : Fin 2 → Fin 3 → Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ q ν,normal θ (p q ν)=0) ∧ + (∀ q ν x,x∈Metric.ball 0 (r₀+3) → + (∀ i,(direction (A := Smooth) coord θ (p q ν i) : X → ℂ) x=θ i*(s q ν : X → ℂ) x) ∧ + (direction (A := Smooth) coord θ (s q ν) : X → ℂ) x= + ((transportT θ (k q) (r q) (hk q) (hL q)*s q ν+ + ∑ i,transportQ θ (k q) (r q) (hr q) (hk q) (hL q) i*p q ν i : Smooth) : X → ℂ) x) ∧ + (∀ ν x,x∉closure Ω → (∀ i,(p 0 ν i : X → ℂ) x=(p 1 ν i : X → ℂ) x) ∧ + (s 0 ν : X → ℂ) x=(s 1 ν : X → ℂ) x) ∧ + ∀ ν x,((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (p 0 ν i : X → ℂ) x),(s 0 ν : X → ℂ) x) := by + intro k r hr + obtain ⟨α,β,hα,hαβ⟩ := null_real_imag θ hθ hne + have heq (i) := congrFun hαβ i + have hθ' : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0 := by + simpa only [← heq] using hθ + have hh := dn_common_leading_frame hΩ hOB r₀ hr₀ hK α β hα hθ' lam m hl hm hp hcll hclm he hDN + dsimp only at hh + rw [← hαβ] at hh + obtain ⟨a,B,hn,hR,hS,hs,hB⟩ := hh + have hr2 (q) : r q*r q=smoothOfReal (m q) (hm q) := positiveRoot_square _ _ _ + have hk : ∀ q x,(k q : X → ℂ) x≠0 := by + intro q x + change (lam q x : ℂ)+(m q x : ℂ)≠0 + exact_mod_cast (real_k_positive (lam q) (m q) (hp q) x).ne' + have hL : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0 := by + intro q x + rw [hr2] + change (lam q x : ℂ)+(m q x : ℂ)+(m q x : ℂ)≠0 + exact_mod_cast (real_longitudinal_positive (lam q) (m q) (hp q) x).ne' + let p := fun q ν => changeP (r q) (a q ν).1 + let s := fun q ν => changeS (k q) (r q) (hr q) (a q ν).1 (a q ν).2 + refine ⟨hk,hL,p,s,B,?_,?_,?_,hB⟩ + · intro q ν + have heq : normal θ (p q ν)=r q*normal θ (a q ν).1 := by + simp only [p,normal,changeP,Algebra.smul_def,Finset.mul_sum] + exact Finset.sum_congr rfl (fun i _ => by ring) + rw [heq,hn,mul_zero] + · intro q ν x hx + apply (leading_equations_at_iff θ (k q) (r q) (hr q) (hk q) (hL q) (a q ν).1 (a q ν).2 x).mp + simpa only [hr2,k,add_sub_cancel_right] using ⟨fun i => hR q ν i hx,hS q ν hx⟩ + · intro ν x hx + have hkE : EqOn (k 0 : X → ℂ) (k 1) (closure Ω)ᶜ := by + intro y hy + have hy' : y∉Ω := fun hyΩ => hy (subset_closure hyΩ) + change (lam 0 y : ℂ)+(m 0 y : ℂ)=(lam 1 y : ℂ)+(m 1 y : ℂ) + rw [(he y hy').1,(he y hy').2] + have hrE : EqOn (r 0 : X → ℂ) (r 1) (closure Ω)ᶜ := by + intro y hy + change (Real.sqrt (m 0 y) : ℂ)=(Real.sqrt (m 1 y) : ℂ) + rw [(he y (fun hyΩ => hy (subset_closure hyΩ))).2] + have haE (i : Fin 4) : EqOn + (((Fin.cons (a 0 ν).2 (a 0 ν).1 : Fin 4 → Smooth) i) : X → ℂ) + ((Fin.cons (a 1 ν).2 (a 1 ν).1 : Fin 4 → Smooth) i) (closure Ω)ᶜ := by + intro y hy + have hz := image_eq_zero_of_notMem_tsupport (fun hh => hy (hs ν i hh)) + exact (sub_eq_zero.mp hz).symm + have hc := eqOn_physical_change isClosed_closure.isOpen_compl (k 0) (k 1) (r 0) (r 1) + (hr 0) (hr 1) (a 0 ν).1 (a 1 ν).1 (a 0 ν).2 (a 1 ν).2 hkE hrE + (fun i => haE i.succ) (haE 0) + exact ⟨fun i => hc.1 i hx,hc.2 hx⟩ +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Compact.lean b/lean/OAI/MathematicalPhysics/Elasticity/Compact.lean new file mode 100644 index 0000000000000000000000000000000000000000..e325da43074092aa41c7f685efb8df4036ea55c7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Compact.lean @@ -0,0 +1,216 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open Set Filter Topology +namespace ElasticityCompact +variable {A P F : Type*} [TopologicalSpace A] [CompactSpace A] + [NormedAddCommGroup P] [NormedSpace ℝ P] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Interchanging a compact continuous-variable slot and a bounded linear slot. -/ +def flipLinear (q : C(A,P →L[ℝ] F)) : P →L[ℝ] C(A,F) := + LinearMap.mkContinuous + ({ toFun := fun p => ⟨fun a => q a p,q.continuous.clm_apply continuous_const⟩ + map_add' := fun v w => by ext a; exact map_add (q a) v w + map_smul' := fun c v => by ext a; exact map_smul (q a) c v } : P →ₗ[ℝ] C(A,F)) + ‖q‖ (fun p => by + change ‖(⟨fun a => q a p,q.continuous.clm_apply continuous_const⟩ : C(A,F))‖ ≤ ‖q‖ * ‖p‖ + apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg q) (norm_nonneg p))).mpr + intro a + exact (q a).le_opNorm p |>.trans (mul_le_mul_of_nonneg_right + (q.norm_coe_le_norm a) (norm_nonneg p))) +lemma flipLinear_apply (q : C(A,P →L[ℝ] F)) (p : P) (a : A) : flipLinear q p a=q a p := rfl + +def flipCLM : C(A,P →L[ℝ] F) →L[ℝ] (P →L[ℝ] C(A,F)) := + LinearMap.mkContinuous + ({ toFun := fun q : C(A,P →L[ℝ] F) => flipLinear q + map_add' := fun q r => by ext p a; rfl + map_smul' := fun c q => by ext p a; rfl } : + C(A,P →L[ℝ] F) →ₗ[ℝ] (P →L[ℝ] C(A,F))) 1 (fun q : C(A,P →L[ℝ] F) => by + change ‖flipLinear q‖ ≤ 1 * ‖q‖ + rw [one_mul] + apply ContinuousLinearMap.opNorm_le_bound (flipLinear q) (norm_nonneg q) + intro p + exact + (ContinuousMap.norm_le (flipLinear q p) (mul_nonneg (norm_nonneg q) (norm_nonneg p))).mpr + (fun a => (q a).le_opNorm p |>.trans + (mul_le_mul_of_nonneg_right (q.norm_coe_le_norm a) (norm_nonneg p)))) + +lemma hasFDerivAt_compact (f : P → C(A,F)) (q : P → C(A,P →L[ℝ] F)) + (hq : Continuous q) + (hd : ∀ p a, HasFDerivAt (fun p => f p a) (q p a) p) (p : P) : + HasFDerivAt f (flipLinear (q p)) p := by + rw [hasFDerivAt_iff_isLittleO,Asymptotics.isLittleO_iff] + intro ε hε + obtain ⟨r,hr,he⟩ := (Metric.continuousAt_iff (f := q) (a := p)).mp hq.continuousAt ε hε + filter_upwards [Metric.ball_mem_nhds p hr] with y hy + apply (ContinuousMap.norm_le _ (mul_nonneg hε.le (norm_nonneg _))).mpr + intro a + have hb (z : P) (hz : z∈Metric.ball p r) : ‖q z a-q p a‖ ≤ ε := by + have hh := le_of_lt (he hz) + simpa only [dist_eq_norm] using (ContinuousMap.dist_apply_le_dist (f := q z) (g := q p) a).trans hh + exact Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le' + (fun z _ => (hd z a).hasFDerivWithinAt) hb (convex_ball p r) + (Metric.mem_ball_self hr) hy + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] +def curryCompact (f : P × E → F) (hf : Continuous f) (j : A → E) (hj : Continuous j) : + P → C(A,F) := + fun p => ⟨fun a => f (p,j a),hf.comp (continuous_const.prodMk hj)⟩ +omit [CompactSpace A] [NormedSpace ℝ P] [NormedSpace ℝ F] [NormedSpace ℝ E] in +lemma curryCompact_apply (f : P × E → F) (hf : Continuous f) (j : A → E) (hj : Continuous j) + (p : P) (a : A) : curryCompact f hf j hj p a=f (p,j a) := rfl +omit [CompactSpace A] [NormedSpace ℝ P] [NormedSpace ℝ F] [NormedSpace ℝ E] in +lemma curryCompact_continuous (f : P × E → F) (hf : Continuous f) (j : A → E) (hj : Continuous j) : + Continuous (curryCompact f hf j hj) := by + apply ContinuousMap.continuous_of_continuous_uncurry + exact hf.comp (continuous_fst.prodMk (hj.comp continuous_snd)) + +lemma curryCompact_hasFDerivAt (f : P × E → F) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (j : A → E) (hj : Continuous j) (p : P) : + HasFDerivAt (curryCompact f hf.continuous j hj) + (flipLinear ⟨fun a => (fderiv ℝ f (p,j a)).comp (ContinuousLinearMap.inl ℝ P E), + ((hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).continuous.comp (continuous_const.prodMk hj)).clm_comp continuous_const⟩) p := by + let q : P → C(A,P →L[ℝ] F) := fun p => + ⟨fun a => (fderiv ℝ f (p,j a)).comp (ContinuousLinearMap.inl ℝ P E), + ((hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).continuous.comp (continuous_const.prodMk hj)).clm_comp continuous_const⟩ + apply hasFDerivAt_compact _ q ?_ ?_ p + · apply ContinuousMap.continuous_of_continuous_uncurry + exact ((hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).continuous.comp + (continuous_fst.prodMk (hj.comp continuous_snd))).clm_comp continuous_const + · intro p a + exact (hf.differentiable (by simp) (p,j a)).hasFDerivAt.comp p + ((hasFDerivAt_id p).prodMk (hasFDerivAt_const (j a) p)) + +/-- Smooth currying over a compact set. This supplies the Banach-space parameter +regularity needed for the actual coefficient multipliers and linear ODE. -/ +theorem curryCompact_contDiff [FiniteDimensional ℝ P] + (f : P × E → F) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (j : A → E) (hj : Continuous j) : + ContDiff ℝ (⊤ : ℕ∞) (curryCompact f hf.continuous j hj) := by + apply contDiff_infty.mpr + intro n + induction n generalizing f with + | zero => + simp only [Nat.cast_zero,contDiff_zero] + exact curryCompact_continuous f hf.continuous j hj + | succ n ih => + rw [Nat.cast_add,Nat.cast_one,contDiff_succ_iff_fderiv_apply] + refine ⟨fun p => (curryCompact_hasFDerivAt f hf j hj p).differentiableAt,by simp,fun v => ?_⟩ + let f' : P × E → F := fun q => fderiv ℝ f q (v,0) + have hf' : ContDiff ℝ (⊤ : ℕ∞) f' := (hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const + have he : (fun p => fderiv ℝ (curryCompact f hf.continuous j hj) p v)= + curryCompact f' hf'.continuous j hj := by + funext p + ext a + rw [(curryCompact_hasFDerivAt f hf j hj p).fderiv] + rfl + rw [he] + exact ih f' hf' +end ElasticityCompact + +end +end +section +noncomputable section +open MeasureTheory Set Filter Function +open scoped ENNReal +namespace ElasticityCompact +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] +variable {S : Set E} [CompactSpace S] +def zeroExtend (f : C(S,ℂ)) : E → ℂ := Function.extend Subtype.val f 0 +omit [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [CompactSpace S] in +lemma zeroExtend_mem (f : C(S,ℂ)) (x : S) : zeroExtend f x=f x := + Subtype.val_injective.extend_apply f 0 x +omit [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [CompactSpace S] in +lemma zeroExtend_notMem (f : C(S,ℂ)) {x : E} (hx : x∉S) : zeroExtend f x=0 := by + apply Function.extend_apply' + rintro ⟨y,rfl⟩ + exact hx y.property +omit [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma zeroExtend_norm (f : C(S,ℂ)) (x : E) : ‖zeroExtend f x‖ ≤ ‖f‖ := by + by_cases hx : x∈S + · exact (zeroExtend_mem f ⟨x,hx⟩) ▸ f.norm_coe_le_norm ⟨x,hx⟩ + · rw [zeroExtend_notMem f hx,norm_zero]; exact norm_nonneg _ +omit [NormedSpace ℝ E] in +lemma zeroExtend_memLp (hS : MeasurableSet S) (μ : Measure E) (f : C(S,ℂ)) : + MemLp (zeroExtend f) ∞ μ := by + apply memLp_top_of_bound _ ‖f‖ (Eventually.of_forall (zeroExtend_norm f)) + exact ((MeasurableEmbedding.subtype_coe hS).stronglyMeasurable_extend + f.continuous.stronglyMeasurable stronglyMeasurable_const).aestronglyMeasurable +omit [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [CompactSpace S] in +lemma zeroExtend_add (f g : C(S,ℂ)) : zeroExtend (f+g)=zeroExtend f+zeroExtend g := by + funext x + by_cases hx : x∈S + · change zeroExtend (f+g) (⟨x,hx⟩ : S)=zeroExtend f (⟨x,hx⟩ : S)+zeroExtend g (⟨x,hx⟩ : S) + rw [zeroExtend_mem (f+g) ⟨x,hx⟩,zeroExtend_mem f ⟨x,hx⟩,zeroExtend_mem g ⟨x,hx⟩] + rfl + · simp only [Pi.add_apply,zeroExtend_notMem _ hx,add_zero] +omit [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [CompactSpace S] in +lemma zeroExtend_smul (c : ℂ) (f : C(S,ℂ)) : zeroExtend (c • f)=c • zeroExtend f := by + funext x + by_cases hx : x∈S + · change zeroExtend (c • f) (⟨x,hx⟩ : S)=c • zeroExtend f (⟨x,hx⟩ : S) + rw [zeroExtend_mem (c • f) ⟨x,hx⟩,zeroExtend_mem f ⟨x,hx⟩] + rfl + · simp only [Pi.smul_apply,zeroExtend_notMem _ hx,smul_zero] +def toLinfCompact (hS : MeasurableSet S) (μ : Measure E) : C(S,ℂ) →L[ℂ] Lp ℂ ∞ μ := + LinearMap.mkContinuous + ({ toFun := fun f => (zeroExtend_memLp hS μ f).toLp (zeroExtend f) + map_add' := fun f g => by + apply Lp.ext + filter_upwards [MemLp.coeFn_toLp (zeroExtend_memLp hS μ (f+g)), + MemLp.coeFn_toLp (zeroExtend_memLp hS μ f),MemLp.coeFn_toLp (zeroExtend_memLp hS μ g), + Lp.coeFn_add ((zeroExtend_memLp hS μ f).toLp _) ((zeroExtend_memLp hS μ g).toLp _)] with x ha hb hc hd + rw [ha,hd] + simp only [Pi.add_apply,hb,hc,zeroExtend_add] + map_smul' := fun c f => by + apply Lp.ext + filter_upwards [MemLp.coeFn_toLp (zeroExtend_memLp hS μ (c • f)), + MemLp.coeFn_toLp (zeroExtend_memLp hS μ f), + Lp.coeFn_smul c ((zeroExtend_memLp hS μ f).toLp _)] with x ha hb hc + simp only [RingHom.id_apply] + rw [ha,hc] + simp only [Pi.smul_apply,hb,zeroExtend_smul] } : C(S,ℂ) →ₗ[ℂ] Lp ℂ ∞ μ) 1 (fun f => by + rw [one_mul] + change ‖(zeroExtend_memLp hS μ f).toLp (zeroExtend f)‖ ≤ ‖f‖ + rw [Lp.norm_toLp] + have h := eLpNorm_le_of_ae_bound (p := ∞) (μ := μ) + (zeroExtend_memLp hS μ f).aestronglyMeasurable + (Eventually.of_forall (zeroExtend_norm f)) + simp only [ENNReal.toReal_top,inv_zero,ENNReal.rpow_zero,one_mul] at h + exact (ENNReal.toReal_mono ENNReal.ofReal_ne_top h).trans_eq + (ENNReal.toReal_ofReal (norm_nonneg f))) +omit [NormedSpace ℝ E] in +lemma toLinfCompact_ae (hS : MeasurableSet S) (μ : Measure E) (f : C(S,ℂ)) : + toLinfCompact hS μ f =ᵐ[μ] zeroExtend f := MemLp.coeFn_toLp (zeroExtend_memLp hS μ f) +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +/-- A joint smooth family with a fixed compact spatial support is genuinely +smooth with values in L-infinity, not merely pointwise smooth. -/ +theorem exists_smooth_linf_family (hS : MeasurableSet S) (μ : Measure E) + (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉S → a (p,x)=0) : + ∃ b : P → Lp ℂ ∞ μ, ContDiff ℝ (⊤ : ℕ∞) b ∧ ∀ p, b p =ᵐ[μ] fun x => a (p,x) := by + let f := curryCompact a ha.continuous (fun x : S => (x:E)) continuous_subtype_val + have hf := curryCompact_contDiff a ha (fun x : S => (x:E)) continuous_subtype_val + refine ⟨fun p => toLinfCompact hS μ (f p),?_,fun p => ?_⟩ + · have hL : ContDiff ℝ (⊤ : ℕ∞) (toLinfCompact hS μ) := + (toLinfCompact hS μ).restrictScalars ℝ |>.contDiff + exact hL.comp hf + · apply (toLinfCompact_ae hS μ (f p)).trans + apply Eventually.of_forall + intro x + by_cases hx : x∈S + · exact zeroExtend_mem (f p) ⟨x,hx⟩ + · rw [zeroExtend_notMem _ hx] + change 0=a (p,x) + exact (hs p x hx).symm +end ElasticityCompact + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Conic.lean b/lean/OAI/MathematicalPhysics/Elasticity/Conic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a11ba11383731ffffa6c758a1684445820f9d810 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Conic.lean @@ -0,0 +1,569 @@ +import OAI.MathematicalPhysics.Elasticity.CommonFrame + +namespace OAI + +section +noncomputable section +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityFrame + +/-- Polynomial coordinates on the finite chart of the actual constrained +rank-three fiber, including its scalar component. -/ +def finiteCoordinates (z : ℂ) (p : Amp) : Fin 3 → ℂ := + ![(p.1 0-Complex.I*p.1 1)/2,p.1 2-z*((p.1 0-Complex.I*p.1 1)/2),p.2] +def finiteVector (z : ℂ) (c : Fin 3 → ℂ) : Amp := + (c 0 • h₁ 1 z+c 1 • h₂ 1 z,c 2) +lemma finiteVector_normal (z : ℂ) (c : Fin 3 → ℂ) : + ElasticityFrame.normal (theta 1 z) (finiteVector z c)=0 := by + change dotProduct (theta 1 z) (c 0 • h₁ 1 z+c 1 • h₂ 1 z)=0 + rw [dotProduct_add,dotProduct_smul,dotProduct_smul,theta_dot_h₁,theta_dot_h₂] + simp only [smul_zero,add_zero] +lemma finiteCoordinates_vector (z : ℂ) (c : Fin 3 → ℂ) : + finiteCoordinates z (finiteVector z c)=c := by + ext i + fin_cases i <;> simp [finiteCoordinates,finiteVector,h₁,h₂,smul_eq_mul] + · linear_combination -(c 0+z*c 1)*Complex.I_sq/2 + · linear_combination z*(c 0+z*c 1)*Complex.I_sq/2 +lemma finiteVector_coordinates (z : ℂ) (p : Amp) + (hp : ElasticityFrame.normal (theta 1 z) p=0) : + finiteVector z (finiteCoordinates z p)=p := by + have hh : (1-z^2)*p.1 0+Complex.I*(1+z^2)*p.1 1+2*z*p.1 2=0 := by + simpa [ElasticityFrame.normal,theta,Fin.sum_univ_three] using hp + apply Prod.ext + · ext i + fin_cases i <;> simp [finiteVector,finiteCoordinates,h₁,h₂,smul_eq_mul] + · linear_combination -hh/2 + · linear_combination Complex.I*hh/2-p.1 1*Complex.I_sq + · ring + · rfl + +def finiteChart (z : ℂ) : (Fin 3 → ℂ) ≃ₗ[ℂ] Fiber (theta 1 z) where + toFun c := ⟨finiteVector z c,finiteVector_normal z c⟩ + invFun p := finiteCoordinates z p.val + left_inv := finiteCoordinates_vector z + right_inv p := Subtype.ext (finiteVector_coordinates z p.val p.property) + map_add' c d := by + apply Subtype.ext + apply Prod.ext + · change (c 0+d 0) • h₁ 1 z+(c 1+d 1) • h₂ 1 z=(c 0 • h₁ 1 z+c 1 • h₂ 1 z)+(d 0 • h₁ 1 z+d 1 • h₂ 1 z) + simp only [add_smul] + abel + · rfl + map_smul' a c := by + apply Subtype.ext + apply Prod.ext + · change (a*c 0) • h₁ 1 z+(a*c 1) • h₂ 1 z=a • (c 0 • h₁ 1 z+c 1 • h₂ 1 z) + simp only [smul_add,mul_smul] + · rfl +end ElasticityConic + +end +end +section +noncomputable section +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityFrame + +def chartZ₀ (b : Bool) (z : ℂ) : ℂ := if b then z else 1 +def chartZ₁ (b : Bool) (z : ℂ) : ℂ := if b then 1 else z +def chartTheta (b : Bool) (z : ℂ) := theta (chartZ₀ b z) (chartZ₁ b z) +def chartVector (b : Bool) (z : ℂ) (c : Fin 3 → ℂ) : Amp := + (c 0 • h₁ (chartZ₀ b z) (chartZ₁ b z)+c 1 • h₂ (chartZ₀ b z) (chartZ₁ b z),c 2) +def chartCoord {A : Type*} [AddCommGroup A] [Module ℂ A] (b : Bool) (z : ℂ) (p : Fin 3 → A) (s : A) : Fin 3 → A := + if b then + let c := -(1/2 : ℂ) • (p 0+Complex.I • p 1) + ![p 2-z • c,c,s] + else + let c := (1/2 : ℂ) • (p 0-Complex.I • p 1) + ![c,p 2-z • c,s] +lemma chartVector_normal (b : Bool) (z : ℂ) (c : Fin 3 → ℂ) : + ElasticityFrame.normal (chartTheta b z) (chartVector b z c)=0 := by + change dotProduct (theta _ _) (c 0 • h₁ _ _+c 1 • h₂ _ _)=0 + rw [dotProduct_add,dotProduct_smul,dotProduct_smul,theta_dot_h₁,theta_dot_h₂] + simp only [smul_zero,add_zero] +lemma chartCoord_vector (b : Bool) (z : ℂ) (c : Fin 3 → ℂ) : + chartCoord b z (chartVector b z c).1 (chartVector b z c).2=c := by + ext i + cases b <;> fin_cases i <;> + simp [chartCoord,chartVector,chartZ₀,chartZ₁,h₁,h₂,smul_eq_mul] + · linear_combination -(c 0+z*c 1)*Complex.I_sq/2 + · linear_combination z*(c 0+z*c 1)*Complex.I_sq/2 + · linear_combination z*(z*c 0+c 1)*Complex.I_sq/2 + · linear_combination -(z*c 0+c 1)*Complex.I_sq/2 +lemma chartVector_coord (b : Bool) (z : ℂ) (p : Amp) + (hp : ElasticityFrame.normal (chartTheta b z) p=0) : + chartVector b z (chartCoord b z p.1 p.2)=p := by + have hh := hp + cases b + · have hc : chartCoord false z p.1 p.2=finiteCoordinates z p := by + ext i + fin_cases i <;> simp [chartCoord,finiteCoordinates,smul_eq_mul,div_eq_mul_inv,mul_comm] + rw [hc] + exact finiteVector_coordinates z p hp + · have he : (z^2-1)*p.1 0+Complex.I*(z^2+1)*p.1 1+2*z*p.1 2=0 := by + simpa [ElasticityFrame.normal,chartTheta,theta,chartZ₀,chartZ₁,Fin.sum_univ_three] using hh + apply Prod.ext + · ext i + fin_cases i <;> simp [chartVector,chartCoord,chartZ₀,chartZ₁,h₁,h₂,smul_eq_mul] + · linear_combination he/2 + · linear_combination Complex.I*he/2-p.1 1*Complex.I_sq + · ring + · rfl + +def conicChart (b : Bool) (z : ℂ) : (Fin 3 → ℂ) ≃ₗ[ℂ] Fiber (chartTheta b z) where + toFun c := ⟨chartVector b z c,chartVector_normal b z c⟩ + invFun p := chartCoord b z p.val.1 p.val.2 + left_inv := chartCoord_vector b z + right_inv p := Subtype.ext (chartVector_coord b z p.val p.property) + map_add' c d := by + apply Subtype.ext + apply Prod.ext + · change (c 0+d 0) • h₁ _ _+(c 1+d 1) • h₂ _ _= + (c 0 • h₁ _ _+c 1 • h₂ _ _)+(d 0 • h₁ _ _+d 1 • h₂ _ _) + simp only [add_smul] + abel + · rfl + map_smul' a c := by + apply Subtype.ext + apply Prod.ext + · change (a*c 0) • h₁ _ _+(a*c 1) • h₂ _ _=a • (c 0 • h₁ _ _+c 1 • h₂ _ _) + simp only [smul_add,mul_smul] + · rfl +lemma chartTheta_ne_zero (b : Bool) (z : ℂ) : chartTheta b z≠0 := by + cases b + · exact theta_ne_zero (Or.inl one_ne_zero) + · exact theta_ne_zero (Or.inr one_ne_zero) +lemma chartTheta_null (b : Bool) (z : ℂ) : ∑ i,chartTheta b z i*chartTheta b z i=0 := + theta_null _ _ +end ElasticityConic + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +variable {n : Type*} [Fintype n] [DecidableEq n] +def smoothEval (x : X) : Smooth →+* ℂ := + (Pi.evalRingHom (fun _ : X => ℂ) x).comp Smooth.val.toRingHom +/-- Entrywise evaluation is an honest matrix ring homomorphism. -/ +def matrixEval (x : X) : Matrix n n Smooth →+* Matrix n n ℂ := + (smoothEval x).mapMatrix +@[simp] lemma matrixEval_apply (x : X) (A : Matrix n n Smooth) (i j : n) : + matrixEval x A i j=(A i j : X → ℂ) x := rfl + +def matrixD (θ : Fin 3 → ℂ) (A : Matrix n n Smooth) : Matrix n n Smooth := + fun i j => thetaDerivation θ (A i j) +omit [DecidableEq n] in +lemma matrixD_mul (θ : Fin 3 → ℂ) (A B : Matrix n n Smooth) : + matrixD θ (A*B)=matrixD θ A*B+A*matrixD θ B := by + ext i j + simp only [matrixD,Matrix.mul_apply,Matrix.add_apply,map_sum,Derivation.leibniz, + smul_eq_mul,Finset.sum_add_distrib] + simp only [mul_comm,add_comm] +omit [Fintype n] in +lemma matrixD_one (θ : Fin 3 → ℂ) : matrixD θ (1 : Matrix n n Smooth)=0 := by + ext i j + simp only [matrixD,Matrix.one_apply,Matrix.zero_apply] + split_ifs <;> simp + +lemma smoothMatrix_isUnit (A : Matrix n n Smooth) (hA : ∀ x,IsUnit (matrixEval x A)) : + IsUnit A.det := by + have hd (x : X) : (A.det : X → ℂ) x≠0 := by + have he := (smoothEval x).map_det A + change (A.det : X → ℂ) x=(matrixEval x A).det at he + rw [he] + exact ((Matrix.isUnit_iff_isUnit_det _).mp (hA x)).ne_zero + exact isUnit_iff_exists_inv'.mpr ⟨smoothInv A.det hd,smoothInv_mul A.det hd⟩ + +/-- Smooth comparison from actual columns; only the original frame needs +invertibility. Equations are initially local and preserve their real domain. -/ +theorem smooth_matrix_comparison {B K : Set X} (hK : IsClosed K) + (θ : Fin 3 → ℂ) (M₀ M₁ Y₀ Y₁ : Matrix n n Smooth) + (hY : ∀ x,IsUnit (matrixEval x Y₀)) + (he₀ : ∀ x∈B,matrixEval x (matrixD θ Y₀)=matrixEval x (M₀*Y₀)) + (he₁ : ∀ x∈B,matrixEval x (matrixD θ Y₁)=matrixEval x (M₁*Y₁)) + (hs : ∀ x∉K,matrixEval x Y₁=matrixEval x Y₀) : + ∃ G : Matrix n n Smooth, + (∀ i j,tsupport ((G i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆K) ∧ + (∀ x∈B,matrixEval x (matrixD θ G)=matrixEval x (M₁*G-G*M₀)) := by + let G := Y₁*Y₀⁻¹ + have hd := smoothMatrix_isUnit Y₀ hY + have hG : G*Y₀=Y₁ := by dsimp [G]; rw [mul_assoc,Matrix.nonsing_inv_mul _ hd,mul_one] + have hDG : matrixD θ G*Y₀+G*matrixD θ Y₀=matrixD θ Y₁ := by + rw [← matrixD_mul,hG] + refine ⟨G,?_,?_⟩ + · intro i j + apply closure_minimal _ hK + intro x hx + by_contra hn + have he : matrixEval x G=1 := by + dsimp [G] + rw [map_mul,hs x hn,← map_mul,Matrix.mul_nonsing_inv _ hd,map_one] + apply hx + change (G i j : X → ℂ) x-((1 : Matrix n n Smooth) i j : X → ℂ) x=0 + have hentry := congrArg (fun A : Matrix n n ℂ => A i j) he + change matrixEval x G i j-matrixEval x 1 i j=0 + rw [map_one,hentry,sub_self] + · intro x hx + have he := congrArg (matrixEval x) hDG + simp only [map_add,map_mul] at he + rw [he₀ x hx,he₁ x hx] at he + simp only [map_mul] at he + have hGX := congrArg (matrixEval x) hG + simp only [map_mul] at hGX + have hh : (matrixEval x (matrixD θ G)-matrixEval x (M₁*G-G*M₀))*matrixEval x Y₀=0 := by + simp only [map_sub,map_mul] + calc + _ = matrixEval x (matrixD θ G)*matrixEval x Y₀+ + matrixEval x G*(matrixEval x M₀*matrixEval x Y₀)- + matrixEval x M₁*(matrixEval x G*matrixEval x Y₀) := by noncomm_ring + _ = 0 := by rw [he,hGX,sub_self] + have hinv := congrArg (fun A : Matrix n n ℂ => A*matrixEval x (Y₀⁻¹)) hh + rw [mul_assoc,← map_mul,Matrix.mul_nonsing_inv _ hd,map_one,mul_one,zero_mul] at hinv + exact sub_eq_zero.mp hinv +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityAugmented + +def chartMatrix (b : Bool) (z : ℂ) (T : Smooth) (Q : Fin 3 → Smooth) : Matrix (Fin 3) (Fin 3) Smooth := + !![0,0,(chartZ₀ b z) • 1; 0,0,(chartZ₁ b z) • 1; + (∑ i,h₁ (chartZ₀ b z) (chartZ₁ b z) i • Q i), + (∑ i,h₂ (chartZ₀ b z) (chartZ₁ b z) i • Q i),T] +lemma chartCoord_apply (b : Bool) (z : ℂ) (p : Fin 3 → Smooth) (s : Smooth) (x : X) (i : Fin 3) : + ((chartCoord b z p s i : Smooth) : X → ℂ) x=chartCoord b z (fun j => (p j : X → ℂ) x) ((s : X → ℂ) x) i := by + cases b <;> fin_cases i <;> rfl +lemma chartCoord_deriv (θ : Fin 3 → ℂ) (b : Bool) (z : ℂ) (p : Fin 3 → Smooth) (s : Smooth) (i : Fin 3) : + thetaDerivation θ (chartCoord b z p s i)= + chartCoord b z (fun j => thetaDerivation θ (p j)) (thetaDerivation θ s) i := by + cases b <;> fin_cases i <;> + simp [chartCoord,map_sub,map_add] +lemma chartCoord_2 {A : Type*} [AddCommGroup A] [Module ℂ A] + (b : Bool) (z : ℂ) (p : Fin 3 → A) (s : A) : chartCoord b z p s 2=s := by + cases b <;> rfl +lemma chartCoord_top (b : Bool) (z s t : ℂ) (i : Fin 3) (hi : i≠2) : + chartCoord b z (fun j => chartTheta b z j*s) t i= + (if i=0 then chartZ₀ b z else chartZ₁ b z)*s := by + have hc : i=0 ∨ i=1 := by omega + cases b <;> rcases hc with rfl | rfl <;> + simp [chartCoord,chartTheta,theta,chartZ₀,chartZ₁,smul_eq_mul] + · linear_combination -(1+z^2)*s*Complex.I_sq/2 + · linear_combination z*(1+z^2)*s*Complex.I_sq/2 + · linear_combination z*(z^2+1)*s*Complex.I_sq/2 + · linear_combination -(z^2+1)*s*Complex.I_sq/2 + +/-- The chart connection is exactly the physical normal transport, rather +than a freely chosen augmented comparison equation. -/ +lemma chart_transport_at (b : Bool) (z : ℂ) (T : Smooth) (Q p : Fin 3 → Smooth) (s : Smooth) (x : X) + (hn : ElasticityFrame.normal (chartTheta b z) ((fun i => (p i : X → ℂ) x),(s : X → ℂ) x)=0) + (hp : ∀ i,(direction (A := Smooth) coord (chartTheta b z) (p i) : X → ℂ) x= + chartTheta b z i*(s : X → ℂ) x) + (hs : (direction (A := Smooth) coord (chartTheta b z) s : X → ℂ) x= + ((T*s+∑ i,Q i*p i : Smooth) : X → ℂ) x) (i : Fin 3) : + (thetaDerivation (chartTheta b z) (chartCoord b z p s i) : X → ℂ) x= + (matrixEval x (chartMatrix b z T Q)*ᵥ(fun j => ((chartCoord b z p s j : Smooth) : X → ℂ) x)) i := by + rw [chartCoord_deriv,chartCoord_apply] + simp only [thetaDerivation_apply,hp,hs] + by_cases hi : i=2 + · subst i + rw [chartCoord_2] + have hd := congrArg Prod.fst (chartVector_coord b z + ((fun j => (p j : X → ℂ) x),(s : X → ℂ) x) hn) + have hdp (j : Fin 3) : (p j : X → ℂ) x= + chartCoord b z (fun k => (p k : X → ℂ) x) ((s : X → ℂ) x) 0*h₁ (chartZ₀ b z) (chartZ₁ b z) j+ + chartCoord b z (fun k => (p k : X → ℂ) x) ((s : X → ℂ) x) 1*h₂ (chartZ₀ b z) (chartZ₁ b z) j := by + exact (congrFun hd j).symm + simp only [Matrix.mulVec,dotProduct,Fin.sum_univ_three,chartMatrix,matrixEval_apply, + Matrix.of_apply,Matrix.cons_val_two,Matrix.cons_val_zero,Matrix.cons_val_one,Matrix.head_cons,Matrix.tail_cons, + Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_smul,Pi.add_apply,Pi.mul_apply,Pi.smul_apply, + smul_eq_mul,chartCoord_apply,chartCoord_2] + rw [hdp 0,hdp 1,hdp 2] + ring + · rw [chartCoord_top b z _ _ i hi] + have hc : i=0 ∨ i=1 := by omega + rcases hc with rfl | rfl <;> + simp [Matrix.mulVec,dotProduct,chartMatrix,Fin.sum_univ_three,chartCoord_2] +end ElasticityConic + +end +end +section +noncomputable section +open Set +open scoped BigOperators +namespace ElasticityParameter +variable {n : Type*} [Fintype n] [DecidableEq n] + +lemma commutator_flatten {R : Type*} [CommRing R] + (M₂ M₁ G : n → n → R) (i j : n) : + (∑ k, (M₂ i k*G k j-G i k*M₁ k j))= + ∑ q : n × n, ((if q.2=j then M₂ i q.1 else 0)- + (if q.1=i then M₁ q.2 j else 0))*G q.1 q.2 := by + rw [Fintype.sum_prod_type] + simp only [sub_mul,Finset.sum_sub_distrib,ite_mul,zero_mul] + simp only [Finset.sum_ite_eq',Finset.mem_univ,ite_true] + rw [Finset.sum_comm] + simp only [Finset.sum_ite_eq',Finset.mem_univ,ite_true] + simp only [mul_comm] + +/-- The comparison equation on a holomorphic fiber chart forces holomorphy +in the parameter. Nullity supplies the injective real characteristic planes; +no compact-kernel or holomorphy premise for the unknown is present. -/ +theorem matrix_holomorphic_of_supported_comparison + (θ : Fin 3 → Smooth (X × ℂ)) + (hθx : ∀ r x z, (θ r : X × ℂ → ℂ) (x,z)=(θ r : X × ℂ → ℂ) (0,z)) + (hθ : ∀ r x, Differentiable ℂ (fun z => (θ r : X × ℂ → ℂ) (x,z))) + (hnull : ∀ z, ∑ r, (θ r : X × ℂ → ℂ) (0,z)*(θ r : X × ℂ → ℂ) (0,z)=0) + (hne : ∀ z, (fun r => (θ r : X × ℂ → ℂ) (0,z))≠0) + (M₂ M₁ G : n → n → Smooth (X × ℂ)) + (hM₂ : ∀ i j x, Differentiable ℂ (fun z => (M₂ i j : X × ℂ → ℂ) (x,z))) + (hM₁ : ∀ i j x, Differentiable ℂ (fun z => (M₁ i j : X × ℂ → ℂ) (x,z))) + (he : ∀ i j, ∑ r, θ r*delta (basis r,0) (G i j)= + ∑ k, (M₂ i k*G k j-G i k*M₁ k j)) + {S : Set X} (hS : IsCompact S) + (hs : ∀ i j x, x∉S → ∀ z, (G i j : X × ℂ → ℂ) (x,z)=if i=j then 1 else 0) : + ∀ i j x, Differentiable ℂ (fun z => (G i j : X × ℂ → ℂ) (x,z)) := by + let a : (n × n) → (n × n) → Smooth (X × ℂ) := fun p q => + (if q.2=p.2 then M₂ p.1 q.1 else 0)-(if q.1=p.1 then M₁ q.2 p.2 else 0) + have ha (p q : n × n) (x : X) : + Differentiable ℂ (fun z => (a p q : X × ℂ → ℂ) (x,z)) := by + dsimp only [a] + split_ifs <;> simp only [Subalgebra.coe_sub,Pi.sub_apply,Subalgebra.coe_zero,Pi.zero_apply] + · exact (hM₂ _ _ x).sub (hM₁ _ _ x) + · exact (hM₂ _ _ x).sub (differentiable_const 0) + · exact (differentiable_const 0).sub (hM₁ _ _ x) + · exact (differentiable_const 0).sub (differentiable_const 0) + have h := holomorphic_of_supported_transport basis θ hθx hθ + (fun z => null_plane_injective _ (hnull z) (hne z)) a ha + (fun p : n × n => G p.1 p.2) (fun p => (he p.1 p.2).trans + (commutator_flatten M₂ M₁ G p.1 p.2)) hS + (fun p : n × n => if p.1=p.2 then 1 else 0) (fun p => hs p.1 p.2) + exact fun i j => h (i,j) +end ElasticityParameter + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +variable {n : Type*} [Fintype n] [DecidableEq n] + +lemma supported_matrix_eq_one {K : Set X} (G : Matrix n n Smooth) + (hs : ∀ i j,tsupport ((G i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆K) + (x : X) (hx : x∉K) : matrixEval x G=1 := by + ext i j + have hz := image_eq_zero_of_notMem_tsupport (fun hh => hx (hs i j hh)) + change (G i j : X → ℂ) x-((1 : Matrix n n Smooth) i j : X → ℂ) x=0 at hz + have he : ((1 : Matrix n n Smooth) i j : X → ℂ) x=(1 : Matrix n n ℂ) i j := by + have hh := congrArg (fun A : Matrix n n ℂ => A i j) (map_one (matrixEval (n := n) x)) + exact hh + rw [he] at hz + exact sub_eq_zero.mp hz + +lemma globalize_matrix_comparison {B K : Set X} (hK : IsClosed K) (hKB : K⊆B) + (θ : Fin 3 → ℂ) (M₀ M₁ G : Matrix n n Smooth) + (hs : ∀ i j,tsupport ((G i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆K) + (he : ∀ x∈B,matrixEval x (matrixD θ G)=matrixEval x (M₁*G-G*M₀)) + (hM : ∀ x∉K,matrixEval x M₀=matrixEval x M₁) : + matrixD θ G=M₁*G-G*M₀ := by + ext i j x + by_cases hx : x∈B + · exact congrArg (fun A : Matrix n n ℂ => A i j) (he x hx) + · have hn : x∉K := fun hh => hx (hKB hh) + have hG := supported_matrix_eq_one G hs x hn + have hD : matrixEval x (matrixD θ G)=0 := by + ext a b + have hh := eqOn_direction hK.isOpen_compl θ (G a b) ((1 : Matrix n n Smooth) a b) + (fun y hy => (congrArg (fun A : Matrix n n ℂ => A a b) (supported_matrix_eq_one G hs y hy)).trans + (congrArg (fun A : Matrix n n ℂ => A a b) (map_one (matrixEval (n := n) y))).symm) hn + change (thetaDerivation θ (G a b) : X → ℂ) x=(thetaDerivation θ ((1 : Matrix n n Smooth) a b) : X → ℂ) x at hh + rw [show thetaDerivation θ ((1 : Matrix n n Smooth) a b)=0 from congrFun (congrFun (matrixD_one (n := n) θ) a) b] at hh + exact hh + have hh : matrixEval x (matrixD θ G)=matrixEval x (M₁*G-G*M₀) := by + simp only [map_sub,map_mul,hD,hG,mul_one,one_mul,hM x hn,sub_self] + exact congrArg (fun A : Matrix n n ℂ => A i j) hh + +lemma matrixD_eval (θ : Fin 3 → ℂ) (G : Matrix n n Smooth) (x : X) (i j : n) : + matrixEval x (matrixD θ G) i j=∑ r,θ r*fderiv ℝ (G i j : X → ℂ) x (ElasticityParameter.basis r) := by + simp only [matrixEval_apply,matrixD,thetaDerivation_apply,direction,smooth_sum_eval, + Subalgebra.coe_smul,Pi.smul_apply,smul_eq_mul] + rfl + +/-- The supported comparison is unique using the actual characteristic-plane +compact kernel theorem, not invertibility of the transferred frame. -/ +theorem supported_matrix_unique (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (M₀ M₁ G H : Matrix n n Smooth) + (heG : matrixD θ G=M₁*G-G*M₀) (heH : matrixD θ H=M₁*H-H*M₀) + (hc : ∀ i j,HasCompactSupport ((G i j-H i j : Smooth) : X → ℂ)) : G=H := by + let a : (n × n) → (n × n) → X → ℂ := fun p q x => + (if q.2=p.2 then (M₁ p.1 q.1 : X → ℂ) x else 0)- + (if q.1=p.1 then (M₀ q.2 p.2 : X → ℂ) x else 0) + have ha (p q : n × n) : Continuous (a p q) := by + have h1 : Continuous (fun x : X => if q.2=p.2 then (M₁ p.1 q.1 : X → ℂ) x else 0) := by + split_ifs + · exact (show ContDiff ℝ (⊤ : ℕ∞) (M₁ p.1 q.1 : X → ℂ) from (M₁ p.1 q.1).property).continuous + · exact continuous_const + have h0 : Continuous (fun x : X => if q.1=p.1 then (M₀ q.2 p.2 : X → ℂ) x else 0) := by + split_ifs + · exact (show ContDiff ℝ (⊤ : ℕ∞) (M₀ q.2 p.2 : X → ℂ) from (M₀ q.2 p.2).property).continuous + · exact continuous_const + exact h1.sub h0 + have he : matrixD θ (G-H)=M₁*(G-H)-(G-H)*M₀ := by + have hd : matrixD θ (G-H)=matrixD θ G-matrixD θ H := by funext i j; exact map_sub _ _ _ + rw [hd,heG,heH] + simp only [mul_sub,sub_mul] + abel + have hz := ElasticityPlanar.spatial_compact_kernel + (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ) + (ElasticityParameter.null_plane_injective θ hθ hne) a ha + (fun p : n × n => ((G p.1 p.2-H p.1 p.2 : Smooth) : X → ℂ)) + (fun p => (G p.1 p.2-H p.1 p.2 : Smooth).property) (fun p => hc p.1 p.2) + (fun p x => ?_) + · ext i j x + exact sub_eq_zero.mp (hz (i,j) x) + · rw [ElasticityParameter.characteristicPlane_principal] + have hh := congrArg (fun A : Matrix n n Smooth => matrixEval x A p.1 p.2) he + rw [matrixD_eval] at hh + simp only [map_sub,map_mul,Matrix.sub_apply,Matrix.mul_apply,← Finset.sum_sub_distrib] at hh + exact hh.trans (ElasticityParameter.commutator_flatten (matrixEval x M₁) (matrixEval x M₀) + (matrixEval x (G-H)) p.1 p.2) +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityAugmented + +/-- Convert the actual physical rank-three fiber basis to a chart matrix; +there is no assumption that the transferred columns are a basis. -/ +theorem chart_frame_comparison {U K : Set X} (hK : IsClosed K) (hKU : K⊆U) + (b : Bool) (z : ℂ) (T : Fin 2 → Smooth) (Q : Fin 2 → Fin 3 → Smooth) + (p : Fin 2 → Fin 3 → Fin 3 → Smooth) (s : Fin 2 → Fin 3 → Smooth) + (B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber (chartTheta b z))) + (hn : ∀ q ν,normal (chartTheta b z) (p q ν)=0) + (he : ∀ q ν x,x∈U → + (∀ i,(direction (A := Smooth) coord (chartTheta b z) (p q ν i) : X → ℂ) x= + chartTheta b z i*(s q ν : X → ℂ) x) ∧ + (direction (A := Smooth) coord (chartTheta b z) (s q ν) : X → ℂ) x= + ((T q*s q ν+∑ i,Q q i*p q ν i : Smooth) : X → ℂ) x) + (hs : ∀ ν x,x∉K → (∀ i,(p 0 ν i : X → ℂ) x=(p 1 ν i : X → ℂ) x) ∧ + (s 0 ν : X → ℂ) x=(s 1 ν : X → ℂ) x) + (hB : ∀ ν x,((B x ν : ElasticityFrame.Fiber (chartTheta b z)) : ElasticityFrame.Amp)= + ((fun i => (p 0 ν i : X → ℂ) x),(s 0 ν : X → ℂ) x)) + (hT : ∀ x∉K,(T 0 : X → ℂ) x=(T 1 : X → ℂ) x) + (hQ : ∀ i x,x∉K → (Q 0 i : X → ℂ) x=(Q 1 i : X → ℂ) x) : + ∃ G : Matrix (Fin 3) (Fin 3) Smooth, + (∀ i j,tsupport ((G i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ)⊆K) ∧ + matrixD (chartTheta b z) G=chartMatrix b z (T 1) (Q 1)*G-G*chartMatrix b z (T 0) (Q 0) := by + let Y : Fin 2 → Matrix (Fin 3) (Fin 3) Smooth := fun q i ν => chartCoord b z (p q ν) (s q ν) i + have hunit (x : X) : IsUnit (matrixEval x (Y 0)) := by + apply Matrix.linearIndependent_cols_iff_isUnit.mp + let C := (B x).map (conicChart b z).symm + have hCb : (C : Fin 3 → Fin 3 → ℂ)=(fun ν => (matrixEval x (Y 0)).col ν) := by + funext ν i + change chartCoord b z (B x ν).val.1 (B x ν).val.2 i=_ + rw [hB] + exact (chartCoord_apply b z (p 0 ν) (s 0 ν) x i).symm + change LinearIndependent ℂ (fun ν => (matrixEval x (Y 0)).col ν) + exact hCb ▸ C.linearIndependent + have hEq (q x) (hx : x∈U) : + matrixEval x (matrixD (chartTheta b z) (Y q))= + matrixEval x (chartMatrix b z (T q) (Q q)*Y q) := by + ext i ν + have hn' : ElasticityFrame.normal (chartTheta b z) + ((fun i => (p q ν i : X → ℂ) x),(s q ν : X → ℂ) x)=0 := by + have hh := congrArg (fun f : Smooth => (f : X → ℂ) x) (hn q ν) + change (∑ i,chartTheta b z i*(p q ν i : X → ℂ) x)=0 + simpa only [normal,dotProduct,smooth_sum_eval, + Subalgebra.coe_smul,Pi.smul_apply,smul_eq_mul,Subalgebra.coe_zero,Pi.zero_apply] using hh + have hh := chart_transport_at b z (T q) (Q q) (p q ν) (s q ν) x hn' (he q ν x hx).1 (he q ν x hx).2 i + rw [map_mul] + exact hh + have hext (x : X) (hx : x∉K) : matrixEval x (Y 1)=matrixEval x (Y 0) := by + ext i ν + change ((chartCoord b z (p 1 ν) (s 1 ν) i : Smooth) : X → ℂ) x= + ((chartCoord b z (p 0 ν) (s 0 ν) i : Smooth) : X → ℂ) x + rw [chartCoord_apply,chartCoord_apply,(hs ν x hx).2,funext ((hs ν x hx).1)] + obtain ⟨G,hGs,hGe⟩ := smooth_matrix_comparison hK (chartTheta b z) + (chartMatrix b z (T 0) (Q 0)) (chartMatrix b z (T 1) (Q 1)) (Y 0) (Y 1) + hunit (hEq 0) (hEq 1) hext + refine ⟨G,hGs,globalize_matrix_comparison hK hKU (chartTheta b z) _ _ G hGs hGe ?_⟩ + intro x hx + ext i j + change ((chartMatrix b z (T 0) (Q 0) i j : Smooth) : X → ℂ) x= + ((chartMatrix b z (T 1) (Q 1) i j : Smooth) : X → ℂ) x + have hq : ∀ k,(Q 0 k : X → ℂ) x=(Q 1 k : X → ℂ) x := fun k => hQ k x hx + fin_cases i <;> fin_cases j <;> simp [chartMatrix,smooth_sum_eval,hq,hT x hx] +end ElasticityConic + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace Elasticity +open ElasticityAugmented ElasticityCGO ElasticityConic +open ElasticityCoeffBounds (ExteriorConstant) + +/-- Supported global commutator comparison on EACH conic chart, constructed +from equality of the physical DN map on the original domain. -/ +theorem dn_conic_comparison {Ω : Set X} (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) + (r₀ : ℝ) (hr₀ : 1≤r₀) (hK : closure Ω⊆Metric.closedBall 0 r₀) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) (b : Bool) (z : ℂ) : + let k := fun q => smoothOfReal (lam q) (hl q)+smoothOfReal (m q) (hm q) + let r := fun q => positiveRoot (m q) (hm q) (fun x => (hp q x).1) + let hr := fun q => positiveRoot_nonzero (m q) (hm q) (fun x => (hp q x).1) + ∀ hk : ∀ q x,(k q : X → ℂ) x≠0, + ∀ hL : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0, + let M := fun q => chartMatrix b z (transportT (chartTheta b z) (k q) (r q) (hk q) (hL q)) + (transportQ (chartTheta b z) (k q) (r q) (hr q) (hk q) (hL q)) + ∃ G : Matrix (Fin 3) (Fin 3) Smooth, + (∀ i j,tsupport ((G i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ)⊆closure Ω) ∧ + matrixD (chartTheta b z) G=M 1*G-G*M 0 := by + intro k r hr hk hL M + obtain ⟨hk',hL',p,s,B,hn,hE,hs,hB⟩ := dn_common_normal_frame hΩ hOB r₀ hr₀ hK (chartTheta b z) + (chartTheta_null b z) (chartTheta_ne_zero b z) lam m hl hm hp hcll hclm he hDN + have hkE : EqOn (k 0 : X → ℂ) (k 1) (closure Ω)ᶜ := by + intro y hy + have hy' : y∉Ω := fun hyΩ => hy (subset_closure hyΩ) + change (lam 0 y : ℂ)+(m 0 y : ℂ)=(lam 1 y : ℂ)+(m 1 y : ℂ) + rw [(he y hy').1,(he y hy').2] + have hrE : EqOn (r 0 : X → ℂ) (r 1) (closure Ω)ᶜ := by + intro y hy + change (Real.sqrt (m 0 y) : ℂ)=(Real.sqrt (m 1 y) : ℂ) + rw [(he y (fun hyΩ => hy (subset_closure hyΩ))).2] + have hMQ := eqOn_transport isClosed_closure.isOpen_compl (chartTheta b z) (k 0) (k 1) (r 0) (r 1) + (hr 0) (hr 1) (hk 0) (hk 1) (hL 0) (hL 1) hkE hrE + exact chart_frame_comparison isClosed_closure (hK.trans (Metric.closedBall_subset_ball (by linarith))) b z + (fun q => transportT (chartTheta b z) (k q) (r q) (hk q) (hL q)) + (fun q => transportQ (chartTheta b z) (k q) (r q) (hr q) (hk q) (hL q)) + p s B hn hE hs hB (fun x hx => hMQ.1 hx) (fun i x hx => hMQ.2 i hx) +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Extension.lean b/lean/OAI/MathematicalPhysics/Elasticity/Extension.lean new file mode 100644 index 0000000000000000000000000000000000000000..325135154b9be8a9dde2d6d6ea8fe352bc1fc25f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Extension.lean @@ -0,0 +1,187 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundary +attribute [local instance] Classical.propDecidable +variable {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +lemma hasFDerivAt_piecewise (s : Set E) (f g : E → F) + (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (hv : ∀ x ∈ frontier s, f x=g x) + (hd : ∀ x ∈ frontier s, fderiv ℝ f x=fderiv ℝ g x) (x : E) : + HasFDerivAt (s.piecewise f g) (s.piecewise (fderiv ℝ f) (fderiv ℝ g) x) x := by + classical + by_cases hb : x ∈ frontier s + · have hvf : s.piecewise f g x=f x := by + by_cases hx : x∈s + · simp [hx] + · simp [hx,hv x hb] + have hvg : s.piecewise f g x=g x := hvf.trans (hv x hb) + have hd' : s.piecewise (fderiv ℝ f) (fderiv ℝ g) x=fderiv ℝ f x := by + by_cases hx : x∈s + · simp [hx] + · simp [hx,hd x hb] + rw [hd'] + have h1 : HasFDerivWithinAt (s.piecewise f g) (fderiv ℝ f x) s x := + (hf x).hasFDerivAt.hasFDerivWithinAt.congr (by intro y hy; simp [hy]) hvf + have h2 : HasFDerivWithinAt (s.piecewise f g) (fderiv ℝ f x) sᶜ x := by + rw [hd x hb] + exact (hg x).hasFDerivAt.hasFDerivWithinAt.congr (by intro y hy; exact piecewise_eq_of_notMem s f g hy) hvg + simpa only [union_compl_self,hasFDerivWithinAt_univ] using h1.union h2 + · by_cases hx : x∈s + · simp only [piecewise_eq_of_mem s _ _ hx] + apply (hf x).hasFDerivAt.congr_of_eventuallyEq + filter_upwards [mem_interior_iff_mem_nhds.mp ((mem_interior_iff_notMem_frontier hx).mpr hb)] with y hy + simp [hy] + · simp only [piecewise_eq_of_notMem s _ _ hx] + apply (hg x).hasFDerivAt.congr_of_eventuallyEq + have hi : x∈interior sᶜ := (mem_interior_iff_notMem_frontier hx).mpr (by simpa using hb) + filter_upwards [mem_interior_iff_mem_nhds.mp hi] with y hy + exact piecewise_eq_of_notMem s f g hy + +/-- Matching all actual Fréchet jets gives smooth gluing across an arbitrary interface. -/ +theorem smooth_piecewise_all_jets (s : Set E) (f g : E → F) + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hj : ∀ n : ℕ, ∀ x∈frontier s, iteratedFDeriv ℝ n f x=iteratedFDeriv ℝ n g x) : + ContDiff ℝ (⊤ : ℕ∞) (s.piecewise f g) := by + classical + have main : ∀ n : ℕ, ∀ (F : Type) [NormedAddCommGroup F] [NormedSpace ℝ F] + (f g : E → F), ContDiff ℝ (⊤ : ℕ∞) f → ContDiff ℝ (⊤ : ℕ∞) g → + (∀ m : ℕ, ∀ x∈frontier s, iteratedFDeriv ℝ m f x=iteratedFDeriv ℝ m g x) → + ContDiff ℝ n (s.piecewise f g) := by + intro n + induction n with + | zero => + intro F _ _ f g hf hg hj + change ContDiff ℝ 0 _ + rw [contDiff_zero] + apply Continuous.piecewise _ hf.continuous hg.continuous + intro x hx + have hh := congrArg (fun L => L (fun i : Fin 0 => ![] i)) (hj 0 x hx) + simpa using hh + | succ n ih => + intro F _ _ f g hf hg hj + have hd : ∀ m : ℕ, ∀ x∈frontier s, + iteratedFDeriv ℝ m (fderiv ℝ f) x=iteratedFDeriv ℝ m (fderiv ℝ g) x := by + intro m x hx + have hh := hj (m+1) x hx + simp only [iteratedFDeriv_succ_eq_comp_right,Function.comp_apply] at hh + exact (continuousMultilinearCurryRightEquiv' ℝ m E F).symm.injective hh + refine contDiff_succ_iff_hasFDerivAt.mpr ⟨s.piecewise (fderiv ℝ f) (fderiv ℝ g), + ih _ _ _ (hf.fderiv_right (by simp)) (hg.fderiv_right (by simp)) hd, ?_⟩ + intro x + apply hasFDerivAt_piecewise s f g (hf.differentiable (by simp)) (hg.differentiable (by simp)) + · intro y hy + have hh := congrArg (fun L => L (fun i : Fin 0 => ![] i)) (hj 0 y hy) + simpa using hh + · intro y hy + have hh := congrArg (fun L => L (fun i : Fin 0 => ![] i)) (hd 0 y hy) + simpa using hh + exact contDiff_infty.mpr (fun n => main n F f g hf hg hj) +end ElasticityBoundary + +end +end +section +noncomputable section +open Set Filter Metric +open scoped Topology Manifold +namespace ElasticityBoundary +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +lemma compact_smooth_cutoff {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) (hKU : K⊆U) : + ∃ χ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) χ ∧ HasCompactSupport χ ∧ tsupport χ⊆U ∧ + (∀ᶠ x in 𝓝ˢ K, χ x=1) ∧ ∀ x, χ x∈Icc 0 1 := by + obtain ⟨R,hR⟩ := hK.isBounded.subset_ball (0 : E) + obtain ⟨V,hV,hKV,hVU⟩ := normal_exists_closure_subset hK.isClosed (hU.inter isOpen_ball) + (show K⊆U∩ball (0 : E) R from fun x hx => ⟨hKU hx,hR hx⟩) + obtain ⟨χ,hχ,hzero,hb⟩ := exists_contMDiffMap_one_nhds_of_subset_interior + (𝓘(ℝ,E)) (n := (⊤ : ℕ∞)) hK.isClosed (by rwa [hV.interior_eq]) + have hs : tsupport (χ : E → ℝ)⊆closure V := by + apply closure_mono + intro x hx + by_contra hn + exact hx (hzero x hn) + refine ⟨χ,χ.contMDiff.contDiff,?_,fun x hx => (hVU (hs hx)).1,hχ,hb⟩ + apply (isCompact_closedBall (0 : E) R).of_isClosed_subset (isClosed_tsupport χ) + exact fun x hx => ball_subset_closedBall ((hVU (hs hx)).2) + +omit [FiniteDimensional ℝ E] in +lemma contDiff_cutoff_mul {U : Set E} (hU : IsOpen U) (f χ : E → ℝ) + (hf : ContDiffOn ℝ (⊤ : ℕ∞) f U) (hχ : ContDiff ℝ (⊤ : ℕ∞) χ) + (hs : tsupport χ⊆U) : ContDiff ℝ (⊤ : ℕ∞) (fun x => χ x*f x) := by + rw [contDiff_iff_contDiffAt] + intro x + by_cases hx : x∈U + · exact hχ.contDiffAt.mul ((hf x hx).contDiffAt (hU.mem_nhds hx)) + · have hn : x∉tsupport χ := fun hh => hx (hs hh) + have he := notMem_tsupport_iff_eventuallyEq.mp hn + apply (contDiffAt_const (c := (0 : ℝ))).congr_of_eventuallyEq + filter_upwards [he] with y hy + simp [hy] + +/-- A genuine global smooth extension, equal on a neighborhood of the compact set. -/ +theorem smooth_global_extension {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) + (hKU : K⊆U) (f : E → ℝ) (hf : ContDiffOn ℝ (⊤ : ℕ∞) f U) : + ∃ F : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) F ∧ HasCompactSupport F ∧ F =ᶠ[𝓝ˢ K] f := by + obtain ⟨χ,hχ,hc,hs,h1,_⟩ := compact_smooth_cutoff hK hU hKU + refine ⟨fun x => χ x*f x,contDiff_cutoff_mul hU f χ hf hχ hs,?_,?_⟩ + · exact hc.mul_right + · filter_upwards [h1] with x hx + simp [hx] + +/-- Convex interpolation preserves both physical positivity inequalities. -/ +theorem admissible_global_extension {K U : Set E} (hK : IsCompact K) (hU : IsOpen U) + (hKU : K⊆U) (lam mu : E → ℝ) + (hl : ContDiffOn ℝ (⊤ : ℕ∞) lam U) (hm : ContDiffOn ℝ (⊤ : ℕ∞) mu U) + (hp : ∀ x∈K, 0 < mu x ∧ 0<3*lam x+2*mu x) : + ∃ L M : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) L ∧ ContDiff ℝ (⊤ : ℕ∞) M ∧ + L =ᶠ[𝓝ˢ K] lam ∧ M =ᶠ[𝓝ˢ K] mu ∧ + (∀ x,0 < M x ∧ 0<3*L x+2*M x) ∧ + HasCompactSupport L ∧ HasCompactSupport (fun x => M x-1) := by + obtain ⟨f,hf,_,hfl⟩ := smooth_global_extension hK hU hKU lam hl + obtain ⟨g,hg,_,hgm⟩ := smooth_global_extension hK hU hKU mu hm + let V := {x | 0 χ x*f x + let M := fun x => χ x*g x+(1-χ x) + refine ⟨L,M,hχ.mul hf,(hχ.mul hg).add (contDiff_const.sub hχ),?_,?_,?_,?_,?_⟩ + · filter_upwards [h1,hfl] with x hx hy + simp [L,hx,hy] + · filter_upwards [h1,hgm] with x hx hy + simp [M,hx,hy] + · intro x + by_cases hx : χ x=0 + · simp [L,M,hx] + · have hv := hs (subset_tsupport χ (show χ x≠0 from hx)) + have hpos : 0<χ x := lt_of_le_of_ne (hb x).1 (Ne.symm hx) + have hle := (hb x).2 + have hgpos := hv.1 + have hpair := hv.2 + change 0<χ x*g x+(1-χ x) ∧ 0<3*(χ x*f x)+2*(χ x*g x+(1-χ x)) + constructor + · nlinarith [mul_pos hpos hgpos] + · nlinarith [mul_pos hpos hpair] + · exact hc.mul_right + · have he : (fun x => M x-1)=(fun x => χ x*(g x-1)) := by funext x; dsimp [M]; ring + rw [he] + exact hc.mul_right +end ElasticityBoundary + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/ForcedTransport.lean b/lean/OAI/MathematicalPhysics/Elasticity/ForcedTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..893e387bcca3bf6b6d713dda670d565d4f1e8309 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/ForcedTransport.lean @@ -0,0 +1,649 @@ +import OAI.MathematicalPhysics.Elasticity.Transport + +namespace OAI + +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable (D : Fin 3 → Derivation ℂ A A) +lemma leadingP_neg (θ : Fin 3 → ℂ) (m f : A) : leadingP D θ m (-f)=-leadingP D θ m f := by + simp only [leadingP,direction,map_neg,smul_neg,Finset.sum_neg_distrib] + ring +lemma normal_sub (θ : Fin 3 → ℂ) (u v : Fin 3 → A) : normal θ (u-v)=normal θ u-normal θ v := by + simp only [normal,Pi.sub_apply,smul_sub,Finset.sum_sub_distrib] +lemma normal_neg (θ : Fin 3 → ℂ) (u : Fin 3 → A) : normal θ (-u)=-normal θ u := by + simp only [normal,Pi.neg_apply,smul_neg,Finset.sum_neg_distrib] + +lemma normal_particular (θ n : Fin 3 → ℂ) (hn : ∑ i,θ i*n i=1) (q : A) : + normal θ (fun i => -(n i • q))=-q := by + simp only [normal,smul_neg,smul_smul,Finset.sum_neg_distrib] + rw [← Finset.sum_smul,hn,one_smul] +lemma exists_normalizing_vector (θ : Fin 3 → ℂ) (hθ : θ≠0) : ∃ n : Fin 3 → ℂ,∑ i,θ i*n i=1 := by + obtain ⟨i,hi⟩ := Function.ne_iff.mp hθ + change θ i≠0 at hi + refine ⟨Pi.single i (θ i)⁻¹,?_⟩ + simp [Pi.single_apply,hi] + +lemma residual_source_tangent (θ n : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hn : ∑ i,θ i*n i=1) + (lam m : A) (u : Fin 3 → A) (b : A) + (hc : normal θ (R D lam m u b)=leadingP D θ m (div D u-b)) : + normal θ (-R D lam m u b-leadingR D θ lam m (fun i => -(n i • (div D u-b))) 0)=0 := by + rw [normal_sub,normal_neg,leading_normal D θ hθ,normal_particular θ n hn,leadingP_neg,hc] + exact sub_self _ +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityFrame +open ElasticityAugmented + +def tangentProjection (θ n : Fin 3 → ℂ) (hn : ∑ i,θ i*n i=1) : Amp →ₗ[ℂ] Fiber θ := + (LinearMap.id-(normal θ).smulRight (n,0)).codRestrict (fiber θ) (by + intro v + change normal θ (v-normal θ v • (n,0))=0 + rw [map_sub,map_smul] + have he : normal θ (n,0)=1 := hn + rw [he,smul_eq_mul,mul_one,sub_self]) +lemma tangentProjection_apply (θ n : Fin 3 → ℂ) (hn : ∑ i,θ i*n i=1) (v : Amp) : + ((tangentProjection θ n hn v : Fiber θ) : Amp)=v-normal θ v • (n,0) := rfl +lemma tangentProjection_of_normal (θ n : Fin 3 → ℂ) (hn : ∑ i,θ i*n i=1) + (v : Amp) (hv : normal θ v=0) : + ((tangentProjection θ n hn v : Fiber θ) : Amp)=v := by + rw [tangentProjection_apply,hv,zero_smul,sub_zero] +lemma tangentProjection_smooth (θ n : Fin 3 → ℂ) (hn : ∑ i,θ i*n i=1) + (p : Fin 3 → Smooth) (s : Smooth) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => tangentProjection θ n hn + ((fun i => (p i : X → ℂ) x),(s : X → ℂ) x)) := by + exact ((tangentProjection θ n hn).toContinuousLinearMap.restrictScalars ℝ).contDiff.comp + (((contDiff_pi.mpr (fun i => smooth_coe (p i))).prodMk (smooth_coe s))) + +lemma smooth_vector_forced (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) (t : Smooth) (qq : Fin 3 → Smooth) + (f : Fiber θ) (x : X) + (he : fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + Complex.I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ Complex.I)= + connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x)+f) : + ∀ i,(direction (A := Smooth) coord θ (vectorSmooth θ u hu i) : X → ℂ) x= + θ i*(scalarSmooth θ u hu : X → ℂ) x+(f : Amp).1 i := by + intro i + rw [vectorSmooth,projection_direction,he,map_add] + exact congrArg (fun z : ℂ => z+(f : Amp).1 i) + (connection_vector θ hθ ((t : X → ℂ) x) (fun j => (qq j : X → ℂ) x) (u x) i) +lemma smooth_scalar_forced (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) (t : Smooth) (qq : Fin 3 → Smooth) + (f : Fiber θ) (x : X) + (he : fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + Complex.I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ Complex.I)= + connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x)+f) : + (direction (A := Smooth) coord θ (scalarSmooth θ u hu) : X → ℂ) x= + ((t*scalarSmooth θ u hu+∑ i,qq i*vectorSmooth θ u hu i : Smooth) : X → ℂ) x+(f : Amp).2 := by + rw [scalarSmooth,projection_direction,he,map_add] + apply congrArg (fun z : ℂ => z+(f : Amp).2) + have h := connection_scalar θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x) + simp only [Fin.sum_univ_three,Subalgebra.coe_add,Subalgebra.coe_mul,Pi.add_apply,Pi.mul_apply] + change ((connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x) : Fiber θ) : Amp).2= + (t : X → ℂ) x*((u x : Fiber θ) : Amp).2+ + ((qq 0 : X → ℂ) x*((u x : Fiber θ) : Amp).1 0+ + (qq 1 : X → ℂ) x*((u x : Fiber θ) : Amp).1 1+ + (qq 2 : X → ℂ) x*((u x : Fiber θ) : Amp).1 2) + simpa only [Fin.sum_univ_three] using h +end ElasticityFrame + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +lemma transformed_scalar_exact (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) : + leadingS coord θ (k-r*r) (r*r) a b= + 2*((k+r*r)*direction (A := Smooth) coord θ b+direction (A := Smooth) coord θ k*b+ + r*(2*thetaGamma θ r hr*changeS k r hr a b+ + ∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)) := by + have ht : (∑ i, (2*coord i (r*r)*direction (A := Smooth) coord θ (a i)+ + direction (A := Smooth) coord θ (coord i (r*r))*a i) : Smooth)= + r*(2*thetaGamma θ r hr*changeS k r hr a b+ + ∑ i, direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i) := by + simp_rw [transformed_gradient θ r hr a,normal_form_top θ k r hr a b hR] + rw [← Finset.mul_sum,Finset.sum_add_distrib] + congr 2 + simp only [thetaGamma,Finset.sum_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + simp only [Algebra.smul_def] + ring + rw [← ht] + simp only [leadingS,sub_add_cancel,Finset.sum_add_distrib,← Finset.mul_sum,mul_assoc] + ring + +lemma scalar_residual_algebra (r k R K b db H J s : ℂ) (hr : r≠0) (hk : k≠0) + (hl : k+r*r≠0) (hB : 2*r*s+k*b+r*H=0) : + -(1/2 : ℂ)*((K/r-k*R/r^2)*b+k/r*db+J+(2*R/r)*s)- + ((r*r/(k+r*r))*(K/k-2*R/r)*s+ + (1/2 : ℂ)*(((r*r/(k+r*r))*(K/k)-(2*R/r)/2)*H-(r*r/(k+r*r))*J))= + (-k/(2*r*(k+r*r)))*((k+r*r)*db+K*b+r*(2*(2*R/r)*s+J)) := by + calc + _ = (-k/(2*r*(k+r*r)))*((k+r*r)*db+K*b+r*(2*(2*R/r)*s+J))+ + (R/(2*r^2)-r*K/(2*k*(k+r*r)))*(2*r*s+k*b+r*H) := by + have hp : k+r^2≠0 := by simpa only [pow_two] using hl + field_simp [hr,hk,hl,hp] + ring + _ = _ := by rw [hB]; ring + +lemma normal_form_bottom_residual (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) : + direction (A := Smooth) coord θ (changeS k r hr a b)- + (transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i)= + -(1/4 : ℂ) • (k*smoothInv r hr*smoothInv (k+r*r) hl*leadingS coord θ (k-r*r) (r*r) a b) := by + rw [changeS_derivative θ k r hr a b hR,transportT_eq θ k r hr hk hl, + transportQ_contract,transformed_scalar_exact θ k r hr a b hR] + apply Subtype.ext + funext x + let R := (r : X → ℂ) x + let K := (k : X → ℂ) x + let DR := (direction (A := Smooth) coord θ r : X → ℂ) x + let DK := (direction (A := Smooth) coord θ k : X → ℂ) x + let B := (b : X → ℂ) x + let DB := (direction (A := Smooth) coord θ b : X → ℂ) x + let H := ((∑ i,logarithmicGrad r hr i*changeP r a i : Smooth) : X → ℂ) x + let J := ((∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i : Smooth) : X → ℂ) x + let S := (changeS k r hr a b : X → ℂ) x + have he : S=-(1/2 : ℂ)*(K*R⁻¹*B+H) := rfl + have hB : 2*R*S+K*B+R*H=0 := by + rw [he] + have hn : R≠0 := hr x + field_simp [hn] + ring + have hgamma : (thetaGamma θ r hr : X → ℂ) x=2*DR/R := by + rw [thetaGamma_eq] + change 2*R⁻¹*DR=2*DR/R + ring + have ha := scalar_residual_algebra R K DR DK B DB H J S (hr x) (hk x) + (show K+R*R≠0 from hl x) hB + simp only [Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_pow, + Subalgebra.coe_smul,Pi.add_apply,Pi.sub_apply,Pi.mul_apply,Pi.pow_apply,Pi.smul_apply, + smul_eq_mul,smoothInv_apply,hgamma] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + change -(1/2 : ℂ)*((DK*R⁻¹-K*(R⁻¹)^2*DR)*B+K*R⁻¹*DB+J+(2*DR/R)*S)- + (R*R*(K+R*R)⁻¹*(K⁻¹*DK-2*DR/R)*S+ + (1/2 : ℂ)*((R*R*(K+R*R)⁻¹*K⁻¹*DK-(1/2 : ℂ)*(2*DR/R))*H-R*R*(K+R*R)⁻¹*J))= + -(1/4 : ℂ)*(K*R⁻¹*(K+R*R)⁻¹*(2*((K+R*R)*DB+DK*B+R*(2*(2*DR/R)*S+J)))) + convert ha using 1 <;> simp only [div_eq_mul_inv,inv_pow,mul_inv_rev] <;> ring + +/-- Both directions of the actual physical leading transport equivalence. -/ +theorem leading_equations_iff (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + (leadingR coord θ (k-r*r) (r*r) a b=0 ∧ leadingS coord θ (k-r*r) (r*r) a b=0) ↔ + (∀ i,direction (A := Smooth) coord θ (changeP r a i)=θ i • changeS k r hr a b) ∧ + direction (A := Smooth) coord θ (changeS k r hr a b)= + transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i := by + constructor + · rintro ⟨hR,hS⟩ + exact ⟨normal_form_top θ k r hr a b hR,normal_form_bottom θ k r hr hk hl a b hR hS⟩ + · rintro ⟨hP,hT⟩ + have hR := (leadingR_iff θ k r hr a b).mpr hP + refine ⟨hR,?_⟩ + have hh := normal_form_bottom_residual θ k r hr hk hl a b hR + rw [hT,sub_self] at hh + apply Subtype.ext + funext x + have he := congrArg (fun f : Smooth => (f : X → ℂ) x) hh + simp only [Subalgebra.coe_smul,Subalgebra.coe_mul,Subalgebra.coe_zero,Pi.zero_apply,Pi.mul_apply, + Pi.smul_apply,smul_eq_mul,smoothInv_apply] at he + rw [← mul_assoc] at he + exact (mul_eq_zero.mp he.symm).resolve_left (by + apply mul_ne_zero + · norm_num + · exact mul_ne_zero (mul_ne_zero (hk x) (inv_ne_zero (hr x))) (inv_ne_zero (hl x))) +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +lemma changeS_derivative_raw (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + direction (A := Smooth) coord θ (changeS k r hr a b)= + -(1/2 : ℂ) • ((direction (A := Smooth) coord θ k*smoothInv r hr- + k*(smoothInv r hr)^2*direction (A := Smooth) coord θ r)*b+ + k*smoothInv r hr*direction (A := Smooth) coord θ b+ + (∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)+ + ∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i)) := by + conv_lhs => rw [changeS,direction_smul,direction_add] + simp only [direction_sum,direction_mul,direction_inv,Finset.sum_add_distrib] + congr 1 + ring + +lemma transformed_scalar_raw (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + leadingS coord θ (k-r*r) (r*r) a b= + 2*((k+r*r)*direction (A := Smooth) coord θ b+direction (A := Smooth) coord θ k*b+ + r*(2*(∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i))+ + ∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)) := by + have ht : (∑ i, (2*coord i (r*r)*direction (A := Smooth) coord θ (a i)+ + direction (A := Smooth) coord θ (coord i (r*r))*a i) : Smooth)= + r*(2*(∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i))+ + ∑ i, direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i) := by + simp_rw [transformed_gradient θ r hr a] + rw [← Finset.mul_sum,Finset.sum_add_distrib] + simp only [Finset.mul_sum,mul_assoc] + rw [← ht] + simp only [leadingS,sub_add_cancel,Finset.sum_add_distrib,← Finset.mul_sum,mul_assoc] + ring + +lemma contraction_at (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) (x : X) + (hP : ∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x) : + ((∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i) : Smooth) : X → ℂ) x= + (thetaGamma θ r hr : X → ℂ) x*(changeS k r hr a b : X → ℂ) x := by + simp only [thetaGamma,Fin.sum_univ_three,Subalgebra.coe_add,Subalgebra.coe_mul, + Subalgebra.coe_smul,Pi.add_apply,Pi.mul_apply,Pi.smul_apply,smul_eq_mul,hP] + ring + +lemma changeS_derivative_at (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) (x : X) + (hP : ∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x) : + (direction (A := Smooth) coord θ (changeS k r hr a b) : X → ℂ) x= + ((-(1/2 : ℂ) • ((direction (A := Smooth) coord θ k*smoothInv r hr- + k*(smoothInv r hr)^2*direction (A := Smooth) coord θ r)*b+ + k*smoothInv r hr*direction (A := Smooth) coord θ b+ + (∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)+ + thetaGamma θ r hr*changeS k r hr a b) : Smooth) : X → ℂ) x := by + rw [changeS_derivative_raw] + simp only [Subalgebra.coe_smul,Subalgebra.coe_add,Subalgebra.coe_mul,Pi.smul_apply,Pi.add_apply,Pi.mul_apply] + rw [contraction_at θ k r hr a b x hP] + +lemma transformed_scalar_at (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) (x : X) + (hP : ∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x) : + ((leadingS coord θ (k-r*r) (r*r) a b : Smooth) : X → ℂ) x= + ((2*((k+r*r)*direction (A := Smooth) coord θ b+direction (A := Smooth) coord θ k*b+ + r*(2*thetaGamma θ r hr*changeS k r hr a b+ + ∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)) : Smooth) : X → ℂ) x := by + rw [transformed_scalar_raw θ k r hr a b] + simp only [Subalgebra.coe_add,Subalgebra.coe_mul,Pi.add_apply,Pi.mul_apply] + rw [contraction_at θ k r hr a b x hP] + ring + +lemma normal_form_bottom_residual_at (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (x : X) (hP : ∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x) : + ((direction (A := Smooth) coord θ (changeS k r hr a b)- + (transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i) : Smooth) : X → ℂ) x= + ((-(1/4 : ℂ) • (k*smoothInv r hr*smoothInv (k+r*r) hl*leadingS coord θ (k-r*r) (r*r) a b) : Smooth) : X → ℂ) x := by + rw [transportT_eq θ k r hr hk hl,transportQ_contract] + simp only [Subalgebra.coe_sub,Subalgebra.coe_smul,Subalgebra.coe_mul,Pi.sub_apply, + Pi.smul_apply,Pi.mul_apply] + rw [changeS_derivative_at θ k r hr a b x hP,transformed_scalar_at θ k r hr a b x hP] + let R := (r : X → ℂ) x + let K := (k : X → ℂ) x + let DR := (direction (A := Smooth) coord θ r : X → ℂ) x + let DK := (direction (A := Smooth) coord θ k : X → ℂ) x + let B := (b : X → ℂ) x + let DB := (direction (A := Smooth) coord θ b : X → ℂ) x + let H := ((∑ i,logarithmicGrad r hr i*changeP r a i : Smooth) : X → ℂ) x + let J := ((∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i : Smooth) : X → ℂ) x + let S := (changeS k r hr a b : X → ℂ) x + have he : S=-(1/2 : ℂ)*(K*R⁻¹*B+H) := rfl + have hB : 2*R*S+K*B+R*H=0 := by + rw [he] + have hn : R≠0 := hr x + field_simp [hn] + ring + have hgamma : (thetaGamma θ r hr : X → ℂ) x=2*DR/R := by + rw [thetaGamma_eq] + change 2*R⁻¹*DR=2*DR/R + ring + have ha := scalar_residual_algebra R K DR DK B DB H J S (hr x) (hk x) + (show K+R*R≠0 from hl x) hB + simp only [Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_pow, + Subalgebra.coe_smul,Pi.add_apply,Pi.sub_apply,Pi.mul_apply,Pi.pow_apply,Pi.smul_apply, + smul_eq_mul,smoothInv_apply,hgamma] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + change -(1/2 : ℂ)*((DK*R⁻¹-K*(R⁻¹)^2*DR)*B+K*R⁻¹*DB+J+(2*DR/R)*S)- + (R*R*(K+R*R)⁻¹*(K⁻¹*DK-2*DR/R)*S+ + (1/2 : ℂ)*((R*R*(K+R*R)⁻¹*K⁻¹*DK-(1/2 : ℂ)*(2*DR/R))*H-R*R*(K+R*R)⁻¹*J))= + -(1/4 : ℂ)*(K*R⁻¹*(K+R*R)⁻¹*(2*((K+R*R)*DB+DK*B+R*(2*(2*DR/R)*S+J)))) + convert ha using 1 <;> simp only [div_eq_mul_inv,inv_pow,mul_inv_rev] <;> ring + +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +lemma leadingR_contract (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + (∑ i,logarithmicGrad r hr i*leadingR coord θ (k-r*r) (r*r) a b i)= + 2*r*((∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i))- + thetaGamma θ r hr*changeS k r hr a b) := by + simp_rw [leadingR_change θ k r hr a b] + simp only [thetaGamma,mul_sub,Finset.mul_sum,Finset.sum_mul,Finset.sum_sub_distrib, + Algebra.smul_def] + congr 1 <;> apply Finset.sum_congr rfl <;> intro i _ <;> ring + +lemma scalar_forced_residual (r k R K b db H J G s : ℂ) (hr : r≠0) (hk : k≠0) + (hl : k+r*r≠0) (hB : 2*r*s+k*b+r*H=0) : + -(1/2 : ℂ)*((K/r-k*R/r^2)*b+k/r*db+J+G)- + ((r*r/(k+r*r))*(K/k-2*R/r)*s+ + (1/2 : ℂ)*(((r*r/(k+r*r))*(K/k)-(2*R/r)/2)*H-(r*r/(k+r*r))*J))= + (-k/(2*r*(k+r*r)))*((k+r*r)*db+K*b+r*(2*G+J))+ + ((k-r*r)/(2*(k+r*r)))*(G-(2*R/r)*s) := by + have ha := scalar_residual_algebra r k R K b db H J s hr hk hl hB + calc + _ = (-(1/2 : ℂ)*((K/r-k*R/r^2)*b+k/r*db+J+(2*R/r)*s)- + ((r*r/(k+r*r))*(K/k-2*R/r)*s+ + (1/2 : ℂ)*(((r*r/(k+r*r))*(K/k)-(2*R/r)/2)*H-(r*r/(k+r*r))*J)))- + (1/2 : ℂ)*(G-(2*R/r)*s) := by ring + _ = (-k/(2*r*(k+r*r)))*((k+r*r)*db+K*b+r*(2*(2*R/r)*s+J))- + (1/2 : ℂ)*(G-(2*R/r)*s) := by rw [ha] + _ = _ := by + have hp : k+r^2≠0 := by simpa only [pow_two] using hl + field_simp [hr,hl,hp] + ring + +/-- Exact forced transport intertwining, with no homogeneous leading-equation +premise. This is the source term needed for the physical compatible recursion. -/ +lemma normal_form_forced_residual (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + direction (A := Smooth) coord θ (changeS k r hr a b)- + (transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i)= + -(1/4 : ℂ) • (k*smoothInv r hr*smoothInv (k+r*r) hl*leadingS coord θ (k-r*r) (r*r) a b)+ + (1/4 : ℂ) • ((k-r*r)*smoothInv r hr*smoothInv (k+r*r) hl* + ∑ i,logarithmicGrad r hr i*leadingR coord θ (k-r*r) (r*r) a b i) := by + rw [changeS_derivative_raw θ k r hr a b,transportT_eq θ k r hr hk hl, + transportQ_contract,transformed_scalar_raw θ k r hr a b,leadingR_contract] + apply Subtype.ext + funext x + let R := (r : X → ℂ) x + let K := (k : X → ℂ) x + let DR := (direction (A := Smooth) coord θ r : X → ℂ) x + let DK := (direction (A := Smooth) coord θ k : X → ℂ) x + let B := (b : X → ℂ) x + let DB := (direction (A := Smooth) coord θ b : X → ℂ) x + let H := ((∑ i,logarithmicGrad r hr i*changeP r a i : Smooth) : X → ℂ) x + let J := ((∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i : Smooth) : X → ℂ) x + let G := ((∑ i,logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i) : Smooth) : X → ℂ) x + let S := (changeS k r hr a b : X → ℂ) x + have he : S=-(1/2 : ℂ)*(K*R⁻¹*B+H) := rfl + have hB : 2*R*S+K*B+R*H=0 := by + rw [he] + have hn : R≠0 := hr x + field_simp [hn] + ring + have hgamma : (thetaGamma θ r hr : X → ℂ) x=2*DR/R := by + rw [thetaGamma_eq] + change 2*R⁻¹*DR=2*DR/R + ring + have ha := scalar_forced_residual R K DR DK B DB H J G S (hr x) (hk x) + (show K+R*R≠0 from hl x) hB + simp only [Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_pow, + Subalgebra.coe_smul,Pi.add_apply,Pi.sub_apply,Pi.mul_apply,Pi.pow_apply,Pi.smul_apply, + smul_eq_mul,smoothInv_apply,hgamma] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + change -(1/2 : ℂ)*((DK*R⁻¹-K*(R⁻¹)^2*DR)*B+K*R⁻¹*DB+J+G)- + (R*R*(K+R*R)⁻¹*(K⁻¹*DK-2*DR/R)*S+ + (1/2 : ℂ)*((R*R*(K+R*R)⁻¹*K⁻¹*DK-(1/2 : ℂ)*(2*DR/R))*H-R*R*(K+R*R)⁻¹*J))= + -(1/4 : ℂ)*(K*R⁻¹*(K+R*R)⁻¹*(2*((K+R*R)*DB+DK*B+R*(2*G+J))))+ + (1/4 : ℂ)*((K-R*R)*R⁻¹*(K+R*R)⁻¹*(2*R*(G-(2*DR/R)*S))) + have hR : R≠0 := hr x + have hL : K+R^2≠0 := by + simpa only [pow_two] using (show K+R*R≠0 from hl x) + convert ha using 1 <;> simp only [div_eq_mul_inv,inv_pow,mul_inv_rev] <;> + field_simp [hR,hL] + all_goals norm_num +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +def topSource (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (H : Fin 3 → Smooth) : Fin 3 → Smooth := + fun i => (1/2 : ℂ) • (smoothInv r hr*H i) +def scalarSource (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (H : Fin 3 → Smooth) (K : Smooth) : Smooth := + -(1/4 : ℂ) • (k*smoothInv r hr*smoothInv (k+r*r) hl*K)+ + (1/4 : ℂ) • ((k-r*r)*smoothInv r hr*smoothInv (k+r*r) hl* + ∑ i,logarithmicGrad r hr i*H i) + +lemma forced_equations_at (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) + (H : Fin 3 → Smooth) (K : Smooth) (a : Fin 3 → Smooth) (b : Smooth) (x : X) + (hp : ∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x+(topSource r hr H i : X → ℂ) x) + (hs : (direction (A := Smooth) coord θ (changeS k r hr a b) : X → ℂ) x= + ((transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i : Smooth) : X → ℂ) x+ + (scalarSource k r hr hl H K : X → ℂ) x) : + (∀ i,((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x=(H i : X → ℂ) x) ∧ + ((leadingS coord θ (k-r*r) (r*r) a b : Smooth) : X → ℂ) x=(K : X → ℂ) x := by + have hR (i) : ((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x=(H i : X → ℂ) x := by + have h := congrArg (fun f : Smooth => (f : X → ℂ) x) (leadingR_change θ k r hr a b i) + change ((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x= + 2*(r : X → ℂ) x*((direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x- + θ i*(changeS k r hr a b : X → ℂ) x) at h + rw [h,hp i] + change 2*(r : X → ℂ) x*(θ i*(changeS k r hr a b : X → ℂ) x+ + (1/2 : ℂ)*(((r : X → ℂ) x)⁻¹*(H i : X → ℂ) x)-θ i*(changeS k r hr a b : X → ℂ) x)=_ + field_simp [hr x] + ring + refine ⟨hR,?_⟩ + have h := congrArg (fun f : Smooth => (f : X → ℂ) x) + (normal_form_forced_residual θ k r hr hk hl a b) + change (direction (A := Smooth) coord θ (changeS k r hr a b) : X → ℂ) x- + ((transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i : Smooth) : X → ℂ) x=_ at h + rw [hs,add_sub_cancel_left] at h + simp only [scalarSource,Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_sub, + Subalgebra.coe_smul,Pi.add_apply,Pi.mul_apply,Pi.sub_apply,Pi.smul_apply, + smul_eq_mul,smoothInv_apply,Fin.sum_univ_three,hR] at h + have hc : -(1/4 : ℂ)*(k : X → ℂ) x*((r : X → ℂ) x)⁻¹* + (((k : X → ℂ) x+(r : X → ℂ) x*(r : X → ℂ) x)⁻¹)≠0 := by + exact mul_ne_zero (mul_ne_zero (mul_ne_zero (by norm_num) (hk x)) (inv_ne_zero (hr x))) + (inv_ne_zero (hl x)) + apply (mul_left_cancel₀ hc) + linear_combination -h +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +theorem leading_equations_at_iff (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) (x : X) : + ((∀ i,((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x=0) ∧ + ((leadingS coord θ (k-r*r) (r*r) a b : Smooth) : X → ℂ) x=0) ↔ + (∀ i,(direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x) ∧ + (direction (A := Smooth) coord θ (changeS k r hr a b) : X → ℂ) x= + ((transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i : Smooth) : X → ℂ) x := by + have hR (i) := congrArg (fun f : Smooth => (f : X → ℂ) x) (leadingR_change θ k r hr a b i) + change ∀ i, ((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x= + 2*(r : X → ℂ) x*((direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x- + θ i*(changeS k r hr a b : X → ℂ) x) at hR + have hn : (2 : ℂ)*(r : X → ℂ) x≠0 := mul_ne_zero (by norm_num) (hr x) + constructor + · rintro ⟨hp,hs⟩ + have hP (i) : (direction (A := Smooth) coord θ (changeP r a i) : X → ℂ) x= + θ i*(changeS k r hr a b : X → ℂ) x := by + have hh := (hR i).symm.trans (hp i) + exact sub_eq_zero.mp ((mul_eq_zero.mp hh).resolve_left hn) + refine ⟨hP,?_⟩ + have hh := normal_form_bottom_residual_at θ k r hr hk hl a b x hP + simp only [Subalgebra.coe_sub,Pi.sub_apply,Subalgebra.coe_smul,Subalgebra.coe_mul, + Pi.smul_apply,Pi.mul_apply,smul_eq_mul,hs,mul_zero] at hh + exact sub_eq_zero.mp hh + · rintro ⟨hP,hS⟩ + refine ⟨fun i => ?_,?_⟩ + · rw [hR i,hP i,sub_self,mul_zero] + · have hh := normal_form_bottom_residual_at θ k r hr hk hl a b x hP + simp only [Subalgebra.coe_sub,Pi.sub_apply,hS,sub_self,Subalgebra.coe_smul, + Subalgebra.coe_mul,Pi.smul_apply,Pi.mul_apply,smul_eq_mul,smoothInv_apply] at hh + rw [← mul_assoc] at hh + exact (mul_eq_zero.mp hh.symm).resolve_left (by + apply mul_ne_zero + · norm_num + · exact mul_ne_zero (mul_ne_zero (hk x) (inv_ne_zero (hr x))) (inv_ne_zero (hl x))) +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +lemma normal_inverseP (θ : Fin 3 → ℂ) (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) + (p : Fin 3 → Smooth) : normal θ (inverseP r hr p)=smoothInv r hr*normal θ p := by + simp only [normal,inverseP,Finset.mul_sum,Algebra.smul_def] + exact Finset.sum_congr rfl (fun _ _ => by ring) + +/-- Actual physical leading amplitudes, with three independent transformed +columns and both augmented leading equations on any prescribed compact region. +The equations are local: no global transport equation is assumed. -/ +theorem exists_physical_leading_frame (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) + {C : Set X} (hC : IsCompact C) : + ∃ a : Fin 3 → Fin 3 → Smooth, ∃ b : Fin 3 → Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ ν,normal θ (a ν)=0) ∧ + (∀ ν x, x∈C → + (∀ i,((leadingR coord θ (k-r*r) (r*r) (a ν) (b ν) i : Smooth) : X → ℂ) x=0) ∧ + ((leadingS coord θ (k-r*r) (r*r) (a ν) (b ν) : Smooth) : X → ℂ) x=0) ∧ + ∀ ν x, ((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (a ν) i : X → ℂ) x),(changeS k r hr (a ν) (b ν) : X → ℂ) x) := by + let t := transportT θ k r hk hl + let q := transportQ θ k r hr hk hl + obtain ⟨B,hB,he⟩ := ElasticityFrame.exists_constraint_columns θ hθ hne + (t : X → ℂ) (fun i => (q i : X → ℂ)) (smooth_coe t) (fun i => smooth_coe (q i)) hC + let p (ν : Fin 3) := ElasticityFrame.vectorSmooth θ (fun x => B x ν) (hB ν) + let s (ν : Fin 3) := ElasticityFrame.scalarSmooth θ (fun x => B x ν) (hB ν) + let a (ν : Fin 3) := inverseP r hr (p ν) + let b (ν : Fin 3) := inverseS k r hr hk (p ν) (s ν) + refine ⟨a,b,B,?_,?_,?_⟩ + · intro ν + rw [show a ν=inverseP r hr (p ν) from rfl,normal_inverseP, + ElasticityFrame.smooth_normal θ (fun x => B x ν) (hB ν),mul_zero] + · intro ν x hx + apply (leading_equations_at_iff θ k r hr hk hl (a ν) (b ν) x).mpr + have hp := ElasticityFrame.smooth_vector_equation θ hθ (fun x => B x ν) (hB ν) t q x (he ν x hx) + have hs := ElasticityFrame.smooth_scalar_equation θ hθ (fun x => B x ν) (hB ν) t q x (he ν x hx) + change (∀ i,(direction (A := Smooth) coord θ + (changeP r (inverseP r hr (p ν)) i) : X → ℂ) x= + θ i*(changeS k r hr (inverseP r hr (p ν)) (inverseS k r hr hk (p ν) (s ν)) : X → ℂ) x) ∧ _ + rw [change_inverseP,change_inverseS] + exact ⟨hp,hs⟩ + · intro ν x + change ((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (inverseP r hr (p ν)) i : X → ℂ) x), + (changeS k r hr (inverseP r hr (p ν)) (inverseS k r hr hk (p ν) (s ν)) : X → ℂ) x) + rw [change_inverseP,change_inverseS] + rfl +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented + +lemma normal_topSource (θ : Fin 3 → ℂ) (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) + (H : Fin 3 → Smooth) : normal θ (topSource r hr H)=(1/2 : ℂ) • (smoothInv r hr*normal θ H) := by + simp only [normal,topSource,Algebra.smul_def,Finset.mul_sum] + exact Finset.sum_congr rfl (fun _ _ => by ring) + +/-- Smooth physical leading equations with arbitrary tangent vector forcing. +Solvability is proved from actual planar transport, not assumed. Forcing need +only be tangent on the compact region on which the equations are requested. -/ +theorem exists_physical_forced_transport (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) + (H : Fin 3 → Smooth) (K : Smooth) {C : Set X} (hC : IsCompact C) + (hH : ∀ x∈C,((normal θ H : Smooth) : X → ℂ) x=0) : + ∃ a : Fin 3 → Smooth, ∃ b : Smooth, normal θ a=0 ∧ + ∀ x∈C, (∀ i,((leadingR coord θ (k-r*r) (r*r) a b i : Smooth) : X → ℂ) x=(H i : X → ℂ) x) ∧ + ((leadingS coord θ (k-r*r) (r*r) a b : Smooth) : X → ℂ) x=(K : X → ℂ) x := by + obtain ⟨n,hn⟩ := exists_normalizing_vector θ hne + let Fp := topSource r hr H + let Fs := scalarSource k r hr hl H K + let f : X → ElasticityFrame.Fiber θ := fun x => ElasticityFrame.tangentProjection θ n hn + ((fun i => (Fp i : X → ℂ) x),(Fs : X → ℂ) x) + have hf : ContDiff ℝ (⊤ : ℕ∞) f := ElasticityFrame.tangentProjection_smooth θ n hn Fp Fs + let t := transportT θ k r hk hl + let q := transportQ θ k r hr hk hl + obtain ⟨u,hu,he⟩ := ElasticityFrame.exists_constraint_transport θ hθ hne + (t : X → ℂ) (fun i => (q i : X → ℂ)) (smooth_coe t) (fun i => smooth_coe (q i)) f hf hC + let p := ElasticityFrame.vectorSmooth θ u hu + let s := ElasticityFrame.scalarSmooth θ u hu + let a := inverseP r hr p + let b := inverseS k r hr hk p s + refine ⟨a,b,?_,?_⟩ + · rw [show a=inverseP r hr p from rfl,normal_inverseP, + ElasticityFrame.smooth_normal θ u hu,mul_zero] + · intro x hx + have hF : ((f x : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (Fp i : X → ℂ) x),(Fs : X → ℂ) x) := by + apply ElasticityFrame.tangentProjection_of_normal θ n hn + have h := congrArg (fun v : Smooth => (v : X → ℂ) x) (normal_topSource θ r hr H) + change ElasticityFrame.normal θ ((fun i => (Fp i : X → ℂ) x),(Fs : X → ℂ) x)= + (1/2 : ℂ)*(((r : X → ℂ) x)⁻¹*((normal θ H : Smooth) : X → ℂ) x) at h + rw [h,hH x hx,mul_zero,mul_zero] + have hp := ElasticityFrame.smooth_vector_forced θ hθ u hu t q (f x) x (he x hx) + have hs := ElasticityFrame.smooth_scalar_forced θ hθ u hu t q (f x) x (he x hx) + rw [hF] at hp hs + apply forced_equations_at θ k r hr hk hl H K a b x + · change ∀ i,(direction (A := Smooth) coord θ (changeP r (inverseP r hr p) i) : X → ℂ) x= + θ i*(changeS k r hr (inverseP r hr p) (inverseS k r hr hk p s) : X → ℂ) x+_ + rw [change_inverseP,change_inverseS] + exact hp + · change (direction (A := Smooth) coord θ + (changeS k r hr (inverseP r hr p) (inverseS k r hr hk p s)) : X → ℂ) x=_ + rw [change_inverseS,change_inverseP] + exact hs +end ElasticityAugmented + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Holomorphy.lean b/lean/OAI/MathematicalPhysics/Elasticity/Holomorphy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cca676fa70823e1bb847103aef1627331d156dd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Holomorphy.lean @@ -0,0 +1,463 @@ +import OAI.MathematicalPhysics.Elasticity.Conic + +namespace OAI + +section +noncomputable section +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap BigOperators +namespace ElasticityPlanar +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +lemma test_equation_distribution (a : n → n → ℂ → ℂ) + (ha : ∀ i j,(a i j).HasTemperateGrowth) (u f : n → Test) + (he : ∀ i z,schwartzDbar (toSchwartz (u i)) z+∑ j,a i j z*u j z=f i z) (i : n) : + planarOperator a i (embed u)=(toSchwartz (f i) : 𝓢'(ℂ,ℂ)) := by + rw [planarOperator_test a ha] + change (L2 (transport a (fun i j => (ha i j).1) u i) : 𝓢'(ℂ,ℂ))=_ + rw [L2_distribution] + congr 1 + apply congrArg toSchwartz + apply Subtype.ext + funext z + simp only [transport,LinearMap.coe_mk,AddHom.coe_mk,Submodule.coe_add,Submodule.coe_smul, + Submodule.coe_sum,Pi.add_apply,Pi.smul_apply,Finset.sum_apply,smul_eq_mul] + exact he i z + +/-- Uniqueness identifies the independently supplied smooth slices with the +jointly smooth selection; smooth parameter dependence is a conclusion. -/ +theorem classical_parameter_smooth {S K : Set ℂ} (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z,z∉K → a i j (p,z)=0) + (f : n → P × ℂ → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i p z,z∉K → f i (p,z)=0) + (u : P → n → Test) (hu : ∀ p i,tsupport (u p i : ℂ → ℂ)⊆S) + (he : ∀ p i z,schwartzDbar (toSchwartz (u p i)) z+ + ∑ j,a i j (p,z)*u p j z=f i (p,z)) : + ∀ i,ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => u q.1 i q.2) := by + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + let F (p : P) (i : n) : Test := ⟨fun z => f i (p,z), + (hf i).comp (contDiff_const.prodMk contDiff_id),compact_slice hK (f i) (hfs i) p⟩ + have hdist (p : P) (i : n) := test_equation_distribution (fun i j z => a i j (p,z)) + (hat p) (u p) (F p) (he p) i + obtain ⟨v,hv,hvs,hve⟩ := supported_parameter_inversion hS hK a ha hs f hf hfs + (D := univ) dense_univ (fun p _ => ⟨embed (u p),fun i => ⟨hdist p i, + test_support_distribution (u p i) (hu p i)⟩⟩) + have huv (p : P) : embed (u p)=embed (v p) := by + apply supported_weak_unique hS (fun i j z => a i j (p,z)) (hat p) + · intro i + exact (hdist p i).trans (test_equation_distribution (fun i j z => a i j (p,z)) + (hat p) (v p) (F p) (hve p) i).symm + · intro i + exact test_support_distribution (u p i) (hu p i) + · intro i + exact test_support_distribution (v p i) (hvs p i) + have htest (p : P) (i : n) : u p i=v p i := by + have hh := congrArg (entryInjection i) (huv p) + change (L2 (u p i) : 𝓢'(ℂ,ℂ))=(L2 (v p i) : 𝓢'(ℂ,ℂ)) at hh + rw [L2_distribution,L2_distribution] at hh + have heq : LocalEqual univ (toSchwartz (u p i) : 𝓢'(ℂ,ℂ)) (toSchwartz (v p i) : 𝓢'(ℂ,ℂ)) := + fun φ _ _ => congrArg (fun t : 𝓢'(ℂ,ℂ) => t φ) hh + apply Subtype.ext + funext z + exact heq.schwartz_eqOn isOpen_univ (mem_univ z) + simpa only [htest] using hv +end ElasticityPlanar + +end +end +section +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityCoordinates +variable {P E : Type} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] +lemma compact_parameter_identity (p₀ : P) : + ∃ τ : P → P,ContDiff ℝ (⊤ : ℕ∞) τ ∧ IsCompact (range τ) ∧ τ=ᶠ[𝓝 p₀] id := by + obtain ⟨χ,hχ,hc,_,h1,_⟩ := ElasticityBoundary.compact_smooth_cutoff + (K := {p₀}) (U := univ) isCompact_singleton isOpen_univ (subset_univ _) + let u := fun p => χ p • (p-p₀) + have hu : ContDiff ℝ (⊤ : ℕ∞) u := hχ.smul (contDiff_id.sub contDiff_const) + have huc : HasCompactSupport u := hc.smul_right + refine ⟨fun p => p₀+u p,contDiff_const.add hu,?_,?_⟩ + · have he : range (fun p => p₀+u p)=(fun q => p₀+q) '' range u := by + ext q + simp only [mem_range,mem_image,exists_exists_eq_and] + rw [he] + exact (huc.isCompact_range hu.continuous).image (continuous_const.add continuous_id) + · have hh : ∀ᶠ p in 𝓝 p₀,χ p=1 := by simpa only [nhdsSet_singleton] using h1 + filter_upwards [hh] with p hp + simp only [u,hp,one_smul,id_eq] + abel + +omit [NormedSpace ℝ P] [FiniteDimensional ℝ P] [FiniteDimensional ℝ E] in +/-- Uniform properness of an injective family of characteristic planes on a +compact parameter set. This supplies a fixed planar support for parameter +inversion, rather than silently treating moving planes as fixed. -/ +lemma uniform_plane_support {T : Set P} (hT : IsCompact T) + (J : P → ℂ →L[ℝ] E) (hJ : Continuous J) (hinj : ∀ p∈T,Function.Injective (J p)) + (x : P → E) (hx : Continuous x) {K : Set E} (hK : IsCompact K) : + ∃ S : Set ℂ,IsCompact S ∧ ∀ p∈T,∀ w,x p+J p w∈K → w∈S := by + have hc : IsCompact (T ×ˢ Metric.sphere (0 : ℂ) 1) := hT.prod (isCompact_sphere _ _) + have hf : Continuous (fun q : P × ℂ => ‖J q.1 q.2‖) := + ((hJ.comp continuous_fst).clm_apply continuous_snd).norm + have hp : ∀ q∈T ×ˢ Metric.sphere (0 : ℂ) 1,0<‖J q.1 q.2‖ := by + rintro ⟨p,w⟩ ⟨hpt,hws⟩ + apply norm_pos_iff.mpr + intro hz + have hw : w=0 := hinj p hpt (hz.trans (map_zero _).symm) + have hh : ‖w‖=1 := by simpa only [Metric.mem_sphere,dist_zero_right] using hws + rw [hw,norm_zero] at hh + norm_num at hh + obtain ⟨c,hc0,hc⟩ := hc.exists_forall_le' hf.continuousOn hp + have hlow (p : P) (hpt : p∈T) (w : ℂ) : c*‖w‖≤‖J p w‖ := by + by_cases hw : w=0 + · simp only [hw,norm_zero,mul_zero,map_zero,le_refl] + have hn : 0<‖w‖ := norm_pos_iff.mpr hw + have hu : (‖w‖⁻¹ : ℝ) • w∈Metric.sphere (0 : ℂ) 1 := by + simp only [Metric.mem_sphere,dist_zero_right,norm_smul,Real.norm_eq_abs,abs_inv,abs_of_pos hn] + exact inv_mul_cancel₀ hn.ne' + have hh := hc (p,(‖w‖⁻¹ : ℝ) • w) ⟨hpt,hu⟩ + simp only [map_smul,norm_smul,Real.norm_eq_abs,abs_inv,abs_of_pos hn] at hh + have he := mul_le_mul_of_nonneg_left hh hn.le + calc + c*‖w‖=‖w‖*c := mul_comm _ _ + _ ≤ ‖w‖*(‖w‖⁻¹*‖J p w‖) := he + _ = ‖J p w‖ := by rw [← mul_assoc,mul_inv_cancel₀ hn.ne',one_mul] + obtain ⟨R,hR⟩ := hK.isBounded.exists_norm_le + obtain ⟨C,hC⟩ := (hT.image hx).isBounded.exists_norm_le + refine ⟨Metric.closedBall 0 ((R+C)/c),isCompact_closedBall _ _,fun p hpt w hw => ?_⟩ + rw [Metric.mem_closedBall,dist_zero_right,le_div_iff₀ hc0] + have hu : ‖J p w‖≤R+C := by + have he : J p w=(x p+J p w)-x p := by abel + rw [he] + exact (norm_sub_le _ _).trans (add_le_add (hR _ hw) (hC _ (mem_image_of_mem x hpt))) + have hh : ‖w‖*c≤‖J p w‖ := by simpa only [mul_comm] using hlow p hpt w + exact hh.trans hu +end ElasticityCoordinates + +end +end +section +noncomputable section +open Set Filter +open scoped Topology BigOperators SchwartzMap +namespace ElasticityPlanar +variable {n : Type*} [Fintype n] +variable {P E : Type} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] +/-- Joint smoothness from supported transport on moving characteristic planes. +Neither continuity nor parameter differentiability of the unknown is assumed. -/ +theorem moving_plane_parameter_smooth (J : P → ℂ →L[ℝ] E) + (hJ : ContDiff ℝ (⊤ : ℕ∞) J) (hJi : ∀ p,Function.Injective (J p)) + {S K : Set E} (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → E × P → ℂ) (ha : ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (has : ∀ i j x p,x∉K → a i j (x,p)=0) + (f : n → E × P → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i x p,x∉K → f i (x,p)=0) + (u : P → n → E → ℂ) (hu : ∀ p i,ContDiff ℝ (⊤ : ℕ∞) (u p i)) + (hus : ∀ p i,tsupport (u p i)⊆S) + (he : ∀ p i x,fderiv ℝ (u p i) x (J p 1)+Complex.I*fderiv ℝ (u p i) x (J p Complex.I)+ + ∑ j,a i j (x,p)*u p j x=f i (x,p)) : + ∀ i,ContDiff ℝ (⊤ : ℕ∞) (fun q : E × P => u q.2 i q.1) := by + intro i + apply contDiff_iff_contDiffAt.mpr + intro q₀ + obtain ⟨τ,hτ,hτc,hτe⟩ := ElasticityCoordinates.compact_parameter_identity q₀ + obtain ⟨W,hW,hWs⟩ := ElasticityCoordinates.uniform_plane_support hτc + (fun q : E × P => J q.2) (hJ.continuous.comp continuous_snd) + (fun q _ => hJi q.2) Prod.fst continuous_fst (hS.union hK) + let F : (E × P) × ℂ → E := fun q => (τ q.1).1+J (τ q.1).2 q.2 + have hF : ContDiff ℝ (⊤ : ℕ∞) F := + (hτ.fst.comp contDiff_fst).add ((hJ.comp (hτ.snd.comp contDiff_fst)).clm_apply contDiff_snd) + let A : n → n → (E × P) × ℂ → ℂ := fun i j q => a i j (F q,(τ q.1).2) + let b : n → (E × P) × ℂ → ℂ := fun i q => f i (F q,(τ q.1).2) + have hA (i j) : ContDiff ℝ (⊤ : ℕ∞) (A i j) := + (ha i j).comp (hF.prodMk (hτ.snd.comp contDiff_fst)) + have hb (i) : ContDiff ℝ (⊤ : ℕ∞) (b i) := + (hf i).comp (hF.prodMk (hτ.snd.comp contDiff_fst)) + have hout (q : E × P) (z : ℂ) (hz : z∉W) : F (q,z)∉S∪K := + fun hh => hz (hWs (τ q) (mem_range_self q) z hh) + have hAs (i j q z) (hz : z∉W) : A i j (q,z)=0 := + has i j _ _ (fun hh => hout q z hz (Or.inr hh)) + have hbs (i q z) (hz : z∉W) : b i (q,z)=0 := + hfs i _ _ (fun hh => hout q z hz (Or.inr hh)) + have hvu (q : E × P) (j : n) : ContDiff ℝ (⊤ : ℕ∞) (fun z => u (τ q).2 j (F (q,z))) := + (hu _ _).comp (hF.comp (contDiff_const.prodMk contDiff_id)) + have hvs (q : E × P) (j : n) : tsupport (fun z => u (τ q).2 j (F (q,z)))⊆W := by + apply closure_minimal _ hW.isClosed + intro z hz + by_contra hn + exact hz (image_eq_zero_of_notMem_tsupport (fun hh => hout q z hn (Or.inl (hus _ _ hh)))) + let v : (E × P) → n → Test := fun q j => ⟨fun z => u (τ q).2 j (F (q,z)), + hvu q j,hW.of_isClosed_subset isClosed_closure (hvs q j)⟩ + have hve (q : E × P) (j : n) (z : ℂ) : + schwartzDbar (toSchwartz (v q j)) z+∑ k,A j k (q,z)*v q k z=b j (q,z) := by + change fderiv ℝ (u (τ q).2 j ∘ planeMap (J (τ q).2) (τ q).1) z 1+ + Complex.I*fderiv ℝ (u (τ q).2 j ∘ planeMap (J (τ q).2) (τ q).1) z Complex.I+_=_ + rw [plane_deriv _ _ ((hu _ _).differentiable (by simp)), + plane_deriv _ _ ((hu _ _).differentiable (by simp))] + exact he (τ q).2 j (F (q,z)) + have hv := classical_parameter_smooth hW hW A hA hAs b hb hbs v hvs hve + have hg : ContDiff ℝ (⊤ : ℕ∞) (fun q : E × P => u (τ q).2 i (τ q).1) := by + have hg := (hv i).comp (contDiff_id.prodMk (contDiff_const (c := (0 : ℂ)))) + simpa only [Function.comp_def,id,v,F,map_zero,add_zero] using hg + apply hg.contDiffAt.congr_of_eventuallyEq + filter_upwards [hτe] with q hq + simp only [hq,id_eq] +end ElasticityPlanar + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +variable {n : Type*} [Fintype n] [DecidableEq n] + +lemma characteristicPlane_smooth (θ : Fin 3 → ℂ → ℂ) + (hθ : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (θ i)) : + ContDiff ℝ (⊤ : ℕ∞) (fun z => ElasticityParameter.characteristicPlane ElasticityParameter.basis (fun i => θ i z)) := by + apply ContDiff.add + · exact contDiff_const.smulRight (ContDiff.sum (fun i _ => + (Complex.reCLM.contDiff.comp (hθ i)).smul contDiff_const)) + · exact contDiff_const.smulRight (ContDiff.sum (fun i _ => + (Complex.imCLM.contDiff.comp (hθ i)).smul contDiff_const)) + +/-- Joint smoothness of the actual supported comparison. Continuity in the +conic parameter is not supplied as data. -/ +theorem supported_matrix_smooth (θ : Fin 3 → ℂ → ℂ) + (hθ : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (θ i)) + (hnull : ∀ z,∑ i,θ i z*θ i z=0) (hne : ∀ z,(fun i => θ i z)≠0) + (M₀ M₁ G : ℂ → Matrix n n Smooth) + (hM₀ : ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (fun q : X × ℂ => (M₀ q.2 i j : X → ℂ) q.1)) + (hM₁ : ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (fun q : X × ℂ => (M₁ q.2 i j : X → ℂ) q.1)) + {S : Set X} (hS : IsCompact S) (χ : Smooth) (hχ : HasCompactSupport (χ : X → ℂ)) + (hχ1 : ∀ x∈S,(χ : X → ℂ) x=1) + (hs : ∀ z i j,tsupport ((G z i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆S) + (hMe : ∀ z x,x∉S → matrixEval x (M₀ z)=matrixEval x (M₁ z)) + (he : ∀ z,matrixD (fun i => θ i z) (G z)=M₁ z*G z-G z*M₀ z) : + ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (fun q : X × ℂ => (G q.2 i j : X → ℂ) q.1) := by + let U : ℂ → Matrix n n Smooth := fun z => G z-1 + let C : (n × n) → (n × n) → X × ℂ → ℂ := fun p q y => + (if q.2=p.2 then (M₁ y.2 p.1 q.1 : X → ℂ) y.1 else 0)- + (if q.1=p.1 then (M₀ y.2 q.2 p.2 : X → ℂ) y.1 else 0) + let a : (n × n) → (n × n) → X × ℂ → ℂ := fun p q y => -(χ : X → ℂ) y.1*C p q y + let f : (n × n) → X × ℂ → ℂ := fun p y => (M₁ y.2 p.1 p.2 : X → ℂ) y.1-(M₀ y.2 p.1 p.2 : X → ℂ) y.1 + have ha (p q : n × n) : ContDiff ℝ (⊤ : ℕ∞) (a p q) := by + have hχs : ContDiff ℝ (⊤ : ℕ∞) (χ : X → ℂ) := χ.property + apply ((hχs.comp contDiff_fst).neg).mul + have h1 : ContDiff ℝ (⊤ : ℕ∞) (fun y : X × ℂ => if q.2=p.2 then (M₁ y.2 p.1 q.1 : X → ℂ) y.1 else 0) := by + split_ifs + · exact hM₁ _ _ + · exact contDiff_const + have h0 : ContDiff ℝ (⊤ : ℕ∞) (fun y : X × ℂ => if q.1=p.1 then (M₀ y.2 q.2 p.2 : X → ℂ) y.1 else 0) := by + split_ifs + · exact hM₀ _ _ + · exact contDiff_const + exact h1.sub h0 + have hf (p : n × n) : ContDiff ℝ (⊤ : ℕ∞) (f p) := (hM₁ _ _).sub (hM₀ _ _) + let K := S∪tsupport (χ : X → ℂ) + have hK : IsCompact K := hS.union hχ + have has (p q : n × n) (x : X) (z : ℂ) (hx : x∉K) : a p q (x,z)=0 := by + have hz := image_eq_zero_of_notMem_tsupport (fun hh => hx (Or.inr hh)) + change -(χ : X → ℂ) x*C p q (x,z)=0 + rw [hz,neg_zero,zero_mul] + have hfs (p : n × n) (x : X) (z : ℂ) (hx : x∉K) : f p (x,z)=0 := by + exact sub_eq_zero.mpr (congrArg (fun A : Matrix n n ℂ => A p.1 p.2) + (hMe z x (fun hh => hx (Or.inl hh)))).symm + have hUe (z : ℂ) : matrixD (fun i => θ i z) (U z)= + M₁ z*U z-U z*M₀ z+(M₁ z-M₀ z) := by + have hd : matrixD (fun i => θ i z) (G z-1)=matrixD (fun i => θ i z) (G z)-matrixD (fun i => θ i z) 1 := by + funext i j; exact map_sub _ _ _ + dsimp only [U] + rw [hd,matrixD_one,sub_zero,he] + simp only [mul_sub,sub_mul,mul_one,one_mul] + abel + have hg := ElasticityPlanar.moving_plane_parameter_smooth + (fun z => ElasticityParameter.characteristicPlane ElasticityParameter.basis (fun i => θ i z)) + (characteristicPlane_smooth θ hθ) (fun z => ElasticityParameter.null_plane_injective _ (hnull z) (hne z)) + hS hK a ha has f hf hfs + (fun z p => (U z p.1 p.2 : X → ℂ)) (fun z p => (U z p.1 p.2).property) + (fun z p => hs z p.1 p.2) (fun z p x => ?_) + · intro i j + have h := (hg (i,j)).add (contDiff_const (c := ((1 : Matrix n n Smooth) i j : X → ℂ) 0)) + have hid (x : X) : ((1 : Matrix n n Smooth) i j : X → ℂ) x=((1 : Matrix n n Smooth) i j : X → ℂ) 0 := by + simp only [Matrix.one_apply] + split_ifs <;> rfl + convert h using 1 + funext q + change (G q.2 i j : X → ℂ) q.1=(G q.2 i j : X → ℂ) q.1-((1 : Matrix n n Smooth) i j : X → ℂ) q.1+_ + rw [hid,sub_add_cancel] + · rw [ElasticityParameter.characteristicPlane_principal] + have hh := congrArg (fun A : Matrix n n Smooth => matrixEval x A p.1 p.2) (hUe z) + rw [matrixD_eval] at hh + simp only [map_add,map_sub,map_mul,Matrix.add_apply,Matrix.sub_apply,Matrix.mul_apply, + ← Finset.sum_sub_distrib] at hh + rw [ElasticityParameter.commutator_flatten (matrixEval x (M₁ z)) (matrixEval x (M₀ z)) (matrixEval x (U z)) p.1 p.2] at hh + change (∑ r,θ r z*fderiv ℝ (U z p.1 p.2 : X → ℂ) x (ElasticityParameter.basis r))= + (∑ q : n × n,C p q (x,z)*(U z q.1 q.2 : X → ℂ) x)+f p (x,z) at hh + rw [hh] + have hc : ∑ q : n × n,a p q (x,z)*(U z q.1 q.2 : X → ℂ) x= + -(∑ q : n × n,C p q (x,z)*(U z q.1 q.2 : X → ℂ) x) := by + by_cases hx : x∈S + · simp only [a,hχ1 x hx,neg_mul,one_mul,Finset.sum_neg_distrib] + · have hu (q : n × n) : (U z q.1 q.2 : X → ℂ) x=0 := + image_eq_zero_of_notMem_tsupport (fun hh => hx (hs z q.1 q.2 hh)) + simp only [hu,mul_zero,Finset.sum_const_zero,neg_zero] + rw [hc] + ring +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityAugmented + +structure JointHolomorphic (f : X × ℂ → ℂ) : Prop where + smooth : ContDiff ℝ (⊤ : ℕ∞) f + holo : ∀ x,Differentiable ℂ (fun z => f (x,z)) +namespace JointHolomorphic +lemma fixed (f : Smooth) : JointHolomorphic (fun q : X × ℂ => (f : X → ℂ) q.1) := + ⟨(show ContDiff ℝ (⊤ : ℕ∞) (f : X → ℂ) from f.property).comp contDiff_fst,fun x => differentiable_const ((f : X → ℂ) x)⟩ +lemma param (f : ℂ → ℂ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hh : Differentiable ℂ f) : + JointHolomorphic (fun q : X × ℂ => f q.2) := ⟨hf.comp contDiff_snd,fun _ => hh⟩ +lemma const (c : ℂ) : JointHolomorphic (fun _ : X × ℂ => c) := + ⟨contDiff_const,fun _ => differentiable_const _⟩ +lemma add {f g : X × ℂ → ℂ} (hf : JointHolomorphic f) (hg : JointHolomorphic g) : + JointHolomorphic (fun q => f q+g q) := ⟨hf.smooth.add hg.smooth,fun x => (hf.holo x).add (hg.holo x)⟩ +lemma sub {f g : X × ℂ → ℂ} (hf : JointHolomorphic f) (hg : JointHolomorphic g) : + JointHolomorphic (fun q => f q-g q) := ⟨hf.smooth.sub hg.smooth,fun x => (hf.holo x).sub (hg.holo x)⟩ +lemma mul {f g : X × ℂ → ℂ} (hf : JointHolomorphic f) (hg : JointHolomorphic g) : + JointHolomorphic (fun q => f q*g q) := ⟨hf.smooth.mul hg.smooth,fun x => (hf.holo x).mul (hg.holo x)⟩ +lemma pow {f : X × ℂ → ℂ} (hf : JointHolomorphic f) (n : ℕ) : + JointHolomorphic (fun q => f q^n) := ⟨hf.smooth.pow n,fun x => (hf.holo x).pow n⟩ +lemma sum {ι : Type*} [Fintype ι] {f : ι → X × ℂ → ℂ} (hf : ∀ i,JointHolomorphic (f i)) : + JointHolomorphic (fun q => ∑ i,f i q) := + ⟨ContDiff.sum (fun i _ => (hf i).smooth),fun x => Differentiable.fun_sum (fun i _ => (hf i).holo x)⟩ +end JointHolomorphic + +lemma chartZ₀_regular (b : Bool) : JointHolomorphic (fun q : X × ℂ => chartZ₀ b q.2) := by + cases b + · exact JointHolomorphic.const 1 + · exact JointHolomorphic.param id contDiff_id differentiable_id +lemma chartZ₁_regular (b : Bool) : JointHolomorphic (fun q : X × ℂ => chartZ₁ b q.2) := by + cases b + · exact JointHolomorphic.param id contDiff_id differentiable_id + · exact JointHolomorphic.const 1 +lemma chartTheta_regular (b : Bool) (i : Fin 3) : JointHolomorphic (fun q : X × ℂ => chartTheta b q.2 i) := by + fin_cases i + · exact (chartZ₀_regular b).pow 2 |>.sub ((chartZ₁_regular b).pow 2) + · exact (JointHolomorphic.const Complex.I).mul (((chartZ₀_regular b).pow 2).add ((chartZ₁_regular b).pow 2)) + · exact ((JointHolomorphic.const 2).mul (chartZ₀_regular b)).mul (chartZ₁_regular b) +lemma h₁_regular (b : Bool) (i : Fin 3) : JointHolomorphic (fun q : X × ℂ => h₁ (chartZ₀ b q.2) (chartZ₁ b q.2) i) := by + fin_cases i + · exact chartZ₀_regular b + · exact (JointHolomorphic.const Complex.I).mul (chartZ₀_regular b) + · exact chartZ₁_regular b +lemma h₂_regular (b : Bool) (i : Fin 3) : JointHolomorphic (fun q : X × ℂ => h₂ (chartZ₀ b q.2) (chartZ₁ b q.2) i) := by + fin_cases i + · simpa [h₂] using (JointHolomorphic.const (-1)).mul (chartZ₁_regular b) + · exact (JointHolomorphic.const Complex.I).mul (chartZ₁_regular b) + · exact chartZ₀_regular b +lemma direction_regular (b : Bool) (f : Smooth) : + JointHolomorphic (fun q : X × ℂ => (direction (A := Smooth) coord (chartTheta b q.2) f : X → ℂ) q.1) := by + have hh := JointHolomorphic.sum (fun i => (chartTheta_regular b i).mul (JointHolomorphic.fixed (coord i f))) + simpa only [direction,smooth_sum_eval,Subalgebra.coe_smul,Pi.smul_apply,smul_eq_mul] using hh +lemma thetaGamma_regular (b : Bool) (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) : + JointHolomorphic (fun q : X × ℂ => (thetaGamma (chartTheta b q.2) r hr : X → ℂ) q.1) := by + have hh := JointHolomorphic.sum (fun i => (chartTheta_regular b i).mul (JointHolomorphic.fixed (logarithmicGrad r hr i))) + simpa only [thetaGamma,smooth_sum_eval,Subalgebra.coe_smul,Pi.smul_apply,smul_eq_mul] using hh +lemma transportT_regular (b : Bool) (k r : Smooth) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + JointHolomorphic (fun q : X × ℂ => (transportT (chartTheta b q.2) k r hk hl : X → ℂ) q.1) := + ((JointHolomorphic.fixed (smoothInv k hk)).mul (direction_regular b k)).sub + ((JointHolomorphic.fixed (smoothInv (k+r*r) hl)).mul (direction_regular b (k+r*r))) +lemma transportQ_regular (b : Bool) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (i : Fin 3) : + JointHolomorphic (fun q : X × ℂ => (transportQ (chartTheta b q.2) k r hr hk hl i : X → ℂ) q.1) := + (JointHolomorphic.const (1/2)).mul + ((((JointHolomorphic.fixed (r*r*smoothInv (k+r*r) hl*smoothInv k hk)).mul (direction_regular b k)).sub + ((JointHolomorphic.const (1/2)).mul (thetaGamma_regular b r hr))).mul + (JointHolomorphic.fixed (logarithmicGrad r hr i)) |>.sub + ((JointHolomorphic.fixed (r*r*smoothInv (k+r*r) hl)).mul (direction_regular b (logarithmicGrad r hr i)))) + +/-- These are the literal chart coefficients, jointly smooth and holomorphic +in the normalized conic direction, with the physical point fixed. -/ +lemma chartMatrix_regular (b : Bool) (T : ℂ → Smooth) (Q : ℂ → Fin 3 → Smooth) + (hT : JointHolomorphic (fun q : X × ℂ => (T q.2 : X → ℂ) q.1)) + (hQ : ∀ i,JointHolomorphic (fun q : X × ℂ => (Q q.2 i : X → ℂ) q.1)) (i j : Fin 3) : + JointHolomorphic (fun q : X × ℂ => (chartMatrix b q.2 (T q.2) (Q q.2) i j : X → ℂ) q.1) := by + fin_cases i <;> fin_cases j + all_goals try first | exact JointHolomorphic.const 0 | exact hT + · simpa [chartMatrix,smooth_sum_eval] using chartZ₀_regular b + · simpa [chartMatrix,smooth_sum_eval] using chartZ₁_regular b + · have hh := JointHolomorphic.sum (fun k => (h₁_regular b k).mul (hQ k)) + simpa [chartMatrix,smooth_sum_eval] using hh + · have hh := JointHolomorphic.sum (fun k => (h₂_regular b k).mul (hQ k)) + simpa [chartMatrix,smooth_sum_eval] using hh +end ElasticityConic + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +variable {n : Type*} [Fintype n] [DecidableEq n] + +/-- Both regularity statements are derived for a separately constructed family +from its transport equation and ONE fixed spatial support. -/ +theorem supported_matrix_holomorphic (θ : Fin 3 → ℂ → ℂ) + (hθs : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (θ i)) (hθh : ∀ i,Differentiable ℂ (θ i)) + (hnull : ∀ z,∑ i,θ i z*θ i z=0) (hne : ∀ z,(fun i => θ i z)≠0) + (M₀ M₁ G : ℂ → Matrix n n Smooth) + (hM₀ : ∀ i j,ElasticityConic.JointHolomorphic (fun q : X × ℂ => (M₀ q.2 i j : X → ℂ) q.1)) + (hM₁ : ∀ i j,ElasticityConic.JointHolomorphic (fun q : X × ℂ => (M₁ q.2 i j : X → ℂ) q.1)) + {S : Set X} (hS : IsCompact S) (χ : Smooth) (hχ : HasCompactSupport (χ : X → ℂ)) + (hχ1 : ∀ x∈S,(χ : X → ℂ) x=1) + (hs : ∀ z i j,tsupport ((G z i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆S) + (hMe : ∀ z x,x∉S → matrixEval x (M₀ z)=matrixEval x (M₁ z)) + (he : ∀ z,matrixD (fun i => θ i z) (G z)=M₁ z*G z-G z*M₀ z) : + ∀ i j,ElasticityConic.JointHolomorphic (fun q : X × ℂ => (G q.2 i j : X → ℂ) q.1) := by + have hgs := supported_matrix_smooth θ hθs hnull hne M₀ M₁ G + (fun i j => (hM₀ i j).smooth) (fun i j => (hM₁ i j).smooth) hS χ hχ hχ1 hs hMe he + let Θ : Fin 3 → ElasticityParameter.Smooth (X × ℂ) := fun i => ⟨fun q => θ i q.2,(hθs i).comp contDiff_snd⟩ + let A : n → n → ElasticityParameter.Smooth (X × ℂ) := fun i j => ⟨fun q => (M₁ q.2 i j : X → ℂ) q.1,(hM₁ i j).smooth⟩ + let B : n → n → ElasticityParameter.Smooth (X × ℂ) := fun i j => ⟨fun q => (M₀ q.2 i j : X → ℂ) q.1,(hM₀ i j).smooth⟩ + let F : n → n → ElasticityParameter.Smooth (X × ℂ) := fun i j => ⟨fun q => (G q.2 i j : X → ℂ) q.1,hgs i j⟩ + have hh := ElasticityParameter.matrix_holomorphic_of_supported_comparison Θ + (fun _ _ _ => rfl) (fun i _ => hθh i) hnull hne A B F + (fun i j => (hM₁ i j).holo) (fun i j => (hM₀ i j).holo) (fun i j => ?_) hS (fun i j x hx z => ?_) + · exact fun i j => ⟨hgs i j,hh i j⟩ + · apply Subtype.ext + funext q + rcases q with ⟨x,z⟩ + simp only [AddSubmonoidClass.coe_finsetSum,Finset.sum_apply,Subalgebra.coe_mul, + Subalgebra.coe_sub,Pi.sub_apply,Pi.mul_apply,ElasticityParameter.delta_apply] + change (∑ r, θ r z * fderiv ℝ (F i j : X × ℂ → ℂ) (x,z) (ElasticityParameter.basis r,0))= + ∑ a, ((M₁ z i a : X → ℂ) x*(G z a j : X → ℂ) x- + (G z i a : X → ℂ) x*(M₀ z a j : X → ℂ) x) + simp_rw [← ElasticityParameter.spatial_slice_deriv] + have hh := congrArg (fun C : Matrix n n Smooth => matrixEval x C i j) (he z) + rw [matrixD_eval] at hh + simpa only [F,map_sub,map_mul,Matrix.sub_apply,Matrix.mul_apply,matrixEval_apply,smooth_sum_eval,Subalgebra.coe_sub,Subalgebra.coe_mul,Pi.sub_apply,Pi.mul_apply,Finset.sum_sub_distrib] using hh + · have h := congrArg (fun C : Matrix n n ℂ => C i j) (supported_matrix_eq_one (G z) (hs z) x hx) + exact h +end ElasticityAugmented + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Homotopy.lean b/lean/OAI/MathematicalPhysics/Elasticity/Homotopy.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9855c35d3b7c8940b35809f0e9723adc29d8a85 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Homotopy.lean @@ -0,0 +1,376 @@ +import OAI.MathematicalPhysics.Elasticity.Parameters +import OAI.MathematicalPhysics.Elasticity.ODE + +namespace OAI + +section +noncomputable section +open Set +namespace ElasticityODE +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] +def frameDbar (b : ℂ → C(Time,R)) (p : ℂ) : C(Time,R) := + fderiv ℝ (fun p => fundamental (b p)) p 1+ + Complex.I • fderiv ℝ (fun p => fundamental (b p)) p Complex.I +def coefficientDbar (b : ℂ → C(Time,R)) (p : ℂ) : C(Time,R) := + fderiv ℝ b p 1+Complex.I • fderiv ℝ b p Complex.I +lemma frameDbar_hasDerivWithinAt (b : ℂ → C(Time,R)) + (hb : ContDiff ℝ (⊤ : ℕ∞) b) (p : ℂ) (t : Time) : + HasDerivWithinAt (extend (frameDbar b p)) + (b p t*frameDbar b p t+coefficientDbar b p t*fundamental (b p) t) Time t := by + have h1 := fundamental_variation_hasDerivWithinAt b hb p 1 t + have hi := (fundamental_variation_hasDerivWithinAt b hb p Complex.I t).const_smul Complex.I + have h := h1.add hi + have he : + b p t*fderiv ℝ (fun p => fundamental (b p)) p 1 t+fderiv ℝ b p 1 t*fundamental (b p) t+ + Complex.I • (b p t*fderiv ℝ (fun p => fundamental (b p)) p Complex.I t+ + fderiv ℝ b p Complex.I t*fundamental (b p) t)= + b p t*frameDbar b p t+coefficientDbar b p t*fundamental (b p) t := by + simp only [frameDbar,coefficientDbar,ContinuousMap.add_apply,ContinuousMap.smul_apply, + smul_add,mul_add,add_mul,mul_smul_comm,smul_mul_assoc] + abel + rw [he] at h + exact h.congr_of_mem (fun x hx => by + change extend (frameDbar b p) (⟨x,hx⟩ : Time)=_ + rw [extend_apply] + change _=extend (fderiv ℝ (fun p => fundamental (b p)) p 1) (⟨x,hx⟩ : Time)+ + Complex.I • extend (fderiv ℝ (fun p => fundamental (b p)) p Complex.I) (⟨x,hx⟩ : Time) + rw [extend_apply,extend_apply] + rfl) t.property +lemma frameDbar_initial (b : ℂ → C(Time,R)) (hb : ContDiff ℝ (⊤ : ℕ∞) b) (p : ℂ) : + frameDbar b p ⟨0,by simp [Time]⟩=0 := by + simp only [frameDbar,ContinuousMap.add_apply,ContinuousMap.smul_apply, + fundamental_variation_initial b hb,smul_zero,add_zero] + +/-- The homotopy defect vanishes. This derives the planar frame equation from +an actual coefficient homotopy, instead of assuming an Oka trivialization. -/ +theorem fundamental_transport (b : ℂ → C(Time,R)) + (hb : ContDiff ℝ (⊤ : ℕ∞) b) (p : ℂ) (A : R) + (he : ∀ t : Time, coefficientDbar b p t=A+(t:ℝ) • (A*b p t-b p t*A)) (t : Time) : + frameDbar b p t=(t:ℝ) • (A*fundamental (b p) t) := by + let u : C(Time,R) := frameDbar b p- + ⟨fun s => (s:ℝ) • (A*fundamental (b p) s), + continuous_subtype_val.smul (continuous_const.mul (fundamental (b p)).continuous)⟩ + let v : C(Time,R) := 0 + have hu (s : Time) : HasDerivWithinAt (extend u) (b p s*u s) Time s := by + have hU := (fundamental_deriv (b p) s).const_mul A + have hs : HasDerivWithinAt (fun x : ℝ => x) 1 Time s := (hasDerivAt_id (s:ℝ)).hasDerivWithinAt + have hT := hs.smul hU + have hD := (frameDbar_hasDerivWithinAt b hb p s).sub hT + have ha : b p s*frameDbar b p s+coefficientDbar b p s*fundamental (b p) s- + ((s:ℝ) • (A*(b p s*fundamental (b p) s))+(1:ℝ) • (A*extend (fundamental (b p)) s))= + b p s*u s := by + rw [he,extend_apply] + change _=b p s*(frameDbar b p s-(s:ℝ) • (A*fundamental (b p) s)) + simp only [one_smul,add_mul,smul_mul_assoc,sub_mul,smul_sub,mul_sub,mul_smul_comm,mul_assoc] + abel + rw [ha] at hD + exact hD.congr_of_mem (fun x hx => by + change extend u (⟨x,hx⟩ : Time)=_ + rw [extend_apply] + change frameDbar b p ⟨x,hx⟩-x • (A*fundamental (b p) ⟨x,hx⟩)=_ + rw [← extend_apply (frameDbar b p) ⟨x,hx⟩, + ← extend_apply (fundamental (b p)) ⟨x,hx⟩] + rfl) s.property + have hv (s : Time) : HasDerivWithinAt (extend v) (b p s*v s) Time s := by + have hh : HasDerivWithinAt (fun _ : ℝ => (0:R)) 0 Time s := hasDerivWithinAt_const _ _ _ + have hz : b p s*v s=0 := mul_zero _ + rw [hz] + exact hh.congr_of_mem (fun x hx => by + change extend v (⟨x,hx⟩ : Time)=0 + rw [extend_apply]; rfl) s.property + have hzero : u ⟨0,by simp [Time]⟩=v ⟨0,by simp [Time]⟩ := by + change frameDbar b p ⟨0,by simp [Time]⟩-(0:ℝ) • _=0 + rw [frameDbar_initial b hb,zero_smul,sub_zero] + have h := congrArg (fun f : C(Time,R) => f t) + (linear_ode_unique (leftCoeff (b p)) u v hu hv hzero) + exact sub_eq_zero.mp h +end ElasticityODE + +end +end +section +noncomputable section +open Set Complex Module +open scoped SchwartzMap LineDeriv BigOperators +namespace ElasticityPlanar +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] + [FiniteDimensional ℂ R] +variable {n : Type*} [Fintype n] [DecidableEq n] +def coords (q : Basis n ℂ R) : R ≃L[ℂ] (n → ℂ) := q.equivFun.toContinuousLinearEquiv +def coord (q : Basis n ℂ R) (i : n) : R →L[ℂ] ℂ := + (ContinuousLinearMap.proj i).comp (coords q).toContinuousLinearMap +omit [CompleteSpace R] [DecidableEq n] in +lemma coords_coord (q : Basis n ℂ R) (x : R) (i : n) : coords q x i=coord q i x := rfl +omit [CompleteSpace R] [DecidableEq n] in +lemma coord_linear_apply (q : Basis n ℂ R) (L : R →ₗ[ℂ] R) (x : R) (i : n) : + coord q i (L x)=∑ j, coord q i (L (q j))*coord q j x := by + have h : L x=∑ j, (q.equivFun x j) • L (q j) := by + calc + L x=L (∑ j, q.equivFun x j • q j) := congrArg L (q.sum_equivFun x).symm + _=∑ j, q.equivFun x j • L (q j) := by simp only [map_sum,map_smul] + rw [h,map_sum] + apply Finset.sum_congr rfl + intro j _ + rw [map_smul,smul_eq_mul,mul_comm] + rfl + +def classicalDbar (f : ℂ → R) (z : ℂ) : R := fderiv ℝ f z 1+I • fderiv ℝ f z I +omit [CompleteSpace R] [DecidableEq n] in +lemma coord_dbar (q : Basis n ℂ R) (f : ℂ → R) (hf : Differentiable ℝ f) (z : ℂ) (i : n) : + coord q i (classicalDbar f z)= + fderiv ℝ (fun z => coord q i (f z)) z 1+I*fderiv ℝ (fun z => coord q i (f z)) z I := by + have h := ((coord q i).restrictScalars ℝ).hasFDerivAt.comp z (hf z).hasFDerivAt + change HasFDerivAt (fun z => coord q i (f z)) _ z at h + rw [h.fderiv] + simp only [classicalDbar,map_add,map_smul,ContinuousLinearMap.comp_apply, + smul_eq_mul] + rfl + +omit [CompleteSpace R] [DecidableEq n] in +/-- The commutator homotopy equation in a genuine finite-dimensional complex +Banach algebra, with actual joint smooth representatives. -/ +theorem exists_algebra_homotopy {S Ω Ω' : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (q : Basis n ℂ R) (A : ℂ → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + (hAc : HasCompactSupport A) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ B : ℝ × ℂ → R, ContDiff ℝ (⊤ : ℕ∞) B ∧ + ∀ s z, z∈Ω' → classicalDbar (fun z => B (s,z)) z= + A z+s • (A z*B (s,z)-B (s,z)*A z) := by + let a : n → n → ℂ → ℂ := fun i j z => coord q i (q j*A z-A z*q j) + have ha (i j : n) : ContDiff ℝ (⊤ : ℕ∞) (a i j) := + ((coord q i).restrictScalars ℝ).contDiff.comp + ((contDiff_const.mul hA).sub (hA.mul contDiff_const)) + have hac (i j : n) : HasCompactSupport (a i j) := + ((hAc.mul_left.sub hAc.mul_right).comp_left (g := coord q i) (map_zero _)) + have hf (i : n) : ContDiff ℝ (⊤ : ℕ∞) (fun z => coord q i (A z)) := + ((coord q i).restrictScalars ℝ).contDiff.comp hA + have hfc (i : n) : HasCompactSupport (fun z => coord q i (A z)) := + hAc.comp_left (g := coord q i) (map_zero _) + let f : n → 𝓢(ℂ,ℂ) := fun i => (hfc i).toSchwartzMap (hf i) + obtain ⟨v,hv,he⟩ := exists_classical_homotopy hS hΩS hΩ' hsub a ha hac f hg hc hs h1 + let B : ℝ × ℂ → R := fun p => (coords q).symm (fun i => v p.1 i p.2) + have hL : ContDiff ℝ (⊤ : ℕ∞) (coords q).symm := by + let L : (n → ℂ) →L[ℝ] R := (coords q).symm.toContinuousLinearMap.restrictScalars ℝ + exact ContinuousLinearMap.contDiff (𝕜 := ℝ) (E := n → ℂ) (F := R) L + have hB : ContDiff ℝ (⊤ : ℕ∞) B := hL.comp (contDiff_pi.mpr hv) + have hev (s : ℝ) (i : n) : (fun z => coord q i (B (s,z)))=fun z => v s i z := by + funext z + change (coords q) ((coords q).symm (fun i => v s i z)) i=v s i z + rw [ContinuousLinearEquiv.apply_symm_apply] + refine ⟨B,hB,fun s z hz => ?_⟩ + apply (coords q).injective + ext i + change coord q i (classicalDbar (fun z => B (s,z)) z)= + coord q i (A z+s • (A z*B (s,z)-B (s,z)*A z)) + have hBs : Differentiable ℝ (fun z => B (s,z)) := + (hB.comp (contDiff_const.prodMk contDiff_id)).differentiable (by simp) + have hD := coord_dbar q (fun z => B (s,z)) hBs z i + rw [hev] at hD + have he' := he s i hz + simp only [schwartzDbar,add_apply,smul_apply,SchwartzMap.lineDerivOp_apply_eq_fderiv,smul_eq_mul] at he' + rw [← hD] at he' + have hcomm : coord q i (B (s,z)*A z-A z*B (s,z))=∑ j, a i j z*v s j z := by + let L : R →ₗ[ℂ] R := ((ContinuousLinearMap.mul ℂ R).flip (A z)- + ContinuousLinearMap.mul ℂ R (A z)).toLinearMap + have hh := coord_linear_apply q L (B (s,z)) i + change coord q i (B (s,z)*A z-A z*B (s,z))= + ∑ j, a i j z*coord q j (B (s,z)) at hh + simpa only [congrFun (hev s _) z] using hh + have hs' : coord q i (A z+s • (A z*B (s,z)-B (s,z)*A z))= + coord q i (A z)-(s:ℂ)*(∑ j, a i j z*v s j z) := by + rw [map_add] + have hneg : A z*B (s,z)-B (s,z)*A z=-(B (s,z)*A z-A z*B (s,z)) := by abel + rw [hneg] + have hl := ((coord q i).restrictScalars ℝ).map_smul s (-(B (s,z)*A z-A z*B (s,z))) + change coord q i (s • (-(B (s,z)*A z-A z*B (s,z))))=s • coord q i (-(B (s,z)*A z-A z*B (s,z))) at hl + rw [hl,map_neg,hcomm] + simp [Complex.real_smul,sub_eq_add_neg] + rw [hs'] + change _+∑ j, (s:ℂ)*a i j z*v s j z=coord q i (A z) at he' + rw [Finset.mul_sum] + simp_rw [mul_assoc] at he' ⊢ + linear_combination he' +end ElasticityPlanar + +end +end +section +noncomputable section +open Set Complex Module +open scoped SchwartzMap LineDeriv BigOperators +namespace ElasticityPlanar +open ElasticityRegularity +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] + [FiniteDimensional ℂ R] +variable {n : Type*} [Fintype n] [DecidableEq n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +omit [CompleteSpace R] [DecidableEq n] in +/-- The commutator homotopy equation in a genuine finite-dimensional complex +Banach algebra, with actual joint smooth representatives. -/ +theorem exists_algebra_variable_homotopy {S Ω Ω' K : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (hK : IsCompact K) (q : Basis n ℂ R) (A : P × ℂ → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + (hAc : ∀ p z, z∉K → A (p,z)=0) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ B : (ℝ × P) × ℂ → R, ContDiff ℝ (⊤ : ℕ∞) B ∧ + ∀ s p z, z∈Ω' → classicalDbar (fun z => B ((s,p),z)) z= + A (p,z)+s • (A (p,z)*B ((s,p),z)-B ((s,p),z)*A (p,z)) := by + let A' : (ℝ × P) × ℂ → R := fun q => A (q.1.2,q.2) + have hA' : ContDiff ℝ (⊤ : ℕ∞) A' := + hA.comp ((contDiff_snd.comp contDiff_fst).prodMk contDiff_snd) + let a : n → n → (ℝ × P) × ℂ → ℂ := fun i j w => + (w.1.1 : ℂ)*coord q i (q j*A' w-A' w*q j) + have ha (i j : n) : ContDiff ℝ (⊤ : ℕ∞) (a i j) := + (Complex.ofRealCLM.contDiff.comp (contDiff_fst.comp contDiff_fst)).mul + (((coord q i).restrictScalars ℝ).contDiff.comp + ((contDiff_const.mul hA').sub (hA'.mul contDiff_const))) + have hac (i j : n) (w : ℝ × P) (z : ℂ) (hz : z∉K) : a i j (w,z)=0 := by + simp only [a,A',hAc w.2 z hz,mul_zero,zero_mul,sub_self,map_zero] + let f : n → (ℝ × P) × ℂ → ℂ := fun i w => coord q i (A' w) + have hf (i : n) : ContDiff ℝ (⊤ : ℕ∞) (f i) := + ((coord q i).restrictScalars ℝ).contDiff.comp hA' + have hfc (i : n) (w : ℝ × P) (z : ℂ) (hz : z∉K) : f i (w,z)=0 := by + simp only [f,A',hAc w.2 z hz,map_zero] + obtain ⟨v,hv,he⟩ := exists_classical_variable hS hΩS hΩ' hsub hK a ha hac f hf hfc hg hc hs h1 + let B : (ℝ × P) × ℂ → R := fun p => (coords q).symm (fun i => v p.1 i p.2) + have hL : ContDiff ℝ (⊤ : ℕ∞) (coords q).symm := by + let L : (n → ℂ) →L[ℝ] R := (coords q).symm.toContinuousLinearMap.restrictScalars ℝ + exact ContinuousLinearMap.contDiff (𝕜 := ℝ) (E := n → ℂ) (F := R) L + have hB : ContDiff ℝ (⊤ : ℕ∞) B := hL.comp (contDiff_pi.mpr hv) + have hev (w : ℝ × P) (i : n) : (fun z => coord q i (B (w,z)))=fun z => v w i z := by + funext z + change (coords q) ((coords q).symm (fun i => v w i z)) i=v w i z + rw [ContinuousLinearEquiv.apply_symm_apply] + refine ⟨B,hB,fun s p z hz => ?_⟩ + apply (coords q).injective + ext i + change coord q i (classicalDbar (fun z => B ((s,p),z)) z)= + coord q i (A (p,z)+s • (A (p,z)*B ((s,p),z)-B ((s,p),z)*A (p,z))) + have hBs : Differentiable ℝ (fun z => B ((s,p),z)) := + (hB.comp (contDiff_const.prodMk contDiff_id)).differentiable (by simp) + have hD := coord_dbar q (fun z => B ((s,p),z)) hBs z i + rw [hev] at hD + have he' := he (s,p) i hz + change schwartzDbar (v (s,p) i) z+∑ j, (s:ℂ)*coord q i (q j*A (p,z)-A (p,z)*q j)*v (s,p) j z=coord q i (A (p,z)) at he' + simp only [schwartzDbar,add_apply,smul_apply,SchwartzMap.lineDerivOp_apply_eq_fderiv,smul_eq_mul] at he' + rw [← hD] at he' + have hcomm : coord q i (B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z))=∑ j, coord q i (q j*A (p,z)-A (p,z)*q j)*v (s,p) j z := by + let L : R →ₗ[ℂ] R := ((ContinuousLinearMap.mul ℂ R).flip (A (p,z))- + ContinuousLinearMap.mul ℂ R (A (p,z))).toLinearMap + have hh := coord_linear_apply q L (B ((s,p),z)) i + change coord q i (B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z))= + ∑ j, coord q i (q j*A (p,z)-A (p,z)*q j)*coord q j (B ((s,p),z)) at hh + simpa only [congrFun (hev (s,p) _) z] using hh + have hs' : coord q i (A (p,z)+s • (A (p,z)*B ((s,p),z)-B ((s,p),z)*A (p,z)))= + coord q i (A (p,z))-(s:ℂ)*(∑ j, coord q i (q j*A (p,z)-A (p,z)*q j)*v (s,p) j z) := by + rw [map_add] + have hneg : A (p,z)*B ((s,p),z)-B ((s,p),z)*A (p,z)=-(B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z)) := by abel + rw [hneg] + have hl := ((coord q i).restrictScalars ℝ).map_smul s (-(B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z))) + change coord q i (s • (-(B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z))))=s • coord q i (-(B ((s,p),z)*A (p,z)-A (p,z)*B ((s,p),z))) at hl + rw [hl,map_neg,hcomm] + simp [Complex.real_smul,sub_eq_add_neg] + rw [hs'] + change _+∑ j, (s:ℂ)*coord q i (q j*A (p,z)-A (p,z)*q j)*v (s,p) j z=coord q i (A (p,z)) at he' + rw [Finset.mul_sum] + simp_rw [mul_assoc] at he' ⊢ + linear_combination he' +end ElasticityPlanar + +end +end +section +noncomputable section +open Set Complex Module +namespace ElasticityPlanar +open ElasticityODE ElasticityCompact +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] +omit [CompleteSpace R] in +lemma dbar_evaluation (b : ℂ → C(Time,R)) (hb : Differentiable ℝ b) (z : ℂ) (t : Time) : + classicalDbar (fun z => b z t) z=coefficientDbar b z t := by + have h := (ContinuousMap.evalCLM ℝ t : C(Time,R) →L[ℝ] R).hasFDerivAt.comp z (hb z).hasFDerivAt + change HasFDerivAt (fun z => b z t) _ z at h + rw [classicalDbar,h.fderiv] + rfl +lemma dbar_fundamental (b : ℂ → C(Time,R)) (hb : ContDiff ℝ (⊤ : ℕ∞) b) (z : ℂ) (t : Time) : + classicalDbar (fun z => fundamental (b z) t) z=frameDbar b z t := + dbar_evaluation (fun z => fundamental (b z)) + ((fundamental_contDiff b hb).differentiable (by simp)) z t +variable [FiniteDimensional ℂ R] {n : Type*} [Fintype n] [DecidableEq n] +omit [DecidableEq n] in +/-- A global smooth invertible planar frame on the prescribed inner domain. +It is built from the proved planar solver and coefficient homotopy flow. -/ +theorem exists_planar_frame {S Ω Ω' : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (q : Basis n ℂ R) (A : ℂ → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + (hAc : HasCompactSupport A) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ V : ℂ → R, ContDiff ℝ (⊤ : ℕ∞) V ∧ (∀ z, IsUnit (V z)) ∧ + ∀ z∈Ω', classicalDbar V z=A z*V z := by + obtain ⟨B,hB,he⟩ := exists_algebra_homotopy hS hΩS hΩ' hsub q A hA hAc hg hc hs h1 + let f : ℂ × ℝ → R := fun p => B (p.2,p.1) + have hf : ContDiff ℝ (⊤ : ℕ∞) f := hB.comp (contDiff_snd.prodMk contDiff_fst) + let b : ℂ → C(Time,R) := curryCompact f hf.continuous (fun t : Time => (t:ℝ)) continuous_subtype_val + have hb : ContDiff ℝ (⊤ : ℕ∞) b := curryCompact_contDiff f hf _ continuous_subtype_val + let t : Time := ⟨1,by simp [Time]⟩ + let V : ℂ → R := fun z => fundamental (b z) t + have hV : ContDiff ℝ (⊤ : ℕ∞) V := by + have hL : ContDiff ℝ (⊤ : ℕ∞) (ContinuousMap.evalCLM ℝ t : C(Time,R) →L[ℝ] R) := + ContinuousLinearMap.contDiff (E := C(Time,R)) (F := R) _ + exact hL.comp (fundamental_contDiff b hb) + refine ⟨V,hV,fun z => fundamental_isUnit (b z) t,fun z hz => ?_⟩ + have hcoeff (s : Time) : coefficientDbar b z s=A z+(s:ℝ) • (A z*b z s-b z s*A z) := by + rw [← dbar_evaluation b (hb.differentiable (by simp)) z s] + exact he (s:ℝ) z hz + have ht := fundamental_transport b hb z (A z) hcoeff t + rw [← dbar_fundamental b hb] at ht + simpa only [t,one_smul] using ht +end ElasticityPlanar + +end +end +section +noncomputable section +open Set Complex Module +namespace ElasticityPlanar +open ElasticityODE ElasticityCompact +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] + [FiniteDimensional ℂ R] {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +/-- A genuine jointly smooth global planar frame with arbitrary transverse +parameters. Invertibility holds everywhere, not only at a chosen base point. -/ +theorem exists_variable_planar_frame {S Ω Ω' K : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (hK : IsCompact K) (q : Basis n ℂ R) (A : P × ℂ → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + (hAc : ∀ p z, z∉K → A (p,z)=0) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ V : P × ℂ → R, ContDiff ℝ (⊤ : ℕ∞) V ∧ (∀ w, IsUnit (V w)) ∧ + ∀ p z, z∈Ω' → classicalDbar (fun z => V (p,z)) z=A (p,z)*V (p,z) := by + obtain ⟨B,hB,he⟩ := exists_algebra_variable_homotopy hS hΩS hΩ' hsub hK q A hA hAc hg hc hs h1 + let f : (P × ℂ) × ℝ → R := fun w => B ((w.2,w.1.1),w.1.2) + have hf : ContDiff ℝ (⊤ : ℕ∞) f := hB.comp + ((contDiff_snd.prodMk (contDiff_fst.comp contDiff_fst)).prodMk (contDiff_snd.comp contDiff_fst)) + let b : P × ℂ → C(Time,R) := curryCompact f hf.continuous (fun t : Time => (t:ℝ)) continuous_subtype_val + have hb : ContDiff ℝ (⊤ : ℕ∞) b := curryCompact_contDiff f hf _ continuous_subtype_val + let t : Time := ⟨1,by simp [Time]⟩ + let V : P × ℂ → R := fun w => fundamental (b w) t + have hV : ContDiff ℝ (⊤ : ℕ∞) V := by + have hL : ContDiff ℝ (⊤ : ℕ∞) (ContinuousMap.evalCLM ℝ t : C(Time,R) →L[ℝ] R) := + ContinuousLinearMap.contDiff (E := C(Time,R)) (F := R) _ + exact hL.comp (fundamental_contDiff b hb) + refine ⟨V,hV,fun w => fundamental_isUnit (b w) t,fun p z hz => ?_⟩ + let bp : ℂ → C(Time,R) := fun z => b (p,z) + have hbp : ContDiff ℝ (⊤ : ℕ∞) bp := hb.comp (contDiff_const.prodMk contDiff_id) + have hcoeff (s : Time) : coefficientDbar bp z s=A (p,z)+(s:ℝ) • (A (p,z)*bp z s-bp z s*A (p,z)) := by + rw [← dbar_evaluation bp (hbp.differentiable (by simp)) z s] + exact he (s:ℝ) p z hz + have ht := fundamental_transport bp hbp z (A (p,z)) hcoeff t + rw [← dbar_fundamental bp hbp] at ht + simpa only [t,one_smul] using ht +end ElasticityPlanar + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/LocalRegularity.lean b/lean/OAI/MathematicalPhysics/Elasticity/LocalRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..11a9747758a1ea678348828ac3c4335f4c380889 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/LocalRegularity.lean @@ -0,0 +1,326 @@ +import OAI.MathematicalPhysics.Elasticity.Solvability + +namespace OAI + +noncomputable section + +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal +namespace ElasticityRegularity + + +section +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +def LocalEqual (Ω : Set E) (u v : 𝓢'(E,ℂ)) : Prop := + ∀ φ : 𝓢(E,ℂ), HasCompactSupport (φ : E → ℂ) → tsupport (φ : E → ℂ) ⊆ Ω → u φ=v φ +namespace LocalEqual +variable {Ω : Set E} {u v w u' v' : 𝓢'(E,ℂ)} +lemma refl (u : 𝓢'(E,ℂ)) : LocalEqual Ω u u := fun _ _ _ => rfl +lemma symm (h : LocalEqual Ω u v) : LocalEqual Ω v u := fun φ hc hs => (h φ hc hs).symm +lemma trans (h : LocalEqual Ω u v) (h' : LocalEqual Ω v w) : LocalEqual Ω u w := + fun φ hc hs => (h φ hc hs).trans (h' φ hc hs) +lemma add (h : LocalEqual Ω u v) (h' : LocalEqual Ω u' v') : LocalEqual Ω (u+u') (v+v') := by + intro φ hc hs + simp only [add_apply,h φ hc hs,h' φ hc hs] +lemma sub (h : LocalEqual Ω u v) (h' : LocalEqual Ω u' v') : LocalEqual Ω (u-u') (v-v') := by + intro φ hc hs + simp only [sub_apply,h φ hc hs,h' φ hc hs] +lemma smul (h : LocalEqual Ω u v) (c : ℂ) : LocalEqual Ω (c • u) (c • v) := by + intro φ hc hs + simp only [smul_apply,h φ hc hs] +lemma sum {ι : Type*} (S : Finset ι) {u v : ι → 𝓢'(E,ℂ)} + (h : ∀ i ∈ S, LocalEqual Ω (u i) (v i)) : LocalEqual Ω (∑ i ∈ S, u i) (∑ i ∈ S, v i) := by + intro φ hc hs + simp only [sum_apply] + exact Finset.sum_congr rfl (fun i hi => h i hi φ hc hs) +lemma derivative (h : LocalEqual Ω u v) (a : E) : LocalEqual Ω (∂_{a} u) (∂_{a} v) := by + intro φ hc hs + change u (- ∂_{a} φ) = v (- ∂_{a} φ) + apply h + · change HasCompactSupport (fun x => -((∂_{a} φ : 𝓢(E,ℂ)) x)) + exact (hc.fderiv_apply (𝕜 := ℝ) a).neg + · change tsupport (-((∂_{a} φ : 𝓢(E,ℂ)) : E → ℂ)) ⊆ Ω + rw [tsupport_neg] + exact (derivative_support_subset (φ : E → ℂ) a).trans hs +lemma cutoff (h : LocalEqual Ω u v) {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) : + smulLeftCLM ℂ g u = smulLeftCLM ℂ g v := by + ext φ + change u (SchwartzMap.smulLeftCLM ℂ g φ) = v (SchwartzMap.smulLeftCLM ℂ g φ) + apply h + · simpa only [SchwartzMap.smulLeftCLM_apply (hc.hasTemperateGrowth hg),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (hc.mul_right : HasCompactSupport (g * (φ : E → ℂ))) + · simpa only [SchwartzMap.smulLeftCLM_apply (hc.hasTemperateGrowth hg),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (tsupport_mul_subset_left (f := g) (g := (φ : E → ℂ))).trans hs +variable [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +lemma localSobolev {s : ℝ} (h : LocalEqual Ω u v) (hv : LocalSobolev Ω s v) : LocalSobolev Ω s u := by + intro g hg hc hs + rw [h.cutoff hg hc hs] + exact hv g hg hc hs +end LocalEqual +variable [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +namespace LocalSobolev +variable {Ω : Set E} {s : ℝ} {u v : 𝓢'(E,ℂ)} +lemma add (h : LocalSobolev Ω s u) (h' : LocalSobolev Ω s v) : LocalSobolev Ω s (u+v) := by + intro g hg hc hs + rw [map_add] + exact (h g hg hc hs).add (h' g hg hc hs) +lemma sub (h : LocalSobolev Ω s u) (h' : LocalSobolev Ω s v) : LocalSobolev Ω s (u-v) := by + intro g hg hc hs + rw [map_sub] + exact (h g hg hc hs).sub (h' g hg hc hs) +lemma smul (h : LocalSobolev Ω s u) (c : ℂ) : LocalSobolev Ω s (c • u) := by + intro g hg hc hs + rw [map_smul] + exact (h g hg hc hs).smul c +lemma sum {ι : Type*} (S : Finset ι) {u : ι → 𝓢'(E,ℂ)} + (h : ∀ i ∈ S, LocalSobolev Ω s (u i)) : LocalSobolev Ω s (∑ i ∈ S, u i) := by + intro g hg hc hs + rw [map_sum] + exact sobolev_sum S (fun i hi => h i hi g hg hc hs) +lemma coeff (h : LocalSobolev Ω s u) {a : E → ℂ} (ha : a.HasTemperateGrowth) : + LocalSobolev Ω s (smulLeftCLM ℂ a u) := by + intro g hg hc hs + rw [smulLeftCLM_smulLeftCLM_apply ha (hc.hasTemperateGrowth hg),mul_comm] + exact h (g*a) (hg.mul ha.1) hc.mul_right (tsupport_mul_subset_left.trans hs) +lemma derivative (h : LocalSobolev Ω s u) (a : E) : LocalSobolev Ω (s-1) (∂_{a} u) := by + intro g hg hc hs + exact h.product_derivative hg hc hs a +end LocalSobolev + +lemma local_laplacian_gain_basis {ι : Type*} [Fintype ι] (b : OrthonormalBasis ι ℝ E) + {Ω : Set E} {s : ℝ} {u : 𝓢'(E,ℂ)} (hu : LocalSobolev Ω s u) + (hΔ : LocalSobolev Ω (s-1) (Δ u)) : LocalSobolev Ω (s+1) u := by + intro g hg hgc hgs + have hb : MemSobolev (s-1) 2 (Δ (smulLeftCLM ℂ g u)) := by + rw [laplacian_product b hg hgc] + apply (hΔ g hg hgc hgs).add + apply sobolev_sum Finset.univ + intro d _ + have hgd := smooth_derivative hg (b d) + have hcd := compact_derivative hgc (b d) + have hsd := (derivative_support_subset g (b d)).trans hgs + exact ((hu _ (smooth_derivative hgd (b d)) (compact_derivative hcd (b d)) + ((derivative_support_subset _ (b d)).trans hsd)).mono (by linarith)).add + ((hu.product_derivative hgd hcd hsd (b d)).smul 2) + have h := laplacian_gain ((hu g hg hgc hgs).mono (by linarith : s-1 ≤ s)) hb + convert h using 1 + ring +end + +section + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma schwartz_dist_injective : Function.Injective (fun u : 𝓢(E,ℂ) => (u : 𝓢'(E,ℂ))) := by + intro u v h + apply SchwartzMap.injective_toLp 2 volume + apply LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := ℂ)) + change ((u.toLp 2 volume : Lp ℂ 2 (volume : Measure E)) : 𝓢'(E,ℂ)) = + ((v.toLp 2 volume : Lp ℂ 2 (volume : Measure E)) : 𝓢'(E,ℂ)) + simpa only [Lp.toTemperedDistribution_toLp_eq] using h + +lemma distribution_schwartz_product {g : E → ℂ} (hg : g.HasTemperateGrowth) (u : 𝓢(E,ℂ)) : + smulLeftCLM ℂ g (u : 𝓢'(E,ℂ)) = (SchwartzMap.smulLeftCLM ℂ g u : 𝓢'(E,ℂ)) := by + ext φ + simp only [smulLeftCLM_apply_apply,SchwartzMap.coe_apply,SchwartzMap.smulLeftCLM_apply_apply hg, + smul_eq_mul] + apply integral_congr_ae + filter_upwards [] with x + ring + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma LocalEqual.cutoff_one {Ω : Set E} (u : 𝓢'(E,ℂ)) {g : E → ℂ} + (hg : g.HasTemperateGrowth) (h1 : Set.EqOn g 1 Ω) : + LocalEqual Ω (smulLeftCLM ℂ g u) u := by + intro φ _ hs + rw [smulLeftCLM_apply_apply] + congr 1 + ext x + rw [SchwartzMap.smulLeftCLM_apply_apply hg,smul_eq_mul] + by_cases hx : φ x=0 + · simp [hx] + · rw [h1 (hs (subset_tsupport _ hx))] + simp + +lemma LocalEqual.schwartz_eqOn {Ω : Set E} (hΩ : IsOpen Ω) + {u v : 𝓢(E,ℂ)} (h : LocalEqual Ω (u : 𝓢'(E,ℂ)) (v : 𝓢'(E,ℂ))) : + Set.EqOn (u : E → ℂ) (v : E → ℂ) Ω := by + intro x hx + obtain ⟨g,hs,hc,hg,_,h1⟩ := exists_contDiff_tsupport_subset (n := (⊤ : ℕ∞)) (hΩ.mem_nhds hx) + let f : E → ℂ := fun y => (g y : ℂ) + have hfc : HasCompactSupport f := + show HasCompactSupport (Complex.ofReal ∘ g) from hc.comp_left Complex.ofReal_zero + have hfg : ContDiff ℝ (⊤ : ℕ∞) f := + (Complex.ofRealCLM.contDiff : ContDiff ℝ (⊤ : ℕ∞) Complex.ofReal).comp hg + have hfs : tsupport f ⊆ Ω := by + change closure (Function.support f) ⊆ Ω + apply Set.Subset.trans (closure_mono ?_) hs + intro y hy + change g y ≠ 0 + intro hy0 + apply hy + change (g y : ℂ)=0 + rw [hy0,Complex.ofReal_zero] + have he := h.cutoff hfg hfc hfs + rw [distribution_schwartz_product (hfc.hasTemperateGrowth hfg), + distribution_schwartz_product (hfc.hasTemperateGrowth hfg)] at he + have he' := congrArg (fun w : 𝓢(E,ℂ) => w x) (schwartz_dist_injective he) + simp only [SchwartzMap.smulLeftCLM_apply_apply (hfc.hasTemperateGrowth hfg),smul_eq_mul] at he' + have hx1 : f x=1 := by simp only [f,h1,Complex.ofReal_one] + simpa only [hx1,one_mul] using he' + +lemma smooth_Linfty_product {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (v : BoundedContinuousFunction E ℂ) + (hv : ContDiff ℝ (⊤ : ℕ∞) (v : E → ℂ)) : + let f : 𝓢(E,ℂ) := (hc.mul_right : HasCompactSupport (g*(v : E → ℂ))).toSchwartzMap (hg.mul hv) + smulLeftCLM ℂ g (((v.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E))) : 𝓢'(E,ℂ)) = (f : 𝓢'(E,ℂ)) := by + intro f + ext φ + simp only [smulLeftCLM_apply_apply,Lp.toTemperedDistribution_apply,SchwartzMap.coe_apply] + apply integral_congr_ae + filter_upwards [v.memLp_top.coeFn_toLp] with x hx + simp only [SchwartzMap.smulLeftCLM_apply_apply (hc.hasTemperateGrowth hg),hx,smul_eq_mul] + change g x*φ x*v x = φ x*(g x*v x) + ring + +/-- Interior cutoff regularity yields an actual Schwartz representative on the +smaller open set; this is what is needed to construct physical smooth CGO +solutions on a ball from an L2 weak solution on a larger ball. -/ +theorem local_schwartz_representative {Ω Ω' : Set E} (u : 𝓢'(E,ℂ)) + (hu : ∀ N : ℕ, LocalSobolev Ω N u) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : 𝓢(E,ℂ), LocalEqual Ω' u (v : 𝓢'(E,ℂ)) := by + obtain ⟨v,hv,he⟩ := all_orders_smooth_representative (fun N => hu N g hg hc hs) + let f : 𝓢(E,ℂ) := (hc.mul_right : HasCompactSupport (g*(v : E → ℂ))).toSchwartzMap (hg.mul hv) + refine ⟨f,?_⟩ + have he' := smooth_Linfty_product hg hc v hv + have hlocal := (LocalEqual.cutoff_one u (hc.hasTemperateGrowth hg) h1).symm + have hlocal' := (LocalEqual.cutoff_one (smulLeftCLM ℂ g u) (hc.hasTemperateGrowth hg) h1).symm + have h := hlocal.trans hlocal' + rw [he,he'] at h + exact h +end + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma LocalEqual.lp_ae {Ω : Set E} (hΩ : IsOpen Ω) + (u v : Lp ℂ 2 (volume : Measure E)) + (h : LocalEqual Ω (u : 𝓢'(E,ℂ)) (v : 𝓢'(E,ℂ))) : + ∀ᵐ x ∂(volume : Measure E), x ∈ Ω → u x=v x := by + have hu : LocallyIntegrable (u : E → ℂ) (volume : Measure E) := (Lp.memLp u).locallyIntegrable (by norm_num) + have hv : LocallyIntegrable (v : E → ℂ) (volume : Measure E) := (Lp.memLp v).locallyIntegrable (by norm_num) + have he : ∀ᵐ x ∂(volume : Measure E), x ∈ Ω → (u x-v x)=0 := hΩ.ae_eq_zero_of_integral_contDiff_smul_eq_zero + ((hu.sub hv).locallyIntegrableOn Ω) ?_ + · filter_upwards [he] with x hx + intro hxΩ + exact sub_eq_zero.mp (hx hxΩ) + intro g hg hc hs + let f : E → ℂ := fun x => (g x : ℂ) + have hfc : HasCompactSupport f := + show HasCompactSupport (Complex.ofReal ∘ g) from hc.comp_left Complex.ofReal_zero + have hfg : ContDiff ℝ (⊤ : ℕ∞) f := + (Complex.ofRealCLM.contDiff : ContDiff ℝ (⊤ : ℕ∞) Complex.ofReal).comp hg + let φ : 𝓢(E,ℂ) := hfc.toSchwartzMap hfg + have hfs : tsupport (φ : E → ℂ) ⊆ Ω := by + change closure (Function.support f) ⊆ Ω + apply Set.Subset.trans (closure_mono ?_) hs + intro x hx hzero + apply hx + change (g x : ℂ)=0 + rw [hzero,Complex.ofReal_zero] + have hh := h φ hfc hfs + simp only [Lp.toTemperedDistribution_apply] at hh + have hiu := hu.integrable_smul_left_of_hasCompactSupport hg.continuous hc + have hiv := hv.integrable_smul_left_of_hasCompactSupport hg.continuous hc + simp only [smul_sub] + rw [integral_sub hiu hiv,sub_eq_zero] + simp only [show (φ : E → ℂ)=f from rfl,f,Complex.real_smul,smul_eq_mul] at hh ⊢ + convert hh using 1 + +/-- The smooth local representative really is the original L2 function almost + everywhere, so the HB solution's L2 estimate is not lost in regularization. -/ +theorem local_schwartz_l2_representative {Ω Ω' : Set E} (hΩ' : IsOpen Ω') + (u : Lp ℂ 2 (volume : Measure E)) + (hu : ∀ N : ℕ, LocalSobolev Ω N (u : 𝓢'(E,ℂ))) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : 𝓢(E,ℂ), LocalEqual Ω' (u : 𝓢'(E,ℂ)) (v : 𝓢'(E,ℂ)) ∧ + ∀ᵐ x ∂(volume : Measure E), x ∈ Ω' → u x=v x := by + obtain ⟨v,hv⟩ := local_schwartz_representative (u : 𝓢'(E,ℂ)) hu hg hc hs h1 + refine ⟨v,hv,?_⟩ + have he : LocalEqual Ω' (u : 𝓢'(E,ℂ)) ((v.toLp 2 volume : Lp ℂ 2 (volume : Measure E)) : 𝓢'(E,ℂ)) := by + simpa only [Lp.toTemperedDistribution_toLp_eq] using hv + filter_upwards [LocalEqual.lp_ae hΩ' u (v.toLp 2 volume) he,v.coeFn_toLp 2 volume] with x hx hxv + intro hxΩ + exact (hx hxΩ).trans hxv +end ElasticityRegularity + +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators ENNReal +namespace ElasticityDistribution +open ElasticityAugmented ElasticityPhysicalAlgebra ElasticityNegativeOrder + +lemma coe_schwartz_add (u v : S) : ((u+v : S) : Dist)=(u : Dist)+(v : Dist) := map_add _ _ _ +lemma coe_schwartz_smul (c : ℂ) (u : S) : ((c • u : S) : Dist)=c • (u : Dist) := map_smul _ _ _ +lemma coe_schwartz_sum {ι : Type*} (s : Finset ι) (u : ι → S) : + ((∑ i ∈ s, u i : S) : Dist)=∑ i ∈ s, (u i : Dist) := map_sum _ _ _ +lemma sd_schwartz (z : Fin 3 → ℂ) (i : Fin 3) (u : S) : + sd z i (u : Dist)=(shiftD z i u : Dist) := by + rw [sd_apply,dd_apply,shiftD_apply,coe_schwartz_add,coe_schwartz_smul] + congr 1 + exact TemperedDistribution.lineDerivOp_toTemperedDistributionCLM_eq u (e i) +lemma coeff_schwartz (a : Coeff) (u : S) : a • (u : Dist)=(mult (eval a) u : Dist) := + ElasticityRegularity.distribution_schwartz_product (growth a) u +lemma divd_schwartz (z : Fin 3 → ℂ) (u : Fin 3 → S) : + divd z (fun i => (u i : Dist))=(∑ i, shiftD z i (u i) : S) := by + rw [divd,coe_schwartz_sum] + simp only [sd_schwartz] +lemma phys_schwartz (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → S) (i : Fin 3) : + phys z lam m (fun j => (u j : Dist)) i=(physical z (eval lam) (eval m) u i : Dist) := by + simp only [phys,physical,divd_schwartz,sd_schwartz,← coe_schwartz_add, + coeff_schwartz,← coe_schwartz_sum] + +lemma LocalEq.physical {Ω : Set X} {u v : Fin 3 → Dist} (h : ∀ i, LocalEq Ω (u i) (v i)) + (z : Fin 3 → ℂ) (lam m : Coeff) (i : Fin 3) : + LocalEq Ω (phys z lam m u i) (phys z lam m v i) := + (((LocalEq.divergence h z).coeff lam).shifted z i).add (LocalEq.sum Finset.univ + (fun j _ => (((h i).shifted z j).add ((h j).shifted z i) |>.coeff m).shifted z j)) + +/-- A genuinely classical physical solution on an interior open set is obtained +from the actual weak solution, and represents that same L2 unknown there. -/ +theorem classical_representative {Ω Ω' : Set X} (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (z : Fin 3 → ℂ) (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (w : ElasticityPhysicalDual.H) (F : Fin 3 → S) + (heq : ∀ i, LocalEq Ω (phys z lam m (fun j => (w j : Dist)) i) (F i : Dist)) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : Fin 3 → S, (∀ i, ∀ᵐ x ∂(volume : Measure X), x ∈ Ω' → w i x=v i x) ∧ + ∀ i, Set.EqOn (physical z (eval lam) (eval m) v i : X → ℂ) (F i : X → ℂ) Ω' := by + have hall := physical_local_all_orders z lam m n o hn ho (fun j => (w j : Dist)) + (fun j => (F j : Dist)) heq (fun j => lp_local_zero Ω (w j)) (fun N j => schwartz_local_nat Ω (F j) N) + have hv : ∀ i : Fin 3, ∃ v : S, ElasticityRegularity.LocalEqual Ω' (w i : Dist) (v : Dist) ∧ + ∀ᵐ x ∂(volume : Measure X), x ∈ Ω' → w i x=v x := by + intro i + exact ElasticityRegularity.local_schwartz_l2_representative hΩ' (w i) + (fun N => hall N i.succ) hg hc hs h1 + choose v hv he using hv + refine ⟨v,he,fun i => ?_⟩ + apply ElasticityRegularity.LocalEqual.schwartz_eqOn hΩ' + have hl : ∀ j, LocalEq Ω' (w j : Dist) (v j : Dist) := hv + have hphys := LocalEq.physical hl z lam m i + rw [phys_schwartz] at hphys + exact fun φ hφ hφs => (hphys φ hφ hφs).symm.trans (heq i φ hφ (hφs.trans hsub)) +end ElasticityDistribution + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/ODE.lean b/lean/OAI/MathematicalPhysics/Elasticity/ODE.lean new file mode 100644 index 0000000000000000000000000000000000000000..d46b0b4513dd22de6cf6c35fbf42818e569fd5ad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/ODE.lean @@ -0,0 +1,551 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +abbrev Time := Icc (0:ℝ) 1 +instance : Fact ((0:ℝ) ≤ 1) := ⟨zero_le_one⟩ +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +def extend (f : C(Time,F)) : C(ℝ,F) := ContinuousMap.IccExtendCM f +omit [NormedSpace ℝ F] [CompleteSpace F] in +lemma extend_apply (f : C(Time,F)) (t : Time) : extend f t=f t := by + exact ContinuousMap.IccExtendCM_of_mem t.property +omit [NormedSpace ℝ F] [CompleteSpace F] in +lemma extend_norm_le (f : C(Time,F)) (t : ℝ) : ‖extend f t‖ ≤ ‖f‖ := + f.norm_coe_le_norm _ + +lemma weighted_continuous (k : ℝ) (f : C(Time,F)) : + Continuous (fun t : ℝ => Real.exp (-k*t) • ∫ s in (0:ℝ)..t, Real.exp (k*s) • extend f s) := by + have hc : Continuous (fun s : ℝ => Real.exp (k*s) • extend f s) := + (Real.continuous_exp.comp (continuous_const.mul continuous_id)).smul (extend f).continuous + exact (Real.continuous_exp.comp (continuous_const.mul continuous_id)).smul + (intervalIntegral.differentiable_integral_of_continuous hc).continuous + +def weighted (k : ℝ) (f : C(Time,F)) : C(Time,F) := + ⟨fun t => Real.exp (-k*(t:ℝ)) • ∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend f s, + (weighted_continuous k f).comp continuous_subtype_val⟩ + +lemma integral_exp_mul (k t : ℝ) (hk : k ≠ 0) : + ∫ s in (0:ℝ)..t, Real.exp (k*s)=(Real.exp (k*t)-1)/k := by + have hd (s : ℝ) : HasDerivAt (fun s => Real.exp (k*s)/k) (Real.exp (k*s)) s := by + convert ((Real.hasDerivAt_exp (k*s)).comp s ((hasDerivAt_id s).const_mul k)).div_const k using 1 <;> first | rfl | simp [hk] + have h := intervalIntegral.integral_eq_sub_of_hasDerivAt (fun s _ => hd s) + ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).intervalIntegrable 0 t) + simpa only [mul_zero,Real.exp_zero,sub_div] using h + +lemma weighted_bound (k : ℝ) (hk : 0 by + rw [norm_smul,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + exact mul_le_mul_of_nonneg_left (extend_norm_le f s) (Real.exp_pos _).le) + · exact ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).mul + continuous_const).intervalIntegrable _ _ + rw [intervalIntegral.integral_mul_const,integral_exp_mul k _ hk.ne'] at hb + calc + _ ≤ Real.exp (-k*(t:ℝ))*(((Real.exp (k*(t:ℝ))-1)/k)*‖f‖) := + mul_le_mul_of_nonneg_left hb (Real.exp_pos _).le + _ = ((1-Real.exp (-k*(t:ℝ)))/k)*‖f‖ := by + have he : Real.exp (-k*(t:ℝ))*Real.exp (k*(t:ℝ))=1 := by + rw [← Real.exp_add]; ring_nf; exact Real.exp_zero + calc + _ = (Real.exp (-k*(t:ℝ))*(Real.exp (k*(t:ℝ))-1))/k*‖f‖ := by ring + _ = _ := by rw [mul_sub,he,mul_one] + _ ≤ k⁻¹*‖f‖ := by + apply mul_le_mul_of_nonneg_right _ (norm_nonneg f) + rw [inv_eq_one_div] + exact div_le_div_of_nonneg_right (by linarith [Real.exp_pos (-k*(t:ℝ))]) hk.le + +/-- The actual exponentially weighted integration operator on the time interval. +Its norm is at most 1/k; this supplies a uniform contraction for arbitrary bounded +linear ODE coefficients, without an assumed global flow theorem. -/ +def weightedCLM (k : ℝ) (hk : 0 by + ext t + change Real.exp (-k*(t:ℝ)) • (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • (extend f s+extend g s)) = + Real.exp (-k*(t:ℝ)) • (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend f s)+ + Real.exp (-k*(t:ℝ)) • (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend g s) + have hc (v : C(Time,F)) : Continuous (fun s : ℝ => Real.exp (k*s) • extend v s) := + (Real.continuous_exp.comp (continuous_const.mul continuous_id)).smul (extend v).continuous + simp_rw [smul_add] + rw [intervalIntegral.integral_add ((hc f).intervalIntegrable _ _) ((hc g).intervalIntegrable _ _),smul_add] + map_smul' := fun c f => by + ext t + change Real.exp (-k*(t:ℝ)) • (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • (c • extend f s)) = + c • (Real.exp (-k*(t:ℝ)) • (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend f s)) + simp_rw [smul_comm (Real.exp (k*_)) c] + rw [intervalIntegral.integral_smul,smul_comm] + } : C(Time,F) →ₗ[ℝ] C(Time,F)) + k⁻¹ (fun f => weighted_bound k hk f) +lemma weightedCLM_apply (k : ℝ) (hk : 0 weighted_bound k hk f) + +end ElasticityODE + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +omit [CompleteSpace F] in +def pointwise (b : C(Time,F →L[ℝ] F)) (f : C(Time,F)) : C(Time,F) := + ⟨fun t => b t (f t),b.continuous.clm_apply f.continuous⟩ +omit [CompleteSpace F] in +lemma pointwise_bound (b : C(Time,F →L[ℝ] F)) (f : C(Time,F)) : ‖pointwise b f‖ ≤ ‖b‖*‖f‖ := by + apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg b) (norm_nonneg f))).mpr + intro t + exact (b t).le_opNorm (f t) |>.trans (mul_le_mul (b.norm_coe_le_norm t) + (f.norm_coe_le_norm t) (norm_nonneg _) (norm_nonneg _)) +omit [CompleteSpace F] in +def pointwiseLM : C(Time,F →L[ℝ] F) →ₗ[ℝ] (C(Time,F) →ₗ[ℝ] C(Time,F)) where + toFun b := + { toFun := pointwise b + map_add' := fun f g => by ext t; exact map_add (b t) (f t) (g t) + map_smul' := fun c f => by ext t; exact map_smul (b t) c (f t) } + map_add' b c := by ext f t; rfl + map_smul' c b := by ext f t; rfl +omit [CompleteSpace F] in +def pointwiseCLM : C(Time,F →L[ℝ] F) →L[ℝ] (C(Time,F) →L[ℝ] C(Time,F)) := + LinearMap.mkContinuous₂ (σ₁₃ := RingHom.id ℝ) (σ₂₃ := RingHom.id ℝ) + (pointwiseLM (F := F)) 1 (fun (b : C(Time,F →L[ℝ] F)) (f : C(Time,F)) => by + change ‖pointwise b f‖ ≤ 1*‖b‖*‖f‖ + simpa only [one_mul] using pointwise_bound (F := F) b f) +omit [CompleteSpace F] in +lemma pointwiseCLM_apply (b : C(Time,F →L[ℝ] F)) (f : C(Time,F)) (t : Time) : + pointwiseCLM b f t=b t (f t) := rfl +omit [CompleteSpace F] in +lemma pointwiseCLM_norm (b : C(Time,F →L[ℝ] F)) : ‖pointwiseCLM b‖ ≤ ‖b‖ := + ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg b) (pointwise_bound b) + +omit [CompleteSpace F] in +def expScale (k : ℝ) : C(Time,F) →L[ℝ] C(Time,F) := + pointwiseCLM ⟨fun t => Real.exp (k*(t:ℝ)) • ContinuousLinearMap.id ℝ F, + ((Real.continuous_exp.comp (continuous_const.mul continuous_subtype_val)).smul continuous_const)⟩ +omit [CompleteSpace F] in +lemma expScale_apply (k : ℝ) (f : C(Time,F)) (t : Time) : + expScale k f t=Real.exp (k*(t:ℝ)) • f t := rfl + +lemma volterra_unit (k : ℝ) (hk : 0 L q) + (Ring.mul_inverse_cancel _ (volterra_unit k hk b hb)) + simpa only [mul_apply_eq_comp,sub_apply,one_apply_eq_self] using h + have hwt := congrArg (fun f : C(Time,F) => f t) hw + change w t-Real.exp (-k*(t:ℝ)) • + (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend (pointwiseCLM b w) s)= + Real.exp (-k*(t:ℝ)) • y at hwt + have he : Real.exp (k*(t:ℝ))*Real.exp (-k*(t:ℝ))=1 := by + rw [← Real.exp_add]; ring_nf; exact Real.exp_zero + have hscaled := congrArg (fun z : F => Real.exp (k*(t:ℝ)) • z) hwt + rw [smul_sub,smul_smul,he,one_smul,smul_smul,he,one_smul] at hscaled + have hint : (∫ s in (0:ℝ)..(t:ℝ), Real.exp (k*s) • extend (pointwiseCLM b w) s)= + ∫ s in (0:ℝ)..(t:ℝ), extend b s (extend (evolution k hk b y) s) := by + apply intervalIntegral.integral_congr + intro s hs + have hsi : s∈Icc (0:ℝ) 1 := by + rw [uIcc_of_le t.property.1] at hs + exact ⟨hs.1,hs.2.trans t.property.2⟩ + have hs' : s=(⟨s,hsi⟩ : Time) := rfl + change Real.exp (k*s) • extend (pointwiseCLM b w) s = + extend b s (extend (evolution k hk b y) s) + rw [hs',extend_apply,extend_apply,extend_apply,pointwiseCLM_apply] + change Real.exp (k*s) • b ⟨s,hsi⟩ (w ⟨s,hsi⟩)= + b ⟨s,hsi⟩ (Real.exp (k*s) • w ⟨s,hsi⟩) + exact (map_smul (b ⟨s,hsi⟩) (Real.exp (k*s)) (w ⟨s,hsi⟩)).symm + rw [hint] at hscaled + change Real.exp (k*(t:ℝ)) • w t=_ + exact sub_eq_iff_eq_add.mp hscaled + +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] +/-- Strong smooth parameter dependence of the entire continuous trajectory. -/ +theorem evolution_contDiffAt (k : ℝ) (hk : 0 evolution k hk (b p) (y p)) p := by + have hB : ContDiffAt ℝ (⊤ : ℕ∞) (fun q => pointwiseCLM (b q)) p := by + exact (ContinuousLinearMap.contDiff (E := C(Time,F →L[ℝ] F)) + (F := C(Time,F) →L[ℝ] C(Time,F)) (pointwiseCLM (F := F))).contDiffAt.comp p hb + have hA : ContDiffAt ℝ (⊤ : ℕ∞) (fun p => (1 : C(Time,F) →L[ℝ] C(Time,F))- + weightedCLM k hk*pointwiseCLM (b p)) p := + by + apply ContDiffAt.sub contDiffAt_const + exact ContDiffAt.mul (𝕜 := ℝ) (f := fun _ : P => weightedCLM (F := F) k hk) + (g := fun q => pointwiseCLM (b q)) contDiffAt_const hB + obtain ⟨a,ha⟩ := volterra_unit k hk (b p) hsmall + have hi : ContDiffAt ℝ (⊤ : ℕ∞) Ring.inverse + ((1 : C(Time,F) →L[ℝ] C(Time,F))-weightedCLM k hk*pointwiseCLM (b p)) := by + rw [← ha] + exact contDiffAt_ringInverse (R := C(Time,F) →L[ℝ] C(Time,F)) ℝ a + have hq : ContDiffAt ℝ (⊤ : ℕ∞) (fun p => expScale (-k) (ContinuousMap.const Time (y p))) p := + (expScale (F := F) (-k)).contDiff.contDiffAt.comp p ((ContinuousLinearMap.contDiff (E := F) (F := C(Time,F)) + (ContinuousLinearMap.const ℝ Time)).contDiffAt.comp p hy) + have hic := hi.comp p hA + exact (expScale (F := F) k).contDiff.contDiffAt.comp p (hic.clm_apply hq) +end ElasticityODE + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +/-- Integral solutions are genuine classical solutions, including one-sided +endpoint derivatives. -/ +lemma evolution_hasDerivWithinAt (k : ℝ) (hk : 0 extend b s (extend u s)) := + (extend b).continuous.clm_apply (extend u).continuous + have h := (intervalIntegral.integral_hasDerivAt_right (hc.intervalIntegrable 0 (t:ℝ)) + hc.aestronglyMeasurable.stronglyMeasurableAtFilter hc.continuousAt).const_add y + have he : ∀ s∈Time, y+(∫ r in (0:ℝ)..s, extend b r (extend u r))=extend u s := by + intro s hs + change _=extend u (⟨s,hs⟩ : Time) + rw [extend_apply] + exact (evolution_integral k hk b hb y ⟨s,hs⟩).symm + have ht := h.hasDerivWithinAt.congr_of_mem (fun s hs => (he s hs).symm) t.property + simpa only [extend_apply] using ht + +lemma evolution_initial (k : ℝ) (hk : 0 extend b t x) (s := fun _ => univ) (K := ‖b‖₊) + (fun t _ => (hLip t).lipschitzOnWith) (extend u).continuous.continuousOn + (fun t ht => by + have h := (hu ⟨t,mem_Icc_of_Ico ht⟩).mono_of_mem_nhdsWithin (Icc_mem_nhdsGE_of_mem ht) + simpa only [extend_apply b ⟨t,mem_Icc_of_Ico ht⟩, + extend_apply u ⟨t,mem_Icc_of_Ico ht⟩] using h) + (fun _ _ => mem_univ _) (extend v).continuous.continuousOn + (fun t ht => by + have h := (hv ⟨t,mem_Icc_of_Ico ht⟩).mono_of_mem_nhdsWithin (Icc_mem_nhdsGE_of_mem ht) + simpa only [extend_apply b ⟨t,mem_Icc_of_Ico ht⟩, + extend_apply v ⟨t,mem_Icc_of_Ico ht⟩] using h) + (fun _ _ => mem_univ _) (by + change extend u (⟨0,by simp [Time]⟩ : Time)=extend v (⟨0,by simp [Time]⟩ : Time) + simpa only [extend_apply u ⟨0,by simp [Time]⟩,extend_apply v ⟨0,by simp [Time]⟩] using hzero) + ext t + have h := he t.property + simpa only [extend_apply] using h + +/-- A globally defined linear evolution, not restricted to small coefficients. -/ +def flow (b : C(Time,F →L[ℝ] F)) (y : F) : C(Time,F) := + evolution (‖b‖+1) (by positivity) b y +lemma flow_hasDerivWithinAt (b : C(Time,F →L[ℝ] F)) (y : F) (t : Time) : + HasDerivWithinAt (extend (flow b y)) (b t (flow b y t)) Time t := + evolution_hasDerivWithinAt _ _ b (by linarith) y t +lemma flow_initial (b : C(Time,F →L[ℝ] F)) (y : F) : + flow b y ⟨0,by simp [Time]⟩=y := evolution_initial _ _ b (by linarith) y +lemma flow_eq_evolution (k : ℝ) (hk : 0 evolution k hk (b p) (y p)) := by + rw [contDiff_iff_contDiffAt] + exact fun p => evolution_contDiffAt k hk b y p hb.contDiffAt hy.contDiffAt (hsmall p) +theorem flow_contDiff (b : P → C(Time,F →L[ℝ] F)) (y : P → F) + (hb : ContDiff ℝ (⊤ : ℕ∞) b) (hy : ContDiff ℝ (⊤ : ℕ∞) y) : + ContDiff ℝ (⊤ : ℕ∞) (fun p => flow (b p) (y p)) := by + rw [contDiff_iff_contDiffAt] + intro p + let k : ℝ := ‖b p‖+1 + have hk : 0 ‖b q‖) p := ContinuousAt.norm (f := b) hbc + filter_upwards [hn.eventually_lt_const hsmall] with q hq + exact flow_eq_evolution k hk (b q) hq (y q) +end ElasticityODE + +end +end +section +noncomputable section +open Set +namespace ElasticityODE +variable {R : Type*} [NormedRing R] [NormedAlgebra ℝ R] [CompleteSpace R] +def leftCoeff (b : C(Time,R)) : C(Time,R →L[ℝ] R) := + ⟨fun t => ContinuousLinearMap.mul ℝ R (b t), + (ContinuousLinearMap.mul ℝ R).continuous.comp b.continuous⟩ +def rightCoeff (b : C(Time,R)) : C(Time,R →L[ℝ] R) := + ⟨fun t => (ContinuousLinearMap.mul ℝ R).flip (b t), + (ContinuousLinearMap.mul ℝ R).flip.continuous.comp b.continuous⟩ +def fundamental (b : C(Time,R)) : C(Time,R) := flow (leftCoeff b) 1 +def reciprocal (b : C(Time,R)) : C(Time,R) := flow (-rightCoeff b) 1 +lemma fundamental_deriv (b : C(Time,R)) (t : Time) : + HasDerivWithinAt (extend (fundamental b)) (b t*fundamental b t) Time t := + flow_hasDerivWithinAt (leftCoeff b) 1 t +lemma reciprocal_deriv (b : C(Time,R)) (t : Time) : + HasDerivWithinAt (extend (reciprocal b)) (-(reciprocal b t*b t)) Time t := + flow_hasDerivWithinAt (-rightCoeff b) 1 t +lemma fundamental_initial (b : C(Time,R)) : fundamental b ⟨0,by simp [Time]⟩=1 := + flow_initial (leftCoeff b) 1 +lemma reciprocal_initial (b : C(Time,R)) : reciprocal b ⟨0,by simp [Time]⟩=1 := + flow_initial (-rightCoeff b) 1 +lemma reciprocal_mul_fundamental (b : C(Time,R)) (t : Time) : + reciprocal b t*fundamental b t=1 := by + let f : ℝ → R := fun s => extend (reciprocal b) s*extend (fundamental b) s + have hder (s : Time) : HasDerivWithinAt f 0 Time s := by + have h := (reciprocal_deriv b s).mul (fundamental_deriv b s) + simpa only [f,Pi.mul_def,extend_apply,neg_mul,mul_assoc,neg_add_cancel] using h + have he := constant_of_has_deriv_right_zero + ((extend (reciprocal b)).continuous.mul (extend (fundamental b)).continuous).continuousOn + (fun s hs => (hder ⟨s,mem_Icc_of_Ico hs⟩).mono_of_mem_nhdsWithin + (Icc_mem_nhdsGE_of_mem hs)) t t.property + change f t=f (⟨0,by simp [Time]⟩ : Time) at he + have hz : f (⟨0,by simp [Time]⟩ : Time)=1 := by + change extend (reciprocal b) (⟨0,by simp [Time]⟩ : Time)* + extend (fundamental b) (⟨0,by simp [Time]⟩ : Time)=1 + rw [extend_apply,extend_apply,reciprocal_initial,fundamental_initial,mul_one] + have hh := he.trans hz + simpa only [f,extend_apply] using hh +lemma fundamental_mul_reciprocal (b : C(Time,R)) (t : Time) : + fundamental b t*reciprocal b t=1 := by + let a := leftCoeff b-rightCoeff b + let u := fundamental b*reciprocal b + let v : C(Time,R) := ContinuousMap.const Time 1 + have hu (s : Time) : HasDerivWithinAt (extend u) (a s (u s)) Time s := by + have h := (fundamental_deriv b s).mul (reciprocal_deriv b s) + have hh : HasDerivWithinAt (fun x => extend (fundamental b) x*extend (reciprocal b) x) + (b s*(fundamental b s*reciprocal b s)-(fundamental b s*reciprocal b s)*b s) Time s := by + simpa only [Pi.mul_def,extend_apply,mul_neg,mul_assoc,sub_eq_add_neg] using h + exact hh.congr_of_mem (fun x hx => by + change extend u (⟨x,hx⟩ : Time)=_ + rw [extend_apply] + change fundamental b ⟨x,hx⟩*reciprocal b ⟨x,hx⟩=_ + rw [← extend_apply (fundamental b) ⟨x,hx⟩,← extend_apply (reciprocal b) ⟨x,hx⟩]) s.property + have hv (s : Time) : HasDerivWithinAt (extend v) (a s (v s)) Time s := by + have h : a s (v s)=0 := by change b s*1-1*b s=0; simp + rw [h] + have hh : HasDerivWithinAt (fun _ : ℝ => (1:R)) 0 Time s := hasDerivWithinAt_const _ _ _ + exact hh.congr_of_mem (fun x hx => by + change extend v (⟨x,hx⟩ : Time)=1 + rw [extend_apply] + rfl) s.property + have hi : u ⟨0,by simp [Time]⟩=v ⟨0,by simp [Time]⟩ := by + change fundamental b ⟨0,by simp [Time]⟩*reciprocal b ⟨0,by simp [Time]⟩=1 + rw [fundamental_initial,reciprocal_initial,mul_one] + exact congrArg (fun f : C(Time,R) => f t) (linear_ode_unique a u v hu hv hi) +theorem fundamental_isUnit (b : C(Time,R)) (t : Time) : IsUnit (fundamental b t) := + ⟨⟨fundamental b t,reciprocal b t,fundamental_mul_reciprocal b t,reciprocal_mul_fundamental b t⟩,rfl⟩ +end ElasticityODE + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] +def integrate (f : C(Time,F)) : C(Time,F) := + ⟨fun t => ∫ s in (0:ℝ)..(t:ℝ), extend f s, + (intervalIntegral.differentiable_integral_of_continuous (extend f).continuous).continuous.comp + continuous_subtype_val⟩ +lemma integrate_bound (f : C(Time,F)) : ‖integrate f‖ ≤ ‖f‖ := by + apply (ContinuousMap.norm_le _ (norm_nonneg f)).mpr + intro t + change ‖∫ s in (0:ℝ)..(t:ℝ), extend f s‖ ≤ ‖f‖ + have h := intervalIntegral.norm_integral_le_of_norm_le t.property.1 + (Filter.Eventually.of_forall (fun s (_ : s ∈ Ioc (0:ℝ) (t:ℝ)) => extend_norm_le f s)) + (intervalIntegrable_const : IntervalIntegrable (fun _ : ℝ => ‖f‖) volume 0 (t:ℝ)) + calc + _ ≤ ∫ s in (0:ℝ)..(t:ℝ), ‖f‖ := h + _ = (t:ℝ)*‖f‖ := by simp + _ ≤ ‖f‖ := by simpa only [one_mul] using mul_le_mul_of_nonneg_right t.property.2 (norm_nonneg f) + +def integrateCLM : C(Time,F) →L[ℝ] C(Time,F) := + LinearMap.mkContinuous + ({ toFun := integrate + map_add' := fun f g => by + ext t + change (∫ s in (0:ℝ)..(t:ℝ), (extend f s+extend g s)) = + (∫ s in (0:ℝ)..(t:ℝ), extend f s)+(∫ s in (0:ℝ)..(t:ℝ), extend g s) + exact intervalIntegral.integral_add ((extend f).continuous.intervalIntegrable _ _) + ((extend g).continuous.intervalIntegrable _ _) + map_smul' := fun c f => by + ext t + exact intervalIntegral.integral_smul c (fun s => extend f s) + } : C(Time,F) →ₗ[ℝ] C(Time,F)) 1 (fun f => by + change ‖integrate f‖ ≤ 1*‖f‖ + simpa only [one_mul] using integrate_bound f) +lemma integrateCLM_apply (f : C(Time,F)) (t : Time) : + integrateCLM f t=∫ s in (0:ℝ)..(t:ℝ), extend f s := rfl + +lemma integral_curve_hasDerivWithinAt (u f : C(Time,F)) (y : F) + (he : u=ContinuousMap.const Time y+integrateCLM f) (t : Time) : + HasDerivWithinAt (extend u) (f t) Time t := by + have hc := (extend f).continuous + have h := (intervalIntegral.integral_hasDerivAt_right (hc.intervalIntegrable 0 (t:ℝ)) + hc.aestronglyMeasurable.stronglyMeasurableAtFilter hc.continuousAt).const_add y + apply (h.hasDerivWithinAt.congr_of_mem ?_ t.property).congr_deriv (extend_apply f t) + intro s hs + change extend u (⟨s,hs⟩ : Time)=_ + rw [extend_apply,he] + rfl +end ElasticityODE + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +variable {F P : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + [NormedAddCommGroup P] [NormedSpace ℝ P] +lemma integral_family_variation (b : P → C(Time,F →L[ℝ] F)) (u : P → C(Time,F)) (y : P → F) + (p : P) (b' : P →L[ℝ] C(Time,F →L[ℝ] F)) (u' : P →L[ℝ] C(Time,F)) (y' : P →L[ℝ] F) + (hb : HasFDerivAt b b' p) (hu : HasFDerivAt u u' p) (hy : HasFDerivAt y y' p) + (he : ∀ q, u q=ContinuousMap.const Time (y q)+integrateCLM (pointwiseCLM (b q) (u q))) (v : P) : + u' v=ContinuousMap.const Time (y' v)+ + integrateCLM (pointwiseCLM (b p) (u' v)+pointwiseCLM (b' v) (u p)) := by + have hB : HasFDerivAt (fun q => pointwiseCLM (b q)) + ((pointwiseCLM (F := F)).comp b') p := by + exact HasFDerivAt.comp (𝕜 := ℝ) (f := b) (g := pointwiseCLM (F := F)) + (f' := b') (g' := pointwiseCLM (F := F)) p + (pointwiseCLM (F := F)).hasFDerivAt hb + have hprod := hB.clm_apply hu + have hI := (integrateCLM (F := F)).hasFDerivAt.comp p hprod + have hyc := (ContinuousLinearMap.const ℝ Time : F →L[ℝ] C(Time,F)).hasFDerivAt.comp p hy + have hall := (hyc.add hI).congr_of_eventuallyEq (Filter.Eventually.of_forall he) + have hd := hu.unique hall + have h := congrArg (fun L : P →L[ℝ] C(Time,F) => L v) hd + simp only [add_apply,ContinuousLinearMap.comp_apply,ContinuousLinearMap.flip_apply] at h + exact h + +lemma integral_family_variation_hasDerivWithinAt + (b : P → C(Time,F →L[ℝ] F)) (u : P → C(Time,F)) (y : P → F) + (p : P) (b' : P →L[ℝ] C(Time,F →L[ℝ] F)) (u' : P →L[ℝ] C(Time,F)) (y' : P →L[ℝ] F) + (hb : HasFDerivAt b b' p) (hu : HasFDerivAt u u' p) (hy : HasFDerivAt y y' p) + (he : ∀ q, u q=ContinuousMap.const Time (y q)+integrateCLM (pointwiseCLM (b q) (u q))) + (v : P) (t : Time) : + HasDerivWithinAt (extend (u' v)) (b p t (u' v t)+b' v t (u p t)) Time t := by + have h := integral_curve_hasDerivWithinAt (u' v) _ (y' v) + (integral_family_variation b u y p b' u' y' hb hu hy he v) t + simpa only [ContinuousMap.add_apply,pointwiseCLM_apply] using h +end ElasticityODE + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Interval +namespace ElasticityODE +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] +lemma flow_integral_curve (b : C(Time,F →L[ℝ] F)) (y : F) : + flow b y=ContinuousMap.const Time y+integrateCLM (pointwiseCLM b (flow b y)) := by + ext t + have h := evolution_integral (‖b‖+1) (by positivity) b (by linarith) y t + change flow b y t=y+∫ s in (0:ℝ)..(t:ℝ), extend b s (extend (flow b y) s) at h + rw [h] + rfl +variable {R P : Type*} [NormedRing R] [NormedAlgebra ℝ R] [CompleteSpace R] + [NormedAddCommGroup P] [NormedSpace ℝ P] +def leftCoeffCLM : C(Time,R) →L[ℝ] C(Time,R →L[ℝ] R) := + (ContinuousLinearMap.mul ℝ R).compLeftContinuous ℝ Time +omit [CompleteSpace R] in +lemma leftCoeffCLM_eq (b : C(Time,R)) : leftCoeffCLM b=leftCoeff b := rfl +lemma fundamental_contDiff (b : P → C(Time,R)) (hb : ContDiff ℝ (⊤ : ℕ∞) b) : + ContDiff ℝ (⊤ : ℕ∞) (fun p => fundamental (b p)) := by + have hL : ContDiff ℝ (⊤ : ℕ∞) (leftCoeffCLM (R := R)) := + ContinuousLinearMap.contDiff (E := C(Time,R)) (F := C(Time,R →L[ℝ] R)) _ + have hcomp := hL.comp hb + have hcoeff : ContDiff ℝ (⊤ : ℕ∞) (fun p => leftCoeff (b p)) := by + simpa only [Function.comp_def,leftCoeffCLM_eq] using hcomp + exact flow_contDiff (fun p => leftCoeff (b p)) (fun _ => 1) hcoeff contDiff_const +lemma fundamental_variation_hasDerivWithinAt (b : P → C(Time,R)) + (hb : ContDiff ℝ (⊤ : ℕ∞) b) (p v : P) (t : Time) : + HasDerivWithinAt (extend (fderiv ℝ (fun p => fundamental (b p)) p v)) + (b p t*(fderiv ℝ (fun p => fundamental (b p)) p v t)+ + fderiv ℝ b p v t*fundamental (b p) t) Time t := by + have hL : HasFDerivAt (leftCoeffCLM (R := R)) (leftCoeffCLM (R := R)) (b p) := + ContinuousLinearMap.hasFDerivAt _ + have hc := HasFDerivAt.comp (𝕜 := ℝ) (E := P) (F := C(Time,R)) + (G := C(Time,R →L[ℝ] R)) (f := b) (g := leftCoeffCLM (R := R)) + (f' := fderiv ℝ b p) (g' := leftCoeffCLM (R := R)) p hL + (hb.differentiable (by simp) p).hasFDerivAt + have hb' : HasFDerivAt (fun q => leftCoeff (b q)) + ((leftCoeffCLM (R := R)).comp (fderiv ℝ b p)) p := by + simpa only [Function.comp_def,leftCoeffCLM_eq] using hc + have hu := ((fundamental_contDiff b hb).differentiable (by simp) p).hasFDerivAt + have hy : HasFDerivAt (fun _ : P => (1:R)) 0 p := hasFDerivAt_const (𝕜 := ℝ) _ _ + exact integral_family_variation_hasDerivWithinAt (fun q => leftCoeff (b q)) + (fun q => fundamental (b q)) (fun _ => 1) p _ _ _ hb' hu hy + (fun q => flow_integral_curve (leftCoeff (b q)) 1) v t +lemma fundamental_variation_initial (b : P → C(Time,R)) + (hb : ContDiff ℝ (⊤ : ℕ∞) b) (p v : P) : + fderiv ℝ (fun p => fundamental (b p)) p v ⟨0,by simp [Time]⟩=0 := by + let t : Time := ⟨0,by simp [Time]⟩ + have hu := ((fundamental_contDiff b hb).differentiable (by simp) p).hasFDerivAt + have h := (ContinuousMap.evalCLM ℝ t : C(Time,R) →L[ℝ] R).hasFDerivAt.comp p hu + have hh : (fun q => fundamental (b q) t)=(fun _ : P => (1:R)) := + funext (fun q => fundamental_initial (b q)) + change HasFDerivAt (fun q => fundamental (b q) t) _ p at h + rw [hh] at h + have he := h.unique (hasFDerivAt_const (1:R) p) + exact congrArg (fun L : P →L[ℝ] R => L v) he +end ElasticityODE + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Parameters.lean b/lean/OAI/MathematicalPhysics/Elasticity/Parameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e2416fa4078e71c5b0e99c95b8a75856509530b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Parameters.lean @@ -0,0 +1,1390 @@ +import OAI.MathematicalPhysics.Elasticity.Planar + +namespace OAI + +noncomputable section + +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Set +open scoped ENNReal SchwartzMap BigOperators +open ElasticityRegularity +variable {n : Type*} [Fintype n] +abbrev PL2 := Lp ℂ 2 (volume : Measure ℂ) + +lemma lp_dist_add (f g : PL2) : ((f+g : PL2) : 𝓢'(ℂ,ℂ))=(f : 𝓢'(ℂ,ℂ))+(g : 𝓢'(ℂ,ℂ)) := + (Lp.toTemperedDistributionCLM ℂ (volume : Measure ℂ) 2).map_add f g +lemma lp_dist_smul (c : ℝ) (f : PL2) : ((c • f : PL2) : 𝓢'(ℂ,ℂ))=c • (f : 𝓢'(ℂ,ℂ)) := by + change (((c : ℂ) • f : PL2) : 𝓢'(ℂ,ℂ))=(c : ℂ) • (f : 𝓢'(ℂ,ℂ)) + exact (Lp.toTemperedDistributionCLM ℂ (volume : Measure ℂ) 2).map_smul (c : ℂ) f +lemma lp_dist_sum (f : n → PL2) : ((∑ j, f j : PL2) : 𝓢'(ℂ,ℂ))=∑ j, (f j : 𝓢'(ℂ,ℂ)) := + map_sum (Lp.toTemperedDistributionCLM ℂ (volume : Measure ℂ) 2) f _ + +/-- The matrix multiplication here acts on genuine L2 classes and agrees with +multiplication on distributions; it is not a formal bounded-operator model. -/ +theorem exists_matrix_multiplier (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hc : ∀ i j, HasCompactSupport (a i j)) : + ∃ M : Hilbert n →L[ℂ] Hilbert n, ∀ (f : Hilbert n) (i : n), + (M f i : 𝓢'(ℂ,ℂ))=∑ j, smulLeftCLM ℂ (a i j) (f j : 𝓢'(ℂ,ℂ)) := by + choose L hL using fun i j => exists_bounded_nat_multiplier 0 (ha i j) (hc i j) + let e := PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2) + let M' : (n → PL2) →L[ℂ] (n → PL2) := + ContinuousLinearMap.pi (fun i => ∑ j, (L i j).comp (ContinuousLinearMap.proj j)) + refine ⟨e.symm.toContinuousLinearMap.comp (M'.comp e.toContinuousLinearMap),fun f i => ?_⟩ + simp only [ContinuousLinearMap.comp_apply,ContinuousLinearEquiv.coe_coe,e, + PiLp.continuousLinearEquiv_apply,PiLp.continuousLinearEquiv_symm_apply,WithLp.ofLp_toLp, + M',ContinuousLinearMap.pi_apply,sum_apply,ContinuousLinearMap.proj_apply] + rw [lp_dist_sum] + apply Finset.sum_congr rfl + intro j _ + simpa only [Nat.cast_zero,sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + ContinuousLinearMap.comp_apply,ContinuousLinearMap.id_apply,Lp.toTemperedDistributionCLM_apply] using hL i j (f j) + + theorem exists_planar_distribution_inverse {S Ω : Set ℂ} (hS : IsCompact S) + (hΩ : Ω ⊆ S) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, (a i j).HasTemperateGrowth) : + ∃ T : Hilbert n →L[ℂ] Hilbert n, ∀ f : Hilbert n, ∀ i, + LocalEqual Ω (ElasticityPlanarDistribution.dbar (T f i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (T f j : 𝓢'(ℂ,ℂ))) (f i : 𝓢'(ℂ,ℂ)) := by + obtain ⟨C,hC,T,hT,heq⟩ := exists_planar_weak_inverse hS a (fun i j => (ha i j).1) + exact ⟨T,fun f => weak_to_local_equation Ω S hΩ a ha (T f) f (heq f)⟩ + +/-- Local smooth dependence of an actual distributional planar inverse along +the coefficient homotopy s*a. This supplies the parameter ingredient for frame +construction without invoking holomorphic bundle triviality. -/ +theorem local_homotopy_inverse {S Ω : Set ℂ} (hS : IsCompact S) (hΩ : Ω ⊆ S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hc : ∀ i j, HasCompactSupport (a i j)) (s₀ : ℝ) : + ∃ (U : Set ℝ) (T : ℝ → Hilbert n →L[ℂ] Hilbert n), + IsOpen U ∧ s₀ ∈ U ∧ ContDiffOn ℝ (⊤ : ℕ∞) T U ∧ + ∀ s ∈ U, ∀ f : Hilbert n, ∀ i, + LocalEqual Ω (ElasticityPlanarDistribution.dbar (T s f i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (fun z => (s : ℂ)*a i j z) + (T s f j : 𝓢'(ℂ,ℂ))) (f i : 𝓢'(ℂ,ℂ)) := by + have hat (i j : n) : (a i j).HasTemperateGrowth := (hc i j).hasTemperateGrowth (ha i j) + have hscaled (c : ℂ) (i j : n) : (fun z => c*a i j z).HasTemperateGrowth := + (Function.HasTemperateGrowth.const c).mul (hat i j) + obtain ⟨M,hM⟩ := exists_matrix_multiplier a ha hc + obtain ⟨T₀,hT₀⟩ := exists_planar_distribution_inverse hS hΩ + (fun i j z => (s₀ : ℂ)*a i j z) (fun i j => (Function.HasTemperateGrowth.const _).mul (hat i j)) + let B : ℝ → Hilbert n →L[ℂ] Hilbert n := fun s => (s-s₀) • M + let T : ℝ → Hilbert n →L[ℂ] Hilbert n := fun s => T₀*Ring.inverse (1+B s*T₀) + let U : Set ℝ := {s | ‖B s*T₀‖<1} + have hB : ContDiff ℝ (⊤ : ℕ∞) B := (contDiff_id.sub contDiff_const).smul contDiff_const + have hopen : IsOpen U := isOpen_lt (hB.continuous.mul continuous_const).norm continuous_const + have hBzero : B s₀=0 := by + simpa only [B,sub_self] using zero_smul ℝ M + have hmem : s₀∈U := by + change ‖B s₀*T₀‖<1 + rw [hBzero,zero_mul,norm_zero] + exact zero_lt_one + have hsmooth : ContDiffOn ℝ (⊤ : ℕ∞) T U := fun s hs => + (ElasticityDualSolvability.smooth_local_weak_inverse T₀ B hB.contDiffAt hs).contDiffWithinAt + refine ⟨U,T,hopen,hmem,hsmooth,fun s hs f i => ?_⟩ + change ‖B s*T₀‖<1 at hs + have hu : IsUnit (1+B s*T₀) := by + simpa only [sub_neg_eq_add] using isUnit_one_sub_of_norm_lt_one + (by simpa only [norm_neg] using hs : ‖-(B s*T₀)‖<1) + let q := Ring.inverse (1+B s*T₀) f + have heq := hT₀ q i + have htot : q+B s (T₀ q)=f := by + have h := congrArg (fun L : Hilbert n →L[ℂ] Hilbert n => L f) + (Ring.mul_inverse_cancel (1+B s*T₀) hu) + simpa only [mul_apply_eq_comp,add_apply,one_apply_eq_self] using h + have hprod : ((B s (T₀ q)) i : 𝓢'(ℂ,ℂ))= + ∑ j, smulLeftCLM ℂ (fun z => (((s-s₀ : ℝ) : ℂ))*a i j z) (T₀ q j : 𝓢'(ℂ,ℂ)) := by + change (((s-s₀) • M (T₀ q) : Hilbert n) i : 𝓢'(ℂ,ℂ))=_ + simp only [PiLp.smul_apply,lp_dist_smul,hM,Finset.smul_sum] + apply Finset.sum_congr rfl + intro j _ + ext φ + simp only [smul_apply,smulLeftCLM_apply_apply] + change (s-s₀) • ((T₀ q j : 𝓢'(ℂ,ℂ)) (SchwartzMap.smulLeftCLM ℂ (a i j) φ))=_ + change (((s-s₀ : ℝ) : ℂ)) • ((T₀ q j : 𝓢'(ℂ,ℂ)) (SchwartzMap.smulLeftCLM ℂ (a i j) φ))=_ + rw [← map_smul] + congr 1 + ext z + simp only [SchwartzMap.smulLeftCLM_apply_apply (hat i j), + SchwartzMap.smulLeftCLM_apply_apply (hscaled ((s-s₀ : ℝ) : ℂ) i j), + smul_eq_mul,smul_apply] + ring + intro φ hφ hφs + have he := heq φ hφ hφs + have ht := congrArg (fun v : Hilbert n => (v i : 𝓢'(ℂ,ℂ)) φ) htot + rw [PiLp.add_apply,lp_dist_add,hprod] at ht + change _= _ at he + change ((ElasticityPlanarDistribution.dbar (T₀ q i : 𝓢'(ℂ,ℂ)))+ + ∑ j, smulLeftCLM ℂ (fun z => (s : ℂ)*a i j z) (T₀ q j : 𝓢'(ℂ,ℂ))) φ=_ + have hc' (j : n) : smulLeftCLM ℂ (fun z => (s : ℂ)*a i j z) (T₀ q j : 𝓢'(ℂ,ℂ))= + smulLeftCLM ℂ (fun z => (s₀ : ℂ)*a i j z) (T₀ q j : 𝓢'(ℂ,ℂ))+ + smulLeftCLM ℂ (fun z => (((s-s₀ : ℝ) : ℂ))*a i j z) (T₀ q j : 𝓢'(ℂ,ℂ)) := by + ext ψ + simp only [smulLeftCLM_apply_apply,add_apply] + rw [← map_add] + congr 1 + ext z + simp only [SchwartzMap.smulLeftCLM_apply_apply (hscaled (s : ℂ) i j), + SchwartzMap.smulLeftCLM_apply_apply (hscaled (s₀ : ℂ) i j), + SchwartzMap.smulLeftCLM_apply_apply (hscaled ((s-s₀ : ℝ) : ℂ) i j), + add_apply,smul_eq_mul] + rw [Complex.ofReal_sub] + ring + simp only [hc',Finset.sum_add_distrib,add_apply] at he ht ⊢ + linear_combination he+ht +end ElasticityPlanar +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Set +open scoped ENNReal SchwartzMap BigOperators LineDeriv Manifold +open ElasticityRegularity +variable {n : Type*} [Fintype n] + +def entryInjection (i : n) : Hilbert n →L[ℂ] 𝓢'(ℂ,ℂ) := + (Lp.toTemperedDistributionCLM ℂ (volume : Measure ℂ) 2).comp + ((ContinuousLinearMap.proj i).comp (PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).toContinuousLinearMap) +omit [Fintype n] in +lemma entryInjection_apply (i : n) (f : Hilbert n) : entryInjection i f=(f i : 𝓢'(ℂ,ℂ)) := rfl + +def planarOperator (a : n → n → ℂ → ℂ) (i : n) : Hilbert n →L[ℂ] 𝓢'(ℂ,ℂ) := + ((LineDeriv.lineDerivOpCLM ℂ 𝓢'(ℂ,ℂ) (1 : ℂ))+ + Complex.I • (LineDeriv.lineDerivOpCLM ℂ 𝓢'(ℂ,ℂ) Complex.I)).comp (entryInjection i)+ + ∑ j, (smulLeftCLM ℂ (a i j)).comp (entryInjection j) +lemma planarOperator_apply (a : n → n → ℂ → ℂ) (i : n) (f : Hilbert n) : + planarOperator a i f=ElasticityPlanarDistribution.dbar (f i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (f j : 𝓢'(ℂ,ℂ)) := by + simp only [planarOperator,ContinuousLinearMap.comp_apply,add_apply,smul_apply,sum_apply, + entryInjection_apply,LineDeriv.lineDerivOpCLM_apply,ElasticityPlanarDistribution.dbar] + +/-- A genuine smooth bounded weak inverse along the entire real homotopy. +The patching uses a proved smooth convex selection theorem from Mathlib; +it adds no global frame or invertibility assumption to the PDE. -/ +theorem global_homotopy_inverse {S Ω : Set ℂ} (hS : IsCompact S) (hΩ : Ω ⊆ S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hc : ∀ i j, HasCompactSupport (a i j)) : + ∃ T : ℝ → Hilbert n →L[ℂ] Hilbert n, + ContDiff ℝ (⊤ : ℕ∞) T ∧ ∀ s, ∀ f : Hilbert n, ∀ i, + LocalEqual Ω (ElasticityPlanarDistribution.dbar (T s f i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (fun z => (s : ℂ)*a i j z) (T s f j : 𝓢'(ℂ,ℂ))) + (f i : 𝓢'(ℂ,ℂ)) := by + let P : ℝ → Set (Hilbert n →L[ℂ] Hilbert n) := fun s => {T | ∀ f i, + LocalEqual Ω (planarOperator (fun i j z => (s : ℂ)*a i j z) i (T f)) (f i : 𝓢'(ℂ,ℂ))} + have hconv : ∀ s, Convex ℝ (P s) := by + intro s T₁ hT₁ T₂ hT₂ b c _ _ hbc f i φ hφ hs + have h₁ := hT₁ f i φ hφ hs + have h₂ := hT₂ f i φ hφ hs + change (planarOperator (fun i j z => (s : ℂ)*a i j z) i + ((b : ℂ) • (T₁ f)+(c : ℂ) • (T₂ f))) φ=_ + simp only [map_add,map_smul,add_apply,smul_apply,h₁,h₂,smul_eq_mul] + have hh : (b : ℂ)+(c : ℂ)=1 := by exact_mod_cast hbc + rw [← add_mul,hh,one_mul] + have hlocal : ∀ s : ℝ, ∃ U ∈ nhds s, ∃ T : ℝ → Hilbert n →L[ℂ] Hilbert n, + ContMDiffOn 𝓘(ℝ,ℝ) 𝓘(ℝ,Hilbert n →L[ℂ] Hilbert n) (⊤ : ℕ∞) T U ∧ + ∀ t ∈ U, T t∈P t := by + intro s + obtain ⟨U,T,hU,hs,hT,heq⟩ := local_homotopy_inverse hS hΩ a ha hc s + refine ⟨U,hU.mem_nhds hs,T,hT.contMDiffOn,fun t ht f i => ?_⟩ + simp only [planarOperator_apply] + exact heq t ht f i + obtain ⟨T,hT⟩ := exists_contMDiffMap_forall_mem_convex_of_local 𝓘(ℝ,ℝ) hconv hlocal + refine ⟨T,T.contMDiff.contDiff,fun s f i => ?_⟩ + simpa only [planarOperator_apply] using hT s f i +end ElasticityPlanar +section +open MeasureTheory TemperedDistribution Set +open scoped ENNReal SchwartzMap BigOperators Manifold +namespace ElasticityRegularity +variable {P E F G : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] + [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedSpace ℂ E] [IsScalarTower ℝ ℂ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedSpace ℂ F] [IsScalarTower ℝ ℂ F] + [NormedAddCommGroup G] [NormedSpace ℝ G] [NormedSpace ℂ G] [IsScalarTower ℝ ℂ G] +lemma complex_clm_apply_smooth {f : P → E →L[ℂ] F} {g : P → E} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) : + ContDiff ℝ (⊤ : ℕ∞) (fun p => f p (g p)) := + ((ContinuousLinearMap.restrictScalarsL ℂ E F ℝ ℝ).contDiff.comp hf).clm_apply hg +omit [NormedSpace ℝ E] [IsScalarTower ℝ ℂ E] in +lemma complex_clm_comp_smooth {f : P → F →L[ℂ] G} {g : P → E →L[ℂ] F} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) : + ContDiff ℝ (⊤ : ℕ∞) (fun p => (f p).comp (g p)) := by + let C := ContinuousLinearMap.compL ℂ E F G + exact complex_clm_apply_smooth ((C.restrictScalars ℝ).contDiff.comp hf) hg +end ElasticityRegularity +namespace ElasticityPlanar +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +theorem exists_smooth_matrix_multiplier {K : Set ℂ} (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) : + ∃ M : P → Hilbert n →L[ℂ] Hilbert n, + ContDiff ℝ (⊤ : ℕ∞) M ∧ ∀ p (f : Hilbert n) i, + (M p f i : 𝓢'(ℂ,ℂ))=∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (f j : 𝓢'(ℂ,ℂ)) := by + choose L hL hLe using fun i j => exists_smooth_lp_multiplier hK (a i j) (ha i j) (hs i j) + let e := PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2) + let M' : P → (n → PL2) →L[ℂ] (n → PL2) := fun p => + ContinuousLinearMap.pi (fun i => ∑ j, (L i j p).comp (ContinuousLinearMap.proj j)) + have hM' : ContDiff ℝ (⊤ : ℕ∞) M' := by + apply (ContinuousLinearMap.piEquivL ℂ (n → PL2) (fun _ : n => PL2)).toContinuousLinearMap.restrictScalars ℝ |>.contDiff.comp + apply contDiff_pi.mpr + intro i + exact ContDiff.sum (fun j _ => complex_clm_comp_smooth (hL i j) contDiff_const) + refine ⟨fun p => e.symm.toContinuousLinearMap.comp ((M' p).comp e.toContinuousLinearMap), + complex_clm_comp_smooth contDiff_const (complex_clm_comp_smooth hM' contDiff_const),fun p f i => ?_⟩ + simp only [ContinuousLinearMap.comp_apply,ContinuousLinearEquiv.coe_coe,e, + PiLp.continuousLinearEquiv_apply,PiLp.continuousLinearEquiv_symm_apply,WithLp.ofLp_toLp, + M',ContinuousLinearMap.pi_apply,sum_apply,ContinuousLinearMap.proj_apply] + rw [lp_dist_sum] + exact Finset.sum_congr rfl (fun j _ => hLe i j p (f j)) + +/-- Local inversion for an arbitrary joint smooth compact coefficient family, +not merely scalar multiples of one coefficient. -/ +theorem local_variable_inverse {S Ω K : Set ℂ} (hS : IsCompact S) (hΩ : Ω ⊆ S) + (hK : IsCompact K) (a : n → n → P × ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) (p₀ : P) : + ∃ (U : Set P) (T : P → Hilbert n →L[ℂ] Hilbert n), + IsOpen U ∧ p₀∈U ∧ ContDiffOn ℝ (⊤ : ℕ∞) T U ∧ + ∀ p∈U, ∀ (f : Hilbert n) i, + LocalEqual Ω (planarOperator (fun i j z => a i j (p,z)) i (T p f)) (f i : 𝓢'(ℂ,ℂ)) := by + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := by + have hc : HasCompactSupport (fun z => a i j (p,z)) := by + apply hK.of_isClosed_subset (isClosed_tsupport _) + apply closure_minimal _ hK.isClosed + intro z hz + contrapose! hz + simpa only [Function.mem_support,not_not] using hs i j p z hz + exact hc.hasTemperateGrowth ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + obtain ⟨M,hM,hMe⟩ := exists_smooth_matrix_multiplier hK a ha hs + obtain ⟨T₀,hT₀⟩ := exists_planar_distribution_inverse hS hΩ + (fun i j z => a i j (p₀,z)) (hat p₀) + let B : P → Hilbert n →L[ℂ] Hilbert n := fun p => M p-M p₀ + let T : P → Hilbert n →L[ℂ] Hilbert n := fun p => T₀*Ring.inverse (1+B p*T₀) + let U : Set P := {p | ‖B p*T₀‖<1} + have hB : ContDiff ℝ (⊤ : ℕ∞) B := hM.sub contDiff_const + have hopen : IsOpen U := isOpen_lt (hB.continuous.mul continuous_const).norm continuous_const + have hmem : p₀∈U := by simp only [U,B,mem_ofPred_eq,sub_self,zero_mul,norm_zero,zero_lt_one] + have hsmooth : ContDiffOn ℝ (⊤ : ℕ∞) T U := fun p hp => + (ElasticityDualSolvability.smooth_local_weak_inverse T₀ B hB.contDiffAt hp).contDiffWithinAt + refine ⟨U,T,hopen,hmem,hsmooth,fun p hp f i => ?_⟩ + change ‖B p*T₀‖<1 at hp + have hu : IsUnit (1+B p*T₀) := by + simpa only [sub_neg_eq_add] using isUnit_one_sub_of_norm_lt_one + (by simpa only [norm_neg] using hp : ‖-(B p*T₀)‖<1) + let q := Ring.inverse (1+B p*T₀) f + have htot : q+B p (T₀ q)=f := by + have h := congrArg (fun L : Hilbert n →L[ℂ] Hilbert n => L f) + (Ring.mul_inverse_cancel (1+B p*T₀) hu) + simpa only [mul_apply_eq_comp,add_apply,one_apply_eq_self] using h + have hprod : ((B p (T₀ q)) i : 𝓢'(ℂ,ℂ))= + (∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (T₀ q j : 𝓢'(ℂ,ℂ)))- + (∑ j, smulLeftCLM ℂ (fun z => a i j (p₀,z)) (T₀ q j : 𝓢'(ℂ,ℂ))) := by + change (((M p (T₀ q)-M p₀ (T₀ q) : Hilbert n)) i : 𝓢'(ℂ,ℂ))=_ + rw [PiLp.sub_apply] + change (Lp.toTemperedDistributionCLM ℂ volume 2) (_-_) = _ + rw [map_sub] + exact congrArg₂ (·-·) (hMe p (T₀ q) i) (hMe p₀ (T₀ q) i) + intro φ hφ hφs + have he := hT₀ q i φ hφ hφs + have ht := congrArg (fun v : Hilbert n => (v i : 𝓢'(ℂ,ℂ)) φ) htot + rw [PiLp.add_apply,lp_dist_add,hprod] at ht + simp only [planarOperator_apply] + change (ElasticityPlanarDistribution.dbar (T₀ q i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (T₀ q j : 𝓢'(ℂ,ℂ))) φ=_ + simp only [add_apply,sub_apply] at he ht ⊢ + linear_combination he+ht +end ElasticityPlanar + +end +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Set +open scoped ENNReal SchwartzMap BigOperators Manifold +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +/-- A global smooth weak right inverse for actual smooth compactly supported +matrix coefficients over any finite-dimensional real parameter space. -/ +theorem global_variable_inverse {S Ω K : Set ℂ} (hS : IsCompact S) (hΩ : Ω ⊆ S) + (hK : IsCompact K) (a : n → n → P × ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) : + ∃ T : P → Hilbert n →L[ℂ] Hilbert n, + ContDiff ℝ (⊤ : ℕ∞) T ∧ ∀ p, ∀ f : Hilbert n, ∀ i, + LocalEqual Ω (planarOperator (fun i j z => a i j (p,z)) i (T p f)) (f i : 𝓢'(ℂ,ℂ)) := by + let Q : P → Set (Hilbert n →L[ℂ] Hilbert n) := fun p => {T | ∀ f i, + LocalEqual Ω (planarOperator (fun i j z => a i j (p,z)) i (T f)) (f i : 𝓢'(ℂ,ℂ))} + have hconv : ∀ p, Convex ℝ (Q p) := by + intro p T₁ hT₁ T₂ hT₂ b c _ _ hbc f i φ hφ hφs + have h₁ := hT₁ f i φ hφ hφs + have h₂ := hT₂ f i φ hφ hφs + change (planarOperator (fun i j z => a i j (p,z)) i + ((b : ℂ) • (T₁ f)+(c : ℂ) • (T₂ f))) φ=_ + simp only [map_add,map_smul,add_apply,smul_apply,h₁,h₂,smul_eq_mul] + have hh : (b : ℂ)+(c : ℂ)=1 := by exact_mod_cast hbc + rw [← add_mul,hh,one_mul] + have hlocal : ∀ p : P, ∃ U ∈ nhds p, ∃ T : P → Hilbert n →L[ℂ] Hilbert n, + ContMDiffOn 𝓘(ℝ,P) 𝓘(ℝ,Hilbert n →L[ℂ] Hilbert n) (⊤ : ℕ∞) T U ∧ + ∀ t ∈ U, T t∈Q t := by + intro p + obtain ⟨U,T,hU,hp,hT,heq⟩ := local_variable_inverse hS hΩ hK a ha hs p + exact ⟨U,hU.mem_nhds hp,T,hT.contMDiffOn,heq⟩ + obtain ⟨T,hT⟩ := exists_contMDiffMap_forall_mem_convex_of_local 𝓘(ℝ,P) hconv hlocal + exact ⟨T,T.contMDiff.contDiff,hT⟩ +end ElasticityPlanar +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +/-- The actual whole-space Laplacian gain has a uniform norm estimate. Its +constant does not depend on any conjugation parameter or on the unknown. -/ +theorem quantitative_laplacian_gain (s : ℝ) : + ∃ C : ℝ, 0 by + apply (memSobolev_iff_range (s+1) _).mp + change MemSobolev (s+1) 2 (sobolevInjection s p.1.1) + have hΔ : MemSobolev (s-1) 2 (Δ (sobolevInjection s p.1.1)) := by + rw [he] + exact sobolevInjection_mem _ _ + have h := laplacian_gain ((sobolevInjection_mem s p.1.1).mono (by linarith : s-1 ≤ s)) hΔ + rw [show s-1+2=s+1 by ring] at h + exact h) + refine ⟨‖L‖+1,by positivity,fun f g hfg => ?_⟩ + have hG : (f,g) ∈ G := by + change A (f,g)=0 + simpa only [A,D,T,sub_apply,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.coe_fst',ContinuousLinearMap.coe_snd',laplacianCLM_apply] using + (sub_eq_zero.mpr hfg) + let p : G := ⟨(f,g),hG⟩ + refine ⟨L p,hL p,?_⟩ + have hp : ‖p‖ ≤ ‖f‖+‖g‖ := by + change max ‖f‖ ‖g‖ ≤ ‖f‖+‖g‖ + exact max_le (le_add_of_nonneg_right (norm_nonneg _)) (le_add_of_nonneg_left (norm_nonneg _)) + calc + ‖L p‖ ≤ ‖L‖*‖p‖ := L.le_opNorm p + _ ≤ (‖L‖+1)*(‖f‖+‖g‖) := by gcongr; linarith + + +/-- A bounded realization of the actual Laplacian graph gain, extended by +orthogonal projection only off its graph. On the graph it is the unique actual +Sobolev representative. This is used for strong parameter regularity. -/ +theorem bounded_laplacian_graph_gain (s : ℝ) : + ∃ L : (Lp ℂ 2 (volume : Measure E) × Lp ℂ 2 (volume : Measure E)) →L[ℂ] + Lp ℂ 2 (volume : Measure E), + ∀ f g, Δ (sobolevInjection s f)=sobolevInjection (s-1) g → + sobolevInjection (s+1) (L (f,g))=sobolevInjection s f := by + let H := Lp ℂ 2 (volume : Measure E) + let X := WithLp 2 (H × H) + let e : X ≃L[ℂ] H × H := WithLp.prodContinuousLinearEquiv 2 ℂ H H + let D : 𝓢'(E,ℂ) →L[ℂ] 𝓢'(E,ℂ) := LineDeriv.laplacianCLM ℂ E _ + let T : X →L[ℂ] 𝓢'(E,ℂ) := (sobolevInjection s).comp + ((ContinuousLinearMap.fst ℂ H H).comp e.toContinuousLinearMap) + let A : X →L[ℂ] 𝓢'(E,ℂ) := D.comp T- + (sobolevInjection (s-1)).comp ((ContinuousLinearMap.snd ℂ H H).comp e.toContinuousLinearMap) + let G : Submodule ℂ X := A.ker + have hclosed : IsClosed (G : Set X) := A.isClosed_ker + let : CompleteSpace G := hclosed.completeSpace_coe + have he (p : G) : Δ (sobolevInjection s (e p.1).1)=sobolevInjection (s-1) (e p.1).2 := by + have hp := p.2 + change A p.1=0 at hp + apply sub_eq_zero.mp + simpa only [A,D,T,sub_apply,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.coe_fst',ContinuousLinearMap.coe_snd',laplacianCLM_apply, + ContinuousLinearEquiv.coe_coe] using hp + obtain ⟨L,hL⟩ := exists_continuous_lift (sobolevInjection (E := E) (s+1)) + (sobolevInjection_injective (s+1)) (T.comp G.subtypeL) (fun p => by + apply (memSobolev_iff_range (s+1) _).mp + change MemSobolev (s+1) 2 (sobolevInjection s (e p.1).1) + have hΔ : MemSobolev (s-1) 2 (Δ (sobolevInjection s (e p.1).1)) := by + rw [he] + exact sobolevInjection_mem _ _ + have h := laplacian_gain ((sobolevInjection_mem s (e p.1).1).mono (by linarith : s-1 ≤ s)) hΔ + rw [show s-1+2=s+1 by ring] at h + exact h) + refine ⟨(L.comp G.orthogonalProjectionOnto).comp e.symm.toContinuousLinearMap,fun f g hfg => ?_⟩ + have hG : e.symm (f,g) ∈ G := by + change A (e.symm (f,g))=0 + simpa only [A,D,T,sub_apply,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.coe_fst',ContinuousLinearMap.coe_snd',laplacianCLM_apply, + ContinuousLinearEquiv.coe_coe,ContinuousLinearEquiv.apply_symm_apply] using + (sub_eq_zero.mpr hfg) + let p : G := ⟨e.symm (f,g),hG⟩ + have hp : G.orthogonalProjectionOnto (e.symm (f,g))=p := + G.orthogonalProjectionOnto_mem_subspace_eq_self p + simp only [ContinuousLinearMap.comp_apply,ContinuousLinearEquiv.coe_coe,hp,hL] + change sobolevInjection s (e p.1).1=sobolevInjection s f + simp only [p,ContinuousLinearEquiv.apply_symm_apply] + +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] + +theorem smooth_laplacian_gain (s : ℝ) + (f g : P → Lp ℂ 2 (volume : Measure E)) + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (heq : ∀ p, Δ (sobolevInjection s (f p))=sobolevInjection (s-1) (g p)) : + ∃ q : P → Lp ℂ 2 (volume : Measure E), ContDiff ℝ (⊤ : ℕ∞) q ∧ + ∀ p, sobolevInjection (s+1) (q p)=sobolevInjection s (f p) := by + obtain ⟨L,hL⟩ := bounded_laplacian_graph_gain (E := E) s + exact ⟨fun p => L (f p,g p),(L.restrictScalars ℝ).contDiff.comp (hf.prodMk hg), + fun p => hL (f p) (g p) (heq p)⟩ +end ElasticityRegularity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] + +/-- Smooth dependence in the genuine Hilbert Sobolev topology, with the +representative tied to the given distribution family. -/ +def SmoothSobolev (s : ℝ) (u : P → 𝓢'(E,ℂ)) : Prop := + ∃ f : P → Lp ℂ 2 (volume : Measure E), ContDiff ℝ (⊤ : ℕ∞) f ∧ + ∀ p, sobolevInjection s (f p)=u p + +def SmoothLocalSobolev (Ω : Set E) (s : ℝ) (u : P → 𝓢'(E,ℂ)) : Prop := + ∀ g : E → ℂ, ContDiff ℝ (⊤ : ℕ∞) g → HasCompactSupport g → tsupport g ⊆ Ω → + SmoothSobolev s (fun p => smulLeftCLM ℂ g (u p)) + +namespace SmoothSobolev +variable {s t : ℝ} {u v : P → 𝓢'(E,ℂ)} +lemma add (hu : SmoothSobolev s u) (hv : SmoothSobolev s v) : + SmoothSobolev s (fun p => u p+v p) := by + obtain ⟨f,hf,he⟩ := hu + obtain ⟨g,hg,hg'⟩ := hv + exact ⟨fun p => f p+g p,hf.add hg,fun p => by rw [map_add,he,hg']⟩ +lemma sub (hu : SmoothSobolev s u) (hv : SmoothSobolev s v) : + SmoothSobolev s (fun p => u p-v p) := by + obtain ⟨f,hf,he⟩ := hu + obtain ⟨g,hg,hg'⟩ := hv + exact ⟨fun p => f p-g p,hf.sub hg,fun p => by rw [map_sub,he,hg']⟩ +lemma smul (hu : SmoothSobolev s u) (c : P → ℂ) (hc : ContDiff ℝ (⊤ : ℕ∞) c) : + SmoothSobolev s (fun p => c p • u p) := by + obtain ⟨f,hf,he⟩ := hu + exact ⟨fun p => c p • f p,hc.smul hf,fun p => by rw [map_smul,he]⟩ +lemma zero : SmoothSobolev s (fun _ : P => (0 : 𝓢'(E,ℂ))) := + ⟨fun _ => 0,contDiff_const,fun _ => map_zero _⟩ +lemma sum {ι : Type*} (S : Finset ι) (u : ι → P → 𝓢'(E,ℂ)) + (hu : ∀ i ∈ S, SmoothSobolev s (u i)) : + SmoothSobolev s (fun p => ∑ i ∈ S, u i p) := by + classical + induction S using Finset.induction_on with + | empty => simpa only [Finset.sum_empty] using (zero (s := s) (P := P) (E := E)) + | @insert i S hi ih => + simp only [Finset.sum_insert hi] + exact (hu i (Finset.mem_insert_self _ _)).add + (ih (fun j hj => hu j (Finset.mem_insert_of_mem hj))) +lemma mono (hu : SmoothSobolev s u) (hst : t ≤ s) : SmoothSobolev t u := by + obtain ⟨L,hL⟩ := exists_bounded_sobolev_inclusion (E := E) hst + obtain ⟨f,hf,he⟩ := hu + exact ⟨fun p => L (f p),(L.restrictScalars ℝ).contDiff.comp hf,fun p => (hL _).trans (he p)⟩ +lemma derivative (hu : SmoothSobolev s u) (a : E) : + SmoothSobolev (s-1) (fun p => ∂_{a} (u p)) := by + obtain ⟨L,hL⟩ := exists_bounded_sobolev_derivative (E := E) s a + obtain ⟨f,hf,he⟩ := hu + exact ⟨fun p => L (f p),(L.restrictScalars ℝ).contDiff.comp hf,fun p => by rw [hL,he]⟩ +lemma laplacian_gain (hu : SmoothSobolev s u) + (hΔ : SmoothSobolev (s-1) (fun p => Δ (u p))) : SmoothSobolev (s+1) u := by + obtain ⟨f,hf,he⟩ := hu + obtain ⟨g,hg,hg'⟩ := hΔ + obtain ⟨q,hq,hq'⟩ := smooth_laplacian_gain s f g hf hg (fun p => by rw [he,hg']) + exact ⟨q,hq,fun p => (hq' p).trans (he p)⟩ +end SmoothSobolev + +namespace SmoothLocalSobolev +variable {Ω : Set E} {s t : ℝ} {u v : P → 𝓢'(E,ℂ)} +lemma add (hu : SmoothLocalSobolev Ω s u) (hv : SmoothLocalSobolev Ω s v) : + SmoothLocalSobolev Ω s (fun p => u p+v p) := by + intro g hg hc hs + simpa only [map_add] using (hu g hg hc hs).add (hv g hg hc hs) +lemma sub (hu : SmoothLocalSobolev Ω s u) (hv : SmoothLocalSobolev Ω s v) : + SmoothLocalSobolev Ω s (fun p => u p-v p) := by + intro g hg hc hs + simpa only [map_sub] using (hu g hg hc hs).sub (hv g hg hc hs) +lemma smul (hu : SmoothLocalSobolev Ω s u) (c : P → ℂ) (hc : ContDiff ℝ (⊤ : ℕ∞) c) : + SmoothLocalSobolev Ω s (fun p => c p • u p) := by + intro g hg hcg hs + simpa only [map_smul] using (hu g hg hcg hs).smul c hc +lemma sum {ι : Type*} (S : Finset ι) (u : ι → P → 𝓢'(E,ℂ)) + (hu : ∀ i ∈ S, SmoothLocalSobolev Ω s (u i)) : + SmoothLocalSobolev Ω s (fun p => ∑ i ∈ S, u i p) := by + intro g hg hc hs + simpa only [map_sum] using SmoothSobolev.sum S + (fun i p => smulLeftCLM ℂ g (u i p)) (fun i hi => hu i hi g hg hc hs) +lemma mono (hu : SmoothLocalSobolev Ω s u) (hst : t ≤ s) : SmoothLocalSobolev Ω t u := + fun g hg hc hs => (hu g hg hc hs).mono hst +lemma coeff (hu : SmoothLocalSobolev Ω s u) {a : E → ℂ} (ha : a.HasTemperateGrowth) : + SmoothLocalSobolev Ω s (fun p => smulLeftCLM ℂ a (u p)) := by + intro g hg hc hs + simp only [smulLeftCLM_smulLeftCLM_apply ha (hc.hasTemperateGrowth hg),mul_comm a g] + exact hu (g*a) (hg.mul ha.1) hc.mul_right (tsupport_mul_subset_left.trans hs) +lemma product_derivative (hu : SmoothLocalSobolev Ω s u) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (a : E) : + SmoothSobolev (s-1) (fun p => smulLeftCLM ℂ g (∂_{a} (u p))) := by + have hd := smooth_derivative hg a + have hdc := compact_derivative hc a + have hds := (derivative_support_subset g a).trans hs + have h := ((hu g hg hc hs).derivative a).sub + ((hu _ hd hdc hds).mono (by linarith : s-1 ≤ s)) + simpa only [distribution_leibniz (hc.hasTemperateGrowth hg) a (hdc.hasTemperateGrowth hd), + add_sub_cancel_left] using h +lemma derivative (hu : SmoothLocalSobolev Ω s u) (a : E) : + SmoothLocalSobolev Ω (s-1) (fun p => ∂_{a} (u p)) := + fun _ hg hc hs => hu.product_derivative hg hc hs a +lemma congr (hu : SmoothLocalSobolev Ω s u) (he : ∀ p, LocalEqual Ω (v p) (u p)) : + SmoothLocalSobolev Ω s v := by + intro g hg hc hs + have h : (fun p => smulLeftCLM ℂ g (v p))=(fun p => smulLeftCLM ℂ g (u p)) := + funext (fun p => (he p).cutoff hg hc hs) + rw [h] + exact hu g hg hc hs + +/-- Strong smooth parameter regularity is gained for the actual distribution +family; the proof uses fixed bounded Laplacian graph operators. -/ +lemma laplacian_gain (hu : SmoothLocalSobolev Ω s u) + (hΔ : SmoothLocalSobolev Ω (s-1) (fun p => Δ (u p))) : + SmoothLocalSobolev Ω (s+1) u := by + let b := stdOrthonormalBasis ℝ E + intro g hg hc hs + have hbase := hu g hg hc hs + apply SmoothSobolev.laplacian_gain hbase + simp only [laplacian_product b hg hc] + apply (hΔ g hg hc hs).add + apply SmoothSobolev.sum Finset.univ + intro i _ + have hgd := smooth_derivative hg (b i) + have hcd := compact_derivative hc (b i) + have hsd := (derivative_support_subset g (b i)).trans hs + exact ((hu _ (smooth_derivative hgd (b i)) (compact_derivative hcd (b i)) + ((derivative_support_subset _ (b i)).trans hsd)).mono (by linarith)).add + ((hu.product_derivative hgd hcd hsd (b i)).smul (fun _ => 2) contDiff_const) +end SmoothLocalSobolev +end ElasticityRegularity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution Set +open scoped SchwartzMap LineDeriv Laplacian BigOperators ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] [FiniteDimensional ℝ P] in +lemma smooth_spatial_derivative {a : P × E → ℂ} (ha : ContDiff ℝ (⊤ : ℕ∞) a) (v : E) : + ContDiff ℝ (⊤ : ℕ∞) (fun q : P × E => fderiv ℝ (fun x => a (q.1,x)) q.2 v) := by + have he : (fun q : P × E => fderiv ℝ (fun x => a (q.1,x)) q.2 v)= + (fun q : P × E => fderiv ℝ a q (0,v)) := by + funext q + have hg : HasFDerivAt (fun x : E => (q.1,x)) (ContinuousLinearMap.inr ℝ P E) q.2 := + (hasFDerivAt_const q.1 q.2).prodMk (hasFDerivAt_id q.2) + have hh := (ha.differentiable (by simp) (q.1,q.2)).hasFDerivAt.comp q.2 hg + change fderiv ℝ (a ∘ Prod.mk q.1) q.2 v=_ + rw [hh.fderiv] + rfl + rw [he] + exact (ha.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] [FiniteDimensional ℝ P] in +omit [InnerProductSpace ℝ E] [NormedAddCommGroup P] [NormedSpace ℝ P] in +lemma compact_slice {S : Set E} (hS : IsCompact S) (a : P × E → ℂ) + (hs : ∀ p x, x∉S → a (p,x)=0) (p : P) : HasCompactSupport (fun x => a (p,x)) := by + apply hS.of_isClosed_subset (isClosed_tsupport _) + exact closure_minimal (fun x hx => by contrapose! hx; simpa only [Function.mem_support,not_not] using hs p x hx) hS.isClosed + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] [FiniteDimensional ℝ P] in +omit [NormedAddCommGroup P] [NormedSpace ℝ P] in +lemma spatial_derivative_outside {S : Set E} (hS : IsClosed S) (a : P × E → ℂ) + (hs : ∀ p x, x∉S → a (p,x)=0) (v : E) : + ∀ p x, x∉S → fderiv ℝ (fun y => a (p,y)) x v=0 := by + intro p x hx + apply image_eq_zero_of_notMem_tsupport (f := fun y => fderiv ℝ (fun z => a (p,z)) y v) + intro hh + have ht : tsupport (fun y => a (p,y)) ⊆ S := + closure_minimal (fun y hy => by contrapose! hy; simpa only [Function.mem_support,not_not] using hs p y hy) hS + exact hx (ht (derivative_support_subset (fun y => a (p,y)) v hh)) + +omit [FiniteDimensional ℝ P] in +lemma SmoothSobolev.coordinate_gain {s : ℝ} {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev s u) + (hd : ∀ v : E, SmoothSobolev s (fun p => ∂_{v} (u p))) : + SmoothSobolev (s+1) u := by + apply hu.laplacian_gain + let b := stdOrthonormalBasis ℝ E + have h := SmoothSobolev.sum Finset.univ (fun i p => ∂_{b i} (∂_{b i} (u p))) + (fun i _ => (hd (b i)).derivative (b i)) + simpa only [laplacian_eq_sum b] using h + +lemma SmoothSobolev.variable_zero {S : Set E} (hS : IsCompact S) + (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉S → a (p,x)=0) {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev 0 u) : + SmoothSobolev 0 (fun p => smulLeftCLM ℂ (fun x => a (p,x)) (u p)) := by + let : CompactSpace S := isCompact_iff_compactSpace.mp hS + obtain ⟨b,hb,hbe⟩ := ElasticityCompact.exists_smooth_linf_family hS.measurableSet + (volume : Measure E) a ha hs + obtain ⟨v,hv,he⟩ := hu + simp only [sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + Lp.toTemperedDistributionCLM_apply] at he + let B := (ContinuousLinearMap.mul ℝ ℂ).holderL (volume : Measure E) ∞ 2 2 + refine ⟨fun p => B (b p) (v p),(B.contDiff.comp hb).clm_apply hv,fun p => ?_⟩ + simp only [sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + Lp.toTemperedDistributionCLM_apply] + have ha' : ContDiff ℝ (⊤ : ℕ∞) (fun x => a (p,x)) := + ha.comp (contDiff_const.prodMk contDiff_id) + have hc := compact_slice hS a hs p + have hm := compact_bounded_multiplier ha' hc + have hprod : B (b p) (v p)=(hm.toLp (fun x => a (p,x))) • v p := by + apply Lp.ext + filter_upwards [(ContinuousLinearMap.mul ℝ ℂ).coeFn_holder (r := 2) (b p) (v p), + Lp.coeFn_lpSMul (r := 2) (hm.toLp _) (v p),hm.coeFn_toLp,hbe p] with x h₁ h₂ h₃ h₄ + change ((ContinuousLinearMap.mul ℝ ℂ).holder 2 (b p) (v p)) x=_ + rw [h₁,h₂] + simp only [Pi.smul_apply',h₃,h₄] + rfl + rw [hprod,Lp.toTemperedDistribution_smul_eq (hc.hasTemperateGrowth ha') hm,he] + +/-- Joint smooth coefficient multiplication in the strong Hilbert Sobolev +parameter topology, for each actual nonnegative integral order. -/ +theorem SmoothSobolev.variable_nat {S : Set E} (hS : IsCompact S) + (N : ℕ) (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉S → a (p,x)=0) {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev N u) : + SmoothSobolev N (fun p => smulLeftCLM ℂ (fun x => a (p,x)) (u p)) := by + induction N generalizing a u with + | zero => + rw [Nat.cast_zero] at hu ⊢ + exact SmoothSobolev.variable_zero hS a ha hs hu + | succ N ih => + rw [Nat.cast_add,Nat.cast_one] at hu ⊢ + have hu' := hu.mono (by norm_num : (N : ℝ) ≤ N+1) + apply (ih a ha hs hu').coordinate_gain + intro v + have hd : SmoothSobolev (N : ℝ) (fun p => ∂_{v} (u p)) := by + simpa only [add_sub_cancel_right] using hu.derivative v + have hsum := (ih _ (smooth_spatial_derivative ha v) + (spatial_derivative_outside hS.isClosed a hs v) hu').add (ih a ha hs hd) + convert hsum using 1 + funext p + have ha' : ContDiff ℝ (⊤ : ℕ∞) (fun x => a (p,x)) := + ha.comp (contDiff_const.prodMk contDiff_id) + have hc := compact_slice hS a hs p + exact distribution_leibniz (hc.hasTemperateGrowth ha') v + ((compact_derivative hc v).hasTemperateGrowth (smooth_derivative ha' v)) (u p) +end ElasticityRegularity +namespace ElasticityPlanarDistribution +open MeasureTheory TemperedDistribution Complex +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open ElasticityRegularity +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] +variable {n : Type*} [Fintype n] +lemma SmoothLocalSobolev.dhol {Ω : Set ℂ} {s : ℝ} {u : P → Dist} + (h : ElasticityRegularity.SmoothLocalSobolev Ω s u) : + ElasticityRegularity.SmoothLocalSobolev Ω (s-1) (fun p => dhol (u p)) := + (h.derivative 1).sub ((h.derivative I).smul (fun _ => I) contDiff_const) + +/-- Actual smooth parameter-dependent elliptic gain for the planar system. -/ +theorem smooth_local_gain {Ω : Set ℂ} {s : ℝ} + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (c : P → ℂ) (hc : ContDiff ℝ (⊤ : ℕ∞) c) + (u f : P → n → Dist) + (heq : ∀ p i, LocalEqual Ω (dbar (u p i)) + (f p i+c p • ∑ j, smulLeftCLM ℂ (a i j) (u p j))) + (hu : ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω s (fun p => u p i)) + (hf : ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω s (fun p => f p i)) : + ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω (s+1) (fun p => u p i) := by + intro i + apply (hu i).laplacian_gain + have H := SmoothLocalSobolev.dhol ((hf i).add + ((ElasticityRegularity.SmoothLocalSobolev.sum Finset.univ + (fun j p => smulLeftCLM ℂ (a i j) (u p j)) + (fun j _ => (hu j).coeff (ha i j))).smul c hc)) + apply H.congr + intro p + simpa only [dhol_dbar] using LocalEqual.dhol (heq p i) + +theorem smooth_local_all_orders {Ω : Set ℂ} + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (c : P → ℂ) (hc : ContDiff ℝ (⊤ : ℕ∞) c) + (u f : P → n → Dist) + (heq : ∀ p i, LocalEqual Ω (dbar (u p i)) + (f p i+c p • ∑ j, smulLeftCLM ℂ (a i j) (u p j))) + (hu : ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω 0 (fun p => u p i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω N (fun p => f p i)) : + ∀ N : ℕ, ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω N (fun p => u p i) := by + intro N + induction N with + | zero => simpa only [Nat.cast_zero] using hu + | succ N hN => + rw [Nat.cast_add,Nat.cast_one] + exact smooth_local_gain a ha c hc u f heq hN (hf N) +end ElasticityPlanarDistribution +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution FourierTransform +open scoped SchwartzMap ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +/-- The continuous Sobolev embedding is a genuinely bounded operator, obtained +from the actual Fourier representative and the closed graph theorem. -/ +theorem exists_bounded_continuous_embedding {s : ℝ} (hs : Module.finrank ℝ E < 2*s) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] BoundedContinuousFunction E ℂ, + ∀ f, sobolevInjection s f= + (((L f).memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E)) : 𝓢'(E,ℂ)) := by + let J := Lp.toTemperedDistributionCLM ℂ (volume : Measure E) 1 + have hJ : Function.Injective J := + LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := ℂ)) + obtain ⟨T,hT⟩ := exists_continuous_lift J hJ + ((fourierCLM ℂ 𝓢'(E,ℂ)).comp (sobolevInjection s)) (fun f => by + obtain ⟨v,hv⟩ := (sobolevInjection_mem s f).fourier_memL1 hs + exact ⟨v,hv.symm⟩) + let R : Lp ℂ 1 (volume : Measure E) →L[ℂ] BoundedContinuousFunction E ℂ := + (BoundedContinuousFunction.compContinuousCLM ℂ ℂ (-ContinuousMap.id E)).comp + (Real.Lp.fourierTransformCLM E ℂ) + refine ⟨R.comp T,fun f => ?_⟩ + change sobolevInjection s f= + (((Real.Lp.fourierTransformInv (T f)).memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E)) : 𝓢'(E,ℂ)) + rw [l1_inverse_fourier_distribution] + have h := hT f + change (T f : 𝓢'(E,ℂ))=𝓕 (sobolevInjection s f) at h + rw [h,fourierInv_fourier_eq] + +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] +lemma SmoothSobolev.continuous_representative {s : ℝ} {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev s u) (hs : Module.finrank ℝ E < 2*s) : + ∃ g : P → BoundedContinuousFunction E ℂ, ContDiff ℝ (⊤ : ℕ∞) g ∧ + ∀ p, u p=(((g p).memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E)) : 𝓢'(E,ℂ)) := by + obtain ⟨f,hf,he⟩ := hu + obtain ⟨L,hL⟩ := exists_bounded_continuous_embedding hs + exact ⟨fun p => L (f p),(L.restrictScalars ℝ).contDiff.comp hf,fun p => (he p).symm.trans (hL _)⟩ + +lemma SmoothSobolev.joint_continuous_representative {s : ℝ} {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev s u) (hs : Module.finrank ℝ E < 2*s) : + ∃ g : P → BoundedContinuousFunction E ℂ, + ContDiff ℝ (⊤ : ℕ∞) g ∧ Continuous (fun q : P × E => g q.1 q.2) ∧ + ∀ p, u p=(((g p).memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E)) : 𝓢'(E,ℂ)) := by + obtain ⟨g,hg,he⟩ := hu.continuous_representative hs + exact ⟨g,hg,(hg.continuous.comp continuous_fst).eval continuous_snd,he⟩ +end ElasticityRegularity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal LineDeriv Topology +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +def bcfToLinfty : BoundedContinuousFunction E ℂ →L[ℂ] Lp ℂ ∞ (volume : Measure E) := + LinearMap.mkContinuous + { toFun := fun g => g.memLp_top.toLp _ + map_add' := fun f g => by exact f.memLp_top.toLp_add g.memLp_top + map_smul' := fun c f => by exact f.memLp_top.toLp_const_smul c } 1 (fun g => by + change ‖(g.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E))‖ ≤ 1*‖g‖ + rw [one_mul,Lp.norm_toLp,eLpNorm_exponent_top g.memLp_top.aestronglyMeasurable] + exact (ENNReal.toReal_mono (by simp) + (eLpNormEssSup_le_of_ae_bound (Filter.Eventually.of_forall g.norm_coe_le_norm))).trans_eq + (ENNReal.toReal_ofReal (norm_nonneg g))) +def bcfToDist : BoundedContinuousFunction E ℂ →L[ℂ] 𝓢'(E,ℂ) := + (Lp.toTemperedDistributionCLM ℂ (volume : Measure E) ∞).comp bcfToLinfty +lemma bcfToDist_apply (g : BoundedContinuousFunction E ℂ) : + bcfToDist g=(((g.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E))) : 𝓢'(E,ℂ)) := rfl +lemma bcfToDist_injective : Function.Injective (bcfToDist (E := E)) := by + intro f g h + have hh : (f.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure E))=g.memLp_top.toLp _ := + LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := ℂ)) h + have ha : (f : E → ℂ)=ᵐ[volume] (g : E → ℂ) := + f.memLp_top.coeFn_toLp.symm.trans (hh ▸ g.memLp_top.coeFn_toLp) + exact DFunLike.coe_injective ((f.continuous.ae_eq_iff_eq volume g.continuous).mp ha) +lemma bcf_smooth_of_all_orders (g : BoundedContinuousFunction E ℂ) + (hg : ∀ n : ℕ, MemSobolev n 2 (bcfToDist g)) : + ContDiff ℝ (⊤ : ℕ∞) (g : E → ℂ) := by + obtain ⟨h,hh,he⟩ := all_orders_smooth_representative hg + have : g=h := bcfToDist_injective he + rwa [this] + +/-- Distributional and classical derivatives agree for the actual bounded smooth +representatives. A compact smooth multiplier makes every term Schwartz. -/ +lemma bcf_derivative (g h : BoundedContinuousFunction E ℂ) + (hg : ContDiff ℝ (⊤ : ℕ∞) (g : E → ℂ)) + (hh : ContDiff ℝ (⊤ : ℕ∞) (h : E → ℂ)) (a x : E) + (he : ∂_{a} (bcfToDist g)=bcfToDist h) : + fderiv ℝ (g : E → ℂ) x a=h x := by + obtain ⟨q,_,hc,hq,_,h1⟩ := exists_contDiff_tsupport_subset (x := x) (n := (⊤ : ℕ∞)) + (s := Set.univ) Filter.univ_mem + let c : E → ℂ := fun y => (q y : ℂ) + have hcg : ContDiff ℝ (⊤ : ℕ∞) c := Complex.ofRealCLM.contDiff.comp hq + have hcc : HasCompactSupport c := hc.comp_left Complex.ofReal_zero + have hdg := smooth_derivative hcg a + have hdc := compact_derivative hcc a + let cg : 𝓢(E,ℂ) := (hcc.mul_right : HasCompactSupport (c*(g : E → ℂ))).toSchwartzMap (hcg.mul hg) + let ch : 𝓢(E,ℂ) := (hcc.mul_right : HasCompactSupport (c*(h : E → ℂ))).toSchwartzMap (hcg.mul hh) + let cdg : 𝓢(E,ℂ) := (hdc.mul_right : HasCompactSupport ((fun y => fderiv ℝ c y a)*(g : E → ℂ))).toSchwartzMap (hdg.mul hg) + have hd := distribution_leibniz (hcc.hasTemperateGrowth hcg) a + (hdc.hasTemperateGrowth hdg) (bcfToDist g) + rw [he,bcfToDist_apply,bcfToDist_apply,smooth_Linfty_product hcg hcc g hg, + smooth_Linfty_product hcg hcc h hh,smooth_Linfty_product hdg hdc g hg] at hd + have hdist : ((∂_{a} cg : 𝓢(E,ℂ)) : 𝓢'(E,ℂ))=((cdg+ch : 𝓢(E,ℂ)) : 𝓢'(E,ℂ)) := by + simpa only [← lineDerivOp_toTemperedDistributionCLM_eq,map_add] using hd + have hv := congrArg (fun f : 𝓢(E,ℂ) => f x) (schwartz_dist_injective hdist) + change fderiv ℝ (c*(g : E → ℂ)) x a=fderiv ℝ c x a*g x+c x*h x at hv + rw [fderiv_mul (hcg.differentiable (by simp) x) (hg.differentiable (by simp) x)] at hv + have hx : c x=1 := by simp only [c,h1,Complex.ofReal_one] + simp only [add_apply,smul_apply,smul_eq_mul,hx,one_mul] at hv + linear_combination hv +end ElasticityRegularity +namespace ElasticityRegularity + +section +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal LineDeriv +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] + +lemma bcf_family_spatial_smooth (g : P → BoundedContinuousFunction E ℂ) + (hu : ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (g p))) (p : P) : + ContDiff ℝ (⊤ : ℕ∞) (g p : E → ℂ) := by + apply bcf_smooth_of_all_orders + intro n + obtain ⟨f,_,he⟩ := hu n + dsimp only at he + rw [← he p] + exact sobolevInjection_mem _ _ + +lemma bcf_parameter_derivative (g : P → BoundedContinuousFunction E ℂ) + (hu : ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (g p))) (a : P) : + ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (fderiv ℝ g p a)) := by + intro n + let t : ℕ := n+Module.finrank ℝ E+1 + have ht : Module.finrank ℝ E < 2*(t : ℝ) := by dsimp [t]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) n, Nat.cast_nonneg (α := ℝ) (Module.finrank ℝ E)] + obtain ⟨f,hf,he⟩ := hu t + obtain ⟨T,hT⟩ := exists_bounded_continuous_embedding ht + have hge : g=fun p => T (f p) := by + funext p + apply bcfToDist_injective + exact (he p).symm.trans (hT _) + have hd (p : P) : fderiv ℝ g p a=T (fderiv ℝ f p a) := by + have h := (T.restrictScalars ℝ).hasFDerivAt.comp p (hf.differentiable (by simp) p).hasFDerivAt + change HasFDerivAt (fun p => T (f p)) _ p at h + rw [← hge] at h + exact congrArg (fun L : P →L[ℝ] BoundedContinuousFunction E ℂ => L a) h.fderiv + have h : SmoothSobolev (t : ℝ) (fun p => bcfToDist (fderiv ℝ g p a)) := by + refine ⟨fun p => fderiv ℝ f p a,?_,fun p => ?_⟩ + · exact (hf.fderiv_right (by simp)).clm_apply contDiff_const + · dsimp only + rw [hd] + exact hT _ + exact h.mono (by dsimp [t]; norm_cast; omega) + +/-- Actual spatial derivatives have smoothly parameter-dependent bounded +representatives in every Sobolev order. -/ +lemma bcf_spatial_derivative (g : P → BoundedContinuousFunction E ℂ) + (hu : ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (g p))) (a : E) : + ∃ h : P → BoundedContinuousFunction E ℂ, + ContDiff ℝ (⊤ : ℕ∞) h ∧ + (∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (h p))) ∧ + ∀ p x, fderiv ℝ (g p : E → ℂ) x a=h p x := by + have hd (n : ℕ) : SmoothSobolev n (fun p => ∂_{a} (bcfToDist (g p))) := by + have h := (hu (n+1)).derivative a + convert h using 1; push_cast; ring + let t : ℕ := Module.finrank ℝ E+1 + obtain ⟨h,hh,he⟩ := (hd t).continuous_representative (by dsimp [t]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) (Module.finrank ℝ E)]) + change ∀ p, ∂_{a} (bcfToDist (g p))=bcfToDist (h p) at he + have hs (n : ℕ) : SmoothSobolev n (fun p => bcfToDist (h p)) := by + simpa only [he] using hd n + refine ⟨h,hh,hs,fun p x => ?_⟩ + exact bcf_derivative (g p) (h p) (bcf_family_spatial_smooth g hu p) + (bcf_family_spatial_smooth h hs p) a x (he p) +end +open MeasureTheory TemperedDistribution Filter Topology +open scoped SchwartzMap ENNReal LineDeriv +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] + +lemma bcf_joint_hasFDerivAt (g : P → BoundedContinuousFunction E ℂ) + (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hu : ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (g p))) (q : P × E) : + HasFDerivAt (fun q : P × E => g q.1 q.2) + (((BoundedContinuousFunction.evalCLM ℝ q.2).comp (fderiv ℝ g q.1)).coprod + (fderiv ℝ (g q.1 : E → ℂ) q.2)) q := by + let A : P → E → P →L[ℝ] ℂ := fun p x => + (BoundedContinuousFunction.evalCLM ℝ x).comp (fderiv ℝ g p) + let B : P → E → E →L[ℝ] ℂ := fun p x => fderiv ℝ (g p : E → ℂ) x + have hA : Continuous (fun q : P × E => A q.1 q.2) := by + apply continuous_clm_apply.mpr + intro a + have ht : ContDiff ℝ (⊤ : ℕ∞) (fun p => fderiv ℝ g p a) := + (hg.fderiv_right (by simp)).clm_apply contDiff_const + exact (ht.continuous.comp continuous_fst).eval continuous_snd + have hB : Continuous (fun q : P × E => B q.1 q.2) := by + apply continuous_clm_apply.mpr + intro a + obtain ⟨h,hh,_,he⟩ := bcf_spatial_derivative g hu a + change Continuous (fun q : P × E => fderiv ℝ (g q.1 : E → ℂ) q.2 a) + simp only [he] + exact (hh.continuous.comp continuous_fst).eval continuous_snd + apply (hasStrictFDerivAt_uncurry_coprod (f := fun p x => g p x) + (f₁ := A) (f₂ := B) ?_ ?_ hA.continuousAt hB.continuousAt).hasFDerivAt + · apply Filter.Eventually.of_forall + intro v + exact (BoundedContinuousFunction.evalCLM ℝ v.2).hasFDerivAt.comp v.1 + (hg.differentiable (by simp) v.1).hasFDerivAt + · apply Filter.Eventually.of_forall + intro v + exact ((bcf_family_spatial_smooth g hu v.1).differentiable (by simp) v.2).hasFDerivAt + +/-- Strong smoothness in every Sobolev order yields actual joint smoothness, +including mixed parameter and spatial derivatives. -/ +theorem bcf_joint_smooth (g : P → BoundedContinuousFunction E ℂ) + (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hu : ∀ n : ℕ, SmoothSobolev n (fun p => bcfToDist (g p))) : + ContDiff ℝ (⊤ : ℕ∞) (fun q : P × E => g q.1 q.2) := by + apply contDiff_infty.mpr + intro n + induction n generalizing g with + | zero => + simp only [Nat.cast_zero,contDiff_zero] + exact (hg.continuous.comp continuous_fst).eval continuous_snd + | succ n ih => + rw [Nat.cast_add,Nat.cast_one,contDiff_succ_iff_fderiv_apply] + refine ⟨fun q => (bcf_joint_hasFDerivAt g hg hu q).differentiableAt,by simp,fun a => ?_⟩ + have hp : ContDiff ℝ (⊤ : ℕ∞) (fun p => fderiv ℝ g p a.1) := + (hg.fderiv_right (by simp)).clm_apply contDiff_const + have hpu := bcf_parameter_derivative g hu a.1 + obtain ⟨h,hh,hs,he⟩ := bcf_spatial_derivative g hu a.2 + have hp' := ih (fun p => fderiv ℝ g p a.1) hp hpu + have hs' := ih h hh hs + have hf (q : P × E) : + fderiv ℝ (fun q : P × E => g q.1 q.2) q a= + (fderiv ℝ g q.1 a.1) q.2+h q.1 q.2 := by + rw [(bcf_joint_hasFDerivAt g hg hu q).fderiv] + change (fderiv ℝ g q.1 a.1) q.2+fderiv ℝ (g q.1 : E → ℂ) q.2 a.2=_ + rw [he] + simp only [hf] + exact hp'.add hs' + +theorem SmoothSobolev.joint_smooth_representative {u : P → 𝓢'(E,ℂ)} + (hu : ∀ n : ℕ, SmoothSobolev n u) : + ∃ g : P → BoundedContinuousFunction E ℂ, + ContDiff ℝ (⊤ : ℕ∞) g ∧ ContDiff ℝ (⊤ : ℕ∞) (fun q : P × E => g q.1 q.2) ∧ + ∀ p, u p=bcfToDist (g p) := by + let t : ℕ := Module.finrank ℝ E+1 + obtain ⟨g,hg,he⟩ := (hu t).continuous_representative + (by dsimp [t]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) (Module.finrank ℝ E)]) + change ∀ p, u p=bcfToDist (g p) at he + have hs (n : ℕ) : SmoothSobolev n (fun p => bcfToDist (g p)) := by + rw [← show u=(fun p => bcfToDist (g p)) from funext he] + exact hu n + exact ⟨g,hg,bcf_joint_smooth g hg hs,he⟩ +end ElasticityRegularity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] + +/-- Joint smoothness on an arbitrary smaller fixed open set. The representative +is an actual Schwartz function in space for every parameter. -/ +theorem SmoothLocalSobolev.joint_schwartz_representative {Ω Ω' : Set E} + (u : P → 𝓢'(E,ℂ)) (hu : ∀ N : ℕ, SmoothLocalSobolev Ω N u) + {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ f : P → 𝓢(E,ℂ), ContDiff ℝ (⊤ : ℕ∞) (fun q : P × E => f q.1 q.2) ∧ + ∀ p, LocalEqual Ω' (u p) (f p : 𝓢'(E,ℂ)) := by + obtain ⟨v,_,hv,he⟩ := SmoothSobolev.joint_smooth_representative + (fun N => hu N g hg hc hs) + have hvs (p : P) : ContDiff ℝ (⊤ : ℕ∞) (v p : E → ℂ) := + hv.comp (contDiff_const.prodMk contDiff_id) + let f : P → 𝓢(E,ℂ) := fun p => + (hc.mul_right : HasCompactSupport (g*(v p : E → ℂ))).toSchwartzMap (hg.mul (hvs p)) + refine ⟨f,?_,fun p => ?_⟩ + · change ContDiff ℝ (⊤ : ℕ∞) (fun q : P × E => g q.2*v q.1 q.2) + exact (hg.comp contDiff_snd).mul hv + · have he' := smooth_Linfty_product hg hc (v p) (hvs p) + have hl := (LocalEqual.cutoff_one (u p) (hc.hasTemperateGrowth hg) h1).symm + have hl' := (LocalEqual.cutoff_one (smulLeftCLM ℂ g (u p)) (hc.hasTemperateGrowth hg) h1).symm + have h := hl.trans hl' + rw [he p] at h + exact h.trans (by intro φ _ _; exact congrArg (fun T : 𝓢'(E,ℂ) => T φ) he') +end ElasticityRegularity +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Complex +open scoped SchwartzMap ENNReal LineDeriv BigOperators +variable {n : Type*} [Fintype n] +open ElasticityRegularity + +def schwartzDbar (v : 𝓢(ℂ,ℂ)) : 𝓢(ℂ,ℂ) := ∂_{(1 : ℂ)} v+I • ∂_{I} v +lemma dbar_schwartz (v : 𝓢(ℂ,ℂ)) : + ElasticityPlanarDistribution.dbar (v : 𝓢'(ℂ,ℂ))=(schwartzDbar v : 𝓢'(ℂ,ℂ)) := by + simp only [ElasticityPlanarDistribution.dbar,schwartzDbar, + TemperedDistribution.lineDerivOp_toTemperedDistributionCLM_eq] + rw [map_add,map_smul] +lemma LocalEqual.dbar {Ω : Set ℂ} {u v : 𝓢'(ℂ,ℂ)} (h : LocalEqual Ω u v) : + LocalEqual Ω (ElasticityPlanarDistribution.dbar u) (ElasticityPlanarDistribution.dbar v) := + (h.derivative 1).add ((h.derivative I).smul I) + +lemma LocalEqual.coeff {Ω : Set ℂ} {u v : 𝓢'(ℂ,ℂ)} (h : LocalEqual Ω u v) + {a : ℂ → ℂ} (ha : a.HasTemperateGrowth) : + LocalEqual Ω (smulLeftCLM ℂ a u) (smulLeftCLM ℂ a v) := by + intro φ hc hs + change u (SchwartzMap.smulLeftCLM ℂ a φ)=v (SchwartzMap.smulLeftCLM ℂ a φ) + apply h + · simpa only [SchwartzMap.smulLeftCLM_apply ha,Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (hc.mul_left : HasCompactSupport (a*(φ : ℂ → ℂ))) + · simpa only [SchwartzMap.smulLeftCLM_apply ha,Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (tsupport_mul_subset_right (f := a) (g := (φ : ℂ → ℂ))).trans hs + +/-- The actual matrix Cauchy--Riemann equation is solvable smoothly on every +smaller open set. The unknown is produced by the supported estimate and Hilbert +space duality, and the smooth solution is the same L2 solution almost everywhere. +No pre-existing local or global frame is used. -/ +theorem exists_planar_classical_solution {S Ω Ω' : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (f : n → 𝓢(ℂ,ℂ)) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ w : Hilbert n, ∃ v : n → 𝓢(ℂ,ℂ), + (∀ i, ∀ᵐ z ∂(volume : Measure ℂ), z ∈ Ω' → w i z=v i z) ∧ + ∀ i, Set.EqOn (fun z => schwartzDbar (v i) z+∑ j, a i j z*v j z) (f i) Ω' := by + obtain ⟨C,hC,T,hT,heq⟩ := exists_planar_weak_inverse hS a (fun i j => (ha i j).1) + let f' : Hilbert n := WithLp.toLp 2 (fun i => (f i).toLp 2 volume) + let w : Hilbert n := T f' + have he : ∀ i, LocalEqual Ω (ElasticityPlanarDistribution.dbar (w i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (w j : 𝓢'(ℂ,ℂ))) (f i : 𝓢'(ℂ,ℂ)) := by + intro i + have hh := weak_to_local_equation Ω S hΩS a ha w f' (heq f') i + simpa only [f',WithLp.ofLp_toLp,Lp.toTemperedDistribution_toLp_eq] using hh + have he' : ElasticityPlanarDistribution.Equation Ω (fun i j z => -a i j z) + (fun j => (w j : 𝓢'(ℂ,ℂ))) (fun j => (f j : 𝓢'(ℂ,ℂ))) := by + intro i φ hφ hφs + have hh := he i φ hφ hφs + simp only [add_apply,sum_apply,smulLeftCLM_apply_apply] at hh ⊢ + have hn (j : n) : SchwartzMap.smulLeftCLM ℂ (fun z => -a i j z) φ = + -SchwartzMap.smulLeftCLM ℂ (a i j) φ := by + ext z + change (SchwartzMap.smulLeftCLM ℂ (-(a i j)) φ) z = _ + simp only [SchwartzMap.smulLeftCLM_apply_apply ((ha i j).neg), + SchwartzMap.smulLeftCLM_apply_apply (ha i j),neg_apply,Pi.neg_apply,smul_eq_mul,neg_mul] + simp only [hn,map_neg,Finset.sum_neg_distrib] + linear_combination hh + have hall := ElasticityPlanarDistribution.local_all_orders (fun i j z => -a i j z) + (fun i j => (ha i j).neg) (fun j => (w j : 𝓢'(ℂ,ℂ))) (fun j => (f j : 𝓢'(ℂ,ℂ))) he' + (fun j => MemSobolev.local_zero (memSobolev_zero_iff.mpr ⟨w j,rfl⟩) Ω) + (fun N j g hg hc _ => sobolev_nat_product Complex.orthonormalBasisOneI N hg hc (f j).memSobolev) + have hv : ∀ i : n, ∃ v : 𝓢(ℂ,ℂ), LocalEqual Ω' (w i : 𝓢'(ℂ,ℂ)) (v : 𝓢'(ℂ,ℂ)) ∧ + ∀ᵐ z ∂(volume : Measure ℂ), z ∈ Ω' → w i z=v z := by + intro i + exact local_schwartz_l2_representative hΩ' (w i) (fun N => hall N i) hg hc hs h1 + choose v hv hev using hv + refine ⟨w,v,hev,fun i => ?_⟩ + let q : 𝓢(ℂ,ℂ) := schwartzDbar (v i)+∑ j, SchwartzMap.smulLeftCLM ℂ (a i j) (v j) + have hq : (q : 𝓢'(ℂ,ℂ))=ElasticityPlanarDistribution.dbar (v i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (v j : 𝓢'(ℂ,ℂ)) := by + simp only [q,map_add,map_sum,← dbar_schwartz] + congr 1 + exact Finset.sum_congr rfl (fun j _ => (distribution_schwartz_product (ha i j) (v j)).symm) + have hqq : LocalEqual Ω' (q : 𝓢'(ℂ,ℂ)) (f i : 𝓢'(ℂ,ℂ)) := by + rw [hq] + have hh := (LocalEqual.dbar (hv i)).add (LocalEqual.sum Finset.univ (fun j _ => LocalEqual.coeff (hv j) (ha i j))) + exact fun φ hφ hφs => (hh φ hφ hφs).symm.trans (he i φ hφ (hφs.trans hsub)) + have hpoint := hqq.schwartz_eqOn hΩ' + intro z hz + have hp := hpoint hz + simpa only [q,add_apply,sum_apply,SchwartzMap.smulLeftCLM_apply_apply (ha i _),smul_eq_mul] using hp +end ElasticityPlanar +section +open MeasureTheory TemperedDistribution Set +open scoped SchwartzMap ENNReal BigOperators +namespace ElasticityRegularity +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] +lemma SmoothSobolev.local_nat {N : ℕ} {u : P → 𝓢'(E,ℂ)} + (hu : SmoothSobolev N u) (Ω : Set E) : SmoothLocalSobolev Ω N u := by + intro g hg hc _ + obtain ⟨u,hu,he⟩ := hu + obtain ⟨L,hL⟩ := exists_bounded_nat_multiplier N hg hc + exact ⟨fun p => L (u p),(L.restrictScalars ℝ).contDiff.comp hu,fun p => by rw [hL,he]⟩ +lemma smoothSobolev_schwartz_const (N : ℕ) (f : 𝓢(E,ℂ)) : + SmoothSobolev N (fun _ : P => (f : 𝓢'(E,ℂ))) := by + obtain ⟨v,hv⟩ := (memSobolev_iff_range (N:ℝ) (f : 𝓢'(E,ℂ))).mp f.memSobolev + exact ⟨fun _ => v,contDiff_const,fun _ => hv⟩ +end ElasticityRegularity + +namespace ElasticityPlanar +open ElasticityRegularity +variable {n : Type*} [Fintype n] +/-- The weak inverse along the entire coefficient homotopy has actual joint smooth +classical representatives with the exact prescribed source. This is the linear +PDE input to the frame homotopy, not an assumed family of invertible frames. -/ +theorem exists_classical_homotopy {S Ω Ω' : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hac : ∀ i j, HasCompactSupport (a i j)) (f : n → 𝓢(ℂ,ℂ)) + {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : ℝ → n → 𝓢(ℂ,ℂ), + (∀ i, ContDiff ℝ (⊤ : ℕ∞) (fun q : ℝ × ℂ => v q.1 i q.2)) ∧ + ∀ s i, Set.EqOn (fun z => schwartzDbar (v s i) z+∑ j, (s:ℂ)*a i j z*v s j z) (f i) Ω' := by + obtain ⟨T,hT,heq⟩ := global_homotopy_inverse hS hΩS a ha hac + let f' : Hilbert n := WithLp.toLp 2 (fun i => (f i).toLp 2 volume) + let w : ℝ → Hilbert n := fun s => T s f' + let u : ℝ → n → 𝓢'(ℂ,ℂ) := fun s i => (w s i : 𝓢'(ℂ,ℂ)) + have hw : ContDiff ℝ (⊤ : ℕ∞) w := + ((ContinuousLinearMap.apply ℂ (Hilbert n) f').restrictScalars ℝ).contDiff.comp hT + have hat (i j : n) : (a i j).HasTemperateGrowth := (hac i j).hasTemperateGrowth (ha i j) + have hscaled (s : ℝ) (i j : n) : (fun z => (s:ℂ)*a i j z).HasTemperateGrowth := + Function.HasTemperateGrowth.mul (Function.HasTemperateGrowth.const (s:ℂ)) (hat i j) + have he (s : ℝ) (i : n) : LocalEqual Ω + (ElasticityPlanarDistribution.dbar (u s i)+ + ∑ j, smulLeftCLM ℂ (fun z => (s:ℂ)*a i j z) (u s j)) (f i : 𝓢'(ℂ,ℂ)) := by + simpa only [f',WithLp.ofLp_toLp,Lp.toTemperedDistribution_toLp_eq] using heq s f' i + have hm (s : ℝ) (i j : n) : smulLeftCLM ℂ (fun z => (s:ℂ)*a i j z) (u s j)= + (s:ℂ) • smulLeftCLM ℂ (a i j) (u s j) := by + change smulLeftCLM ℂ ((s:ℂ) • (a i j)) (u s j) = _ + rw [smulLeftCLM_smul (hat i j),smul_apply] + have he' (s : ℝ) (i : n) : LocalEqual Ω (ElasticityPlanarDistribution.dbar (u s i)) + ((f i : 𝓢'(ℂ,ℂ))+(-(s:ℂ)) • ∑ j, smulLeftCLM ℂ (a i j) (u s j)) := by + intro φ hφ hφs + have h := he s i φ hφ hφs + simp only [hm,← Finset.smul_sum,add_apply,smul_apply,smul_eq_mul,neg_mul] at h ⊢ + linear_combination h + have hu (i : n) : SmoothLocalSobolev Ω 0 (fun s => u s i) := by + have hzero : SmoothSobolev 0 (fun s => u s i) := by + let L : Hilbert n →L[ℂ] PL2 := (ContinuousLinearMap.proj i).comp + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).toContinuousLinearMap + refine ⟨fun s => L (w s),(L.restrictScalars ℝ).contDiff.comp hw,fun s => ?_⟩ + simp only [sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + Lp.toTemperedDistributionCLM_apply] + rfl + simpa only [Nat.cast_zero] using + (SmoothSobolev.local_nat (N := 0) (u := fun s => u s i) + (by simpa only [Nat.cast_zero] using hzero) Ω) + have hall := ElasticityPlanarDistribution.smooth_local_all_orders a hat + (fun s : ℝ => -(s:ℂ)) (Complex.ofRealCLM.contDiff.neg) + u (fun _ i => (f i : 𝓢'(ℂ,ℂ))) he' hu + (fun N i => (smoothSobolev_schwartz_const (P := ℝ) N (f i)).local_nat Ω) + have hv (i : n) : ∃ v : ℝ → 𝓢(ℂ,ℂ), + ContDiff ℝ (⊤ : ℕ∞) (fun q : ℝ × ℂ => v q.1 q.2) ∧ + ∀ s, LocalEqual Ω' (u s i) (v s : 𝓢'(ℂ,ℂ)) := + SmoothLocalSobolev.joint_schwartz_representative (fun s => u s i) + (fun N => hall N i) hg hc hs h1 + choose v hv hv' using hv + refine ⟨fun s i => v i s,hv,fun s i => ?_⟩ + let q : 𝓢(ℂ,ℂ) := schwartzDbar (v i s)+ + ∑ j, SchwartzMap.smulLeftCLM ℂ (fun z => (s:ℂ)*a i j z) (v j s) + have hq : (q : 𝓢'(ℂ,ℂ))=ElasticityPlanarDistribution.dbar (v i s : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (fun z => (s:ℂ)*a i j z) (v j s : 𝓢'(ℂ,ℂ)) := by + simp only [q,map_add,map_sum,← dbar_schwartz] + congr 1 + exact Finset.sum_congr rfl (fun j _ => (distribution_schwartz_product (hscaled s i j) (v j s)).symm) + have hqq : LocalEqual Ω' (q : 𝓢'(ℂ,ℂ)) (f i : 𝓢'(ℂ,ℂ)) := by + rw [hq] + have hh := (LocalEqual.dbar (hv' i s)).add (LocalEqual.sum Finset.univ + (fun j _ => LocalEqual.coeff (hv' j s) (hscaled s i j))) + exact fun φ hφ hφs => (hh φ hφ hφs).symm.trans (he s i φ hφ (hφs.trans hsub)) + intro z hz + have hp := hqq.schwartz_eqOn hΩ' hz + simpa only [q,add_apply,sum_apply,SchwartzMap.smulLeftCLM_apply_apply (hscaled s i _),smul_eq_mul] using hp +end ElasticityPlanar + +end +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution Set +open scoped ENNReal SchwartzMap BigOperators +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +omit [MeasurableSpace E] [BorelSpace E] in +lemma exists_schwartz_one_on_compact {K : Set E} (hK : IsCompact K) : + ∃ g : 𝓢(E,ℂ), Set.EqOn g 1 K := by + obtain ⟨R,hR,hKR⟩ := hK.isBounded.exists_pos_norm_le + let b : ContDiffBump (0 : E) := ⟨R,R+1,hR,by simp⟩ + have hc : HasCompactSupport (fun x : E => (b x : ℂ)) := + b.hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + have hg : ContDiff ℝ (⊤ : ℕ∞) (fun x : E => (b x : ℂ)) := + Complex.ofRealCLM.contDiff.comp b.contDiff + refine ⟨hc.toSchwartzMap hg,fun x hx => ?_⟩ + change (b x : ℂ)=1 + rw [b.one_of_mem_closedBall (by simpa only [Metric.mem_closedBall,dist_zero_right] using hKR x hx)] + rfl +/-- The actual Schwartz representatives of joint smooth uniform-compact-support +families vary smoothly in every nonnegative Hilbert Sobolev norm. -/ +theorem compact_smooth_sobolev {K : Set E} (hK : IsCompact K) + (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉K → a (p,x)=0) : + ∃ f : P → 𝓢(E,ℂ), (∀ p x, f p x=a (p,x)) ∧ + ∀ N : ℕ, SmoothSobolev N (fun p => (f p : 𝓢'(E,ℂ))) := by + obtain ⟨g,hg⟩ := exists_schwartz_one_on_compact hK + have hat (p : P) : (fun x => a (p,x)).HasTemperateGrowth := + (compact_slice hK a hs p).hasTemperateGrowth (ha.comp (contDiff_const.prodMk contDiff_id)) + let f : P → 𝓢(E,ℂ) := fun p => SchwartzMap.smulLeftCLM ℂ (fun x => a (p,x)) g + refine ⟨f,fun p x => ?_,fun N => ?_⟩ + · change SchwartzMap.smulLeftCLM ℂ (fun x => a (p,x)) g x=_ + rw [SchwartzMap.smulLeftCLM_apply_apply (hat p),smul_eq_mul] + by_cases hx : x∈K + · rw [hg hx,Pi.one_apply,mul_one] + · rw [hs p x hx,zero_mul] + · have H := (smoothSobolev_schwartz_const (P := P) N g).variable_nat hK N a ha hs + convert H using 1 + funext p + exact (distribution_schwartz_product (hat p) g).symm +end ElasticityRegularity +section +open MeasureTheory TemperedDistribution Set Complex +open scoped SchwartzMap LineDeriv Laplacian BigOperators +namespace ElasticityRegularity +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +lemma SmoothLocalSobolev.variable_nat {Ω S : Set E} (hS : IsCompact S) + (N : ℕ) (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉S → a (p,x)=0) {u : P → 𝓢'(E,ℂ)} + (hu : SmoothLocalSobolev Ω N u) : + SmoothLocalSobolev Ω N (fun p => smulLeftCLM ℂ (fun x => a (p,x)) (u p)) := by + intro g hg hc hgs + have H := (hu g hg hc hgs).variable_nat hS N a ha hs + convert H using 1 + funext p + have hat : (fun x => a (p,x)).HasTemperateGrowth := + (compact_slice hS a hs p).hasTemperateGrowth (ha.comp (contDiff_const.prodMk contDiff_id)) + rw [smulLeftCLM_smulLeftCLM_apply (hc.hasTemperateGrowth hg) hat, + smulLeftCLM_smulLeftCLM_apply hat (hc.hasTemperateGrowth hg),mul_comm g] +end ElasticityRegularity +namespace ElasticityPlanarDistribution +open ElasticityRegularity +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +variable {n : Type*} [Fintype n] +/-- The full variable-coefficient planar weak equation has strong smooth +parameter regularity at every spatial order. -/ +theorem smooth_variable_all_orders {Ω S : Set ℂ} (hS : IsCompact S) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉S → a i j (p,z)=0) + (u f : P → n → Dist) + (heq : ∀ p i, LocalEqual Ω (dbar (u p i)) + (f p i+∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j))) + (hu : ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω 0 (fun p => u p i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω N (fun p => f p i)) : + ∀ N : ℕ, ∀ i, ElasticityRegularity.SmoothLocalSobolev Ω N (fun p => u p i) := by + intro N + induction N with + | zero => simpa only [Nat.cast_zero] using hu + | succ N ih => + rw [Nat.cast_add,Nat.cast_one] + intro i + apply (ih i).laplacian_gain + have H := SmoothLocalSobolev.dhol ((hf N i).add + (ElasticityRegularity.SmoothLocalSobolev.sum Finset.univ + (fun j p => smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j)) + (fun j _ => (ih j).variable_nat hS N (a i j) (ha i j) (hs i j)))) + apply H.congr + intro p + simpa only [dhol_dbar] using LocalEqual.dhol (heq p i) +end ElasticityPlanarDistribution + +end +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Set +open scoped SchwartzMap ENNReal BigOperators +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +/-- Actual smooth classical solutions for arbitrary joint smooth compactly +supported planar coefficient and source families. -/ +theorem exists_classical_variable {S Ω Ω' K : Set ℂ} (hS : IsCompact S) + (hΩS : Ω ⊆ S) (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hac : ∀ i j p z, z∉K → a i j (p,z)=0) + (f : n → P × ℂ → ℂ) (hf : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfc : ∀ i p z, z∉K → f i (p,z)=0) + {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : P → n → 𝓢(ℂ,ℂ), + (∀ i, ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 i q.2)) ∧ + ∀ p i, Set.EqOn (fun z => schwartzDbar (v p i) z+∑ j, a i j (p,z)*v p j z) + (fun z => f i (p,z)) Ω' := by + choose F hFe hF using fun i => compact_smooth_sobolev hK (f i) (hf i) (hfc i) + have hF₀ (i : n) : ∃ w : P → PL2, ContDiff ℝ (⊤ : ℕ∞) w ∧ + ∀ p, (w p : 𝓢'(ℂ,ℂ))=(F i p : 𝓢'(ℂ,ℂ)) := by + obtain ⟨w,hw,he⟩ := hF i 0 + simp only [Nat.cast_zero,sobolevInjection,neg_zero,besselPotential_zero, + ContinuousLinearMap.id_comp,Lp.toTemperedDistributionCLM_apply] at he + exact ⟨w,hw,he⟩ + choose W hW hWe using hF₀ + let rhs : P → Hilbert n := fun p => WithLp.toLp 2 (fun i => W i p) + have hrhs : ContDiff ℝ (⊤ : ℕ∞) rhs := + ((PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).symm.toContinuousLinearMap.restrictScalars ℝ).contDiff.comp + (contDiff_pi.mpr hW) + obtain ⟨T,hT,heq⟩ := global_variable_inverse hS hΩS hK a ha hac + let w : P → Hilbert n := fun p => T p (rhs p) + let u : P → n → 𝓢'(ℂ,ℂ) := fun p i => (w p i : 𝓢'(ℂ,ℂ)) + have hw : ContDiff ℝ (⊤ : ℕ∞) w := complex_clm_apply_smooth hT hrhs + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hac i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + have he (p : P) (i : n) : LocalEqual Ω + (ElasticityPlanarDistribution.dbar (u p i)+ + ∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j)) (F i p : 𝓢'(ℂ,ℂ)) := by + simpa only [planarOperator_apply,rhs,WithLp.ofLp_toLp,hWe] using heq p (rhs p) i + have he' (p : P) (i : n) : LocalEqual Ω (ElasticityPlanarDistribution.dbar (u p i)) + ((F i p : 𝓢'(ℂ,ℂ))+∑ j, smulLeftCLM ℂ (fun z => -(a i j (p,z))) (u p j)) := by + intro φ hφ hφs + have h := he p i φ hφ hφs + have hn (j : n) : smulLeftCLM ℂ (fun z => -(a i j (p,z))) (u p j)= + -smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j) := by + change smulLeftCLM ℂ (-(fun z => a i j (p,z))) (u p j)=_ + rw [smulLeftCLM_neg (hat p i j),neg_apply] + simp only [hn,Finset.sum_neg_distrib,add_apply,neg_apply] at h ⊢ + linear_combination h + have hu (i : n) : SmoothLocalSobolev Ω 0 (fun p => u p i) := by + have hz : SmoothSobolev 0 (fun p => u p i) := by + let L : Hilbert n →L[ℂ] PL2 := (ContinuousLinearMap.proj i).comp + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).toContinuousLinearMap + refine ⟨fun p => L (w p),(L.restrictScalars ℝ).contDiff.comp hw,fun p => ?_⟩ + simp only [sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + Lp.toTemperedDistributionCLM_apply] + rfl + simpa only [Nat.cast_zero] using (SmoothSobolev.local_nat (N := 0) (by simpa only [Nat.cast_zero] using hz) Ω) + have hall := ElasticityPlanarDistribution.smooth_variable_all_orders hK + (fun i j q => -(a i j q)) (fun i j => (ha i j).neg) + (fun i j p z hz => by rw [hac i j p z hz,neg_zero]) + u (fun p i => (F i p : 𝓢'(ℂ,ℂ))) he' hu + (fun N i => (hF i N).local_nat Ω) + have hv (i : n) : ∃ v : P → 𝓢(ℂ,ℂ), + ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 q.2) ∧ + ∀ p, LocalEqual Ω' (u p i) (v p : 𝓢'(ℂ,ℂ)) := + SmoothLocalSobolev.joint_schwartz_representative (fun p => u p i) + (fun N => hall N i) hg hc hs h1 + choose v hv hv' using hv + refine ⟨fun p i => v i p,hv,fun p i => ?_⟩ + let q : 𝓢(ℂ,ℂ) := schwartzDbar (v i p)+ + ∑ j, SchwartzMap.smulLeftCLM ℂ (fun z => a i j (p,z)) (v j p) + have hq : (q : 𝓢'(ℂ,ℂ))=ElasticityPlanarDistribution.dbar (v i p : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (v j p : 𝓢'(ℂ,ℂ)) := by + simp only [q,map_add,map_sum,← dbar_schwartz] + congr 1 + exact Finset.sum_congr rfl (fun j _ => (distribution_schwartz_product (hat p i j) (v j p)).symm) + have hqq : LocalEqual Ω' (q : 𝓢'(ℂ,ℂ)) (F i p : 𝓢'(ℂ,ℂ)) := by + rw [hq] + have hh := (LocalEqual.dbar (hv' i p)).add (LocalEqual.sum Finset.univ + (fun j _ => LocalEqual.coeff (hv' j p) (hat p i j))) + exact fun φ hφ hφs => (hh φ hφ hφs).symm.trans (he p i φ hφ (hφs.trans hsub)) + intro z hz + have hp := hqq.schwartz_eqOn hΩ' hz + simpa only [q,add_apply,sum_apply,SchwartzMap.smulLeftCLM_apply_apply (hat p i _),smul_eq_mul,hFe] using hp +end ElasticityPlanar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/PhysicalCGO.lean b/lean/OAI/MathematicalPhysics/Elasticity/PhysicalCGO.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8e55db84ba7021e2f2088f8dab396d2a802eab7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/PhysicalCGO.lean @@ -0,0 +1,1219 @@ +import OAI.MathematicalPhysics.Elasticity.CommonExterior +import OAI.MathematicalPhysics.Elasticity.Recovery + +namespace OAI + +noncomputable section + +namespace ElasticityAugmented + +section +open scoped BigOperators + +def smoothOfReal (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) : Smooth := + ⟨fun x => (f x : ℂ),Complex.ofRealCLM.contDiff.comp hf⟩ +lemma smoothOfReal_apply (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (x : X) : + (smoothOfReal f hf : X → ℂ) x=(f x : ℂ) := rfl +lemma coord_ofReal (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) (x : X) : + (coord i (smoothOfReal f hf) : X → ℂ) x=(fderiv ℝ f x (e i) : ℂ) := by + have hh := Complex.ofRealCLM.hasFDerivAt.comp x ((hf.differentiable (by simp)) x).hasFDerivAt + exact congrArg (fun L : X →L[ℝ] ℂ => L (e i)) hh.fderiv +lemma recovery_basis (i : Fin 3) : ElasticityRecovery.basis i=e i := by + simp [ElasticityRecovery.basis,e,EuclideanSpace.basisFun_apply] +lemma coord_ofReal_grad (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) (x : X) : + (coord i (smoothOfReal f hf) : X → ℂ) x=(ElasticityRecovery.grad f x i : ℂ) := by + rw [coord_ofReal] + simp only [ElasticityRecovery.grad,ElasticityFiniteType.D,recovery_basis] + +def positiveRoot (m : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hp : ∀ x,0 < m x) : Smooth := + smoothOfReal (fun x => Real.sqrt (m x)) (hm.sqrt (fun x => (hp x).ne')) +lemma positiveRoot_nonzero (m : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hp : ∀ x,0 < m x) (x : X) : + (positiveRoot m hm hp : X → ℂ) x≠0 := by + exact Complex.ofReal_ne_zero.mpr (Real.sqrt_pos.mpr (hp x)).ne' +lemma positiveRoot_square (m : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hp : ∀ x,0 < m x) : + positiveRoot m hm hp*positiveRoot m hm hp=smoothOfReal m hm := by + apply Subtype.ext + funext x + change (Real.sqrt (m x) : ℂ)*(Real.sqrt (m x) : ℂ)=(m x : ℂ) + norm_cast + exact Real.mul_self_sqrt (hp x).le + +def smoothLog (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hp : ∀ x,0 < f x) : Smooth := + smoothOfReal (fun x => Real.log (f x)) (hf.log (fun x => (hp x).ne')) +lemma coord_real_log (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hp : ∀ x,0 < f x) (i : Fin 3) : + coord i (smoothLog f hf hp)= + smoothInv (smoothOfReal f hf) (fun x => Complex.ofReal_ne_zero.mpr (hp x).ne')* + coord i (smoothOfReal f hf) := by + apply Subtype.ext + funext x + rw [smoothLog,coord_ofReal] + rw [fderiv.log ((hf.differentiable (by simp)) x) (hp x).ne'] + simp only [smul_apply,smul_eq_mul,Complex.ofReal_mul,Complex.ofReal_inv] + change (f x : ℂ)⁻¹*(fderiv ℝ f x (e i) : ℂ)=_ + change _ = (f x : ℂ)⁻¹ * (coord i (smoothOfReal f hf) : X → ℂ) x + rw [coord_ofReal] +lemma direction_real_log (θ : Fin 3 → ℂ) (f : X → ℝ) + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hp : ∀ x,0 < f x) : + direction (A := Smooth) coord θ (smoothLog f hf hp)= + smoothInv (smoothOfReal f hf) (fun x => Complex.ofReal_ne_zero.mpr (hp x).ne')* + direction (A := Smooth) coord θ (smoothOfReal f hf) := by + simp only [direction,coord_real_log,Finset.mul_sum,Algebra.smul_def] + apply Finset.sum_congr rfl + intro i _ + ring +lemma logarithmicGrad_root (m : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hp : ∀ x,0 < m x) (i : Fin 3) : + logarithmicGrad (positiveRoot m hm hp) (positiveRoot_nonzero m hm hp) i=coord i (smoothLog m hm hp) := by + rw [coord_real_log] + have hderiv := congrArg (coord i) (positiveRoot_square m hm hp) + rw [partial_mul] at hderiv + apply Subtype.ext + funext point + have hvalue := congrArg (fun value : Smooth => (value : X → ℂ) point) hderiv + change (coord i (positiveRoot m hm hp) : X → ℂ) point * (Real.sqrt (m point) : ℂ) + + (Real.sqrt (m point) : ℂ) * (coord i (positiveRoot m hm hp) : X → ℂ) point = + (coord i (smoothOfReal m hm) : X → ℂ) point at hvalue + change 2 * (Real.sqrt (m point) : ℂ)⁻¹ * + (coord i (positiveRoot m hm hp) : X → ℂ) point = + (m point : ℂ)⁻¹ * (coord i (smoothOfReal m hm) : X → ℂ) point + have hroot : (Real.sqrt (m point) : ℂ)^2=(m point : ℂ) := by + norm_cast + exact Real.sq_sqrt (hp point).le + have hzero : (Real.sqrt (m point) : ℂ)≠0 := positiveRoot_nonzero m hm hp point + rw [← hvalue,← hroot] + field_simp [hzero] + ring + +lemma ofReal_direction (θ : Fin 3 → ℂ) (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (x : X) : + (direction (A := Smooth) coord θ (smoothOfReal f hf) : X → ℂ) x=ElasticityRecovery.dir θ f x := by + simp only [direction,ElasticityRecovery.dir,dotProduct,Fin.sum_univ_three, + Subalgebra.coe_add,Subalgebra.coe_smul,Pi.add_apply,Pi.smul_apply,smul_eq_mul,coord_ofReal_grad] + +lemma smoothOfReal_add (f g : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) : + smoothOfReal f hf+smoothOfReal g hg=smoothOfReal (fun x => f x+g x) (hf.add hg) := by + apply Subtype.ext + funext x + exact (Complex.ofReal_add _ _).symm +lemma smoothLog_div (f g : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hp : ∀ x,0 < f x) (hq : ∀ x,0 < g x) : + smoothLog (fun x => f x/g x) (hf.div hg (fun x => (hq x).ne')) (fun x => div_pos (hp x) (hq x))= + smoothLog f hf hp-smoothLog g hg hq := by + apply Subtype.ext + funext x + change (Real.log (f x/g x) : ℂ)=(Real.log (f x) : ℂ)-(Real.log (g x) : ℂ) + exact_mod_cast Real.log_div (hp x).ne' (hq x).ne' +lemma real_sum_nonzero (m k : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hk : ContDiff ℝ (⊤ : ℕ∞) k) (hmp : ∀ x,0 < m x) (hkp : ∀ x,0 < k x) (x : X) : + ((smoothOfReal k hk+positiveRoot m hm hmp*positiveRoot m hm hmp : Smooth) : X → ℂ) x≠0 := by + rw [positiveRoot_square,smoothOfReal_add,smoothOfReal_apply] + exact Complex.ofReal_ne_zero.mpr (add_pos (hkp x) (hmp x)).ne' + +lemma direction_sub (θ : Fin 3 → ℂ) (f g : Smooth) : + direction (A := Smooth) coord θ (f-g)=direction (A := Smooth) coord θ f-direction (A := Smooth) coord θ g := + map_sub (thetaDerivation θ) f g + +lemma transportT_real (θ : Fin 3 → ℂ) (m k : X → ℝ) + (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hk : ContDiff ℝ (⊤ : ℕ∞) k) + (hmp : ∀ x,0 < m x) (hkp : ∀ x,0 < k x) (x : X) : + (transportT θ (smoothOfReal k hk) (positiveRoot m hm hmp) + (fun x => Complex.ofReal_ne_zero.mpr (hkp x).ne') (real_sum_nonzero m k hm hk hmp hkp) : X → ℂ) x= + ElasticityRecovery.T m k x θ := by + have hlog := smoothLog_div k (fun x => k x+m x) hk (hk.add hm) hkp (fun x => add_pos (hkp x) (hmp x)) + have hd := congrArg (direction (A := Smooth) coord θ) hlog + rw [direction_sub] at hd + conv_rhs at hd => rw [direction_real_log θ k hk hkp, + direction_real_log θ (fun x => k x+m x) (hk.add hm) (fun x => add_pos (hkp x) (hmp x))] + have hleft : (direction (A := Smooth) coord θ + (smoothLog (fun x => k x/(k x+m x)) + (hk.div (hk.add hm) (fun x => (add_pos (hkp x) (hmp x)).ne')) + (fun x => div_pos (hkp x) (add_pos (hkp x) (hmp x)))) : X → ℂ) x= + ElasticityRecovery.T m k x θ := by + exact ofReal_direction θ _ _ x + rw [← hleft] + change _ = (direction (A := Smooth) coord θ _ : X → ℂ) x + rw [hd] + unfold transportT + simp only [positiveRoot_square,smoothOfReal_add] + +lemma grad_contDiff (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => ElasticityRecovery.grad f x i) := + ElasticityFiniteType.contDiff_D hf _ +lemma coord_real_grad (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) : + coord i (smoothOfReal f hf)=smoothOfReal (fun x => ElasticityRecovery.grad f x i) + (grad_contDiff f hf i) := by + apply Subtype.ext + funext x + exact coord_ofReal_grad f hf i x +lemma direction_coord_real (θ : Fin 3 → ℂ) (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) (x : X) : + (direction (A := Smooth) coord θ (coord i (smoothOfReal f hf)) : X → ℂ) x= + ∑ j,θ j*(ElasticityRecovery.hessian f x i j : ℂ) := by + rw [coord_real_grad,ofReal_direction] + rfl +lemma thetaGamma_real (θ : Fin 3 → ℂ) (m : X → ℝ) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hp : ∀ x,0 < m x) (x : X) : + (thetaGamma θ (positiveRoot m hm hp) (positiveRoot_nonzero m hm hp) : X → ℂ) x= + ElasticityRecovery.dir θ (fun x => Real.log (m x)) x := by + simp only [thetaGamma,logarithmicGrad_root] + exact ofReal_direction θ _ _ x +lemma transportQ_real (θ : Fin 3 → ℂ) (m k : X → ℝ) + (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hk : ContDiff ℝ (⊤ : ℕ∞) k) + (hmp : ∀ x,0 < m x) (hkp : ∀ x,0 < k x) (x : X) (i : Fin 3) : + (transportQ θ (smoothOfReal k hk) (positiveRoot m hm hmp) + (positiveRoot_nonzero m hm hmp) (fun x => Complex.ofReal_ne_zero.mpr (hkp x).ne') + (real_sum_nonzero m k hm hk hmp hkp) i : X → ℂ) x=ElasticityRecovery.Q m k x θ i := by + unfold transportQ + simp only [positiveRoot_square,logarithmicGrad_root] + rw [mul_assoc,← direction_real_log θ k hk hkp] + simp only [Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_smul,Pi.sub_apply,Pi.mul_apply, + Pi.smul_apply,smul_eq_mul] + rw [thetaGamma_real] + have hdlog : (direction (A := Smooth) coord θ (smoothLog k hk hkp) : X → ℂ) x= + ElasticityRecovery.dir θ (fun x => Real.log (k x)) x := ofReal_direction θ _ _ x + rw [hdlog] + change (1/2 : ℂ)*(((m x : ℂ)*((k x : ℂ)+(m x : ℂ))⁻¹* + ElasticityRecovery.dir θ (fun x => Real.log (k x)) x- + (1/2 : ℂ)*ElasticityRecovery.dir θ (fun x => Real.log (m x)) x)* + (coord i (smoothLog m hm hmp) : X → ℂ) x- + (m x : ℂ)*((k x : ℂ)+(m x : ℂ))⁻¹* + (direction (A := Smooth) coord θ (coord i (smoothLog m hm hmp)) : X → ℂ) x)=_ + rw [smoothLog,coord_ofReal_grad,direction_coord_real] + simp only [ElasticityRecovery.Q,ElasticityRecovery.QMatrix,ElasticityRecovery.dir, + Matrix.mulVec,dotProduct,Fin.sum_univ_three,Complex.ofReal_mul,Complex.ofReal_sub, + Complex.ofReal_div,Complex.ofReal_add,Complex.ofReal_ofNat,Complex.ofReal_one] + ring +end +open Set +open scoped BigOperators +lemma real_k_positive (lam m : X → ℝ) (hp : ∀ x,0 < m x ∧ 0<3*lam x+2*m x) (x : X) : + 0 (hp x).1) + let hr := positiveRoot_nonzero m hm (fun x => (hp x).1) + ∃ a : Fin 3 → ℕ → Amplitude Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ ν,normal θ (a ν 0).1=0) ∧ + (∀ ν,leadingR (localCoord hU) θ (restrictSmooth U l) (restrictSmooth U μ) + (localAmp U (a ν 0)).1 (localAmp U (a ν 0)).2=0 ∧ + leadingS (localCoord hU) θ (restrictSmooth U l) (restrictSmooth U μ) + (localAmp U (a ν 0)).1 (localAmp U (a ν 0)).2=0) ∧ + (∀ ν j,RecursOn hU θ l μ (a ν j) (a ν (j+1))) ∧ + ∀ ν x,((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (a ν 0).1 i : X → ℂ) x), + (changeS (l+μ) r hr (a ν 0).1 (a ν 0).2 : X → ℂ) x) := by + intro l μ r hr + have hr2 : r*r=μ := positiveRoot_square m hm (fun x => (hp x).1) + have hk : ∀ x,((l+μ : Smooth) : X → ℂ) x≠0 := by + intro x + change (lam x : ℂ)+(m x : ℂ)≠0 + exact_mod_cast (real_k_positive lam m hp x).ne' + have hsum : ∀ x,((l+μ+r*r : Smooth) : X → ℂ) x≠0 := by + intro x + rw [hr2] + change (lam x : ℂ)+(m x : ℂ)+(m x : ℂ)≠0 + exact_mod_cast (real_longitudinal_positive lam m hp x).ne' + obtain ⟨a,B,hn,he,hrec,hB⟩ := exists_physical_formal_frame hU hC θ hθ hne (l+μ) r hr hk hsum + refine ⟨a,B,hn,?_,?_,hB⟩ + · simpa only [hr2,add_sub_cancel_right] using he + · simpa only [hr2,add_sub_cancel_right] using hrec +end ElasticityAugmented +namespace Elasticity +open Set MeasureTheory +open scoped BigOperators SchwartzMap +open ElasticityAugmented (Smooth smoothOfReal smooth_coe) +open ElasticityCoeffBounds +open ElasticityDistribution (Coeff eval) +open ElasticityPhysicalAlgebra (physical) +open ElasticityCGO (expCut) + +/-- Actual DN equality yields a shifted physical solution with a compact +amplitude difference. This uses the common-exterior coefficients from the +boundary reduction; it does not assume normalized-system transfer. The two +cutoffs are ordinary compact smooth cutoffs on nested open domains. -/ +theorem extended_dn_amplitude_transfer {Ω B B' : Set X} + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hB : IsOpen B) + (hBB : Bornology.IsBounded B) (hB' : IsOpen B') (hsub : B'⊆B) (hcl : closure Ω⊆B') + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) + (χ g : Smooth) (hcχ : HasCompactSupport (χ : X → ℂ)) + (hc : HasCompactSupport (g : X → ℂ)) (hs : tsupport (g : X → ℂ)⊆B) + (hχ : EqOn (χ : X → ℂ) 1 B) (hg : EqOn (g : X → ℂ) 1 B') + (z : Fin 3 → ℂ) (u : Fin 3 → SchwartzMap X ℂ) + (hu : ∀ i,EqOn (physical z (fun x => (lam 0 x : ℂ)) (fun x => (m 0 x : ℂ)) u i : X → ℂ) 0 B) : + ∃ v : Fin 3 → SchwartzMap X ℂ, + (∀ i,tsupport (v i-u i : SchwartzMap X ℂ)⊆closure Ω) ∧ + (∀ i,EqOn (physical z (fun x => (lam 1 x : ℂ)) (fun x => (m 1 x : ℂ)) v i : X → ℂ) 0 B') := by + let l := fun q => smoothOfReal (lam q) (hl q) + let μ := fun q => smoothOfReal (m q) (hm q) + have hn0 (x) : (μ 1 : X → ℂ) x≠0 := Complex.ofReal_ne_zero.mpr (hp 1 x).1.ne' + have ho0 (x) : ((l 1+μ 1+μ 1 : Smooth) : X → ℂ) x≠0 := by + change (lam 1 x : ℂ)+(m 1 x : ℂ)+(m 1 x : ℂ)≠0 + exact_mod_cast (ElasticityAugmented.real_longitudinal_positive (lam 1) (m 1) (hp 1) x).ne' + let n := reciprocal (μ 1) hn0 + let o := reciprocal (l 1+μ 1+μ 1) ho0 + have hn : ExteriorConstant n := (hclm 1).reciprocal hn0 + have ho : ExteriorConstant o := (((hcll 1).add (hclm 1)).add (hclm 1)).reciprocal ho0 + let L : Fin 2 → Coeff := fun q => ⟨l q,(hcll q).growth⟩ + let M : Fin 2 → Coeff := fun q => ⟨μ q,(hclm q).growth⟩ + let N : Coeff := ⟨n,hn.growth⟩ + let O : Coeff := ⟨o,ho.growth⟩ + have hiN : N*M 1=1 := by apply Subtype.ext; exact reciprocal_mul (μ 1) hn0 + have hiO : O*(L 1+M 1+M 1)=1 := by apply Subtype.ext; exact reciprocal_mul (l 1+μ 1+μ 1) ho0 + have ha (q) : Admissible Ω (lam q) (m q) := admissible_of_global (hl q) (hm q) (hp q) + have hbl (q) : BoundedCoefficient B (lam q) := + SmoothUpTo.boundedCoefficient ⟨univ,isOpen_univ,subset_univ _,(hl q).contDiffOn⟩ hB hBB + have hbm (q) : BoundedCoefficient B (m q) := + SmoothUpTo.boundedCoefficient ⟨univ,isOpen_univ,subset_univ _,(hm q).contDiffOn⟩ hB hBB + let F := fun i => expCut χ hcχ z (u i) + have hF : ∀ i,EqOn (physical 0 (eval (L 0)) (eval (M 0)) F i : X → ℂ) 0 B := + ElasticityCGO.expCut_solution hB (l 0) (μ 0) χ (hcll 0).growth (hclm 0).growth hcχ hχ z u hu + obtain ⟨H,hH,hsol,_⟩ := physical_supported_transfer (ha 0) (ha 1) hΩ hOB + (subset_closure.trans (hcl.trans hsub)) hB hB' hsub hcl + (hbl 0) (hbm 0) (hbl 1) (hbm 1) he hDN (L 0) (M 0) (L 1) (M 1) N O hiN hiO + (Filter.Eventually.of_forall (fun _ => rfl)) (Filter.Eventually.of_forall (fun _ => rfl)) + (Filter.Eventually.of_forall (fun _ => rfl)) (Filter.Eventually.of_forall (fun _ => rfl)) + (smooth_coe g) hc hs hg F hF + obtain ⟨v,hv,hp',_⟩ := ElasticityCGO.transferred_amplitude hB' (l 1) (μ 1) χ + (hcll 1).growth (hclm 1).growth hcχ (hχ.mono hsub) z u F H + (fun i x hx => by + change expCut χ hcχ z (u i) x=_ + rw [ElasticityCGO.expCut_apply,hχ (hsub hx),Pi.one_apply,one_mul]) hH hsol + exact ⟨v,hv,hp'⟩ + +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityPhysicalAlgebra (phase) +open ElasticityNegativeOrder (sobNorm) + +/-- The actual physical DN equality gives the uniform compact comparison bound. +The Cauchy-data transfer, normalized forcing, and coefficient bounds are all +proved dependencies. This theorem still starts at the common-exterior stage; +it does not replace the missing original-boundary jet determination. -/ +theorem extended_dn_compact_comparison {Ω B B' : Set X} + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hB : IsOpen B) + (hBB : Bornology.IsBounded B) (hB' : IsOpen B') (hsub : B'⊆B) (hcl : closure Ω⊆B') + (R : ℝ) (hR : 1≤R) (hKR : closure Ω⊆Metric.closedBall 0 R) + (α β : X) (hα : α≠0) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) + (χ g : Smooth) (hcχ : HasCompactSupport (χ : X → ℂ)) + (hc : HasCompactSupport (g : X → ℂ)) (hs : tsupport (g : X → ℂ)⊆B) + (hχ : EqOn (χ : X → ℂ) 1 B) (hg : EqOn (g : X → ℂ) 1 B') : + ∃ C h₀ : ℝ,0 (lam 0 x : ℂ)) + (fun x => (m 0 x : ℂ)) u i : X → ℂ) 0 B) → + ∃ v : Fin 3 → SchwartzMap X ℂ, + (∀ i,tsupport (v i-u i : SchwartzMap X ℂ)⊆closure Ω) ∧ + (∀ i,EqOn (physical (phase h α β) (fun x => (lam 1 x : ℂ)) + (fun x => (m 1 x : ℂ)) v i : X → ℂ) 0 B') ∧ + sobNorm h 1 (physicalAug (phase h α β) (v-u))≤ + C*sobNorm h 1 (physicalAug (phase h α β) u) := by + let l := fun q => smoothOfReal (lam q) (hl q) + let μ := fun q => smoothOfReal (m q) (hm q) + have hn0 (q x) : (μ q : X → ℂ) x≠0 := Complex.ofReal_ne_zero.mpr (hp q x).1.ne' + have ho0 (q x) : ((l q+μ q+μ q : Smooth) : X → ℂ) x≠0 := by + change (lam q x : ℂ)+(m q x : ℂ)+(m q x : ℂ)≠0 + exact_mod_cast (ElasticityAugmented.real_longitudinal_positive (lam q) (m q) (hp q) x).ne' + have hel : EqOn (l 0 : X → ℂ) (l 1) (closure Ω)ᶜ := by + intro x hx + exact congrArg Complex.ofReal (he x (fun hh => hx (subset_closure hh))).1 + have hem : EqOn (μ 0 : X → ℂ) (μ 1) (closure Ω)ᶜ := by + intro x hx + exact congrArg Complex.ofReal (he x (fun hh => hx (subset_closure hh))).2 + obtain ⟨C,h₀,hC,hh₀,hest⟩ := ElasticityPhysicalEstimate.physical_compact_comparison + hB' isClosed_closure hcl R hR hKR α β hα l μ hcll hclm hn0 ho0 hel hem + refine ⟨C,h₀,hC,hh₀,fun h hh hsmall u hu => ?_⟩ + obtain ⟨v,hv,hsol⟩ := extended_dn_amplitude_transfer hΩ hOB hB hBB hB' hsub hcl + lam m hl hm hp hcll hclm he hDN χ g hcχ hc hs hχ hg (phase h α β) u hu + exact ⟨v,hv,hsol,hest h hh hsmall u v hv (fun i => (hu i).mono hsub) hsol⟩ +end Elasticity +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +local notation "X" => ElasticityBessel.X + +lemma sobolevInjection_zero (q : Lp ℂ 2 (volume : Measure X)) : + sobolevInjection 0 q=(q : 𝓢'(X,ℂ)) := by + simp only [sobolevInjection,neg_zero,besselPotential_zero, + ContinuousLinearMap.comp_apply,ContinuousLinearMap.id_apply,Lp.toTemperedDistributionCLM_apply] + +/-- A standard Sobolev H1 representative controls the actual semiclassical +Fourier norm uniformly for h in (0,1]. The two Bessel conventions are not +identified: this follows from their concrete L2 derivative realizations. -/ +theorem standard_H1_controls_semiclassical : + ∃ C : ℝ,0 ?_⟩ + have hzero : L₀ q=L2 f := by + apply lp_distribution_injective + change (L₀ q : 𝓢'(X,ℂ))=(L2 f : 𝓢'(X,ℂ)) + rw [← sobolevInjection_zero,hL₀,hq] + exact (Lp.toTemperedDistribution_toLp_eq f).symm + have hder (i : Fin 3) : L i q=L2 (d (e i) f) := by + apply lp_distribution_injective + have hd := hL i q + norm_num only [sub_self] at hd + rw [sobolevInjection_zero,hq, + lineDerivOp_toTemperedDistributionCLM_eq] at hd + exact hd.trans (Lp.toTemperedDistribution_toLp_eq (d (e i) f)).symm + have ha₀ : ‖L₀‖≤A := by + have hs : 0≤∑ i,‖L i‖ := Finset.sum_nonneg (fun i _ => norm_nonneg (L i)) + dsimp [A] + linarith + have ha (i : Fin 3) : ‖L i‖≤A := by + have hs := Finset.single_le_sum (fun j _ => norm_nonneg (L j)) (Finset.mem_univ i) + dsimp [A] + linarith [norm_nonneg L₀] + have hf : norm2 f≤A*‖q‖ := by + change ‖L2 f‖≤_ + rw [← hzero] + exact (L₀.le_opNorm q).trans (mul_le_mul_of_nonneg_right ha₀ (norm_nonneg q)) + have hdf (i : Fin 3) : norm2 (d (e i) f)≤A*‖q‖ := by + change ‖L2 (d (e i) f)‖≤_ + rw [← hder i] + exact ((L i).le_opNorm q).trans (mul_le_mul_of_nonneg_right (ha i) (norm_nonneg q)) + have hf₂ := pow_le_pow_left₀ (norm2_nonneg f) hf 2 + have hd₂ (i : Fin 3) := pow_le_pow_left₀ (norm2_nonneg (d (e i) f)) (hdf i) 2 + have hg : gradientMass f≤3*(A*‖q‖)^2 := by + simp only [gradientMass,Fin.sum_univ_three,← norm2_sq_mass] + nlinarith only [hd₂ 0,hd₂ 1,hd₂ 2] + have hh₂ : h^2≤1 := by nlinarith + have he := H1_energy h f + have hgm := mul_le_mul_of_nonneg_right hh₂ (gradientMass_nonneg f) + rw [← norm2_sq_mass] at he + have hb : norm2 (J h 1 f)^2≤4*(A*‖q‖)^2 := by nlinarith only [he,hgm,hg,hf₂] + have hpos : 0≤2*A*‖q‖ := by positivity + nlinarith only [hb,norm2_nonneg (J h 1 f),hpos] +/-- The same uniform bound after a compact cutoff, when only a local +standard-H1 representative is available. This is the localization needed +for the actual augmented CGO corrections. -/ +theorem local_standard_H1_controls_semiclassical {U : Set X} {g : X → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (hs : tsupport g⊆U) : + ∃ C : ℝ,0 ?_⟩ + have he : sobolevInjection 1 (L q)=(mult g f : 𝓢'(X,ℂ)) := by + rw [hL,hq.cutoff hg hc hs] + exact distribution_schwartz_product (hc.hasTemperateGrowth hg) f + have hb := hest h hh hh1 (mult g f) (L q) he + have hn := L.le_opNorm q + calc + _ ≤ C*‖L q‖ := hb + _ ≤ C*(‖L‖*‖q‖) := mul_le_mul_of_nonneg_left hn hC.le + _ ≤ (C*(1+‖L‖))*‖q‖ := by nlinarith [mul_nonneg hC.le (norm_nonneg q)] +end ElasticityRegularity +namespace ElasticityCGO + +section +open MeasureTheory Set TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityRegularity (sobolevInjection) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityDistribution (HV Dist divd) + +/-- A genuinely compatible finite amplitude series gives exact smooth physical +CGO fields. The correction is the same estimated L2 solution, and its full +physical divergence is H1-small. Neither a physical-solvability statement nor +convergence of a formal infinite series is assumed. -/ +theorem physical_cgo_from_recursion (R : ℝ) (hR : 1≤R) + (Ω U : Set X) (hΩ : Ω⊆Metric.closedBall 0 R) (hU : IsOpen U) (hsub : U⊆Ω) + (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hrl : ∀ x,star ((lam : X → ℂ) x)=(lam : X → ℂ) x) + (hrm : ∀ x,star ((m : X → ℂ) x)=(m : X → ℂ) x) + (hm0 : ∀ x,(m : X → ℂ) x≠0) + (he0 : ∀ x,((lam+m+m : Smooth) : X → ℂ) x≠0) + (χ : Fin 5 → X → ℂ) (hχ : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (χ i)) + (hcχ : ∀ i,HasCompactSupport (χ i)) + (hnest : ∀ i : Fin 4,EqOn (χ i.succ) 1 (tsupport (χ i.castSucc))) + (hs : ∀ i,tsupport (χ i)⊆Ω) (h1 : EqOn (χ 0) 1 U) + (a : ℕ → Amplitude Smooth) + (hR₀ : leadingR (localCoord hU) (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (restrictSmooth U lam) (restrictSmooth U m) (localAmp U (a 0)).1 (localAmp U (a 0)).2=0) + (hn₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,RecursOn hU (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) lam m (a j) (a (j+1))) : + ∃ C h₀ : ℝ, 0 cut ⟨χ 0,hχ 0⟩ (hcχ 0) ((truncation (h : ℂ) 8 a).1 j))-v) i : X → ℂ) 0 U) ∧ + (∀ i,sobolevInjection 1 (q i)=smulLeftCLM ℂ (χ 0) + ((Fin.cons (divd (phase h α β) (fun j => (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖≤C*h^7 ∧ ‖q‖≤C*h := by + let θ : Fin 3 → ℂ := fun i => (α i : ℂ)+Complex.I*(β i : ℂ) + let f₀ : Fin 3 → S := fun i => cut ⟨χ 0,hχ 0⟩ (hcχ 0) (residual0 lam m (a 8) i) + let f₁ : Fin 3 → S := fun i => cut ⟨χ 0,hχ 0⟩ (hcχ 0) (residual1 θ lam m (a 8) i) + obtain ⟨C,h₀,hC,hh₀,hsol⟩ := ElasticityDistribution.finite_classical_correction R hR Ω U hΩ hU hsub + α β hα lam m hl hm hrl hrm hm0 he0 χ hχ hcχ hnest hs h1 f₀ f₁ + refine ⟨C,h₀,hC,hh₀,fun h hh hsmall => ?_⟩ + obtain ⟨w,q,v,hv,hphys,hq,hw,hqn⟩ := hsol h hh hsmall + refine ⟨w,q,v,hv,?_,hq,hw,hqn⟩ + apply ElasticityDistribution.correction_cancels_residual U (phase h α β) lam m + (fun j => cut ⟨χ 0,hχ 0⟩ (hcχ 0) ((truncation (h : ℂ) 8 a).1 j)) v + (ElasticityDistribution.finiteResidual h f₀ f₁) _ hphys + intro i + rw [phase_eq] + exact cut_truncation_residual hU θ hθ lam m ⟨χ 0,hχ 0⟩ hl.growth hm.growth + (hcχ 0) h1 h (ne_of_gt hh) a hR₀ hn₀ hrec i +end +open Set +open ElasticityAugmented +open ElasticityNegativeOrder (cutoff) + +def fiveCutoff (R : ℝ) (hR : 1≤R) (i : Fin 5) (x : X) : ℂ := + (cutoff (R+(i.val : ℝ)) (by have h := Nat.cast_nonneg (α := ℝ) i.val; linarith) x : ℂ) +lemma fiveCutoff_smooth (R : ℝ) (hR : 1≤R) (i : Fin 5) : + ContDiff ℝ (⊤ : ℕ∞) (fiveCutoff R hR i) := + Complex.ofRealCLM.contDiff.comp (cutoff _ _).contDiff +lemma fiveCutoff_compact (R : ℝ) (hR : 1≤R) (i : Fin 5) : + HasCompactSupport (fiveCutoff R hR i) := + (cutoff _ _).hasCompactSupport.comp_left Complex.ofReal_zero +lemma fiveCutoff_support (R : ℝ) (hR : 1≤R) (i : Fin 5) : + tsupport (fiveCutoff R hR i)⊆Metric.closedBall 0 (R+(i.val : ℝ)+2) := by + let b := cutoff (R+(i.val : ℝ)) (by have h := Nat.cast_nonneg (α := ℝ) i.val; linarith) + have hs : tsupport (fiveCutoff R hR i)⊆tsupport b := by + apply closure_mono + intro x hx + exact fun hh => hx (by change (b x : ℂ)=0; rw [hh,Complex.ofReal_zero]) + simpa only [b,ContDiffBump.tsupport_eq,cutoff] using hs +lemma fiveCutoff_one (R : ℝ) (hR : 1≤R) (i : Fin 5) {x : X} + (hx : x∈Metric.closedBall 0 (R+(i.val : ℝ)+1)) : fiveCutoff R hR i x=1 := by + have hh := (cutoff (R+(i.val : ℝ)) (by have h := Nat.cast_nonneg (α := ℝ) i.val; linarith)).one_of_mem_closedBall hx + unfold fiveCutoff + rw [hh,Complex.ofReal_one] +lemma fiveCutoff_nested (R : ℝ) (hR : 1≤R) (i : Fin 4) : + EqOn (fiveCutoff R hR i.succ) 1 (tsupport (fiveCutoff R hR i.castSucc)) := by + intro x hx + apply fiveCutoff_one + have hh := fiveCutoff_support R hR i.castSucc hx + simp only [Metric.mem_closedBall,Fin.val_castSucc,Fin.val_succ,Nat.cast_add,Nat.cast_one] at hh ⊢ + linarith +lemma fiveCutoff_inside (R : ℝ) (hR : 1≤R) (i : Fin 5) : + tsupport (fiveCutoff R hR i)⊆Metric.ball 0 (R+7) := by + intro x hx + have hh := fiveCutoff_support R hR i hx + have hi : (i.val : ℝ)<5 := by exact_mod_cast i.isLt + simp only [Metric.mem_closedBall] at hh + rw [Metric.mem_ball] + linarith +lemma fiveCutoff_initial (R : ℝ) (hR : 1≤R) : + EqOn (fiveCutoff R hR 0) 1 (Metric.ball 0 R) := by + intro x hx + apply fiveCutoff_one + simp only [Fin.val_zero,Nat.cast_zero,add_zero,Metric.mem_closedBall] + have hh := Metric.mem_ball.mp hx + linarith +end ElasticityCGO +namespace ElasticityCGO +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityRegularity (sobolevInjection) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityDistribution (HV Dist divd) + +/-- Quantified actual physical CGO corrections on the ball, with the full +physical divergence in H1. This is a conclusion, never an input assumption. -/ +def PhysicalColumn (R : ℝ) (hR : 1≤R) (α β : X) (lam m : Smooth) + (a : ℕ → Amplitude Smooth) : Prop := + ∃ C h₀ : ℝ,0 cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation (h : ℂ) 8 a).1 j))-v) i : X → ℂ) 0 (Metric.ball 0 R)) ∧ + (∀ i,sobolevInjection 1 (q i)=smulLeftCLM ℂ (fiveCutoff R hR 0) + ((Fin.cons (divd (phase h α β) (fun j => (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖≤C*h^7 ∧ ‖q‖≤C*h + +theorem physical_column_of_recursion (R : ℝ) (hR : 1≤R) (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hrl : ∀ x,star ((lam : X → ℂ) x)=(lam : X → ℂ) x) + (hrm : ∀ x,star ((m : X → ℂ) x)=(m : X → ℂ) x) + (hm0 : ∀ x,(m : X → ℂ) x≠0) (he0 : ∀ x,((lam+m+m : Smooth) : X → ℂ) x≠0) + (a : ℕ → Amplitude Smooth) + (hR₀ : leadingR (localCoord Metric.isOpen_ball) (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (restrictSmooth (Metric.ball 0 R) lam) (restrictSmooth (Metric.ball 0 R) m) + (localAmp (Metric.ball 0 R) (a 0)).1 (localAmp (Metric.ball 0 R) (a 0)).2=0) + (hn₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,RecursOn (U := Metric.ball 0 R) Metric.isOpen_ball + (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) lam m (a j) (a (j+1))) : + PhysicalColumn R hR α β lam m a := by + exact physical_cgo_from_recursion (R+7) (by linarith) (Metric.ball 0 (R+7)) (Metric.ball 0 R) + Metric.ball_subset_closedBall Metric.isOpen_ball (Metric.ball_subset_ball (by linarith)) + α β hα hθ lam m hl hm hrl hrm hm0 he0 (fiveCutoff R hR) (fiveCutoff_smooth R hR) + (fiveCutoff_compact R hR) (fiveCutoff_nested R hR) (fiveCutoff_inside R hR) + (fiveCutoff_initial R hR) a hR₀ hn₀ hrec + +/-- A full genuine rank-three constrained frame of actual physical CGO +columns for every smooth, constant-exterior, strongly convex real Lamé pair. +The amplitudes and all corrections are constructed, not postulated. -/ +theorem exists_real_physical_cgo_frame (R : ℝ) (hR : 1≤R) (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : X → ℝ) (hl : ContDiff ℝ (⊤ : ℕ∞) lam) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hp : ∀ x,0 < m x ∧ 0<3*lam x+2*m x) + (hcl : ExteriorConstant (smoothOfReal lam hl)) (hcm : ExteriorConstant (smoothOfReal m hm)) : + let θ := fun i => (α i : ℂ)+Complex.I*(β i : ℂ) + let l := smoothOfReal lam hl + let μ := smoothOfReal m hm + let r := positiveRoot m hm (fun x => (hp x).1) + let hr := positiveRoot_nonzero m hm (fun x => (hp x).1) + ∃ a : Fin 3 → ℕ → Amplitude Smooth, + ∃ B : X → Module.Basis (Fin 3) ℂ (ElasticityFrame.Fiber θ), + (∀ ν,normal θ (a ν 0).1=0) ∧ + (∀ ν,PhysicalColumn R hR α β l μ (a ν)) ∧ + ∀ ν x,((B x ν : ElasticityFrame.Fiber θ) : ElasticityFrame.Amp)= + ((fun i => (changeP r (a ν 0).1 i : X → ℂ) x), + (changeS (l+μ) r hr (a ν 0).1 (a ν 0).2 : X → ℂ) x) := by + intro θ l μ r hr + have hne : θ≠0 := by + intro hz + apply hα + ext i + change α i=0 + have hi := congrArg Complex.re (congrFun hz i) + simpa only [θ,Pi.zero_apply,Complex.add_re,Complex.ofReal_re,Complex.mul_re, + Complex.I_re,Complex.I_im,Complex.ofReal_im,zero_mul,one_mul,sub_zero,add_zero,Complex.zero_re] using hi + have hC : IsCompact (closure (Metric.ball (0 : X) R)) := + (isCompact_closedBall (0 : X) R).of_isClosed_subset isClosed_closure + (closure_minimal Metric.ball_subset_closedBall Metric.isClosed_closedBall) + obtain ⟨a,B,hn,he,hrec,hB⟩ := exists_real_physical_series Metric.isOpen_ball hC θ hθ hne lam m hl hm hp + refine ⟨a,B,hn,fun ν => ?_,hB⟩ + apply physical_column_of_recursion R hR α β hα hθ l μ hcl hcm + (fun x => Complex.conj_ofReal _) (fun x => Complex.conj_ofReal _) + (fun x => Complex.ofReal_ne_zero.mpr (hp x).1.ne') (fun x => ?_) + (a ν) (he ν).1 (hn ν) (fun j _ => hrec ν j) + change (lam x : ℂ)+(m x : ℂ)+(m x : ℂ)≠0 + exact_mod_cast (real_longitudinal_positive lam m hp x).ne' +end ElasticityCGO +namespace ElasticityCGO +open Set MeasureTheory TemperedDistribution + +section +open scoped SchwartzMap ENNReal BigOperators +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityRegularity (sobolevInjection) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityCarleman (phaseCLM) +open ElasticityDistribution (HV Dist divd) + +def cgoField (R : ℝ) (hR : 1≤R) (h : ℝ) (α β : X) + (a : ℕ → Amplitude Smooth) (v : Fin 3 → S) (i : Fin 3) : S := + expCut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + (phase h α β) + (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation (h : ℂ) 8 a).1 i)-v i) + +theorem cgoField_apply_on (R : ℝ) (hR : 1≤R) (h : ℝ) (α β : X) + (a : ℕ → Amplitude Smooth) (v : Fin 3 → S) (i : Fin 3) {x : X} + (hx : x∈Metric.ball 0 R) : + cgoField R hR h α β a v i x=Complex.exp (phaseCLM (phase h α β) x)* + (((truncation (h : ℂ) 8 a).1 i : X → ℂ) x-v i x) := by + change expCut _ _ _ _ x=_ + rw [expCut_apply] + change fiveCutoff R hR 0 x*Complex.exp (phaseCLM (phase h α β) x)* + (fiveCutoff R hR 0 x*(((truncation (h : ℂ) 8 a).1 i : X → ℂ) x)-v i x)=_ + rw [fiveCutoff_initial R hR hx] + simp only [Pi.one_apply,one_mul] + +/-- Realization of the constructed physical column by a literal exponential +solution of the original (not augmented) elasticity equation. -/ +theorem physical_column_realization (R : ℝ) (hR : 1≤R) (α β : X) (lam m : Smooth) + (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (a : ℕ → Amplitude Smooth) (ha : PhysicalColumn R hR α β lam m a) : + ∃ C h₀ : ℝ,0 (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖≤C*h^7 ∧ ‖q‖≤C*h := by + obtain ⟨C,h₀,hC,hh₀,hsol⟩ := ha + refine ⟨C,h₀,hC,hh₀,fun h hh hsmall => ?_⟩ + obtain ⟨w,q,v,hv,hp,hq,hw,hn⟩ := hsol h hh hsmall + refine ⟨w,q,v,hv,?_,hq,hw,hn⟩ + exact expCut_solution Metric.isOpen_ball lam m + ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ hl.growth hm.growth + (fiveCutoff_compact R hR 0) (fiveCutoff_initial R hR) (phase h α β) + ((fun j => cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation (h : ℂ) 8 a).1 j))-v) hp +end +open scoped SchwartzMap LineDeriv BigOperators ENNReal +open ElasticityRegularity ElasticityAugmented +open ElasticityBessel (norm2 J) +open ElasticityNegativeOrder (mult sobNorm sumNorm) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityDistribution (HV Dist divd) + +lemma local_lp_schwartz_of_ae {U : Set X} (w : Lp ℂ 2 (volume : Measure X)) (v : S) + (hv : ∀ᵐ x ∂(volume : Measure X),x∈U → w x=v x) : + LocalEqual U (w : Dist) (v : Dist) := by + intro φ _ hs + calc + _ = ∫ x,φ x • w x := Lp.toTemperedDistribution_apply w φ + _ = ∫ x,φ x • v x := by + apply integral_congr_ae + filter_upwards [hv] with x hx + by_cases hφ : φ x=0 + · rw [hφ,zero_smul,zero_smul] + · rw [hx (hs (subset_tsupport _ hφ))] + _ = _ := (SchwartzMap.coe_apply v φ).symm + +/-- The local standard-H1 representative controls the SAME physical +correction and its actual shifted divergence. -/ +lemma actual_augmented_local_representative {U : Set X} (z : Fin 3 → ℂ) + (χ : X → ℂ) (hχ : χ.HasTemperateGrowth) (h1 : EqOn χ 1 U) + (w : ElasticityPhysicalDual.H) (q : HV) (v : Fin 3 → S) + (hv : ∀ i,∀ᵐ x ∂(volume : Measure X),x∈U → w i x=v i x) + (hq : ∀ i,sobolevInjection 1 (q i)=smulLeftCLM ℂ χ + ((Fin.cons (divd z (fun j => (w j : Dist))) (fun j => (w j : Dist)) : Fin 4 → Dist) i)) : + ∀ i,LocalEqual U (sobolevInjection 1 (q i)) (physicalAug z v i : Dist) := by + have hl (i : Fin 3) := local_lp_schwartz_of_ae (w i) (v i) (hv i) + intro i + rw [hq i] + apply (LocalEqual.cutoff_one _ hχ h1).trans + refine Fin.cases ?_ (fun i => hl i) i + have hd := ElasticityDistribution.LocalEq.divergence hl z + rw [ElasticityDistribution.divd_schwartz] at hd + exact hd + +/-- Uniform compactly localized augmented correction bound; the scalar +component is not independent of the displacement. -/ +theorem actual_augmented_cutoff_bound {U : Set X} {g : X → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (hs : tsupport g⊆U) : + ∃ C : ℝ,0 (w j : Dist))) (fun j => (w j : Dist)) : Fin 4 → Dist) i)) → + sobNorm h 1 (fun i => mult g (physicalAug z v i))≤C*‖q‖ := by + obtain ⟨C,hC,hest⟩ := local_standard_H1_controls_semiclassical hg hc hs + refine ⟨4*C,by positivity,fun h hh hh1 z χ hχ h1 w q v hv hq => ?_⟩ + have hl := actual_augmented_local_representative z χ hχ h1 w q v hv hq + have hb (i : Fin 4) : norm2 (J h 1 (mult g (physicalAug z v i)))≤C*‖q‖ := by + exact (hest h hh hh1 _ (q i) (hl i)).trans + (mul_le_mul_of_nonneg_left (norm_le_pi_norm q i) hC.le) + apply (ElasticityNegativeOrder.sobNorm_le_sumNorm h 1 _).trans + calc + sumNorm h 1 (fun i => mult g (physicalAug z v i))≤∑ i : Fin 4,C*‖q‖ := + Finset.sum_le_sum (fun i _ => hb i) + _ = (4*C)*‖q‖ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; ring + +lemma divShift_mult (z : Fin 3 → ℂ) (g : X → ℂ) (hg : g.HasTemperateGrowth) + (v : Fin 3 → S) : + ElasticityPhysicalAlgebra.divShift z (fun i => mult g (v i))= + mult g (ElasticityPhysicalAlgebra.divShift z v)+ + ∑ i,mult (fun x => fderiv ℝ g x (e i)) (v i) := by + have hd (i : Fin 3) : (fun x => fderiv ℝ g x (e i)).HasTemperateGrowth := + ElasticityPhysicalAlgebra.temperate_partial g hg (e i) + ext x + simp only [ElasticityPhysicalAlgebra.divShift,sum_apply, + ElasticityPhysicalAlgebra.shiftD_apply,add_apply,smul_apply, + ElasticityNegativeOrder.d_mult_apply g hg, + ElasticityNegativeOrder.mult_apply g hg, + ElasticityNegativeOrder.mult_apply _ (hd _),smul_eq_mul, + Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + dsimp only [ElasticitySchwartzCarleman.e,ElasticityAugmented.e] + ring + +/-- Cutting off the displacement itself retains a uniformly controlled +ACTUAL augmented field. The derivative of the cutoff has no phase loss. -/ +theorem cut_actual_augmented_bound {U : Set X} {g : X → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (hs : tsupport g⊆U) : + ∃ C : ℝ,0 mult g (v i)))≤C*‖q‖ := by + obtain ⟨C,hC,hest⟩ := local_standard_H1_controls_semiclassical hg hc hs + have hed (i : Fin 3) := local_standard_H1_controls_semiclassical + (smooth_derivative hg (e i)) (compact_derivative hc (e i)) + ((tsupport_fderiv_apply_subset ℝ (e i)).trans hs) + choose D hD hdest using hed + have hDsum : 0≤∑ i,D i := Finset.sum_nonneg (fun i _ => (hD i).le) + refine ⟨4*C+∑ i,D i,by positivity,fun h hh hh1 z q v hq => ?_⟩ + have hbase (i : Fin 4) : norm2 (J h 1 (mult g (physicalAug z v i)))≤C*‖q‖ := + (hest h hh hh1 _ (q i) (hq i)).trans + (mul_le_mul_of_nonneg_left (norm_le_pi_norm q i) hC.le) + have hder (i : Fin 3) : + norm2 (J h 1 (mult (fun x => fderiv ℝ g x (e i)) (v i)))≤D i*‖q‖ := + (hdest i h hh hh1 _ (q i.succ) (hq i.succ)).trans + (mul_le_mul_of_nonneg_left (norm_le_pi_norm q i.succ) (hD i).le) + have hsc : norm2 (J h 1 (ElasticityPhysicalAlgebra.divShift z (fun i => mult g (v i))))≤ + C*‖q‖+(∑ i,D i)*‖q‖ := by + rw [divShift_mult z g (hc.hasTemperateGrowth hg),ElasticityBessel.J_add, + ElasticityPhysicalEstimate.J_sum] + calc + _ ≤ norm2 (J h 1 (mult g (ElasticityPhysicalAlgebra.divShift z v)))+ + norm2 (∑ i,J h 1 (mult (fun x => fderiv ℝ g x (e i)) (v i))) := + ElasticityBessel.norm2_add_le _ _ + _ ≤ C*‖q‖+∑ i,D i*‖q‖ := add_le_add (hbase 0) + ((ElasticityNegativeOrder.norm2_sum_le _ _).trans (Finset.sum_le_sum (fun i _ => hder i))) + _ = _ := by rw [Finset.sum_mul] + apply (ElasticityNegativeOrder.sobNorm_le_sumNorm h 1 _).trans + change (∑ i : Fin 4,norm2 (J h 1 (physicalAug z (fun i => mult g (v i)) i)))≤_ + rw [Fin.sum_univ_succ] + change norm2 (J h 1 (ElasticityPhysicalAlgebra.divShift z (fun i => mult g (v i))))+ + (∑ i : Fin 3,norm2 (J h 1 (mult g (v i))))≤_ + calc + _ ≤ (C*‖q‖+(∑ i,D i)*‖q‖)+∑ _i : Fin 3,C*‖q‖ := + add_le_add hsc (Finset.sum_le_sum (fun i _ => hbase i.succ)) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; ring +end ElasticityCGO +namespace ElasticityCGO +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityNegativeOrder (mult sobNorm) +open ElasticityRegularity (sobolevInjection) +open ElasticityDistribution (HV Dist divd) + +/-- The actual physical CGO corrections have a uniform localized augmented +semiclassical H1 bound. Localize the displacement and then take its actual +shifted divergence: the scalar is not a separately prescribed amplitude. -/ +theorem physical_column_localized_realization (R : ℝ) (hR : 1≤R) (α β : X) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (a : ℕ → Amplitude Smooth) (ha : PhysicalColumn R hR α β lam m a) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆Metric.ball 0 R) : + ∃ C h₀ : ℝ,0 (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖≤C*h^7 ∧ ‖q‖≤C*h ∧ + sobNorm h 1 (physicalAug (phase h α β) (fun i => mult g (v i)))≤C*h := by + obtain ⟨C₀,h₀,hC₀,hh₀,hsol⟩ := physical_column_realization R hR α β lam m hl hm a ha + obtain ⟨D,hD,hest⟩ := cut_actual_augmented_bound hg hc hs + let C := C₀*(1+D) + have hC : 0 ?_⟩ + have hhh₀ : h≤h₀ := hsml.trans (min_le_left _ _) + have hh1 : h≤1 := hsml.trans (min_le_right _ _) + obtain ⟨w,q,v,hv,hp,hq,hw,hn⟩ := hsol h hh hhh₀ + refine ⟨w,q,v,hv,hp,hq,hw.trans (mul_le_mul_of_nonneg_right hle (by positivity)), + hn.trans (mul_le_mul_of_nonneg_right hle hh.le),?_⟩ + have hloc := actual_augmented_local_representative (phase h α β) (fiveCutoff R hR 0) + ((fiveCutoff_compact R hR 0).hasTemperateGrowth (fiveCutoff_smooth R hR 0)) + (fiveCutoff_initial R hR) w q v hv hq + calc + _ ≤ D*‖q‖ := hest h hh.le hh1 (phase h α β) q v hloc + _ ≤ D*(C₀*h) := mul_le_mul_of_nonneg_left hn hD.le + _ = (D*C₀)*h := by ring + _ ≤ C*h := mul_le_mul_of_nonneg_right hmul hh.le + +/-- The actual physical CGO corrections have a uniform localized augmented +semiclassical H1 bound. Localize the displacement and then take its actual +shifted divergence: the scalar is not a separately prescribed amplitude. -/ +theorem physical_column_shifted_realization (R : ℝ) (hR : 1≤R) (α β : X) + (lam m : Smooth) + (a : ℕ → Amplitude Smooth) (ha : PhysicalColumn R hR α β lam m a) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆Metric.ball 0 R) : + ∃ C h₀ : ℝ,0 cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation (h : ℂ) 8 a).1 j))-v) i : X → ℂ) 0 (Metric.ball 0 R)) ∧ + (∀ i,sobolevInjection 1 (q i)=smulLeftCLM ℂ (fiveCutoff R hR 0) + ((Fin.cons (divd (phase h α β) (fun j => (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i)) ∧ + ‖w‖≤C*h^7 ∧ ‖q‖≤C*h ∧ + sobNorm h 1 (physicalAug (phase h α β) (fun i => mult g (v i)))≤C*h := by + obtain ⟨C₀,h₀,hC₀,hh₀,hsol⟩ := ha + obtain ⟨D,hD,hest⟩ := cut_actual_augmented_bound hg hc hs + let C := C₀*(1+D) + have hC : 0 ?_⟩ + have hhh₀ : h≤h₀ := hsml.trans (min_le_left _ _) + have hh1 : h≤1 := hsml.trans (min_le_right _ _) + obtain ⟨w,q,v,hv,hp,hq,hw,hn⟩ := hsol h hh hhh₀ + refine ⟨w,q,v,hv,hp,hq,hw.trans (mul_le_mul_of_nonneg_right hle (by positivity)), + hn.trans (mul_le_mul_of_nonneg_right hle hh.le),?_⟩ + have hloc := actual_augmented_local_representative (phase h α β) (fiveCutoff R hR 0) + ((fiveCutoff_compact R hR 0).hasTemperateGrowth (fiveCutoff_smooth R hR 0)) + (fiveCutoff_initial R hR) w q v hv hq + calc + _ ≤ D*‖q‖ := hest h hh.le hh1 (phase h α β) q v hloc + _ ≤ D*(C₀*h) := mul_le_mul_of_nonneg_left hn hD.le + _ = (D*C₀)*h := by ring + _ ≤ C*h := mul_le_mul_of_nonneg_right hmul hh.le +end ElasticityCGO +section +open Set +open scoped BigOperators SchwartzMap +namespace ElasticityAugmented +lemma restrict_divT {U : Set X} (hU : IsOpen U) (z : Fin 3 → ℂ) (a : Fin 3 → Smooth) : + restrictSmooth U (divT (shifted coord z) a)= + divT (shifted (localCoord hU) z) (fun j => restrictSmooth U (a j)) := by + simp only [divT,map_sum,restrict_shifted hU] + +/-- The actual finite divergence constraint on an open physical region. -/ +theorem truncation_divergence_on {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (h : ℂ) (hh : h≠0) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h₀ : normal θ (a 0).1=0) + (hrec : ∀ j ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) : + EqOn ((divT (shifted coord (h⁻¹ • θ)) (truncation h N a).1 : Smooth) : X → ℂ) + (((truncation h N a).2+h^N • (div coord (a N).1-(a N).2) : Smooth) : X → ℂ) U := by + have hn₀ : normal θ (localAmp U (a 0)).1=0 := by + simp only [localAmp,← restrict_normal,h₀,map_zero] + have hn (j) (hj : j localAmp U (a j)) hn₀ hn + apply (restrictSmooth_eq_iff U _ _).mp + rw [restrict_divT hU] + change divT (shifted (localCoord hU) (h⁻¹ • θ)) (localAmp U (truncation h N a)).1=_ + rw [localAmp_truncation,ht] + simp only [map_add,map_smul,map_sub,restrict_div hU] + congr 1 + exact congrArg Prod.snd (localAmp_truncation U h N a).symm +end ElasticityAugmented + +namespace ElasticityCGO +open ElasticityAugmented +open ElasticityPhysicalAlgebra (toSmooth toSmooth_apply toSmooth_divShift divShift) +lemma divShift_cut_local {U : Set X} (hU : IsOpen U) + (z : Fin 3 → ℂ) (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (hχ : EqOn (χ : X → ℂ) 1 U) (u : Fin 3 → Smooth) : + EqOn (divShift z (fun j => cut χ hc (u j)) : X → ℂ) + ((divT (shifted coord z) u : Smooth) : X → ℂ) U := by + change EqOn ((toSmooth (divShift z (fun j => cut χ hc (u j))) : Smooth) : X → ℂ) _ U + apply (restrictSmooth_eq_iff U _ _).mp + rw [toSmooth_divShift,restrict_divT hU,restrict_divT hU] + congr 1 + funext j + exact cut_local χ hc hχ (u j) + +/-- The exact scalar augmented amplitude has the same eight-order truncation +plus a single h^8 defect. No unjustified differentiation of small L2 errors. -/ +theorem cut_truncation_divergence {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (h : ℂ) (hh : h≠0) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h₀ : normal θ (a 0).1=0) + (hrec : ∀ j ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) + (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) : + EqOn (divShift (h⁻¹ • θ) (fun j => cut χ hc ((truncation h N a).1 j)) : X → ℂ) + (cut χ hc ((truncation h N a).2+h^N • (div coord (a N).1-(a N).2))) U := by + intro x hx + rw [divShift_cut_local hU _ χ hc hχ _ hx,truncation_divergence_on hU θ h hh N a h₀ hrec hx, + cut_apply,hχ hx] + exact (one_mul _).symm +end ElasticityCGO + +end +namespace ElasticityCGO + +section +open scoped SchwartzMap BigOperators +open ElasticityAugmented +open ElasticityBessel (J norm2 norm2_nonneg J_smul norm2_const_smul) +open ElasticityNegativeOrder (H1_energy) +open ElasticitySchwartzCarleman (gradientMass_nonneg) + +lemma semiclassical_H1_le_H1 (h : ℝ) (hh : 0≤h) (hh1 : h≤1) (f : S) : + norm2 (J h 1 f)≤norm2 (J 1 1 f) := by + have hsq : h^2≤1 := by nlinarith + have he := H1_energy h f + have he1 := H1_energy 1 f + have hm := mul_le_mul_of_nonneg_right hsq (gradientMass_nonneg f) + norm_num only [one_pow,one_mul] at he1 hm + nlinarith only [he,he1,hm,norm2_nonneg (J h 1 f),norm2_nonneg (J 1 1 f)] + +/-- A literal finite Schwartz amplitude polynomial is uniformly bounded +in the semiclassical H1 norm. There is no h-dependent Sobolev constant. -/ +theorem finite_polynomial_H1_bound (N : ℕ) (f : ℕ → S) (h : ℝ) + (hh : 0≤h) (hh1 : h≤1) : + norm2 (J h 1 (truncation (h : ℂ) N f))≤ + ∑ j ∈ Finset.range (N+1),norm2 (J 1 1 (f j)) := by + rw [truncation,ElasticityPhysicalEstimate.J_sum] + apply (ElasticityNegativeOrder.norm2_sum_le _ _).trans + apply Finset.sum_le_sum + intro j _ + rw [J_smul,norm2_const_smul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hh] + calc + _ ≤ 1*norm2 (J h 1 (f j)) := + mul_le_mul_of_nonneg_right (pow_le_one₀ hh hh1) (norm2_nonneg _) + _ ≤ norm2 (J 1 1 (f j)) := by simpa only [one_mul] using semiclassical_H1_le_H1 h hh hh1 (f j) + +lemma cut_truncation (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (h : ℂ) (N : ℕ) (a : ℕ → Smooth) : + cut χ hc (truncation h N a)=truncation h N (fun j => cut χ hc (a j)) := by + simp only [truncation,map_sum,map_smul] + +/-- The formal smooth amplitudes need no global growth hypothesis: after +the actual compact cutoff, their finite order-eight truncations have a +uniform H_h^1 bound. -/ +theorem cut_polynomial_H1_bound (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (N : ℕ) (a : ℕ → Smooth) : + ∃ C : ℝ,0 norm2_nonneg _) + refine ⟨C,by dsimp [C]; linarith,fun h hh hh1 => ?_⟩ + rw [cut_truncation] + exact (finite_polynomial_H1_bound N _ h hh hh1).trans (by dsimp [C]; linarith) +end +open Set +open scoped SchwartzMap BigOperators +open ElasticityAugmented +open ElasticityBessel (J norm2 norm2_nonneg J_smul norm2_const_smul) +open ElasticityNegativeOrder (mult mult_apply) +open ElasticityPhysicalAlgebra (divShift) + +lemma truncation_scalar (h : ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) : + (truncation h N a).2=truncation h N (fun j => (a j).2) := by + induction N with + | zero => simp only [truncation_zero] + | succ N ih => + rw [truncation_succ,truncation_succ] + change (truncation h N a).2+h^(N+1) • (a (N+1)).2=_ + rw [ih] +lemma truncation_vector (h : ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) (i : Fin 3) : + (truncation h N a).1 i=truncation h N (fun j => (a j).1 i) := by + induction N with + | zero => simp only [truncation_zero] + | succ N ih => + rw [truncation_succ,truncation_succ] + change (truncation h N a).1 i+h^(N+1) • (a (N+1)).1 i=_ + rw [ih] + +lemma mult_eq_of_local {U : Set X} {g : X → ℂ} (hg : g.HasTemperateGrowth) + (hs : tsupport g⊆U) {f k : S} (hf : EqOn (f : X → ℂ) k U) : + mult g f=mult g k := by + ext x + rw [mult_apply g hg,mult_apply g hg] + by_cases h : g x=0 + · simp only [h,zero_mul] + · rw [hf (hs (subset_tsupport _ h))] + +lemma H1_monomial_bound (h : ℝ) (hh : 0≤h) (hh1 : h≤1) (N : ℕ) (f : S) : + norm2 (J h 1 ((h : ℂ)^N • f))≤norm2 (J 1 1 f) := by + rw [J_smul,norm2_const_smul,norm_pow,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hh] + exact (mul_le_mul_of_nonneg_right (pow_le_one₀ hh hh1) (norm2_nonneg _)).trans + (by simpa only [one_mul] using semiclassical_H1_le_H1 h hh hh1 f) + +/-- The formal divergence, localized strictly inside the physical region, +is uniformly H_h^1 bounded. The apparent h⁻¹ term is removed by the actual +finite divergence recurrence, not by estimating an independent scalar. -/ +theorem localized_formal_divergence_H1_bound {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h₀ : normal θ (a 0).1=0) + (hrec : ∀ j ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) + (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + {g : X → ℂ} (hg : g.HasTemperateGrowth) (hs : tsupport g⊆U) : + ∃ C : ℝ,0 cut χ hc ((truncation (h : ℂ) N a).1 j)))))≤C := by + let b : ℕ → S := fun j => mult g (cut χ hc (a j).2) + let d : S := mult g (cut χ hc (div coord (a N).1-(a N).2)) + let B := ∑ j ∈ Finset.range (N+1),norm2 (J 1 1 (b j)) + let D := norm2 (J 1 1 d) + have hB : 0≤B := Finset.sum_nonneg (fun j _ => norm2_nonneg _) + have hD : 0≤D := norm2_nonneg _ + refine ⟨1+B+D,by linarith only [hB,hD],fun h hh hh1 => ?_⟩ + have he := cut_truncation_divergence hU θ (h : ℂ) (Complex.ofReal_ne_zero.mpr hh.ne') + N a h₀ hrec χ hc hχ + rw [mult_eq_of_local hg hs he] + have hp : mult g (cut χ hc ((truncation (h : ℂ) N a).2+ + (h : ℂ)^N • (div coord (a N).1-(a N).2)))= + truncation (h : ℂ) N b+(h : ℂ)^N • d := by + rw [truncation_scalar] + simp only [map_add,map_smul,cut_truncation] + simp only [truncation,map_sum,map_smul,b,d] + rw [hp,ElasticityBessel.J_add] + calc + _ ≤ norm2 (J h 1 (truncation (h : ℂ) N b))+norm2 (J h 1 ((h : ℂ)^N • d)) := + ElasticityBessel.norm2_add_le _ _ + _ ≤ B+D := add_le_add (finite_polynomial_H1_bound N b h hh.le hh1) + (H1_monomial_bound h hh.le hh1 N d) + _ ≤ 1+B+D := by linarith +end ElasticityCGO +namespace ElasticityCGO +open Set +open scoped SchwartzMap BigOperators +open ElasticityAugmented +open ElasticityBessel (J norm2 norm2_nonneg) +open ElasticityNegativeOrder (mult sobNorm sumNorm) +open ElasticityPhysicalAlgebra (divShift) +open ElasticityPhysicalEstimate (physicalAug) + +lemma mult_cut_truncation_vector (g : X → ℂ) (χ : Smooth) + (hc : HasCompactSupport (χ : X → ℂ)) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h : ℂ) (i : Fin 3) : + mult g (cut χ hc ((truncation h N a).1 i))= + truncation h N (fun j => mult g (cut χ hc ((a j).1 i))) := by + rw [truncation_vector,cut_truncation] + simp only [truncation,map_sum,map_smul] + +/-- Fixed interior localization of the whole formal physical displacement +has a uniformly bounded ACTUAL four-component H_h^1 amplitude. The singular +phase is cancelled by the actual divergence recurrence. -/ +theorem localized_formal_augmented_H1_bound {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h₀ : normal θ (a 0).1=0) + (hrec : ∀ j ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) + (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + {g : X → ℂ} (hg : g.HasTemperateGrowth) (hs : tsupport g⊆U) : + ∃ C : ℝ,0 mult g (cut χ hc ((truncation (h : ℂ) N a).1 i))))≤C := by + obtain ⟨C,hC,hscalar⟩ := localized_formal_divergence_H1_bound hU θ N a h₀ hrec χ hc hχ hg hs + let dg : Fin 3 → X → ℂ := fun i x => fderiv ℝ g x (e i) + let B : Fin 3 → ℝ := fun i => ∑ j ∈ Finset.range (N+1), + norm2 (J 1 1 (mult g (cut χ hc ((a j).1 i)))) + let D : Fin 3 → ℝ := fun i => ∑ j ∈ Finset.range (N+1), + norm2 (J 1 1 (mult (dg i) (cut χ hc ((a j).1 i)))) + have hB (i) : 0≤B i := Finset.sum_nonneg (fun j _ => norm2_nonneg _) + have hD (i) : 0≤D i := Finset.sum_nonneg (fun j _ => norm2_nonneg _) + have hBs : 0≤∑ i,B i := Finset.sum_nonneg (fun i _ => hB i) + have hDs : 0≤∑ i,D i := Finset.sum_nonneg (fun i _ => hD i) + refine ⟨C+(∑ i,D i)+(∑ i,B i),by linarith only [hC,hBs,hDs],fun h hh hh1 => ?_⟩ + let u : Fin 3 → S := fun i => cut χ hc ((truncation (h : ℂ) N a).1 i) + have hv (i : Fin 3) : norm2 (J h 1 (mult g (u i)))≤B i := by + dsimp only [u] + rw [mult_cut_truncation_vector] + exact finite_polynomial_H1_bound N _ h hh.le hh1 + have hd (i : Fin 3) : norm2 (J h 1 (mult (dg i) (u i)))≤D i := by + dsimp only [u] + rw [mult_cut_truncation_vector] + exact finite_polynomial_H1_bound N _ h hh.le hh1 + have hsc : norm2 (J h 1 (divShift ((h : ℂ)⁻¹ • θ) (fun i => mult g (u i))))≤C+∑ i,D i := by + rw [divShift_mult _ g hg,ElasticityBessel.J_add,ElasticityPhysicalEstimate.J_sum] + apply (ElasticityBessel.norm2_add_le _ _).trans + exact add_le_add (hscalar h hh hh1) + ((ElasticityNegativeOrder.norm2_sum_le _ _).trans (Finset.sum_le_sum (fun i _ => hd i))) + apply (ElasticityNegativeOrder.sobNorm_le_sumNorm h 1 _).trans + change (∑ i : Fin 4,norm2 (J h 1 (physicalAug ((h : ℂ)⁻¹ • θ) + (fun j => mult g (u j)) i)))≤_ + rw [Fin.sum_univ_succ] + exact add_le_add hsc (Finset.sum_le_sum (fun i _ => hv i)) +end ElasticityCGO +namespace ElasticityCGO +open Set +open scoped SchwartzMap BigOperators +open ElasticityAugmented +open ElasticityBessel (J norm2) +open ElasticityNegativeOrder (mult sobNorm sumNorm) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityCoeffBounds (ExteriorConstant) + +lemma sobNorm_sub_four (h s : ℝ) (u v : Fin 4 → S) : + sobNorm h s (u-v)≤2*(sobNorm h s u+sobNorm h s v) := by + apply (ElasticityNegativeOrder.sobNorm_le_sumNorm h s _).trans + have hs : sumNorm h s (u-v)≤ sumNorm h s u+sumNorm h s v := by + simp only [sumNorm,Pi.sub_apply,ElasticityNegativeOrder.J_sub,← Finset.sum_add_distrib] + exact Finset.sum_le_sum (fun i _ => ElasticityNegativeOrder.norm2_sub_le _ _) + have hu := ElasticityNegativeOrder.sumNorm_four_le h s u + have hv := ElasticityNegativeOrder.sumNorm_four_le h s v + linarith only [hs,hu,hv] + +/-- Literal original-PDE CGO solutions can be chosen with a uniformly +bounded actual compact augmented amplitude. Both the formal divergence and +the correction divergence are proved bounds, not additional assumptions. -/ +theorem localized_actual_amplitude_bound (R : ℝ) (hR : 1≤R) (α β : X) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (a : ℕ → Amplitude Smooth) (ha : PhysicalColumn R hR α β lam m a) + (h₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,EqOn + (fun x => ((normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) (Metric.ball 0 R)) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆Metric.ball 0 R) : + ∃ C h₁ : ℝ,0 mult g + (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation (h : ℂ) 8 a).1 i)-v i)))≤C := by + let χ : Smooth := ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ + have hcχ : HasCompactSupport (χ : X → ℂ) := fiveCutoff_compact R hR 0 + obtain ⟨A,hA,hformal⟩ := localized_formal_augmented_H1_bound Metric.isOpen_ball + (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) 8 a h₀ hrec χ hcχ + (fiveCutoff_initial R hR) (hc.hasTemperateGrowth hg) hs + obtain ⟨D,h₁,hD,hh₁,hh₁1,hsol⟩ := physical_column_localized_realization + R hR α β lam m hl hm a ha hg hc hs + refine ⟨2*(A+D),h₁,by linarith only [hA,hD],hh₁,fun h hh hsmall => ?_⟩ + obtain ⟨w,q,v,_hv,hp,_hq,_hw,_hn,hbound⟩ := hsol h hh hsmall + refine ⟨v,hp,?_⟩ + have hh1 : h≤1 := hsmall.trans hh₁1 + have hf := hformal h hh hh1 + rw [← phase_eq] at hf + let u : Fin 3 → S := fun i => mult g (cut χ hcχ ((truncation (h : ℂ) 8 a).1 i)) + let v' : Fin 3 → S := fun i => mult g (v i) + have he : (fun i => mult g (cut χ hcχ ((truncation (h : ℂ) 8 a).1 i)-v i))=u-v' := by + funext i + exact map_sub (mult g) _ _ + change sobNorm h 1 (physicalAug (phase h α β) + (fun i => mult g (cut χ hcχ ((truncation (h : ℂ) 8 a).1 i)-v i)))≤_ + rw [he,ElasticityPhysicalEstimate.physicalAug_sub] + have hn := sobNorm_sub_four h 1 (physicalAug (phase h α β) u) (physicalAug (phase h α β) v') + change sobNorm h 1 (physicalAug (phase h α β) u)≤A at hf + change sobNorm h 1 (physicalAug (phase h α β) v')≤D*h at hbound + have hDh : D*h≤D := by nlinarith only [hD,hh1] + linarith only [hn,hf,hbound,hDh] +end ElasticityCGO + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Planar.lean b/lean/OAI/MathematicalPhysics/Elasticity/Planar.lean new file mode 100644 index 0000000000000000000000000000000000000000..975ccd49e7ac35302b6c6e8256a10d07b6f12463 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Planar.lean @@ -0,0 +1,1330 @@ +import OAI.MathematicalPhysics.Elasticity.LocalRegularity +import OAI.MathematicalPhysics.Elasticity.Compact + +namespace OAI + +noncomputable section + +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution Set +open scoped SchwartzMap ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +/-- A joint smooth compactly spatially supported coefficient yields a genuinely +operator-norm-smooth family of actual L2 multipliers. -/ +theorem exists_smooth_lp_multiplier {S : Set E} (hS : IsCompact S) + (a : P × E → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hs : ∀ p x, x∉S → a (p,x)=0) : + ∃ M : P → Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ContDiff ℝ (⊤ : ℕ∞) M ∧ ∀ p f, + (M p f : 𝓢'(E,ℂ))=smulLeftCLM ℂ (fun x => a (p,x)) (f : 𝓢'(E,ℂ)) := by + let : CompactSpace S := isCompact_iff_compactSpace.mp hS + obtain ⟨b,hb,hbe⟩ := ElasticityCompact.exists_smooth_linf_family hS.measurableSet + (volume : Measure E) a ha hs + let B := (ContinuousLinearMap.mul ℂ ℂ).holderL (volume : Measure E) ∞ 2 2 + refine ⟨fun p => B (b p),(B.restrictScalars ℝ).contDiff.comp hb,fun p f => ?_⟩ + have ha' : ContDiff ℝ (⊤ : ℕ∞) (fun x => a (p,x)) := + ha.comp (contDiff_const.prodMk contDiff_id) + have hc : HasCompactSupport (fun x => a (p,x)) := by + apply hS.of_isClosed_subset (isClosed_tsupport _) + apply closure_minimal _ hS.isClosed + intro x hx + contrapose! hx + simpa only [Function.mem_support,not_not] using hs p x hx + have hm := compact_bounded_multiplier ha' hc + have hprod : B (b p) f=(hm.toLp (fun x => a (p,x))) • f := by + apply Lp.ext + filter_upwards [(ContinuousLinearMap.mul ℂ ℂ).coeFn_holder (r := 2) (b p) f, + Lp.coeFn_lpSMul (r := 2) (hm.toLp _) f,hm.coeFn_toLp,hbe p] with x h₁ h₂ h₃ h₄ + change ((ContinuousLinearMap.mul ℂ ℂ).holder 2 (b p) f) x=_ + rw [h₁,h₂] + simp only [Pi.smul_apply',h₃,h₄] + rfl + rw [hprod,Lp.toTemperedDistribution_smul_eq (hc.hasTemperateGrowth ha') hm] +end ElasticityRegularity +namespace ElasticityPlanar +open MeasureTheory Complex + +def testSubmodule : Submodule ℂ (ℂ → ℂ) where + carrier := {f | ContDiff ℝ (⊤ : ℕ∞) f ∧ HasCompactSupport f} + add_mem' := by + intro f g hf hg + change ContDiff ℝ (⊤ : ℕ∞) f ∧ HasCompactSupport f at hf + change ContDiff ℝ (⊤ : ℕ∞) g ∧ HasCompactSupport g at hg + exact ⟨hf.1.add hg.1, hf.2.add hg.2⟩ + zero_mem' := by + exact ⟨contDiff_const (c := (0 : ℂ)), HasCompactSupport.zero⟩ + smul_mem' := by + intro a f hf + change ContDiff ℝ (⊤ : ℕ∞) f ∧ HasCompactSupport f at hf + constructor + · exact hf.1.const_smul a + · change HasCompactSupport (fun z => a * f z) + exact hf.2.mul_left + +abbrev Test := testSubmodule + +instance : CoeFun Test (fun _ => ℂ → ℂ) := ⟨fun f => f.val⟩ + +lemma smooth (f : Test) : ContDiff ℝ (⊤ : ℕ∞) (f : ℂ → ℂ) := f.property.1 +lemma compact (f : Test) : HasCompactSupport (f : ℂ → ℂ) := f.property.2 + +def d (v : ℂ) : Test →ₗ[ℂ] Test where + toFun f := ⟨fun z => fderiv ℝ (f : ℂ → ℂ) z v, by + constructor + · exact ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const + · exact (compact f).fderiv_apply ℝ v⟩ + map_add' f g := by + apply Subtype.ext + funext z + exact congrArg (fun L : ℂ →L[ℝ] ℂ => L v) + (fderiv_add ((smooth f).differentiable (by simp) z) + ((smooth g).differentiable (by simp) z)) + map_smul' a f := by + apply Subtype.ext + funext z + exact congrArg (fun L : ℂ →L[ℝ] ℂ => L v) + (fderiv_const_smul ((smooth f).differentiable (by simp) z) a) + +@[simp] lemma d_apply (v : ℂ) (f : Test) (z : ℂ) : + (d v f : ℂ → ℂ) z = fderiv ℝ (f : ℂ → ℂ) z v := rfl + +def mulSmooth (a : ℂ → ℂ) (ha : ContDiff ℝ (⊤ : ℕ∞) a) : Test →ₗ[ℂ] Test where + toFun f := ⟨fun z => a z * f z, ⟨ha.mul (smooth f), (compact f).mul_left⟩⟩ + map_add' f g := by + apply Subtype.ext + funext z + exact mul_add _ _ _ + map_smul' c f := by + apply Subtype.ext + funext z + change a z * (c * f z) = c * (a z * f z) + ring + +def Z : Test →ₗ[ℂ] Test := mulSmooth id contDiff_id +def Zbar : Test →ₗ[ℂ] Test := mulSmooth star Complex.conjCLE.contDiff + +@[simp] lemma Z_apply (f : Test) (z : ℂ) : (Z f : ℂ → ℂ) z = z * f z := rfl +@[simp] lemma Zbar_apply (f : Test) (z : ℂ) : (Zbar f : ℂ → ℂ) z = star z * f z := rfl + +lemma d_Z (v : ℂ) (f : Test) : d v (Z f) = v • f + Z (d v f) := by + apply Subtype.ext + funext z + change fderiv ℝ (fun z => z * f z) z v = v * f z + z * ((d v f : ℂ → ℂ) z) + have h := congrArg (fun L : ℂ →L[ℝ] ℂ => L v) + ((hasFDerivAt_id z).mul ((smooth f).differentiable (by simp) z).hasFDerivAt).fderiv + simpa [d_apply, add_comm, mul_comm, Pi.mul_def] using h + +lemma deriv_conj (f : Test) (z v : ℂ) : + fderiv ℝ (fun z => star (f z)) z v = star (fderiv ℝ (f : ℂ → ℂ) z v) := by + have h := (Complex.conjCLE.hasFDerivAt.comp z + ((smooth f).differentiable (by simp) z).hasFDerivAt).fderiv + exact congrArg (fun L : ℂ →L[ℝ] ℂ => L v) h + +lemma d_Zbar (v : ℂ) (f : Test) : d v (Zbar f) = (star v) • f + Zbar (d v f) := by + apply Subtype.ext + funext z + change fderiv ℝ (fun z => star z * f z) z v = star v * f z + star z * ((d v f : ℂ → ℂ) z) + have h := congrArg (fun L : ℂ →L[ℝ] ℂ => L v) + ((Complex.conjCLE.hasFDerivAt (x := z)).mul + ((smooth f).differentiable (by simp) z).hasFDerivAt).fderiv + simpa [d_apply, Complex.star_def, add_comm, mul_comm, Pi.mul_def] using h + +lemma d_d (v w : ℂ) (f : Test) (z : ℂ) : + (d v (d w f) : ℂ → ℂ) z = fderiv ℝ (fderiv ℝ (f : ℂ → ℂ)) z v w := by + have hd : Differentiable ℝ (fderiv ℝ (f : ℂ → ℂ)) := + ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ (f : ℂ → ℂ) y w) z v = _ + rw [fderiv_clm_apply (hd z) (differentiableAt_const w)] + simp + +lemma d_comm (v w : ℂ) (f : Test) : d v (d w f) = d w (d v f) := by + apply Subtype.ext + funext z + rw [d_d, d_d] + exact (smooth f).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) _ _ + +def pair (f g : Test) : ℂ := ∫ z : ℂ, star (f z) * g z + +lemma integrable_pair (f g : Test) : Integrable (fun z : ℂ => star (f z)*g z) := by + exact ((Complex.conjCLE.continuous.comp (smooth f).continuous).mul (smooth g).continuous).integrable_of_hasCompactSupport (compact g).mul_left + +lemma pair_add_right (f g h : Test) : pair f (g+h) = pair f g + pair f h := by + simpa only [pair, Submodule.coe_add, Pi.add_apply, mul_add] using + integral_add (integrable_pair f g) (integrable_pair f h) + +lemma pair_add_left (f g h : Test) : pair (f+g) h = pair f h + pair g h := by + simpa only [pair, Submodule.coe_add, Pi.add_apply, star_add, add_mul] using + integral_add (integrable_pair f h) (integrable_pair g h) + +lemma pair_sub_right (f g h : Test) : pair f (g-h) = pair f g - pair f h := by + simpa only [pair, Submodule.coe_sub, Pi.sub_apply, mul_sub] using + integral_sub (integrable_pair f g) (integrable_pair f h) + +lemma pair_sub_left (f g h : Test) : pair (f-g) h = pair f h - pair g h := by + simpa only [pair, Submodule.coe_sub, Pi.sub_apply, star_sub, sub_mul] using + integral_sub (integrable_pair f h) (integrable_pair g h) + +lemma pair_smul_right (f g : Test) (a : ℂ) : pair f (a • g) = a * pair f g := by + simp only [pair, Submodule.coe_smul, Pi.smul_apply, smul_eq_mul] + simp_rw [← mul_assoc, mul_comm (star (f _)) a, mul_assoc] + exact integral_const_mul a _ + +lemma pair_smul_left (f g : Test) (a : ℂ) : pair (a • f) g = star a * pair f g := by + simp only [pair, Submodule.coe_smul, Pi.smul_apply, smul_eq_mul, star_mul, mul_comm (star (f _)), mul_assoc] + exact integral_const_mul (star a) _ + +/-- Coordinate derivatives are skew adjoint on the actual test space. -/ +lemma pair_d (f g : Test) (v : ℂ) : pair f (d v g) = -pair (d v f) g := by + have h1 : Integrable (fun z : ℂ => fderiv ℝ (fun z => star (f z)) z v * g z) := by + simpa only [deriv_conj, d_apply] using integrable_pair (d v f) g + have h2 : Integrable (fun z : ℂ => star (f z)*fderiv ℝ (g : ℂ → ℂ) z v) := + integrable_pair f (d v g) + exact integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable h1 h2 (integrable_pair f g) + (fun z _ => Complex.conjCLE.differentiableAt.comp z ((smooth f).differentiable (by simp) z)) + (fun z _ => (smooth g).differentiable (by simp) z) + |>.trans (by simp only [pair, deriv_conj, d_apply]) + +lemma pair_Z (f g : Test) : pair f (Z g) = pair (Zbar f) g := by + apply integral_congr_ae + filter_upwards [] with z + simp [mul_comm, mul_left_comm, mul_assoc] + +lemma pair_Zbar (f g : Test) : pair f (Zbar g) = pair (Z f) g := by + apply integral_congr_ae + filter_upwards [] with z + simp [mul_comm, mul_left_comm] + +/-- Twice dbar conjugated by exp(t|z|²/2). -/ +def B (t : ℝ) : Test →ₗ[ℂ] Test := d 1 + Complex.I • d Complex.I - (t : ℂ) • Z +/-- Formal Hermitian adjoint. -/ +def C (t : ℝ) : Test →ₗ[ℂ] Test := -d 1 + Complex.I • d Complex.I - (t : ℂ) • Zbar + +lemma pair_B (f g : Test) (t : ℝ) : pair f (B t g) = pair (C t f) g := by + simp only [B, C, LinearMap.add_apply, LinearMap.sub_apply, LinearMap.smul_apply, + LinearMap.neg_apply, pair_add_right, pair_sub_right, pair_smul_right, + pair_add_left, pair_sub_left, pair_smul_left, pair_d, pair_Z, + ← neg_one_smul ℂ (d 1 f), pair_smul_left, map_neg, map_one, + Complex.star_def, Complex.conj_I, Complex.conj_ofReal] + ring + +lemma pair_C (f g : Test) (t : ℝ) : pair f (C t g) = pair (B t f) g := by + simp only [B, C, LinearMap.add_apply, LinearMap.sub_apply, LinearMap.smul_apply, + LinearMap.neg_apply, pair_add_right, pair_sub_right, pair_smul_right, + pair_add_left, pair_sub_left, pair_smul_left, pair_d, pair_Zbar, + ← neg_one_smul ℂ (d 1 g), pair_smul_right, Complex.star_def, Complex.conj_I, Complex.conj_ofReal] + ring + +lemma Z_Zbar (f : Test) : Z (Zbar f) = Zbar (Z f) := by + apply Subtype.ext + funext z + change z * (star z * f z) = star z * (z * f z) + ring + +/-- Positive commutator of the two Gaussian-conjugated planar operators. -/ +lemma commutator (t : ℝ) (f : Test) : + C t (B t f) - B t (C t f) = (4 * (t : ℂ)) • f := by + simp only [B, C, LinearMap.add_apply, LinearMap.sub_apply, LinearMap.smul_apply, + LinearMap.neg_apply, map_add, map_sub, map_smul, map_neg, d_Z, d_Zbar, + star_one, Complex.star_def, Complex.conj_I] + rw [d_comm I 1 f, Z_Zbar f] + trans (2 * (t : ℂ) - 2 * (t : ℂ) * I ^ 2) • f + · module + · congr 1 + rw [Complex.I_sq] + ring + +lemma energy_identity (t : ℝ) (f : Test) : + pair (B t f) (B t f) - pair (C t f) (C t f) = + (4 * (t : ℂ)) * pair f f := by + calc + _ = pair f (C t (B t f) - B t (C t f)) := by + rw [pair_sub_right, pair_C f (B t f) t, pair_B f (C t f) t] + _ = _ := by rw [commutator, pair_smul_right] + +def mass (f : Test) : ℝ := (pair f f).re + +lemma mass_integral (f : Test) : mass f = ∫ z : ℂ, Complex.normSq (f z) := by + have h := integral_re (integrable_pair f f) + simpa only [mass, pair, Complex.star_def, ← Complex.normSq_eq_conj_mul_self, + RCLike.re_to_complex, Complex.ofReal_re] using h.symm + +lemma integrable_normSq (f : Test) : Integrable (fun z : ℂ => Complex.normSq (f z)) := by + have h := (integrable_pair f f).re + simpa only [Complex.star_def, ← Complex.normSq_eq_conj_mul_self, + RCLike.re_to_complex, Complex.ofReal_re] using h + +lemma mass_nonneg (f : Test) : 0 ≤ mass f := by + rw [mass_integral] + exact integral_nonneg fun _ => Complex.normSq_nonneg _ + +lemma mass_eq_zero (f : Test) (h : mass f = 0) : f = 0 := by + rw [mass_integral] at h + have hae := (integral_eq_zero_iff_of_nonneg + (fun z : ℂ => Complex.normSq_nonneg (f z)) (integrable_normSq f)).mp h + have hf : (f : ℂ → ℂ) =ᵐ[volume] 0 := by + filter_upwards [hae] with z hz + exact Complex.normSq_eq_zero.mp hz + apply Subtype.ext + exact ((smooth f).continuous.ae_eq_iff_eq volume continuous_zero).mp hf + +/-- An actual weighted support estimate, independent of any frame existence. -/ +theorem gaussian_coercivity (t : ℝ) (f : Test) : + 4 * t * mass f ≤ mass (B t f) := by + have h := congrArg Complex.re (energy_identity t f) + simp only [Complex.sub_re, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.re_ofNat, Complex.im_ofNat, mul_zero, sub_zero, zero_mul, add_zero] at h + change mass (B t f) - mass (C t f) = 4 * t * mass f at h + linarith [mass_nonneg (C t f)] + +def gaussian (t : ℝ) (z : ℂ) : ℂ := + Complex.exp (((t : ℂ) / 2) * (z * star z)) + +lemma smooth_gaussian (t : ℝ) : ContDiff ℝ (⊤ : ℕ∞) (gaussian t) := by + exact (contDiff_const.mul (contDiff_id.mul Complex.conjCLE.contDiff)).cexp + +def W (t : ℝ) : Test →ₗ[ℂ] Test := mulSmooth (gaussian t) (smooth_gaussian t) + +@[simp] lemma W_apply (t : ℝ) (f : Test) (z : ℂ) : + (W t f : ℂ → ℂ) z = gaussian t z * f z := rfl + +lemma gaussian_ne_zero (t : ℝ) (z : ℂ) : gaussian t z ≠ 0 := Complex.exp_ne_zero _ + +lemma fderiv_gaussian (t : ℝ) (z v : ℂ) : + fderiv ℝ (gaussian t) z v = + gaussian t z * ((t : ℂ) / 2) * (v * star z + z * star v) := by + have hd := (((hasFDerivAt_id z).mul (Complex.conjCLE.hasFDerivAt (x := z))).const_mul + ((t : ℂ) / 2)).cexp + have he := congrArg (fun L : ℂ →L[ℝ] ℂ => L v) hd.fderiv + change fderiv ℝ (gaussian t) z v = _ at he + rw [he] + simp only [smul_apply, add_apply, + smul_eq_mul, Complex.conjCLE_apply] + change gaussian t z * ((t : ℂ) / 2 * (z * star v + star z * v)) = _ + ring + +lemma d_W (t : ℝ) (v : ℂ) (f : Test) (z : ℂ) : + (d v (W t f) : ℂ → ℂ) z = gaussian t z * + (((t : ℂ) / 2) * (v * star z + z * star v) * f z + (d v f : ℂ → ℂ) z) := by + have hd := ((smooth_gaussian t).differentiable (by simp) z).hasFDerivAt.mul + ((smooth f).differentiable (by simp) z).hasFDerivAt + have he := congrArg (fun L : ℂ →L[ℝ] ℂ => L v) hd.fderiv + change fderiv ℝ (fun z => gaussian t z * f z) z v = _ + simp only [Pi.mul_def] at he + rw [he] + simp only [add_apply, smul_apply, + smul_eq_mul, fderiv_gaussian, d_apply] + ring + +/-- Exact Gaussian conjugation of twice the planar Cauchy--Riemann operator. -/ +lemma gaussian_conjugation (t : ℝ) (f : Test) : + B t (W t f) = W t (d 1 f + I • d I f) := by + apply Subtype.ext + funext z + change (d 1 (W t f) : ℂ → ℂ) z + I * (d I (W t f) : ℂ → ℂ) z - + (t : ℂ) * (z * (gaussian t z * f z)) = + gaussian t z * ((d 1 f : ℂ → ℂ) z + I * (d I f : ℂ → ℂ) z) + rw [d_W, d_W] + simp only [star_one, Complex.star_def, Complex.conj_I] + ring_nf + simp only [Complex.I_sq] + ring + +open scoped BigOperators + +lemma normSq_sum_mul {n : Type*} [Fintype n] (a u : n → ℂ) : + Complex.normSq (∑ j, a j * u j) ≤ + (∑ j, Complex.normSq (a j)) * ∑ j, Complex.normSq (u j) := by + simp only [Complex.normSq_eq_norm_sq] + have h := norm_sum_le Finset.univ (fun j => a j * u j) + simp only [norm_mul] at h + exact (pow_le_pow_left₀ (norm_nonneg _) h 2).trans + (Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (fun j => ‖a j‖) (fun j => ‖u j‖)) + +lemma mass_bound {n : Type*} [Fintype n] (f : Test) (u : n → Test) (K : ℝ) + (h : ∀ z : ℂ, Complex.normSq (f z) ≤ K * ∑ j, Complex.normSq (u j z)) : + mass f ≤ K * ∑ j, mass (u j) := by + simp only [mass_integral] + have hi : Integrable (fun z : ℂ => ∑ j, Complex.normSq (u j z)) := + integrable_finsetSum _ (fun j _ => integrable_normSq (u j)) + calc + _ ≤ ∫ z : ℂ, K * ∑ j, Complex.normSq (u j z) := + integral_mono (integrable_normSq f) (hi.const_mul K) h + _ = _ := by + rw [integral_const_mul, integral_finsetSum _ (fun j _ => integrable_normSq (u j))] + +/-- Compact-kernel uniqueness with a coefficient bound only where a column is +nonzero. This is a genuine analytic theorem, not an assumed continuation rule. -/ +theorem compact_kernel_of_bound {n : Type*} [Fintype n] + (a : n → n → ℂ → ℂ) (u : n → Test) (K : ℝ) + (hb : ∀ z : ℂ, (∃ j, u j z ≠ 0) → ∀ i, + (∑ j, Complex.normSq (a i j z)) ≤ K) + (heq : ∀ i (z : ℂ), + (d 1 (u i) + I • d I (u i) : Test) z = ∑ j, a i j z * u j z) : + ∀ i, u i = 0 := by + classical + let t : ℝ := (Fintype.card n : ℝ) * K + 1 + let w : n → Test := fun i => W t (u i) + have hBw (i : n) (z : ℂ) : + (B t (w i) : Test) z = ∑ j, a i j z * w j z := by + dsimp [w] + rw [gaussian_conjugation, W_apply, heq] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + have hpoint (i : n) (z : ℂ) : + Complex.normSq ((B t (w i) : Test) z) ≤ K * ∑ j, Complex.normSq (w j z) := by + rw [hBw] + by_cases hu : ∃ j, u j z ≠ 0 + · exact (normSq_sum_mul (fun j => a i j z) (fun j => w j z)).trans + (mul_le_mul_of_nonneg_right (hb z hu i) + (Finset.sum_nonneg fun j _ => Complex.normSq_nonneg _)) + · have hw : ∀ j, w j z = 0 := by + intro j + have h := not_exists.mp hu j + simp only [not_not] at h + simp [w, h] + simp [hw] + have hi (i : n) : mass (B t (w i)) ≤ K * ∑ j, mass (w j) := + mass_bound _ w K (hpoint i) + have h := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => + (gaussian_coercivity t (w i)).trans (hi i)) + simp only [← Finset.mul_sum, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] at h + have hn : 0 ≤ ∑ i, mass (w i) := Finset.sum_nonneg fun i _ => mass_nonneg _ + have hz : ∑ i, mass (w i) = 0 := by + by_contra hne + have hp : 0 < ∑ i, mass (w i) := lt_of_le_of_ne hn (Ne.symm hne) + have htK : (Fintype.card n : ℝ) * K ≥ 0 := by + by_cases hnon : ∃ j z, u j z ≠ 0 + · obtain ⟨j, z, hj⟩ := hnon + have hk : 0 ≤ K := (Finset.sum_nonneg + (fun k (_ : k ∈ Finset.univ) => Complex.normSq_nonneg (a j k z))).trans + (hb z ⟨j, hj⟩ j) + exact mul_nonneg (Nat.cast_nonneg _) hk + · have hw : ∀ j, w j = 0 := by + intro j + apply Subtype.ext + funext z + have hj : u j z = 0 := by simpa using not_exists.mp (not_exists.mp hnon j) z + simp [w, hj] + have hm : ∑ i, mass (w i) = 0 := by simp [hw, mass, pair] + exact False.elim (hne hm) + dsimp [t] at h + nlinarith + have hz' : ∀ i, mass (w i) = 0 := fun i => + (Finset.sum_eq_zero_iff_of_nonneg (fun j _ => mass_nonneg (w j))).mp hz i + (Finset.mem_univ _) + intro i + have hw := mass_eq_zero (w i) (hz' i) + apply Subtype.ext + funext z + have hval := congrArg (fun f : Test => f z) hw + change gaussian t z * u i z = 0 at hval + exact (mul_eq_zero.mp hval).resolve_left (gaussian_ne_zero t z) + +/-- A smooth compactly supported solution of a planar matrix Cauchy--Riemann +system with continuous coefficients is zero. No smallness is imposed. -/ +theorem compact_kernel {n : Type*} [Fintype n] + (a : n → n → ℂ → ℂ) (ha : ∀ i j, Continuous (a i j)) + (u : n → Test) + (heq : ∀ i (z : ℂ), + (d 1 (u i) + I • d I (u i) : Test) z = ∑ j, a i j z * u j z) : + ∀ i, u i = 0 := by + classical + let S : Set ℂ := ⋃ i, tsupport (u i : ℂ → ℂ) + have hc : IsCompact S := isCompact_iUnion fun i => compact (u i) + let F : ℂ → ℝ := fun z => ∑ i, ∑ j, Complex.normSq (a i j z) + have hF : Continuous F := by + dsimp [F] + fun_prop + obtain ⟨K, hK⟩ := hc.exists_bound_of_continuousOn hF.continuousOn + apply compact_kernel_of_bound a u K ?_ heq + intro z hz i + have hmem : z ∈ S := by + obtain ⟨j, hj⟩ := hz + exact Set.mem_iUnion.mpr ⟨j, subset_tsupport _ hj⟩ + calc + (∑ j, Complex.normSq (a i j z)) ≤ F z := by + dsimp [F] + exact Finset.single_le_sum (f := fun k => ∑ j, Complex.normSq (a k j z)) + (fun k _ => Finset.sum_nonneg (fun j _ => Complex.normSq_nonneg _)) + (Finset.mem_univ i) + _ ≤ ‖F z‖ := le_abs_self _ + _ ≤ K := hK z hmem + +end ElasticityPlanar +namespace ElasticityPlanar +open MeasureTheory Complex Set +open scoped BigOperators + +lemma normSq_add_le (z w : ℂ) : + normSq (z+w) ≤ 2*normSq z+2*normSq w := by + simp only [normSq_eq_norm_sq] + have h := pow_le_pow_left₀ (norm_nonneg _) (norm_add_le z w) 2 + nlinarith [sq_nonneg (‖z‖-‖w‖)] + +lemma mass_add_le (f g : Test) : mass (f+g) ≤ 2*mass f+2*mass g := by + rw [mass_integral,mass_integral,mass_integral] + calc + _ ≤ ∫ z : ℂ, (2*normSq (f z)+2*normSq (g z)) := + integral_mono (integrable_normSq (f+g)) + (((integrable_normSq f).const_mul 2).add ((integrable_normSq g).const_mul 2)) + (fun z => normSq_add_le _ _) + _ = _ := by rw [integral_add ((integrable_normSq f).const_mul 2) + ((integrable_normSq g).const_mul 2),integral_const_mul,integral_const_mul] + +lemma mass_mul_bound (f g : Test) (K : ℝ) + (hb : ∀ z, normSq (f z) ≤ K*normSq (g z)) : mass f ≤ K*mass g := by + simpa using (mass_bound (n := Unit) f (fun _ => g) K (by simpa using hb)) + +lemma mass_smul (k : ℂ) (f : Test) : mass (k • f)=normSq k*mass f := by + rw [mass_integral,mass_integral,← integral_const_mul] + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun z => normSq_mul k (f z)) + +lemma pair_derivative_cross (f : Test) : pair (d 1 f) (d I f)=pair (d I f) (d 1 f) := by + calc + _ = -pair f (d 1 (d I f)) := by rw [pair_d f (d I f) 1]; simp + _ = -pair f (d I (d 1 f)) := by rw [d_comm] + _ = _ := by rw [pair_d f (d 1 f) I]; simp + +/-- The exact two-dimensional elliptic energy identity for the actual dbar operator. -/ +lemma dbar_energy (f : Test) : + mass (d 1 f + I • d I f)=mass (d 1 f)+mass (d I f) := by + have h : pair (d 1 f + I • d I f) (d 1 f + I • d I f)= + pair (d 1 f) (d 1 f)+pair (d I f) (d I f) := by + rw [pair_add_left, pair_add_right, pair_add_right, + pair_smul_right, pair_smul_left, pair_smul_left, pair_smul_right, + pair_derivative_cross] + simp only [Complex.star_def, Complex.conj_I] + calc + _ = pair (d 1 f) (d 1 f)-I^2*pair (d I f) (d I f) := by ring + _ = _ := by simp + exact congrArg Complex.re h + +/-- Quantitative Gaussian absorption for a system with no smallness of coefficients. -/ +theorem weighted_inhomogeneous_bound {n : Type*} [Fintype n] + (a : n → n → ℂ → ℂ) (u v : n → Test) (K : ℝ) (hK : 0 ≤ K) + (hb : ∀ z, (∃ j, u j z ≠ 0) → ∀ i, (∑ j, normSq (a i j z)) ≤ K) + (heq : ∀ i z, (d 1 (u i)+I • d I (u i) : Test) z = + v i z+∑ j, a i j z*u j z) : + let t := (Fintype.card n : ℝ)*K+1 + (∑ i, mass (W t (u i))) ≤ ∑ i, mass (W t (v i)) := by + classical + dsimp only + let t : ℝ := (Fintype.card n : ℝ)*K+1 + let w : n → Test := fun i => W t (u i) + let f : n → Test := fun i => W t (v i) + have hi (i : n) : mass (B t (w i)) ≤ + 2*mass (f i)+2*K*∑ j, mass (w j) := by + have hp (z : ℂ) : normSq ((B t (w i) : Test) z) ≤ + 2*normSq (f i z)+2*K*∑ j, normSq (w j z) := by + have he : (B t (w i) : Test) z=f i z+∑ j, a i j z*w j z := by + dsimp [w,f] + rw [gaussian_conjugation,W_apply,heq,mul_add,Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro j _ + ring + rw [he] + apply (normSq_add_le _ _).trans + have hm : normSq (∑ j, a i j z*w j z) ≤ K*∑ j, normSq (w j z) := by + by_cases hu : ∃ j, u j z ≠ 0 + · exact (normSq_sum_mul (fun j => a i j z) (fun j => w j z)).trans + (mul_le_mul_of_nonneg_right (hb z hu i) + (Finset.sum_nonneg fun j _ => normSq_nonneg _)) + · have hw : ∀ j, w j z=0 := by + intro j + have hj : u j z=0 := by simpa using not_exists.mp hu j + simp [w,hj] + simp [hw] + linarith + rw [mass_integral,mass_integral] + simp only [mass_integral] + calc + _ ≤ ∫ z : ℂ, (2*normSq (f i z)+2*K*∑ j, normSq (w j z)) := + integral_mono (integrable_normSq _) (((integrable_normSq _).const_mul 2).add + ((integrable_finsetSum _ (fun j _ => integrable_normSq (w j))).const_mul _)) hp + _ = _ := by + rw [integral_add ((integrable_normSq _).const_mul 2) + ((integrable_finsetSum _ (fun j _ => integrable_normSq (w j))).const_mul _), + integral_const_mul,integral_const_mul, + integral_finsetSum _ (fun j _ => integrable_normSq (w j))] + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => + (gaussian_coercivity t (w i)).trans (hi i)) + simp only [Finset.sum_add_distrib,← Finset.mul_sum,Finset.sum_const, + Finset.card_univ,nsmul_eq_mul] at hs + have hn : 0 ≤ (Fintype.card n : ℝ)*K := mul_nonneg (Nat.cast_nonneg _) hK + have hw : 0 ≤ ∑ i, mass (w i) := Finset.sum_nonneg fun i _ => mass_nonneg _ + change (∑ i, mass (w i)) ≤ ∑ i, mass (f i) + dsimp [t] at hs + nlinarith [mul_nonneg hn hw] + + +lemma gaussian_inv (t : ℝ) (z : ℂ) : gaussian (-t) z*gaussian t z=1 := by + rw [gaussian,gaussian,← Complex.exp_add] + have h : (((-t : ℝ) : ℂ)/2)*(z*star z)+((t : ℂ)/2)*(z*star z)=0 := by + push_cast + ring + rw [h,Complex.exp_zero] + +lemma supported_weight_bound {S : Set ℂ} (hS : IsCompact S) (t : ℝ) : + ∃ C : ℝ, 0 normSq (gaussian t z)) := + continuous_normSq.comp (smooth_gaussian t).continuous + obtain ⟨K,hK⟩ := hS.exists_bound_of_continuousOn hc.continuousOn + refine ⟨max K 1,lt_of_lt_of_le zero_lt_one (le_max_right _ _),?_⟩ + intro f hf + apply mass_mul_bound + intro z + rw [W_apply,normSq_mul] + by_cases hz : f z=0 + · simp [hz] + · apply mul_le_mul_of_nonneg_right _ (normSq_nonneg _) + exact (le_abs_self (normSq (gaussian t z))).trans + ((hK z (hf (subset_tsupport _ hz))).trans (le_max_left _ _)) + +lemma supported_weight_equivalence {S : Set ℂ} (hS : IsCompact S) (t : ℝ) : + ∃ C : ℝ, 0 ∑ i, ∑ j, normSq (a i j z) + have hF : Continuous F := by dsimp [F]; fun_prop + obtain ⟨K,hK⟩ := hS.exists_bound_of_continuousOn hF.continuousOn + refine ⟨max K 0,le_max_right _ _,?_⟩ + intro z hz i + calc + _ ≤ F z := Finset.single_le_sum (fun k _ => Finset.sum_nonneg + (fun j _ => normSq_nonneg _)) (Finset.mem_univ i) + _ ≤ ‖F z‖ := le_abs_self _ + _ ≤ K := hK z hz + _ ≤ max K 0 := le_max_left _ _ + +/-- A true unweighted supported L2 estimate, uniform over all test columns on a +fixed compact set, for an arbitrary continuous matrix coefficient. -/ +theorem supported_inhomogeneous_L2 {n : Type*} [Fintype n] + {S : Set ℂ} (hS : IsCompact S) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, Continuous (a i j)) : + ∃ C : ℝ, 0 (hW _ (hu i)).1 + _ = C*∑ i, mass (W t (u i)) := (Finset.mul_sum ..).symm + _ ≤ C*∑ i, mass (W t (v i)) := mul_le_mul_of_nonneg_left hw hC.le + _ ≤ C*(C*∑ i, mass (v i)) := mul_le_mul_of_nonneg_left (by + rw [Finset.mul_sum] + exact Finset.sum_le_sum fun i _ => (hW _ (hv i)).2) hC.le + _ = _ := by ring + +end ElasticityPlanar +namespace ElasticityDualSolvability +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +omit [CompleteSpace H] in +lemma weak_unique_in_range (D : Submodule ℂ H) (A : D →ₗ[ℂ] H) {f z w : H} + (hz : z ∈ A.range.topologicalClosure) (hw : w ∈ A.range.topologicalClosure) + (hez : ∀ v : D, inner ℂ z (A v)=inner ℂ f (v : H)) + (hew : ∀ v : D, inner ℂ w (A v)=inner ℂ f (v : H)) : z=w := by + have horth : z-w ∈ A.rangeᗮ := by + intro y hy + obtain ⟨v,rfl⟩ := hy + rw [inner_eq_zero_symm,inner_sub_left,hez,hew,sub_self] + have hcl : z-w ∈ A.range.topologicalClosureᗮ := by simpa using horth + have hself := hcl (z-w) (A.range.topologicalClosure.sub_mem hz hw) + exact sub_eq_zero.mp (inner_self_eq_zero.mp hself) + +/-- Hilbert projection makes the actual Hahn--Banach solver canonical and linear. +It will be used for smooth parameter dependence of the planar right inverse. -/ +theorem exists_linear_weak_solver (D : Submodule ℂ H) (A : D →ₗ[ℂ] H) + (C : ℝ) (hC : 0 ≤ C) (hA : ∀ v : D, ‖(v : H)‖ ≤ C*‖A v‖) : + ∃ T : H →L[ℂ] H, ‖T‖ ≤ C ∧ ∀ f v, inner ℂ (T f) (A v)=inner ℂ f (v : H) := by + let V := A.range.topologicalClosure + have : CompleteSpace V := (Submodule.isClosed_topologicalClosure _).completeSpace_coe + have hex (f : H) : ∃ z : H, z ∈ V ∧ ‖z‖ ≤ C*‖f‖ ∧ + ∀ v : D, inner ℂ z (A v)=inner ℂ f (v : H) := by + obtain ⟨z,hz,heq⟩ := exists_weak_solution D A C hC hA f + refine ⟨V.orthogonalProjectionOnto z,(V.orthogonalProjectionOnto z).property, + (V.norm_orthogonalProjectionOnto_apply_le z).trans hz,?_⟩ + intro v + let av : V := ⟨A v,Submodule.le_topologicalClosure _ (LinearMap.mem_range_self A v)⟩ + have h := V.inner_orthogonalProjectionOnto_eq_of_mem_right av z + change inner ℂ _ (A v) = inner ℂ z (A v) at h + exact h.trans (heq v) + choose t ht hnorm heq using hex + let L : H →ₗ[ℂ] H := + { toFun := t + map_add' := by + intro f g + apply weak_unique_in_range D A (ht (f+g)) (V.add_mem (ht f) (ht g)) (heq (f+g)) + intro v + simp only [inner_add_left,heq] + map_smul' := by + intro c f + apply weak_unique_in_range D A (ht (c • f)) (V.smul_mem c (ht f)) (heq (c • f)) + intro v + simp only [inner_smul_left,heq] } + refine ⟨L.mkContinuous C hnorm,L.mkContinuous_norm_le hC hnorm,heq⟩ +end ElasticityDualSolvability +namespace ElasticityPlanar +open MeasureTheory Complex Set +open scoped SchwartzMap ENNReal BigOperators + +def toSchwartz : Test →ₗ[ℂ] 𝓢(ℂ,ℂ) where + toFun f := (compact f).toSchwartzMap (smooth f) + map_add' _ _ := by ext z; rfl + map_smul' _ _ := by ext z; rfl +@[simp] lemma toSchwartz_apply (f : Test) (z : ℂ) : toSchwartz f z=f z := rfl +lemma toSchwartz_injective : Function.Injective toSchwartz := by + intro u v h + apply Subtype.ext + exact congrArg (fun f : 𝓢(ℂ,ℂ) => (f : ℂ → ℂ)) h + +def L2 : Test →ₗ[ℂ] Lp ℂ 2 (volume : Measure ℂ) := + (SchwartzMap.toLpCLM ℂ ℂ 2 (volume : Measure ℂ)).toLinearMap.comp toSchwartz +lemma L2_injective : Function.Injective L2 := (SchwartzMap.injective_toLp 2 volume).comp toSchwartz_injective +lemma inner_L2 (f g : Test) : inner ℂ (L2 f) (L2 g)=pair f g := by + simpa only [L2,LinearMap.comp_apply,ContinuousLinearMap.coe_coe,SchwartzMap.toLpCLM_apply, + RCLike.inner_apply',RCLike.star_def,toSchwartz_apply,pair] using + SchwartzMap.inner_toL2_toL2_eq (toSchwartz f) (toSchwartz g) volume +lemma norm_L2_sq (f : Test) : ‖L2 f‖^2=mass f := by + rw [← inner_self_eq_norm_sq (𝕜 := ℂ),inner_L2] + rfl + +def cj (f : Test) : Test := ⟨fun z => star (f z), + ⟨Complex.conjCLE.contDiff.comp (smooth f),(compact f).comp_left (star_zero ℂ)⟩⟩ +@[simp] lemma cj_apply (f : Test) (z : ℂ) : cj f z=star (f z) := rfl +@[simp] lemma cj_cj (f : Test) : cj (cj f)=f := by ext z; simp +lemma cj_d (v : ℂ) (f : Test) : cj (d v f)=d v (cj f) := by + apply Subtype.ext + funext z + exact (deriv_conj f z v).symm +lemma cj_add (f g : Test) : cj (f+g)=cj f+cj g := by ext z; exact star_add _ _ +lemma cj_neg (f : Test) : cj (-f)= -cj f := by ext z; exact star_neg _ +lemma cj_smul (c : ℂ) (f : Test) : cj (c • f)=star c • cj f := by + apply Subtype.ext + funext z + change star (c*f z)=star c*star (f z) + rw [star_mul,mul_comm] +lemma mass_cj (f : Test) : mass (cj f)=mass f := by + rw [mass_integral,mass_integral] + apply integral_congr_ae + filter_upwards [] with z + simp only [cj_apply,Complex.star_def,normSq_conj] +lemma support_cj (S : Set ℂ) (f : Test) (h : tsupport (f : ℂ → ℂ) ⊆ S) : + tsupport (cj f : ℂ → ℂ) ⊆ S := by + apply Set.Subset.trans (closure_mono ?_) h + intro z hz hh + exact hz (by change star (f z)=0; rw [hh,star_zero]) + +variable {n : Type*} +abbrev Hilbert (n : Type*) := PiLp 2 (fun _ : n => Lp ℂ 2 (volume : Measure ℂ)) +def embed : (n → Test) →ₗ[ℂ] Hilbert n where + toFun u := WithLp.toLp 2 (fun i => L2 (u i)) + map_add' _ _ := by apply PiLp.ext; intro i; exact map_add L2 _ _ + map_smul' _ _ := by apply PiLp.ext; intro i; exact map_smul L2 _ _ +@[simp] lemma embed_apply (u : n → Test) (i : n) : embed u i = L2 (u i) := rfl +lemma embed_injective : Function.Injective (embed (n := n)) := by + intro u v h + funext i + exact L2_injective (congrArg (fun w : Hilbert n => w i) h) +variable [Fintype n] +lemma norm_embed_sq (u : n → Test) : ‖embed u‖^2=∑ i, mass (u i) := by + rw [PiLp.norm_eq_of_L2,Real.sq_sqrt (Finset.sum_nonneg fun i _ => sq_nonneg _)] + exact Finset.sum_congr rfl (fun i _ => norm_L2_sq (u i)) +lemma norm_embed_cj (u : n → Test) : ‖embed (fun i => cj (u i))‖=‖embed u‖ := by + have h : ‖embed (fun i => cj (u i))‖^2=‖embed u‖^2 := by + simp only [norm_embed_sq,mass_cj] + nlinarith [norm_nonneg (embed (fun i => cj (u i))),norm_nonneg (embed u)] + +/-- Actual first-order matrix transport on compactly supported smooth tests. -/ +def transport (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : + (n → Test) →ₗ[ℂ] (n → Test) where + toFun u i := d 1 (u i)+I • d I (u i)+∑ j, mulSmooth (a i j) (ha i j) (u j) + map_add' u v := by + funext i + simp only [Pi.add_apply,map_add,Finset.sum_add_distrib,smul_add] + abel + map_smul' c u := by + funext i + simp only [Pi.smul_apply,map_smul,smul_add,Finset.smul_sum,smul_comm I c,RingHom.id_apply] + +lemma transport_supported {S : Set ℂ} (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) (u : n → Test) + (hu : ∀ i, tsupport (u i : ℂ → ℂ) ⊆ S) : + ∀ i, tsupport (transport a ha u i : ℂ → ℂ) ⊆ S := by + intro i + apply (tsupport_add _ _).trans + apply Set.union_subset + · apply (tsupport_add _ _).trans + apply Set.union_subset + · exact (tsupport_fderiv_apply_subset ℝ _).trans (hu i) + · exact (tsupport_smul_subset_right (fun _ : ℂ => (I : ℂ)) (d I (u i) : ℂ → ℂ)).trans ((tsupport_fderiv_apply_subset ℝ I).trans (hu i)) + · have hsum (s : Finset n) : tsupport ((∑ j ∈ s, mulSmooth (a i j) (ha i j) (u j) : Test) : ℂ → ℂ) ⊆ S := by + classical + induction s using Finset.induction_on with + | empty => simp only [Finset.sum_empty,Submodule.coe_zero,tsupport_zero,Set.empty_subset] + | @insert j s hj ih => + rw [Finset.sum_insert hj] + exact (tsupport_add _ _).trans (Set.union_subset ((tsupport_mul_subset_right).trans (hu j)) ih) + exact hsum Finset.univ + +/-- A true L2 lower bound for the actual transport operator. -/ +theorem supported_transport_estimate {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : + ∃ C : ℝ, 0 -(a i j z)) (fun i j => (ha i j).continuous.neg) + refine ⟨Real.sqrt C,Real.sqrt_pos.mpr hC,fun u hu => ?_⟩ + have heq : ∀ i z, (d 1 (u i)+I • d I (u i) : Test) z = + transport a ha u i z+∑ j, -(a i j z)*u j z := by + intro i z + change _ = (d 1 (u i)+I • d I (u i) : Test) z+(∑ j, mulSmooth (a i j) (ha i j) (u j) : Test) z+_ + simp only [Submodule.coe_sum,Finset.sum_apply,mulSmooth,LinearMap.coe_mk,AddHom.coe_mk, + Finset.sum_neg_distrib,neg_mul] + ring + have h := hest u (transport a ha u) hu (transport_supported a ha u hu) heq + rw [← norm_embed_sq,← norm_embed_sq] at h + have hs := Real.sq_sqrt hC.le + have hp : 0 ≤ Real.sqrt C*‖embed (transport a ha u)‖ := mul_nonneg (Real.sqrt_nonneg _) (norm_nonneg _) + nlinarith [norm_nonneg (embed u)] +end ElasticityPlanar +namespace ElasticityPlanar +open MeasureTheory Complex Set +open scoped SchwartzMap ENNReal BigOperators +variable {n : Type*} [Fintype n] + +/-- The genuine Hermitian formal adjoint of dbar+a, written using conjugation +and the transpose coefficient. No elliptic right inverse is assumed. -/ +def adjTransport (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : + (n → Test) →ₗ[ℂ] (n → Test) where + toFun u i := -cj (transport (fun i j z => -a j i z) (fun i j => (ha j i).neg) + (fun j => cj (u j)) i) + map_add' u v := by + have hh : (fun i => cj ((u+v) i))=(fun i => cj (u i))+(fun i => cj (v i)) := by + funext i; exact cj_add _ _ + rw [hh,map_add] + funext i + simp only [Pi.add_apply,cj_add,neg_add_rev,add_comm] + map_smul' c u := by + have hh : (fun i => cj ((c • u) i))=star c • (fun i => cj (u i)) := by + funext i; exact cj_smul _ _ + rw [hh,map_smul] + funext i + simp only [Pi.smul_apply,cj_smul,star_star,smul_neg,RingHom.id_apply] + +lemma norm_adjTransport (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (u : n → Test) : ‖embed (adjTransport a ha u)‖= + ‖embed (transport (fun i j z => -a j i z) (fun i j => (ha j i).neg) (fun i => cj (u i)))‖ := by + change ‖embed (-(fun i => cj (transport (fun i j z => -a j i z) (fun i j => (ha j i).neg) (fun i => cj (u i)) i)))‖=_ + rw [map_neg,norm_neg,norm_embed_cj] + +/-- Supported test vectors form the actual L2 domain for the adjoint. -/ +def supported (S : Set ℂ) : Submodule ℂ (n → Test) where + carrier := {u | ∀ i, tsupport (u i : ℂ → ℂ) ⊆ S} + zero_mem' _ := by simpa only [Pi.zero_apply,Submodule.coe_zero,tsupport_zero] using Set.empty_subset S + add_mem' hu hv i := (tsupport_add _ _).trans (Set.union_subset (hu i) (hv i)) + smul_mem' c u hu i := (tsupport_smul_subset_right (fun _ : ℂ => c) (u i : ℂ → ℂ)).trans (hu i) + +/-- Actual supported matrix transport has a bounded linear L2 weak right inverse. +The estimate comes from the proved Gaussian positive commutator, not a smallness +assumption or a globally given frame. -/ +theorem exists_planar_weak_inverse {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : + ∃ C : ℝ, 0 -a j i z) (fun i j => (ha j i).neg) + have hbound (u : n → Test) (hu : ∀ i, tsupport (u i : ℂ → ℂ) ⊆ S) : + ‖embed u‖ ≤ C*‖embed (adjTransport a ha u)‖ := by + rw [norm_adjTransport,← norm_embed_cj u] + exact hest _ (fun i => support_cj S (u i) (hu i)) + let V := supported (n := n) S + let e : V →ₗ[ℂ] Hilbert n := embed.comp V.subtype + have hinj : Function.Injective e := by + intro u v h + exact Subtype.val_injective (embed_injective h) + let E := LinearEquiv.ofInjective e hinj + let A : e.range →ₗ[ℂ] Hilbert n := + (embed.comp (adjTransport a ha)).comp (V.subtype.comp E.symm.toLinearMap) + have he (u : e.range) : e (E.symm u)=(u : Hilbert n) := congrArg Subtype.val (E.apply_symm_apply u) + have hA (u : e.range) : ‖(u : Hilbert n)‖ ≤ C*‖A u‖ := by + rw [← he u] + exact hbound _ (E.symm u).property + obtain ⟨T,hT,heq⟩ := ElasticityDualSolvability.exists_linear_weak_solver e.range A C hC.le hA + refine ⟨C,hC,T,hT,fun f u hu => ?_⟩ + let u' : V := ⟨u,hu⟩ + have h := heq f (E u') + change inner ℂ (T f) (embed (adjTransport a ha ((E.symm (E u') : V) : n → Test)))=inner ℂ f (e u') at h + rw [E.symm_apply_apply] at h + exact h +end ElasticityPlanar +namespace ElasticityPlanarDistribution +open MeasureTheory TemperedDistribution Complex +open scoped SchwartzMap LineDeriv Laplacian ENNReal BigOperators +open ElasticityRegularity +abbrev Test := 𝓢(ℂ,ℂ) +abbrev Dist := 𝓢'(ℂ,ℂ) +def dbar (u : Dist) : Dist := ∂_{(1 : ℂ)} u+I • ∂_{I} u +def dhol (u : Dist) : Dist := ∂_{(1 : ℂ)} u-I • ∂_{I} u + +lemma schwartz_derivative_commute (v w : ℂ) (f : Test) : ∂_{v} (∂_{w} f)=∂_{w} (∂_{v} f) := by + ext x + have hdd (v w : ℂ) : (∂_{v} (∂_{w} f) : Test) x = + fderiv ℝ (fderiv ℝ (f : ℂ → ℂ)) x v w := by + change fderiv ℝ (fun y => fderiv ℝ (f : ℂ → ℂ) y w) x v = _ + rw [fderiv_clm_apply (((f.smooth ⊤).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) x) + (differentiableAt_const w)] + simp + rw [hdd,hdd] + exact (f.smooth ⊤).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) _ _ +lemma derivative_commute (v w : ℂ) (u : Dist) : ∂_{v} (∂_{w} u)=∂_{w} (∂_{v} u) := by + ext φ + change u (- ∂_{w} (- ∂_{v} φ))=u (- ∂_{v} (- ∂_{w} φ)) + simp only [LineDeriv.lineDerivOp_neg,neg_neg] + rw [schwartz_derivative_commute] +lemma dhol_dbar (u : Dist) : dhol (dbar u)=Δ u := by + rw [laplacian_eq_sum Complex.orthonormalBasisOneI] + simp only [Complex.coe_orthonormalBasisOneI,Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one] + simp only [dhol,dbar,LineDeriv.lineDerivOp_add,LineDeriv.lineDerivOp_smul, + smul_add,smul_smul,Complex.I_mul_I,neg_one_smul] + rw [derivative_commute (1 : ℂ) I] + module +lemma dhol_sum {ι : Type*} (S : Finset ι) (u : ι → Dist) : + dhol (∑ i ∈ S, u i)=∑ i ∈ S, dhol (u i) := by + simp only [dhol,LineDeriv.lineDerivOp_sum,Finset.smul_sum,Finset.sum_sub_distrib] +lemma dhol_add (u v : Dist) : dhol (u+v)=dhol u+dhol v := by + simp only [dhol,LineDeriv.lineDerivOp_add,smul_add] + module +lemma LocalEqual.dhol {Ω : Set ℂ} {u v : Dist} (h : ElasticityRegularity.LocalEqual Ω u v) : + ElasticityRegularity.LocalEqual Ω (dhol u) (dhol v) := + (h.derivative 1).sub ((h.derivative I).smul I) +lemma LocalSobolev.dhol {Ω : Set ℂ} {s : ℝ} {u : Dist} (h : ElasticityRegularity.LocalSobolev Ω s u) : + ElasticityRegularity.LocalSobolev Ω (s-1) (dhol u) := + (h.derivative 1).sub ((h.derivative I).smul I) + +/-- Actual planar first-order equation on distributions, not an abstract +regularity or frame existence interface. -/ +def Equation {n : Type*} [Fintype n] (Ω : Set ℂ) (a : n → n → ℂ → ℂ) (u f : n → Dist) : Prop := + ∀ i, ElasticityRegularity.LocalEqual Ω (dbar (u i)) (f i+∑ j, smulLeftCLM ℂ (a i j) (u j)) + +theorem local_gain {n : Type*} [Fintype n] {Ω : Set ℂ} {s : ℝ} + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u f : n → Dist) (heq : Equation Ω a u f) + (hu : ∀ i, ElasticityRegularity.LocalSobolev Ω s (u i)) + (hf : ∀ i, ElasticityRegularity.LocalSobolev Ω s (f i)) : + ∀ i, ElasticityRegularity.LocalSobolev Ω (s+1) (u i) := by + intro i + apply local_laplacian_gain_basis Complex.orthonormalBasisOneI (hu i) + have he := LocalEqual.dhol (heq i) + rw [dhol_dbar,dhol_add,dhol_sum] at he + apply he.localSobolev + exact (LocalSobolev.dhol (hf i)).add (ElasticityRegularity.LocalSobolev.sum Finset.univ (fun j _ => + LocalSobolev.dhol ((hu j).coeff (ha i j)))) + +theorem local_all_orders {n : Type*} [Fintype n] {Ω : Set ℂ} + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u f : n → Dist) (heq : Equation Ω a u f) + (hu : ∀ i, ElasticityRegularity.LocalSobolev Ω 0 (u i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N (f i)) : + ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N (u i) := by + intro N + induction N with + | zero => rw [Nat.cast_zero]; exact hu + | succ N hN => + rw [Nat.cast_add,Nat.cast_one] + exact local_gain a ha u f heq hN (hf N) + +theorem cutoff_smooth {n : Type*} [Fintype n] {Ω : Set ℂ} + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u f : n → Dist) (heq : Equation Ω a u f) + (hu : ∀ i, ElasticityRegularity.LocalSobolev Ω 0 (u i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N (f i)) + (i : n) {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) : + ∃ v : BoundedContinuousFunction ℂ ℂ, ContDiff ℝ (⊤ : ℕ∞) (v : ℂ → ℂ) ∧ + smulLeftCLM ℂ g (u i)=((v.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure ℂ)) : Dist) := + all_orders_smooth_representative (fun N => local_all_orders a ha u f heq hu hf N i g hg hc hs) +end ElasticityPlanarDistribution +namespace ElasticityPlanar +open MeasureTheory Complex TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators LineDeriv +variable {n : Type*} [Fintype n] + +lemma toSchwartz_d (v : ℂ) (φ : Test) : toSchwartz (d v φ)=∂_{v} (toSchwartz φ) := by + ext z + rfl +lemma toSchwartz_mul (a : ℂ → ℂ) (ha : a.HasTemperateGrowth) (φ : Test) : + toSchwartz (mulSmooth a ha.1 φ)=SchwartzMap.smulLeftCLM ℂ a (toSchwartz φ) := by + ext z + simp only [toSchwartz_apply,SchwartzMap.smulLeftCLM_apply_apply ha,smul_eq_mul] + rfl +lemma Lp_test (w : Lp ℂ 2 (volume : Measure ℂ)) (φ : Test) : + (w : 𝓢'(ℂ,ℂ)) (toSchwartz φ) = inner ℂ (L2 (cj φ)) w := by + rw [Lp.toTemperedDistribution_apply,MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [(toSchwartz (cj φ)).coeFn_toLp 2 volume] with z hz + change φ z • w z = inner ℂ ((L2 (cj φ)) z) (w z) + change (L2 (cj φ) : ℂ → ℂ) z=cj φ z at hz + rw [hz] + simp only [cj_apply,RCLike.inner_apply',starRingEnd_apply,star_star,smul_eq_mul,mul_comm] + +lemma vector_transpose (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (w : n → 𝓢'(ℂ,ℂ)) (φ : n → Test) : + (∑ i, (ElasticityPlanarDistribution.dbar (w i)+∑ j, smulLeftCLM ℂ (a i j) (w j)) (toSchwartz (φ i))) = + ∑ i, w i (toSchwartz (- transport (fun i j z => -a j i z) (fun i j => (ha j i).1.neg) φ i)) := by + simp only [ElasticityPlanarDistribution.dbar,add_apply,sum_apply,smul_apply, + smulLeftCLM_apply_apply,TemperedDistribution.lineDerivOp_apply_apply] + simp only [transport,LinearMap.coe_mk,AddHom.coe_mk,map_neg,map_add,map_smul,map_sum, + toSchwartz_d, smul_eq_mul] + have hm (i j : n) : toSchwartz (mulSmooth (fun z => -a j i z) (ha j i).1.neg (φ j)) = + -SchwartzMap.smulLeftCLM ℂ (a j i) (toSchwartz (φ j)) := by + ext z + simp only [toSchwartz_apply,neg_apply,SchwartzMap.smulLeftCLM_apply_apply (ha j i),smul_eq_mul] + change (-a j i z)*φ j z= -(a j i z*φ j z) + ring + simp only [hm,map_neg,Finset.sum_neg_distrib,neg_add_rev,neg_neg, + Finset.sum_add_distrib] + rw [Finset.sum_comm] + simp only [mul_neg,Finset.sum_neg_distrib] + ring + +lemma weak_to_vector_distribution (a : n → n → ℂ → ℂ) + (ha : ∀ i j, (a i j).HasTemperateGrowth) (S : Set ℂ) (w f : Hilbert n) + (heq : ∀ u : n → Test, (∀ i, tsupport (u i : ℂ → ℂ) ⊆ S) → + inner ℂ w (embed (adjTransport a (fun i j => (ha i j).1) u))=inner ℂ f (embed u)) + (φ : n → Test) (hφ : ∀ i, tsupport (φ i : ℂ → ℂ) ⊆ S) : + (∑ i, (ElasticityPlanarDistribution.dbar (w i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (w j : 𝓢'(ℂ,ℂ))) (toSchwartz (φ i))) = + ∑ i, (f i : 𝓢'(ℂ,ℂ)) (toSchwartz (φ i)) := by + rw [vector_transpose a ha] + simp only [Lp_test] + have h := congrArg star (heq (fun i => cj (φ i)) (fun i => support_cj S _ (hφ i))) + have hs (u v : Hilbert n) : star (inner ℂ u v)=inner ℂ v u := inner_conj_symm (𝕜 := ℂ) v u + rw [hs,hs] at h + simp only [PiLp.inner_apply,embed_apply] at h + have he (i : n) : adjTransport a (fun i j => (ha i j).1) (fun i => cj (φ i)) i = + cj (-transport (fun i j z => -a j i z) (fun i j => (ha j i).1.neg) φ i) := by + simp only [adjTransport,LinearMap.coe_mk,AddHom.coe_mk,cj_cj,cj_neg] + simpa only [he] using h + +lemma weak_to_local_equation (Ω S : Set ℂ) (hΩ : Ω ⊆ S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) (w f : Hilbert n) + (heq : ∀ u : n → Test, (∀ i, tsupport (u i : ℂ → ℂ) ⊆ S) → + inner ℂ w (embed (adjTransport a (fun i j => (ha i j).1) u))=inner ℂ f (embed u)) : + ∀ i, ElasticityRegularity.LocalEqual Ω (ElasticityPlanarDistribution.dbar (w i : 𝓢'(ℂ,ℂ))+ + ∑ j, smulLeftCLM ℂ (a i j) (w j : 𝓢'(ℂ,ℂ))) (f i : 𝓢'(ℂ,ℂ)) := by + classical + intro i φ hc hs + let φ' : Test := ⟨φ,⟨φ.smooth ⊤,hc⟩⟩ + let ψ : n → Test := fun j => if j=i then φ' else 0 + have hψ : ∀ j, tsupport (ψ j : ℂ → ℂ) ⊆ S := by + intro j + by_cases hji : j=i + · simpa only [ψ,ite_eq_left hji] using hs.trans hΩ + · simpa only [ψ,ite_eq_right hji,Submodule.coe_zero,tsupport_zero] using Set.empty_subset S + have h := weak_to_vector_distribution a ha S w f heq ψ hψ + simpa only [ψ,apply_ite,ite_true,map_zero,Finset.sum_ite_eq',Finset.mem_univ, + show toSchwartz φ'=φ from by ext z; rfl] using h +end ElasticityPlanar +section +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal LineDeriv +namespace ElasticityRegularity + +/-- The closed graph argument supplies norms for genuine distribution operators, +not additional quantitative regularity assumptions. -/ +theorem exists_continuous_lift + {X Y Z : Type*} [NormedAddCommGroup X] [NormedSpace ℂ X] [CompleteSpace X] + [NormedAddCommGroup Y] [NormedSpace ℂ Y] [CompleteSpace Y] + [AddCommGroup Z] [Module ℂ Z] [TopologicalSpace Z] [T2Space Z] + (J : Y →L[ℂ] Z) (hJ : Function.Injective J) (T : X →L[ℂ] Z) + (hT : ∀ x, ∃ y, J y=T x) : + ∃ L : X →L[ℂ] Y, ∀ x, J (L x)=T x := by + choose l hl using hT + let L : X →ₗ[ℂ] Y := { + toFun := l + map_add' := fun x y => hJ (by rw [map_add,hl,hl,hl,map_add]) + map_smul' := fun c x => hJ (by rw [map_smul,hl,hl,map_smul]; rfl) } + have hc : IsClosed (L.graph : Set (X × Y)) := by + have he : (L.graph : Set (X × Y))={p | T p.1=J p.2} := by + ext p + change p.2=L p.1 ↔ T p.1=J p.2 + constructor + · intro h + rw [h] + exact (hl p.1).symm + · intro h + apply hJ + exact h.symm.trans (hl p.1).symm + rw [he] + exact isClosed_eq (T.continuous.comp continuous_fst) (J.continuous.comp continuous_snd) + exact ⟨⟨L,L.continuous_of_isClosed_graph hc⟩,hl⟩ + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma lp_distribution_injective : Function.Injective + (fun u : Lp ℂ 2 (volume : Measure E) => (u : 𝓢'(E,ℂ))) := by + intro u v huv + apply Lp.ext + have h : LocalEqual Set.univ (u : 𝓢'(E,ℂ)) (v : 𝓢'(E,ℂ)) := + fun _ _ _ => congrArg (fun T : 𝓢'(E,ℂ) => T _) huv + filter_upwards [h.lp_ae isOpen_univ u v] with x hx + exact hx (Set.mem_univ x) + +/-- H^s is represented isometrically by L2 via J^{-s}; its injection is into the +actual space of tempered distributions. -/ +def sobolevInjection (s : ℝ) : Lp ℂ 2 (volume : Measure E) →L[ℂ] 𝓢'(E,ℂ) := + (besselPotential E ℂ (-s)).comp (Lp.toTemperedDistributionCLM ℂ (volume : Measure E) 2) + +lemma sobolevInjection_injective (s : ℝ) : + Function.Injective (sobolevInjection (E := E) s) := by + intro u v huv + have h := congrArg (besselPotential E ℂ s) huv + have hh : (u : 𝓢'(E,ℂ))=(v : 𝓢'(E,ℂ)) := by + simpa only [sobolevInjection,ContinuousLinearMap.comp_apply, + besselPotential_besselPotential_apply,neg_add_cancel,besselPotential_zero, + ContinuousLinearMap.id_apply,Lp.toTemperedDistributionCLM_apply] using h + exact lp_distribution_injective hh + +lemma sobolevInjection_mem (s : ℝ) (f : Lp ℂ 2 (volume : Measure E)) : + MemSobolev s 2 (sobolevInjection s f) := by + refine ⟨f,?_⟩ + simp only [sobolevInjection,ContinuousLinearMap.comp_apply, + besselPotential_besselPotential_apply,neg_add_cancel,besselPotential_zero, + ContinuousLinearMap.id_apply,Lp.toTemperedDistributionCLM_apply] + +lemma memSobolev_iff_range (s : ℝ) (u : 𝓢'(E,ℂ)) : + MemSobolev s 2 u ↔ ∃ f : Lp ℂ 2 (volume : Measure E), sobolevInjection s f=u := by + constructor + · rintro ⟨f,hf⟩ + refine ⟨f,?_⟩ + change besselPotential E ℂ (-s) (f : 𝓢'(E,ℂ))=u + exact (besselPotential_neg_apply_eq_iff s (f : 𝓢'(E,ℂ)) u).mpr hf + · rintro ⟨f,rfl⟩ + exact sobolevInjection_mem s f + +/-- A qualitative everywhere-defined Sobolev mapping theorem for a continuous +actual distribution operator automatically gives its bounded Sobolev realization. +This is useful for smooth multipliers and coordinate derivatives on cutoffs. -/ +theorem exists_sobolev_realization (s t : ℝ) (P : 𝓢'(E,ℂ) →L[ℂ] 𝓢'(E,ℂ)) + (hP : ∀ u, MemSobolev s 2 u → MemSobolev t 2 (P u)) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection t (L f)=P (sobolevInjection s f) := by + exact exists_continuous_lift (sobolevInjection t) (sobolevInjection_injective t) + (P.comp (sobolevInjection s)) (fun f => + (memSobolev_iff_range t _).mp (hP _ (sobolevInjection_mem s f))) + +theorem exists_bounded_sobolev_derivative (s : ℝ) (m : E) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection (s-1) (L f)=∂_{m} (sobolevInjection s f) := by + exact exists_sobolev_realization s (s-1) (LineDeriv.lineDerivOpCLM ℂ 𝓢'(E,ℂ) m) + (fun _ h => h.lineDerivOp) + +theorem exists_bounded_sobolev_inclusion {s t : ℝ} (hst : t ≤ s) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection t (L f)=sobolevInjection s f := by + exact exists_sobolev_realization s t (ContinuousLinearMap.id ℂ _) + (fun _ h => h.mono hst) + +end ElasticityRegularity + +end +namespace ElasticityRegularity +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +/-- Compact smooth multiplication on the negative initial Sobolev order in +which the physical divergence is initially controlled. -/ +theorem sobolev_neg_one_product {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + {u : 𝓢'(E,ℂ)} (hu : MemSobolev (-1) 2 u) : + MemSobolev (-1) 2 (smulLeftCLM ℂ g u) := by + let v := besselPotential E ℂ (-2) u + have hv : MemSobolev 1 2 v := by + apply memSobolev_besselPotential_iff.mpr + norm_num + exact hu + have hv0 : MemSobolev 0 2 v := hv.mono (by norm_num) + let b := stdOrthonormalBasis ℝ E + have hd : MemSobolev (-1) 2 (smulLeftCLM ℂ g (Δ v)) := by + rw [laplacian_eq_sum b,map_sum] + apply sobolev_sum Finset.univ + intro i _ + apply sobolev_zero_product_derivative hg hc (b i) + simpa only [sub_self] using (hv.lineDerivOp (m := b i)) + have hp : (-(2*Real.pi)^2 : ℝ) ≠ 0 := + neg_ne_zero.mpr (pow_ne_zero _ (mul_ne_zero (by norm_num) Real.pi_ne_zero)) + have he : u=v+(-(2*Real.pi)^2 : ℝ)⁻¹ • Δ v := by + rw [laplacian_eq_fourierMultiplierCLM,smul_smul,inv_mul_cancel₀ hp,one_smul, + ← besselPotential_two] + simp only [v,besselPotential_besselPotential_apply,neg_add_cancel, + besselPotential_zero,ContinuousLinearMap.id_apply] + rw [he,map_add,ContinuousLinearMap.map_smul_of_tower] + exact ((sobolev_zero_product (hc.hasTemperateGrowth hg) + (compact_bounded_multiplier hg hc) hv0).mono (by norm_num)).add + (sobolev_real_smul hd _) + +lemma sobolev_product_step_down (s : ℝ) + (hm : ∀ (g : E → ℂ), ContDiff ℝ (⊤ : ℕ∞) g → HasCompactSupport g → + ∀ u : 𝓢'(E,ℂ), MemSobolev s 2 u → MemSobolev s 2 (smulLeftCLM ℂ g u)) + {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + {u : 𝓢'(E,ℂ)} (hu : MemSobolev (s-1) 2 u) : + MemSobolev (s-1) 2 (smulLeftCLM ℂ g u) := by + let v := besselPotential E ℂ (-2) u + have hv : MemSobolev (s+1) 2 v := by + apply memSobolev_besselPotential_iff.mpr + convert hu using 1 + ring + have hvs : MemSobolev s 2 v := hv.mono (by linarith) + let b := stdOrthonormalBasis ℝ E + have hd : MemSobolev (s-1) 2 (smulLeftCLM ℂ g (Δ v)) := by + rw [laplacian_eq_sum b,map_sum] + apply sobolev_sum Finset.univ + intro i _ + have hdi : MemSobolev s 2 (∂_{b i} v) := by + simpa only [add_sub_cancel_right] using (hv.lineDerivOp (m := b i)) + have hgd := smooth_derivative hg (b i) + have hcd := compact_derivative hc (b i) + have h₁ := (hm g hg hc _ hdi).lineDerivOp (m := b i) + have h₂ := (hm _ hgd hcd _ hdi).mono (by linarith : s-1 ≤ s) + have hh := h₁.sub h₂ + rw [distribution_leibniz (hc.hasTemperateGrowth hg) _ (hcd.hasTemperateGrowth hgd), + add_sub_cancel_left] at hh + exact hh + have hp : (-(2*Real.pi)^2 : ℝ) ≠ 0 := + neg_ne_zero.mpr (pow_ne_zero _ (mul_ne_zero (by norm_num) Real.pi_ne_zero)) + have he : u=v+(-(2*Real.pi)^2 : ℝ)⁻¹ • Δ v := by + rw [laplacian_eq_fourierMultiplierCLM,smul_smul,inv_mul_cancel₀ hp,one_smul, + ← besselPotential_two] + simp only [v,besselPotential_besselPotential_apply,neg_add_cancel, + besselPotential_zero,ContinuousLinearMap.id_apply] + rw [he,map_add,ContinuousLinearMap.map_smul_of_tower] + exact ((hm g hg hc _ hvs).mono (by linarith)).add (sobolev_real_smul hd _) + +/-- Smooth compact multiplication preserves every integral Sobolev order, +including the H^-2 forcing order in the first augmented bootstrap step. -/ +theorem sobolev_negative_product (n : ℕ) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + {u : 𝓢'(E,ℂ)} (hu : MemSobolev (-(n : ℝ)) 2 u) : + MemSobolev (-(n : ℝ)) 2 (smulLeftCLM ℂ g u) := by + induction n generalizing g u with + | zero => + simp only [Nat.cast_zero,neg_zero] at hu ⊢ + exact sobolev_zero_product (hc.hasTemperateGrowth hg) (compact_bounded_multiplier hg hc) hu + | succ n ih => + have hh := sobolev_product_step_down (-(n : ℝ)) + (fun g hg hc u hu => ih hg hc hu) hg hc (u := u) + have he : (-(n : ℝ)-1 : ℝ)= -((n+1 : ℕ) : ℝ) := by push_cast; ring + rw [he] at hh + exact hh hu + +theorem exists_bounded_negative_multiplier (n : ℕ) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection (-(n : ℝ)) (L f)=smulLeftCLM ℂ g (sobolevInjection (-(n : ℝ)) f) := by + exact exists_sobolev_realization _ _ (smulLeftCLM ℂ g) + (fun _ h => sobolev_negative_product n hg hc h) + +theorem exists_bounded_nat_multiplier (n : ℕ) {g : E → ℂ} + (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) : + ∃ L : Lp ℂ 2 (volume : Measure E) →L[ℂ] Lp ℂ 2 (volume : Measure E), + ∀ f, sobolevInjection (n : ℝ) (L f)=smulLeftCLM ℂ g (sobolevInjection (n : ℝ) f) := by + exact exists_sobolev_realization _ _ (smulLeftCLM ℂ g) + (fun _ h => sobolev_nat_product (stdOrthonormalBasis ℝ E) n hg hc h) +end ElasticityRegularity +namespace ElasticityDualSolvability +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +/-- A bounded zeroth-order perturbation of an actual weak right inverse. -/ +theorem perturbed_weak_solver (D : Submodule ℂ H) (A : D →ₗ[ℂ] H) + (T B Q : H →L[ℂ] H) + (hT : ∀ f v, inner ℂ (T f) (A v)=inner ℂ f (v : H)) + (hQ : (1+B*T)*Q=1) (f : H) (v : D) : + inner ℂ ((T*Q) f) (A v+B.adjoint (v : H))=inner ℂ f (v : H) := by + rw [mul_apply_eq_comp,inner_add_right,hT,ContinuousLinearMap.adjoint_inner_right, + ← inner_add_left] + have h := congrArg (fun L : H →L[ℂ] H => L f) hQ + simpa only [mul_apply_eq_comp,add_apply, + one_apply_eq_self] using congrArg (fun y => inner ℂ y (v : H)) h + +/-- The perturbative solver exists without adding a range surjectivity +assumption. The smallness condition is strictly local in parameter space. -/ +theorem perturbed_weak_inverse (D : Submodule ℂ H) (A : D →ₗ[ℂ] H) + (T B : H →L[ℂ] H) + (hT : ∀ f v, inner ℂ (T f) (A v)=inner ℂ f (v : H)) + (hBT : ‖B*T‖<1) : + ∀ f v, inner ℂ ((T*Ring.inverse (1+B*T)) f) (A v+B.adjoint (v : H))= + inner ℂ f (v : H) := by + have hu : IsUnit (1+B*T) := by + simpa only [sub_neg_eq_add] using isUnit_one_sub_of_norm_lt_one + (by simpa only [norm_neg] using hBT : ‖-(B*T)‖<1) + exact perturbed_weak_solver D A T B _ hT (Ring.mul_inverse_cancel _ hu) + +/-- Smooth dependence of the local Neumann inverse, established with the stock +Banach-algebra inversion theorem. -/ +theorem smooth_local_weak_inverse {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] + (T : H →L[ℂ] H) (B : P → H →L[ℂ] H) {p : P} + (hB : ContDiffAt ℝ (⊤ : ℕ∞) B p) (hBT : ‖B p*T‖<1) : + ContDiffAt ℝ (⊤ : ℕ∞) (fun q => T*Ring.inverse (1+B q*T)) p := by + have hu : IsUnit (1+B p*T) := by + simpa only [sub_neg_eq_add] using isUnit_one_sub_of_norm_lt_one + (by simpa only [norm_neg] using hBT : ‖-(B p*T)‖<1) + obtain ⟨u,hu⟩ := hu + have hi : ContDiffAt ℝ (⊤ : ℕ∞) Ring.inverse (1+B p*T) := by + rw [← hu] + exact contDiffAt_ringInverse ℝ u + have hg : ContDiffAt ℝ (⊤ : ℕ∞) (fun q => (1 : H →L[ℂ] H)+B q*T) p := + contDiffAt_const.add (hB.mul contDiffAt_const) + have hc := hi.comp p hg + exact contDiffAt_const.mul hc +end ElasticityDualSolvability + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Recovery.lean b/lean/OAI/MathematicalPhysics/Elasticity/Recovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..80c5189938b2869dc3fdc2545aded2148a85c15f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Recovery.lean @@ -0,0 +1,690 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open scoped BigOperators Matrix + +namespace ElasticityConic + +abbrev C3 := Fin 3 → ℂ +abbrev Mat3 := Matrix (Fin 3) (Fin 3) ℂ + +def null (v : C3) : Prop := dotProduct v v = 0 + +def theta (z₀ z₁ : ℂ) : C3 := + ![z₀ ^ 2 - z₁ ^ 2, Complex.I * (z₀ ^ 2 + z₁ ^ 2), 2 * z₀ * z₁] + +def h₁ (z₀ z₁ : ℂ) : C3 := ![z₀, Complex.I * z₀, z₁] +def h₂ (z₀ z₁ : ℂ) : C3 := ![-z₁, Complex.I * z₁, z₀] + +lemma dot3 (a b : C3) : dotProduct a b = a 0 * b 0 + a 1 * b 1 + a 2 * b 2 := by + simp [dotProduct, Fin.sum_univ_succ, add_assoc] + +lemma theta_null (z₀ z₁ : ℂ) : null (theta z₀ z₁) := by + simp only [null, dot3, theta, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons] + linear_combination (z₀ ^ 2 + z₁ ^ 2) ^ 2 * Complex.I_sq + +lemma theta_dot_h₁ (z₀ z₁ : ℂ) : dotProduct (theta z₀ z₁) (h₁ z₀ z₁) = 0 := by + simp only [dot3, theta, h₁, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons] + linear_combination (z₀ ^ 2 + z₁ ^ 2) * z₀ * Complex.I_sq + +lemma theta_dot_h₂ (z₀ z₁ : ℂ) : dotProduct (theta z₀ z₁) (h₂ z₀ z₁) = 0 := by + simp only [dot3, theta, h₂, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.head_cons, Matrix.tail_cons] + linear_combination (z₀ ^ 2 + z₁ ^ 2) * z₁ * Complex.I_sq + +lemma theta_eq (z₀ z₁ : ℂ) : theta z₀ z₁ = z₀ • h₁ z₀ z₁ + z₁ • h₂ z₀ z₁ := by + ext i + fin_cases i <;> simp [theta, h₁, h₂] <;> ring + +lemma theta_ne_zero {z₀ z₁ : ℂ} (hz : z₀ ≠ 0 ∨ z₁ ≠ 0) : theta z₀ z₁ ≠ 0 := by + intro h + have ha := congrFun h 0 + have hb := congrFun h 1 + simp [theta] at ha hb + have hb' : z₀ ^ 2 + z₁ ^ 2 = 0 := hb + have hc : z₀ ^ 2 = 0 := by linear_combination (ha + hb') / 2 + have hd : z₁ ^ 2 = 0 := by linear_combination (hb' - ha) / 2 + exact hz.elim (fun hz₀ => hz₀ ((pow_eq_zero_iff (by omega : (2 : ℕ) ≠ 0)).mp hc)) (fun hz₁ => hz₁ ((pow_eq_zero_iff (by omega : (2 : ℕ) ≠ 0)).mp hd)) + +/-- The concrete spanning assertion used twice in the source proof. -/ +lemma null_dot_zero (v : C3) + (hv : ∀ θ : C3, θ ≠ 0 → null θ → dotProduct θ v = 0) : v = 0 := by + have h0 := hv (theta 1 0) (theta_ne_zero (Or.inl one_ne_zero)) (theta_null 1 0) + have h1 := hv (theta 0 1) (theta_ne_zero (Or.inr one_ne_zero)) (theta_null 0 1) + have h2 := hv (theta 1 1) (theta_ne_zero (Or.inl one_ne_zero)) (theta_null 1 1) + simp [theta, Matrix.vecHead, Matrix.vecTail] at h0 h1 h2 + have hv0 : v 0 = 0 := by linear_combination (h0 - h1) / 2 + have hv1 : v 1 = 0 := by + apply (mul_eq_zero.mp (show Complex.I * v 1 = 0 by linear_combination h0 - hv0)).resolve_left + exact Complex.I_ne_zero + have hv2 : v 2 = 0 := by + simp only [hv1, mul_zero, zero_add] at h2 + exact (mul_eq_zero.mp h2).resolve_left (by norm_num) + ext i + fin_cases i <;> assumption + +/-- Null directions used to test the entire ambient matrix, without an analytic +argument on projective space. These imply precisely (scalar-ambient-difference). -/ +theorem scalar_of_null_annihilator (K : Mat3) + (hK : ∀ θ : C3, θ ≠ 0 → null θ → + ∀ p : C3, dotProduct θ p = 0 → dotProduct (K *ᵥ θ) p = 0) : + ∃ κ : ℂ, K = κ • (1 : Mat3) := by + have h01p := hK ![1, Complex.I, 0] (by intro h; have h0 := congrFun h 0; norm_num at h0) (by norm_num [null, dot3]) + have h01m := hK ![1, -Complex.I, 0] (by intro h; have h0 := congrFun h 0; norm_num at h0) (by norm_num [null, dot3]) + have h02p := hK ![1, 0, Complex.I] (by intro h; have h0 := congrFun h 0; norm_num at h0) (by norm_num [null, dot3]) + have h02m := hK ![1, 0, -Complex.I] (by intro h; have h0 := congrFun h 0; norm_num at h0) (by norm_num [null, dot3]) + have h12p := hK ![0, 1, Complex.I] (by intro h; have h1 := congrFun h 1; norm_num at h1) (by norm_num [null, dot3]) + have h12m := hK ![0, 1, -Complex.I] (by intro h; have h1 := congrFun h 1; norm_num at h1) (by norm_num [null, dot3]) + have a20 := h01p ![0,0,1] (by simp) + have b20 := h01m ![0,0,1] (by simp) + have a10 := h02p ![0,1,0] (by simp) + have b10 := h02m ![0,1,0] (by simp) + have a01 := h12p ![1,0,0] (by simp) + have b01 := h12m ![1,0,0] (by simp) + simp [Matrix.mulVec, Matrix.vecHead, Matrix.vecTail] at a20 b20 a10 b10 a01 b01 + have k20 : K 2 0 = 0 := by linear_combination (a20 + b20) / 2 + have k21 : K 2 1 = 0 := by + apply (mul_eq_zero.mp (show K 2 1 * (2 * Complex.I) = 0 by + linear_combination a20 - b20)).resolve_right + norm_num + have k10 : K 1 0 = 0 := by linear_combination (a10 + b10) / 2 + have k12 : K 1 2 = 0 := by + apply (mul_eq_zero.mp (show K 1 2 * (2 * Complex.I) = 0 by + linear_combination a10 - b10)).resolve_right + norm_num + have k01 : K 0 1 = 0 := by linear_combination (a01 + b01) / 2 + have k02 : K 0 2 = 0 := by + apply (mul_eq_zero.mp (show K 0 2 * (2 * Complex.I) = 0 by + linear_combination a01 - b01)).resolve_right + norm_num + have d01 := h01p ![1,Complex.I,0] (by norm_num [dot3]) + have d02 := h02p ![1,0,Complex.I] (by norm_num [dot3]) + simp [Matrix.mulVec, Matrix.vecHead, Matrix.vecTail, k01, k02, k10, k12, k20, k21, mul_assoc] at d01 d02 + have k11 : K 1 1 = K 0 0 := by linear_combination -d01 + have k22 : K 2 2 = K 0 0 := by linear_combination -d02 + refine ⟨K 0 0, ?_⟩ + ext i j + fin_cases i <;> fin_cases j <;> + simp [k01, k02, k10, k12, k20, k21, k11, k22] + +end ElasticityConic + +/-! Finite-type uniqueness used in the last step of the elasticity proof. +All spaces and coefficient fields below are actual functions, not axioms. -/ +noncomputable section +open Set Filter Module +open scoped BigOperators Topology + +namespace ElasticityFiniteType + +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem zero_of_homogeneous_system + {f : E → F} {A : E → E →L[ℝ] F →L[ℝ] F} + (hf : Differentiable ℝ f) (hA : Continuous A) + (hdf : ∀ x v, fderiv ℝ f x v = A x v (f x)) + {x₀ : E} (hzero : f x₀ = 0) : ∀ x, f x = 0 := by + intro x + let v := x - x₀ + let c : ℝ → E := fun t => x₀ + t • v + have hc (t : ℝ) : HasDerivAt c v t := by + simpa [c] using (hasDerivAt_id t).smul_const v |>.const_add x₀ + have hfc (t : ℝ) : HasDerivAt (fun t => f (c t)) (A (c t) v (f (c t))) t := by + simpa only [Function.comp_def, hdf] using + (hf (c t)).hasFDerivAt.comp_hasDerivAt t (hc t) + have hAc : Continuous (fun t => A (c t)) := + hA.comp (by fun_prop) + obtain ⟨C, hC⟩ := (isCompact_Icc : IsCompact (Icc (0 : ℝ) 1)).exists_bound_of_continuousOn + (f := fun t => A (c t)) hAc.continuousOn + have hbound (t : ℝ) (ht : t ∈ Ico (0 : ℝ) 1) : + ‖A (c t) v (f (c t))‖ ≤ (C * ‖v‖) * ‖f (c t)‖ := by + calc + ‖A (c t) v (f (c t))‖ ≤ ‖A (c t) v‖ * ‖f (c t)‖ := + (A (c t) v).le_opNorm _ + _ ≤ (‖A (c t)‖ * ‖v‖) * ‖f (c t)‖ := + mul_le_mul_of_nonneg_right ((A (c t)).le_opNorm v) (norm_nonneg _) + _ ≤ (C * ‖v‖) * ‖f (c t)‖ := by + gcongr + exact hC t ⟨ht.1, ht.2.le⟩ + have hstart : f (c 0) = 0 := by simpa [c] using hzero + have hz := eq_zero_of_abs_deriv_le_mul_abs_self_of_eq_zero_right + (hf.continuous.comp (by fun_prop : Continuous c)).continuousOn + (fun t _ => (hfc t).hasDerivWithinAt) hstart hbound 1 (by norm_num) + simpa [c, v] using hz + +/-- Constant-direction differentiation. All directions are real; the values may +be real or complex, as in the source lemma. -/ +def D (f : E → F) (v : E) : E → F := fun x => fderiv ℝ f x v + +lemma contDiff_D {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v : E) : + ContDiff ℝ (⊤ : ℕ∞) (D f v) := by + exact (hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const + +lemma D_D {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v w x : E) : + D (D f v) w x = fderiv ℝ (fderiv ℝ f) x w v := by + have hd : Differentiable ℝ (fderiv ℝ f) := + (hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ f y v) x w = _ + rw [fderiv_clm_apply (hd x) (differentiableAt_const v)] + simp + +lemma D_comm {f : E → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (v w : E) : + D (D f v) w = D (D f w) v := by + ext x + rw [D_D hf, D_D hf] + exact hf.contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) w v + +lemma D_add {f g : E → F} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (v : E) : D (fun x => f x + g x) v = fun x => D f v x + D g v x := by + ext x + simp [D, fderiv_fun_add (hf x) (hg x)] + +lemma D_mul {f g : E → ℝ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (v : E) : D (fun x => f x * g x) v = fun x => D f v x * g x + f x * D g v x := by + ext x + simp [D, fderiv_fun_mul (hf x) (hg x), mul_comm, add_comm] + +lemma D_sum {ι : Type*} (s : Finset ι) {f : ι → E → F} + (hf : ∀ i ∈ s, Differentiable ℝ (f i)) (v : E) : + D (fun x => ∑ i ∈ s, f i x) v = fun x => ∑ i ∈ s, D (f i) v x := by + ext x + simp [D, fderiv_fun_sum (fun i hi => (hf i hi) x)] + +section CoordinateSystems +variable {ι κ : Type*} [Fintype ι] [Fintype κ] + [FiniteDimensional ℝ E] + +def matrixCLM (M : κ → κ → ℝ) : (κ → ℝ) →L[ℝ] (κ → ℝ) := + ContinuousLinearMap.pi fun a => ∑ b, M a b • ContinuousLinearMap.proj b + +lemma matrixCLM_apply (M : κ → κ → ℝ) (w : κ → ℝ) (a : κ) : + matrixCLM M w a = ∑ b, M a b * w b := by + simp [matrixCLM] + +def coordL (b : Basis ι ℝ E) (s : ι) : E →L[ℝ] ℝ := + (ContinuousLinearMap.proj s).comp b.equivFunL.toContinuousLinearMap + +def systemCLM (b : Basis ι ℝ E) (M : E → ι → κ → κ → ℝ) (x : E) : + E →L[ℝ] (κ → ℝ) →L[ℝ] (κ → ℝ) := + ∑ s, (coordL b s).smulRight (matrixCLM (M x s)) + +omit [FiniteDimensional ℝ E] in +lemma systemCLM_basis (b : Basis ι ℝ E) (M : E → ι → κ → κ → ℝ) + (x : E) (s : ι) (w : κ → ℝ) (a : κ) : + systemCLM b M x (b s) w a = ∑ c, M x s a c * w c := by + classical + simp [systemCLM, coordL, matrixCLM, Basis.equivFunL_apply, Finsupp.single_apply] + +lemma continuous_systemCLM (b : Basis ι ℝ E) (M : E → ι → κ → κ → ℝ) + (hM : ∀ s a c, Continuous (fun x => M x s a c)) : + Continuous (systemCLM b M) := by + apply continuous_clm_apply.mpr + intro v + apply continuous_clm_apply.mpr + intro w + apply continuous_pi + intro a + have h : Continuous (fun x => ∑ s, coordL b s v * ∑ c, M x s a c * w c) := by + fun_prop + simpa [systemCLM, matrixCLM] using h + +/-- Coordinate form of the homogeneous-system uniqueness statement. -/ +theorem zero_of_coordinate_system (b : Basis ι ℝ E) + {f : E → κ → ℝ} {M : E → ι → κ → κ → ℝ} + (hf : Differentiable ℝ f) + (hM : ∀ s a c, Continuous (fun x => M x s a c)) + (hsystem : ∀ x s a, fderiv ℝ f x (b s) a = ∑ c, M x s a c * f x c) + {x₀ : E} (hzero : f x₀ = 0) : ∀ x, f x = 0 := by + apply zero_of_homogeneous_system hf (continuous_systemCLM b M hM) ?_ hzero + intro x w + have heq : (fderiv ℝ f x).toLinearMap = + ((systemCLM b M x).flip (f x)).toLinearMap := by + apply b.ext + intro s + ext a + simpa only [ContinuousLinearMap.coe_coe, ContinuousLinearMap.flip_apply, + systemCLM_basis] using hsystem x s a + exact congrArg (fun L : E →ₗ[ℝ] (κ → ℝ) => L w) heq + +end CoordinateSystems + +section Closure +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def C (e : ι → E) (B : ι → ι → ι → E → ℝ) (s i b : ι) (x : E) : ℝ := + D (B s i b) (e i) x - D (B i i b) (e s) x + + ∑ a, (B s i a x * B a i b x - B i i a x * B a s b x) + +def d (B : ι → ι → ι → E → ℝ) (s i : ι) (x : E) : ℝ := + B s i i x - B i i s x + +theorem finite_type_closure (e : ι → E) {η q : E → ℝ} + {B : ι → ι → ι → E → ℝ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hq : ContDiff ℝ (⊤ : ℕ∞) q) + (hB : ∀ i j a, ContDiff ℝ (⊤ : ℕ∞) (B i j a)) + (hess : ∀ i j, D (D η (e i)) (e j) = + fun x => ∑ a, B i j a x * D η (e a) x + if i = j then q x else 0) + {s i : ι} (his : i ≠ s) : + D q (e s) = fun x => ∑ b, C e B s i b x * D η (e b) x + d B s i x * q x := by + let v : ι → E → ℝ := fun a => D η (e a) + have hv (a : ι) : ContDiff ℝ (⊤ : ℕ∞) (v a) := contDiff_D hη _ + have hsum (a b : ι) : Differentiable ℝ (fun x => ∑ c, B a b c x * v c x) := by + exact Differentiable.fun_sum (fun c _ => + ((hB a b c).differentiable (by simp)).mul ((hv c).differentiable (by simp))) + have hdiag : D (v i) (e i) = fun x => ∑ a, B i i a x * v a x + q x := by + simpa [v] using hess i i + have hcross : D (v s) (e i) = fun x => ∑ a, B s i a x * v a x := by + simpa [v, Ne.symm his] using hess s i + have hthird : D (D (v i) (e i)) (e s) = D (D (v s) (e i)) (e i) := by + rw [D_comm (hv i) (e i) (e s)] + change D (D (D η (e i)) (e s)) (e i) = _ + rw [D_comm hη (e i) (e s)] + rw [hdiag, hcross, D_add (hsum i i) (hq.differentiable (by simp))] at hthird + have hsumD (a b c : ι) : + D (fun x => ∑ j, B a b j x * v j x) (e c) = + fun x => ∑ j, (D (B a b j) (e c) x * v j x + B a b j x * D (v j) (e c) x) := by + have hd := D_sum (f := fun j x => B a b j x * v j x) Finset.univ + (fun j _ => ((hB a b j).differentiable (by simp)).mul + ((hv j).differentiable (by simp))) (e c) + rw [hd] + simp_rw [D_mul ((hB a b _).differentiable (by simp)) ((hv _).differentiable (by simp))] + rw [hsumD, hsumD] at hthird + ext x + have hh := congrFun hthird x + dsimp only at hh + simp_rw [show ∀ j c, D (v j) (e c) = fun x => ∑ a, B j c a x * v a x + + if j = c then q x else 0 from hess] at hh + simp only [C, d] + -- Expand the finite sums, retaining the unsummed index i throughout. + simp only [Finset.sum_add_distrib, mul_add, Finset.mul_sum, add_mul, sub_mul, + Finset.sum_sub_distrib, Finset.sum_mul, mul_ite, mul_zero] at hh ⊢ + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] at hh + simp_rw [mul_assoc] at hh ⊢ + rw [Finset.sum_comm] at hh + conv at hh => rhs; rw [Finset.sum_comm] + dsimp only [v] at hh + linear_combination hh + +omit [DecidableEq ι] in +lemma contDiff_C {B : ι → ι → ι → E → ℝ} + (e : ι → E) (hB : ∀ i j a, ContDiff ℝ (⊤ : ℕ∞) (B i j a)) (s i b : ι) : + ContDiff ℝ (⊤ : ℕ∞) (C e B s i b) := by + have h₁ := contDiff_D (hB s i b) (e i) + have h₂ := contDiff_D (hB i i b) (e s) + unfold C + fun_prop + +omit [Fintype ι] [DecidableEq ι] in +lemma contDiff_d {B : ι → ι → ι → E → ℝ} + (hB : ∀ i j a, ContDiff ℝ (⊤ : ℕ∞) (B i j a)) (s i : ι) : + ContDiff ℝ (⊤ : ℕ∞) (d B s i) := by + exact (hB s i i).sub (hB i i s) + +/-- The precise global finite-type endpoint needed after taking the common +exterior extensions. The index type has at least two elements, so there is a +non-diagonal Hessian entry for each direction. -/ +theorem finite_type_zero [FiniteDimensional ℝ E] [Nontrivial ι] + (e : Basis ι ℝ E) {η q : E → ℝ} {B : ι → ι → ι → E → ℝ} + (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hq : ContDiff ℝ (⊤ : ℕ∞) q) + (hB : ∀ i j a, ContDiff ℝ (⊤ : ℕ∞) (B i j a)) + (hess : ∀ i j, D (D η (e i)) (e j) = + fun x => ∑ a, B i j a x * D η (e a) x + if i = j then q x else 0) + {W : Set E} (hW : IsOpen W) (hne : W.Nonempty) (hz : ∀ x ∈ W, η x = 0) : + (∀ x, η x = 0) ∧ (∀ x, q x = 0) := by + classical + let alt : ι → ι := fun s => Classical.choose (exists_ne s) + have halt (s : ι) : alt s ≠ s := Classical.choose_spec (exists_ne s) + let f : E → Option ι → ℝ := fun x a => match a with + | none => q x + | some a => D η (e a) x + let M : E → ι → Option ι → Option ι → ℝ := fun x s a c => + match a, c with + | none, none => d B s (alt s) x + | none, some b => C e B s (alt s) b x + | some a, none => if a = s then 1 else 0 + | some a, some b => B a s b x + have hfc (a : Option ι) : ContDiff ℝ (⊤ : ℕ∞) (fun x => f x a) := by + cases a with + | none => exact hq + | some a => exact contDiff_D hη _ + have hf : Differentiable ℝ f := differentiable_pi.mpr fun a => + (hfc a).differentiable (by simp) + have hM (s : ι) (a c : Option ι) : Continuous (fun x => M x s a c) := by + cases a <;> cases c + · exact (contDiff_d hB s (alt s)).continuous + · exact (contDiff_C e hB s (alt s) _).continuous + · exact continuous_const + · exact (hB _ _ _).continuous + have hsys (x : E) (s : ι) (a : Option ι) : + fderiv ℝ f x (e s) a = ∑ c, M x s a c * f x c := by + have hd : fderiv ℝ f x (e s) a = D (fun y => f y a) (e s) x := by + simp [D, fderiv_apply (hf x) a] + rw [hd] + cases a with + | none => + have h := congrFun (finite_type_closure e hη hq hB hess (halt s)) x + simpa [f, M, Fintype.sum_option, add_comm] using h + | some a => + have h := congrFun (hess a s) x + simpa [f, M, Fintype.sum_option, ite_mul, add_comm] using h + obtain ⟨x₀, hx₀⟩ := hne + have hevent : η =ᶠ[𝓝 x₀] (fun _ => 0) := + Filter.eventually_of_mem (hW.mem_nhds hx₀) hz + have hgrad (a : ι) : D η (e a) =ᶠ[𝓝 x₀] (fun _ => 0) := by + filter_upwards [hevent.fderiv (𝕜 := ℝ)] with x hx + simp [D, hx] + have hfzero : f x₀ = 0 := by + ext a + cases a with + | some a => exact (hgrad a).self_of_nhds + | none => + obtain ⟨i⟩ := (inferInstance : Nonempty ι) + have hi := congrFun (hess i i) x₀ + have hdi : D (D η (e i)) (e i) x₀ = 0 := by + simp [D, (hgrad i).fderiv_eq] + have hv (a : ι) : D η (e a) x₀ = 0 := (hgrad a).self_of_nhds + simpa [hdi, hv] using hi.symm + have hall := zero_of_coordinate_system e hf hM hsys hfzero + have hqzero (x : E) : q x = 0 := congrFun (hall x) none + have hderiv (x : E) : fderiv ℝ η x = 0 := by + have he : (fderiv ℝ η x).toLinearMap = (0 : E →ₗ[ℝ] ℝ) := by + apply e.ext + intro a + exact congrFun (hall x) (some a) + exact DFunLike.coe_injective (congrArg (fun L : E →ₗ[ℝ] ℝ => (L : E → ℝ)) he) + constructor + · apply zero_of_homogeneous_system (hη.differentiable (by simp)) + (A := fun _ => 0) continuous_const ?_ (hz x₀ hx₀) + intro x v + simp [hderiv x] + · exact hqzero + +end Closure + +end ElasticityFiniteType + +namespace ElasticityRecovery +open Module ElasticityFiniteType ElasticityConic + +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev RMat := Matrix (Fin 3) (Fin 3) ℝ + +def basis : Basis (Fin 3) ℝ X := (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis + +def grad (f : X → ℝ) (x : X) (i : Fin 3) : ℝ := D f (basis i) x + +def hessian (f : X → ℝ) (x : X) (i j : Fin 3) : ℝ := + D (D f (basis i)) (basis j) x + +def dir (θ : C3) (f : X → ℝ) (x : X) : ℂ := + dotProduct θ (fun i => (grad f x i : ℂ)) + +lemma D_sub {f g : X → ℝ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (v : X) : D (fun x => f x - g x) v = fun x => D f v x - D g v x := by + ext x + simp [D, fderiv_fun_sub (hf x) (hg x)] + +lemma grad_sub {f g : X → ℝ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (x : X) (i : Fin 3) : grad (fun x => f x - g x) x i = grad f x i - grad g x i := by + exact congrFun (D_sub hf hg (basis i)) x + +lemma dir_sub {f g : X → ℝ} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (θ : C3) (x : X) : dir θ (fun x => f x - g x) x = dir θ f x - dir θ g x := by + simp [dir, grad_sub hf hg, dotProduct, Finset.sum_sub_distrib, mul_sub] + +lemma fderiv_zero_of_null (f : X → ℝ) (x : X) + (hf : ∀ θ : C3, θ ≠ 0 → null θ → dir θ f x = 0) : fderiv ℝ f x = 0 := by + have hv := null_dot_zero (fun i => (grad f x i : ℂ)) hf + have hb (i : Fin 3) : grad f x i = 0 := by + exact Complex.ofReal_eq_zero.mp (congrFun hv i) + have he : (fderiv ℝ f x).toLinearMap = (0 : X →ₗ[ℝ] ℝ) := by + apply basis.ext + exact hb + exact DFunLike.coe_injective (congrArg (fun L : X →ₗ[ℝ] ℝ => (L : X → ℝ)) he) + +lemma zero_of_null_derivatives {f : X → ℝ} + (hf : Differentiable ℝ f) + (hd : ∀ x θ, θ ≠ 0 → null θ → dir θ f x = 0) + {x₀ : X} (hz : f x₀ = 0) : ∀ x, f x = 0 := by + apply zero_of_homogeneous_system hf (A := fun _ => 0) continuous_const ?_ hz + intro x v + simp [fderiv_zero_of_null f x (hd x)] + +lemma real_scalar_of_null_annihilator (K : RMat) + (hK : ∀ θ : C3, θ ≠ 0 → null θ → ∀ p : C3, dotProduct θ p = 0 → + dotProduct ((fun i j => (K i j : ℂ)) *ᵥ θ) p = 0) : + ∀ i j, K i j = if i = j then K 0 0 else 0 := by + obtain ⟨κ, hκ⟩ := scalar_of_null_annihilator _ hK + have hk : κ = (K 0 0 : ℂ) := by + simpa using (congrArg (fun M : Mat3 => M 0 0) hκ).symm + intro i j + have he := congrArg (fun M : Mat3 => M i j) hκ + apply Complex.ofReal_injective + simpa [hk, Matrix.one_apply, apply_ite] using he + +/-- Real matrix whose null contraction is exactly the Q block. -/ +def QMatrix (m k : X → ℝ) (x : X) : RMat := fun i j => + (1 / 2 : ℝ) * (((m x / (k x + m x)) * grad (fun x => Real.log (k x)) x j - + (1 / 2 : ℝ) * grad (fun x => Real.log (m x)) x j) * + grad (fun x => Real.log (m x)) x i - + (m x / (k x + m x)) * hessian (fun x => Real.log (m x)) x i j) + +def T (m k : X → ℝ) (x : X) (θ : C3) : ℂ := + dir θ (fun x => Real.log (k x / (k x + m x))) x + +def Q (m k : X → ℝ) (x : X) (θ : C3) : C3 := + (fun i j => (QMatrix m k x i j : ℂ)) *ᵥ θ + +/-- This is equality of the two restricted bottom rows, not a DN hypothesis. +Deriving it from the actual DN maps is still required by the full theorem. -/ +def EqualRestrictedTransports (m₁ k₁ m₂ k₂ : X → ℝ) : Prop := + ∀ x θ, θ ≠ 0 → null θ → + T m₁ k₁ x θ = T m₂ k₂ x θ ∧ + ∀ p : C3, dotProduct θ p = 0 → + dotProduct (Q m₁ k₁ x θ) p = dotProduct (Q m₂ k₂ x θ) p + +lemma contDiff_log {f : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hp : ∀ x, 0 < f x) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => Real.log (f x)) := + hf.log (fun x => (hp x).ne') + +lemma contDiff_logRatio {m k : X → ℝ} + (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hk : ContDiff ℝ (⊤ : ℕ∞) k) + (hmp : ∀ x, 0 < m x) (hkp : ∀ x, 0 < k x) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => Real.log (k x / (k x + m x))) := by + exact contDiff_log (hk.div (hk.add hm) (fun x => (add_pos (hkp x) (hmp x)).ne')) + (fun x => div_pos (hkp x) (add_pos (hkp x) (hmp x))) + +lemma ratio_equal {m₁ k₁ m₂ k₂ : X → ℝ} + (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) (hk₁ : ContDiff ℝ (⊤ : ℕ∞) k₁) + (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) (hk₂ : ContDiff ℝ (⊤ : ℕ∞) k₂) + (hmp₁ : ∀ x, 0 < m₁ x) (hkp₁ : ∀ x, 0 < k₁ x) + (hmp₂ : ∀ x, 0 < m₂ x) (hkp₂ : ∀ x, 0 < k₂ x) + (ht : EqualRestrictedTransports m₁ k₁ m₂ k₂) + {x₀ : X} (hm₀ : m₁ x₀ = m₂ x₀) (hk₀ : k₁ x₀ = k₂ x₀) : + ∀ x, k₁ x / (k₁ x + m₁ x) = k₂ x / (k₂ x + m₂ x) := by + let ρ₁ := fun x => Real.log (k₁ x / (k₁ x + m₁ x)) + let ρ₂ := fun x => Real.log (k₂ x / (k₂ x + m₂ x)) + have h₁ := (contDiff_logRatio hm₁ hk₁ hmp₁ hkp₁).differentiable (by simp) + have h₂ := (contDiff_logRatio hm₂ hk₂ hmp₂ hkp₂).differentiable (by simp) + have hz : ∀ x, ρ₁ x - ρ₂ x = 0 := by + apply zero_of_null_derivatives (h₁.sub h₂) ?_ (x₀ := x₀) ?_ + · intro x θ hn hnull + change dir θ (fun y => ρ₁ y - ρ₂ y) x = 0 + rw [dir_sub h₁ h₂] + exact sub_eq_zero.mpr (ht x θ hn hnull).1 + · simp [hm₀, hk₀] + intro x + apply Real.log_injOn_pos + (div_pos (hkp₁ x) (add_pos (hkp₁ x) (hmp₁ x))) + (div_pos (hkp₂ x) (add_pos (hkp₂ x) (hmp₂ x))) + exact sub_eq_zero.mp (hz x) + +lemma ratios_algebra {m₁ k₁ m₂ k₂ : ℝ} + (hm₁ : 0 < m₁) (hk₁ : 0 < k₁) (hm₂ : 0 < m₂) (hk₂ : 0 < k₂) + (h : k₁ / (k₁ + m₁) = k₂ / (k₂ + m₂)) : + m₁ / (k₁ + m₁) = m₂ / (k₂ + m₂) ∧ k₁ / m₁ = k₂ / m₂ := by + have hd₁ := (add_pos hk₁ hm₁).ne' + have hd₂ := (add_pos hk₂ hm₂).ne' + have hcross := (div_eq_div_iff hd₁ hd₂).mp h + constructor + · apply (div_eq_div_iff hd₁ hd₂).mpr + nlinarith + · apply (div_eq_div_iff hm₁.ne' hm₂.ne').mpr + nlinarith + +lemma hessian_sub {f g : X → ℝ} + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (x : X) (i j : Fin 3) : + hessian (fun x => f x - g x) x i j = hessian f x i j - hessian g x i j := by + unfold hessian + rw [D_sub (hf.differentiable (by simp)) (hg.differentiable (by simp)), + D_sub ((contDiff_D hf _).differentiable (by simp)) + ((contDiff_D hg _).differentiable (by simp))] + +lemma contDiff_grad {f : X → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => grad f x i) := contDiff_D hf _ + +lemma contDiff_hessian {f : X → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i j : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => hessian f x i j) := contDiff_D (contDiff_D hf _) _ + +lemma contDiff_QMatrix {m k : X → ℝ} + (hm : ContDiff ℝ (⊤ : ℕ∞) m) (hk : ContDiff ℝ (⊤ : ℕ∞) k) + (hmp : ∀ x, 0 < m x) (hkp : ∀ x, 0 < k x) (i j : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => QMatrix m k x i j) := by + have hc : ContDiff ℝ (⊤ : ℕ∞) (fun x => m x / (k x + m x)) := + hm.div (hk.add hm) (fun x => (add_pos (hkp x) (hmp x)).ne') + have hg (a : Fin 3) := contDiff_grad (contDiff_log hm hmp) a + have ht (a : Fin 3) := contDiff_grad (contDiff_log hk hkp) a + have hh := contDiff_hessian (contDiff_log hm hmp) i j + unfold QMatrix + fun_prop + +lemma recovery_entry {c g₁ᵢ g₁ⱼ g₂ᵢ g₂ⱼ t₁ t₂ H₁ H₂ κ δ : ℝ} + (hc : c ≠ 0) (ht : t₁ - t₂ = g₁ⱼ - g₂ⱼ) + (hQ : (1 / 2 : ℝ) * ((c * t₁ - (1 / 2 : ℝ) * g₁ⱼ) * g₁ᵢ - c * H₁) - + (1 / 2 : ℝ) * ((c * t₂ - (1 / 2 : ℝ) * g₂ⱼ) * g₂ᵢ - c * H₂) = κ * δ) : + H₁ - H₂ = ((c - (1 / 2 : ℝ)) / c) * g₁ᵢ * (g₁ⱼ - g₂ⱼ) + + (((c - (1 / 2 : ℝ)) / c) * g₂ⱼ + (t₂ - g₂ⱼ)) * (g₁ᵢ - g₂ᵢ) + + (-2 * κ / c) * δ := by + have ht' : t₁ = t₂ + (g₁ⱼ - g₂ⱼ) := by linarith + rw [ht'] at hQ + field_simp [hc] + linear_combination -4 * hQ + +/-- The final coefficient-recovery step, with its genuine intermediate transport +hypothesis explicit. This is not the main DN uniqueness theorem. -/ +theorem coefficients_equal_of_restricted_transports + {m₁ k₁ m₂ k₂ : X → ℝ} + (hm₁ : ContDiff ℝ (⊤ : ℕ∞) m₁) (hk₁ : ContDiff ℝ (⊤ : ℕ∞) k₁) + (hm₂ : ContDiff ℝ (⊤ : ℕ∞) m₂) (hk₂ : ContDiff ℝ (⊤ : ℕ∞) k₂) + (hmp₁ : ∀ x, 0 < m₁ x) (hkp₁ : ∀ x, 0 < k₁ x) + (hmp₂ : ∀ x, 0 < m₂ x) (hkp₂ : ∀ x, 0 < k₂ x) + (ht : EqualRestrictedTransports m₁ k₁ m₂ k₂) + {W : Set X} (hW : IsOpen W) (hne : W.Nonempty) + (hmW : ∀ x ∈ W, m₁ x = m₂ x) (hkW : ∀ x ∈ W, k₁ x = k₂ x) : + m₁ = m₂ ∧ k₁ = k₂ := by + obtain ⟨x₀, hx₀⟩ := hne + have hr := ratio_equal hm₁ hk₁ hm₂ hk₂ hmp₁ hkp₁ hmp₂ hkp₂ ht + (hmW x₀ hx₀) (hkW x₀ hx₀) + have hc (x : X) := (ratios_algebra (hmp₁ x) (hkp₁ x) (hmp₂ x) (hkp₂ x) (hr x)).1 + have hb (x : X) := (ratios_algebra (hmp₁ x) (hkp₁ x) (hmp₂ x) (hkp₂ x) (hr x)).2 + let l₁ := fun x => Real.log (m₁ x) + let l₂ := fun x => Real.log (m₂ x) + let t₁ := fun x => Real.log (k₁ x) + let t₂ := fun x => Real.log (k₂ x) + have hl₁ : ContDiff ℝ (⊤ : ℕ∞) l₁ := contDiff_log hm₁ hmp₁ + have hl₂ : ContDiff ℝ (⊤ : ℕ∞) l₂ := contDiff_log hm₂ hmp₂ + have ht₁ : ContDiff ℝ (⊤ : ℕ∞) t₁ := contDiff_log hk₁ hkp₁ + have ht₂ : ContDiff ℝ (⊤ : ℕ∞) t₂ := contDiff_log hk₂ hkp₂ + have heq : (fun x => t₁ x - l₁ x) = (fun x => t₂ x - l₂ x) := by + ext x + have he := congrArg Real.log (hb x) + simpa [Real.log_div (hkp₁ x).ne' (hmp₁ x).ne', + Real.log_div (hkp₂ x).ne' (hmp₂ x).ne'] using he + have htg (x : X) (j : Fin 3) : grad t₁ x j - grad t₂ x j = + grad l₁ x j - grad l₂ x j := by + have he := congrArg (fun f : X → ℝ => grad f x j) heq + rw [grad_sub (ht₁.differentiable (by simp)) (hl₁.differentiable (by simp)), + grad_sub (ht₂.differentiable (by simp)) (hl₂.differentiable (by simp))] at he + linarith + let K : X → RMat := fun x i j => QMatrix m₁ k₁ x i j - QMatrix m₂ k₂ x i j + let κ : X → ℝ := fun x => K x 0 0 + have hK (x : X) : ∀ i j, K x i j = if i = j then κ x else 0 := by + apply real_scalar_of_null_annihilator + intro θ hn hnull p hp + have he := (ht x θ hn hnull).2 p hp + simpa [K, Q, dotProduct, Matrix.mulVec, sub_mul, Finset.sum_sub_distrib] + using sub_eq_zero.mpr he + have hKc (i j : Fin 3) : ContDiff ℝ (⊤ : ℕ∞) (fun x => K x i j) := + (contDiff_QMatrix hm₁ hk₁ hmp₁ hkp₁ i j).sub + (contDiff_QMatrix hm₂ hk₂ hmp₂ hkp₂ i j) + let c := fun x => m₁ x / (k₁ x + m₁ x) + have hcp (x : X) : 0 < c x := div_pos (hmp₁ x) (add_pos (hkp₁ x) (hmp₁ x)) + have hcc : ContDiff ℝ (⊤ : ℕ∞) c := + hm₁.div (hk₁.add hm₁) (fun x => (add_pos (hkp₁ x) (hmp₁ x)).ne') + let α := fun x => (c x - (1 / 2 : ℝ)) / c x + let q := fun x => -2 * κ x / c x + let η := fun x => l₁ x - l₂ x + let B : Fin 3 → Fin 3 → Fin 3 → X → ℝ := fun i j a x => + α x * grad l₁ x i * (if j = a then 1 else 0) + + (α x * grad l₂ x j + (grad t₂ x j - grad l₂ x j)) * (if i = a then 1 else 0) + have hα : ContDiff ℝ (⊤ : ℕ∞) α := (hcc.sub contDiff_const).div hcc (fun x => (hcp x).ne') + have hq : ContDiff ℝ (⊤ : ℕ∞) q := + (contDiff_const.mul (hKc 0 0)).div hcc (fun x => (hcp x).ne') + have hB (i j a : Fin 3) : ContDiff ℝ (⊤ : ℕ∞) (B i j a) := by + have hg₁ := contDiff_grad hl₁ i + have hg₂ := contDiff_grad hl₂ j + have hgt := contDiff_grad ht₂ j + dsimp [B] + fun_prop + have hess (i j : Fin 3) : D (D η (basis i)) (basis j) = + fun x => (∑ a, B i j a x * D η (basis a) x) + (if i = j then q x else 0) := by + ext x + have hQ := hK x i j + have hc' : m₂ x / (k₂ x + m₂ x) = c x := (hc x).symm + change QMatrix m₁ k₁ x i j - QMatrix m₂ k₂ x i j = _ at hQ + simp only [QMatrix, hc'] at hQ + have hδ : (if i = j then κ x else 0) = κ x * (if i = j then (1 : ℝ) else 0) := by + split_ifs <;> simp + rw [hδ] at hQ + have hh := recovery_entry (hcp x).ne' (htg x j) hQ + change hessian η x i j = _ + rw [hessian_sub hl₁ hl₂] + change hessian l₁ x i j - hessian l₂ x i j = _ at hh + rw [hh] + have hv (a : Fin 3) : D η (basis a) x = grad l₁ x a - grad l₂ x a := + grad_sub (hl₁.differentiable (by simp)) (hl₂.differentiable (by simp)) x a + simp only [B, hv, add_mul, mul_assoc, mul_ite, ite_mul, mul_one, mul_zero, + zero_mul, Finset.sum_add_distrib, Finset.sum_ite_eq, + Finset.mem_univ, ↓reduceIte] + rfl + have hηzero : ∀ x ∈ W, η x = 0 := by + intro x hx + simp [η, l₁, l₂, hmW x hx] + have hz := (finite_type_zero basis (hl₁.sub hl₂) hq hB hess hW ⟨x₀, hx₀⟩ hηzero).1 + have hm : m₁ = m₂ := by + ext x + apply Real.log_injOn_pos (hmp₁ x) (hmp₂ x) + exact sub_eq_zero.mp (hz x) + refine ⟨hm, ?_⟩ + ext x + have he := hb x + rw [hm] at he + exact (div_left_inj' (hmp₂ x).ne').mp he + +end ElasticityRecovery + +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Regularity.lean b/lean/OAI/MathematicalPhysics/Elasticity/Regularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..121649ed3d4516d27a77bb2ee16de56cd924ffe6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Regularity.lean @@ -0,0 +1,1044 @@ +import OAI.MathematicalPhysics.Elasticity.Carleman + +namespace OAI + +noncomputable section + +/-! Actual distributional elliptic regularity dependencies of the physical and +planar weak-limit constructions. No regularity assumption on an L2 unknown is +used in the gain of Sobolev order below. -/ +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal +namespace ElasticityRegularity + +section +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +omit [CompleteSpace F] in +lemma fourierMultiplier_add {g h : E → ℂ} + (hg : g.HasTemperateGrowth) (hh : h.HasTemperateGrowth) (u : 𝓢'(E,F)) : + fourierMultiplierCLM F (g+h) u=fourierMultiplierCLM F g u+fourierMultiplierCLM F h u := by + simp only [fourierMultiplierCLM_apply,smulLeftCLM_add hg hh,add_apply,fourierInv_add] + +omit [CompleteSpace F] in +lemma besselPotential_two (u : 𝓢'(E,F)) : + besselPotential E F 2 u=u+fourierMultiplierCLM F (fun x : E => ((‖x‖^2 : ℝ) : ℂ)) u := by + have he : (fun x : E => (((1+‖x‖^2)^(2/2 : ℝ) : ℝ) : ℂ)) = + (fun _ : E => (1 : ℂ))+(fun x : E => ((‖x‖^2 : ℝ) : ℂ)) := by + funext x + norm_num + rw [besselPotential,he,fourierMultiplier_add (by fun_prop) (by fun_prop)] + simp + +lemma sobolev_real_smul {s : ℝ} {u : 𝓢'(E,F)} (hu : MemSobolev s 2 u) (c : ℝ) : + MemSobolev s 2 (c • u) := by + convert hu.smul (c : ℂ) using 1 + +/-- Whole-space elliptic gain for the actual distributional Laplacian. -/ +theorem laplacian_gain {s : ℝ} {u : 𝓢'(E,F)} + (hu : MemSobolev s 2 u) (hΔ : MemSobolev s 2 (Δ u)) : MemSobolev (s+2) 2 u := by + have hp : (-(2*Real.pi)^2 : ℝ) ≠ 0 := + neg_ne_zero.mpr (pow_ne_zero _ (mul_ne_zero (by norm_num) Real.pi_ne_zero)) + have hm := sobolev_real_smul hΔ (-(2*Real.pi)^2)⁻¹ + rw [laplacian_eq_fourierMultiplierCLM,smul_smul,inv_mul_cancel₀ hp,one_smul] at hm + have h := hu.add hm + rw [← besselPotential_two,memSobolev_besselPotential_iff] at h + simpa only [add_comm] using h + +/-- One derivative of gain from information on all coordinate first derivatives. -/ +theorem coordinate_derivative_gain {ι : Type*} [Fintype ι] + (b : OrthonormalBasis ι ℝ E) {s : ℝ} {u : 𝓢'(E,F)} + (hu : MemSobolev s 2 u) (hd : ∀ i, MemSobolev s 2 (∂_{b i} u)) : + MemSobolev (s+1) 2 u := by + have hall : ∀ S : Finset ι, MemSobolev (s-1) 2 (∑ i ∈ S, ∂_{b i} (∂_{b i} u)) := by + classical + intro S + induction S using Finset.induction_on with + | empty => simp + | @insert i S hi hS => + rw [Finset.sum_insert hi] + exact ((hd i).lineDerivOp).add hS + have hsum := hall Finset.univ + rw [← laplacian_eq_sum b] at hsum + have h := laplacian_gain (hu.mono (by linarith : s-1 ≤ s)) hsum + have he : s-1+2=s+1 := by ring + rwa [he] at h + +end + +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] in +lemma compact_derivative {g : E → ℂ} (hg : HasCompactSupport g) (m : E) : + HasCompactSupport (fun x => fderiv ℝ g x m) := + (hg.fderiv ℝ).comp_left (g := fun T : E →L[ℝ] ℂ => T m) (by simp) + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] in +lemma smooth_derivative {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (m : E) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => fderiv ℝ g x m) := + (hg.fderiv_right (by simp)).clm_apply contDiff_const + +omit [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] in +lemma schwartz_leibniz {g : E → ℂ} (hg : g.HasTemperateGrowth) + (m : E) (hd : (fun x => fderiv ℝ g x m).HasTemperateGrowth) (φ : 𝓢(E,ℂ)) : + ∂_{m} (SchwartzMap.smulLeftCLM ℂ g φ) = + SchwartzMap.smulLeftCLM ℂ (fun x => fderiv ℝ g x m) φ + + SchwartzMap.smulLeftCLM ℂ g (∂_{m} φ) := by + ext x + simp only [add_apply,SchwartzMap.smulLeftCLM_apply_apply hd, + SchwartzMap.smulLeftCLM_apply_apply hg,SchwartzMap.lineDerivOp_apply_eq_fderiv, + SchwartzMap.smulLeftCLM_apply hg] + change fderiv ℝ (g*(φ : E → ℂ)) x m = + fderiv ℝ g x m*φ x+g x*fderiv ℝ (φ : E → ℂ) x m + rw [fderiv_mul (hg.1.differentiable (by simp) x) φ.differentiableAt] + simp only [add_apply,smul_apply,smul_eq_mul] + ring + +omit [CompleteSpace F] [MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] in +lemma distribution_leibniz {g : E → ℂ} (hg : g.HasTemperateGrowth) + (m : E) (hd : (fun x => fderiv ℝ g x m).HasTemperateGrowth) (u : 𝓢'(E,F)) : + ∂_{m} (smulLeftCLM F g u) = + smulLeftCLM F (fun x => fderiv ℝ g x m) u+smulLeftCLM F g (∂_{m} u) := by + ext φ + simp only [lineDerivOp_apply_apply,smulLeftCLM_apply_apply,add_apply, + schwartz_leibniz hg m hd,map_neg,map_add] + abel + +lemma compact_bounded_multiplier {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) : MemLp g ∞ (volume : Measure E) := by + obtain ⟨C,hC⟩ := hc.exists_bound_of_continuousOn hg.continuous.continuousOn + refine memLp_top_of_bound hg.continuous.aestronglyMeasurable (max C 0) + (Filter.Eventually.of_forall fun x => ?_) + by_cases hx : x ∈ tsupport g + · exact (hC x hx).trans (le_max_left _ _) + · rw [image_eq_zero_of_notMem_tsupport hx,norm_zero] + exact le_max_right _ _ + +lemma sobolev_zero_product {g : E → ℂ} (hg : g.HasTemperateGrowth) + (hb : MemLp g ∞ (volume : Measure E)) {u : 𝓢'(E,F)} (hu : MemSobolev 0 2 u) : + MemSobolev 0 2 (smulLeftCLM F g u) := by + obtain ⟨v,rfl⟩ := memSobolev_zero_iff.mp hu + apply memSobolev_zero_iff.mpr + exact ⟨hb.toLp g • v, (Lp.toTemperedDistribution_smul_eq hg hb v).symm⟩ + +/-- Smooth compact coefficients preserve every nonnegative integral Sobolev order. +This is proved for the actual tempered distribution product, not an assumed +bounded multiplier on an unspecified Sobolev completion. -/ +theorem sobolev_nat_product {ι : Type*} [Fintype ι] (b : OrthonormalBasis ι ℝ E) + (n : ℕ) {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + {u : 𝓢'(E,F)} (hu : MemSobolev n 2 u) : MemSobolev n 2 (smulLeftCLM F g u) := by + induction n generalizing u g with + | zero => + rw [Nat.cast_zero] at hu ⊢ + exact sobolev_zero_product (hc.hasTemperateGrowth hg) (compact_bounded_multiplier hg hc) hu + | succ n ih => + rw [Nat.cast_add,Nat.cast_one] at hu ⊢ + apply coordinate_derivative_gain b (ih hg hc (hu.mono (by norm_num))) + intro i + have hd : MemSobolev (n : ℝ) 2 (∂_{b i} u) := by + simpa only [add_sub_cancel_right] using hu.lineDerivOp (m := b i) + rw [distribution_leibniz (hc.hasTemperateGrowth hg) (b i) + ((compact_derivative hc (b i)).hasTemperateGrowth (smooth_derivative hg (b i)))] + exact (ih (smooth_derivative hg (b i)) (compact_derivative hc (b i)) + (hu.mono (by norm_num))).add (ih hg hc hd) + +lemma sobolev_zero_product_derivative {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (m : E) {u : 𝓢'(E,F)} (hu : MemSobolev 0 2 u) : + MemSobolev (-1) 2 (smulLeftCLM F g (∂_{m} u)) := by + have h1 := (sobolev_zero_product (hc.hasTemperateGrowth hg) + (compact_bounded_multiplier hg hc) hu).lineDerivOp (m := m) + simp only [zero_sub] at h1 + have h2 := sobolev_zero_product + ((compact_derivative hc m).hasTemperateGrowth (smooth_derivative hg m)) + (compact_bounded_multiplier (smooth_derivative hg m) (compact_derivative hc m)) hu + have h := h1.sub (h2.mono (by norm_num : (-1 : ℝ) ≤ 0)) + rw [distribution_leibniz (hc.hasTemperateGrowth hg) m + ((compact_derivative hc m).hasTemperateGrowth (smooth_derivative hg m)),add_sub_cancel_left] at h + exact h + +end ElasticityRegularity + +open scoped BigOperators SchwartzMap LineDeriv +open scoped SchwartzMap LineDeriv BigOperators +namespace ElasticityDistribution + +open ElasticityAugmented ElasticityRegularity TemperedDistribution +abbrev X := ElasticityAugmented.X +abbrev Dist := 𝓢'(X,ℂ) + +/-- Smooth temperate coefficients act on actual tempered distributions. -/ +def coefficientAlgebra : Subalgebra ℂ Smooth where + carrier := {a | (a : X → ℂ).HasTemperateGrowth} + add_mem' ha hb := ha.add hb + mul_mem' ha hb := ha.mul hb + zero_mem' := Function.HasTemperateGrowth.zero + one_mem' := Function.HasTemperateGrowth.const 1 + algebraMap_mem' c := Function.HasTemperateGrowth.const c +abbrev Coeff := coefficientAlgebra + +def eval (a : Coeff) : X → ℂ := a.val +lemma growth (a : Coeff) : (eval a).HasTemperateGrowth := a.property +lemma eval_smooth (a : Coeff) : ContDiff ℝ (⊤ : ℕ∞) (eval a) := (growth a).1 + +@[simp] lemma eval_add (a b : Coeff) : eval (a+b) = eval a+eval b := rfl +@[simp] lemma eval_mul (a b : Coeff) : eval (a*b) = eval a*eval b := rfl +@[simp] lemma eval_one : eval (1 : Coeff) = fun _ => 1 := rfl + +instance : SMul Coeff Dist := ⟨fun a u => smulLeftCLM ℂ (eval a) u⟩ +lemma smul_def (a : Coeff) (u : Dist) : a • u = smulLeftCLM ℂ (eval a) u := rfl +instance : Module Coeff Dist := Module.ofMinimalAxioms + (fun a u v => (smulLeftCLM ℂ (eval a)).map_add u v) + (fun a b u => by simp only [smul_def, eval_add, smulLeftCLM_add (growth a) (growth b), + add_apply]) + (fun a b u => by + simp only [smul_def, eval_mul] + rw [smulLeftCLM_smulLeftCLM_apply (growth b) (growth a),mul_comm]) + (fun u => by simp only [smul_def,eval_one,smulLeftCLM_const,one_smul]) + +instance : IsScalarTower ℂ Coeff Dist where + smul_assoc c a u := by + change smulLeftCLM ℂ (c • eval a) u = c • smulLeftCLM ℂ (eval a) u + rw [smulLeftCLM_smul (growth a) c, smul_apply] +instance : SMulCommClass ℂ Coeff Dist where + smul_comm c a u := ((smulLeftCLM ℂ (eval a)).map_smul c u).symm + +/-- The coefficient derivative and distribution derivative are genuine derivatives. -/ +def dc (i : Fin 3) : Derivation ℂ Coeff Coeff := Derivation.mk' (R := ℂ) (A := Coeff) (M := Coeff) + ({ toFun := fun (a : Coeff) => (⟨coord i a.val, ElasticityPhysicalAlgebra.temperate_partial _ (growth a) (e i)⟩ : Coeff) + map_add' a b := by apply Subtype.ext; exact map_add (coord i) _ _ + map_smul' c a := by apply Subtype.ext; exact (coord i).toLinearMap.map_smul c a.val } : Coeff →ₗ[ℂ] Coeff) + (by intro (a : Coeff) (b : Coeff); apply Subtype.ext; exact (coord i).leibniz a.val b.val) + +def dd (i : Fin 3) : Dist →ₗ[ℂ] Dist := (LineDeriv.lineDerivOpCLM ℂ Dist (e i)).toLinearMap +lemma dd_apply (i : Fin 3) (u : Dist) : dd i u = ∂_{e i} u := rfl +lemma dc_eval (i : Fin 3) (a : Coeff) : eval (dc i a) = fun x => fderiv ℝ (eval a) x (e i) := rfl +lemma dc_commute (i j : Fin 3) (a : Coeff) : dc i (dc j a) = dc j (dc i a) := by + apply Subtype.ext + exact coord_commute i j a.val +lemma dd_commute (i j : Fin 3) (u : Dist) : dd i (dd j u) = dd j (dd i u) := by + ext φ + change u (- ∂_{e j} (- ∂_{e i} φ)) = u (- ∂_{e i} (- ∂_{e j} φ)) + simp only [LineDeriv.lineDerivOp_neg,neg_neg] + congr 1 + exact ElasticitySchwartzCarleman.d_comm (e j) (e i) φ +lemma dd_leibniz (i : Fin 3) (a : Coeff) (u : Dist) : + dd i (a • u) = dc i a • u+a • dd i u := by + exact distribution_leibniz (growth a) (e i) (growth (dc i a)) u + +open ElasticityAugmented TrivSqZeroExt + +instance : SMul Coeffᵐᵒᵖ Dist := ⟨fun a u => a.unop • u⟩ +instance : Module Coeffᵐᵒᵖ Dist := Module.ofMinimalAxioms + (fun a u v => smul_add a.unop u v) + (fun a b u => add_smul a.unop b.unop u) + (fun a b u => by change (b.unop*a.unop) • u = a.unop • b.unop • u; rw [mul_comm,mul_smul]) + (fun u => (one_smul Coeff u)) +instance : IsCentralScalar Coeff Dist where + op_smul_eq_smul _a _u := rfl +instance : IsScalarTower ℂ Coeffᵐᵒᵖ Dist where + smul_assoc c a u := by change (c • a.unop) • u = c • a.unop • u; exact smul_assoc c a.unop u + +abbrev Ext := TrivSqZeroExt Coeff Dist +/-- The square-zero algebra is only an algebraic way of reusing the physical +compatibility identities: its genuine distribution component is never multiplied +by another distribution. -/ +def de (i : Fin 3) : Derivation ℂ Ext Ext := Derivation.mk' (R := ℂ) (A := Ext) (M := Ext) + ({ toFun := fun v => (dc i v.fst,dd i v.snd) + map_add' := by + intro v w + apply TrivSqZeroExt.ext + · change dc i (v.fst+w.fst) = dc i v.fst+dc i w.fst + exact map_add (dc i) _ _ + · change dd i (v.snd+w.snd) = dd i v.snd+dd i w.snd + exact map_add (dd i) _ _ + map_smul' := by + intro c v + apply TrivSqZeroExt.ext + · change dc i (c • v.fst) = c • dc i v.fst + exact (dc i).map_smul c v.fst + · change dd i (c • v.snd) = c • dd i v.snd + exact (dd i).map_smul c v.snd } : Ext →ₗ[ℂ] Ext) + (by + intro v w + apply TrivSqZeroExt.ext + · change dc i (v.fst*w.fst) = v.fst*dc i w.fst+w.fst*dc i v.fst + exact (dc i).leibniz _ _ + · change dd i (v.fst • w.snd+w.fst • v.snd) = + v.fst • dd i w.snd+dc i w.fst • v.snd + + (w.fst • dd i v.snd+dc i v.fst • w.snd) + rw [map_add,dd_leibniz,dd_leibniz] + abel) +lemma de_fst (i : Fin 3) (v : Ext) : (de i v).fst = dc i v.fst := rfl +lemma de_snd (i : Fin 3) (v : Ext) : (de i v).snd = dd i v.snd := rfl +lemma de_inl (i : Fin 3) (a : Coeff) : de i (inl a) = inl (dc i a) := by + apply TrivSqZeroExt.ext <;> simp [de_fst,de_snd] +lemma de_inr (i : Fin 3) (u : Dist) : de i (inr u) = inr (dd i u) := by + apply TrivSqZeroExt.ext <;> simp [de_fst,de_snd] +lemma de_commute (i j : Fin 3) (v : Ext) : de i (de j v) = de j (de i v) := by + apply TrivSqZeroExt.ext + · exact dc_commute i j v.fst + · exact dd_commute i j v.snd + +def sd (z : Fin 3 → ℂ) (i : Fin 3) : Dist →ₗ[ℂ] Dist := dd i+z i • LinearMap.id +lemma sd_apply (z : Fin 3 → ℂ) (i : Fin 3) (u : Dist) : sd z i u = dd i u+z i • u := rfl +lemma shifted_inr (z : Fin 3 → ℂ) (i : Fin 3) (u : Dist) : + shifted (A := Ext) de z i (inr u) = inr (sd z i u) := by + simp only [shifted_apply,sd_apply,de_inr,inr_add,inr_smul] + +def lapd (z : Fin 3 → ℂ) (u : Dist) : Dist := ∑ i, sd z i (sd z i u) +def divd (z : Fin 3 → ℂ) (u : Fin 3 → Dist) : Dist := ∑ i, sd z i (u i) +def rd (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (d : Dist) (i : Fin 3) : Dist := + m • lapd z (u i)+(lam+m) • sd z i d+ + (∑ j, dc j m • (sd z j (u i)+sd z i (u j)))+dc i lam • d + +def scd (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (d : Dist) : Dist := + (lam+m+m) • lapd z d + (2 : ℂ) • (∑ i, dc i (lam+m) • sd z i d) + + (2 : ℂ) • (∑ i, dc i m • lapd z (u i))+ + (2 : ℂ) • (∑ i, ∑ j, dc i (dc j m) • sd z i (u j))+ + (∑ i, dc i (dc i lam)) • d + +def phys (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (i : Fin 3) : Dist := + sd z i (lam • divd z u)+ ∑ j, sd z j (m • (sd z j (u i)+sd z i (u j))) + +lemma lapT_inr (z : Fin 3 → ℂ) (u : Dist) : + lapT (shifted (A := Ext) de z) (inr u) = inr (lapd z u) := by + simp only [lapT,lapd,shifted_inr,inr_sum] +lemma divT_inr (z : Fin 3 → ℂ) (u : Fin 3 → Dist) : + divT (shifted (A := Ext) de z) (fun i => inr (u i)) = inr (divd z u) := by + simp only [divT,divd,shifted_inr,inr_sum] +lemma LT_inr (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (i : Fin 3) : + LT (shifted (A := Ext) de z) (inl lam) (inl m) (fun j => inr (u j)) i = inr (phys z lam m u i) := by + simp only [ElasticityAugmented.LT,phys,divT_inr,shifted_inr,inl_mul_inr,← inr_add,← inr_sum] +lemma RT_inr (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (d : Dist) (i : Fin 3) : + RT de (shifted (A := Ext) de z) (inl lam) (inl m) (fun j => inr (u j)) (inr d) i = + inr (rd z lam m u d i) := by + simp only [RT,cmT,rd,lapT_inr,shifted_inr,de_inl,← inl_add,inl_mul_inr,← inr_add,← inr_sum] +lemma ST_inr (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (d : Dist) : + ST de (shifted (A := Ext) de z) (inl lam) (inl m) (fun j => inr (u j)) (inr d) = + inr (scd z lam m u d) := by + simp only [ElasticityAugmented.ST,scd,lap,lapT_inr,shifted_inr,de_inl,← inl_add,inl_mul_inr, + ← inl_sum,← inr_sum] + simp only [two_mul,← inr_add] + congr 1 + ext φ + simp only [add_apply] + change _ = _ + (2 : ℂ) * ((∑ i, dc i (lam+m) • sd z i d) φ) + + (2 : ℂ) * ((∑ i, dc i m • lapd z (u i)) φ) + + (2 : ℂ) * ((∑ i, ∑ j, dc i (dc j m) • sd z i (u j)) φ) + _ + ring + +/-- The genuine distributional physical equation has the same compatible +augmented scalar-principal system as the smooth equation. No regularity of the +unknown is used in this differential identity. -/ +theorem physical_expansion (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (i : Fin 3) : + phys z lam m u i = rd z lam m u (divd z u) i := by + have h := shifted_physical_expansion de z (inl lam) (inl m) (fun j => inr (u j)) de_commute i + rw [LT_inr,divT_inr,RT_inr] at h + exact congrArg TrivSqZeroExt.snd h + +theorem physical_divergence (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) : + divd z (phys z lam m u) = scd z lam m u (divd z u) := by + have h := shifted_physical_divergence de z (inl lam) (inl m) (fun j => inr (u j)) de_commute + have hL : ElasticityAugmented.LT (shifted (A := Ext) de z) (inl lam) (inl m) (fun j => inr (u j)) = + (fun i => inr (phys z lam m u i)) := funext (LT_inr z lam m u) + rw [hL,divT_inr,divT_inr,ST_inr] at h + exact congrArg TrivSqZeroExt.snd h + +def normPair (z : Fin 3 → ℂ) (lam m n o : Coeff) (u : Fin 3 → Dist) (d : Dist) : Fin 4 → Dist := + Fin.cons (o • (scd z lam m u d-(2 : ℂ) • (n • (∑ i, dc i m • rd z lam m u d i)))) + (fun i => n • rd z lam m u d i) +lemma inl_two : inl (2 : Coeff) = (2 : Ext) := by + exact inl_natCast 2 +lemma coff_inl_mul (a b : Coeff) : (inl a : Ext)*inl b = inl (a*b) := + (inl_mul Dist a b).symm +lemma coff_inl_add (a b : Coeff) : (inl a : Ext)+inl b = inl (a+b) := + (inl_add Dist a b).symm +lemma coff_inl_sub (a b : Coeff) : (inl a : Ext)-inl b = inl (a-b) := + (inl_sub Dist a b).symm +lemma dist_inr_sub (u v : Dist) : (inr u : Ext)-inr v = inr (u-v) := + (inr_sub Coeff u v).symm +lemma coeff_two_smul (u : Dist) : (2 : Coeff) • u = (2 : ℂ) • u := by + change TemperedDistribution.smulLeftCLM ℂ (fun _ : X => (2 : ℂ)) u = _ + rw [TemperedDistribution.smulLeftCLM_const] + +lemma coeffA_inl (lam m n o : Coeff) (k : Fin 3) (i j : Fin 4) : + coeffA (A := Ext) de (inl lam) (inl m) (inl n) (inl o) k i j = inl (coeffA dc lam m n o k i j) := by + refine Fin.cases ?_ (fun i => ?_) i <;> refine Fin.cases ?_ (fun j => ?_) j <;> + simp only [coeffA,Fin.cons_zero,Fin.cons_succ,coff_inl_add,de_inl,coff_inl_mul, + coff_inl_sub,← inl_two] + · split_ifs <;> rfl + · split_ifs <;> simp only [coff_inl_add,add_zero,zero_add,inl_zero] +lemma coeffV_inl (lam m n o : Coeff) (i j : Fin 4) : + coeffV (A := Ext) de (inl lam) (inl m) (inl n) (inl o) i j = inl (coeffV dc lam m n o i j) := by + refine Fin.cases ?_ (fun i => ?_) i <;> refine Fin.cases ?_ (fun j => ?_) j <;> + simp only [coeffV,lap,Fin.cons_zero,Fin.cons_succ,de_inl,coff_inl_mul,← inl_sum, + coff_inl_sub,← inl_two,inl_zero] +lemma normalizedPair_inr (z : Fin 3 → ℂ) (lam m n o : Coeff) (u : Fin 3 → Dist) (d : Dist) (i : Fin 4) : + normalizedPair de (shifted (A := Ext) de z) (inl lam) (inl m) (inl n) (inl o) (fun j => inr (u j)) (inr d) i = + inr (normPair z lam m n o u d i) := by + refine Fin.cases ?_ (fun i => ?_) i + · simp only [normalizedPair,normPair,Fin.cons_zero,ST_inr,RT_inr,de_inl,inl_mul_inr, + ← inr_sum] + rw [← inl_two,coff_inl_mul,inl_mul_inr,dist_inr_sub,inl_mul_inr] + congr 1 + congr 1 + congr 1 + exact (mul_smul (2 : Coeff) n (∑ i, dc i m • rd z lam m u d i)).trans (coeff_two_smul _) + · simp only [normalizedPair,normPair,Fin.cons_succ,RT_inr,inl_mul_inr] + +/-- Genuine scalar-principal matrix form for the actual distribution system. -/ +theorem normalized_matrix (z : Fin 3 → ℂ) (lam m n o : Coeff) + (hn : n*m=1) (ho : o*(lam+m+m)=1) (U : Fin 4 → Dist) (i : Fin 4) : + normPair z lam m n o (fun j => U j.succ) (U 0) i = + lapd z (U i)+(∑ k, ∑ j, coeffA dc lam m n o k i j • sd z k (U j))+ + (∑ j, coeffV dc lam m n o i j • U j) := by + have hn' : (inl n : Ext)*inl m=1 := by rw [coff_inl_mul,hn]; rfl + have ho' : (inl o : Ext)*(inl lam+inl m+inl m)=1 := by + rw [coff_inl_add,coff_inl_add,coff_inl_mul,ho]; rfl + have h := normalizedPair_matrix de (shifted (A := Ext) de z) (inl lam) (inl m) (inl n) (inl o) + hn' ho' (fun j => inr (U j)) i + simp only [normalizedPair_inr,lapT_inr,coeffA_inl,coeffV_inl,shifted_inr,inl_mul_inr, + ← inr_sum,← inr_add] at h + exact congrArg TrivSqZeroExt.snd h +end ElasticityDistribution + +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal BigOperators +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap Real ENNReal +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal BigOperators +namespace ElasticityRegularity + + +section +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +lemma sobolev_sum {ι : Type*} (S : Finset ι) {s : ℝ} {v : ι → 𝓢'(E,F)} + (hv : ∀ i ∈ S, MemSobolev s 2 (v i)) : MemSobolev s 2 (∑ i ∈ S, v i) := by + classical + induction S using Finset.induction_on with + | empty => simp + | @insert i S hi hS => + rw [Finset.sum_insert hi] + exact (hv i (Finset.mem_insert_self _ _)).add + (hS (fun j hj => hv j (Finset.mem_insert_of_mem hj))) + +/-- Actual all-order elliptic bootstrap for scalar-principal systems. The +unknown is only assumed to be represented by L2; its derivatives are the actual +tempered-distribution derivatives. Compact smooth coefficients are sufficient +for the localized physical augmented and planar systems. -/ +theorem elliptic_all_orders {ι κ : Type*} [Fintype ι] [Fintype κ] + (b : OrthonormalBasis ι ℝ E) (a : κ → κ → ι → E → ℂ) (c : κ → κ → E → ℂ) + (ha : ∀ i j d, ContDiff ℝ (⊤ : ℕ∞) (a i j d)) (hac : ∀ i j d, HasCompactSupport (a i j d)) + (hc : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (c i j)) (hcc : ∀ i j, HasCompactSupport (c i j)) + (f : κ → 𝓢(E,F)) (u : κ → 𝓢'(E,F)) (hu : ∀ i, MemSobolev 0 2 (u i)) + (heq : ∀ i, Δ (u i) = (∑ j, ∑ d, smulLeftCLM F (a i j d) (∂_{b d} (u j)))+ + (∑ j, smulLeftCLM F (c i j) (u j))+(f i : 𝓢'(E,F))) : + ∀ n : ℕ, ∀ i, MemSobolev n 2 (u i) := by + classical + intro n + induction n with + | zero => + rw [Nat.cast_zero] + exact hu + | succ n ih => + cases n with + | zero => + intro i + have hd : MemSobolev (-1) 2 (Δ (u i)) := by + rw [heq] + refine ((sobolev_sum Finset.univ (fun j _ => + sobolev_sum Finset.univ (fun d _ => + sobolev_zero_product_derivative (ha i j d) (hac i j d) (b d) (hu j)))).add ?_).add + ((f i).memSobolev (s := -1) (p := 2)) + apply sobolev_sum Finset.univ + intro j _ + exact (sobolev_zero_product ((hcc i j).hasTemperateGrowth (hc i j)) + (compact_bounded_multiplier (hc i j) (hcc i j)) (hu j)).mono (by norm_num) + have hh := laplacian_gain ((hu i).mono (by norm_num : (-1 : ℝ) ≤ 0)) hd + norm_num at hh ⊢ + exact hh + | succ k => + intro i + have hlow (j : κ) : MemSobolev (k : ℝ) 2 (u j) := + (ih j).mono (by simp) + have hder (j : κ) (d : ι) : MemSobolev (k : ℝ) 2 (∂_{b d} (u j)) := by + simpa using (ih j).lineDerivOp (m := b d) + have hd : MemSobolev (k : ℝ) 2 (Δ (u i)) := by + rw [heq] + exact ((sobolev_sum Finset.univ (fun j _ => sobolev_sum Finset.univ + (fun d _ => sobolev_nat_product b k (ha i j d) (hac i j d) (hder j d)))).add + (sobolev_sum Finset.univ (fun j _ => + sobolev_nat_product b k (hc i j) (hcc i j) (hlow j)))).add (f i).memSobolev + convert laplacian_gain (hlow i) hd using 1 + push_cast + ring + +lemma decay_memLp {s : ℝ} (hs : Module.finrank ℝ E < 2*s) : + MemLp (fun x : E => (1+‖x‖^2)^(-s/2)) 2 := by + have growth : (fun x : E => (1+‖x‖^2)^(-s/2)).HasTemperateGrowth := by fun_prop + rw [memLp_iff, eLpNorm_lt_top_iff_lintegral_rpow_enorm_lt_top + (by norm_num) (by norm_num) growth.1.continuous.aestronglyMeasurable] + suffices h : ∫⁻ x : E, ENNReal.ofReal ‖(1+‖x‖^2)^(-s)‖ < ⊤ from by + norm_cast + simp_rw [ofReal_norm] at h + simp_rw [← enorm_pow] + convert h + rw [← Real.rpow_mul_natCast (by positivity)] + simp + apply ((integrable_rpow_neg_one_add_norm_sq hs).congr _).lintegral_lt_top + filter_upwards with x + rw [Real.norm_eq_abs, abs_eq_self.mpr (by positivity)] + congr + ring + +omit [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma weighted_decay_bound (x : E) (n k : ℕ) : + ‖x‖^n*(1+‖x‖^2)^(-(n+k : ℝ)) ≤ (1+‖x‖^2)^(-(k : ℝ)) := by + have hpos : 0 < 1+‖x‖^2 := by positivity + have hbase : ‖x‖ ≤ 1+‖x‖^2 := by nlinarith [sq_nonneg (‖x‖-1)] + calc + _ ≤ (1+‖x‖^2)^n*(1+‖x‖^2)^(-(n+k : ℝ)) := + mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (norm_nonneg _) hbase n) (by positivity) + _ = _ := by + rw [← Real.rpow_natCast,← Real.rpow_add hpos] + congr 1 + ring + +lemma all_orders_fourier_moments {u : 𝓢'(E,F)} + (hu : ∀ n : ℕ, MemSobolev n 2 u) : + ∃ v : Lp F 1 (volume : Measure E), 𝓕 u = (v : 𝓢'(E,F)) ∧ + ∀ n : ℕ, Integrable (fun x => ‖x‖^n*‖v x‖) := by + let k : ℕ := Module.finrank ℝ E+1 + have hk : (Module.finrank ℝ E : ℝ) < 2*k := by dsimp [k]; push_cast; linarith + obtain ⟨v,hv⟩ := (hu k).fourier_memL1 hk + refine ⟨v,hv,fun n => ?_⟩ + obtain ⟨w,hw⟩ := memSobolev_iff_exists_smulLeftCLM_fourier.mp (hu (2*(n+k))) + have hdec (m : ℕ) (hm : k ≤ m) : MemLp (fun x : E => (1+‖x‖^2)^(-(m : ℝ))) 2 := by + have hh : (Module.finrank ℝ E : ℝ) < 2*(2*m) := by + have : (k : ℝ) ≤ m := by exact_mod_cast hm + linarith + convert decay_memLp hh using 1 + ext x + congr 1 + ring + have hg : MemLp (fun x : E => Complex.ofReal ((1+‖x‖^2)^(-(↑(n+k) : ℝ)))) 2 := + (hdec (n+k) (Nat.le_add_left _ _)).ofReal + let q : Lp F 1 (volume : Measure E) := hg.toLp _ • w + have hq : (q : 𝓢'(E,F)) = 𝓕 u := by + rw [Lp.toTemperedDistribution_smul_eq (by fun_prop),← hw, + smulLeftCLM_smulLeftCLM_apply (by fun_prop) (by fun_prop)] + convert (smulLeftCLM_const (1 : ℂ) (𝓕 u)) using 1 + · congr 2 + ext x + change Complex.ofReal ((1+‖x‖^2)^((↑(2*(n+k)) : ℝ)/2)) * + Complex.ofReal ((1+‖x‖^2)^(-(↑(n+k) : ℝ))) = 1 + rw [← Complex.ofReal_mul,← Complex.ofReal_one,Complex.ofReal_inj] + rw [← Real.rpow_add (by positivity : 0 < (1+‖x‖^2 : ℝ))] + convert Real.rpow_zero (1+‖x‖^2) using 1 + congr 1 + push_cast + ring + · simp + have heq : q=v := by + apply LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := F)) + change (q : 𝓢'(E,F)) = (v : 𝓢'(E,F)) + rw [hq,hv] + have hqa : ∀ᵐ x, v x = Complex.ofReal ((1+‖x‖^2)^(-(↑(n+k) : ℝ))) • w x := by + rw [← heq] + filter_upwards [Lp.coeFn_lpSMul (r := 1) (hg.toLp _) w, hg.coeFn_toLp] with x hx hy + change q x = _ at hx + rw [hx] + change (hg.toLp _ : E → ℂ) x • w x = _ + rw [hy] + have hi : Integrable (fun x : E => (1+‖x‖^2)^(-(k : ℝ))*‖w x‖) := + (hdec k le_rfl).integrable_mul (Lp.memLp w).norm + apply hi.mono' ((continuous_norm.pow n).aestronglyMeasurable.mul (Lp.aestronglyMeasurable v).norm) + filter_upwards [hqa] with x hx + change ‖‖x‖^n*‖v x‖‖ ≤ _ + rw [hx,norm_smul,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (by positivity)] + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity),← mul_assoc] + simpa only [Nat.cast_add] using + mul_le_mul_of_nonneg_right (weighted_decay_bound x n k) (norm_nonneg (w x)) + +end + +section + +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +lemma l1_inverse_fourier_distribution (v : Lp F 1 (volume : Measure E)) : + (((Real.Lp.fourierTransformInv v).memLp_top.toLp _ : Lp F ∞ (volume : Measure E)) : 𝓢'(E,F)) = + 𝓕⁻ (v : 𝓢'(E,F)) := by + ext φ + rw [TemperedDistribution.fourierInv_apply,Lp.toTemperedDistribution_apply, + Lp.toTemperedDistribution_apply] + calc + _ = ∫ x : E, φ x • 𝓕⁻ (v : E → F) x := by + apply integral_congr_ae + filter_upwards [(Real.Lp.fourierTransformInv v).memLp_top.coeFn_toLp] with x hx + rw [hx,Real.Lp.fourierTransformInv_apply] + _ = ∫ x : E, (𝓕⁻ φ) x • v x := by + have hf : (-innerₗ E).flip = -innerₗ E := by + ext x y + exact congrArg Neg.neg (real_inner_comm x y) + have h := VectorFourier.integral_fourierIntegral_smul_eq_flip + (L := -innerₗ E) (μ := (volume : Measure E)) (ν := volume) Real.continuous_fourierChar + (show Continuous (fun p : E × E => -inner ℝ p.1 p.2) by fun_prop) φ.integrable (L1.integrable_coeFn v) + rw [hf] at h + simp only [SchwartzMap.fourierInv_coe] + convert h.symm using 1 + _ = _ := rfl + rfl + +/-- A tempered distribution lying in all integral Sobolev spaces has an actual +bounded smooth representative. All moments of a single L1 Fourier representative +are proved first, so the smooth representatives do not depend on the order. -/ +theorem all_orders_smooth_representative {u : 𝓢'(E,F)} + (hu : ∀ n : ℕ, MemSobolev n 2 u) : + ∃ g : BoundedContinuousFunction E F, ContDiff ℝ (⊤ : ℕ∞) (g : E → F) ∧ + u = ((g.memLp_top.toLp _ : Lp F ∞ (volume : Measure E)) : 𝓢'(E,F)) := by + obtain ⟨v,hv,hm⟩ := all_orders_fourier_moments hu + refine ⟨Real.Lp.fourierTransformInv v,?_,?_⟩ + · have hs := Real.contDiff_fourier (N := (⊤ : ℕ∞)) (fun n _ => hm n) + convert hs.comp contDiff_neg using 1 + ext x + exact (Real.Lp.fourierTransformInv_apply v x).trans (Real.fourierInv_eq_fourier_neg _ _) + · rw [l1_inverse_fourier_distribution,← hv,fourierInv_fourier_eq] + +end + +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +/-- Local Bessel-potential regularity, using actual compact smooth multipliers. -/ +def LocalSobolev (Ω : Set E) (s : ℝ) (u : 𝓢'(E,F)) : Prop := + ∀ g : E → ℂ, ContDiff ℝ (⊤ : ℕ∞) g → HasCompactSupport g → tsupport g ⊆ Ω → + MemSobolev s 2 (smulLeftCLM F g u) + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma derivative_support_subset (g : E → ℂ) (m : E) : + tsupport (fun x => fderiv ℝ g x m) ⊆ tsupport g := + (tsupport_comp_subset (g := fun T : E →L[ℝ] ℂ => T m) (by simp) (fderiv ℝ g)).trans + (tsupport_fderiv_subset ℝ) + +lemma LocalSobolev.mono {Ω : Set E} {s t : ℝ} {u : 𝓢'(E,F)} + (h : LocalSobolev Ω s u) (hst : t ≤ s) : LocalSobolev Ω t u := + fun g hg hc hs => (h g hg hc hs).mono hst + +lemma LocalSobolev.product_derivative {Ω : Set E} {s : ℝ} {u : 𝓢'(E,F)} + (h : LocalSobolev Ω s u) {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) (m : E) : + MemSobolev (s-1) 2 (smulLeftCLM F g (∂_{m} u)) := by + have hdg := (compact_derivative hc m).hasTemperateGrowth (smooth_derivative hg m) + have h1 := (h g hg hc hs).lineDerivOp (m := m) + have h2 := h _ (smooth_derivative hg m) (compact_derivative hc m) + ((derivative_support_subset g m).trans hs) + have h3 := h1.sub (h2.mono (by linarith : s-1 ≤ s)) + rw [distribution_leibniz (hc.hasTemperateGrowth hg) m hdg,add_sub_cancel_left] at h3 + exact h3 + +omit [MeasurableSpace E] [BorelSpace E] [CompleteSpace F] in +lemma laplacian_product {ι : Type*} [Fintype ι] (b : OrthonormalBasis ι ℝ E) + {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) (u : 𝓢'(E,F)) : + Δ (smulLeftCLM F g u) = smulLeftCLM F g (Δ u)+ + ∑ d, (smulLeftCLM F (fun x => fderiv ℝ (fun y => fderiv ℝ g y (b d)) x (b d)) u+ + (2 : ℂ) • smulLeftCLM F (fun x => fderiv ℝ g x (b d)) (∂_{b d} u)) := by + classical + rw [laplacian_eq_sum b,laplacian_eq_sum b,map_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro d _ + have hgd := smooth_derivative hg (b d) + have hcd := compact_derivative hc (b d) + rw [distribution_leibniz (hc.hasTemperateGrowth hg) _ (hcd.hasTemperateGrowth hgd),LineDeriv.lineDerivOp_add, + distribution_leibniz (hcd.hasTemperateGrowth hgd) _ + ((compact_derivative hcd (b d)).hasTemperateGrowth (smooth_derivative hgd (b d))), + distribution_leibniz (hc.hasTemperateGrowth hg) _ (hcd.hasTemperateGrowth hgd)] + module + +/-- Local distributional equation with scalar Laplacian principal part. The +coefficients need only be globally smooth: cutoff multiplication, not a hidden +boundedness or temperedness condition, defines every coefficient product. -/ +def LocalEllipticEquation {ι κ : Type*} [Fintype ι] [Fintype κ] + (Ω : Set E) (b : OrthonormalBasis ι ℝ E) + (a : κ → κ → ι → E → ℂ) (c : κ → κ → E → ℂ) (f u : κ → 𝓢'(E,F)) : Prop := + ∀ i g, ContDiff ℝ (⊤ : ℕ∞) g → HasCompactSupport g → tsupport g ⊆ Ω → + smulLeftCLM F g (Δ (u i)) = + (∑ j, ∑ d, smulLeftCLM F (g*a i j d) (∂_{b d} (u j)))+ + (∑ j, smulLeftCLM F (g*c i j) (u j))+smulLeftCLM F g (f i) + +/-- One full local Sobolev order of elliptic gain, including the initial +L2-to-H1 step. This uses no regularity of the unknown beyond the stated order. -/ +theorem local_elliptic_gain {ι κ : Type*} [Fintype ι] [Fintype κ] + {Ω : Set E} (b : OrthonormalBasis ι ℝ E) + (a : κ → κ → ι → E → ℂ) (c : κ → κ → E → ℂ) + (ha : ∀ i j d, ContDiff ℝ (⊤ : ℕ∞) (a i j d)) + (hc : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (c i j)) + {f u : κ → 𝓢'(E,F)} (heq : LocalEllipticEquation Ω b a c f u) + {s : ℝ} (hu : ∀ i, LocalSobolev Ω s (u i)) + (hf : ∀ i, LocalSobolev Ω (s-1) (f i)) : + ∀ i, LocalSobolev Ω (s+1) (u i) := by + classical + intro i g hg hgc hgs + have hsource : MemSobolev (s-1) 2 (smulLeftCLM F g (Δ (u i))) := by + rw [heq i g hg hgc hgs] + refine ((sobolev_sum Finset.univ (fun j _ => sobolev_sum Finset.univ (fun d _ => + (hu j).product_derivative (hg.mul (ha i j d)) hgc.mul_right + (tsupport_mul_subset_left.trans hgs) (b d)))).add ?_).add (hf i g hg hgc hgs) + exact sobolev_sum Finset.univ (fun j _ => + (hu j _ (hg.mul (hc i j)) hgc.mul_right (tsupport_mul_subset_left.trans hgs)).mono (by linarith)) + have hΔ : MemSobolev (s-1) 2 (Δ (smulLeftCLM F g (u i))) := by + rw [laplacian_product b hg hgc] + apply hsource.add + apply sobolev_sum Finset.univ + intro d _ + have hgd := smooth_derivative hg (b d) + have hcd := compact_derivative hgc (b d) + have hsd := (derivative_support_subset g (b d)).trans hgs + exact ((hu i _ (smooth_derivative hgd (b d)) (compact_derivative hcd (b d)) + ((derivative_support_subset _ (b d)).trans hsd)).mono (by linarith)).add + (((hu i).product_derivative hgd hcd hsd (b d)).smul 2) + have h := laplacian_gain ((hu i g hg hgc hgs).mono (by linarith : s-1 ≤ s)) hΔ + convert h using 1 + ring + +end ElasticityRegularity + +open scoped SchwartzMap LineDeriv BigOperators +open scoped SchwartzMap LineDeriv Laplacian BigOperators +namespace ElasticityDistribution +open ElasticityAugmented TemperedDistribution +abbrev Test := 𝓢(X,ℂ) + +/-- Equality of actual distributions tested strictly within the open domain. -/ +def LocalEq (Ω : Set X) (u v : Dist) : Prop := + ∀ φ : Test, HasCompactSupport (φ : X → ℂ) → tsupport (φ : X → ℂ) ⊆ Ω → u φ=v φ +namespace LocalEq +variable {Ω : Set X} {u v w u' v' : Dist} +lemma refl (u : Dist) : LocalEq Ω u u := fun _ _ _ => rfl +lemma symm (h : LocalEq Ω u v) : LocalEq Ω v u := fun φ hc hs => (h φ hc hs).symm +lemma trans (h : LocalEq Ω u v) (h' : LocalEq Ω v w) : LocalEq Ω u w := + fun φ hc hs => (h φ hc hs).trans (h' φ hc hs) +lemma add (h : LocalEq Ω u v) (h' : LocalEq Ω u' v') : LocalEq Ω (u+u') (v+v') := by + intro φ hc hs + simp only [add_apply,h φ hc hs,h' φ hc hs] +lemma sub (h : LocalEq Ω u v) (h' : LocalEq Ω u' v') : LocalEq Ω (u-u') (v-v') := by + intro φ hc hs + simp only [sub_apply,h φ hc hs,h' φ hc hs] +lemma smul (h : LocalEq Ω u v) (c : ℂ) : LocalEq Ω (c • u) (c • v) := by + intro φ hc hs + simp only [smul_apply,h φ hc hs] +lemma sum {ι : Type*} (s : Finset ι) {a b : ι → Dist} (h : ∀ i ∈ s, LocalEq Ω (a i) (b i)) : + LocalEq Ω (∑ i ∈ s, a i) (∑ i ∈ s, b i) := by + intro φ hc hs + simp only [sum_apply] + exact Finset.sum_congr rfl (fun i hi => h i hi φ hc hs) +lemma coeff (h : LocalEq Ω u v) (a : Coeff) : LocalEq Ω (a • u) (a • v) := by + intro φ hc hs + change u (SchwartzMap.smulLeftCLM ℂ (eval a) φ) = v (SchwartzMap.smulLeftCLM ℂ (eval a) φ) + apply h + · simpa only [SchwartzMap.smulLeftCLM_apply (growth a),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (hc.mul_left : HasCompactSupport (eval a * (φ : X → ℂ))) + · simpa only [SchwartzMap.smulLeftCLM_apply (growth a),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (tsupport_mul_subset_right (f := eval a) (g := (φ : X → ℂ))).trans hs +lemma derivative (h : LocalEq Ω u v) (i : Fin 3) : LocalEq Ω (dd i u) (dd i v) := by + intro φ hc hs + change u (- ∂_{e i} φ) = v (- ∂_{e i} φ) + apply h + · change HasCompactSupport (fun x => -((∂_{e i} φ : Test) x)) + exact (hc.fderiv_apply (𝕜 := ℝ) (e i)).neg + · change tsupport (-((∂_{e i} φ : Test) : X → ℂ)) ⊆ Ω + rw [tsupport_neg] + exact (ElasticityRegularity.derivative_support_subset (φ : X → ℂ) (e i)).trans hs +lemma cutoff (h : LocalEq Ω u v) {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (hs : tsupport g ⊆ Ω) : + smulLeftCLM ℂ g u = smulLeftCLM ℂ g v := by + ext φ + change u (SchwartzMap.smulLeftCLM ℂ g φ) = v (SchwartzMap.smulLeftCLM ℂ g φ) + apply h + · simpa only [SchwartzMap.smulLeftCLM_apply (hc.hasTemperateGrowth hg),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (hc.mul_right : HasCompactSupport (g * (φ : X → ℂ))) + · simpa only [SchwartzMap.smulLeftCLM_apply (hc.hasTemperateGrowth hg),Pi.smul_def,smul_eq_mul,Pi.mul_def] using + (tsupport_mul_subset_left (f := g) (g := (φ : X → ℂ))).trans hs +end LocalEq + +lemma LocalEq.shifted {Ω : Set X} {u v : Dist} (h : LocalEq Ω u v) (z : Fin 3 → ℂ) (i : Fin 3) : + LocalEq Ω (sd z i u) (sd z i v) := + (h.derivative i).add (h.smul (z i)) +lemma LocalEq.divergence {Ω : Set X} {u v : Fin 3 → Dist} (h : ∀ i, LocalEq Ω (u i) (v i)) + (z : Fin 3 → ℂ) : LocalEq Ω (divd z u) (divd z v) := + LocalEq.sum Finset.univ (fun i _ => (h i).shifted z i) + +def normSource (z : Fin 3 → ℂ) (m n o : Coeff) (F : Fin 3 → Dist) : Fin 4 → Dist := + Fin.cons (o • (divd z F-(2 : ℂ) • (n • ∑ i, dc i m • F i))) (fun i => n • F i) + +/-- The local physical stress-divergence equation implies the true normalized +augmented equation. The fourth component is the actual shifted divergence. -/ +theorem local_normalized_system {Ω : Set X} (z : Fin 3 → ℂ) (lam m n o : Coeff) + (u F : Fin 3 → Dist) (h : ∀ i, LocalEq Ω (phys z lam m u i) (F i)) : + ∀ i, LocalEq Ω (normPair z lam m n o u (divd z u) i) (normSource z m n o F i) := by + have hr (i : Fin 3) : LocalEq Ω (rd z lam m u (divd z u) i) (F i) := by + rw [← physical_expansion] + exact h i + have hs : LocalEq Ω (scd z lam m u (divd z u)) (divd z F) := by + rw [← physical_divergence] + exact LocalEq.divergence h z + intro i + refine Fin.cases ?_ (fun i => ?_) i + · exact (hs.sub (((LocalEq.sum Finset.univ (fun j _ => (hr j).coeff (dc j m))).coeff n).smul 2)).coeff o + · exact (hr i).coeff n + +lemma lapd_expand (z : Fin 3 → ℂ) (u : Dist) : + lapd z u = Δ u + (∑ i, (2*z i) • dd i u)+(∑ i, z i*z i) • u := by + have he (i : Fin 3) : sd z i (sd z i u)=dd i (dd i u)+(2*z i) • dd i u+(z i*z i) • u := by + simp only [sd_apply,map_add,map_smul,smul_add,smul_smul] + module + rw [lapd] + simp only [he,Finset.sum_add_distrib,← Finset.sum_smul] + congr 2 + simpa only [dd_apply,e,EuclideanSpace.basisFun_apply] using + (laplacian_eq_sum (EuclideanSpace.basisFun (Fin 3) ℝ) u).symm + +end ElasticityDistribution + +open MeasureTheory FourierTransform TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian Real ENNReal BigOperators +namespace ElasticityRegularity +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + +lemma MemSobolev.local_zero {u : 𝓢'(E,F)} (hu : MemSobolev 0 2 u) (Ω : Set E) : + LocalSobolev Ω 0 u := by + intro g hg hc _ + exact sobolev_zero_product (hc.hasTemperateGrowth hg) (compact_bounded_multiplier hg hc) hu + +theorem local_elliptic_all_orders {ι κ : Type*} [Fintype ι] [Fintype κ] + {Ω : Set E} (b : OrthonormalBasis ι ℝ E) + (a : κ → κ → ι → E → ℂ) (c : κ → κ → E → ℂ) + (ha : ∀ i j d, ContDiff ℝ (⊤ : ℕ∞) (a i j d)) + (hc : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (c i j)) + {f u : κ → 𝓢'(E,F)} (heq : LocalEllipticEquation Ω b a c f u) + (hu : ∀ i, LocalSobolev Ω 0 (u i)) + (hf : ∀ n : ℕ, ∀ i, LocalSobolev Ω n (f i)) : + ∀ n : ℕ, ∀ i, LocalSobolev Ω n (u i) := by + intro n + induction n with + | zero => rw [Nat.cast_zero]; exact hu + | succ n ih => + rw [Nat.cast_add,Nat.cast_one] + exact local_elliptic_gain b a c ha hc heq ih (fun i => + (hf n i).mono (by linarith : (n : ℝ)-1 ≤ n)) + +/-- The actual cutoff of an L2 weak solution is represented by one bounded +smooth function, simultaneously at all Sobolev orders. This is the distributional +interior-regularity conclusion used for physical correction and planar limits. -/ +theorem local_elliptic_cutoff_smooth {ι κ : Type*} [Fintype ι] [Fintype κ] + {Ω : Set E} (b : OrthonormalBasis ι ℝ E) + (a : κ → κ → ι → E → ℂ) (c : κ → κ → E → ℂ) + (ha : ∀ i j d, ContDiff ℝ (⊤ : ℕ∞) (a i j d)) + (hc : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (c i j)) + {f u : κ → 𝓢'(E,F)} (heq : LocalEllipticEquation Ω b a c f u) + (hu : ∀ i, LocalSobolev Ω 0 (u i)) + (hf : ∀ n : ℕ, ∀ i, LocalSobolev Ω n (f i)) + (i : κ) {g : E → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hgc : HasCompactSupport g) (hgs : tsupport g ⊆ Ω) : + ∃ v : BoundedContinuousFunction E F, ContDiff ℝ (⊤ : ℕ∞) (v : E → F) ∧ + smulLeftCLM F g (u i) = ((v.memLp_top.toLp _ : Lp F ∞ (volume : Measure E)) : 𝓢'(E,F)) := by + exact all_orders_smooth_representative (fun n => + local_elliptic_all_orders b a c ha hc heq hu hf n i g hg hgc hgs) + +end ElasticityRegularity + +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv Laplacian BigOperators ENNReal +namespace ElasticityDistribution +open ElasticityAugmented ElasticityRegularity +namespace LocalSobolev +variable {Ω : Set X} {s t : ℝ} {u v : Dist} +lemma add (h : ElasticityRegularity.LocalSobolev Ω s u) + (h' : ElasticityRegularity.LocalSobolev Ω s v) : + ElasticityRegularity.LocalSobolev Ω s (u+v) := by + intro g hg hc hs + rw [map_add] + exact (h g hg hc hs).add (h' g hg hc hs) +lemma sub (h : ElasticityRegularity.LocalSobolev Ω s u) + (h' : ElasticityRegularity.LocalSobolev Ω s v) : + ElasticityRegularity.LocalSobolev Ω s (u-v) := by + intro g hg hc hs + rw [map_sub] + exact (h g hg hc hs).sub (h' g hg hc hs) +lemma smul (h : ElasticityRegularity.LocalSobolev Ω s u) (c : ℂ) : + ElasticityRegularity.LocalSobolev Ω s (c • u) := by + intro g hg hc hs + rw [map_smul] + exact (h g hg hc hs).smul c +lemma sum {ι : Type*} (S : Finset ι) {u : ι → Dist} + (h : ∀ i ∈ S, ElasticityRegularity.LocalSobolev Ω s (u i)) : + ElasticityRegularity.LocalSobolev Ω s (∑ i ∈ S, u i) := by + intro g hg hc hs + rw [map_sum] + exact sobolev_sum S (fun i hi => h i hi g hg hc hs) +lemma coeff (h : ElasticityRegularity.LocalSobolev Ω s u) (a : Coeff) : + ElasticityRegularity.LocalSobolev Ω s (a • u) := by + intro g hg hc hs + have := h (g*eval a) (hg.mul (eval_smooth a)) hc.mul_right (tsupport_mul_subset_left.trans hs) + change MemSobolev s 2 (smulLeftCLM ℂ g (smulLeftCLM ℂ (eval a) u)) + rw [smulLeftCLM_smulLeftCLM_apply (growth a) (hc.hasTemperateGrowth hg),mul_comm] + exact this +lemma derivative (h : ElasticityRegularity.LocalSobolev Ω s u) (i : Fin 3) : + ElasticityRegularity.LocalSobolev Ω (s-1) (dd i u) := by + intro g hg hc hs + exact h.product_derivative hg hc hs (e i) +lemma shifted (h : ElasticityRegularity.LocalSobolev Ω s u) (z : Fin 3 → ℂ) (i : Fin 3) : + ElasticityRegularity.LocalSobolev Ω (s-1) (sd z i u) := + add (derivative h i) (smul (h.mono (by linarith)) (z i)) +lemma divergence {u : Fin 3 → Dist} (h : ∀ i, ElasticityRegularity.LocalSobolev Ω s (u i)) + (z : Fin 3 → ℂ) : ElasticityRegularity.LocalSobolev Ω (s-1) (divd z u) := + sum Finset.univ (fun i _ => shifted (h i) z i) +end LocalSobolev + +lemma LocalEq.localSobolev {Ω : Set X} {s : ℝ} {u v : Dist} (h : LocalEq Ω u v) + (hv : ElasticityRegularity.LocalSobolev Ω s v) : ElasticityRegularity.LocalSobolev Ω s u := by + intro g hg hc hs + rw [h.cutoff hg hc hs] + exact hv g hg hc hs + +/-- Local gain from an actual distributional Laplacian; includes negative order +starting points. The cutoff commutator is proved, not silently discarded. -/ +theorem local_laplacian_gain {Ω : Set X} {s : ℝ} {u : Dist} + (hu : ElasticityRegularity.LocalSobolev Ω s u) + (hΔ : ElasticityRegularity.LocalSobolev Ω (s-1) (Δ u)) : + ElasticityRegularity.LocalSobolev Ω (s+1) u := by + let b := EuclideanSpace.basisFun (Fin 3) ℝ + intro g hg hgc hgs + have hb : MemSobolev (s-1) 2 (Δ (smulLeftCLM ℂ g u)) := by + rw [laplacian_product b hg hgc] + apply (hΔ g hg hgc hgs).add + apply sobolev_sum Finset.univ + intro d _ + have hgd := smooth_derivative hg (b d) + have hcd := compact_derivative hgc (b d) + have hsd := (derivative_support_subset g (b d)).trans hgs + exact ((hu _ (smooth_derivative hgd (b d)) (compact_derivative hcd (b d)) + ((derivative_support_subset _ (b d)).trans hsd)).mono (by linarith)).add + ((hu.product_derivative hgd hcd hsd (b d)).smul 2) + have h := laplacian_gain ((hu g hg hgc hgs).mono (by linarith : s-1 ≤ s)) hb + convert h using 1 + ring + +lemma normSource_local {Ω : Set X} {s : ℝ} (z : Fin 3 → ℂ) (m n o : Coeff) + (F : Fin 3 → Dist) (hF : ∀ i, ElasticityRegularity.LocalSobolev Ω s (F i)) : + ∀ i, ElasticityRegularity.LocalSobolev Ω (s-1) (normSource z m n o F i) := by + intro i + refine Fin.cases ?_ (fun i => ?_) i + · exact LocalSobolev.coeff (LocalSobolev.sub (LocalSobolev.divergence hF z) + (LocalSobolev.smul (LocalSobolev.coeff (LocalSobolev.sum Finset.univ (fun i _ => + LocalSobolev.coeff ((hF i).mono (by linarith)) (dc i m))) n) 2)) o + · exact LocalSobolev.coeff ((hF i).mono (by linarith)) n + +/-- Interior elliptic gain for the genuine normalized physical distribution +system, with no solution-regularity premise hidden in the equation. -/ +theorem normalized_local_gain {Ω : Set X} {s : ℝ} (z : Fin 3 → ℂ) (lam m n o : Coeff) + (hn : n*m=1) (ho : o*(lam+m+m)=1) (U F : Fin 4 → Dist) + (heq : ∀ i, LocalEq Ω (normPair z lam m n o (fun j => U j.succ) (U 0) i) (F i)) + (hU : ∀ i, ElasticityRegularity.LocalSobolev Ω s (U i)) + (hF : ∀ i, ElasticityRegularity.LocalSobolev Ω (s-1) (F i)) : + ∀ i, ElasticityRegularity.LocalSobolev Ω (s+1) (U i) := by + intro i + let l₁ : Dist := ∑ k, ∑ j, coeffA (A := Coeff) dc lam m n o k i j • sd z k (U j) + let l₀ : Dist := ∑ j, coeffV (A := Coeff) dc lam m n o i j • U j + have h₁ : ElasticityRegularity.LocalSobolev Ω (s-1) l₁ := by + apply LocalSobolev.sum + intro k _ + apply LocalSobolev.sum + intro j _ + exact LocalSobolev.coeff (LocalSobolev.shifted (hU j) z k) _ + have h₀ : ElasticityRegularity.LocalSobolev Ω (s-1) l₀ := by + apply LocalSobolev.sum + intro j _ + exact LocalSobolev.coeff ((hU j).mono (by linarith)) _ + have he : LocalEq Ω (lapd z (U i)) (F i-l₁-l₀) := by + intro φ hc hs + have hh := heq i φ hc hs + rw [normalized_matrix z lam m n o hn ho] at hh + change ((lapd z (U i)+l₁+l₀) : Dist) φ=(F i) φ at hh + simp only [add_apply,sub_apply] at hh ⊢ + linear_combination hh + have hlap := he.localSobolev (LocalSobolev.sub (LocalSobolev.sub (hF i) h₁) h₀) + have hd : ElasticityRegularity.LocalSobolev Ω (s-1) (∑ k, (2*z k) • dd k (U i)) := + LocalSobolev.sum Finset.univ (fun k _ => LocalSobolev.smul + (LocalSobolev.derivative (hU i) k) (2*z k)) + have hz : ElasticityRegularity.LocalSobolev Ω (s-1) ((∑ k, z k*z k) • U i) := + LocalSobolev.smul ((hU i).mono (by linarith)) _ + apply local_laplacian_gain (hU i) + have hΔ := LocalSobolev.sub (LocalSobolev.sub hlap hz) hd + simpa only [lapd_expand,add_sub_cancel_right] using hΔ + +/-- All local Sobolev orders for an L2 physical solution with smooth source. +The physical fourth unknown is the actual shifted divergence, initially H^-1, +not an independent L2 unknown postulated as a hypothesis. -/ +theorem physical_local_all_orders {Ω : Set X} (z : Fin 3 → ℂ) (lam m n o : Coeff) + (hn : n*m=1) (ho : o*(lam+m+m)=1) (u F : Fin 3 → Dist) + (heq : ∀ i, LocalEq Ω (phys z lam m u i) (F i)) + (hu : ∀ i, ElasticityRegularity.LocalSobolev Ω 0 (u i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N (F i)) : + ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N ((Fin.cons (divd z u) u : Fin 4 → Dist) i) := by + let U : Fin 4 → Dist := Fin.cons (divd z u) u + let FF := normSource z m n o F + have hsys : ∀ i, LocalEq Ω (normPair z lam m n o (fun j => U j.succ) (U 0) i) (FF i) := + local_normalized_system z lam m n o u F heq + have hm : ∀ i, ElasticityRegularity.LocalSobolev Ω (-1) (U i) := by + intro i + refine Fin.cases ?_ (fun i => ?_) i + · change ElasticityRegularity.LocalSobolev Ω (-1) (divd z u) + simpa only [zero_sub] using LocalSobolev.divergence hu z + · exact (hu i).mono (by norm_num) + have hzero : ∀ i, ElasticityRegularity.LocalSobolev Ω 0 (U i) := by + have hh := normalized_local_gain (s := -1) z lam m n o hn ho U FF hsys hm + (fun i => (normSource_local z m n o F (hf 0) i).mono (by norm_num)) + simpa only [neg_add_cancel] using hh + intro N + induction N with + | zero => rw [Nat.cast_zero]; exact hzero + | succ N hN => + rw [Nat.cast_add,Nat.cast_one] + exact normalized_local_gain z lam m n o hn ho U FF hsys hN + (normSource_local z m n o F (hf N)) + +/-- Every compact cutoff of the actual augmented physical unknown has a single +bounded smooth representative. This is a conclusion, not an assumed classical +regularity theorem. -/ +theorem physical_cutoff_smooth {Ω : Set X} (z : Fin 3 → ℂ) (lam m n o : Coeff) + (hn : n*m=1) (ho : o*(lam+m+m)=1) (u F : Fin 3 → Dist) + (heq : ∀ i, LocalEq Ω (phys z lam m u i) (F i)) + (hu : ∀ i, ElasticityRegularity.LocalSobolev Ω 0 (u i)) + (hf : ∀ N : ℕ, ∀ i, ElasticityRegularity.LocalSobolev Ω N (F i)) + (i : Fin 4) {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hgc : HasCompactSupport g) (hgs : tsupport g ⊆ Ω) : + ∃ v : BoundedContinuousFunction X ℂ, ContDiff ℝ (⊤ : ℕ∞) (v : X → ℂ) ∧ + smulLeftCLM ℂ g ((Fin.cons (divd z u) u : Fin 4 → Dist) i) = + ((v.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure X)) : Dist) := by + exact all_orders_smooth_representative (fun N => + physical_local_all_orders z lam m n o hn ho u F heq hu hf N i g hg hgc hgs) +end ElasticityDistribution + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Restriction.lean b/lean/OAI/MathematicalPhysics/Elasticity/Restriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..c52a0993f6da77d6b1593b3ff983663d4cc332ef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Restriction.lean @@ -0,0 +1,566 @@ +import OAI.MathematicalPhysics.Elasticity.Variational + +namespace OAI + +section +noncomputable section +open MeasureTheory Set +open scoped ENNReal +namespace Elasticity +variable {α E : Type*} [MeasurableSpace α] [NormedAddCommGroup E] [NormedSpace ℝ E] +variable (μ : Measure α) (s : Set α) +def lpRestrictCLM : Lp E 2 μ →L[ℝ] Lp E 2 (μ.restrict s) := + Lp.LpToLpOfMeasureLeSMul (c := 1) (by simp) (by simpa using Measure.restrict_le_self (μ := μ) (s := s)) +lemma lpRestrict_coe (f : Lp E 2 μ) : (lpRestrictCLM μ s f : α → E)=ᵐ[μ.restrict s] f := + Lp.coeFn_LpToLpOfMeasureLeSMul _ _ f +variable (hs : MeasurableSet s) +def lpZeroValue (f : Lp E 2 (μ.restrict s)) : Lp E 2 μ := + ((memLp_indicator_iff_restrict hs).mpr (Lp.memLp f)).toLp (s.indicator f) +omit [NormedSpace ℝ E] in +lemma lpZeroValue_coe (f : Lp E 2 (μ.restrict s)) : + (lpZeroValue μ s hs f : α → E)=ᵐ[μ] s.indicator f := by + unfold lpZeroValue + exact @MemLp.coeFn_toLp α E _ 2 μ _ (s.indicator (⇑f)) + ((memLp_indicator_iff_restrict (p := 2) (μ := μ) hs).mpr (Lp.memLp f)) +omit [NormedSpace ℝ E] in +lemma lpZeroValue_add (f g : Lp E 2 (μ.restrict s)) : + lpZeroValue μ s hs (f+g)=lpZeroValue μ s hs f+lpZeroValue μ s hs g := by + apply Lp.ext + filter_upwards [lpZeroValue_coe μ s hs (f+g),lpZeroValue_coe μ s hs f, + lpZeroValue_coe μ s hs g,Lp.coeFn_add (lpZeroValue μ s hs f) (lpZeroValue μ s hs g), + (ae_restrict_iff' hs).mp (Lp.coeFn_add f g)] with x h1 h2 h3 h4 h5 + rw [h1,h4] + change s.indicator (⇑(f+g)) x=lpZeroValue μ s hs f x+lpZeroValue μ s hs g x + rw [h2,h3] + by_cases hx : x∈s + · simp only [indicator_of_mem hx,h5 hx,Pi.add_apply] + · simp only [indicator_of_notMem hx,add_zero] +lemma lpZeroValue_smul (c : ℝ) (f : Lp E 2 (μ.restrict s)) : + lpZeroValue μ s hs (c • f)=c • lpZeroValue μ s hs f := by + apply Lp.ext + filter_upwards [lpZeroValue_coe μ s hs (c • f),lpZeroValue_coe μ s hs f, + Lp.coeFn_smul c (lpZeroValue μ s hs f), + (ae_restrict_iff' hs).mp (Lp.coeFn_smul c f)] with x h1 h2 h3 h4 + rw [h1,h3] + change s.indicator (⇑(c • f)) x=c • lpZeroValue μ s hs f x + rw [h2] + by_cases hx : x∈s + · simp only [indicator_of_mem hx,h4 hx,Pi.smul_apply] + · simp only [indicator_of_notMem hx,smul_zero] +def lpZeroExtend : Lp E 2 (μ.restrict s) →ₗ[ℝ] Lp E 2 μ where + toFun := lpZeroValue μ s hs + map_add' := lpZeroValue_add μ s hs + map_smul' := lpZeroValue_smul μ s hs +lemma lpZeroExtend_norm (f : Lp E 2 (μ.restrict s)) : ‖lpZeroExtend μ s hs f‖=‖f‖ := by + change ‖((memLp_indicator_iff_restrict hs).mpr (Lp.memLp f)).toLp (s.indicator f)‖=‖f‖ + rw [Lp.norm_toLp,Lp.norm_def,eLpNorm_indicator_eq_eLpNorm_restrict hs] +def lpZeroExtendCLM : Lp E 2 (μ.restrict s) →L[ℝ] Lp E 2 μ := + (lpZeroExtend μ s hs).mkContinuous 1 (fun f => by rw [lpZeroExtend_norm,one_mul]) +lemma lpZeroExtend_coe (f : Lp E 2 (μ.restrict s)) : + (lpZeroExtendCLM μ s hs f : α → E)=ᵐ[μ] s.indicator f := lpZeroValue_coe μ s hs f +lemma lpRestrict_zeroExtend (f : Lp E 2 (μ.restrict s)) : + lpRestrictCLM μ s (lpZeroExtendCLM μ s hs f)=f := by + apply Lp.ext + filter_upwards [lpRestrict_coe μ s (lpZeroExtendCLM μ s hs f), + ae_restrict_of_ae (lpZeroExtend_coe μ s hs f),ae_restrict_mem hs] with x h1 h2 hx + rw [h1,h2,indicator_of_mem hx] +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +namespace Elasticity +variable {Ω B : Set X} +def lpRestrictBetween (h : Ω⊆B) : Lp V 2 (volume.restrict B) →L[ℝ] Lp V 2 (volume.restrict Ω) := + Lp.LpToLpOfMeasureLeSMul (c := 1) (by simp) + (by simpa using Measure.restrict_mono h (le_refl (volume : Measure X))) +lemma lpRestrictBetween_coe (h : Ω⊆B) (f : Lp V 2 (volume.restrict B)) : + (lpRestrictBetween h f : X → V)=ᵐ[volume.restrict Ω] f := + Lp.coeFn_LpToLpOfMeasureLeSMul _ _ f +lemma lpRestrictBetween_toLp (h : Ω⊆B) (f : X → V) + (hf : MemLp f 2 (volume.restrict B)) (hg : MemLp f 2 (volume.restrict Ω)) : + lpRestrictBetween h (hf.toLp f)=hg.toLp f := by + apply Lp.ext + exact (lpRestrictBetween_coe h (hf.toLp f)).trans + ((Measure.absolutelyContinuous_of_le (Measure.restrict_mono h (le_refl (volume : Measure X)))).ae_eq hf.coeFn_toLp |>.trans hg.coeFn_toLp.symm) +def ambientRestrict (h : Ω⊆B) : Ambient B →L[ℝ] Ambient Ω := + (lpRestrictBetween h).prodMap (ContinuousLinearMap.pi + (fun i : Fin 3 => (lpRestrictBetween h).comp (ContinuousLinearMap.proj i))) +lemma restrict_smoothJet (h : Ω⊆B) {u : Ambient B} (hu : u∈SmoothJets B) : + ambientRestrict h u∈SmoothJets Ω := by + obtain ⟨f,hf,hd,hsm,hval,hder⟩ := hu + have hm : volume.restrict Ω≤volume.restrict B := Measure.restrict_mono h (le_refl (volume : Measure X)) + refine ⟨f,hf.mono_measure hm,(fun i => (hd i).mono_measure hm),hsm,?_,?_⟩ + · change lpRestrictBetween h u.1=_ + rw [hval,lpRestrictBetween_toLp] + · funext i + change lpRestrictBetween h (u.2 i)=_ + rw [hder,lpRestrictBetween_toLp] +lemma restrict_h1 (h : Ω⊆B) {u : Ambient B} (hu : u∈closure (SmoothJets B)) : + ambientRestrict h u∈closure (SmoothJets Ω) := by + exact (show MapsTo (ambientRestrict h) (SmoothJets B) (SmoothJets Ω) from + fun _ hu => restrict_smoothJet h hu).closure (ambientRestrict h).continuous hu +def h1Restrict (h : Ω⊆B) (u : H1 B) : H1 Ω := ⟨ambientRestrict h u.val,restrict_h1 h u.property⟩ +def lpExtendBetween (hΩ : MeasurableSet Ω) : + Lp V 2 (volume.restrict Ω) →L[ℝ] Lp V 2 (volume.restrict B) := + (lpRestrictCLM volume B).comp (lpZeroExtendCLM volume Ω hΩ) +lemma lpExtendBetween_coe (hΩ : MeasurableSet Ω) (f : Lp V 2 (volume.restrict Ω)) : + (lpExtendBetween (B := B) hΩ f : X → V)=ᵐ[volume.restrict B] Ω.indicator f := + (lpRestrict_coe volume B _).trans (ae_restrict_of_ae (lpZeroExtend_coe volume Ω hΩ f)) +lemma lpExtendBetween_toLp (hΩ : MeasurableSet Ω) (f : X → V) (hf : MemLp f 2 (volume.restrict Ω)) + (hg : MemLp f 2 (volume.restrict B)) (hs : tsupport f⊆Ω) : + lpExtendBetween hΩ (hf.toLp f)=hg.toLp f := by + apply Lp.ext + have hval : ∀ᵐ x ∂(volume : Measure X), x∈Ω → hf.toLp f x=f x := (ae_restrict_iff' hΩ).mp hf.coeFn_toLp + filter_upwards [lpExtendBetween_coe (B := B) hΩ (hf.toLp f), + ae_restrict_of_ae hval,hg.coeFn_toLp] with x h1 h2 h3 + rw [h1,h3] + by_cases hx : x∈Ω + · rw [indicator_of_mem hx,h2 hx] + · rw [indicator_of_notMem hx,image_eq_zero_of_notMem_tsupport (fun h => hx (hs h))] +def ambientExtend (hΩ : MeasurableSet Ω) : Ambient Ω →L[ℝ] Ambient B := + (lpExtendBetween hΩ).prodMap (ContinuousLinearMap.pi + (fun i : Fin 3 => (lpExtendBetween hΩ).comp (ContinuousLinearMap.proj i))) +lemma extend_testJet (hΩ : MeasurableSet Ω) (h : Ω⊆B) {u : Ambient Ω} (hu : u∈TestJets Ω) : + ambientExtend (B := B) hΩ u∈TestJets B := by + obtain ⟨f,hf,hd,hsm,hc,hs,hval,hder⟩ := hu + have hdf (i : Fin 3) : ContDiff ℝ (⊤ : ℕ∞) (coordDeriv f i) := + (hsm.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const + have hcd (i : Fin 3) : HasCompactSupport (coordDeriv f i) := hc.fderiv_apply ℝ _ + have hsd (i : Fin 3) : tsupport (coordDeriv f i)⊆Ω := + (tsupport_fderiv_apply_subset ℝ (coordVector i)).trans hs + have hfg : MemLp f 2 (volume.restrict B) := (hsm.continuous.memLp_of_hasCompactSupport hc).restrict B + have hdg (i : Fin 3) : MemLp (coordDeriv f i) 2 (volume.restrict B) := + ((hdf i).continuous.memLp_of_hasCompactSupport (hcd i)).restrict B + refine ⟨f,hfg,hdg,hsm,hc,hs.trans h,?_,?_⟩ + · change lpExtendBetween hΩ u.1=_ + rw [hval,lpExtendBetween_toLp hΩ f hf hfg hs] + · funext i + change lpExtendBetween hΩ (u.2 i)=_ + rw [hder,lpExtendBetween_toLp hΩ _ (hd i) (hdg i) (hsd i)] +lemma extend_h10 (hΩ : MeasurableSet Ω) (h : Ω⊆B) {u : Ambient Ω} (hu : u∈closure (TestJets Ω)) : + ambientExtend (B := B) hΩ u∈closure (TestJets B) := by + exact (show MapsTo (ambientExtend (B := B) hΩ) (TestJets Ω) (TestJets B) from + fun _ hu => extend_testJet hΩ h hu).closure (ambientExtend hΩ).continuous hu +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω B : Set X} +def gradient (u : Ambient Ω) (x : X) : Fin 3 → V := fun i => u.2 i x +def elasticDensity (lam mu : ℝ) (P Q : Fin 3 → V) : ℝ := + lam*(∑ i, P i i)*(∑ i, Q i i)+2*mu*∑ i, ∑ j, + ((P j i+P i j)/2)*((Q j i+Q i j)/2) +def ambientDensity (lam mu : X → ℝ) (u v : Ambient Ω) (x : X) : ℝ := + elasticDensity (lam x) (mu x) (gradient u x) (gradient v x) +def ambientEnergy (lam mu : X → ℝ) (u v : Ambient Ω) : ℝ := + ∫ x, ambientDensity lam mu u v x ∂(volume.restrict Ω) +lemma energy_eq_ambient (lam mu : X → ℝ) (u v : H1 Ω) : + energy Ω lam mu u v=ambientEnergy lam mu u.val v.val := rfl +lemma elasticDensity_symm (a b : ℝ) (P Q : Fin 3 → V) : + elasticDensity a b P Q=elasticDensity a b Q P := by + unfold elasticDensity + have hs : (∑ i, ∑ j, ((P j i+P i j)/2)*((Q j i+Q i j)/2))= + ∑ i, ∑ j, ((Q j i+Q i j)/2)*((P j i+P i j)/2) := by + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + exact mul_comm _ _ + rw [hs] + ring +@[simp] lemma elasticDensity_zero_right (a b : ℝ) (P : Fin 3 → V) : + elasticDensity a b P 0=0 := by simp [elasticDensity] +lemma gradient_restrict (h : Ω⊆B) (u : Ambient B) : + (fun x => gradient (ambientRestrict h u) x)=ᵐ[volume.restrict Ω] gradient u := by + have he := Filter.eventually_all.mpr (fun i : Fin 3 => lpRestrictBetween_coe h (u.2 i)) + filter_upwards [he] with x hx + exact funext hx +lemma gradient_extend (hΩ : MeasurableSet Ω) (u : Ambient Ω) : + (fun x => gradient (ambientExtend (B := B) hΩ u) x)=ᵐ[volume.restrict B] Ω.indicator (gradient u) := by + have he := Filter.eventually_all.mpr (fun i : Fin 3 => lpExtendBetween_coe (B := B) hΩ (u.2 i)) + filter_upwards [he] with x hx + by_cases hm : x∈Ω + · rw [indicator_of_mem hm] + funext i + exact (hx i).trans (indicator_of_mem hm _) + · rw [indicator_of_notMem hm] + funext i + exact (hx i).trans (indicator_of_notMem hm _) +lemma entry_memLp (u : Ambient Ω) (i j : Fin 3) : + MemLp (fun x => u.2 j x i) 2 (volume.restrict Ω) := + (EuclideanSpace.proj i : V →L[ℝ] ℝ).comp_memLp (u.2 j) +lemma BoundedCoefficient.mul_memLp_fun {a f : X → ℝ} (ha : BoundedCoefficient Ω a) + (hf : MemLp f 2 (volume.restrict Ω)) : MemLp (fun x => a x*f x) 2 (volume.restrict Ω) := by + obtain ⟨C,hC⟩ := ha.bound + apply hf.of_le_mul (c := C) (ha.measurable.mul hf.aestronglyMeasurable) + filter_upwards [hC] with x hx + simpa only [Pi.mul_apply,norm_mul] using mul_le_mul_of_nonneg_right hx (norm_nonneg (f x)) +lemma ambientDensity_integrable {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v : Ambient Ω) : + Integrable (ambientDensity lam mu u v) (volume.restrict Ω) := by + have hd (w : Ambient Ω) : MemLp (fun x => ∑ i, w.2 i x i) 2 (volume.restrict Ω) := + memLp_finsetSum _ (fun i _ => entry_memLp w i i) + have hs (w : Ambient Ω) (i j : Fin 3) : + MemLp (fun x => (w.2 j x i+w.2 i x j)/2) 2 (volume.restrict Ω) := + by simpa only [div_eq_mul_inv,Pi.add_apply] using + ((entry_memLp w i j).add (entry_memLp w j i)).mul_const (2 : ℝ)⁻¹ + have hL := (hl.mul_memLp_fun (hd u)).integrable_mul (hd v) + have hS (i j) := (hm.mul_memLp_fun (hs u i j)).integrable_mul (hs v i j) + have hsum := integrable_finsetSum Finset.univ (fun i _ => + integrable_finsetSum Finset.univ (fun j _ => hS i j)) + apply (hL.add (hsum.const_mul 2)).congr + exact Filter.Eventually.of_forall (fun x => by + simp only [ambientDensity,elasticDensity,gradient,Pi.mul_apply,Pi.add_apply,Finset.mul_sum,mul_assoc]) +lemma ambientEnergy_symm (lam mu : X → ℝ) (u v : Ambient Ω) : + ambientEnergy lam mu u v=ambientEnergy lam mu v u := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun x => elasticDensity_symm _ _ _ _) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω B : Set X} +lemma ambientEnergy_extend_right (hΩ : MeasurableSet Ω) (h : Ω⊆B) + (lam mu : X → ℝ) (u : Ambient B) (v : Ambient Ω) : + ambientEnergy lam mu u (ambientExtend hΩ v)= + ambientEnergy lam mu (ambientRestrict h u) v := by + let f := fun x => elasticDensity (lam x) (mu x) (gradient u x) (gradient v x) + calc + _ = ∫ x, Ω.indicator f x ∂(volume.restrict B) := by + apply integral_congr_ae + filter_upwards [gradient_extend (B := B) hΩ v] with x hx + change elasticDensity _ _ _ _=_ + rw [hx] + by_cases hm : x∈Ω + · simp only [indicator_of_mem hm] + rfl + · simp only [indicator_of_notMem hm,elasticDensity_zero_right] + _ = ∫ x, f x ∂(volume.restrict Ω) := by + rw [integral_indicator hΩ,Measure.restrict_restrict hΩ,inter_eq_left.mpr h] + _ = _ := by + apply integral_congr_ae + filter_upwards [gradient_restrict h u] with x hx + exact congrArg (fun P => elasticDensity (lam x) (mu x) P (gradient v x)) hx.symm +lemma ambientEnergy_extend_left (hΩ : MeasurableSet Ω) (h : Ω⊆B) + (lam mu : X → ℝ) (u : Ambient Ω) (v : Ambient B) : + ambientEnergy lam mu (ambientExtend hΩ u) v= + ambientEnergy lam mu u (ambientRestrict h v) := by + rw [ambientEnergy_symm,ambientEnergy_extend_right hΩ h,ambientEnergy_symm] +lemma BoundedCoefficient.restrict {a : X → ℝ} (ha : BoundedCoefficient B a) (h : Ω⊆B) : + BoundedCoefficient Ω a := by + have hm : volume.restrict Ω≤volume.restrict B := Measure.restrict_mono h (le_refl (volume : Measure X)) + refine ⟨ha.measurable.mono_measure hm,?_⟩ + obtain ⟨C,hC⟩ := ha.bound + exact ⟨C,ae_mono hm hC⟩ +lemma energy_coefficient_locality {lam₁ mu₁ lam₂ mu₂ : X → ℝ} + (hl₁ : BoundedCoefficient B lam₁) (hm₁ : BoundedCoefficient B mu₁) + (hl₂ : BoundedCoefficient B lam₂) (hm₂ : BoundedCoefficient B mu₂) + (hΩ : MeasurableSet Ω) (h : Ω⊆B) + (he : ∀ x∉Ω, lam₁ x=lam₂ x ∧ mu₁ x=mu₂ x) (u v : Ambient B) : + ambientEnergy lam₂ mu₂ u v-ambientEnergy lam₁ mu₁ u v= + ambientEnergy lam₂ mu₂ (ambientRestrict h u) (ambientRestrict h v)- + ambientEnergy lam₁ mu₁ (ambientRestrict h u) (ambientRestrict h v) := by + let f := fun x => ambientDensity lam₂ mu₂ u v x-ambientDensity lam₁ mu₁ u v x + calc + _ = ∫ x, f x ∂(volume.restrict B) := (integral_sub + (ambientDensity_integrable hl₂ hm₂ u v) (ambientDensity_integrable hl₁ hm₁ u v)).symm + _ = ∫ x, Ω.indicator f x ∂(volume.restrict B) := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun x => by + by_cases hx : x∈Ω + · rw [indicator_of_mem hx] + · rw [indicator_of_notMem hx] + dsimp [f,ambientDensity] + rw [(he x hx).1,(he x hx).2,sub_self]) + _ = ∫ x, f x ∂(volume.restrict Ω) := by + rw [integral_indicator hΩ,Measure.restrict_restrict hΩ,inter_eq_left.mpr h] + _ = ∫ x, ambientDensity lam₂ mu₂ (ambientRestrict h u) (ambientRestrict h v) x- + ambientDensity lam₁ mu₁ (ambientRestrict h u) (ambientRestrict h v) x ∂(volume.restrict Ω) := by + apply integral_congr_ae + filter_upwards [gradient_restrict h u,gradient_restrict h v] with x hu hv + simp only [f,ambientDensity,hu,hv] + _ = _ := integral_sub (ambientDensity_integrable (hl₂.restrict h) (hm₂.restrict h) _ _) + (ambientDensity_integrable (hl₁.restrict h) (hm₁.restrict h) _ _) +lemma elasticDensity_add_left (a b : ℝ) (P Q R : Fin 3 → V) : + elasticDensity a b (P+Q) R=elasticDensity a b P R+elasticDensity a b Q R := by + simp only [elasticDensity,Pi.add_apply,PiLp.add_apply] + have he (i j : Fin 3) : ((P j i+Q j i+(P i j+Q i j))/2)*((R j i+R i j)/2)= + ((P j i+P i j)/2)*((R j i+R i j)/2)+((Q j i+Q i j)/2)*((R j i+R i j)/2) := by ring + simp only [he,Finset.sum_add_distrib] + ring +lemma gradient_add (u v : Ambient Ω) : + gradient (u+v)=ᵐ[volume.restrict Ω] fun x => gradient u x+gradient v x := by + have he := Filter.eventually_all.mpr (fun i : Fin 3 => Lp.coeFn_add (u.2 i) (v.2 i)) + filter_upwards [he] with x hx + exact funext hx +lemma ambientEnergy_add_left {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v w : Ambient Ω) : + ambientEnergy lam mu (u+v) w=ambientEnergy lam mu u w+ambientEnergy lam mu v w := by + rw [ambientEnergy,ambientEnergy,ambientEnergy,← integral_add + (ambientDensity_integrable hl hm u w) (ambientDensity_integrable hl hm v w)] + apply integral_congr_ae + filter_upwards [gradient_add u v] with x hx + change elasticDensity _ _ _ _=_ + rw [hx,elasticDensity_add_left] + rfl +lemma ambientEnergy_sub_left {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v w : Ambient Ω) : + ambientEnergy lam mu (u-v) w=ambientEnergy lam mu u w-ambientEnergy lam mu v w := by + have he := ambientEnergy_add_left hl hm (u-v) v w + rw [sub_add_cancel] at he + linarith +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +namespace Elasticity +variable {Ω B : Set X} +lemma lpRestrictBetween_extend (hΩ : MeasurableSet Ω) (h : Ω⊆B) + (f : Lp V 2 (volume.restrict Ω)) : lpRestrictBetween h (lpExtendBetween hΩ f)=f := by + apply Lp.ext + have hm : volume.restrict Ω≤volume.restrict B := Measure.restrict_mono h (le_refl (volume : Measure X)) + filter_upwards [lpRestrictBetween_coe h (lpExtendBetween hΩ f), + (Measure.absolutelyContinuous_of_le hm).ae_eq (lpExtendBetween_coe (B := B) hΩ f), + ae_restrict_mem hΩ] with x hx hy hz + rw [hx,hy,indicator_of_mem hz] +lemma ambientRestrict_extend (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : Ambient Ω) : + ambientRestrict h (ambientExtend hΩ u)=u := by + apply Prod.ext + · exact lpRestrictBetween_extend hΩ h u.1 + · funext i + exact lpRestrictBetween_extend hΩ h (u.2 i) +def h1Extend (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : H1 Ω) (hu : HasZeroTrace Ω u) : H1 B := + ⟨ambientExtend hΩ u.val,h10Submodule_le B (extend_h10 hΩ h hu)⟩ +lemma weakSolution_restrict (hΩ : MeasurableSet Ω) (h : Ω⊆B) {lam mu : X → ℝ} + {u : H1 B} (hu : WeakSolution B lam mu u) : WeakSolution Ω lam mu (h1Restrict h u) := by + intro v hv + have he := hu (h1Extend hΩ h v hv) (extend_h10 hΩ h hv) + change ambientEnergy lam mu u.val (ambientExtend hΩ v.val)=0 at he + rw [ambientEnergy_extend_right hΩ h] at he + exact he +def gluedH1 (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : H1 B) (v : H1 Ω) + (ht : SameTrace Ω v (h1Restrict h u)) : H1 B := + ⟨u.val+ambientExtend hΩ (v.val-ambientRestrict h u.val), + (h1Submodule B).add_mem u.property (h10Submodule_le B (extend_h10 hΩ h ht))⟩ +lemma gluedH1_restrict (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : H1 B) (v : H1 Ω) + (ht : SameTrace Ω v (h1Restrict h u)) : h1Restrict h (gluedH1 hΩ h u v ht)=v := by + apply Subtype.ext + change ambientRestrict h (u.val+ambientExtend hΩ (v.val-ambientRestrict h u.val))=v.val + rw [map_add,ambientRestrict_extend] + abel +lemma gluedH1_exterior_gradient (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : H1 B) (v : H1 Ω) + (ht : SameTrace Ω v (h1Restrict h u)) : + ∀ᵐ x ∂(volume.restrict B), x∉Ω → gradient (gluedH1 hΩ h u v ht).val x=gradient u.val x := by + filter_upwards [gradient_add u.val (ambientExtend (B := B) hΩ (v.val-ambientRestrict h u.val)), + gradient_extend (B := B) hΩ (v.val-ambientRestrict h u.val)] with x ha he hx + change gradient (u.val+ambientExtend hΩ (v.val-ambientRestrict h u.val)) x=_ + rw [ha,he,indicator_of_notMem hx,add_zero] +lemma gluedH1_exterior_value (hΩ : MeasurableSet Ω) (h : Ω⊆B) (u : H1 B) (v : H1 Ω) + (ht : SameTrace Ω v (h1Restrict h u)) : + ∀ᵐ x ∂(volume.restrict B), x∉Ω → (gluedH1 hΩ h u v ht).val.1 x=u.val.1 x := by + filter_upwards [Lp.coeFn_add u.val.1 (lpExtendBetween (B := B) hΩ (v.val-ambientRestrict h u.val).1), + lpExtendBetween_coe (B := B) hΩ (v.val-ambientRestrict h u.val).1] with x ha he hx + change (u.val.1+lpExtendBetween hΩ (v.val-ambientRestrict h u.val).1 : Lp V 2 (volume.restrict B)) x=_ + rw [ha] + change u.val.1 x+lpExtendBetween hΩ (v.val-ambientRestrict h u.val).1 x=_ + rw [he,indicator_of_notMem hx,add_zero] + +theorem physical_weak_transfer {lam₁ mu₁ lam₂ mu₂ : X → ℝ} + (ha₁ : Admissible Ω lam₁ mu₁) (ha₂ : Admissible Ω lam₂ mu₂) + (hO : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (h : Ω⊆B) + (hl₁ : BoundedCoefficient B lam₁) (hm₁ : BoundedCoefficient B mu₁) + (hl₂ : BoundedCoefficient B lam₂) (hm₂ : BoundedCoefficient B mu₂) + (he : ∀ x∉Ω, lam₁ x=lam₂ x ∧ mu₁ x=mu₂ x) + (hDN : DN Ω lam₁ mu₁=DN Ω lam₂ mu₂) + {u : H1 B} (hu : WeakSolution B lam₁ mu₁ u) : + ∃ v : H1 B, WeakSolution B lam₂ mu₂ v ∧ + (∀ᵐ x ∂(volume.restrict B), x∉Ω → v.val.1 x=u.val.1 x) ∧ + (∀ᵐ x ∂(volume.restrict B), x∉Ω → gradient v.val x=gradient u.val x) := by + obtain ⟨v,hv,ht,hpair⟩ := interior_physical_transfer ha₁ ha₂ hO hOB hDN + (weakSolution_restrict hO.measurableSet h hu) + have ht' : SameTrace Ω v (h1Restrict h u) := (trace_eq_iff _ _).mp ht + refine ⟨gluedH1 hO.measurableSet h u v ht',?_, + gluedH1_exterior_value hO.measurableSet h u v ht', + gluedH1_exterior_gradient hO.measurableSet h u v ht'⟩ + intro w hw + have hw0 := hu w hw + have hp := hpair (h1Restrict h w) + simp only [energy_eq_ambient] at hp hw0 ⊢ + change ambientEnergy lam₂ mu₂ (u.val+ambientExtend hO.measurableSet + (v.val-ambientRestrict h u.val)) w.val=0 + rw [ambientEnergy_add_left hl₂ hm₂,ambientEnergy_extend_left hO.measurableSet h, + ambientEnergy_sub_left (hl₂.restrict h) (hm₂.restrict h)] + have hc := energy_coefficient_locality hl₁ hm₁ hl₂ hm₂ hO.measurableSet h he u.val w.val + change ambientEnergy lam₂ mu₂ v.val (ambientRestrict h w.val)= + ambientEnergy lam₁ mu₁ (ambientRestrict h u.val) (ambientRestrict h w.val) at hp + linarith +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} +def ambientScalar (Ω : Set X) (k : Option (Fin 3)) (i : Fin 3) : + Ambient Ω →L[ℝ] ScalarL2 Ω := (jetScalar Ω k i).comp (jetEquiv Ω).symm.toContinuousLinearMap +lemma ambientScalar_ae (u : Ambient Ω) (k : Option (Fin 3)) (i : Fin 3) : + ambientScalar Ω k i u =ᵐ[volume.restrict Ω] fun x => ((jetEquiv Ω).symm u k x) i := + jetScalar_ae _ _ _ +lemma scalar_pair_smooth {f : X → V} (hf : MemLp f 2 (volume.restrict Ω)) + (g : SchwartzMap X ℝ) (i : Fin 3) : + inner ℝ ((EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) (hf.toLp f)) + (schwartzR Ω g) = ∫ x, (f x) i*g x ∂(volume.restrict Ω) := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [ContinuousLinearMap.coeFn_compLpL (EuclideanSpace.proj (𝕜 := ℝ) i) (hf.toLp f), + hf.coeFn_toLp,g.coeFn_toLp 2 (volume.restrict Ω)] with x hx hy hz + change inner ℝ (((EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) (hf.toLp f)) x) (g.toLp 2 (volume.restrict Ω) x)=_ + rw [hx,hz,hy] + exact real_inner_comm _ _ +lemma smooth_ibp {f : X → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ) ⊆ Ω) (j : Fin 3) : + (∫ x, f x*ElasticityKorn.d (coordVector j) g x ∂(volume.restrict Ω)) = + -(∫ x, fderiv ℝ f x (coordVector j)*g x ∂(volume.restrict Ω)) := by + have hg : ContDiff ℝ (⊤ : ℕ∞) (g : X → ℝ) := g.smooth _ + have hd : Continuous (fun x => fderiv ℝ f x (coordVector j)) := + (hf.continuous_fderiv (by simp)).clm_apply continuous_const + have hgd : Continuous (fun x => fderiv ℝ (g : X → ℝ) x (coordVector j)) := + (hg.continuous_fderiv (by simp)).clm_apply continuous_const + rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + have hz := image_eq_zero_of_notMem_tsupport (f := (ElasticityKorn.d (coordVector j) g : X → ℝ)) + (fun ht => hx (hs ((tsupport_fderiv_apply_subset ℝ (coordVector j)) ht))) + rw [hz,mul_zero]), + setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + rw [image_eq_zero_of_notMem_tsupport (f := (g : X → ℝ)) (fun ht => hx (hs ht)),mul_zero])] + exact integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + ((hd.mul hg.continuous).integrable_of_hasCompactSupport (hc.mul_left)) + ((hf.continuous.mul hgd).integrable_of_hasCompactSupport ((hc.fderiv_apply ℝ _).mul_left)) + ((hf.continuous.mul hg.continuous).integrable_of_hasCompactSupport (hc.mul_left)) + (fun x _ => hf.differentiable (by simp) x) (fun x _ => hg.differentiable (by simp) x) + +def weakDerivativePair (Ω : Set X) (g : SchwartzMap X ℝ) (i j : Fin 3) : Ambient Ω →L[ℝ] ℝ := + ((innerSL ℝ (schwartzR Ω (ElasticityKorn.d (coordVector j) g))).comp (ambientScalar Ω none i)) + + ((innerSL ℝ (schwartzR Ω g)).comp (ambientScalar Ω (some j) i)) +lemma weakDerivativePair_smooth (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ) ⊆ Ω) (i j : Fin 3) {u : Ambient Ω} (hu : u∈SmoothJets Ω) : + weakDerivativePair Ω g i j u=0 := by + obtain ⟨f,hf,hd,hsm,hu,huj⟩ := hu + have he0 : ambientScalar Ω none i u= + (EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) (hf.toLp f) := by + change (EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) u.1=_ + rw [hu] + have he1 : ambientScalar Ω (some j) i u= + (EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) ((hd j).toLp (coordDeriv f j)) := by + change (EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) (u.2 j)=_ + rw [huj] + simp only [weakDerivativePair,add_apply,ContinuousLinearMap.comp_apply, + innerSL_apply_apply,he0,he1] + rw [← real_inner_comm (schwartzR Ω (ElasticityKorn.d (coordVector j) g)), + ← real_inner_comm (schwartzR Ω g),scalar_pair_smooth,scalar_pair_smooth] + have hh := smooth_ibp ((EuclideanSpace.proj (𝕜 := ℝ) i).contDiff.comp hsm) g hc hs j + change (∫ x, (f x) i * ElasticityKorn.d (coordVector j) g x ∂(volume.restrict Ω)) = + -(∫ x, fderiv ℝ (fun y => (f y) i) x (coordVector j) * g x ∂(volume.restrict Ω)) at hh + simp only [coordDeriv_scalar f hsm] at hh + rw [hh,neg_add_cancel] +/-- The gradient components in the closure-of-jets H1 really are weak +partial derivatives of its value. No weak-derivative property is assumed. -/ +theorem h1_weak_derivative (u : H1 Ω) (g : SchwartzMap X ℝ) + (hc : HasCompactSupport (g : X → ℝ)) (hs : tsupport (g : X → ℝ) ⊆ Ω) + (i j : Fin 3) : + inner ℝ (ambientScalar Ω none i u.val) (schwartzR Ω (ElasticityKorn.d (coordVector j) g)) = + -inner ℝ (ambientScalar Ω (some j) i u.val) (schwartzR Ω g) := by + have hm : MapsTo (weakDerivativePair Ω g i j) (SmoothJets Ω) ({0} : Set ℝ) := + fun _ hu => weakDerivativePair_smooth g hc hs i j hu + have hh := hm.closure (weakDerivativePair Ω g i j).continuous u.property + rw [closure_singleton] at hh + change weakDerivativePair Ω g i j u.val=0 at hh + simp only [weakDerivativePair,add_apply,ContinuousLinearMap.comp_apply, + innerSL_apply_apply] at hh + rw [← real_inner_comm (schwartzR Ω (ElasticityKorn.d (coordVector j) g)), + ← real_inner_comm (schwartzR Ω g)] at hh + linarith +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} +def testField (g : SchwartzMap X ℝ) (i : Fin 3) : X → V := fun x => g x • coordVector i +lemma testField_smooth (g : SchwartzMap X ℝ) (i : Fin 3) : ContDiff ℝ (⊤ : ℕ∞) (testField g i) := + (g.smooth _).smul contDiff_const +lemma testField_deriv (g : SchwartzMap X ℝ) (i j : Fin 3) : + coordDeriv (testField g i) j=fun x => ElasticityKorn.d (coordVector j) g x • coordVector i := by + funext x + have h := ((ContinuousLinearMap.toSpanSingleton ℝ (coordVector i)).hasFDerivAt (x := g x)).comp x + (g.differentiableAt (x := x)).hasFDerivAt + change fderiv ℝ ((ContinuousLinearMap.toSpanSingleton ℝ (coordVector i)) ∘ (g : X → ℝ)) x (coordVector j)=_ + rw [h.fderiv] + rfl +lemma testField_compact (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) (i : Fin 3) : + HasCompactSupport (testField g i) := hc.comp_left (g := fun a : ℝ => a • coordVector i) (zero_smul ..) +lemma testField_support (g : SchwartzMap X ℝ) (i : Fin 3) : + tsupport (testField g i) ⊆ tsupport (g : X → ℝ) := + tsupport_comp_subset (g := fun a : ℝ => a • coordVector i) (zero_smul ..) _ +lemma testField_memLp (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) (i : Fin 3) : + MemLp (testField g i) 2 (volume.restrict Ω) := + ((testField_smooth g i).continuous.memLp_of_hasCompactSupport (testField_compact g hc i)).restrict Ω +lemma testField_deriv_memLp (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) (i j : Fin 3) : + MemLp (coordDeriv (testField g i) j) 2 (volume.restrict Ω) := + (((testField_smooth g i).continuous_fderiv (by simp)).clm_apply continuous_const + |>.memLp_of_hasCompactSupport ((testField_compact g hc i).fderiv_apply ℝ (coordVector j))).restrict Ω + def testFieldJet (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) (i : Fin 3) : Ambient Ω := + ((testField_memLp g hc i).toLp _,fun j => (testField_deriv_memLp g hc i j).toLp _) +lemma testFieldJet_mem (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : testFieldJet (Ω := Ω) g hc i∈TestJets Ω := by + refine ⟨testField g i,testField_memLp g hc i,testField_deriv_memLp g hc i,testField_smooth g i,testField_compact g hc i, + (testField_support g i).trans hs,rfl,rfl⟩ +def testH1 (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : H1 Ω := + ⟨testFieldJet g hc i,h10Submodule_le Ω (subset_closure (testFieldJet_mem g hc hs i))⟩ +lemma testH1_zeroTrace (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : HasZeroTrace Ω (testH1 g hc hs i) := + subset_closure (testFieldJet_mem g hc hs i) +lemma testH1_gradient (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : + ∀ᵐ x ∂(volume.restrict Ω), gradient (testH1 g hc hs i).val x= + fun j => ElasticityKorn.d (coordVector j) g x • coordVector i := by + have he : ∀ᵐ x ∂(volume.restrict Ω), ∀ j, (testFieldJet (Ω := Ω) g hc i).2 j x=coordDeriv (testField g i) j x := + Filter.eventually_all.mpr (fun j => (testField_deriv_memLp g hc i j).coeFn_toLp) + filter_upwards [he] with x hx + funext j + change (testFieldJet (Ω := Ω) g hc i).2 j x=_ + rw [hx,testField_deriv] +lemma density_single (a b : ℝ) (P : Fin 3 → V) (v : Fin 3 → ℝ) (i : Fin 3) : + elasticDensity a b P (fun j => v j • coordVector i)= + a*(∑ k, P k k)*v i+b*∑ j, (P j i+P i j)*v j := by + fin_cases i <;> simp [elasticDensity,Fin.sum_univ_succ,coordVector] <;> ring +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Rigidity.lean b/lean/OAI/MathematicalPhysics/Elasticity/Rigidity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5de604b062acfa0aeed9be8bba486fcd6cad1a7c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Rigidity.lean @@ -0,0 +1,817 @@ +import OAI.MathematicalPhysics.Elasticity.Holomorphy + +namespace OAI + +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +variable {n : Type*} [Fintype n] [DecidableEq n] + +def diagonalGauge (d : n → ℂ) (A : Matrix n n Smooth) : Matrix n n Smooth := + fun i j => ((d i)⁻¹*d j) • A i j +omit [DecidableEq n] in +lemma diagonalGauge_mul (d : n → ℂ) (hd : ∀ i,d i≠0) (A B : Matrix n n Smooth) : + diagonalGauge d (A*B)=diagonalGauge d A*diagonalGauge d B := by + funext i j + simp only [diagonalGauge,Matrix.mul_apply,Finset.smul_sum,smul_mul_smul_comm] + apply Finset.sum_congr rfl + intro k _ + congr 1 + field_simp [hd k] +omit [Fintype n] [DecidableEq n] in +lemma diagonalGauge_sub (d : n → ℂ) (A B : Matrix n n Smooth) : + diagonalGauge d (A-B)=diagonalGauge d A-diagonalGauge d B := by + funext i j + exact smul_sub _ _ _ +omit [Fintype n] in +lemma diagonalGauge_one (d : n → ℂ) (hd : ∀ i,d i≠0) : + diagonalGauge d (1 : Matrix n n Smooth)=1 := by + funext i j + simp only [diagonalGauge,Matrix.one_apply] + split_ifs with h + · subst j; simp [hd i] + · simp only [smul_zero] +omit [Fintype n] [DecidableEq n] in +lemma matrixD_diagonalGauge (θ : Fin 3 → ℂ) (d : n → ℂ) (G : Matrix n n Smooth) : + matrixD θ (diagonalGauge d G)=diagonalGauge d (matrixD θ G) := by + funext i j + exact (thetaDerivation θ).map_smul _ _ +omit [Fintype n] [DecidableEq n] in +lemma matrixD_direction_smul (θ : Fin 3 → ℂ) (c : ℂ) (G : Matrix n n Smooth) : + matrixD (c • θ) G=c • matrixD θ G := by + funext i j + change thetaDerivation (c • θ) (G i j)=c • thetaDerivation θ (G i j) + simp only [thetaDerivation_apply,direction,Pi.smul_apply,smul_eq_mul,Finset.smul_sum,mul_smul] +omit [Fintype n] [DecidableEq n] in +lemma diagonalGauge_smul (d : n → ℂ) (c : ℂ) (G : Matrix n n Smooth) : + diagonalGauge d (c • G)=c • diagonalGauge d G := by + funext i j + change ((d i)⁻¹*d j) • (c • G i j)=c • (((d i)⁻¹*d j) • G i j) + exact smul_comm _ _ _ +omit [DecidableEq n] in +lemma diagonalGauge_equation (θ : Fin 3 → ℂ) (c : ℂ) (d : n → ℂ) (hd : ∀ i,d i≠0) + (M₀ M₁ G : Matrix n n Smooth) (he : matrixD θ G=M₁*G-G*M₀) : + matrixD (c • θ) (diagonalGauge d G)= + (c • diagonalGauge d M₁)*diagonalGauge d G-diagonalGauge d G*(c • diagonalGauge d M₀) := by + rw [matrixD_direction_smul,matrixD_diagonalGauge,he,diagonalGauge_sub, + diagonalGauge_mul d hd,diagonalGauge_mul d hd,smul_sub,smul_mul_assoc,mul_smul_comm] +omit [Fintype n] in +lemma diagonalGauge_supported {K : Set X} (hK : IsClosed K) (d : n → ℂ) (hd : ∀ i,d i≠0) + (G : Matrix n n Smooth) + (hs : ∀ i j,tsupport ((G i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆K) : + ∀ i j,tsupport ((diagonalGauge d G i j-(1 : Matrix n n Smooth) i j : Smooth) : X → ℂ)⊆K := by + intro i j + apply closure_minimal _ hK + intro x hx + by_contra hnx + apply hx + have hz := image_eq_zero_of_notMem_tsupport (fun hh => hnx (hs i j hh)) + change (G i j : X → ℂ) x-((1 : Matrix n n Smooth) i j : X → ℂ) x=0 at hz + have he := sub_eq_zero.mp hz + have ho := congrArg (fun A : Matrix n n Smooth => (A i j : X → ℂ) x) (diagonalGauge_one d hd) + change ((d i)⁻¹*d j)*(G i j : X → ℂ) x-((1 : Matrix n n Smooth) i j : X → ℂ) x=0 + rw [he] + exact sub_eq_zero.mpr ho +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityAugmented +lemma direction_theta_smul (θ : Fin 3 → ℂ) (c : ℂ) (f : Smooth) : + direction (A := Smooth) coord (c • θ) f=c • direction (A := Smooth) coord θ f := by + simp only [direction,Pi.smul_apply,smul_eq_mul,Finset.smul_sum,mul_smul] +lemma thetaGamma_smul (θ : Fin 3 → ℂ) (c : ℂ) (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) : + thetaGamma (c • θ) r hr=c • thetaGamma θ r hr := by + simp only [thetaGamma,Pi.smul_apply,smul_eq_mul,Finset.smul_sum,mul_smul] +lemma transportT_smul (θ : Fin 3 → ℂ) (c : ℂ) (k r : Smooth) + (hk : ∀ x,(k : X → ℂ) x≠0) (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + transportT (c • θ) k r hk hl=c • transportT θ k r hk hl := by + simp only [transportT,direction_theta_smul,mul_smul_comm,smul_sub] +lemma transportQ_smul (θ : Fin 3 → ℂ) (c : ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + transportQ (c • θ) k r hr hk hl=c • transportQ θ k r hr hk hl := by + funext i + apply Subtype.ext + funext x + simp only [transportQ,direction_theta_smul,thetaGamma_smul,Pi.smul_apply, + Subalgebra.coe_smul,Subalgebra.coe_sub,Subalgebra.coe_mul,Pi.sub_apply,Pi.mul_apply,smul_eq_mul] + ring +end ElasticityAugmented +namespace ElasticityConic +open ElasticityAugmented + +def chartDiagonal (z : ℂ) (i : Fin 3) : ℂ := if i=2 then 1 else z +lemma chartDiagonal_ne_zero {z : ℂ} (hz : z≠0) (i : Fin 3) : chartDiagonal z i≠0 := by + simp only [chartDiagonal] + split_ifs <;> first | exact one_ne_zero | exact hz +lemma chartTheta_transition {z : ℂ} (hz : z≠0) : chartTheta false z=z^2 • chartTheta true z⁻¹ := by + ext i + fin_cases i <;> simp [chartTheta,theta,chartZ₀,chartZ₁,smul_eq_mul] <;> field_simp + +lemma chartMatrix_transition {z : ℂ} (hz : z≠0) (T : Smooth) (Q : Fin 3 → Smooth) : + chartMatrix false z (z^2 • T) (z^2 • Q)= + z^2 • diagonalGauge (chartDiagonal z) (chartMatrix true z⁻¹ T Q) := by + ext i j x + fin_cases i <;> fin_cases j <;> + simp [chartMatrix,diagonalGauge,chartDiagonal,chartZ₀,chartZ₁,h₁,h₂, + Fin.sum_univ_three,smul_eq_mul] <;> field_simp + +lemma physical_chart_transition {z : ℂ} (hz : z≠0) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + chartMatrix false z (transportT (chartTheta false z) k r hk hl) (transportQ (chartTheta false z) k r hr hk hl)= + z^2 • diagonalGauge (chartDiagonal z) + (chartMatrix true z⁻¹ (transportT (chartTheta true z⁻¹) k r hk hl) (transportQ (chartTheta true z⁻¹) k r hr hk hl)) := by + rw [chartTheta_transition hz,transportT_smul,transportQ_smul] + exact chartMatrix_transition hz _ _ + +/-- The projective conic transition law is forced by supported uniqueness; +comparisons constructed using unrelated weak subsequences glue exactly. -/ +theorem supported_chart_glue (k r : Fin 2 → Smooth) + (hr : ∀ q x,(r q : X → ℂ) x≠0) (hk : ∀ q x,(k q : X → ℂ) x≠0) + (hl : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0) + {K : Set X} (hK : IsCompact K) (G : Bool → ℂ → Matrix (Fin 3) (Fin 3) Smooth) + (hs : ∀ b z i j,tsupport ((G b z i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ)⊆K) + (he : ∀ b z,matrixD (chartTheta b z) (G b z)= + chartMatrix b z (transportT (chartTheta b z) (k 1) (r 1) (hk 1) (hl 1)) + (transportQ (chartTheta b z) (k 1) (r 1) (hr 1) (hk 1) (hl 1))*G b z- + G b z*chartMatrix b z (transportT (chartTheta b z) (k 0) (r 0) (hk 0) (hl 0)) + (transportQ (chartTheta b z) (k 0) (r 0) (hr 0) (hk 0) (hl 0))) + (z : ℂ) (hz : z≠0) : G false z=diagonalGauge (chartDiagonal z) (G true z⁻¹) := by + let M := fun b z q => chartMatrix b z (transportT (chartTheta b z) (k q) (r q) (hk q) (hl q)) + (transportQ (chartTheta b z) (k q) (r q) (hr q) (hk q) (hl q)) + have ht (q : Fin 2) : M false z q=z^2 • diagonalGauge (chartDiagonal z) (M true z⁻¹ q) := + physical_chart_transition hz (k q) (r q) (hr q) (hk q) (hl q) + have hE := diagonalGauge_equation (chartTheta true z⁻¹) (z^2) (chartDiagonal z) + (chartDiagonal_ne_zero hz) (M true z⁻¹ 0) (M true z⁻¹ 1) (G true z⁻¹) (he true z⁻¹) + rw [← chartTheta_transition hz,← ht 0,← ht 1] at hE + have hS := diagonalGauge_supported hK.isClosed (chartDiagonal z) (chartDiagonal_ne_zero hz) (G true z⁻¹) (hs true z⁻¹) + apply supported_matrix_unique (chartTheta false z) (chartTheta_null false z) (chartTheta_ne_zero false z) + (M false z 0) (M false z 1) (G false z) (diagonalGauge (chartDiagonal z) (G true z⁻¹)) (he false z) hE + intro i j + have hc0 : HasCompactSupport ((G false z i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ) := + hK.of_isClosed_subset (isClosed_tsupport _) (hs false z i j) + have hc1 : HasCompactSupport ((diagonalGauge (chartDiagonal z) (G true z⁻¹) i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ) := + hK.of_isClosed_subset (isClosed_tsupport _) (hS i j) + have hc := hc0.sub hc1 + have heq : (G false z i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j)- + (diagonalGauge (chartDiagonal z) (G true z⁻¹) i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j)= + G false z i j-diagonalGauge (chartDiagonal z) (G true z⁻¹) i j := by abel + simpa only [← Subalgebra.coe_sub,heq] using hc +end ElasticityConic + +end +end +section +/-! Two-chart proof of precisely the holomorphic-conic rigidity step. The +analytic construction of the comparison from DN equality is NOT assumed in +the main target and is still missing. -/ +noncomputable section +open Set Filter +open scoped BigOperators Topology Matrix +namespace ElasticityRigidity + +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev Mat := Matrix (Fin 3) (Fin 3) ℂ + +def θ (z : ℂ) : Fin 3 → ℂ := ![1 - z ^ 2, Complex.I * (1 + z ^ 2), 2 * z] + +def e (i : Fin 3) : X := EuclideanSpace.single i 1 + +def D (z : ℂ) (f : X → ℂ) (x : X) : ℂ := + ∑ i, θ z i * fderiv ℝ f x (e i) + +/-- Two-chart Liouville argument for degree-zero entries. -/ +lemma sphere_function_constant {f g : ℂ → ℂ} (hf : Differentiable ℂ f) + (hg : ContinuousAt g 0) (hglue : ∀ z : ℂ, z ≠ 0 → f z = g z⁻¹) : + ∀ z, f z = f 0 := by + have hi : Tendsto (fun z : ℂ => z⁻¹) (cocompact ℂ) (𝓝 0) := by + simpa only [Metric.cobounded_eq_cocompact] using (tendsto_inv₀_cobounded (α := ℂ)) + have hlim : Tendsto f (cocompact ℂ) (𝓝 (g 0)) := by + apply (hg.tendsto.comp hi).congr' + filter_upwards [show ∀ᶠ z : ℂ in cocompact ℂ, z ≠ 0 by + simpa only [Metric.cobounded_eq_cocompact] using Bornology.eventually_ne_cobounded (0 : ℂ)] with z hz + exact (hglue z hz).symm + intro z + exact (hf.apply_eq_of_tendsto_cocompact z hlim).trans + (hf.apply_eq_of_tendsto_cocompact 0 hlim).symm + +/-- The negative-degree transition forces every holomorphic section to vanish. -/ +lemma negative_section_zero {f g : ℂ → ℂ} (hf : Differentiable ℂ f) + (hg : ContinuousAt g 0) (hglue : ∀ z : ℂ, z ≠ 0 → f z = z⁻¹ * g z⁻¹) : + ∀ z, f z = 0 := by + have hi : Tendsto (fun z : ℂ => z⁻¹) (cocompact ℂ) (𝓝 0) := by + simpa only [Metric.cobounded_eq_cocompact] using (tendsto_inv₀_cobounded (α := ℂ)) + have hlim : Tendsto f (cocompact ℂ) (𝓝 0) := by + have hh := hi.mul (hg.tendsto.comp hi) + simp only [zero_mul] at hh + apply hh.congr' + filter_upwards [show ∀ᶠ z : ℂ in cocompact ℂ, z ≠ 0 by + simpa only [Metric.cobounded_eq_cocompact] using Bornology.eventually_ne_cobounded (0 : ℂ)] with z hz + exact (hglue z hz).symm + exact fun z => hf.apply_eq_of_tendsto_cocompact z hlim + +/-- The exact chart transition for End(O(-1)² ⊕ O). The two spatial +coefficients are expressed in h₁(1,z),h₂(1,z) and h₁(w,1),h₂(w,1). -/ +def HolomorphicComparison (G₀ Ginf : X → ℂ → Mat) : Prop := + (∀ x i j, Differentiable ℂ (fun z => G₀ x z i j)) ∧ + (∀ x i j, Differentiable ℂ (fun w => Ginf x w i j)) ∧ + (∀ x z, z ≠ 0 → ∀ i j, + G₀ x z i j = + (if i = 2 then (1 : ℂ) else z⁻¹) * Ginf x z⁻¹ i j * + (if j = 2 then (1 : ℂ) else z)) + +lemma diagonal_degree_zero {G₀ Ginf : X → ℂ → Mat} + (hG : HolomorphicComparison G₀ Ginf) (x : X) (i j : Fin 3) + (hij : (i = 2 ↔ j = 2)) : ∀ z, G₀ x z i j = G₀ x 0 i j := by + apply sphere_function_constant (hG.1 x i j) (hG.2.1 x i j).continuous.continuousAt + intro z hz + have he := hG.2.2 x z hz i j + by_cases hi : i = 2 + · have hj := hij.mp hi + simpa [hi, hj] using he + · have hj : j ≠ 2 := fun hj => hi (hij.mpr hj) + simpa [hi, hj, mul_comm, mul_left_comm, mul_assoc, hz] using he + +lemma upperright_zero {G₀ Ginf : X → ℂ → Mat} + (hG : HolomorphicComparison G₀ Ginf) (x : X) (i : Fin 3) (hi : i ≠ 2) : + ∀ z, G₀ x z i 2 = 0 := by + apply negative_section_zero (hG.1 x i 2) (hG.2.1 x i 2).continuous.continuousAt + intro z hz + simpa [hi] using hG.2.2 x z hz i 2 + +/-- Normal-form connection matrix on the finite chart; q is the bottom-left +row in this frame and T the original scalar coefficient. -/ +def M (q : X → ℂ → Fin 2 → ℂ) (T : X → ℂ → ℂ) (x : X) (z : ℂ) : Mat := + !![0, 0, 1; 0, 0, z; q x z 0, q x z 1, T x z] + +def Transport (G : X → ℂ → Mat) + (q₁ q₂ : X → ℂ → Fin 2 → ℂ) (T₁ T₂ : X → ℂ → ℂ) : Prop := + ∀ x z i j, D z (fun y => G y z i j) x = + (M q₂ T₂ x z * G x z - G x z * M q₁ T₁ x z) i j + +lemma D_zero (z : ℂ) (x : X) : D z (fun _ => 0) x = 0 := by + simp [D] + +lemma top_blocks_scalar {G₀ Ginf : X → ℂ → Mat} + {q₁ q₂ : X → ℂ → Fin 2 → ℂ} {T₁ T₂ : X → ℂ → ℂ} + (hG : HolomorphicComparison G₀ Ginf) (hT : Transport G₀ q₁ q₂ T₁ T₂) : + ∀ x z i j, i ≠ 2 → j ≠ 2 → + G₀ x z i j = if i = j then G₀ x 0 2 2 else 0 := by + have hu (i : Fin 3) (hi : i ≠ 2) (z : ℂ) : (fun x => G₀ x z i 2) = fun _ => 0 := by + funext x + exact upperright_zero hG x i hi z + have hc (x : X) (z : ℂ) (i j : Fin 3) (hh : i = 2 ↔ j = 2) := + diagonal_degree_zero hG x i j hh z + have hr0 (x : X) (z : ℂ) : + G₀ x 0 2 2 - (G₀ x 0 0 0 + G₀ x 0 0 1 * z) = 0 := by + have ht := hT x z 0 2 + rw [hu 0 (by decide) z, D_zero] at ht + simp [M, Matrix.mul_apply, Matrix.vecMul, dotProduct, Fin.sum_univ_succ, + upperright_zero hG x 0 (by decide) z] at ht + rw [hc x z 2 2 Iff.rfl, hc x z 0 0 Iff.rfl, + hc x z 0 1 (by decide)] at ht + exact ht.symm + have hr1 (x : X) (z : ℂ) : + z * G₀ x 0 2 2 - (G₀ x 0 1 0 + G₀ x 0 1 1 * z) = 0 := by + have ht := hT x z 1 2 + rw [hu 1 (by decide) z, D_zero] at ht + simp [M, Matrix.mul_apply, Matrix.vecMul, dotProduct, Fin.sum_univ_succ, + upperright_zero hG x 1 (by decide) z] at ht + rw [hc x z 2 2 Iff.rfl, hc x z 1 0 (by decide), + hc x z 1 1 Iff.rfl] at ht + exact ht.symm + intro x z i j hi hj + have h00 : G₀ x 0 0 0 = G₀ x 0 2 2 := by + have hh := hr0 x 0 + simp only [mul_zero, add_zero, sub_eq_zero] at hh + exact hh.symm + have h01 : G₀ x 0 0 1 = 0 := by linear_combination -(hr0 x 1) - h00 + have h10 : G₀ x 0 1 0 = 0 := by simpa using hr1 x 0 + have h11 : G₀ x 0 1 1 = G₀ x 0 2 2 := by linear_combination -(hr1 x 1) - h10 + have hi' : i = 0 ∨ i = 1 := by omega + have hj' : j = 0 ∨ j = 1 := by omega + rcases hi' with rfl | rfl <;> rcases hj' with rfl | rfl + · simpa using (hc x z 0 0 Iff.rfl).trans h00 + · simpa using (hc x z 0 1 (by decide)).trans h01 + · simpa using (hc x z 1 0 (by decide)).trans h10 + · simpa using (hc x z 1 1 Iff.rfl).trans h11 + +lemma comparison_scalar_and_dir_zero {G₀ Ginf : X → ℂ → Mat} + {q₁ q₂ : X → ℂ → Fin 2 → ℂ} {T₁ T₂ : X → ℂ → ℂ} + (hG : HolomorphicComparison G₀ Ginf) (hT : Transport G₀ q₁ q₂ T₁ T₂) : + (∀ x z, G₀ x z = G₀ x 0 2 2 • (1 : Mat)) ∧ + ∀ x z, D z (fun y => G₀ y 0 2 2) x = 0 := by + let f : X → ℂ := fun y => G₀ y 0 2 2 + have heq00 (z : ℂ) : (fun y => G₀ y z 0 0) = f := by + funext y + exact top_blocks_scalar hG hT y z 0 0 (by decide) (by decide) + have heq11 (z : ℂ) : (fun y => G₀ y z 1 1) = f := by + funext y + exact top_blocks_scalar hG hT y z 1 1 (by decide) (by decide) + have heq01 (z : ℂ) : (fun y => G₀ y z 0 1) = fun _ => 0 := by + funext y + exact top_blocks_scalar hG hT y z 0 1 (by decide) (by decide) + have h21 (x : X) (z : ℂ) : G₀ x z 2 1 = 0 := by + have ht := hT x z 0 1 + rw [heq01 z, D_zero] at ht + simpa [M, Matrix.mul_apply, Matrix.vecMul, dotProduct, Fin.sum_univ_succ, + upperright_zero hG] using ht.symm + have hd (x : X) (z : ℂ) : D z f x = 0 := by + have ht := hT x z 1 1 + rw [heq11 z] at ht + simpa [M, Matrix.mul_apply, Matrix.vecMul, dotProduct, Fin.sum_univ_succ, + upperright_zero hG, h21 x z] using ht + have h20 (x : X) (z : ℂ) : G₀ x z 2 0 = 0 := by + have ht := hT x z 0 0 + rw [heq00 z, hd] at ht + simpa [M, Matrix.mul_apply, Matrix.vecMul, dotProduct, Fin.sum_univ_succ, + upperright_zero hG] using ht.symm + refine ⟨?_, hd⟩ + intro x z + ext i j + by_cases hi : i = 2 + · subst i + fin_cases j + · simpa using h20 x z + · simpa using h21 x z + · simpa using diagonal_degree_zero hG x 2 2 Iff.rfl z + · by_cases hj : j = 2 + · subst j + simpa [Matrix.one_apply, hi] using upperright_zero hG x i hi z + · simpa [Matrix.one_apply, smul_eq_mul, mul_ite] using + top_blocks_scalar hG hT x z i j hi hj + +lemma fderiv_zero_of_chart_dirs (f : X → ℂ) (x : X) + (hf : ∀ z, D z f x = 0) : fderiv ℝ f x = 0 := by + have h0 := hf 0 + have h1 := hf 1 + have hm := hf (-1) + simp [D, θ, Fin.sum_univ_succ] at h0 h1 hm + have h2 : fderiv ℝ f x (e 2) = 0 := by linear_combination (h1 - hm) / 4 + have hi : Complex.I * fderiv ℝ f x (e 1) = 0 := by linear_combination (h1 + hm) / 4 + have h₁ := (mul_eq_zero.mp hi).resolve_left Complex.I_ne_zero + have h₀ : fderiv ℝ f x (e 0) = 0 := by simpa [h₁] using h0 + have hL : (fderiv ℝ f x).toLinearMap = (0 : X →ₗ[ℝ] ℂ) := by + apply (EuclideanSpace.basisFun (Fin 3) ℝ).toBasis.ext + intro i + fin_cases i <;> simpa [e] using (by assumption) + exact DFunLike.coe_injective (congrArg (fun L : X →ₗ[ℝ] ℂ => (L : X → ℂ)) hL) + +/-- Exact comparison rigidity in the two charts of the projective null conic. +The exterior identity assumption is used only at a single exterior point. -/ +theorem comparison_identity {G₀ Ginf : X → ℂ → Mat} + {q₁ q₂ : X → ℂ → Fin 2 → ℂ} {T₁ T₂ : X → ℂ → ℂ} + (hG : HolomorphicComparison G₀ Ginf) (hT : Transport G₀ q₁ q₂ T₁ T₂) + (hs : ∀ z i j, Differentiable ℝ (fun x => G₀ x z i j)) + {x₀ : X} (hext : G₀ x₀ 0 = 1) : + (∀ x z, G₀ x z = 1) ∧ (∀ x w, Ginf x w = 1) := by + obtain ⟨hscalar, hd⟩ := comparison_scalar_and_dir_zero hG hT + have hf' (x : X) : fderiv ℝ (fun y => G₀ y 0 2 2) x = 0 := + fderiv_zero_of_chart_dirs _ x (hd x) + have hf (x : X) : G₀ x 0 2 2 = 1 := by + have he := is_const_of_fderiv_eq_zero (hs 0 2 2) hf' x x₀ + simpa [hext] using he + have hzero (x : X) (z : ℂ) : G₀ x z = 1 := by simpa [hf x] using hscalar x z + refine ⟨hzero, ?_⟩ + intro x w + have hout (w : ℂ) (hw : w ≠ 0) (i j : Fin 3) : Ginf x w i j = (1 : Mat) i j := by + have he := hG.2.2 x w⁻¹ (inv_ne_zero hw) i j + rw [hzero] at he + simp only [inv_inv] at he + by_cases hij : i = j + · subst j + by_cases hi : i = 2 + · simpa [hi] using he.symm + · calc + Ginf x w i i = w * Ginf x w i i * w⁻¹ := by field_simp + _ = (1 : Mat) i i := by simpa [hi] using he.symm + · have hl : (if i = 2 then (1 : ℂ) else w) ≠ 0 := by + by_cases hi : i = 2 <;> simp [hi, hw] + have hr : (if j = 2 then (1 : ℂ) else w⁻¹) ≠ 0 := by + by_cases hj : j = 2 <;> simp [hj, hw] + have hz : (if i = 2 then (1 : ℂ) else w) * Ginf x w i j * + (if j = 2 then (1 : ℂ) else w⁻¹) = 0 := by + simpa [Matrix.one_apply, hij] using he.symm + have hz' := (mul_eq_zero.mp hz).resolve_right hr + have hz'' := (mul_eq_zero.mp hz').resolve_left hl + simpa [Matrix.one_apply, hij] using hz'' + ext i j + have hfun : (fun w : ℂ => Ginf x w i j) = fun _ => (1 : Mat) i j := by + apply Continuous.ext_on (dense_compl_singleton (0 : ℂ)) + (hG.2.1 x i j).continuous continuous_const + intro z hz + exact hout z hz i j + exact congrFun hfun w + +/-- The comparison equation now yields the equality of connection matrices, +without any residual scalar gauge or assumed transport equality. -/ +theorem connections_equal {G₀ Ginf : X → ℂ → Mat} + {q₁ q₂ : X → ℂ → Fin 2 → ℂ} {T₁ T₂ : X → ℂ → ℂ} + (hG : HolomorphicComparison G₀ Ginf) (hT : Transport G₀ q₁ q₂ T₁ T₂) + (hs : ∀ z i j, Differentiable ℝ (fun x => G₀ x z i j)) + {x₀ : X} (hext : G₀ x₀ 0 = 1) : + ∀ x z, M q₁ T₁ x z = M q₂ T₂ x z := by + have hId := (comparison_identity hG hT hs hext).1 + have hfun (z : ℂ) (i j : Fin 3) : (fun y => G₀ y z i j) = fun _ => (1 : Mat) i j := by + funext y + rw [hId] + intro x z + ext i j + have he := hT x z i j + rw [hfun, hId] at he + have hh : M q₂ T₂ x z i j = M q₁ T₁ x z i j := by + simpa [D, sub_eq_zero] using he.symm + exact hh.symm + +end ElasticityRigidity + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityAugmented + +def physicalChartMatrix (b : Bool) (z : ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : Matrix (Fin 3) (Fin 3) Smooth := + chartMatrix b z (transportT (chartTheta b z) k r hk hl) + (transportQ (chartTheta b z) k r hr hk hl) + +lemma physicalChartMatrix_regular (b : Bool) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (i j : Fin 3) : + JointHolomorphic (fun y : X × ℂ => (physicalChartMatrix b y.2 k r hr hk hl i j : X → ℂ) y.1) := by + apply chartMatrix_regular b (fun z => transportT (chartTheta b z) k r hk hl) + (fun z => transportQ (chartTheta b z) k r hr hk hl) + · exact transportT_regular b k r hk hl + · exact transportQ_regular b k r hr hk hl + +lemma physicalChartMatrix_eqOn (b : Bool) (z : ℂ) (k r : Fin 2 → Smooth) + (hr : ∀ q x,(r q : X → ℂ) x≠0) (hk : ∀ q x,(k q : X → ℂ) x≠0) + (hl : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0) + {O : Set X} (hO : IsOpen O) (hek : EqOn (k 0 : X → ℂ) (k 1) O) + (her : EqOn (r 0 : X → ℂ) (r 1) O) {x : X} (hx : x∈O) : + matrixEval x (physicalChartMatrix b z (k 0) (r 0) (hr 0) (hk 0) (hl 0))= + matrixEval x (physicalChartMatrix b z (k 1) (r 1) (hr 1) (hk 1) (hl 1)) := by + have hh := eqOn_transport hO (chartTheta b z) (k 0) (k 1) (r 0) (r 1) + (hr 0) (hr 1) (hk 0) (hk 1) (hl 0) (hl 1) hek her + ext i j + have ht := hh.1 hx + have hq : ∀ i,(transportQ (chartTheta b z) (k 0) (r 0) (hr 0) (hk 0) (hl 0) i : X → ℂ) x= + (transportQ (chartTheta b z) (k 1) (r 1) (hr 1) (hk 1) (hl 1) i : X → ℂ) x := fun i => hh.2 i hx + fin_cases i <;> fin_cases j <;> simp [physicalChartMatrix,matrixEval_apply,chartMatrix,smooth_sum_eval,ht,hq] + +lemma chart_transition_scalar (z a : ℂ) (i j : Fin 3) : + (chartDiagonal z i)⁻¹*chartDiagonal z j*a= + (if i=2 then (1 : ℂ) else z⁻¹)*a*(if j=2 then (1 : ℂ) else z) := by + simp only [chartDiagonal] + split_ifs <;> ring + +lemma chartTheta_smooth (b : Bool) (i : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (fun z : ℂ => chartTheta b z i) := by + cases b <;> fin_cases i <;> dsimp [chartTheta,chartZ₀,chartZ₁,theta] <;> fun_prop + +lemma chartTheta_false (z : ℂ) : chartTheta false z=ElasticityRigidity.θ z := by + ext i + fin_cases i <;> simp [chartTheta,chartZ₀,chartZ₁,theta,ElasticityRigidity.θ] + +/-- The abstract conic rigidity calculation, separated from the lengthy +physical coefficient formulas. All analytic matching properties are supplied +below by proved supported uniqueness and regularity, not by inverse hypotheses. -/ +theorem chart_comparison_trivial (T : Bool → ℂ → Fin 2 → Smooth) + (Q : Bool → ℂ → Fin 2 → Fin 3 → Smooth) + (G : Bool → ℂ → Matrix (Fin 3) (Fin 3) Smooth) + (hG : ∀ b i j,JointHolomorphic (fun y : X × ℂ => (G b y.2 i j : X → ℂ) y.1)) + (hglue : ∀ z : ℂ,z≠0 → G false z=diagonalGauge (chartDiagonal z) (G true z⁻¹)) + (he : ∀ b z,matrixD (chartTheta b z) (G b z)= + chartMatrix b z (T b z 1) (Q b z 1)*G b z-G b z*chartMatrix b z (T b z 0) (Q b z 0)) + (x₀ : X) (hbase : matrixEval x₀ (G false 0)=1) : ∀ b z,G b z=1 := by + let M := fun b z q => chartMatrix b z (T b z q) (Q b z q) + let F := fun b x z => matrixEval x (G b z) + have hH : ElasticityRigidity.HolomorphicComparison (F false) (F true) := by + refine ⟨fun x i j => (hG false i j).holo x,fun x i j => (hG true i j).holo x,?_⟩ + intro x z hz i j + have hh := congrArg (fun A : Matrix (Fin 3) (Fin 3) Smooth => (A i j : X → ℂ) x) + (hglue z hz) + change (G false z i j : X → ℂ) x=((chartDiagonal z i)⁻¹*chartDiagonal z j)*(G true z⁻¹ i j : X → ℂ) x at hh + change (G false z i j : X → ℂ) x=_ + exact hh.trans (chart_transition_scalar z ((G true z⁻¹ i j : X → ℂ) x) i j) + let τ := fun q x z => (T false z q : X → ℂ) x + let β := fun q x z (i : Fin 2) => (M false z q 2 i.castSucc : X → ℂ) x + have hM (q x z) : ElasticityRigidity.M (β q) (τ q) x z=matrixEval x (M false z q) := by + ext i j + fin_cases i <;> fin_cases j <;> + simp [ElasticityRigidity.M,β,τ,M,chartMatrix,chartZ₀,chartZ₁] + have hT : ElasticityRigidity.Transport (F false) (β 0) (β 1) (τ 0) (τ 1) := by + intro x z i j + have hh := congrArg (fun A : Matrix (Fin 3) (Fin 3) Smooth => matrixEval x A i j) (he false z) + rw [matrixD_eval] at hh + simp only [map_sub,map_mul] at hh + rw [hM,hM] + simpa only [chartTheta_false,ElasticityRigidity.D,ElasticityRigidity.e, + ElasticityParameter.basis,F,matrixEval_apply] using hh + have hsp (z i j) : Differentiable ℝ (fun x => F false x z i j) := + (show ContDiff ℝ (⊤ : ℕ∞) (G false z i j : X → ℂ) from (G false z i j).property).differentiable (by simp) + have hId := ElasticityRigidity.comparison_identity hH hT hsp hbase + intro b z + ext i j x + have hh := congrArg (fun A : Matrix (Fin 3) (Fin 3) ℂ => A i j) + (show F b x z=1 by cases b; exact hId.1 x z; exact hId.2 x z) + change matrixEval x (G b z) i j=matrixEval x 1 i j + rw [map_one] + exact hh + +/-- Rigidity of the genuine two-chart physical connection. The entire analytic +matching input is only separately smooth supported transport; joint smoothness, +holomorphy and transition compatibility are conclusions of the transport equations, never additional properties imposed upon CGO weak limits. -/ +theorem supported_physical_holomorphic (k r : Fin 2 → Smooth) + (hr : ∀ q x,(r q : X → ℂ) x≠0) (hk : ∀ q x,(k q : X → ℂ) x≠0) + (hl : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0) + {K : Set X} (hK : IsCompact K) (χ : Smooth) (hχ : HasCompactSupport (χ : X → ℂ)) + (hχ1 : ∀ x∈K,(χ : X → ℂ) x=1) + (hexk : EqOn (k 0 : X → ℂ) (k 1) Kᶜ) (hexr : EqOn (r 0 : X → ℂ) (r 1) Kᶜ) + (G : Bool → ℂ → Matrix (Fin 3) (Fin 3) Smooth) + (hs : ∀ b z i j,tsupport ((G b z i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ)⊆K) + (he : ∀ b z,matrixD (chartTheta b z) (G b z)= + physicalChartMatrix b z (k 1) (r 1) (hr 1) (hk 1) (hl 1)*G b z- + G b z*physicalChartMatrix b z (k 0) (r 0) (hr 0) (hk 0) (hl 0)) : + ∀ b i j,JointHolomorphic (fun y : X × ℂ => (G b y.2 i j : X → ℂ) y.1) := by + let T := fun b z q => transportT (chartTheta b z) (k q) (r q) (hk q) (hl q) + let Q := fun b z q => transportQ (chartTheta b z) (k q) (r q) (hr q) (hk q) (hl q) + let M := fun b z q => chartMatrix b z (T b z q) (Q b z q) + have hMr (b : Bool) (q : Fin 2) (i j : Fin 3) : JointHolomorphic (fun y : X × ℂ => (M b y.2 q i j : X → ℂ) y.1) := + physicalChartMatrix_regular b (k q) (r q) (hr q) (hk q) (hl q) i j + have hMe (b z x) (hx : x∉K) : matrixEval x (M b z 0)=matrixEval x (M b z 1) := + physicalChartMatrix_eqOn b z k r hr hk hl hK.isClosed.isOpen_compl hexk hexr hx + have hGr (b : Bool) := supported_matrix_holomorphic (fun i z => chartTheta b z i) + (chartTheta_smooth b) + (fun i => (chartTheta_regular b i).holo 0) + (chartTheta_null b) (chartTheta_ne_zero b) (fun z => M b z 0) (fun z => M b z 1) (G b) + (hMr b 0) (hMr b 1) hK χ hχ hχ1 (hs b) (hMe b) (he b) + exact hGr + +theorem physical_conic_connections_equal (k r : Fin 2 → Smooth) + (hr : ∀ q x,(r q : X → ℂ) x≠0) (hk : ∀ q x,(k q : X → ℂ) x≠0) + (hl : ∀ q x,((k q+r q*r q : Smooth) : X → ℂ) x≠0) + {K : Set X} (hK : IsCompact K) (χ : Smooth) (hχ : HasCompactSupport (χ : X → ℂ)) + (hχ1 : ∀ x∈K,(χ : X → ℂ) x=1) (x₀ : X) (hx₀ : x₀∉K) + (hexk : EqOn (k 0 : X → ℂ) (k 1) Kᶜ) (hexr : EqOn (r 0 : X → ℂ) (r 1) Kᶜ) + (G : Bool → ℂ → Matrix (Fin 3) (Fin 3) Smooth) + (hs : ∀ b z i j,tsupport ((G b z i j-(1 : Matrix (Fin 3) (Fin 3) Smooth) i j : Smooth) : X → ℂ)⊆K) + (he : ∀ b z,matrixD (chartTheta b z) (G b z)= + physicalChartMatrix b z (k 1) (r 1) (hr 1) (hk 1) (hl 1)*G b z- + G b z*physicalChartMatrix b z (k 0) (r 0) (hr 0) (hk 0) (hl 0)) : + ∀ b z,physicalChartMatrix b z (k 0) (r 0) (hr 0) (hk 0) (hl 0)= + physicalChartMatrix b z (k 1) (r 1) (hr 1) (hk 1) (hl 1) := by + let T := fun b z q => transportT (chartTheta b z) (k q) (r q) (hk q) (hl q) + let Q := fun b z q => transportQ (chartTheta b z) (k q) (r q) (hr q) (hk q) (hl q) + have hGr := supported_physical_holomorphic k r hr hk hl hK χ hχ hχ1 hexk hexr G hs he + have hId : ∀ b z,G b z=1 := chart_comparison_trivial T Q G hGr + (supported_chart_glue k r hr hk hl hK G hs he) he x₀ + (supported_matrix_eq_one (G false 0) (hs false 0) x₀ hx₀) + intro b z + have hh := he b z + rw [hId b z,matrixD_one,mul_one,one_mul] at hh + exact (sub_eq_zero.mp hh.symm).symm +end ElasticityConic + +end +end +section +noncomputable section +open scoped BigOperators Matrix +namespace ElasticityConic + +/-- The two affine charts exhaust every nonzero complex characteristic direction, +up to its nonzero scalar. No arbitrary choice of a square root is needed. -/ +lemma chart_covers_null (v : C3) (hv : v≠0) (hn : null v) : + ∃ (b : Bool) (z c : ℂ), c≠0 ∧ v=c • chartTheta b z := by + have hn' : v 0^2+v 1^2+v 2^2=0 := by + simpa only [null,dot3,pow_two] using hn + let a : ℂ := v 0-Complex.I*v 1 + by_cases ha : a=0 + · have hz : v 2=0 := by + have hh : v 2^2=0 := by + dsimp [a] at ha + linear_combination hn'-(v 0+Complex.I*v 1)*ha-(v 1)^2*Complex.I_sq + exact (pow_eq_zero_iff (by omega : (2 : ℕ)≠0)).mp hh + have hn0 : v 0≠0 := by + intro h + have h1 : v 1=0 := by + have hh : Complex.I*v 1=0 := by simpa [a,h] using ha + exact (mul_eq_zero.mp hh).resolve_left Complex.I_ne_zero + apply hv + ext i + fin_cases i <;> simp [h,h1,hz] + refine ⟨true,0,-v 0,neg_ne_zero.mpr hn0,?_⟩ + ext i + fin_cases i <;> simp [chartTheta,chartZ₀,chartZ₁,theta,smul_eq_mul,hz] + dsimp [a] at ha + linear_combination Complex.I*ha+(v 1)*Complex.I_sq + · have h0 : a^2-v 2^2=2*a*v 0 := by + dsimp [a] + linear_combination -hn'+(v 1)^2*Complex.I_sq + have h1 : Complex.I*(a^2+v 2^2)=2*a*v 1 := by + dsimp [a] + linear_combination Complex.I*hn'+(Complex.I*(v 1)^2-2*v 0*v 1)*Complex.I_sq + refine ⟨false,v 2/a,a/2,div_ne_zero ha (by norm_num),?_⟩ + ext i + fin_cases i <;> simp [chartTheta,chartZ₀,chartZ₁,theta,smul_eq_mul] + · field_simp + linear_combination -h0 + · field_simp + linear_combination -h1 + · field_simp +end ElasticityConic + +end +end +section +noncomputable section +open scoped BigOperators Matrix +namespace ElasticityConic +open ElasticityAugmented + +lemma chart_bottom_equal (b : Bool) (z : ℂ) (T₀ T₁ : Smooth) (Q₀ Q₁ : Fin 3 → Smooth) + (he : chartMatrix b z T₀ Q₀=chartMatrix b z T₁ Q₁) (x : X) : + (T₀ : X → ℂ) x=(T₁ : X → ℂ) x ∧ + ∀ p : C3, dotProduct (chartTheta b z) p=0 → + dotProduct (fun i => (Q₀ i : X → ℂ) x) p=dotProduct (fun i => (Q₁ i : X → ℂ) x) p := by + have ht := congrArg (fun M : Matrix (Fin 3) (Fin 3) Smooth => (M 2 2 : X → ℂ) x) he + have h0 : dotProduct (fun i => (Q₀ i : X → ℂ) x) (h₁ (chartZ₀ b z) (chartZ₁ b z))= + dotProduct (fun i => (Q₁ i : X → ℂ) x) (h₁ (chartZ₀ b z) (chartZ₁ b z)) := by + have hh := congrArg (fun M : Matrix (Fin 3) (Fin 3) Smooth => (M 2 0 : X → ℂ) x) he + simpa [chartMatrix,smooth_sum_eval,dotProduct,mul_comm] using hh + have h1 : dotProduct (fun i => (Q₀ i : X → ℂ) x) (h₂ (chartZ₀ b z) (chartZ₁ b z))= + dotProduct (fun i => (Q₁ i : X → ℂ) x) (h₂ (chartZ₀ b z) (chartZ₁ b z)) := by + have hh := congrArg (fun M : Matrix (Fin 3) (Fin 3) Smooth => (M 2 1 : X → ℂ) x) he + simpa [chartMatrix,smooth_sum_eval,dotProduct,mul_comm] using hh + refine ⟨ht,?_⟩ + intro p hp + have hs := congrArg Prod.fst (chartVector_coord b z (p,0) hp) + change _+_=p at hs + rw [← hs,dotProduct_add,dotProduct_add,dotProduct_smul,dotProduct_smul, + dotProduct_smul,dotProduct_smul,h0,h1] + +end ElasticityConic +namespace ElasticityRecovery +open ElasticityConic +lemma T_smul (m k : X → ℝ) (x : X) (c : ℂ) (θ : C3) : + T m k x (c • θ)=c*T m k x θ := by + simp only [T,dir,smul_dotProduct,smul_eq_mul] +lemma Q_smul (m k : X → ℝ) (x : X) (c : ℂ) (θ : C3) : + Q m k x (c • θ)=c • Q m k x θ := by + exact Matrix.mulVec_smul _ _ _ +end ElasticityRecovery +namespace ElasticityAugmented +open ElasticityConic +/-- Equality of the actual conic connections is precisely sufficient for the +restricted physical transports used by Lamé coefficient recovery. -/ +theorem restricted_transports_of_chart_equal (m k : Fin 2 → X → ℝ) + (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) (hk : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (k q)) + (hmp : ∀ q x,0 < m q x) (hkp : ∀ q x,0 < k q x) + (he : ∀ b z, + chartMatrix b z + (transportT (chartTheta b z) (smoothOfReal (k 0) (hk 0)) (positiveRoot (m 0) (hm 0) (hmp 0)) + (fun x => Complex.ofReal_ne_zero.mpr (hkp 0 x).ne') (real_sum_nonzero (m 0) (k 0) (hm 0) (hk 0) (hmp 0) (hkp 0))) + (transportQ (chartTheta b z) (smoothOfReal (k 0) (hk 0)) (positiveRoot (m 0) (hm 0) (hmp 0)) + (positiveRoot_nonzero (m 0) (hm 0) (hmp 0)) (fun x => Complex.ofReal_ne_zero.mpr (hkp 0 x).ne') + (real_sum_nonzero (m 0) (k 0) (hm 0) (hk 0) (hmp 0) (hkp 0)))= + chartMatrix b z + (transportT (chartTheta b z) (smoothOfReal (k 1) (hk 1)) (positiveRoot (m 1) (hm 1) (hmp 1)) + (fun x => Complex.ofReal_ne_zero.mpr (hkp 1 x).ne') (real_sum_nonzero (m 1) (k 1) (hm 1) (hk 1) (hmp 1) (hkp 1))) + (transportQ (chartTheta b z) (smoothOfReal (k 1) (hk 1)) (positiveRoot (m 1) (hm 1) (hmp 1)) + (positiveRoot_nonzero (m 1) (hm 1) (hmp 1)) (fun x => Complex.ofReal_ne_zero.mpr (hkp 1 x).ne') + (real_sum_nonzero (m 1) (k 1) (hm 1) (hk 1) (hmp 1) (hkp 1)))) : + ElasticityRecovery.EqualRestrictedTransports (m 0) (k 0) (m 1) (k 1) := by + intro x θ hθ hn + obtain ⟨b,z,c,hc,hθc⟩ := chart_covers_null θ hθ hn + have hh := chart_bottom_equal b z _ _ _ _ (he b z) x + have ht : ElasticityRecovery.T (m 0) (k 0) x (chartTheta b z)= + ElasticityRecovery.T (m 1) (k 1) x (chartTheta b z) := + (transportT_real (chartTheta b z) (m 0) (k 0) (hm 0) (hk 0) (hmp 0) (hkp 0) x).symm.trans + (hh.1.trans (transportT_real (chartTheta b z) (m 1) (k 1) (hm 1) (hk 1) (hmp 1) (hkp 1) x)) + have hq (q : Fin 2) : (fun i => + (transportQ (chartTheta b z) (smoothOfReal (k q) (hk q)) (positiveRoot (m q) (hm q) (hmp q)) + (positiveRoot_nonzero (m q) (hm q) (hmp q)) (fun x => Complex.ofReal_ne_zero.mpr (hkp q x).ne') + (real_sum_nonzero (m q) (k q) (hm q) (hk q) (hmp q) (hkp q)) i : X → ℂ) x)= + ElasticityRecovery.Q (m q) (k q) x (chartTheta b z) := by + funext i + exact transportQ_real (chartTheta b z) (m q) (k q) (hm q) (hk q) (hmp q) (hkp q) x i + constructor + · rw [hθc,ElasticityRecovery.T_smul,ElasticityRecovery.T_smul,ht] + · intro p hp + have hp' : dotProduct (chartTheta b z) p=0 := by + rw [hθc,smul_dotProduct,smul_eq_mul] at hp + exact (mul_eq_zero.mp hp).resolve_left hc + have h := hh.2 p hp' + rw [hq 0,hq 1] at h + rw [hθc,ElasticityRecovery.Q_smul,ElasticityRecovery.Q_smul,smul_dotProduct,smul_dotProduct,h] +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators Matrix +namespace Elasticity +open ElasticityAugmented ElasticityCGO ElasticityConic +open ElasticityCoeffBounds (ExteriorConstant) + +lemma physicalChartMatrix_congr_k (b : Bool) (z : ℂ) (k₀ k₁ r : Smooth) + (e : k₀=k₁) (hr : ∀ x,(r : X → ℂ) x≠0) + (hk₀ : ∀ x,(k₀ : X → ℂ) x≠0) (hk₁ : ∀ x,(k₁ : X → ℂ) x≠0) + (hl₀ : ∀ x,((k₀+r*r : Smooth) : X → ℂ) x≠0) + (hl₁ : ∀ x,((k₁+r*r : Smooth) : X → ℂ) x≠0) : + physicalChartMatrix b z k₀ r hr hk₀ hl₀ = physicalChartMatrix b z k₁ r hr hk₁ hl₁ := by + subst k₁ + rfl + +/-- The global transport-matching implication for a genuine common exterior. +Its only inverse-data hypothesis is equality of the physical DN maps. -/ +theorem dn_global_coefficients_equal {Ω : Set X} (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) : + lam 0=lam 1 ∧ m 0=m 1 := by + have hK : IsCompact (closure Ω) := hOB.isCompact_closure + obtain ⟨R,hR,hKR⟩ := hOB.closure.subset_closedBall_lt 1 (0 : X) + have hr₀ : 1≤R := hR.le + let kr := fun q x => lam q x+m q x + have hks (q) : ContDiff ℝ (⊤ : ℕ∞) (kr q) := (hl q).add (hm q) + have hkp (q x) : 0 < kr q x := by dsimp [kr]; have hh := hp q x; linarith + let k := fun q => smoothOfReal (lam q) (hl q)+smoothOfReal (m q) (hm q) + let r := fun q => positiveRoot (m q) (hm q) (fun x => (hp q x).1) + have hr (q x) : (r q : X → ℂ) x≠0 := positiveRoot_nonzero (m q) (hm q) (fun x => (hp q x).1) x + have hk (q x) : (k q : X → ℂ) x≠0 := by + change (lam q x : ℂ)+(m q x : ℂ)≠0 + rw [← Complex.ofReal_add] + exact Complex.ofReal_ne_zero.mpr (hkp q x).ne' + have hL (q x) : ((k q+r q*r q : Smooth) : X → ℂ) x≠0 := by + have hrr : r q*r q=smoothOfReal (m q) (hm q) := positiveRoot_square (m q) (hm q) (fun x => (hp q x).1) + rw [hrr] + change (lam q x : ℂ)+(m q x : ℂ)+(m q x : ℂ)≠0 + rw [← Complex.ofReal_add,← Complex.ofReal_add] + apply Complex.ofReal_ne_zero.mpr + have hh := hp q x + linarith + choose G hs hge using (fun b z => dn_conic_comparison hΩ hOB R hr₀ hKR lam m hl hm hp hcll hclm he hDN b z hk hL) + have hne : (closure Ω)ᶜ.Nonempty := Set.nonempty_compl.mpr hK.ne_univ + obtain ⟨x₀,hx₀⟩ := hne + let χ : Smooth := ⟨fiveCutoff R hr₀ 0,fiveCutoff_smooth R hr₀ 0⟩ + have hχ1 (x) (hx : x∈closure Ω) : (χ : X → ℂ) x=1 := by + apply fiveCutoff_one R hr₀ 0 + simpa only [Fin.val_zero,Nat.cast_zero,add_zero] using + Metric.closedBall_subset_closedBall (by linarith : R≤R+1) (hKR hx) + have hek : EqOn (k 0 : X → ℂ) (k 1) (closure Ω)ᶜ := by + intro x hx + have hh := he x (fun hh => hx (subset_closure hh)) + change (lam 0 x : ℂ)+(m 0 x : ℂ)=(lam 1 x : ℂ)+(m 1 x : ℂ) + rw [hh.1,hh.2] + have her : EqOn (r 0 : X → ℂ) (r 1) (closure Ω)ᶜ := by + intro x hx + have hh := he x (fun hh => hx (subset_closure hh)) + change (Real.sqrt (m 0 x) : ℂ)=(Real.sqrt (m 1 x) : ℂ) + rw [hh.2] + have hM := physical_conic_connections_equal k r hr hk hL hK χ + (fiveCutoff_compact R hr₀ 0) hχ1 x₀ hx₀ hek her G hs hge + have ht : ElasticityRecovery.EqualRestrictedTransports (m 0) (kr 0) (m 1) (kr 1) := by + apply restricted_transports_of_chart_equal m kr hm hks (fun q x => (hp q x).1) hkp + intro b z + have hEq (q : Fin 2) : smoothOfReal (kr q) (hks q)=k q := + (smoothOfReal_add (lam q) (m q) (hl q) (hm q)).symm + exact (physicalChartMatrix_congr_k b z _ _ _ (hEq 0) _ _ _ _ _).trans + ((hM b z).trans (physicalChartMatrix_congr_k b z _ _ _ (hEq 1) _ _ _ _ _).symm) + have hmk := ElasticityRecovery.coefficients_equal_of_restricted_transports + (hm 0) (hks 0) (hm 1) (hks 1) (fun x => (hp 0 x).1) (hkp 0) + (fun x => (hp 1 x).1) (hkp 1) ht isClosed_closure.isOpen_compl ⟨x₀,hx₀⟩ + (fun x hx => (he x (fun hh => hx (subset_closure hh))).2) + (fun x hx => by dsimp [kr]; rw [(he x (fun hh => hx (subset_closure hh))).1,(he x (fun hh => hx (subset_closure hh))).2]) + refine ⟨?_,hmk.1⟩ + funext x + have hh := congrFun hmk.2 x + have hm' := congrFun hmk.1 x + dsimp [kr] at hh + linarith +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Smoothing.lean b/lean/OAI/MathematicalPhysics/Elasticity/Smoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe9d6c8e48af4e215b64fb9e3f61308b1eb4a40b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Smoothing.lean @@ -0,0 +1,875 @@ +import OAI.MathematicalPhysics.Elasticity.Supported + +namespace OAI + +noncomputable section + +namespace ElasticityCoordinates +/-! Actual Haar/L2 and tempered-distribution change of linear coordinates. +The Jacobian is derived from Haar uniqueness, not silently set equal to one. -/ +open MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal NNReal LineDeriv +variable {E F : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + [MeasureSpace E] [BorelSpace E] [Measure.IsAddHaarMeasure (volume : Measure E)] + [MeasureSpace F] [BorelSpace F] [Measure.IsAddHaarMeasure (volume : Measure F)] + +omit [FiniteDimensional ℝ F] in +lemma linear_haar (L : F ≃L[ℝ] E) : + ∃ c : ℝ≥0,0 φ (L.symm x)*u x) + change (∫ x : E, φ (L.symm x)*u x ∂((volume : Measure F).map L))= + ∫ q : F, φ (L.symm (L q))*u (L q) at hh + rw [hc,integral_smul_nnreal_measure] at hh + simpa only [ContinuousLinearEquiv.symm_apply_apply,NNReal.smul_def,Complex.real_smul, + SchwartzMap.compCLMOfContinuousLinearEquiv_apply,Function.comp_apply] using hh.symm + +omit [FiniteDimensional ℝ F] in +lemma pullLp_equation (L : F ≃L[ℝ] E) (v w : F) + (u f : Lp ℂ 2 (volume : Measure E)) + (he : ∂_{L v} (u : 𝓢'(E,ℂ))+Complex.I • ∂_{L w} (u : 𝓢'(E,ℂ))+ + (f : 𝓢'(E,ℂ))=0) : + ∂_{v} (pullLp L u : 𝓢'(F,ℂ))+Complex.I • ∂_{w} (pullLp L u : 𝓢'(F,ℂ))+ + (pullLp L f : 𝓢'(F,ℂ))=0 := by + obtain ⟨c,_,hc⟩ := linear_haar L + have hh := congrArg (linearPull L) he + simp only [linearPull_add,linearPull_smul,linearPull_deriv,linearPull_zero] at hh + rw [pullLp_distribution L c hc u,pullLp_distribution L c hc f] + simp only [LineDeriv.lineDerivOp_smul] + rw [smul_comm Complex.I (c : ℂ),← smul_add,← smul_add,hh,smul_zero] + +end ElasticityCoordinates +namespace ElasticityCoordinates +open MeasureTheory Set +open scoped ENNReal NNReal +variable {E F : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + [MeasureSpace E] [BorelSpace E] [Measure.IsAddHaarMeasure (volume : Measure E)] + [MeasureSpace F] [BorelSpace F] [Measure.IsAddHaarMeasure (volume : Measure F)] + +lemma ae_linear (L : F ≃L[ℝ] E) {p : E → Prop} (hp : ∀ᵐ x,p x) : ∀ᵐ q,p (L q) := by + obtain ⟨c,_hc,hm⟩ := linear_haar L + have hh : ∀ᵐ x ∂((volume : Measure F).map L),p x := by + rw [hm] + exact Measure.ae_smul_measure hp c + exact ae_of_ae_map L.continuous.measurable.aemeasurable hh + +omit [FiniteDimensional ℝ E] [NormedSpace ℝ E] in +lemma lp_integrable_supported {K : Set E} (hK : IsCompact K) + (u : Lp ℂ 2 (volume : Measure E)) (hu : ∀ᵐ x,x∉K → u x=0) : Integrable (u : E → ℂ) := by + have hres : MemLp (u : E → ℂ) 2 (volume.restrict K) := (Lp.memLp u).restrict K + have : IsFiniteMeasure (volume.restrict K) := ⟨by simpa only [Measure.restrict_apply_univ] using hK.measure_lt_top (μ := (volume : Measure E))⟩ + have hi : IntegrableOn (u : E → ℂ) K := hres.integrable (by norm_num) + have he : K.indicator (u : E → ℂ)=ᵐ[volume] (u : E → ℂ) := by + filter_upwards [hu] with x hx + by_cases h : x∈K + · exact indicator_of_mem h _ + · simp only [indicator_of_notMem h,hx h] + exact (hi.integrable_indicator hK.measurableSet).congr he +end ElasticityCoordinates +namespace ElasticityCoordinates +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal LineDeriv +variable {E P n : Type*} [Fintype n] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + [MeasureSpace E] [BorelSpace E] [Measure.IsAddHaarMeasure (volume : Measure E)] + [NormedAddCommGroup P] [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] + +/-- Smoothness of an actual compactly supported matrix transport weak solution +in arbitrary linear transverse coordinates. The representative equals the +original L2 function almost everywhere; no exceptional planes remain. -/ +theorem planar_smooth_representative (L : (P × ℂ) ≃L[ℝ] E) + (T K : Set E) (hT : IsCompact T) (hK : IsCompact K) + (a : n → n → E → ℂ) (ha : ∀ i j,ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (has : ∀ i j x,x∉K → a i j x=0) + (f : n → E → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i x,x∉K → f i x=0) + (u w : n → Lp ℂ 2 (volume : Measure E)) + (hus : ∀ i,∀ᵐ x,x∉T → u i x=0) (hws : ∀ i,∀ᵐ x,x∉T → w i x=0) + (hc : ∀ i,∀ᵐ x,w i x=∑ j,a i j x*u j x-f i x) + (he : ∀ i,∂_{L (0,1)} (u i : 𝓢'(E,ℂ))+ + Complex.I • ∂_{L (0,Complex.I)} (u i : 𝓢'(E,ℂ))+(w i : 𝓢'(E,ℂ))=0) : + ∃ v : n → E → ℂ,(∀ i,ContDiff ℝ (⊤ : ℕ∞) (v i)) ∧ + (∀ i,(u i : E → ℂ)=ᵐ[volume] v i) := by + classical + have : (volume : Measure (P × ℂ)).HasTemperateGrowth := by + change (volume.prod volume).HasTemperateGrowth + infer_instance + have : Measure.IsAddHaarMeasure (volume : Measure (P × ℂ)) := by + change Measure.IsAddHaarMeasure (volume.prod volume) + infer_instance + let S := (fun x : E => (L.symm x).2) '' T + let Q := (fun x : E => (L.symm x).2) '' K + have hS : IsCompact S := hT.image (continuous_snd.comp L.symm.continuous) + have hQ : IsCompact Q := hK.image (continuous_snd.comp L.symm.continuous) + let U := fun i => pullLp L (u i) + let W := fun i => pullLp L (w i) + have hsU (i) : ∀ᵐ q : P × ℂ,q.2∉S → U i q=0 := by + filter_upwards [pullLp_coe L (u i),ae_linear L (hus i)] with q hq hqu + intro hqs + rw [hq] + apply hqu + intro hqt + exact hqs ⟨L q,hqt,by simp⟩ + have hsW (i) : ∀ᵐ q : P × ℂ,q.2∉S → W i q=0 := by + filter_upwards [pullLp_coe L (w i),ae_linear L (hws i)] with q hq hqw + intro hqs + rw [hq] + apply hqw + intro hqt + exact hqs ⟨L q,hqt,by simp⟩ + have compactU (i) : ∀ᵐ q : P × ℂ,q∉L.symm '' T → U i q=0 := by + filter_upwards [pullLp_coe L (u i),ae_linear L (hus i)] with q hq hqu + intro hqs + rw [hq] + exact hqu (fun hh => hqs ⟨L q,hh,L.symm_apply_apply q⟩) + have compactW (i) : ∀ᵐ q : P × ℂ,q∉L.symm '' T → W i q=0 := by + filter_upwards [pullLp_coe L (w i),ae_linear L (hws i)] with q hq hqw + intro hqs + rw [hq] + exact hqw (fun hh => hqs ⟨L q,hh,L.symm_apply_apply q⟩) + have huI (i) := lp_integrable_supported (hT.image L.symm.continuous) (U i) (compactU i) + have hwI (i) := lp_integrable_supported (hT.image L.symm.continuous) (W i) (compactW i) + have hcc (i) : ∀ᵐ q : P × ℂ,W i q=∑ j,a i j (L q)*U j q-f i (L q) := by + have huall : ∀ᵐ q : P × ℂ,∀ j,U j q=u j (L q) := by + rw [ae_all_iff] + exact fun j => pullLp_coe L (u j) + filter_upwards [pullLp_coe L (w i),huall,ae_linear L (hc i)] with q hwq huq hq + change W i q=w i (L q) at hwq + rw [hwq] + simp_rw [huq] + exact hq + obtain ⟨v,hv,_hvs,_hve,hvu⟩ := ElasticityGeneralSlicing.smooth_cylinder_representative S Q hS hQ + (fun i j q => a i j (L q)) (fun i j => (ha i j).comp L.contDiff) + (fun i j t z hz => has i j _ (fun hh => hz ⟨L (t,z),hh,by simp⟩)) + (fun i q => f i (L q)) (fun i => (hf i).comp L.contDiff) + (fun i t z hz => hfs i _ (fun hh => hz ⟨L (t,z),hh,by simp⟩)) + U W huI hwI hsU hsW hcc (fun i => pullLp_equation L (0,1) (0,Complex.I) (u i) (w i) (he i)) + refine ⟨fun i x => v (L.symm x).1 i (L.symm x).2, + fun i => (hv i).comp L.symm.contDiff,fun i => ?_⟩ + have hq : ∀ᵐ q : P × ℂ,u i (L q)=v q.1 i q.2 := by + filter_upwards [pullLp_coe L (u i),hvu i] with q huq hvq + exact huq.symm.trans hvq + have hh := ae_linear L.symm hq + filter_upwards [hh] with x hx + simpa only [L.apply_symm_apply] using hx + +end ElasticityCoordinates +namespace ElasticityDistribution +open Set MeasureTheory TemperedDistribution + +section +open scoped SchwartzMap LineDeriv ENNReal +open ElasticityRegularity + +abbrev L2Space := Lp ℂ 2 (volume : Measure X) + +def compactLpMul (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (u : L2Space) : L2Space := + (compact_bounded_multiplier hg hc).toLp g • u +lemma compactLpMul_coe (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (u : L2Space) : + (compactLpMul g hg hc u : X → ℂ)=ᵐ[volume] fun x => g x*u x := by + filter_upwards [Lp.coeFn_lpSMul (r := 2) ((compact_bounded_multiplier hg hc).toLp g) u, + (compact_bounded_multiplier hg hc).coeFn_toLp] with x hx hy + change (((compact_bounded_multiplier hg hc).toLp g) • u) x=_ + rw [hx,Pi.smul_apply',hy,smul_eq_mul] +lemma compactLpMul_dist (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) + (hc : HasCompactSupport g) (u : L2Space) : + (compactLpMul g hg hc u : Dist)=smulLeftCLM ℂ g (u : Dist) := + Lp.toTemperedDistribution_smul_eq (hc.hasTemperateGrowth hg) (compact_bounded_multiplier hg hc) u + +lemma lp_mul_eq {K : Set X} (u : L2Space) (hu : ∀ᵐ x,x∉K → u x=0) + (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (h1 : EqOn g 1 K) : smulLeftCLM ℂ g (u : Dist)=(u : Dist) := by + rw [← compactLpMul_dist g hg hc] + congr 1 + apply Lp.ext + filter_upwards [compactLpMul_coe g hg hc u,hu] with x hx hux + rw [hx] + by_cases h : x∈K + · rw [h1 h,Pi.one_apply,one_mul] + · rw [hux h,mul_zero] +lemma lp_mul_zero {K : Set X} (u : L2Space) (hu : ∀ᵐ x,x∉K → u x=0) + (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (h0 : EqOn g 0 K) : smulLeftCLM ℂ g (u : Dist)=0 := by + rw [← compactLpMul_dist g hg hc] + have he : compactLpMul g hg hc u=0 := by + apply Lp.ext + filter_upwards [compactLpMul_coe g hg hc u,hu,Lp.coeFn_zero (E := ℂ) (p := (2 : ℝ≥0∞)) (μ := (volume : Measure X))] with x hx hux hz + rw [hx,hz] + change g x*u x=0 + by_cases h : x∈K + · rw [h0 h,Pi.zero_apply,zero_mul] + · rw [hux h,mul_zero] + rw [he] + exact (Lp.toTemperedDistributionCLM ℂ (volume : Measure X) 2).map_zero + +lemma lp_cutoff_derivative {K B : Set X} (hB : IsOpen B) (hKB : K⊆B) + (u : L2Space) (hu : ∀ᵐ x,x∉K → u x=0) + (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (h1 : EqOn g 1 B) (a : X) : + smulLeftCLM ℂ g (∂_{a} (u : Dist))=∂_{a} (u : Dist) := by + have he := lp_mul_eq u hu g hg hc (h1.mono hKB) + have h0 : EqOn (fun x => fderiv ℝ g x a) 0 K := by + intro x hx + have hh : g=ᶠ[nhds x] (fun _ => (1 : ℂ)) := + Filter.mem_of_superset (hB.mem_nhds (hKB hx)) h1 + change fderiv ℝ g x a=0 + rw [hh.fderiv_eq] + simp only [fderiv_fun_const] + rfl + have hz := lp_mul_zero u hu _ (smooth_derivative hg a) (compact_derivative hc a) h0 + have hl := distribution_leibniz (hc.hasTemperateGrowth hg) a + ((compact_derivative hc a).hasTemperateGrowth (smooth_derivative hg a)) (u : Dist) + rw [he,hz,zero_add] at hl + exact hl.symm + +lemma continuous_supported_of_ae {K : Set X} (hK : IsClosed K) + (u : L2Space) (hu : ∀ᵐ x,x∉K → u x=0) + (v : X → ℂ) (hv : Continuous v) (hvu : (u : X → ℂ)=ᵐ[volume] v) : + tsupport v⊆K := by + have he : v=ᵐ[volume.restrict Kᶜ] 0 := by + change ∀ᵐ x ∂volume.restrict Kᶜ,v x=0 + rw [ae_restrict_iff' hK.isOpen_compl.measurableSet] + filter_upwards [hu,hvu] with x hx he + intro hk + rw [← he,hx hk] + have hh : EqOn v 0 Kᶜ := Measure.eqOn_of_ae_eq he hv.continuousOn continuousOn_const + (by rw [hK.isOpen_compl.interior_eq];exact subset_closure) + apply closure_minimal _ hK + intro x hx + by_contra hn + exact hx (hh hn) + +end +open scoped SchwartzMap LineDeriv ENNReal BigOperators +open ElasticityRegularity +variable {n P : Type*} [Fintype n] + [NormedAddCommGroup P] [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] + +def planeDerivative (α β : X) : Dist →L[ℂ] Dist := + LineDeriv.lineDerivOpCLM ℂ Dist α+Complex.I • LineDeriv.lineDerivOpCLM ℂ Dist β +def planeSchwartz (α β : X) : Test →L[ℂ] Test := + LineDeriv.lineDerivOpCLM ℂ Test α+Complex.I • LineDeriv.lineDerivOpCLM ℂ Test β +lemma planeDerivative_schwartz (α β : X) (a : Test) : + planeDerivative α β (a : Dist)=(planeSchwartz α β a : Dist) := by + change ∂_{α} (a : Dist)+Complex.I • ∂_{β} (a : Dist)= + ((∂_{α} a+Complex.I • ∂_{β} a : Test) : Dist) + simp only [coe_schwartz_add,coe_schwartz_smul, + lineDerivOp_toTemperedDistributionCLM_eq] + +/-- Compactly supported differences of the actual weak columns are smooth, +including the transverse variable. No inverse of the transferred frame is +assumed and no ellipticity in three dimensions is asserted. -/ +theorem compact_transport_smoothing (L : (P × ℂ) ≃L[ℝ] X) + {K B B₀ : Set X} (hK : IsCompact K) (hB₀ : IsOpen B₀) (hKB : K⊆B₀) + (A : n → n → Coeff) (W : n → L2Space) (a : n → Test) + (hext : ∀ i,LocalEq Kᶜ (W i : Dist) (a i : Dist)) + (he : ∀ i,LocalEq B (planeDerivative (L (0,1)) (L (0,Complex.I)) (W i : Dist)+ + ∑ j,A i j • (W j : Dist)) 0) + (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆B) (h1 : EqOn g 1 B₀) : + ∃ v : n → Test,(∀ i,(W i : Dist)=(v i : Dist)) ∧ + ∀ i,tsupport (v i-a i : Test)⊆K := by + classical + let α := L (0,1) + let β := L (0,Complex.I) + let u := fun i => W i-(a i).toLp 2 volume + have hu (i) : ∀ᵐ x,x∉K → u i x=0 := by + have hh : LocalEqual Kᶜ (W i : Dist) (((a i).toLp 2 volume : L2Space) : Dist) := by + simpa only [Lp.toTemperedDistribution_toLp_eq,LocalEqual,LocalEq] using hext i + filter_upwards [LocalEqual.lp_ae hK.isClosed.isOpen_compl (W i) ((a i).toLp 2 volume) hh, + Lp.coeFn_sub (W i) ((a i).toLp 2 volume)] with x hx hy + intro hk + change (W i-(a i).toLp 2 volume) x=0 + rw [hy,Pi.sub_apply,hx hk,sub_self] + have ud (i) : (u i : Dist)=(W i : Dist)-(a i : Dist) := by + change (Lp.toTemperedDistributionCLM ℂ volume 2) (W i-(a i).toLp 2 volume)=_ + rw [map_sub,Lp.toTemperedDistributionCLM_apply,Lp.toTemperedDistributionCLM_apply, + Lp.toTemperedDistribution_toLp_eq] + let q : n → Test := fun i => planeSchwartz α β (a i)+ + ∑ j,SchwartzMap.smulLeftCLM ℂ (eval (A i j)) (a j) + have qd (i) : (q i : Dist)=planeDerivative α β (a i : Dist)+∑ j,A i j • (a j : Dist) := by + simp only [q,coe_schwartz_add,coe_schwartz_sum,← planeDerivative_schwartz,coeff_schwartz,ElasticityNegativeOrder.mult] + let f : n → Test := fun i => -(SchwartzMap.smulLeftCLM ℂ g (q i)) + have fd (i) : (f i : Dist)= -(smulLeftCLM ℂ g (q i : Dist)) := by + rw [show f i= -(SchwartzMap.smulLeftCLM ℂ g (q i)) from rfl,map_neg] + congr 1 + exact (distribution_schwartz_product (hc.hasTemperateGrowth hg) (q i)).symm + have fcoe (i) : (f i : X → ℂ)=fun x => -(g x*q i x) := by + funext x + simp only [f,neg_apply,SchwartzMap.smulLeftCLM_apply_apply (hc.hasTemperateGrowth hg),smul_eq_mul] + have hfc (i) : HasCompactSupport (f i : X → ℂ) := by + rw [fcoe] + exact (hc.mul_right (f' := (q i : X → ℂ))).neg + have hfs (i) : tsupport (f i : X → ℂ)⊆tsupport g := by + rw [fcoe] + change tsupport (-(fun x => g x*q i x))⊆tsupport g + rw [tsupport_neg] + exact tsupport_mul_subset_left + let b := fun i j x => g x*eval (A i j) x + have hb (i j) : ContDiff ℝ (⊤ : ℕ∞) (b i j) := hg.mul (eval_smooth (A i j)) + have hbc (i j) : HasCompactSupport (b i j) := hc.mul_right + let w := fun i => (∑ j,compactLpMul (b i j) (hb i j) (hbc i j) (u j))-(f i).toLp 2 volume + have wd (i) : (w i : Dist)=(∑ j,smulLeftCLM ℂ (b i j) (u j : Dist))-(f i : Dist) := by + change (Lp.toTemperedDistributionCLM ℂ volume 2) (_-_)=_ + simp only [map_sub,map_sum,Lp.toTemperedDistributionCLM_apply,compactLpMul_dist, + Lp.toTemperedDistribution_toLp_eq] + have wcoe (i) : ∀ᵐ x,w i x=∑ j,b i j x*u j x-f i x := by + have hall : ∀ᵐ x,∀ j,compactLpMul (b i j) (hb i j) (hbc i j) (u j) x=b i j x*u j x := by + rw [ae_all_iff] + exact fun j => compactLpMul_coe _ _ _ _ + filter_upwards [hall,Lp.coeFn_finsetSum Finset.univ (fun j => compactLpMul (b i j) (hb i j) (hbc i j) (u j)), + Lp.coeFn_sub (∑ j,compactLpMul (b i j) (hb i j) (hbc i j) (u j)) ((f i).toLp 2 volume), + (f i).coeFn_toLp 2 volume] with x hx hy hz hf + change ((∑ j,compactLpMul (b i j) (hb i j) (hbc i j) (u j))-(f i).toLp 2 volume) x=_ + rw [hz,Pi.sub_apply,hy,hf] + simp only [Finset.sum_apply,hx] + have we (i) : planeDerivative α β (u i : Dist)+(w i : Dist)=0 := by + have hlu : LocalEq B (planeDerivative α β (u i : Dist)+∑ j,A i j • (u j : Dist)) (-(q i : Dist)) := by + intro φ hφ hφs + have hhi := he i φ hφ hφs + simp only [ud,map_sub,smul_def,map_sub,Finset.sum_sub_distrib,qd,add_apply,sub_apply,neg_apply,zero_apply] at hhi ⊢ + linear_combination hhi + have ht := hlu.cutoff hg hc hs + simp only [map_add,map_sum,map_neg] at ht + have hd : smulLeftCLM ℂ g (planeDerivative α β (u i : Dist))=planeDerivative α β (u i : Dist) := by + change smulLeftCLM ℂ g (∂_{α} (u i : Dist)+Complex.I • ∂_{β} (u i : Dist))=_ + rw [map_add,map_smul,lp_cutoff_derivative hB₀ hKB (u i) (hu i) g hg hc h1 α, + lp_cutoff_derivative hB₀ hKB (u i) (hu i) g hg hc h1 β] + rfl + have hm (j) : smulLeftCLM ℂ g (A i j • (u j : Dist))=smulLeftCLM ℂ (b i j) (u j : Dist) := by + rw [smul_def,smulLeftCLM_smulLeftCLM_apply (growth (A i j)) (hc.hasTemperateGrowth hg)] + congr 2 + funext x + exact mul_comm _ _ + rw [hd] at ht + simp_rw [hm] at ht + rw [wd,fd] + rw [sub_neg_eq_add] + rw [← add_assoc,ht,neg_add_cancel] + have hw (i) : ∀ᵐ x,x∉K∪tsupport g → w i x=0 := by + have hall : ∀ᵐ x,∀ j,x∉K → u j x=0 := by rw [ae_all_iff];exact hu + filter_upwards [wcoe i,hall] with x hx hxu + intro hn + rw [hx] + have hf : f i x=0 := image_eq_zero_of_notMem_tsupport (fun hh => hn (Or.inr (hfs i hh))) + simp only [hxu _ (fun hh => hn (Or.inl hh)),mul_zero,Finset.sum_const_zero,hf,sub_self] + obtain ⟨v,hv,hvu⟩ := ElasticityCoordinates.planar_smooth_representative L + (K∪tsupport g) (tsupport g) (hK.union hc) hc b hb + (fun i j x hx => by simp only [b,image_eq_zero_of_notMem_tsupport hx,zero_mul]) + (fun i => (f i : X → ℂ)) (fun i => (f i).smooth ⊤) + (fun i x hx => image_eq_zero_of_notMem_tsupport (fun hh => hx (hfs i hh))) + u w (fun i => (hu i).mono fun x hx hn => hx (fun hh => hn (Or.inl hh))) hw wcoe we + have hvK (i) : tsupport (v i)⊆K := continuous_supported_of_ae hK.isClosed (u i) (hu i) (v i) (hv i).continuous (hvu i) + have hvc (i) : HasCompactSupport (v i) := hK.of_isClosed_subset (isClosed_tsupport _) (hvK i) + let vS := fun i => (hvc i).toSchwartzMap (hv i) + have vsd (i) : (u i : Dist)=(vS i : Dist) := by + have hL : u i=(vS i).toLp 2 volume := by + apply Lp.ext + exact (hvu i).trans ((vS i).coeFn_toLp 2 volume).symm + rw [hL,Lp.toTemperedDistribution_toLp_eq] + refine ⟨fun i => vS i+a i,fun i => ?_,fun i => ?_⟩ + · rw [coe_schwartz_add,← vsd,ud,sub_add_cancel] + · rw [add_sub_cancel_right] + change tsupport (v i)⊆K + exact hvK i +end ElasticityDistribution +namespace ElasticityDistribution +open Set TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityAugmented + +def leadingPair (θ : Fin 3 → ℂ) (lam m n o : Coeff) (U : Fin 4 → Dist) : Fin 4 → Dist := + Fin.cons (o • (leadingSd θ lam m (fun j => U j.succ) (U 0)- + (2 : ℂ) • (n • ∑ i, dc i m • leadingRd θ lam m (fun j => U j.succ) (U 0) i))) + (fun i => n • leadingRd θ lam m (fun j => U j.succ) (U 0) i) + +lemma lapd_null_direction (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (u : Dist) : + lapd θ u=lapd 0 u+(2 : ℂ) • directiond θ u := by + rw [lapd_expand,lapd_expand] + ext φ + simp only [hθ,Pi.zero_apply,mul_zero,Finset.sum_const_zero] + unfold directiond + simp [mul_smul,Finset.smul_sum] + +lemma normPair_null_leading (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (lam m n o : Coeff) (U : Fin 4 → Dist) (i : Fin 4) : + normPair θ lam m n o (fun j => U j.succ) (U 0) i= + normPair 0 lam m n o (fun j => U j.succ) (U 0) i+leadingPair θ lam m n o U i := by + have hr (j) : rd θ lam m (fun j => U j.succ) (U 0) j= + rd 0 lam m (fun j => U j.succ) (U 0) j+leadingRd θ lam m (fun j => U j.succ) (U 0) j := by + simpa only [one_smul] using rd_null_expansion θ hθ 1 lam m (fun j => U j.succ) (U 0) j + have hs : scd θ lam m (fun j => U j.succ) (U 0)= + scd 0 lam m (fun j => U j.succ) (U 0)+leadingSd θ lam m (fun j => U j.succ) (U 0) := by + simpa only [one_smul] using scd_null_expansion θ hθ 1 lam m (fun j => U j.succ) (U 0) + refine Fin.cases ?_ (fun j => ?_) i + · simp only [normPair,leadingPair,Fin.cons_zero,hr,hs,smul_def,map_add,map_sub,map_sum,smul_add,Finset.sum_add_distrib] + abel + · simp only [normPair,leadingPair,Fin.cons_succ,hr,smul_def,map_add] + +/-- The physical leading equations have a scalar planar principal part on all +four actual augmented entries. The constraint is retained separately. -/ +theorem leadingPair_matrix (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (U : Fin 4 → Dist) (i : Fin 4) : + leadingPair θ lam m n o U i=(2 : ℂ) • directiond θ (U i)+ + ∑ k,∑ j,θ k • (coeffA dc lam m n o k i j • U j) := by + have hz0 (k : Fin 3) (u : Dist) : sd (0 : Fin 3 → ℂ) k u=dd k u := by + change dd k u+(0 : ℂ) • u=dd k u + rw [zero_smul ℂ u,add_zero] + have hz := normalized_matrix 0 lam m n o hn ho U i + simp only [hz0] at hz + have ht := normalized_matrix θ lam m n o hn ho U i + rw [normPair_null_leading θ hθ,lapd_null_direction θ hθ] at ht + simp only [sd_apply,smul_def,map_add,map_smul,Finset.sum_add_distrib] at ht + apply add_left_cancel (a := normPair 0 lam m n o (fun j => U j.succ) (U 0) i) + calc + _ = _ := ht + _ = _ := by + rw [hz] + simp only [smul_def] + abel + +lemma leading_matrix_local {B : Set X} (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) (U : Fin 4 → Dist) + (hr : ∀ i,LocalEq B (leadingRd θ lam m (fun j => U j.succ) (U 0) i) 0) + (hs : LocalEq B (leadingSd θ lam m (fun j => U j.succ) (U 0)) 0) (i : Fin 4) : + LocalEq B ((2 : ℂ) • directiond θ (U i)+ + ∑ k,∑ j,θ k • (coeffA dc lam m n o k i j • U j)) 0 := by + rw [← leadingPair_matrix θ hθ lam m n o hn ho] + refine Fin.cases ?_ (fun j => ?_) i + · have hh := (hs.sub ((LocalEq.sum Finset.univ (fun j _ => (hr j).coeff (dc j m))).coeff n |>.smul 2)).coeff o + simpa only [leadingPair,Fin.cons_zero,smul_def,map_zero,smul_zero,Finset.sum_const_zero,sub_zero] using hh + · have hh := (hr j).coeff n + simpa only [leadingPair,Fin.cons_succ,smul_def,map_zero] using hh +end ElasticityDistribution +namespace ElasticityCoordinates +open Set MeasureTheory +open scoped ENNReal SchwartzMap LineDeriv +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +/-- The actual characteristic plane and its transverse kernel are complementary. +No orthonormal-coordinate or slicing-existence premise is imposed. -/ +def planeSplit (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) (hK : Function.LeftInverse K J) : + E ≃L[ℝ] LinearMap.ker K.toLinearMap × ℂ := + LinearEquiv.toContinuousLinearEquiv { + toFun := fun x => (⟨x-J (K x),by + change K (x-J (K x))=0 + rw [map_sub,hK,sub_self]⟩,K x) + invFun := fun q => (q.1 : E)+J q.2 + left_inv := fun x => sub_add_cancel x (J (K x)) + right_inv := fun q => by + have hk : K (q.1 : E)=0 := q.1.property + apply Prod.ext + · apply Subtype.ext + change (q.1 : E)+J q.2-J (K ((q.1 : E)+J q.2))=(q.1 : E) + rw [map_add,hk,zero_add,hK q.2,add_sub_cancel_right] + · change K ((q.1 : E)+J q.2)=q.2 + rw [map_add,hk,zero_add,hK q.2] + map_add' := fun x y => by + apply Prod.ext + · apply Subtype.ext + change x+y-J (K (x+y))=(x-J (K x))+(y-J (K y)) + simp only [map_add] + abel + · exact map_add K x y + map_smul' := fun c x => by + apply Prod.ext + · apply Subtype.ext + change c • x-J (K (c • x))=c • (x-J (K x)) + simp only [map_smul,smul_sub] + · exact map_smul K c x } + +lemma planeSplit_symm (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) (hK : Function.LeftInverse K J) + (q : LinearMap.ker K.toLinearMap × ℂ) : (planeSplit J K hK).symm q=(q.1 : E)+J q.2 := rfl +lemma planeSplit_plane (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) (hK : Function.LeftInverse K J) + (z : ℂ) : planeSplit J K hK (J z)=(0,z) := by + apply Prod.ext + · apply Subtype.ext + change J z-J (K (J z))=0 + rw [hK,sub_self] + · exact hK z +lemma planeSplit_symm_plane (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) (hK : Function.LeftInverse K J) + (z : ℂ) : (planeSplit J K hK).symm (0,z)=J z := by + simp only [planeSplit_symm,ZeroMemClass.coe_zero,zero_add] + +end ElasticityCoordinates +namespace ElasticityDistribution + +section +open TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityAugmented + +lemma directiond_real_complex (α β : X) (u : Dist) : + directiond (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) u= + ∂_{α} u+Complex.I • ∂_{β} u := by + have hα := ElasticityNegativeOrder.basis_expansion α + have hβ := ElasticityNegativeOrder.basis_expansion β + conv_rhs => rw [hα,hβ] + ext φ + simp only [LineDeriv.lineDerivOp_left_sum,LineDeriv.lineDerivOp_left_smul, + directiond,dd_apply] + simp [ElasticitySchwartzCarleman.e,e,Finset.smul_sum,add_mul,mul_assoc,Finset.sum_add_distrib,add_comm] + +lemma exists_direction_coordinates (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) : + ∃ (J : ℂ →L[ℝ] X) (K : X →L[ℝ] ℂ),Function.LeftInverse K J ∧ + J 1=WithLp.toLp 2 (fun i => (θ i).re) ∧ J Complex.I=WithLp.toLp 2 (fun i => (θ i).im) := by + let J := ElasticityParameter.characteristicPlane ElasticityParameter.basis θ + have hJ := ElasticityParameter.null_plane_injective θ hθ hne + obtain ⟨K,hK⟩ := ContinuousLinearMap.HasLeftInverse.of_injective_of_finiteDimensional hJ + refine ⟨J,K,hK,?_,?_⟩ + · rw [show J 1=∑ i,(θ i).re • ElasticityParameter.basis i from ElasticityParameter.characteristicPlane_one _ _] + ext i + exact ElasticityParameter.basis_sum_apply _ i + · rw [show J Complex.I=∑ i,(θ i).im • ElasticityParameter.basis i from ElasticityParameter.characteristicPlane_I _ _] + ext i + exact ElasticityParameter.basis_sum_apply _ i +end +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityAugmented + +lemma half_contraction (C : Fin 3 → Fin 4 → Fin 4 → Coeff) (θ : Fin 3 → ℂ) + (U : Fin 4 → Dist) (i : Fin 4) : + (∑ j,((1/2 : ℂ) • ∑ k,θ k • C k i j) • U j)= + (1/2 : ℂ) • (∑ k,∑ j,θ k • (C k i j • U j)) := by + have he (j : Fin 4) : ((1/2 : ℂ) • ∑ k,θ k • C k i j) • U j= + (1/2 : ℂ) • ∑ k,θ k • (C k i j • U j) := by + rw [smul_assoc] + congr 1 + rw [@Finset.sum_smul (Fin 3) Coeff Dist _ _ _ (fun k => θ k • C k i j) Finset.univ (U j)] + exact Finset.sum_congr rfl (fun k _ => smul_assoc (θ k) (C k i j) (U j)) + simp only [he,← Finset.smul_sum] + congr 1 + simp only [Finset.smul_sum] + exact Finset.sum_comm + +/-- The actual weak leading augmented solution has a globally smooth +representative; the compact exterior difference is preserved exactly. -/ +theorem weak_leading_smooth {K B B₀ : Set X} (hK : IsCompact K) (hB₀ : IsOpen B₀) (hKB : K⊆B₀) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (lam m n o : Coeff) (hn : n*m=1) (ho : o*(lam+m+m)=1) + (W : Fin 4 → L2Space) (a : Fin 4 → Test) + (hext : ∀ i,LocalEq Kᶜ (W i : Dist) (a i : Dist)) + (hr : ∀ i,LocalEq B (leadingRd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist) i) 0) + (hs : LocalEq B (leadingSd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist)) 0) + (g : X → ℂ) (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hgs : tsupport g⊆B) (h1 : EqOn g 1 B₀) : + ∃ v : Fin 4 → Test,(∀ i,(W i : Dist)=(v i : Dist)) ∧ + ∀ i,tsupport (v i-a i : Test)⊆K := by + obtain ⟨J,Q,hQ,hα,hβ⟩ := exists_direction_coordinates θ hθ hne + let L := (ElasticityCoordinates.planeSplit J Q hQ).symm + let A := fun i j => (1/2 : ℂ) • ∑ k,θ k • coeffA dc lam m n o k i j + have hD (u : Dist) : planeDerivative (L (0,1)) (L (0,Complex.I)) u=directiond θ u := by + rw [show L (0,1)=J 1 from ElasticityCoordinates.planeSplit_symm_plane J Q hQ 1, + show L (0,Complex.I)=J Complex.I from ElasticityCoordinates.planeSplit_symm_plane J Q hQ Complex.I,hα,hβ] + have hh := directiond_real_complex (WithLp.toLp 2 (fun i => (θ i).re)) + (WithLp.toLp 2 (fun i => (θ i).im)) u + have he : (fun i => ((θ i).re : ℂ)+Complex.I*((θ i).im : ℂ))=θ := by + funext i + simpa only [mul_comm] using (Complex.re_add_im (θ i)) + change ∂_{WithLp.toLp 2 (fun i => (θ i).re)} u+Complex.I • + ∂_{WithLp.toLp 2 (fun i => (θ i).im)} u=directiond θ u + simpa only [he] using hh.symm + have hA (U : Fin 4 → Dist) (i : Fin 4) := half_contraction (coeffA dc lam m n o) θ U i + have hE (i) : LocalEq B (planeDerivative (L (0,1)) (L (0,Complex.I)) (W i : Dist)+ + ∑ j,A i j • (W j : Dist)) 0 := by + have hh := (leading_matrix_local θ hθ lam m n o hn ho (fun i => (W i : Dist)) hr hs i).smul (1/2) + rw [hD,hA] + intro φ hφ hφs + have he := hh φ hφ hφs + simp only [smul_apply,add_apply,smul_eq_mul,zero_apply] at he ⊢ + linear_combination he + exact compact_transport_smoothing L hK hB₀ hKB A W a hext hE g hg hc hgs h1 +end ElasticityDistribution +namespace ElasticityDistribution +open Set TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityAugmented ElasticityPhysicalAlgebra ElasticityNegativeOrder + +def schwartzDirection (θ : Fin 3 → ℂ) (u : Test) : Test := ∑ i,θ i • ∂_{e i} u +def schwartzLeadingR (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) (i : Fin 3) : Test := + mult (eval (2*m)) (schwartzDirection θ (u i))+mult (eval (direction dc θ m)) (u i)+ + θ i • (mult (eval (lam+m)) b+∑ j,mult (eval (dc j m)) (u j)) +def schwartzLeadingS (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) : Test := + mult (eval (2*(lam+m+m))) (schwartzDirection θ b)+mult (eval (2*direction dc θ (lam+m))) b+ + mult (eval (4 : Coeff)) (∑ i,mult (eval (dc i m)) (schwartzDirection θ (u i)))+ + mult (eval (2 : Coeff)) (∑ i,mult (eval (direction dc θ (dc i m))) (u i)) +lemma schwartzDirection_dist (θ : Fin 3 → ℂ) (u : Test) : + (schwartzDirection θ u : Dist)=directiond θ (u : Dist) := by + simp only [schwartzDirection,directiond,coe_schwartz_sum,coe_schwartz_smul,dd_apply, + lineDerivOp_toTemperedDistributionCLM_eq] +lemma schwartzLeadingR_dist (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) (i : Fin 3) : + (schwartzLeadingR θ lam m u b i : Dist)=leadingRd θ lam m (fun j => (u j : Dist)) (b : Dist) i := by + simp only [schwartzLeadingR,leadingRd,coe_schwartz_add,coe_schwartz_smul,coe_schwartz_sum, + ← coeff_schwartz,schwartzDirection_dist] +lemma schwartzLeadingS_dist (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) : + (schwartzLeadingS θ lam m u b : Dist)=leadingSd θ lam m (fun j => (u j : Dist)) (b : Dist) := by + simp only [schwartzLeadingS,leadingSd,coe_schwartz_add,coe_schwartz_sum, + ← coeff_schwartz,schwartzDirection_dist] +lemma schwartzDirection_smooth (θ : Fin 3 → ℂ) (u : Test) : + toSmooth (schwartzDirection θ u)=direction coord θ (toSmooth u) := by + simp only [schwartzDirection,direction,map_sum,map_smul] + congr 1 +lemma direction_coeff_val (θ : Fin 3 → ℂ) (m : Coeff) : + (direction dc θ m).val=direction coord θ m.val := by + apply Subtype.ext + rfl +lemma toSmooth_coeff_mult (a : Coeff) (u : Test) : + toSmooth (mult (eval a) u)=a.val*toSmooth u := + toSmooth_mult a.val (growth a) u +lemma dc_coeff_val (i : Fin 3) (m : Coeff) : (dc i m).val=coord i m.val := rfl +lemma schwartzLeadingR_smooth (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) (i : Fin 3) : + toSmooth (schwartzLeadingR θ lam m u b i)=leadingR coord θ lam.val m.val (fun j => toSmooth (u j)) (toSmooth b) i := by + simp only [schwartzLeadingR,map_add,map_smul,map_sum, + toSmooth_coeff_mult,schwartzDirection_smooth,leadingR,direction_coeff_val,dc_coeff_val] + rfl +lemma schwartzLeadingS_smooth (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Test) (b : Test) : + toSmooth (schwartzLeadingS θ lam m u b)=leadingS coord θ lam.val m.val (fun j => toSmooth (u j)) (toSmooth b) := by + simp only [schwartzLeadingS,map_add,map_sum, + toSmooth_coeff_mult,schwartzDirection_smooth,leadingS,direction_coeff_val,dc_coeff_val] + simp only [Finset.mul_sum] + rfl +lemma leading_classical {B : Set X} (hB : IsOpen B) (θ : Fin 3 → ℂ) (lam m : Coeff) + (u : Fin 3 → Test) (b : Test) + (hr : ∀ i,LocalEq B (leadingRd θ lam m (fun j => (u j : Dist)) (b : Dist) i) 0) + (hs : LocalEq B (leadingSd θ lam m (fun j => (u j : Dist)) (b : Dist)) 0) : + (∀ i,EqOn ((leadingR coord θ lam.val m.val (fun j => toSmooth (u j)) (toSmooth b) i).val) 0 B) ∧ + EqOn ((leadingS coord θ lam.val m.val (fun j => toSmooth (u j)) (toSmooth b)).val) 0 B := by + have h0 : ((0 : Test) : Dist)=0 := map_zero _ + constructor + · intro i + have hh : ElasticityRegularity.LocalEqual B (schwartzLeadingR θ lam m u b i : Dist) ((0 : Test) : Dist) := by + simpa only [schwartzLeadingR_dist,h0,LocalEq,ElasticityRegularity.LocalEqual] using hr i + have hh' := hh.schwartz_eqOn hB + intro x hx + rw [← schwartzLeadingR_smooth] + exact hh' hx + · have hh : ElasticityRegularity.LocalEqual B (schwartzLeadingS θ lam m u b : Dist) ((0 : Test) : Dist) := by + simpa only [schwartzLeadingS_dist,h0,LocalEq,ElasticityRegularity.LocalEqual] using hs + intro x hx + rw [← schwartzLeadingS_smooth] + exact hh.schwartz_eqOn hB hx +end ElasticityDistribution +section +open Set Filter TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators Topology +namespace ElasticityCGO +open ElasticityAugmented +open ElasticityPhysicalAlgebra (temperate_partial) +open ElasticityNegativeOrder (mult_apply) + +lemma localizedLeading_eqOn {B : Set X} (hB : IsOpen B) (R : ℝ) (hR : 1≤R) + (hBR : B⊆Metric.ball 0 R) (a : ℕ → Amplitude Smooth) (g : Smooth) + (hc : HasCompactSupport (g : X → ℂ)) (hg : EqOn (g : X → ℂ) 1 B) (i : Fin 4) : + EqOn (localizedLeading R hR a g i : X → ℂ) + ((Fin.cons (a 0).2 (a 0).1 : Fin 4 → Smooth) i : X → ℂ) B := by + have ht := hc.hasTemperateGrowth (smooth_coe g) + have hd (x : X) (hx : x∈B) (j : Fin 3) : fderiv ℝ (g : X → ℂ) x (e j)=0 := by + have hh : (g : X → ℂ)=ᶠ[𝓝 x] (fun _ => (1 : ℂ)) := + Filter.mem_of_superset (hB.mem_nhds hx) hg + rw [hh.fderiv_eq] + simp only [fderiv_fun_const] + rfl + have hχ (x : X) (hx : x∈B) : fiveCutoff R hR 0 x=1 := fiveCutoff_initial R hR (hBR hx) + intro x hx + refine Fin.cases ?_ (fun j => ?_) i + · simp only [localizedLeading,Fin.cons_zero,add_apply,sum_apply,mult_apply _ ht, + mult_apply _ (temperate_partial _ ht _),cut_apply,hd x hx,hg hx,Pi.one_apply,hχ x hx, + zero_mul,one_mul,Finset.sum_const_zero,add_zero] + · simp only [localizedLeading,Fin.cons_succ,mult_apply _ ht,cut_apply,hg hx,Pi.one_apply,hχ x hx,one_mul] +end ElasticityCGO +namespace ElasticityDistribution +open ElasticityAugmented +open ElasticityPhysicalAlgebra (toSmooth) +lemma normal_classical {B : Set X} (hB : IsOpen B) (θ : Fin 3 → ℂ) (u : Fin 3 → Test) + (hn : LocalEq B (normald θ (fun j => (u j : Dist))) 0) : + EqOn (normal θ (fun j => toSmooth (u j))).val 0 B := by + let w : Test := ∑ i,θ i • u i + have hw : (w : Dist)=normald θ (fun j => (u j : Dist)) := by + simp only [w,normald,coe_schwartz_sum,coe_schwartz_smul] + have hl : ElasticityRegularity.LocalEqual B (w : Dist) ((0 : Test) : Dist) := by + simpa only [hw,map_zero,LocalEq,ElasticityRegularity.LocalEqual] using hn + have he : toSmooth w=normal θ (fun j => toSmooth (u j)) := by + simp only [w,normal,map_sum,map_smul] + intro x hx + rw [← he] + exact hl.schwartz_eqOn hB hx +end ElasticityDistribution + +end +open Set Filter TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators Topology +namespace ElasticityAugmented +lemma direction_eqOn {B : Set X} (hB : IsOpen B) (θ : Fin 3 → ℂ) {a b : Smooth} + (h : EqOn (a : X → ℂ) (b : X → ℂ) B) : + EqOn (direction (A := Smooth) coord θ a : X → ℂ) (direction (A := Smooth) coord θ b : X → ℂ) B := by + intro x hx + have he : (a : X → ℂ)=ᶠ[𝓝 x] (b : X → ℂ) := Filter.mem_of_superset (hB.mem_nhds hx) h + change (∑ i,θ i*fderiv ℝ (a : X → ℂ) x (e i))=(∑ i,θ i*fderiv ℝ (b : X → ℂ) x (e i)) + rw [he.fderiv_eq] +lemma leadingR_eqOn {B : Set X} (hB : IsOpen B) (θ : Fin 3 → ℂ) (lam m : Smooth) + {a a' : Fin 3 → Smooth} {b b' : Smooth} + (ha : ∀ i,EqOn (a i : X → ℂ) (a' i : X → ℂ) B) + (hb : EqOn (b : X → ℂ) (b' : X → ℂ) B) (i) : + EqOn (leadingR (A := Smooth) coord θ lam m a b i : X → ℂ) (leadingR (A := Smooth) coord θ lam m a' b' i : X → ℂ) B := by + intro x hx + change ((2*m : Smooth) : X → ℂ) x*(direction (A := Smooth) coord θ (a i) : X → ℂ) x+ + (direction (A := Smooth) coord θ m : X → ℂ) x*(a i : X → ℂ) x+θ i*(((lam+m : Smooth) : X → ℂ) x*(b : X → ℂ) x+ + ∑ j,(coord j m : X → ℂ) x*(a j : X → ℂ) x)=_ + rw [direction_eqOn hB θ (ha i) hx,ha i hx,hb hx] + have hs : (∑ j,(coord j m : X → ℂ) x*(a j : X → ℂ) x)= + ∑ j,(coord j m : X → ℂ) x*(a' j : X → ℂ) x := + Finset.sum_congr rfl (fun j _ => congrArg ((coord j m : X → ℂ) x*·) (ha j hx)) + rw [hs] + rfl +lemma leadingS_eqOn {B : Set X} (hB : IsOpen B) (θ : Fin 3 → ℂ) (lam m : Smooth) + {a a' : Fin 3 → Smooth} {b b' : Smooth} + (ha : ∀ i,EqOn (a i : X → ℂ) (a' i : X → ℂ) B) + (hb : EqOn (b : X → ℂ) (b' : X → ℂ) B) : + EqOn (leadingS (A := Smooth) coord θ lam m a b : X → ℂ) (leadingS (A := Smooth) coord θ lam m a' b' : X → ℂ) B := by + intro x hx + change ((2*(lam+m+m) : Smooth) : X → ℂ) x*(direction (A := Smooth) coord θ b : X → ℂ) x+ + ((2*direction (A := Smooth) coord θ (lam+m) : Smooth) : X → ℂ) x*(b : X → ℂ) x+ + 4*(∑ i,(coord i m : X → ℂ) x*(direction (A := Smooth) coord θ (a i) : X → ℂ) x)+ + 2*(∑ i,(direction (A := Smooth) coord θ (coord i m) : X → ℂ) x*(a i : X → ℂ) x)=_ + rw [direction_eqOn hB θ hb hx,hb hx] + have hd := fun i => direction_eqOn hB θ (ha i) hx + simp only [hd,fun i => ha i hx] + rfl +end ElasticityAugmented +namespace ElasticityDistribution +open ElasticityAugmented +open ElasticityPhysicalAlgebra (toSmooth) +/-- Patch the actual smooth representative to the original unlocalized +amplitude, without pretending the localization derivative vanishes globally. -/ +theorem smooth_column_patch {K B : Set X} (hB : IsOpen B) (hKB : K⊆B) + (θ : Fin 3 → ℂ) (lam m : Coeff) (v φ : Fin 4 → Test) (a₀ : Fin 4 → Smooth) + (hs : ∀ i,tsupport (v i-φ i : Test)⊆K) + (hφ : ∀ i,EqOn (φ i : X → ℂ) (a₀ i : X → ℂ) B) + (hr : ∀ i,LocalEq B (leadingRd θ lam m (fun j => (v j.succ : Dist)) (v 0 : Dist) i) 0) + (he : LocalEq B (leadingSd θ lam m (fun j => (v j.succ : Dist)) (v 0 : Dist)) 0) + (hn : LocalEq B (normald θ (fun j => (v j.succ : Dist))) 0) + (hn₀ : normal θ (fun j => a₀ j.succ)=0) : + ∃ a : Fin 4 → Smooth, + (∀ i,tsupport ((a i-a₀ i : Smooth) : X → ℂ)⊆K) ∧ + (∀ i,EqOn (leadingR (A := Smooth) coord θ lam.val m.val (fun j => a j.succ) (a 0) i : X → ℂ) 0 B) ∧ + EqOn (leadingS (A := Smooth) coord θ lam.val m.val (fun j => a j.succ) (a 0) : X → ℂ) 0 B ∧ + normal θ (fun j => a j.succ)=0 := by + let a := fun i => a₀ i+toSmooth (v i-φ i) + have ha (i) : EqOn (a i : X → ℂ) (toSmooth (v i) : X → ℂ) B := by + intro x hx + change (a₀ i : X → ℂ) x+(v i x-φ i x)=v i x + rw [hφ i hx] + ring + have hsp (i) : tsupport ((a i-a₀ i : Smooth) : X → ℂ)⊆K := by + have hh : ((a i-a₀ i : Smooth) : X → ℂ)=(v i-φ i : Test) := by + funext x + change (a₀ i : X → ℂ) x+(v i x-φ i x)-(a₀ i : X → ℂ) x=v i x-φ i x + ring + rw [hh] + exact hs i + obtain ⟨hR,hS⟩ := leading_classical hB θ lam m (fun j => v j.succ) (v 0) hr he + refine ⟨a,hsp,fun i => (leadingR_eqOn hB θ lam.val m.val (fun j => ha j.succ) (ha 0) i).trans (hR i), + (leadingS_eqOn hB θ lam.val m.val (fun j => ha j.succ) (ha 0)).trans hS,?_⟩ + apply Subtype.ext + funext x + by_cases hx : x∈B + · have hh := normal_classical hB θ (fun j => v j.succ) hn hx + change (∑ j,θ j*(a j.succ : X → ℂ) x)=0 + change (∑ j,θ j*v j.succ x)=0 at hh + rw [show (∑ j,θ j*(a j.succ : X → ℂ) x)=(∑ j,θ j*v j.succ x) from + Finset.sum_congr rfl (fun j _ => congrArg (θ j*·) (ha j.succ hx))] + exact hh + · have hh (i) : (a i : X → ℂ) x=(a₀ i : X → ℂ) x := by + have hz := image_eq_zero_of_notMem_tsupport (f := ((a i-a₀ i : Smooth) : X → ℂ)) + (fun hn => hx (hKB (hsp i hn))) + exact sub_eq_zero.mp hz + change (∑ j,θ j*(a j.succ : X → ℂ) x)=0 + simp only [hh] + exact congrArg (fun f : Smooth => (f : X → ℂ) x) hn₀ +end ElasticityDistribution + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Solvability.lean b/lean/OAI/MathematicalPhysics/Elasticity/Solvability.lean new file mode 100644 index 0000000000000000000000000000000000000000..4843cb66560e319fe5f3985cd79c0cd9cb9ec783 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Solvability.lean @@ -0,0 +1,709 @@ +import OAI.MathematicalPhysics.Elasticity.Regularity + +namespace OAI + +noncomputable section + +/-! The Hahn--Banach / Riesz step used by the physical solvability argument. +This proves the functional-analytic implication, rather than postulating +existence of a right inverse. The physical test estimate is proved separately. -/ +namespace ElasticityDualSolvability + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +/-- A lower norm estimate on an (unbounded) test operator gives a weak solution +for every Hilbert-space forcing, with precisely the same constant. No density +or completeness of the test space, or closedness of the range, is assumed. -/ +theorem exists_weak_solution (D : Submodule ℂ H) (A : D →ₗ[ℂ] H) + (C : ℝ) (hC : 0 ≤ C) (hA : ∀ v : D, ‖(v : H)‖ ≤ C * ‖A v‖) (f : H) : + ∃ z : H, ‖z‖ ≤ C * ‖f‖ ∧ ∀ v : D, inner ℂ z (A v) = inner ℂ f (v : H) := by + have hinj : Function.Injective A := by + intro v w hvw + apply sub_eq_zero.mp + apply Subtype.val_injective + apply norm_eq_zero.mp + have ht := hA (v-w) + rw [map_sub, hvw, sub_self, norm_zero, mul_zero] at ht + exact le_antisymm ht (norm_nonneg _) + let T := (LinearEquiv.ofInjective A hinj).symm + let l : A.range →ₗ[ℂ] ℂ := + ((innerSL ℂ f).toLinearMap.comp D.subtype).comp T.toLinearMap + have hT (y : A.range) : A (T y) = (y : H) := by + exact congrArg Subtype.val ((LinearEquiv.ofInjective A hinj).apply_symm_apply y) + have hl : ∀ y : A.range, ‖l y‖ ≤ (C*‖f‖)*‖y‖ := by + intro y + change ‖inner ℂ f ((T y : D) : H)‖ ≤ _ + calc + _ ≤ ‖f‖ * ‖((T y : D) : H)‖ := norm_inner_le_norm _ _ + _ ≤ ‖f‖ * (C*‖A (T y)‖) := mul_le_mul_of_nonneg_left (hA (T y)) (norm_nonneg _) + _ = _ := by rw [hT]; change ‖f‖ * (C * ‖y‖) = _; ring + let L : A.range →L[ℂ] ℂ := l.mkContinuous (C*‖f‖) hl + obtain ⟨G, hG, hnorm⟩ := exists_extension_norm_eq A.range L + let z : H := (InnerProductSpace.toDual ℂ H).symm G + refine ⟨z, ?_, fun v => ?_⟩ + · calc + ‖z‖ = ‖G‖ := (InnerProductSpace.toDual ℂ H).symm.norm_map _ + _ = ‖L‖ := hnorm + _ ≤ C*‖f‖ := l.mkContinuous_norm_le (mul_nonneg hC (norm_nonneg _)) hl + · change inner ℂ ((InnerProductSpace.toDual ℂ H).symm G) (A v) = _ + rw [InnerProductSpace.toDual_symm_apply] + change G ((LinearEquiv.ofInjective A hinj v : A.range) : H) = _ + rw [hG] + change inner ℂ f ((T (LinearEquiv.ofInjective A hinj v) : D) : H) = _ + rw [LinearEquiv.symm_apply_apply] + +end ElasticityDualSolvability + +open MeasureTheory Complex SchwartzMap +open scoped BigOperators FourierTransform SchwartzMap LineDeriv ENNReal +namespace ElasticityPhysicalDual +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +open ElasticityPhysicalAlgebra ElasticityPhysicalEstimate +abbrev X := ElasticityBessel.X +abbrev H := PiLp 2 (fun _ : Fin 3 => Lp ℂ 2 (volume : Measure X)) + +def embed : (Fin 3 → S) →ₗ[ℂ] H where + toFun u := WithLp.toLp 2 (fun i => L2 (u i)) + map_add' u v := by apply PiLp.ext; intro i; exact map_add L2 _ _ + map_smul' a u := by apply PiLp.ext; intro i; exact map_smul L2 _ _ + +lemma embed_apply (u : Fin 3 → S) (i : Fin 3) : embed u i = L2 (u i) := rfl + +lemma embed_injective : Function.Injective embed := by + intro u v h + funext i + apply SchwartzMap.injective_toLp 2 volume + exact congrArg (fun w : H => w i) h + +lemma norm_embed (h : ℝ) (u : Fin 3 → S) : ‖embed u‖ = sobNorm h 0 u := by + rw [PiLp.norm_eq_of_L2] + simp only [embed_apply, sobNorm, J_zero, norm2] + +lemma inner_embed (u v : Fin 3 → S) : + inner ℂ (embed u) (embed v) = ∑ i, pair (u i) (v i) := by + rw [PiLp.inner_apply] + apply Finset.sum_congr rfl + intro i _ + exact ip_integral _ _ + +def adjPhase (z : Fin 3 → ℂ) (i : Fin 3) : ℂ := -star (z i) + +lemma pair_neg_left (f g : S) : pair (-f) g = -pair f g := by + simpa only [neg_one_smul, star_neg, star_one, neg_mul, one_mul] using pair_smul_left f g (-1) + +lemma pair_neg_right (f g : S) : pair f (-g) = -pair f g := by + simpa only [neg_one_smul, neg_mul, one_mul] using pair_smul_right f g (-1) + +lemma pair_shift (z : Fin 3 → ℂ) (i : Fin 3) (f g : S) : + pair f (shiftD z i g) = -pair (shiftD (adjPhase z) i f) g := by + simp only [shiftD_apply, pair_add_right, pair_add_left, pair_smul_left, + pair_smul_right, pair_d, adjPhase, star_neg, star_star] + ring + +lemma pair_mult (a : X → ℂ) (ha : a.HasTemperateGrowth) (hr : ∀ x, star (a x) = a x) + (f g : S) : pair f (mult a g) = pair (mult a f) g := by + unfold pair + apply integral_congr_ae + filter_upwards [] with x + simp only [mult_apply a ha, star_mul, hr] + ring + +lemma pair_two_shift (z : Fin 3 → ℂ) (i j : Fin 3) (a : X → ℂ) + (ha : a.HasTemperateGrowth) (hr : ∀ x, star (a x) = a x) (f g : S) : + pair f (shiftD z i (mult a (shiftD z j g))) = + pair (shiftD (adjPhase z) j (mult a (shiftD (adjPhase z) i f))) g := by + rw [pair_shift, pair_mult a ha hr, pair_shift, neg_neg] + +lemma pair_eq_ip (f g : S) : pair f g = ip f g := (ip_integral f g).symm + +lemma pair_sum_left {ι : Type*} (s : Finset ι) (f : ι → S) (g : S) : + pair (∑ i ∈ s, f i) g = ∑ i ∈ s, pair (f i) g := by + simpa only [pair_eq_ip, ip, map_sum] using + (sum_inner (𝕜 := ℂ) (s := s) (f := fun i => L2 (f i)) (L2 g)) + +lemma pair_sum_right {ι : Type*} (s : Finset ι) (f : S) (g : ι → S) : + pair f (∑ i ∈ s, g i) = ∑ i ∈ s, pair f (g i) := by + simpa only [pair_eq_ip, ip, map_sum] using + (inner_sum (𝕜 := ℂ) (s := s) (f := fun i => L2 (g i)) (L2 f)) + +lemma physical_adjoint (z : Fin 3 → ℂ) (lam m : X → ℂ) + (hl : lam.HasTemperateGrowth) (hm : m.HasTemperateGrowth) + (hrl : ∀ x, star (lam x) = lam x) (hrm : ∀ x, star (m x) = m x) + (u v : Fin 3 → S) : + inner ℂ (embed v) (embed (physical z lam m u)) = + inner ℂ (embed (physical (adjPhase z) lam m v)) (embed u) := by + simp only [inner_embed, physical, map_sum, map_add, pair_add_left, pair_add_right, + pair_sum_left, pair_sum_right, pair_two_shift z _ _ lam hl hrl, + pair_two_shift z _ _ m hm hrm, Finset.sum_add_distrib] + congr 1 + · rw [Finset.sum_comm] + · congr 1 + rw [Finset.sum_comm] + +/-- Supported Schwartz vectors, regarded as an actual subspace of L2. -/ +def supported (R : ℝ) : Submodule ℂ (Fin 3 → S) where + carrier := {u | ∀ i, BallSupported R (u i)} + zero_mem' _i := BallSupported.zero R + add_mem' hu hv i := (hu i).add (hv i) + smul_mem' a _u hu i := (hu i).smul a + +lemma physical_add (z : Fin 3 → ℂ) (lam m : X → ℂ) (u v : Fin 3 → S) : + physical z lam m (u+v) = physical z lam m u + physical z lam m v := by + funext i + simp only [physical, Pi.add_apply, map_add, Finset.sum_add_distrib] + abel + +lemma physical_smul (z : Fin 3 → ℂ) (lam m : X → ℂ) (a : ℂ) (u : Fin 3 → S) : + physical z lam m (a • u) = a • physical z lam m u := by + funext i + simp only [physical, Pi.smul_apply, map_smul, ← smul_add, ← Finset.smul_sum] + +/-- Exact shifted stress-divergence as a linear map, for duality on its range. -/ +def physicalLM (z : Fin 3 → ℂ) (lam m : X → ℂ) : (Fin 3 → S) →ₗ[ℂ] (Fin 3 → S) where + toFun := physical z lam m + map_add' := physical_add z lam m + map_smul' := physical_smul z lam m + +/-- The physical weak equation follows from the actual uniform test estimate. +The forcing and unknown belong to the genuine vector-valued L2 Hilbert space. -/ +theorem weak_physical_from_test (R h : ℝ) (z : Fin 3 → ℂ) (lam m : X → ℂ) + (C : ℝ) (hC : 0 ≤ C) + (htest : ∀ u : Fin 3 → S, (∀ i, BallSupported R (u i)) → + sobNorm h 0 u ≤ C*sobNorm h 0 (physical (adjPhase z) lam m u)) (F : H) : + ∃ w : H, ‖w‖ ≤ C*‖F‖ ∧ ∀ v : Fin 3 → S, (∀ i, BallSupported R (v i)) → + inner ℂ w (embed (physical (adjPhase z) lam m v)) = inner ℂ F (embed v) := by + let V := supported R + let T : V →ₗ[ℂ] H := embed.comp V.subtype + have hinj : Function.Injective T := by + intro v w hvw + exact Subtype.val_injective (embed_injective hvw) + let E := LinearEquiv.ofInjective T hinj + let B : T.range →ₗ[ℂ] H := + (((embed.comp (physicalLM (adjPhase z) lam m)).comp V.subtype).comp E.symm.toLinearMap) + have hT (y : T.range) : T (E.symm y) = (y : H) := + congrArg Subtype.val (E.apply_symm_apply y) + have hB (y : T.range) : ‖(y : H)‖ ≤ C*‖B y‖ := by + rw [← hT y] + change ‖embed ((E.symm y : V) : Fin 3 → S)‖ ≤ + C * ‖embed (physical (adjPhase z) lam m ((E.symm y : V) : Fin 3 → S))‖ + rw [norm_embed h, norm_embed h] + exact htest _ (E.symm y).property + obtain ⟨w, hw, heq⟩ := ElasticityDualSolvability.exists_weak_solution T.range B C hC hB F + refine ⟨w, hw, fun v hv => ?_⟩ + let v' : V := ⟨v, hv⟩ + have hh := heq (E v') + change inner ℂ w (embed (physical (adjPhase z) lam m ((E.symm (E v') : V) : Fin 3 → S))) = + inner ℂ F (T v') at hh + rw [E.symm_apply_apply] at hh + exact hh + +lemma adjPhase_phase (h : ℝ) (α β : X) : + adjPhase (phase h α β) = phase h (-α) β := by + funext i + simp only [adjPhase, phase, Complex.star_def, map_div₀, map_add, map_mul, + Complex.conj_ofReal, Complex.conj_I, PiLp.neg_apply, Complex.ofReal_neg] + ring + +end ElasticityPhysicalDual + +open MeasureTheory Complex SchwartzMap +open scoped BigOperators SchwartzMap LineDeriv +open scoped SchwartzMap LineDeriv BigOperators +open MeasureTheory Complex SchwartzMap +open scoped BigOperators SchwartzMap LineDeriv +namespace ElasticityDistribution + +section + +open ElasticityPhysicalAlgebra ElasticityPhysicalDual ElasticityNegativeOrder +abbrev S := 𝓢(X,ℂ) +def cj (φ : S) : S := φ.postcompCLM Complex.conjCLE.toContinuousLinearMap +@[simp] lemma cj_apply (φ : S) (x : X) : cj φ x = star (φ x) := rfl +lemma cj_add (φ ψ : S) : cj (φ+ψ) = cj φ+cj ψ := by ext x; simp +lemma cj_smul (c : ℂ) (φ : S) : cj (c • φ) = star c • cj φ := by ext x; simp +lemma cj_sum {ι : Type*} (s : Finset ι) (φ : ι → S) : cj (∑ i ∈ s, φ i) = ∑ i ∈ s, cj (φ i) := by + ext x + simp +lemma cj_cj (φ : S) : cj (cj φ) = φ := by ext x; simp +lemma cj_deriv (i : Fin 3) (φ : S) : cj (∂_{ElasticityAugmented.e i} φ) = ∂_{ElasticityAugmented.e i} (cj φ) := by + ext x + change star (fderiv ℝ φ x (ElasticityAugmented.e i)) = fderiv ℝ (cj φ) x (ElasticityAugmented.e i) + have h := Complex.conjCLE.toContinuousLinearMap.hasFDerivAt.comp x (φ.hasFDerivAt x) + exact (congrArg (fun T : X →L[ℝ] ℂ => T (ElasticityAugmented.e i)) h.fderiv).symm +lemma cj_shift (z : Fin 3 → ℂ) (i : Fin 3) (φ : S) : + cj (shiftD z i φ) = shiftD (fun i => star (z i)) i (cj φ) := by + simp only [shiftD_apply,cj_add,cj_smul] + congr 1 + exact cj_deriv i φ +lemma cj_mult (a : X → ℂ) (ha : a.HasTemperateGrowth) (hr : ∀ x, star (a x)=a x) (φ : S) : + cj (mult a φ) = mult a (cj φ) := by + ext x + simp only [cj_apply,mult_apply a ha,star_mul,hr] + exact mul_comm _ _ +lemma cj_physical (z : Fin 3 → ℂ) (lam m : X → ℂ) + (hl : lam.HasTemperateGrowth) (hm : m.HasTemperateGrowth) + (hrl : ∀ x, star (lam x)=lam x) (hrm : ∀ x, star (m x)=m x) (φ : Fin 3 → S) + {index : Fin 3} : + cj (physical z lam m φ index) = + physical (fun i => star (z i)) lam m (fun i => cj (φ i)) index := by + simp only [physical,cj_add,cj_shift,cj_mult lam hl hrl,cj_mult m hm hrm,cj_sum] +lemma cj_supported {R : ℝ} {φ : S} (h : BallSupported R φ) : BallSupported R (cj φ) := by + intro x hx + exact h x (fun h0 => hx (by simp [h0])) +lemma Lp_test (w : Lp ℂ 2 (volume : Measure X)) (φ : S) : + (w : Dist) φ = inner ℂ (ElasticityBessel.L2 (cj φ)) w := by + rw [Lp.toTemperedDistribution_apply,MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [(cj φ).coeFn_toLp 2 volume] with x hx + change φ x • w x = inner ℂ ((ElasticityBessel.L2 (cj φ)) x) (w x) + change (ElasticityBessel.L2 (cj φ) : X → ℂ) x = cj φ x at hx + rw [hx] + simp only [cj_apply,RCLike.inner_apply',starRingEnd_apply,star_star,smul_eq_mul,mul_comm] + +open ElasticityAugmented TemperedDistribution +open ElasticityPhysicalAlgebra (shiftD shiftD_apply) +open ElasticityNegativeOrder (mult) + +lemma sd_test (z : Fin 3 → ℂ) (i : Fin 3) (u : Dist) (φ : S) : + (sd z i u) φ = -u (shiftD (-z) i φ) := by + simp only [sd_apply,dd_apply,lineDerivOp_apply_apply,add_apply,smul_apply, + shiftD_apply,map_neg,map_add,map_smul,Pi.neg_apply,neg_smul] + change -u (∂_{e i} φ)+z i • u φ = -(u (∂_{e i} φ)+ -(z i • u φ)) + abel +lemma coeff_test (a : Coeff) (u : Dist) (φ : S) : + (a • u) φ = u (mult (eval a) φ) := rfl +lemma coeff_smul_add (a : Coeff) (u v : Dist) : a • (u+v)=a•u+a•v := + (TemperedDistribution.smulLeftCLM ℂ (eval a)).map_add u v +lemma two_sd_test (z : Fin 3 → ℂ) (i j : Fin 3) (a : Coeff) (u : Dist) (φ : S) : + (sd z i (a • sd z j u)) φ = + u (shiftD (-z) j (mult (eval a) (shiftD (-z) i φ))) := by + rw [sd_test,coeff_test,sd_test,neg_neg] + +/-- Formal transpose of the actual complex physical distribution operator. +It is proved by evaluation on Schwartz tests, so no integration-by-parts +regularity of the unknown is assumed. -/ +theorem physical_transpose (z : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (φ : Fin 3 → S) : + (∑ i, phys z lam m u i (φ i)) = + ∑ i, u i (ElasticityPhysicalAlgebra.physical (-z) (eval lam) (eval m) φ i) := by + have h_lam : (∑ i, ∑ j, u j (shiftD (-z) j (mult (eval lam) (shiftD (-z) i (φ i))))) = + ∑ i, ∑ j, u i (shiftD (-z) i (mult (eval lam) (shiftD (-z) j (φ j)))) := + Finset.sum_comm + have hm : (∑ i, ∑ j, u j (shiftD (-z) i (mult (eval m) (shiftD (-z) j (φ i))))) = + ∑ i, ∑ j, u i (shiftD (-z) j (mult (eval m) (shiftD (-z) i (φ j)))) := + Finset.sum_comm + simp only [phys,divd,Finset.smul_sum,map_sum,coeff_smul_add,map_add,sum_apply,add_apply, + two_sd_test,Finset.sum_add_distrib, + ElasticityPhysicalAlgebra.physical] + rw [h_lam,hm] + +end + +open ElasticityPhysicalAlgebra ElasticityPhysicalDual ElasticityNegativeOrder + +/-- The actual Hilbert weak equation is the actual physical distribution equation. +This lemma does not assume regularity of the unknown and does not replace the +physical stress-divergence operator by an abstract PDE hypothesis. -/ +theorem weak_to_vector_distribution (R : ℝ) (z : Fin 3 → ℂ) (lam m : Coeff) + (hrl : ∀ x, star (eval lam x)=eval lam x) (hrm : ∀ x, star (eval m x)=eval m x) + (w F : H) + (heq : ∀ v : Fin 3 → S, (∀ i, BallSupported R (v i)) → + inner ℂ w (embed (physical (adjPhase z) (eval lam) (eval m) v)) = inner ℂ F (embed v)) + (φ : Fin 3 → S) (hφ : ∀ i, BallSupported R (φ i)) : + (∑ i, phys z lam m (fun j => (w j : Dist)) i (φ i)) = + ∑ i, (F i : Dist) (φ i) := by + rw [physical_transpose] + simp only [Lp_test] + have h := congrArg star (heq (fun i => cj (φ i)) (fun i => cj_supported (hφ i))) + have hs (a b : H) : star (inner ℂ a b)=inner ℂ b a := + inner_conj_symm (𝕜 := ℂ) b a + simp only [hs] at h + rw [PiLp.inner_apply,PiLp.inner_apply] at h + have hh (i : Fin 3) : physical (adjPhase z) (eval lam) (eval m) (fun j => cj (φ j)) i = + cj (physical (-z) (eval lam) (eval m) φ i) := by + rw [cj_physical _ _ _ (growth lam) (growth m) hrl hrm] + rfl + simpa only [embed_apply,hh] using h + +theorem weak_to_local_physical (Ω : Set X) (R : ℝ) (hΩ : Ω ⊆ Metric.closedBall 0 R) + (z : Fin 3 → ℂ) (lam m : Coeff) + (hrl : ∀ x, star (eval lam x)=eval lam x) (hrm : ∀ x, star (eval m x)=eval m x) + (w F : H) + (heq : ∀ v : Fin 3 → S, (∀ i, BallSupported R (v i)) → + inner ℂ w (embed (physical (adjPhase z) (eval lam) (eval m) v)) = inner ℂ F (embed v)) : + ∀ i, LocalEq Ω (phys z lam m (fun j => (w j : Dist)) i) (F i : Dist) := by + classical + intro i φ _hc hs + let ψ : Fin 3 → S := fun j => if j=i then φ else 0 + have hψ : ∀ j, BallSupported R (ψ j) := by + intro j + by_cases hji : j=i + · intro x hx + have hx' : φ x ≠ 0 := by simpa only [ψ,ite_eq_left hji] using hx + have hxx := hΩ (hs (subset_tsupport _ hx')) + simpa only [Metric.mem_closedBall,dist_zero_right] using hxx + · simpa only [ψ,ite_eq_right hji] using BallSupported.zero R + have h := weak_to_vector_distribution R z lam m hrl hrm w F heq ψ hψ + simpa only [ψ,apply_ite,map_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] using h +end ElasticityDistribution + +open scoped BigOperators +namespace ElasticityCoeffBounds +open ElasticityAugmented ElasticityPhysicalEstimate +abbrev X := ElasticityAugmented.X + +def ExteriorConstant (f : Smooth) : Prop := + ∃ c : ℂ, HasCompactSupport (fun x => (f : X → ℂ) x - c) + +lemma ExteriorConstant.growth {f : Smooth} (hf : ExteriorConstant f) : + (f : X → ℂ).HasTemperateGrowth := by + obtain ⟨c, hc⟩ := hf + have hg := hc.hasTemperateGrowth ((smooth_coe f).sub contDiff_const) + convert hg.add (Function.HasTemperateGrowth.const c) using 1 + funext x + simp + +lemma ExteriorConstant.bound {f : Smooth} (hf : ExteriorConstant f) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x, ‖(f : X → ℂ) x‖ ≤ C := by + obtain ⟨c, hc⟩ := hf + have hcont : Continuous (fun x => ‖(f : X → ℂ) x - c‖) := + ((smooth_coe f).continuous.sub continuous_const).norm + obtain ⟨x₀, hx⟩ := hcont.exists_forall_ge_of_hasCompactSupport hc.norm + refine ⟨‖(f : X → ℂ) x₀ - c‖ + ‖c‖, by positivity, fun x => ?_⟩ + calc + ‖(f : X → ℂ) x‖ = ‖((f : X → ℂ) x-c)+c‖ := by rw [sub_add_cancel] + _ ≤ ‖(f : X → ℂ) x-c‖ + ‖c‖ := norm_add_le _ _ + _ ≤ ‖(f : X → ℂ) x₀-c‖ + ‖c‖ := by linarith [hx x] + +lemma ExteriorConstant.const (c : ℂ) : ExteriorConstant (algebraMap ℂ Smooth c) := by + refine ⟨c, ?_⟩ + change HasCompactSupport (fun _ : X => c-c) + exact HasCompactSupport.intro isCompact_empty (fun _ _ => sub_self c) + +lemma ExteriorConstant.add {f g : Smooth} (hf : ExteriorConstant f) (hg : ExteriorConstant g) : + ExteriorConstant (f+g) := by + obtain ⟨c, hc⟩ := hf + obtain ⟨d, hd⟩ := hg + refine ⟨c+d, ?_⟩ + have he : (fun x => ((f+g : Smooth) : X → ℂ) x - (c+d)) = + (fun x => (f : X → ℂ) x-c) + (fun x => (g : X → ℂ) x-d) := by + funext x + change (f : X → ℂ) x + (g : X → ℂ) x - (c+d) = _ + dsimp + ring + rw [he] + exact hc.add hd + +lemma ExteriorConstant.mul {f g : Smooth} (hf : ExteriorConstant f) (hg : ExteriorConstant g) : + ExteriorConstant (f*g) := by + obtain ⟨c, hc⟩ := hf + obtain ⟨d, hd⟩ := hg + refine ⟨c*d, ?_⟩ + have h1 : HasCompactSupport ((fun x => (f : X → ℂ) x-c) * (g : X → ℂ)) := hc.mul_right + have h2 : HasCompactSupport ((fun _ : X => c) * (fun x => (g : X → ℂ) x-d)) := hd.mul_left + have he : (fun x => ((f*g : Smooth) : X → ℂ) x - c*d) = + ((fun x => (f : X → ℂ) x-c) * (g : X → ℂ)) + + ((fun _ : X => c) * (fun x => (g : X → ℂ) x-d)) := by + funext x + change (f : X → ℂ) x * (g : X → ℂ) x - c*d = _ + dsimp + ring + rw [he] + exact h1.add h2 + +lemma ExteriorConstant.neg {f : Smooth} (hf : ExteriorConstant f) : ExteriorConstant (-f) := by + obtain ⟨c, hc⟩ := hf + refine ⟨-c, ?_⟩ + have he : (fun x => ((-f : Smooth) : X → ℂ) x - (-c)) = -(fun x => (f : X → ℂ) x-c) := by + funext x + change -(f : X → ℂ) x - (-c) = -((f : X → ℂ) x-c) + ring + rw [he] + exact hc.neg + +lemma ExteriorConstant.sub {f g : Smooth} (hf : ExteriorConstant f) (hg : ExteriorConstant g) : + ExteriorConstant (f-g) := by + simpa only [sub_eq_add_neg] using hf.add hg.neg + +lemma ExteriorConstant.coord {f : Smooth} (hf : ExteriorConstant f) (i : Fin 3) : + ExteriorConstant (coord i f) := by + obtain ⟨c, hc⟩ := hf + refine ⟨0, ?_⟩ + have hs : HasCompactSupport (fun x => fderiv ℝ (fun y => (f : X → ℂ) y-c) x (e i)) := + hc.fderiv_apply (𝕜 := ℝ) (e i) + convert hs using 1 + funext x + simp only [sub_zero, coord_apply, fderiv_sub_const] + +lemma ExteriorConstant.zero : ExteriorConstant (0 : Smooth) := by + simpa only [map_zero] using ExteriorConstant.const 0 + +lemma ExteriorConstant.natCast (n : ℕ) : ExteriorConstant (n : Smooth) := by + simpa only [map_natCast] using ExteriorConstant.const (n : ℂ) + +lemma ExteriorConstant.sum {ι : Type*} (s : Finset ι) (f : ι → Smooth) + (hf : ∀ i ∈ s, ExteriorConstant (f i)) : ExteriorConstant (∑ i ∈ s, f i) := by + classical + induction s using Finset.induction_on with + | empty => simpa only [Finset.sum_empty] using ExteriorConstant.zero + | @insert i s hi ih => + rw [Finset.sum_insert hi] + exact (hf i (Finset.mem_insert_self _ _)).add + (ih (fun j hj => hf j (Finset.mem_insert_of_mem hj))) + +lemma exterior_coeffA {lam m n o : Smooth} (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hn : ExteriorConstant n) (ho : ExteriorConstant o) (k : Fin 3) (i j : Fin 4) : + ExteriorConstant (coeffA coord lam m n o k i j) := by + refine Fin.cases ?_ (fun i => ?_) i + · refine Fin.cases ?_ (fun j => ?_) j + · exact ((ExteriorConstant.natCast 2).mul ho).mul + (((hl.add hm).coord k).sub (((hl.add hm).mul hn).mul (hm.coord k))) + · exact ((ExteriorConstant.natCast 2).mul ho).mul + (((hm.coord j).coord k).sub + ((((ExteriorConstant.natCast 2).mul hn).mul (hm.coord k)).mul (hm.coord j))) + · refine Fin.cases ?_ (fun j => ?_) j + · change ExteriorConstant (if k=i then (lam+m)*n else 0) + split + · exact (hl.add hm).mul hn + · exact ExteriorConstant.zero + · change ExteriorConstant ((if j=i then n*coord k m else 0) + + (if k=i then n*coord j m else 0)) + apply ExteriorConstant.add + · split + · exact hn.mul (hm.coord k) + · exact ExteriorConstant.zero + · split + · exact hn.mul (hm.coord j) + · exact ExteriorConstant.zero + +lemma exterior_coeffV {lam m n o : Smooth} (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hn : ExteriorConstant n) (ho : ExteriorConstant o) (i j : Fin 4) : + ExteriorConstant (coeffV coord lam m n o i j) := by + refine Fin.cases ?_ (fun i => ?_) i + · refine Fin.cases ?_ (fun _ => ExteriorConstant.zero) j + exact ho.mul ((ExteriorConstant.sum Finset.univ _ (fun i _ => (hl.coord i).coord i)).sub + (((ExteriorConstant.natCast 2).mul hn).mul + (ExteriorConstant.sum Finset.univ _ (fun i _ => (hm.coord i).mul (hl.coord i))))) + · refine Fin.cases ?_ (fun _ => ExteriorConstant.zero) j + exact hn.mul (hl.coord i) + +lemma exterior_cPhys {m n : Smooth} (hm : ExteriorConstant m) (hn : ExteriorConstant n) + (i : Fin 3) : ExteriorConstant (-2*n*coord i m) := + (((ExteriorConstant.natCast 2).neg).mul hn).mul (hm.coord i) + +lemma ExteriorConstant.uniform_bound {ι : Type*} [Fintype ι] (f : ι → Smooth) + (hf : ∀ i, ExteriorConstant (f i)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ i x, ‖(f i : X → ℂ) x‖ ≤ C := by + classical + choose C hC hb using (fun i => (hf i).bound) + refine ⟨∑ i, C i, Finset.sum_nonneg (fun i _ => hC i), fun i x => ?_⟩ + exact (hb i x).trans (Finset.single_le_sum (fun j _ => hC j) (Finset.mem_univ i)) + +/-- The reciprocal is the pointwise reciprocal, not an abstract inverse assumption. -/ +def reciprocal (f : Smooth) (hf : ∀ x, (f : X → ℂ) x ≠ 0) : Smooth := + ⟨fun x => ((f : X → ℂ) x)⁻¹, (smooth_coe f).inv hf⟩ + +lemma reciprocal_mul (f : Smooth) (hf : ∀ x, (f : X → ℂ) x ≠ 0) : + reciprocal f hf * f = 1 := by + apply Subtype.ext + funext x + exact inv_mul_cancel₀ (hf x) + +lemma ExteriorConstant.reciprocal {f : Smooth} (hf : ExteriorConstant f) + (hn : ∀ x, (f : X → ℂ) x ≠ 0) : ExteriorConstant (reciprocal f hn) := by + obtain ⟨c, hc⟩ := hf + refine ⟨c⁻¹, hc.mono' ?_⟩ + intro x hx + change ((f : X → ℂ) x)⁻¹-c⁻¹ ≠ 0 at hx + apply subset_tsupport (fun x => (f : X → ℂ) x-c) + change (f : X → ℂ) x-c ≠ 0 + intro h + apply hx + exact sub_eq_zero.mpr (congrArg Inv.inv (sub_eq_zero.mp h)) + +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +open ElasticityPhysicalAlgebra (physical phase) + +theorem physical_test_exterior (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : α ≠ 0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hm0 : ∀ x, (m : X → ℂ) x ≠ 0) + (he0 : ∀ x, ((lam+m+m : Smooth) : X → ℂ) x ≠ 0) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ u : Fin 3 → S, (∀ i, BallSupported R (u i)) → + sobNorm h 0 u ≤ C*sobNorm h 0 (physical (phase h α β) lam m u) := by + let n := reciprocal m hm0 + let o := reciprocal (lam+m+m) he0 + have hn : ExteriorConstant n := hm.reciprocal hm0 + have ho : ExteriorConstant o := ((hl.add hm).add hm).reciprocal he0 + have ha := exterior_coeffA hl hm hn ho + have hv := exterior_coeffV hl hm hn ho + have hc := exterior_cPhys hm hn + obtain ⟨M, hM, hbM⟩ := ExteriorConstant.uniform_bound + (fun ij : Fin 3 × Fin 4 × Fin 4 => coeffA coord lam m n o ij.1 ij.2.1 ij.2.2) + (fun ij => ha ij.1 ij.2.1 ij.2.2) + obtain ⟨V, hV, hbV⟩ := ExteriorConstant.uniform_bound + (fun ij : Fin 4 × Fin 4 => coeffV coord lam m n o ij.1 ij.2) + (fun ij => hv ij.1 ij.2) + obtain ⟨A₁, hA₁, hnA⟩ := hn.bound + obtain ⟨A₂, hA₂, hoA⟩ := ho.bound + obtain ⟨A₃, hA₃, hcA⟩ := ExteriorConstant.uniform_bound (fun i => -2*n*coord i m) hc + obtain ⟨D, hD, hod⟩ := ExteriorConstant.uniform_bound (fun i => coord i o) (fun i => ho.coord i) + let Z : ℝ := ∑ i, ‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ + have hZ : 0 ≤ Z := Finset.sum_nonneg (fun i _ => norm_nonneg _) + have hbZ (i : Fin 3) : ‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ ≤ Z := + Finset.single_le_sum (fun j _ => norm_nonneg ((α j : ℂ)+Complex.I*(β j : ℂ))) (Finset.mem_univ i) + apply physical_test_estimate R hR α β hα lam m n o (reciprocal_mul m hm0) + (reciprocal_mul (lam+m+m) he0) hl.growth hm.growth hn.growth ho.growth + (fun k i j => (ha k i j).growth) (fun i j => (hv i j).growth) (fun i => (hc i).growth) + M V (A₁+A₂+A₃) D Z hM hV (by positivity) hD hZ + · intro k i j x + simpa only [aPhys, Pi.neg_apply, norm_neg] using hbM (k, i, j) x + · intro i j x + simpa only [vPhys, Pi.neg_apply, norm_neg] using hbV (i, j) x + · intro x + linarith [hnA x] + · intro x + linarith [hoA x] + · intro i x + have hh := hcA i x + change ‖((-2*n*coord i m : Smooth) : X → ℂ) x‖ ≤ _ + linarith + · exact fun x i => hod i x + · exact hbZ + +end ElasticityCoeffBounds + +open MeasureTheory Complex SchwartzMap +open scoped BigOperators FourierTransform SchwartzMap LineDeriv ENNReal +namespace ElasticityPhysicalSolvability +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder +open ElasticityAugmented +open ElasticityPhysicalAlgebra (physical phase) +open ElasticityPhysicalDual ElasticityCoeffBounds +abbrev X := ElasticityAugmented.X + +theorem weak_solvability (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : α ≠ 0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hm0 : ∀ x, (m : X → ℂ) x ≠ 0) + (he0 : ∀ x, ((lam+m+m : Smooth) : X → ℂ) x ≠ 0) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ F : H, ∃ w : H, ‖w‖ ≤ C*‖F‖ ∧ ∀ v : Fin 3 → S, + (∀ i, BallSupported R (v i)) → + inner ℂ w (embed (physical (adjPhase (phase h α β)) lam m v)) = + inner ℂ F (embed v) := by + obtain ⟨C, h₀, hC, hh₀, hest⟩ := physical_test_exterior R hR (-α) β + (neg_ne_zero.mpr hα) lam m hl hm hm0 he0 + refine ⟨C, h₀, hC, hh₀, fun h hh hsmall F => ?_⟩ + apply weak_physical_from_test R h (phase h α β) lam m C hC.le ?_ F + intro u hu + rw [adjPhase_phase] + exact hest h hh hsmall u hu + +/-- The real smooth coefficients are embedded pointwise, not abstractly. -/ +def realSmooth (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) : Smooth := + ⟨fun x => (f x : ℂ), Complex.ofRealCLM.contDiff.comp hf⟩ + +lemma realSmooth_real (f : X → ℝ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) (x : X) : + star ((realSmooth f hf : X → ℂ) x) = (realSmooth f hf : X → ℂ) x := by + exact Complex.conj_ofReal _ + +lemma exterior_of_ball (f : Smooth) (R : ℝ) (c : ℂ) + (hf : ∀ x, R ≤ ‖x‖ → (f : X → ℂ) x = c) : ExteriorConstant f := by + refine ⟨c, HasCompactSupport.intro (isCompact_closedBall (0 : X) R) ?_⟩ + intro x hx + have hx' : R < ‖x‖ := by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hx + exact sub_eq_zero.mpr (hf x hx'.le) + +/-- Coefficient assumptions for this PDE lemma: smooth, strongly +convex, constant outside a ball. No bounds on their derivatives are assumed. -/ +theorem real_weak_solvability (R : ℝ) (hR : 1 ≤ R) (α β : X) (hα : α ≠ 0) + (lam m : X → ℝ) (hl : ContDiff ℝ (⊤ : ℕ∞) lam) (hm : ContDiff ℝ (⊤ : ℕ∞) m) + (hpos : ∀ x, 0 < m x ∧ 0 < 3*lam x+2*m x) + (Rext cl cm : ℝ) (hext : ∀ x, Rext ≤ ‖x‖ → lam x=cl ∧ m x=cm) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ F : H, ∃ w : H, ‖w‖ ≤ C*‖F‖ ∧ ∀ v : Fin 3 → S, + (∀ i, BallSupported R (v i)) → + inner ℂ w (embed (physical (adjPhase (phase h α β)) + (realSmooth lam hl) (realSmooth m hm) v)) = inner ℂ F (embed v) := by + apply weak_solvability R hR α β hα + (realSmooth lam hl) (realSmooth m hm) + · exact exterior_of_ball _ Rext (cl : ℂ) (fun x hx => congrArg Complex.ofReal (hext x hx).1) + · exact exterior_of_ball _ Rext (cm : ℂ) (fun x hx => congrArg Complex.ofReal (hext x hx).2) + · intro x + change (m x : ℂ) ≠ 0 + exact_mod_cast (hpos x).1.ne' + · intro x + have hh : lam x+m x+m x ≠ 0 := by linarith [(hpos x).1, (hpos x).2] + change (lam x : ℂ)+(m x : ℂ)+(m x : ℂ) ≠ 0 + exact_mod_cast hh + +end ElasticityPhysicalSolvability + +open MeasureTheory TemperedDistribution +open scoped ENNReal SchwartzMap BigOperators +namespace ElasticityDistribution +open ElasticityAugmented ElasticityRegularity ElasticityCoeffBounds +open ElasticityPhysicalAlgebra (phase) +open ElasticityPhysicalDual + +lemma lp_local_zero (Ω : Set X) (u : Lp ℂ 2 (volume : Measure X)) : + ElasticityRegularity.LocalSobolev Ω 0 (u : Dist) := + ElasticityRegularity.MemSobolev.local_zero (memSobolev_zero_iff.mpr ⟨u,rfl⟩) Ω +lemma schwartz_local_nat (Ω : Set X) (u : S) (N : ℕ) : + ElasticityRegularity.LocalSobolev Ω N (u : Dist) := by + intro g hg hc _ + exact sobolev_nat_product (EuclideanSpace.basisFun (Fin 3) ℝ) N hg hc u.memSobolev + +/-- Real physical coefficients and pointwise inverses are the actual smooth +coefficients in the distribution formulation. -/ +def exteriorCoeff (f : Smooth) (hf : ExteriorConstant f) : Coeff := ⟨f,hf.growth⟩ +def inverseCoeff (f : Smooth) (hf : ExteriorConstant f) (hn : ∀ x, (f : X → ℂ) x ≠ 0) : Coeff := + exteriorCoeff (reciprocal f hn) (hf.reciprocal hn) +lemma inverseCoeff_mul (f : Smooth) (hf : ExteriorConstant f) (hn : ∀ x, (f : X → ℂ) x ≠ 0) : + inverseCoeff f hf hn*exteriorCoeff f hf=1 := by + apply Subtype.ext + exact reciprocal_mul f hn + +/-- Actual uniform physical weak solvability together with proved interior +smoothness of every cutoff of the physical displacement and shifted divergence. +This combines the supported Carleman/Hahn--Banach construction with the true +augmented distribution identity rather than assuming elliptic regularity. -/ +theorem weak_smooth_solvability (R : ℝ) (hR : 1 ≤ R) + (Ω : Set X) (hΩ : Ω ⊆ Metric.closedBall 0 R) (α β : X) (hα : α ≠ 0) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (hrl : ∀ x, star ((lam : X → ℂ) x)=(lam : X → ℂ) x) + (hrm : ∀ x, star ((m : X → ℂ) x)=(m : X → ℂ) x) + (hm0 : ∀ x, (m : X → ℂ) x ≠ 0) + (he0 : ∀ x, ((lam+m+m : Smooth) : X → ℂ) x ≠ 0) : + ∃ C h₀ : ℝ, 0 < C ∧ 0 < h₀ ∧ ∀ h : ℝ, 0 < h → h ≤ h₀ → + ∀ f : Fin 3 → S, ∃ w : H, ‖w‖ ≤ C*‖embed f‖ ∧ + (∀ i, LocalEq Ω (phys (phase h α β) (exteriorCoeff lam hl) (exteriorCoeff m hm) + (fun j => (w j : Dist)) i) (f i : Dist)) ∧ + ∀ i : Fin 4, ∀ g : X → ℂ, ContDiff ℝ (⊤ : ℕ∞) g → HasCompactSupport g → tsupport g ⊆ Ω → + ∃ v : BoundedContinuousFunction X ℂ, ContDiff ℝ (⊤ : ℕ∞) (v : X → ℂ) ∧ + smulLeftCLM ℂ g ((Fin.cons (divd (phase h α β) (fun j => (w j : Dist))) + (fun j => (w j : Dist)) : Fin 4 → Dist) i) = + ((v.memLp_top.toLp _ : Lp ℂ ∞ (volume : Measure X)) : Dist) := by + obtain ⟨C,h₀,hC,hh₀,hsol⟩ := ElasticityPhysicalSolvability.weak_solvability R hR α β hα lam m hl hm hm0 he0 + refine ⟨C,h₀,hC,hh₀,fun h hh hs f => ?_⟩ + obtain ⟨w,hw,hwe⟩ := hsol h hh hs (embed f) + have heq := weak_to_local_physical Ω R hΩ (phase h α β) (exteriorCoeff lam hl) (exteriorCoeff m hm) + hrl hrm w (embed f) hwe + have heq' : ∀ i, LocalEq Ω (phys (phase h α β) (exteriorCoeff lam hl) (exteriorCoeff m hm) + (fun j => (w j : Dist)) i) (f i : Dist) := by + intro i + simpa only [embed_apply,ElasticityBessel.L2,SchwartzMap.toLpCLM_apply,Lp.toTemperedDistribution_toLp_eq] using heq i + refine ⟨w,hw,heq',fun i g hg hc hgs => ?_⟩ + let n := inverseCoeff m hm hm0 + let o := inverseCoeff (lam+m+m) ((hl.add hm).add hm) he0 + have hn : n*exteriorCoeff m hm=1 := inverseCoeff_mul m hm hm0 + have ho : o*(exteriorCoeff lam hl+exteriorCoeff m hm+exteriorCoeff m hm)=1 := by + apply Subtype.ext + exact reciprocal_mul (lam+m+m) he0 + exact physical_cutoff_smooth (phase h α β) (exteriorCoeff lam hl) (exteriorCoeff m hm) n o hn ho + (fun j => (w j : Dist)) (fun j => (f j : Dist)) heq' (fun j => lp_local_zero Ω (w j)) + (fun N j => schwartz_local_nat Ω (f j) N) i hg hc hgs +end ElasticityDistribution + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Supported.lean b/lean/OAI/MathematicalPhysics/Elasticity/Supported.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6a77ab94facfca3757219aefc199c8579722dab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Supported.lean @@ -0,0 +1,975 @@ +import OAI.MathematicalPhysics.Elasticity.WeakLimits + +namespace OAI + +noncomputable section + +/- The exact extension proofs are reused from their canonical original module. -/ + +namespace ElasticityGraph +open Set +variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] +/-- Orthogonal projection supplies a genuine bounded left inverse of a +coercive Hilbert operator on all of the target space. -/ +theorem exists_coercive_left_inverse (A : E →L[ℂ] F) (C : ℝ) (hC : 0≤C) + (hA : ∀ x, ‖x‖≤C*‖A x‖) : + ∃ R : F →L[ℂ] E, R.comp A=ContinuousLinearMap.id ℂ E := by + have hal : AntilipschitzWith ⟨C,hC⟩ A := by + apply AntilipschitzWith.of_le_mul_dist + intro x y + change dist x y≤C*dist (A x) (A y) + simpa only [dist_eq_norm,← map_sub] using hA (x-y) + have hclosed : IsClosed (Set.range A) := hal.isClosed_range A.uniformContinuous + let e : E ≃L[ℂ] A.range := A.equivRange hal.injective hclosed + let : CompleteSpace A.range := hclosed.completeSpace_coe + let R : F →L[ℂ] E := e.symm.toContinuousLinearMap.comp A.range.orthogonalProjectionOnto + refine ⟨R,?_⟩ + ext x + change e.symm (A.range.orthogonalProjectionOnto (A x))=x + have hx : A.range.orthogonalProjectionOnto (A x)=e x := + A.range.orthogonalProjectionOnto_mem_subspace_eq_self (e x) + rw [hx,ContinuousLinearEquiv.symm_apply_apply] +end ElasticityGraph +namespace ElasticityGraph +open Set +open ElasticityRegularity +variable {E F P : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] + + [NormedAddCommGroup P] [NormedSpace ℝ P] +local instance : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ ℂ E +local instance : NormedSpace ℝ F := NormedSpace.restrictScalars ℝ ℂ F +/-- A smooth local left inverse, with no surjectivity hypothesis. -/ +theorem local_smooth_left_inverse (A : P → E →L[ℂ] F) + (hA : ContDiff ℝ (⊤ : ℕ∞) A) (p₀ : P) (C : ℝ) (hC : 0≤C) + (hbound : ∀ x, ‖x‖≤C*‖A p₀ x‖) : + ∃ (U : Set P) (R : P → F →L[ℂ] E), IsOpen U ∧ p₀∈U ∧ + ContDiffOn ℝ (⊤ : ℕ∞) R U ∧ ∀ p∈U, (R p).comp (A p)=ContinuousLinearMap.id ℂ E := by + obtain ⟨R₀,hR₀⟩ := exists_coercive_left_inverse (A p₀) C hC hbound + let B : P → E →L[ℂ] E := fun p => R₀.comp (A p-A p₀) + have hB : ContDiff ℝ (⊤ : ℕ∞) B := complex_clm_comp_smooth contDiff_const (hA.sub contDiff_const) + let U : Set P := {p | ‖B p‖<1} + have hopen : IsOpen U := isOpen_lt hB.continuous.norm continuous_const + have hmem : p₀∈U := by simp only [U,B,mem_ofPred_eq,sub_self,ContinuousLinearMap.comp_zero,norm_zero,zero_lt_one] + let R : P → F →L[ℂ] E := fun p => (Ring.inverse (1+B p)).comp R₀ + have hu (p : P) (hp : p∈U) : IsUnit (1+B p) := by + simpa only [sub_neg_eq_add] using isUnit_one_sub_of_norm_lt_one + (by simpa only [norm_neg] using (show ‖B p‖<1 from hp) : ‖-(B p)‖<1) + have hi (p : P) (hp : p∈U) : ContDiffAt ℝ (⊤ : ℕ∞) (fun q => Ring.inverse (1+B q)) p := by + obtain ⟨v,hv⟩ := hu p hp + have hInv : ContDiffAt ℝ (⊤ : ℕ∞) Ring.inverse (1+B p) := by + rw [← hv] + exact contDiffAt_ringInverse ℝ v + exact hInv.comp p (contDiffAt_const.add hB.contDiffAt) + have hR : ContDiffOn ℝ (⊤ : ℕ∞) R U := by + intro p hp + let L : (E →L[ℂ] E) →L[ℂ] (F →L[ℂ] E) := (ContinuousLinearMap.compL ℂ F E E).flip R₀ + exact ((L.restrictScalars ℝ).contDiff.contDiffAt.comp p (hi p hp)).contDiffWithinAt + refine ⟨U,R,hopen,hmem,hR,fun p hp => ?_⟩ + have hRA : R₀.comp (A p)=1+B p := by + dsimp [B] + rw [ContinuousLinearMap.comp_sub,hR₀] + change R₀.comp (A p)=ContinuousLinearMap.id ℂ E+(R₀.comp (A p)-ContinuousLinearMap.id ℂ E) + abel + change (Ring.inverse (1+B p)).comp (R₀.comp (A p))=1 + rw [hRA] + exact Ring.inverse_mul_cancel _ (hu p hp) + +/-- Smooth dependence and existence at all parameters follow from existence +on a dense set, using the actual local Hilbert left inverse. -/ +theorem local_smooth_solution_of_dense (A : P → E →L[ℂ] F) + (hA : ContDiff ℝ (⊤ : ℕ∞) A) (f : P → F) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + {D : Set P} (hD : Dense D) (hex : ∀ p∈D, ∃ u, A p u=f p) + (p₀ : P) (C : ℝ) (hC : 0≤C) (hbound : ∀ x, ‖x‖≤C*‖A p₀ x‖) : + ∃ (U : Set P) (u : P → E), IsOpen U ∧ p₀∈U ∧ + ContDiffOn ℝ (⊤ : ℕ∞) u U ∧ ∀ p∈U, A p (u p)=f p := by + obtain ⟨U,R,hU,hp,hR,he⟩ := local_smooth_left_inverse A hA p₀ C hC hbound + let u : P → E := fun p => R p (f p) + have hu : ContDiffOn ℝ (⊤ : ℕ∞) u U := + (((ContinuousLinearMap.restrictScalarsL ℂ F E ℝ ℝ).contDiff.comp_contDiffOn hR).clm_apply hf.contDiffOn) + have hr : ContinuousOn (fun p => A p (u p)) U := + (((ContinuousLinearMap.restrictScalarsL ℂ E F ℝ ℝ).contDiff.comp hA).contDiffOn.clm_apply hu).continuousOn + have hdense : EqOn (fun p => A p (u p)) f (U∩D) := by + intro p hp + obtain ⟨v,hv⟩ := hex p hp.2 + have hl := congrArg (fun L : E →L[ℂ] E => L v) (he p hp.1) + change R p (A p v)=v at hl + dsimp [u] + rw [← hv,hl] + exact ⟨U,u,hU,hp,hu,hdense.of_subset_closure hr hf.continuous.continuousOn + inter_subset_left (hD.open_subset_closure_inter hU)⟩ +end ElasticityGraph +namespace ElasticityPlanar +open Set MeasureTheory TemperedDistribution +open scoped ENNReal SchwartzMap BigOperators + +section +variable {n : Type*} [Fintype n] +abbrev GraphSpace (n : Type*) := WithLp 2 (Hilbert n × Hilbert n) +def testGraph (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : supported (n := n) S →ₗ[ℂ] GraphSpace n := + (WithLp.prodContinuousLinearEquiv 2 ℂ (Hilbert n) (Hilbert n)).symm.toLinearMap.comp + ((embed.comp (supported S).subtype).prod + ((embed.comp (transport a ha)).comp (supported S).subtype)) +def closedGraph (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : Submodule ℂ (GraphSpace n) := + (testGraph S a ha).range.topologicalClosure +instance graphComplete (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : CompleteSpace (closedGraph S a ha) := + (testGraph S a ha).range.isClosed_topologicalClosure.completeSpace_coe + +def graphFirst (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : closedGraph S a ha →L[ℂ] Hilbert n := + (WithLp.fstL 2 ℂ (Hilbert n) (Hilbert n)).comp (closedGraph S a ha).subtypeL +def graphSecond (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : closedGraph S a ha →L[ℂ] Hilbert n := + (WithLp.sndL 2 ℂ (Hilbert n) (Hilbert n)).comp (closedGraph S a ha).subtypeL + +/-- The positive-commutator coercivity survives the actual graph closure. -/ +theorem closed_graph_estimate {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) : + ∃ C : ℝ, 0 ?_⟩ + have h := hcl u + have hn := WithLp.prod_norm_sq_eq_of_L2 (u : GraphSpace n) + change ‖u‖^2=‖graphFirst S a ha u‖^2+‖graphSecond S a ha u‖^2 at hn + have hp : 0≤C*‖graphSecond S a ha u‖ := mul_nonneg hC.le (norm_nonneg _) + have hsq := sq_le_sq₀ (norm_nonneg (graphFirst S a ha u)) hp |>.mpr h + have hx := norm_nonneg u + have hy := norm_nonneg (graphSecond S a ha u) + nlinarith [sq_nonneg (C*‖graphSecond S a ha u‖),mul_nonneg hC.le (sq_nonneg ‖graphSecond S a ha u‖)] +end +open ElasticityRegularity +variable {n : Type*} [Fintype n] +lemma L2_distribution (u : Test) : (L2 u : 𝓢'(ℂ,ℂ))=(toSchwartz u : 𝓢'(ℂ,ℂ)) := + Lp.toTemperedDistribution_toLp_eq (toSchwartz u) +lemma planarOperator_test (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u : n → Test) (i : n) : + planarOperator a i (embed u)=entryInjection i (embed (transport a (fun i j => (ha i j).1) u)) := by + simp only [planarOperator_apply,entryInjection_apply,embed_apply,L2_distribution,dbar_schwartz] + have ht : toSchwartz (transport a (fun i j => (ha i j).1) u i)= + schwartzDbar (toSchwartz (u i))+∑ j, SchwartzMap.smulLeftCLM ℂ (a i j) (toSchwartz (u j)) := by + simp only [transport,LinearMap.coe_mk,AddHom.coe_mk,map_add,map_smul,map_sum, + toSchwartz_d,schwartzDbar] + congr 1 + exact Finset.sum_congr rfl (fun j _ => toSchwartz_mul (a i j) (ha i j) (u j)) + rw [ht,map_add,map_sum] + congr 1 + exact Finset.sum_congr rfl (fun j _ => distribution_schwartz_product (ha i j) (toSchwartz (u j))) + +/-- Closing compact test graphs preserves the actual distributional operator. -/ +theorem graph_equation (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u : closedGraph S a (fun i j => (ha i j).1)) (i : n) : + planarOperator a i (graphFirst S a (fun i j => (ha i j).1) u)= + entryInjection i (graphSecond S a (fun i j => (ha i j).1) u) := by + let F := (planarOperator a i).comp (WithLp.fstL 2 ℂ (Hilbert n) (Hilbert n)) + let G := (entryInjection i).comp (WithLp.sndL 2 ℂ (Hilbert n) (Hilbert n)) + have hc : IsClosed {v : GraphSpace n | F v=G v} := isClosed_eq F.continuous G.continuous + have hsub : ((testGraph S a (fun i j => (ha i j).1)).range : Set (GraphSpace n)) ⊆ {v | F v=G v} := by + rintro v ⟨w,rfl⟩ + exact planarOperator_test a ha w i + exact closure_minimal hsub hc u.property + +lemma test_support_distribution {S : Set ℂ} (u : Test) (hu : tsupport (u : ℂ → ℂ)⊆S) : + LocalEqual Sᶜ (L2 u : 𝓢'(ℂ,ℂ)) 0 := by + intro φ _ hs + rw [L2_distribution] + change (∫ z : ℂ, φ z • toSchwartz u z)=0 + apply integral_eq_zero_of_ae + filter_upwards [] with z + by_cases hz : z∈S + · have hz' : z∉tsupport (φ : ℂ → ℂ) := fun h => hs h hz + rw [image_eq_zero_of_notMem_tsupport hz',zero_smul] + rfl + · have hz' : z∉tsupport (u : ℂ → ℂ) := fun h => hz (hu h) + rw [toSchwartz_apply,image_eq_zero_of_notMem_tsupport hz',smul_zero] + rfl + +/-- Graph closure retains support, in the literal distributional sense. -/ +theorem graph_support (S : Set ℂ) (a : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (u : closedGraph S a ha) (i : n) : + LocalEqual Sᶜ (entryInjection i (graphFirst S a ha u)) 0 := by + intro φ hc hs + let F : GraphSpace n →L[ℂ] ℂ := + (PointwiseConvergenceCLM.evalCLM (RingHom.id ℂ) ℂ φ).comp ((entryInjection i).comp (WithLp.fstL 2 ℂ (Hilbert n) (Hilbert n))) + have hclosed : IsClosed {v : GraphSpace n | F v=0} := isClosed_eq F.continuous continuous_const + have hsub : ((testGraph S a ha).range : Set (GraphSpace n)) ⊆ {v | F v=0} := by + rintro v ⟨w,rfl⟩ + exact test_support_distribution (w.val i) (w.property i) φ hc hs + exact closure_minimal hsub hclosed u.property +end ElasticityPlanar +namespace ElasticityPlanar +open Set MeasureTheory TemperedDistribution +open scoped ENNReal SchwartzMap BigOperators +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +lemma shifted_graph_equation {S : Set ℂ} (a b : n → n → ℂ → ℂ) + (ha : ∀ i j, (a i j).HasTemperateGrowth) + (M : Hilbert n →L[ℂ] Hilbert n) + (hM : ∀ w i, entryInjection i (M w)= + ∑ j, smulLeftCLM ℂ (b i j) (entryInjection j w)- + ∑ j, smulLeftCLM ℂ (a i j) (entryInjection j w)) + (u : closedGraph S a (fun i j => (ha i j).1)) (i : n) : + planarOperator b i (graphFirst S a (fun i j => (ha i j).1) u)= + entryInjection i ((graphSecond S a (fun i j => (ha i j).1)+ + M.comp (graphFirst S a (fun i j => (ha i j).1))) u) := by + have h₀ := graph_equation S a ha u i + simp only [add_apply,ContinuousLinearMap.comp_apply,map_add,hM] + rw [← h₀,planarOperator_apply,planarOperator_apply] + simp only [entryInjection_apply] + abel + +lemma graph_test_solution {S : Set ℂ} (a b : n → n → ℂ → ℂ) + (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (A : closedGraph S a ha →L[ℂ] Hilbert n) + (hA : ∀ u i, planarOperator b i (graphFirst S a ha u)=entryInjection i (A u)) + (f : Hilbert n) (v : n → Test) (hv : ∀ i, tsupport (v i : ℂ → ℂ)⊆S) + (heq : ∀ i, planarOperator b i (embed v)=entryInjection i f) : + ∃ u : closedGraph S a ha, A u=f := by + let w : closedGraph S a ha := ⟨testGraph S a ha ⟨v,hv⟩, + (testGraph S a ha).range.le_topologicalClosure ⟨⟨v,hv⟩,rfl⟩⟩ + refine ⟨w,?_⟩ + apply PiLp.ext + intro i + apply LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := ℂ)) + change entryInjection i (A w)=entryInjection i f + rw [← hA w i] + exact heq i + +omit [FiniteDimensional ℝ P] in +lemma local_graph_solution {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (A : P → closedGraph S a ha →L[ℂ] Hilbert n) + (hA : ContDiff ℝ (⊤ : ℕ∞) A) (p₀ : P) (hA₀ : A p₀=graphSecond S a ha) + (f : P → Hilbert n) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + {D : Set P} (hD : Dense D) (hex : ∀ p∈D, ∃ u : closedGraph S a ha, A p u=f p) : + ∃ (U : Set P) (u : P → closedGraph S a ha), IsOpen U ∧ p₀∈U ∧ + ContDiffOn ℝ (⊤ : ℕ∞) u U ∧ ∀ p∈U, A p (u p)=f p := by + obtain ⟨C,hC,hbound⟩ := closed_graph_estimate hS a ha + exact ElasticityGraph.local_smooth_solution_of_dense (E := closedGraph S a ha) (F := Hilbert n) A hA f hf hD hex p₀ C hC.le + (fun x => by rw [hA₀]; exact hbound x) + +/-- A local smooth supported solution family, derived from compact-test graph +solvability on a dense set. No range-surjectivity assumption is required. -/ +theorem local_supported_of_dense_tests {S K : Set ℂ} (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) + (f : P → Hilbert n) (hf : ContDiff ℝ (⊤ : ℕ∞) f) {D : Set P} (hD : Dense D) + (hex : ∀ p∈D, ∃ v : n → Test, (∀ i, tsupport (v i : ℂ → ℂ)⊆S) ∧ + ∀ i, planarOperator (fun i j z => a i j (p,z)) i (embed v)=entryInjection i (f p)) + (p₀ : P) : + ∃ (U : Set P) (u : P → Hilbert n), IsOpen U ∧ p₀∈U ∧ + ContDiffOn ℝ (⊤ : ℕ∞) u U ∧ ∀ p∈U, ∀ i, + planarOperator (fun i j z => a i j (p,z)) i (u p)=entryInjection i (f p) ∧ + LocalEqual Sᶜ (entryInjection i (u p)) 0 := by + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + let a₀ : n → n → ℂ → ℂ := fun i j z => a i j (p₀,z) + let ha₀ := fun i j => (hat p₀ i j).1 + obtain ⟨M,hM,hMe⟩ := exists_smooth_matrix_multiplier hK a ha hs + let I : closedGraph S a₀ ha₀ →L[ℂ] Hilbert n := graphFirst S a₀ ha₀ + let J : closedGraph S a₀ ha₀ →L[ℂ] Hilbert n := graphSecond S a₀ ha₀ + let A : P → closedGraph S a₀ ha₀ →L[ℂ] Hilbert n := fun p => J+(M p-M p₀).comp I + have hA : ContDiff ℝ (⊤ : ℕ∞) A := contDiff_const.add + (complex_clm_comp_smooth (hM.sub contDiff_const) contDiff_const) + have he (p : P) (u : closedGraph S a₀ ha₀) (i : n) : + planarOperator (fun i j z => a i j (p,z)) i (I u)=entryInjection i (A p u) := by + apply shifted_graph_equation a₀ (fun i j z => a i j (p,z)) (hat p₀) + (M p-M p₀) (fun w k => ?_) u i + simp only [sub_apply,map_sub,entryInjection_apply,hMe p,hMe p₀] + rfl + have hex' : ∀ p∈D, ∃ u : closedGraph S a₀ ha₀, A p u=f p := by + intro p hp + obtain ⟨v,hv,heq⟩ := hex p hp + exact graph_test_solution a₀ (fun i j z => a i j (p,z)) ha₀ (A p) (he p) (f p) v hv heq + have hA₀ : A p₀=graphSecond S a₀ ha₀ := by + simp only [A,sub_self,ContinuousLinearMap.zero_comp,add_zero,J] + obtain ⟨U,u,hU,hp₀,hu,huEq⟩ := local_graph_solution hS a₀ ha₀ A hA p₀ hA₀ f hf hD hex' + refine ⟨U,fun p => I (u p),hU,hp₀,(I.restrictScalars ℝ).contDiff.comp_contDiffOn hu,fun p hp i => ?_⟩ + exact ⟨(he p (u p) i).trans (congrArg (entryInjection i) (huEq p hp)),graph_support S a₀ ha₀ (u p) i⟩ +end ElasticityPlanar +namespace ElasticityPlanar +open Set MeasureTheory TemperedDistribution + +section +open scoped ENNReal SchwartzMap +open ElasticityRegularity +lemma supported_smooth_test {S : Set ℂ} (hS : IsCompact S) + (u : Lp ℂ 2 (volume : Measure ℂ)) + (hu : ∀ N : ℕ, LocalSobolev univ N (u : 𝓢'(ℂ,ℂ))) + (hs : LocalEqual Sᶜ (u : 𝓢'(ℂ,ℂ)) 0) : + ∃ v : Test, L2 v=u ∧ tsupport (v : ℂ → ℂ)⊆S := by + obtain ⟨R,hR,hSR⟩ := hS.isBounded.exists_pos_norm_le + let b : ContDiffBump (0 : ℂ) := ⟨R,R+1,hR,by simp⟩ + let c : ContDiffBump (0 : ℂ) := ⟨R+3,R+4,by linarith,by linarith⟩ + have hc : HasCompactSupport (fun z : ℂ => (c z : ℂ)) := + c.hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + have hcs : ContDiff ℝ (⊤ : ℕ∞) (fun z : ℂ => (c z : ℂ)) := Complex.ofRealCLM.contDiff.comp c.contDiff + have h1 : EqOn (fun z : ℂ => (c z : ℂ)) 1 (Metric.ball 0 (R+3)) := by + intro z hz + change (c z : ℂ)=1 + rw [c.one_of_mem_closedBall (Metric.ball_subset_closedBall hz)] + rfl + obtain ⟨w,_,hw⟩ := local_schwartz_l2_representative Metric.isOpen_ball u hu hcs hc (subset_univ _) h1 + have hb : HasCompactSupport (fun z : ℂ => (b z : ℂ)) := + b.hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + let v : Test := ⟨fun z => (b z : ℂ)*w z, + ⟨(Complex.ofRealCLM.contDiff.comp b.contDiff).mul (w.smooth ⊤),hb.mul_right⟩⟩ + have hs' : LocalEqual Sᶜ (u : 𝓢'(ℂ,ℂ)) ((0 : Lp ℂ 2 (volume : Measure ℂ)) : 𝓢'(ℂ,ℂ)) := by + change LocalEqual Sᶜ (u : 𝓢'(ℂ,ℂ)) ((Lp.toTemperedDistributionCLM ℂ volume 2) 0) + rw [map_zero] + exact hs + have hzero := LocalEqual.lp_ae hS.isClosed.isOpen_compl u 0 hs' + have hev : L2 v=u := by + apply Lp.ext + filter_upwards [(toSchwartz v).coeFn_toLp 2 volume,hw,hzero,Lp.coeFn_zero ℂ 2 (volume : Measure ℂ)] with z hz hzB hzout hz0 + change (L2 v : ℂ → ℂ) z=v z at hz + rw [hz] + change (b z : ℂ)*w z=u z + by_cases hzS : z∈S + · have hzn : ‖z‖≤R := hSR z hzS + have hzB' : z∈Metric.ball 0 (R+3) := by simpa only [Metric.mem_ball,dist_zero_right] using (show ‖z‖ -a i j z) + (fun j => (w j : 𝓢'(ℂ,ℂ))) (fun j => (f j : 𝓢'(ℂ,ℂ))) := by + intro i φ _ _ + have hh := congrArg (fun v : 𝓢'(ℂ,ℂ) => v φ) (he i) + rw [planarOperator_apply] at hh + have hn (j : n) : smulLeftCLM ℂ (fun z => -a i j z) (w j : 𝓢'(ℂ,ℂ))= + -smulLeftCLM ℂ (a i j) (w j : 𝓢'(ℂ,ℂ)) := by + change smulLeftCLM ℂ (-(a i j)) (w j : 𝓢'(ℂ,ℂ))=_ + rw [smulLeftCLM_neg (ha i j),neg_apply] + simp only [hn,Finset.sum_neg_distrib,add_apply,neg_apply] at hh ⊢ + linear_combination hh + exact ElasticityPlanarDistribution.local_all_orders (fun i j z => -a i j z) + (fun i j => (ha i j).neg) (fun j => (w j : 𝓢'(ℂ,ℂ))) (fun j => (f j : 𝓢'(ℂ,ℂ))) he' + (fun j => MemSobolev.local_zero (memSobolev_zero_iff.mpr ⟨w j,rfl⟩) univ) + (fun N j g hg hc _ => sobolev_nat_product Complex.orthonormalBasisOneI N hg hc (f j).memSobolev) + +/-- Smooth forcing upgrades every supported weak L2 solution to an actual compact +smooth test vector, by the established elliptic regularity and support identity. -/ +theorem supported_weak_is_test {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (w : Hilbert n) (f : n → 𝓢(ℂ,ℂ)) + (he : ∀ i, planarOperator a i w=(f i : 𝓢'(ℂ,ℂ))) + (hs : ∀ i, LocalEqual Sᶜ (entryInjection i w) 0) : + ∃ v : n → Test, embed v=w ∧ ∀ i, tsupport (v i : ℂ → ℂ)⊆S := by + have hall := operator_all_orders a ha w f he + choose v hv hvs using fun i => supported_smooth_test hS (w i) (fun N => hall N i) (hs i) + refine ⟨v,?_,hvs⟩ + apply PiLp.ext + exact hv + +/-- Compact support gives uniqueness for the genuine weak transport operator. -/ +theorem supported_weak_kernel {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (w : Hilbert n) (he : ∀ i, planarOperator a i w=0) + (hs : ∀ i, LocalEqual Sᶜ (entryInjection i w) 0) : w=0 := by + obtain ⟨v,hv,hvs⟩ := supported_weak_is_test hS a ha w (fun _ => 0) + (fun i => by simpa only [map_zero] using he i) hs + have htr : embed (transport a (fun i j => (ha i j).1) v)=0 := by + apply PiLp.ext + intro i + apply LinearMap.ker_eq_bot.mp (Lp.ker_toTemperedDistributionCLM_eq_bot (F := ℂ)) + change entryInjection i (embed (transport a (fun i j => (ha i j).1) v))=entryInjection i 0 + rw [← planarOperator_test a ha v i,hv,he i,map_zero] + obtain ⟨C,_,hC⟩ := supported_transport_estimate hS a (fun i j => (ha i j).1) + have h := hC v hvs + rw [htr,norm_zero,mul_zero,hv] at h + exact norm_eq_zero.mp (le_antisymm h (norm_nonneg w)) +end ElasticityPlanar +namespace ElasticityPlanar +open MeasureTheory TemperedDistribution Set +open scoped SchwartzMap ENNReal BigOperators Manifold +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +lemma compact_smooth_source {K : Set ℂ} (hK : IsCompact K) + (f : n → P × ℂ → ℂ) (hf : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hs : ∀ i p z, z∉K → f i (p,z)=0) : + ∃ (F : P → n → 𝓢(ℂ,ℂ)) (w : P → Hilbert n), + (∀ p i z, F p i z=f i (p,z)) ∧ + (∀ N : ℕ, ∀ i, SmoothSobolev N (fun p => (F p i : 𝓢'(ℂ,ℂ)))) ∧ + ContDiff ℝ (⊤ : ℕ∞) w ∧ ∀ p i, entryInjection i (w p)=(F p i : 𝓢'(ℂ,ℂ)) := by + choose F hFe hF using fun i => compact_smooth_sobolev hK (f i) (hf i) (hs i) + have hF₀ (i : n) : ∃ w : P → PL2, ContDiff ℝ (⊤ : ℕ∞) w ∧ + ∀ p, (w p : 𝓢'(ℂ,ℂ))=(F i p : 𝓢'(ℂ,ℂ)) := by + obtain ⟨w,hw,he⟩ := hF i 0 + simp only [Nat.cast_zero,sobolevInjection,neg_zero,besselPotential_zero, + ContinuousLinearMap.id_comp,Lp.toTemperedDistributionCLM_apply] at he + exact ⟨w,hw,he⟩ + choose W hW hWe using hF₀ + let rhs : P → Hilbert n := fun p => WithLp.toLp 2 (fun i => W i p) + have hrhs : ContDiff ℝ (⊤ : ℕ∞) rhs := + ((PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).symm.toContinuousLinearMap.restrictScalars ℝ).contDiff.comp + (contDiff_pi.mpr hW) + exact ⟨fun p i => F i p,rhs,(fun p i z => hFe i p z),(fun N i => hF i N),hrhs, + fun p i => hWe i p⟩ + +/-- Dense-parameter supported weak solvability extends to all parameters in the +actual L2/distribution spaces, and the solution varies strongly smoothly. -/ +theorem global_supported_of_dense {S K : Set ℂ} (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) + (F : P → n → 𝓢(ℂ,ℂ)) (f : P → Hilbert n) + (hf : ContDiff ℝ (⊤ : ℕ∞) f) (hFe : ∀ p i, entryInjection i (f p)=(F p i : 𝓢'(ℂ,ℂ))) + {D : Set P} (hD : Dense D) + (hex : ∀ p∈D, ∃ w : Hilbert n, ∀ i, + planarOperator (fun i j z => a i j (p,z)) i w=entryInjection i (f p) ∧ + LocalEqual Sᶜ (entryInjection i w) 0) : + ∃ u : P → Hilbert n, ContDiff ℝ (⊤ : ℕ∞) u ∧ ∀ p i, + planarOperator (fun i j z => a i j (p,z)) i (u p)=entryInjection i (f p) ∧ + LocalEqual Sᶜ (entryInjection i (u p)) 0 := by + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + have hex' : ∀ p∈D, ∃ v : n → Test, (∀ i, tsupport (v i : ℂ → ℂ)⊆S) ∧ + ∀ i, planarOperator (fun i j z => a i j (p,z)) i (embed v)=entryInjection i (f p) := by + intro p hp + obtain ⟨w,hw⟩ := hex p hp + obtain ⟨v,hv,hvs⟩ := supported_weak_is_test hS (fun i j z => a i j (p,z)) + (hat p) w (F p) (fun i => (hw i).1.trans (hFe p i)) (fun i => (hw i).2) + exact ⟨v,hvs,fun i => by rw [hv]; exact (hw i).1⟩ + let Q : P → Set (Hilbert n) := fun p => {w | ∀ i, + planarOperator (fun i j z => a i j (p,z)) i w=entryInjection i (f p) ∧ + LocalEqual Sᶜ (entryInjection i w) 0} + have hconv : ∀ p, Convex ℝ (Q p) := by + intro p u hu v hv b c _ _ hbc i + have hh : (b : ℂ)+(c : ℂ)=1 := by exact_mod_cast hbc + change planarOperator (fun i j z => a i j (p,z)) i + ((b : ℂ) • u+(c : ℂ) • v)=_ ∧ _ + constructor + · ext φ + simp only [map_add,map_smul,(hu i).1,(hv i).1,add_apply,smul_apply,smul_eq_mul] + rw [← add_mul,hh,one_mul] + · intro φ hφ hφs + change (entryInjection i ((b : ℂ) • u+(c : ℂ) • v)) φ=0 + simp only [map_add,map_smul,add_apply,smul_apply,(hu i).2 φ hφ hφs, + (hv i).2 φ hφ hφs,zero_apply,smul_zero,add_zero] + have hlocal : ∀ p : P, ∃ U ∈ nhds p, ∃ u : P → Hilbert n, + ContMDiffOn 𝓘(ℝ,P) 𝓘(ℝ,Hilbert n) (⊤ : ℕ∞) u U ∧ ∀ t∈U, u t∈Q t := by + intro p + obtain ⟨U,u,hU,hp,hu,he⟩ := local_supported_of_dense_tests hS hK a ha hs f hf hD hex' p + exact ⟨U,hU.mem_nhds hp,u,hu.contMDiffOn,he⟩ + obtain ⟨u,he⟩ := exists_contMDiffMap_forall_mem_convex_of_local 𝓘(ℝ,P) hconv hlocal + exact ⟨u,u.contMDiff.contDiff,he⟩ +end ElasticityPlanar +namespace ElasticityPlanar +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal BigOperators +open ElasticityRegularity +variable {n : Type*} [Fintype n] +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] [FiniteDimensional ℝ P] +lemma smooth_operator_all_orders {K : Set ℂ} (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j p z, z∉K → a i j (p,z)=0) + (w : P → Hilbert n) (hw : ContDiff ℝ (⊤ : ℕ∞) w) (F : P → n → 𝓢(ℂ,ℂ)) + (hF : ∀ N : ℕ, ∀ i, SmoothSobolev N (fun p => (F p i : 𝓢'(ℂ,ℂ)))) + (he : ∀ p i, planarOperator (fun i j z => a i j (p,z)) i (w p)=(F p i : 𝓢'(ℂ,ℂ))) : + ∀ N : ℕ, ∀ i, SmoothLocalSobolev univ N (fun p => entryInjection i (w p)) := by + let u : P → n → 𝓢'(ℂ,ℂ) := fun p i => entryInjection i (w p) + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + have he' (p : P) (i : n) : LocalEqual univ (ElasticityPlanarDistribution.dbar (u p i)) + ((F p i : 𝓢'(ℂ,ℂ))+∑ j, smulLeftCLM ℂ (fun z => -(a i j (p,z))) (u p j)) := by + intro φ _ _ + have h := congrArg (fun v : 𝓢'(ℂ,ℂ) => v φ) (he p i) + rw [planarOperator_apply] at h + have hn (j : n) : smulLeftCLM ℂ (fun z => -(a i j (p,z))) (u p j)= + -smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j) := by + change smulLeftCLM ℂ (-(fun z => a i j (p,z))) (u p j)=_ + rw [smulLeftCLM_neg (hat p i j),neg_apply] + simp only [hn,Finset.sum_neg_distrib,add_apply,neg_apply] at h ⊢ + change ElasticityPlanarDistribution.dbar (u p i) φ+ + (∑ j, smulLeftCLM ℂ (fun z => a i j (p,z)) (u p j)) φ=(F p i : 𝓢'(ℂ,ℂ)) φ at h + linear_combination h + have hu (i : n) : SmoothLocalSobolev univ 0 (fun p => u p i) := by + have hz : SmoothSobolev 0 (fun p => u p i) := by + let L : Hilbert n →L[ℂ] PL2 := (ContinuousLinearMap.proj i).comp + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : n => PL2)).toContinuousLinearMap + refine ⟨fun p => L (w p),(L.restrictScalars ℝ).contDiff.comp hw,fun p => ?_⟩ + simp only [sobolevInjection,neg_zero,besselPotential_zero,ContinuousLinearMap.id_comp, + Lp.toTemperedDistributionCLM_apply] + rfl + simpa only [Nat.cast_zero] using (SmoothSobolev.local_nat (N := 0) (by simpa only [Nat.cast_zero] using hz) univ) + exact ElasticityPlanarDistribution.smooth_variable_all_orders hK + (fun i j q => -(a i j q)) (fun i j => (ha i j).neg) + (fun i j p z hz => by rw [hs i j p z hz,neg_zero]) + u (fun p i => (F p i : 𝓢'(ℂ,ℂ))) he' hu (fun N i => (hF N i).local_nat univ) + +lemma supported_smooth_test_family {S : Set ℂ} (hS : IsCompact S) + (u : P → Lp ℂ 2 (volume : Measure ℂ)) + (hu : ∀ N : ℕ, SmoothLocalSobolev univ N (fun p => (u p : 𝓢'(ℂ,ℂ)))) + (hs : ∀ p, LocalEqual Sᶜ (u p : 𝓢'(ℂ,ℂ)) 0) : + ∃ v : P → Test, ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 q.2) ∧ + ∀ p, L2 (v p)=u p ∧ tsupport (v p : ℂ → ℂ)⊆S := by + obtain ⟨R,hR,hSR⟩ := hS.isBounded.exists_pos_norm_le + let b : ContDiffBump (0 : ℂ) := ⟨R,R+1,hR,by simp⟩ + let c : ContDiffBump (0 : ℂ) := ⟨R+3,R+4,by linarith,by linarith⟩ + have hc : HasCompactSupport (fun z : ℂ => (c z : ℂ)) := + c.hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + have hcs : ContDiff ℝ (⊤ : ℕ∞) (fun z : ℂ => (c z : ℂ)) := Complex.ofRealCLM.contDiff.comp c.contDiff + have h1 : EqOn (fun z : ℂ => (c z : ℂ)) 1 (Metric.ball 0 (R+3)) := by + intro z hz + change (c z : ℂ)=1 + rw [c.one_of_mem_closedBall (Metric.ball_subset_closedBall hz)] + rfl + obtain ⟨w,hw,hwe⟩ := SmoothLocalSobolev.joint_schwartz_representative + (fun p => (u p : 𝓢'(ℂ,ℂ))) hu hcs hc (subset_univ _) h1 + have hb : HasCompactSupport (fun z : ℂ => (b z : ℂ)) := + b.hasCompactSupport.comp_left (g := Complex.ofReal) (by simp) + let v : P → Test := fun p => ⟨fun z => (b z : ℂ)*w p z, + ⟨(Complex.ofRealCLM.contDiff.comp b.contDiff).mul ((w p).smooth ⊤),hb.mul_right⟩⟩ + refine ⟨v,((Complex.ofRealCLM.contDiff.comp b.contDiff).comp contDiff_snd).mul hw,fun p => ?_⟩ + have hsch (p : P) : ((w p).toLp 2 (volume : Measure ℂ) : 𝓢'(ℂ,ℂ))=(w p : 𝓢'(ℂ,ℂ)) := by + exact Lp.toTemperedDistribution_toLp_eq (w p) + have hlocal : ∀ᵐ z : ℂ, z∈Metric.ball 0 (R+3) → u p z=w p z := by + have he : LocalEqual (Metric.ball 0 (R+3)) (u p : 𝓢'(ℂ,ℂ)) + ((w p).toLp 2 (volume : Measure ℂ) : 𝓢'(ℂ,ℂ)) := by rw [hsch]; exact hwe p + filter_upwards [he.lp_ae Metric.isOpen_ball (u p) ((w p).toLp 2 volume), + (w p).coeFn_toLp 2 volume] with z h hzw using fun hz => (h hz).trans hzw + have hs' : LocalEqual Sᶜ (u p : 𝓢'(ℂ,ℂ)) ((0 : Lp ℂ 2 (volume : Measure ℂ)) : 𝓢'(ℂ,ℂ)) := by + change LocalEqual Sᶜ (u p : 𝓢'(ℂ,ℂ)) ((Lp.toTemperedDistributionCLM ℂ volume 2) 0) + rw [map_zero] + exact hs p + have hzero := LocalEqual.lp_ae hS.isClosed.isOpen_compl (u p) 0 hs' + have hev : L2 (v p)=u p := by + apply Lp.ext + filter_upwards [(toSchwartz (v p)).coeFn_toLp 2 volume,hlocal,hzero,Lp.coeFn_zero ℂ 2 (volume : Measure ℂ)] with z hz hzB hzout hz0 + change (L2 (v p) : ℂ → ℂ) z=v p z at hz + rw [hz] + change (b z : ℂ)*w p z=u p z + by_cases hzS : z∈S + · have hzn : ‖z‖≤R := hSR z hzS + have hzB' : z∈Metric.ball 0 (R+3) := by simpa only [Metric.mem_ball,dist_zero_right] using (show ‖z‖ a i j (p,z)) i w= + (toSchwartz ⟨fun z => f i (p,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) p⟩⟩ : 𝓢'(ℂ,ℂ)) ∧ + LocalEqual Sᶜ (entryInjection i w) 0) : + ∃ v : P → n → Test, + (∀ i, ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 i q.2)) ∧ + (∀ p i, tsupport (v p i : ℂ → ℂ)⊆S) ∧ + ∀ p i z, schwartzDbar (toSchwartz (v p i)) z+ + ∑ j, a i j (p,z)*v p j z=f i (p,z) := by + obtain ⟨F,w,hFe,hF,hw,hwe⟩ := compact_smooth_source hK f hf hfs + have hFt (p : P) (i : n) : F p i=toSchwartz + ⟨fun z => f i (p,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) p⟩⟩ := by + ext z + exact hFe p i z + have hex' : ∀ p∈D, ∃ u : Hilbert n, ∀ i, + planarOperator (fun i j z => a i j (p,z)) i u=entryInjection i (w p) ∧ + LocalEqual Sᶜ (entryInjection i u) 0 := by + intro p hp + obtain ⟨u,hu⟩ := hex p hp + exact ⟨u,fun i => ⟨by rw [hwe,hFt]; exact (hu i).1,(hu i).2⟩⟩ + obtain ⟨u,hu,he⟩ := global_supported_of_dense hS hK a ha hs F w hw hwe hD hex' + have he' (p : P) (i : n) : planarOperator (fun i j z => a i j (p,z)) i (u p)=(F p i : 𝓢'(ℂ,ℂ)) := + (he p i).1.trans (hwe p i) + have hall := smooth_operator_all_orders hK a ha hs u hu F hF he' + choose v hv hve using fun i => supported_smooth_test_family hS (fun p => u p i) + (fun N => hall N i) (fun p => (he p i).2) + have hvu (p : P) : embed (fun i => v i p)=u p := PiLp.ext (fun i => (hve i p).1) + have hat (p : P) (i j : n) : (fun z => a i j (p,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) p).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + refine ⟨fun p i => v i p,hv,(fun p i => (hve i p).2),fun p i z => ?_⟩ + let q : Test := transport (fun i j z => a i j (p,z)) (fun i j => (hat p i j).1) (fun i => v i p) i + have hq : (toSchwartz q : 𝓢'(ℂ,ℂ))=(F p i : 𝓢'(ℂ,ℂ)) := by + rw [← L2_distribution] + change entryInjection i (embed (transport (fun i j z => a i j (p,z)) + (fun i j => (hat p i j).1) (fun i => v i p)))=_ + rw [← planarOperator_test _ (hat p),hvu,he'] + have hp := (show LocalEqual univ (toSchwartz q : 𝓢'(ℂ,ℂ)) (F p i : 𝓢'(ℂ,ℂ)) from + fun φ _ _ => congrArg (fun t : 𝓢'(ℂ,ℂ) => t φ) hq).schwartz_eqOn isOpen_univ (mem_univ z) + have hqv : toSchwartz q=schwartzDbar (toSchwartz (v i p))+ + ∑ j, SchwartzMap.smulLeftCLM ℂ (fun z => a i j (p,z)) (toSchwartz (v j p)) := by + simp only [q,transport,LinearMap.coe_mk,AddHom.coe_mk,map_add,map_smul,map_sum, + toSchwartz_d,schwartzDbar] + congr 1 + exact Finset.sum_congr rfl (fun j _ => toSchwartz_mul _ (hat p i j) (v j p)) + rw [hqv] at hp + simpa only [add_apply,sum_apply,SchwartzMap.smulLeftCLM_apply_apply (hat p i _), + smul_eq_mul,toSchwartz_apply,hFe] using hp + +lemma supported_weak_unique {S : Set ℂ} (hS : IsCompact S) + (a : n → n → ℂ → ℂ) (ha : ∀ i j, (a i j).HasTemperateGrowth) + (u v : Hilbert n) (he : ∀ i, planarOperator a i u=planarOperator a i v) + (hu : ∀ i, LocalEqual Sᶜ (entryInjection i u) 0) + (hv : ∀ i, LocalEqual Sᶜ (entryInjection i v) 0) : u=v := by + apply sub_eq_zero.mp + apply supported_weak_kernel hS a ha (u-v) + · intro i + rw [map_sub,he,sub_self] + · intro i φ hφ hs + simp only [map_sub,sub_apply,hu i φ hφ hs,hv i φ hφ hs,sub_self,zero_apply] +end ElasticityPlanar +namespace ElasticityGeneralSlicing +open Set MeasureTheory TemperedDistribution Filter +open scoped SchwartzMap ENNReal LineDeriv Topology +open ElasticitySlicing +variable {P : Type*} [NormedAddCommGroup P] [InnerProductSpace ℝ P] + [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] +open ElasticityPlanar ElasticityRegularity +open ElasticityPlanarDistribution (Dist dbar) + +lemma tests_determine_supported (S : Set ℂ) (hS : IsCompact S) (u w : PL2) + (hsu : ∀ᵐ z : ℂ, z∉S → u z=0) (hsw : ∀ᵐ z : ℂ, z∉S → w z=0) + (he : ∀ φ : Test, (∫ z, φ z*w z)=(∫ z, testDbar φ z*u z)) : + dbar (u : Dist)+(w : Dist)=0 := by + obtain ⟨χ,hχ,hc,_,hχ1,_⟩ := ElasticityBoundary.compact_smooth_cutoff hS isOpen_univ (subset_univ S) + ext φ + let ψ : Test := ⟨fun z => (χ z : ℂ)*φ z,⟨ + (Complex.ofRealCLM.contDiff.comp hχ).mul (φ.smooth ⊤),hc.comp_left Complex.ofReal_zero |>.mul_right⟩⟩ + have hg (z : ℂ) (hz : z∈S) : (ψ : ℂ → ℂ)=ᶠ[𝓝 z] (φ : ℂ → ℂ) := by + filter_upwards [hχ1.filter_mono (nhds_le_nhdsSet hz)] with y hy + change (χ y : ℂ)*φ y=φ y + simp only [hy,Complex.ofReal_one,one_mul] + have hv (z : ℂ) (hz : z∈S) : ψ z=φ z := (hg z hz).eq_of_nhds + have hd (z : ℂ) (hz : z∈S) : testDbar ψ z=schwartzDbar φ z := by + change fderiv ℝ (ψ : ℂ → ℂ) z 1+Complex.I*fderiv ℝ (ψ : ℂ → ℂ) z Complex.I= + fderiv ℝ (φ : ℂ → ℂ) z 1+Complex.I*fderiv ℝ (φ : ℂ → ℂ) z Complex.I + rw [(hg z hz).fderiv_eq] + have h1 : (∫ z, ψ z*w z)=(∫ z, φ z*w z) := by + apply integral_congr_ae + filter_upwards [hsw] with z hz + by_cases hm : z∈S + · rw [hv z hm] + · rw [hz hm,mul_zero,mul_zero] + have h2 : (∫ z, testDbar ψ z*u z)=(∫ z, schwartzDbar φ z*u z) := by + apply integral_congr_ae + filter_upwards [hsu] with z hz + by_cases hm : z∈S + · rw [hd z hm] + · rw [hz hm,mul_zero,mul_zero] + have hh := h1.symm.trans ((he ψ).trans h2) + have hh' : (w : Dist) φ=(u : Dist) (schwartzDbar φ) := by + simpa only [Lp.toTemperedDistribution_apply,smul_eq_mul] using hh + simp only [dbar,schwartzDbar,add_apply,smul_apply, + TemperedDistribution.lineDerivOp_apply_apply,map_neg,zero_apply,smul_eq_mul] at * + rw [hh',map_add,map_smul] + ring + +lemma supported_local_zero (S : Set ℂ) (u : PL2) + (hsu : ∀ᵐ z : ℂ, z∉S → u z=0) : LocalEqual Sᶜ (u : Dist) 0 := by + intro φ _ hs + rw [Lp.toTemperedDistribution_apply] + change (∫ z, φ z*u z)=0 + apply integral_eq_zero_of_ae + filter_upwards [hsu] with z hz + by_cases hm : z∈S + · have hn : z∉tsupport (φ : ℂ → ℂ) := fun hh => hs hh hm + simp only [image_eq_zero_of_notMem_tsupport hn,zero_mul,Pi.zero_apply] + · simp only [hz hm,mul_zero,Pi.zero_apply] + +omit [BorelSpace P] in +/-- Compact support passes through Fubini and through the chosen L2 representative. -/ +lemma supported_slice (S : Set ℂ) (u : P × ℂ → ℂ) + (hu : MemLp u 2 volume) (hs : ∀ᵐ q : P × ℂ, q.2∉S → u q=0) : + ∀ᵐ t : P, ∀ᵐ z : ℂ, z∉S → sliceLp u t z=0 := by + have hu' := memLp_two_slices (ν := (volume : Measure P)) (κ := (volume : Measure ℂ)) hu + have hs' := Measure.ae_ae_of_ae_prod hs + filter_upwards [hu',hs'] with t hut hst + filter_upwards [sliceLp_coe hut,hst] with z hz hsz + intro h + rw [hz,hsz h] + +/-- The slicing result is an actual global planar distribution equation, +not merely equality on a selected family of test functions. -/ +theorem cylinder_supported_slices (S : Set ℂ) (hS : IsCompact S) + (u w : Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : Integrable (u : P × ℂ → ℂ)) (hw : Integrable (w : P × ℂ → ℂ)) + (hsu : ∀ᵐ q : P × ℂ, q.2∉S → u q=0) (hsw : ∀ᵐ q : P × ℂ, q.2∉S → w q=0) + (he : ∂_{((0:P),(1:ℂ))} (u : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u : 𝓢'(P × ℂ,ℂ))+(w : 𝓢'(P × ℂ,ℂ))=0) : + ∀ᵐ t : P, + dbar (sliceLp u t : Dist)+(sliceLp w t : Dist)=0 ∧ + LocalEqual Sᶜ (sliceLp u t : Dist) 0 := by + have he' := cylinder_weak_slices u w hu hw he + have hsu' := supported_slice S u (Lp.memLp u) hsu + have hsw' := supported_slice S w (Lp.memLp w) hsw + filter_upwards [he',hsu',hsw'] with t ht hut hwt + refine ⟨tests_determine_supported S hS (sliceLp u t) (sliceLp w t) hut hwt ?_, + supported_local_zero S (sliceLp u t) hut⟩ + intro φ + convert ht.2.2 φ using 1 + · apply integral_congr_ae + filter_upwards [sliceLp_coe ht.2.1] with z hz + rw [hz] + · apply integral_congr_ae + filter_upwards [sliceLp_coe ht.1] with z hz + rw [hz] + +end ElasticityGeneralSlicing +namespace ElasticityGeneralSlicing +open Set MeasureTheory TemperedDistribution Filter +open scoped SchwartzMap ENNReal BigOperators Topology LineDeriv +open ElasticitySlicing +variable {P : Type*} [NormedAddCommGroup P] [InnerProductSpace ℝ P] + [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] +open ElasticityPlanar ElasticityRegularity +open ElasticityPlanarDistribution (Dist dbar) +variable {n : Type*} [Fintype n] + +lemma sliced_coefficients (a : n → ℂ → ℂ) (ha : ∀ j,(a j).HasTemperateGrowth) + (u : n → PL2) (w : PL2) (f : Test) + (he : ∀ᵐ z : ℂ, w z=∑ j,a j z*u j z-f z) : + (w : Dist)=∑ j,smulLeftCLM ℂ (a j) (u j : Dist)-(toSchwartz f : Dist) := by + classical + ext φ + have hi (j : n) : Integrable (fun z => φ z*(a j z*u j z)) := by + have hh := ((SchwartzMap.smulLeftCLM ℂ (a j) φ).memLp 2 volume).integrable_mul (Lp.memLp (u j)) + convert hh using 1 + ext z + simp only [Pi.mul_apply,SchwartzMap.smulLeftCLM_apply_apply (ha j),smul_eq_mul] + ring + have hf : Integrable (fun z => φ z*f z) := + (φ.memLp 2 volume).integrable_mul ((toSchwartz f).memLp 2 volume) + have he' : (fun z => φ z*w z)=ᵐ[volume] fun z => (∑ j,φ z*(a j z*u j z))-φ z*f z := by + filter_upwards [he] with z hz + simp only [hz,mul_sub,Finset.mul_sum] + simp only [Lp.toTemperedDistribution_apply,sub_apply,sum_apply, + smulLeftCLM_apply_apply,SchwartzMap.coe_apply,smul_eq_mul] + rw [integral_congr_ae he',integral_sub (integrable_finsetSum _ (fun j _ => hi j)) hf, + integral_finsetSum _ (fun j _ => hi j)] + congr 1 + apply Finset.sum_congr rfl + intro j _ + apply integral_congr_ae + exact Eventually.of_forall (fun z => by + change φ z*(a j z*u j z)=((SchwartzMap.smulLeftCLM ℂ (a j)) φ) z*u j z + rw [SchwartzMap.smulLeftCLM_apply_apply (ha j)] + simp only [smul_eq_mul] + ring) + +/-- Genuine cylinder weak solutions give supported weak planar solutions on a +single full-measure, hence dense, set of transverse parameters. -/ +theorem coupled_slice_equations (S K : Set ℂ) (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j t z,z∉K → a i j (t,z)=0) + (f : n → P × ℂ → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i t z,z∉K → f i (t,z)=0) + (u w : n → Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : ∀ i,Integrable (u i : P × ℂ → ℂ)) (hw : ∀ i,Integrable (w i : P × ℂ → ℂ)) + (hsu : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → u i q=0) + (hsw : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → w i q=0) + (hc : ∀ i,∀ᵐ q : P × ℂ,w i q=∑ j,a i j q*u j q-f i q) + (he : ∀ i, ∂_{((0:P),(1:ℂ))} (u i : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u i : 𝓢'(P × ℂ,ℂ))+(w i : 𝓢'(P × ℂ,ℂ))=0) : + ∀ᵐ t : P, ∀ i, + planarOperator (fun i j z => a i j (t,z)) i + (WithLp.toLp 2 (fun j => sliceLp (u j) t))= + (toSchwartz ⟨fun z => f i (t,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) t⟩⟩ : Dist) ∧ + LocalEqual Sᶜ (sliceLp (u i) t : Dist) 0 := by + classical + have hsl : ∀ᵐ t : P, ∀ i, + dbar (sliceLp (u i) t : Dist)+(sliceLp (w i) t : Dist)=0 ∧ + LocalEqual Sᶜ (sliceLp (u i) t : Dist) 0 := by + rw [ae_all_iff] + exact fun i => cylinder_supported_slices S hS (u i) (w i) (hu i) (hw i) (hsu i) (hsw i) (he i) + have huc : ∀ᵐ t : P,∀ i, MemLp (fun z => u i (t,z)) 2 volume := by + rw [ae_all_iff] + exact fun i => memLp_two_slices (Lp.memLp (u i)) + have hwc : ∀ᵐ t : P,∀ i, MemLp (fun z => w i (t,z)) 2 volume := by + rw [ae_all_iff] + exact fun i => memLp_two_slices (Lp.memLp (w i)) + have hcc : ∀ᵐ t : P,∀ i,∀ᵐ z : ℂ,w i (t,z)=∑ j,a i j (t,z)*u j (t,z)-f i (t,z) := by + rw [ae_all_iff] + exact fun i => Measure.ae_ae_of_ae_prod (hc i) + filter_upwards [hsl,huc,hwc,hcc] with t ht hut hwt hct + intro i + refine ⟨?_,(ht i).2⟩ + let ft : Test := ⟨fun z => f i (t,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) t⟩⟩ + have hac (j : n) : (fun z => a i j (t,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) t).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + have hrel : ∀ᵐ z : ℂ,sliceLp (w i) t z=∑ j,a i j (t,z)*sliceLp (u j) t z-ft z := by + have huall : ∀ᵐ z : ℂ,∀ j,sliceLp (u j) t z=u j (t,z) := by + rw [ae_all_iff] + exact fun j => sliceLp_coe (hut j) + filter_upwards [sliceLp_coe (hwt i),huall,hct i] with z hwz huz hcz + simpa only [hwz,huz] using hcz + have hh := sliced_coefficients (fun j z => a i j (t,z)) hac + (fun j => sliceLp (u j) t) (sliceLp (w i) t) ft hrel + have hz := (ht i).1 + rw [hh] at hz + rw [planarOperator_apply] + change dbar (sliceLp (u i) t : Dist)+∑ j,smulLeftCLM ℂ (fun z => a i j (t,z)) + (sliceLp (u j) t : Dist)=(toSchwartz ft : Dist) + exact sub_eq_zero.mp (by simpa only [add_sub_assoc] using hz) + +/-- Completion of the almost-every-plane to every-plane step. No smooth weak +representative or nowhere-exceptional slicing has been assumed. -/ +theorem smooth_supported_of_cylinder (S K : Set ℂ) (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j t z,z∉K → a i j (t,z)=0) + (f : n → P × ℂ → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i t z,z∉K → f i (t,z)=0) + (u w : n → Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : ∀ i,Integrable (u i : P × ℂ → ℂ)) (hw : ∀ i,Integrable (w i : P × ℂ → ℂ)) + (hsu : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → u i q=0) + (hsw : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → w i q=0) + (hc : ∀ i,∀ᵐ q : P × ℂ,w i q=∑ j,a i j q*u j q-f i q) + (he : ∀ i, ∂_{((0:P),(1:ℂ))} (u i : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u i : 𝓢'(P × ℂ,ℂ))+(w i : 𝓢'(P × ℂ,ℂ))=0) : + ∃ v : P → n → Test, + (∀ i,ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 i q.2)) ∧ + (∀ t i,tsupport (v t i : ℂ → ℂ)⊆S) ∧ + ∀ t i z,schwartzDbar (toSchwartz (v t i)) z+∑ j,a i j (t,z)*v t j z=f i (t,z) := by + have hh := coupled_slice_equations S K hS hK a ha hs f hf hfs u w hu hw hsu hsw hc he + exact supported_parameter_inversion hS hK a ha hs f hf hfs (Measure.dense_of_ae hh) + (fun t ht => ⟨WithLp.toLp 2 (fun i => sliceLp (u i) t),ht⟩) +end ElasticityGeneralSlicing +namespace ElasticityGeneralSlicing +open Set MeasureTheory TemperedDistribution Filter +open scoped SchwartzMap ENNReal BigOperators Topology LineDeriv +open ElasticitySlicing ElasticityPlanar ElasticityRegularity +open ElasticityPlanarDistribution (Dist dbar) +variable {n : Type*} [Fintype n] + +lemma classical_planar_distribution (a : n → n → ℂ → ℂ) + (ha : ∀ i j,(a i j).HasTemperateGrowth) (v : n → Test) (f : n → Test) + (he : ∀ i z,schwartzDbar (toSchwartz (v i)) z+∑ j,a i j z*v j z=f i z) (i : n) : + planarOperator a i (embed v)=(toSchwartz (f i) : Dist) := by + rw [planarOperator_test a ha v i,entryInjection_apply,embed_apply,L2_distribution] + congr 1 + ext z + have ht : toSchwartz (transport a (fun i j => (ha i j).1) v i)= + schwartzDbar (toSchwartz (v i))+∑ j,SchwartzMap.smulLeftCLM ℂ (a i j) (toSchwartz (v j)) := by + simp only [transport,LinearMap.coe_mk,AddHom.coe_mk,map_add,map_smul,map_sum, + toSchwartz_d,schwartzDbar] + congr 1 + exact Finset.sum_congr rfl (fun j _ => toSchwartz_mul _ (ha i j) (v j)) + rw [ht] + simpa only [add_apply,sum_apply,SchwartzMap.smulLeftCLM_apply_apply (ha i _), + smul_eq_mul,toSchwartz_apply] using he i z + +variable {P : Type*} [NormedAddCommGroup P] [InnerProductSpace ℝ P] + [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] + +/-- The jointly smooth solution is the actual weak cylinder solution, not an +unrelated branch. Supported uniqueness identifies it on almost every slice. -/ +theorem smooth_cylinder_representative (S K : Set ℂ) (hS : IsCompact S) (hK : IsCompact K) + (a : n → n → P × ℂ → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (hs : ∀ i j t z,z∉K → a i j (t,z)=0) + (f : n → P × ℂ → ℂ) (hf : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (f i)) + (hfs : ∀ i t z,z∉K → f i (t,z)=0) + (u w : n → Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : ∀ i,Integrable (u i : P × ℂ → ℂ)) (hw : ∀ i,Integrable (w i : P × ℂ → ℂ)) + (hsu : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → u i q=0) + (hsw : ∀ i,∀ᵐ q : P × ℂ,q.2∉S → w i q=0) + (hc : ∀ i,∀ᵐ q : P × ℂ,w i q=∑ j,a i j q*u j q-f i q) + (he : ∀ i, ∂_{((0:P),(1:ℂ))} (u i : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u i : 𝓢'(P × ℂ,ℂ))+(w i : 𝓢'(P × ℂ,ℂ))=0) : + ∃ v : P → n → Test, + (∀ i,ContDiff ℝ (⊤ : ℕ∞) (fun q : P × ℂ => v q.1 i q.2)) ∧ + (∀ t i,tsupport (v t i : ℂ → ℂ)⊆S) ∧ + (∀ t i z,schwartzDbar (toSchwartz (v t i)) z+∑ j,a i j (t,z)*v t j z=f i (t,z)) ∧ + ∀ i,(u i : P × ℂ → ℂ)=ᵐ[volume] fun q => v q.1 i q.2 := by + obtain ⟨v,hv,hvs,hve⟩ := smooth_supported_of_cylinder S K hS hK a ha hs f hf hfs + u w hu hw hsu hsw hc he + refine ⟨v,hv,hvs,hve,fun i => ?_⟩ + have hsl := coupled_slice_equations S K hS hK a ha hs f hf hfs u w hu hw hsu hsw hc he + have hu' := memLp_two_slices (Lp.memLp (u i)) + have ha' (t i j) : (fun z => a i j (t,z)).HasTemperateGrowth := + (compact_slice hK (a i j) (hs i j) t).hasTemperateGrowth + ((ha i j).comp (contDiff_const.prodMk contDiff_id)) + have hp (t i) : planarOperator (fun i j z => a i j (t,z)) i (embed (v t))= + (toSchwartz ⟨fun z => f i (t,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) t⟩⟩ : Dist) := + classical_planar_distribution _ (ha' t) (v t) + (fun i => ⟨fun z => f i (t,z),⟨(hf i).comp (contDiff_const.prodMk contDiff_id), + compact_slice hK (f i) (hfs i) t⟩⟩) (hve t) i + have hre : ∀ᵐ t : P,∀ᵐ z : ℂ,u i (t,z)=v t i z := by + filter_upwards [hsl,hu'] with t ht hut + have hh : (WithLp.toLp 2 (fun j => sliceLp (u j) t) : Hilbert n)=embed (v t) := + supported_weak_unique hS _ (ha' t) _ _ (fun j => (ht j).1.trans (hp t j).symm) + (fun j => (ht j).2) (fun j => test_support_distribution (v t j) (hvs t j)) + have hi : sliceLp (u i) t=L2 (v t i) := congrArg (fun w : Hilbert n => w i) hh + filter_upwards [sliceLp_coe hut,(toSchwartz (v t i)).coeFn_toLp 2 volume] with z hz hzv + change L2 (v t i) z=v t i z at hzv + exact hz.symm.trans ((congrArg (fun w : PL2 => w z) hi).trans hzv) + apply (Measure.ae_prod_iff_ae_ae ?_).mpr hre + exact measurableSet_eq_fun (Lp.stronglyMeasurable (u i)).measurable (hv i).continuous.measurable + +end ElasticityGeneralSlicing + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Transfer.lean b/lean/OAI/MathematicalPhysics/Elasticity/Transfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c6198b2908a9f64b10313f2554f967a52bf4ec4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Transfer.lean @@ -0,0 +1,707 @@ +import OAI.MathematicalPhysics.Elasticity.WeakSolutions +import OAI.MathematicalPhysics.Elasticity.CGO + +namespace OAI + +section +noncomputable section +open Set MeasureTheory +open scoped BigOperators SchwartzMap +namespace ElasticityCGO +open ElasticityAugmented +open ElasticityPhysicalAlgebra (toSmooth toSmooth_apply toSmooth_physical physical phase) +open ElasticityDistribution (finiteResidual) +abbrev S := SchwartzMap X ℂ + +/-- A compact cutoff acts on every smooth amplitude, without any temperate +assumption on the amplitude itself. -/ +def cut (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) : Smooth →ₗ[ℂ] S where + toFun f := (hc.mul_right : HasCompactSupport ((χ : X → ℂ)*(f : X → ℂ))).toSchwartzMap + ((smooth_coe χ).mul (smooth_coe f)) + map_add' f g := by + ext x + change (χ : X → ℂ) x*((f : X → ℂ) x+(g : X → ℂ) x)=_ + exact mul_add _ _ _ + map_smul' c f := by + ext x + change (χ : X → ℂ) x*(c*(f : X → ℂ) x)=c*((χ : X → ℂ) x*(f : X → ℂ) x) + ring +@[simp] lemma cut_apply (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (f : Smooth) (x : X) : + cut χ hc f x=(χ : X → ℂ) x*(f : X → ℂ) x := rfl +lemma cut_local {U : Set X} (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (hχ : EqOn (χ : X → ℂ) 1 U) (f : Smooth) : + restrictSmooth U (toSmooth (cut χ hc f))=restrictSmooth U f := by + apply (restrictSmooth_eq_iff U _ _).mpr + intro x hx + simp only [toSmooth_apply,cut_apply,hχ hx,Pi.one_apply,one_mul] +lemma physical_cut_local {U : Set X} (hU : IsOpen U) + (z : Fin 3 → ℂ) (lam m χ : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + (u : Fin 3 → Smooth) (i : Fin 3) : + EqOn (physical z lam m (fun j => cut χ hc (u j)) i : X → ℂ) + ((LT (shifted coord z) lam m u i : Smooth) : X → ℂ) U := by + change EqOn ((toSmooth (physical z lam m (fun j => cut χ hc (u j)) i) : Smooth) : X → ℂ) _ U + apply (restrictSmooth_eq_iff U _ _).mp + rw [toSmooth_physical z lam m hl hm,restrict_LT hU,restrict_LT hU] + congr 1 + funext j + exact cut_local χ hc hχ (u j) + +def residual0 (lam m : Smooth) (a : Amplitude Smooth) (i : Fin 3) : Smooth := + R coord lam m a.1 a.2 i+(lam+m)*coord i (div coord a.1-a.2)+ + coord i lam*(div coord a.1-a.2) +def residual1 (θ : Fin 3 → ℂ) (lam m : Smooth) (a : Amplitude Smooth) (i : Fin 3) : Smooth := + θ i • ((lam+m)*(div coord a.1-a.2)) + +/-- The actual Schwartz residual has precisely the two powers h^8 and h^7. +The amplitude recursions are only required on the indicated open region. -/ +theorem cut_truncation_residual {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (lam m χ : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + (h : ℝ) (hh : h≠0) (a : ℕ → Amplitude Smooth) + (hR₀ : leadingR (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U m) + (localAmp U (a 0)).1 (localAmp U (a 0)).2=0) + (hn₀ : normal θ (a 0).1=0) + (hrec : ∀ j<8,RecursOn hU θ lam m (a j) (a (j+1))) (i : Fin 3) : + EqOn (physical ((h : ℂ)⁻¹ • θ) lam m + (fun j => cut χ hc ((truncation (h : ℂ) 8 a).1 j)) i : X → ℂ) + (finiteResidual h (fun j => cut χ hc (residual0 lam m (a 8) j)) + (fun j => cut χ hc (residual1 θ lam m (a 8) j)) i : X → ℂ) U := by + intro x hx + rw [physical_cut_local hU _ lam m χ hl hm hc hχ _ i hx] + have hh' : (h : ℂ)≠0 := by exact_mod_cast hh + rw [physical_truncation_residual_on hU θ hθ lam m (h : ℂ) hh' 8 a hR₀ hn₀ hrec i hx] + change (h : ℂ)^8 * ( _ + ((h : ℂ)⁻¹*θ i) * _) = + (h : ℂ)^8 * ((χ : X → ℂ) x * (residual0 lam m (a 8) i : X → ℂ) x) + + (h : ℂ)^7 * ((χ : X → ℂ) x * (residual1 θ lam m (a 8) i : X → ℂ) x) + rw [hχ hx] + change (h : ℂ)^8 * ( _ + ((h : ℂ)⁻¹*θ i) * _) = + (h : ℂ)^8 * (1 * _) + (h : ℂ)^7 * (1 * (θ i * _)) + simp only [one_mul,residual0] + field_simp + +lemma phase_eq (h : ℝ) (α β : X) : + phase h α β=(h : ℂ)⁻¹ • (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) := by + funext i + simp only [phase,Pi.smul_apply,smul_eq_mul,div_eq_mul_inv,mul_comm] +end ElasticityCGO + +end +end +section +noncomputable section +open Set MeasureTheory +open scoped Topology BigOperators SchwartzMap +namespace ElasticityPhysicalAlgebra +open ElasticityAugmented + +lemma physical_eqOn_of_eqOn {U : Set X} (hU : IsOpen U) + (z : Fin 3 → ℂ) (lam m : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (f g : Fin 3 → SchwartzMap X ℂ) (hfg : ∀ j,EqOn (f j : X → ℂ) (g j) U) (i : Fin 3) : + EqOn (physical z lam m f i : X → ℂ) (physical z lam m g i) U := by + change EqOn ((toSmooth (physical z lam m f i) : Smooth) : X → ℂ) + ((toSmooth (physical z lam m g i) : Smooth) : X → ℂ) U + apply (restrictSmooth_eq_iff U _ _).mp + rw [toSmooth_physical z lam m hl hm,toSmooth_physical z lam m hl hm, + restrict_LT hU,restrict_LT hU] + congr 1 + funext j + exact (restrictSmooth_eq_iff U _ _).mpr (hfg j) + +/-- A local physical transfer that agrees off a compact set gives a genuinely +compact supported global difference, without changing the physical equation +on its open domain. -/ +theorem compactify_physical_transfer {K U : Set X} (hK : IsCompact K) + (hU : IsOpen U) (hKU : K⊆U) (lam m : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (F G : Fin 3 → SchwartzMap X ℂ) (hG : ∀ i,EqOn (physical 0 lam m G i : X → ℂ) 0 U) + (he : ∀ i,EqOn (G i : X → ℂ) (F i) (U\K)) : + ∃ H : Fin 3 → SchwartzMap X ℂ,(∀ i,tsupport (H i)⊆K) ∧ + (∀ i,EqOn (physical 0 lam m (F+H) i : X → ℂ) 0 U) ∧ + (∀ i,EqOn ((F+H) i : X → ℂ) (G i) U) := by + obtain ⟨χ,hχ,hc,hs,h1,_⟩ := ElasticityBoundary.compact_smooth_cutoff hK hU hKU + let c : Smooth := ⟨fun x => (χ x : ℂ),Complex.ofRealCLM.contDiff.comp hχ⟩ + have hc' : HasCompactSupport (c : X → ℂ) := hc.comp_left Complex.ofReal_zero + let H : Fin 3 → SchwartzMap X ℂ := fun i => ElasticityCGO.cut c hc' (toSmooth (G i-F i)) + have hH (i) (x) : H i x=(χ x : ℂ)*(G i x-F i x) := rfl + have heq : ∀ i,EqOn ((F+H) i : X → ℂ) (G i) U := by + intro i x hx + change F i x+H i x=G i x + rw [hH] + by_cases hxK : x∈K + · have hx1 : χ x=1 := mem_of_mem_nhds (s := {y : X | χ y=1}) (x := x) (h1.filter_mono (nhds_le_nhdsSet hxK)) + rw [hx1,Complex.ofReal_one,one_mul] + ring + · rw [he i ⟨hx,hxK⟩,sub_self,mul_zero,add_zero] + refine ⟨H,?_,?_,heq⟩ + · intro i + apply closure_minimal _ hK.isClosed + intro x hx + by_contra hnot + apply hx + rw [hH] + by_cases hxU : x∈U + · rw [he i ⟨hxU,hnot⟩,sub_self,mul_zero] + · have hz : χ x=0 := image_eq_zero_of_notMem_tsupport (fun hh => hxU (hs hh)) + rw [hz,Complex.ofReal_zero,zero_mul] + · intro i x hx + exact (physical_eqOn_of_eqOn hU 0 lam m hl hm (F+H) G heq i hx).trans (hG i hx) +end ElasticityPhysicalAlgebra + +namespace Elasticity +open ElasticityDistribution +open ElasticityPhysicalAlgebra (physical) +variable {Ω B B' : Set X} {lam₁ mu₁ lam₂ mu₂ : X → ℝ} + +/-- A supported smooth physical difference derived from the actual DN equality. +This is the literal compact support needed for the augmented Carleman estimate. -/ +theorem physical_supported_transfer + (ha₁ : Admissible Ω lam₁ mu₁) (ha₂ : Admissible Ω lam₂ mu₂) + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hΩB : Ω⊆B) + (hB : IsOpen B) (hB' : IsOpen B') (hsub : B'⊆B) (hcl : closure Ω⊆B') + (hl₁ : BoundedCoefficient B lam₁) (hm₁ : BoundedCoefficient B mu₁) + (hl₂ : BoundedCoefficient B lam₂) (hm₂ : BoundedCoefficient B mu₂) + (he : ∀ x∉Ω, lam₁ x=lam₂ x ∧ mu₁ x=mu₂ x) + (hDN : DN Ω lam₁ mu₁=DN Ω lam₂ mu₂) + (L₁ M₁ L₂ M₂ N₂ O₂ : Coeff) (hN : N₂*M₂=1) (hO : O₂*(L₂+M₂+M₂)=1) + (hL₁ : ∀ᵐ x ∂(volume.restrict B), eval L₁ x=(lam₁ x : ℂ)) + (hM₁ : ∀ᵐ x ∂(volume.restrict B), eval M₁ x=(mu₁ x : ℂ)) + (hL₂ : ∀ᵐ x ∂(volume.restrict B), eval L₂ x=(lam₂ x : ℂ)) + (hM₂ : ∀ᵐ x ∂(volume.restrict B), eval M₂ x=(mu₂ x : ℂ)) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆B) (h1 : Set.EqOn g 1 B') (F : Fin 3 → SchwartzMap X ℂ) + (hF : ∀ i, Set.EqOn (physical 0 (eval L₁) (eval M₁) F i : X → ℂ) 0 B) : + ∃ H : Fin 3 → SchwartzMap X ℂ,(∀ i,tsupport (H i)⊆closure Ω) ∧ + (∀ i,EqOn (physical 0 (eval L₂) (eval M₂) (F+H) i : X → ℂ) 0 B') ∧ + (∀ i,EqOn ((F+H) i : X → ℂ) (F i) (closure Ω)ᶜ) := by + obtain ⟨G,hG,heG⟩ := physical_classical_transfer ha₁ ha₂ hΩ hOB hΩB hB hB' hsub + hl₁ hm₁ hl₂ hm₂ he hDN L₁ M₁ L₂ M₂ N₂ O₂ hN hO hL₁ hM₁ hL₂ hM₂ hg hc hs h1 F hF + obtain ⟨H,hH,hp,_⟩ := ElasticityPhysicalAlgebra.compactify_physical_transfer + hOB.isCompact_closure hB' hcl L₂.val M₂.val (growth L₂) (growth M₂) F G hG heG + refine ⟨H,hH,hp,?_⟩ + intro i x hx + have hz : H i x=0 := image_eq_zero_of_notMem_tsupport (fun hh => hx (hH i hh)) + change F i x+H i x=F i x + rw [hz,add_zero] +end Elasticity + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented +section Algebra +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable {ι : Type*} [Fintype ι] +variable (D : ι → Derivation ℂ A A) (z : ι → ℂ) (χ : A) +omit [Fintype ι] in +lemma deriv_phase_mul (hχ : ∀ i,D i χ=z i • χ) (i : ι) (f : A) : + D i (χ*f)=χ*(shifted D z i f) := by + rw [partial_mul,hχ,shifted_apply] + simp only [Algebra.smul_def] + ring + +/-- The shifted operator is the literal exponential conjugation of the +physical stress-divergence, not a new PDE declared equivalent by hypothesis. -/ +theorem physical_phase_conjugation (hχ : ∀ i,D i χ=z i • χ) + (lam m : A) (u : ι → A) (i : ι) : + LT (fun j => (D j).toLinearMap) lam m (fun j => χ*u j) i = + χ*LT (shifted D z) lam m u i := by + have hd (j) (f) := deriv_phase_mul D z χ hχ j f + change D i (lam*(∑ j,D j (χ*u j)))+ + ∑ j,D j (m*(D j (χ*u i)+D i (χ*u j)))=_ + simp only [hd,← Finset.mul_sum,← mul_add] + have hfirst : lam*(χ*(∑ j,shifted D z j (u j)))=χ*(lam*(∑ j,shifted D z j (u j))) := by ring + have hsecond (j) : m*(χ*(shifted D z j (u i)+shifted D z i (u j)))= + χ*(m*(shifted D z j (u i)+shifted D z i (u j))) := by ring + rw [hfirst,hd] + simp_rw [hsecond,hd] + rw [← Finset.mul_sum,← mul_add] + rfl +end Algebra + +/-- An arbitrary complex linear frequency gives a genuine global smooth +exponential on the physical real space. -/ +def exponential (L : X →L[ℝ] ℂ) : Smooth := ⟨fun x => Complex.exp (L x),by + exact (show ContDiff ℝ (⊤ : ℕ∞) (fun x => Complex.exp (L x)) from L.contDiff.cexp)⟩ +lemma coord_exponential (L : X →L[ℝ] ℂ) (i : Fin 3) : + coord i (exponential L)=L (e i) • exponential L := by + apply Subtype.ext + funext x + have hh := congrArg (fun K : X →L[ℝ] ℂ => K (e i)) (L.hasFDerivAt.cexp.fderiv (x := x)) + change fderiv ℝ (fun y => Complex.exp (L y)) x (e i)=L (e i)*Complex.exp (L x) + simpa only [smul_apply,smul_eq_mul,mul_comm] using hh +lemma exponential_ne_zero (L : X →L[ℝ] ℂ) (x : X) : (exponential L : X → ℂ) x≠0 := + Complex.exp_ne_zero _ + +theorem physical_exponential_conjugation (L : X →L[ℝ] ℂ) (lam m : Smooth) + (u : Fin 3 → Smooth) (i : Fin 3) : + LT (fun j => (coord j).toLinearMap) lam m (fun j => exponential L*u j) i= + exponential L*LT (shifted coord (fun j => L (e j))) lam m u i := + physical_phase_conjugation coord (fun j => L (e j)) (exponential L) (coord_exponential L) lam m u i +end ElasticityAugmented + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators FourierTransform + +namespace ElasticityCarleman + +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev Y := EuclideanSpace ℂ (Fin 4) +abbrev Direction := Fin 3 → ℂ + +def e (i : Fin 3) : X := EuclideanSpace.single i 1 + +def deriv (f : X → Y) (i : Fin 3) : X → Y := + fun x => fderiv ℝ f x (e i) + +def laplacian (f : X → Y) : X → Y := + fun x => ∑ i, deriv (deriv f i) i x + +def phase (θ : Direction) (x : X) : ℂ := ∑ i, θ i * (x i : ℂ) + +def conjugate (θ : Direction) (h : ℝ) (f : X → Y) : X → Y := + fun x => Complex.exp (-(h : ℂ)⁻¹ * phase θ x) • f x + +/-- The sum-of-component semiclassical Fourier norm, written using the +Euclidean norm on the target; this is exactly that sum under the square root. -/ +def sobolevNorm (h s : ℝ) (f : X → Y) : ℝ := + Real.sqrt (∫ ξ : X, (1 + h ^ 2 * ‖ξ‖ ^ 2) ^ s * ‖𝓕 f ξ‖ ^ 2) + +def normalizedOperator (A : Fin 3 → X → Y →L[ℂ] Y) (A₀ : X → Y →L[ℂ] Y) + (f : X → Y) : X → Y := + fun x => laplacian f x + (∑ i, A i x (deriv f i x)) + A₀ x (f x) + +def SupportedCarlemanClaim : Prop := + ∀ (A : Fin 3 → X → Y →L[ℂ] Y) (A₀ : X → Y →L[ℂ] Y), + (∀ i, ContDiff ℝ (⊤ : ℕ∞) (A i)) → ContDiff ℝ (⊤ : ℕ∞) A₀ → + ∀ (θ : Direction), θ ≠ 0 → (∑ i, θ i * θ i) = 0 → + ∀ (x₀ : X) (r : ℝ), 0 < r → + ∃ C : ℝ, 0 < C ∧ ∃ h₀ : ℝ, 0 < h₀ ∧ + ∀ h : ℝ, 0 < h → h < h₀ → ∀ U : X → Y, + ContDiff ℝ (⊤ : ℕ∞) U → HasCompactSupport U → + tsupport U ⊆ Metric.ball x₀ r → + sobolevNorm h 1 (conjugate θ h U) ≤ + C * h * sobolevNorm h (-1) (conjugate θ h (normalizedOperator A A₀ U)) + +/-- The real-linear complex phase functional. -/ +def phaseCLM (θ : Direction) : X →L[ℝ] ℂ := + ∑ i, θ i • (Complex.ofRealCLM.comp (EuclideanSpace.proj i)) + +lemma phaseCLM_apply (θ : Direction) (x : X) : phaseCLM θ x = phase θ x := by + simp [phaseCLM, phase] + +lemma phaseCLM_e (θ : Direction) (i : Fin 3) : phaseCLM θ (e i) = θ i := by + simp [phaseCLM, e, EuclideanSpace.proj, apply_ite] + +def expPhase (θ : Direction) (z : ℂ) (x : X) : ℂ := Complex.exp (z * phase θ x) + +lemma contDiff_expPhase (θ : Direction) (z : ℂ) : + ContDiff ℝ (⊤ : ℕ∞) (expPhase θ z) := by + have hp : ContDiff ℝ (⊤ : ℕ∞) (phase θ) := by + have he : (phaseCLM θ : X → ℂ) = phase θ := funext (phaseCLM_apply θ) + rw [← he] + exact (phaseCLM θ).contDiff + exact (contDiff_const.mul hp).cexp + +lemma fderiv_expPhase (θ : Direction) (z : ℂ) (x : X) : + fderiv ℝ (expPhase θ z) x = (expPhase θ z x * z) • phaseCLM θ := by + have hd := (((phaseCLM θ).hasFDerivAt (x := x)).const_mul z).cexp + change fderiv ℝ (fun x => Complex.exp (z * phase θ x)) x = _ + simpa [expPhase, phaseCLM_apply, smul_smul] using hd.fderiv + +lemma contDiff_deriv {f : X → Y} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (i : Fin 3) : + ContDiff ℝ (⊤ : ℕ∞) (deriv f i) := by + exact (hf.fderiv_right (by simp)).clm_apply contDiff_const + +lemma deriv_add {f g : X → Y} (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) + (i : Fin 3) : deriv (fun x => f x + g x) i = fun x => deriv f i x + deriv g i x := by + funext x + simp [deriv, fderiv_fun_add (hf x) (hg x)] + +lemma deriv_const_smul {f : X → Y} (hf : Differentiable ℝ f) (a : ℂ) (i : Fin 3) : + deriv (fun x => a • f x) i = fun x => a • deriv f i x := by + funext x + change fderiv ℝ (a • f) x (e i) = a • fderiv ℝ f x (e i) + rw [fderiv_const_smul (hf x)] + rfl + +lemma deriv_expPhase_smul {f : X → Y} (hf : Differentiable ℝ f) + (θ : Direction) (z : ℂ) (i : Fin 3) : + deriv (fun x => expPhase θ z x • f x) i = + fun x => expPhase θ z x • (deriv f i x + (z * θ i) • f x) := by + funext x + rw [deriv, fderiv_fun_smul ((contDiff_expPhase θ z).differentiable (by simp) x) (hf x), + fderiv_expPhase] + simp [deriv, phaseCLM_e, smul_add, smul_smul, mul_assoc] + +lemma second_deriv_expPhase_smul {f : X → Y} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (θ : Direction) (z : ℂ) (i : Fin 3) : + deriv (deriv (fun x => expPhase θ z x • f x) i) i = + fun x => expPhase θ z x • (deriv (deriv f i) i x + + (2 * (z * θ i)) • deriv f i x + ((z * θ i) ^ 2) • f x) := by + have hdf := (contDiff_deriv hf i).differentiable (by simp) + have hfd := hf.differentiable (by simp) + rw [deriv_expPhase_smul hfd, + deriv_expPhase_smul (f := fun x => deriv f i x + (z * θ i) • f x) + (hdf.fun_add (hfd.fun_const_smul (z * θ i))), + deriv_add hdf (hfd.fun_const_smul (z * θ i)), + deriv_const_smul hfd] + funext x + apply congrArg (fun y : Y => expPhase θ z x • y) + simp only [smul_add, smul_smul, pow_two] + module + +/-- Exact second-order conjugation before using the characteristic equation. -/ +lemma laplacian_expPhase_smul {f : X → Y} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (θ : Direction) (z : ℂ) : + laplacian (fun x => expPhase θ z x • f x) = fun x => + expPhase θ z x • (laplacian f x + + (2 * z) • (∑ i, θ i • deriv f i x) + + (z ^ 2 * (∑ i, θ i * θ i)) • f x) := by + funext x + simp only [laplacian, second_deriv_expPhase_smul hf, ← Finset.smul_sum, + Finset.sum_add_distrib] + apply congrArg (fun y : Y => expPhase θ z x • y) + have h₁ : (∑ i : Fin 3, (2 * (z * θ i)) • deriv f i x) = + (2 * z) • ∑ i, θ i • deriv f i x := by + simp [Finset.smul_sum, smul_smul, mul_assoc] + have h₂ : (∑ i : Fin 3, ((z * θ i) ^ 2) • f x) = + (z ^ 2 * (∑ i, θ i * θ i)) • f x := by + rw [← Finset.sum_smul] + apply congrArg (fun a : ℂ => a • f x) + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + rw [h₁, h₂] + +/-- The null phase removes the order-two parameter term, exactly as used in +both the supported estimate and the formal physical recursion. -/ +lemma laplacian_expPhase_smul_null {f : X → Y} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (θ : Direction) (hθ : (∑ i, θ i * θ i) = 0) (z : ℂ) : + laplacian (fun x => expPhase θ z x • f x) = fun x => + expPhase θ z x • (laplacian f x + (2 * z) • (∑ i, θ i • deriv f i x)) := by + simpa [hθ] using laplacian_expPhase_smul hf θ z + +/-- Full normalized conjugation identity, retaining the lower-order matrices. -/ +lemma normalized_expPhase_smul {f : X → Y} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (A : Fin 3 → X → Y →L[ℂ] Y) (A₀ : X → Y →L[ℂ] Y) + (θ : Direction) (hθ : (∑ i, θ i * θ i) = 0) (z : ℂ) : + normalizedOperator A A₀ (fun x => expPhase θ z x • f x) = + fun x => expPhase θ z x • (normalizedOperator A A₀ f x + + (2 * z) • (∑ i, θ i • deriv f i x) + + z • (∑ i, θ i • A i x (f x))) := by + funext x + simp only [normalizedOperator, laplacian_expPhase_smul_null hf θ hθ, + deriv_expPhase_smul (hf.differentiable (by simp)), map_smul, map_add, + smul_add, smul_smul, Finset.sum_add_distrib, Finset.smul_sum, mul_assoc] + abel + +end ElasticityCarleman + +end +end +section +noncomputable section +open Set +open scoped BigOperators SchwartzMap +namespace ElasticityCGO +open ElasticityAugmented +open ElasticityPhysicalAlgebra (toSmooth toSmooth_apply toSmooth_physical physical) +open ElasticityCarleman (phaseCLM phaseCLM_e) + +/-- Actual Schwartz representatives of the exponential physical fields on a +bounded region. No temperate behavior of the exponential is assumed. -/ +def expCut (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (z : Fin 3 → ℂ) (f : S) : S := + cut χ hc (exponential (phaseCLM z)*toSmooth f) +@[simp] lemma expCut_apply (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (z : Fin 3 → ℂ) (f : S) (x : X) : + expCut χ hc z f x=(χ : X → ℂ) x*Complex.exp (phaseCLM z x)*f x := by + change (χ : X → ℂ) x*(Complex.exp (phaseCLM z x)*f x)=_ + ring +lemma shifted_zero : shifted coord (0 : Fin 3 → ℂ)=fun j => (coord j).toLinearMap := by + funext j + apply LinearMap.ext + intro f + change coord j f+(0 : ℂ) • f=coord j f + rw [zero_smul,add_zero] +lemma phaseCLM_coords (z : Fin 3 → ℂ) : (fun j => phaseCLM z (e j))=z := by + funext j + exact phaseCLM_e z j + +/-- The literal unshifted stress-divergence of a cut-off exponential field. -/ +theorem expCut_physical {U : Set X} (hU : IsOpen U) (lam m χ : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + (z : Fin 3 → ℂ) (f : Fin 3 → S) (i : Fin 3) : + EqOn (physical 0 lam m (fun j => expCut χ hc z (f j)) i : X → ℂ) + (fun x => Complex.exp (phaseCLM z x)*physical z lam m f i x) U := by + intro x hx + change physical 0 lam m (fun j => cut χ hc (exponential (phaseCLM z)*toSmooth (f j))) i x=_ + rw [physical_cut_local hU 0 lam m χ hl hm hc hχ _ i hx,shifted_zero, + physical_exponential_conjugation,phaseCLM_coords,← toSmooth_physical z lam m hl hm f i] + rfl + +theorem expCut_solution {U : Set X} (hU : IsOpen U) (lam m χ : Smooth) + (hl : (lam : X → ℂ).HasTemperateGrowth) (hm : (m : X → ℂ).HasTemperateGrowth) + (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + (z : Fin 3 → ℂ) (f : Fin 3 → S) + (hf : ∀ i,EqOn (physical z lam m f i : X → ℂ) 0 U) : + ∀ i,EqOn (physical 0 lam m (fun j => expCut χ hc z (f j)) i : X → ℂ) 0 U := by + intro i x hx + rw [expCut_physical hU lam m χ hl hm hc hχ z f i hx] + change Complex.exp (phaseCLM z x)*physical z lam m f i x=0 + rw [hf i hx] + exact mul_zero _ + +/-- The full actual divergence is the exponential times the shifted divergence. -/ +theorem div_exponential (z : Fin 3 → ℂ) (u : Fin 3 → Smooth) : + div coord (fun j => exponential (phaseCLM z)*u j)= + exponential (phaseCLM z)*divT (shifted coord z) u := by + have hh (j) : coord j (exponential (phaseCLM z))=z j • exponential (phaseCLM z) := by + rw [coord_exponential] + exact congrArg (fun c : ℂ => c • exponential (phaseCLM z)) (phaseCLM_e z j) + simp only [div,divT,deriv_phase_mul coord z (exponential (phaseCLM z)) hh,Finset.mul_sum] +end ElasticityCGO + +end +end +section +noncomputable section +open Set +open scoped BigOperators SchwartzMap +namespace ElasticityCGO +open ElasticityAugmented +open ElasticityPhysicalAlgebra (physical physical_eqOn_of_eqOn divShift shiftD shiftD_apply) +open ElasticityCarleman (phaseCLM) + +lemma phaseCLM_neg (z : Fin 3 → ℂ) : phaseCLM (-z)=-phaseCLM z := by + ext x + simp only [ElasticityCarleman.phaseCLM,sum_apply,smul_apply, + Pi.neg_apply,neg_apply,smul_eq_mul,neg_mul,Finset.sum_neg_distrib] + +lemma expCut_support (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) + (z : Fin 3 → ℂ) (f : S) : tsupport (expCut χ hc z f : X → ℂ)⊆tsupport (f : X → ℂ) := by + have he : (expCut χ hc z f : X → ℂ)= + (fun x => (χ : X → ℂ) x*Complex.exp (phaseCLM z x))*(f : X → ℂ) := by + funext x + exact expCut_apply χ hc z f x + rw [he] + exact tsupport_mul_subset_right + +/-- Factoring the transferred PHYSICAL solution gives a shifted physical +solution. The compact difference is multiplied by the inverse exponential only +on a compact support, never regarded as a global temperate multiplier. -/ +theorem transferred_amplitude {B K : Set X} (hB : IsOpen B) + (lam m χ : Smooth) (hl : (lam : X → ℂ).HasTemperateGrowth) + (hm : (m : X → ℂ).HasTemperateGrowth) (hc : HasCompactSupport (χ : X → ℂ)) + (hχ : EqOn (χ : X → ℂ) 1 B) (z : Fin 3 → ℂ) (u F H : Fin 3 → S) + (hF : ∀ i x,x∈B → F i x=Complex.exp (phaseCLM z x)*u i x) + (hH : ∀ i,tsupport (H i : X → ℂ)⊆K) + (hsol : ∀ i,EqOn (physical 0 lam m (F+H) i : X → ℂ) 0 B) : + ∃ v : Fin 3 → S, + (∀ i,tsupport (v i-u i : S)⊆K) ∧ + (∀ i,EqOn (physical z lam m v i : X → ℂ) 0 B) ∧ + (∀ i x,x∈B → Complex.exp (phaseCLM z x)*v i x=F i x+H i x) := by + let w : Fin 3 → S := fun i => expCut χ hc (-z) (H i) + let v := u+w + have he : ∀ i x,x∈B → Complex.exp (phaseCLM z x)*v i x=F i x+H i x := by + intro i x hx + change Complex.exp (phaseCLM z x)*(u i x+w i x)=F i x+H i x + dsimp [w] + rw [expCut_apply,hχ hx,Pi.one_apply,one_mul,phaseCLM_neg] + change Complex.exp (phaseCLM z x)*(u i x+Complex.exp (-(phaseCLM z x))*H i x)=F i x+H i x + rw [mul_add,← mul_assoc,← Complex.exp_add,add_neg_cancel,Complex.exp_zero,one_mul,hF i x hx] + have hex : ∀ i,EqOn (expCut χ hc z (v i) : X → ℂ) ((F+H) i) B := by + intro i x hx + rw [expCut_apply,hχ hx,Pi.one_apply,one_mul] + exact he i x hx + refine ⟨v,fun i => ?_,fun i x hx => ?_,he⟩ + · have hv : v i-u i=w i := by dsimp [v]; simp only [add_sub_cancel_left] + rw [hv] + exact (expCut_support χ hc (-z) (H i)).trans (hH i) + · have hp := physical_eqOn_of_eqOn hB 0 lam m hl hm + (fun j => expCut χ hc z (v j)) (F+H) hex i hx + rw [expCut_physical hB lam m χ hl hm hc hχ z v i hx] at hp + have hz : Complex.exp (phaseCLM z x)*physical z lam m v i x=0 := hp.trans (hsol i hx) + exact (mul_eq_zero.mp hz).resolve_left (Complex.exp_ne_zero _) + +/-- The actual shifted divergence of the compact physical difference also has +compact support; no separate scalar field is introduced. -/ +lemma divShift_supported {K : Set X} (hK : IsClosed K) (z : Fin 3 → ℂ) + (u : Fin 3 → S) (hu : ∀ i,tsupport (u i : X → ℂ)⊆K) : + tsupport (divShift z u : X → ℂ)⊆K := by + apply closure_minimal _ hK + intro x hx + by_contra hnot + apply hx + have hh (i : Fin 3) : u i x=0 := image_eq_zero_of_notMem_tsupport (fun ht => hnot (hu i ht)) + have hd (i : Fin 3) : ElasticitySchwartzCarleman.d (e i) (u i) x=0 := by + apply image_eq_zero_of_notMem_tsupport + intro ht + exact hnot (hu i ((tsupport_fderiv_apply_subset ℝ (e i)) ht)) + simp only [divShift,sum_apply,shiftD_apply,add_apply, + smul_apply,hh,smul_zero,add_zero] + change (∑ i, ElasticitySchwartzCarleman.d (e i) (u i) x)=0 + simp only [hd,Finset.sum_const_zero] +end ElasticityCGO + +end +end +section +noncomputable section +open Set +open scoped BigOperators SchwartzMap +namespace ElasticityPhysicalEstimate +open ElasticityBessel ElasticitySchwartzCarleman ElasticityNegativeOrder ElasticityPhysicalAlgebra +open ElasticityAugmented (coord coeffA coeffV) +open ElasticityCoeffBounds + +/-- The scalar component is the actual shifted divergence. -/ +def physicalAug (z : Fin 3 → ℂ) (u : Fin 3 → S) : Fin 4 → S := + Fin.cons (divShift z u) u + +lemma physicalAug_sub (z : Fin 3 → ℂ) (u v : Fin 3 → S) : + physicalAug z (v-u)=physicalAug z v-physicalAug z u := by + funext i + refine Fin.cases ?_ (fun i => ?_) i + · simp only [physicalAug,Fin.cons_zero,Pi.sub_apply,divShift,map_sub,Finset.sum_sub_distrib] + · rfl + +lemma physicalAug_supported {K : Set X} (hK : IsClosed K) (z : Fin 3 → ℂ) + (u : Fin 3 → S) (hu : ∀ i,tsupport (u i : X → ℂ)⊆K) : + ∀ i,tsupport (physicalAug z u i : X → ℂ)⊆K := by + intro i + refine Fin.cases ?_ (fun i => hu i) i + exact ElasticityCGO.divShift_supported hK z u hu + +theorem physical_compact_comparison {B K : Set X} (hB : IsOpen B) + (hK : IsClosed K) (hKB : K⊆B) (R : ℝ) (hR : 1≤R) + (hKR : K⊆Metric.closedBall 0 R) (α β : X) (hα : α≠0) + (lam m : Fin 2 → Smooth) + (hl : ∀ q,ExteriorConstant (lam q)) (hm : ∀ q,ExteriorConstant (m q)) + (hm0 : ∀ q x,(m q : X → ℂ) x≠0) + (he0 : ∀ q x,((lam q+m q+m q : Smooth) : X → ℂ) x≠0) + (hel : EqOn (lam 0 : X → ℂ) (lam 1) Kᶜ) + (hem : EqOn (m 0 : X → ℂ) (m 1) Kᶜ) : + ∃ C h₀ : ℝ,0 reciprocal (m q) (hm0 q) + let o := fun q => reciprocal (lam q+m q+m q) (he0 q) + have hn (q) : ExteriorConstant (n q) := (hm q).reciprocal (hm0 q) + have ho (q) : ExteriorConstant (o q) := (((hl q).add (hm q)).add (hm q)).reciprocal (he0 q) + have hni (q) : n q*m q=1 := reciprocal_mul _ _ + have hoi (q) : o q*(lam q+m q+m q)=1 := reciprocal_mul _ _ + have ha (q) := exterior_coeffA (hl q) (hm q) (hn q) (ho q) + have hv (q) := exterior_coeffV (hl q) (hm q) (hn q) (ho q) + have hc (q) := exterior_cPhys (hm q) (hn q) + let a := fun q => aPhys (lam q) (m q) (n q) (o q) + let w := fun q => vPhys (lam q) (m q) (n q) (o q) + have hag (q k i j) : (a q k i j).HasTemperateGrowth := (ha q k i j).growth.neg + have hwg (q i j) : (w q i j).HasTemperateGrowth := (hv q i j).growth.neg + obtain ⟨A,hA,hba⟩ := ExteriorConstant.uniform_bound + (fun t : Fin 2 × Fin 3 × Fin 4 × Fin 4 => + coeffA coord (lam t.1) (m t.1) (n t.1) (o t.1) t.2.1 t.2.2.1 t.2.2.2) + (fun t => ha t.1 t.2.1 t.2.2.1 t.2.2.2) + obtain ⟨V,hV,hbv⟩ := ExteriorConstant.uniform_bound + (fun t : Fin 2 × Fin 4 × Fin 4 => + coeffV coord (lam t.1) (m t.1) (n t.1) (o t.1) t.2.1 t.2.2) + (fun t => hv t.1 t.2.1 t.2.2) + have hba' (q k i j x) : ‖a q k i j x‖≤A := by + simpa only [a,aPhys,Pi.neg_apply,norm_neg] using hba (q,k,i,j) x + have hbw' (q i j x) : ‖w q i j x‖≤V := by + simpa only [w,vPhys,Pi.neg_apply,norm_neg] using hbv (q,i,j) x + let Z := ∑ i,‖((α i : ℂ)+Complex.I*(β i : ℂ))‖ + have hZ : 0≤Z := Finset.sum_nonneg (fun i _ => norm_nonneg _) + have hz (i : Fin 3) : ‖((α i : ℂ)+Complex.I*(β i : ℂ))‖≤Z := + Finset.single_le_sum (fun j _ => norm_nonneg ((α j : ℂ)+Complex.I*(β j : ℂ))) (Finset.mem_univ i) + obtain ⟨C,h₀,hC,hh₀,hest⟩ := compact_comparison_estimate R hR α β hα + (a 0) (a 1) (w 0) (w 1) (hag 0) (hag 1) (hwg 0) (hwg 1) + A V Z hA hV hZ (hba' 0) (hba' 1) (hbw' 0) (hbw' 1) hz + obtain ⟨hea,hev⟩ := ElasticityAugmented.normalized_coefficients_eqOn hK.isOpen_compl + (lam 0) (m 0) (n 0) (o 0) (lam 1) (m 1) (n 1) (o 1) + (hni 0) (hni 1) (hoi 0) (hoi 1) hel hem + refine ⟨C,h₀,hC,hh₀,fun h hh hsmall u v hs hu hv' => ?_⟩ + have hs' := physicalAug_supported hK (phase h α β) (v-u) hs + have hlocal (q) (f : Fin 3 → S) + (hf : ∀ i,EqOn (physical (phase h α β) (lam q) (m q) f i : X → ℂ) 0 B) := + physical_dirSystem_on hB h hh.ne' α β (lam q) (m q) (n q) (o q) + (hni q) (hoi q) (hl q).growth (hm q).growth (hn q).growth (ho q).growth + (fun k i j => (ha q k i j).growth) (fun i j => (hv q i j).growth) + (fun i => (hc q i).growth) f hf + rw [physicalAug_sub] at hs' ⊢ + refine hest h hh hsmall _ _ (fun i => ?_) ?_ + · intro x hx + have ht := hKR (hs' i (subset_tsupport _ hx)) + simpa only [Metric.mem_closedBall,dist_zero_right] using ht + · apply compact_forcing_identity hKB h α β (a 0) (a 1) (w 0) (w 1) + (hag 0) (hag 1) (hwg 0) (hwg 1) _ _ _ _ hs' (hlocal 0 u hu) (hlocal 1 v hv') + · intro k i j x hx + exact congrArg Neg.neg (hea k i j hx) + · intro i j x hx + exact congrArg Neg.neg (hev i j hx) +end ElasticityPhysicalEstimate + +end +end +section +noncomputable section +open Set MeasureTheory +namespace Elasticity +variable {Ω : Set X} {l₁ m₁ l₂ m₂ : X → ℝ} + +lemma energy_coeff_congr_ae + (hl : l₁ =ᵐ[volume.restrict Ω] l₂) (hm : m₁ =ᵐ[volume.restrict Ω] m₂) : + energy Ω l₁ m₁=energy Ω l₂ m₂ := by + funext u v + apply integral_congr_ae + filter_upwards [hl,hm] with x hxl hxm + rw [hxl,hxm] + +/-- The variational DN definition really depends only on the interior +coefficients, including its choice branch. No exterior identification is presumed. -/ +theorem DN_coeff_congr_ae + (hl : l₁ =ᵐ[volume.restrict Ω] l₂) (hm : m₁ =ᵐ[volume.restrict Ω] m₂) : + DN Ω l₁ m₁=DN Ω l₂ m₂ := by + have he := energy_coeff_congr_ae hl hm + have hws : WeakSolution Ω l₁ m₁=WeakSolution Ω l₂ m₂ := by + funext u + apply propext + unfold WeakSolution + rw [he] + have hsol : dirichletSolution Ω l₁ m₁=dirichletSolution Ω l₂ m₂ := by + funext f + unfold dirichletSolution + rw [hws] + change (fun (f g : BoundaryData Ω) => energy Ω l₁ m₁ (dirichletSolution Ω l₁ m₁ f) g.out) = + (fun (f g : BoundaryData Ω) => energy Ω l₂ m₂ (dirichletSolution Ω l₂ m₂ f) g.out) + rw [he,hsol] + +theorem DN_coeff_congr (hΩ : MeasurableSet Ω) (hl : EqOn l₁ l₂ Ω) (hm : EqOn m₁ m₂ Ω) : + DN Ω l₁ m₁=DN Ω l₂ m₂ := by + apply DN_coeff_congr_ae + · filter_upwards [ae_restrict_mem hΩ] with x hx + exact hl hx + · filter_upwards [ae_restrict_mem hΩ] with x hx + exact hm hx +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Transport.lean b/lean/OAI/MathematicalPhysics/Elasticity/Transport.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d136d915846420cb0f02e6149b9be4e51ae942d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Transport.lean @@ -0,0 +1,1150 @@ +import OAI.MathematicalPhysics.Elasticity.TransportAlgebra +import OAI.MathematicalPhysics.Elasticity.Homotopy +import OAI.MathematicalPhysics.Elasticity.Extension + +namespace OAI + +noncomputable section + +namespace ElasticityPlanar +open Set Complex Module +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +section +variable {R : Type*} [NormedRing R] [NormedAlgebra ℂ R] [CompleteSpace R] [FiniteDimensional ℂ R] +variable {n : Type*} [Fintype n] + +/-- A smooth frame for the actual constant complex characteristic direction +in ambient space. Transverse coordinates are obtained by a proved continuous +left inverse, not assumed to exist. Arbitrary smooth coefficients are allowed. -/ +theorem spatial_frame_of_left_inverse (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) + (hK : Function.LeftInverse K J) + {S Ω Ω' : Set ℂ} (hS : IsCompact S) (hΩS : Ω ⊆ S) + (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) (q : Basis n ℂ R) + (A : E → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ V : E → R, ContDiff ℝ (⊤ : ℕ∞) V ∧ (∀ x, IsUnit (V x)) ∧ + ∀ x, K x∈Ω' → fderiv ℝ V x (J 1)+I • fderiv ℝ V x (J I)=A x*V x := by + let P : E →L[ℝ] E := ContinuousLinearMap.id ℝ E-J.comp K + have hPJ (z : ℂ) : P (J z)=0 := by + change J z-J (K (J z))=0 + rw [hK z,sub_self] + have hrec (x : E) : P x+J (K x)=x := sub_add_cancel x (J (K x)) + let B : E × ℂ → R := fun w => g w.2 • A (w.1+J w.2) + have hB : ContDiff ℝ (⊤ : ℕ∞) B := + (hg.comp contDiff_snd).smul (hA.comp (contDiff_fst.add (J.contDiff.comp contDiff_snd))) + have hBc (p : E) (z : ℂ) (hz : z∉tsupport g) : B (p,z)=0 := by + simp only [B,image_eq_zero_of_notMem_tsupport hz,zero_smul] + obtain ⟨W,hW,hunit,he⟩ := exists_variable_planar_frame hS hΩS hΩ' hsub hc q B hB hBc hg hc hs h1 + let L := P.prod K + let V : E → R := W ∘ L + have hV : ContDiff ℝ (⊤ : ℕ∞) V := hW.comp L.contDiff + refine ⟨V,hV,fun x => hunit (L x),fun x hx => ?_⟩ + have hd (v : ℂ) : fderiv ℝ V x (J v)=fderiv ℝ (fun z => W (P x,z)) (K x) v := by + have hw := ((hW.differentiable (by simp)) (L x)).hasFDerivAt.comp x L.hasFDerivAt + have ht : HasFDerivAt (fun z : ℂ => (P x,z)) (ContinuousLinearMap.inr ℝ E ℂ) (K x) := by + simpa only [ContinuousLinearMap.inr,id] using + (hasFDerivAt_const (P x) (K x)).prodMk (hasFDerivAt_id (K x)) + have hw' := ((hW.differentiable (by simp)) (L x)).hasFDerivAt.comp (K x) ht + change HasFDerivAt V _ x at hw + change HasFDerivAt (fun z => W (P x,z)) _ (K x) at hw' + rw [hw.fderiv,hw'.fderiv] + change fderiv ℝ W (L x) (P (J v),K (J v))=fderiv ℝ W (L x) (0,v) + rw [hPJ v,hK v] + rw [hd 1,hd I] + have hh := he (P x) (K x) hx + change classicalDbar (fun z => W (P x,z)) (K x)=_ + rw [hh] + change (g (K x) • A (P x+J (K x)))*W (P x,K x)=A x*W (P x,K x) + rw [h1 hx,hrec] + simp only [Pi.one_apply,one_smul] +/-- Actual frames on every compact physical region, with no coordinate, +cutoff, or planar-solvability existence hypothesis. -/ +theorem exists_spatial_frame (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) + (q : Basis n ℂ R) (A : E → R) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + {C : Set E} (hC : IsCompact C) : + ∃ V : E → R, ContDiff ℝ (⊤ : ℕ∞) V ∧ (∀ x, IsUnit (V x)) ∧ + ∀ x∈C, fderiv ℝ V x (J 1)+I • fderiv ℝ V x (J I)=A x*V x := by + obtain ⟨K,hK⟩ := ContinuousLinearMap.HasLeftInverse.of_injective_of_finiteDimensional hJ + obtain ⟨r,hr⟩ := (hC.image K.continuous).isBounded.subset_ball (0 : ℂ) + have hbb : Metric.closedBall (0 : ℂ) r ⊆ Metric.ball 0 (r+1) := by + intro z hz + exact lt_of_le_of_lt (Metric.mem_closedBall.mp hz) (by linarith) + obtain ⟨g,hg,hc,hs,h1,_⟩ := ElasticityBoundary.compact_smooth_cutoff + (isCompact_closedBall (0 : ℂ) r) Metric.isOpen_ball hbb + let g' : ℂ → ℂ := fun z => (g z : ℂ) + have hg' : ContDiff ℝ (⊤ : ℕ∞) g' := Complex.ofRealCLM.contDiff.comp hg + have hsupport : tsupport g'⊆tsupport g := by + apply closure_mono + intro z hz + exact fun hh => hz (by simp only [g',hh,Complex.ofReal_zero]) + have hc' : HasCompactSupport g' := hc.of_isClosed_subset (isClosed_tsupport _) hsupport + have h1' : Set.EqOn g' 1 (Metric.ball (0 : ℂ) r) := by + intro z hz + have hh := h1.self_of_nhdsSet z (Metric.ball_subset_closedBall hz) + simp only [g',hh,Complex.ofReal_one,Pi.one_apply] + obtain ⟨V,hV,hu,he⟩ := spatial_frame_of_left_inverse J K hK + (isCompact_closedBall (0 : ℂ) (r+1)) Metric.ball_subset_closedBall Metric.isOpen_ball + (Metric.ball_subset_ball (by linarith : r≤r+1)) q A hA hg' hc' (hsupport.trans hs) h1' + exact ⟨V,hV,hu,fun x hx => he x (hr (Set.mem_image_of_mem K hx))⟩ +end +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] [FiniteDimensional ℂ F] + +/-- Genuine invertible transport frames on any finite dimensional complex +fiber, with arbitrary smooth coefficients. Applies to the rank-three physical +null hyperplane plus scalar fiber, without assuming a frame exists. -/ +theorem exists_spatial_linear_frame (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) + (A : E → F →L[ℂ] F) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + {C : Set E} (hC : IsCompact C) : + ∃ V : E → F →L[ℂ] F, ContDiff ℝ (⊤ : ℕ∞) V ∧ + (∀ x, IsUnit (V x)) ∧ + ∀ x∈C, fderiv ℝ V x (J 1)+I • fderiv ℝ V x (J I)=A x*V x := by + let : CompleteSpace F := FiniteDimensional.complete ℂ F + exact exists_spatial_frame J hJ (Module.finBasis ℂ (F →L[ℂ] F)) A hA hC + +end ElasticityPlanar +namespace ElasticityPlanar +open MeasureTheory Set Topology +open scoped BigOperators ComplexConjugate +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] +variable {n : Type*} [Fintype n] + +def planeMap (J : ℂ →L[ℝ] E) (x : E) (z : ℂ) : E := x+J z +lemma planeMap_smooth (J : ℂ →L[ℝ] E) (x : E) : + ContDiff ℝ (⊤ : ℕ∞) (planeMap J x) := contDiff_const.add J.contDiff +lemma planeMap_closedEmbedding (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) (x : E) : + IsClosedEmbedding (planeMap J x) := by + exact (Homeomorph.addLeft x).isClosedEmbedding.comp + (LinearMap.isClosedEmbedding_of_injective (LinearMap.ker_eq_bot.mpr hJ)) +lemma plane_compact (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) (x : E) + {f : E → ℂ} (hf : HasCompactSupport f) : HasCompactSupport (f ∘ planeMap J x) := by + apply HasCompactSupport.intro ((planeMap_closedEmbedding J hJ x).isCompact_preimage hf) + intro z hz + exact image_eq_zero_of_notMem_tsupport (f := f) (x := planeMap J x z) hz +lemma plane_deriv (J : ℂ →L[ℝ] E) (x : E) {f : E → ℂ} + (hf : Differentiable ℝ f) (z v : ℂ) : + fderiv ℝ (f ∘ planeMap J x) z v=fderiv ℝ f (planeMap J x z) (J v) := by + have hp : HasFDerivAt (planeMap J x) J z := by + change HasFDerivAt (fun t : ℂ => x+J t) J z + simpa only [Pi.add_def,zero_add] using (hasFDerivAt_const x z).add J.hasFDerivAt + exact congrArg (fun T : ℂ →L[ℝ] ℂ => T v) ((hf _).hasFDerivAt.comp z hp).fderiv + +/-- Compact kernel uniqueness in ambient physical space, by restriction to +all affine characteristic planes. The plane embedding is actual and injective. -/ +theorem spatial_compact_kernel (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) + (a : n → n → E → ℂ) (ha : ∀ i j, Continuous (a i j)) + (u : n → E → ℂ) (hu : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (u i)) + (hc : ∀ i, HasCompactSupport (u i)) + (he : ∀ i x, fderiv ℝ (u i) x (J 1)+Complex.I*fderiv ℝ (u i) x (J Complex.I)= + ∑ j, a i j x*u j x) : ∀ i x, u i x=0 := by + intro i x + let v : n → Test := fun i => ⟨u i ∘ planeMap J x, + (hu i).comp (planeMap_smooth J x),plane_compact J hJ x (hc i)⟩ + have hv := compact_kernel (fun i j => a i j ∘ planeMap J x) + (fun i j => (ha i j).comp (planeMap_smooth J x).continuous) v (fun j z => ?_) + · have hh := congrArg (fun f : Test => f 0) (hv i) + change u i (x+J 0)=0 at hh + simpa only [map_zero,add_zero] using hh + · change fderiv ℝ (u j ∘ planeMap J x) z 1+ + Complex.I*fderiv ℝ (u j ∘ planeMap J x) z Complex.I=_ + rw [plane_deriv J x ((hu j).differentiable (by simp)), + plane_deriv J x ((hu j).differentiable (by simp))] + exact he j (planeMap J x z) +end ElasticityPlanar +namespace ElasticityParameter +open scoped BigOperators +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] +def smoothAlgebra : Subalgebra ℂ (E → ℂ) where + carrier := {f | ContDiff ℝ (⊤ : ℕ∞) f} + add_mem' := by + intro f g hf hg + change ContDiff ℝ (⊤ : ℕ∞) f at hf + change ContDiff ℝ (⊤ : ℕ∞) g at hg + exact hf.add hg + mul_mem' := by + intro f g hf hg + change ContDiff ℝ (⊤ : ℕ∞) f at hf + change ContDiff ℝ (⊤ : ℕ∞) g at hg + exact hf.mul hg + zero_mem' := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : E => (0 : ℂ)) + exact contDiff_const + one_mem' := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : E => (1 : ℂ)) + exact contDiff_const + algebraMap_mem' c := by + change ContDiff ℝ (⊤ : ℕ∞) (fun _ : E => c) + exact contDiff_const +abbrev Smooth := smoothAlgebra E +variable {E} +lemma smooth (f : Smooth E) : ContDiff ℝ (⊤ : ℕ∞) (f : E → ℂ) := f.property + +def delta (v : E) : Derivation ℂ (Smooth E) (Smooth E) := Derivation.mk' + { toFun := fun f => ⟨fun x => fderiv ℝ (f : E → ℂ) x v, + ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).clm_apply contDiff_const⟩ + map_add' f g := by + apply Subtype.ext + funext x + exact congrArg (fun T : E →L[ℝ] ℂ => T v) + (fderiv_add ((smooth f).differentiable (by simp) x) ((smooth g).differentiable (by simp) x)) + map_smul' c f := by + apply Subtype.ext + funext x + exact congrArg (fun T : E →L[ℝ] ℂ => T v) + (fderiv_const_smul ((smooth f).differentiable (by simp) x) c) } + (by + intro f g + apply Subtype.ext + funext x + exact congrArg (fun T : E →L[ℝ] ℂ => T v) + (fderiv_mul ((smooth f).differentiable (by simp) x) ((smooth g).differentiable (by simp) x))) +lemma delta_apply (v : E) (f : Smooth E) (x : E) : + (delta v f : E → ℂ) x=fderiv ℝ (f : E → ℂ) x v := rfl +lemma delta_delta (v w : E) (f : Smooth E) (x : E) : + (delta v (delta w f) : E → ℂ) x=fderiv ℝ (fderiv ℝ (f : E → ℂ)) x v w := by + have hd : Differentiable ℝ (fderiv ℝ (f : E → ℂ)) := + ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ (f : E → ℂ) y w) x v=_ + rw [fderiv_clm_apply (hd x) (differentiableAt_const w)] + simp +lemma delta_commute (v w : E) (f : Smooth E) : delta v (delta w f)=delta w (delta v f) := by + apply Subtype.ext + funext x + rw [delta_delta,delta_delta] + exact (smooth f).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞)≤⊤)) _ _ + +/-- Parameter antiholomorphic derivative in fixed physical coordinates, without +changing the physical point or differentiating any moving plane coordinates. -/ +def pbar : Derivation ℂ (Smooth (E × ℂ)) (Smooth (E × ℂ)) := + delta ((0 : E),(1 : ℂ))+Complex.I • delta ((0 : E),Complex.I) +lemma pbar_delta (v : E) (f : Smooth (E × ℂ)) : + pbar (delta (v,0) f)=delta (v,0) (pbar f) := by + simp only [pbar,Derivation.add_apply,Derivation.smul_apply,map_add,Derivation.map_smul] + rw [delta_commute,delta_commute (0,Complex.I)] +lemma slice_deriv (f : Smooth (E × ℂ)) (x : E) (z v : ℂ) : + fderiv ℝ (fun w => (f : E × ℂ → ℂ) (x,w)) z v= + fderiv ℝ (f : E × ℂ → ℂ) (x,z) (0,v) := by + have he : HasFDerivAt (fun w : ℂ => (x,w)) (ContinuousLinearMap.inr ℝ E ℂ) z := by + simpa only [ContinuousLinearMap.inr,id] using (hasFDerivAt_const x z).prodMk (hasFDerivAt_id z) + exact congrArg (fun L : ℂ →L[ℝ] ℂ => L v) + (((smooth f).differentiable (by simp) (x,z)).hasFDerivAt.comp z he).fderiv +lemma pbar_apply (f : Smooth (E × ℂ)) (x : E) (z : ℂ) : + (pbar f : E × ℂ → ℂ) (x,z)= + fderiv ℝ (fun w => (f : E × ℂ → ℂ) (x,w)) z 1+ + Complex.I*fderiv ℝ (fun w => (f : E × ℂ → ℂ) (x,w)) z Complex.I := by + rw [slice_deriv,slice_deriv] + rfl +lemma pbar_zero_of_holomorphic (f : Smooth (E × ℂ)) + (hf : ∀ x, Differentiable ℂ (fun z => (f : E × ℂ → ℂ) (x,z))) : pbar f=0 := by + apply Subtype.ext + funext q + obtain ⟨x,z⟩ := q + rw [pbar_apply] + have he := (differentiableAt_complex_iff_differentiableAt_real.mp (hf x z)).2 + simp only [smul_eq_mul] at he + rw [he,← mul_assoc,Complex.I_mul_I] + change _=0 + ring +lemma holomorphic_of_pbar_zero (f : Smooth (E × ℂ)) (hf : pbar f=0) (x : E) : + Differentiable ℂ (fun z => (f : E × ℂ → ℂ) (x,z)) := by + intro z + apply differentiableAt_complex_iff_differentiableAt_real.mpr + refine ⟨((smooth f).comp (contDiff_const.prodMk contDiff_id)).differentiable (by simp) z,?_⟩ + have he := congrArg (fun g : Smooth (E × ℂ) => (g : E × ℂ → ℂ) (x,z)) hf + rw [pbar_apply] at he + change _=0 at he + simp only [smul_eq_mul] + have hh := congrArg (fun c : ℂ => -Complex.I*c) he + simp only [mul_add,neg_mul,← mul_assoc Complex.I Complex.I,Complex.I_mul_I] at hh + linear_combination hh + +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable {k n : Type*} [Fintype k] [Fintype n] +/-- Differentiating the transport in fixed coordinates produces a homogeneous +transport for the antiholomorphic derivative. -/ +lemma differentiate_transport (Q : Derivation ℂ A A) (D : k → Derivation ℂ A A) + (hQD : ∀ r f, Q (D r f)=D r (Q f)) + (θ : k → A) (a : n → n → A) (u : n → A) + (hθ : ∀ r, Q (θ r)=0) (ha : ∀ i j, Q (a i j)=0) + (he : ∀ i, ∑ r, θ r*D r (u i)=∑ j, a i j*u j) : + ∀ i, ∑ r, θ r*D r (Q (u i))=∑ j, a i j*Q (u j) := by + intro i + have hh := congrArg Q (he i) + simpa only [map_sum,Derivation.leibniz,hθ,ha,hQD,mul_zero,zero_add,smul_eq_mul,add_zero] using hh +end ElasticityParameter +namespace ElasticityParameter +open Set +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] +variable {k n : Type*} [Fintype k] [Fintype n] + +def characteristicPlane (e : k → E) (θ : k → ℂ) : ℂ →L[ℝ] E := + Complex.reCLM.smulRight (∑ r, (θ r).re • e r)+ + Complex.imCLM.smulRight (∑ r, (θ r).im • e r) +lemma characteristicPlane_one (e : k → E) (θ : k → ℂ) : + characteristicPlane e θ 1=∑ r, (θ r).re • e r := by simp [characteristicPlane] +lemma characteristicPlane_I (e : k → E) (θ : k → ℂ) : + characteristicPlane e θ Complex.I=∑ r, (θ r).im • e r := by simp [characteristicPlane] +lemma spatial_slice_deriv (f : Smooth (E × ℂ)) (x v : E) (z : ℂ) : + fderiv ℝ (fun y => (f : E × ℂ → ℂ) (y,z)) x v= + fderiv ℝ (f : E × ℂ → ℂ) (x,z) (v,0) := by + have he : HasFDerivAt (fun y : E => (y,z)) (ContinuousLinearMap.inl ℝ E ℂ) x := by + simpa only [ContinuousLinearMap.inl,id] using (hasFDerivAt_id x).prodMk (hasFDerivAt_const z x) + exact congrArg (fun L : E →L[ℝ] ℂ => L v) + (((smooth f).differentiable (by simp) (x,z)).hasFDerivAt.comp x he).fderiv +lemma characteristicPlane_principal (e : k → E) (θ : k → ℂ) (L : E →L[ℝ] ℂ) : + L (characteristicPlane e θ 1)+Complex.I*L (characteristicPlane e θ Complex.I)= + ∑ r, θ r*L (e r) := by + rw [characteristicPlane_one,characteristicPlane_I] + simp only [map_sum,map_smul,Complex.real_smul,Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro r _ + calc + _ = ((θ r).re+(θ r).im*Complex.I)*L (e r) := by ring + _ = θ r*L (e r) := by rw [Complex.re_add_im] + +lemma compact_pbar_slice {S : Set E} (hS : IsCompact S) + (u : Smooth (E × ℂ)) (c : ℂ) + (hs : ∀ x∉S, ∀ z, (u : E × ℂ → ℂ) (x,z)=c) (z : ℂ) : + HasCompactSupport (fun x => (pbar u : E × ℂ → ℂ) (x,z)) := by + apply HasCompactSupport.intro hS + intro x hx + have he : (fun z => (u : E × ℂ → ℂ) (x,z))=fun _ => c := funext (hs x hx) + rw [pbar_apply,he] + simp + +/-- Holomorphy of a supported comparison is derived, not assumed. The parameter +is differentiated with the physical point fixed, including the holomorphic +principal direction, and ambient compact kernel uniqueness then applies. -/ +theorem holomorphic_of_supported_transport + (e : k → E) (θ : k → Smooth (E × ℂ)) + (hθx : ∀ r x z, (θ r : E × ℂ → ℂ) (x,z)=(θ r : E × ℂ → ℂ) (0,z)) + (hθ : ∀ r x, Differentiable ℂ (fun z => (θ r : E × ℂ → ℂ) (x,z))) + (hplane : ∀ z, Function.Injective (characteristicPlane e (fun r => (θ r : E × ℂ → ℂ) (0,z)))) + (a : n → n → Smooth (E × ℂ)) + (ha : ∀ i j x, Differentiable ℂ (fun z => (a i j : E × ℂ → ℂ) (x,z))) + (u : n → Smooth (E × ℂ)) + (he : ∀ i, ∑ r, θ r*delta (e r,0) (u i)=∑ j, a i j*u j) + {S : Set E} (hS : IsCompact S) (c : n → ℂ) + (hs : ∀ i x, x∉S → ∀ z, (u i : E × ℂ → ℂ) (x,z)=c i) : + ∀ i x, Differentiable ℂ (fun z => (u i : E × ℂ → ℂ) (x,z)) := by + have hd := differentiate_transport pbar (fun r => delta (e r,0)) + (fun r f => pbar_delta (e r) f) θ a u + (fun r => pbar_zero_of_holomorphic (θ r) (hθ r)) + (fun i j => pbar_zero_of_holomorphic (a i j) (ha i j)) he + have hb (z : ℂ) : ∀ i x, (pbar (u i) : E × ℂ → ℂ) (x,z)=0 := by + apply ElasticityPlanar.spatial_compact_kernel + (characteristicPlane e (fun r => (θ r : E × ℂ → ℂ) (0,z))) (hplane z) + (fun i j x => (a i j : E × ℂ → ℂ) (x,z)) + (fun i j => (smooth (a i j)).continuous.comp (continuous_id.prodMk continuous_const)) + (fun i x => (pbar (u i) : E × ℂ → ℂ) (x,z)) + (fun i => (smooth (pbar (u i))).comp (contDiff_id.prodMk contDiff_const)) + (fun i => compact_pbar_slice hS (u i) (c i) (hs i) z) + intro i x + rw [characteristicPlane_principal] + simp_rw [spatial_slice_deriv] + have hh := congrArg (fun f : Smooth (E × ℂ) => (f : E × ℂ → ℂ) (x,z)) (hd i) + simpa only [AddSubmonoidClass.coe_finsetSum,Finset.sum_apply,Subalgebra.coe_mul,Pi.mul_apply, + delta_apply,hθx] using hh + intro i x + apply holomorphic_of_pbar_zero (u i) _ x + apply Subtype.ext + funext q + exact hb q.2 i q.1 +end ElasticityParameter +namespace ElasticityParameter +open scoped BigOperators InnerProductSpace + +lemma real_complex_plane_injective {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + (a b : E) (ha : a≠0) (hb : b≠0) (hab : inner ℝ a b=0) : + Function.Injective (Complex.reCLM.smulRight a+Complex.imCLM.smulRight b : ℂ →L[ℝ] E) := by + let J : ℂ →L[ℝ] E := Complex.reCLM.smulRight a+Complex.imCLM.smulRight b + suffices hn : ∀ z : ℂ, J z=0 → z=0 by + intro z w h + apply sub_eq_zero.mp + apply hn + rw [map_sub,h,sub_self] + intro z hz + have ha0 : inner ℝ a a≠0 := by + intro h + exact ha (inner_self_eq_zero.mp h) + have hb0 : inner ℝ b b≠0 := by + intro h + exact hb (inner_self_eq_zero.mp h) + have hba : inner ℝ b a=0 := by rwa [real_inner_comm] + have hr := congrArg (fun v : E => inner ℝ a v) hz + have hi := congrArg (fun v : E => inner ℝ b v) hz + change inner ℝ a (z.re • a+z.im • b)=inner ℝ a 0 at hr + change inner ℝ b (z.re • a+z.im • b)=inner ℝ b 0 at hi + simp only [inner_add_right,inner_smul_right,hab,hba,mul_zero,zero_add,add_zero,inner_zero_right] at hr hi + apply Complex.ext + · exact (mul_eq_zero.mp hr).resolve_right ha0 + · exact (mul_eq_zero.mp hi).resolve_right hb0 + +abbrev X := EuclideanSpace ℝ (Fin 3) +def basis (i : Fin 3) : X := EuclideanSpace.single i 1 +lemma basis_sum_apply (v : Fin 3 → ℝ) (i : Fin 3) : + (∑ r, v r • basis r : X) i=v i := by + simp [basis,Pi.single_apply] + +lemma null_re_im (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) : + (∑ i, (θ i).re*(θ i).re)=(∑ i, (θ i).im*(θ i).im) ∧ + (∑ i, (θ i).re*(θ i).im)=0 := by + have hr := congrArg Complex.re hθ + have hi := congrArg Complex.im hθ + simp only [Complex.re_sum,Complex.mul_re,Complex.zero_re,Finset.sum_sub_distrib] at hr + simp only [Complex.im_sum,Complex.mul_im,Complex.zero_im,Finset.sum_add_distrib] at hi + have he : (∑ i, (θ i).im*(θ i).re)=(∑ i, (θ i).re*(θ i).im) := + Finset.sum_congr rfl (fun i _ => mul_comm _ _) + rw [he] at hi + constructor + · exact sub_eq_zero.mp hr + · linarith + +lemma null_plane_injective (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) (hne : θ≠0) : + Function.Injective (characteristicPlane basis θ) := by + obtain ⟨hre,him⟩ := null_re_im θ hθ + let a : X := ∑ i, (θ i).re • basis i + let b : X := ∑ i, (θ i).im • basis i + have hai (i : Fin 3) : a i=(θ i).re := basis_sum_apply _ i + have hbi (i : Fin 3) : b i=(θ i).im := basis_sum_apply _ i + have haa : inner ℝ a a=∑ i, (θ i).re*(θ i).re := by + simp only [PiLp.inner_apply,RCLike.inner_apply,conj_trivial,hai] + have hbb : inner ℝ b b=∑ i, (θ i).im*(θ i).im := by + simp only [PiLp.inner_apply,RCLike.inner_apply,conj_trivial,hbi] + have hab : inner ℝ a b=0 := by + simp only [PiLp.inner_apply,RCLike.inner_apply,conj_trivial,hai,hbi] + simpa only [mul_comm] using him + have he : inner ℝ a a=inner ℝ b b := by rw [haa,hbb,hre] + have hboth : ¬ (a=0 ∧ b=0) := by + rintro ⟨ha,hb⟩ + apply hne + funext i + apply Complex.ext + · simpa only [ha,PiLp.zero_apply,Pi.zero_apply,Complex.zero_re] using (hai i).symm + · simpa only [hb,PiLp.zero_apply,Pi.zero_apply,Complex.zero_im] using (hbi i).symm + have ha : a≠0 := by + intro hz + apply hboth + refine ⟨hz,(@inner_self_eq_zero ℝ X _ _ _).mp ?_⟩ + rw [← he,hz,inner_zero_left] + have hb : b≠0 := by + intro hz + apply ha + apply (@inner_self_eq_zero ℝ X _ _ _).mp + rw [he,hz,inner_zero_left] + exact real_complex_plane_injective a b ha hb hab +end ElasticityParameter +namespace ElasticityFrame +open Set Complex Module +open scoped BigOperators +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev Amp := (Fin 3 → ℂ) × ℂ + +def normal (θ : Fin 3 → ℂ) : Amp →ₗ[ℂ] ℂ where + toFun v := ∑ i, θ i*v.1 i + map_add' v w := by simp only [Prod.fst_add,Pi.add_apply,mul_add,Finset.sum_add_distrib] + map_smul' c v := by + simp only [Prod.smul_fst,Pi.smul_apply,smul_eq_mul,RingHom.id_apply,Finset.mul_sum] + exact Finset.sum_congr rfl (fun _ _ => by ring) +def fiber (θ : Fin 3 → ℂ) : Submodule ℂ Amp := (normal θ).ker +abbrev Fiber (θ : Fin 3 → ℂ) := ↥(fiber θ) + +lemma finrank_fiber (θ : Fin 3 → ℂ) (hne : θ≠0) : Module.finrank ℂ (Fiber θ)=3 := by + obtain ⟨i,hi⟩ := Function.ne_iff.mp hne + change θ i≠0 at hi + have hs : Function.Surjective (normal θ) := by + intro c + refine ⟨(Pi.single i (c/(θ i)),0),?_⟩ + change (∑ j,θ j*(Pi.single i (c/(θ i)) : Fin 3 → ℂ) j)=c + simp [Pi.single_apply] + field_simp [hi] + have he := (normal θ).finrank_range_add_finrank_ker + rw [LinearMap.range_eq_top.mpr hs,finrank_top] at he + change Module.finrank ℂ ℂ+Module.finrank ℂ (Fiber θ)=Module.finrank ℂ Amp at he + simp only [Module.finrank_self,Module.finrank_prod,Module.finrank_pi,Fintype.card_fin] at he + omega + +def scalarVector (θ : Fin 3 → ℂ) : Fiber θ := ⟨(0,1),by simp [fiber,normal,LinearMap.mem_ker]⟩ +def nullVector (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) : Fiber θ := ⟨(θ,0),hθ⟩ +def scalarPr (θ : Fin 3 → ℂ) : Fiber θ →L[ℂ] ℂ := + (ContinuousLinearMap.snd ℂ (Fin 3 → ℂ) ℂ).comp (fiber θ).subtypeL +def vectorPr (θ : Fin 3 → ℂ) (i : Fin 3) : Fiber θ →L[ℂ] ℂ := + (ContinuousLinearMap.proj i).comp ((ContinuousLinearMap.fst ℂ (Fin 3 → ℂ) ℂ).comp (fiber θ).subtypeL) +def connection (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (t : ℂ) (q : Fin 3 → ℂ) : + Fiber θ →L[ℂ] Fiber θ := + (scalarPr θ).smulRight (nullVector θ hθ)+ + t • (scalarPr θ).smulRight (scalarVector θ)+ + ∑ i, q i • (vectorPr θ i).smulRight (scalarVector θ) + +lemma connection_vector (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (t : ℂ) (q : Fin 3 → ℂ) (v : Fiber θ) (i : Fin 3) : + ((connection θ hθ t q v : Fiber θ) : Amp).1 i=θ i*(v : Amp).2 := by + simp [connection,scalarPr,vectorPr,nullVector,scalarVector,Fin.sum_univ_three,mul_comm] +lemma connection_scalar (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (t : ℂ) (q : Fin 3 → ℂ) (v : Fiber θ) : + ((connection θ hθ t q v : Fiber θ) : Amp).2=t*(v : Amp).2+∑ i,q i*(v : Amp).1 i := by + simp [connection,scalarPr,vectorPr,nullVector,scalarVector,Fin.sum_univ_three] + +lemma connection_smooth {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (t : E → ℂ) (q : Fin 3 → E → ℂ) + (ht : ContDiff ℝ (⊤ : ℕ∞) t) (hq : ∀ i,ContDiff ℝ (⊤ : ℕ∞) (q i)) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => connection θ hθ (t x) (fun i => q i x)) := by + have hs (B : Fiber θ →L[ℂ] Fiber θ) {f : E → ℂ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) : + ContDiff ℝ (⊤ : ℕ∞) (fun x => f x • B) := by + exact (ContinuousLinearMap.contDiff (𝕜 := ℝ) (E := ℂ) (F := Fiber θ →L[ℂ] Fiber θ) + (((ContinuousLinearMap.id ℂ ℂ).smulRight B).restrictScalars ℝ)).comp hf + exact (contDiff_const.add (hs _ ht)).add (ContDiff.sum (fun i _ => hs _ (hq i))) + +/-- The actual rank-three constrained transport admits a smooth invertible +frame on every compact physical region. The null-plane geometry and smooth +planar solvability are proved dependencies, not existence hypotheses. -/ +theorem exists_constraint_frame (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (t : X → ℂ) (q : Fin 3 → X → ℂ) + (ht : ContDiff ℝ (⊤ : ℕ∞) t) (hq : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (q i)) + {C : Set X} (hC : IsCompact C) : + ∃ V : X → Fiber θ →L[ℂ] Fiber θ, ContDiff ℝ (⊤ : ℕ∞) V ∧ + (∀ x,IsUnit (V x)) ∧ + ∀ x∈C, fderiv ℝ V x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + I • fderiv ℝ V x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ I)= + connection θ hθ (t x) (fun i => q i x)*V x := by + exact ElasticityPlanar.exists_spatial_linear_frame + (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ) + (ElasticityParameter.null_plane_injective θ hθ hne) + (fun x => connection θ hθ (t x) (fun i => q i x)) (connection_smooth θ hθ t q ht hq) hC +end ElasticityFrame +namespace ElasticityPlanar +open Set Complex Module +open scoped BigOperators +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +section +variable {n : Type*} [Fintype n] + +/-- Inhomogeneous transport in the actual ambient characteristic plane, +with arbitrary smooth coefficients and source. -/ +theorem spatial_transport_of_left_inverse (J : ℂ →L[ℝ] E) (K : E →L[ℝ] ℂ) + (hK : Function.LeftInverse K J) + {S Ω Ω' : Set ℂ} (hS : IsCompact S) (hΩS : Ω ⊆ S) + (hΩ' : IsOpen Ω') (hsub : Ω' ⊆ Ω) + (a : n → n → E → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (f : n → E → ℂ) (hf : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (f i)) + {g : ℂ → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g ⊆ Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ u : n → E → ℂ, (∀ i, ContDiff ℝ (⊤ : ℕ∞) (u i)) ∧ + ∀ i x, K x∈Ω' → fderiv ℝ (u i) x (J 1)+I*fderiv ℝ (u i) x (J I)+ + ∑ j, a i j x*u j x=f i x := by + let P : E →L[ℝ] E := ContinuousLinearMap.id ℝ E-J.comp K + have hPJ (z : ℂ) : P (J z)=0 := by + change J z-J (K (J z))=0 + rw [hK z,sub_self] + have hrec (x : E) : P x+J (K x)=x := sub_add_cancel x (J (K x)) + let B : n → n → E × ℂ → ℂ := fun i j w => g w.2*a i j (w.1+J w.2) + let F : n → E × ℂ → ℂ := fun i w => g w.2*f i (w.1+J w.2) + have hB (i j) : ContDiff ℝ (⊤ : ℕ∞) (B i j) := + (hg.comp contDiff_snd).mul ((ha i j).comp (contDiff_fst.add (J.contDiff.comp contDiff_snd))) + have hF (i) : ContDiff ℝ (⊤ : ℕ∞) (F i) := + (hg.comp contDiff_snd).mul ((hf i).comp (contDiff_fst.add (J.contDiff.comp contDiff_snd))) + have hBc (i j) (p : E) (z : ℂ) (hz : z∉tsupport g) : B i j (p,z)=0 := by + simp only [B,image_eq_zero_of_notMem_tsupport hz,zero_mul] + have hFc (i) (p : E) (z : ℂ) (hz : z∉tsupport g) : F i (p,z)=0 := by + simp only [F,image_eq_zero_of_notMem_tsupport hz,zero_mul] + obtain ⟨v,hv,he⟩ := exists_classical_variable hS hΩS hΩ' hsub hc B hB hBc F hF hFc hg hc hs h1 + let W : n → E × ℂ → ℂ := fun i w => v w.1 i w.2 + let L := P.prod K + let u : n → E → ℂ := fun i => W i ∘ L + have hu (i) : ContDiff ℝ (⊤ : ℕ∞) (u i) := (hv i).comp L.contDiff + refine ⟨u,hu,fun i x hx => ?_⟩ + have hd (z : ℂ) : fderiv ℝ (u i) x (J z)=fderiv ℝ (v (P x) i) (K x) z := by + have hw := (((hv i).differentiable (by simp)) (L x)).hasFDerivAt.comp x L.hasFDerivAt + have ht : HasFDerivAt (fun z : ℂ => (P x,z)) (ContinuousLinearMap.inr ℝ E ℂ) (K x) := by + simpa only [ContinuousLinearMap.inr,id] using + (hasFDerivAt_const (P x) (K x)).prodMk (hasFDerivAt_id (K x)) + have hw' := (((hv i).differentiable (by simp)) (L x)).hasFDerivAt.comp (K x) ht + change HasFDerivAt (u i) _ x at hw + change HasFDerivAt (v (P x) i) _ (K x) at hw' + rw [hw.fderiv,hw'.fderiv] + change fderiv ℝ (W i) (L x) (P (J z),K (J z))=fderiv ℝ (W i) (L x) (0,z) + rw [hPJ z,hK z] + rw [hd 1,hd I] + have hh := he (P x) i hx + simp only [B,F,hrec,h1 hx,Pi.one_apply,one_mul] at hh + exact hh + +theorem exists_spatial_transport (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) + (a : n → n → E → ℂ) (ha : ∀ i j, ContDiff ℝ (⊤ : ℕ∞) (a i j)) + (f : n → E → ℂ) (hf : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (f i)) + {C : Set E} (hC : IsCompact C) : + ∃ u : n → E → ℂ, (∀ i, ContDiff ℝ (⊤ : ℕ∞) (u i)) ∧ + ∀ i x, x∈C → fderiv ℝ (u i) x (J 1)+I*fderiv ℝ (u i) x (J I)+ + ∑ j, a i j x*u j x=f i x := by + obtain ⟨K,hK⟩ := ContinuousLinearMap.HasLeftInverse.of_injective_of_finiteDimensional hJ + obtain ⟨r,hr⟩ := (hC.image K.continuous).isBounded.subset_ball (0 : ℂ) + have hbb : Metric.closedBall (0 : ℂ) r ⊆ Metric.ball 0 (r+1) := by + intro z hz + exact lt_of_le_of_lt (Metric.mem_closedBall.mp hz) (by linarith) + obtain ⟨g,hg,hc,hs,h1,_⟩ := ElasticityBoundary.compact_smooth_cutoff + (isCompact_closedBall (0 : ℂ) r) Metric.isOpen_ball hbb + let g' : ℂ → ℂ := fun z => (g z : ℂ) + have hg' : ContDiff ℝ (⊤ : ℕ∞) g' := Complex.ofRealCLM.contDiff.comp hg + have hsupport : tsupport g'⊆tsupport g := by + apply closure_mono + intro z hz + exact fun hh => hz (by simp only [g',hh,Complex.ofReal_zero]) + have hc' : HasCompactSupport g' := hc.of_isClosed_subset (isClosed_tsupport _) hsupport + have h1' : Set.EqOn g' 1 (Metric.ball (0 : ℂ) r) := by + intro z hz + have hh := h1.self_of_nhdsSet z (Metric.ball_subset_closedBall hz) + simp only [g',hh,Complex.ofReal_one,Pi.one_apply] + obtain ⟨u,hu,he⟩ := spatial_transport_of_left_inverse J K hK + (isCompact_closedBall (0 : ℂ) (r+1)) Metric.ball_subset_closedBall Metric.isOpen_ball + (Metric.ball_subset_ball (by linarith : r≤r+1)) a ha f hf hg' hc' (hsupport.trans hs) h1' + exact ⟨u,hu,fun i x hx => he i x (hr (Set.mem_image_of_mem K hx))⟩ +end +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] [FiniteDimensional ℂ F] + +/-- Inhomogeneous spatial transport on an actual finite-dimensional complex +fiber, not a postulated planar inverse. -/ +theorem exists_spatial_linear_transport (J : ℂ →L[ℝ] E) (hJ : Function.Injective J) + (A : E → F →L[ℂ] F) (hA : ContDiff ℝ (⊤ : ℕ∞) A) + (f : E → F) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + {C : Set E} (hC : IsCompact C) : + ∃ u : E → F, ContDiff ℝ (⊤ : ℕ∞) u ∧ + ∀ x∈C, fderiv ℝ u x (J 1)+I • fderiv ℝ u x (J I)=A x (u x)+f x := by + let q := Module.finBasis ℂ F + let L : F ≃L[ℂ] (Fin (Module.finrank ℂ F) → ℂ) := q.equivFun.toContinuousLinearEquiv + let c (i : Fin (Module.finrank ℂ F)) : F →L[ℂ] ℂ := + (ContinuousLinearMap.proj i).comp L.toContinuousLinearMap + let a := fun i j x => -c i (A x (q j)) + let g := fun i x => c i (f x) + have ha (i j) : ContDiff ℝ (⊤ : ℕ∞) (a i j) := + (((c i).restrictScalars ℝ).contDiff.comp + (((ContinuousLinearMap.apply ℂ F (q j)).restrictScalars ℝ).contDiff.comp hA)).neg + have hg (i) : ContDiff ℝ (⊤ : ℕ∞) (g i) := ((c i).restrictScalars ℝ).contDiff.comp hf + obtain ⟨v,hv,he⟩ := exists_spatial_transport J hJ a ha g hg hC + let u : E → F := fun x => L.symm (fun i => v i x) + have hu : ContDiff ℝ (⊤ : ℕ∞) u := + (L.symm.toContinuousLinearMap.restrictScalars ℝ).contDiff.comp (contDiff_pi.mpr hv) + have hcoord (i) : (fun x => c i (u x))=v i := by + funext x + change L (L.symm (fun i => v i x)) i=v i x + rw [ContinuousLinearEquiv.apply_symm_apply] + have hmat (x : E) (i) : c i (A x (u x))=∑ j,c i (A x (q j))*v j x := by + have hex : u x=∑ j,L (u x) j • q j := (q.sum_equivFun _).symm + conv_lhs => rw [hex] + simp only [map_sum,map_smul,smul_eq_mul] + apply Finset.sum_congr rfl + intro j _ + have hc : L (u x) j=v j x := congrFun (hcoord j) x + rw [hc,mul_comm] + refine ⟨u,hu,fun x hx => ?_⟩ + apply L.injective + ext i + change c i (fderiv ℝ u x (J 1)+I • fderiv ℝ u x (J I))=c i (A x (u x)+f x) + have hd (z : ℂ) : c i (fderiv ℝ u x (J z))=fderiv ℝ (v i) x (J z) := by + have hh := ((c i).restrictScalars ℝ).hasFDerivAt.comp x ((hu.differentiable (by simp)) x).hasFDerivAt + change HasFDerivAt (fun x => c i (u x)) _ x at hh + rw [hcoord] at hh + rw [hh.fderiv] + rfl + rw [map_add,map_smul,hd 1,hd I,map_add,hmat] + have hh := he i x hx + simp only [a,g,neg_mul,Finset.sum_neg_distrib] at hh + change _+I*_=_+_ + linear_combination hh +end ElasticityPlanar +section +open Set Complex Module +open scoped BigOperators +namespace ElasticityFrame + +/-- Three genuine independent smooth columns for the null constrained system, +on an arbitrary compact physical region. -/ +theorem exists_constraint_columns (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (t : X → ℂ) (q : Fin 3 → X → ℂ) + (ht : ContDiff ℝ (⊤ : ℕ∞) t) (hq : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (q i)) + {C : Set X} (hC : IsCompact C) : + ∃ B : X → Basis (Fin 3) ℂ (Fiber θ), + (∀ ν, ContDiff ℝ (⊤ : ℕ∞) (fun x => B x ν)) ∧ + ∀ ν x, x∈C → + fderiv ℝ (fun x => B x ν) x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + I • fderiv ℝ (fun x => B x ν) x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ I)= + connection θ hθ (t x) (fun i => q i x) (B x ν) := by + obtain ⟨V,hV,hu,he⟩ := exists_constraint_frame θ hθ hne t q ht hq hC + let : CompleteSpace (Fiber θ) := FiniteDimensional.complete ℂ (Fiber θ) + let b := Module.finBasisOfFinrankEq ℂ (Fiber θ) (finrank_fiber θ hne) + let B : X → Basis (Fin 3) ℂ (Fiber θ) := fun x => + b.map (LinearEquiv.ofBijective (V x).toLinearMap (ContinuousLinearMap.isUnit_iff_bijective.mp (hu x))) + have hB (ν) : ContDiff ℝ (⊤ : ℕ∞) (fun x => B x ν) := by + change ContDiff ℝ (⊤ : ℕ∞) (fun x => V x (b ν)) + exact (ContinuousLinearMap.contDiff (𝕜 := ℝ) (E := Fiber θ →L[ℂ] Fiber θ) (F := Fiber θ) + ((ContinuousLinearMap.apply ℂ (Fiber θ) (b ν)).restrictScalars ℝ)).comp hV + refine ⟨B,hB,fun ν x hx => ?_⟩ + have hd (v : X) : fderiv ℝ (fun x => B x ν) x v=fderiv ℝ V x v (b ν) := by + have hh := ((ContinuousLinearMap.apply ℂ (Fiber θ) (b ν)).restrictScalars ℝ).hasFDerivAt.comp x + ((hV.differentiable (by simp)) x).hasFDerivAt + change HasFDerivAt (fun x => B x ν) _ x at hh + rw [hh.fderiv] + rfl + rw [hd,hd] + exact congrArg (fun L : Fiber θ →L[ℂ] Fiber θ => L (b ν)) (he x hx) + +/-- Inhomogeneous constrained transport has actual smooth solutions as well. -/ +theorem exists_constraint_transport (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) (hne : θ≠0) + (t : X → ℂ) (q : Fin 3 → X → ℂ) + (ht : ContDiff ℝ (⊤ : ℕ∞) t) (hq : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (q i)) + (f : X → Fiber θ) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + {C : Set X} (hC : IsCompact C) : + ∃ u : X → Fiber θ, ContDiff ℝ (⊤ : ℕ∞) u ∧ + ∀ x∈C, fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ I)= + connection θ hθ (t x) (fun i => q i x) (u x)+f x := by + exact ElasticityPlanar.exists_spatial_linear_transport + (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ) + (ElasticityParameter.null_plane_injective θ hθ hne) + (fun x => connection θ hθ (t x) (fun i => q i x)) (connection_smooth θ hθ t q ht hq) f hf hC +end ElasticityFrame + +end +namespace ElasticityAugmented +open scoped BigOperators + +def smoothInv (f : Smooth) (hf : ∀ x, (f : X → ℂ) x≠0) : Smooth := + ⟨fun x => ((f : X → ℂ) x)⁻¹,(smooth_coe f).inv hf⟩ +lemma smoothInv_apply (f : Smooth) (hf : ∀ x, (f : X → ℂ) x≠0) (x : X) : + (smoothInv f hf : X → ℂ) x=((f : X → ℂ) x)⁻¹ := rfl +lemma smoothInv_mul (f : Smooth) (hf : ∀ x, (f : X → ℂ) x≠0) : smoothInv f hf*f=1 := by + apply Subtype.ext + funext x + exact inv_mul_cancel₀ (hf x) +lemma coord_inv (f : Smooth) (hf : ∀ x, (f : X → ℂ) x≠0) (i : Fin 3) : + coord i (smoothInv f hf)=-(smoothInv f hf)^2*coord i f := by + simpa only [smul_eq_mul] using (coord i).leibniz_of_mul_eq_one (smoothInv_mul f hf) + +def thetaDerivation (θ : Fin 3 → ℂ) : Derivation ℂ Smooth Smooth := ∑ i, θ i • coord i +lemma thetaDerivation_apply (θ : Fin 3 → ℂ) (f : Smooth) : + thetaDerivation θ f=direction (A := Smooth) coord θ f := by + simp [thetaDerivation,direction,Fin.sum_univ_three] +lemma direction_mul (θ : Fin 3 → ℂ) (f g : Smooth) : + direction (A := Smooth) coord θ (f*g)=direction (A := Smooth) coord θ f*g+f*direction (A := Smooth) coord θ g := by + simpa only [thetaDerivation_apply,smul_eq_mul,mul_comm,add_comm] using (thetaDerivation θ).leibniz f g +lemma direction_add (θ : Fin 3 → ℂ) (f g : Smooth) : + direction (A := Smooth) coord θ (f+g)=direction (A := Smooth) coord θ f+direction (A := Smooth) coord θ g := by + exact (thetaDerivation θ).map_add f g +lemma direction_smul (θ : Fin 3 → ℂ) (c : ℂ) (f : Smooth) : + direction (A := Smooth) coord θ (c • f)=c • direction (A := Smooth) coord θ f := by + exact (thetaDerivation θ).map_smul c f + +def changeP (r : Smooth) (a : Fin 3 → Smooth) : Fin 3 → Smooth := fun i => r*a i +def logarithmicGrad (r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) : Fin 3 → Smooth := + fun i => 2*smoothInv r hr*coord i r +def changeS (k r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) + (a : Fin 3 → Smooth) (b : Smooth) : Smooth := + -(1/2 : ℂ) • (k*smoothInv r hr*b+ + ∑ i, logarithmicGrad r hr i*changeP r a i) + +/-- The physical displacement change gives the literal upper transport row, +with actual coordinate derivations and no derivative identities postulated. -/ +theorem normal_form_top (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x, (r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) (i : Fin 3) : + direction (A := Smooth) coord θ (changeP r a i)=θ i • changeS k r hr a b := by + have he := congrFun hR i + simp only [leadingR,sub_add_cancel,direction_mul] at he + rw [changeP,direction_mul] + apply Subtype.ext + funext x + have hh := congrArg (fun f : Smooth => (f : X → ℂ) x) he + simp only [Pi.zero_apply] at hh + change 2*((r : X → ℂ) x*(r : X → ℂ) x)*(direction (A := Smooth) coord θ (a i) : X → ℂ) x+ + ((direction (A := Smooth) coord θ r : X → ℂ) x*(r : X → ℂ) x+ + (r : X → ℂ) x*(direction (A := Smooth) coord θ r : X → ℂ) x)*(a i : X → ℂ) x+ + θ i*((k : X → ℂ) x*(b : X → ℂ) x+ + ((∑ j, coord j (r*r)*a j : Smooth) : X → ℂ) x)=0 at hh + have hg : (∑ j, coord j (r*r)*a j : Smooth)= + r*(∑ j, logarithmicGrad r hr j*changeP r a j) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + apply Subtype.ext + funext y + simp only [Derivation.leibniz,smul_eq_mul,logarithmicGrad,changeP,Subalgebra.coe_add,Subalgebra.coe_mul, + Pi.add_apply,Pi.mul_apply,smoothInv_apply] + change ((r : X → ℂ) y*(coord j r : X → ℂ) y+(r : X → ℂ) y*(coord j r : X → ℂ) y)* + (a j : X → ℂ) y=(r : X → ℂ) y*(2*((r : X → ℂ) y)⁻¹*(coord j r : X → ℂ) y*((r : X → ℂ) y*(a j : X → ℂ) y)) + field_simp [hr y] + ring + rw [hg] at hh + simp only [Subalgebra.coe_mul,Pi.mul_apply] at hh + simp only [changeS,Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_smul, + Pi.add_apply,Pi.mul_apply,Pi.smul_apply,smul_eq_mul,smoothInv_apply] + field_simp [hr x] + linear_combination hh +lemma direction_inv (θ : Fin 3 → ℂ) (f : Smooth) (hf : ∀ x, (f : X → ℂ) x≠0) : + direction (A := Smooth) coord θ (smoothInv f hf)= + -(smoothInv f hf)^2*direction (A := Smooth) coord θ f := by + simpa only [thetaDerivation_apply,smul_eq_mul] using + (thetaDerivation θ).leibniz_of_mul_eq_one (smoothInv_mul f hf) +lemma gradient_square (r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) (i : Fin 3) : + coord i (r*r)=r*r*logarithmicGrad r hr i := by + apply Subtype.ext + funext x + simp only [Derivation.leibniz,smul_eq_mul,logarithmicGrad,Subalgebra.coe_add,Subalgebra.coe_mul, + Pi.add_apply,Pi.mul_apply,smoothInv_apply] + change (r : X → ℂ) x*(coord i r : X → ℂ) x+(r : X → ℂ) x*(coord i r : X → ℂ) x= + (r : X → ℂ) x*(r : X → ℂ) x*(2*((r : X → ℂ) x)⁻¹*(coord i r : X → ℂ) x) + field_simp [hr x] + ring +lemma transformed_gradient (θ : Fin 3 → ℂ) (r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) + (a : Fin 3 → Smooth) (i : Fin 3) : + 2*coord i (r*r)*direction (A := Smooth) coord θ (a i)+ + direction (A := Smooth) coord θ (coord i (r*r))*a i = + r*(2*logarithmicGrad r hr i*direction (A := Smooth) coord θ (changeP r a i)+ + direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i) := by + rw [gradient_square r hr i] + simp only [direction_mul,changeP] + ring + +def thetaGamma (θ : Fin 3 → ℂ) (r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) : Smooth := + ∑ i, θ i • logarithmicGrad r hr i +lemma thetaGamma_eq (θ : Fin 3 → ℂ) (r : Smooth) (hr : ∀ x, (r : X → ℂ) x≠0) : + thetaGamma θ r hr=2*smoothInv r hr*direction (A := Smooth) coord θ r := by + simp only [thetaGamma,logarithmicGrad,direction,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + simp only [Algebra.smul_def] + ring + +lemma transformed_scalar (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x, (r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) + (hS : leadingS coord θ (k-r*r) (r*r) a b=0) : + (k+r*r)*direction (A := Smooth) coord θ b+direction (A := Smooth) coord θ k*b+ + r*(2*thetaGamma θ r hr*changeS k r hr a b+ + ∑ i, direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)=0 := by + have ht : (∑ i, (2*coord i (r*r)*direction (A := Smooth) coord θ (a i)+ + direction (A := Smooth) coord θ (coord i (r*r))*a i) : Smooth)= + r*(2*thetaGamma θ r hr*changeS k r hr a b+ + ∑ i, direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i) := by + simp_rw [transformed_gradient θ r hr a,normal_form_top θ k r hr a b hR] + rw [← Finset.mul_sum,Finset.sum_add_distrib] + congr 2 + simp only [thetaGamma,Finset.sum_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + simp only [Algebra.smul_def] + ring + rw [← ht] + have hsum : (∑ i, (2*coord i (r*r)*direction (A := Smooth) coord θ (a i)+ + direction (A := Smooth) coord θ (coord i (r*r))*a i) : Smooth)= + 2*(∑ i, coord i (r*r)*direction (A := Smooth) coord θ (a i))+ + ∑ i, direction (A := Smooth) coord θ (coord i (r*r))*a i := by + simp only [Finset.sum_add_distrib,Finset.mul_sum,mul_assoc] + rw [hsum] + apply Subtype.ext + funext x + have hh := congrArg (fun f : Smooth => (f : X → ℂ) x) hS + simp only [leadingS,sub_add_cancel,Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_zero, + Pi.add_apply,Pi.mul_apply,Pi.zero_apply] at hh + simp only [Subalgebra.coe_add,Subalgebra.coe_mul, + Pi.add_apply,Pi.mul_apply,Subalgebra.coe_zero,Pi.zero_apply] + change ((k+r*r : Smooth) : X → ℂ) x*(direction (A := Smooth) coord θ b : X → ℂ) x+ + (direction (A := Smooth) coord θ k : X → ℂ) x*(b : X → ℂ) x+ + (2*((∑ i,coord i (r*r)*direction (A := Smooth) coord θ (a i) : Smooth) : X → ℂ) x+ + ((∑ i,direction (A := Smooth) coord θ (coord i (r*r))*a i : Smooth) : X → ℂ) x)=0 + simp only [Subalgebra.coe_add,Subalgebra.coe_mul,Pi.add_apply,Pi.mul_apply] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + have h4 : ((4 : Smooth) : X → ℂ) x=(4 : ℂ) := rfl + rw [h2,h4] at hh + linear_combination hh/2 +lemma direction_sum (θ : Fin 3 → ℂ) (f : Fin 3 → Smooth) : + direction (A := Smooth) coord θ (∑ i,f i)=∑ i,direction (A := Smooth) coord θ (f i) := by + exact map_sum (thetaDerivation θ).toLinearMap f Finset.univ +lemma contraction_derivative (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x, (r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) : + direction (A := Smooth) coord θ (∑ i,logarithmicGrad r hr i*changeP r a i)= + (∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)+ + thetaGamma θ r hr*changeS k r hr a b := by + simp only [direction_sum,direction_mul,Finset.sum_add_distrib] + congr 1 + simp only [normal_form_top θ k r hr a b hR,thetaGamma,Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + simp only [Algebra.smul_def] + ring +lemma changeS_derivative (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x, (r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) : + direction (A := Smooth) coord θ (changeS k r hr a b)= + -(1/2 : ℂ) • ((direction (A := Smooth) coord θ k*smoothInv r hr- + k*(smoothInv r hr)^2*direction (A := Smooth) coord θ r)*b+ + k*smoothInv r hr*direction (A := Smooth) coord θ b+ + (∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i)+ + thetaGamma θ r hr*changeS k r hr a b) := by + conv_lhs => rw [changeS,direction_smul,direction_add] + rw [contraction_derivative θ k r hr a b hR] + simp only [direction_mul,direction_inv] + congr 1 + ring + +lemma normal_scalar_algebra (r k R K b db H J s : ℂ) (hr : r≠0) (hk : k≠0) + (hl : k+r*r≠0) (hB : 2*r*s+k*b+r*H=0) + (hS : (k+r*r)*db+K*b+r*(2*(2*R/r)*s+J)=0) : + -(1/2 : ℂ)*((K/r-k*R/r^2)*b+k/r*db+J+(2*R/r)*s)= + (r*r/(k+r*r))*(K/k-2*R/r)*s+ + (1/2 : ℂ)*(((r*r/(k+r*r))*(K/k)-(2*R/r)/2)*H-(r*r/(k+r*r))*J) := by + apply sub_eq_zero.mp + calc + _ = (-k/(2*r*(k+r*r)))*((k+r*r)*db+K*b+r*(2*(2*R/r)*s+J))+ + (R/(2*r^2)-r*K/(2*k*(k+r*r)))*(2*r*s+k*b+r*H) := by + have hp : k+r^2≠0 := by simpa only [pow_two] using hl + field_simp [hr,hk,hl,hp] + ring + _ = 0 := by rw [hS,hB]; ring + + +def transportT (θ : Fin 3 → ℂ) (k r : Smooth) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : Smooth := + smoothInv k hk*direction (A := Smooth) coord θ k- + smoothInv (k+r*r) hl*direction (A := Smooth) coord θ (k+r*r) +def transportQ (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : Fin 3 → Smooth := fun i => + (1/2 : ℂ) • ((r*r*smoothInv (k+r*r) hl*smoothInv k hk*direction (A := Smooth) coord θ k- + (1/2 : ℂ) • thetaGamma θ r hr)*logarithmicGrad r hr i- + r*r*smoothInv (k+r*r) hl*direction (A := Smooth) coord θ (logarithmicGrad r hr i)) +lemma transportT_eq (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) : + transportT θ k r hk hl=r*r*smoothInv (k+r*r) hl* + (smoothInv k hk*direction (A := Smooth) coord θ k-thetaGamma θ r hr) := by + apply Subtype.ext + funext x + simp only [transportT,thetaGamma_eq,direction_add,direction_mul, + Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Pi.add_apply,Pi.sub_apply,Pi.mul_apply,smoothInv_apply] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + have hh : (k : X → ℂ) x+(r : X → ℂ) x*(r : X → ℂ) x≠0 := hl x + have hp : (k : X → ℂ) x+(r : X → ℂ) x^2≠0 := by simpa only [pow_two] using hh + field_simp [hr x,hk x,hh,hp] + ring +lemma transportQ_contract (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (p : Fin 3 → Smooth) : + (∑ i,transportQ θ k r hr hk hl i*p i)= + (1/2 : ℂ) • ((r*r*smoothInv (k+r*r) hl*smoothInv k hk*direction (A := Smooth) coord θ k- + (1/2 : ℂ) • thetaGamma θ r hr)*(∑ i,logarithmicGrad r hr i*p i)- + r*r*smoothInv (k+r*r) hl*(∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*p i)) := by + simp only [transportQ,Fin.sum_univ_three,Algebra.smul_def] + ring + +/-- The exact bottom connection row follows from the physical leading equations, +not from a separately postulated transport system. -/ +theorem normal_form_bottom (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (hl : ∀ x,((k+r*r : Smooth) : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) + (hR : leadingR coord θ (k-r*r) (r*r) a b=0) + (hS : leadingS coord θ (k-r*r) (r*r) a b=0) : + direction (A := Smooth) coord θ (changeS k r hr a b)= + transportT θ k r hk hl*changeS k r hr a b+ + ∑ i,transportQ θ k r hr hk hl i*changeP r a i := by + rw [changeS_derivative θ k r hr a b hR,transportT_eq θ k r hr hk hl,transportQ_contract] + apply Subtype.ext + funext x + let R := (r : X → ℂ) x + let K := (k : X → ℂ) x + let DR := (direction (A := Smooth) coord θ r : X → ℂ) x + let DK := (direction (A := Smooth) coord θ k : X → ℂ) x + let B := (b : X → ℂ) x + let DB := (direction (A := Smooth) coord θ b : X → ℂ) x + let H := ((∑ i,logarithmicGrad r hr i*changeP r a i : Smooth) : X → ℂ) x + let J := ((∑ i,direction (A := Smooth) coord θ (logarithmicGrad r hr i)*changeP r a i : Smooth) : X → ℂ) x + let S := (changeS k r hr a b : X → ℂ) x + have he : S=-(1/2 : ℂ)*(K*R⁻¹*B+H) := rfl + have hB : 2*R*S+K*B+R*H=0 := by + rw [he] + have hn : R≠0 := hr x + field_simp [hn] + ring + have hgamma : (thetaGamma θ r hr : X → ℂ) x=2*DR/R := by + rw [thetaGamma_eq] + change 2*R⁻¹*DR=2*DR/R + ring + have hvS := congrArg (fun f : Smooth => (f : X → ℂ) x) (transformed_scalar θ k r hr a b hR hS) + simp only [Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_zero,Pi.add_apply,Pi.mul_apply, + Pi.zero_apply,hgamma] at hvS + change (K+R*R)*DB+DK*B+R*(2*(2*DR/R)*S+J)=0 at hvS + have hL : K+R*R≠0 := hl x + have ha := normal_scalar_algebra R K DR DK B DB H J S (hr x) (hk x) hL hB hvS + simp only [Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_pow, + Subalgebra.coe_smul,Pi.add_apply,Pi.sub_apply,Pi.mul_apply,Pi.pow_apply,Pi.smul_apply, + smul_eq_mul,smoothInv_apply,hgamma] + change -(1/2 : ℂ)*((DK*R⁻¹-K*(R⁻¹)^2*DR)*B+K*R⁻¹*DB+J+(2*DR/R)*S)= + R*R*(K+R*R)⁻¹*(K⁻¹*DK-2*DR/R)*S+ + (1/2 : ℂ)*((R*R*(K+R*R)⁻¹*K⁻¹*DK-(1/2 : ℂ)*(2*DR/R))*H-R*R*(K+R*R)⁻¹*J) + convert ha using 1 <;> simp only [div_eq_mul_inv,inv_pow] <;> ring + +def inverseP (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (p : Fin 3 → Smooth) : Fin 3 → Smooth := + fun i => smoothInv r hr*p i +def inverseS (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (p : Fin 3 → Smooth) (s : Smooth) : Smooth := + -r*smoothInv k hk*(2*s+∑ i,logarithmicGrad r hr i*p i) + +lemma change_inverseP (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (p : Fin 3 → Smooth) : + changeP r (inverseP r hr p)=p := by + funext i + apply Subtype.ext + funext x + change (r : X → ℂ) x*(((r : X → ℂ) x)⁻¹*(p i : X → ℂ) x)=(p i : X → ℂ) x + rw [← mul_assoc,mul_inv_cancel₀ (hr x),one_mul] +lemma inverse_changeP (r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) : + inverseP r hr (changeP r a)=a := by + funext i + apply Subtype.ext + funext x + change ((r : X → ℂ) x)⁻¹*((r : X → ℂ) x*(a i : X → ℂ) x)=(a i : X → ℂ) x + rw [← mul_assoc,inv_mul_cancel₀ (hr x),one_mul] +lemma change_inverseS (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (p : Fin 3 → Smooth) (s : Smooth) : + changeS k r hr (inverseP r hr p) (inverseS k r hr hk p s)=s := by + simp only [changeS,change_inverseP] + apply Subtype.ext + funext x + simp only [inverseS,Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_neg,Subalgebra.coe_smul, + Pi.add_apply,Pi.mul_apply,Pi.neg_apply,Pi.smul_apply,smul_eq_mul,smoothInv_apply] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + field_simp [hr x,hk x] + ring +lemma inverse_changeS (k r : Smooth) (hr : ∀ x,(r : X → ℂ) x≠0) (hk : ∀ x,(k : X → ℂ) x≠0) + (a : Fin 3 → Smooth) (b : Smooth) : + inverseS k r hr hk (changeP r a) (changeS k r hr a b)=b := by + apply Subtype.ext + funext x + simp only [inverseS,changeS,Subalgebra.coe_add,Subalgebra.coe_mul,Subalgebra.coe_neg,Subalgebra.coe_smul, + Pi.add_apply,Pi.mul_apply,Pi.neg_apply,Pi.smul_apply,smul_eq_mul,smoothInv_apply] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + field_simp [hr x,hk x] + ring +lemma normal_changeP (θ : Fin 3 → ℂ) (r : Smooth) (a : Fin 3 → Smooth) : + normal θ (changeP r a)=r*normal θ a := by + simp only [normal,changeP,Finset.mul_sum,Algebra.smul_def] + apply Finset.sum_congr rfl + intro i _ + ring + +/-- Exact intertwining of the vector leading equation, including nonzero source. -/ +lemma leadingR_change (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) (i : Fin 3) : + leadingR coord θ (k-r*r) (r*r) a b i= + 2*r*(direction (A := Smooth) coord θ (changeP r a i)-θ i • changeS k r hr a b) := by + have hg : (∑ j,coord j (r*r)*a j : Smooth)=r*(∑ j,logarithmicGrad r hr j*changeP r a j) := by + simp_rw [gradient_square r hr] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + simp only [changeP] + ring + simp only [leadingR,sub_add_cancel,hg,changeP,direction_mul,changeS] + apply Subtype.ext + funext x + simp only [Subalgebra.coe_add,Subalgebra.coe_sub,Subalgebra.coe_mul,Subalgebra.coe_smul, + Pi.add_apply,Pi.sub_apply,Pi.mul_apply,Pi.smul_apply,smul_eq_mul,smoothInv_apply] + have h2 : ((2 : Smooth) : X → ℂ) x=(2 : ℂ) := rfl + rw [h2] + field_simp [hr x] + ring + +lemma leadingR_iff (θ : Fin 3 → ℂ) (k r : Smooth) + (hr : ∀ x,(r : X → ℂ) x≠0) (a : Fin 3 → Smooth) (b : Smooth) : + leadingR coord θ (k-r*r) (r*r) a b=0 ↔ + ∀ i, direction (A := Smooth) coord θ (changeP r a i)=θ i • changeS k r hr a b := by + constructor + · intro h + exact normal_form_top θ k r hr a b h + · intro h + funext i + rw [leadingR_change θ k r hr a b i,h i,sub_self,mul_zero] + rfl +end ElasticityAugmented +namespace ElasticityFrame +open scoped BigOperators +open ElasticityAugmented + +def smoothProjection {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] + (L : F →L[ℂ] ℂ) (u : X → F) (hu : ContDiff ℝ (⊤ : ℕ∞) u) : Smooth := + ⟨fun x => L (u x),(L.restrictScalars ℝ).contDiff.comp hu⟩ + +lemma projection_direction {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] + (L : F →L[ℂ] ℂ) (u : X → F) (hu : ContDiff ℝ (⊤ : ℕ∞) u) (θ : Fin 3 → ℂ) (x : X) : + (direction (A := Smooth) coord θ (smoothProjection L u hu) : X → ℂ) x= + L (fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + Complex.I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ Complex.I)) := by + have hd (v : X) : + fderiv ℝ (smoothProjection L u hu : X → ℂ) x v=L (fderiv ℝ u x v) := by + exact congrArg (fun M : X →L[ℝ] ℂ => M v) + (((L.restrictScalars ℝ).hasFDerivAt.comp x + ((hu.differentiable (by simp)) x).hasFDerivAt).fderiv) + have he := ElasticityParameter.characteristicPlane_principal + ElasticityParameter.basis θ (fderiv ℝ (smoothProjection L u hu : X → ℂ) x) + have hb : ElasticityParameter.basis=ElasticityAugmented.e := rfl + rw [hd,hd] at he + rw [map_add,map_smul,smul_eq_mul,he] + simp only [direction,Fin.sum_univ_three,Subalgebra.coe_add,Subalgebra.coe_smul, + Pi.add_apply,Pi.smul_apply,smul_eq_mul,coord_apply,hb] + +def vectorSmooth (θ : Fin 3 → ℂ) (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) : + Fin 3 → Smooth := fun i => smoothProjection (vectorPr θ i) u hu +def scalarSmooth (θ : Fin 3 → ℂ) (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) : + Smooth := smoothProjection (scalarPr θ) u hu + +lemma smooth_normal (θ : Fin 3 → ℂ) (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) : + ElasticityAugmented.normal θ (vectorSmooth θ u hu)=0 := by + apply Subtype.ext + funext x + have h := (u x).property + change (∑ i,θ i*((u x : Fiber θ) : Amp).1 i)=0 at h + simp only [ElasticityAugmented.normal,Fin.sum_univ_three,Subalgebra.coe_add, + Subalgebra.coe_smul,Pi.add_apply,Pi.smul_apply,smul_eq_mul] + change θ 0*((u x : Fiber θ) : Amp).1 0+θ 1*((u x : Fiber θ) : Amp).1 1+ + θ 2*((u x : Fiber θ) : Amp).1 2=0 + simpa only [Fin.sum_univ_three] using h + +lemma smooth_vector_equation (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) (t : Smooth) (qq : Fin 3 → Smooth) + (x : X) + (he : fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + Complex.I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ Complex.I)= + connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x)) : + ∀ i,(direction (A := Smooth) coord θ (vectorSmooth θ u hu i) : X → ℂ) x= + θ i*(scalarSmooth θ u hu : X → ℂ) x := by + intro i + rw [vectorSmooth,projection_direction,he] + exact connection_vector θ hθ ((t : X → ℂ) x) (fun j => (qq j : X → ℂ) x) (u x) i +lemma smooth_scalar_equation (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (u : X → Fiber θ) (hu : ContDiff ℝ (⊤ : ℕ∞) u) (t : Smooth) (qq : Fin 3 → Smooth) + (x : X) + (he : fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ 1)+ + Complex.I • fderiv ℝ u x (ElasticityParameter.characteristicPlane ElasticityParameter.basis θ Complex.I)= + connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x)) : + (direction (A := Smooth) coord θ (scalarSmooth θ u hu) : X → ℂ) x= + ((t*scalarSmooth θ u hu+∑ i,qq i*vectorSmooth θ u hu i : Smooth) : X → ℂ) x := by + rw [scalarSmooth,projection_direction,he] + have h := connection_scalar θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x) + simp only [Fin.sum_univ_three,Subalgebra.coe_add,Subalgebra.coe_mul,Pi.add_apply,Pi.mul_apply] + change ((connection θ hθ ((t : X → ℂ) x) (fun i => (qq i : X → ℂ) x) (u x) : Fiber θ) : Amp).2= + (t : X → ℂ) x*((u x : Fiber θ) : Amp).2+ + ((qq 0 : X → ℂ) x*((u x : Fiber θ) : Amp).1 0+ + (qq 1 : X → ℂ) x*((u x : Fiber θ) : Amp).1 1+ + (qq 2 : X → ℂ) x*((u x : Fiber θ) : Amp).1 2) + simpa only [Fin.sum_univ_three] using h +end ElasticityFrame + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/TransportAlgebra.lean b/lean/OAI/MathematicalPhysics/Elasticity/TransportAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..463827aed5851d2d313a019caa25136ae01d43bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/TransportAlgebra.lean @@ -0,0 +1,402 @@ +import OAI.MathematicalPhysics.Elasticity.Carleman + +namespace OAI + +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented +section CGO +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable (D : Fin 3 → Derivation ℂ A A) +def normal (θ : Fin 3 → ℂ) (u : Fin 3 → A) : A := ∑ i, θ i • u i +def direction (θ : Fin 3 → ℂ) (a : A) : A := ∑ i, θ i • D i a +def leadingR (θ : Fin 3 → ℂ) (lam m : A) (u : Fin 3 → A) (b : A) (i : Fin 3) : A := + 2*m*direction D θ (u i)+direction D θ m*u i+ + θ i • ((lam+m)*b+∑ j, D j m*u j) +def leadingS (θ : Fin 3 → ℂ) (lam m : A) (u : Fin 3 → A) (b : A) : A := + 2*(lam+m+m)*direction D θ b+2*direction D θ (lam+m)*b+ + 4*(∑ i, D i m*direction D θ (u i))+2*(∑ i, direction D θ (D i m)*u i) +def leadingP (θ : Fin 3 → ℂ) (m f : A) : A := + 2*m*direction D θ f+direction D θ m*f + +lemma shifted_lap_expansion (z : Fin 3 → ℂ) (f : A) : + lapT (shifted D z) f=lap D f+2*direction D z f+(∑ i, z i*z i) • f := by + simp only [lapT,lap,direction,shifted_apply,map_add,Derivation.map_smul,Fin.sum_univ_three] + simp only [Algebra.smul_def,map_add,map_mul] + ring + +lemma leading_normal (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (lam m : A) (u : Fin 3 → A) (b : A) : + normal θ (leadingR D θ lam m u b)=leadingP D θ m (normal θ u) := by + have hz : ∑ i, algebraMap ℂ A (θ i)*algebraMap ℂ A (θ i)=0 := by + simpa only [map_sum,map_mul,map_zero] using congrArg (algebraMap ℂ A) hθ + simp only [Fin.sum_univ_three] at hz + simp only [normal,leadingR,leadingP,direction,Fin.sum_univ_three,map_add,Derivation.map_smul] + simp only [Algebra.smul_def] + linear_combination ((lam+m)*b+(D 0 m*u 0+D 1 m*u 1+D 2 m*u 2))*hz + +lemma RT_phase_polynomial (θ : Fin 3 → ℂ) (τ : ℂ) (lam m : A) (u : Fin 3 → A) (b : A) : + RT D (shifted D (τ • θ)) lam m u b = + (fun i => R D lam m u b i+τ • leadingR D θ lam m u b i+ + (τ*τ*(∑ j, θ j*θ j)) • (m*u i)) := by + funext i + simp only [RT,R,cmT,cm,lapT,lap,shifted_apply,direction,leadingR, + Pi.smul_apply,smul_eq_mul,Fin.sum_univ_three,map_add,Derivation.map_smul,smul_add] + simp only [Algebra.smul_def,map_add,map_mul] + ring + +lemma ST_phase_polynomial (θ : Fin 3 → ℂ) (τ : ℂ) (lam m : A) (u : Fin 3 → A) (b : A) + (hD : ∀ i j f, D i (D j f)=D j (D i f)) : + ST D (shifted D (τ • θ)) lam m u b = S D lam m u b+τ • leadingS D θ lam m u b+ + (τ*τ*(∑ j, θ j*θ j)) • ((lam+m+m)*b+2*∑ i, D i m*u i) := by + simp only [ST,S,lapT,lap,shifted_apply,direction,leadingS, + Pi.smul_apply,smul_eq_mul,Fin.sum_univ_three,map_add,Derivation.map_smul,smul_add] + simp only [Algebra.smul_def,map_add,map_mul] + rw [hD 1 0 m,hD 2 0 m,hD 2 1 m] + ring + +lemma RT_null_expansion (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (τ : ℂ) (lam m : A) (u : Fin 3 → A) (b : A) (i : Fin 3) : + RT D (shifted D (τ • θ)) lam m u b i=R D lam m u b i+τ • leadingR D θ lam m u b i := by + have hh := congrFun (RT_phase_polynomial D θ τ lam m u b) i + simpa only [hθ,mul_zero,zero_smul,add_zero] using hh + +lemma ST_null_expansion (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (τ : ℂ) (lam m : A) (u : Fin 3 → A) (b : A) + (hD : ∀ i j f, D i (D j f)=D j (D i f)) : + ST D (shifted D (τ • θ)) lam m u b=S D lam m u b+τ • leadingS D θ lam m u b := by + simpa only [hθ,mul_zero,zero_smul,add_zero] using ST_phase_polynomial D θ τ lam m u b hD +/-- The exact first-order compatibility identity used by the physical recursion. -/ +lemma transport_compatibility (θ : Fin 3 → ℂ) (lam m : A) (u : Fin 3 → A) (b : A) + (hD : ∀ i j f, D i (D j f)=D j (D i f)) : + div D (leadingR D θ lam m u b)+normal θ (R D lam m u b)-leadingS D θ lam m u b = + P D m (normal θ u)+leadingP D θ m (div D u-b) := by + have htwo (i : Fin 3) : D i (2 : A)=0 := (D i).map_natCast 2 + simp only [div,normal,leadingR,leadingS,leadingP,direction,R,P,cm,lap, + Fin.sum_univ_three,map_add,map_sub,Derivation.map_smul,partial_mul,htwo,zero_mul,zero_add] + simp only [hD 1 0,hD 2 0,hD 2 1,Algebra.smul_def] + ring +end CGO +end ElasticityAugmented + +end +end +section +noncomputable section +open scoped BigOperators +namespace ElasticityAugmented +section FiniteExpansion +variable {V W : Type*} [AddCommGroup V] [Module ℂ V] [AddCommGroup W] [Module ℂ W] +def truncation (h : ℂ) (N : ℕ) (a : ℕ → V) : V := ∑ j ∈ Finset.range (N+1), h^j • a j +lemma truncation_zero (h : ℂ) (a : ℕ → V) : truncation h 0 a=a 0 := by simp [truncation] +lemma truncation_succ (h : ℂ) (N : ℕ) (a : ℕ → V) : + truncation h (N+1) a=truncation h N a+h^(N+1) • a (N+1) := by + exact Finset.sum_range_succ _ _ + +/-- Exact finite telescoping, not an asymptotic formal series. -/ +lemma truncated_transport (L T : V →ₗ[ℂ] W) (h : ℂ) (hh : h ≠ 0) (N : ℕ) (a : ℕ → V) + (h₀ : T (a 0)=0) (hrec : ∀ j simp only [truncation_zero,h₀,smul_zero,add_zero,pow_zero,one_smul] + | succ N ih => + have hn := ih (fun j hj => hrec j (hj.trans (Nat.lt_succ_self N))) + have hp : h⁻¹*h^(N+1)=h^N := by rw [pow_succ]; field_simp + simp only [truncation_succ,map_add,map_smul,smul_add,smul_smul,hp,hrec N (Nat.lt_succ_self N),smul_neg] + rw [← hn] + abel +end FiniteExpansion +section PhysicalRecursion +variable {A : Type*} [CommRing A] [Algebra ℂ A] +variable (D : Fin 3 → Derivation ℂ A A) +abbrev Amplitude (A : Type*) := (Fin 3 → A) × A + +def Rpair (lam m : A) : Amplitude A →ₗ[ℂ] (Fin 3 → A) where + toFun a := R D lam m a.1 a.2 + map_add' a b := by + funext i + simp only [R,lap,cm,Prod.fst_add,Prod.snd_add,Pi.add_apply,map_add,Finset.sum_add_distrib,mul_add,add_mul] + ring + map_smul' c a := by + funext i + simp only [R,lap,cm,Prod.smul_fst,Prod.smul_snd,Pi.smul_apply,Derivation.map_smul] + simp only [Algebra.smul_def,Fin.sum_univ_three,RingHom.id_apply] + ring + +def leadingRpair (θ : Fin 3 → ℂ) (lam m : A) : Amplitude A →ₗ[ℂ] (Fin 3 → A) where + toFun a := leadingR D θ lam m a.1 a.2 + map_add' a b := by + funext i + simp only [leadingR,direction,Prod.fst_add,Prod.snd_add,Pi.add_apply,map_add,smul_add, + Finset.sum_add_distrib,mul_add,add_mul] + ring + map_smul' c a := by + funext i + simp only [leadingR,direction,Prod.smul_fst,Prod.smul_snd,Pi.smul_apply,Derivation.map_smul] + simp only [Algebra.smul_def,Fin.sum_univ_three,RingHom.id_apply] + ring + +def divergenceDefect : Amplitude A →ₗ[ℂ] A where + toFun a := div D a.1-a.2 + map_add' a b := by + simp only [div,Prod.fst_add,Prod.snd_add,Pi.add_apply,map_add,Finset.sum_add_distrib] + abel + map_smul' c a := by + simp only [div,Prod.smul_fst,Prod.smul_snd,Pi.smul_apply,Derivation.map_smul,Finset.smul_sum,smul_sub, + RingHom.id_apply] + +def normalPair (θ : Fin 3 → ℂ) : Amplitude A →ₗ[ℂ] A where + toFun a := normal θ a.1 + map_add' a b := by + simp only [normal,Prod.fst_add,Pi.add_apply,smul_add,Finset.sum_add_distrib] + map_smul' c a := by + simp only [normal,Prod.smul_fst,Pi.smul_apply,smul_comm (θ _) c,Finset.smul_sum,RingHom.id_apply] + +lemma truncated_R (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) (lam m : A) + (h : ℂ) (hh : h ≠ 0) (N : ℕ) (a : ℕ → Amplitude A) + (h₀ : leadingR D θ lam m (a 0).1 (a 0).2=0) + (hrec : ∀ j (v : U → ℂ) ⟨x,hx⟩) h + · intro h + apply Subtype.ext + funext x + exact h x.property +lemma restrictSmooth_zero_iff (U : Set X) (f : Smooth) : + restrictSmooth U f=0 ↔ ∀ x∈U,(f : X → ℂ) x=0 := by + rw [← map_zero (restrictSmooth U),restrictSmooth_eq_iff] + rfl +lemma restrict_coord_zero {U : Set X} (hU : IsOpen U) (i : Fin 3) (f : Smooth) + (hf : restrictSmooth U f=0) : restrictSmooth U (coord i f)=0 := by + apply (restrictSmooth_zero_iff U _).mpr + intro x hx + have he : (f : X → ℂ)=ᶠ[𝓝 x] fun _ => 0 := by + filter_upwards [hU.mem_nhds hx] with y hy + exact (restrictSmooth_zero_iff U f).mp hf y hy + rw [coord_apply,he.fderiv_eq] + simp + +def localCoord {U : Set X} (hU : IsOpen U) (i : Fin 3) : + Derivation ℂ (LocalSmooth U) (LocalSmooth U) := + Derivation.liftOfSurjective (restrictSmooth_surjective U) (restrict_coord_zero hU i) +lemma localCoord_restrict {U : Set X} (hU : IsOpen U) (i : Fin 3) (f : Smooth) : + localCoord hU i (restrictSmooth U f)=restrictSmooth U (coord i f) := by + exact Derivation.liftOfSurjective_apply (restrictSmooth_surjective U) (restrict_coord_zero hU i) f +lemma localCoord_commute {U : Set X} (hU : IsOpen U) (i j : Fin 3) (f : LocalSmooth U) : + localCoord hU i (localCoord hU j f)=localCoord hU j (localCoord hU i f) := by + obtain ⟨f,rfl⟩ := restrictSmooth_surjective U f + simp only [localCoord_restrict,coord_commute i j] + +lemma restrict_div {U : Set X} (hU : IsOpen U) (a : Fin 3 → Smooth) : + restrictSmooth U (div coord a)=div (localCoord hU) (fun i => restrictSmooth U (a i)) := by + simp only [div,map_sum,localCoord_restrict] +lemma restrict_normal (U : Set X) (θ : Fin 3 → ℂ) (a : Fin 3 → Smooth) : + restrictSmooth U (normal θ a)=normal θ (fun i => restrictSmooth U (a i)) := by + simp only [normal,map_sum,map_smul] +lemma restrict_direction {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) (f : Smooth) : + restrictSmooth U (direction coord θ f)=direction (localCoord hU) θ (restrictSmooth U f) := by + simp only [direction,map_sum,map_smul,localCoord_restrict] +lemma restrict_R {U : Set X} (hU : IsOpen U) (lam mu : Smooth) (a : Fin 3 → Smooth) (b : Smooth) (i : Fin 3) : + restrictSmooth U (R coord lam mu a b i)= + R (localCoord hU) (restrictSmooth U lam) (restrictSmooth U mu) + (fun i => restrictSmooth U (a i)) (restrictSmooth U b) i := by + simp only [R,cm,lap,map_add,map_mul,map_sum,localCoord_restrict] +lemma restrict_S {U : Set X} (hU : IsOpen U) (lam mu : Smooth) (a : Fin 3 → Smooth) (b : Smooth) : + restrictSmooth U (S coord lam mu a b)= + S (localCoord hU) (restrictSmooth U lam) (restrictSmooth U mu) + (fun i => restrictSmooth U (a i)) (restrictSmooth U b) := by + simp only [S,lap,map_add,map_mul,map_ofNat,map_sum,localCoord_restrict] +lemma restrict_leadingR {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) + (lam mu : Smooth) (a : Fin 3 → Smooth) (b : Smooth) (i : Fin 3) : + restrictSmooth U (leadingR coord θ lam mu a b i)= + leadingR (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U mu) + (fun i => restrictSmooth U (a i)) (restrictSmooth U b) i := by + simp only [leadingR,map_add,map_mul,map_ofNat,map_sum,map_smul,localCoord_restrict,restrict_direction hU] +lemma restrict_leadingS {U : Set X} (hU : IsOpen U) (θ : Fin 3 → ℂ) + (lam mu : Smooth) (a : Fin 3 → Smooth) (b : Smooth) : + restrictSmooth U (leadingS coord θ lam mu a b)= + leadingS (localCoord hU) θ (restrictSmooth U lam) (restrictSmooth U mu) + (fun i => restrictSmooth U (a i)) (restrictSmooth U b) := by + simp only [leadingS,map_add,map_mul,map_ofNat,map_sum,localCoord_restrict,restrict_direction hU] +end ElasticityAugmented + +end +end +section +noncomputable section +open Set +open scoped BigOperators +namespace ElasticityAugmented + +lemma restrict_coeffA {B : Set X} (hB : IsOpen B) (lam m n o : Smooth) + (k : Fin 3) (i j : Fin 4) : + restrictSmooth B (coeffA coord lam m n o k i j)= + coeffA (localCoord hB) (restrictSmooth B lam) (restrictSmooth B m) + (restrictSmooth B n) (restrictSmooth B o) k i j := by + refine Fin.cases ?_ (fun i => ?_) i <;> refine Fin.cases ?_ (fun j => ?_) j <;> + simp only [coeffA,Fin.cons_zero,Fin.cons_succ,map_mul,map_add,map_sub,map_ofNat, + localCoord_restrict,map_zero,apply_ite] <;> split_ifs <;> rfl + +lemma restrict_coeffV {B : Set X} (hB : IsOpen B) (lam m n o : Smooth) + (i j : Fin 4) : + restrictSmooth B (coeffV coord lam m n o i j)= + coeffV (localCoord hB) (restrictSmooth B lam) (restrictSmooth B m) + (restrictSmooth B n) (restrictSmooth B o) i j := by + refine Fin.cases ?_ (fun i => ?_) i <;> refine Fin.cases ?_ (fun j => ?_) j <;> + simp only [coeffV,Fin.cons_zero,Fin.cons_succ,lap,map_mul,map_sub,map_ofNat, + map_sum,localCoord_restrict,map_zero] + +lemma inverse_eqOn {B : Set X} (m₁ m₂ n₁ n₂ : Smooth) + (hn₁ : n₁*m₁=1) (hn₂ : n₂*m₂=1) (he : EqOn (m₁ : X → ℂ) m₂ B) : + EqOn (n₁ : X → ℂ) n₂ B := by + intro x hx + have h1 := congrArg (fun f : Smooth => (f : X → ℂ) x) hn₁ + have h2 := congrArg (fun f : Smooth => (f : X → ℂ) x) hn₂ + change (n₁ : X → ℂ) x*(m₁ : X → ℂ) x=1 at h1 + change (n₂ : X → ℂ) x*(m₂ : X → ℂ) x=1 at h2 + rw [he hx] at h1 + linear_combination (n₂ : X → ℂ) x*h1-(n₁ : X → ℂ) x*h2 + +/-- Equality of the original coefficients on an open set gives equality of +both actual normalized matrices there. Reciprocals are not extra exterior +identifications: they follow from their defining inverse identities. -/ +theorem normalized_coefficients_eqOn {B : Set X} (hB : IsOpen B) + (l₁ m₁ n₁ o₁ l₂ m₂ n₂ o₂ : Smooth) + (hn₁ : n₁*m₁=1) (hn₂ : n₂*m₂=1) + (ho₁ : o₁*(l₁+m₁+m₁)=1) (ho₂ : o₂*(l₂+m₂+m₂)=1) + (hel : EqOn (l₁ : X → ℂ) l₂ B) (hem : EqOn (m₁ : X → ℂ) m₂ B) : + (∀ k i j,EqOn ((coeffA coord l₁ m₁ n₁ o₁ k i j : Smooth) : X → ℂ) + ((coeffA coord l₂ m₂ n₂ o₂ k i j : Smooth) : X → ℂ) B) ∧ + (∀ i j,EqOn ((coeffV coord l₁ m₁ n₁ o₁ i j : Smooth) : X → ℂ) + ((coeffV coord l₂ m₂ n₂ o₂ i j : Smooth) : X → ℂ) B) := by + have hen := inverse_eqOn m₁ m₂ n₁ n₂ hn₁ hn₂ hem + have heo : EqOn (o₁ : X → ℂ) o₂ B := + inverse_eqOn _ _ o₁ o₂ ho₁ ho₂ (by + intro x hx + change (l₁ : X → ℂ) x+(m₁ : X → ℂ) x+(m₁ : X → ℂ) x = + (l₂ : X → ℂ) x+(m₂ : X → ℂ) x+(m₂ : X → ℂ) x + rw [hel hx,hem hx]) + have hl := (restrictSmooth_eq_iff B _ _).mpr hel + have hm := (restrictSmooth_eq_iff B _ _).mpr hem + have hn := (restrictSmooth_eq_iff B _ _).mpr hen + have ho := (restrictSmooth_eq_iff B _ _).mpr heo + constructor + · intro k i j + apply (restrictSmooth_eq_iff B _ _).mp + rw [restrict_coeffA hB,restrict_coeffA hB,hl,hm,hn,ho] + · intro i j + apply (restrictSmooth_eq_iff B _ _).mp + rw [restrict_coeffV hB,restrict_coeffV hB,hl,hm,hn,ho] +end ElasticityAugmented + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Uniqueness.lean b/lean/OAI/MathematicalPhysics/Elasticity/Uniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..efc1ea51d4988b3326af7165027c3b4792045026 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Uniqueness.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.Elasticity.Rigidity +import OAI.MathematicalPhysics.Elasticity.BoundaryJets + +namespace OAI + +section +noncomputable section +open Set Filter +open scoped Topology +namespace ElasticityBoundaryPacket +open Elasticity +/-- Full common-exterior reduction from the physical DN map. In particular no +prior boundary jets or agreement on a boundary neighbourhood is assumed. -/ +theorem admissible_common_exterior {Ω : Set X} (hD : SourceDomain Ω) + (l₁ m₁ l₂ m₂ : X → ℝ) (ha₁ : Admissible Ω l₁ m₁) (ha₂ : Admissible Ω l₂ m₂) + (hDN : DN Ω l₁ m₁=DN Ω l₂ m₂) : + ∃ L₁ M₁ L₂ M₂ : X → ℝ, + ContDiff ℝ (⊤ : ℕ∞) L₁ ∧ ContDiff ℝ (⊤ : ℕ∞) M₁ ∧ + ContDiff ℝ (⊤ : ℕ∞) L₂ ∧ ContDiff ℝ (⊤ : ℕ∞) M₂ ∧ + EqOn L₁ l₁ Ω ∧ EqOn M₁ m₁ Ω ∧ EqOn L₂ l₂ Ω ∧ EqOn M₂ m₂ Ω ∧ + (∀ x,0 < M₁ x ∧ 0<3*L₁ x+2*M₁ x) ∧ + (∀ x,0 < M₂ x ∧ 0<3*L₂ x+2*M₂ x) ∧ + EqOn L₂ L₁ Ωᶜ ∧ EqOn M₂ M₁ Ωᶜ ∧ + DN Ω L₁ M₁=DN Ω L₂ M₂ ∧ + ∃ K,IsCompact K ∧ ∀ x∉K,L₁ x=0 ∧ M₁ x=1 ∧ L₂ x=0 ∧ M₂ x=1 := by + obtain ⟨hjl,hjm⟩ := admissible_boundary_jets hD l₁ m₁ l₂ m₂ ha₁ ha₂ hDN + obtain ⟨U₁,hU₁,hs₁,hl₁,hm₁⟩ := ha₁.common_neighborhood + obtain ⟨U₂,hU₂,hs₂,hl₂,hm₂⟩ := ha₂.common_neighborhood + obtain ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂,heL₁,heM₁,heL₂,heM₂,hp₁,hp₂,hexL,hexM,hK⟩ := + ElasticityBoundary.common_exterior_of_all_jets hD.2.2.1.isCompact_closure + hU₁ hU₂ hs₁ hs₂ l₁ m₁ l₂ m₂ hl₁ hm₁ hl₂ hm₂ ha₁.2.2 ha₂.2.2 hjl hjm + refine ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂,heL₁,heM₁,heL₂,heM₂,hp₁,hp₂,hexL,hexM,?_,hK⟩ + exact (DN_coeff_congr hD.1.measurableSet heL₁ heM₁).trans + (hDN.trans (DN_coeff_congr hD.1.measurableSet heL₂ heM₂).symm) +end ElasticityBoundaryPacket + +end +end +section +noncomputable section +open Set +namespace Elasticity +open ElasticityAugmented ElasticityCoeffBounds + +lemma exteriorConstant_of_eq_const {f : X → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) + {K : Set X} (hK : IsCompact K) (c : ℝ) (hc : ∀ x∉K,f x=c) : + ExteriorConstant (smoothOfReal f hf) := by + refine ⟨(c : ℂ),hK.of_isClosed_subset (isClosed_tsupport _) ?_⟩ + apply closure_minimal ?_ hK.isClosed + intro x hx + by_contra h + apply hx + change (f x : ℂ)-(c : ℂ)=0 + rw [hc x h,sub_self] + +/-- Exact global smooth isotropic elasticity uniqueness on every bounded +connected domain with genuine smooth open boundary charts. Boundary jets, +common exterior, physical transfer, weak limits, constrained common frames, +parameter holomorphy and transport matching are all proved dependencies. -/ +theorem source_global_uniqueness (Ω : Set X) (hD : SourceDomain Ω) + (lam₁ mu₁ lam₂ mu₂ : X → ℝ) + (ha₁ : Admissible Ω lam₁ mu₁) (ha₂ : Admissible Ω lam₂ mu₂) + (hDN : DN Ω lam₁ mu₁=DN Ω lam₂ mu₂) : + (∀ x∈Ω,lam₁ x=lam₂ x) ∧ (∀ x∈Ω,mu₁ x=mu₂ x) := by + obtain ⟨L₁,M₁,L₂,M₂,hL₁,hM₁,hL₂,hM₂,heL₁,heM₁,heL₂,heM₂,hp₁,hp₂,hexL,hexM,hd,K,hK,hout⟩ := + ElasticityBoundaryPacket.admissible_common_exterior hD lam₁ mu₁ lam₂ mu₂ ha₁ ha₂ hDN + let l : Fin 2 → X → ℝ := ![L₁,L₂] + let m : Fin 2 → X → ℝ := ![M₁,M₂] + have hl (q : Fin 2) : ContDiff ℝ (⊤ : ℕ∞) (l q) := by fin_cases q; exact hL₁; exact hL₂ + have hm (q : Fin 2) : ContDiff ℝ (⊤ : ℕ∞) (m q) := by fin_cases q; exact hM₁; exact hM₂ + have hp (q : Fin 2) (x : X) : 0 < m q x ∧ 0<3*l q x+2*m q x := by + fin_cases q; exact hp₁ x; exact hp₂ x + have hcll (q : Fin 2) : ExteriorConstant (smoothOfReal (l q) (hl q)) := by + apply exteriorConstant_of_eq_const (hl q) hK 0 + intro x hx + fin_cases q; exact (hout x hx).1; exact (hout x hx).2.2.1 + have hclm (q : Fin 2) : ExteriorConstant (smoothOfReal (m q) (hm q)) := by + apply exteriorConstant_of_eq_const (hm q) hK 1 + intro x hx + fin_cases q; exact (hout x hx).2.1; exact (hout x hx).2.2.2 + have he (x) (hx : x∉Ω) : l 0 x=l 1 x ∧ m 0 x=m 1 x := ⟨(hexL hx).symm,(hexM hx).symm⟩ + have hh := dn_global_coefficients_equal hD.1 hD.2.2.1 l m hl hm hp hcll hclm he hd + constructor + · intro x hx + rw [← heL₁ hx,← heL₂ hx] + exact congrFun hh.1 x + · intro x hx + rw [← heM₁ hx,← heM₂ hx] + exact congrFun hh.2 x +end Elasticity + +end +end +theorem Elasticity.global_uniqueness : Elasticity.MainClaim := by + intro Ω hD lam₁ mu₁ lam₂ mu₂ ha₁ ha₂ hDN + exact Elasticity.source_global_uniqueness Ω hD lam₁ mu₁ lam₂ mu₂ ha₁ ha₂ hDN + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/Variational.lean b/lean/OAI/MathematicalPhysics/Elasticity/Variational.lean new file mode 100644 index 0000000000000000000000000000000000000000..97d3e4982fe2354a3e78ca5f7384d86de4296d3d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/Variational.lean @@ -0,0 +1,1127 @@ +import OAI.MathematicalPhysics.Elasticity.Basic + +namespace OAI + +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators + + + +namespace Elasticity +open scoped BigOperators + +lemma coordDeriv_add {f g : X → V} (hf : Differentiable ℝ f) + (hg : Differentiable ℝ g) (i : Fin 3) : + coordDeriv (f+g) i = coordDeriv f i + coordDeriv g i := by + funext x + exact congrArg (fun L : X →L[ℝ] V => L (coordVector i)) + (fderiv_add (hf x) (hg x)) + +lemma coordDeriv_smul (c : ℝ) {f : X → V} (hf : Differentiable ℝ f) + (i : Fin 3) : coordDeriv (c • f) i = c • coordDeriv f i := by + funext x + exact congrArg (fun L : X →L[ℝ] V => L (coordVector i)) + (fderiv_const_smul (hf x) c) + +lemma coordDeriv_zero (i : Fin 3) : coordDeriv (0 : X → V) i = 0 := by + ext x j + simp [coordDeriv] + +def smoothJetSubmodule (Ω : Set X) : Submodule ℝ (Ambient Ω) where + carrier := SmoothJets Ω + zero_mem' := by + refine ⟨0, MemLp.zero, fun i => ?_, contDiff_const, ?_, ?_⟩ + · simpa only [coordDeriv_zero] using (MemLp.zero : MemLp (0 : X → V) 2 (volume.restrict Ω)) + · simp + · funext i + change 0 = _ + simp only [coordDeriv_zero, MemLp.toLp_zero] + add_mem' := by + rintro u v ⟨f, hf, hd, hs, hu, hud⟩ ⟨g, hg, he, ht, hv, hvd⟩ + have hb (i) : MemLp (coordDeriv (f+g) i) 2 (volume.restrict Ω) := by + rw [coordDeriv_add (hs.differentiable (by simp)) (ht.differentiable (by simp))] + exact (hd i).add (he i) + refine ⟨f+g, hf.add hg, hb, hs.add ht, ?_, ?_⟩ + · simpa [hu, hv] using (MemLp.toLp_add hf hg).symm + · funext i + simp only [Prod.snd_add, Pi.add_apply, hud, hvd] + simp only [coordDeriv_add (hs.differentiable (by simp)) (ht.differentiable (by simp))] + exact (MemLp.toLp_add (hd i) (he i)).symm + smul_mem' := by + rintro c u ⟨f, hf, hd, hs, hu, hud⟩ + have hb (i) : MemLp (coordDeriv (c • f) i) 2 (volume.restrict Ω) := by + rw [coordDeriv_smul c (hs.differentiable (by simp))] + exact (hd i).const_smul c + refine ⟨c • f, hf.const_smul c, hb, hs.const_smul c, ?_, ?_⟩ + · simpa [hu] using (MemLp.toLp_const_smul c hf).symm + · funext i + change c • u.2 i = _ + rw [hud] + simp only [coordDeriv_smul c (hs.differentiable (by simp))] + exact (MemLp.toLp_const_smul c (hd i)).symm + +/-- Compactly supported interior test jets, with the actual support condition. -/ +def testJetSubmodule (Ω : Set X) : Submodule ℝ (Ambient Ω) where + carrier := TestJets Ω + zero_mem' := by + refine ⟨0, MemLp.zero, fun i => ?_, contDiff_const, HasCompactSupport.zero, ?_, ?_, ?_⟩ + · simpa only [coordDeriv_zero] using (MemLp.zero : MemLp (0 : X → V) 2 (volume.restrict Ω)) + · simp + · simp + · funext i + change 0 = _ + simp only [coordDeriv_zero, MemLp.toLp_zero] + add_mem' := by + rintro u v ⟨f, hf, hd, hs, hc, hsup, hu, hud⟩ ⟨g, hg, he, ht, hgc, hgsup, hv, hvd⟩ + have hb (i) : MemLp (coordDeriv (f+g) i) 2 (volume.restrict Ω) := by + rw [coordDeriv_add (hs.differentiable (by simp)) (ht.differentiable (by simp))] + exact (hd i).add (he i) + refine ⟨f+g, hf.add hg, hb, hs.add ht, hc.add hgc, + (tsupport_add f g).trans (union_subset hsup hgsup), ?_, ?_⟩ + · simpa [hu, hv] using (MemLp.toLp_add hf hg).symm + · funext i + simp only [Prod.snd_add, Pi.add_apply, hud, hvd] + simp only [coordDeriv_add (hs.differentiable (by simp)) (ht.differentiable (by simp))] + exact (MemLp.toLp_add (hd i) (he i)).symm + smul_mem' := by + rintro c u ⟨f, hf, hd, hs, hc, hsup, hu, hud⟩ + have hb (i) : MemLp (coordDeriv (c • f) i) 2 (volume.restrict Ω) := by + rw [coordDeriv_smul c (hs.differentiable (by simp))] + exact (hd i).const_smul c + refine ⟨c • f, hf.const_smul c, hb, hs.const_smul c, (hc.smul_left : HasCompactSupport ((fun _ : X => c) • f)), + (tsupport_smul_subset_right (fun _ : X => c) f).trans hsup, ?_, ?_⟩ + · simpa [hu] using (MemLp.toLp_const_smul c hf).symm + · funext i + change c • u.2 i = _ + rw [hud] + simp only [coordDeriv_smul c (hs.differentiable (by simp))] + exact (MemLp.toLp_const_smul c (hd i)).symm + +lemma testJetSubmodule_le (Ω : Set X) : testJetSubmodule Ω ≤ smoothJetSubmodule Ω := by + rintro u ⟨f,hf,hd,hs,_,_,hu,hud⟩ + exact ⟨f,hf,hd,hs,hu,hud⟩ + +def h1Submodule (Ω : Set X) : Submodule ℝ (Ambient Ω) := + (smoothJetSubmodule Ω).topologicalClosure + +def h10Submodule (Ω : Set X) : Submodule ℝ (Ambient Ω) := + (testJetSubmodule Ω).topologicalClosure + +lemma h10Submodule_le (Ω : Set X) : h10Submodule Ω ≤ h1Submodule Ω := + Submodule.topologicalClosure_mono (testJetSubmodule_le Ω) + +lemma sameTrace_refl (Ω : Set X) (u : H1 Ω) : SameTrace Ω u u := by + exact show u.val - u.val ∈ h10Submodule Ω by rw [sub_self]; exact Submodule.zero_mem _ + +lemma sameTrace_symm (Ω : Set X) {u v : H1 Ω} (h : SameTrace Ω u v) : + SameTrace Ω v u := by + exact show v.val - u.val ∈ h10Submodule Ω by + rw [← neg_sub]; exact Submodule.neg_mem _ h + +lemma sameTrace_trans (Ω : Set X) {u v w : H1 Ω} + (h : SameTrace Ω u v) (h' : SameTrace Ω v w) : SameTrace Ω u w := by + exact show u.val - w.val ∈ h10Submodule Ω by + convert Submodule.add_mem (h10Submodule Ω) h h' using 1; abel + +abbrev JetH (Ω : Set X) := PiLp 2 (fun _ : Option (Fin 3) => Lp V 2 (volume.restrict Ω)) + +def jetEquiv (Ω : Set X) : JetH Ω ≃L[ℝ] Ambient Ω := by + let e : (Option (Fin 3) → Lp V 2 (volume.restrict Ω)) ≃L[ℝ] Ambient Ω := + { toLinearEquiv := LinearEquiv.piOptionEquivProd ℝ + continuous_toFun := (continuous_apply none).prodMk + (continuous_pi fun i => continuous_apply (some i)) + continuous_invFun := continuous_pi fun i => by + cases i with + | none => exact continuous_fst + | some i => exact (continuous_apply i).comp continuous_snd } + exact (PiLp.continuousLinearEquiv 2 ℝ _).trans e + +@[simp] lemma jetEquiv_apply (Ω : Set X) (u : JetH Ω) : + jetEquiv Ω u = (u none, fun i => u (some i)) := rfl + +def H1Hilbert (Ω : Set X) : Submodule ℝ (JetH Ω) := + (h1Submodule Ω).comap (jetEquiv Ω).toLinearMap + +def H10Hilbert (Ω : Set X) : Submodule ℝ (JetH Ω) := + (h10Submodule Ω).comap (jetEquiv Ω).toLinearMap + +lemma isClosed_H1Hilbert (Ω : Set X) : IsClosed (H1Hilbert Ω : Set (JetH Ω)) := + (smoothJetSubmodule Ω).isClosed_topologicalClosure.preimage (jetEquiv Ω).continuous + +lemma isClosed_H10Hilbert (Ω : Set X) : IsClosed (H10Hilbert Ω : Set (JetH Ω)) := + (testJetSubmodule Ω).isClosed_topologicalClosure.preimage (jetEquiv Ω).continuous + +instance (Ω : Set X) : CompleteSpace (H1Hilbert Ω) := (isClosed_H1Hilbert Ω).completeSpace_coe +instance (Ω : Set X) : CompleteSpace (H10Hilbert Ω) := (isClosed_H10Hilbert Ω).completeSpace_coe + +lemma H10Hilbert_le (Ω : Set X) : H10Hilbert Ω ≤ H1Hilbert Ω := + Submodule.comap_mono (h10Submodule_le Ω) + +/-- The Hilbert version is exactly the H¹ jet closure, not an extra +regularity hypothesis or a replacement by a smaller test space. -/ +def h1Equiv (Ω : Set X) : (H1Hilbert Ω) ≃ H1 Ω where + toFun u := ⟨jetEquiv Ω u, u.property⟩ + invFun u := ⟨(jetEquiv Ω).symm u.val, by + change jetEquiv Ω ((jetEquiv Ω).symm u.val) ∈ h1Submodule Ω + rw [ContinuousLinearEquiv.apply_symm_apply] + exact u.property⟩ + left_inv u := by apply Subtype.ext; exact (jetEquiv Ω).symm_apply_apply u.val + right_inv u := by apply Subtype.ext; exact (jetEquiv Ω).apply_symm_apply u.val + +end Elasticity + +end +end +section +/-! The physical energy is a continuous bilinear form on the actual +Hilbert jet space. Bounded coefficients below are proved from admissibility +later, rather than added to the inverse theorem. -/ +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace Elasticity + +abbrev ScalarL2 (Ω : Set X) := Lp ℝ 2 (volume.restrict Ω) + +structure BoundedCoefficient (Ω : Set X) (a : X → ℝ) : Prop where + measurable : AEStronglyMeasurable a (volume.restrict Ω) + bound : ∃ C : ℝ, ∀ᵐ x ∂(volume.restrict Ω), ‖a x‖ ≤ C + +namespace BoundedCoefficient +variable {Ω : Set X} {a : X → ℝ} (ha : BoundedCoefficient Ω a) + +include ha in +lemma mul_memLp (f : ScalarL2 Ω) : MemLp (fun x => a x * f x) 2 (volume.restrict Ω) := by + obtain ⟨C,hC⟩ := ha.bound + apply (Lp.memLp f).of_le_mul (c := C) (ha.measurable.mul (Lp.aestronglyMeasurable f)) + filter_upwards [hC] with x hx + simpa only [Pi.mul_apply, norm_mul] using mul_le_mul_of_nonneg_right hx (norm_nonneg (f x)) + +def mulL : ScalarL2 Ω →L[ℝ] ScalarL2 Ω := by + let F : ScalarL2 Ω →ₗ[ℝ] ScalarL2 Ω := + { toFun f := (ha.mul_memLp f).toLp _ + map_add' f g := by + apply Lp.ext + filter_upwards [(ha.mul_memLp (f+g)).coeFn_toLp, + (ha.mul_memLp f).coeFn_toLp, (ha.mul_memLp g).coeFn_toLp, + Lp.coeFn_add f g, Lp.coeFn_add ((ha.mul_memLp f).toLp _) ((ha.mul_memLp g).toLp _)] + with x hfg hf hg hadd he + rw [hfg,he] + simp only [Pi.add_apply] + rw [hf,hg,hadd] + exact mul_add .. + map_smul' c f := by + apply Lp.ext + filter_upwards [(ha.mul_memLp (c • f)).coeFn_toLp, + (ha.mul_memLp f).coeFn_toLp, Lp.coeFn_smul c f, + Lp.coeFn_smul c ((ha.mul_memLp f).toLp _)] with x hcf hf hs ht + simp only [RingHom.id_apply] + rw [hcf,ht] + simp only [Pi.smul_apply, smul_eq_mul] + rw [hf,hs] + simp only [Pi.smul_apply, smul_eq_mul] + ring } + let C := ha.bound.choose + have hC := ha.bound.choose_spec + exact F.mkContinuous C (fun f => by + apply Lp.norm_le_mul_norm_of_ae_le_mul + filter_upwards [(ha.mul_memLp f).coeFn_toLp,hC] with x hx hb + change ‖(ha.mul_memLp f).toLp _ x‖ ≤ _ + rw [hx,norm_mul] + exact mul_le_mul_of_nonneg_right hb (norm_nonneg _)) + +lemma mulL_ae (f : ScalarL2 Ω) : ha.mulL f =ᵐ[volume.restrict Ω] fun x => a x*f x := + (ha.mul_memLp f).coeFn_toLp + +lemma inner_mulL (f g : ScalarL2 Ω) : + inner ℝ (ha.mulL f) g = ∫ x, a x*f x*g x ∂(volume.restrict Ω) := by + rw [MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [ha.mulL_ae f] with x hx + rw [hx,real_inner_comm] + rfl +end BoundedCoefficient + +variable {Ω : Set X} + +lemma lp_sum_ae {ι : Type*} (s : Finset ι) (f : ι → ScalarL2 Ω) : + ((∑ i ∈ s, f i : ScalarL2 Ω) : X → ℝ) =ᵐ[volume.restrict Ω] fun x => ∑ i ∈ s, f i x := by + classical + induction s using Finset.induction_on with + | empty => + simp only [Finset.sum_empty] + filter_upwards [Lp.coeFn_zero ℝ 2 (volume.restrict Ω)] with x hx + exact hx + | @insert i s hi ih => + simp only [Finset.sum_insert hi] + filter_upwards [Lp.coeFn_add (f i) (∑ j ∈ s, f j), ih] with x hx hy + simp only [Pi.add_apply] at hx + exact hx.trans (congrArg (fun t => f i x+t) hy) + +def jetEntry (Ω : Set X) (i j : Fin 3) : JetH Ω →L[ℝ] ScalarL2 Ω := + ((EuclideanSpace.proj i).compLpL 2 (volume.restrict Ω)).comp + (PiLp.proj 2 (fun _ : Option (Fin 3) => Lp V 2 (volume.restrict Ω)) (some j)) + +def jetDiv (Ω : Set X) : JetH Ω →L[ℝ] ScalarL2 Ω := ∑ i, jetEntry Ω i i + +def jetStrain (Ω : Set X) (i j : Fin 3) : JetH Ω →L[ℝ] ScalarL2 Ω := + (1/2 : ℝ) • (jetEntry Ω i j + jetEntry Ω j i) + +lemma jetEntry_ae (u : JetH Ω) (i j : Fin 3) : + jetEntry Ω i j u =ᵐ[volume.restrict Ω] fun x => (u (some j) x) i := + ContinuousLinearMap.coeFn_compLpL _ _ + +lemma jetDiv_ae (u : JetH Ω) : + jetDiv Ω u =ᵐ[volume.restrict Ω] fun x => ∑ i, (u (some i) x) i := by + have hs := lp_sum_ae Finset.univ (fun i => jetEntry Ω i i u) + have he : ∀ᵐ x ∂(volume.restrict Ω), ∀ i, jetEntry Ω i i u x = (u (some i) x) i := + Filter.eventually_all.mpr (fun i => jetEntry_ae u i i) + filter_upwards [hs,he] with x hx hy + change (∑ i, jetEntry Ω i i) u x = _ + simpa only [sum_apply,hy] using hx + +lemma jetStrain_ae (u : JetH Ω) (i j : Fin 3) : + jetStrain Ω i j u =ᵐ[volume.restrict Ω] + fun x => ((u (some j) x) i+(u (some i) x) j)/2 := by + filter_upwards [Lp.coeFn_smul (1/2 : ℝ) (jetEntry Ω i j u+jetEntry Ω j i u), + Lp.coeFn_add (jetEntry Ω i j u) (jetEntry Ω j i u), + jetEntry_ae u i j, jetEntry_ae u j i] with x hs ha hi hj + change ((1/2 : ℝ) • (jetEntry Ω i j u+jetEntry Ω j i u)) x = _ + rw [hs] + simp only [Pi.smul_apply,smul_eq_mul] + rw [ha] + simp only [Pi.add_apply,hi,hj] + ring + +def jetEnergy {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) : JetH Ω →L[ℝ] JetH Ω →L[ℝ] ℝ := + (innerSL ℝ).bilinearComp (hl.mulL.comp (jetDiv Ω)) (jetDiv Ω) + + (2 : ℝ) • ∑ i, ∑ j, (innerSL ℝ).bilinearComp + (hm.mulL.comp (jetStrain Ω i j)) (jetStrain Ω i j) + +lemma jetEnergy_apply {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v : JetH Ω) : + jetEnergy hl hm u v = inner ℝ (hl.mulL (jetDiv Ω u)) (jetDiv Ω v) + + 2 * ∑ i, ∑ j, inner ℝ (hm.mulL (jetStrain Ω i j u)) (jetStrain Ω i j v) := by + simp [jetEnergy,sum_apply,ContinuousLinearMap.bilinearComp_apply, + innerSL_apply_apply] + +end Elasticity + +end +end +section +/-! Actual Korn and supported Poincaré identities, needed for variational +wellposedness of the physical DN map. No coercivity is assumed. -/ +noncomputable section +open MeasureTheory SchwartzMap +open scoped BigOperators LineDeriv SchwartzMap +namespace ElasticityKorn +abbrev X := EuclideanSpace ℝ (Fin 3) +abbrev S := SchwartzMap X ℝ +abbrev L2 : S →L[ℝ] Lp ℝ 2 (volume : Measure X) := SchwartzMap.toLpCLM ℝ ℝ 2 volume + +def norm2 (f : S) := ‖L2 f‖ +def pair (f g : S) : ℝ := inner ℝ (L2 f) (L2 g) +def e (i : Fin 3) : X := EuclideanSpace.single i 1 +def d (v : X) : S →ₗ[ℝ] S := (LineDeriv.lineDerivOpCLM ℝ S v).toLinearMap +@[simp] lemma d_apply (v : X) (f : S) (x : X) : + d v f x = fderiv ℝ (f : X → ℝ) x v := rfl +lemma smooth (f : S) : ContDiff ℝ (⊤ : ℕ∞) (f : X → ℝ) := f.smooth _ +lemma pair_integral (f g : S) : pair f g = ∫ x : X, f x * g x := by + rw [pair, MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [f.coeFn_toLp 2 volume, g.coeFn_toLp 2 volume] with x hx hy + change inner ℝ (f.toLp 2 volume x) (g.toLp 2 volume x) = _ + rw [hx, hy] + exact real_inner_comm _ _ + +lemma pair_self (f : S) : pair f f = norm2 f ^ 2 := real_inner_self_eq_norm_sq _ +lemma pair_symm (f g : S) : pair f g = pair g f := real_inner_comm _ _ +lemma pair_add_left (f g h : S) : pair (f+g) h = pair f h + pair g h := by + simp only [pair, map_add, inner_add_left] +lemma pair_add_right (f g h : S) : pair f (g+h) = pair f g + pair f h := by + simp only [pair, map_add, inner_add_right] +lemma pair_smul_left (c : ℝ) (f g : S) : pair (c • f) g = c * pair f g := by + simp only [pair, map_smul, real_inner_smul_left] +lemma pair_smul_right (c : ℝ) (f g : S) : pair f (c • g) = c * pair f g := by + simp only [pair, map_smul, real_inner_smul_right] +lemma pair_sum_left {ι : Type*} (s : Finset ι) (f : ι → S) (g : S) : + pair (∑ i ∈ s, f i) g = ∑ i ∈ s, pair (f i) g := by + simp only [pair, map_sum, sum_inner] +lemma pair_sum_right {ι : Type*} (s : Finset ι) (f : S) (g : ι → S) : + pair f (∑ i ∈ s, g i) = ∑ i ∈ s, pair f (g i) := by + simp only [pair, map_sum, inner_sum] +lemma pair_bound (f g : S) : |pair f g| ≤ norm2 f * norm2 g := abs_real_inner_le_norm _ _ +lemma integrable_pair (f g : S) : Integrable (fun x : X => f x*g x) := + (SchwartzMap.pairing (ContinuousLinearMap.mul ℝ ℝ) f g).integrable +lemma pair_d (f g : S) (v : X) : pair f (d v g) = -pair (d v f) g := by + simp only [pair_integral] + exact integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + (integrable_pair (d v f) g) (integrable_pair f (d v g)) (integrable_pair f g) + (fun x _ => (smooth f).differentiable (by simp) x) + (fun x _ => (smooth g).differentiable (by simp) x) +lemma d_d (v w : X) (f : S) (x : X) : + d v (d w f) x = fderiv ℝ (fderiv ℝ (f : X → ℝ)) x v w := by + have hd : Differentiable ℝ (fderiv ℝ (f : X → ℝ)) := + ((smooth f).fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) + change fderiv ℝ (fun y => fderiv ℝ (f : X → ℝ) y w) x v = _ + rw [fderiv_clm_apply (hd x) (differentiableAt_const w)] + simp +lemma d_comm (v w : X) (f : S) : d v (d w f) = d w (d v f) := by + ext x + rw [d_d, d_d] + exact (smooth f).contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) _ _ +lemma cross (v w : X) (f g : S) : pair (d v f) (d w g) = pair (d w f) (d v g) := by + have h := pair_d (d v f) g w + have h' := pair_d (d w f) g v + rw [d_comm] at h + exact h.trans h'.symm + +def divergence (u : Fin 3 → S) : S := ∑ i, d (e i) (u i) +def gradEnergy (u : Fin 3 → S) : ℝ := ∑ i, ∑ j, norm2 (d (e i) (u j)) ^ 2 +def strainEnergy (u : Fin 3 → S) : ℝ := + ∑ i, ∑ j, norm2 ((1/2 : ℝ) • (d (e i) (u j) + d (e j) (u i))) ^ 2 +lemma norm2_half_add_sq (f g : S) : + norm2 ((1/2 : ℝ) • (f+g)) ^ 2 = (norm2 f ^ 2 + 2*pair f g + norm2 g ^ 2)/4 := by + rw [← pair_self, pair_smul_left, pair_smul_right, pair_add_left, + pair_add_right, pair_add_right, pair_self, pair_self, pair_symm g f] + ring +lemma cross_sum (u : Fin 3 → S) : + (∑ i, ∑ j, pair (d (e i) (u j)) (d (e j) (u i))) = norm2 (divergence u) ^ 2 := by + rw [← pair_self, divergence, pair_sum_left] + simp_rw [pair_sum_right] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [cross] + exact pair_symm _ _ +/-- The classical exact whole-space Korn identity, by two integrations by parts. -/ +theorem korn_identity (u : Fin 3 → S) : + 2*strainEnergy u = gradEnergy u + norm2 (divergence u)^2 := by + simp only [strainEnergy, norm2_half_add_sq, add_div, mul_div_assoc] + simp_rw [Finset.sum_add_distrib, ← Finset.sum_div, ← Finset.mul_sum] + have hs : (∑ i, ∑ j, norm2 (d (e j) (u i))^2) = gradEnergy u := Finset.sum_comm + simp_rw [← Finset.sum_div] + rw [hs, cross_sum u] + change 2*((gradEnergy u/4 + 2*(norm2 (divergence u)^2/4)) + gradEnergy u/4) = _ + ring + +theorem korn (u : Fin 3 → S) : gradEnergy u ≤ 2*strainEnergy u := by + rw [korn_identity] + exact le_add_of_nonneg_right (sq_nonneg _) + +def qCLM : X →L[ℝ] ℝ := EuclideanSpace.proj 0 +def Q : S →ₗ[ℝ] S := (SchwartzMap.smulLeftCLM ℝ qCLM).toLinearMap +@[simp] lemma Q_apply (f : S) (x : X) : Q f x = x 0 * f x := + SchwartzMap.smulLeftCLM_apply_apply qCLM.hasTemperateGrowth f x +lemma d_Q (f : S) : d (e 0) (Q f) = f + Q (d (e 0) f) := by + ext x + rw [d_apply] + have hc : (Q f : X → ℝ) = fun x => x 0 * f x := by ext x; exact Q_apply f x + rw [hc] + change _ = f x + Q (d (e 0) f) x + rw [Q_apply, d_apply] + have h := congrArg (fun L : X →L[ℝ] ℝ => L (e 0)) + (((EuclideanSpace.proj (𝕜 := ℝ) 0).hasFDerivAt (x := x)).mul + ((smooth f).differentiable (by simp) x).hasFDerivAt).fderiv + simpa [e, add_comm, Pi.mul_def] using h +lemma pair_Q (f g : S) : pair f (Q g) = pair (Q f) g := by + simp only [pair_integral, Q_apply] + congr 1 + ext x + ring +lemma norm2_Q_supported {R : ℝ} (f : S) (hf : ∀ x, f x ≠ 0 → |x 0| ≤ R) : + norm2 (Q f) ≤ R*norm2 f := by + apply Lp.norm_le_mul_norm_of_ae_le_mul + filter_upwards [(Q f).coeFn_toLp 2 volume, f.coeFn_toLp 2 volume] with x hx hy + change ‖(Q f).toLp 2 volume x‖ ≤ R*‖f.toLp 2 volume x‖ + rw [hx, hy, Q_apply, norm_mul, Real.norm_eq_abs] + by_cases hz : f x=0 + · simp [hz] + · exact mul_le_mul_of_nonneg_right (hf x hz) (norm_nonneg _) +/-- Supported Poincaré with explicit constant; support is imposed on the actual +function, not on an abstract or assumed Sobolev norm. -/ +theorem poincare {R : ℝ} (f : S) (hf : ∀ x, f x ≠ 0 → |x 0| ≤ R) : + norm2 f ≤ 2*R*norm2 (d (e 0) f) := by + have he := pair_d (Q f) f (e 0) + rw [d_Q, pair_add_left, pair_self, pair_symm (Q (d (e 0) f)) f, pair_Q] at he + have ht := pair_bound (Q f) (d (e 0) f) + have hq := norm2_Q_supported f hf + have hnn : 0 ≤ norm2 (d (e 0) f) := norm_nonneg _ + have hn : 0 ≤ norm2 f := norm_nonneg _ + have hmul := mul_le_mul_of_nonneg_right hq hnn + by_cases hzero : norm2 f = 0 + · rw [hzero] + by_cases hR : 0 ≤ R + · positivity + · have hz : f=0 := by + apply SchwartzMap.injective_toLp 2 volume + change L2 f = L2 0 + rw [map_zero] + exact norm_eq_zero.mp hzero + rw [hz, map_zero] + change 0 ≤ 2*R*‖L2 0‖ + rw [map_zero, norm_zero, mul_zero] + · have hp : 0 < norm2 f := lt_of_le_of_ne hn (Ne.symm hzero) + have ha := neg_le_abs (pair (Q f) (d (e 0) f)) + nlinarith + +end ElasticityKorn + +end +end +section +noncomputable section +open MeasureTheory SchwartzMap Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} + +instance temperate_restrict_volume (Ω : Set X) : (volume.restrict Ω).HasTemperateGrowth := + ⟨⟨volume.integrablePower, + (Measure.integrable_pow_neg_integrablePower (volume : Measure X)).mono_measure + Measure.restrict_le_self⟩⟩ + +abbrev schwartzR (Ω : Set X) : SchwartzMap X ℝ →L[ℝ] ScalarL2 Ω := + SchwartzMap.toLpCLM ℝ ℝ 2 (volume.restrict Ω) + +lemma schwartzR_norm_sq (f : SchwartzMap X ℝ) : + ‖schwartzR Ω f‖^2 = ∫ x, (f x)^2 ∂(volume.restrict Ω) := by + rw [← real_inner_self_eq_norm_sq,MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [f.coeFn_toLp 2 (volume.restrict Ω)] with x hx + change inner ℝ (f.toLp 2 (volume.restrict Ω) x) (f.toLp 2 (volume.restrict Ω) x) = _ + rw [hx,real_inner_comm] + exact (sq _).symm + +lemma schwartzR_supported_norm (f : SchwartzMap X ℝ) (hf : tsupport (f : X → ℝ) ⊆ Ω) : + ‖schwartzR Ω f‖ = ElasticityKorn.norm2 f := by + have hsq : ‖schwartzR Ω f‖^2 = ElasticityKorn.norm2 f^2 := by + rw [schwartzR_norm_sq,← ElasticityKorn.pair_self,ElasticityKorn.pair_integral] + simp only [← sq] + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro x hx + have hz : f x=0 := image_eq_zero_of_notMem_tsupport (fun ht => hx (hf ht)) + simp [hz] + have hnon : 0 ≤ ElasticityKorn.norm2 f := norm_nonneg _ + nlinarith [norm_nonneg (schwartzR Ω f)] + +def jetScalar (Ω : Set X) (k : Option (Fin 3)) (i : Fin 3) : + JetH Ω →L[ℝ] ScalarL2 Ω := + ((EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω)).comp + (PiLp.proj 2 (fun _ : Option (Fin 3) => Lp V 2 (volume.restrict Ω)) k) + +lemma jetScalar_ae (u : JetH Ω) (k : Option (Fin 3)) (i : Fin 3) : + jetScalar Ω k i u =ᵐ[volume.restrict Ω] fun x => (u k x) i := + ContinuousLinearMap.coeFn_compLpL _ _ + +lemma scalar_projection_norm_sq (u : Lp V 2 (volume.restrict Ω)) : + ‖u‖^2 = ∑ i, ‖(EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) u‖^2 := by + let F (i : Fin 3) : ScalarL2 Ω := (EuclideanSpace.proj (𝕜 := ℝ) i).compLpL 2 (volume.restrict Ω) u + have hmeas (i : Fin 3) : Integrable (fun x => (F i x)^2) (volume.restrict Ω) := by + simpa only [real_inner_self_eq_norm_sq, Real.norm_eq_abs, sq_abs] using (L2.integrable_inner (𝕜 := ℝ) (F i) (F i)) + have hnorm (i : Fin 3) : ‖F i‖^2 = ∫ x, (F i x)^2 ∂(volume.restrict Ω) := by + rw [← real_inner_self_eq_norm_sq, L2.inner_def] + simp only [real_inner_self_eq_norm_sq, Real.norm_eq_abs, sq_abs] + change ‖u‖^2 = ∑ i, ‖F i‖^2 + simp_rw [hnorm] + rw [← integral_finsetSum Finset.univ (fun i _ => hmeas i),← real_inner_self_eq_norm_sq, + L2.inner_def] + have he : ∀ᵐ x ∂(volume.restrict Ω), ∀ i, F i x=(u x) i := + Filter.eventually_all.mpr (fun i => ContinuousLinearMap.coeFn_compLpL _ u) + apply integral_congr_ae + filter_upwards [he] with x hx + simp only [hx,real_inner_self_eq_norm_sq,EuclideanSpace.real_norm_sq_eq] + +def jetValueSq (Ω : Set X) (u : JetH Ω) : ℝ := ∑ i, ‖jetScalar Ω none i u‖^2 +def jetGradSq (Ω : Set X) (u : JetH Ω) : ℝ := ∑ i, ∑ j, ‖jetEntry Ω i j u‖^2 +def jetStrainSq (Ω : Set X) (u : JetH Ω) : ℝ := ∑ i, ∑ j, ‖jetStrain Ω i j u‖^2 + +lemma jet_norm_sq (u : JetH Ω) : ‖u‖^2 = jetValueSq Ω u+jetGradSq Ω u := by + rw [PiLp.norm_sq_eq_of_L2,Fintype.sum_option] + simp_rw [scalar_projection_norm_sq] + change jetValueSq Ω u+ (∑ j, ∑ i, ‖jetEntry Ω i j u‖^2) = _ + rw [Finset.sum_comm] + rfl + +lemma continuous_jetValueSq : Continuous (jetValueSq Ω) := by + unfold jetValueSq + fun_prop +lemma continuous_jetGradSq : Continuous (jetGradSq Ω) := by + unfold jetGradSq + fun_prop +lemma continuous_jetStrainSq : Continuous (jetStrainSq Ω) := by + unfold jetStrainSq + fun_prop + +/-- The scalar derivatives of an actual vector-valued smooth test field. -/ +lemma coordDeriv_scalar (f : X → V) (hf : ContDiff ℝ (⊤ : ℕ∞) f) + (i j : Fin 3) (x : X) : + fderiv ℝ (fun y => (f y) i) x (coordVector j) = (coordDeriv f j x) i := by + have h := ((EuclideanSpace.proj (𝕜 := ℝ) i).hasFDerivAt (x := f x)).comp x + ((hf.differentiable (by simp) x).hasFDerivAt) + change fderiv ℝ ((EuclideanSpace.proj (𝕜 := ℝ) i) ∘ f) x (coordVector j) = _ + rw [h.fderiv] + rfl + +lemma scalar_test_support (f : X → V) (i : Fin 3) : + tsupport (fun x => (f x) i) ⊆ tsupport f := + tsupport_comp_subset (g := fun y : V => y i) rfl f + +lemma jet_test_representation (u : JetH Ω) (hu : jetEquiv Ω u ∈ TestJets Ω) : + ∃ F : Fin 3 → SchwartzMap X ℝ, + (∀ i, tsupport (F i : X → ℝ) ⊆ Ω) ∧ + (∀ i, jetScalar Ω none i u = schwartzR Ω (F i)) ∧ + ∀ i j, jetEntry Ω i j u = schwartzR Ω (ElasticityKorn.d (ElasticityKorn.e j) (F i)) := by + obtain ⟨f,hf,hd,hs,hc,hsub,hu,hud⟩ := hu + let F (i : Fin 3) : SchwartzMap X ℝ := + ((hc.comp_left (g := fun y : V => y i) rfl)).toSchwartzMap + ((EuclideanSpace.proj (𝕜 := ℝ) i).contDiff.comp hs) + have hF (i) (x : X) : F i x=(f x) i := rfl + refine ⟨F,fun i => (scalar_test_support f i).trans hsub,?_,?_⟩ + · intro i + apply Lp.ext + have hv : (u none : X → V) =ᵐ[volume.restrict Ω] f := by + change (jetEquiv Ω u).1 =ᵐ[volume.restrict Ω] f + rw [hu] + exact hf.coeFn_toLp + filter_upwards [jetScalar_ae u none i,hv,(F i).coeFn_toLp 2 (volume.restrict Ω)] with x hx hy hz + exact hx.trans ((congrArg (fun y : V => y i) hy).trans hz.symm) + · intro i j + apply Lp.ext + have hv : (u (some j) : X → V) =ᵐ[volume.restrict Ω] coordDeriv f j := by + change (jetEquiv Ω u).2 j =ᵐ[volume.restrict Ω] coordDeriv f j + rw [hud] + exact (hd j).coeFn_toLp + filter_upwards [jetEntry_ae u i j,hv, + (ElasticityKorn.d (ElasticityKorn.e j) (F i)).coeFn_toLp 2 (volume.restrict Ω)] with x hx hy hz + change jetEntry Ω i j u x = (ElasticityKorn.d (ElasticityKorn.e j) (F i)).toLp 2 (volume.restrict Ω) x + rw [hz,ElasticityKorn.d_apply] + change jetEntry Ω i j u x = fderiv ℝ (fun y => (f y) i) x (coordVector j) + rw [coordDeriv_scalar f hs i j x,hx,hy] + +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory SchwartzMap Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} + +lemma schwartz_d_support (f : SchwartzMap X ℝ) (v : X) : + tsupport (ElasticityKorn.d v f : X → ℝ) ⊆ tsupport (f : X → ℝ) := + tsupport_fderiv_apply_subset ℝ v + +lemma schwartz_strain_support (f g : SchwartzMap X ℝ) (v w : X) + (hf : tsupport (f : X → ℝ) ⊆ Ω) (hg : tsupport (g : X → ℝ) ⊆ Ω) : + tsupport (((1/2 : ℝ) • (ElasticityKorn.d v f+ElasticityKorn.d w g)) : X → ℝ) ⊆ Ω := by + exact (tsupport_smul_subset_right (fun _ : X => (1/2 : ℝ)) _).trans + ((tsupport_add _ _).trans (union_subset ((schwartz_d_support f v).trans hf) + ((schwartz_d_support g w).trans hg))) + +lemma jet_test_energies (u : JetH Ω) (hu : jetEquiv Ω u ∈ TestJets Ω) : + ∃ F : Fin 3 → SchwartzMap X ℝ, + (∀ i, tsupport (F i : X → ℝ) ⊆ Ω) ∧ + jetValueSq Ω u = ∑ i, ElasticityKorn.norm2 (F i)^2 ∧ + jetGradSq Ω u = ElasticityKorn.gradEnergy F ∧ + jetStrainSq Ω u = ElasticityKorn.strainEnergy F := by + obtain ⟨F,hF,hval,hgrad⟩ := jet_test_representation u hu + refine ⟨F,hF,?_,?_,?_⟩ + · unfold jetValueSq + simp_rw [hval] + congr 1 + funext i + rw [schwartzR_supported_norm _ (hF i)] + · unfold jetGradSq ElasticityKorn.gradEnergy + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [hgrad,schwartzR_supported_norm _ ((schwartz_d_support _ _).trans (hF j))] + · unfold jetStrainSq ElasticityKorn.strainEnergy + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + change ‖(1/2 : ℝ) • (jetEntry Ω i j u+jetEntry Ω j i u)‖^2 = _ + rw [hgrad,hgrad,← map_add,← map_smul] + rw [schwartzR_supported_norm _ (schwartz_strain_support _ _ _ _ (hF i) (hF j)),add_comm] + +lemma test_korn (u : JetH Ω) (hu : jetEquiv Ω u ∈ TestJets Ω) : + jetGradSq Ω u ≤ 2*jetStrainSq Ω u := by + obtain ⟨F,_,_,hg,hs⟩ := jet_test_energies u hu + rw [hg,hs] + exact ElasticityKorn.korn F + +lemma test_poincare {R : ℝ} (hR : 0 < R) (hbound : ∀ x ∈ Ω, |x 0| ≤ R) + (u : JetH Ω) (hu : jetEquiv Ω u ∈ TestJets Ω) : + jetValueSq Ω u ≤ 4*R^2*jetGradSq Ω u := by + obtain ⟨F,hF,hv,hg,_⟩ := jet_test_energies u hu + rw [hv,hg,ElasticityKorn.gradEnergy,Finset.sum_comm,Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + have hp := ElasticityKorn.poincare (F i) (fun x hx => + hbound x (hF i (subset_tsupport _ hx))) + have hsq : ElasticityKorn.norm2 (F i)^2 ≤ + 4*R^2*ElasticityKorn.norm2 (ElasticityKorn.d (ElasticityKorn.e 0) (F i))^2 := by + have := sq_le_sq₀ (norm_nonneg (ElasticityKorn.L2 (F i))) + (show 0 ≤ 2*R*ElasticityKorn.norm2 (ElasticityKorn.d (ElasticityKorn.e 0) (F i)) by + exact mul_nonneg (by positivity) (norm_nonneg _)) + have ht : ElasticityKorn.norm2 (F i)^2 ≤ + (2*R*ElasticityKorn.norm2 (ElasticityKorn.d (ElasticityKorn.e 0) (F i)))^2 := this.mpr hp + nlinarith [ht] + refine hsq.trans (mul_le_mul_of_nonneg_left ?_ (by positivity)) + exact Finset.single_le_sum + (fun j _ => sq_nonneg (ElasticityKorn.norm2 (ElasticityKorn.d (ElasticityKorn.e j) (F i)))) + (Finset.mem_univ (0 : Fin 3)) + +lemma h10_induction_closed {P : JetH Ω → Prop} (hP : IsClosed {u | P u}) + (htest : ∀ u, jetEquiv Ω u ∈ TestJets Ω → P u) + (u : H10Hilbert Ω) : P u := by + have hclosed : IsClosed {v : Ambient Ω | P ((jetEquiv Ω).symm v)} := + hP.preimage (jetEquiv Ω).symm.continuous + have hsubset : closure (TestJets Ω) ⊆ {v : Ambient Ω | P ((jetEquiv Ω).symm v)} := + closure_minimal (fun v hv => htest _ (by simpa using hv)) hclosed + have h := hsubset u.property + change P ((jetEquiv Ω).symm (jetEquiv Ω u.val)) at h + simpa only [ContinuousLinearEquiv.symm_apply_apply] using h + +lemma h10_korn (u : H10Hilbert Ω) : jetGradSq Ω u ≤ 2*jetStrainSq Ω u := by + apply h10_induction_closed + (isClosed_le continuous_jetGradSq (continuous_const.mul continuous_jetStrainSq)) + test_korn u + +lemma h10_poincare {R : ℝ} (hR : 0 < R) (hbound : ∀ x ∈ Ω, |x 0| ≤ R) + (u : H10Hilbert Ω) : jetValueSq Ω u ≤ 4*R^2*jetGradSq Ω u := by + apply h10_induction_closed + (isClosed_le continuous_jetValueSq (continuous_const.mul continuous_jetGradSq)) + (test_poincare hR hbound) u + +lemma h10_norm_strain (hB : Bornology.IsBounded Ω) : + ∃ C : ℝ, 0 < C ∧ ∀ u : H10Hilbert Ω, ‖u‖^2 ≤ C*jetStrainSq Ω u := by + obtain ⟨R,hR,hbound⟩ := hB.exists_pos_norm_le + have hb (x : X) (hx : x ∈ Ω) : |x 0| ≤ R := by + have hn : |x 0| ≤ ‖x‖ := by + simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le x 0 + exact hn.trans (hbound x hx) + refine ⟨2*(4*R^2+1),by positivity,?_⟩ + intro u + have hp := h10_poincare hR hb u + have hk := h10_korn u + have he := jet_norm_sq u.val + have hh : 0 ≤ 4*R^2+1 := by positivity + have := mul_le_mul_of_nonneg_left hk hh + change ‖u.val‖^2 ≤ _ + nlinarith + +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity + +variable {Ω : Set X} + +lemma SmoothUpTo.continuousOn_closure {a : X → ℝ} (ha : SmoothUpTo Ω a) : + ContinuousOn a (closure Ω) := by + obtain ⟨U,_,hs,hf⟩ := ha + exact hf.continuousOn.mono hs + +lemma SmoothUpTo.boundedCoefficient {a : X → ℝ} (ha : SmoothUpTo Ω a) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) : BoundedCoefficient Ω a := by + have hc := ha.continuousOn_closure + refine ⟨(hc.mono subset_closure).aestronglyMeasurable hO.measurableSet, ?_⟩ + obtain ⟨C,hC⟩ := hB.isCompact_closure.bddAbove_image hc.norm + refine ⟨C, ?_⟩ + filter_upwards [self_mem_ae_restrict hO.measurableSet] with x hx + exact hC ⟨x,subset_closure hx,rfl⟩ + +lemma Admissible.uniform_positive {lam mu : X → ℝ} (ha : Admissible Ω lam mu) + (hB : Bornology.IsBounded Ω) : + ∃ c : ℝ, 0 < c ∧ ∀ x ∈ closure Ω, c ≤ mu x ∧ c ≤ 3*lam x+2*mu x := by + have hl := ha.1.continuousOn_closure + have hm := ha.2.1.continuousOn_closure + have hp : ContinuousOn (fun x => min (mu x) (3*lam x+2*mu x)) (closure Ω) := + hm.inf ((hl.const_mul 3).add (hm.const_mul 2)) + obtain ⟨c,hc,hbound⟩ := hB.isCompact_closure.exists_forall_le' hp + (fun x hx => lt_min (ha.2.2 x hx).1 (ha.2.2 x hx).2) + exact ⟨c,hc,fun x hx => le_min_iff.mp (hbound x hx)⟩ + +lemma trace_sq_le (A : Fin 3 → Fin 3 → ℝ) : + (∑ i, A i i)^2 ≤ 3*∑ i, ∑ j, A i j^2 := by + have ht : (∑ i, A i i)^2 ≤ 3*∑ i, A i i^2 := by + simpa using (sq_sum_le_card_mul_sum_sq (s := Finset.univ) (f := fun i => A i i)) + refine ht.trans (mul_le_mul_of_nonneg_left ?_ (by norm_num)) + apply Finset.sum_le_sum + intro i _ + exact Finset.single_le_sum (fun j _ => sq_nonneg (A i j)) (Finset.mem_univ i) + +/-- Pointwise strong convexity controls the full physical symmetric strain, +including negative lambda. This uses the exact hypothesis 3λ+2μ>0. -/ +lemma elasticity_density_lower (lam mu c : ℝ) (hc : 0 ≤ c) (hm : c ≤ mu) + (hlm : c ≤ 3*lam+2*mu) (A : Fin 3 → Fin 3 → ℝ) : + c*(∑ i, ∑ j, A i j^2) ≤ lam*(∑ i, A i i)^2+2*mu*(∑ i, ∑ j, A i j^2) := by + have hA : 0 ≤ ∑ i, ∑ j, A i j^2 := + Finset.sum_nonneg (fun i _ => Finset.sum_nonneg (fun j _ => sq_nonneg (A i j))) + by_cases hl : 0 ≤ lam + · have h1 := mul_nonneg hl (sq_nonneg (∑ i, A i i)) + have h2 := mul_le_mul_of_nonneg_right hm hA + have h3 := mul_nonneg (hc.trans hm) hA + nlinarith + · have ht := mul_le_mul_of_nonpos_left (trace_sq_le A) (le_of_not_ge hl) + have hk := mul_le_mul_of_nonneg_right hlm hA + nlinarith + +lemma weighted_integrable {a : X → ℝ} (ha : BoundedCoefficient Ω a) + (f g : ScalarL2 Ω) : Integrable (fun x => a x*f x*g x) (volume.restrict Ω) := by + simpa only [Pi.mul_def] using (ha.mul_memLp f).integrable_mul (Lp.memLp g) + +lemma jetEnergy_integral {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v : JetH Ω) : + jetEnergy hl hm u v = ∫ x, lam x*jetDiv Ω u x*jetDiv Ω v x+ + 2*mu x*∑ i, ∑ j, jetStrain Ω i j u x*jetStrain Ω i j v x ∂(volume.restrict Ω) := by + have hL := weighted_integrable hl (jetDiv Ω u) (jetDiv Ω v) + have hS (i j) := weighted_integrable hm (jetStrain Ω i j u) (jetStrain Ω i j v) + rw [jetEnergy_apply,BoundedCoefficient.inner_mulL] + simp_rw [BoundedCoefficient.inner_mulL] + have hsum : Integrable (fun x => ∑ i, ∑ j, + mu x*jetStrain Ω i j u x*jetStrain Ω i j v x) (volume.restrict Ω) := + integrable_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => hS i j)) + calc + _ = (∫ x, lam x*jetDiv Ω u x*jetDiv Ω v x ∂(volume.restrict Ω))+ + 2*(∫ x, ∑ i, ∑ j, mu x*jetStrain Ω i j u x*jetStrain Ω i j v x + ∂(volume.restrict Ω)) := by + rw [integral_finsetSum _ (fun i _ => + integrable_finsetSum _ (fun j _ => hS i j))] + simp_rw [integral_finsetSum _ (fun j _ => hS _ j)] + _ = ∫ x, lam x*jetDiv Ω u x*jetDiv Ω v x+ + 2*(∑ i, ∑ j, mu x*jetStrain Ω i j u x*jetStrain Ω i j v x) + ∂(volume.restrict Ω) := by + rw [integral_add hL (hsum.const_mul 2),integral_const_mul] + _ = _ := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun x => by + simp only [Finset.mul_sum,mul_assoc]) + +lemma jetEnergy_eq_energy {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) + (hm : BoundedCoefficient Ω mu) (u v : H1Hilbert Ω) : + jetEnergy hl hm u v = energy Ω lam mu (h1Equiv Ω u) (h1Equiv Ω v) := by + rw [jetEnergy_integral,energy] + apply integral_congr_ae + have hsu : ∀ᵐ x ∂(volume.restrict Ω), ∀ i j, + jetStrain Ω i j u.val x=((u.val (some j) x) i+(u.val (some i) x) j)/2 := + Filter.eventually_all.mpr (fun i => Filter.eventually_all.mpr (fun j => jetStrain_ae u.val i j)) + have hsv : ∀ᵐ x ∂(volume.restrict Ω), ∀ i j, + jetStrain Ω i j v.val x=((v.val (some j) x) i+(v.val (some i) x) j)/2 := + Filter.eventually_all.mpr (fun i => Filter.eventually_all.mpr (fun j => jetStrain_ae v.val i j)) + filter_upwards [jetDiv_ae u.val,jetDiv_ae v.val,hsu,hsv] with x hu hv hsu hsv + simp only [hu,hv,hsu,hsv,div,strain,h1Equiv,Equiv.coe_fn_mk,jetEquiv_apply] + +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} {lam mu : X → ℝ} + +lemma scalarL2_norm_sq (f : ScalarL2 Ω) : + ‖f‖^2 = ∫ x, (f x)^2 ∂(volume.restrict Ω) := by + rw [← real_inner_self_eq_norm_sq,L2.inner_def] + simp only [real_inner_self_eq_norm_sq,Real.norm_eq_abs,sq_abs] + +lemma scalarL2_integrable_sq (f : ScalarL2 Ω) : + Integrable (fun x => (f x)^2) (volume.restrict Ω) := by + simpa only [real_inner_self_eq_norm_sq,Real.norm_eq_abs,sq_abs] using + L2.integrable_inner (𝕜 := ℝ) f f + +lemma jetDiv_strain_ae (u : JetH Ω) : + jetDiv Ω u =ᵐ[volume.restrict Ω] fun x => ∑ i, jetStrain Ω i i u x := by + have hs : ∀ᵐ x ∂(volume.restrict Ω), ∀ i, + jetStrain Ω i i u x=((u (some i) x) i+(u (some i) x) i)/2 := + Filter.eventually_all.mpr (fun i => jetStrain_ae u i i) + filter_upwards [jetDiv_ae u,hs] with x hx hy + rw [hx] + apply Finset.sum_congr rfl + intro i _ + rw [hy] + ring + +lemma jetStrainSq_integral (u : JetH Ω) : + jetStrainSq Ω u = ∫ x, ∑ i, ∑ j, (jetStrain Ω i j u x)^2 ∂(volume.restrict Ω) := by + unfold jetStrainSq + simp_rw [scalarL2_norm_sq] + rw [integral_finsetSum _ (fun i _ => + integrable_finsetSum _ (fun j _ => scalarL2_integrable_sq _))] + simp_rw [integral_finsetSum _ (fun j _ => scalarL2_integrable_sq _)] + +lemma jetEnergy_lower (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (hO : IsOpen Ω) {c : ℝ} (hc : 0 ≤ c) + (hp : ∀ x ∈ Ω, c ≤ mu x ∧ c ≤ 3*lam x+2*mu x) (u : JetH Ω) : + c*jetStrainSq Ω u ≤ jetEnergy hl hm u u := by + rw [jetStrainSq_integral,jetEnergy_integral,← integral_const_mul] + have hS : Integrable (fun x => ∑ i, ∑ j, (jetStrain Ω i j u x)^2) + (volume.restrict Ω) := + integrable_finsetSum _ (fun i _ => + integrable_finsetSum _ (fun j _ => scalarL2_integrable_sq _)) + have hR : Integrable (fun x => lam x*jetDiv Ω u x*jetDiv Ω u x+ + 2*mu x*∑ i, ∑ j, jetStrain Ω i j u x*jetStrain Ω i j u x) + (volume.restrict Ω) := by + have hsum := (integrable_finsetSum Finset.univ (fun i _ => + integrable_finsetSum Finset.univ (fun j _ => + weighted_integrable hm (jetStrain Ω i j u) (jetStrain Ω i j u)))).const_mul 2 + convert (weighted_integrable hl (jetDiv Ω u) (jetDiv Ω u)).add hsum using 1 + ext point + simp only [Finset.mul_sum,mul_assoc,Pi.add_apply] + apply integral_mono_ae (hS.const_mul c) hR + filter_upwards [self_mem_ae_restrict hO.measurableSet,jetDiv_strain_ae u] with x hx hd + have h := elasticity_density_lower (lam x) (mu x) c hc (hp x hx).1 (hp x hx).2 + (fun i j => jetStrain Ω i j u x) + simpa only [hd,sq,mul_assoc] using h + +/-- The actual Dirichlet physical energy on the exact zero-trace Hilbert space. -/ +def zeroTraceEnergy (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) : + H10Hilbert Ω →L[ℝ] H10Hilbert Ω →L[ℝ] ℝ := + (jetEnergy hl hm).bilinearComp (H10Hilbert Ω).subtypeL (H10Hilbert Ω).subtypeL + +lemma zeroTraceEnergy_apply (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u v : H10Hilbert Ω) : zeroTraceEnergy hl hm u v = jetEnergy hl hm u.val v.val := rfl + +/-- Korn, supported Poincare and the exact strong convexity yield coercivity; +there is no sign restriction on lambda beyond 3 lambda + 2 mu > 0. -/ +theorem physical_coercive (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) : + IsCoercive (zeroTraceEnergy (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB)) := by + obtain ⟨c,hc,hp⟩ := ha.uniform_positive hB + obtain ⟨C,hC,hbound⟩ := h10_norm_strain hB + refine ⟨c/C,div_pos hc hC,?_⟩ + intro u + have hlower := jetEnergy_lower (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) hO hc.le (fun x hx => hp x (subset_closure hx)) u.val + have hn := mul_le_mul_of_nonneg_left (hbound u) (div_pos hc hC).le + rw [zeroTraceEnergy_apply] + have he : c/C*C=c := div_mul_cancel₀ c (ne_of_gt hC) + have hprod : c/C*‖u‖^2 ≤ c*jetStrainSq Ω u := by + simpa only [← mul_assoc,he] using hn + nlinarith + +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} {lam mu : X → ℝ} + +def traceSetoid (Ω : Set X) : Setoid (H1 Ω) where + r := SameTrace Ω + iseqv := ⟨sameTrace_refl Ω,fun h => sameTrace_symm Ω h,fun h h' => sameTrace_trans Ω h h'⟩ + +lemma trace_eq_iff (u v : H1 Ω) : trace Ω u = trace Ω v ↔ SameTrace Ω u v := by + exact ⟨fun h => Quotient.exact (s := traceSetoid Ω) h, Quot.sound⟩ + +lemma hasZeroTrace_h1Equiv (u : H1Hilbert Ω) : + HasZeroTrace Ω (h1Equiv Ω u) ↔ u.val ∈ H10Hilbert Ω := Iff.rfl + +lemma sameTrace_h1Equiv (u v : H1Hilbert Ω) : + SameTrace Ω (h1Equiv Ω u) (h1Equiv Ω v) ↔ u.val-v.val ∈ H10Hilbert Ω := by + change (jetEquiv Ω u.val-jetEquiv Ω v.val ∈ h10Submodule Ω) ↔ + jetEquiv Ω (u.val-v.val) ∈ h10Submodule Ω + rw [map_sub] + +lemma weakSolution_h1Equiv (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1Hilbert Ω) : WeakSolution Ω lam mu (h1Equiv Ω u) ↔ + ∀ v : H10Hilbert Ω, jetEnergy hl hm u.val v.val=0 := by + constructor + · intro h v + let v' : H1Hilbert Ω := ⟨v.val,H10Hilbert_le Ω v.property⟩ + exact (jetEnergy_eq_energy hl hm u v').trans (h _ v.property) + · intro h v hv + let v' := (h1Equiv Ω).symm v + have hz : v'.val ∈ H10Hilbert Ω := by + rw [← hasZeroTrace_h1Equiv] + simpa only [v',Equiv.apply_symm_apply] using hv + have he := jetEnergy_eq_energy hl hm u v' + simp only [v',Equiv.apply_symm_apply] at he + rw [← he] + exact h ⟨v'.val,hz⟩ + +/-- Lax--Milgram applied to the actual physical form and the exact jet +closures. The prescribed trace is arbitrary, not restricted to smooth data. -/ +theorem dirichlet_exists (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (f : BoundaryData Ω) : + ∃ u : H1 Ω, trace Ω u=f ∧ WeakSolution Ω lam mu u := by + let hl := ha.1.boundedCoefficient hO hB + let hm := ha.2.1.boundedCoefficient hO hB + let w := (h1Equiv Ω).symm f.out + let L : H10Hilbert Ω →L[ℝ] ℝ := -(jetEnergy hl hm w.val).comp (H10Hilbert Ω).subtypeL + let F := (InnerProductSpace.toDual ℝ (H10Hilbert Ω)).symm L + have hC : IsCoercive (zeroTraceEnergy hl hm) := physical_coercive ha hO hB + let z := hC.continuousLinearEquivOfBilin.symm F + have hz (v : H10Hilbert Ω) : jetEnergy hl hm z.val v.val = -jetEnergy hl hm w.val v.val := by + rw [← zeroTraceEnergy_apply,← hC.continuousLinearEquivOfBilin_apply] + change inner ℝ (hC.continuousLinearEquivOfBilin (hC.continuousLinearEquivOfBilin.symm F)) v = _ + rw [ContinuousLinearEquiv.apply_symm_apply] + exact InnerProductSpace.toDual_symm_apply + let u : H1Hilbert Ω := ⟨w.val+z.val, + (H1Hilbert Ω).add_mem w.property (H10Hilbert_le Ω z.property)⟩ + refine ⟨h1Equiv Ω u,?_,?_⟩ + · have ht : SameTrace Ω (h1Equiv Ω u) (h1Equiv Ω w) := by + apply (sameTrace_h1Equiv u w).mpr + change w.val+z.val-w.val ∈ H10Hilbert Ω + simpa only [add_sub_cancel_left] using z.property + calc + trace Ω (h1Equiv Ω u) = trace Ω (h1Equiv Ω w) := Quot.sound ht + _ = trace Ω f.out := by rw [Equiv.apply_symm_apply] + _ = f := Quot.out_eq f + · apply (weakSolution_h1Equiv hl hm u).mpr + intro v + change jetEnergy hl hm (w.val+z.val) v.val = 0 + rw [map_add,add_apply,hz] + exact add_neg_cancel _ + +theorem dirichletSolution_spec (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (f : BoundaryData Ω) : + trace Ω (dirichletSolution Ω lam mu f)=f ∧ + WeakSolution Ω lam mu (dirichletSolution Ω lam mu f) := by + have hex := dirichlet_exists ha hO hB f + simp only [dirichletSolution,dite_eq_left hex] + exact Classical.choose_spec hex + +theorem dirichlet_unique (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (u v : H1 Ω) + (hu : WeakSolution Ω lam mu u) (hv : WeakSolution Ω lam mu v) + (ht : trace Ω u=trace Ω v) : u=v := by + let hl := ha.1.boundedCoefficient hO hB + let hm := ha.2.1.boundedCoefficient hO hB + let u' := (h1Equiv Ω).symm u + let v' := (h1Equiv Ω).symm v + have htu : SameTrace Ω (h1Equiv Ω u') (h1Equiv Ω v') := by + simpa only [u',v',Equiv.apply_symm_apply] using (trace_eq_iff u v).mp ht + let z : H10Hilbert Ω := ⟨u'.val-v'.val,(sameTrace_h1Equiv u' v').mp htu⟩ + have hu' : ∀ w : H10Hilbert Ω, jetEnergy hl hm u'.val w.val=0 := + (weakSolution_h1Equiv hl hm u').mp (by simpa only [u',Equiv.apply_symm_apply] using hu) + have hv' : ∀ w : H10Hilbert Ω, jetEnergy hl hm v'.val w.val=0 := + (weakSolution_h1Equiv hl hm v').mp (by simpa only [v',Equiv.apply_symm_apply] using hv) + have hz : zeroTraceEnergy hl hm z z=0 := by + change jetEnergy hl hm (u'.val-v'.val) z.val=0 + rw [map_sub (jetEnergy hl hm) u'.val v'.val,sub_apply,hu',hv',sub_self] + obtain ⟨c,hc,hbound⟩ := physical_coercive ha hO hB + have hn : ‖z‖=0 := by + have hh := hbound z + rw [hz] at hh + have hs : ‖z‖*‖z‖ ≤ 0 := (mul_le_mul_iff_right₀ hc).mp (by nlinarith only [hh]) + nlinarith [norm_nonneg z] + have he : u'=v' := by + apply Subtype.ext + have hval := congrArg Subtype.val (norm_eq_zero.mp hn) + change u'.val-v'.val=0 at hval + exact sub_eq_zero.mp hval + exact (h1Equiv Ω).symm.injective he + +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} {lam mu : X → ℝ} + +lemma jetEnergy_symm (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u v : JetH Ω) : jetEnergy hl hm u v=jetEnergy hl hm v u := by + rw [jetEnergy_integral,jetEnergy_integral] + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun x => by + have hs : (∑ i, ∑ j, jetStrain Ω i j u x*jetStrain Ω i j v x)= + ∑ i, ∑ j, jetStrain Ω i j v x*jetStrain Ω i j u x := by + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + exact mul_comm _ _ + dsimp only + rw [hs] + ring) + +lemma energy_symm (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u v : H1 Ω) : energy Ω lam mu u v=energy Ω lam mu v u := by + have h := jetEnergy_symm hl hm ((h1Equiv Ω).symm u).val ((h1Equiv Ω).symm v).val + rwa [jetEnergy_eq_energy,jetEnergy_eq_energy,Equiv.apply_symm_apply, + Equiv.apply_symm_apply] at h + +lemma energy_eq_of_sameTrace (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + {u v w : H1 Ω} (hu : WeakSolution Ω lam mu u) (hvw : SameTrace Ω v w) : + energy Ω lam mu u v=energy Ω lam mu u w := by + let u' := (h1Equiv Ω).symm u + let v' := (h1Equiv Ω).symm v + let w' := (h1Equiv Ω).symm w + have ht : v'.val-w'.val ∈ H10Hilbert Ω := + (sameTrace_h1Equiv v' w').mp (by simpa only [v',w',Equiv.apply_symm_apply] using hvw) + have he := (weakSolution_h1Equiv hl hm u').mp (by + simpa only [u',Equiv.apply_symm_apply] using hu) ⟨v'.val-w'.val,ht⟩ + change jetEnergy hl hm u'.val (v'.val-w'.val)=0 at he + rw [map_sub] at he + have hv' := jetEnergy_eq_energy hl hm u' v' + have hw' := jetEnergy_eq_energy hl hm u' w' + simp only [u',v',w',Equiv.apply_symm_apply] at hv' hw' + rw [hv',hw'] at he + exact sub_eq_zero.mp he + +lemma DN_eq_energy (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) (f : BoundaryData Ω) (v : H1 Ω) : + DN Ω lam mu f (trace Ω v)=energy Ω lam mu (dirichletSolution Ω lam mu f) v := by + apply energy_eq_of_sameTrace (ha.1.boundedCoefficient hO hB) + (ha.2.1.boundedCoefficient hO hB) (dirichletSolution_spec ha hO hB f).2 + apply (trace_eq_iff _ _).mp + exact Quot.out_eq (trace Ω v) + +lemma solution_eq_dirichlet (ha : Admissible Ω lam mu) (hO : IsOpen Ω) + (hB : Bornology.IsBounded Ω) {u : H1 Ω} (hu : WeakSolution Ω lam mu u) : + u=dirichletSolution Ω lam mu (trace Ω u) := + dirichlet_unique ha hO hB _ _ hu (dirichletSolution_spec ha hO hB _).2 + (dirichletSolution_spec ha hO hB _).1.symm + +theorem interior_physical_transfer {lam₁ mu₁ lam₂ mu₂ : X → ℝ} + (ha₁ : Admissible Ω lam₁ mu₁) (ha₂ : Admissible Ω lam₂ mu₂) + (hO : IsOpen Ω) (hB : Bornology.IsBounded Ω) + (hDN : DN Ω lam₁ mu₁=DN Ω lam₂ mu₂) + {u₁ : H1 Ω} (hu₁ : WeakSolution Ω lam₁ mu₁ u₁) : + ∃ u₂ : H1 Ω, WeakSolution Ω lam₂ mu₂ u₂ ∧ trace Ω u₂=trace Ω u₁ ∧ + ∀ v : H1 Ω, energy Ω lam₂ mu₂ u₂ v=energy Ω lam₁ mu₁ u₁ v := by + let u₂ := dirichletSolution Ω lam₂ mu₂ (trace Ω u₁) + have hs := dirichletSolution_spec ha₂ hO hB (trace Ω u₁) + refine ⟨u₂,hs.2,hs.1,?_⟩ + intro v + rw [← DN_eq_energy ha₂ hO hB,← hDN,DN_eq_energy ha₁ hO hB] + rw [← solution_eq_dirichlet ha₁ hO hB hu₁] + +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/WeakLimits.lean b/lean/OAI/MathematicalPhysics/Elasticity/WeakLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..16915f01f24e496d2a2ac27524fc48bd1e972706 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/WeakLimits.lean @@ -0,0 +1,1079 @@ +import OAI.MathematicalPhysics.Elasticity.PhysicalCGO + +namespace OAI + +noncomputable section + +namespace ElasticityDistribution + +section +open scoped SchwartzMap LineDeriv Laplacian BigOperators +open ElasticityAugmented TemperedDistribution TrivSqZeroExt + +lemma complex_inr_smul (c : ℂ) (u : Dist) : (c • (inr u : Ext))=inr (c • u) := by + exact (TrivSqZeroExt.inr_smul Coeff c u).symm + +def directiond (θ : Fin 3 → ℂ) (u : Dist) : Dist := ∑ i, θ i • dd i u +def normald (θ : Fin 3 → ℂ) (u : Fin 3 → Dist) : Dist := ∑ i, θ i • u i +def leadingRd (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) (i : Fin 3) : Dist := + (2*m) • directiond θ (u i)+direction dc θ m • u i+ + θ i • ((lam+m) • b+∑ j, dc j m • u j) +def leadingSd (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) : Dist := + (2*(lam+m+m)) • directiond θ b+(2*direction dc θ (lam+m)) • b+ + (4 : Coeff) • (∑ i, dc i m • directiond θ (u i))+ + (2 : Coeff) • (∑ i, direction dc θ (dc i m) • u i) + +lemma direction_inr (θ : Fin 3 → ℂ) (u : Dist) : + direction (A := Ext) de θ (inr u)=inr (directiond θ u) := by + simp only [direction,directiond,de_inr,inr_smul,inr_sum] +lemma direction_inl (θ : Fin 3 → ℂ) (a : Coeff) : + direction (A := Ext) de θ (inl a)=inl (direction dc θ a) := by + simp only [direction,de_inl,inl_smul,inl_sum] +lemma leadingR_inr (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) (i : Fin 3) : + leadingR de θ (inl lam) (inl m) (fun j => inr (u j)) (inr b) i = + inr (leadingRd θ lam m u b i) := by + simp only [leadingR,leadingRd,direction_inr,direction_inl,← inl_two, + coff_inl_mul,coff_inl_add,inl_mul_inr,de_inl,← inr_sum,← inr_add,complex_inr_smul] +lemma leadingS_inr (θ : Fin 3 → ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) : + leadingS de θ (inl lam) (inl m) (fun j => inr (u j)) (inr b) = + inr (leadingSd θ lam m u b) := by + have hf : (4 : Ext)=inl (4 : Coeff) := (inl_natCast 4).symm + simp only [leadingS,leadingSd,direction_inr,direction_inl,← inl_two,hf, + coff_inl_mul,coff_inl_add,inl_mul_inr,de_inl,← inr_sum,← inr_add] + +/-- Exact null-phase polynomial decomposition for the physical distributions. -/ +theorem rd_null_expansion (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (τ : ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) (i : Fin 3) : + rd (τ • θ) lam m u b i=rd 0 lam m u b i+τ • leadingRd θ lam m u b i := by + have he := RT_null_expansion de θ hθ τ (inl lam) (inl m) (fun j => inr (u j)) (inr b) i + have h0 := RT_inr 0 lam m u b i + have ht : shifted (A := Ext) de 0=fun i => (de i).toLinearMap := by + funext i + apply LinearMap.ext + intro a + change de i a+(0 : ℂ) • a=de i a + rw [zero_smul ℂ a,add_zero] + rw [ht] at h0 + change R de (inl lam) (inl m) (fun j => inr (u j)) (inr b) i=_ at h0 + rw [RT_inr,h0,leadingR_inr,← inr_smul,← inr_add] at he + exact congrArg TrivSqZeroExt.snd he + +theorem scd_null_expansion (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (τ : ℂ) (lam m : Coeff) (u : Fin 3 → Dist) (b : Dist) : + scd (τ • θ) lam m u b=scd 0 lam m u b+τ • leadingSd θ lam m u b := by + have he := ST_null_expansion de θ hθ τ (inl lam) (inl m) (fun j => inr (u j)) (inr b) de_commute + have h0 := ST_inr 0 lam m u b + have ht : shifted (A := Ext) de 0=fun i => (de i).toLinearMap := by + funext i + apply LinearMap.ext + intro a + change de i a+(0 : ℂ) • a=de i a + rw [zero_smul ℂ a,add_zero] + rw [ht] at h0 + change ElasticityAugmented.S de (inl lam) (inl m) (fun j => inr (u j)) (inr b)=_ at h0 + rw [ST_inr,h0,leadingS_inr,← inr_smul,← inr_add] at he + exact congrArg TrivSqZeroExt.snd he + +lemma divergence_phase (θ : Fin 3 → ℂ) (τ : ℂ) (u : Fin 3 → Dist) : + divd (τ • θ) u=divd 0 u+τ • normald θ u := by + have hz (i : Fin 3) : sd 0 i (u i)=dd i (u i) := by + change dd i (u i)+(0 : ℂ) • u i=dd i (u i) + rw [zero_smul ℂ (u i),add_zero] + simp only [divd,hz,sd_apply,Pi.smul_apply,smul_eq_mul,normald, + Finset.sum_add_distrib,Finset.smul_sum,smul_smul] +end +open MeasureTheory TemperedDistribution +open scoped SchwartzMap LineDeriv BigOperators +open ElasticityAugmented +abbrev AugHilbert := WithLp 2 (Fin 4 → Lp ℂ 2 (volume : Measure X)) +def augEntry (i : Fin 4) : AugHilbert →L[ℂ] Dist := + (Lp.toTemperedDistributionCLM ℂ (volume : Measure X) 2).comp + ((ContinuousLinearMap.proj i).comp + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : Fin 4 => Lp ℂ 2 (volume : Measure X))).toContinuousLinearMap) +lemma augEntry_apply (i : Fin 4) (U : AugHilbert) : augEntry i U=(U i : Dist) := rfl + +def coeffCLM (a : Coeff) : Dist →L[ℂ] Dist := smulLeftCLM ℂ (eval a) +def ddCLM (i : Fin 3) : Dist →L[ℂ] Dist := LineDeriv.lineDerivOpCLM ℂ Dist (e i) +def sdCLM (z : Fin 3 → ℂ) (i : Fin 3) : Dist →L[ℂ] Dist := + ddCLM i+z i • ContinuousLinearMap.id ℂ Dist +def lapdCLM (z : Fin 3 → ℂ) : Dist →L[ℂ] Dist := ∑ i, (sdCLM z i).comp (sdCLM z i) +def directionCLM (θ : Fin 3 → ℂ) : Dist →L[ℂ] Dist := ∑ i, θ i • ddCLM i +lemma coeffCLM_apply (a : Coeff) (u : Dist) : coeffCLM a u=a • u := rfl +lemma ddCLM_apply (i : Fin 3) (u : Dist) : ddCLM i u=dd i u := rfl +lemma sdCLM_apply (z : Fin 3 → ℂ) (i : Fin 3) (u : Dist) : sdCLM z i u=sd z i u := rfl +lemma lapdCLM_apply (z : Fin 3 → ℂ) (u : Dist) : lapdCLM z u=lapd z u := by + simp only [lapdCLM,lapd,sum_apply,ContinuousLinearMap.comp_apply,sdCLM_apply] +lemma directionCLM_apply (θ : Fin 3 → ℂ) (u : Dist) : directionCLM θ u=directiond θ u := by + simp only [directionCLM,directiond,sum_apply,smul_apply,ddCLM_apply] + +def rdCLM (z : Fin 3 → ℂ) (lam m : Coeff) (i : Fin 3) : AugHilbert →L[ℂ] Dist := + (coeffCLM m).comp ((lapdCLM z).comp (augEntry i.succ))+ + (coeffCLM (lam+m)).comp ((sdCLM z i).comp (augEntry 0))+ + (∑ j, (coeffCLM (dc j m)).comp ((sdCLM z j).comp (augEntry i.succ)+(sdCLM z i).comp (augEntry j.succ)))+ + (coeffCLM (dc i lam)).comp (augEntry 0) +def scdCLM (z : Fin 3 → ℂ) (lam m : Coeff) : AugHilbert →L[ℂ] Dist := + (coeffCLM (lam+m+m)).comp ((lapdCLM z).comp (augEntry 0))+ + (2 : ℂ) • (∑ i, (coeffCLM (dc i (lam+m))).comp ((sdCLM z i).comp (augEntry 0)))+ + (2 : ℂ) • (∑ i, (coeffCLM (dc i m)).comp ((lapdCLM z).comp (augEntry i.succ)))+ + (2 : ℂ) • (∑ i, ∑ j, (coeffCLM (dc i (dc j m))).comp ((sdCLM z i).comp (augEntry j.succ)))+ + (coeffCLM (∑ i, dc i (dc i lam))).comp (augEntry 0) +def leadingRCLM (θ : Fin 3 → ℂ) (lam m : Coeff) (i : Fin 3) : AugHilbert →L[ℂ] Dist := + (coeffCLM (2*m)).comp ((directionCLM θ).comp (augEntry i.succ))+ + (coeffCLM (direction dc θ m)).comp (augEntry i.succ)+ + θ i • ((coeffCLM (lam+m)).comp (augEntry 0)+∑ j, (coeffCLM (dc j m)).comp (augEntry j.succ)) +def leadingSCLM (θ : Fin 3 → ℂ) (lam m : Coeff) : AugHilbert →L[ℂ] Dist := + (coeffCLM (2*(lam+m+m))).comp ((directionCLM θ).comp (augEntry 0))+ + (coeffCLM (2*direction dc θ (lam+m))).comp (augEntry 0)+ + (coeffCLM 4).comp (∑ i, (coeffCLM (dc i m)).comp ((directionCLM θ).comp (augEntry i.succ)))+ + (coeffCLM 2).comp (∑ i, (coeffCLM (direction dc θ (dc i m))).comp (augEntry i.succ)) +def normalCLM (θ : Fin 3 → ℂ) : AugHilbert →L[ℂ] Dist := ∑ i, θ i • augEntry i.succ +def divergenceCLM (z : Fin 3 → ℂ) : AugHilbert →L[ℂ] Dist := ∑ i, (sdCLM z i).comp (augEntry i.succ) +lemma rdCLM_apply (z : Fin 3 → ℂ) (lam m : Coeff) (i : Fin 3) (U : AugHilbert) : + rdCLM z lam m i U=rd z lam m (fun j => (U j.succ : Dist)) (U 0 : Dist) i := by + simp only [rdCLM,rd,add_apply,sum_apply,ContinuousLinearMap.comp_apply, + coeffCLM_apply,lapdCLM_apply,sdCLM_apply,augEntry_apply] +lemma scdCLM_apply (z : Fin 3 → ℂ) (lam m : Coeff) (U : AugHilbert) : + scdCLM z lam m U=scd z lam m (fun j => (U j.succ : Dist)) (U 0 : Dist) := by + simp only [scdCLM,scd,add_apply,sum_apply,smul_apply,ContinuousLinearMap.comp_apply, + coeffCLM_apply,lapdCLM_apply,sdCLM_apply,augEntry_apply] +lemma leadingRCLM_apply (θ : Fin 3 → ℂ) (lam m : Coeff) (i : Fin 3) (U : AugHilbert) : + leadingRCLM θ lam m i U=leadingRd θ lam m (fun j => (U j.succ : Dist)) (U 0 : Dist) i := by + simp only [leadingRCLM,leadingRd,add_apply,sum_apply,smul_apply,ContinuousLinearMap.comp_apply, + coeffCLM_apply,directionCLM_apply,augEntry_apply] +lemma leadingSCLM_apply (θ : Fin 3 → ℂ) (lam m : Coeff) (U : AugHilbert) : + leadingSCLM θ lam m U=leadingSd θ lam m (fun j => (U j.succ : Dist)) (U 0 : Dist) := by + simp only [leadingSCLM,leadingSd,add_apply,sum_apply,ContinuousLinearMap.comp_apply, + coeffCLM_apply,directionCLM_apply,augEntry_apply] +lemma normalCLM_apply (θ : Fin 3 → ℂ) (U : AugHilbert) : + normalCLM θ U=normald θ (fun j => (U j.succ : Dist)) := by + simp only [normalCLM,normald,sum_apply,smul_apply,augEntry_apply] +lemma divergenceCLM_apply (z : Fin 3 → ℂ) (U : AugHilbert) : + divergenceCLM z U=divd z (fun j => (U j.succ : Dist)) := by + simp only [divergenceCLM,divd,sum_apply,ContinuousLinearMap.comp_apply,sdCLM_apply,augEntry_apply] +end ElasticityDistribution +namespace ElasticityCGO + +section +open Set Filter MeasureTheory +open scoped SchwartzMap Topology BigOperators ENNReal +open ElasticityAugmented +open ElasticityBessel (L2 norm2 J) +open ElasticityNegativeOrder (mult sobNorm) +open ElasticityPhysicalAlgebra (divShift) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityDistribution (AugHilbert) + +def augEmbed : (Fin 4 → S) →ₗ[ℂ] AugHilbert where + toFun u := WithLp.toLp 2 (fun i => L2 (u i)) + map_add' u v := by apply PiLp.ext; intro i; exact map_add L2 _ _ + map_smul' c u := by apply PiLp.ext; intro i; exact map_smul L2 _ _ +lemma augEmbed_apply (u : Fin 4 → S) (i : Fin 4) : augEmbed u i=L2 (u i) := rfl +lemma norm_augEmbed (h : ℝ) (u : Fin 4 → S) : ‖augEmbed u‖=sobNorm h 0 u := by + rw [PiLp.norm_eq_of_L2] + simp only [augEmbed_apply,sobNorm,ElasticityBessel.J_zero,norm2] +lemma norm_augEmbed_le (h : ℝ) (u : Fin 4 → S) : ‖augEmbed u‖≤ sobNorm h 1 u := by + rw [norm_augEmbed h] + simpa only [one_mul] using ElasticityNegativeOrder.sobNorm_component_bound h h 0 1 1 + (by norm_num) u u (fun i => by + simpa only [ElasticityBessel.J_zero,one_mul] using ElasticityNegativeOrder.norm2_J_one_ge h (u i)) +lemma norm2_le_sobNorm {n : ℕ} (h : ℝ) (u : Fin n → S) (i : Fin n) : + norm2 (u i)≤ sobNorm h 1 u := by + apply (ElasticityNegativeOrder.norm2_J_one_ge h (u i)).trans + exact Real.le_sqrt_of_sq_le (Finset.single_le_sum (fun j _ => sq_nonneg (norm2 (J h 1 (u j)))) + (Finset.mem_univ i)) + +lemma truncation_at_zero (N : ℕ) (f : ℕ → S) : truncation 0 N f=f 0 := by + induction N with + | zero => exact truncation_zero 0 f + | succ N ih => simp only [truncation_succ,ih,zero_pow (Nat.succ_ne_zero N),zero_smul,add_zero] +lemma truncation_continuous (N : ℕ) (f : ℕ → S) : Continuous (fun h : ℂ => truncation h N f) := by + unfold truncation + exact continuous_finsetSum _ (fun j _ => (continuous_id.pow j).smul continuous_const) +lemma truncation_tendsto {h : ℕ → ℂ} (hh : Tendsto h atTop (𝓝 0)) (N : ℕ) (f : ℕ → S) : + Tendsto (fun n => truncation (h n) N f) atTop (𝓝 (f 0)) := by + simpa only [truncation_at_zero,Function.comp_def] using (truncation_continuous N f).continuousAt.tendsto.comp hh + +/-- Exact polynomial formula for the actual localized formal scalar amplitude. +The derivative of the localization is retained; it disappears only where g=1. -/ +lemma formal_scalar_polynomial {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (N : ℕ) (a : ℕ → Amplitude Smooth) + (h₀ : normal θ (a 0).1=0) + (hrec : ∀ j ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) + (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + {g : X → ℂ} (hg : g.HasTemperateGrowth) (hs : tsupport g⊆U) + (h : ℂ) (hh : h≠0) : + divShift (h⁻¹ • θ) (fun i => mult g (cut χ hc ((truncation h N a).1 i)))= + truncation h N (fun j => mult g (cut χ hc (a j).2))+ + h^N • mult g (cut χ hc (div coord (a N).1-(a N).2))+ + ∑ i, truncation h N (fun j => mult (fun x => fderiv ℝ g x (e i)) (cut χ hc ((a j).1 i))) := by + rw [divShift_mult _ g hg] + have he := cut_truncation_divergence hU θ h hh N a h₀ hrec χ hc hχ + rw [mult_eq_of_local hg hs he,truncation_scalar] + simp only [map_add,map_smul,cut_truncation] + congr 1 + · simp only [truncation,map_sum,map_smul] + · exact Finset.sum_congr rfl (fun i _ => mult_cut_truncation_vector _ χ hc N a h i) + +/-- Strong Schwartz convergence of the formal augmented amplitudes, including +its physical scalar component and the cutoff derivative. -/ +theorem formal_augmented_tendsto {U : Set X} (hU : IsOpen U) + (θ : Fin 3 → ℂ) (N : ℕ) (hN : 0 ((normal θ (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) U) + (χ : Smooth) (hc : HasCompactSupport (χ : X → ℂ)) (hχ : EqOn (χ : X → ℂ) 1 U) + {g : X → ℂ} (hg : g.HasTemperateGrowth) (hs : tsupport g⊆U) + {h : ℕ → ℂ} (hh : Tendsto h atTop (𝓝 0)) (hne : ∀ n,h n≠0) : + ∀ i : Fin 4, Tendsto (fun n => physicalAug ((h n)⁻¹ • θ) + (fun j => mult g (cut χ hc ((truncation (h n) N a).1 j))) i) atTop + (𝓝 ((Fin.cons (mult g (cut χ hc (a 0).2)+ + ∑ j, mult (fun x => fderiv ℝ g x (e j)) (cut χ hc ((a 0).1 j))) + (fun j => mult g (cut χ hc ((a 0).1 j))) : Fin 4 → S) i)) := by + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [physicalAug,Fin.cons_zero] + have he : (fun n => divShift ((h n)⁻¹ • θ) + (fun j => mult g (cut χ hc ((truncation (h n) N a).1 j))))= + (fun n => truncation (h n) N (fun j => mult g (cut χ hc (a j).2))+ + h n^N • mult g (cut χ hc (div coord (a N).1-(a N).2))+ + ∑ j, truncation (h n) N (fun k => mult (fun x => fderiv ℝ g x (e j)) + (cut χ hc ((a k).1 j)))) := by + funext n + exact formal_scalar_polynomial hU θ N a h₀ hrec χ hc hχ hg hs _ (hne n) + rw [he] + have hm := (hh.pow N).smul (tendsto_const_nhds (x := mult g (cut χ hc (div coord (a N).1-(a N).2)))) + simp only [zero_pow hN.ne',zero_smul] at hm + have hv := tendsto_finsetSum Finset.univ (fun j _ => truncation_tendsto hh N + (fun k => mult (fun x => fderiv ℝ g x (e j)) (cut χ hc ((a k).1 j)))) + simpa only [add_zero] using ((truncation_tendsto hh N + (fun k => mult g (cut χ hc (a k).2))).add hm).add hv + · simp only [physicalAug,Fin.cons_succ] + simp_rw [mult_cut_truncation_vector] + exact truncation_tendsto hh N _ + +/-- A localized actual physical correction with O(h) augmented H_h^1 norm +has every literal augmented L2 component converging strongly to zero. -/ +lemma augmented_correction_tendsto {h : ℕ → ℝ} (hh : Tendsto h atTop (𝓝 0)) + (C : ℝ) (u : ℕ → Fin 4 → S) (hu : ∀ n,sobNorm (h n) 1 (u n)≤C*h n) (i : Fin 4) : + Tendsto (fun n => L2 (u n i)) atTop (𝓝 0) := by + rw [tendsto_zero_iff_norm_tendsto_zero] + exact squeeze_zero (fun _ => norm_nonneg _) (fun n => (norm2_le_sobNorm (h n) (u n) i).trans (hu n)) + (by simpa only [mul_zero] using (tendsto_const_nhds (x := C)).mul hh) + +end +open Set MeasureTheory Filter +open scoped SchwartzMap Topology BigOperators +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityBessel (L2 norm2) +open ElasticityNegativeOrder (mult sobNorm) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalEstimate (physicalAug) + +def localizedFormal (R : ℝ) (hR : 1≤R) (h : ℂ) (a : ℕ → Amplitude Smooth) + (g : X → ℂ) : Fin 3 → S := fun i => mult g + (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + ((truncation h 8 a).1 i)) + +def localizedLeading (R : ℝ) (hR : 1≤R) (a : ℕ → Amplitude Smooth) + (g : X → ℂ) : Fin 4 → S := Fin.cons + (mult g (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) (a 0).2)+ + ∑ j,mult (fun x => fderiv ℝ g x (e j)) + (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) ((a 0).1 j))) + (fun j => mult g (cut ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ + (fiveCutoff_compact R hR 0) ((a 0).1 j))) + +/-- Actual shifted physical solutions, bounded in the literal augmented H1 +norm, whose augmented L2 error from the formal series is O(h). -/ +theorem localized_actual_strong_bound (R : ℝ) (hR : 1≤R) (α β : X) + (lam m : Smooth) (hl : ExteriorConstant lam) (hm : ExteriorConstant m) + (a : ℕ → Amplitude Smooth) (ha : PhysicalColumn R hR α β lam m a) + (h₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,EqOn (fun x => ((normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) (Metric.ball 0 R)) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆Metric.ball 0 R) {B : Set X} (hB : IsOpen B) + (hBR : B⊆Metric.ball 0 R) (hg1 : EqOn g 1 B) : + ∃ C D h₁ : ℝ,0 (α i : ℂ)+Complex.I*(β i : ℂ)) 8 a h₀ hrec χ hcχ + (fiveCutoff_initial R hR) (hc.hasTemperateGrowth hg) hs + obtain ⟨D,h₁,hD,hh₁,hh₁1,hsol⟩ := physical_column_shifted_realization + R hR α β lam m a ha hg hc hs + refine ⟨2*(A+D),D,h₁,by linarith only [hA,hD],hD,hh₁,fun h hh hsmall => ?_⟩ + obtain ⟨w,q,v,_hv,hp,_hq,_hw,_hn,hbound⟩ := hsol h hh hsmall + let F := localizedFormal R hR (h : ℂ) a g + let V : Fin 3 → S := fun i => mult g (v i) + let u := F-V + have hlocal : ∀ j,EqOn (u j : X → ℂ) + (((fun k => cut χ hcχ ((truncation (h : ℂ) 8 a).1 k))-v) j) B := by + intro j x hx + change mult g (cut χ hcχ ((truncation (h : ℂ) 8 a).1 j)) x-mult g (v j) x=_ + simp only [ElasticityNegativeOrder.mult_apply g (hc.hasTemperateGrowth hg),hg1 hx, + Pi.one_apply,one_mul,Pi.sub_apply,sub_apply] + refine ⟨u,fun i x hx => (ElasticityPhysicalAlgebra.physical_eqOn_of_eqOn hB _ lam m + hl.growth hm.growth u _ hlocal i hx).trans (hp i (hBR hx)),?_,fun i => ?_⟩ + · have hh1 : h≤1 := hsmall.trans hh₁1 + have hf := hformal h hh hh1 + rw [← phase_eq] at hf + change sobNorm h 1 (physicalAug (phase h α β) F)≤A at hf + change sobNorm h 1 (physicalAug (phase h α β) V)≤D*h at hbound + change sobNorm h 1 (physicalAug (phase h α β) (F-V))≤_ + rw [ElasticityPhysicalEstimate.physicalAug_sub] + have hn := sobNorm_sub_four h 1 (physicalAug (phase h α β) F) (physicalAug (phase h α β) V) + have hDh : D*h≤D := by nlinarith only [hD,hh1] + linarith only [hn,hf,hbound,hDh] + · have ht : physicalAug (phase h α β) u i-physicalAug (phase h α β) F i= + -physicalAug (phase h α β) V i := by + change physicalAug (phase h α β) (F-V) i-physicalAug (phase h α β) F i=_ + rw [ElasticityPhysicalEstimate.physicalAug_sub] + simp only [Pi.sub_apply,sub_sub_cancel_left] + rw [ht,map_neg,norm_neg] + exact (norm2_le_sobNorm h (physicalAug (phase h α β) V) i).trans hbound + +lemma localized_formal_L2_tendsto (R : ℝ) (hR : 1≤R) (α β : X) + (a : ℕ → Amplitude Smooth) + (h₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,EqOn (fun x => ((normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) (Metric.ball 0 R)) + {g : X → ℂ} (hg : g.HasTemperateGrowth) (hs : tsupport g⊆Metric.ball 0 R) + {h : ℕ → ℝ} (hh : Tendsto h atTop (𝓝 0)) (hne : ∀ n,h n≠0) (i : Fin 4) : + Tendsto (fun n => L2 (physicalAug (phase (h n) α β) + (localizedFormal R hR (h n : ℂ) a g) i)) atTop + (𝓝 (L2 (localizedLeading R hR a g i))) := by + have hh' : Tendsto (fun n => (h n : ℂ)) atTop (𝓝 0) := by + simpa only [Complex.ofReal_zero,Function.comp_def] using Complex.continuous_ofReal.continuousAt.tendsto.comp hh + have ht := formal_augmented_tendsto Metric.isOpen_ball + (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) 8 (by norm_num) a h₀ hrec + ⟨fiveCutoff R hR 0,fiveCutoff_smooth R hR 0⟩ (fiveCutoff_compact R hR 0) + (fiveCutoff_initial R hR) hg hs hh' (fun n => Complex.ofReal_ne_zero.mpr (hne n)) i + simp_rw [← phase_eq] at ht + exact L2.continuous.continuousAt.tendsto.comp ht + +end ElasticityCGO +namespace ElasticityWeakLimit +open Filter Topology +open scoped InnerProductSpace +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +/-- Bounded physical amplitudes admit a common weak subsequence in the genuine +Hilbert space. For several columns, take their finite Hilbert product. -/ +theorem bounded_weak_subsequence [CompleteSpace H] [TopologicalSpace.SeparableSpace H] + (u : ℕ → H) (C : ℝ) (hC : ∀ n, ‖u n‖ ≤ C) : + ∃ w : H, ‖w‖ ≤ C ∧ ∃ σ : ℕ → ℕ, StrictMono σ ∧ + ∀ v : H, Tendsto (fun n => inner ℂ (u (σ n)) v) atTop (𝓝 (inner ℂ w v)) := by + let f : ℕ → WeakDual ℂ H := fun n => StrongDual.toWeakDual (InnerProductSpace.toDual ℂ H (u n)) + have hf : ∀ n, f n ∈ WeakDual.toStrongDual ⁻¹' Metric.closedBall (0 : StrongDual ℂ H) C := by + intro n + simpa only [Set.mem_preimage,Metric.mem_closedBall,dist_zero_right, + f,StrongDual.toStrongDual_toWeakDual,LinearIsometryEquiv.norm_map] using hC n + obtain ⟨w,hw,σ,hσ,hlim⟩ := (WeakDual.isSeqCompact_closedBall (𝕜 := ℂ) (E := H) 0 C) hf + refine ⟨(InnerProductSpace.toDual ℂ H).symm w.toStrongDual,?_,σ,hσ,fun v => ?_⟩ + · simpa only [Set.mem_preimage,Metric.mem_closedBall,dist_zero_right, + LinearIsometryEquiv.norm_map] using hw + · have he := (WeakDual.eval_continuous v).tendsto w |>.comp hlim + rw [InnerProductSpace.toDual_symm_apply] + exact he + +/-- Weak convergence preserves any exact testing identity, including exterior +agreement of the transferred amplitudes. -/ +lemma testing_identity {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (v : H) (c : ℂ) (hc : ∀ n, inner ℂ (u n) v=c) : inner ℂ w v=c := by + have hconst : Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 c) := by + simpa only [hc] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => c) atTop (𝓝 c)) + exact tendsto_nhds_unique (hu v) hconst + +/-- The lower-order conjugated terms vanish under weak convergence. No +bound on derivatives of the sequence is required: both operators have already +been transposed onto fixed test vectors. -/ +lemma asymptotic_testing_identity {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (eps : ℕ → ℂ) (heps : Tendsto eps atTop (𝓝 0)) (v₁ v₂ : H) + (heq : ∀ n, inner ℂ (u n) v₁+eps n*inner ℂ (u n) v₂=0) : + inner ℂ w v₁=0 := by + have hl := (hu v₁).add (heps.mul (hu v₂)) + simp only [zero_mul,add_zero] at hl + have hz : Tendsto (fun n => inner ℂ (u n) v₁+eps n*inner ℂ (u n) v₂) atTop (𝓝 (0 : ℂ)) := by + simpa only [heq] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℂ)) atTop (𝓝 0)) + exact tendsto_nhds_unique hl hz +end ElasticityWeakLimit +namespace ElasticityWeakLimit +open MeasureTheory TemperedDistribution Filter Topology +open scoped SchwartzMap InnerProductSpace +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +lemma weak_scalar {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (L : H →L[ℂ] ℂ) : Tendsto (fun n => L (u n)) atTop (𝓝 (L w)) := by + let v := (InnerProductSpace.toDual ℂ H).symm L + have he (x : H) : L x=inner ℂ v x := (InnerProductSpace.toDual_symm_apply (y := L) (x := x)).symm + simp only [he] + have hh := (continuous_star.tendsto (inner ℂ w v)).comp (hu v) + change Tendsto (fun n => star (inner ℂ (u n) v)) atTop (𝓝 (star (inner ℂ w v))) at hh + have hs (a b : H) : star (inner ℂ a b)=inner ℂ b a := inner_conj_symm (𝕜 := ℂ) b a + simpa only [hs] using hh + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] +lemma weak_distribution {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (A : H →L[ℂ] 𝓢'(E,ℂ)) (φ : 𝓢(E,ℂ)) : + Tendsto (fun n => A (u n) φ) atTop (𝓝 (A w φ)) := by + let L : H →L[ℂ] ℂ := (PointwiseConvergenceCLM.evalCLM (RingHom.id ℂ) ℂ φ).comp A + exact weak_scalar hu L + +/-- The actual distributional lower-order terms disappear after transposing to +fixed tests. This is the passage used for physical transferred amplitudes. -/ +theorem weak_local_equation {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (A B : H →L[ℂ] 𝓢'(E,ℂ)) (Ω : Set E) (eps : ℕ → ℂ) + (heps : Tendsto eps atTop (𝓝 0)) + (heq : ∀ n, ElasticityRegularity.LocalEqual Ω (A (u n)+eps n • B (u n)) 0) : + ElasticityRegularity.LocalEqual Ω (A w) 0 := by + intro φ hc hs + have hh := (weak_distribution hu A φ).add (heps.mul (weak_distribution hu B φ)) + simp only [zero_mul,add_zero] at hh + have hz : Tendsto (fun n => A (u n) φ+eps n*B (u n) φ) atTop (𝓝 (0 : ℂ)) := by + have he (n : ℕ) : A (u n) φ+eps n*B (u n) φ=0 := heq n φ hc hs + simpa only [he] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0 : ℂ)) atTop (𝓝 0)) + exact tendsto_nhds_unique hh hz + +lemma weak_local_agreement {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (A : H →L[ℂ] 𝓢'(E,ℂ)) (Ω : Set E) (f : 𝓢'(E,ℂ)) + (heq : ∀ n, ElasticityRegularity.LocalEqual Ω (A (u n)) f) : + ElasticityRegularity.LocalEqual Ω (A w) f := by + intro φ hc hs + have hz : Tendsto (fun n => A (u n) φ) atTop (𝓝 (f φ)) := by + simpa only [fun n => heq n φ hc hs] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => f φ) atTop (𝓝 (f φ))) + exact tendsto_nhds_unique (weak_distribution hu A φ) hz +end ElasticityWeakLimit +namespace ElasticityDistribution +open MeasureTheory TemperedDistribution Filter Topology +open scoped SchwartzMap InnerProductSpace +open ElasticityAugmented ElasticityWeakLimit + +lemma scaled_null_sum (ε : ℂ) (hε : ε ≠ 0) (a b : Dist) : + ε • (a+ε⁻¹ • b)=b+ε • a := by + rw [smul_add,smul_smul,mul_inv_cancel₀ hε,one_smul] + exact add_comm _ _ +lemma complex_smul_zero (ε : ℂ) : ε • (0 : Dist)=0 := by + exact @smul_zero ℂ Dist _ _ ε + +/-- Weak physical transferred amplitudes satisfy the actual constrained leading +system, not an unconstrained augmented transport. -/ +theorem weak_physical_leading {U : ℕ → AugHilbert} {W : AugHilbert} + (hU : ∀ v, Tendsto (fun n => inner ℂ (U n) v) atTop (𝓝 (inner ℂ W v))) + (Ω : Set X) (eps : ℕ → ℂ) (heps : Tendsto eps atTop (𝓝 0)) + (hne : ∀ n, eps n ≠ 0) (θ : Fin 3 → ℂ) (hθ : ∑ i, θ i*θ i=0) + (lam m : Coeff) + (hR : ∀ n i, LocalEq Ω (rd ((eps n)⁻¹ • θ) lam m + (fun j => (U n j.succ : Dist)) (U n 0 : Dist) i) 0) + (hS : ∀ n, LocalEq Ω (scd ((eps n)⁻¹ • θ) lam m + (fun j => (U n j.succ : Dist)) (U n 0 : Dist)) 0) + (hdiv : ∀ n, LocalEq Ω (divd ((eps n)⁻¹ • θ) (fun j => (U n j.succ : Dist))) + (U n 0 : Dist)) : + (∀ i, LocalEq Ω (leadingRd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist) i) 0) ∧ + LocalEq Ω (leadingSd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist)) 0 ∧ + LocalEq Ω (normald θ (fun j => (W j.succ : Dist))) 0 := by + refine ⟨fun i => ?_,?_,?_⟩ + · have hh := weak_local_equation hU (leadingRCLM θ lam m i) (rdCLM 0 lam m i) Ω eps heps + simp only [leadingRCLM_apply,rdCLM_apply] at hh + apply hh + intro n + have h := (hR n i).smul (eps n) + rw [rd_null_expansion θ hθ] at h + rw [scaled_null_sum _ (hne n),complex_smul_zero] at h + exact h + · have hh := weak_local_equation hU (leadingSCLM θ lam m) (scdCLM 0 lam m) Ω eps heps + simp only [leadingSCLM_apply,scdCLM_apply] at hh + apply hh + intro n + have h := (hS n).smul (eps n) + rw [scd_null_expansion θ hθ] at h + rw [scaled_null_sum _ (hne n),complex_smul_zero] at h + exact h + · have hh := weak_local_equation hU (normalCLM θ) (divergenceCLM 0-augEntry 0) Ω eps heps + simp only [normalCLM_apply,sub_apply,divergenceCLM_apply,augEntry_apply] at hh + apply hh + intro n + have h := ((hdiv n).sub (LocalEq.refl (U n 0 : Dist))).smul (eps n) + rw [divergence_phase] at h + have he (a b c : Dist) : eps n • (a+(eps n)⁻¹ • b-c)=b+eps n • (a-c) := by + rw [smul_sub,smul_add,smul_smul,mul_inv_cancel₀ (hne n),one_smul,smul_sub] + abel + rw [he,sub_self,complex_smul_zero] at h + exact h +end ElasticityDistribution +section +open MeasureTheory TemperedDistribution Filter Topology +open scoped SchwartzMap InnerProductSpace ENNReal +namespace ElasticityWeakLimit +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +/-- The exterior data need only converge in distributions. In particular, this +retains the finite-amplitude and correction terms of the physical CGO sequence +until after the weak limit, rather than replacing them by their leading value. -/ +theorem weak_moving_local_agreement {u : ℕ → H} {w : H} + (hu : ∀ v, Tendsto (fun n => inner ℂ (u n) v) atTop (𝓝 (inner ℂ w v))) + (A : H →L[ℂ] 𝓢'(E,ℂ)) (Ω : Set E) (f : ℕ → 𝓢'(E,ℂ)) (g : 𝓢'(E,ℂ)) + (hf : ∀ φ, Tendsto (fun n => f n φ) atTop (𝓝 (g φ))) + (heq : ∀ n, ElasticityRegularity.LocalEqual Ω (A (u n)) (f n)) : + ElasticityRegularity.LocalEqual Ω (A w) g := by + intro φ hc hs + have htest (n : ℕ) : A (u n) φ=f n φ := heq n φ hc hs + have ht : Tendsto (fun n => A (u n) φ) atTop (𝓝 (g φ)) := by + simpa only [htest] using hf φ + exact tendsto_nhds_unique (weak_distribution hu A φ) ht +end ElasticityWeakLimit + +namespace ElasticityDistribution +open ElasticityAugmented ElasticityWeakLimit + +/-- Actual coefficientwise physical equations survive bounded weak extraction, +including the divergence constraint and the varying physical exterior data. +The bound is a premise here: deriving it from the DN transfer and its compact +Carleman estimate remains separate and is not identified with the main theorem. -/ +theorem bounded_physical_limit + (U : ℕ → AugHilbert) (C : ℝ) (hbound : ∀ n, ‖U n‖≤C) + (Ω E : Set X) (eps : ℕ → ℂ) (heps : Tendsto eps atTop (𝓝 0)) + (hne : ∀ n,eps n≠0) (θ : Fin 3 → ℂ) (hθ : ∑ i,θ i*θ i=0) + (lam m : Coeff) + (hR : ∀ n i,LocalEq Ω (rd ((eps n)⁻¹ • θ) lam m + (fun j => (U n j.succ : Dist)) (U n 0 : Dist) i) 0) + (hS : ∀ n,LocalEq Ω (scd ((eps n)⁻¹ • θ) lam m + (fun j => (U n j.succ : Dist)) (U n 0 : Dist)) 0) + (hdiv : ∀ n,LocalEq Ω (divd ((eps n)⁻¹ • θ) (fun j => (U n j.succ : Dist))) + (U n 0 : Dist)) + (F : ℕ → Fin 4 → Dist) (a : Fin 4 → Dist) + (hF : ∀ i φ,Tendsto (fun n => F n i φ) atTop (𝓝 (a i φ))) + (hext : ∀ n i,LocalEq E (U n i : Dist) (F n i)) : + ∃ W : AugHilbert,‖W‖≤C ∧ + (∀ i,LocalEq Ω (leadingRd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist) i) 0) ∧ + LocalEq Ω (leadingSd θ lam m (fun j => (W j.succ : Dist)) (W 0 : Dist)) 0 ∧ + LocalEq Ω (normald θ (fun j => (W j.succ : Dist))) 0 ∧ + (∀ i,LocalEq E (W i : Dist) (a i)) ∧ + ∃ σ : ℕ → ℕ,StrictMono σ ∧ + ∀ v,Tendsto (fun n => inner ℂ (U (σ n)) v) atTop (𝓝 (inner ℂ W v)) := by + have : Fact ((2 : ℝ≥0∞) ≠ ⊤) := ⟨by norm_num⟩ + have : TopologicalSpace.SeparableSpace (Lp ℂ 2 (volume : Measure X)) := inferInstance + have : TopologicalSpace.SeparableSpace AugHilbert := inferInstance + obtain ⟨W,hW,σ,hσ,hw⟩ := bounded_weak_subsequence U C hbound + have ht := hσ.tendsto_atTop + obtain ⟨hr,hs,hd⟩ := weak_physical_leading hw Ω (fun n => eps (σ n)) + (heps.comp ht) (fun n => hne (σ n)) θ hθ lam m + (fun n => hR (σ n)) (fun n => hS (σ n)) (fun n => hdiv (σ n)) + refine ⟨W,hW,hr,hs,hd,fun i => ?_,σ,hσ,hw⟩ + have he := weak_moving_local_agreement hw (augEntry i) E (fun n => F (σ n) i) (a i) + (fun φ => (hF i φ).comp ht) (fun n => hext (σ n) i) + exact he +end ElasticityDistribution + +end +namespace ElasticityDistribution + +section +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap BigOperators +open ElasticityAugmented +open ElasticityCGO (augEmbed) +open ElasticityPhysicalEstimate (physicalAug) + +lemma augEmbed_distribution (u : Fin 4 → SchwartzMap X ℂ) (i : Fin 4) : + (augEmbed u i : Dist)=(u i : Dist) := + Lp.toTemperedDistribution_toLp_eq (u i) + +/-- The scalar entry of the actual augmented amplitude is its actual physical +shifted divergence. Both physical equations, including the scalar consequence, +are thereby inherited by the same L2 object used in weak extraction. -/ +theorem actual_augmented_equations {B : Set X} (z : Fin 3 → ℂ) (lam m : Coeff) + (u : Fin 3 → SchwartzMap X ℂ) + (hu : ∀ i,EqOn (ElasticityPhysicalAlgebra.physical z (eval lam) (eval m) u i : X → ℂ) 0 B) : + let U := augEmbed (physicalAug z u) + (∀ i,LocalEq B (rd z lam m (fun j => (U j.succ : Dist)) (U 0 : Dist) i) 0) ∧ + LocalEq B (scd z lam m (fun j => (U j.succ : Dist)) (U 0 : Dist)) 0 ∧ + LocalEq B (divd z (fun j => (U j.succ : Dist))) (U 0 : Dist) := by + intro U + have he (i : Fin 3) : (U i.succ : Dist)=(u i : Dist) := augEmbed_distribution _ _ + have hd : (U 0 : Dist)=divd z (fun i => (u i : Dist)) := by + rw [augEmbed_distribution,divd_schwartz] + rfl + simp only [he,hd] + have hp (i) : LocalEq B (phys z lam m (fun j => (u j : Dist)) i) 0 := by + rw [phys_schwartz] + have hh := Elasticity.localEq_of_schwartz_eqOn (F := ElasticityPhysicalAlgebra.physical z + (eval lam) (eval m) u i) (G := 0) (hu i) + simpa only [map_zero] using hh + refine ⟨fun i => ?_,?_,LocalEq.refl _⟩ + · rw [← physical_expansion] + exact hp i + · rw [← physical_divergence] + have hh := LocalEq.divergence hp z + simpa only [divd,map_zero,Finset.sum_const_zero] using hh + +lemma actual_augmented_exterior {K : Set X} (z : Fin 3 → ℂ) + (u v : Fin 3 → SchwartzMap X ℂ) + (hs : ∀ i,tsupport (v i-u i : SchwartzMap X ℂ)⊆K) : + ∀ i,LocalEq Kᶜ (augEmbed (physicalAug z v) i : Dist) (augEmbed (physicalAug z u) i : Dist) := by + have hh (j : Fin 3) : LocalEq Kᶜ (v j : Dist) (u j : Dist) := by + apply Elasticity.localEq_of_schwartz_eqOn + intro x hx + have hz : (v j-u j) x=0 := image_eq_zero_of_notMem_tsupport (fun hh => hx (hs j hh)) + exact sub_eq_zero.mp hz + intro i + simp only [augEmbed_distribution] + refine Fin.cases ?_ (fun j => hh j) i + change LocalEq Kᶜ (ElasticityPhysicalAlgebra.divShift z v : Dist) + (ElasticityPhysicalAlgebra.divShift z u : Dist) + have hd := LocalEq.divergence hh z + simpa only [divd_schwartz,ElasticityPhysicalAlgebra.divShift] using hd + +end +open Set Filter MeasureTheory TemperedDistribution +open scoped SchwartzMap Topology BigOperators +open ElasticityAugmented +open ElasticityCGO (augEmbed) +open ElasticityBessel (L2) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityPhysicalAlgebra (phase physical) + +/-- Weak transport extraction for the literal transferred physical sequence. +The exterior leading value follows from strong convergence of the actual +source augmented amplitudes, not from dropping CGO remainders by definition. -/ +theorem actual_transferred_limit (B K : Set X) (α β : X) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Coeff) (h : ℕ → ℝ) (hh : Tendsto h atTop (𝓝 0)) (hne : ∀ n,h n≠0) + (u v : ℕ → Fin 3 → SchwartzMap X ℂ) (a : Fin 4 → SchwartzMap X ℂ) + (hv : ∀ n i,EqOn (physical (phase (h n) α β) (eval lam) (eval m) (v n) i : X → ℂ) 0 B) + (hs : ∀ n i,tsupport (v n i-u n i : SchwartzMap X ℂ)⊆K) + (C : ℝ) (hC : ∀ n,‖augEmbed (physicalAug (phase (h n) α β) (v n))‖≤C) + (ha : ∀ i,Tendsto (fun n => L2 (physicalAug (phase (h n) α β) (u n) i)) atTop (𝓝 (L2 (a i)))) : + ∃ W : AugHilbert, + (∀ i,LocalEq B (leadingRd (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) lam m + (fun j => (W j.succ : Dist)) (W 0 : Dist) i) 0) ∧ + LocalEq B (leadingSd (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) lam m + (fun j => (W j.succ : Dist)) (W 0 : Dist)) 0 ∧ + LocalEq B (normald (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (fun j => (W j.succ : Dist))) 0 ∧ + ∀ i,LocalEq Kᶜ (W i : Dist) (a i : Dist) := by + let U := fun n => augEmbed (physicalAug (phase (h n) α β) (v n)) + have hh' : Tendsto (fun n => (h n : ℂ)) atTop (𝓝 0) := by + simpa only [Complex.ofReal_zero,Function.comp_def] using + Complex.continuous_ofReal.continuousAt.tendsto.comp hh + have heq (n) := actual_augmented_equations (phase (h n) α β) lam m (v n) (hv n) + have hF (i : Fin 4) (φ : 𝓢(X,ℂ)) : + Tendsto (fun n => (augEmbed (physicalAug (phase (h n) α β) (u n)) i : Dist) φ) + atTop (𝓝 ((a i : Dist) φ)) := by + let A : Lp ℂ 2 (volume : Measure X) →L[ℂ] ℂ := + (PointwiseConvergenceCLM.evalCLM (RingHom.id ℂ) ℂ φ).comp + (Lp.toTemperedDistributionCLM ℂ (volume : Measure X) 2) + have ht := A.continuous.continuousAt.tendsto.comp (ha i) + simp only [A,Function.comp_def,ContinuousLinearMap.comp_apply, + PointwiseConvergenceCLM.evalCLM_apply,Lp.toTemperedDistributionCLM_apply, + ElasticityCGO.augEmbed_apply,ElasticityBessel.L2,SchwartzMap.toLpCLM_apply, + Lp.toTemperedDistribution_toLp_eq] at ht ⊢ + exact ht + obtain ⟨W,_hW,hr,hs',hn,hext,_hseq⟩ := bounded_physical_limit U C hC B Kᶜ + (fun n => (h n : ℂ)) hh' (fun n => Complex.ofReal_ne_zero.mpr (hne n)) _ hθ lam m + (fun n i => by simpa only [← ElasticityCGO.phase_eq] using (heq n).1 i) + (fun n => by simpa only [← ElasticityCGO.phase_eq] using (heq n).2.1) + (fun n => by simpa only [← ElasticityCGO.phase_eq] using (heq n).2.2) + (fun n i => (augEmbed (physicalAug (phase (h n) α β) (u n)) i : Dist)) + (fun i => (a i : Dist)) hF (fun n => actual_augmented_exterior _ (u n) (v n) (hs n)) + exact ⟨W,hr,hs',hn,hext⟩ + +end ElasticityDistribution +namespace ElasticitySequences +open Filter +open scoped Topology +lemma small_sequence {a b : ℝ} (ha : 0 c*((n+1 : ℝ)⁻¹) + have hh : Tendsto h atTop (𝓝 0) := by + simpa only [h,one_div,mul_zero] using + tendsto_const_nhds.mul (tendsto_one_div_add_atTop_nhds_zero_nat : + Tendsto (fun n : ℕ => 1/((n : ℝ)+1)) atTop (𝓝 0)) + have hpos (n) : 0 (hle n).trans (min_le_left a b), + fun n => (hle n).trans (min_le_right a b)⟩ +lemma tendsto_of_error {E : Type*} [NormedAddCommGroup E] + {u f : ℕ → E} {a : E} {h : ℕ → ℝ} {C : ℝ} + (hf : Tendsto f atTop (𝓝 a)) (hh : Tendsto h atTop (𝓝 0)) + (he : ∀ n,‖u n-f n‖≤C*h n) : Tendsto u atTop (𝓝 a) := by + have hn : Tendsto (fun n => ‖u n-f n‖) atTop (𝓝 0) := + squeeze_zero (fun _ => norm_nonneg _) he (by simpa using tendsto_const_nhds.mul hh) + have hz : Tendsto (fun n => u n-f n) atTop (𝓝 0) := tendsto_zero_iff_norm_tendsto_zero.mpr hn + simpa only [sub_add_cancel,zero_add] using hz.add hf +end ElasticitySequences +namespace Elasticity +open Set MeasureTheory Filter TemperedDistribution +open scoped BigOperators SchwartzMap Topology +open ElasticityAugmented +open ElasticityCoeffBounds (ExteriorConstant) +open ElasticityDistribution (Coeff Dist LocalEq AugHilbert leadingRd leadingSd normald) +open ElasticityPhysicalAlgebra (phase physical) +open ElasticityPhysicalEstimate (physicalAug) +open ElasticityNegativeOrder (sobNorm) +open ElasticityCGO + +/-- A genuine physical DN transfer yields a bounded weak leading transport +column with the actual exterior leading value. Every bound and equation is +derived from the physical CGO construction and the compact comparison. -/ +theorem dn_weak_transport_column {Ω B B' : Set X} + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hB : IsOpen B) + (hBB : Bornology.IsBounded B) (hB' : IsOpen B') (hsub : B'⊆B) (hcl : closure Ω⊆B') + (R : ℝ) (hR : 1≤R) (hKR : closure Ω⊆Metric.closedBall 0 R) + (hBR : B⊆Metric.ball 0 R) (α β : X) (hα : α≠0) + (hθ : ∑ i,((α i : ℂ)+Complex.I*(β i : ℂ))*((α i : ℂ)+Complex.I*(β i : ℂ))=0) + (lam m : Fin 2 → X → ℝ) + (hl : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (lam q)) (hm : ∀ q,ContDiff ℝ (⊤ : ℕ∞) (m q)) + (hp : ∀ q x,0 < m q x ∧ 0<3*lam q x+2*m q x) + (hcll : ∀ q,ExteriorConstant (smoothOfReal (lam q) (hl q))) + (hclm : ∀ q,ExteriorConstant (smoothOfReal (m q) (hm q))) + (he : ∀ x∉Ω,lam 0 x=lam 1 x ∧ m 0 x=m 1 x) + (hDN : DN Ω (lam 0) (m 0)=DN Ω (lam 1) (m 1)) + (χ g η : Smooth) (hcχ : HasCompactSupport (χ : X → ℂ)) + (hc : HasCompactSupport (g : X → ℂ)) (hs : tsupport (g : X → ℂ)⊆B) + (hχ : EqOn (χ : X → ℂ) 1 B) (hg : EqOn (g : X → ℂ) 1 B') + (hcη : HasCompactSupport (η : X → ℂ)) (hsη : tsupport (η : X → ℂ)⊆Metric.ball 0 R) + (hη : EqOn (η : X → ℂ) 1 B) + (a : ℕ → Amplitude Smooth) + (ha : PhysicalColumn R hR α β (smoothOfReal (lam 0) (hl 0)) (smoothOfReal (m 0) (hm 0)) a) + (h₀ : normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) (a 0).1=0) + (hrec : ∀ j<8,EqOn (fun x => ((normal (fun i => (α i : ℂ)+Complex.I*(β i : ℂ)) + (a (j+1)).1 : Smooth) : X → ℂ) x) + (fun x => ((-(ElasticityAugmented.div coord (a j).1-(a j).2) : Smooth) : X → ℂ) x) (Metric.ball 0 R)) : + let L : Coeff := ⟨smoothOfReal (lam 1) (hl 1),(hcll 1).growth⟩ + let M : Coeff := ⟨smoothOfReal (m 1) (hm 1),(hclm 1).growth⟩ + let θ := fun i => (α i : ℂ)+Complex.I*(β i : ℂ) + ∃ W : AugHilbert, + (∀ i,LocalEq B' (leadingRd θ L M (fun j => (W j.succ : Dist)) (W 0 : Dist) i) 0) ∧ + LocalEq B' (leadingSd θ L M (fun j => (W j.succ : Dist)) (W 0 : Dist)) 0 ∧ + LocalEq B' (normald θ (fun j => (W j.succ : Dist))) 0 ∧ + ∀ i,LocalEq (closure Ω)ᶜ (W i : Dist) (localizedLeading R hR a η i : Dist) := by + intro L M θ + obtain ⟨C,D,h₀',hC,hD,hh₀,hsource⟩ := localized_actual_strong_bound R hR α β + (smoothOfReal (lam 0) (hl 0)) (smoothOfReal (m 0) (hm 0)) (hcll 0) (hclm 0) + a ha h₀ hrec (smooth_coe η) hcη hsη hB hBR hη + obtain ⟨A,h₁,hA,hh₁,htransfer⟩ := extended_dn_compact_comparison hΩ hOB hB hBB hB' hsub hcl + R hR hKR α β hα lam m hl hm hp hcll hclm he hDN χ g hcχ hc hs hχ hg + obtain ⟨h,hh,hpos,hle₀,hle₁⟩ := ElasticitySequences.small_sequence hh₀ hh₁ + choose u hu hub hue using fun n => hsource (h n) (hpos n) (hle₀ n) + choose v hvs hv hvb using fun n => htransfer (h n) (hpos n) (hle₁ n) (u n) (hu n) + have bound (n) : ‖augEmbed (physicalAug (phase (h n) α β) (v n))‖≤(A+1)*C := by + have hd : augEmbed (physicalAug (phase (h n) α β) (v n-u n))= + augEmbed (physicalAug (phase (h n) α β) (v n))- + augEmbed (physicalAug (phase (h n) α β) (u n)) := by + rw [ElasticityPhysicalEstimate.physicalAug_sub,map_sub] + have hhU := (norm_augEmbed_le (h n) (physicalAug (phase (h n) α β) (u n))).trans (hub n) + have hhV := (norm_augEmbed_le (h n) (physicalAug (phase (h n) α β) (v n-u n))).trans (hvb n) + rw [hd] at hhV + have hAC := mul_le_mul_of_nonneg_left (hub n) hA.le + have hn := norm_sub_norm_le (augEmbed (physicalAug (phase (h n) α β) (v n))) + (augEmbed (physicalAug (phase (h n) α β) (u n))) + nlinarith only [hhU,hhV,hAC,hn] + have strong (i : Fin 4) : Tendsto + (fun n => ElasticityBessel.L2 (physicalAug (phase (h n) α β) (u n) i)) atTop + (𝓝 (ElasticityBessel.L2 (localizedLeading R hR a η i))) := by + apply ElasticitySequences.tendsto_of_error + (localized_formal_L2_tendsto R hR α β a h₀ hrec (hcη.hasTemperateGrowth (smooth_coe η)) + hsη hh (fun n => (hpos n).ne') i) hh + intro n + simpa only [map_sub] using hue n i + exact ElasticityDistribution.actual_transferred_limit B' (closure Ω) α β hθ L M h hh + (fun n => (hpos n).ne') u v (localizedLeading R hR a η) hv hvs ((A+1)*C) bound strong +end Elasticity +namespace ElasticitySlicing +/-! Measure-theoretic core of transverse slicing: a single exceptional null +set for all planar tests, obtained using the separable L2 value/derivative graph, +not an invalid interchange of an uncountable intersection with almost-everywhere. -/ +open Set Filter MeasureTheory +open scoped Topology ENNReal + +variable {T E F : Type*} [MeasurableSpace T] {μ : Measure T} + [TopologicalSpace E] [SecondCountableTopology E] + [TopologicalSpace F] [T2Space F] [Zero F] + +lemma ae_all_on_of_continuous (s : Set E) (f : T → E → F) + (hc : ∀ᵐ t ∂μ, Continuous (f t)) + (hz : ∀ x∈s, ∀ᵐ t ∂μ, f t x=0) : + ∀ᵐ t ∂μ, ∀ x∈s, f t x=0 := by + obtain ⟨d,hd,hdd⟩ := TopologicalSpace.exists_countable_dense s + have hz' : ∀ᵐ t ∂μ, ∀ x∈d, f t (x:E)=0 := by + rw [ae_ball_iff hd] + exact fun x _ => hz x x.property + filter_upwards [hc,hz'] with t hct hzt + have hs : closure d ⊆ {x : s | f t x=0} := + closure_minimal hzt (isClosed_eq (hct.comp continuous_subtype_val) continuous_const) + intro x hx + exact hs (hdd ⟨x,hx⟩) + +variable {A B G : Type*} [MeasurableSpace A] [MeasurableSpace B] + [NormedAddCommGroup G] + {ν : Measure A} {κ : Measure B} [SFinite ν] [SFinite κ] + +/-- An honest L2 function on the cylinder has L2 planar slices a.e. -/ +lemma memLp_two_slices {u : A × B → G} (hu : MemLp u 2 (ν.prod κ)) : + ∀ᵐ t ∂ν, MemLp (fun z => u (t,z)) 2 κ := by + have hn := hu.integrable_norm_rpow (by norm_num) (by norm_num) + filter_upwards [hu.aestronglyMeasurable.prodMk_left,hn.prod_right_ae] with t ht hnt + exact (integrable_norm_rpow_iff ht (by norm_num : (2:ℝ≥0∞)≠0) + (by norm_num : (2:ℝ≥0∞)≠⊤)).mp hnt + +end ElasticitySlicing +namespace ElasticityGeneralSlicing +/-! Actual transverse slicing of weak planar equations. All planar tests share +one exceptional null set. No uncountable a.e. intersection is used. -/ +open Set MeasureTheory Filter +open scoped SchwartzMap ENNReal InnerProductSpace +open ElasticitySlicing +variable {P : Type*} [NormedAddCommGroup P] [InnerProductSpace ℝ P] + [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] +open ElasticityPlanar + +abbrev PL2 := Lp ℂ 2 (volume : Measure ℂ) +def sliceLp (u : P × ℂ → ℂ) (t : P) : PL2 := + by classical exact if h : MemLp (fun z => u (t,z)) 2 volume then h.toLp _ else 0 +omit [NormedAddCommGroup P] [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma sliceLp_coe {u : P × ℂ → ℂ} {t : P} + (h : MemLp (fun z => u (t,z)) 2 volume) : + (sliceLp u t : ℂ → ℂ)=ᵐ[volume] fun z => u (t,z) := by + simp only [sliceLp,dite_eq_left h] + exact h.coeFn_toLp + +def testDbar (φ : Test) : Test := d (1:ℂ) φ+Complex.I • d Complex.I φ + +def testGraph (φ : Test) : PL2 × PL2 := (L2 (cj φ),L2 (cj (testDbar φ))) + +def slicePair (u w : P × ℂ → ℂ) (t : P) (q : PL2 × PL2) : ℂ := + inner ℂ q.1 (sliceLp w t)-inner ℂ q.2 (sliceLp u t) + +omit [NormedAddCommGroup P] [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma slicePair_continuous (u w : P × ℂ → ℂ) (t : P) : + Continuous (slicePair u w t) := by + exact (continuous_fst.inner continuous_const).sub (continuous_snd.inner continuous_const) + +lemma L2_test_integral {w : ℂ → ℂ} (hw : MemLp w 2 volume) (φ : Test) : + inner ℂ (L2 (cj φ)) (hw.toLp w)=∫ z, φ z*w z := by + rw [MeasureTheory.L2.inner_def] + apply integral_congr_ae + filter_upwards [(toSchwartz (cj φ)).coeFn_toLp 2 volume,hw.coeFn_toLp] with z hz hwz + change (L2 (cj φ) : ℂ → ℂ) z=cj φ z at hz + rw [hz,hwz] + simp only [cj_apply,RCLike.inner_apply',starRingEnd_apply,star_star,mul_comm] + +omit [NormedAddCommGroup P] [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma slicePair_graph {u w : P × ℂ → ℂ} {t : P} + (hu : MemLp (fun z => u (t,z)) 2 volume) + (hw : MemLp (fun z => w (t,z)) 2 volume) (φ : Test) : + slicePair u w t (testGraph φ)= + (∫ z, φ z*w (t,z))-(∫ z, testDbar φ z*u (t,z)) := by + simp only [slicePair,testGraph,sliceLp,dite_eq_left hu,dite_eq_left hw,L2_test_integral] + +omit [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma test_mul_integrable {w : P × ℂ → ℂ} (hw : Integrable w) (φ : Test) : + Integrable (fun q : P × ℂ => φ q.2*w q) := by + apply hw.bdd_mul ((toSchwartz φ).continuous.comp continuous_snd).aestronglyMeasurable + exact Eventually.of_forall (fun q => (toSchwartz φ).norm_le_seminorm ℝ q.2) + +/-- Fubini plus the fundamental lemma first gives a null set for one test. -/ +lemma single_test_slice {u w : P × ℂ → ℂ} + (hu : Integrable u) (hw : Integrable w) (φ : Test) + (he : ∀ (η : P → ℝ), ContDiff ℝ (⊤ : ℕ∞) η → HasCompactSupport η → + (∫ q : P × ℂ, η q.1 • (φ q.2*w q-testDbar φ q.2*u q))=0) : + ∀ᵐ t : P, ∫ z : ℂ, φ z*w (t,z)-testDbar φ z*u (t,z)=0 := by + have hi := (test_mul_integrable hw φ).sub (test_mul_integrable hu (testDbar φ)) + apply ae_eq_zero_of_integral_contDiff_smul_eq_zero hi.integral_prod_left.locallyIntegrable + intro η hη hcη + obtain ⟨C,hC⟩ := (hcη.isCompact_range hη.continuous).isBounded.exists_norm_le + have hηi : Integrable (fun q : P × ℂ => η q.1 • + (φ q.2*w q-testDbar φ q.2*u q)) := + hi.bdd_smul C (hη.continuous.comp continuous_fst).aestronglyMeasurable + (Eventually.of_forall (fun q => hC (η q.1) (mem_range_self q.1))) + have hh := he η hη hcη + change (∫ q : P × ℂ, η q.1 • (φ q.2*w q-testDbar φ q.2*u q) + ∂(volume : Measure P).prod (volume : Measure ℂ))=0 at hh + rw [integral_prod _ hηi] at hh + simpa only [integral_smul,Pi.sub_apply] using hh + +/-- The weak cylinder equation genuinely determines the planar weak equation +on a single full-measure subset of transverse parameters. -/ +theorem weak_slice_from_product_tests {u w : P × ℂ → ℂ} + (hu : Integrable u) (hw : Integrable w) + (hu2 : MemLp u 2 volume) (hw2 : MemLp w 2 volume) + (he : ∀ (η : P → ℝ), ContDiff ℝ (⊤ : ℕ∞) η → HasCompactSupport η → + ∀ φ : Test, (∫ q : P × ℂ, + η q.1 • (φ q.2*w q-testDbar φ q.2*u q))=0) : + ∀ᵐ t : P, MemLp (fun z => u (t,z)) 2 volume ∧ + MemLp (fun z => w (t,z)) 2 volume ∧ + ∀ φ : Test, (∫ z, φ z*w (t,z))=(∫ z, testDbar φ z*u (t,z)) := by + have : Fact ((2 : ℝ≥0∞)≠⊤) := ⟨by norm_num⟩ + have hu' := memLp_two_slices (ν := (volume : Measure P)) (κ := (volume : Measure ℂ)) hu2 + have hw' := memLp_two_slices (ν := (volume : Measure P)) (κ := (volume : Measure ℂ)) hw2 + have hg : ∀ q∈range testGraph, ∀ᵐ t : P, slicePair u w t q=0 := by + rintro q ⟨φ,rfl⟩ + have hzero := single_test_slice hu hw φ (fun η hη hcη => he η hη hcη φ) + filter_upwards [hu',hw',hzero,(test_mul_integrable hw φ).prod_right_ae, + (test_mul_integrable hu (testDbar φ)).prod_right_ae] with t hut hwt hzt h1 h2 + rw [slicePair_graph hut hwt,← integral_sub h1 h2] + exact hzt + have hcount := ae_all_on_of_continuous (range testGraph) (slicePair u w) + (Eventually.of_forall (slicePair_continuous u w)) hg + filter_upwards [hu',hw',hcount] with t hut hwt ht + refine ⟨hut,hwt,fun φ => ?_⟩ + exact sub_eq_zero.mp ((slicePair_graph hut hwt φ).symm.trans (ht _ (mem_range_self φ))) + +end ElasticityGeneralSlicing +namespace ElasticityGeneralSlicing +open Set MeasureTheory TemperedDistribution +open scoped SchwartzMap ENNReal LineDeriv +open ElasticitySlicing +variable {P : Type*} [NormedAddCommGroup P] [InnerProductSpace ℝ P] + [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] +open ElasticityPlanar + +instance cylinder_temperate : (volume : Measure (P × ℂ)).HasTemperateGrowth := by + change ((volume : Measure P).prod (volume : Measure ℂ)).HasTemperateGrowth + infer_instance + +omit [InnerProductSpace ℝ P] [FiniteDimensional ℝ P] + [MeasureSpace P] [BorelSpace P] [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma compact_product_test (η : P → ℝ) (hcη : HasCompactSupport η) (φ : Test) : + HasCompactSupport (fun q : P × ℂ => (η q.1 : ℂ)*φ q.2) := by + apply HasCompactSupport.intro (hcη.prod (compact φ)) + intro q hq + by_cases ht : q.1∈tsupport η + · have hz : q.2∉tsupport (φ : ℂ → ℂ) := fun hz => hq ⟨ht,hz⟩ + rw [image_eq_zero_of_notMem_tsupport hz,mul_zero] + · rw [image_eq_zero_of_notMem_tsupport ht,Complex.ofReal_zero,zero_mul] + +def productTest (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (φ : Test) : 𝓢(P × ℂ,ℂ) := + (compact_product_test η hcη φ).toSchwartzMap + ((Complex.ofRealCLM.contDiff.comp (hη.comp contDiff_fst)).mul + ((smooth φ).comp contDiff_snd)) + +omit [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma productTest_apply (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (φ : Test) (q : P × ℂ) : + productTest η hη hcη φ q=(η q.1 : ℂ)*φ q.2 := rfl + +omit [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma productTest_deriv (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (φ : Test) (v : ℂ) : + ∂_{((0:P),v)} (productTest η hη hcη φ)=productTest η hη hcη (d v φ) := by + ext q + change fderiv ℝ (fun q : P × ℂ => (η q.1 : ℂ)*φ q.2) q (0,v)= + (η q.1 : ℂ)*fderiv ℝ (φ : ℂ → ℂ) q.2 v + have hηd := (Complex.ofRealCLM.contDiff.comp hη).differentiable (by simp) + have hφd := (smooth φ).differentiable (by simp) + have ha : DifferentiableAt ℝ (fun q : P × ℂ => (η q.1 : ℂ)) q := + (hηd.comp differentiable_fst) q + have hb : DifferentiableAt ℝ (fun q : P × ℂ => φ q.2) q := + (hφd.comp differentiable_snd) q + rw [fderiv_fun_mul ha hb] + have hfa := fderiv_comp q (hηd q.1) (differentiableAt_fst (p := q)) + have hfb := fderiv_comp q (hφd q.2) (differentiableAt_snd (p := q)) + change fderiv ℝ (fun q : P × ℂ => (η q.1 : ℂ)) q = _ at hfa + change fderiv ℝ (fun q : P × ℂ => φ q.2) q = _ at hfb + rw [hfa,hfb] + simp [fderiv_fst,fderiv_snd,smul_eq_mul] + +omit [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma productTest_add (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (φ ψ : Test) : + productTest η hη hcη (φ+ψ)=productTest η hη hcη φ+productTest η hη hcη ψ := by + ext q + change (η q.1 : ℂ)*(φ q.2+ψ q.2)=_ + exact mul_add _ _ _ +omit [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma productTest_smul (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (c : ℂ) (φ : Test) : + productTest η hη hcη (c • φ)=c • productTest η hη hcη φ := by + ext q + change (η q.1 : ℂ)*(c*φ q.2)=c*((η q.1 : ℂ)*φ q.2) + ring +omit [FiniteDimensional ℝ P] [MeasureSpace P] [BorelSpace P] + [Measure.IsAddHaarMeasure (volume : Measure P)] in +lemma productTest_dbar (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) + (hcη : HasCompactSupport η) (φ : Test) : + ∂_{((0:P),(1:ℂ))} (productTest η hη hcη φ)+ + Complex.I • ∂_{((0:P),Complex.I)} (productTest η hη hcη φ)= + productTest η hη hcη (testDbar φ) := by + simp only [testDbar,productTest_add,productTest_smul,productTest_deriv] + +/-- The product-test premise of slicing is not an axiom: it follows from the +actual distributional cylinder equation by an exact directional derivative. -/ +theorem cylinder_product_tests (u w : Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : Integrable (u : P × ℂ → ℂ)) (hw : Integrable (w : P × ℂ → ℂ)) + (he : ∂_{((0:P),(1:ℂ))} (u : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u : 𝓢'(P × ℂ,ℂ))+(w : 𝓢'(P × ℂ,ℂ))=0) + (η : P → ℝ) (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hcη : HasCompactSupport η) (φ : Test) : + (∫ q : P × ℂ, η q.1 • (φ q.2*w q-testDbar φ q.2*u q))=0 := by + have hh := congrArg (fun D : 𝓢'(P × ℂ,ℂ) => D (productTest η hη hcη φ)) he + have htest : (w : 𝓢'(P × ℂ,ℂ)) (productTest η hη hcη φ)= + (u : 𝓢'(P × ℂ,ℂ)) (productTest η hη hcη (testDbar φ)) := by + rw [← productTest_dbar] + simp only [add_apply,smul_apply,TemperedDistribution.lineDerivOp_apply_apply, + map_neg,zero_apply,smul_eq_mul] at hh + simp only [map_add,map_smul,smul_eq_mul] + linear_combination hh + simp only [Lp.toTemperedDistribution_apply,productTest_apply,smul_eq_mul] at htest + obtain ⟨C,hC⟩ := (hcη.isCompact_range hη.continuous).isBounded.exists_norm_le + have hi (f : P × ℂ → ℂ) (hf : Integrable f) (ψ : Test) : + Integrable (fun q : P × ℂ => (η q.1 : ℂ)*(ψ q.2*f q)) := by + apply (test_mul_integrable hf ψ).bdd_mul (c := C) + (Complex.continuous_ofReal.comp (hη.continuous.comp continuous_fst)).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun q => by simpa only [Function.comp_apply,Complex.norm_real] using hC (η q.1) (mem_range_self q.1)) + have hrew : (fun q : P × ℂ => η q.1 • (φ q.2*w q-testDbar φ q.2*u q))= + (fun q => (η q.1 : ℂ)*(φ q.2*w q))-(fun q => (η q.1 : ℂ)*(testDbar φ q.2*u q)) := by + funext q + simp only [Pi.sub_apply,Complex.real_smul,mul_sub] + rw [hrew] + change (∫ q : P × ℂ, (η q.1 : ℂ)*(φ q.2*w q)-(η q.1 : ℂ)*(testDbar φ q.2*u q))=0 + rw [integral_sub (hi w hw φ) (hi u hu (testDbar φ)),sub_eq_zero] + simpa only [mul_assoc] using htest + +/-- Actual weak distribution solutions on the cylinder slice to planar +solutions for every compact smooth test on one full-measure parameter set. -/ +theorem cylinder_weak_slices (u w : Lp ℂ 2 (volume : Measure (P × ℂ))) + (hu : Integrable (u : P × ℂ → ℂ)) (hw : Integrable (w : P × ℂ → ℂ)) + (he : ∂_{((0:P),(1:ℂ))} (u : 𝓢'(P × ℂ,ℂ))+ + Complex.I • ∂_{((0:P),Complex.I)} (u : 𝓢'(P × ℂ,ℂ))+(w : 𝓢'(P × ℂ,ℂ))=0) : + ∀ᵐ t : P, MemLp (fun z => u (t,z)) 2 volume ∧ + MemLp (fun z => w (t,z)) 2 volume ∧ + ∀ φ : Test, (∫ z, φ z*w (t,z))=(∫ z, testDbar φ z*u (t,z)) := + weak_slice_from_product_tests hu hw (Lp.memLp u) (Lp.memLp w) + (cylinder_product_tests u w hu hw he) + +end ElasticityGeneralSlicing + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Elasticity/WeakSolutions.lean b/lean/OAI/MathematicalPhysics/Elasticity/WeakSolutions.lean new file mode 100644 index 0000000000000000000000000000000000000000..db3fc02eb5d0ffad534478408440c195bd2ce1ab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Elasticity/WeakSolutions.lean @@ -0,0 +1,702 @@ +import OAI.MathematicalPhysics.Elasticity.Restriction +import OAI.MathematicalPhysics.Elasticity.LocalRegularity + +namespace OAI + +section +noncomputable section +open MeasureTheory SchwartzMap Set TemperedDistribution +open scoped SchwartzMap LineDeriv +namespace Elasticity +variable {Ω : Set X} +abbrev realTest (g : SchwartzMap X ℝ) : SchwartzMap X ℂ := g.postcompCLM Complex.ofRealCLM +abbrev reTest (g : SchwartzMap X ℂ) : SchwartzMap X ℝ := g.postcompCLM Complex.reCLM +abbrev imTest (g : SchwartzMap X ℂ) : SchwartzMap X ℝ := g.postcompCLM Complex.imCLM +lemma realTest_d (g : SchwartzMap X ℝ) (j : Fin 3) : + ∂_{coordVector j} (realTest g)=realTest (ElasticityKorn.d (coordVector j) g) := by + ext x + change fderiv ℝ ((Complex.ofRealCLM : ℝ → ℂ) ∘ (g : X → ℝ)) x (coordVector j)= + Complex.ofRealCLM (fderiv ℝ (g : X → ℝ) x (coordVector j)) + rw [((Complex.ofRealCLM.hasFDerivAt (x := g x)).comp x + (g.differentiableAt (x := x)).hasFDerivAt).fderiv] + rfl +lemma test_parts (g : SchwartzMap X ℂ) : g=realTest (reTest g)+Complex.I • realTest (imTest g) := by + ext x + change g x=↑((g x).re)+Complex.I*↑((g x).im) + exact (Complex.re_add_im (g x)).symm.trans (by ring) +def scalarDistribution (Ω : Set X) : ScalarL2 Ω →L[ℝ] ElasticityDistribution.Dist := + ((Lp.toTemperedDistributionCLM ℂ (volume.restrict Ω) 2).restrictScalars ℝ).comp + (Complex.ofRealCLM.compLpL 2 (volume.restrict Ω)) +lemma scalarDistribution_real (f : ScalarL2 Ω) (g : SchwartzMap X ℝ) : + scalarDistribution Ω f (realTest g)=↑(inner ℝ f (schwartzR Ω g)) := by + have hi : Integrable (fun x => g x*f x) (volume.restrict Ω) := by + apply (L2.integrable_inner (𝕜 := ℝ) f (schwartzR Ω g)).congr + filter_upwards [g.coeFn_toLp 2 (volume.restrict Ω)] with x hx + change inner ℝ (f x) (g.toLp 2 (volume.restrict Ω) x)=_ + rw [hx] + rfl + have hpair : inner ℝ f (schwartzR Ω g)=∫ x, g x*f x ∂(volume.restrict Ω) := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [g.coeFn_toLp 2 (volume.restrict Ω)] with x hx + change inner ℝ (f x) (g.toLp 2 (volume.restrict Ω) x)=_ + rw [hx] + rfl + change Lp.toTemperedDistribution (Complex.ofRealCLM.compLpL 2 (volume.restrict Ω) f) (realTest g)=_ + rw [Lp.toTemperedDistribution_apply,hpair] + calc + _ = ∫ x, Complex.ofRealCLM (g x*f x) ∂(volume.restrict Ω) := by + apply integral_congr_ae + filter_upwards [ContinuousLinearMap.coeFn_compLpL Complex.ofRealCLM f] with x hx + rw [hx] + change (g x : ℂ)*(f x : ℂ)=↑(g x*f x) + exact (Complex.ofReal_mul _ _).symm + _ = _ := Complex.ofRealCLM.integral_comp_comm hi +lemma localEq_of_realTest {U V : ElasticityDistribution.Dist} + (h : ∀ (g : SchwartzMap X ℝ), HasCompactSupport (g : X → ℝ) → tsupport (g : X → ℝ)⊆Ω → + U (realTest g)=V (realTest g)) : ElasticityDistribution.LocalEq Ω U V := by + intro φ hc hs + have hrc : HasCompactSupport (reTest φ : X → ℝ) := hc.comp_left (g := Complex.re) rfl + have hic : HasCompactSupport (imTest φ : X → ℝ) := hc.comp_left (g := Complex.im) rfl + have hrs : tsupport (reTest φ : X → ℝ)⊆Ω := (tsupport_comp_subset (g := Complex.re) rfl (φ : X → ℂ)).trans hs + have his : tsupport (imTest φ : X → ℝ)⊆Ω := (tsupport_comp_subset (g := Complex.im) rfl (φ : X → ℂ)).trans hs + conv_lhs => rw [test_parts φ] + conv_rhs => rw [test_parts φ] + rw [map_add,map_add,map_smul,map_smul,h (reTest φ) hrc hrs,h (imTest φ) hic his] +def h1Distribution (u : H1 Ω) (i : Fin 3) : ElasticityDistribution.Dist := + scalarDistribution Ω (ambientScalar Ω none i u.val) +def h1GradientDistribution (u : H1 Ω) (i j : Fin 3) : ElasticityDistribution.Dist := + scalarDistribution Ω (ambientScalar Ω (some j) i u.val) +/-- Actual distributional identification of every H1 gradient. -/ +theorem h1_distribution_derivative (u : H1 Ω) (i j : Fin 3) : + ElasticityDistribution.LocalEq Ω (ElasticityDistribution.dd j (h1Distribution u i)) + (h1GradientDistribution u i j) := by + apply localEq_of_realTest + intro g hc hs + change (∂_{coordVector j} (h1Distribution u i)) (realTest g)=_ + rw [lineDerivOp_apply_apply,realTest_d,map_neg] + change -scalarDistribution Ω (ambientScalar Ω none i u.val) (realTest (ElasticityKorn.d (coordVector j) g))= + scalarDistribution Ω (ambientScalar Ω (some j) i u.val) (realTest g) + rw [scalarDistribution_real,scalarDistribution_real,h1_weak_derivative u g hc hs i j, + Complex.ofReal_neg,neg_neg] +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +variable {Ω : Set X} {lam mu : X → ℝ} +def stressFun (lam mu : X → ℝ) (u : Ambient Ω) (i j : Fin 3) (x : X) : ℝ := + (if i=j then lam x*(∑ k, u.2 k x k) else 0)+mu x*(u.2 j x i+u.2 i x j) +lemma stress_memLp (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) : MemLp (stressFun lam mu u i j) 2 (volume.restrict Ω) := by + have hd : MemLp (fun x => ∑ k, u.2 k x k) 2 (volume.restrict Ω) := + memLp_finsetSum _ (fun k _ => entry_memLp u k k) + have hs := hm.mul_memLp_fun ((entry_memLp u i j).add (entry_memLp u j i)) + change MemLp (fun x => (if i=j then lam x*(∑ k, u.2 k x k) else 0)+mu x*(u.2 j x i+u.2 i x j)) 2 (volume.restrict Ω) + by_cases he : i=j + · subst j + simp only [ite_true] + exact (hl.mul_memLp_fun hd).add hs + · simp only [he,ite_false,zero_add] + exact hs + def stressL2 (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) : ScalarL2 Ω := (stress_memLp hl hm u i j).toLp _ +lemma stressL2_ae (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) : stressL2 hl hm u i j =ᵐ[volume.restrict Ω] stressFun lam mu u i j := + (stress_memLp hl hm u i j).coeFn_toLp +lemma stress_pair (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) (g : SchwartzMap X ℝ) : + inner ℝ (stressL2 hl hm u i j) (schwartzR Ω g)= + ∫ x, stressFun lam mu u i j x*g x ∂(volume.restrict Ω) := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [stressL2_ae hl hm u i j,g.coeFn_toLp 2 (volume.restrict Ω)] with x hx hy + change inner ℝ (stressL2 hl hm u i j x) (g.toLp 2 (volume.restrict Ω) x)=_ + rw [hx,hy,real_inner_comm] + rfl +lemma stress_pair_integrable (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) (g : SchwartzMap X ℝ) : + Integrable (fun x => stressFun lam mu u i j x*g x) (volume.restrict Ω) := + (stress_memLp hl hm u i j).integrable_mul (g.memLp 2 (volume.restrict Ω)) +lemma density_stress (a b : ℝ) (u : Fin 3 → V) (v : Fin 3 → ℝ) (i : Fin 3) : + elasticDensity a b u (fun j => v j • coordVector i)= + ∑ j, ((if i=j then a*(∑ k, u k k) else 0)+b*(u j i+u i j))*v j := by + rw [density_single] + simp only [add_mul,Finset.sum_add_distrib,ite_mul,zero_mul] + simp only [Finset.sum_ite_eq,Finset.mem_univ,ite_true] + simp only [Finset.mul_sum,mul_add,add_mul,Finset.sum_add_distrib,mul_assoc] +lemma energy_test_stress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1 Ω) (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : + energy Ω lam mu u (testH1 g hc hs i)= + ∑ j, inner ℝ (stressL2 hl hm u.val i j) (schwartzR Ω (ElasticityKorn.d (coordVector j) g)) := by + simp only [stress_pair] + rw [← integral_finsetSum _ (fun j _ => stress_pair_integrable hl hm u.val i j _)] + change (∫ x, elasticDensity (lam x) (mu x) (gradient u.val x) (gradient (testH1 g hc hs i).val x) ∂(volume.restrict Ω))=_ + apply integral_congr_ae + filter_upwards [testH1_gradient g hc hs i] with x hx + rw [hx,density_stress] + rfl +/-- The variational equation yields the actual scalar-test stress equation. -/ +theorem weakSolution_stress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1 Ω) (hu : WeakSolution Ω lam mu u) (g : SchwartzMap X ℝ) + (hc : HasCompactSupport (g : X → ℝ)) (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : + (∑ j, inner ℝ (stressL2 hl hm u.val i j) (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))=0 := by + rw [← energy_test_stress hl hm u g hc hs i] + exact hu _ (testH1_zeroTrace g hc hs i) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} {lam mu : X → ℝ} +lemma scalarDistribution_apply (f : ScalarL2 Ω) (g : SchwartzMap X ℂ) : + scalarDistribution Ω f g=∫ x, g x*(f x : ℂ) ∂(volume.restrict Ω) := by + change Lp.toTemperedDistribution (Complex.ofRealCLM.compLpL 2 (volume.restrict Ω) f) g=_ + rw [Lp.toTemperedDistribution_apply] + apply integral_congr_ae + filter_upwards [ContinuousLinearMap.coeFn_compLpL Complex.ofRealCLM f] with x hx + rw [hx] + rfl +lemma scalarDistribution_mulL {a : X → ℝ} (ha : BoundedCoefficient Ω a) + (c : Coeff) (hc : ∀ᵐ x ∂(volume.restrict Ω), eval c x=(a x : ℂ)) (f : ScalarL2 Ω) : + scalarDistribution Ω (ha.mulL f)=c • scalarDistribution Ω f := by + ext g + rw [coeff_test,scalarDistribution_apply,scalarDistribution_apply] + apply integral_congr_ae + filter_upwards [ha.mulL_ae f,hc] with x hx hy + rw [hx] + rw [ElasticityNegativeOrder.mult_apply _ (growth c),hy,Complex.ofReal_mul] + ring +lemma stressL2_eq (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : Ambient Ω) (i j : Fin 3) : stressL2 hl hm u i j= + (if i=j then hl.mulL (∑ k, ambientScalar Ω (some k) k u) else 0)+ + hm.mulL (ambientScalar Ω (some j) i u+ambientScalar Ω (some i) j u) := by + have hdiv : (∑ k, ambientScalar Ω (some k) k u : ScalarL2 Ω) =ᵐ[volume.restrict Ω] + fun x => ∑ k, u.2 k x k := by + have hs := lp_sum_ae Finset.univ (fun k => ambientScalar Ω (some k) k u) + have he : ∀ᵐ x ∂(volume.restrict Ω), ∀ k, ambientScalar Ω (some k) k u x=u.2 k x k := + Filter.eventually_all.mpr (fun k => ambientScalar_ae u (some k) k) + filter_upwards [hs,he] with x hx hy + exact hx.trans (Finset.sum_congr rfl (fun k _ => hy k)) + have hs : (ambientScalar Ω (some j) i u+ambientScalar Ω (some i) j u : ScalarL2 Ω) + =ᵐ[volume.restrict Ω] fun x => u.2 j x i+u.2 i x j := by + filter_upwards [Lp.coeFn_add (ambientScalar Ω (some j) i u) (ambientScalar Ω (some i) j u), + ambientScalar_ae u (some j) i,ambientScalar_ae u (some i) j] with x hx hy hz + exact hx.trans (congrArg₂ (·+·) hy hz) + apply Lp.ext + by_cases he : i=j + · simp only [he,ite_true] at * + filter_upwards [stressL2_ae hl hm u j j, hdiv,hs, + hl.mulL_ae (∑ k, ambientScalar Ω (some k) k u), + hm.mulL_ae (ambientScalar Ω (some j) j u+ambientScalar Ω (some j) j u), + Lp.coeFn_add (hl.mulL (∑ k, ambientScalar Ω (some k) k u)) + (hm.mulL (ambientScalar Ω (some j) j u+ambientScalar Ω (some j) j u))] with x hx hd hs hl hm ha + rw [hx,ha] + simp only [Pi.add_apply,hl,hm,hd,hs,stressFun,ite_true] + · simp only [he,ite_false,zero_add] + filter_upwards [stressL2_ae hl hm u i j,hs, + hm.mulL_ae (ambientScalar Ω (some j) i u+ambientScalar Ω (some i) j u)] with x hx hs hm + rw [hx,hm,hs] + simp only [stressFun,he,ite_false,zero_add] +lemma stress_distribution (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) + (u : H1 Ω) (i j : Fin 3) : scalarDistribution Ω (stressL2 hl hm u.val i j)= + (if i=j then L • (∑ k, h1GradientDistribution u k k) else 0)+ + M • (h1GradientDistribution u i j+h1GradientDistribution u j i) := by + rw [stressL2_eq,map_add,scalarDistribution_mulL hm M hM,map_add] + simp only [h1GradientDistribution] + congr 1 + split_ifs + · rw [scalarDistribution_mulL hl L hL,map_sum] + · exact map_zero _ +/-- The physical stress of a genuine weak solution has zero distributional divergence. -/ +theorem weak_stress_divergence (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1 Ω) (hu : WeakSolution Ω lam mu u) (i : Fin 3) : + LocalEq Ω (∑ j, dd j (scalarDistribution Ω (stressL2 hl hm u.val i j))) 0 := by + apply localEq_of_realTest + intro g hc hs + simp only [sum_apply,dd_apply,lineDerivOp_apply_apply,map_neg] + change (∑ j, -scalarDistribution Ω (stressL2 hl hm u.val i j) (∂_{coordVector j} (realTest g)))=0 + simp only [realTest_d,scalarDistribution_real,← Complex.ofReal_neg,← Complex.ofReal_sum,Finset.sum_neg_distrib] + rw [weakSolution_stress hl hm u hu g hc hs i,neg_zero,Complex.ofReal_zero] +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set +open scoped BigOperators +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} {lam mu : X → ℝ} +lemma dist_sd_zero (j : Fin 3) (v : Dist) : sd (0 : Fin 3 → ℂ) j v=dd j v := by + rw [sd_apply] + change dd j v+(0 : ℂ) • v=dd j v + rw [zero_smul ℂ v,add_zero] +lemma physical_gradient (u : H1 Ω) (L M : Coeff) (i : Fin 3) : + LocalEq Ω (phys 0 L M (h1Distribution u) i) + (dd i (L • (∑ k, h1GradientDistribution u k k))+ + ∑ j, dd j (M • (h1GradientDistribution u i j+h1GradientDistribution u j i))) := by + simp only [phys,divd,dist_sd_zero] + have hd : LocalEq Ω (∑ k, dd k (h1Distribution u k)) (∑ k, h1GradientDistribution u k k) := + LocalEq.sum Finset.univ (fun k _ => h1_distribution_derivative u k k) + have hL := (hd.coeff L).derivative i + have hM : ∀ j : Fin 3, LocalEq Ω + (dd j (M • (dd j (h1Distribution u i)+dd i (h1Distribution u j)))) + (dd j (M • (h1GradientDistribution u i j+h1GradientDistribution u j i))) := by + intro j + exact (((h1_distribution_derivative u i j).add (h1_distribution_derivative u j i)).coeff M).derivative j + exact hL.add (LocalEq.sum Finset.univ (fun j _ => hM j)) +lemma physical_stress_sum (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) + (u : H1 Ω) (i : Fin 3) : + (∑ j, dd j (scalarDistribution Ω (stressL2 hl hm u.val i j)))= + dd i (L • (∑ k, h1GradientDistribution u k k))+ + ∑ j, dd j (M • (h1GradientDistribution u i j+h1GradientDistribution u j i)) := by + simp only [stress_distribution hl hm L M hL hM,map_add,apply_ite,map_zero,Finset.sum_add_distrib] + simp +/-- Actual weak-to-distributional physical elasticity, for the closure-defined +H1 space and its variational equation. No PDE regularity hypothesis is introduced. -/ +theorem weak_physical (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) + (u : H1 Ω) (hu : WeakSolution Ω lam mu u) (i : Fin 3) : + LocalEq Ω (phys 0 L M (h1Distribution u) i) 0 := by + have hh := physical_gradient u L M i + rw [← physical_stress_sum hl hm L M hL hM u i] at hh + exact hh.trans (weak_stress_divergence hl hm u hu i) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} {lam mu : X → ℝ} +lemma density_full_stress (a b : ℝ) (P Q : Fin 3 → V) : + elasticDensity a b P Q=∑ i, ∑ j, + ((if i=j then a*(∑ k, P k k) else 0)+b*(P j i+P i j))*Q j i := by + simp [elasticDensity,Fin.sum_univ_succ] + ring +lemma energy_testJet_stress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1 Ω) (v : Ambient Ω) (hv : v∈TestJets Ω) + (ht : ∀ (g : SchwartzMap X ℝ), HasCompactSupport (g : X → ℝ) → tsupport (g : X → ℝ)⊆Ω → + ∀ i, (∑ j, inner ℝ (stressL2 hl hm u.val i j) + (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))=0) : + ambientEnergy lam mu u.val v=0 := by + obtain ⟨f,hf,hd,hsm,hc,hs,hv,hvd⟩ := hv + let F (i : Fin 3) : SchwartzMap X ℝ := + (hc.comp_left (g := fun y : V => y i) rfl).toSchwartzMap + ((EuclideanSpace.proj (𝕜 := ℝ) i).contDiff.comp hsm) + have he (i) := ht (F i) (hc.comp_left (g := fun y : V => y i) rfl) + ((scalar_test_support f i).trans hs) i + have hdv : ∀ᵐ x ∂(volume.restrict Ω), ∀ j, v.2 j x=coordDeriv f j x := by + rw [hvd] + exact Filter.eventually_all.mpr (fun j => (hd j).coeFn_toLp) + have heq : ambientEnergy lam mu u.val v=∑ i, ∑ j, + inner ℝ (stressL2 hl hm u.val i j) (schwartzR Ω (ElasticityKorn.d (coordVector j) (F i))) := by + simp only [stress_pair] + simp_rw [← integral_finsetSum _ (fun j _ => stress_pair_integrable hl hm u.val _ j _)] + rw [← integral_finsetSum _ (fun i _ => integrable_finsetSum _ + (fun j _ => stress_pair_integrable hl hm u.val i j _))] + apply integral_congr_ae + filter_upwards [hdv] with x hx + simp only [ambientDensity,density_full_stress,stressFun,gradient] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [hx] + congr 1 + exact (coordDeriv_scalar f hsm i j x).symm + rw [heq] + simp only [he,Finset.sum_const_zero] +/-- The scalar-test stress equation is equivalent to the physical weak +formulation; the nontrivial direction uses actual density of compact test jets. -/ +theorem weakSolution_of_stress (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (u : H1 Ω) + (ht : ∀ (g : SchwartzMap X ℝ), HasCompactSupport (g : X → ℝ) → tsupport (g : X → ℝ)⊆Ω → + ∀ i, (∑ j, inner ℝ (stressL2 hl hm u.val i j) + (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))=0) : + WeakSolution Ω lam mu u := by + let E : Ambient Ω →L[ℝ] ℝ := + (jetEnergy hl hm ((h1Equiv Ω).symm u).val).comp (jetEquiv Ω).symm.toContinuousLinearMap + have hE (v : H1 Ω) : E v.val=energy Ω lam mu u v := by + have he := jetEnergy_eq_energy hl hm ((h1Equiv Ω).symm u) ((h1Equiv Ω).symm v) + simp only [Equiv.apply_symm_apply] at he + change jetEnergy hl hm ((jetEquiv Ω).symm u.val) ((jetEquiv Ω).symm v.val)=_ + exact he + have htE : MapsTo E (TestJets Ω) ({0} : Set ℝ) := by + intro v hv + let w : H1 Ω := ⟨v,h10Submodule_le Ω (subset_closure hv)⟩ + change E w.val=0 + rw [hE] + exact energy_testJet_stress hl hm u v hv ht + intro v hv + have he := htE.closure E.continuous hv + rw [closure_singleton] at he + exact (hE v).symm.trans he +/-- A genuine H1 field satisfying the actual distributional physical equation +is a genuine variational solution; no PDE interface is taken on faith. -/ +theorem weakSolution_of_physical (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) (u : H1 Ω) + (hu : ∀ i, LocalEq Ω (phys 0 L M (h1Distribution u) i) 0) : WeakSolution Ω lam mu u := by + apply weakSolution_of_stress hl hm u + intro g hc hs i + have hh := physical_gradient u L M i + rw [← physical_stress_sum hl hm L M hL hM u i] at hh + have he := hh.symm.trans (hu i) + have hgc : HasCompactSupport (realTest g : X → ℂ) := hc.comp_left (g := Complex.ofReal) rfl + have hgs : tsupport (realTest g : X → ℂ)⊆Ω := + (tsupport_comp_subset (g := Complex.ofReal) rfl (g : X → ℝ)).trans hs + have h := he (realTest g) hgc hgs + simp only [sum_apply,dd_apply,lineDerivOp_apply_apply,map_neg] at h + change (∑ j, -scalarDistribution Ω (stressL2 hl hm u.val i j) + (∂_{coordVector j} (realTest g)))=0 at h + simp only [realTest_d,scalarDistribution_real,← Complex.ofReal_neg,← Complex.ofReal_sum, + Finset.sum_neg_distrib] at h + exact neg_eq_zero.mp (Complex.ofReal_eq_zero.mp h) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} +def schwartzJet (F : SchwartzMap X V) : Ambient Ω := + (F.toLp 2 (volume.restrict Ω),fun j => (∂_{coordVector j} F).toLp 2 (volume.restrict Ω)) +lemma schwartzJet_mem (F : SchwartzMap X V) : schwartzJet (Ω := Ω) F∈SmoothJets Ω := by + refine ⟨F,F.memLp 2 (volume.restrict Ω),fun j => (∂_{coordVector j} F).memLp 2 (volume.restrict Ω),F.smooth _,?_,?_⟩ + · rfl + · rfl +def schwartzH1 (F : SchwartzMap X V) : H1 Ω := ⟨schwartzJet F,subset_closure (schwartzJet_mem F)⟩ +lemma schwartzH1_value (F : SchwartzMap X V) : + (schwartzH1 (Ω := Ω) F).val.1 =ᵐ[volume.restrict Ω] (F : X → V) := + F.coeFn_toLp 2 (volume.restrict Ω) +lemma schwartzH1_gradient (F : SchwartzMap X V) (i : Fin 3) : + (schwartzH1 (Ω := Ω) F).val.2 i =ᵐ[volume.restrict Ω] ((∂_{coordVector i} F : SchwartzMap X V) : X → V) := + (∂_{coordVector i} F).coeFn_toLp 2 (volume.restrict Ω) +def componentTest (F : SchwartzMap X V) (i : Fin 3) : SchwartzMap X ℝ := + F.postcompCLM (EuclideanSpace.proj (𝕜 := ℝ) i) +lemma schwartzH1_distribution (F : SchwartzMap X V) (i : Fin 3) : + LocalEq Ω (h1Distribution (schwartzH1 (Ω := Ω) F) i) ((realTest (componentTest F i)) : Dist) := by + intro φ hc hs + rw [h1Distribution,scalarDistribution_apply] + change (∫ x, φ x * ((ambientScalar Ω none i (schwartzH1 (Ω := Ω) F).val) x : ℂ) + ∂(volume.restrict Ω))=((realTest (componentTest F i)) : Dist) φ + have he : ((ambientScalar Ω none i (schwartzH1 (Ω := Ω) F).val) : X → ℝ) =ᵐ[volume.restrict Ω] + fun x => F x i := by + filter_upwards [ambientScalar_ae (schwartzH1 (Ω := Ω) F).val none i,schwartzH1_value (Ω := Ω) F] with x hx hy + exact hx.trans (congrArg (fun y : V => y i) hy) + calc + _ = ∫ x, φ x*(F x i : ℂ) ∂(volume.restrict Ω) := by + apply integral_congr_ae + filter_upwards [he] with x hx + rw [hx] + _ = ∫ x, φ x*(F x i : ℂ) := by + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro x hx + rw [image_eq_zero_of_notMem_tsupport (f := (φ : X → ℂ)) (fun h => hx (hs h)),zero_mul] + _ = _ := rfl +/-- A classical real displacement gives the concrete variational H1 field, +with its actual derivatives and physical equation. -/ +theorem schwartzH1_weak {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) (F : SchwartzMap X V) + (he : ∀ i, LocalEq Ω (phys 0 L M (fun i => ((realTest (componentTest F i)) : Dist)) i) 0) : + WeakSolution Ω lam mu (schwartzH1 (Ω := Ω) F) := by + apply weakSolution_of_physical hl hm L M hL hM + intro i + exact (LocalEq.physical (schwartzH1_distribution F) 0 L M i).trans (he i) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace ElasticityDistribution +lemma phys_add (z : Fin 3 → ℂ) (L M : Coeff) (u v : Fin 3 → Dist) (i : Fin 3) : + phys z L M (u+v) i=phys z L M u i+phys z L M v i := by + have ha (A : Coeff) (v w : Dist) : A • (v+w)=A • v+A • w := smul_add A v w + simp only [phys,divd,Pi.add_apply,map_add,Finset.sum_add_distrib,ha] + abel +lemma phys_smul (z : Fin 3 → ℂ) (L M : Coeff) (c : ℂ) (u : Fin 3 → Dist) (i : Fin 3) : + phys z L M (c • u) i=c • phys z L M u i := by + have hc (A : Coeff) (v : Dist) : A • (c • v)=c • (A • v) := (smul_comm c A v).symm + have ha (v w : Dist) : c • v+c • w=c • (v+w) := (smul_add c v w).symm + simp only [phys,divd,Pi.smul_apply,map_smul,← Finset.smul_sum,ha,hc] +end ElasticityDistribution +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} {lam mu : X → ℝ} +lemma physical_realTest (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) + (u : H1 Ω) (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : + phys 0 L M (h1Distribution u) i (realTest g)= + ↑(-(∑ j, inner ℝ (stressL2 hl hm u.val i j) + (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))) := by + have hh := physical_gradient u L M i + rw [← physical_stress_sum hl hm L M hL hM u i] at hh + have hgc : HasCompactSupport (realTest g : X → ℂ) := hc.comp_left (g := Complex.ofReal) rfl + have hgs : tsupport (realTest g : X → ℂ)⊆Ω := + (tsupport_comp_subset (g := Complex.ofReal) rfl (g : X → ℝ)).trans hs + rw [hh (realTest g) hgc hgs] + simp only [sum_apply,dd_apply,lineDerivOp_apply_apply,map_neg] + change (∑ j, -scalarDistribution Ω (stressL2 hl hm u.val i j) + (∂_{coordVector j} (realTest g)))=_ + simp only [realTest_d,scalarDistribution_real,← Complex.ofReal_neg,← Complex.ofReal_sum, + Finset.sum_neg_distrib] +/-- Real and imaginary parts of a physical H1 solution solve the original real +variational problems. This is derived from the actual distribution equation. -/ +theorem weakSolution_parts (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) (u v : H1 Ω) + (he : ∀ i, LocalEq Ω (phys 0 L M (h1Distribution u+Complex.I • h1Distribution v) i) 0) : + WeakSolution Ω lam mu u ∧ WeakSolution Ω lam mu v := by + have ht (g : SchwartzMap X ℝ) (hc : HasCompactSupport (g : X → ℝ)) + (hs : tsupport (g : X → ℝ)⊆Ω) (i : Fin 3) : + (∑ j, inner ℝ (stressL2 hl hm u.val i j) (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))=0 ∧ + (∑ j, inner ℝ (stressL2 hl hm v.val i j) (schwartzR Ω (ElasticityKorn.d (coordVector j) g)))=0 := by + have hgc : HasCompactSupport (realTest g : X → ℂ) := hc.comp_left (g := Complex.ofReal) rfl + have hgs : tsupport (realTest g : X → ℂ)⊆Ω := + (tsupport_comp_subset (g := Complex.ofReal) rfl (g : X → ℝ)).trans hs + have h := he i (realTest g) hgc hgs + rw [phys_add,phys_smul] at h + simp only [add_apply,smul_apply,smul_eq_mul,physical_realTest hl hm L M hL hM _ g hc hs i] at h + have hr := congrArg Complex.re h + have hi := congrArg Complex.im h + simp only [Complex.add_re,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,zero_mul,one_mul,sub_zero,add_zero] at hr + simp only [Complex.add_im,Complex.mul_im,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,zero_mul,one_mul,zero_add] at hi + exact ⟨neg_eq_zero.mp hr,neg_eq_zero.mp hi⟩ + exact ⟨weakSolution_of_stress hl hm u (fun g hc hs i => (ht g hc hs i).1), + weakSolution_of_stress hl hm v (fun g hc hs i => (ht g hc hs i).2)⟩ +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} +def realVectorTest (F : Fin 3 → SchwartzMap X ℝ) : SchwartzMap X V := + ∑ i, (F i).postcompCLM (ContinuousLinearMap.toSpanSingleton ℝ (coordVector i)) +lemma realVectorTest_apply (F : Fin 3 → SchwartzMap X ℝ) (x : X) (i : Fin 3) : + realVectorTest F x i=F i x := by + simp [realVectorTest,coordVector,Pi.single_apply] +lemma component_realVectorTest (F : Fin 3 → SchwartzMap X ℝ) (i : Fin 3) : + componentTest (realVectorTest F) i=F i := by + ext x + exact realVectorTest_apply F x i +def complexRealH1 (F : Fin 3 → SchwartzMap X ℂ) : H1 Ω := + schwartzH1 (realVectorTest (fun i => reTest (F i))) +def complexImagH1 (F : Fin 3 → SchwartzMap X ℂ) : H1 Ω := + schwartzH1 (realVectorTest (fun i => imTest (F i))) +lemma complexH1_value (F : Fin 3 → SchwartzMap X ℂ) (i : Fin 3) : + ∀ᵐ x ∂(volume.restrict Ω), + ((complexRealH1 (Ω := Ω) F).val.1 x i : ℂ)+Complex.I*((complexImagH1 (Ω := Ω) F).val.1 x i : ℂ)=F i x := by + filter_upwards [schwartzH1_value (Ω := Ω) (realVectorTest (fun i => reTest (F i))), + schwartzH1_value (Ω := Ω) (realVectorTest (fun i => imTest (F i)))] with x hr hi + change ((schwartzH1 (Ω := Ω) _).val.1 x i : ℂ)+Complex.I*((schwartzH1 (Ω := Ω) _).val.1 x i : ℂ)=_ + rw [hr,hi,realVectorTest_apply,realVectorTest_apply] + change ↑((F i x).re)+Complex.I*↑((F i x).im)=_ + exact (by rw [mul_comm]; exact Complex.re_add_im (F i x)) +lemma complexH1_distribution (F : Fin 3 → SchwartzMap X ℂ) (i : Fin 3) : + LocalEq Ω (h1Distribution (complexRealH1 (Ω := Ω) F) i+ + Complex.I • h1Distribution (complexImagH1 (Ω := Ω) F) i) ((F i) : Dist) := by + have hr := schwartzH1_distribution (Ω := Ω) (realVectorTest (fun i => reTest (F i))) i + have hi := schwartzH1_distribution (Ω := Ω) (realVectorTest (fun i => imTest (F i))) i + rw [component_realVectorTest] at hr hi + have he := hr.add (hi.smul Complex.I) + rw [← coe_schwartz_smul,← coe_schwartz_add, + ← test_parts (F i)] at he + exact he +lemma localEq_of_schwartz_eqOn {F G : SchwartzMap X ℂ} (h : Set.EqOn (F : X → ℂ) G Ω) : + LocalEq Ω (F : Dist) (G : Dist) := by + intro φ _ hs + change (∫ x, φ x*F x)=(∫ x, φ x*G x) + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun x => by + change φ x*F x=φ x*G x + by_cases hx : x∈Ω + · rw [h hx] + · rw [image_eq_zero_of_notMem_tsupport (f := (φ : X → ℂ)) (fun hg => hx (hs hg)),zero_mul,zero_mul]) +/-- A classical complex physical field embeds into the literal real DN problem +through its two actual H1 parts, rather than a presumed complex boundary map. -/ +theorem complexH1_weak {lam mu : X → ℝ} (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M : Coeff) (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) (F : Fin 3 → SchwartzMap X ℂ) + (he : ∀ i, Set.EqOn (ElasticityPhysicalAlgebra.physical 0 (eval L) (eval M) F i : X → ℂ) 0 Ω) : + WeakSolution Ω lam mu (complexRealH1 (Ω := Ω) F) ∧ + WeakSolution Ω lam mu (complexImagH1 (Ω := Ω) F) := by + apply weakSolution_parts hl hm L M hL hM + intro i + have hp := LocalEq.physical (complexH1_distribution (Ω := Ω) F) 0 L M i + rw [phys_schwartz] at hp + have hh := localEq_of_schwartz_eqOn (F := ElasticityPhysicalAlgebra.physical 0 (eval L) (eval M) F i) + (G := 0) (he i) + simpa only [map_zero,Pi.add_def,Pi.smul_def] using hp.trans hh +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set TemperedDistribution +open scoped BigOperators SchwartzMap +namespace Elasticity +open ElasticityDistribution +variable {Ω : Set X} {lam mu : X → ℝ} +def scalarGlobal (hs : MeasurableSet Ω) (f : ScalarL2 Ω) : Lp ℂ 2 (volume : Measure X) := + lpZeroExtendCLM volume Ω hs (Complex.ofRealCLM.compLpL 2 (volume.restrict Ω) f) +lemma scalarGlobal_ae (hs : MeasurableSet Ω) (f : ScalarL2 Ω) : + (scalarGlobal hs f : X → ℂ)=ᵐ[volume] Ω.indicator (fun x => (f x : ℂ)) := by + filter_upwards [lpZeroExtend_coe volume Ω hs (Complex.ofRealCLM.compLpL 2 (volume.restrict Ω) f), + (ae_restrict_iff' hs).mp (ContinuousLinearMap.coeFn_compLpL Complex.ofRealCLM f)] with x hx hy + rw [scalarGlobal,hx] + by_cases he : x∈Ω + · simp only [indicator_of_mem he,hy he] + rfl + · simp only [indicator_of_notMem he] +lemma scalarGlobal_distribution (hs : MeasurableSet Ω) (f : ScalarL2 Ω) : + (scalarGlobal hs f : Dist)=scalarDistribution Ω f := by + ext g + rw [Lp.toTemperedDistribution_apply,scalarDistribution_apply] + calc + _ = ∫ x, Ω.indicator (fun y => g y*(f y : ℂ)) x ∂volume := by + apply integral_congr_ae + filter_upwards [scalarGlobal_ae hs f] with x hx + rw [hx] + by_cases he : x∈Ω + · simp only [indicator_of_mem he,smul_eq_mul] + · simp only [indicator_of_notMem he,smul_zero] + _ = _ := integral_indicator hs + def h1Global (hs : MeasurableSet Ω) (u : H1 Ω) : ElasticityPhysicalDual.H := + WithLp.toLp 2 (fun i => scalarGlobal hs (ambientScalar Ω none i u.val)) +lemma h1Global_distribution (hs : MeasurableSet Ω) (u : H1 Ω) (i : Fin 3) : + (h1Global hs u i : Dist)=h1Distribution u i := scalarGlobal_distribution hs _ +lemma h1Global_ae (hs : MeasurableSet Ω) (u : H1 Ω) (i : Fin 3) : + ∀ᵐ x ∂volume, x∈Ω → h1Global hs u i x=(u.val.1 x i : ℂ) := by + filter_upwards [scalarGlobal_ae hs (ambientScalar Ω none i u.val), + (ae_restrict_iff' hs).mp (ambientScalar_ae u.val none i)] with x hx hy + intro he + change scalarGlobal hs (ambientScalar Ω none i u.val) x=_ + rw [hx,indicator_of_mem he,hy he] + rfl +/-- Interior regularization now applies to the genuine variational solution, +not a hypothetical distribution satisfying an assumed physical equation. -/ +theorem h1_classical_representative (hΩ : IsOpen Ω) {Ω' : Set X} (hΩ' : IsOpen Ω') (hsub : Ω'⊆Ω) + (hl : BoundedCoefficient Ω lam) (hm : BoundedCoefficient Ω mu) + (L M N O : Coeff) (hN : N*M=1) (hO : O*(L+M+M)=1) + (hL : ∀ᵐ x ∂(volume.restrict Ω), eval L x=(lam x : ℂ)) + (hM : ∀ᵐ x ∂(volume.restrict Ω), eval M x=(mu x : ℂ)) + (u : H1 Ω) (hu : WeakSolution Ω lam mu u) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆Ω) (h1 : Set.EqOn g 1 Ω') : + ∃ v : Fin 3 → SchwartzMap X ℂ, + (∀ i, ∀ᵐ x ∂volume, x∈Ω' → (u.val.1 x i : ℂ)=v i x) ∧ + ∀ i, Set.EqOn (ElasticityPhysicalAlgebra.physical 0 (eval L) (eval M) v i : X → ℂ) 0 Ω' := by + have he : ∀ i, LocalEq Ω (phys 0 L M (fun j => (h1Global hΩ.measurableSet u j : Dist)) i) + ((0 : SchwartzMap X ℂ) : Dist) := by + intro i + simp only [h1Global_distribution,map_zero] + exact weak_physical hl hm L M hL hM u hu i + obtain ⟨v,hv,hve⟩ := classical_representative hΩ' hsub 0 L M N O hN hO + (h1Global hΩ.measurableSet u) (fun _ => 0) he hg hc hs h1 + refine ⟨v,fun i => ?_,hve⟩ + filter_upwards [hv i,h1Global_ae hΩ.measurableSet u i] with x hx hy + intro he + exact (hy (hsub he)).symm.trans (hx he) +end Elasticity + +end +end +section +noncomputable section +open MeasureTheory Set SchwartzMap TemperedDistribution +open scoped BigOperators SchwartzMap LineDeriv +namespace Elasticity +open ElasticityDistribution +variable {Ω B B' : Set X} {lam₁ mu₁ lam₂ mu₂ : X → ℝ} +/-- Actual smooth complex physical transfer on an interior ball, from the +original real variational DN equality. No augmented/artificial DN map is used. -/ +theorem physical_classical_transfer + (ha₁ : Admissible Ω lam₁ mu₁) (ha₂ : Admissible Ω lam₂ mu₂) + (hΩ : IsOpen Ω) (hOB : Bornology.IsBounded Ω) (hΩB : Ω⊆B) + (hB : IsOpen B) (hB' : IsOpen B') (hsub : B'⊆B) + (hl₁ : BoundedCoefficient B lam₁) (hm₁ : BoundedCoefficient B mu₁) + (hl₂ : BoundedCoefficient B lam₂) (hm₂ : BoundedCoefficient B mu₂) + (he : ∀ x∉Ω, lam₁ x=lam₂ x ∧ mu₁ x=mu₂ x) + (hDN : DN Ω lam₁ mu₁=DN Ω lam₂ mu₂) + (L₁ M₁ L₂ M₂ N₂ O₂ : Coeff) (hN : N₂*M₂=1) (hO : O₂*(L₂+M₂+M₂)=1) + (hL₁ : ∀ᵐ x ∂(volume.restrict B), eval L₁ x=(lam₁ x : ℂ)) + (hM₁ : ∀ᵐ x ∂(volume.restrict B), eval M₁ x=(mu₁ x : ℂ)) + (hL₂ : ∀ᵐ x ∂(volume.restrict B), eval L₂ x=(lam₂ x : ℂ)) + (hM₂ : ∀ᵐ x ∂(volume.restrict B), eval M₂ x=(mu₂ x : ℂ)) + {g : X → ℂ} (hg : ContDiff ℝ (⊤ : ℕ∞) g) (hc : HasCompactSupport g) + (hs : tsupport g⊆B) (h1 : Set.EqOn g 1 B') (F : Fin 3 → SchwartzMap X ℂ) + (hF : ∀ i, Set.EqOn (ElasticityPhysicalAlgebra.physical 0 (eval L₁) (eval M₁) F i : X → ℂ) 0 B) : + ∃ G : Fin 3 → SchwartzMap X ℂ, + (∀ i, Set.EqOn (ElasticityPhysicalAlgebra.physical 0 (eval L₂) (eval M₂) G i : X → ℂ) 0 B') ∧ + ∀ i, Set.EqOn (G i : X → ℂ) (F i) (B'\closure Ω) := by + obtain ⟨hr,hi⟩ := complexH1_weak hl₁ hm₁ L₁ M₁ hL₁ hM₁ F hF + obtain ⟨wr,hwr,hre,_⟩ := physical_weak_transfer ha₁ ha₂ hΩ hOB hΩB hl₁ hm₁ hl₂ hm₂ he hDN hr + obtain ⟨wi,hwi,hie,_⟩ := physical_weak_transfer ha₁ ha₂ hΩ hOB hΩB hl₁ hm₁ hl₂ hm₂ he hDN hi + obtain ⟨R,hR,hRp⟩ := h1_classical_representative hB hB' hsub hl₂ hm₂ L₂ M₂ N₂ O₂ hN hO hL₂ hM₂ wr hwr hg hc hs h1 + obtain ⟨I,hI,hIp⟩ := h1_classical_representative hB hB' hsub hl₂ hm₂ L₂ M₂ N₂ O₂ hN hO hL₂ hM₂ wi hwi hg hc hs h1 + let G : Fin 3 → SchwartzMap X ℂ := R+Complex.I • I + refine ⟨G,?_,?_⟩ + · intro i x hx + change ElasticityPhysicalAlgebra.physical 0 (eval L₂) (eval M₂) (R+Complex.I • I) i x=0 + rw [ElasticityPhysicalDual.physical_add,ElasticityPhysicalDual.physical_smul] + change ElasticityPhysicalAlgebra.physical 0 (eval L₂) (eval M₂) R i x+ + Complex.I*ElasticityPhysicalAlgebra.physical 0 (eval L₂) (eval M₂) I i x=0 + simp only [hRp i hx,hIp i hx,Pi.zero_apply,mul_zero,add_zero] + · intro i + apply Measure.eqOn_open_of_ae_eq (μ := (volume : Measure X)) _ (hB'.sdiff isClosed_closure) + (G i).continuous.continuousOn (F i).continuous.continuousOn + apply (ae_restrict_iff' (hB'.measurableSet.diff isClosed_closure.measurableSet)).mpr + have hre' := (ae_restrict_iff' hB.measurableSet).mp hre + have hie' := (ae_restrict_iff' hB.measurableSet).mp hie + have hFv := (ae_restrict_iff' hB.measurableSet).mp (complexH1_value (Ω := B) F i) + filter_upwards [hR i,hI i,hre',hie',hFv] with x hRx hIx hrx hix hFx hx + have hxB := hsub hx.1 + have hxo : x∉Ω := fun hh => hx.2 (subset_closure hh) + change R i x+Complex.I*I i x=F i x + rw [← hRx hx.1,← hIx hx.1,hrx hxB hxo,hix hxB hxo] + exact hFx hxB +end Elasticity + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Fock/Beam.lean b/lean/OAI/MathematicalPhysics/Fock/Beam.lean new file mode 100644 index 0000000000000000000000000000000000000000..ceb8c80ce33afb62a509fde7387094cf56cfe54a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Fock/Beam.lean @@ -0,0 +1,941 @@ +import OAI.InformationTheory.PhotonNumber.Basic + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial + +namespace FischerBeam +variable {J : Type*} [Fintype J] [DecidableEq J] + + +def weight (m : J →₀ ℕ) : ℝ := ∏ j, (m j).factorial + + + +def pairing : MvPolynomial J ℝ →ₗ[ℝ] MvPolynomial J ℝ →ₗ[ℝ] ℝ := + (basisMonomials J ℝ).constr ℝ (fun m => weight m • lcoeff ℝ m) + +omit [DecidableEq J] in +@[simp] theorem pairing_monomial (m : J →₀ ℕ) (a : ℝ) (q : MvPolynomial J ℝ) : + pairing (monomial m a) q = a * weight m * q.coeff m := by + have hm : monomial m a = a • (basisMonomials J ℝ) m := by + simp [coe_basisMonomials, smul_monomial] + have hb : pairing ((basisMonomials J ℝ) m) = weight m • lcoeff ℝ m := + (basisMonomials J ℝ).constr_basis ℝ _ m + rw [hm, map_smul, LinearMap.smul_apply, hb] + simp only [LinearMap.smul_apply, lcoeff_apply, smul_eq_mul] + ring + +omit [DecidableEq J] in +@[simp] theorem weight_zero : weight (0 : J →₀ ℕ) = 1 := by simp [weight] + +omit [DecidableEq J] in +@[simp] theorem pairing_one (p : MvPolynomial J ℝ) : + pairing 1 p = constantCoeff p := by + change pairing (monomial 0 1) p = p.coeff 0 + rw [pairing_monomial, weight_zero, one_mul, one_mul] + + +theorem weight_add_single (m : J →₀ ℕ) (i : J) : + weight (m + Finsupp.single i 1) = ((m i : ℝ)+1) * weight m := by + unfold weight + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i), + ← Finset.mul_prod_erase _ (fun j => ((m j).factorial : ℝ)) (Finset.mem_univ i)] + have he : (∏ j ∈ Finset.univ.erase i, ((m+(Finsupp.single i 1 : J →₀ ℕ)) j).factorial : ℝ) = + ∏ j ∈ Finset.univ.erase i, ((m j).factorial : ℝ) := by + apply Finset.prod_congr rfl + intro j hj + simp [Finsupp.single_eq_of_ne (Finset.ne_of_mem_erase hj)] + rw [he] + simp [Nat.factorial_succ, mul_assoc] + + +theorem pairing_X_left (i : J) (p q : MvPolynomial J ℝ) : + pairing (X i*p) q = pairing p (pderiv i q) := by + induction p using MvPolynomial.induction_on' with + | add p r hp hr => simp [mul_add, hp, hr] + | monomial m a => + rw [X, monomial_mul_monomial, one_mul, add_comm, pairing_monomial, pairing_monomial, + coeff_pderiv, weight_add_single] + ring + + +theorem pairing_comm (p q : MvPolynomial J ℝ) : pairing p q = pairing q p := by + induction p using MvPolynomial.induction_on' with + | add p r hp hr => simp [hp, hr] + | monomial m a => + induction q using MvPolynomial.induction_on' with + | add q r hq hr => simp only [map_add, LinearMap.add_apply, hq, hr] + | monomial n b => + simp only [pairing_monomial, coeff_monomial] + by_cases h : m = n + · subst n; simp; ring + · simp [h, Ne.symm h] + +abbrev Poly := MvPolynomial (Fin 2) ℝ + +def creatorA (c s : ℝ) : Poly := c • X 0 - s • X 1 + +def creatorB (c s : ℝ) : Poly := s • X 0 + c • X 1 + +def derivA (c s : ℝ) : Derivation ℝ Poly Poly := c • pderiv 0 - s • pderiv 1 + +def derivB (c s : ℝ) : Derivation ℝ Poly Poly := s • pderiv 0 + c • pderiv 1 + +@[simp] theorem derivA_creatorA {c s : ℝ} (h : c^2+s^2=1) : + derivA c s (creatorA c s) = 1 := by + simp only [derivA, creatorA, Derivation.sub_apply, Derivation.smul_apply, map_sub, + Derivation.map_smul, pderiv_X_self, pderiv_X_of_ne (by decide : (1:Fin 2)≠0), + pderiv_X_of_ne (by decide : (0:Fin 2)≠1), smul_zero, sub_zero, zero_sub, + smul_neg, smul_smul, sub_neg_eq_add, ← add_smul] + rw [← pow_two, ← pow_two, h, one_smul] + +@[simp] theorem derivA_creatorB (c s : ℝ) : derivA c s (creatorB c s) = 0 := by + simp [derivA, creatorB, Derivation.map_smul, smul_smul, mul_comm] + +@[simp] theorem derivB_creatorA (c s : ℝ) : derivB c s (creatorA c s) = 0 := by + simp [derivB, creatorA, Derivation.map_smul, smul_smul, mul_comm] + +@[simp] theorem derivB_creatorB {c s : ℝ} (h : c^2+s^2=1) : + derivB c s (creatorB c s) = 1 := by + simp only [derivB, creatorB, Derivation.add_apply, Derivation.smul_apply, map_add, + Derivation.map_smul, pderiv_X_self, pderiv_X_of_ne (by decide : (1:Fin 2)≠0), + pderiv_X_of_ne (by decide : (0:Fin 2)≠1), smul_zero, add_zero, zero_add, + smul_smul, ← add_smul] + rw [← pow_two, ← pow_two, add_comm, h, one_smul] + + +theorem pairing_creatorA (c s : ℝ) (p q : Poly) : + pairing (creatorA c s*p) q = pairing p (derivA c s q) := by + simp [creatorA, derivA, sub_mul, pairing_X_left] + +theorem pairing_creatorB (c s : ℝ) (p q : Poly) : + pairing (creatorB c s*p) q = pairing p (derivB c s q) := by + simp [creatorB, derivB, add_mul, pairing_X_left] + + +def rotated (c s : ℝ) (a b : ℕ) : Poly := creatorA c s^a * creatorB c s^b + +@[simp] theorem derivA_rotated {c s : ℝ} (h : c^2+s^2=1) (a b : ℕ) : + derivA c s (rotated c s a b) = a • rotated c s (a-1) b := by + simp [rotated, Derivation.leibniz, Derivation.leibniz_pow, derivA_creatorA h, + smul_eq_mul] + ring + +@[simp] theorem derivB_rotated {c s : ℝ} (h : c^2+s^2=1) (a b : ℕ) : + derivB c s (rotated c s a b) = b • rotated c s a (b-1) := by + simp [rotated, Derivation.leibniz, Derivation.leibniz_pow, derivB_creatorB h, + smul_eq_mul] + ring + +@[simp] theorem constantCoeff_rotated (c s : ℝ) (a b : ℕ) : + constantCoeff (rotated c s a b) = if a = 0 ∧ b = 0 then 1 else 0 := by + simp [rotated, creatorA, creatorB, zero_pow_eq] + split_ifs <;> simp_all + + + +theorem pairing_rotated {c s : ℝ} (h : c^2+s^2=1) (a b u v : ℕ) : + pairing (rotated c s a b) (rotated c s u v) = + if a = u ∧ b = v then (a.factorial : ℝ)*b.factorial else 0 := by + induction a generalizing b u v with + | zero => + induction b generalizing u v with + | zero => + rw [show rotated c s 0 0 = 1 by simp [rotated], pairing_one, constantCoeff_rotated] + simp [eq_comm] + | succ b ih => + have hr : rotated c s 0 (b+1) = creatorB c s * rotated c s 0 b := by + simp [rotated, pow_succ'] + rw [hr, pairing_creatorB, derivB_rotated h, map_nsmul] + cases v with + | zero => simp + | succ v => + simp only [Nat.add_one_sub_one, nsmul_eq_mul, ih] + by_cases he : u = 0 ∧ b = v + · obtain ⟨rfl, rfl⟩ := he + simp [Nat.factorial_succ] + · simp [he, eq_comm] + | succ a ih => + have hr : rotated c s (a+1) b = creatorA c s * rotated c s a b := by + simp [rotated, pow_succ', mul_assoc] + rw [hr, pairing_creatorA, derivA_rotated h, map_nsmul] + cases u with + | zero => simp + | succ u => + simp only [Nat.add_one_sub_one, nsmul_eq_mul, ih] + by_cases he : a = u ∧ b = v + · obtain ⟨rfl, rfl⟩ := he + simp [Nat.factorial_succ] + ring + · simp [he] + +end FischerBeam + +namespace FischerBeam + + + +def degree (a b : ℕ) : Fin 2 →₀ ℕ := Finsupp.single 0 a + Finsupp.single 1 b + +@[simp] theorem degree_zero (a b : ℕ) : degree a b 0 = a := by simp [degree] +@[simp] theorem degree_one (a b : ℕ) : degree a b 1 = b := by simp [degree] + +@[simp] theorem degree_eq_iff (a b u v : ℕ) : degree a b = degree u v ↔ a=u ∧ b=v := by + constructor + · intro h + exact ⟨by simpa using congrArg (fun f => f 0) h, + by simpa using congrArg (fun f => f 1) h⟩ + · rintro ⟨rfl, rfl⟩; rfl + +@[simp] theorem degree_add (a b u v : ℕ) : degree a b + degree u v = degree (a+u) (b+v) := by + ext j + fin_cases j <;> simp [degree] + +@[simp] theorem weight_degree (a b : ℕ) : weight (degree a b) = (a.factorial : ℝ)*b.factorial := by + simp [weight, Fin.prod_univ_two] + + +theorem linear_power (c s : ℝ) (a : ℕ) : + (c • (X 0 : Poly)+s • X 1)^a = + ∑ p ∈ Finset.range (a+1), monomial (degree p (a-p)) + ((a.choose p : ℝ)*c^p*s^(a-p)) := by + rw [add_pow] + apply Finset.sum_congr rfl + intro p _ + rw [smul_pow, smul_pow, X_pow_eq_monomial, X_pow_eq_monomial, + smul_monomial, smul_monomial] + simp only [smul_eq_mul, mul_one] + rw [monomial_mul_monomial] + rw [show (a.choose p : Poly) = C (a.choose p : ℝ) by simp] + rw [mul_comm _ (C _), C_mul_monomial] + simp only [degree, mul_assoc] + + +theorem rotated_expansion (c s : ℝ) (a b : ℕ) : + rotated c s a b = + ∑ p ∈ Finset.range (a+1), ∑ q ∈ Finset.range (b+1), + monomial (degree (p+q) ((a-p)+(b-q))) + ((a.choose p : ℝ)*b.choose q*c^p*(-s)^(a-p)*s^q*c^(b-q)) := by + have ha : creatorA c s = c • (X 0 : Poly) + (-s) • X 1 := by simp [creatorA, sub_eq_add_neg] + rw [rotated, ha, creatorB, linear_power, linear_power, Finset.sum_mul] + apply Finset.sum_congr rfl + intro p _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro q _ + rw [monomial_mul_monomial, degree_add] + congr 1 + ring + + +theorem coeff_rotated (c s : ℝ) (k e a b : ℕ) : + (rotated c s a b).coeff (degree k e) = + if k+e=a+b then + ∑ p ∈ Finset.range (a+1), ∑ q ∈ Finset.range (b+1), + if p+q=k then (a.choose p : ℝ)*b.choose q*c^p*(-s)^(a-p)*s^q*c^(b-q) else 0 + else 0 := by + rw [rotated_expansion] + simp only [coeff_sum, coeff_monomial, degree_eq_iff] + by_cases ht : k+e=a+b + · rw [ite_eq_left ht] + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro q hq + have hp' := Finset.mem_range.mp hp + have hq' := Finset.mem_range.mp hq + have he : p+q=k ∧ a-p+(b-q)=e ↔ p+q=k := by omega + simp only [he] + · rw [ite_eq_right ht] + apply Finset.sum_eq_zero + intro p hp + apply Finset.sum_eq_zero + intro q hq + have hp' := Finset.mem_range.mp hp + have hq' := Finset.mem_range.mp hq + rw [ite_eq_right (by omega)] + +end FischerBeam + +namespace FischerBeam + +@[simp] theorem degree_coordinates (m : Fin 2 →₀ ℕ) : degree (m 0) (m 1) = m := by + ext j + fin_cases j <;> simp + + +theorem sector_reconstruction (P : Poly) (T : ℕ) + (hP : ∀ k e, k+e ≠ T → P.coeff (degree k e) = 0) : + P = ∑ k : Fin (T+1), monomial (degree k (T-k)) (P.coeff (degree k (T-k))) := by + ext m + obtain ⟨k, e, rfl⟩ : ∃ k e, m = degree k e := ⟨m 0, m 1, (degree_coordinates m).symm⟩ + simp only [coeff_sum, coeff_monomial, degree_eq_iff] + by_cases ht : k+e=T + · have hk : k < T+1 := by omega + rw [Finset.sum_eq_single ⟨k,hk⟩] + · simp [show T-k=e by omega] + · intro j _ hj + have hj' : j.val ≠ k := by exact fun he => hj (Fin.ext he) + simp [hj'] + · simp + · rw [hP k e ht] + symm + apply Finset.sum_eq_zero + intro j _ + by_cases he : j.val=k ∧ T-j.val=e + · have hj := j.isLt + omega + · simp [he] + + +theorem rotated_sector (c s : ℝ) (a b : ℕ) : + rotated c s a b = ∑ k : Fin (a+b+1), + monomial (degree k (a+b-k)) ((rotated c s a b).coeff (degree k (a+b-k))) := by + apply sector_reconstruction + intro k e h + rw [coeff_rotated, ite_eq_right h] + + +theorem pairing_rotated_coefficients (c s : ℝ) (a b : ℕ) (Q : Poly) : + pairing (rotated c s a b) Q = + ∑ k : Fin (a+b+1), weight (degree k (a+b-k)) * + (rotated c s a b).coeff (degree k (a+b-k)) * Q.coeff (degree k (a+b-k)) := by + conv_lhs => arg 1; rw [rotated_sector c s a b] + simp only [map_sum, LinearMap.sum_apply, pairing_monomial] + apply Finset.sum_congr rfl + intro k _ + ring + + +def sectorMatrix (c s : ℝ) (T : ℕ) : Matrix (Fin (T+1)) (Fin (T+1)) ℝ := + fun k a => Real.sqrt (weight (degree k (T-k))) / + Real.sqrt (weight (degree a (T-a))) * + (rotated c s a (T-a)).coeff (degree k (T-k)) + +@[simp] theorem sqrt_weight_degree_pos (a b : ℕ) : 0 < Real.sqrt (weight (degree a b)) := by + rw [weight_degree] + positivity + + + +theorem sectorMatrix_columns {c s : ℝ} (h : c^2+s^2=1) (T : ℕ) + (a b : Fin (T+1)) : + ∑ k, sectorMatrix c s T k a * sectorMatrix c s T k b = if a=b then 1 else 0 := by + have ha : a.val + (T-a.val) = T := Nat.add_sub_of_le (by omega : a.val ≤ T) + have hp : pairing (rotated c s a (T-a)) (rotated c s b (T-b)) = + ∑ k : Fin (T+1), weight (degree k (T-k)) * + (rotated c s a (T-a)).coeff (degree k (T-k)) * + (rotated c s b (T-b)).coeff (degree k (T-k)) := by + have hrec := sector_reconstruction (rotated c s a (T-a)) T (by + intro k e hne + rw [coeff_rotated, ite_eq_right (by omega)]) + conv_lhs => arg 1; rw [hrec] + simp only [map_sum, LinearMap.sum_apply, pairing_monomial] + apply Finset.sum_congr rfl + intro k _ + ring + have ho := pairing_rotated h a (T-a) b (T-b) + have he : (a.val=b.val ∧ T-a.val=T-b.val) ↔ a=b := by + constructor + · exact fun he => Fin.ext he.1 + · rintro rfl; exact ⟨rfl,rfl⟩ + simp only [he] at ho + have hsa := (sqrt_weight_degree_pos a (T-a)).ne' + have hsb := (sqrt_weight_degree_pos b (T-b)).ne' + calc + (∑ k, sectorMatrix c s T k a * sectorMatrix c s T k b) = + (∑ k : Fin (T+1), weight (degree k (T-k)) * + (rotated c s a (T-a)).coeff (degree k (T-k)) * + (rotated c s b (T-b)).coeff (degree k (T-k))) / + (Real.sqrt (weight (degree a (T-a)))*Real.sqrt (weight (degree b (T-b)))) := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro k _ + have hw : 0 ≤ weight (degree k (T-k)) := by rw [weight_degree]; positivity + dsimp only [sectorMatrix] + field_simp + rw [Real.sq_sqrt hw] + ring + _ = if a=b then 1 else 0 := by + rw [← hp, ho] + by_cases heq : a=b + · subst b + rw [ite_eq_left rfl, ite_eq_left rfl, ← pow_two, Real.sq_sqrt (by rw [weight_degree]; positivity), weight_degree] + exact div_self (by positivity) + · rw [ite_eq_right heq, ite_eq_right heq, zero_div] + +end FischerBeam + +namespace FischerBeam + + +theorem sectorMatrix_rows {c s : ℝ} (h : c^2+s^2=1) (T : ℕ) + (k l : Fin (T+1)) : + ∑ a, sectorMatrix c s T k a * sectorMatrix c s T l a = if k=l then 1 else 0 := by + have hc : (sectorMatrix c s T).transpose * sectorMatrix c s T = 1 := by + ext a b + simpa only [Matrix.mul_apply, Matrix.transpose_apply, Matrix.one_apply] using + sectorMatrix_columns h T a b + have hr := mul_eq_one_comm.mp hc + simpa only [Matrix.mul_apply, Matrix.transpose_apply, Matrix.one_apply] using + congrArg (fun M => M k l) hr + + +def multiSectorMatrix {n : ℕ} (c s : ℝ) (T : Fin n → ℕ) : + Matrix (∀ j, Fin (T j+1)) (∀ j, Fin (T j+1)) ℝ := + fun k a => ∏ j, sectorMatrix c s (T j) (k j) (a j) + +theorem multiSectorMatrix_columns {n : ℕ} {c s : ℝ} (h : c^2+s^2=1) + (T : Fin n → ℕ) (a b : ∀ j, Fin (T j+1)) : + ∑ k, multiSectorMatrix c s T k a * multiSectorMatrix c s T k b = + if a=b then 1 else 0 := by + classical + simp only [multiSectorMatrix, ← Finset.prod_mul_distrib] + rw [← Fintype.prod_sum (fun (j : Fin n) (u : Fin (T j+1)) => + sectorMatrix c s (T j) u (a j) * sectorMatrix c s (T j) u (b j))] + simp only [sectorMatrix_columns h] + by_cases hab : a=b + · subst b + simp + · rw [ite_eq_right hab] + obtain ⟨j,hj⟩ := Function.ne_iff.mp hab + exact Finset.prod_eq_zero (Finset.mem_univ j) (ite_eq_right hj) + +theorem multiSectorMatrix_rows {n : ℕ} {c s : ℝ} (h : c^2+s^2=1) + (T : Fin n → ℕ) (k l : ∀ j, Fin (T j+1)) : + ∑ a, multiSectorMatrix c s T k a * multiSectorMatrix c s T l a = + if k=l then 1 else 0 := by + have hc : (multiSectorMatrix c s T).transpose * multiSectorMatrix c s T = 1 := by + ext a b + simpa only [Matrix.mul_apply, Matrix.transpose_apply, Matrix.one_apply] using + multiSectorMatrix_columns h T a b + have hr := mul_eq_one_comm.mp hc + simpa only [Matrix.mul_apply, Matrix.transpose_apply, Matrix.one_apply] using + congrArg (fun M => M k l) hr + +end FischerBeam + +end + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate +open scoped BigOperators ComplexConjugate +open scoped BigOperators +open MvPolynomial +open scoped BigOperators ComplexConjugate Classical +open Submodule + +namespace BlockUnitary + +variable {S : Type*} {I : S → Type*} [∀ s, Fintype (I s)] +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +def rotated (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) (i : Sigma I) : E := + ∑ k, (U i.1 k i.2 : ℂ) • b ⟨i.1,k⟩ + +theorem inner_rotated_same (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) (s : S) (a d : I s) : + inner ℂ (rotated b U ⟨s,a⟩) (rotated b U ⟨s,d⟩) = + ((∑ k, U s k a * U s k d : ℝ) : ℂ) := by + classical + simp only [rotated, inner_sum, sum_inner, inner_smul_right, inner_smul_left, + orthonormal_iff_ite.mp b.orthonormal, Complex.conj_ofReal] + simp [mul_comm] + +theorem inner_rotated_ne (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) {s t : S} (hst : s ≠ t) + (a : I s) (d : I t) : + inner ℂ (rotated b U ⟨s,a⟩) (rotated b U ⟨t,d⟩) = 0 := by + classical + simp only [rotated, inner_sum, sum_inner, inner_smul_right, inner_smul_left, + orthonormal_iff_ite.mp b.orthonormal] + have he (k : I s) (l : I t) : (Sigma.mk s k : Sigma I) ≠ ⟨t,l⟩ := by + intro h + exact hst (congrArg Sigma.fst h) + simp [he] + +theorem rotated_orthonormal (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hU : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) : + Orthonormal ℂ (rotated b U) := by + classical + rw [orthonormal_iff_ite] + rintro ⟨s,a⟩ ⟨t,d⟩ + by_cases hst : s=t + · subst t + rw [inner_rotated_same, hU] + by_cases had : a=d <;> simp [had] + · rw [inner_rotated_ne b U hst] + simp [show (Sigma.mk s a : Sigma I) ≠ ⟨t,d⟩ from + fun he => hst (congrArg Sigma.fst he)] + +theorem inner_basis_rotated_same (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) (s : S) (k a : I s) : + inner ℂ (b ⟨s,k⟩) (rotated b U ⟨s,a⟩) = (U s k a : ℂ) := by + classical + simp [rotated, orthonormal_iff_ite.mp b.orthonormal] + +theorem inner_basis_rotated_ne (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) {s t : S} (hst : s ≠ t) + (k : I s) (a : I t) : + inner ℂ (b ⟨s,k⟩) (rotated b U ⟨t,a⟩) = 0 := by + classical + have he (l : I t) : (Sigma.mk s k : Sigma I) ≠ ⟨t,l⟩ := by + exact fun h => hst (congrArg Sigma.fst h) + simp [rotated, orthonormal_iff_ite.mp b.orthonormal, he] + +theorem inverse_expansion (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hU : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) + (s : S) (k : I s) : + b ⟨s,k⟩ = ∑ a, (U s k a : ℂ) • rotated b U ⟨s,a⟩ := by + classical + apply b.repr.injective + apply lp.ext + funext i + rcases i with ⟨t,l⟩ + simp only [b.repr_apply_apply, inner_sum, inner_smul_right] + by_cases hts : t=s + · subst t + simp only [inner_basis_rotated_same, orthonormal_iff_ite.mp b.orthonormal] + simp only [← Complex.ofReal_mul, ← Complex.ofReal_sum, hU] + by_cases hlk : l=k + · subst k; simp + · simp [hlk, Ne.symm hlk] + · have he : (Sigma.mk t l : Sigma I) ≠ ⟨s,k⟩ := + fun he => hts (congrArg Sigma.fst he) + simp [inner_basis_rotated_ne b U hts, orthonormal_iff_ite.mp b.orthonormal, he] + +theorem rotated_dense (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hU : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) : + ⊤ ≤ (span ℂ (Set.range (rotated b U))).topologicalClosure := by + rw [← b.dense_span] + apply Submodule.topologicalClosure_mono + apply Submodule.span_le.mpr + rintro _ ⟨⟨s,k⟩,rfl⟩ + rw [inverse_expansion b U hU s k] + exact Submodule.sum_mem _ (fun a _ => Submodule.smul_mem _ _ + (Submodule.subset_span ⟨⟨s,a⟩,rfl⟩)) + +variable [CompleteSpace E] + +def basis (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) : + HilbertBasis (Sigma I) ℂ E := + HilbertBasis.mk (rotated_orthonormal b U hcol) (rotated_dense b U hrow) + +@[simp] theorem basis_apply (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) + (i : Sigma I) : basis b U hcol hrow i = rotated b U i := by + simp [basis] + + +def unitary (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) : + E ≃ₗᵢ[ℂ] E := b.repr.trans (basis b U hcol hrow).repr.symm + +@[simp] theorem unitary_apply_basis (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) + (i : Sigma I) : unitary b U hcol hrow (b i) = rotated b U i := by + change (basis b U hcol hrow).repr.symm (b.repr (b i)) = _ + rw [b.repr_self, HilbertBasis.repr_symm_single, basis_apply] + +end BlockUnitary + +namespace BlockUnitary +variable {S : Type*} {I : S → Type*} [∀ s, Fintype (I s)] +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + + +def reindex {ι κ : Type*} (b : HilbertBasis ι ℂ E) (e : κ ≃ ι) : HilbertBasis κ ℂ E := + HilbertBasis.mk (b.orthonormal.comp e e.injective) (by + have hr : Set.range (b ∘ e) = Set.range b := by + ext x + constructor + · rintro ⟨i,rfl⟩; exact ⟨e i,rfl⟩ + · rintro ⟨i,rfl⟩; exact ⟨e.symm i,by simp⟩ + rw [hr, b.dense_span]) + +@[simp] theorem reindex_apply {ι κ : Type*} (b : HilbertBasis ι ℂ E) (e : κ ≃ ι) + (k : κ) : reindex b e k = b (e k) := by simp [reindex] + +theorem unitary_symm_apply_basis (b : HilbertBasis (Sigma I) ℂ E) + (U : ∀ s, I s → I s → ℝ) + (hcol : ∀ s a d, ∑ k, U s k a * U s k d = if a=d then 1 else 0) + (hrow : ∀ s k l, ∑ a, U s k a * U s l a = if k=l then 1 else 0) + (s : S) (k : I s) : + (unitary b U hcol hrow).symm (b ⟨s,k⟩) = + ∑ a, (U s k a : ℂ) • b ⟨s,a⟩ := by + apply (unitary b U hcol hrow).injective + simp only [LinearIsometryEquiv.apply_symm_apply, map_sum, map_smul, unitary_apply_basis] + exact inverse_expansion b U hrow s k + +end BlockUnitary + +namespace EntropyPhotonNumber +open FischerBeam + + +theorem oneModeBeamCoefficient_eq (η : ℝ) (k e a b : ℕ) : + oneModeBeamCoefficient η k e a b = + Real.sqrt (weight (degree k e)) / Real.sqrt (weight (degree a b)) * + (rotated (Real.sqrt η) (Real.sqrt (1-η)) a b).coeff (degree k e) := by + rw [coeff_rotated] + by_cases ht : k+e=a+b + · simp only [oneModeBeamCoefficient, ite_eq_left ht, weight_degree] + rw [Real.sqrt_div (by positivity)] + · simp [oneModeBeamCoefficient, ht] + +abbrev PairedIndex (n : ℕ) := NumberIndex n × NumberIndex n +abbrev JointFock (n : ℕ) := lp (fun _ : PairedIndex n => ℂ) 2 +abbrev NumberSector (n : ℕ) := Σ T : NumberIndex n, ∀ j, Fin (T j+1) + + +def sectorEquiv (n : ℕ) : NumberSector n ≃ PairedIndex n where + toFun a := (fun j => a.2 j, fun j => a.1 j-a.2 j) + invFun x := ⟨fun j => x.1 j+x.2 j, fun j => ⟨x.1 j, by dsimp; omega⟩⟩ + left_inv := by + rintro ⟨T,a⟩ + have hT : (fun j => (a j).val + (T j-(a j).val)) = T := by + funext j + have ha := (a j).isLt + omega + apply Sigma.ext hT + apply Function.hfunext rfl + intro j j' hj + have he : j=j' := eq_of_heq hj + subst j' + apply (Fin.heq_ext_iff (congrArg (fun t : NumberIndex n => t j+1) hT)).mpr + rfl + right_inv := by + rintro ⟨a,b⟩ + ext j <;> simp + + +def jointNumberBasis (n : ℕ) : HilbertBasis (PairedIndex n) ℂ (JointFock n) := + HilbertBasis.ofRepr (LinearIsometryEquiv.refl ℂ _) + +def jointSectorBasis (n : ℕ) : HilbertBasis (NumberSector n) ℂ (JointFock n) := + BlockUnitary.reindex (jointNumberBasis n) (sectorEquiv n) + +@[simp] theorem jointNumberBasis_apply {n : ℕ} (i : PairedIndex n) : + jointNumberBasis n i = lp.single 2 i 1 := by + exact ((jointNumberBasis n).repr_symm_single i).symm + +@[simp] theorem jointSectorBasis_apply {n : ℕ} (a : NumberSector n) : + jointSectorBasis n a = lp.single 2 (sectorEquiv n a) 1 := by + simp [jointSectorBasis] + +theorem beam_sectorCoefficient {n : ℕ} (η : ℝ) (T : NumberIndex n) + (k a : ∀ j, Fin (T j+1)) : + beamCoefficient η (fun j => k j) (fun j => T j-k j) + (fun j => a j) (fun j => T j-a j) = + multiSectorMatrix (Real.sqrt η) (Real.sqrt (1-η)) T k a := by + simp only [beamCoefficient, multiSectorMatrix, oneModeBeamCoefficient_eq, sectorMatrix] + +theorem sqrt_beam_rotation {η : ℝ} (hη : η ∈ Set.Icc 0 1) : + Real.sqrt η^2 + Real.sqrt (1-η)^2 = 1 := by + rw [Real.sq_sqrt hη.1, Real.sq_sqrt (sub_nonneg.mpr hη.2)] + ring + + +def beamUnitary {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) : + JointFock n ≃ₗᵢ[ℂ] JointFock n := + BlockUnitary.unitary (jointSectorBasis n) + (multiSectorMatrix (Real.sqrt η) (Real.sqrt (1-η))) + (fun T a b => by + have h := multiSectorMatrix_columns (sqrt_beam_rotation hη) T a b + by_cases he : a=b <;> simpa [he] using h) + (fun T k l => by + have h := multiSectorMatrix_rows (sqrt_beam_rotation hη) T k l + by_cases he : k=l <;> simpa [he] using h) + +end EntropyPhotonNumber + +namespace EntropyPhotonNumber +open FischerBeam + +theorem beam_symm_sector {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (T : NumberIndex n) (k : ∀ j, Fin (T j+1)) : + (beamUnitary (n := n) η hη).symm (jointSectorBasis n ⟨T,k⟩) = + ∑ a : (∀ j, Fin (T j+1)), + (beamCoefficient η (fun j => k j) (fun j => T j-k j) + (fun j => a j) (fun j => T j-a j) : ℂ) • jointSectorBasis n ⟨T,a⟩ := by + simp only [beam_sectorCoefficient] + unfold beamUnitary + apply BlockUnitary.unitary_symm_apply_basis + + + +theorem beam_symm_number {n : ℕ} (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (k e : NumberIndex n) : + (beamUnitary (n := n) η hη).symm (lp.single 2 (k,e) 1) = + ∑ a : SectorSplit k e, + (beamCoefficient η k e (splitLeft a) (splitRight a) : ℂ) • + lp.single 2 (splitLeft a,splitRight a) 1 := by + have h := beam_symm_sector η hη (fun j => k j+e j) + (fun j => (⟨k j, by omega⟩ : Fin (k j+e j+1))) + simp only [jointSectorBasis_apply, sectorEquiv, Nat.add_sub_cancel_left, + Equiv.coe_fn_mk] at h + convert! h using 1 + +end EntropyPhotonNumber + +namespace FischerBeam +open MvPolynomial + + +theorem pderiv_zero_rotated (c s : ℝ) (a b : ℕ) : + pderiv 0 (rotated c s a b) = + (c*(a:ℝ)) • rotated c s (a-1) b + (s*(b:ℝ)) • rotated c s a (b-1) := by + simp [rotated, creatorA, creatorB, pderiv_X, smul_eq_C_mul] + ring + + +theorem pderiv_one_rotated (c s : ℝ) (a b : ℕ) : + pderiv 1 (rotated c s a b) = + (-(s*(a:ℝ))) • rotated c s (a-1) b + (c*(b:ℝ)) • rotated c s a (b-1) := by + simp [rotated, creatorA, creatorB, pderiv_X, smul_eq_C_mul] + ring + +@[simp] theorem degree_add_zero (k e : ℕ) : degree k e + Finsupp.single 0 1 = degree (k+1) e := by + ext j + fin_cases j <;> simp [degree] +@[simp] theorem degree_add_one (k e : ℕ) : degree k e + Finsupp.single 1 1 = degree k (e+1) := by + ext j + fin_cases j <;> simp [degree] + +theorem coeff_lower_zero (c s : ℝ) (k e a b : ℕ) : + ((k:ℝ)+1)*(rotated c s a b).coeff (degree (k+1) e) = + c*(a:ℝ)*(rotated c s (a-1) b).coeff (degree k e)+ + s*(b:ℝ)*(rotated c s a (b-1)).coeff (degree k e) := by + have hh := congrArg (fun polynomial : Poly => polynomial.coeff (degree k e)) + (pderiv_zero_rotated c s a b) + simpa only [coeff_pderiv, degree_zero, degree_add_zero, AddMonoidAlgebra.coeff_add, + Finsupp.add_apply, coeff_smul, + smul_eq_mul, mul_comm] using hh + +theorem coeff_lower_one (c s : ℝ) (k e a b : ℕ) : + ((e:ℝ)+1)*(rotated c s a b).coeff (degree k (e+1)) = + -(s*(a:ℝ))*(rotated c s (a-1) b).coeff (degree k e)+ + c*(b:ℝ)*(rotated c s a (b-1)).coeff (degree k e) := by + have hh := congrArg (fun polynomial : Poly => polynomial.coeff (degree k e)) + (pderiv_one_rotated c s a b) + simpa only [coeff_pderiv, degree_one, degree_add_one, AddMonoidAlgebra.coeff_add, + Finsupp.add_apply, coeff_smul, + smul_eq_mul, mul_comm] using hh + +def oscillatorCoefficient (c s : ℝ) (k e a b : ℕ) : ℝ := + Real.sqrt (weight (degree k e))/Real.sqrt (weight (degree a b))* + (rotated c s a b).coeff (degree k e) + +theorem sqrt_weight_succ_left (a b : ℕ) : + Real.sqrt (weight (degree (a+1) b)) = + Real.sqrt ((a:ℝ)+1)*Real.sqrt (weight (degree a b)) := by + simp only [weight_degree, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one] + rw [mul_assoc, Real.sqrt_mul (by positivity)] + +theorem sqrt_weight_succ_right (a b : ℕ) : + Real.sqrt (weight (degree a (b+1))) = + Real.sqrt ((b:ℝ)+1)*Real.sqrt (weight (degree a b)) := by + simp only [weight_degree, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one] + rw [show (a.factorial:ℝ)*((b+1)*b.factorial) = ((b:ℝ)+1)*(a.factorial*b.factorial) by ring] + rw [Real.sqrt_mul (by positivity)] + +theorem sqrt_lower_left (a b : ℕ) : + (a:ℝ)/Real.sqrt (weight (degree a b)) = + Real.sqrt a/Real.sqrt (weight (degree (a-1) b)) := by + cases a with + | zero => simp + | succ a => + simp only [Nat.add_one_sub_one, Nat.cast_add, Nat.cast_one, + sqrt_weight_succ_left] + have h := Real.sq_sqrt (by positivity : 0 ≤ (a:ℝ)+1) + have hp := Real.sqrt_pos.mpr (by positivity : 0 < (a:ℝ)+1) + have hw := sqrt_weight_degree_pos a b + field_simp + nlinarith + +theorem sqrt_lower_right (a b : ℕ) : + (b:ℝ)/Real.sqrt (weight (degree a b)) = + Real.sqrt b/Real.sqrt (weight (degree a (b-1))) := by + cases b with + | zero => simp + | succ b => + simp only [Nat.add_one_sub_one, Nat.cast_add, Nat.cast_one, + sqrt_weight_succ_right] + have h := Real.sq_sqrt (by positivity : 0 ≤ (b:ℝ)+1) + have hp := Real.sqrt_pos.mpr (by positivity : 0 < (b:ℝ)+1) + have hw := sqrt_weight_degree_pos a b + field_simp + nlinarith + +theorem oscillator_lower_zero (c s : ℝ) (k e a b : ℕ) : + Real.sqrt ((k:ℝ)+1)*oscillatorCoefficient c s (k+1) e a b = + c*Real.sqrt a*oscillatorCoefficient c s k e (a-1) b+ + s*Real.sqrt b*oscillatorCoefficient c s k e a (b-1) := by + unfold oscillatorCoefficient + rw [sqrt_weight_succ_left] + have hh := coeff_lower_zero c s k e a b + calc + _ = (Real.sqrt ((k:ℝ)+1))^2*(Real.sqrt (weight (degree k e))/Real.sqrt (weight (degree a b)))* + (rotated c s a b).coeff (degree (k+1) e) := by ring + _ = (Real.sqrt (weight (degree k e))/Real.sqrt (weight (degree a b)))* + (((k:ℝ)+1)*(rotated c s a b).coeff (degree (k+1) e)) := by rw [Real.sq_sqrt (by positivity)]; ring + _ = c*Real.sqrt (weight (degree k e))*((a:ℝ)/Real.sqrt (weight (degree a b)))*(rotated c s (a-1) b).coeff (degree k e)+ + s*Real.sqrt (weight (degree k e))*((b:ℝ)/Real.sqrt (weight (degree a b)))*(rotated c s a (b-1)).coeff (degree k e) := by rw [hh]; ring + _ = _ := by rw [sqrt_lower_left, sqrt_lower_right]; ring + +theorem oscillator_lower_one (c s : ℝ) (k e a b : ℕ) : + Real.sqrt ((e:ℝ)+1)*oscillatorCoefficient c s k (e+1) a b = + -(s*Real.sqrt a)*oscillatorCoefficient c s k e (a-1) b+ + c*Real.sqrt b*oscillatorCoefficient c s k e a (b-1) := by + unfold oscillatorCoefficient + rw [sqrt_weight_succ_right] + have hh := coeff_lower_one c s k e a b + calc + _ = (Real.sqrt ((e:ℝ)+1))^2*(Real.sqrt (weight (degree k e))/Real.sqrt (weight (degree a b)))* + (rotated c s a b).coeff (degree k (e+1)) := by ring + _ = (Real.sqrt (weight (degree k e))/Real.sqrt (weight (degree a b)))* + (((e:ℝ)+1)*(rotated c s a b).coeff (degree k (e+1))) := by rw [Real.sq_sqrt (by positivity)]; ring + _ = -s*Real.sqrt (weight (degree k e))*((a:ℝ)/Real.sqrt (weight (degree a b)))*(rotated c s (a-1) b).coeff (degree k e)+ + c*Real.sqrt (weight (degree k e))*((b:ℝ)/Real.sqrt (weight (degree a b)))*(rotated c s a (b-1)).coeff (degree k e) := by rw [hh]; ring + _ = _ := by rw [sqrt_lower_left, sqrt_lower_right]; ring + +end FischerBeam + +namespace EntropyPhotonNumber +open FischerBeam + + + +theorem oneMode_retained_lower (η : ℝ) (k e a b : ℕ) : + Real.sqrt ((k:ℝ)+1)*oneModeBeamCoefficient η (k+1) e a b = + Real.sqrt η*Real.sqrt a*oneModeBeamCoefficient η k e (a-1) b+ + Real.sqrt (1-η)*Real.sqrt b*oneModeBeamCoefficient η k e a (b-1) := by + simpa only [oneModeBeamCoefficient_eq, oscillatorCoefficient] using + oscillator_lower_zero (Real.sqrt η) (Real.sqrt (1-η)) k e a b + + +theorem oneMode_discarded_lower (η : ℝ) (k e a b : ℕ) : + Real.sqrt ((e:ℝ)+1)*oneModeBeamCoefficient η k (e+1) a b = + -(Real.sqrt (1-η)*Real.sqrt a)*oneModeBeamCoefficient η k e (a-1) b+ + Real.sqrt η*Real.sqrt b*oneModeBeamCoefficient η k e a (b-1) := by + simpa only [oneModeBeamCoefficient_eq, oscillatorCoefficient] using + oscillator_lower_one (Real.sqrt η) (Real.sqrt (1-η)) k e a b + +theorem beam_product_lower {n : ℕ} (j : Fin n) (f : Fin n → ℕ → ℕ → ℕ → ℕ → ℝ) + (k e a b : NumberIndex n) (u c s : ℝ) + (h : u*f j (k j+1) (e j) (a j) (b j) = + c*f j (k j) (e j) (a j-1) (b j)+s*f j (k j) (e j) (a j) (b j-1)) : + u*(∏ i, f i (Function.update k j (k j+1) i) (e i) (a i) (b i)) = + c*(∏ i, f i (k i) (e i) (Function.update a j (a j-1) i) (b i))+ + s*(∏ i, f i (k i) (e i) (a i) (Function.update b j (b j-1) i)) := by + classical + let R := ∏ i ∈ Finset.univ.erase j, f i (k i) (e i) (a i) (b i) + have h₁ : (∏ i, f i (Function.update k j (k j+1) i) (e i) (a i) (b i)) = + f j (k j+1) (e j) (a j) (b j)*R := by + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ j), Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro i hi + rw [Function.update_of_ne (Finset.ne_of_mem_erase hi)] + have h₂ : (∏ i, f i (k i) (e i) (Function.update a j (a j-1) i) (b i)) = + f j (k j) (e j) (a j-1) (b j)*R := by + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ j), Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro i hi + rw [Function.update_of_ne (Finset.ne_of_mem_erase hi)] + have h₃ : (∏ i, f i (k i) (e i) (a i) (Function.update b j (b j-1) i)) = + f j (k j) (e j) (a j) (b j-1)*R := by + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ j), Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro i hi + rw [Function.update_of_ne (Finset.ne_of_mem_erase hi)] + rw [h₁, h₂, h₃, ← mul_assoc, h] + ring + + theorem beam_retained_lower {n : ℕ} (η : ℝ) (j : Fin n) (k e a b : NumberIndex n) : + Real.sqrt ((k j:ℝ)+1)*beamCoefficient η (Function.update k j (k j+1)) e a b = + Real.sqrt η*Real.sqrt (a j)*beamCoefficient η k e (Function.update a j (a j-1)) b+ + Real.sqrt (1-η)*Real.sqrt (b j)*beamCoefficient η k e a (Function.update b j (b j-1)) := by + exact beam_product_lower j (fun _ => oneModeBeamCoefficient η) k e a b + _ _ _ (oneMode_retained_lower η (k j) (e j) (a j) (b j)) + +end EntropyPhotonNumber + +namespace EntropyPhotonNumber +open FischerBeam +variable {n : ℕ} + +theorem beamCoefficient_sector_zero (η : ℝ) (S T : NumberIndex n) + (k : ∀ j, Fin (S j+1)) (a : ∀ j, Fin (T j+1)) (h : S ≠ T) : + beamCoefficient η (fun j => k j) (fun j => S j-k j) + (fun j => a j) (fun j => T j-a j)=0 := by + classical + obtain ⟨j,hj⟩ := Function.ne_iff.mp h + apply Finset.prod_eq_zero (Finset.mem_univ j) + apply ite_eq_right + change ¬ ((k j:ℕ)+(S j-k j)=(a j:ℕ)+(T j-a j)) + have hk := (k j).isLt + have ha := (a j).isLt + omega + +theorem beamUnitary_apply_sector (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (T : NumberIndex n) (a : ∀ j, Fin (T j+1)) : + beamUnitary η hη (jointSectorBasis n ⟨T,a⟩)= + BlockUnitary.rotated (jointSectorBasis n) + (fun T k a => multiSectorMatrix (Real.sqrt η) (Real.sqrt (1-η)) T k a) ⟨T,a⟩ := by + exact BlockUnitary.unitary_apply_basis (jointSectorBasis n) + (fun T k a => multiSectorMatrix (Real.sqrt η) (Real.sqrt (1-η)) T k a) _ _ _ + +theorem beam_coordinate_sector (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (S T : NumberIndex n) (k : ∀ j, Fin (S j+1)) (a : ∀ j, Fin (T j+1)) : + inner ℂ (jointSectorBasis n ⟨S,k⟩) (beamUnitary η hη (jointSectorBasis n ⟨T,a⟩)) = + (beamCoefficient η (fun j => k j) (fun j => S j-k j) + (fun j => a j) (fun j => T j-a j) : ℂ) := by + rw [beamUnitary_apply_sector] + by_cases h : S=T + · subst T + erw [BlockUnitary.inner_basis_rotated_same, beam_sectorCoefficient] + · erw [BlockUnitary.inner_basis_rotated_ne _ _ h, + beamCoefficient_sector_zero η S T k a h, Complex.ofReal_zero] + +theorem beam_coordinate (η : ℝ) (hη : η ∈ Set.Icc 0 1) + (k e a b : NumberIndex n) : + beamUnitary η hη (lp.single 2 (a,b) 1) (k,e)=(beamCoefficient η k e a b : ℂ) := by + have hh := beam_coordinate_sector η hη (fun j => k j+e j) (fun j => a j+b j) + (fun j => (⟨k j, by omega⟩ : Fin (k j+e j+1))) + (fun j => (⟨a j, by omega⟩ : Fin (a j+b j+1))) + simp only [jointSectorBasis_apply, sectorEquiv, Nat.add_sub_cancel_left, Equiv.coe_fn_mk] at hh + simpa only [lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] using hh +end EntropyPhotonNumber + +end + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Fock/Operators.lean b/lean/OAI/MathematicalPhysics/Fock/Operators.lean new file mode 100644 index 0000000000000000000000000000000000000000..62faf368eeac49a9b93d8f897068d8233c10af94 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Fock/Operators.lean @@ -0,0 +1,695 @@ +import OAI.InformationTheory.PhotonNumber.Basic +import OAI.Analysis.QuantumTrace.Basic + +namespace OAI + +noncomputable section + +section +open scoped BigOperators ComplexConjugate ENNReal Topology +open MeasureTheory +open scoped ComplexConjugate + +namespace WeightedShift +variable {I J : Type*} +abbrev H (I : Type*) := lp (fun _ : I => ℂ) 2 + +theorem hasSum_square (x : H I) : HasSum (fun i => ‖x i‖^2) (‖x‖^2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using lp.hasSum_norm (p := 2) (by norm_num) x + +theorem pull_mem (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (_hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H J) : + Memℓp (fun i => c i*x (f i)) 2 := by + apply (memℓp_gen_iff (by norm_num : 0 < (2 : ENNReal).toReal)).mpr + simp only [ENNReal.toReal_ofNat, Real.rpow_two] + apply (((hasSum_square x).summable.comp_injective hf).mul_left (C^2)).of_nonneg_of_le + (fun _ => sq_nonneg _) + intro i + rw [norm_mul, mul_pow] + exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (norm_nonneg _) (hc i) 2) (sq_nonneg _) + +def pull (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H J) : H I := + ⟨_, pull_mem f hf c C hC hc x⟩ +@[simp] theorem pull_apply (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H J) (i : I) : + pull f hf c C hC hc x i = c i*x (f i) := rfl + +theorem pull_bound (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H J) : + ‖pull f hf c C hC hc x‖ ≤ C*‖x‖ := by + have h₁ : ‖pull f hf c C hC hc x‖^2 ≤ C^2*∑' i, ‖x (f i)‖^2 := by + rw [← (hasSum_square (pull f hf c C hC hc x)).tsum_eq, ← tsum_mul_left] + apply Summable.tsum_le_tsum (fun i => ?_) (hasSum_square _).summable + (((hasSum_square x).summable.comp_injective hf).mul_left _) + simp only [pull_apply, norm_mul, mul_pow] + exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (norm_nonneg _) (hc i) 2) (sq_nonneg _) + have h₂ : (∑' i, ‖x (f i)‖^2) ≤ ‖x‖^2 := by + rw [← (hasSum_square x).tsum_eq] + exact tsum_comp_le_tsum_of_inj (hasSum_square x).summable (fun _ => sq_nonneg _) hf + have h₃ := mul_le_mul_of_nonneg_left h₂ (sq_nonneg C) + nlinarith [norm_nonneg (pull f hf c C hC hc x), mul_nonneg hC (norm_nonneg x)] + +def pullCLM (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) : H J →L[ℂ] H I := + LinearMap.mkContinuous + { toFun := pull f hf c C hC hc + map_add' := fun x y => by + apply lp.ext + funext i + change c i*(x (f i)+y (f i)) = c i*x (f i)+c i*y (f i) + ring + map_smul' := fun z x => by + apply lp.ext + funext i + change c i*(z*x (f i)) = z*(c i*x (f i)) + ring } + C (pull_bound f hf c C hC hc) +@[simp] theorem pullCLM_apply (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H J) (i : I) : + pullCLM f hf c C hC hc x i = c i*x (f i) := rfl + +variable [DecidableEq I] [DecidableEq J] + +theorem pullCLM_single (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (i : I) (z : ℂ) : + pullCLM f hf c C hC hc (lp.single 2 (f i) z) = lp.single 2 i (c i*z) := by + apply lp.ext + funext k + simp only [pullCLM_apply, lp.coeFn_single, Pi.single_apply] + by_cases he : k = i + · subst k; simp + · have hh : f k ≠ f i := fun h => he (hf h) + simp [he, hh] + +omit [DecidableEq I] in + theorem pullCLM_single_outside (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (j : J) (hj : ∀ i, f i ≠ j) (z : ℂ) : + pullCLM f hf c C hC hc (lp.single 2 j z) = 0 := by + apply lp.ext + funext i + simp [hj i] + + theorem adjoint_apply_image (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H I) (i : I) : + (pullCLM f hf c C hC hc).adjoint x (f i) = conj (c i)*x i := by + have hh := ContinuousLinearMap.adjoint_inner_right (pullCLM f hf c C hC hc) + (lp.single 2 (f i) 1) x + simpa only [pullCLM_single, mul_one, lp.inner_single_left, RCLike.inner_apply, + map_one, one_mul, mul_comm] using hh + +omit [DecidableEq I] in + theorem adjoint_apply_outside (f : I → J) (hf : Function.Injective f) (c : I → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hc : ∀ i, ‖c i‖ ≤ C) (x : H I) (j : J) (hj : ∀ i, f i ≠ j) : + (pullCLM f hf c C hC hc).adjoint x j = 0 := by + have hh := ContinuousLinearMap.adjoint_inner_right (pullCLM f hf c C hC hc) + (lp.single 2 j 1) x + rw [pullCLM_single_outside f hf c C hC hc j hj, inner_zero_left] at hh + simpa only [lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] using hh + +end WeightedShift + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +variable {n : ℕ} + +def up (j : Fin n) (k : NumberIndex n) : NumberIndex n := k + Pi.single j 1 +@[simp] theorem up_same (j : Fin n) (k : NumberIndex n) : up j k j = k j+1 := by simp [up] +@[simp] theorem up_other (j l : Fin n) (hl : l ≠ j) (k : NumberIndex n) : up j k l = k l := by simp [up, Pi.single_eq_of_ne hl] +theorem up_injective (j : Fin n) : Function.Injective (up j) := by + intro k l h + exact add_right_cancel h +@[simp] theorem weight_up (j : Fin n) (k : NumberIndex n) : numberWeight (up j k) = numberWeight k+1 := by + simp only [numberWeight, up, Pi.add_apply, Nat.cast_add, Finset.sum_add_distrib] + have h : (∑ i : Fin n, (((Pi.single j 1 : Fin n → ℕ) i): ℝ)) = 1 := by + simp only [Pi.single_apply] + simp + rw [h] + ring + +theorem coordinate_le_weight (j : Fin n) (k : NumberIndex n) : (k j:ℝ)+1 ≤ numberWeight k := by + have h : (k j:ℝ) ≤ ∑ i : Fin n, (k i:ℝ) := + Finset.single_le_sum (fun i _ => Nat.cast_nonneg (k i)) (Finset.mem_univ j) + dsimp [numberWeight] + linarith + +theorem sqrt_step_le_weight (j : Fin n) (k : NumberIndex n) : Real.sqrt ((k j:ℝ)+1) ≤ numberWeight (up j k) := by + have h₁ := coordinate_le_weight j k + have h₂ := numberWeight_one_le k + have hs := Real.sq_sqrt (show 0 ≤ (k j:ℝ)+1 by positivity) + have hp := Real.sqrt_nonneg ((k j:ℝ)+1) + rw [weight_up] + nlinarith + +def coefficient (a b : ℕ) (j : Fin n) (k : NumberIndex n) : ℂ := + ((numberWeight k)^a*Real.sqrt ((k j:ℝ)+1)/(numberWeight (up j k))^b : ℝ) + +theorem coefficient_bound (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) (k : NumberIndex n) : ‖coefficient a b j k‖ ≤ 1 := by + have hk := numberWeight_one_le k + have hu := numberWeight_one_le (up j k) + have hkpos : 0 < numberWeight k := by linarith + have hupos : 0 < numberWeight (up j k) := by linarith + have hm : numberWeight k ≤ numberWeight (up j k) := by rw [weight_up]; linarith + have hp : numberWeight k^a*Real.sqrt ((k j:ℝ)+1) ≤ numberWeight (up j k)^(a+1) := by + rw [pow_succ] + exact mul_le_mul (pow_le_pow_left₀ hkpos.le hm a) (sqrt_step_le_weight j k) + (Real.sqrt_nonneg _) (pow_nonneg hupos.le _) + have hpow : numberWeight (up j k)^(a+1) ≤ numberWeight (up j k)^b := + pow_le_pow_right₀ hu hab + rw [coefficient, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by positivity)] + exact (div_le_one (pow_pos hupos b)).mpr (hp.trans hpow) + + +def sandwich (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : Fock n →L[ℂ] Fock n := + WeightedShift.pullCLM (up j) (up_injective j) (coefficient a b j) 1 (by norm_num) + (coefficient_bound a b hab j) +@[simp] theorem sandwich_apply (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) (x : Fock n) (k : NumberIndex n) : + sandwich a b hab j x k = coefficient a b j k*x (up j k) := rfl + +theorem sandwich_norm_le (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : ‖sandwich a b hab j‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ (by norm_num) + intro x + exact WeightedShift.pull_bound (up j) (up_injective j) _ 1 (by norm_num) (coefficient_bound a b hab j) x + +end Annihilation + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +open scoped ComplexConjugate +variable {n : ℕ} + +theorem sqrt_step_le_base (j : Fin n) (k : NumberIndex n) : Real.sqrt ((k j:ℝ)+1) ≤ numberWeight k := by + have h₁ := coordinate_le_weight j k + have h₂ := numberWeight_one_le k + have hs := Real.sq_sqrt (show 0 ≤ (k j:ℝ)+1 by positivity) + nlinarith [Real.sqrt_nonneg ((k j:ℝ)+1)] + +def creationCoefficient (a b : ℕ) (j : Fin n) (k : NumberIndex n) : ℂ := + ((numberWeight (up j k))^a*Real.sqrt ((k j:ℝ)+1)/(numberWeight k)^b : ℝ) + +theorem creationCoefficient_bound (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) (k : NumberIndex n) : + ‖creationCoefficient a b j k‖ ≤ 2^a := by + have hk := numberWeight_one_le k + have hkpos : 0 < numberWeight k := by linarith + have hu : 0 < numberWeight (up j k) := by linarith [numberWeight_one_le (up j k)] + have hup : numberWeight (up j k) ≤ 2*numberWeight k := by rw [weight_up]; linarith + have hp : numberWeight (up j k)^a*Real.sqrt ((k j:ℝ)+1) ≤ 2^a*numberWeight k^(a+1) := by + calc + _ ≤ (2*numberWeight k)^a*numberWeight k := mul_le_mul + (pow_le_pow_left₀ (by linarith [numberWeight_one_le (up j k)]) hup a) + (sqrt_step_le_base j k) (Real.sqrt_nonneg _) (by positivity) + _ = _ := by rw [mul_pow, pow_succ]; ring + have hpow := mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hk hab) (show (0:ℝ) ≤ 2^a by positivity) + rw [creationCoefficient, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by positivity)] + exact (div_le_iff₀ (pow_pos hkpos b)).mpr (hp.trans hpow) + + +def creationSandwich (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : Fock n →L[ℂ] Fock n := + (WeightedShift.pullCLM (up j) (up_injective j) (creationCoefficient a b j) (2^a) + (by positivity) (creationCoefficient_bound a b hab j)).adjoint + +theorem creationSandwich_norm_le (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : + ‖creationSandwich a b hab j‖ ≤ 2^a := by + rw [creationSandwich, LinearIsometryEquiv.norm_map] + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro x + exact WeightedShift.pull_bound (up j) (up_injective j) _ _ (by positivity) (creationCoefficient_bound a b hab j) x + +@[simp] theorem creationSandwich_up (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) (x : Fock n) (k : NumberIndex n) : + creationSandwich a b hab j x (up j k) = creationCoefficient a b j k*x k := by + rw [creationSandwich, WeightedShift.adjoint_apply_image] + simp only [creationCoefficient, Complex.conj_ofReal] + +@[simp] theorem creationSandwich_zero (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) (x : Fock n) + (k : NumberIndex n) (hk : k j = 0) : creationSandwich a b hab j x k = 0 := by + rw [creationSandwich] + apply WeightedShift.adjoint_apply_outside + intro l hl + have hh := congrFun hl j + rw [up_same, hk] at hh + omega + +def down (j : Fin n) (k : NumberIndex n) : NumberIndex n := Function.update k j (k j-1) +@[simp] theorem up_down (j : Fin n) (k : NumberIndex n) (hk : 0 < k j) : up j (down j k) = k := by + funext i + by_cases he : i = j + · subst i; simp [down, Nat.sub_add_cancel hk] + · simp [down, he] +@[simp] theorem down_up (j : Fin n) (k : NumberIndex n) : down j (up j k) = k := by + funext i + by_cases he : i = j + · subst i; simp [down] + · simp [down, he] + + theorem index_cases (j : Fin n) (k : NumberIndex n) : k j = 0 ∨ ∃ l, k = up j l := by + by_cases hk : k j = 0 + · exact Or.inl hk + · exact Or.inr ⟨down j k, (up_down j k (Nat.pos_of_ne_zero hk)).symm⟩ + + theorem coefficient_inverse_bound (m : ℕ) (k : NumberIndex n) : ‖((numberWeight k^m)⁻¹ : ℂ)‖ ≤ 1 := by + rw [norm_inv, norm_pow, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith [numberWeight_one_le k])] + exact inv_le_one_of_one_le₀ (one_le_pow₀ (numberWeight_one_le k)) + +def inverseWeight (m : ℕ) : Fock n →L[ℂ] Fock n := + WeightedShift.pullCLM id Function.injective_id (fun k => ((numberWeight k^m)⁻¹ : ℂ)) 1 (by norm_num) + (coefficient_inverse_bound m) +@[simp] theorem inverseWeight_apply (m : ℕ) (x : Fock n) (k : NumberIndex n) : + inverseWeight m x k = ((numberWeight k^m)⁻¹ : ℂ)*x k := rfl + +theorem inverseWeight_injective (m : ℕ) : Function.Injective (inverseWeight (n := n) m) := by + intro x y h + apply lp.ext + funext k + have hh := congrArg (fun z : Fock n => z k) h + simp only [inverseWeight_apply] at hh + exact mul_left_cancel₀ (by exact inv_ne_zero (pow_ne_zero m (by exact_mod_cast (show numberWeight k ≠ 0 by linarith [numberWeight_one_le k])))) hh + +theorem inverseWeight_add (a b : ℕ) : inverseWeight (n := n) (a+b) = inverseWeight a ∘L inverseWeight b := by + ext x k + simp only [inverseWeight_apply, ContinuousLinearMap.comp_apply, pow_add, mul_inv_rev] + ring + + theorem sandwich_factor (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : + sandwich 0 b (by omega) j = inverseWeight a ∘L sandwich a b hab j := by + ext x k + have hn : (numberWeight k : ℂ) ≠ 0 := by exact_mod_cast (show numberWeight k ≠ 0 by linarith [numberWeight_one_le k]) + simp only [ContinuousLinearMap.comp_apply, inverseWeight_apply, sandwich_apply, coefficient, + pow_zero, one_mul, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_pow] + field_simp + + theorem creationSandwich_factor (a b : ℕ) (hab : a+1 ≤ b) (j : Fin n) : + creationSandwich 0 b (by omega) j = inverseWeight a ∘L creationSandwich a b hab j := by + apply ContinuousLinearMap.ext + intro x + apply lp.ext + funext k + rcases index_cases j k with hk | ⟨l,rfl⟩ + · simp [creationSandwich_zero _ _ _ _ _ k hk] + · have hn : (numberWeight (up j l) : ℂ) ≠ 0 := by exact_mod_cast (show numberWeight (up j l) ≠ 0 by linarith [numberWeight_one_le (up j l)]) + simp only [ContinuousLinearMap.comp_apply, inverseWeight_apply, creationSandwich_up, creationCoefficient, + pow_zero, one_mul, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_pow] + field_simp + +end Annihilation + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +variable {n : ℕ} + +def lowering (j : Fin n) : Fock n →L[ℂ] Fock n := sandwich 0 1 (by omega) j +def raising (j : Fin n) : Fock n →L[ℂ] Fock n := creationSandwich 0 1 (by omega) j + +@[simp] theorem lowering_apply (j : Fin n) (x : Fock n) (k : NumberIndex n) : + lowering j x k = (Real.sqrt ((k j:ℝ)+1) : ℂ)*inverseWeight 1 x (up j k) := by + simp only [lowering, sandwich_apply, coefficient, pow_zero, one_mul, pow_one, + Complex.ofReal_div, inverseWeight_apply] + ring + +@[simp] theorem raising_up (j : Fin n) (x : Fock n) (k : NumberIndex n) : + raising j x (up j k) = (Real.sqrt ((k j:ℝ)+1) : ℂ)*inverseWeight 1 x k := by + simp only [raising, creationSandwich_up, creationCoefficient, pow_zero, one_mul, + pow_one, Complex.ofReal_div, inverseWeight_apply] + ring + +@[simp] theorem raising_zero (j : Fin n) (x : Fock n) (k : NumberIndex n) (hk : k j = 0) : + raising j x k = 0 := creationSandwich_zero _ _ _ _ _ _ hk + + theorem lowering_sq (j : Fin n) (x : Fock n) (k : NumberIndex n) : + ‖lowering j x k‖^2 = ((k j:ℝ)+1)*‖inverseWeight 1 x (up j k)‖^2 := by + rw [lowering_apply, norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, + Real.sq_sqrt (by positivity)] + + theorem raising_sq (j : Fin n) (x : Fock n) (k : NumberIndex n) : + ‖raising j x (up j k)‖^2 = ((k j:ℝ)+1)*‖inverseWeight 1 x k‖^2 := by + rw [raising_up, norm_mul, mul_pow, Complex.norm_real, Real.norm_eq_abs, sq_abs, + Real.sq_sqrt (by positivity)] + + theorem lowering_norm_sum (j : Fin n) (x : Fock n) : + HasSum (fun k : NumberIndex n => (k j:ℝ)*‖inverseWeight 1 x k‖^2) (‖lowering j x‖^2) := by + have hh := WeightedShift.hasSum_square (lowering j x) + simp only [lowering_sq] at hh + have hz (k : NumberIndex n) (hk : k ∉ Set.range (up j)) : + (k j:ℝ)*‖inverseWeight 1 x k‖^2 = 0 := by + rcases index_cases j k with he | ⟨l,rfl⟩ + · simp [he] + · exact (hk ⟨l,rfl⟩).elim + apply (up_injective j).hasSum_iff hz |>.mp + simpa only [Function.comp_def, up_same, Nat.cast_add, Nat.cast_one] using hh + + theorem raising_norm_sum (j : Fin n) (x : Fock n) : + HasSum (fun k : NumberIndex n => ((k j:ℝ)+1)*‖inverseWeight 1 x k‖^2) (‖raising j x‖^2) := by + have hz (k : NumberIndex n) (hk : k ∉ Set.range (up j)) : ‖raising j x k‖^2 = 0 := by + rcases index_cases j k with he | ⟨l,rfl⟩ + · simp [raising_zero _ _ _ he] + · exact (hk ⟨l,rfl⟩).elim + have hh := (up_injective j).hasSum_iff hz |>.mpr (WeightedShift.hasSum_square (raising j x)) + simpa only [Function.comp_def, raising_sq] using hh + + + theorem canonical_norm_identity (j : Fin n) (x : Fock n) : + ‖raising j x‖^2 = ‖lowering j x‖^2+‖inverseWeight 1 x‖^2 := by + have hh := (lowering_norm_sum j x).add (WeightedShift.hasSum_square (inverseWeight 1 x)) + have he : HasSum (fun k : NumberIndex n => ((k j:ℝ)+1)*‖inverseWeight 1 x k‖^2) + (‖lowering j x‖^2+‖inverseWeight 1 x‖^2) := by + convert! hh using 1 + ext k + ring + exact (raising_norm_sum j x).unique he + + theorem inverseWeight_selfAdjoint (m : ℕ) : IsSelfAdjoint (inverseWeight (n := n) m) := by + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + intro x y + apply HasSum.unique (lp.hasSum_inner (𝕜 := ℂ) (inverseWeight m x) y) + convert! lp.hasSum_inner (𝕜 := ℂ) x (inverseWeight m y) using 1 + ext k + simp only [inverseWeight_apply, RCLike.inner_apply, map_mul, map_inv₀, map_pow, + Complex.conj_ofReal] + ring + + theorem lowering_adjoint_inverse (j : Fin n) : + (lowering j).adjoint ∘L inverseWeight 1 = inverseWeight 1 ∘L raising j := by + apply ContinuousLinearMap.ext + intro x + apply lp.ext + funext k + rcases index_cases j k with hk | ⟨l,rfl⟩ + · have hn : ∀ l, up j l ≠ k := by intro l he; have hh := congrFun he j; rw [up_same, hk] at hh; omega + change (lowering j).adjoint (inverseWeight 1 x) k = inverseWeight 1 (raising j x) k + have hh := WeightedShift.adjoint_apply_outside (up j) (up_injective j) (coefficient 0 1 j) 1 (by norm_num) (coefficient_bound 0 1 (by omega) j) (inverseWeight 1 x) k hn + change (lowering j).adjoint (inverseWeight 1 x) k = 0 at hh + rw [hh] + simp [inverseWeight_apply, raising_zero _ _ _ hk] + · change (lowering j).adjoint (inverseWeight 1 x) (up j l) = inverseWeight 1 (raising j x) (up j l) + have hh := WeightedShift.adjoint_apply_image (up j) (up_injective j) (coefficient 0 1 j) 1 (by norm_num) (coefficient_bound 0 1 (by omega) j) (inverseWeight 1 x) l + change (lowering j).adjoint (inverseWeight 1 x) (up j l) = _ at hh + rw [hh] + have hc : (starRingEnd ℂ) (coefficient 0 1 j l) = coefficient 0 1 j l := + Complex.conj_ofReal _ + rw [hc] + simp only [coefficient, pow_zero, one_mul, pow_one, + raising_up, inverseWeight_apply, Complex.ofReal_div] + ring + + theorem ladder_adjoint_pairing (j : Fin n) (x y : Fock n) : + inner ℂ (lowering j x) (inverseWeight 1 y) = inner ℂ (inverseWeight 1 x) (raising j y) := by + rw [← ContinuousLinearMap.adjoint_inner_right] + have hh := congrArg (fun T : Fock n →L[ℂ] Fock n => T y) (lowering_adjoint_inverse j) + change (lowering j).adjoint (inverseWeight 1 y) = inverseWeight 1 (raising j y) at hh + rw [hh] + exact (ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp (inverseWeight_selfAdjoint 1) x (raising j y)).symm + +end Annihilation + +namespace CrossEnsemble +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +def operator (u v : I → E) : E →L[ℂ] E := ∑' i, InnerProductSpace.rankOne ℂ (u i) (v i) + +omit [InnerProductSpace ℂ E] [CompleteSpace E] in +theorem norm_product_summable {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) : Summable (fun i => ‖u i‖*‖v i‖) := by + apply Summable.of_nonneg_of_le (fun i => mul_nonneg (norm_nonneg _) (norm_nonneg _)) _ (hu.add hv) + intro i + nlinarith [sq_nonneg (‖u i‖-‖v i‖)] + +theorem hasSum_operator {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) : + HasSum (fun i => InnerProductSpace.rankOne ℂ (u i) (v i)) (operator u v) := by + apply Summable.hasSum + apply Summable.of_norm + simpa only [InnerProductSpace.norm_rankOne] using norm_product_summable hu hv + +theorem entry_hasSum {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (x y : E) : + HasSum (fun i => inner ℂ x (u i)*inner ℂ (v i) y) (inner ℂ x (operator u v y)) := by + convert! ((hasSum_operator hu hv).mapL (ContinuousLinearMap.apply ℂ E y)).mapL (innerSL ℂ x) using 1 + ext i + simp [InnerProductSpace.rankOne_apply, mul_comm] + +omit [CompleteSpace E] in +theorem square_coordinates_summable (b : HilbertBasis J ℂ E) {u : I → E} + (hu : Summable (fun i => ‖u i‖^2)) : + Summable (fun ij : I × J => ‖inner ℂ (b ij.2) (u ij.1)‖^2) := by + apply (summable_prod_of_nonneg (fun _ => sq_nonneg _)).mpr + have hh (i : I) : HasSum (fun j => ‖inner ℂ (b j) (u i)‖^2) (‖u i‖^2) := by + have ht := (b.hasSum_inner_mul_inner (u i) (u i)).mapL Complex.reCLM + convert! ht using 1 + · ext j + rw [← inner_conj_symm (u i) (b j), mul_comm, Complex.mul_conj] + simp only [Complex.reCLM_apply, Complex.normSq_eq_norm_sq, Complex.ofReal_re] + · simp [← Complex.ofReal_pow] + refine ⟨fun i => (hh i).summable, ?_⟩ + simpa only [(hh _).tsum_eq] using hu + +omit [CompleteSpace E] in +theorem trace_norm_summable (b : HilbertBasis J ℂ E) {u v : I → E} + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) : + Summable (fun ij : I × J => ‖inner ℂ (b ij.2) (u ij.1)*inner ℂ (v ij.1) (b ij.2)‖) := by + apply Summable.of_nonneg_of_le (fun _ => norm_nonneg _) _ + ((square_coordinates_summable b hu).add (square_coordinates_summable b hv)) + intro ij + rw [norm_mul, norm_inner_symm (v ij.1)] + nlinarith [sq_nonneg (‖inner ℂ (b ij.2) (u ij.1)‖-‖inner ℂ (b ij.2) (v ij.1)‖)] + +def pairing (u v : I → E) (Z : E →L[ℂ] E) : ℂ := ∑' i, inner ℂ (v i) (Z (u i)) + +omit [CompleteSpace E] in +theorem applied_summable {u : I → E} (hu : Summable (fun i => ‖u i‖^2)) (Z : E →L[ℂ] E) : + Summable (fun i => ‖Z (u i)‖^2) := by + apply Summable.of_nonneg_of_le (fun _ => sq_nonneg _) _ (hu.mul_left (‖Z‖^2)) + intro i + calc + _ ≤ (‖Z‖*‖u i‖)^2 := pow_le_pow_left₀ (norm_nonneg _) (Z.le_opNorm _) _ + _ = _ := mul_pow _ _ _ + +omit [CompleteSpace E] in +theorem pairing_summable {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + Summable (fun i => inner ℂ (v i) (Z (u i))) := + (norm_product_summable hv (applied_summable hu Z)).of_norm_bounded + (fun _i => norm_inner_le_norm _ _) + +theorem trace_hasSum (b : HilbertBasis J ℂ E) {u v : I → E} + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) : + HasSum (fun j => inner ℂ (b j) (operator u v (b j))) + (∑' i, inner ℂ (v i) (u i)) := by + have hh := (trace_norm_summable b hu hv).of_norm + have hi (i : I) : HasSum (fun j => inner ℂ (b j) (u i)*inner ℂ (v i) (b j)) (inner ℂ (v i) (u i)) := by + simpa only [mul_comm] using b.hasSum_inner_mul_inner (v i) (u i) + have he (j : J) := entry_hasSum hu hv (b j) (b j) + have hf := hh.hasSum.prod_fiberwise (f := fun ij : I × J => inner ℂ (b ij.2) (u ij.1)*inner ℂ (v ij.1) (b ij.2)) hi + have hg := hh.prod_symm.hasSum.prod_fiberwise (f := fun ji : J × I => inner ℂ (b ji.1) (u ji.2)*inner ℂ (v ji.2) (b ji.1)) he + have ht : (∑' j, inner ℂ (b j) (operator u v (b j)))=∑' i, inner ℂ (v i) (u i) := by + rw [hg.tsum_eq, hf.tsum_eq] + exact (Equiv.prodComm J I).tsum_eq (fun ij : I × J => inner ℂ (b ij.2) (u ij.1)*inner ℂ (v ij.1) (b ij.2)) + exact ht ▸ hg.summable.hasSum + +theorem operator_comp_left {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + Z ∘L operator u v=operator (fun i => Z (u i)) v := by + apply ContinuousLinearMap.ext + intro y + apply ext_inner_left ℂ + intro x + have hh := ((hasSum_operator hu hv).mapL (ContinuousLinearMap.apply ℂ E y)).mapL Z + have ht := hh.mapL (innerSL ℂ x) + have ht' : HasSum (fun i => inner ℂ x (Z (u i))*inner ℂ (v i) y) + (inner ℂ x (Z (operator u v y))) := by + convert! ht using 1 + ext i + simp [InnerProductSpace.rankOne_apply, mul_comm] + exact ht'.unique (entry_hasSum (applied_summable hu Z) hv x y) + +theorem pairing_trace (b : HilbertBasis J ℂ E) {u v : I → E} + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + HasSum (fun j => inner ℂ (b j) (Z (operator u v (b j)))) (pairing u v Z) := by + have hh := trace_hasSum b (applied_summable hu Z) hv + rw [← operator_comp_left hu hv Z] at hh + exact hh + + theorem pairing_eq_of_operator_eq {K : Type*} (b : HilbertBasis J ℂ E) + {u v : I → E} {x y : K → E} + (hu : Summable (fun i => ‖u i‖^2)) (hv : Summable (fun i => ‖v i‖^2)) + (hx : Summable (fun i => ‖x i‖^2)) (hy : Summable (fun i => ‖y i‖^2)) + (he : operator u v=operator x y) (Z : E →L[ℂ] E) : pairing u v Z=pairing x y Z := by + apply HasSum.unique (pairing_trace b hu hv Z) + rw [he] + exact pairing_trace b hx hy Z +end CrossEnsemble + +namespace CrossEnsemble +open scoped BigOperators ComplexConjugate +variable {I J E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +theorem operator_adjoint {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) : (operator u v).adjoint=operator v u := by + apply ContinuousLinearMap.ext + intro y + apply ext_inner_left ℂ + intro x + rw [ContinuousLinearMap.adjoint_inner_right] + have hh := (entry_hasSum hu hv y x).mapL Complex.conjCLE.toContinuousLinearMap + change HasSum (fun i => conj (inner ℂ y (u i)*inner ℂ (v i) x)) + (conj (inner ℂ y (operator u v x))) at hh + simp only [map_mul, inner_conj_symm] at hh + have hh' : HasSum (fun i => inner ℂ x (v i)*inner ℂ (u i) y) + (inner ℂ (operator u v x) y) := by + convert! hh using 1 + ext i + ring + exact hh'.unique (entry_hasSum hv hu x y) + +theorem operator_sandwich {u v : I → E} (hu : Summable (fun i => ‖u i‖^2)) + (hv : Summable (fun i => ‖v i‖^2)) (Z : E →L[ℂ] E) : + Z ∘L operator u v ∘L Z.adjoint=operator (fun i => Z (u i)) (fun i => Z (v i)) := by + have hr : operator u v ∘L Z.adjoint=operator u (fun i => Z (v i)) := by + have hh := congrArg ContinuousLinearMap.adjoint (operator_comp_left hv hu Z) + simpa only [ContinuousLinearMap.adjoint_comp, operator_adjoint hv hu, + operator_adjoint (applied_summable hv Z) hu] using hh + rw [hr, operator_comp_left hu (applied_summable hv Z) Z] +end CrossEnsemble + +namespace Annihilation +open EntropyPhotonNumber QuantumTrace +open scoped BigOperators ComplexConjugate +variable {n : ℕ} + +def modeBound (j : Fin n) (upward : Bool) : Fock n →L[ℂ] Fock n := + WeightedShift.pullCLM id Function.injective_id + (fun k => (((k j:ℝ)+(if upward then 1 else 0))/numberWeight k : ℝ)) 1 (by norm_num) (by + intro k + have hk := numberWeight_one_le k + have hc := coordinate_le_weight j k + have hp : 0 < numberWeight k := by linarith + rw [Complex.norm_real, Real.norm_of_nonneg (by positivity)] + apply (div_le_iff₀ hp).mpr + cases upward <;> norm_num at * <;> linarith) + +@[simp] theorem modeBound_apply (j : Fin n) (upward : Bool) (x : Fock n) (k : NumberIndex n) : + modeBound j upward x k = + ((((k j:ℝ)+(if upward then 1 else 0))/numberWeight k : ℝ):ℂ)*x k := rfl + +theorem modeBound_selfAdjoint (j : Fin n) (upward : Bool) : IsSelfAdjoint (modeBound j upward) := by + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + intro x y + apply HasSum.unique (lp.hasSum_inner (𝕜 := ℂ) (modeBound j upward x) y) + convert! lp.hasSum_inner (𝕜 := ℂ) x (modeBound j upward y) using 1 + ext k + simp only [modeBound_apply, RCLike.inner_apply, map_mul, Complex.conj_ofReal] + ring + +theorem modeBound_inverse_commute (j : Fin n) (upward : Bool) (m : ℕ) : + modeBound j upward ∘L inverseWeight m=inverseWeight m ∘L modeBound j upward := by + ext x k + simp only [ContinuousLinearMap.comp_apply, modeBound_apply, inverseWeight_apply] + ring + +theorem sandwich_right_inverse (a b t : ℕ) (hab : a+1 ≤ b) (j : Fin n) : + sandwich a (b+t) (by omega) j = sandwich a b hab j ∘L inverseWeight t := by + ext x k + simp only [sandwich_apply, coefficient, inverseWeight_apply, ContinuousLinearMap.comp_apply, + Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_pow, pow_add] + ring + +theorem creationSandwich_right_inverse (a b t : ℕ) (hab : a+1 ≤ b) (j : Fin n) : + creationSandwich a (b+t) (by omega) j = creationSandwich a b hab j ∘L inverseWeight t := by + apply ContinuousLinearMap.ext + intro x + apply lp.ext + funext k + rcases index_cases j k with hk | ⟨l,rfl⟩ + · simp [creationSandwich_zero _ _ _ _ _ k hk] + · simp only [creationSandwich_up, creationCoefficient, inverseWeight_apply, ContinuousLinearMap.comp_apply, + Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_pow, pow_add] + ring + +def gain (j : Fin n) (upward : Bool) : Fock n →L[ℂ] Fock n := + if upward then creationSandwich 2 3 (by omega) j else sandwich 2 3 (by omega) j + +def unweightedGain (j : Fin n) (upward : Bool) : Fock n →L[ℂ] Fock n := + if upward then raising j else lowering j + +theorem gain_factor (j : Fin n) (upward : Bool) : + inverseWeight 2 ∘L gain j upward=unweightedGain j upward ∘L inverseWeight 2 := by + cases upward + · exact (sandwich_factor 2 3 (by omega) j).symm.trans (sandwich_right_inverse 0 1 2 (by omega) j) + · exact (creationSandwich_factor 2 3 (by omega) j).symm.trans (creationSandwich_right_inverse 0 1 2 (by omega) j) + +theorem quadratic_coordinate (w t : ℝ) (hw : 0 < w) (z : ℂ) : + ((w:ℂ)^2)⁻¹ * ((t:ℂ)/(w:ℂ)*z) * (((w:ℂ)^3)⁻¹*conj z)= + (t:ℂ)*((((|w|:ℝ):ℂ)^3)⁻¹*(‖z‖:ℂ))^2 := by + rw [abs_of_pos hw] + calc + _ = (t:ℂ)*(w:ℂ)⁻¹^6*(z*conj z) := by ring + _ = _ := by + rw [Complex.mul_conj, Complex.normSq_eq_norm_sq, Complex.ofReal_pow] + ring + +theorem mode_quadratic (j : Fin n) (upward : Bool) (x : Fock n) : + inner ℂ (inverseWeight 3 x) (inverseWeight 2 (modeBound j upward x))= + (‖unweightedGain j upward (inverseWeight 2 x)‖^2:ℝ) := by + have hh : HasSum (fun k : NumberIndex n => + ((k j:ℝ)+(if upward then 1 else 0))*‖inverseWeight 3 x k‖^2) + (‖unweightedGain j upward (inverseWeight 2 x)‖^2) := by + have hi : inverseWeight 1 (inverseWeight 2 x)=inverseWeight 3 x := by + exact congrArg (fun T : Fock n →L[ℂ] Fock n => T x) (inverseWeight_add 1 2).symm + cases upward + · simpa only [Bool.false_eq_true, ↓reduceIte, add_zero, unweightedGain, hi] using lowering_norm_sum j (inverseWeight 2 x) + · simpa only [↓reduceIte, unweightedGain, hi] using raising_norm_sum j (inverseWeight 2 x) + apply HasSum.unique (lp.hasSum_inner (𝕜 := ℂ) (inverseWeight 3 x) (inverseWeight 2 (modeBound j upward x))) + convert! hh.mapL Complex.ofRealCLM using 1 + ext k + simp only [RCLike.inner_apply, inverseWeight_apply, modeBound_apply, Complex.ofRealCLM_apply, + map_mul, map_inv₀, map_pow, Complex.conj_ofReal, norm_mul, norm_inv, norm_pow, + Complex.norm_real, Real.norm_eq_abs, Complex.ofReal_mul, Complex.ofReal_pow, + Complex.ofReal_inv, Complex.ofReal_div] + exact quadratic_coordinate _ _ (by have := numberWeight_one_le k; linarith) (x k) +end Annihilation + +namespace WeightedGenerator +open EntropyPhotonNumber Annihilation +open scoped BigOperators +variable {n : ℕ} {I J : Type*} + + +def dissipator (x : I → Fock n) (j : Fin n) (upward : Bool) : Fock n →L[ℂ] Fock n := + CrossEnsemble.operator (fun i => gain j upward (x i)) (fun i => gain j upward (x i))- + (2:ℂ)⁻¹ • (CrossEnsemble.operator (fun i => modeBound j upward (x i)) (fun i => inverseWeight 1 (x i))+ + CrossEnsemble.operator (fun i => inverseWeight 1 (x i)) (fun i => modeBound j upward (x i))) + +def generator (r : ℝ) (x : I → Fock n) : Fock n →L[ℂ] Fock n := + ∑ j, (((r+1:ℝ):ℂ) • dissipator x j false+(r:ℂ) • dissipator x j true) + +def pairing (r : ℝ) (x : I → Fock n) (Z : Fock n →L[ℂ] Fock n) : ℂ := + ∑ j, (((r+1:ℝ):ℂ)*(CrossEnsemble.pairing (fun i => gain j false (x i)) (fun i => gain j false (x i)) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (fun i => modeBound j false (x i)) (fun i => inverseWeight 1 (x i)) Z+ + CrossEnsemble.pairing (fun i => inverseWeight 1 (x i)) (fun i => modeBound j false (x i)) Z))+ + (r:ℂ)*(CrossEnsemble.pairing (fun i => gain j true (x i)) (fun i => gain j true (x i)) Z- + (2:ℂ)⁻¹*(CrossEnsemble.pairing (fun i => modeBound j true (x i)) (fun i => inverseWeight 1 (x i)) Z+ + CrossEnsemble.pairing (fun i => inverseWeight 1 (x i)) (fun i => modeBound j true (x i)) Z))) + +theorem pairing_hasSum (b : HilbertBasis J ℂ (Fock n)) (r : ℝ) (x : I → Fock n) + (hx : Summable (fun i => ‖x i‖^2)) (Z : Fock n →L[ℂ] Fock n) : + HasSum (fun k => inner ℂ (b k) (Z (generator r x (b k)))) (pairing r x Z) := by + have ha (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (gain j u) + have hb (j : Fin n) (u : Bool) := CrossEnsemble.applied_summable hx (modeBound j u) + have hc := CrossEnsemble.applied_summable hx (inverseWeight 1) + have h (j : Fin n) (u : Bool) := + (CrossEnsemble.pairing_trace b (ha j u) (ha j u) Z).sub + (((CrossEnsemble.pairing_trace b (hb j u) hc Z).add + (CrossEnsemble.pairing_trace b hc (hb j u) Z)).mul_left (2:ℂ)⁻¹) + have hh := hasSum_sum fun j (_hj : j ∈ (Finset.univ : Finset (Fin n))) => + ((h j false).mul_left ((r+1:ℝ):ℂ)).add ((h j true).mul_left (r:ℂ)) + convert! hh using 1 + ext k + simp only [generator, dissipator, sum_apply, add_apply, + sub_apply, smul_apply, map_sum, map_add, map_sub, map_smul, + inner_sum, inner_sub_right, inner_add_right, inner_smul_right] + +end WeightedGenerator + +end + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/HardSphere/GrandCanonical.lean b/lean/OAI/MathematicalPhysics/HardSphere/GrandCanonical.lean new file mode 100644 index 0000000000000000000000000000000000000000..aad684b308d7beb53c0b64ac5f3f5ce06a3f7d02 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/HardSphere/GrandCanonical.lean @@ -0,0 +1,599 @@ +import Mathlib + +namespace OAI + +/-! +# Grand-canonical hard-sphere probability and kinetic fluctuation preliminaries + +This development proves microscopic law normalization, scattering and covariance algebra, +exact centering, and compact and Gaussian-growth test estimates. The dynamics, backward Gaussian +field, and finite-dimensional limit are specified, but their existence or convergence is not proved. +The almost-everywhere deterministic flow and backward Gaussian field constructions, connected-history +estimates, sharp cumulant bounds, discrepancy and centering transfer, and finite-dimensional +convergence remain open here. +-/ + +noncomputable section + +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators RealInnerProductSpace ContDiff ZeroAtInfty + +namespace HardSphereFluctuations + +abbrev R3 := EuclideanSpace ℝ (Fin 3) +abbrev Phase := R3 × R3 +abbrev Test := Phase → ℝ +abbrev Density := ℝ → Phase → ℝ +abbrev Sphere := Metric.sphere (0 : R3) 1 + +def sphereArea : Measure Sphere := (volume : Measure R3).toSphere + +def collisionKernel (v w σ : R3) : ℝ := max (inner ℝ (v - w) σ) 0 + +def scatterLeft (v w σ : R3) : R3 := v - (inner ℝ (v - w) σ) • σ + +def scatterRight (v w σ : R3) : R3 := w + (inner ℝ (v - w) σ) • σ + +def pairDifference (φ : Test) (x v w σ : R3) : ℝ := + φ (x, scatterLeft v w σ) + φ (x, scatterRight v w σ) - φ (x, v) - φ (x, w) + +def latticePoint (a : Fin 3 → ℤ) : R3 := WithLp.toLp 2 (fun j => (a j : ℝ)) + +def bolNorm {E : Type*} [NormedAddCommGroup E] (b : ℝ) (g : Phase → E) : ℝ≥0∞ := + ∑' a : Fin 3 → ℤ, + ⨆ (x : R3) (_ : ‖x - latticePoint a‖ ≤ 1) (v : R3), + ENNReal.ofReal (Real.exp (b * ‖v‖ ^ 2) * ‖g (x, v)‖) + +def spatialDerivative (g : Test) (z : Phase) : R3 →L[ℝ] ℝ := + fderiv ℝ (fun x : R3 => g (x, z.2)) z.1 + +def boltzmannQ (g : Test) (z : Phase) : ℝ := + ∫ p : R3 × Sphere, + collisionKernel z.2 p.1 p.2 * + (g (z.1, scatterLeft z.2 p.1 p.2) * g (z.1, scatterRight z.2 p.1 p.2) - + g z * g (z.1, p.1)) + ∂((volume : Measure R3).prod sphereArea) + +structure ClassicalBoltzmann (T : ℝ) (f₀ : Test) (f : Density) : Prop where + continuous : ContinuousOn (fun p : ℝ × Phase => f p.1 p.2) (Icc 0 T ×ˢ univ) + nonnegative : ∀ t ∈ Icc 0 T, ∀ z, 0 ≤ f t z + initial : f 0 = f₀ + classical : ∀ v : R3, + ContDiffOn ℝ 1 (fun p : ℝ × R3 => f p.1 (p.2, v)) (Ioo 0 T ×ˢ univ) + equation : ∀ t ∈ Ioo 0 T, ∀ z : Phase, + deriv (fun s => f s z) t + spatialDerivative (f t) z z.2 = boltzmannQ (f t) z + +structure KineticAssumption (β T : ℝ) (f₀ : Test) (f : Density) : Prop where + beta_pos : 0 < β + time_pos : 0 < T + initial_smooth : ContDiff ℝ ∞ f₀ + initial_nonnegative : ∀ z, 0 ≤ f₀ z + initial_integrable : Integrable f₀ (volume : Measure Phase) + initial_mass : ∫ z, f₀ z = 1 + initial_bol : bolNorm (2 * β) f₀ + bolNorm (2 * β) (spatialDerivative f₀) < ⊤ + solution : ClassicalBoltzmann T f₀ f + gaussian_bound : ∃ M : ℝ, ∀ t ∈ Icc 0 T, ∀ z : Phase, + Real.exp (2 * β * ‖z.2‖ ^ 2) * f t z ≤ M + +def collisionDrift (f : Density) (t : ℝ) (φ : Test) (z : Phase) : ℝ := + ∫ p : R3 × Sphere, + collisionKernel z.2 p.1 p.2 * f t (z.1, p.1) * pairDifference φ z.1 z.2 p.1 p.2 + ∂((volume : Measure R3).prod sphereArea) + +def drift (f : Density) (t : ℝ) (φ : Test) (z : Phase) : ℝ := + spatialDerivative φ z z.2 + collisionDrift f t φ z + +abbrev Collision := R3 × R3 × R3 × Sphere + +def collisionBase : Measure Collision := + (volume : Measure R3).prod ((volume : Measure R3).prod + ((volume : Measure R3).prod sphereArea)) + +def collisionWeight (f : Density) (t : ℝ) (p : Collision) : ℝ := + (1 / 2 : ℝ) * collisionKernel p.2.1 p.2.2.1 p.2.2.2 * + f t (p.1, p.2.1) * f t (p.1, p.2.2.1) + +def collisionDifference (φ : Test) (p : Collision) : ℝ := + pairDifference φ p.1 p.2.1 p.2.2.1 p.2.2.2 + +def collisionCovariance (f : Density) (t : ℝ) (φ ψ : Test) : ℝ := + ∫ p, collisionWeight f t p * collisionDifference φ p * collisionDifference ψ p + ∂collisionBase + +def initialCovariance (f₀ φ ψ : Test) : ℝ := ∫ z, f₀ z * φ z * ψ z + +abbrev CompactTest := {φ : Test // ContDiff ℝ ∞ φ ∧ HasCompactSupport φ} + +abbrev TestCoordinates := C₀(Phase, ℝ) + +def testAtExponent (a : ℝ) (h : TestCoordinates) : Test := + fun z => Real.exp (a * ‖z.2‖ ^ 2) * h z + +def InTestSpace (a : ℝ) (h : Test) : Prop := ∃ k : TestCoordinates, testAtExponent a k = h + +def SmallTest (β : ℝ) (h : Test) : Prop := ∃ a : ℝ, 0 ≤ a ∧ a < β ∧ InTestSpace a h + +abbrev SmallTests (β : ℝ) := {h : Test // SmallTest β h} + +def freeTransport (u : ℝ) (h : Test) : Test := fun z => h (z.1 + u • z.2, z.2) + +abbrev Propagator := ℝ → ℝ → Test → Test + +def BoundedOnScales (β T : ℝ) (U : Propagator) : Prop := + ∀ a b : ℝ, 0 ≤ a → a < b → b < 2 * β → + ∃ V : ℝ → ℝ → TestCoordinates →L[ℝ] TestCoordinates, + (∀ r ∈ Icc 0 T, ∀ t ∈ Icc r T, ∀ h, + U r t (testAtExponent a h) = testAtExponent b (V r t h)) ∧ + (∃ C : ℝ, ∀ r ∈ Icc 0 T, ∀ t ∈ Icc r T, ‖V r t‖ ≤ C) + +structure IsBackwardPropagator (β T : ℝ) (f : Density) (U : Propagator) : Prop where + bounded : BoundedOnScales β T U + diagonal : ∀ a, 0 ≤ a → a < 2 * β → ∀ t ∈ Icc 0 T, ∀ h, + U t t (testAtExponent a h) = testAtExponent a h + time_integrable : ∀ a b, 0 ≤ a → a < b → b < 2 * β → + ∀ r ∈ Icc 0 T, ∀ t ∈ Icc r T, ∀ h : TestCoordinates, ∀ z, + IntervalIntegrable (fun s => freeTransport (s - r) + (collisionDrift f s (U s t (testAtExponent a h))) z) volume r t + mild : ∀ a b, 0 ≤ a → a < b → b < 2 * β → + ∀ r ∈ Icc 0 T, ∀ t ∈ Icc r T, ∀ h : TestCoordinates, ∀ z, + U r t (testAtExponent a h) z = freeTransport (t - r) (testAtExponent a h) z + + ∫ s in r..t, freeTransport (s - r) + (collisionDrift f s (U s t (testAtExponent a h))) z + composition : ∀ a, 0 ≤ a → a < 2 * β → ∀ r ∈ Icc 0 T, + ∀ s ∈ Icc r T, ∀ t ∈ Icc s T, ∀ h : TestCoordinates, + U r s (U s t (testAtExponent a h)) = U r t (testAtExponent a h) + +abbrev Configuration (N : ℕ) := Fin N → Phase +abbrev Microstate := (N : ℕ) × Configuration N + +def admissible (ε : ℝ) (N : ℕ) : Set (Configuration N) := + {Z | ∀ i j, i ≠ j → ε < ‖(Z i).1 - (Z j).1‖} + +def particleIntensity (ε : ℝ) : ℝ := (ε ^ 2)⁻¹ + +def sectorLaw (f₀ : Test) (ε : ℝ) (N : ℕ) : Measure (Configuration N) := by + classical + exact (volume : Measure (Configuration N)).withDensity (fun Z => + if Z ∈ admissible ε N then + ENNReal.ofReal (particleIntensity ε ^ N / (N.factorial : ℝ)) * + ∏ i, ENNReal.ofReal (f₀ (Z i)) + else 0) + +def grandCanonicalRaw (f₀ : Test) (ε : ℝ) : Measure Microstate := + Measure.sum (fun N => Measure.map (Sigma.mk N) (sectorLaw f₀ ε N)) + +def partitionFunction (f₀ : Test) (ε : ℝ) : ℝ≥0∞ := + grandCanonicalRaw f₀ ε univ + +def grandCanonical (f₀ : Test) (ε : ℝ) : Measure Microstate := + (partitionFunction f₀ ε)⁻¹ • grandCanonicalRaw f₀ ε + +def freeFlight {N : ℕ} (t : ℝ) (Z : Configuration N) : Configuration N := + fun i => ((Z i).1 + t • (Z i).2, (Z i).2) + +def OneElasticImpact {N : ℕ} (ε : ℝ) (Z Z' : Configuration N) : Prop := + ∃ i j : Fin N, i ≠ j ∧ + ‖(Z j).1 - (Z i).1‖ = ε ∧ + 0 < inner ℝ ((Z i).2 - (Z j).2) (ε⁻¹ • ((Z j).1 - (Z i).1)) ∧ + (∀ l, (Z' l).1 = (Z l).1) ∧ + (Z' i).2 = scatterLeft (Z i).2 (Z j).2 (ε⁻¹ • ((Z j).1 - (Z i).1)) ∧ + (Z' j).2 = scatterRight (Z i).2 (Z j).2 (ε⁻¹ • ((Z j).1 - (Z i).1)) ∧ + (∀ l, l ≠ i → l ≠ j → (Z' l).2 = (Z l).2) ∧ + (∀ l h, l ≠ h → ¬ (l = i ∧ h = j) → ¬ (l = j ∧ h = i) → + ε < ‖(Z l).1 - (Z h).1‖) + +def IsRegularTrajectory {N : ℕ} (ε T : ℝ) (Z : Configuration N) + (q : ℝ → Configuration N) : Prop := + Z ∈ admissible ε N ∧ ∃ k : ℕ, ∃ τ : ℕ → ℝ, ∃ Q : ℕ → Configuration N, + τ 0 = 0 ∧ τ (k + 1) = T ∧ StrictMonoOn τ (Icc 0 (k + 1)) ∧ Q 0 = Z ∧ + (∀ j ≤ k, ∀ t ∈ Ico (τ j) (τ (j + 1)), q t = freeFlight (t - τ j) (Q j)) ∧ + q T = freeFlight (T - τ k) (Q k) ∧ q T ∈ admissible ε N ∧ + (∀ j < k, OneElasticImpact ε (freeFlight (τ (j + 1) - τ j) (Q j)) (Q (j + 1))) ∧ + (∀ t ∈ Icc 0 T, ∀ i j, i ≠ j → ε ≤ ‖(q t i).1 - (q t j).1‖) + +abbrev Dynamics := ℝ → ℝ → (N : ℕ) → Configuration N → Configuration N + +def IsHardSphereDynamics (T : ℝ) (S : Dynamics) : Prop := + ∀ ε : ℝ, 0 < ε → ∀ N : ℕ, + (∀ t ∈ Icc 0 T, Measurable (S ε t N)) ∧ + (∀ᵐ Z ∂((volume : Measure (Configuration N)).restrict (admissible ε N)), + IsRegularTrajectory ε T Z (fun t => S ε t N Z) ∧ + ∀ q : ℝ → Configuration N, IsRegularTrajectory ε T Z q → + ∀ t ∈ Icc 0 T, q t = S ε t N Z) + +def empirical (ε : ℝ) (S : Dynamics) (t : ℝ) (φ : Test) (Z : Microstate) : ℝ := + (particleIntensity ε)⁻¹ * ∑ i, φ (S ε t Z.1 Z.2 i) + +def microscopicFluctuation (f₀ : Test) (ε : ℝ) (S : Dynamics) (t : ℝ) + (φ : Test) (Z : Microstate) : ℝ := + Real.sqrt (particleIntensity ε) * + (empirical ε S t φ Z - ∫ Z', empirical ε S t φ Z' ∂grandCanonical f₀ ε) + +def initialMeasure (f₀ : Test) : Measure Phase := + (volume : Measure Phase).withDensity (fun z => ENNReal.ofReal (f₀ z)) + +abbrev SpaceTimeCollision := ℝ × Collision + +def noiseMeasure (T : ℝ) (f : Density) : Measure SpaceTimeCollision := + ((volume.restrict (Icc 0 T)).prod collisionBase).withDensity + (fun p => ENNReal.ofReal (collisionWeight f p.1 p.2)) + +abbrev L2 {X : Type*} [MeasurableSpace X] (μ : Measure X) := Lp ℝ 2 μ + +def toL2 {X : Type*} [MeasurableSpace X] (μ : Measure X) (h : X → ℝ) : L2 μ := by + classical + exact if hh : MemLp h 2 μ then hh.toLp h else 0 + +def constantNoiseKernel (t : ℝ) (h : Test) : SpaceTimeCollision → ℝ := + fun p => if p.1 ∈ Icc 0 t then collisionDifference h p.2 else 0 + +def backwardNoiseKernel (U : Propagator) (t : ℝ) (h : Test) : SpaceTimeCollision → ℝ := + fun p => if p.1 ∈ Icc 0 t then collisionDifference (U p.1 t h) p.2 else 0 + +structure IsonormalPair (T : ℝ) (f₀ : Test) (f : Density) + (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω) where + initial : L2 (initialMeasure f₀) →L[ℝ] L2 P + source : L2 (noiseMeasure T f) →L[ℝ] L2 P + initial_law : ∀ h, Measure.map (initial h) P = gaussianReal 0 (‖h‖₊ ^ 2) + source_law : ∀ h, Measure.map (source h) P = gaussianReal 0 (‖h‖₊ ^ 2) + independent : IndepFun + (fun o : Ω => fun h : L2 (initialMeasure f₀) => initial h o) + (fun o : Ω => fun h : L2 (noiseMeasure T f) => source h o) P + +def gaussianNoise {T : ℝ} {f₀ : Test} {f : Density} + {Ω : Type} [MeasurableSpace Ω] {P : Measure Ω} + (G : IsonormalPair T f₀ f Ω P) (t : ℝ) (h : Test) : L2 P := + G.source (toL2 (noiseMeasure T f) (constantNoiseKernel t h)) + +def mildField {T : ℝ} {f₀ : Test} {f : Density} + {Ω : Type} [MeasurableSpace Ω] {P : Measure Ω} + (U : Propagator) (G : IsonormalPair T f₀ f Ω P) (t : ℝ) (h : Test) : L2 P := + G.initial (toL2 (initialMeasure f₀) (U 0 t h)) + + G.source (toL2 (noiseMeasure T f) (backwardNoiseKernel U t h)) + +def CenteredGaussianFamily {Ω I : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (X : I → Ω → ℝ) : Prop := + ∀ n : ℕ, ∀ idx : Fin n → I, ∀ a : Fin n → ℝ, ∃ v : ℝ≥0, + Measure.map (fun o => ∑ i, a i * X (idx i) o) P = gaussianReal 0 v + +structure IsFluctuationField (β T : ℝ) (f₀ : Test) (f : Density) + (U : Propagator) {Ω : Type} [MeasurableSpace Ω] {P : Measure Ω} + (G : IsonormalPair T f₀ f Ω P) : Prop where + kernel_integrable : ∀ h : SmallTests β, ∀ t ∈ Icc 0 T, + MemLp (U 0 t h) 2 (initialMeasure f₀) ∧ + MemLp (backwardNoiseKernel U t h) 2 (noiseMeasure T f) ∧ + MemLp (constantNoiseKernel t h) 2 (noiseMeasure T f) + initial_integrable : ∀ h : SmallTests β, MemLp (h : Test) 2 (initialMeasure f₀) + field_bounded_linear : ∀ a, 0 ≤ a → a < β → + ∃ L : ℝ → TestCoordinates →L[ℝ] L2 P, + (∀ t ∈ Icc 0 T, ∀ h, mildField U G t (testAtExponent a h) = L t h) ∧ + ∃ C : ℝ, ∀ t ∈ Icc 0 T, ‖L t‖ ≤ C + centered_gaussian : CenteredGaussianFamily P + (fun p : Icc (0 : ℝ) T × SmallTests β => (mildField U G p.1 p.2 : Ω → ℝ)) + noise_centered_gaussian : CenteredGaussianFamily P + (fun p : Icc (0 : ℝ) T × SmallTests β => (gaussianNoise G p.1 p.2 : Ω → ℝ)) + drift_test : ∀ h : CompactTest, ∀ t ∈ Icc 0 T, SmallTest β (drift f t h) + drift_integrable : ∀ h : CompactTest, ∀ t ∈ Icc 0 T, + IntervalIntegrable (fun s => mildField U G s (drift f s h)) volume 0 t + weak_equation : ∀ h : CompactTest, ∀ t ∈ Icc 0 T, + mildField U G t h = mildField U G 0 h + + (∫ s in 0..t, mildField U G s (drift f s h)) + gaussianNoise G t h + initial_independent : IndepFun + (fun o : Ω => fun h : SmallTests β => mildField U G 0 h o) + (fun o : Ω => fun p : Icc (0 : ℝ) T × SmallTests β => gaussianNoise G p.1 p.2 o) P + initial_covariance : ∀ h k : SmallTests β, + (∫ o, mildField U G 0 h o * mildField U G 0 k o ∂P) = initialCovariance f₀ h k + covariance_integrable : ∀ h k : SmallTests β, + IntervalIntegrable (fun r => collisionCovariance f r h k) volume 0 T + noise_covariance : ∀ h k : SmallTests β, ∀ t ∈ Icc 0 T, ∀ s ∈ Icc 0 T, + (∫ o, gaussianNoise G t h o * gaussianNoise G s k o ∂P) = + ∫ r in 0..min t s, collisionCovariance f r h k + independent_increments : ∀ n : ℕ, ∀ τ : Fin (n + 1) → ℝ, + (∀ i, τ i ∈ Icc 0 T) → Monotone τ → + iIndepFun (fun i : Fin n => fun o : Ω => fun h : SmallTests β => + (gaussianNoise G (τ i.succ) h - gaussianNoise G (τ i.castSucc) h) o) P + backward_covariance : ∀ h k : SmallTests β, ∀ t ∈ Icc 0 T, ∀ s ∈ Icc 0 T, + (∫ o, mildField U G t h o * mildField U G s k o ∂P) = + initialCovariance f₀ (U 0 t h) (U 0 s k) + + ∫ r in 0..min t s, collisionCovariance f r (U r t h) (U r s k) + +def FiniteDimensionalLimit (T : ℝ) (f₀ : Test) (S : Dynamics) + {Ω : Type} [MeasurableSpace Ω] (P : Measure Ω) (X : ℝ → Test → L2 P) : Prop := + ∀ m : ℕ, 1 ≤ m → ∀ ts : Fin m → ℝ, (∀ i, ts i ∈ Icc 0 T) → + ∀ hs : Fin m → CompactTest, ∀ F : BoundedContinuousFunction (Fin m → ℝ) ℝ, + Tendsto + (fun ε => ∫ Z, F (fun i => microscopicFluctuation f₀ ε S (ts i) (hs i) Z) + ∂grandCanonical f₀ ε) + (𝓝[>] (0 : ℝ)) + (𝓝 (∫ o, F (fun i => X (ts i) (hs i) o) ∂P)) + +structure ProbabilitySpaceData where + carrier : Type + measurable : MeasurableSpace carrier + law : @Measure carrier measurable + probability : @IsProbabilityMeasure carrier measurable law + +attribute [instance] ProbabilitySpaceData.measurable ProbabilitySpaceData.probability + +end HardSphereFluctuations + +namespace HardSphereFluctuations + +theorem collisionKernel_nonnegative (v w σ : R3) : 0 ≤ collisionKernel v w σ := + le_max_right _ _ + +theorem scatter_momentum (v w σ : R3) : + scatterLeft v w σ + scatterRight v w σ = v + w := by + unfold scatterLeft scatterRight + abel + +theorem scatter_energy (v w σ : R3) (hσ : ‖σ‖ = 1) : + ‖scatterLeft v w σ‖ ^ 2 + ‖scatterRight v w σ‖ ^ 2 = ‖v‖ ^ 2 + ‖w‖ ^ 2 := by + unfold scatterLeft scatterRight + rw [norm_sub_sq_real, norm_add_sq_real] + simp only [inner_smul_right, norm_smul, Real.norm_eq_abs, hσ, mul_one, sq_abs, + inner_sub_left] + ring + +theorem scatter_normal_reversed (v w σ : R3) (hσ : ‖σ‖ = 1) : + inner ℝ (scatterLeft v w σ - scatterRight v w σ) σ = -inner ℝ (v - w) σ := by + simp only [scatterLeft, scatterRight, inner_sub_left, inner_add_left, + real_inner_smul_left, real_inner_self_eq_norm_sq, hσ] + ring + +theorem scatterLeft_involutive (v w σ : R3) (hσ : ‖σ‖ = 1) : + scatterLeft (scatterLeft v w σ) (scatterRight v w σ) σ = v := by + change scatterLeft v w σ - + (inner ℝ (scatterLeft v w σ - scatterRight v w σ) σ) • σ = v + rw [scatter_normal_reversed v w σ hσ] + simp [scatterLeft, neg_smul] + +theorem scatterRight_involutive (v w σ : R3) (hσ : ‖σ‖ = 1) : + scatterRight (scatterLeft v w σ) (scatterRight v w σ) σ = w := by + change scatterRight v w σ + + (inner ℝ (scatterLeft v w σ - scatterRight v w σ) σ) • σ = w + rw [scatter_normal_reversed v w σ hσ] + simp [scatterRight, neg_smul] + +theorem collisionKernel_prepost (v w σ : R3) (hσ : ‖σ‖ = 1) : + collisionKernel (scatterLeft v w σ) (scatterRight v w σ) (-σ) = + collisionKernel v w σ := by + unfold collisionKernel + rw [inner_neg_right, scatter_normal_reversed v w σ hσ, neg_neg] + +theorem pairDifference_linear (φ ψ : Test) (a b : ℝ) (x v w σ : R3) : + pairDifference (fun z => a * φ z + b * ψ z) x v w σ = + a * pairDifference φ x v w σ + b * pairDifference ψ x v w σ := by + unfold pairDifference + ring + +theorem pairDifference_constant (c : ℝ) (x v w σ : R3) : + pairDifference (fun _ => c) x v w σ = 0 := by + simp [pairDifference] + +theorem pairDifference_momentum (u x v w σ : R3) : + pairDifference (fun z => inner ℝ z.2 u) x v w σ = 0 := by + simp only [pairDifference, scatterLeft, scatterRight, inner_sub_left, + inner_add_left, real_inner_smul_left] + ring + +theorem pairDifference_energy (x v w σ : R3) (hσ : ‖σ‖ = 1) : + pairDifference (fun z => ‖z.2‖ ^ 2) x v w σ = 0 := by + unfold pairDifference + rw [scatter_energy v w σ hσ] + ring + +theorem covariance_source_algebra + (a b a' b' c d c' d' : ℝ) : + ((a' * c' + b' * d' - a * c - b * d) + + (a' * d' + b' * c' - a * d - b * c)) - + ((c + d) * (a' + b' - a - b) + (a + b) * (c' + d' - c - d)) = + (a' + b' - a - b) * (c' + d' - c - d) := by + ring + +theorem collisionWeight_nonnegative (f : Density) (t : ℝ) + (hf : ∀ z, 0 ≤ f t z) (p : Collision) : 0 ≤ collisionWeight f t p := by + unfold collisionWeight + exact mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) + (collisionKernel_nonnegative _ _ _)) (hf _)) (hf _) + +theorem collisionCovariance_symmetric (f : Density) (t : ℝ) (φ ψ : Test) : + collisionCovariance f t φ ψ = collisionCovariance f t ψ φ := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun p => by ring) + +theorem collisionCovariance_nonnegative (f : Density) (t : ℝ) + (hf : ∀ z, 0 ≤ f t z) (φ : Test) : 0 ≤ collisionCovariance f t φ φ := by + apply integral_nonneg + intro p + change 0 ≤ collisionWeight f t p * collisionDifference φ p * collisionDifference φ p + have h := mul_nonneg (collisionWeight_nonnegative f t hf p) + (sq_nonneg (collisionDifference φ p)) + nlinarith only [h] + +theorem initialCovariance_symmetric (f₀ φ ψ : Test) : + initialCovariance f₀ φ ψ = initialCovariance f₀ ψ φ := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun z => by ring) + +theorem initialCovariance_nonnegative (f₀ : Test) (hf : ∀ z, 0 ≤ f₀ z) (φ : Test) : + 0 ≤ initialCovariance f₀ φ φ := by + apply integral_nonneg + intro z + change 0 ≤ f₀ z * φ z * φ z + have h := mul_nonneg (hf z) (sq_nonneg (φ z)) + nlinarith only [h] + +theorem sqrt_particleIntensity (ε : ℝ) (hε : 0 < ε) : + Real.sqrt (particleIntensity ε) = ε⁻¹ := by + simp [particleIntensity, Real.sqrt_inv, Real.sqrt_sq_eq_abs, abs_of_pos hε] + +theorem microscopicFluctuation_integral_zero + (f₀ : Test) (ε : ℝ) (S : Dynamics) (t : ℝ) (φ : Test) + [IsProbabilityMeasure (grandCanonical f₀ ε)] + (hi : Integrable (empirical ε S t φ) (grandCanonical f₀ ε)) : + ∫ Z, microscopicFluctuation f₀ ε S t φ Z ∂grandCanonical f₀ ε = 0 := by + unfold microscopicFluctuation + rw [integral_const_mul, integral_sub hi (integrable_const _)] + simp + +theorem toL2_ae {X : Type*} [MeasurableSpace X] (μ : Measure X) (h : X → ℝ) + (hh : MemLp h 2 μ) : (toL2 μ h : X → ℝ) =ᵐ[μ] h := by + simp only [toL2, dite_eq_left hh] + exact hh.coeFn_toLp + +end HardSphereFluctuations + +namespace HardSphereFluctuations + +theorem product_density_lintegral (f₀ : Test) + (hn : ∀ z, 0 ≤ f₀ z) (hi : Integrable f₀ (volume : Measure Phase)) + (hm : ∫ z, f₀ z = 1) (N : ℕ) : + (∫⁻ Z : Configuration N, ∏ i, ENNReal.ofReal (f₀ (Z i))) = 1 := by + have hp : Integrable (fun Z : Configuration N => ∏ i, f₀ (Z i)) volume := + Integrable.fintype_prod (fun _ => hi) + have hp₀ : ∀ Z : Configuration N, 0 ≤ ∏ i, f₀ (Z i) := + fun Z => Finset.prod_nonneg (fun i _ => hn (Z i)) + calc + _ = ∫⁻ Z : Configuration N, ENNReal.ofReal (∏ i, f₀ (Z i)) := by + apply lintegral_congr + intro Z + exact (ENNReal.ofReal_prod_of_nonneg (fun i _ => hn (Z i))).symm + _ = ENNReal.ofReal (∫ Z : Configuration N, ∏ i, f₀ (Z i)) := + (ofReal_integral_eq_lintegral_ofReal hp (Filter.Eventually.of_forall hp₀)).symm + _ = 1 := by + rw [integral_fin_nat_prod_volume_eq_prod (fun _ => f₀)] + simp [hm] + +theorem sector_mass_le (f₀ : Test) (ε : ℝ) + (hn : ∀ z, 0 ≤ f₀ z) (hi : Integrable f₀ (volume : Measure Phase)) + (hm : ∫ z, f₀ z = 1) (N : ℕ) : + sectorLaw f₀ ε N univ ≤ ENNReal.ofReal (particleIntensity ε ^ N / (N.factorial : ℝ)) := by + classical + unfold sectorLaw + rw [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] + calc + _ ≤ ∫⁻ Z : Configuration N, + ENNReal.ofReal (particleIntensity ε ^ N / (N.factorial : ℝ)) * + ∏ i, ENNReal.ofReal (f₀ (Z i)) := by + apply lintegral_mono + intro Z + dsimp only + split_ifs <;> simp + _ = _ := by + rw [lintegral_const_mul' _ _ ENNReal.ofReal_ne_top, + product_density_lintegral f₀ hn hi hm N, mul_one] + +theorem sector_zero_mass (f₀ : Test) (ε : ℝ) : sectorLaw f₀ ε 0 univ = 1 := by + classical + simp [sectorLaw, admissible] + exact Measure.pi_empty_univ (fun _ : Fin 0 => (volume : Measure Phase)) + +theorem partitionFunction_eq_tsum (f₀ : Test) (ε : ℝ) : + partitionFunction f₀ ε = ∑' N, sectorLaw f₀ ε N univ := by + unfold partitionFunction grandCanonicalRaw + rw [Measure.sum_apply _ MeasurableSet.univ] + apply tsum_congr + intro N + have hs : Measurable (Sigma.mk N : Configuration N → Microstate) := + measurable_iff_le_map.mpr (iInf_le _ N) + rw [Measure.map_apply hs MeasurableSet.univ, Set.preimage_univ] + +theorem one_le_partitionFunction (f₀ : Test) (ε : ℝ) : 1 ≤ partitionFunction f₀ ε := by + rw [partitionFunction_eq_tsum, ← sector_zero_mass f₀ ε] + exact ENNReal.le_tsum (f := fun particleCount => sectorLaw f₀ ε particleCount univ) 0 + +theorem partitionFunction_le_exp (f₀ : Test) (ε : ℝ) + (hn : ∀ z, 0 ≤ f₀ z) (hi : Integrable f₀ (volume : Measure Phase)) + (hm : ∫ z, f₀ z = 1) : + partitionFunction f₀ ε ≤ ENNReal.ofReal (Real.exp (particleIntensity ε)) := by + have hsum : HasSum (fun N : ℕ => particleIntensity ε ^ N / (N.factorial : ℝ)) + (Real.exp (particleIntensity ε)) := by + rw [Real.exp_eq_exp_ℝ] + exact NormedSpace.expSeries_div_hasSum_exp _ + have hnn : ∀ N : ℕ, 0 ≤ particleIntensity ε ^ N / (N.factorial : ℝ) := by + intro N + unfold particleIntensity + positivity + calc + _ = ∑' N, sectorLaw f₀ ε N univ := partitionFunction_eq_tsum f₀ ε + _ ≤ ∑' N, ENNReal.ofReal (particleIntensity ε ^ N / (N.factorial : ℝ)) := + ENNReal.tsum_le_tsum (sector_mass_le f₀ ε hn hi hm) + _ = ENNReal.ofReal (Real.exp (particleIntensity ε)) := by + rw [← ENNReal.ofReal_tsum_of_nonneg hnn hsum.summable, hsum.tsum_eq] + +theorem grandCanonical_isProbability (f₀ : Test) (ε : ℝ) + (hn : ∀ z, 0 ≤ f₀ z) (hi : Integrable f₀ (volume : Measure Phase)) + (hm : ∫ z, f₀ z = 1) : IsProbabilityMeasure (grandCanonical f₀ ε) := by + have hp : partitionFunction f₀ ε ≠ 0 := + ne_of_gt (lt_of_lt_of_le zero_lt_one (one_le_partitionFunction f₀ ε)) + have hf : partitionFunction f₀ ε ≠ ⊤ := + ne_of_lt (lt_of_le_of_lt (partitionFunction_le_exp f₀ ε hn hi hm) ENNReal.ofReal_lt_top) + constructor + change (partitionFunction f₀ ε)⁻¹ * partitionFunction f₀ ε = 1 + exact ENNReal.inv_mul_cancel hp hf + +end HardSphereFluctuations + +namespace HardSphereFluctuations + +theorem compactTest_small (β : ℝ) (hβ : 0 < β) (φ : CompactTest) : + SmallTest β φ := by + let k : TestCoordinates := + { toFun := φ + continuous_toFun := φ.2.1.continuous + zero_at_infty' := φ.2.2.is_zero_at_infty } + refine ⟨0, le_rfl, hβ, k, ?_⟩ + funext z + simp [testAtExponent, k] + +theorem testAtExponent_bound (a : ℝ) (h : TestCoordinates) (z : Phase) : + |testAtExponent a h z| ≤ ‖h‖ * Real.exp (a * ‖z.2‖ ^ 2) := by + have hb : |h z| ≤ ‖h‖ := by + simpa only [Real.norm_eq_abs, ZeroAtInftyContinuousMap.norm_toBCF_eq_norm, + ZeroAtInftyContinuousMap.toBCF_apply] + using h.toBCF.norm_coe_le_norm z + calc + _ = Real.exp (a * ‖z.2‖ ^ 2) * |h z| := by + rw [testAtExponent, abs_mul, abs_of_pos (Real.exp_pos _)] + _ ≤ Real.exp (a * ‖z.2‖ ^ 2) * ‖h‖ := + mul_le_mul_of_nonneg_left hb (Real.exp_nonneg _) + _ = _ := mul_comm _ _ + +theorem pairDifference_gaussian_bound (a : ℝ) (ha : 0 ≤ a) + (h : TestCoordinates) (x v w σ : R3) (hσ : ‖σ‖ = 1) : + |pairDifference (testAtExponent a h) x v w σ| ≤ + 4 * ‖h‖ * Real.exp (a * (‖v‖ ^ 2 + ‖w‖ ^ 2)) := by + let E : ℝ := ‖v‖ ^ 2 + ‖w‖ ^ 2 + let R : ℝ := ‖h‖ * Real.exp (a * E) + have hb (u : R3) (hu : ‖u‖ ^ 2 ≤ E) : |testAtExponent a h (x, u)| ≤ R := by + calc + _ ≤ ‖h‖ * Real.exp (a * ‖u‖ ^ 2) := testAtExponent_bound a h (x, u) + _ ≤ R := mul_le_mul_of_nonneg_left + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hu ha)) (norm_nonneg h) + have he := scatter_energy v w σ hσ + have hv' : |testAtExponent a h (x, scatterLeft v w σ)| ≤ R := + hb _ (by dsimp [E]; nlinarith only [he, sq_nonneg ‖scatterRight v w σ‖]) + have hw' : |testAtExponent a h (x, scatterRight v w σ)| ≤ R := + hb _ (by dsimp [E]; nlinarith only [he, sq_nonneg ‖scatterLeft v w σ‖]) + have hv : |testAtExponent a h (x, v)| ≤ R := + hb _ (by dsimp [E]; nlinarith only [sq_nonneg ‖w‖]) + have hw : |testAtExponent a h (x, w)| ≤ R := + hb _ (by dsimp [E]; nlinarith only [sq_nonneg ‖v‖]) + calc + _ ≤ (|testAtExponent a h (x, scatterLeft v w σ) + + testAtExponent a h (x, scatterRight v w σ)| + + |testAtExponent a h (x, v)|) + |testAtExponent a h (x, w)| := + (abs_sub _ _).trans (add_le_add_left (abs_sub _ _) _) + _ ≤ ((|testAtExponent a h (x, scatterLeft v w σ)| + + |testAtExponent a h (x, scatterRight v w σ)|) + + |testAtExponent a h (x, v)|) + |testAtExponent a h (x, w)| := + add_le_add_left (add_le_add_left (abs_add_le _ _) _) _ + _ ≤ (R + R) + R + R := add_le_add (add_le_add (add_le_add hv' hw') hv) hw + _ = _ := by dsimp [R, E]; ring + +end HardSphereFluctuations + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/AveragedEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/AveragedEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..d25c86d54bc94c8bcf584d69d2a0e8ae33e387da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/AveragedEnergy.lean @@ -0,0 +1,297 @@ +import OAI.MathematicalPhysics.Heisenberg.HoleReturns + +namespace OAI + +section +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +noncomputable section +open scoped BigOperators Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +open Filter +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +attribute [local instance] exposureDecEq +attribute [-instance] exposureDecEq + +namespace Heisenberg.Exposure +attribute [local irreducible] killedMean Heisenberg.Hitting.hitting Heisenberg.Hitting.energy Heisenberg.Cycle.MissingSet layerHistory +open Heisenberg.Return Heisenberg.Hitting Heisenberg.Cycle Heisenberg.Conditioning +variable {V : Type*} [Fintype V] [DecidableEq V] + +theorem averaged_layer_energy {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (p : Fin n → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) (P : Set (Fin n×V)) + (D : (Fin n → Bool) → Set (Fin n×V)) (T : Finset P) + (hT : ∀ base j,j∈T → j.val∈D base) + (hQ : ∀ base,(MissingSet (layerHistory s (fun i => Equiv.swap (a i) (b i)) base) P)ᶜ∩Pᶜ ⊆ D base) : + let τ := fun i => Equiv.swap (a i) (b i) + let μ₀ := productWeight (fun i z => if z then p i else 1-p i) + let μ := fun c => μ₀ c*(2:ℝ)^missingCount (layerHistory s τ c) P + let θ := fun c => μ c/(∑ b,μ b) + let σ := fun base c => layerHistory s τ + (residualCoins (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c) + (∑ c,θ c*returnCount (layerHistory s τ c) P T) ≤ (T.card:ℝ)- + ∑ base,θ base*energy (killedMean μ₀ (σ base) (D base)) + (hitting (killedMean μ₀ (σ base) (D base)) (T.image Subtype.val)) := by + dsimp only + let τ := fun i => Equiv.swap (a i) (b i) + let w : Fin n → Bool → ℝ := fun i z => if z then p i else 1-p i + let μ := fun c => productWeight w c*(2:ℝ)^missingCount (layerHistory s τ c) P + let Z := ∑ c,μ c + let e := fun base => energy + (killedMean (productWeight w) (fun c => layerHistory s τ + (residualCoins (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c)) (D base)) + (hitting (killedMean (productWeight w) (fun c => layerHistory s τ + (residualCoins (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c)) (D base)) + (T.image Subtype.val)) + have hw0 : ∀ i z,0≤w i z := by + intro i z + cases z <;> simp only [w,Bool.false_eq_true,↓reduceIte] <;> linarith [(hp i).1,(hp i).2] + have hμ : ∀ c,0≤μ c := fun c => mul_nonneg (productWeight_nonneg w hw0 c) (by positivity) + have hZ : 0 le_mul_of_one_le_right (productWeight_nonneg w hw0 c) + (one_le_pow₀ (by norm_num))) + have h : (∑ c,μ c*returnCount (layerHistory s τ c) P T)≤∑ c,μ c*((T.card:ℝ)-e c) := by + apply expected_le μ hμ (layerExposure s τ P) (layerExposure_equivalence s τ P) + intro base hb + simpa only [τ,μ,w,e] using + (exposed_layer_energy s a b p hp P base (left_ne_zero_of_mul hb) (D base) T (hT base) (hQ base)) + have hh := div_le_div_of_nonneg_right h hZ.le + have he : (∑ c,μ c*((T.card:ℝ)-e c))/Z = (T.card:ℝ)-(∑ c,μ c*e c)/Z := by + simp only [mul_sub,Finset.sum_sub_distrib,←Finset.sum_mul] + change (Z*(T.card:ℝ)-(∑ c,μ c*e c))/Z = _ + rw [sub_div,mul_div_cancel_left₀ _ hZ.ne'] + rw [he] at hh + simpa only [Finset.sum_div,div_mul_eq_mul_div] using hh + +end Heisenberg.Exposure + +end +end +end +end +end +end +end +end +end + +noncomputable section +open Filter Topology +open scoped RealInnerProductSpace Classical +namespace Heisenberg.MeshEnergy +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] +variable [CompleteSpace E] + +end Heisenberg.MeshEnergy +namespace Heisenberg.MeshPair +open MeshEnergy +open scoped RealInnerProductSpace Classical +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +variable {V : Type*} [Fintype V] [DecidableEq V] + +end Heisenberg.MeshPair + +namespace Heisenberg.MeshPair +open scoped RealInnerProductSpace Classical +variable {V : Type*} [Fintype V] [DecidableEq V] + +end Heisenberg.MeshPair + +namespace Heisenberg.MatrixContraction + +variable {V : Type*} [Fintype V] + +end Heisenberg.MatrixContraction + +namespace Heisenberg.MeshPair +open Heisenberg.MatrixContraction Matrix +open scoped BigOperators +variable {V : Type*} [Fintype V] [DecidableEq V] + +end Heisenberg.MeshPair + +namespace Heisenberg.MeshPair +open Heisenberg.MatrixContraction +variable {V : Type*} [Fintype V] [DecidableEq V] + +end Heisenberg.MeshPair + +namespace Heisenberg.Serial +open Matrix Heisenberg.MeshPair +variable {V B : Type*} [Fintype V] [DecidableEq V] [Fintype B] + +end Heisenberg.Serial + +namespace Heisenberg.Serial +open Matrix Heisenberg.Hitting +variable {V : Type*} [Fintype V] [DecidableEq V] + +end Heisenberg.Serial + +namespace Heisenberg.Exposure +open Matrix +open scoped BigOperators +variable {T B V : Type*} [Fintype T] [Fintype B] [Fintype V] + +lemma productWeight_coordinate (w : T → B → ℝ) (hw : ∀ t, ∑ b,w t b = 1) + (t : T) (F : B → ℝ) : + (∑ c : T → B,productWeight w c * F (c t)) = ∑ b,w t b * F b := by + classical + let w' : T → B → ℝ := Function.update w t (fun b => w t b * F b) + have he : ∀ c,productWeight w c * F (c t) = productWeight w' c := by + intro c + have hh : (fun i => w' i (c i)) = Function.update (fun i => w i (c i)) t + (w t (c t) * F (c t)) := by + funext i + by_cases hi : i = t <;> simp [w',hi] + rw [productWeight,productWeight,hh,Finset.prod_update_of_mem (Finset.mem_univ t)] + rw [←Finset.mul_prod_erase Finset.univ (fun i => w i (c i)) (Finset.mem_univ t)] + rw [Finset.erase_eq] + ring + simp_rw [he,productWeight] + rw [←Fintype.prod_sum] + rw [Finset.prod_eq_single t] + · simp [w'] + · intro i _ hi + simpa [w',hi] using hw i + · simp + +lemma mean_residual_coordinate (w : T → Bool → ℝ) (hw : ∀ t, ∑ b,w t b=1) + (M : T → Prop) [DecidablePred M] (base : T → Bool) (t : T) (F : Bool → ℝ) : + (∑ c : T → Bool,productWeight w c * F (if M t then base t else c t)) = + if M t then F (base t) else ∑ b,w t b * F b := by + by_cases ht : M t + · simp only [ite_eq_left ht,←Finset.sum_mul,productWeight_sum w hw,one_mul] + · simp only [ite_eq_right ht] + exact productWeight_coordinate w hw t F + +def layerKernel (s : Equiv.Perm T) (σ : T → Bool → Equiv.Perm V) + (w : T → Bool → ℝ) : Matrix (T × V) (T × V) ℝ := fun z x => + if z.1 = s x.1 then ∑ b,w x.1 b * if z.2 = σ x.1 b x.2 then 1 else 0 else 0 + +omit [Fintype V] in + +theorem mean_layer_wiring + (s : Equiv.Perm T) (σ : T → Bool → Equiv.Perm V) + (w : T → Bool → ℝ) (hw : ∀ t,∑ b,w t b=1) : + (∑ c : T → Bool,productWeight w c • + (LayeredExchange.wiring s (fun t => σ t (c t))).permMatrix ℝ : + Matrix (T × V) (T × V) ℝ).transpose = + layerKernel s σ w := by + ext ⟨u,a⟩ ⟨t,b⟩ + simp only [Matrix.transpose_apply,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul, + Equiv.Perm.permMatrix,PEquiv.toMatrix_apply,Equiv.toPEquiv_apply,Option.mem_some_iff] + simp only [LayeredExchange.wiring_apply,Prod.mk.injEq] + by_cases hu : u = s t + · simpa only [hu,true_and,layerKernel,↓reduceIte,eq_comm] using + productWeight_coordinate w hw t (fun c => if a=σ t c b then 1 else 0) + · simp [hu,Ne.symm hu,layerKernel] + +lemma layerKernel_backward (s : Equiv.Perm T) (σ : T → Bool → Equiv.Perm V) + (w : T → Bool → ℝ) (f : T × V → ℝ) (t : T) (v : V) : + ((layerKernel s σ w).transpose *ᵥ f) (t,v) = + ∑ b,w t b * f (s t,σ t b v) := by + classical + simp only [Matrix.mulVec,dotProduct,Matrix.transpose_apply,Fintype.sum_prod_type,layerKernel] + rw [Finset.sum_eq_single (s t)] + · simp only [↓reduceIte,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + rw [Finset.sum_eq_single (σ t b v)] + · simp + · intro a _ ha + simp [ha] + · simp + · intro u _ hu + simp [hu] + · simp + +end Heisenberg.Exposure + +@[reducible] local instance kernelDecEq (α : Type*) : DecidableEq α := Classical.decEq α + +namespace Heisenberg.Exposure +open Heisenberg.Serial Heisenberg.MeshPair +variable {V : Type*} [Fintype V] [DecidableEq V] + +omit [Fintype V] in +lemma residualBetween_mean {n : ℕ} (p : Fin n → ℝ) (M : Fin n → Prop) + (base : Fin n → Bool) (D E : Set V) (a b : V) (t : Fin n) (x y : V) : + (∑ c : Fin n → Bool,productWeight (fun i z => if z then p i else 1-p i) c * + killedBetween D E (if residualCoins M base c t then Equiv.swap a b else 1) x y) = + residualBetween D E (M t) (base t) a b (p t) x y := by + have h := mean_residual_coordinate (fun i z => if z then p i else 1-p i) + (by intro i; simp) M base t + (fun z => killedBetween D E (if z then Equiv.swap a b else 1) x y) + change (∑ c,productWeight _ c * + (fun z => killedBetween D E (if z then Equiv.swap a b else 1) x y) + (if M t then base t else c t)) = _ + have hu : @Finset.univ (Fin n → Bool) + (@Pi.instFintype (Fin n) (fun _ => Bool) (fun a b => Classical.propDecidable (a=b)) + (Fin.fintype n) (fun _ => Bool.fintype)) = (Finset.univ : Finset (Fin n → Bool)) := by + ext c + simp + rw [hu] at h + refine h.trans ?_ + by_cases ht : M t + · simp only [residualBetween,ite_eq_left ht] + · simp [ht,residualBetween,Matrix.add_apply,Matrix.smul_apply,smul_eq_mul,add_comm] + +omit [Fintype V] in + +theorem killed_residual_cyclic (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (M : Fin (n+1) → Prop) (base : Fin (n+1) → Bool) (D : Fin (n+1) → Set V) : + killedMean (productWeight (fun i z => if z then p i else 1-p i)) + (fun c => layerHistory (finRotate (n+1)) (fun i => Equiv.swap (a i) (b i)) + (residualCoins M base c)) {z | z.2∈D z.1} = + cyclicKernel n (fun i => residualBetween (D i) (D (finRotate (n+1) i)) + (M i) (base i) (a i) (b i) (p i)) := by + ext ⟨u,x⟩ ⟨t,y⟩ + simp only [killedMean,Set.mem_ofPred_eq,layerHistory,LayeredExchange.wiring_apply,Prod.mk.injEq,cyclicKernel] + by_cases hu : u=finRotate (n+1) t + · subst u + simp only [true_and,ite_true] + symm + refine (residualBetween_mean p M base (D t) (D (finRotate (n+1) t)) (a t) (b t) t x y).symm.trans ?_ + by_cases hD : x∈D (finRotate (n+1) t) ∧ y∈D t + · simp only [ite_eq_left hD] + apply Finset.sum_congr rfl + intro c _ + simp only [killedBetween,hD.1,hD.2,true_and] + · simp only [ite_eq_right hD] + apply Finset.sum_eq_zero + intro c _ + have hn : ¬(y∈D t ∧ x∈D (finRotate (n+1) t) ∧ x=(if residualCoins M base c t then Equiv.swap (a t) (b t) else 1) y) := + fun h => hD ⟨h.2.1,h.1⟩ + simp only [killedBetween,ite_eq_right hn,mul_zero] + · simp only [hu,false_and,ite_false,mul_zero,Finset.sum_const_zero,ite_self] + +end Heisenberg.Exposure +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapMeshBounds.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapMeshBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..efd33dd4f55087a3af5613d4a8a3b7848d934b79 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapMeshBounds.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.Heisenberg.RegularPin + +namespace OAI + +section + +noncomputable section +namespace Heisenberg.Bootstrap + +lemma mesh_floor (s δ : ℝ) (hs : 0 < s) (hδ : 0 < δ) (hδs : δ ≤ s/2) : + 0 < ⌊s/δ⌋₊ ∧ s/2 ≤ δ*(⌊s/δ⌋₊:ℝ) ∧ δ*(⌊s/δ⌋₊:ℝ) ≤ s := by + have hsd : 0 ≤ s/δ := div_nonneg hs.le hδ.le + have hfloor:=Nat.floor_le hsd + have hceil:=Nat.lt_floor_add_one (s/δ) + have hlow : s-δ < δ*(⌊s/δ⌋₊:ℝ) := by + have hh:=(div_lt_iff₀ hδ).mp hceil + nlinarith + have hup : δ*(⌊s/δ⌋₊:ℝ) ≤ s := by + have hh:=(le_div_iff₀ hδ).mp hfloor + nlinarith + refine ⟨?_,by linarith,hup⟩ + by_contra hn + have he : ⌊s/δ⌋₊=0 := by omega + rw [he,Nat.cast_zero,mul_zero] at hlow + linarith + +lemma period_room (s δ : ℝ) (hs : 0 < s) (hδ : 0 < δ) (hδs : δ ≤ s/2) + (N Q : ℕ) (hperiod : 5*s ≤ (N:ℝ)*δ) : + 2*(⌊s/δ⌋₊+1)*Q ≤ N*Q := by + have hh:=(mesh_floor s δ hs hδ hδs).2.2 + have hb : ((2*(⌊s/δ⌋₊+1):ℕ):ℝ)*δ ≤ (N:ℝ)*δ := by + push_cast + nlinarith + have hn : 2*(⌊s/δ⌋₊+1) ≤ N := by + exact_mod_cast (mul_le_mul_iff_left₀ hδ).mp hb + exact Nat.mul_le_mul_right Q hn + +lemma round_clock_bound (s δ : ℝ) (hs : 0 < s) (hδ : 0 < δ) (R : ℕ) + (hδR : δ ≤ s/(R+2)) : ((⌊s/δ⌋₊+2+R:ℕ):ℝ)*δ ≤ 2*s := by + have hh:=(le_div_iff₀ hδ).mp (Nat.floor_le (div_nonneg hs.le hδ.le)) + have hR : (0:ℝ) < R+2 := by positivity + have hsmall:=(le_div_iff₀ hR).mp hδR + push_cast + nlinarith + +lemma mesh_remainder (p s δ ε : ℝ) (hp : 0 < p) (hs : 0 < s) (hδ : 0 < δ) + (V q n k : ℕ) (hk : 1 ≤ k) (hn : (n:ℝ)*δ ≤ s) + (heps : ε=p/(16*s*((V:ℝ)+1))) (hsmall : δ ≤ p/(16*s*((q:ℝ)^2+1))) : + (n:ℝ)*(ε*δ*V+δ^2*q^2) ≤ p/4*k := by + have hV : 0 < (V:ℝ)+1 := by positivity + have hq : 0 < (q:ℝ)^2+1 := by positivity + have h16 : 0 < 16*s := by positivity + have hε : 0 < ε := heps ▸ div_pos hp (mul_pos h16 hV) + have he : ε*(16*s*((V:ℝ)+1))=p := by rw [heps]; field_simp + have hδq : δ*(16*s*((q:ℝ)^2+1)) ≤ p := (le_div_iff₀ (mul_pos h16 hq)).mp hsmall + have hr1 : s*ε*V ≤ p/16 := by nlinarith [mul_nonneg hs.le hε.le] + have hr2 : s*δ*q^2 ≤ p/16 := by nlinarith [mul_nonneg hs.le hδ.le] + have h1:=mul_le_mul_of_nonneg_right hn (mul_nonneg hε.le (Nat.cast_nonneg V)) + have h2:=mul_le_mul_of_nonneg_right hn (by positivity : 0 ≤ δ*(q:ℝ)^2) + have hkR : (1:ℝ) ≤ k := by exact_mod_cast hk + nlinarith + +lemma leakage_arithmetic (p s δ F ρ tail : ℝ) (n R k : ℕ) + (_hp : 0 < p) (hs : 0 < s) (_hδ : 0 < δ) (hF : 0 ≤ F) + (ht : tail ≤ 1/(1+(R:ℝ))) (hn : s/2 ≤ δ*(n:ℝ)) + (herr : 2*(ρ+1/(1+(R:ℝ)))+8*F*(1+(R:ℝ))^((1:ℝ)/100)/s < p/4) + (rem : ℝ) (hrem : rem ≤ p/4*k) : + (1-p/2)*(k:ℝ) ≤ (k:ℝ)-2*((ρ+tail)*k)- + 2*(F*(1+(R:ℝ))^((1:ℝ)/100)*k)/((δ/2)*(n:ℝ))-rem := by + have hnpos : 0 < δ*(n:ℝ) := lt_of_lt_of_le (by linarith) hn + have hdpos : 0 < (δ/2)*(n:ℝ) := by nlinarith + have hflow : 2*(F*(1+(R:ℝ))^((1:ℝ)/100)*k)/((δ/2)*(n:ℝ)) ≤ + (8*F*(1+(R:ℝ))^((1:ℝ)/100)/s)*(k:ℝ) := by + rw [div_le_iff₀ hdpos] + have hmul:=mul_le_mul_of_nonneg_left hn + (by positivity : 0 ≤ 4*F*(1+(R:ℝ))^((1:ℝ)/100)*k/s) + have hs0 : s≠0 := hs.ne' + field_simp at hmul ⊢ + nlinarith + have htail:=mul_le_mul_of_nonneg_right ht (Nat.cast_nonneg k) + have herror:=mul_le_mul_of_nonneg_right herr.le (Nat.cast_nonneg k) + nlinarith + +end Heisenberg.Bootstrap +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapParameters.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecbd5480ba5b64d245d2bc8df9df50e01c76954b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BootstrapParameters.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.Heisenberg.PeriodicReturnEstimate + +namespace OAI + +section + +noncomputable section +open Filter Topology +namespace Heisenberg.Bootstrap + +lemma nat_rpow_tendsto_zero (e : ℝ) (he : e < 0) : + Tendsto (fun n : ℕ=>(n:ℝ)^e) atTop (𝓝 0) := by + have hh:=tendsto_rpow_neg_atTop (neg_pos.mpr he) + simpa only [Function.comp_def,neg_neg] using hh.comp (tendsto_natCast_atTop_atTop (R:=ℝ)) + +lemma exponent_split (x a b : ℝ) (hx : 0 < x) : + x^a=x^b*x^(a-b) := by rw [←Real.rpow_add hx]; congr 1; ring + +theorem choose_parameters (d : ℕ) (hd : 3 ≤ d) (M : ℕ) + (B F G p₀ : ℝ) (_hB : 0 ≤ B) (hF : 0 ≤ F) (hG : 0 ≤ G) (hp₀ : 0 < p₀) : + ∃ (p s : ℝ) (R : ℕ),0 < p ∧ p < 1/4 ∧ p ≤ p₀ ∧ 0 < s ∧ + s=p^(-(11/10:ℝ)) ∧ 1 ≤ R ∧ M ≤ R ∧ 8*B*Real.exp 1*s ≤ R ∧ + 2*(G*((1+(R:ℝ))^d*p^(2*d)+1/(1+(R:ℝ)))+1/(1+(R:ℝ)))+ + 8*F*(1+(R:ℝ))^((1:ℝ)/100)/s < p/4 := by + obtain ⟨K,hK⟩:=exists_nat_gt (max (8*B*Real.exp 1) 1) + have hK1 : 1 ≤ K := by + have hh : (1:ℝ) < K := (le_max_right _ _).trans_lt hK + exact_mod_cast hh.le + have hKb : 8*B*Real.exp 1 ≤ K := (le_max_left _ _).trans hK.le + let A:=2*G*((K:ℝ)+1)^d + let C:=2*(G+1) + let D:=8*F*((K:ℝ)+1)^((1:ℝ)/100) + let e:ℝ:=(10/11:ℝ)-(9/11)*(d:ℝ) + have he : e < 0 := by + have hdR : (3:ℝ) ≤ d := by exact_mod_cast hd + dsimp only [e] + linarith + have ht : Tendsto (fun n : ℕ=>A*(n:ℝ)^e+C*(n:ℝ)^(-(1/11:ℝ))+ + D*(n:ℝ)^(-(89/1100:ℝ))) atTop (𝓝 0) := by + simpa using (((nat_rpow_tendsto_zero e he).const_mul A).add + ((nat_rpow_tendsto_zero (-(1/11:ℝ)) (by norm_num)).const_mul C)).add + ((nat_rpow_tendsto_zero (-(89/1100:ℝ)) (by norm_num)).const_mul D) + have hp := nat_rpow_tendsto_zero (-(10/11:ℝ)) (by norm_num) + have ev := (ht.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1/4))).and + ((hp.eventually (gt_mem_nhds hp₀)).and + ((hp.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1/4))).and + (eventually_ge_atTop (max M 1)))) + obtain ⟨r,hrerror,hrp,hrsmall,hr⟩:=ev.exists + have hr1 : 1 ≤ r := (le_max_right _ _).trans hr + have hrR : (1:ℝ) ≤ r := by exact_mod_cast hr1 + have hrpos : 0 < (r:ℝ) := lt_of_lt_of_le zero_lt_one hrR + let p:ℝ:=(r:ℝ)^(-(10/11:ℝ)) + let R:ℕ:=K*r + have hp : 0 < p := Real.rpow_pos_of_pos hrpos _ + have hRr : r ≤ R := by dsimp [R]; nlinarith + have hR : (r:ℝ) ≤ R := by exact_mod_cast hRr + have hRup : 1+(R:ℝ) ≤ ((K:ℝ)+1)*r := by dsimp [R]; push_cast; nlinarith + have hrpow : (r:ℝ)^d*p^(2*d)=(r:ℝ)^(-(9/11:ℝ)*(d:ℝ)) := by + rw [←Real.rpow_natCast,←Real.rpow_natCast p] + dsimp only [p] + rw [←Real.rpow_mul hrpos.le,←Real.rpow_add hrpos] + congr 1 + push_cast + ring + have hreg : (1+(R:ℝ))^d*p^(2*d) ≤ ((K:ℝ)+1)^d*(r:ℝ)^(-(9/11:ℝ)*(d:ℝ)) := by + calc + _ ≤ (((K:ℝ)+1)*r)^d*p^(2*d) := + mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by positivity) hRup d) (by positivity) + _ = _ := by rw [mul_pow,mul_assoc,hrpow] + have htail : 1/(1+(R:ℝ)) ≤ (r:ℝ)^(-1:ℝ) := by + rw [Real.rpow_neg_one] + rw [←one_div] + exact one_div_le_one_div_of_le hrpos (by linarith) + have hflow : (1+(R:ℝ))^((1:ℝ)/100)/(r:ℝ) ≤ + ((K:ℝ)+1)^((1:ℝ)/100)*(r:ℝ)^(-(99/100:ℝ)) := by + calc + _ ≤ (((K:ℝ)+1)*r)^((1:ℝ)/100)/(r:ℝ) := + div_le_div_of_nonneg_right (Real.rpow_le_rpow (by positivity) hRup (by norm_num)) hrpos.le + _ = _ := by + rw [Real.mul_rpow (by positivity) hrpos.le,mul_div_assoc,←Real.rpow_sub_one hrpos.ne'] + congr 2 + norm_num + refine ⟨p,(r:ℝ),R,hp,hrsmall,hrp.le,hrpos,?_,(hr1.trans hRr),?_,?_,?_⟩ + · dsimp only [p] + rw [←Real.rpow_mul hrpos.le] + norm_num + · exact (le_max_left _ _).trans (hr.trans hRr) + · dsimp [R] + push_cast + nlinarith + · have hmain : 2*(G*((1+(R:ℝ))^d*p^(2*d)+1/(1+(R:ℝ)))+1/(1+(R:ℝ)))+ + 8*F*(1+(R:ℝ))^((1:ℝ)/100)/(r:ℝ) ≤ + A*(r:ℝ)^(-(9/11:ℝ)*(d:ℝ))+C*(r:ℝ)^(-1:ℝ)+D*(r:ℝ)^(-(99/100:ℝ)) := by + have h1:=mul_le_mul_of_nonneg_left hreg hG + have h2:=mul_le_mul_of_nonneg_left htail hG + have h3:=mul_le_mul_of_nonneg_left hflow (by positivity : 0 ≤ 8*F) + dsimp only [A,C,D] + rw [←mul_div_assoc] at h3 + nlinarith + apply hmain.trans_lt + have he' : (-(9/11:ℝ)*(d:ℝ))-(-(10/11:ℝ))=e := by dsimp [e]; ring + rw [exponent_split (r:ℝ) (-(9/11:ℝ)*(d:ℝ)) (-(10/11:ℝ)) hrpos, + exponent_split (r:ℝ) (-1:ℝ) (-(10/11:ℝ)) hrpos, + exponent_split (r:ℝ) (-(99/100:ℝ)) (-(10/11:ℝ)) hrpos,he'] + have h1 : (-1:ℝ)-(-(10/11:ℝ))=-(1/11:ℝ) := by norm_num + have h2 : (-(99/100:ℝ))-(-(10/11:ℝ))=-(89/1100:ℝ) := by norm_num + rw [h1,h2] + change _ < p/4 + calc + _ = p*(A*(r:ℝ)^e+C*(r:ℝ)^(-(1/11:ℝ))+D*(r:ℝ)^(-(89/1100:ℝ))) := by dsimp [p]; ring + _ < p*(1/4) := mul_lt_mul_of_pos_left hrerror hp + _ = _ := by ring + +end Heisenberg.Bootstrap +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryMesh.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f814fd619b5d9013c380791817897d3e98f9846 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryMesh.lean @@ -0,0 +1,127 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshPin + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.LayeredExchange Heisenberg.Exposure +variable {T V : Type*} [Fintype T] [Fintype V] + +omit [Fintype V] in +lemma swap_preserves_boundary (a b : V) (D : Set V) (h : a∈D ↔ b∈D) (v : V) : + Equiv.swap a b v ∈ D ↔ v∈D := by + simp only [Equiv.swap_apply_def] + split_ifs with h₁ h₂ + · subst v; exact h.symm + · subst v; exact h + · rfl + +theorem mesh_boundary_count (s : Equiv.Perm T) (a b : T → V) (D : Set V) + (K : Finset T) (hK : ∀ t,t∉K → (a t∈D ↔ b t∈D)) + (t₀ : T) (hs : ∀ t,∃ n : ℕ,(s^n) t=t₀) (c : T → Bool) : + (hitClasses (layerHistory s (fun t=>Equiv.swap (a t) (b t)) c) {z | z.2∈D}).card ≤ + (Finset.univ.filter fun v : V=>v∈D).card+2*(K.filter fun t=>c t=true).card := by + let π:=layerHistory s (fun t=>Equiv.swap (a t) (b t)) c + let B : Set (T×V):={z | z.2∈D} + let C : Set (T×V):={z | z.1=t₀} + have hC : ∀ z,∃ n : ℕ,(π^n) z∈C := by + intro z + obtain ⟨n,hn⟩:=hs z.1 + refine ⟨n,?_⟩ + change ((wiring s (fun t=>if c t then Equiv.swap (a t) (b t) else 1)^n) z).1=t₀ + rw [wiring_pow] + exact hn + have hn:=(hitClasses_le_witnesses π B C hC).trans (witness_count π B C) + have hbase : (Finset.univ.filter fun z : T×V=>z∈B∩C).card= + (Finset.univ.filter fun v : V=>v∈D).card := by + have he : (Finset.univ.filter fun z : T×V=>z∈B∩C)= + (Finset.univ.filter fun v : V=>v∈D).image (fun v=>(t₀,v)) := by + ext z + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Set.mem_inter_iff, + Finset.mem_image,B,C,Set.mem_ofPred_eq] + aesop + rw [he,Finset.card_image_of_injective _ (fun _ _ h=>(Prod.mk.inj h).2)] + have hsub : (Finset.univ.filter fun z : T×V=>z∈B ∧ π z∉B) ⊆ + (K.filter fun t=>c t=true).biUnion (fun t=>{(t,a t),(t,b t)}) := by + intro z hz + obtain ⟨hzD,hout⟩:=(Finset.mem_filter.mp hz).2 + have hout' : (if c z.1 then Equiv.swap (a z.1) (b z.1) z.2 else z.2)∉D := by + change ((if c z.1 then Equiv.swap (a z.1) (b z.1) else 1) z.2)∉D at hout + by_cases hh : c z.1=true <;> simpa [hh] using hout + have hc : c z.1=true := by + by_contra hc + have hh : z.2∉D := by simpa [hc] using hout' + exact hh hzD + have hKz : z.1∈K := by + by_contra hnK + have hh:=(swap_preserves_boundary (a z.1) (b z.1) D (hK z.1 hnK) z.2).mpr hzD + simp only [hc,ite_true] at hout' + exact hout' hh + have hzab : z.2=a z.1 ∨ z.2=b z.1 := by + by_contra hh + have hh':=not_or.mp hh + simp only [hc,ite_true,Equiv.swap_apply_of_ne_of_ne hh'.1 hh'.2] at hout' + exact hout' hzD + refine Finset.mem_biUnion.mpr ⟨z.1,Finset.mem_filter.mpr ⟨hKz,hc⟩,?_⟩ + rcases hzab with h|h <;> simp [←h] + have hexit : (Finset.univ.filter fun z : T×V=>z∈B ∧ π z∉B).card≤ + 2*(K.filter fun t=>c t=true).card := by + apply (Finset.card_le_card hsub).trans + apply (Finset.card_biUnion_le).trans + calc + _ ≤ ∑ _t∈K.filter (fun t=>c t=true),2 := by + apply Finset.sum_le_sum + intro t _ + simpa using Finset.card_insert_le (t,a t) {(t,b t)} + _ = _ := by simp [Nat.mul_comm] + rw [hbase] at hn + exact hn.trans (Nat.add_le_add_left hexit _) + +lemma mean_active_marks (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) (K : Finset T) : + (∑ c,layerMass s a b P p c * ((K.filter fun t=>c t=true).card:ℝ)) ≤ ∑ t∈K,2*p t := by + have he (c : T → Bool) : ((K.filter fun t=>c t=true).card:ℝ)= + ∑ t∈K,if c t=true then (1:ℝ) else 0 := by simp + simp_rw [he,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro t ht + have hh:=layer_factorial_bound s a b P p hp {t} + simpa only [Finset.mem_singleton,forall_eq,Finset.prod_singleton,mul_ite,mul_one,mul_zero] using hh + +theorem mean_boundary_cycles (s : Equiv.Perm T) (a b : T → V) (D : Set V) + (K : Finset T) (hK : ∀ t,t∉K → (a t∈D ↔ b t∈D)) + (t₀ : T) (hs : ∀ t,∃ n : ℕ,(s^n) t=t₀) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) (P : Set (T×V)) : + (∑ c,layerMass s a b P p c * + ((hitClasses (layerHistory s (fun t=>Equiv.swap (a t) (b t)) c) {z | z.2∈D}).card:ℝ)) ≤ + (Finset.univ.filter fun v : V=>v∈D).card+4*∑ t∈K,p t := by + have hb : (∑ c,layerMass s a b P p c * + ((hitClasses (layerHistory s (fun t=>Equiv.swap (a t) (b t)) c) {z | z.2∈D}).card:ℝ)) ≤ + ∑ c,layerMass s a b P p c * + ((Finset.univ.filter fun v : V=>v∈D).card+2*((K.filter fun t=>c t=true).card:ℝ)) := by + apply Finset.sum_le_sum + intro c _ + apply mul_le_mul_of_nonneg_left _ (layerMass_nonneg s a b P p hp c) + exact_mod_cast mesh_boundary_count s a b D K hK t₀ hs c + simp_rw [mul_add,Finset.sum_add_distrib,←mul_assoc] at hb + rw [←Finset.sum_mul,layerMass_sum s a b P p hp,one_mul] at hb + have he : (∑ c,layerMass s a b P p c * 2 * ((K.filter fun t=>c t=true).card:ℝ))= + 2*∑ c,layerMass s a b P p c * ((K.filter fun t=>c t=true).card:ℝ) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + ring + rw [he] at hb + have hm:=mean_active_marks s a b P p hp K + rw [←Finset.mul_sum] at hm + linarith + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryPartition.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..570566a2676ef5757eabb6684153d49db3c53d91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryPartition.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.Heisenberg.BoundaryWitness + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.Pin +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +lemma pin_weight_surface (π : Equiv.Perm V) (B : Set V) : + (2:ℝ)^missingCount π B=(2:ℝ)^missingCount π ∅ * + Real.exp (-(Real.log 2)*((hitClasses π B).card:ℝ)) := by + have hpow : Real.exp (Real.log 2*((hitClasses π B).card:ℝ))=(2:ℝ)^(hitClasses π B).card := by + rw [mul_comm,Real.exp_nat_mul,Real.exp_log (by norm_num)] + rw [neg_mul,Real.exp_neg,hpow,←missing_add_hit π B,pow_add] + field_simp + +lemma partition_surface_identity (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (B : Set V) : + pinPartition μ π B/pinPartition μ π ∅= + ∑ ω,pinDensity μ π ∅ ω*Real.exp (-(Real.log 2)*((hitClasses (π ω) B).card:ℝ)) := by + unfold pinPartition + simp_rw [pin_weight_surface (B:=B)] + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro ω _ + unfold pinDensity pinPartition + ring + +theorem partition_surface_lower (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0≤μ ω) (hpos : 0<∑ ω,μ ω) (B : Set V) + (C : ℝ) (hC : (∑ ω,pinDensity μ π ∅ ω*((hitClasses (π ω) B).card:ℝ))≤C) : + Real.exp (-(Real.log 2)*C) ≤ pinPartition μ π B/pinPartition μ π ∅ := by + have hj:=convexOn_exp.map_sum_le (t:=Finset.univ) + (p:=fun ω=>-(Real.log 2)*((hitClasses (π ω) B).card:ℝ)) + (fun ω _=>pinDensity_nonneg μ π hμ hpos ∅ ω) + (pinDensity_sum μ π hμ hpos ∅) (fun _ _=>Set.mem_univ _) + simp only [smul_eq_mul] at hj + have he : (∑ ω,pinDensity μ π ∅ ω*(-(Real.log 2)*((hitClasses (π ω) B).card:ℝ)))= + -(Real.log 2)*(∑ ω,pinDensity μ π ∅ ω*((hitClasses (π ω) B).card:ℝ)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro ω _ + ring + rw [he,←partition_surface_identity μ π B] at hj + apply (Real.exp_le_exp.mpr ?_).trans hj + exact mul_le_mul_of_nonpos_left hC (neg_nonpos.mpr (Real.log_nonneg (by norm_num))) + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryWitness.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..5af73d8eb5457ea17d10202efac4cae1bae6fdcc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BoundaryWitness.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.Heisenberg.TwoEndedReturns + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.LayeredExchange +variable {V : Type*} [Fintype V] + +lemma cycle_boundary_witness (π : Equiv.Perm V) (B C : Set V) + (hC : ∀ z,∃ n : ℕ,(π^n) z∈C) {z : V} (hz : z∈B) : + ∃ w,π.SameCycle z w ∧ w∈B ∧ (w∈C ∨ π w∉B) := by + by_contra hn + have hn' : ∀ w,π.SameCycle z w → w∈B → w∉C ∧ π w∈B := by + intro w hw hB + constructor + · intro hc; exact hn ⟨w,hw,hB,Or.inl hc⟩ + · by_contra hb; exact hn ⟨w,hw,hB,Or.inr hb⟩ + have hb : ∀ n : ℕ,(π^n) z∈B := by + intro n + induction n with + | zero => exact hz + | succ n ih => + rw [pow_succ',Equiv.Perm.mul_apply] + exact (hn' _ ((Equiv.Perm.SameCycle.refl π z).pow_right (n:=n)) ih).2 + obtain ⟨n,hnC⟩:=hC z + exact (hn' _ ((Equiv.Perm.SameCycle.refl π z).pow_right (n:=n)) (hb n)).1 hnC + +local instance (π : Equiv.Perm V) : Fintype (Classes π) := Fintype.ofFinite _ + +def hitClasses (π : Equiv.Perm V) (B : Set V) : Finset (Classes π) := + Finset.univ.filter fun c=>∃ z∈B,classOf π z=c + +def witnesses (π : Equiv.Perm V) (B C : Set V) : Finset V := + Finset.univ.filter fun z=>z∈B ∧ (z∈C ∨ π z∉B) + +lemma hitClasses_le_witnesses (π : Equiv.Perm V) (B C : Set V) + (hC : ∀ z,∃ n : ℕ,(π^n) z∈C) : + (hitClasses π B).card ≤ (witnesses π B C).card := by + have hh : hitClasses π B⊆(witnesses π B C).image (classOf π) := by + intro c hc + obtain ⟨z,hz,rfl⟩:=(Finset.mem_filter.mp hc).2 + obtain ⟨w,hw,hB,hW⟩:=cycle_boundary_witness π B C hC hz + refine Finset.mem_image.mpr ⟨w,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hB,hW⟩,?_⟩ + exact ((classOf_eq_iff π z w).mpr hw).symm + exact (Finset.card_le_card hh).trans Finset.card_image_le + +lemma witness_count (π : Equiv.Perm V) (B C : Set V) : + (witnesses π B C).card ≤ (Finset.univ.filter fun z=>z∈B∩C).card+ + (Finset.univ.filter fun z=>z∈B ∧ π z∉B).card := by + apply le_trans (Finset.card_le_card (show witnesses π B C⊆ + (Finset.univ.filter fun z=>z∈B∩C)∪(Finset.univ.filter fun z=>z∈B ∧ π z∉B) from ?_)) + (Finset.card_union_le _ _) + intro z hz + rcases (Finset.mem_filter.mp hz).2 with ⟨hb,hc|he⟩ + · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _,hb,hc⟩) + · exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _,hb,he⟩) + +lemma missing_add_hit (π : Equiv.Perm V) (B : Set V) : + missingCount π B+(hitClasses π B).card=missingCount π ∅ := by + have hmiss : missingCount π B=(Finset.univ.filter fun c : Classes π=>¬∃ z∈B,classOf π z=c).card := by + unfold missingCount + rw [Nat.card_eq_fintype_card] + convert Fintype.card_subtype (fun c : Classes π=>∀ z∈B,c≠classOf π z) using 1 + congr 1 + ext c + simp [not_exists,not_and,eq_comm] + have hempty : missingCount π ∅=Fintype.card (Classes π) := by + unfold missingCount + rw [Nat.card_eq_fintype_card] + exact Fintype.card_congr (Equiv.subtypeUnivEquiv (fun _=>by simp)) + rw [hmiss,hempty] + simpa [not_not,Finset.card_univ,hitClasses] using (Finset.card_filter_add_card_filter_not (s:=Finset.univ) (fun c : Classes π=>¬∃ z∈B,classOf π z=c)) + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/BoundedStrip.lean b/lean/OAI/MathematicalPhysics/Heisenberg/BoundedStrip.lean new file mode 100644 index 0000000000000000000000000000000000000000..643ab5f4ece28f6c442211984e63d7aed42e0f21 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/BoundedStrip.lean @@ -0,0 +1,332 @@ +import OAI.MathematicalPhysics.Heisenberg.StateCompactness + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators +open Filter Topology Metric +open scoped NNReal +open scoped NNReal + +open scoped ComplexConjugate Topology +namespace GibbsStrip +variable {E : Type*} [CStarAlgebra E] + +local instance : NormedAlgebra ℚ E := NormedAlgebra.restrictScalars ℚ ℂ E + +def evolve (K : E) (z : ℂ) (A : E) : E := + NormedSpace.exp ((Complex.I*z) • K) * A * NormedSpace.exp ((-(Complex.I*z)) • K) + +lemma exp_scalar_add (K : E) (z w : ℂ) : + NormedSpace.exp ((z+w) • K) = NormedSpace.exp (z • K) * NormedSpace.exp (w • K) := by + rw [add_smul] + exact NormedSpace.exp_add_of_commute ((Commute.refl K).smul_left z |>.smul_right w) + +lemma evolve_add (K : E) (z w : ℂ) (A : E) : + evolve K (z+w) A = evolve K z (evolve K w A) := by + unfold evolve + rw [mul_add,exp_scalar_add] + have he : -(Complex.I*z+Complex.I*w) = -(Complex.I*w) + -(Complex.I*z) := by ring + rw [he,exp_scalar_add] + simp only [mul_assoc] + +lemma evolve_differentiable (K A : E) : Differentiable ℂ (fun z => evolve K z A) := by + have h (c : ℂ) : Differentiable ℂ (fun z : ℂ => NormedSpace.exp ((c*z) • K)) := by + have hh : Differentiable ℂ (fun z : ℂ => NormedSpace.exp (z • K)) := + fun z => (hasDerivAt_exp_smul_const K z).differentiableAt + exact hh.comp ((differentiable_const c).mul differentiable_id) + unfold evolve + have hh := ((h Complex.I).mul_const A).mul (h (-Complex.I)) + change Differentiable ℂ (fun z => NormedSpace.exp ((Complex.I*z) • K) * A * + NormedSpace.exp (((-Complex.I)*z) • K)) at hh + simpa only [neg_mul] using hh + +lemma real_evolve_norm {K : E} (hK : IsSelfAdjoint K) (t : ℝ) (A : E) : + ‖evolve K (t : ℂ) A‖ = ‖A‖ := by + have h (t : ℝ) : NormedSpace.exp ((Complex.I*(t:ℂ)) • K) ∈ unitary E := by + apply NormedSpace.exp_mem_unitary_of_mem_skewAdjoint + apply IsSelfAdjoint.smul_mem_skewAdjoint _ hK + change star (Complex.I*(t:ℂ)) = -(Complex.I*(t:ℂ)) + simp + have hn : NormedSpace.exp ((-(Complex.I*(t:ℂ))) • K) ∈ unitary E := by + convert h (-t) using 1; simp + rw [evolve,CStarRing.norm_mul_mem_unitary _ hn,CStarRing.norm_mem_unitary_mul _ (h t)] + +lemma imaginary_evolve (K : E) (β : ℝ) (A : E) : + evolve K (Complex.I * β) A = + NormedSpace.exp ((-β : ℂ) • K) * A * NormedSpace.exp ((β : ℂ) • K) := by + simp [evolve,← mul_assoc] + +lemma exp_cancel_left (K : E) (z : ℂ) : + NormedSpace.exp (z • K) * NormedSpace.exp ((-z) • K) = 1 := by + rw [← exp_scalar_add] + simp + +lemma exp_cancel_right (K : E) (z : ℂ) : + NormedSpace.exp ((-z) • K) * NormedSpace.exp (z • K) = 1 := by + rw [← exp_scalar_add] + simp + +lemma gibbs_upper_boundary (τ : E →L[ℂ] ℂ) + (hτ : ∀ A B, τ (A*B) = τ (B*A)) (K : E) (β t : ℝ) (c : ℂ) (A B : E) : + c * τ (NormedSpace.exp ((-β : ℂ) • K) * (A * evolve K ((t:ℂ)+Complex.I*β) B)) = + c * τ (NormedSpace.exp ((-β : ℂ) • K) * (evolve K (t:ℂ) B * A)) := by + rw [add_comm (t:ℂ),evolve_add,imaginary_evolve] + congr 1 + let D := NormedSpace.exp ((-β : ℂ) • K) + let D' := NormedSpace.exp ((β : ℂ) • K) + let X := evolve K (t:ℂ) B + change τ (D*(A*(D*X*D'))) = τ (D*(X*A)) + calc + _ = τ ((D*(A*(D*X)))*D') := by simp only [mul_assoc] + _ = τ (D'*(D*(A*(D*X)))) := hτ _ _ + _ = τ (A*(D*X)) := by + rw [← mul_assoc D' D,show D'*D = 1 from exp_cancel_left K (β:ℂ),one_mul] + _ = τ ((D*X)*A) := hτ _ _ + _ = _ := by rw [mul_assoc] + +lemma strip_evolve_bounded {K : E} (hK : IsSelfAdjoint K) (A : E) (β : ℝ) : + ∃ M : ℝ, 0 ≤ M ∧ ∀ z : ℂ, 0 ≤ z.im → z.im ≤ β → ‖evolve K z A‖ ≤ M := by + have hc : Continuous (fun u : ℝ => ‖evolve K (Complex.I*(u:ℂ)) A‖) := + ((evolve_differentiable K A).continuous.comp + (continuous_const.mul Complex.continuous_ofReal)).norm + obtain ⟨M,hM⟩ := isCompact_Icc.bddAbove_image (hc.continuousOn (s:=Set.Icc 0 β)) + refine ⟨max M 0,le_max_right _ _,fun z hz0 hzβ => ?_⟩ + have hz : z = (z.re:ℂ)+Complex.I*(z.im:ℂ) := by + apply Complex.ext <;> simp + rw [hz,evolve_add,real_evolve_norm hK] + exact (hM ⟨z.im,⟨hz0,hzβ⟩,rfl⟩).trans (le_max_left _ _) + +end GibbsStrip + +open Set Filter Complex +open scoped Topology + +namespace HeisenbergStrip + +def openStrip (β : ℝ) : Set ℂ := Complex.im ⁻¹' Ioo 0 β +def closedStrip (β : ℝ) : Set ℂ := Complex.im ⁻¹' Icc 0 β + +theorem closure_openStrip {β : ℝ} (hβ : 0 < β) : + closure (openStrip β) = closedStrip β := by + simp only [openStrip, closedStrip, Complex.closure_preimage_im, closure_Ioo hβ.ne] + +theorem isOpen_openStrip (β : ℝ) : IsOpen (openStrip β) := + isOpen_Ioo.preimage Complex.continuous_im + +theorem bounded_strip_max {β C : ℝ} (hβ : 0 < β) {f : ℂ → ℂ} + (hf : DiffContOnCl ℂ f (openStrip β)) + (hbounded : ∃ M : ℝ, ∀ z ∈ closedStrip β, ‖f z‖ ≤ M) + (hzero : ∀ z : ℂ, z.im = 0 → ‖f z‖ ≤ C) + (htop : ∀ z : ℂ, z.im = β → ‖f z‖ ≤ C) + {z : ℂ} (hz : z ∈ closedStrip β) : ‖f z‖ ≤ C := by + apply PhragmenLindelof.horizontal_strip hf ?_ hzero htop hz.1 hz.2 + refine ⟨0, by simpa using div_pos Real.pi_pos hβ, 0, ?_⟩ + obtain ⟨M, hM⟩ := hbounded + apply Asymptotics.IsBigO.of_bound M + simp only [Filter.eventually_inf_principal] + exact Filter.Eventually.of_forall (fun w hw => by + simpa using hM w ⟨hw.1.le, hw.2.le⟩) + +def gaussian (z : ℂ) : ℂ := Complex.exp (-(z * z)) + +theorem gaussian_differentiable : Differentiable ℂ gaussian := + Complex.differentiable_exp.comp (differentiable_id.mul differentiable_id).neg + +theorem norm_gaussian (z : ℂ) : ‖gaussian z‖ = Real.exp (-z.re ^ 2 + z.im ^ 2) := by + rw [gaussian, Complex.norm_exp] + congr 1 + simp only [Complex.neg_re, Complex.mul_re] + ring + +theorem norm_gaussian_le {β : ℝ} {z : ℂ} (hz : z ∈ closedStrip β) : + ‖gaussian z‖ ≤ Real.exp (β ^ 2) := by + rw [norm_gaussian] + apply Real.exp_le_exp.mpr + have := sq_le_sq₀ hz.1 (hz.1.trans hz.2) + nlinarith [sq_nonneg z.re, this.mpr hz.2] + +theorem norm_gaussian_tail {β R : ℝ} (hR : 0 ≤ R) {z : ℂ} + (hz : z ∈ closedStrip β) (hreal : R ≤ |z.re|) : + ‖gaussian z‖ ≤ Real.exp (-(R ^ 2) + β ^ 2) := by + rw [norm_gaussian] + apply Real.exp_le_exp.mpr + have hi := (sq_le_sq₀ hz.1 (hz.1.trans hz.2)).mpr hz.2 + have hr := (sq_le_sq₀ hR (abs_nonneg z.re)).mpr hreal + rw [sq_abs] at hr + linarith + +def BoundaryCauchy (β : ℝ) (F : ℕ → ℂ → ℂ) : Prop := + ∀ R : ℝ, 0 < R → ∀ ε : ℝ, 0 < ε → + ∃ N : ℕ, ∀ m ≥ N, ∀ n ≥ N, ∀ z : ℂ, + (z.im = 0 ∨ z.im = β) → |z.re| ≤ R → ‖F m z - F n z‖ < ε + +theorem boundary_mem_closedStrip {β : ℝ} (hβ : 0 ≤ β) {z : ℂ} + (hz : z.im = 0 ∨ z.im = β) : z ∈ closedStrip β := by + rcases hz with hz | hz <;> exact ⟨by linarith, by linarith⟩ + +theorem gaussian_uniformCauchy {β C : ℝ} (hβ : 0 < β) (_hC : 0 ≤ C) + {F : ℕ → ℂ → ℂ} (hd : ∀ n, DiffContOnCl ℂ (F n) (openStrip β)) + (hbound : ∀ n z, z ∈ closedStrip β → ‖F n z‖ ≤ C) + (hcauchy : BoundaryCauchy β F) : + UniformCauchySeqOn (fun n z => gaussian z * F n z) atTop (closedStrip β) := by + rw [Metric.uniformCauchySeqOn_iff] + intro ε hε + have ht : Tendsto (fun R : ℝ => Real.exp (-(R ^ 2) + β ^ 2) * (2 * C)) + atTop (𝓝 0) := by + have h := (Real.tendsto_exp_neg_atTop_nhds_zero.comp + (Filter.tendsto_pow_atTop (by decide : (2 : ℕ) ≠ 0))).mul_const + (Real.exp (β ^ 2)) + simpa only [Real.exp_add, zero_mul, mul_assoc, Function.comp_apply] using h.mul_const (2 * C) + obtain ⟨R, hR, htail⟩ := ((Filter.eventually_ge_atTop (1 : ℝ)).and + (ht.eventually_lt_const (by linarith : 0 < ε / 2))).exists + have hRpos : 0 < R := lt_of_lt_of_le zero_lt_one hR + have he : 0 < Real.exp (β ^ 2) := Real.exp_pos _ + obtain ⟨N, hN⟩ := hcauchy R hRpos (ε / (2 * Real.exp (β ^ 2))) + (div_pos hε (mul_pos (by norm_num) he)) + refine ⟨N, ?_⟩ + intro m hm n hn z hz + have hdiff (w : ℂ) (hw : w ∈ closedStrip β) : ‖F m w - F n w‖ ≤ 2 * C := + (norm_sub_le _ _).trans (by linarith [hbound m w hw, hbound n w hw]) + have hboundDiff : ∃ M : ℝ, ∀ w ∈ closedStrip β, + ‖gaussian w * F m w - gaussian w * F n w‖ ≤ M := by + refine ⟨Real.exp (β ^ 2) * (2 * C), ?_⟩ + intro w hw + rw [← mul_sub, norm_mul] + exact mul_le_mul (norm_gaussian_le hw) (hdiff w hw) (norm_nonneg _) he.le + have hedge (w : ℂ) (hw : w.im = 0 ∨ w.im = β) : + ‖gaussian w * F m w - gaussian w * F n w‖ ≤ ε / 2 := by + have hwS := boundary_mem_closedStrip hβ.le hw + rw [← mul_sub, norm_mul] + by_cases hwr : |w.re| ≤ R + · apply le_of_lt + calc + ‖gaussian w‖ * ‖F m w - F n w‖ ≤ + Real.exp (β ^ 2) * ‖F m w - F n w‖ := + mul_le_mul_of_nonneg_right (norm_gaussian_le hwS) (norm_nonneg _) + _ < Real.exp (β ^ 2) * (ε / (2 * Real.exp (β ^ 2))) := + mul_lt_mul_of_pos_left (hN m hm n hn w hw hwr) he + _ = ε / 2 := by field_simp + · exact (mul_le_mul (norm_gaussian_tail hRpos.le hwS (not_le.mp hwr).le) + (hdiff w hwS) (norm_nonneg _) (Real.exp_pos _).le).trans htail.le + have hmax := bounded_strip_max hβ + ((gaussian_differentiable.diffContOnCl.smul (hd m)).sub + (gaussian_differentiable.diffContOnCl.smul (hd n))) hboundDiff + (fun w hw => hedge w (Or.inl hw)) (fun w hw => hedge w (Or.inr hw)) hz + rw [dist_eq_norm] + exact hmax.trans_lt (by linarith) + +theorem strip_limit_of_boundaryCauchy {β C : ℝ} (hβ : 0 < β) (hC : 0 ≤ C) + {F : ℕ → ℂ → ℂ} (hd : ∀ n, DiffContOnCl ℂ (F n) (openStrip β)) + (hbound : ∀ n z, z ∈ closedStrip β → ‖F n z‖ ≤ C) + (hcauchy : BoundaryCauchy β F) : + ∃ f : ℂ → ℂ, TendstoLocallyUniformlyOn F f atTop (closedStrip β) ∧ + DiffContOnCl ℂ f (openStrip β) ∧ ∀ z ∈ closedStrip β, ‖f z‖ ≤ C := by + classical + have hgC := gaussian_uniformCauchy hβ hC hd hbound hcauchy + have hex (z : ℂ) : ∃ w : ℂ, z ∈ closedStrip β → + Tendsto (fun n => gaussian z * F n z) atTop (𝓝 w) := by + by_cases hz : z ∈ closedStrip β + · obtain ⟨w, hw⟩ := cauchySeq_tendsto_of_complete (hgC.cauchySeq hz) + exact ⟨w, fun _ => hw⟩ + · exact ⟨0, fun h => (hz h).elim⟩ + choose g hg using hex + have hgu : TendstoUniformlyOn (fun n z => gaussian z * F n z) g atTop + (closedStrip β) := hgC.tendstoUniformlyOn_of_tendsto hg + have hgc : ContinuousOn g (closedStrip β) := by + apply hgu.continuousOn + apply Filter.Eventually.frequently + apply Filter.Eventually.of_forall + intro n + exact gaussian_differentiable.continuous.continuousOn.mul + (by simpa only [closure_openStrip hβ] using (hd n).continuousOn) + let inverseGaussian : ℂ → ℂ := fun z => Complex.exp (z * z) + have hic : Continuous inverseGaussian := + Complex.continuous_exp.comp (continuous_id.mul continuous_id) + have hiu : TendstoUniformlyOn (fun _ : ℕ => inverseGaussian) + inverseGaussian atTop (closedStrip β) := by + rw [Metric.tendstoUniformlyOn_iff] + exact fun ε hε => Filter.Eventually.of_forall (fun _ _ _ => by simpa) + have hloc := hiu.tendstoLocallyUniformlyOn.mul₀ hgu.tendstoLocallyUniformlyOn + hic.continuousOn hgc + have hFi (n : ℕ) (z : ℂ) : + inverseGaussian z * (gaussian z * F n z) = F n z := by + dsimp only [inverseGaussian, gaussian] + rw [← mul_assoc, ← Complex.exp_add, add_neg_cancel, Complex.exp_zero, one_mul] + have hlocF : TendstoLocallyUniformlyOn F (fun z => inverseGaussian z * g z) + atTop (closedStrip β) := hloc.congr (fun n z _ => hFi n z) + refine ⟨fun z => inverseGaussian z * g z, hlocF, ⟨?_, ?_⟩, ?_⟩ + · exact (hlocF.mono (fun _ hz => ⟨hz.1.le, hz.2.le⟩)).differentiableOn + (Filter.Eventually.of_forall (fun n => (hd n).differentiableOn)) + (isOpen_openStrip β) + · rw [closure_openStrip hβ] + exact hic.continuousOn.mul hgc + · intro z hz + exact le_of_tendsto ((hlocF.tendsto_at hz).norm) + (Filter.Eventually.of_forall (fun n => hbound n z hz)) + +theorem boundaryCauchy_of_locallyUniform {β : ℝ} {F : ℕ → ℂ → ℂ} + {f₀ fβ : ℝ → ℂ} + (h₀ : TendstoLocallyUniformly (fun n (t : ℝ) => F n (t : ℂ)) f₀ atTop) + (hβ : TendstoLocallyUniformly (fun n (t : ℝ) => F n ((t : ℂ) + Complex.I * β)) + fβ atTop) : BoundaryCauchy β F := by + intro R _ ε hε + have hu₀ := (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact + (isCompact_Icc : IsCompact (Icc (-R) R))).mp h₀.tendstoLocallyUniformlyOn + have huβ := (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact + (isCompact_Icc : IsCompact (Icc (-R) R))).mp hβ.tendstoLocallyUniformlyOn + obtain ⟨N₀, hN₀⟩ := Metric.uniformCauchySeqOn_iff.mp hu₀.uniformCauchySeqOn ε hε + obtain ⟨Nβ, hNβ⟩ := Metric.uniformCauchySeqOn_iff.mp huβ.uniformCauchySeqOn ε hε + refine ⟨max N₀ Nβ, ?_⟩ + intro m hm n hn z hz hr + have hr' : z.re ∈ Icc (-R) R := abs_le.mp hr + rcases hz with hz | hz + · have heq : (z.re : ℂ) = z := by + apply Complex.ext <;> simp [hz] + simpa only [heq, dist_eq_norm] using + hN₀ m ((le_max_left _ _).trans hm) n ((le_max_left _ _).trans hn) z.re hr' + · have heq : (z.re : ℂ) + Complex.I * β = z := by + apply Complex.ext <;> simp [hz] + simpa only [heq, dist_eq_norm] using + hNβ m ((le_max_right _ _).trans hm) n ((le_max_right _ _).trans hn) z.re hr' + +theorem bounded_strip_limit {β C : ℝ} (hβ : 0 < β) (hC : 0 ≤ C) + {F : ℕ → ℂ → ℂ} {f₀ fβ : ℝ → ℂ} + (hd : ∀ n, DiffContOnCl ℂ (F n) (openStrip β)) + (hbounded : ∀ n, ∃ M : ℝ, ∀ z ∈ closedStrip β, ‖F n z‖ ≤ M) + (hzero : ∀ n (t : ℝ), ‖F n (t : ℂ)‖ ≤ C) + (htop : ∀ n (t : ℝ), ‖F n ((t : ℂ) + Complex.I * β)‖ ≤ C) + (hconv₀ : TendstoLocallyUniformly (fun n (t : ℝ) => F n (t : ℂ)) f₀ atTop) + (hconvβ : TendstoLocallyUniformly + (fun n (t : ℝ) => F n ((t : ℂ) + Complex.I * β)) fβ atTop) : + ∃ f : ℂ → ℂ, TendstoLocallyUniformlyOn F f atTop (closedStrip β) ∧ + DiffContOnCl ℂ f (openStrip β) ∧ + (∀ z ∈ closedStrip β, ‖f z‖ ≤ C) ∧ + (∀ t : ℝ, f (t : ℂ) = f₀ t) ∧ + (∀ t : ℝ, f ((t : ℂ) + Complex.I * β) = fβ t) := by + have hb (n : ℕ) (z : ℂ) (hz : z ∈ closedStrip β) : ‖F n z‖ ≤ C := by + apply bounded_strip_max hβ (hd n) (hbounded n) ?_ ?_ hz + · intro w hw + have heq : (w.re : ℂ) = w := by apply Complex.ext <;> simp [hw] + simpa only [heq] using hzero n w.re + · intro w hw + have heq : (w.re : ℂ) + Complex.I * β = w := by + apply Complex.ext <;> simp [hw] + simpa only [heq] using htop n w.re + obtain ⟨f, hf, hfd, hfb⟩ := strip_limit_of_boundaryCauchy hβ hC hd hb + (boundaryCauchy_of_locallyUniform hconv₀ hconvβ) + refine ⟨f, hf, hfd, hfb, ?_, ?_⟩ + · intro t + have ht : (t : ℂ) ∈ closedStrip β := by + constructor <;> simp [hβ.le] + exact tendsto_nhds_unique (hf.tendsto_at ht) (hconv₀.tendstoLocallyUniformlyOn.tendsto_at (Set.mem_univ t)) + · intro t + have ht : (t : ℂ) + Complex.I * β ∈ closedStrip β := by + constructor <;> simp [hβ.le] + exact tendsto_nhds_unique (hf.tendsto_at ht) (hconvβ.tendstoLocallyUniformlyOn.tendsto_at (Set.mem_univ t)) + +end HeisenbergStrip +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ClockInsertions.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ClockInsertions.lean new file mode 100644 index 0000000000000000000000000000000000000000..8decbfb1cb38521f784b4a38675404bbfda00051 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ClockInsertions.lean @@ -0,0 +1,307 @@ +import OAI.MathematicalPhysics.Heisenberg.ClockWitnesses + +namespace OAI + +noncomputable section + +open Filter Topology +open scoped RealInnerProductSpace Classical +open scoped Classical +open Filter +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical + +namespace Heisenberg.Clocks +open Heisenberg.Exposure +variable {V X E I : Type*} [PseudoMetricSpace X] [Fintype E] [Fintype I] + +theorem mixed_trajectory_probability + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) + (τ : ℕ → Equiv.Perm V) (site : V → X) (v : V) + (edge : ℕ → E) (n N r : ℕ) (time : ℕ → Fin N) + (index : Fin N → E → Bool → I) (src : (I → Bool) → ℕ → Bool) + (htime : Monotone time) + (hinj : ∀ c,Set.InjOn (fun j => index (time j) (edge j) (src c j)) (Set.Iio n)) + (hstep : ∀ j,j c (index (time j) (edge j) (src c j))) n v)) + then Bernoulli.weight p c*W c else 0) ≤ + ((N+r).choose r:ℝ)*(2*(B:ℝ)*δ)^r * (∑ c,Bernoulli.weight p c*W c) := by + apply witness_probability choices next B hB r N (site v) index p κ hp hκ W hW hins δ hδ hrate + intro c hc + let coin : ℕ → Bool := fun j => c (index (time j) (edge j) (src c j)) + let x : ℕ → X := fun j => site (trajectory τ coin j v) + have hx0 : x 0=site v := rfl + have hxstep : ∀ j,0≤j → j<0+n → dist (x j) (x (j+1)) ≤ 1 := by + intro j _ hj + dsimp [x] + rw [trajectory_succ] + split_ifs + · rw [dist_comm] + exact hstep j (by omega) _ + · simp + have hd := dist_le_moves x 0 n hxstep + have hlen : r ≤ (moveList x 0 n).length := by + have hr : (r:ℝ) ≤ ((moveList x 0 n).length:ℝ) := by + have hc' : (r:ℝ) ≤ dist (x 0) (x n) := hc + exact hc'.trans (by simpa only [zero_add] using hd) + exact_mod_cast hr + have hm : ∀ j,j test_nonneg _ c) hx + · rw [ite_eq_right hc] + exact Finset.sum_nonneg (fun x _ => test_nonneg _ c) + have hZ : 0 ≤ ∑ c,weight p c*W c := + Finset.sum_nonneg (fun c _ => mul_nonneg (weight_nonneg p hp c) (hW c)) + calc + _ = ∑ c,weight p c*W c*(if event c then (1:ℝ) else 0) := by + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + _ ≤ ∑ c,weight p c*W c*(∑ x ∈ q,test (marks x) c) := + Finset.sum_le_sum (fun c _ => mul_le_mul_of_nonneg_left (hb c) (mul_nonneg (weight_nonneg p hp c) (hW c))) + _ = ∑ x ∈ q,∑ c,weight p c*(W c*test (marks x) c) := by + simp only [Finset.mul_sum,mul_assoc] + rw [Finset.sum_comm] + _ ≤ ∑ x ∈ q,δ^r*(∑ c,weight p c*W c) := by + apply Finset.sum_le_sum + intro x hx + apply (factorial_bound_rates p κ hp hκ W hW hins (marks x)).trans + apply mul_le_mul_of_nonneg_right _ hZ + calc + _ ≤ ∏ _i ∈ marks x,δ := Finset.prod_le_prod₀ (fun i _ => mul_nonneg (by linarith [hκ i]) (hp i).1) (fun i hi => hrate x hx i hi) + _ = δ^r := by rw [Finset.prod_const,hm x hx] + _ = _ := by simp [mul_assoc] + +end Heisenberg.Bernoulli + +namespace Heisenberg.Clocks +variable {X E I : Type*} [Fintype E] +theorem witness_probability_spatial [Fintype I] + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (r N : ℕ) (x : X) (index : Fin N → E → Bool → I) + (p κ : I → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) (hκ : ∀ i,1 ≤ κ i) + (W : (I → Bool) → ℝ) (hW : ∀ c,0 ≤ W c) + (hins : ∀ c i,W (Function.update c i true) ≤ κ i*W (Function.update c i false)) + (δ : ℝ) (hδ : 0 ≤ δ) (hrate : ∀ t e b,κ (index t e b)*p (index t e b) ≤ δ) + (event : (I → Bool) → Prop) + (hcover : ∀ c,event c → ∃ q ∈ witnesses choices next r N x index, + ∀ k : Fin r,c (index (q.1 k) (q.2.1 k) (q.2.2 k)) = true) : + (∑ c,if event c then Bernoulli.weight p c*W c else 0) ≤ + ((N+r).choose r:ℝ)*(2*(B:ℝ)*δ)^r * (∑ c,Bernoulli.weight p c*W c) := by + have hc : ∀ c,event c → ∃ q ∈ witnesses choices next r N x index, + ∀ i ∈ witnessMarks index q,c i=true := by + intro c he + obtain ⟨q,hq,hh⟩ := hcover c he + refine ⟨q,hq,?_⟩ + intro i hi + obtain ⟨k,_hk,rfl⟩ := Finset.mem_image.mp hi + exact hh k + have hb := Bernoulli.marked_union_bound_on p κ hp hκ W hW hins + (witnesses choices next r N x index) (witnessMarks index) r + (fun q hq => witnessMarks_card choices next r N x index q hq) δ hδ (by + intro q _ i hi + obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hi + exact hrate _ _ _) event hc + have hZ : 0 ≤ ∑ c,Bernoulli.weight p c*W c := Finset.sum_nonneg + (fun c _ => mul_nonneg (Bernoulli.weight_nonneg p hp c) (hW c)) + apply hb.trans + have hn : ((witnesses choices next r N x index).card:ℝ) ≤ + ((N+r).choose r:ℝ)*(2*(B:ℝ))^r := by + exact_mod_cast witnesses_card choices next B hB r N x index + calc + _ ≤ (((N+r).choose r:ℝ)*(2*(B:ℝ))^r)*δ^r*(∑ c,Bernoulli.weight p c*W c) := + mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hn (pow_nonneg hδ _)) hZ + _ = _ := by rw [mul_assoc _ _ (δ^r),←mul_pow] + +theorem adaptive_trajectory_witness (choices : X → Finset E) (next : X → E → X) + (x : ℕ → X) (edge : ℕ → E) (r n N : ℕ) + (time : ℕ → Fin N) (src : ℕ → Bool) (index : Fin N → E → Bool → I) + (c : I → Bool) (hlen : r ≤ (moveList x 0 n).length) + (htime : Monotone time) + (hinj : Set.InjOn (fun j => index (time j) (edge j) (src j)) {j | j l.get (Fin.cast hl.symm k) + have hjmem (k : Fin r) : j k ∈ moveList x 0 n := + List.mem_of_mem_take (List.get_mem l _) + have hjlt (k : Fin r) : j k time (j k),fun k => edge (j k),fun k => src (j k)) + refine ⟨q,?_,fun k => (hjmove k).2.2⟩ + apply Finset.mem_filter.mpr + constructor + · apply Finset.mem_product.mpr + constructor + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,htime.comp hjmono.monotone⟩ + · apply Finset.mem_product.mpr + refine ⟨?_,Finset.mem_univ _⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + have hf := moveList_follows choices next x edge 0 n + (fun j _ hj hm => ⟨(hmove j (by simpa using hj) hm).1,(hmove j (by simpa using hj) hm).2.1⟩) + have ht := follows_take choices next (x 0) _ hf r + have he : List.ofFn (fun k : Fin r => edge (j k)) = l.map edge := by + change List.ofFn (edge ∘ j) = _ + rw [←List.map_ofFn,hof] + rw [he] + convert follows_mem choices next (x 0) (l.map edge) (by simpa [l,List.map_take] using ht) using 1 + simp [hl] + · intro a b he + apply hjmono.injective + exact hinj ⟨hjlt a,moveList_moved x 0 n (hjmem a)⟩ ⟨hjlt b,moveList_moved x 0 n (hjmem b)⟩ he + +theorem adaptive_trajectory_probability [Fintype I] [PseudoMetricSpace X] + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (v : X) + (x : (I → Bool) → ℕ → X) (hx0 : ∀ c,x c 0=v) + (edge : ℕ → E) (n N r : ℕ) (time : ℕ → Fin N) + (index : Fin N → E → Bool → I) (src : (I → Bool) → ℕ → Bool) + (htime : Monotone time) + (hinj : ∀ c,Set.InjOn (fun j => index (time j) (edge j) (src c j)) + {j | j hstep c j (by simpa using hj)) + have hd' : dist v (x c n) ≤ ((moveList (x c) 0 n).length:ℝ) := by simpa [hx0 c] using hd + have hlen : r ≤ (moveList (x c) 0 n).length := by + have hh : (r:ℝ) ≤ ((moveList (x c) 0 n).length:ℝ) := hc.trans hd' + exact_mod_cast hh + simpa only [hx0 c] using adaptive_trajectory_witness choices next (x c) edge r n N time (src c) index c + hlen htime (hinj c) (hmove c) + +end Heisenberg.Clocks + +namespace Heisenberg.Bernoulli +variable {I : Type*} [Fintype I] + +def doubleRates (p : I → ℝ) : I ⊕ I → ℝ := Sum.elim p p + +def original (c : I ⊕ I → Bool) : I → Bool := c ∘ Sum.inl + +def fresh (c : I ⊕ I → Bool) : I → Bool := c ∘ Sum.inr + +lemma weight_total (p : I → ℝ) : ∑ c, weight p c=1 := by + classical + unfold weight + rw [←Fintype.prod_sum (fun i (b : Bool) => if b then p i else 1-p i)] + simp + +lemma double_weight (p : I → ℝ) (c : I ⊕ I → Bool) : + weight (doubleRates p) c=weight p (original c)*weight p (fresh c) := by + classical + simp only [weight,Fintype.prod_sum_type,doubleRates,original,fresh,Function.comp_apply,Sum.elim_inl,Sum.elim_inr] + congr 1 + +lemma double_sum (p : I → ℝ) (F : (I → Bool) → (I → Bool) → ℝ) : + (∑ c : I ⊕ I → Bool,weight (doubleRates p) c*F (original c) (fresh c)) = + ∑ b : I → Bool,∑ f : I → Bool,weight p b*weight p f*F b f := by + rw [←(Equiv.sumArrowEquivProdArrow I I Bool).symm.sum_comp] + simp only [double_weight,Fintype.sum_prod_type] + rfl + +lemma double_partition (p : I → ℝ) (W : (I → Bool) → ℝ) : + (∑ c : I ⊕ I → Bool,weight (doubleRates p) c*W (original c)) = + ∑ b : I → Bool,weight p b*W b := by + rw [double_sum p (fun b _ => W b)] + simp_rw [mul_right_comm _ _ (W _),←Finset.mul_sum,weight_total,mul_one] + +omit [Fintype I] in +lemma original_update_left (c : I ⊕ I → Bool) (i : I) (b : Bool) : + original (Function.update c (Sum.inl i) b)=Function.update (original c) i b := by + classical + funext j + by_cases hj : j=i + · subst j; simp [original] + · simp [original,hj] + +omit [Fintype I] in +lemma original_update_right (c : I ⊕ I → Bool) (i : I) (b : Bool) : + original (Function.update c (Sum.inr i) b)=original c := by + classical + funext j + simp [original] + +omit [Fintype I] in + +theorem double_insertion {κ : ℝ} (W : (I → Bool) → ℝ) + (h : ∀ c i,W (Function.update c i true)≤κ*W (Function.update c i false)) : + ∀ (c : I ⊕ I → Bool) i, + W (original (Function.update c i true)) ≤ + (Sum.elim (fun _ => κ) (fun _ => (1:ℝ)) i)*W (original (Function.update c i false)) := by + intro c i + cases i with + | inl i => simpa only [original_update_left,Sum.elim_inl] using h (original c) i + | inr i => simp only [original_update_right,Sum.elim_inr,one_mul,le_refl] + +end Heisenberg.Bernoulli + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ClockTails.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ClockTails.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ef3c3dd9412b9f1a8e6760b2dc82ee48625d1b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ClockTails.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.Heisenberg.LayerRegularity + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Heisenberg.Clocks + +lemma factorial_lower (r : ℕ) : ((r:ℝ)/Real.exp 1)^r ≤ (r.factorial:ℝ) := by + by_cases hr : r=0 + · subst r; simp + have hr1 : (1:ℝ)≤r := by exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hr) + have hp : (1:ℝ)≤Real.sqrt (2*Real.pi*r) := by + apply Real.one_le_sqrt.mpr + nlinarith [Real.pi_gt_three] + exact (le_mul_of_one_le_left (by positivity) hp).trans (Stirling.le_factorial_stirling r) + +theorem clock_tail {N r : ℕ} {B δ : ℝ} (hB : 0≤B) (hδ : 0≤δ) (hr : 0 test_nonneg _ c) hx + · rw [ite_eq_right hc] + exact Finset.sum_nonneg (fun x _ => test_nonneg _ c) + have hZ : 0 ≤ ∑ c,weight p c*W c := + Finset.sum_nonneg (fun c _ => mul_nonneg (weight_nonneg p hp c) (hW c)) + calc + _ = ∑ c,weight p c*W c*(if event c then (1:ℝ) else 0) := by + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + _ ≤ ∑ c,weight p c*W c*(∑ x ∈ q,test (marks x) c) := + Finset.sum_le_sum (fun c _ => mul_le_mul_of_nonneg_left (hb c) (mul_nonneg (weight_nonneg p hp c) (hW c))) + _ = ∑ x ∈ q,∑ c,weight p c*(W c*test (marks x) c) := by + simp only [Finset.mul_sum,mul_assoc] + rw [Finset.sum_comm] + _ ≤ ∑ x ∈ q,δ^r*(∑ c,weight p c*W c) := by + apply Finset.sum_le_sum + intro x hx + apply (factorial_bound_rates p κ hp hκ W hW hins (marks x)).trans + apply mul_le_mul_of_nonneg_right _ hZ + calc + _ ≤ ∏ _i ∈ marks x,δ := Finset.prod_le_prod₀ (fun i _ => mul_nonneg (by linarith [hκ i]) (hp i).1) (fun i _ => hrate i) + _ = δ^r := by rw [Finset.prod_const,hm x hx] + _ = _ := by simp [mul_assoc] + +end Heisenberg.Bernoulli + +namespace Heisenberg.Clocks + +section +variable {X E I : Type*} [Fintype E] + +def weakTimes (r N : ℕ) : Finset (Fin r → Fin N) := Finset.univ.filter Monotone + +lemma weakTimes_card (r N : ℕ) : (weakTimes r N).card ≤ (N+r).choose r := by + rw [weakTimes,←Fintype.card_subtype] + exact card_weakTimes_le N r + +def functionWords (choices : X → Finset E) (next : X → E → X) (r : ℕ) (x : X) : + Finset (Fin r → E) := Finset.univ.filter (fun w => List.ofFn w ∈ edgeWords choices next r x) + +lemma card_functionWords (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (r : ℕ) (x : X) : + (functionWords choices next r x).card ≤ B^r := by + apply le_trans _ (card_edgeWords choices next B hB r x) + apply Finset.card_le_card_of_injOn (fun w => List.ofFn w) + · intro w hw; exact (Finset.mem_filter.mp hw).2 + · intro a _ b _ he + exact List.ofFn_inj.mp he + +def witnesses (choices : X → Finset E) (next : X → E → X) (r N : ℕ) (x : X) + (index : Fin N → E → Bool → I) : + Finset ((Fin r → Fin N) × (Fin r → E) × (Fin r → Bool)) := + ((weakTimes r N).product ((functionWords choices next r x).product Finset.univ)).filter + (fun q => Function.Injective (fun k => index (q.1 k) (q.2.1 k) (q.2.2 k))) + +def witnessMarks {r N : ℕ} (index : Fin N → E → Bool → I) + (q : (Fin r → Fin N) × (Fin r → E) × (Fin r → Bool)) : Finset I := + Finset.univ.image (fun k => index (q.1 k) (q.2.1 k) (q.2.2 k)) + +lemma witnessMarks_card (choices : X → Finset E) (next : X → E → X) (r N : ℕ) (x : X) + (index : Fin N → E → Bool → I) (q) (hq : q ∈ witnesses choices next r N x index) : + (witnessMarks index q).card = r := by + have hi := (Finset.mem_filter.mp hq).2 + rw [witnessMarks,Finset.card_image_of_injective _ hi,Finset.card_univ,Fintype.card_fin] + +lemma witnesses_card (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (r N : ℕ) (x : X) (index : Fin N → E → Bool → I) : + (witnesses choices next r N x index).card ≤ (N+r).choose r * (2*B)^r := by + calc + _ ≤ ((weakTimes r N).product ((functionWords choices next r x).product Finset.univ)).card := + Finset.card_filter_le _ _ + _ = (weakTimes r N).card * ((functionWords choices next r x).card * 2^r) := by + simp + _ ≤ (N+r).choose r * (B^r * 2^r) := + Nat.mul_le_mul (weakTimes_card r N) (Nat.mul_le_mul_right _ (card_functionWords choices next B hB r x)) + _ = _ := by rw [←Nat.mul_pow,Nat.mul_comm B 2] + +theorem witness_probability [Fintype I] + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (r N : ℕ) (x : X) (index : Fin N → E → Bool → I) + (p κ : I → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) (hκ : ∀ i,1 ≤ κ i) + (W : (I → Bool) → ℝ) (hW : ∀ c,0 ≤ W c) + (hins : ∀ c i,W (Function.update c i true) ≤ κ i*W (Function.update c i false)) + (δ : ℝ) (hδ : 0 ≤ δ) (hrate : ∀ i,κ i*p i ≤ δ) + (event : (I → Bool) → Prop) + (hcover : ∀ c,event c → ∃ q ∈ witnesses choices next r N x index, + ∀ k : Fin r,c (index (q.1 k) (q.2.1 k) (q.2.2 k)) = true) : + (∑ c,if event c then Bernoulli.weight p c*W c else 0) ≤ + ((N+r).choose r:ℝ)*(2*(B:ℝ)*δ)^r * (∑ c,Bernoulli.weight p c*W c) := by + have hc : ∀ c,event c → ∃ q ∈ witnesses choices next r N x index, + ∀ i ∈ witnessMarks index q,c i=true := by + intro c he + obtain ⟨q,hq,hh⟩ := hcover c he + refine ⟨q,hq,?_⟩ + intro i hi + obtain ⟨k,_hk,rfl⟩ := Finset.mem_image.mp hi + exact hh k + have hb := Bernoulli.marked_union_bound p κ hp hκ W hW hins + (witnesses choices next r N x index) (witnessMarks index) r + (fun q hq => witnessMarks_card choices next r N x index q hq) δ hδ hrate event hc + have hZ : 0 ≤ ∑ c,Bernoulli.weight p c*W c := Finset.sum_nonneg + (fun c _ => mul_nonneg (Bernoulli.weight_nonneg p hp c) (hW c)) + apply hb.trans + have hn : ((witnesses choices next r N x index).card:ℝ) ≤ + ((N+r).choose r:ℝ)*(2*(B:ℝ))^r := by + exact_mod_cast witnesses_card choices next B hB r N x index + calc + _ ≤ (((N+r).choose r:ℝ)*(2*(B:ℝ))^r)*δ^r*(∑ c,Bernoulli.weight p c*W c) := + mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hn (pow_nonneg hδ _)) hZ + _ = _ := by rw [mul_assoc _ _ (δ^r),←mul_pow] + +end + +variable {X E I : Type*} + +def moveList (x : ℕ → X) (m : ℕ) : ℕ → List ℕ + | 0 => [] + | k+1 => if x (m+1)=x m then moveList x (m+1) k + else m :: moveList x (m+1) k + +lemma moveList_bounds (x : ℕ → X) (m n : ℕ) {j : ℕ} (hj : j ∈ moveList x m n) : + m ≤ j ∧ j < m+n := by + induction n generalizing m with + | zero => simp [moveList] at hj + | succ n ih => + simp only [moveList] at hj + split_ifs at hj with he + · obtain ⟨h₁,h₂⟩ := ih (m+1) hj + omega + · rcases List.mem_cons.mp hj with rfl | hj + · omega + · obtain ⟨h₁,h₂⟩ := ih (m+1) hj + omega + +lemma moveList_moved (x : ℕ → X) (m n : ℕ) {j : ℕ} (hj : j ∈ moveList x m n) : + x (j+1) ≠ x j := by + induction n generalizing m with + | zero => simp [moveList] at hj + | succ n ih => + simp only [moveList] at hj + split_ifs at hj with he + · exact ih (m+1) hj + · rcases List.mem_cons.mp hj with rfl | hj + · exact he + · exact ih (m+1) hj + +lemma moveList_pairwise (x : ℕ → X) (m n : ℕ) : + (moveList x m n).Pairwise (· < ·) := by + induction n generalizing m with + | zero => simp [moveList] + | succ n ih => + simp only [moveList] + split_ifs + · exact ih _ + · exact List.pairwise_cons.mpr ⟨fun j hj => by + have h := (moveList_bounds x (m+1) n hj).1 + omega, ih _⟩ + +lemma moveList_follows (choices : X → Finset E) (next : X → E → X) + (x : ℕ → X) (e : ℕ → E) (m n : ℕ) + (hmove : ∀ j,m ≤ j → j < m+n → x (j+1) ≠ x j → + e j ∈ choices (x j) ∧ x (j+1)=next (x j) (e j)) : + Follows choices next (x m) ((moveList x m n).map e) := by + induction n generalizing m with + | zero => trivial + | succ n ih => + simp only [moveList] + split_ifs with he + · rw [←he] + exact ih (m+1) (fun j h₁ h₂ => hmove j (by omega) (by omega)) + · have hm := hmove m le_rfl (by omega) he + change e m ∈ choices (x m) ∧ _ + refine ⟨hm.1,?_⟩ + rw [←hm.2] + exact ih (m+1) (fun j h₁ h₂ => hmove j (by omega) (by omega)) + +lemma follows_take (choices : X → Finset E) (next : X → E → X) + (x : X) (l : List E) (hl : Follows choices next x l) (r : ℕ) : + Follows choices next x (l.take r) := by + induction r generalizing x l with + | zero => trivial + | succ r ih => + cases l with + | nil => trivial + | cons e l => exact ⟨hl.1,ih _ _ hl.2⟩ + +lemma dist_le_moves [PseudoMetricSpace X] (x : ℕ → X) (m n : ℕ) + (hstep : ∀ j,m ≤ j → j < m+n → dist (x j) (x (j+1)) ≤ 1) : + dist (x m) (x (m+n)) ≤ (moveList x m n).length := by + induction n generalizing m with + | zero => simp [moveList] + | succ n ih => + have ht := ih (m+1) (fun j h₁ h₂ => hstep j (by omega) (by omega)) + have hh : m+(n+1)=(m+1)+n := by omega + rw [moveList] + split_ifs with he + · rw [←he,hh] + exact ht + · rw [List.length_cons,Nat.cast_add,Nat.cast_one,hh] + exact (dist_triangle _ (x (m+1)) _).trans (by linarith [hstep m le_rfl (by omega)]) + +theorem trajectory_witness [Fintype E] (choices : X → Finset E) (next : X → E → X) + (x : ℕ → X) (edge : ℕ → E) (r n N : ℕ) + (time : ℕ → Fin N) (src : ℕ → Bool) (index : Fin N → E → Bool → I) + (c : I → Bool) (hlen : r ≤ (moveList x 0 n).length) + (htime : Monotone time) + (hinj : Set.InjOn (fun j => index (time j) (edge j) (src j)) (Set.Iio n)) + (hmove : ∀ j,j l.get (Fin.cast hl.symm k) + have hjmem (k : Fin r) : j k ∈ moveList x 0 n := + List.mem_of_mem_take (List.get_mem l _) + have hjlt (k : Fin r) : j k time (j k),fun k => edge (j k),fun k => src (j k)) + refine ⟨q,?_,fun k => (hjmove k).2.2⟩ + apply Finset.mem_filter.mpr + constructor + · apply Finset.mem_product.mpr + constructor + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,htime.comp hjmono.monotone⟩ + · apply Finset.mem_product.mpr + refine ⟨?_,Finset.mem_univ _⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + have hf := moveList_follows choices next x edge 0 n + (fun j _ hj hm => ⟨(hmove j (by simpa using hj) hm).1,(hmove j (by simpa using hj) hm).2.1⟩) + have ht := follows_take choices next (x 0) _ hf r + have he : List.ofFn (fun k : Fin r => edge (j k)) = l.map edge := by + change List.ofFn (edge ∘ j) = _ + rw [←List.map_ofFn,hof] + rw [he] + convert follows_mem choices next (x 0) (l.map edge) (by simpa [l,List.map_take] using ht) using 1 + simp [hl] + · intro a b he + apply hjmono.injective + exact hinj (hjlt a) (hjlt b) he + +end Heisenberg.Clocks + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ColorClockLimit.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ColorClockLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d9f4ece755c9e19d9d8c282c22b6b4e2dccdb89 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ColorClockLimit.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.Heisenberg.ExchangeOnMesh + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator NNReal +open Filter Topology +namespace Heisenberg.Surface +open ExchangeMatrix MeshPair +variable {V : Type} [Fintype V] + +lemma color_matrix_permutation (π : Equiv.Perm V) : + SlotColor.matrix π=permutationMatrix (SlotColor.permute π) := rfl + +def colorClocks (a b : ℕ → V) : ℕ → List (Clock (V → Bool)) + | 0=>[] + | n+1=>(⟨1/2,by norm_num⟩,SlotColor.permute (Equiv.swap (a n) (b n)))::colorClocks a b n + +lemma color_prefix_linear (a b : ℕ → V) (q : ℕ) (δ : ℝ) : + prefixMatrix (fun j=>colorCoin (a j) (b j) (δ/2)) q=linearMesh (colorClocks a b q) δ := by + induction q with + | zero=>rfl + | succ q ih=> + rw [prefixMatrix,ih,colorClocks,linearMesh] + congr 1 + change (1-δ/2) • (1:Matrix (V → Bool) (V → Bool) ℝ)+(δ/2) • + permutationMatrix (SlotColor.permute (Equiv.swap (a q) (b q)))= + (1-(1/2:ℝ)*δ) • 1+((1/2:ℝ)*δ) • permutationMatrix (SlotColor.permute (Equiv.swap (a q) (b q))) + rw [show δ/2=(1/2:ℝ)*δ by ring] + +lemma color_generator (a b : ℕ → V) (q : ℕ) : + clockGenerator (colorClocks a b q)=∑ j∈Finset.range q,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a j) (b j))-1) := by + induction q with + | zero=>simp [colorClocks,clockGenerator] + | succ q ih=> + rw [colorClocks,clockGenerator,ih,Finset.sum_range_succ] + rw [color_matrix_permutation] + exact add_comm _ _ + +theorem color_clock_limit (a b : ℕ → V) (q : ℕ) {t : ℝ} (ht : 0≤t) : + Tendsto (fun n : ℕ=>(prefixMatrix (fun j=>colorCoin (a j) (b j) ((t/(n+1:ℝ))/2)) q)^(n+1)) atTop + (𝓝 (NormedSpace.exp (t • ∑ j∈Finset.range q,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a j) (b j))-1)))) := by + simp_rw [color_prefix_linear] + rw [←color_generator] + exact linear_mesh_converges _ _ ht + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CompletedSurface.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CompletedSurface.lean new file mode 100644 index 0000000000000000000000000000000000000000..94ab5dde2fc56c4e5ba4f23468fbece50de94bfc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CompletedSurface.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshRoom + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Fin.NatCast Matrix Matrix.Norms.Operator +open Filter Topology +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance completedSurfaceDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open Heisenberg.Geometry LatticeRegular SpatialFrame MeshPair + +lemma trace_tendsto {V I : Type*} [Fintype V] {l : Filter I} {f : I → Matrix V V ℝ} + {M : Matrix V V ℝ} (hf : Tendsto f l (𝓝 M)) : + Tendsto (fun i=>Matrix.trace (f i)) l (𝓝 (Matrix.trace M)) := by + exact tendsto_finsetSum _ (fun i _=>(Heat.entry i i).continuous.tendsto M |>.comp hf) + +theorem completed_surface_bound (d : ℕ) (hd : 2≤d) (B : Type) [Fintype B] [Nonempty B] : + ∃ s : ℝ,0v.1.val∉F)).card:ℝ) + let J:=(((Finset.range q).filter (fun j=>(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card:ℝ) + let E:=NormedSpace.exp (t • ∑ j∈Finset.range q,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a₀ j) (b₀ j))-1)) + let U:=prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u j) (v j))) c + Real.exp (-(Real.log 2)*(Z+2*t*J))/2*Matrix.trace (U*E)≤ + Matrix.trace (U*E*tailProjection (Slots (B:=B) Λ)) := by + obtain ⟨s,hs,hbound⟩:=mesh_matrix_surface d hd B + refine ⟨s,hs,?_⟩ + intro Λ F hΛ q _ edge a₀ b₀ ha₀ hb₀ c u v huv hF hf t ht Z J E U + let Q:=q+c + have hq : 0prefixMatrix (fun j=>colorCoin (a₀ j) (b₀ j) (δ/2)) q + have hA : Tendsto (fun k : ℕ=>U*(A (t/(k+1:ℝ)))^(k+1)) atTop (𝓝 (U*E)) := + tendsto_const_nhds.mul (color_clock_limit a₀ b₀ q ht0.le) + apply le_of_tendsto_of_tendsto + (tendsto_const_nhds.mul (trace_tendsto hA)) + (trace_tendsto (hA.mul_const (tailProjection (Slots (B:=B) Λ)))) + have hδevent:=hbound Λ F hΛ q edge a₀ b₀ ha₀ hb₀ + have hδsmall : ∀ᶠ k : ℕ in atTop,t/(k+1:ℝ)≤2 := + (mesh_step_tendsto t).eventually (eventually_le_nhds (by norm_num)) + filter_upwards [(mesh_step_tendsto t).eventually hδevent,hδsmall,eventually_mesh_room hs.le ht Q] with k hk hk2 hroom + let δ:=t/(k+1:ℝ) + have hδ : 0<δ:=div_pos ht0 (by positivity) + let a : Fin ((k+1)*Q) → Slots (B:=B) Λ:=fun j=>completedEndpoint a₀ u q c j.val + let b : Fin ((k+1)*Q) → Slots (B:=B) Λ:=fun j=>completedEndpoint b₀ v q c j.val + let rates : Fin ((k+1)*Q) → ℝ:=fun j=>completedRate δ q c k j.val + have hab : ∀ j : Fin ((k+1)*Q),j.val%Qcompleted_rate_bounds q c k j.val hδ.le hk2) hrate hF hf hroom + let K:=Finset.univ.filter (fun j : Fin ((k+1)*Q)=>j.val%Q(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card := by + have hset : K=Finset.univ.filter (fun j : Fin ((k+1)*Q)=>j.val%Q(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F) using 1 <;> congr! 10 + have he : 2*δ*(K.card:ℝ)=2*t*J := by + rw [hK,Nat.cast_mul] + dsimp only [δ,J] + push_cast + field_simp + have hprod : Serial.product ((k+1)*Q) (fun j=>colorCoin (a j) (b j) (rates j))=U*(A δ)^(k+1) := by + exact completed_product a₀ b₀ u v q c k δ + change Real.exp (-(Real.log 2)*(Z+2*δ*(K.card:ℝ)))/2* + Matrix.trace (Serial.product ((k+1)*Q) (fun j=>colorCoin (a j) (b j) (rates j)))≤_ at hh + rw [he,hprod] at hh + exact hh + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CompletionFactor.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CompletionFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..1933f8b9041308fd2f9fe9b8751c9eaa232350f2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CompletionFactor.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.Heisenberg.OnsiteSwaps + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open MeshPair +variable {V X : Type} [Fintype V] [Nonempty V] + +lemma list_completion (loc : V → X) (L : List (V×V)) + (hL : ∀ e∈L,loc e.1=loc e.2) : + ∃ (c : ℕ) (u v : ℕ → V),(∀ j,loc (u j)=loc (v j)) ∧ + prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u j) (v j))) c= + SlotColor.matrix ((L.map (fun e=>Equiv.swap e.1 e.2)).prod) := by + classical + induction L with + | nil=> + refine ⟨0,fun _=>Classical.arbitrary V,fun _=>Classical.arbitrary V,fun _=>rfl,?_⟩ + simp only [prefixMatrix,List.map_nil,List.prod_nil,SlotColor.matrix_one] + | cons e L ih=> + obtain ⟨c,u,v,huv,hprod⟩:=ih (fun f hf=>hL f (List.mem_cons_of_mem e hf)) + let u' : ℕ → V:=fun j=>if j=c then e.1 else u j + let v' : ℕ → V:=fun j=>if j=c then e.2 else v j + refine ⟨c+1,u',v',?_,?_⟩ + · intro j + by_cases hj : j=c + · simpa only [u',v',ite_eq_left hj] using hL e (List.mem_cons_self ..) + · simpa only [u',v',ite_eq_right hj] using huv j + · rw [prefixMatrix] + have hp : prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u' j) (v' j))) c= + prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u j) (v j))) c := by + apply Serial.prefix_congr + intro j hj + simp only [u',v',ite_eq_right (show j≠c by omega)] + rw [hp,hprod] + simp only [u',v',ite_eq_left rfl,List.map_cons,List.prod_cons,SlotColor.matrix_mul] + +theorem completion_factorization (loc : V → X) (π : Equiv.Perm V) + (hπ : ∀ v,loc (π v)=loc v) : + ∃ (c : ℕ) (u v : ℕ → V),(∀ j,loc (u j)=loc (v j)) ∧ + prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u j) (v j))) c=SlotColor.matrix π := by + obtain ⟨L,hL,he⟩:=Onsite.swap_factorization loc π hπ + obtain ⟨c,u,v,h,hp⟩:=list_completion loc L hL + exact ⟨c,u,v,h,by simpa only [he] using hp⟩ + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ConditionalMoments.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ConditionalMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..219ddb078d53f0d68085820eb1d98f7399fd346a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ConditionalMoments.lean @@ -0,0 +1,256 @@ +import OAI.MathematicalPhysics.Heisenberg.FirstReturns + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix + +namespace Heisenberg.Exposure + +section +variable {J Q Ω : Type*} [Fintype J] [Fintype Q] [Fintype Ω] + [DecidableEq J] [DecidableEq Q] +variable {R : Type*} [Field R] + +lemma conditional_hitWeight_sum (μ : Ω → R) (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) + (hg : hitWeight μ π ≠ 0) : + (∑ ω, if AllHit (π ω) then μ ω / hitWeight μ π else 0) = 1 := by + have ht := conditional_resolvent_determinant μ π h hg (0 : Matrix J J R) + simpa only [Matrix.zero_mul, sub_zero, Matrix.det_one, mul_one] using ht + +theorem conditional_resolvent_first_moment (μ : Ω → R) + (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) + (hg : hitWeight μ π ≠ 0) : + (∑ ω, if AllHit (π ω) then + (μ ω / hitWeight μ π) • hittingResolvent R (columnPerm R (π ω)) else 0) = + hittingResolvent R (∑ ω, μ ω • columnPerm R (π ω)) := by + ext i j + have ht := conditional_resolvent_determinant μ π h hg (Matrix.single j i (1 : R)) + simp only [det_one_sub_single_mul] at ht + have he : (∑ ω, if AllHit (π ω) then (μ ω / hitWeight μ π) * + (1 - hittingResolvent R (columnPerm R (π ω)) i j) else 0) = + (∑ ω, if AllHit (π ω) then μ ω / hitWeight μ π else 0) - + (∑ ω, if AllHit (π ω) then (μ ω / hitWeight μ π) * + hittingResolvent R (columnPerm R (π ω)) i j else 0) := by + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> ring + rw [he, conditional_hitWeight_sum μ π h hg] at ht + have hh := sub_right_injective ht + simp only [Matrix.sum_apply] + rw [← hh] + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> rfl + +end + +section +variable {J Q : Type*} [Fintype J] [Fintype Q] + +lemma reachesPin (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (x : J ⊕ Q) : + ∃ n : ℕ, ∃ j : J, (π ^ n) x = Sum.inl j := by + obtain ⟨j, hj⟩ := h x + obtain ⟨n, hn⟩ := hj.exists_nat_pow_eq + exact ⟨n, j, hn⟩ + +def firstPinTime (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (x : J ⊕ Q) : ℕ := + Nat.find (reachesPin π h x) + +def firstPin (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (x : J ⊕ Q) : J := + Classical.choose (Nat.find_spec (reachesPin π h x)) + +lemma firstPin_spec (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (x : J ⊕ Q) : + (π ^ firstPinTime π h x) x = Sum.inl (firstPin π h x) := + Classical.choose_spec (Nat.find_spec (reachesPin π h x)) + +lemma firstPinTime_min (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (x : J ⊕ Q) + {n : ℕ} {j : J} (hj : (π ^ n) x = Sum.inl j) : firstPinTime π h x ≤ n := + Nat.find_min' (reachesPin π h x) ⟨j, hj⟩ + +@[simp] lemma firstPinTime_inl (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (j : J) : + firstPinTime π h (Sum.inl j) = 0 := by + apply Nat.eq_zero_of_le_zero + exact firstPinTime_min π h _ (by simp : (π ^ 0) (Sum.inl j) = Sum.inl j) + +@[simp] lemma firstPin_inl (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (j : J) : + firstPin π h (Sum.inl j) = j := by + have hs := firstPin_spec π h (Sum.inl j) + simpa using hs.symm + +lemma firstPinTime_inr_pos (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (q : Q) : + 0 < firstPinTime π h (Sum.inr q) := by + apply Nat.pos_of_ne_zero + intro hz + have hs := firstPin_spec π h (Sum.inr q) + simp [hz] at hs + +lemma firstPinTime_step (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (q : Q) : + firstPinTime π h (Sum.inr q) = firstPinTime π h (π (Sum.inr q)) + 1 := by + apply Nat.le_antisymm + · apply firstPinTime_min π h _ (j := firstPin π h (π (Sum.inr q))) + rw [pow_succ, Equiv.Perm.mul_apply] + exact firstPin_spec π h _ + · have hp := firstPinTime_inr_pos π h q + have he : (π ^ (firstPinTime π h (Sum.inr q) - 1)) (π (Sum.inr q)) = + Sum.inl (firstPin π h (Sum.inr q)) := by + rw [← Equiv.Perm.mul_apply, ← pow_succ, Nat.sub_add_cancel hp] + exact firstPin_spec π h _ + have hm := firstPinTime_min π h _ he + omega + +lemma firstPin_step (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (q : Q) : + firstPin π h (Sum.inr q) = firstPin π h (π (Sum.inr q)) := by + have hs := firstPin_spec π h (Sum.inr q) + rw [firstPinTime_step, pow_succ, Equiv.Perm.mul_apply] at hs + exact Sum.inl.inj (hs.symm.trans (firstPin_spec π h _)) + +def nextPin (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (j : J) : J := + firstPin π h (π (Sum.inl j)) + +lemma nextPin_spec (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (j : J) : + (π ^ (firstPinTime π h (π (Sum.inl j)) + 1)) (Sum.inl j) = + Sum.inl (nextPin π h j) := by + rw [pow_succ, Equiv.Perm.mul_apply] + exact firstPin_spec π h _ + +lemma nextPin_is_first (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (j : J) + {n : ℕ} (hn : 0 < n) {k : J} (hk : (π ^ n) (Sum.inl j) = Sum.inl k) : + firstPinTime π h (π (Sum.inl j)) + 1 ≤ n := by + have he : (π ^ (n - 1)) (π (Sum.inl j)) = Sum.inl k := by + rw [← Equiv.Perm.mul_apply, ← pow_succ, Nat.sub_add_cancel hn] + exact hk + have hm := firstPinTime_min π h _ he + omega + +end + +section +variable {J Q : Type*} [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] +variable (R : Type*) [Field R] + +def firstPinMatrix (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : Matrix J (J ⊕ Q) R := + fun i x => if firstPin π h x = i then 1 else 0 + +def nextPinMatrix (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : Matrix J J R := + fun i j => if nextPin π h j = i then 1 else 0 + +omit [DecidableEq Q] in +lemma firstPinMatrix_boundary (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : + (firstPinMatrix R π h).toCols₁ = 1 := by + ext i j + simp [firstPinMatrix, Matrix.one_apply, eq_comm] + +lemma firstPinMatrix_step (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : + firstPinMatrix R π h * columnPerm R π = + Matrix.fromCols (nextPinMatrix R π h) (firstPinMatrix R π h).toCols₂ := by + ext i x + change ((firstPinMatrix R π h) i ᵥ* columnPerm R π) x = _ + rw [columnPerm, Matrix.transpose_permMatrix, Matrix.vecMul_permMatrix] + cases x with + | inl j => rfl + | inr q => + change (if firstPin π h (π (Sum.inr q)) = i then (1 : R) else 0) = + (if firstPin π h (Sum.inr q) = i then (1 : R) else 0) + rw [firstPin_step] + +theorem nextPinMatrix_eq_resolvent (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : + nextPinMatrix R π h = hittingResolvent R (columnPerm R π) := by + let K := columnPerm R π + let V := (firstPinMatrix R π h).toCols₂ + have hs := firstPinMatrix_step R π h + have hf : firstPinMatrix R π h = Matrix.fromCols 1 V := by + rw [← Matrix.fromCols_toCols (firstPinMatrix R π h), firstPinMatrix_boundary] + rw [hf] at hs + change Matrix.fromCols 1 V * K = Matrix.fromCols (nextPinMatrix R π h) V at hs + conv_lhs at hs => arg 2; rw [← Matrix.fromBlocks_toBlocks K] + rw [Matrix.fromCols_mul_fromBlocks, Matrix.one_mul, Matrix.one_mul] at hs + have hJ := congrArg Matrix.toCols₁ hs + have hQ := congrArg Matrix.toCols₂ hs + simp only [Matrix.toCols₁_fromCols, Matrix.toCols₂_fromCols] at hJ hQ + have hV : V * (1 - K.toBlocks₂₂) = K.toBlocks₁₂ := by + rw [Matrix.mul_sub, Matrix.mul_one] + exact sub_eq_iff_eq_add.mpr hQ.symm + have hd : IsUnit (1 - K.toBlocks₂₂).det := by + have he : (1 - K.toBlocks₂₂).det = 1 := by + simpa only [K, Matrix.toBlocks₂₂, Matrix.submatrix, ite_eq_left h] using + det_one_sub_columnPerm_QQ R π + rw [he] + exact isUnit_one + have hv : V = K.toBlocks₁₂ * (1 - K.toBlocks₂₂)⁻¹ := by + rw [← hV, Matrix.mul_nonsing_inv_cancel_right _ _ hd] + rw [← hJ, hv] + rfl + +end + +section +variable {J Q : Type*} [Fintype J] [Fintype Q] + +lemma nextPin_injective (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : + Function.Injective (nextPin π h) := by + have haux (j k : J) + (hn : firstPinTime π h (π (Sum.inl j)) + 1 ≤ + firstPinTime π h (π (Sum.inl k)) + 1) + (he : nextPin π h j = nextPin π h k) : j = k := by + let n := firstPinTime π h (π (Sum.inl j)) + 1 + let m := firstPinTime π h (π (Sum.inl k)) + 1 + have hnm : n ≤ m := hn + have hn0 : 0 < n := Nat.succ_pos _ + have hm0 : 0 < m := Nat.succ_pos _ + have hb : (π ^ (m - n)) (Sum.inl k) = Sum.inl j := by + apply (π ^ n).injective + calc + (π ^ n) ((π ^ (m - n)) (Sum.inl k)) = (π ^ m) (Sum.inl k) := by + rw [← Equiv.Perm.mul_apply, ← pow_add, Nat.add_sub_cancel' hnm] + _ = Sum.inl (nextPin π h k) := nextPin_spec π h k + _ = Sum.inl (nextPin π h j) := congrArg Sum.inl he.symm + _ = (π ^ n) (Sum.inl j) := (nextPin_spec π h j).symm + have hz : m - n = 0 := by + by_contra hne + have ht := nextPin_is_first π h k (Nat.pos_of_ne_zero hne) hb + change m ≤ m - n at ht + omega + simpa only [hz, pow_zero, Equiv.Perm.one_apply, Sum.inl.injEq] using hb.symm + intro j k he + rcases le_total (firstPinTime π h (π (Sum.inl j)) + 1) + (firstPinTime π h (π (Sum.inl k)) + 1) with hle | hle + · exact haux j k hle he + · exact (haux k j hle he.symm).symm + +def nextPinEquiv (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) : Equiv.Perm J := + Equiv.ofBijective (nextPin π h) + ⟨nextPin_injective π h, Finite.surjective_of_injective (nextPin_injective π h)⟩ + +end + +variable {J Q Ω : Type*} [Fintype J] [Fintype Q] [Fintype Ω] + [DecidableEq J] [DecidableEq Q] +variable {R : Type*} [Field R] + +theorem conditional_nextPin_first_moment (μ : Ω → R) + (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) + (hg : hitWeight μ π ≠ 0) : + (∑ ω, if hw : AllHit (π ω) then + (μ ω / hitWeight μ π) • nextPinMatrix R (π ω) hw else 0) = + hittingResolvent R (∑ ω, μ ω • columnPerm R (π ω)) := by + rw [← conditional_resolvent_first_moment μ π h hg] + apply Finset.sum_congr rfl + intro ω _ + by_cases hw : AllHit (π ω) + · simp only [dite_eq_left hw, ite_eq_left hw, nextPinMatrix_eq_resolvent] + · simp only [dite_eq_right hw, ite_eq_right hw] + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CrossingTails.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CrossingTails.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5288eb1d9e9fec8cc813445cc3240e2b95714ba --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CrossingTails.lean @@ -0,0 +1,266 @@ +import OAI.MathematicalPhysics.Heisenberg.SparseCrossings + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical BigOperators + +namespace Heisenberg.Geometry +lemma scaled_ball_card (d b n : ℕ) (hb : 1 ≤ b) (z : Site d) : + (ballFinset d (16*b^n+8) z).card ≤ 49^d*(b^d)^n := by + rw [ballFinset_card] + have hp : 1 ≤ b^n := one_le_pow₀ hb + have h : 2*(16*b^n+8)+1 ≤ 49*b^n := by omega + calc + _ ≤ (49*b^n)^d := Nat.pow_le_pow_left h _ + _ = _ := by rw [mul_pow]; congr 1; rw [←pow_mul,←pow_mul,Nat.mul_comm] + +theorem lattice_crossing_mass_bound {Ω : Type*} [Fintype Ω] + (d b : ℕ) (hb : 100 ≤ b) (α L : ℝ) (hα : 0 ≤ α) (hL : 1 ≤ L) + (hba : 2 ≤ (b:ℝ)^α) + (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) (Z : Ω → Set (Site d)) + (q : ℝ) (hq : 0 ≤ q) + (htest : ∀ F : Finset (Site d), SparseWitness.Sparse α L F → + (∑ ω, if (F:Set (Site d)) ⊆ Z ω then μ ω else 0) ≤ q^F.card) + (n : ℕ) (z : Site d) : + (∑ ω, if SparseWitness.Crosses (Z ω) z (16*(b:ℝ)^n) then μ ω else 0) ≤ + (((49^d*(b^d)^2:ℕ):ℝ)*q)^(2^n) := by + have hb1 : 1 ≤ b := by omega + have hbR : 1 ≤ (b:ℝ) := by exact_mod_cast hb1 + apply SparseWitness.crossing_mass_bound μ hμ Z (fun j => 16*(b:ℝ)^j) + (fun j => by positivity) (fun j => SparseWitness.geometric_scale_gap _ (by exact_mod_cast hb) j) + α L hα hL (SparseWitness.geometric_scale_growth _ _ hbR hα hba) + (fun j z => ballFinset d (16*b^j+8) z) _ (49^d) (b^d) + (one_le_pow₀ (by omega)) (one_le_pow₀ hb1) _ q hq htest + · intro j x y hxy + apply (mem_ballFinset ..).mpr + apply (dist_le_iff_mem_ball x y).mp + norm_cast at hxy ⊢ + · intro j x + exact scaled_ball_card d b (j+1) hb1 x + +end Heisenberg.Geometry + +namespace Heisenberg.SparseWitness +variable {V Ω : Type*} [PseudoMetricSpace V] [Fintype Ω] + +lemma Crosses.mono_radius {Z : Set V} {z : V} {r s : ℝ} (h : Crosses Z z r) + (hs : s ≤ r) : Crosses Z z s := by + obtain ⟨p,m,hp,hz,hstep,hr⟩ := h + exact ⟨p,m,hp,hz,hstep,hs.trans hr⟩ + +lemma event_mass_mono (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) + {A B : Ω → Prop} (hAB : ∀ ω, A ω → B ω) : + (∑ ω, if A ω then μ ω else 0) ≤ ∑ ω, if B ω then μ ω else 0 := by + apply Finset.sum_le_sum + intro ω _ + by_cases ha : A ω + · rw [ite_eq_left ha,ite_eq_left (hAB ω ha)] + · rw [ite_eq_right ha] + split_ifs <;> simp [hμ] + +theorem stretched_tail_of_scales (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) + (hprob : ∑ ω, μ ω ≤ 1) (Z : Ω → Set V) (b γ : ℝ) + (hb : 1 < b) (hγ : 0 < γ) (hbγ : b^γ = 2) + (htail : ∀ n z, (∑ ω, if Crosses (Z ω) z (16*b^n) then μ ω else 0) ≤ + Real.exp (-2*(2:ℝ)^n)) (z : V) (r : ℝ) (hr : 0 ≤ r) : + (∑ ω, if Crosses (Z ω) z r then μ ω else 0) ≤ + Real.exp 1 * Real.exp (-((r/(16*b))^γ)) := by + by_cases hrs : r < 16 + · have hbase : r/(16*b) ≤ 1 := (div_le_one (by positivity)).mpr (by nlinarith) + have hpow : (r/(16*b))^γ ≤ 1 := Real.rpow_le_one (by positivity) hbase hγ.le + calc + _ ≤ ∑ ω, μ ω := Finset.sum_le_sum (fun ω _ => by split_ifs <;> simp [hμ]) + _ ≤ 1 := hprob + _ ≤ Real.exp 1*Real.exp (-((r/(16*b))^γ)) := by + rw [←Real.exp_add] + exact Real.one_le_exp (by linarith) + · obtain ⟨n,hnl,hnr⟩ := exists_nat_pow_near (x:=r/16) (by linarith) hb + have hnr' : r/(16*b) ≤ b^n := by + apply (div_le_iff₀ (by positivity)).mpr + rw [pow_succ] at hnr + nlinarith + have hp : (r/(16*b))^γ ≤ (2:ℝ)^n := by + calc + _ ≤ (b^n)^γ := Real.rpow_le_rpow (by positivity) hnr' hγ.le + _ = (b^γ)^n := by + rw [← Real.rpow_natCast,← Real.rpow_mul (by linarith),mul_comm, + Real.rpow_mul (by linarith),Real.rpow_natCast] + _ = _ := by rw [hbγ] + calc + _ ≤ ∑ ω, if Crosses (Z ω) z (16*b^n) then μ ω else 0 := + event_mass_mono μ hμ (fun _ h => h.mono_radius (by linarith)) + _ ≤ Real.exp (-2*(2:ℝ)^n) := htail n z + _ ≤ Real.exp (-((r/(16*b))^γ)) := Real.exp_le_exp.mpr (by nlinarith [pow_nonneg (show (0:ℝ) ≤ 2 by norm_num) n]) + _ ≤ Real.exp 1 * Real.exp (-((r/(16*b))^γ)) := by + simpa using mul_le_mul_of_nonneg_right (Real.one_le_exp (by norm_num : (0:ℝ) ≤ 1)) + (Real.exp_nonneg (-((r/(16*b))^γ))) + +lemma exists_scale_exponent {b : ℝ} (hb : 1 < b) : + ∃ γ : ℝ, 0 < γ ∧ b^γ = 2 := by + refine ⟨Real.log 2/Real.log b,div_pos (Real.log_pos (by norm_num)) (Real.log_pos hb),?_⟩ + rw [Real.rpow_def_of_pos (by linarith)] + have hlog : Real.log b ≠ 0 := ne_of_gt (Real.log_pos hb) + rw [mul_div_cancel₀ _ hlog,Real.exp_log (by norm_num : (0:ℝ) < 2)] + +lemma sparse_of_card_le {α L : ℝ} (hα : 0 ≤ α) (hL : 0 ≤ L) (F : Finset V) + (hF : (F.card:ℝ) ≤ L) : Sparse α L F := by + intro z r hr + calc + _ ≤ (F.card:ℝ) := by exact_mod_cast Finset.card_filter_le F _ + _ ≤ L := hF + _ ≤ L*(1+r)^α := by + simpa using mul_le_mul_of_nonneg_left (Real.one_le_rpow (by linarith) hα) hL + +lemma countable_union_mass {W : Type*} (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) + (E : W → Ω → Prop) (A : Ω → Prop) (g : W → ℝ) + (hg : ∀ w, 0 ≤ g w) (hs : Summable g) + (hE : ∀ w, (∑ ω, if E w ω then μ ω else 0) ≤ g w) + (hA : ∀ ω, A ω → ∃ w, E w ω) : + (∑ ω, if A ω then μ ω else 0) ≤ ∑' w, g w := by + let S := Finset.univ.filter A + let pick (ω : S) : W := Classical.choose (hA ω (Finset.mem_filter.mp ω.property).2) + let F : Finset W := S.attach.image pick + have hcover : ∀ ω, A ω → ∃ w ∈ F, E w ω := by + intro ω hω + let a : S := ⟨ω,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hω⟩⟩ + refine ⟨pick a, Finset.mem_image.mpr ⟨a,Finset.mem_attach _ _,rfl⟩,?_⟩ + exact Classical.choose_spec (hA ω hω) + calc + _ ≤ ∑ w ∈ F, ∑ ω, if E w ω then μ ω else 0 := finite_union_mass μ hμ F E A hcover + _ ≤ ∑ w ∈ F, g w := Finset.sum_le_sum (fun w _ => hE w) + _ ≤ ∑' w, g w := hs.sum_le_tsum F (fun w _ => hg w) + +theorem bad_count_mass (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) (Z : Ω → Set V) + (α L p : ℝ) (hα : 0 ≤ α) (hL : 0 ≤ L) (k : ℕ) (hk : (k:ℝ) ≤ L) + (htest : ∀ F : Finset V, Sparse α L F → + (∑ ω, if (F:Set V) ⊆ Z ω then μ ω else 0) ≤ p^F.card) + (B : Finset V) : + (∑ ω, if k ≤ (B.filter (· ∈ Z ω)).card then μ ω else 0) ≤ + (B.card.choose k:ℝ)*p^k := by + have hcover : ∀ ω, k ≤ (B.filter (· ∈ Z ω)).card → + ∃ F ∈ B.powersetCard k, (F:Set V) ⊆ Z ω := by + intro ω hω + obtain ⟨F,hF,hcard⟩ := Finset.exists_subset_card_eq hω + refine ⟨F,Finset.mem_powersetCard.mpr ⟨hF.trans (Finset.filter_subset ..),hcard⟩,?_⟩ + intro v hv + exact (Finset.mem_filter.mp (hF hv)).2 + calc + _ ≤ ∑ F ∈ B.powersetCard k, ∑ ω, if (F:Set V) ⊆ Z ω then μ ω else 0 := + by + convert finite_union_mass μ hμ (B.powersetCard k) (fun F ω => (F:Set V) ⊆ Z ω) (fun ω => k ≤ (B.filter (· ∈ Z ω)).card) hcover using 1 + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> rfl + _ ≤ ∑ _F ∈ B.powersetCard k, p^k := by + apply Finset.sum_le_sum + intro F hF + have hc := (Finset.mem_powersetCard.mp hF).2 + simpa only [hc] using htest F (sparse_of_card_le hα hL F (by simpa only [hc] using hk)) + _ = _ := by simp + +end Heisenberg.SparseWitness + +open scoped Classical +open Module + +open scoped BigOperators +namespace Heisenberg.Stretched + +lemma exp_power_bound (c ξ t : ℝ) (hc : 0 < c) (ht : 0 < t) (n : ℕ) : + Real.exp (-c*t^ξ) ≤ (n.factorial:ℝ)/c^n * t^(-ξ*(n:ℝ)) := by + have hct : 0 < c*t^ξ := mul_pos hc (Real.rpow_pos_of_pos ht ξ) + have hf : 0 < (n.factorial:ℝ) := by exact_mod_cast Nat.factorial_pos n + have hh := Real.pow_div_factorial_le_exp (c*t^ξ) hct.le n + have hi := (one_div_le_one_div_of_le (div_pos (pow_pos hct n) hf) hh) + have he : (1:ℝ) / ((c*t^ξ)^n/(n.factorial:ℝ)) = + (n.factorial:ℝ)/c^n * t^(-ξ*(n:ℝ)) := by + rw [mul_pow] + rw [← Real.rpow_natCast (t^ξ) n, ← Real.rpow_mul ht.le] + rw [neg_mul,Real.rpow_neg ht.le] + field_simp + rw [he] at hi + simpa only [one_div,←Real.exp_neg,neg_mul] using hi + +theorem exists_polynomial_envelope (c ξ r : ℝ) (hc : 0 < c) (hξ : 0 < ξ) : + ∃ C : ℝ, 0 < C ∧ ∀ t : ℝ, 1 ≤ t → Real.exp (-c*t^ξ) ≤ C*t^(-r) := by + obtain ⟨n,hn⟩ := exists_nat_gt (r/ξ) + have hnr : r ≤ ξ*(n:ℝ) := by + have := (div_lt_iff₀ hξ).mp hn + nlinarith + refine ⟨(n.factorial:ℝ)/c^n,div_pos (by exact_mod_cast Nat.factorial_pos n) (pow_pos hc n),?_⟩ + intro t ht + exact (exp_power_bound c ξ t hc (by linarith) n).trans + (mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le ht (by linarith)) (by positivity)) + +end Heisenberg.Stretched + +namespace Heisenberg.LatticeSum +open Heisenberg.Geometry + +lemma radius_eq_norm {k : ℕ} (x : Site (k+1)) : (radius x : ℝ) = ‖x‖ := by + apply le_antisymm + · obtain ⟨j,hj,he⟩ := Finset.exists_mem_eq_sup Finset.univ (Finset.univ_nonempty) (fun j : Fin (k+1) => (x j).natAbs) + change ((Finset.univ.sup (fun j => (x j).natAbs) : ℕ) : ℝ) ≤ ‖x‖ + rw [he] + simpa only [Int.norm_eq_abs,Nat.cast_natAbs,Int.cast_abs] using norm_le_pi_norm x j + · apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro j + have h : (x j).natAbs ≤ radius x := Finset.le_sup (f:=fun j => (x j).natAbs) (Finset.mem_univ j) + simpa only [Int.norm_eq_abs,Nat.cast_natAbs,Int.cast_abs] using (show ((x j).natAbs : ℝ) ≤ (radius x : ℝ) by exact_mod_cast h) + +lemma uniform_polynomial_sum (k : ℕ) (r : ℝ) (hr : r < -(k+1:ℝ)) : + ∃ M ≥ 0, ∀ y : Site (k+1), Summable (fun x => (1+dist x y)^r) ∧ + (∑' x, (1+dist x y)^r) = M := by + let M := ∑' x : Site (k+1), ((radius x:ℝ)+1)^r + refine ⟨M,tsum_nonneg (fun x => Real.rpow_nonneg (by positivity) _),?_⟩ + intro y + have hs := summable_radius_sub_rpow (k+1) r (by push_cast; exact hr) y + have he := (Equiv.subRight y).tsum_eq (fun x : Site (k+1) => ((radius x:ℝ)+1)^r) + refine ⟨?_,?_⟩ + · simpa only [radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using hs + · simpa only [M,Equiv.subRight_apply,radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using he + +theorem exp_tail_polynomial (k : ℕ) (c ξ a : ℝ) (hc : 0 < c) (hξ : 0 < ξ) + (ha : 0 ≤ a) : + ∃ C ≥ 0, ∀ (y : Site (k+1)) (R : ℝ), 0 ≤ R → + Summable (fun x => if R < dist x y then Real.exp (-c*(1+dist x y)^ξ) else 0) ∧ + (∑' x, if R < dist x y then Real.exp (-c*(1+dist x y)^ξ) else 0) ≤ C*(1+R)^(-a) := by + obtain ⟨D,hD,hpoly⟩ := Heisenberg.Stretched.exists_polynomial_envelope c ξ (a+(k+2:ℝ)) hc hξ + obtain ⟨M,hM,hMsum⟩ := uniform_polynomial_sum k (-(k+2:ℝ)) (by linarith) + refine ⟨D*M,mul_nonneg hD.le hM,?_⟩ + intro y R hR + let F : Site (k+1) → ℝ := fun x => if R < dist x y then Real.exp (-c*(1+dist x y)^ξ) else 0 + let G : Site (k+1) → ℝ := fun x => (D*(1+R)^(-a))*(1+dist x y)^(-(k+2:ℝ)) + have hsG : Summable G := (hMsum y).1.mul_left _ + have hFG : ∀ x, F x ≤ G x := by + intro x + dsimp [F,G] + split_ifs with hx + · have hp := hpoly (1+dist x y) (by linarith [dist_nonneg (x:=x) (y:=y)]) + have hdec : (1+dist x y)^(-a) ≤ (1+R)^(-a) := + Real.rpow_le_rpow_of_nonpos (by positivity) (by linarith) (by linarith) + have he : (1+dist x y)^(-(a+(k+2:ℝ))) = + (1+dist x y)^(-a)*(1+dist x y)^(-(k+2:ℝ)) := by + rw [←Real.rpow_add (by positivity)] + congr 1 + ring + rw [he] at hp + exact hp.trans (by + rw [mul_assoc] + exact mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right hdec (by positivity)) hD.le) + · positivity + have hsF : Summable F := Summable.of_nonneg_of_le (fun x => by dsimp [F]; split_ifs <;> positivity) hFG hsG + refine ⟨hsF,?_⟩ + calc + (∑' x, F x) ≤ ∑' x, G x := hsF.tsum_le_tsum hFG hsG + _ = D*(1+R)^(-a)*M := by rw [tsum_mul_left,(hMsum y).2] + _ = _ := by ring +end Heisenberg.LatticeSum + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CubeSelection.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CubeSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3908e3c24d229b0bd6f38b4cf799f024939e3ad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CubeSelection.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.Heisenberg.PhysicalTilt + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Fin.NatCast Matrix Matrix.Norms.Operator +open Filter Topology +namespace Heisenberg.Selection +open Heisenberg.Geometry SpatialFrame SlotTensor + +lemma box_volume_tendsto {d : ℕ} (hd : 0((box d (n+r)).card:ℝ)) atTop atTop := by + simp only [box_card,Nat.cast_pow,Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat,Nat.cast_one] + exact (tendsto_pow_atTop hd.ne').comp (tendsto_atTop_add_const_right _ 1 + ((tendsto_atTop_add_const_right _ (r:ℝ) tendsto_natCast_atTop_atTop).const_mul_atTop (by norm_num : (0:ℝ)<2))) + +lemma surface_exp_tendsto {d : ℕ} (hd : 02*Real.exp (C*((box d (n+1)\box d n).card:ℝ)-a*((box d (n+1)).card:ℝ))) atTop (𝓝 0) := by + have hc : Tendsto (fun n : ℕ=>C*(((box d (n+1)\box d n).card:ℝ)/((box d (n+1)).card:ℝ))-a) atTop (𝓝 (-a)) := by + simpa only [mul_zero,zero_sub] using ((box_boundary_ratio_tendsto d 1).const_mul C).sub_const a + have hmul:=(hc.neg_mul_atTop (neg_lt_zero.mpr ha) (box_volume_tendsto hd 1)) + have hexp:=(Real.tendsto_exp_atBot.comp hmul).const_mul 2 + convert hexp using 1 + · ext n + congr 2 + have hv : ((box d (n+1)).card:ℝ)≠0:=by exact_mod_cast Finset.card_ne_zero.mpr (box_nonempty d (n+1)) + field_simp + · norm_num + +lemma cube_edges_nonempty (d ℓ n : ℕ) (hd : 0by simp [y,Function.update_of_ne hj]⟩ + exact ⟨⟨((⟨0,h0⟩,(0:Fin ℓ)),(⟨y,hy⟩,(0:Fin ℓ))),hs⟩⟩ + +theorem field_ordered_cubes (d ℓ : ℕ) (hd : 2≤d) [NeZero ℓ] + (τ : State (d+1) ℓ) (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) : + ∃ β₀ : ℝ,0<β₀ ∧ ∀ β : ℝ,β₀≤β → ∀ h : ℝ,0(edge (j:Fin q)).val.1 + let b₀ : ℕ → Slots (B:=Fin ℓ) Λ:=fun j=>(edge (j:Fin q)).val.2 + have ha₀ : ∀ j : Fin q,a₀ j=(edge j).val.1:=by intro j; simp only [a₀,Fin.cast_val_eq_self] + have hb₀ : ∀ j : Fin q,b₀ j=(edge j).val.2:=by intro j; simp only [b₀,Fin.cast_val_eq_self] + let Z : ℝ:=((Finset.univ.filter (fun v : Slots (B:=Fin ℓ) Λ=>v.1.val∉F)).card:ℝ) + let J : ℝ:=(((Finset.range q).filter (fun j=>(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card:ℝ) + let L : ℝ:=Real.exp (-(Real.log 2)*(Z+β*J))/2 + have htail :=hbound Λ F (box_nonempty _ _) q edge a₀ b₀ ha₀ hb₀ + (box_mono (Nat.le_succ n)) (fun z hz w hzw=>box_neighbor hz hzw) (β/2) (by linarith) + have htail' : L*Matrix.trace (NormedSpace.exp ((β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ))≤ + Matrix.trace (NormedSpace.exp ((β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ)* + Matrix.diagonal (fun k : Λ → SpinSlots.Level ℓ=>if (Λ.card:ℝ)*ℓ/4≤physicalMagnetization ℓ k then (1:ℝ) else 0)) := by + convert htail using 1 <;> simp only [L,Z,J,nearestNeighbor_iff_step]; congr 5; ring + apply physical_field_mean Λ τ hτ β h L (mul_pos hb hh).le (by dsimp [L]; positivity) htail' + have hZ : Z≤((Λ\F).card:ℝ)*ℓ := by dsimp [Z]; exact_mod_cast bad_slots_le (ℓ:=ℓ) Λ F + have hJ : J≤((4*(d+1):ℕ):ℝ)*((Λ\F).card:ℝ)*ℓ^2 := by + dsimp [J] + rw [schedule_bad_eq Λ F edge a₀ b₀ ha₀ hb₀] + exact_mod_cast bad_edges_le (ℓ:=ℓ) Λ F + have hcost : (Real.log 2)*(Z+β*J)≤C*((Λ\F).card:ℝ) := by + have hbJ:=mul_le_mul_of_nonneg_left hJ hb.le + have hhcost:=mul_le_mul_of_nonneg_left (add_le_add hZ hbJ) (Real.log_nonneg (by norm_num : (1:ℝ)≤2)) + calc _ ≤ (Real.log 2)*(((Λ\F).card:ℝ)*ℓ+β*(((4*(d+1):ℕ):ℝ)*((Λ\F).card:ℝ)*ℓ^2)) := hhcost + _ = C*((Λ\F).card:ℝ) := by dsimp [C]; ring + calc L⁻¹*Real.exp (-((β*h)*((Λ.card:ℝ)*ℓ)/16))= + 2*Real.exp ((Real.log 2)*(Z+β*J)-a*(Λ.card:ℝ)) := by + dsimp [L,a] + rw [inv_div,div_eq_mul_inv,←Real.exp_neg] + simp only [neg_mul,neg_neg] + rw [mul_assoc,←Real.exp_add] + congr 2 + ring + _ ≤ 2*Real.exp (C*((Λ\F).card:ℝ)-a*(Λ.card:ℝ)) := + mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (sub_le_sub_right hcost _)) (by norm_num) + _ ≤ 1/11 := hn + +end Heisenberg.Selection +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CubeSurface.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CubeSurface.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed5b267abb590ac60c6936830d3623aff713beb2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CubeSurface.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.Heisenberg.PhysicalSurface + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +open Filter Topology +namespace Heisenberg +open SpatialFrame +variable {d ℓ : ℕ} + +lemma bad_slots_le (Λ F : Finset (Site d)) : + (Finset.univ.filter (fun v : Slots (B:=Fin ℓ) Λ=>v.1.val∉F)).card≤(Λ\F).card*ℓ := by + let f : {v : Slots (B:=Fin ℓ) Λ // v.1.val∉F} → ↥(Λ\F) × Fin ℓ:= + fun v=>(⟨v.val.1,Finset.mem_sdiff.mpr ⟨v.val.1.property,v.property⟩⟩,v.val.2) + have hf : Function.Injective f := by + intro a b h + apply Subtype.ext + apply Prod.ext + · apply Subtype.ext; exact congrArg (fun v : ↥(Λ\F) × Fin ℓ=>v.1.val) h + · exact congrArg (fun v : ↥(Λ\F) × Fin ℓ=>v.2) h + have hc:=Fintype.card_le_of_injective f hf + simpa only [Fintype.card_subtype,Fintype.card_prod,Fintype.card_coe,Fintype.card_fin] using hc + +lemma bad_edges_le (Λ F : Finset (Site d)) : + (Finset.univ.filter (fun e : Edges (B:=Fin ℓ) Geometry.Step Λ=> + e.val.1.1.val∉F ∨ e.val.2.1.val∉F)).card≤(4*d)*(Λ\F).card*ℓ^2 := by + let E:={e : Edges (B:=Fin ℓ) Geometry.Step Λ // e.val.1.1.val∉F ∨ e.val.2.1.val∉F} + let f : E → (incidentEdges (Λ\F)) × (Fin ℓ × Fin ℓ):=fun e=> + (⟨(e.val.val.1.1.val,e.val.val.2.1.val),mem_incidentEdges (nearestNeighbor_iff_step.mpr e.val.property) + (e.property.imp (fun h=>Finset.mem_sdiff.mpr ⟨e.val.val.1.1.property,h⟩) + (fun h=>Finset.mem_sdiff.mpr ⟨e.val.val.2.1.property,h⟩))⟩,(e.val.val.1.2,e.val.val.2.2)) + have hf : Function.Injective f := by + intro a b h + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · apply Prod.ext + · apply Subtype.ext; exact congrArg (fun v : (incidentEdges (Λ\F)) × (Fin ℓ × Fin ℓ)=>v.1.val.1) h + · exact congrArg (fun v : (incidentEdges (Λ\F)) × (Fin ℓ × Fin ℓ)=>v.2.1) h + · apply Prod.ext + · apply Subtype.ext; exact congrArg (fun v : (incidentEdges (Λ\F)) × (Fin ℓ × Fin ℓ)=>v.1.val.2) h + · exact congrArg (fun v : (incidentEdges (Λ\F)) × (Fin ℓ × Fin ℓ)=>v.2.2) h + have hc:=Fintype.card_le_of_injective f hf + simp only [E,Fintype.card_subtype,Fintype.card_prod,Fintype.card_coe,Fintype.card_fin] at hc + exact hc.trans (by simpa only [pow_two] using Nat.mul_le_mul_right (ℓ*ℓ) (card_incidentEdges_le (Λ\F))) + +lemma schedule_bad_eq {q : ℕ} (Λ F : Finset (Site d)) + (edge : Fin q ≃ Edges (B:=Fin ℓ) Geometry.Step Λ) (a₀ b₀ : ℕ → Slots (B:=Fin ℓ) Λ) + (ha : ∀ j : Fin q,a₀ j=(edge j).val.1) (hb : ∀ j : Fin q,b₀ j=(edge j).val.2) : + ((Finset.range q).filter (fun j=>(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card= + (Finset.univ.filter (fun e : Edges (B:=Fin ℓ) Geometry.Step Λ=>e.val.1.1.val∉F ∨ e.val.2.1.val∉F)).card := by + have hsum := edge.sum_comp (fun e : Edges (B:=Fin ℓ) Geometry.Step Λ=>if e.val.1.1.val∉F ∨ e.val.2.1.val∉F then (1:ℕ) else 0) + rw [Finset.card_filter,Finset.card_filter,←Fin.sum_univ_eq_sum_range] + simpa only [ha,hb] using hsum + +lemma box_card (d n : ℕ) : (box d n).card=(2*n+1)^d := Geometry.card_boxFinset d n +lemma box_mem (d n : ℕ) (x : Site d) : x∈box d n ↔ ∀ j,|x j|≤(n:ℤ) := Geometry.mem_boxFinset d n x +lemma box_mono {n m : ℕ} (hnm : n≤ m) : box d n⊆box d m := by + intro x hx + apply (box_mem d m x).mpr + intro j + exact (box_mem d n x |>.mp hx j).trans (by exact_mod_cast hnm) +lemma box_nonempty (d n : ℕ) : (box d n).Nonempty:=⟨0,(box_mem d n 0).mpr (by intro j; simp)⟩ + +lemma box_neighbor {n : ℕ} {x y : Site d} (hx : x∈box d n) (h : Geometry.Step x y) : y∈box d (n+1) := by + obtain ⟨i,hi,hj⟩:=h + apply (box_mem _ _ _).mpr + intro j + have hxj:=(box_mem d n x).mp hx j + by_cases hji : j=i + · subst j + rcases hi with hi | hi + · rw [hi] + exact (abs_add_le _ _).trans (by simpa only [abs_one,Nat.cast_add,Nat.cast_one,add_le_add_iff_right] using hxj) + · rw [show y i=x i-1 by omega] + exact (abs_sub _ _).trans (by simpa only [abs_one,Nat.cast_add,Nat.cast_one,add_le_add_iff_right] using hxj) + · rw [hj j hji] + exact hxj.trans (by exact_mod_cast Nat.le_succ n) + +lemma box_sub_card (d n r : ℕ) : (box d (n+r)\box d n).card=(2*(n+r)+1)^d-(2*n+1)^d := by + rw [Finset.card_sdiff_of_subset (box_mono (Nat.le_add_right n r)),box_card,box_card] + +lemma box_ratio_tendsto (d r : ℕ) : + Tendsto (fun n : ℕ=>((box d n).card:ℝ)/((box d (n+r)).card:ℝ)) atTop (𝓝 1) := by + have hx : Tendsto (fun n : ℕ=>(2*(n:ℝ)+1)/(2*((n:ℝ)+r)+1)) atTop (𝓝 1) := by + have hi : Tendsto (fun n : ℕ=>(2*((n:ℝ)+r)+1)⁻¹) atTop (𝓝 0) := by + apply tendsto_inv_atTop_zero.comp + exact tendsto_atTop_add_const_right _ 1 + ((tendsto_atTop_add_const_right _ (r:ℝ) tendsto_natCast_atTop_atTop).const_mul_atTop (by norm_num : (0:ℝ)<2)) + have hh:=(tendsto_const_nhds (x:=(1:ℝ)) (f:=atTop)).sub (hi.const_mul (2*r:ℝ)) + convert hh using 1 + · ext n + field_simp + ring + · simp + have hh:=hx.pow d + simpa only [box_card,Nat.cast_pow,Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat,Nat.cast_one,div_pow,one_pow] using hh + +lemma box_boundary_ratio_tendsto (d r : ℕ) : + Tendsto (fun n : ℕ=>((box d (n+r)\box d n).card:ℝ)/((box d (n+r)).card:ℝ)) atTop (𝓝 0) := by + have hh:=(tendsto_const_nhds (x:=(1:ℝ)) (f:=atTop)).sub (box_ratio_tendsto d r) + convert hh using 1 + · ext n + rw [Finset.card_sdiff_of_subset (box_mono (Nat.le_add_right n r)),Nat.cast_sub (Finset.card_le_card (box_mono (Nat.le_add_right n r))),sub_div,div_self] + exact_mod_cast (Finset.card_ne_zero.mpr (box_nonempty d (n+r))) + · norm_num + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CutColors.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CutColors.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e132e8f0387727570424be7acb6351589508f4c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CutColors.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.Heisenberg.SurfaceTail + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance cutDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open Heisenberg.LayeredExchange +variable {V : Type*} [Fintype V] + +lemma rotate_pow_zero (n k : ℕ) : ((finRotate (n+1))^k) 0=(k : Fin (n+1)) := by + induction k with + | zero => rfl + | succ k ih => + rw [pow_succ',Equiv.Perm.mul_apply,ih,finRotate_apply] + simp + +omit [Fintype V] in +lemma transport_succ_zero (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) (k : ℕ) : + transport (finRotate (n+1)) σ 0 (k+1)=σ (k : Fin (n+1))*transport (finRotate (n+1)) σ 0 k := by + rw [transport,rotate_pow_zero] + +def extendCut (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) (c : V → Bool) : Fin (n+1)×V → Bool := + fun z=>c ((transport (finRotate (n+1)) σ 0 z.1.val).symm z.2) + +omit [Fintype V] in +lemma extendCut_invariant (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) + (c : V → Bool) (hc : ∀ v,c (transport (finRotate (n+1)) σ 0 (n+1) v)=c v) : + ∀ z,extendCut n σ c (wiring (finRotate (n+1)) σ z)=extendCut n σ c z := by + rintro ⟨t,v⟩ + rw [wiring_apply] + unfold extendCut + dsimp only + by_cases ht : t=Fin.last n + · subst t + simp only [finRotate_last,Fin.val_zero] + change c (σ (Fin.last n) v)=c ((transport (finRotate (n+1)) σ 0 n).symm v) + have hh:=hc ((transport (finRotate (n+1)) σ 0 n).symm v) + rw [transport_succ_zero] at hh + simp only [Equiv.Perm.mul_apply,Equiv.apply_symm_apply] at hh + have hn : (n : Fin (n+1))=Fin.last n := by ext; simp + rw [hn] at hh + exact hh + · rw [coe_finRotate_of_ne_last ht,transport_succ_zero] + have ht' : ((t.val : ℕ) : Fin (n+1))=t := by simp + rw [ht'] + change c ((transport (finRotate (n+1)) σ 0 t.val).symm ((σ t).symm ((σ t) v))) = _ + rw [Equiv.symm_apply_apply] + +def cutColorEquiv (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) : + SlotColor.ClosedColor (wiring (finRotate (n+1)) σ) ≃ + SlotColor.ClosedColor (transport (finRotate (n+1)) σ 0 (n+1)) where + toFun c := ⟨fun v=>c.val (0,v),invariant_cut _ _ c.val c.property 0 (n+1) (by rw [rotate_pow_zero]; simp)⟩ + invFun c := ⟨extendCut n σ c.val,extendCut_invariant n σ c.val c.property⟩ + left_inv c := by + apply Subtype.ext + funext z + obtain ⟨t,v⟩:=z + have hh:=invariant_propagates (finRotate (n+1)) σ c.val c.property 0 + ((transport (finRotate (n+1)) σ 0 t.val).symm v) t.val + rw [rotate_pow_zero,Equiv.apply_symm_apply] at hh + simpa [extendCut] using hh.symm + right_inv c := by + apply Subtype.ext + funext v + rfl + +lemma trace_closed_colors (π : Equiv.Perm V) (f : (V → Bool) → ℝ) : + Matrix.trace (SlotColor.matrix π*Matrix.diagonal f)=∑ c : SlotColor.ClosedColor π,f c.val := by + rw [SlotColor.trace_diagonal,←Finset.sum_filter] + exact Finset.sum_subtype _ (fun c=>by simp) f + +theorem trace_wiring_cut (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) (f : (V → Bool) → ℝ) : + Matrix.trace (SlotColor.matrix (wiring (finRotate (n+1)) σ)* + Matrix.diagonal (fun c=>f (fun v=>c (0,v))))= + Matrix.trace (SlotColor.matrix (transport (finRotate (n+1)) σ 0 (n+1))*Matrix.diagonal f) := by + have hleft:=trace_closed_colors (wiring (finRotate (n+1)) σ) (fun c=>f (fun v=>c (0,v))) + have hright:=trace_closed_colors (transport (finRotate (n+1)) σ 0 (n+1)) f + calc _ = ∑ c : SlotColor.ClosedColor (wiring (finRotate (n+1)) σ), f (fun v=>c.val (0,v)) := by + with_reducible convert hleft using 1 + _ = ∑ c : SlotColor.ClosedColor (transport (finRotate (n+1)) σ 0 (n+1)),f c.val := by + with_reducible convert (cutColorEquiv n σ).sum_comp (fun c=>f c.val) using 1 + congr! 20 + _ = _ := by with_reducible convert hright.symm using 1 + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CutContractions.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CutContractions.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f1aec8df3ceee176c927b5fcf634a1ea837e258 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CutContractions.lean @@ -0,0 +1,293 @@ +import OAI.MathematicalPhysics.Heisenberg.AveragedEnergy + +namespace OAI + +section +noncomputable section +open Filter Topology +open scoped RealInnerProductSpace Classical + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Hitting +variable {V : Type*} [Fintype V] +lemma hitting_zero_column {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) {i : V} (hi : i ∉ T) (hz : ∀ j, U j i = 0) : + hitting U T i = 0 := by + rw [←hitting_harmonic hU T hi] + simp [backward,hz] +end Heisenberg.Hitting + +namespace Heisenberg.Exposure +open Heisenberg.Serial Heisenberg.Hitting Heisenberg.MeshPair Heisenberg.Cycle +variable {V : Type*} [Fintype V] [DecidableEq V] + +def cutFactors (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (P : Set (Fin (n+1)×V)) (D : (Fin (n+1) → Bool) → Fin (n+1) → Set V) + (base : Fin (n+1) → Bool) (i : Fin (n+1)) : Matrix V V ℝ := + residualBetween (D base i) (D base (finRotate (n+1) i)) + (layerRevealed (fun j => Equiv.swap (a j) (b j)) + (MissingSet (layerHistory (finRotate (n+1)) (fun j => Equiv.swap (a j) (b j)) base) P) i) + (base i) (a i) (b i) (p i) + +lemma cutFactors_substochastic (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) (P : Set (Fin (n+1)×V)) + (D : (Fin (n+1) → Bool) → Fin (n+1) → Set V) (base : Fin (n+1) → Bool) : + ∀ i, Heisenberg.Hitting.DoublySubstochastic (cutFactors n a b p P D base i) := by + intro i + have h := residualBetween_substochastic (D base i) (D base (finRotate (n+1) i)) + (layerRevealed (fun j => Equiv.swap (a j) (b j)) + (MissingSet (layerHistory (finRotate (n+1)) (fun j => Equiv.swap (a j) (b j)) base) P) i) + (base i) (a i) (b i) (p i) (hp i).1 (hp i).2 + exact ⟨h.nonneg,h.row,h.col⟩ + +theorem cut_return_energy (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) (P : Set (Fin (n+1)×V)) + (D : (Fin (n+1) → Bool) → Fin (n+1) → Set V) (I : Set V) + (T : Finset P) (T₀ : Finset V) (himage : T.image Subtype.val = cutTargets n T₀) + (hT : ∀ base j, j∈T → j.val.2∈D base j.val.1) + (hQ : ∀ base, (MissingSet + (layerHistory (finRotate (n+1)) (fun j => Equiv.swap (a j) (b j)) base) P)ᶜ∩Pᶜ + ⊆ {z | z.2∈D base z.1}) + (hI : ∀ base, D base 0 ⊆ I) : + let τ := fun j => Equiv.swap (a j) (b j) + let μ₀ := productWeight (fun i z => if z then p i else 1-p i) + let μ := fun c => μ₀ c*(2:ℝ)^missingCount (layerHistory (finRotate (n+1)) τ c) P + let θ := fun c => μ c/(∑ b,μ b) + ∃ f : (Fin (n+1) → Bool) → V → ℝ, + (∀ base j, 0 ≤ f base j ∧ f base j ≤ 1) ∧ + (∀ base j, j∈T₀ → f base j = 1) ∧ + (∀ base j, j∉I → f base j = 0) ∧ + (∑ c, θ c*returnCount (layerHistory (finRotate (n+1)) τ c) P T) ≤ (T₀.card:ℝ)- + ∑ base, θ base*energy (product (n+1) (cutFactors n a b p P D base)) (f base) := by + dsimp only + let K := cutFactors n a b p P D + let F := fun base => hitting (cyclicKernel n (K base)) (cutTargets n T₀) + have hK := cutFactors_substochastic n a b p hp P D + have hU := fun base => cyclicKernel_substochastic n (K base) (hK base) + have hTb (base : Fin (n+1) → Bool) {j : V} (hj : j∈T₀) : j∈D base 0 := by + have ht : (0,j)∈T.image Subtype.val := by rw [himage]; simp [mem_cutTargets,hj] + obtain ⟨t,ht,he⟩ := Finset.mem_image.mp ht + have hh := hT base t ht + simpa only [he] using hh + refine ⟨fun base j => F base (0,j), ?_, ?_, ?_, ?_⟩ + · intro base j + exact ⟨(hitting_bounds (hU base) (cutTargets n T₀)).1 _, + (hitting_bounds (hU base) (cutTargets n T₀)).2 _⟩ + · intro base j hj + exact hitting_on (hU base) (cutTargets n T₀) (by simp [mem_cutTargets,hj]) + · intro base j hj + have hD : j∉D base 0 := fun h => hj (hI base h) + apply hitting_zero_column (hU base) (cutTargets n T₀) + · simp only [mem_cutTargets,true_and] + exact fun ht => hD (hTb base ht) + · intro z + simp only [cyclicKernel] + split_ifs + · dsimp [K,cutFactors] + simp only [residualBetween] + split_ifs <;> simp [killedBetween,hD,Matrix.add_apply,Matrix.smul_apply] + · rfl + · have hh := averaged_layer_energy (finRotate (n+1)) a b p hp P + (fun base => {z | z.2∈D base z.1}) T hT hQ + dsimp only at hh + have hc : T.card=T₀.card := by + have h := congrArg Finset.card himage + rw [Finset.card_image_of_injective _ Subtype.val_injective] at h + simpa [cutTargets,Finset.card_image_of_injective _ (fun _ _ h => (Prod.mk.inj h).2)] using h + rw [hc] at hh + convert hh using 2 + congr 1 + ext base + congr 1 + rw [killed_residual_cyclic,himage] + exact (cyclic_hitting_energy n (K base) (hK base) T₀).symm + +end Heisenberg.Exposure + +end +end + +noncomputable section +open scoped BigOperators Classical RealInnerProductSpace +namespace Heisenberg.Flow +open Heisenberg.Geometry Heisenberg.LatticeRegular Heisenberg.RoutedFlow Heisenberg.SpatialFrame +open Heisenberg.MeshPair Heisenberg.Exposure +variable {k : ℕ} + +theorem exposed_prefix_leakage (hk : 2≤k) (L : ℝ) (hL : 0≤L) : + ∃ M : ℕ,∃ C≥0,∀ (T B : Type) [Fintype T] [Fintype B] [Nonempty B] + (Λ F : Finset (ZSite k)) (s : Equiv.Perm T) + (a b : T → Slots (B:=B) Λ) (p : T → ℝ) + (_hp : ∀ i,0≤p i ∧ p i≤1) (pins : Set (T×Slots (B:=B) Λ)) + (r : ℕ → T) (c : ℕ → ℕ) (J : Finset (Slots (B:=B) Λ)) + (f : (T → Bool) → EuclideanSpace ℝ (Slots (B:=B) Λ)) + (a₀ b₀ : ℕ → Slots (B:=B) Λ) (q n R : ℕ) (e : Fin q ≃ Edges Step Λ) + (δ ρ ζ rem : ℝ), + 0Equiv.swap (a i) (b i)) base pins (r 0) ∧ j.1.val∈F) → + (∀ base j,j∈J → (f base).ofLp j=1) → + (∀ base j,0≤(f base).ofLp j ∧ (f base).ofLp j≤1) → + (∀ base j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) base pins (r 0)∩{j | j.1.val∈F} → + (f base).ofLp j=0) → + (∀ z u,0≤u → ((Finset.univ.filter (fun j : J=>dist j.val.1.val z≤u)).card:ℝ)≤ + L*(1+u)^((1:ℝ)/100)) → + (∀ (i : Fin n) (j : J), (∑ base, Exposure.layerMass s a b pins p base * + (if ¬Regular (blocked Λ (holeCut s (fun l=>Equiv.swap (a l) (b l)) base pins (r (c i)))) + j.val.1.val R M (1/(100*(k+1:ℝ))) then (1:ℝ) else 0))≤ρ) → + (∀ (i : Fin n) (j : J), (∑ base,Exposure.layerMass s a b pins p base * + (∑ v,if (R:ℝ)exposedStep s a b base pins {v | v.1.val∈F} p (r l)) (c i) v j.val else 0))≤ζ) → + (∀ i : Fin n,2*δ*(∑ base,Exposure.layerMass s a b pins p base * + MeshPair.quietEnergy (holeCut s (fun l=>Equiv.swap (a l) (b l)) base pins (r (c i))) + a₀ b₀ q (exposedSweep s a b base pins {v | v.1.val∈F} p r (c i) (f base)))≤ + (∑ base,Exposure.layerMass s a b pins p base * + (‖exposedSweep s a b base pins {v | v.1.val∈F} p r (c i) (f base)‖^2- + ‖exposedSweep s a b base pins {v | v.1.val∈F} p r (c (i+1)) (f base)‖^2))+rem) → + (J.card:ℝ)-2*((ρ+ζ)*J.card)- + 2*(C*(1+(R:ℝ))^((1:ℝ)/100)*J.card)/(δ*(n:ℝ))-(n:ℝ)*rem ≤ + ∑ base,Exposure.layerMass s a b pins p base * + (‖f base‖^2-‖exposedSweep s a b base pins {v | v.1.val∈F} p r (c n) (f base)‖^2) := by + obtain ⟨M,C,hC,hh⟩ := routed_mean_leakage hk L hL + refine ⟨M,C,hC,?_⟩ + intro T B _ _ _ Λ F s a b p hp pins r c J f a₀ b₀ q n R e δ ρ ζ rem hn hδ hrem + hr ha hb hF hframe hJ hfJ hf hs hg hbad hesc hloss + let I : Set (Slots (B:=B) Λ) := {v | v.1.val∈F} + let H : (T → Bool) → ℕ → Set (Slots (B:=B) Λ) := + fun base i=>holeCut s (fun l=>Equiv.swap (a l) (b l)) base pins (r (c i)) + let A : (T → Bool) → ℕ → Matrix (Slots (B:=B) Λ) (Slots (B:=B) Λ) ℝ := + fun base i=>prefixMatrix (fun l=>exposedStep s a b base pins I p (r l)) (c i) + let P := fun base i=>euclideanMap (A base i) + let K := fun base i v (j : J)=>A base i v j.val + let eta := indicatorVector J + let g := fun base=>f base-eta + have heq (base : T → Bool) : eta+g base=f base := by simp [g] + have hA (base : T → Bool) (i : ℕ) : MatrixContraction.DoublySubstochastic (A base i) := + prefix_substochastic _ _ (fun l _=>exposedStep_substochastic s a b base pins I p hp (r l)) + have hPf (base : T → Bool) (i : ℕ) : P base i (eta+g base)= + exposedSweep s a b base pins I p r (c i) (f base) := by + rw [heq,exposedSweep_prefix] + have hsupp (base : T → Bool) (i : ℕ) := exposedSweep_supported s a b base pins I p r (c i) + (fun j _=>hr j) (f base) (hs base) + have hnorm (base : T → Bool) (i : ℕ) (v : EuclideanSpace ℝ (Slots (B:=B) Λ)) : + ‖P base i v‖≤‖v‖ := by + change ‖euclideanMap (A base i) v‖≤‖v‖ + exact euclideanMap_contraction _ (hA base i) v + have h := hh (T → Bool) J B Λ F H (fun j : J=>j.val.1.val) R + (Exposure.layerMass s a b pins p) eta g P K a₀ b₀ q n e δ ρ ζ rem hn hδ hrem ha hb hF hframe + (layerMass_nonneg s a b pins p hp) (layerMass_sum s a b pins p hp) + (fun base=>indicatorVector_orth J (f base) (hfJ base)) + (fun base i _=>hnorm base i) + (by + intro base i j hj + rw [hPf] + exact hsupp base i j (fun h=>hj h.2)) + (by + intro base i + rw [hPf] + exact exposedSweep_bounds s a b base pins I p hp r (c i) (f base) (hf base)) + (fun base i v j=>(hA base i).nonneg v j.val) + (fun base i j=>(hA base i).col j.val) hg + (by + intro base i v j hv + by_contra hnot + apply hv + exact exposedPrefix_column_support s a b base pins I p r (c i) + (fun l _=>hr l) j.val (by simpa only [I,Set.mem_inter_iff,Set.mem_ofPred_eq] using hJ base j.val j.property) v (fun h=>hnot h.1)) + (fun base i=>indicatorVector_pairing (A base i) J (P base i (eta+g base))) + hbad hesc (by intro i; simpa only [hPf, H, I, Exposure.quietEnergy, MeshPair.quietEnergy] using hloss i) + have hPf' (base : T → Bool) (i : ℕ) : P base i (f base)= + exposedSweep s a b base pins I p r (c i) (f base) := by + simpa only [heq] using hPf base i + simpa only [eta,indicatorVector_sq,Fintype.card_coe,heq,hPf',I] using h + +end Heisenberg.Flow + +end + +noncomputable section +open scoped Classical Fin.NatCast +namespace Heisenberg.Schedule +variable {m Q : ℕ} [NeZero m] + +def run (t : Fin m) (j : ℕ) : Fin m := t+(↑j:Fin m) + +@[simp] lemma run_zero (t : Fin m) : run t 0=t := by simp [run] +lemma run_succ (t : Fin m) (j : ℕ) : run t (j+1)=finRotate m (run t j) := by + simp [run,Nat.cast_add,add_assoc] +lemma run_val (t : Fin m) (j : ℕ) : (run t j).val=(t.val+j)%m := by + simp [run,Fin.val_add,Nat.add_mod] +lemma run_inj (t : Fin m) {n : ℕ} (hn : n ≤ m) : Set.InjOn (run t) (Set.Iio n) := by + intro i hi j hj h + have he : (↑i:Fin m)=(↑j:Fin m) := add_left_cancel h + have hh := congrArg Fin.val he + simpa only [Fin.val_natCast,Nat.mod_eq_of_lt (lt_of_lt_of_le hi hn), + Nat.mod_eq_of_lt (lt_of_lt_of_le hj hn)] using hh + +def warm (t : Fin m) (Q : ℕ) : ℕ := Q-t.val%Q +def cut (t : Fin m) (Q : ℕ) (i : ℕ) : ℕ := warm t Q+i*Q + +omit [NeZero m] in +lemma warm_pos (t : Fin m) (hQ : 0 ha (π.injective (h.trans (π.apply_symm_apply a).symm)) + have hb' : π x ≠ b := fun h => hb (π.injective (h.trans (π.apply_symm_apply b).symm)) + simp [Perm.mul_apply,swap_apply_of_ne_of_ne ha hb,swap_apply_of_ne_of_ne ha' hb'] + rw [he] + exact weight_swap_le π P _ _ +end Heisenberg.Cycle + +namespace Heisenberg.Exposure + +section +open Heisenberg.Cycle Heisenberg.LayeredExchange Heisenberg.Bernoulli +variable {T V : Type*} [Fintype T] [Fintype V] + +omit [Fintype T] [Fintype V] in +lemma layerHistory_insert (s : Equiv.Perm T) (a b : T → V) (c : T → Bool) (t : T) : + layerHistory s (fun j => Equiv.swap (a j) (b j)) (Function.update c t true) = + Equiv.swap (s t,a t) (s t,b t) * + layerHistory s (fun j => Equiv.swap (a j) (b j)) (Function.update c t false) := by + let σ := fun j => if Function.update c t false j then Equiv.swap (a j) (b j) else 1 + have he : (fun j => if Function.update c t true j then Equiv.swap (a j) (b j) else 1) = + Function.update σ t (Equiv.swap (a t) (b t)*σ t) := by + funext j + by_cases h : j=t + · subst j + simp [σ] + · simp [Function.update_of_ne h,σ] + change wiring s _ = _ * wiring s σ + rw [he,wiring_update_swap] + +def layerWeight (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) (c : T → Bool) : ℝ := + 2^missingCount (layerHistory s (fun j => Equiv.swap (a j) (b j)) c) P + +omit [Fintype T] [Fintype V] in +lemma layerWeight_nonneg (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) (c : T → Bool) : + 0 ≤ layerWeight s a b P c := by unfold layerWeight; positivity + +omit [Fintype T] [Fintype V] in +lemma layerWeight_one_le (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) (c : T → Bool) : + 1 ≤ layerWeight s a b P c := one_le_pow₀ (by norm_num) + +lemma layerWeight_insertion (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (c : T → Bool) (t : T) : + layerWeight s a b P (Function.update c t true) ≤ + 2*layerWeight s a b P (Function.update c t false) := by + unfold layerWeight + have h := weight_left_swap_le (layerHistory s (fun j => Equiv.swap (a j) (b j)) (Function.update c t false)) P (s t,a t) (s t,b t) + convert h using 1 + congr 2 + exact (layerHistory_insert s a b c t).trans (by + congr 1 + apply Equiv.ext + intro x + simp only [Equiv.swap_apply_def] + split_ifs <;> rfl) + +def layerPartition (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) (p : T → ℝ) : ℝ := + ∑ c,weight p c*layerWeight s a b P c + +def layerMass (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) (p : T → ℝ) (c : T → Bool) : ℝ := + weight p c*layerWeight s a b P c / layerPartition s a b P p + +lemma coin_weight_sum (p : T → ℝ) : (∑ c,weight p c)=1 := by + simpa [Bernoulli.test] using weight_test_sum p ∅ + +omit [Fintype V] in +lemma layerPartition_one_le (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) : 1≤layerPartition s a b P p := by + rw [←coin_weight_sum p] + exact Finset.sum_le_sum fun c _ => le_mul_of_one_le_right (weight_nonneg p hp c) (layerWeight_one_le s a b P c) + +omit [Fintype V] in +lemma layerMass_nonneg (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) (c : T → Bool) : 0≤layerMass s a b P p c := by + exact div_nonneg (mul_nonneg (weight_nonneg p hp c) (layerWeight_nonneg s a b P c)) + (le_trans (by norm_num) (layerPartition_one_le s a b P p hp)) + +omit [Fintype V] in +lemma layerMass_sum (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) : (∑ c,layerMass s a b P p c)=1 := by + simp only [layerMass,←Finset.sum_div] + change layerPartition s a b P p / layerPartition s a b P p = 1 + exact div_self (ne_of_gt (lt_of_lt_of_le (by norm_num) (layerPartition_one_le s a b P p hp))) + +theorem layer_factorial_bound (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) (F : Finset T) : + (∑ c,if ∀ i ∈ F,c i=true then layerMass s a b P p c else 0) ≤ ∏ i ∈ F,2*p i := by + have hz : 0 simp + rw [he] + exact (div_le_iff₀ hz).mpr h + +theorem layer_nonquiet_bound (s : Equiv.Perm T) (a b : T → V) (P : Set (T × V)) + (p : T → ℝ) (hp : ∀ t,0≤p t ∧ p t≤1) (F : Finset T) : + (∑ c,if ∃ i ∈ F,c i=true then layerMass s a b P p c else 0) ≤ ∑ i ∈ F,2*p i := by + have h : ∀ c,(if ∃ i ∈ F,c i=true then layerMass s a b P p c else 0) ≤ + ∑ i ∈ F,if c i=true then layerMass s a b P p c else 0 := by + intro c + by_cases hc : ∃ i ∈ F,c i=true + · obtain ⟨i,hi,hci⟩ := hc + rw [ite_eq_left ⟨i,hi,hci⟩] + calc + _ = if c i=true then layerMass s a b P p c else 0 := by rw [ite_eq_left hci] + _ ≤ _ := Finset.single_le_sum (f := fun j => if c j=true then layerMass s a b P p c else 0) (fun j _ => by split_ifs; exact layerMass_nonneg s a b P p hp c; exact le_rfl) hi + · rw [ite_eq_right hc] + exact Finset.sum_nonneg (fun j _ => by split_ifs; exact layerMass_nonneg s a b P p hp c; exact le_rfl) + calc + _ ≤ ∑ c,∑ i ∈ F,if c i=true then layerMass s a b P p c else 0 := Finset.sum_le_sum (fun c _ => h c) + _ = ∑ i ∈ F,∑ c,if c i=true then layerMass s a b P p c else 0 := Finset.sum_comm + _ ≤ _ := Finset.sum_le_sum (fun i _ => by simpa using layer_factorial_bound s a b P p hp {i}) + +end + +open Heisenberg.MeshPair Heisenberg.Bernoulli +variable {T V : Type*} [Fintype T] [Fintype V] + +omit [Fintype T] in +lemma bounded_euclidean_sq (v : EuclideanSpace ℝ V) + (hv : ∀ j,0≤v.ofLp j ∧ v.ofLp j≤1) : ‖v‖^2≤Fintype.card V := by + rw [EuclideanSpace.norm_sq_eq] + apply le_trans (Finset.sum_le_sum (fun j _ => ?_)) (by simp : (∑ _j : V,(1:ℝ))=Fintype.card V).le + rw [Real.norm_eq_abs,sq_abs] + nlinarith [(hv j).1,(hv j).2] + +theorem tilted_nonquiet_error (s : Equiv.Perm T) (a b : T → V) + (P : Set (T×V)) (p : T → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) + (r : ℕ → T) (n : ℕ) {t : ℝ} (ht : 0≤t) + (hrate : ∀ i,i ring + _ ≤ t*n*(t*n) := hh + _ = _ := by ring + +omit [Fintype T] in +lemma exposedSweep_coins (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p q : T → ℝ) (r : ℕ → T) (n : ℕ) + (hpq : ∀ i,i rfl + | succ n ih => + rw [exposedSweep,exposedSweep,ih (fun i hi => hpq i (by omega))] + simp only [exposedStep,hpq n (by omega)] + +theorem tilted_sweep_energy (s : Equiv.Perm T) (a b : T → V) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,i Equiv.swap (a i) (b i)) base P (r 0)∩I → + (v base).ofLp j=0) → + (∑ base,layerMass s a b P p base * + (t*quietEnergy (holeCut s (fun i => Equiv.swap (a i) (b i)) base P (r 0)) + (a ∘ r) (b ∘ r) n (v base))) ≤ + (∑ base,layerMass s a b P p base * + (‖v base‖^2-‖exposedSweep s a b base P I p r n (v base)‖^2))+ + ε*t*Fintype.card V+t^2*n^2 := by + filter_upwards [exposedSweep_loss s a b r n hr hab hε] with t ht + intro ht0 ht2 p hp hrate P I v hv hvI + have hs := layerMass_sum s a b P p hp + have hc (base : T → Bool) := exposedSweep_coins s a b base P I p (fun _=>t/2) r n hrate (v base) + have hl (base : T → Bool) := ht ht0 ht2 base P I (v base) (hv base) (hvI base) + simp only [←hc] at hl + have h := Finset.sum_le_sum (s:=Finset.univ) (fun base _ => + mul_le_mul_of_nonneg_left (hl base) + (layerMass_nonneg s a b P p hp base)) + have he : (∑ base,layerMass s a b P p base*(ε*t*‖v base‖^2))≤ + ε*t*Fintype.card V := by + calc + _ ≤ ∑ base,layerMass s a b P p base*(ε*t*Fintype.card V) := + Finset.sum_le_sum (fun base _ => mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left (bounded_euclidean_sq (v base) (hv base)) + (by positivity)) (layerMass_nonneg s a b P p hp base)) + _ = _ := by rw [←Finset.sum_mul,hs,one_mul] + have hn := tilted_nonquiet_error s a b P p hp r n ht0 hrate + simp only [mul_add,Finset.sum_add_distrib] at h + linarith + +end Heisenberg.Exposure + +open scoped Classical +namespace Heisenberg.Geometry +abbrev Site (d : ℕ) := Fin d → ℤ + +def Step {d : ℕ} (x y : Site d) : Prop := + ∃ j, (y j = x j + 1 ∨ x j = y j + 1) ∧ ∀ k, k ≠ j → y k = x k + +def Box {d : ℕ} (r : ℤ) : Set (Site d) := {x | ∀ j, |x j| ≤ r} +def Shell {d : ℕ} (r : ℤ) : Set (Site d) := {x | x ∈ Box r ∧ ∃ j, |x j| = r} + +def Reach {d : ℕ} (U : Set (Site d)) (x y : Site d) : Prop := + Relation.ReflTransGen (fun a b => Step a b ∧ a ∈ U ∧ b ∈ U) x y + +lemma step_symm {d : ℕ} {x y : Site d} (h : Step x y) : Step y x := by + obtain ⟨j, h, hj⟩ := h + exact ⟨j, h.symm, fun k hk => (hj k hk).symm⟩ + +lemma reach_refl {d : ℕ} (U : Set (Site d)) (x : Site d) : Reach U x x := + Relation.ReflTransGen.refl + +lemma reach_trans {d : ℕ} {U : Set (Site d)} {x y z : Site d} + (hxy : Reach U x y) (hyz : Reach U y z) : Reach U x z := hxy.trans hyz + +lemma reach_symm {d : ℕ} {U : Set (Site d)} {x y : Site d} + (hxy : Reach U x y) : Reach U y x := by + induction hxy with + | refl => exact reach_refl U x + | @tail b c hab hbc ih => + exact (Relation.ReflTransGen.single ⟨step_symm hbc.1, hbc.2.2, hbc.2.1⟩).trans ih + +lemma reach_mono {d : ℕ} {U W : Set (Site d)} {x y : Site d} + (hUW : U ⊆ W) (hxy : Reach U x y) : Reach W x y := + Relation.ReflTransGen.mono (fun _ _ h => ⟨h.1, hUW h.2.1, hUW h.2.2⟩) x y hxy + +lemma step_update_succ {d : ℕ} (x : Site d) (j : Fin d) (a : ℤ) : + Step (Function.update x j a) (Function.update x j (a + 1)) := by + refine ⟨j, Or.inl ?_, ?_⟩ + · simp + · intro k hk + simp [Function.update_of_ne hk] + +lemma reach_axis_nat {d : ℕ} (U : Set (Site d)) (x : Site d) (j : Fin d) + (a : ℤ) (n : ℕ) (hU : ∀ k : ℕ, k ≤ n → Function.update x j (a + k) ∈ U) : + Reach U (Function.update x j a) (Function.update x j (a + n)) := by + induction n with + | zero => simpa using reach_refl U (Function.update x j a) + | succ n ih => + apply reach_trans (ih (fun k hk => hU k (by omega))) + apply Relation.ReflTransGen.single + refine ⟨?_, hU n (by omega), hU (n + 1) le_rfl⟩ + simpa [Nat.cast_add, Nat.cast_one, add_assoc] using step_update_succ x j (a + n) + +lemma reach_axis {d : ℕ} (U : Set (Site d)) (x : Site d) (j : Fin d) + (a b : ℤ) (hU : ∀ t, min a b ≤ t → t ≤ max a b → Function.update x j t ∈ U) : + Reach U (Function.update x j a) (Function.update x j b) := by + wlog hab : a ≤ b generalizing a b + · exact reach_symm (this b a (by simpa [min_comm, max_comm] using hU) (by omega)) + have he : a + ((b - a).toNat : ℤ) = b := by omega + rw [← he] + apply reach_axis_nat + intro k hk + apply hU + · simp only [min_eq_left hab]; omega + · simp only [max_eq_right hab]; omega + +end Heisenberg.Geometry + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/CyclicEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/CyclicEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..92125cd90d2816279be8305d3626c14c0882977f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/CyclicEnergy.lean @@ -0,0 +1,280 @@ +import OAI.MathematicalPhysics.Heisenberg.RoundEnergy + +namespace OAI + +noncomputable section + +open scoped BigOperators Classical RealInnerProductSpace +namespace Heisenberg.MeshPair +variable {V : Type*} [Fintype V] [DecidableEq V] + +def indicatorVector (J : Finset V) : EuclideanSpace ℝ V := + WithLp.toLp 2 (fun j=>if j∈J then (1:ℝ) else 0) + +lemma indicatorVector_sq (J : Finset V) : ‖indicatorVector J‖^2=(J.card:ℝ) := by + rw [EuclideanSpace.real_norm_sq_eq] + simp [indicatorVector] + +lemma indicatorVector_orth (J : Finset V) (f : EuclideanSpace ℝ V) + (hf : ∀ j∈J,f.ofLp j=1) : ⟪indicatorVector J,f-indicatorVector J⟫=0 := by + rw [EuclideanSpace.inner_eq_star_dotProduct] + apply Finset.sum_eq_zero + intro j _ + by_cases hj : j∈J + · simp [indicatorVector,hj,hf j hj] + · simp [indicatorVector,hj] + +lemma euclideanMap_single (A : Matrix V V ℝ) (j k : V) : + (euclideanMap A (WithLp.toLp 2 (Pi.single k (1:ℝ)))).ofLp j=A j k := by + simp [euclideanMap_apply] + +lemma indicatorVector_pairing (A : Matrix V V ℝ) (J : Finset V) + (f : EuclideanSpace ℝ V) : + ⟪euclideanMap A (indicatorVector J),f⟫=∑ j : J,∑ i,A i j.val*f.ofLp i := by + rw [indicatorVector,pairing_columns] + exact (Finset.sum_attach J (fun j=>∑ i,A i j*f.ofLp i)).symm + +end Heisenberg.MeshPair +namespace Heisenberg.Exposure +open Heisenberg.MeshPair +variable {T V : Type} [Fintype T] [Fintype V] [DecidableEq V] + +omit [Fintype T] in +lemma exposedPrefix_column_support + (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,iEquiv.swap (a i) (b i)) base P (r 0)∩I) : + ∀ j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r n)∩I → + prefixMatrix (fun i=>exposedStep s a b base P I p (r i)) n j k=0 := by + have hs : ∀ j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)∩I → + (WithLp.toLp 2 (Pi.single k (1:ℝ)) : EuclideanSpace ℝ V).ofLp j=0 := by + intro j hj + have hjk : j≠k := fun he=>hj (he.symm ▸ hk) + simp [hjk] + have h := exposedSweep_supported s a b base P I p r n hr + (WithLp.toLp 2 (Pi.single k (1:ℝ))) hs + simpa only [exposedSweep_prefix,euclideanMap_single] using h + +end Heisenberg.Exposure + +open Filter Topology +open scoped RealInnerProductSpace Classical + +open scoped Classical +open Filter +namespace Heisenberg.Serial + +section +open Matrix Heisenberg.MeshPair +variable {V B : Type*} [Fintype V] [DecidableEq V] [Fintype B] + +def product : (n : ℕ) → (Fin n → Matrix V V ℝ) → Matrix V V ℝ + | 0,_ => 1 + | n+1,K => product n (fun i => K i.succ)*K 0 + +private def split (n : ℕ) : (Fin (n+1) → B) ≃ B × (Fin n → B) where + toFun c := (c 0,fun i => c i.succ) + invFun c := Fin.cons c.1 c.2 + left_inv c := by funext i; exact Fin.cases rfl (fun _ => rfl) i + right_inv c := by rfl + +theorem mean_product (n : ℕ) (w : Fin n → B → ℝ) + (K : Fin n → B → Matrix V V ℝ) : + (∑ c : Fin n → B,(∏ i,w i (c i)) • product n (fun i => K i (c i))) = + product n (fun i => ∑ b,w i b • K i b) := by + induction n with + | zero => simp [product] + | succ n ih => + rw [Fintype.sum_equiv (split n) _ + (fun c => (w 0 c.1*(∏ i,w i.succ (c.2 i))) • + (product n (fun i => K i.succ (c.2 i))*K 0 c.1))] + · simp only [Fintype.sum_prod_type,product] + have he (b : B) (c : Fin n → B) : + (w 0 b*(∏ i,w i.succ (c i))) • + (product n (fun i => K i.succ (c i))*K 0 b) = + ((∏ i,w i.succ (c i)) • product n (fun i => K i.succ (c i)))*(w 0 b • K 0 b) := by + rw [Matrix.smul_mul,Matrix.mul_smul,smul_smul,mul_comm] + simp_rw [he,←Finset.sum_mul,ih,←Finset.mul_sum] + · intro c + rw [Fin.prod_univ_succ,product] + rfl + +def follow : (n : ℕ) → (Fin n → Equiv.Perm V) → V → V + | 0,_,v => v + | n+1,σ,v => follow n (fun i => σ i.succ) (σ 0 v) + +def survives : (n : ℕ) → (Fin (n+1) → Set V) → (Fin n → Equiv.Perm V) → V → Prop + | 0,D,_,v => v∈D 0 + | n+1,D,σ,v => v∈D 0 ∧ survives n (fun i => D i.succ) (fun i => σ i.succ) (σ 0 v) + +def projection (D : Set V) : Matrix V V ℝ := killedBetween D D 1 + +def walkKernel (n : ℕ) (D : Fin (n+1) → Set V) (σ : Fin n → Equiv.Perm V) : Matrix V V ℝ := + product n (fun i => killedBetween (D i.castSucc) (D i.succ) (σ i))*projection (D 0) + +lemma projection_mul (D E F : Set V) (σ : Equiv.Perm V) : + killedBetween D E σ*projection F=killedBetween (D∩F) E σ := by + ext i j + simp only [Matrix.mul_apply,projection,killedBetween,Equiv.Perm.one_apply] + rw [Finset.sum_eq_single j] + · by_cases hj : j∈F <;> simp [hj,Set.mem_inter_iff] + · intro k _ hkj + simp [hkj] + · simp + +lemma walkKernel_succ (n : ℕ) (D : Fin (n+2) → Set V) + (σ : Fin (n+1) → Equiv.Perm V) : + walkKernel (n+1) D σ = + walkKernel n (fun i => D i.succ) (fun i => σ i.succ)*killedBetween (D 0) (D 1) (σ 0) := by + simp only [walkKernel,product,Matrix.mul_assoc,projection_mul,Set.inter_self,Fin.castSucc_zero,Fin.succ_zero_eq_one] + congr 1 + have he : projection (D 1)*killedBetween (D 0) (D 1) (σ 0)=killedBetween (D 0) (D 1) (σ 0) := by + ext i j + simp only [Matrix.mul_apply,projection,killedBetween,Equiv.Perm.one_apply] + rw [Finset.sum_eq_single i] + · split_ifs <;> simp_all + · intro k _ hki + simp [Ne.symm hki] + · simp + exact he.symm + +theorem walkKernel_apply (n : ℕ) (D : Fin (n+1) → Set V) + (σ : Fin n → Equiv.Perm V) (i j : V) : + walkKernel n D σ i j = if survives n D σ j then + if i=follow n σ j then 1 else 0 else 0 := by + induction n generalizing i j with + | zero => + simp only [walkKernel,product,one_mul,projection,killedBetween,follow,survives,Equiv.Perm.one_apply] + by_cases hj : j∈D 0 + · by_cases hij : i=j + · subst i; simp [hj] + · simp [hj,hij] + · simp [hj] + | succ n ih => + rw [walkKernel_succ,Matrix.mul_apply,Finset.sum_eq_single (σ 0 j)] + · rw [ih] + simp only [killedBetween,follow,survives] + have hs : survives n (fun i => D i.succ) (fun i => σ i.succ) (σ 0 j) → σ 0 j∈D 1 := by + cases n <;> simp +contextual [survives] + split_ifs <;> simp_all + · intro k _ hk + simp [killedBetween,hk] + · simp + +end + +open Matrix Heisenberg.Hitting +variable {V : Type*} [Fintype V] [DecidableEq V] + +lemma backward_profile (n : ℕ) (K : Fin n → Matrix V V ℝ) (f : Fin (n+1) → V → ℝ) + (hf : ∀ i,(K i).transpose*ᵥ f i.succ=f i.castSucc) : + (product n K).transpose*ᵥ f (Fin.last n)=f 0 := by + induction n with + | zero => simp [product] + | succ n ih => + rw [product,Matrix.transpose_mul,←Matrix.mulVec_mulVec] + have hh := ih (fun i => K i.succ) (fun i => f i.succ) (fun i => hf i.succ) + change (product n (fun i => K i.succ)).transpose*ᵥ f (Fin.last (n+1))=f 1 at hh + rw [hh] + exact hf 0 + +def cyclicKernel (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) : + Matrix (Fin (n+1) × V) (Fin (n+1) × V) ℝ := + fun i j => if i.1=finRotate (n+1) j.1 then K j.1 i.2 j.2 else 0 + +omit [DecidableEq V] in +lemma cyclicKernel_backward (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (f : Fin (n+1) × V → ℝ) (t : Fin (n+1)) (v : V) : + backward (cyclicKernel n K) f (t,v) = + ((K t).transpose*ᵥ (fun w => f (finRotate (n+1) t,w))) v := by + simp only [backward,cyclicKernel,Fintype.sum_prod_type] + rw [Finset.sum_eq_single (finRotate (n+1) t)] + · simp [Matrix.mulVec,dotProduct] + · intro u _ hu + simp only [hu, ite_false, zero_mul, Finset.sum_const_zero] + · simp + +omit [DecidableEq V] in +lemma cyclicKernel_substochastic (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (hK : ∀ t,DoublySubstochastic (K t)) : DoublySubstochastic (cyclicKernel n K) := by + constructor + · intro ⟨t,i⟩ ⟨u,j⟩ + dsimp [cyclicKernel] + split_ifs + · exact (hK u).nonneg i j + · rfl + · intro ⟨t,i⟩ + simp only [cyclicKernel,Fintype.sum_prod_type] + rw [Finset.sum_eq_single ((finRotate (n+1)).symm t)] + · simpa using (hK ((finRotate (n+1)).symm t)).row i + · intro u _ hu + have he : t≠finRotate (n+1) u := by + intro h + exact hu (by rw [h,Equiv.symm_apply_apply]) + simp only [he, ite_false, Finset.sum_const_zero] + · simp + · intro ⟨t,j⟩ + simp only [cyclicKernel,Fintype.sum_prod_type] + rw [Finset.sum_eq_single (finRotate (n+1) t)] + · simpa using (hK t).col j + · intro u _ hu + simp only [hu, ite_false, Finset.sum_const_zero] + · simp + +lemma cyclic_backward_return (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (f : Fin (n+1) → V → ℝ) + (hf : ∀ t,t≠0 → (K t).transpose*ᵥ f (finRotate (n+1) t)=f t) : + (product (n+1) K).transpose*ᵥ f 0=(K 0).transpose*ᵥ f (finRotate (n+1) 0) := by + have hh := backward_profile n (fun i => K i.succ) + (fun i => f (finRotate (n+1) i)) (by + intro i + rw [show finRotate (n+1) i.castSucc=i.succ from finRotate_of_lt i.isLt] + exact hf i.succ (Fin.succ_ne_zero i)) + rw [finRotate_last] at hh + rw [product,Matrix.transpose_mul,←Matrix.mulVec_mulVec,hh] + +def cutTargets (n : ℕ) (T : Finset V) : Finset (Fin (n+1) × V) := + T.image (fun v => (0,v)) + +omit [Fintype V] in +lemma mem_cutTargets (n : ℕ) (T : Finset V) (t : Fin (n+1)) (v : V) : + (t,v)∈cutTargets n T ↔ t=0 ∧ v∈T := by simp [cutTargets,and_comm,eq_comm] + +theorem cyclic_hitting_energy (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (hK : ∀ t,DoublySubstochastic (K t)) (T : Finset V) : + let F := hitting (cyclicKernel n K) (cutTargets n T) + energy (cyclicKernel n K) F = energy (product (n+1) K) (fun v => F (0,v)) := by + dsimp only + let U := cyclicKernel n K + let F := hitting U (cutTargets n T) + have hU := cyclicKernel_substochastic n K hK + have hf (t : Fin (n+1)) (ht : t≠0) : + (K t).transpose*ᵥ (fun v => F (finRotate (n+1) t,v))=(fun v => F (t,v)) := by + funext v + rw [←cyclicKernel_backward] + exact hitting_harmonic hU (cutTargets n T) (by simp [mem_cutTargets,ht]) + have hr := cyclic_backward_return n K (fun t v => F (t,v)) hf + have hr' (v : V) : backward (product (n+1) K) (fun v => F (0,v)) v=backward U F (0,v) := by + rw [cyclicKernel_backward] + exact congrFun hr v + rw [energy_transpose] + change (∑ z,F z*(F z-backward U F z))=energy _ _ + rw [Fintype.sum_prod_type,Finset.sum_eq_single (0:Fin (n+1))] + · rw [energy_transpose] + apply Finset.sum_congr rfl + intro v _ + rw [hr'] + · intro t _ ht + apply Finset.sum_eq_zero + intro v _ + have hh := hitting_harmonic hU (cutTargets n T) (i:=(t,v)) (by simp [mem_cutTargets,ht]) + change backward U F (t,v)=F (t,v) at hh + rw [hh,sub_self,mul_zero] + · simp + +end Heisenberg.Serial + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/DeterminantExposure.lean b/lean/OAI/MathematicalPhysics/Heisenberg/DeterminantExposure.lean new file mode 100644 index 0000000000000000000000000000000000000000..1392558be851f4f1091826019259861bcffcb7a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/DeterminantExposure.lean @@ -0,0 +1,255 @@ +import OAI.MathematicalPhysics.Heisenberg.TensorLift + +namespace OAI + + +noncomputable section +open scoped Classical +open Matrix +namespace Heisenberg.Exposure + +variable {n : Type*} [Fintype n] [DecidableEq n] +variable {R : Type*} [CommRing R] + +lemma det_two_rows (A : Matrix n n R) {i j : n} (hij : i ≠ j) + (v : n → R) (u : R) : + ((A.updateRow i (A i + u • v)).updateRow j (A j - u • v)).det = + A.det + u * ((A.updateRow i v).det - (A.updateRow j v).det) := by + have h₁ : (A.updateRow i (A i + u • v)).updateRow j (A j) = + A.updateRow i (A i + u • v) := by + rw [← Matrix.updateRow_ne (M := A) (b := A i + u • v) hij.symm] + exact Matrix.updateRow_eq_self _ _ + have h₂ : ((A.updateRow i (A i + u • v)).updateRow j v).det = + (A.updateRow j v).det := by + rw [Matrix.updateRow_comm A hij, Matrix.det_updateRow_add, + Matrix.det_updateRow_smul] + have hrow : (A.updateRow j v).updateRow i (A i) = A.updateRow j v := by + rw [← Matrix.updateRow_ne (M := A) (b := v) hij] + exact Matrix.updateRow_eq_self _ _ + rw [hrow] + have hz : ((A.updateRow j v).updateRow i v).det = 0 := by + apply Matrix.det_zero_of_row_eq hij + simp [Matrix.updateRow_self, Matrix.updateRow_ne hij.symm] + rw [hz, mul_zero, add_zero] + rw [sub_eq_add_neg, Matrix.det_updateRow_add, ← neg_smul, + Matrix.det_updateRow_smul, h₁, h₂, Matrix.det_updateRow_add, + Matrix.det_updateRow_smul, Matrix.updateRow_eq_self] + ring + +def swapMix (i j : n) (u : R) : Matrix n n R := + (1 - u) • (1 : Matrix n n R) + u • (Equiv.swap i j).permMatrix R + +lemma one_sub_swapMix_mul (D : Matrix n n R) {i j : n} (hij : i ≠ j) + (u : R) : + 1 - swapMix i j u * D = + (((1 - D).updateRow i ((1 - D) i + u • (D i - D j))).updateRow j + ((1 - D) j - u • (D i - D j))) := by + unfold swapMix + rw [Matrix.add_mul, Matrix.smul_mul, Matrix.smul_mul, Matrix.one_mul, + Equiv.Perm.permMatrix, PEquiv.toMatrix_toPEquiv_mul] + ext k l + by_cases hi : k = i + · subst k + simp only [Matrix.sub_apply, Matrix.add_apply, Matrix.smul_apply, + smul_eq_mul, Matrix.submatrix_apply, Equiv.swap_apply_left, + id_eq, Matrix.updateRow_apply, hij, ite_false, ite_true, + Pi.add_apply, Pi.sub_apply, Pi.smul_apply] + ring + · by_cases hj : k = j + · subst k + simp only [Matrix.sub_apply, Matrix.add_apply, Matrix.smul_apply, + smul_eq_mul, Matrix.submatrix_apply, Equiv.swap_apply_right, + id_eq, Matrix.updateRow_apply, ite_true, + Pi.sub_apply, Pi.smul_apply] + ring + · simp only [Matrix.sub_apply, Matrix.add_apply, Matrix.smul_apply, + smul_eq_mul, Matrix.submatrix_apply, + Equiv.swap_apply_of_ne_of_ne hi hj, id_eq, Matrix.updateRow_apply, + hi, hj, ite_false] + ring + +theorem det_swapMix (D : Matrix n n R) (i j : n) (u : R) : + (1 - D * swapMix i j u).det = + (1 - u) * (1 - D).det + u * (1 - D * (Equiv.swap i j).permMatrix R).det := by + by_cases hij : i = j + · subst j + simp only [Equiv.swap_self, Matrix.permMatrix_refl] + have he : swapMix i i u = (1 : Matrix n n R) := by + simp [swapMix, ← add_smul] + rw [he, Matrix.mul_one] + ring + rw [Matrix.det_one_sub_mul_comm, one_sub_swapMix_mul D hij, det_two_rows _ hij] + have h₁ := det_two_rows (1 - D) hij (D i - D j) (1 : R) + rw [← one_sub_swapMix_mul D hij] at h₁ + simp only [swapMix, sub_self, zero_smul, one_smul, zero_add, one_mul] at h₁ + rw [Matrix.det_one_sub_mul_comm D ((Equiv.swap i j).permMatrix R), h₁] + ring + +def DeterminantLaw {Ω : Type*} [Fintype Ω] + (p : Ω → R) (X : Ω → Matrix n n R) : Prop := + ∀ D : Matrix n n R, + ∑ ω, p ω * (1 - D * X ω).det = + (1 - D * ∑ ω, p ω • X ω).det + +theorem determinantLaw_bernoulli (i j : n) (u : R) : + DeterminantLaw (fun b : Bool => if b then u else 1 - u) + (fun b => if b then (Equiv.swap i j).permMatrix R else 1) := by + intro D + simp only [Fintype.sum_bool, ite_true, Bool.false_eq_true, + ite_false, Matrix.mul_one] + rw [add_comm (u • _), ← swapMix, det_swapMix] + ring + +lemma determinantLaw_deterministic (X : Matrix n n R) : + DeterminantLaw (fun _ : Unit => (1 : R)) (fun _ => X) := by + intro D + simp + +theorem DeterminantLaw.independent_mul {Ω Ψ : Type*} [Fintype Ω] [Fintype Ψ] + {p : Ω → R} {q : Ψ → R} {X : Ω → Matrix n n R} {Y : Ψ → Matrix n n R} + (hX : DeterminantLaw p X) (hY : DeterminantLaw q Y) : + DeterminantLaw (fun z : Ω × Ψ => p z.1 * q z.2) + (fun z => X z.1 * Y z.2) := by + intro D + let MX := ∑ ω, p ω • X ω + let MY := ∑ ψ, q ψ • Y ψ + have hmean : (∑ z : Ω × Ψ, (p z.1 * q z.2) • (X z.1 * Y z.2)) = MX * MY := by + dsimp [MX, MY] + rw [Fintype.sum_prod_type, Matrix.sum_mul] + apply Finset.sum_congr rfl + intro ω _ + rw [Matrix.mul_sum] + apply Finset.sum_congr rfl + intro ψ _ + rw [Matrix.smul_mul, Matrix.mul_smul, smul_smul] + rw [hmean, Fintype.sum_prod_type] + calc + (∑ ω, ∑ ψ, (p ω * q ψ) * (1 - D * (X ω * Y ψ)).det) = + ∑ ω, p ω * (1 - D * X ω * MY).det := by + apply Finset.sum_congr rfl + intro ω _ + simp_rw [mul_assoc (p ω), ← Matrix.mul_assoc D] + rw [← Finset.mul_sum, hY] + _ = ∑ ω, p ω * (1 - MY * D * X ω).det := by + apply Finset.sum_congr rfl + intro ω _ + rw [Matrix.det_one_sub_mul_comm (D * X ω) MY, Matrix.mul_assoc] + _ = (1 - MY * D * MX).det := hX (MY * D) + _ = (1 - D * (MX * MY)).det := by + rw [Matrix.mul_assoc MY, Matrix.det_one_sub_mul_comm MY (D * MX), + Matrix.mul_assoc] + +end Heisenberg.Exposure + +open scoped Classical +open Matrix +namespace Heisenberg.Exposure + +variable {Q : Type*} [Fintype Q] [DecidableEq Q] +variable (R : Type*) [Field R] + +def partialMatrix (f : Q → Option Q) : Matrix Q Q R := + fun i j => if f i = some j then 1 else 0 + +def walk (f : Q → Option Q) : ℕ → Q → Option Q + | 0, i => some i + | n + 1, i => (f i).bind (walk f n) + +omit [Fintype Q] [DecidableEq Q] in +lemma walk_add (f : Q → Option Q) (n m : ℕ) (i : Q) : + walk f (n + m) i = (walk f n i).bind (walk f m) := by + induction n generalizing i with + | zero => simp [walk] + | succ n ih => + simp only [Nat.succ_add, walk] + cases h : f i with + | none => simp + | some j => simpa using ih j + +omit [Fintype Q] [DecidableEq Q] in +lemma walk_eq_none_of_le (f : Q → Option Q) {n m : ℕ} (hnm : n ≤ m) + {i : Q} (hi : walk f n i = none) : walk f m i = none := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hnm + rw [walk_add, hi] + rfl + +lemma pow_partialMatrix (f : Q → Option Q) (n : ℕ) (i j : Q) : + (partialMatrix R f ^ n) i j = if walk f n i = some j then 1 else 0 := by + induction n generalizing i with + | zero => simp [walk, Matrix.one_apply] + | succ n ih => + rw [pow_succ', Matrix.mul_apply] + cases h : f i with + | none => simp [partialMatrix, h, walk] + | some k => + simp only [partialMatrix, h, Option.some.injEq, ite_mul, one_mul, zero_mul] + rw [Finset.sum_ite_eq] + simpa [walk, h] using ih k + +def Escapes (f : Q → Option Q) (i : Q) : Prop := ∃ n, walk f n i = none + +omit [Fintype Q] [DecidableEq Q] in +lemma escapes_of_none {f : Q → Option Q} {i : Q} (hi : f i = none) : Escapes f i := + ⟨1, by simp [walk, hi]⟩ + +omit [Fintype Q] [DecidableEq Q] in +lemma escapes_iff_of_some {f : Q → Option Q} {i j : Q} (h : f i = some j) : + Escapes f i ↔ Escapes f j := by + constructor + · rintro ⟨n, hn⟩ + cases n with + | zero => simp [walk] at hn + | succ n => exact ⟨n, by simpa [walk, h] using hn⟩ + · rintro ⟨n, hn⟩ + exact ⟨n + 1, by simpa [walk, h] using hn⟩ + +lemma nilpotent_partialMatrix (f : Q → Option Q) (h : ∀ i, Escapes f i) : + IsNilpotent (partialMatrix R f) := by + choose n hn using h + refine ⟨∑ i, n i, ?_⟩ + ext i j + rw [pow_partialMatrix] + have hi : walk f (∑ i, n i) i = none := + walk_eq_none_of_le f (Finset.single_le_sum (fun k _ => Nat.zero_le (n k)) + (Finset.mem_univ i)) (hn i) + simp [hi] + +lemma det_one_sub_of_nilpotent {A : Matrix Q Q R} (h : IsNilpotent A) : + (1 - A).det = 1 := by + have hc : A.charpoly = Polynomial.X ^ Fintype.card Q := + sub_eq_zero.mp <| isNilpotent_iff_eq_zero.mp <| + Matrix.isNilpotent_charpoly_sub_pow_of_isNilpotent h + have he := congrArg (Polynomial.eval (1 : R)) hc + simpa [Matrix.eval_charpoly] using he + +lemma det_one_sub_partialMatrix_of_not_all (f : Q → Option Q) + (h : ¬ ∀ i, Escapes f i) : (1 - partialMatrix R f).det = 0 := by + let v : Q → R := fun i => if Escapes f i then 0 else 1 + have hv : partialMatrix R f *ᵥ v = v := by + ext i + cases hi : f i with + | none => simp [Matrix.mulVec, dotProduct, partialMatrix, hi, v, escapes_of_none hi] + | some j => + simp only [Matrix.mulVec, dotProduct, partialMatrix, hi, Option.some.injEq, + ite_mul, one_mul, zero_mul] + rw [Finset.sum_ite_eq] + simp [v, escapes_iff_of_some hi] + have hz : (1 - partialMatrix R f) *ᵥ v = 0 := by + rw [Matrix.sub_mulVec, Matrix.one_mulVec, hv, sub_self] + by_contra hne + have hv0 := Matrix.eq_zero_of_mulVec_eq_zero hne hz + push Not at h + obtain ⟨i, hi⟩ := h + have := congrFun hv0 i + simp [v, hi] at this + +theorem det_one_sub_partialMatrix (f : Q → Option Q) : + (1 - partialMatrix R f).det = if ∀ i, Escapes f i then 1 else 0 := by + split_ifs with h + · exact det_one_sub_of_nilpotent R (nilpotent_partialMatrix R f h) + · exact det_one_sub_partialMatrix_of_not_all R f h + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeCycles.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeCycles.lean new file mode 100644 index 0000000000000000000000000000000000000000..2016046256744e244987938cad1c255f8f3f7e69 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeCycles.lean @@ -0,0 +1,284 @@ +import OAI.MathematicalPhysics.Heisenberg.ExchangeDeterminants + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix + +namespace Heisenberg.LayeredExchange +open Exposure +variable {V W Ω : Type*} [Fintype V] [Fintype W] [Fintype Ω] + [DecidableEq V] [DecidableEq W] +variable {R : Type*} [CommRing R] + +lemma forwardHom_subtype (π : Equiv.Perm V) (P : V → Prop) [DecidablePred P] + (h : ∀ x,P (π x) ↔ P x) : + (forwardHom (R:=R) π).submatrix (fun x : {i // P i} => x.val) (fun x => x.val) = + forwardHom (R:=R) (π.subtypePerm h) := by + ext i j + change (π.permMatrix R) j.val i.val = ((π.subtypePerm h).permMatrix R) j i + simp only [Equiv.Perm.permMatrix,PEquiv.toMatrix_apply,Equiv.toPEquiv_apply, + Option.mem_some_iff] + congr 1 + apply propext + constructor + · exact fun he => Subtype.ext he + · exact fun he => congrArg Subtype.val he + +lemma forwardHom_reindex (π : Equiv.Perm V) (e : W ≃ V) : + (forwardHom (R:=R) π).submatrix e e = forwardHom (R:=R) (e.symm.permCongr π) := by + ext i j + change (π.permMatrix R) (e j) (e i) = ((e.symm.permCongr π).permMatrix R) j i + simp only [Equiv.Perm.permMatrix,PEquiv.toMatrix_apply,Equiv.toPEquiv_apply, + Option.mem_some_iff,Equiv.permCongr_apply,Equiv.symm_symm] + congr 1 + exact propext e.symm_apply_eq.symm + +lemma determinantLaw_holes {μ : Ω → R} {π : Ω → Equiv.Perm V} + (h : DeterminantLaw μ (fun ω => forwardHom (R:=R) (π ω))) + (P : V → Prop) [DecidablePred P] (hi : ∀ ω x,P (π ω x) ↔ P x) : + DeterminantLaw μ (fun ω => forwardHom (R:=R) ((π ω).subtypePerm (hi ω))) := by + have hh := h.subtype P + convert hh using 1 + funext ω + exact (forwardHom_subtype (π ω) P (hi ω)).symm + +lemma determinantLaw_reindexed {μ : Ω → R} {π : Ω → Equiv.Perm V} + (h : DeterminantLaw μ (fun ω => forwardHom (R:=R) (π ω))) (e : W ≃ V) : + DeterminantLaw μ (fun ω => forwardHom (R:=R) (e.symm.permCongr (π ω))) := by + have hh := h.reindex e + convert hh using 1 + funext ω + exact (forwardHom_reindex (π ω) e).symm + +end Heisenberg.LayeredExchange + +open scoped Classical +namespace Heisenberg.Cycle + +section +open Equiv +variable {V : Type*} +abbrev Classes (π : Perm V) := Quotient (Perm.SameCycle.setoid π) +def classOf (π : Perm V) (i : V) : Classes π := Quotient.mk _ i +lemma classOf_eq_iff (π : Perm V) (i j : V) : + classOf π i = classOf π j ↔ π.SameCycle i j := Quotient.eq +@[simp] lemma classOf_apply (π : Perm V) (i : V) : + classOf π (π i) = classOf π i := + (classOf_eq_iff π _ _).mpr ((Perm.SameCycle.refl π i).apply_left) +abbrev MissingClasses (π : Perm V) (P : Set V) := + {c : Classes π // ∀ i ∈ P, c ≠ classOf π i} +noncomputable def missingCount (π : Perm V) (P : Set V) : ℕ := + Nat.card (MissingClasses π P) + +def colorSpace (π : Perm V) (P : Set V) : Submodule (ZMod 2) (V → ZMod 2) where + carrier := {f | (∀ i, f (π i) = f i) ∧ ∀ i ∈ P, f i = 0} + zero_mem' := by simp + add_mem' := by + rintro f g ⟨hf,hfP⟩ ⟨hg,hgP⟩ + exact ⟨fun i => by simp [hf,hg],fun i hi => by simp [hfP i hi,hgP i hi]⟩ + smul_mem' := by + rintro r f ⟨hf,hfP⟩ + exact ⟨fun i => by simp [hf],fun i hi => by simp [hfP i hi]⟩ + +lemma colorSpace_mem (π : Perm V) (P : Set V) (f : V → ZMod 2) : + f ∈ colorSpace π P ↔ (∀ i, f (π i) = f i) ∧ ∀ i ∈ P, f i = 0 := Iff.rfl + +variable [Fintype V] + +lemma color_eq_of_sameCycle (π : Perm V) (P : Set V) (f : colorSpace π P) + {i j : V} (h : π.SameCycle i j) : f.val i = f.val j := by + obtain ⟨n,hn⟩ := h.exists_nat_pow_eq + have ha : ∀ n, f.val ((π^n) i) = f.val i := by + intro n + induction n with + | zero => rfl + | succ n ih => rw [pow_succ',Perm.mul_apply,f.property.1,ih] + rw [← hn,ha] + +def colorEquiv (π : Perm V) (P : Set V) : + colorSpace π P ≃ (MissingClasses π P → ZMod 2) where + toFun f c := Quotient.lift f.val (fun i j h => color_eq_of_sameCycle π P f h) c.val + invFun c := ⟨fun i => if h : ∀ j ∈ P, classOf π i ≠ classOf π j then c ⟨classOf π i,h⟩ else 0, by + constructor + · intro i + simp only [classOf_apply] + · intro i hi + exact dite_eq_right (by intro h; exact h i hi rfl)⟩ + left_inv f := by + apply Subtype.ext + funext i + dsimp + split_ifs with h + · rfl + · obtain ⟨j,hj,hij⟩ := by simpa only [not_forall,not_not] using h + have he := color_eq_of_sameCycle π P f ((classOf_eq_iff π i j).mp hij) + exact (he.trans (f.property.2 j hj)).symm + right_inv c := by + funext q + rcases q with ⟨q,hq⟩ + induction q using Quotient.inductionOn with | _ i => + dsimp + split_ifs with h + · rfl + · exact (h hq).elim + + theorem card_colorSpace (π : Perm V) (P : Set V) : + Nat.card (colorSpace π P) = 2 ^ missingCount π P := by + let := Fintype.ofFinite (MissingClasses π P) + rw [Nat.card_congr (colorEquiv π P),Nat.card_fun] + simp [missingCount] + +lemma finrank_comparison {K W : Type*} [Field K] [AddCommGroup W] [Module K W] + [FiniteDimensional K W] (A B : Submodule K W) (f : W →ₗ[K] K) + (h : ∀ x ∈ A, f x = 0 → x ∈ B) : + Module.finrank K A ≤ Module.finrank K B + 1 := by + let g : A →ₗ[K] K := f.comp A.subtype + let k : LinearMap.ker g →ₗ[K] B := + { toFun := fun x => ⟨x.val.val,h x.val.val x.val.property x.property⟩ + map_add' := by intro x y; rfl + map_smul' := by intro r x; rfl } + have hk : Function.Injective k := by + intro x y he + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun z : B => z.val) he + have hd := k.finrank_le_finrank_of_injective hk + have hr : Module.finrank K (LinearMap.range g) ≤ 1 := by + simpa using (LinearMap.range g).finrank_le + have ht := g.finrank_range_add_finrank_ker + omega + + theorem missingCount_swap_le (π : Perm V) (P : Set V) (a b : V) : + missingCount (π * swap a b) P ≤ missingCount π P + 1 := by + let f : (V → ZMod 2) →ₗ[ZMod 2] ZMod 2 := + { toFun := fun c => c a - c b + map_add' := by intro x y; simp only [Pi.add_apply]; ring + map_smul' := by intro r x; simp only [Pi.smul_apply, smul_sub, RingHom.id_apply] } + have hr : Module.finrank (ZMod 2) (colorSpace (π * swap a b) P) ≤ + Module.finrank (ZMod 2) (colorSpace π P) + 1 := by + apply finrank_comparison _ _ f + intro c hc he + have hab : c a = c b := sub_eq_zero.mp he + refine ⟨?_,hc.2⟩ + intro i + have ht := hc.1 (swap a b i) + simpa only [Perm.mul_apply,swap_apply_self] using ht.trans (by + by_cases hi : i = a + · subst i; simpa using hab.symm + by_cases hi' : i = b + · subst i; simpa using hab + rw [swap_apply_of_ne_of_ne hi hi']) + have hc (σ : Perm V) : missingCount σ P = Module.finrank (ZMod 2) (colorSpace σ P) := by + have h1 := card_colorSpace σ P + have h2 := Module.natCard_eq_pow_finrank (K := ZMod 2) (V := colorSpace σ P) + have he : (2:ℕ) ^ missingCount σ P = 2 ^ Module.finrank (ZMod 2) (colorSpace σ P) := by + rw [← h1] + simpa using h2 + exact Nat.pow_right_injective (by decide : 1 < (2:ℕ)) he + simpa only [hc] using hr + + theorem weight_swap_le (π : Perm V) (P : Set V) (a b : V) : + (2:ℝ) ^ missingCount (π * swap a b) P ≤ 2 * (2:ℝ) ^ missingCount π P := by + calc + _ ≤ (2:ℝ) ^ (missingCount π P + 1) := + pow_le_pow_right₀ (by norm_num) (missingCount_swap_le π P a b) + _ = _ := by rw [pow_succ]; ring + +end + +open Equiv +variable {V : Type*} [Fintype V] + +def MissingSet (π : Perm V) (P : Set V) : Set V := + {i | ∀ j ∈ P, classOf π i ≠ classOf π j} + +omit [Fintype V] in +lemma missing_apply (π : Perm V) (P : Set V) (i : V) : + π i ∈ MissingSet π P ↔ i ∈ MissingSet π P := by + simp only [MissingSet,Set.mem_ofPred_eq,classOf_apply] + +omit [Fintype V] in +lemma missing_disjoint_pins (π : Perm V) (P : Set V) : Disjoint (MissingSet π P) P := by + apply Set.disjoint_left.mpr + intro i hi hP + exact hi i hP rfl + +lemma color_zero_not_missing (π : Perm V) (P : Set V) (f : colorSpace π P) + (i : V) (hi : i ∉ MissingSet π P) : f.val i = 0 := by + obtain ⟨j,hj⟩ := (not_forall.mp hi) + obtain ⟨hjP,hij⟩ := Classical.not_imp.mp hj + exact (color_eq_of_sameCycle π P f ((classOf_eq_iff π i j).mp (not_not.mp hij))).trans (f.property.2 j hjP) + +theorem missing_weight_rigid (π τ : Perm V) (P : Set V) + (hset : MissingSet π P = MissingSet τ P) + (hval : ∀ i ∈ MissingSet π P, π i = τ i) : + missingCount π P = missingCount τ P := by + have hspace : colorSpace π P = colorSpace τ P := by + apply le_antisymm + · intro f hf + refine ⟨?_,hf.2⟩ + intro i + by_cases hi : i ∈ MissingSet π P + · rw [← hval i hi]; exact hf.1 i + · have hτ : τ i ∉ MissingSet π P := by + rw [hset] at hi ⊢ + exact fun h => hi ((missing_apply τ P i).mp h) + exact (color_zero_not_missing π P ⟨f,hf⟩ _ hτ).trans (color_zero_not_missing π P ⟨f,hf⟩ _ hi).symm + · intro f hf + refine ⟨?_,hf.2⟩ + intro i + by_cases hi : i ∈ MissingSet π P + · rw [hval i hi]; exact hf.1 i + · have hπ : π i ∉ MissingSet τ P := by + rw [← hset] + exact fun h => hi ((missing_apply π P i).mp h) + rw [hset] at hi + exact (color_zero_not_missing τ P ⟨f,hf⟩ _ hπ).trans (color_zero_not_missing τ P ⟨f,hf⟩ _ hi).symm + have he := congrArg (fun A : Submodule (ZMod 2) (V → ZMod 2) => Nat.card A) hspace + rw [card_colorSpace,card_colorSpace] at he + exact Nat.pow_right_injective (by decide : 1 < (2:ℕ)) he + +lemma exposed_subset_missing (π τ : Perm V) (P : Set V) + (hval : ∀ i ∈ MissingSet π P, π i = τ i) : + MissingSet π P ⊆ MissingSet τ P := by + intro i hi j hj he + obtain ⟨n,hn⟩ := ((classOf_eq_iff τ i j).mp he).exists_nat_pow_eq + have hiter : ∀ n : ℕ, (τ^n) i ∈ MissingSet π P := by + intro n + induction n with + | zero => exact hi + | succ n ih => + rw [pow_succ',Perm.mul_apply,← hval _ ih] + exact (missing_apply π P _).mpr ih + exact missing_disjoint_pins π P |>.le_bot ⟨hn ▸ hiter n,hj⟩ + +def OutsideHit (τ : Perm V) (P A : Set V) : Prop := + ∀ i ∉ A, ∃ j ∈ P, τ.SameCycle i j + +lemma sameMissing_iff_outsideHit (π τ : Perm V) (P : Set V) + (hval : ∀ i ∈ MissingSet π P, π i = τ i) : + MissingSet τ P = MissingSet π P ↔ OutsideHit τ P (MissingSet π P) := by + have hsub := exposed_subset_missing π τ P hval + constructor + · intro h i hi + have hn : i ∉ MissingSet τ P := by rwa [h] + simp only [MissingSet,Set.mem_ofPred_eq,not_forall,not_not] at hn + obtain ⟨j,hj,hij⟩ := hn + exact ⟨j,hj,(classOf_eq_iff τ i j).mp hij⟩ + · intro h + apply Set.Subset.antisymm _ hsub + intro i hi + by_contra hn + obtain ⟨j,hj,hij⟩ := h i hn + exact hi j hj ((classOf_eq_iff τ i j).mpr hij) + +end Heisenberg.Cycle +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeDeterminants.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeDeterminants.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd6b204d16de67343f137466e1bff97e05111d1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeDeterminants.lean @@ -0,0 +1,276 @@ +import OAI.MathematicalPhysics.Heisenberg.ConditionalMoments + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix + +namespace Heisenberg.Exposure + +section +variable {K J Ω : Type*} [Fintype K] [Fintype J] [Fintype Ω] + [DecidableEq K] [DecidableEq J] +variable {R : Type*} [CommRing R] + +lemma det_block_extraction (X : Matrix (K ⊕ J) (K ⊕ J) R) (D : Matrix K K R) : + (1 - (Matrix.fromBlocks D 0 0 0) * X).det = + (1-D*X.submatrix Sum.inl Sum.inl).det := by + have he : 1 - (Matrix.fromBlocks D 0 0 0) * X = + Matrix.fromBlocks (1-D*X.submatrix Sum.inl Sum.inl) + (-D*X.submatrix Sum.inl Sum.inr) 0 1 := by + ext i j + rcases i with i|i <;> rcases j with j|j <;> + simp [Matrix.mul_apply,Fintype.sum_sum_type,Matrix.fromBlocks,Matrix.one_apply] + rw [he,Matrix.det_fromBlocks_zero₂₁,Matrix.det_one,mul_one] + +theorem DeterminantLaw.inl {p : Ω → R} {X : Ω → Matrix (K ⊕ J) (K ⊕ J) R} + (h : DeterminantLaw p X) : + DeterminantLaw p (fun ω => (X ω).submatrix Sum.inl Sum.inl) := by + intro D + have hh := h (Matrix.fromBlocks D 0 0 0) + simp only [det_block_extraction] at hh + convert hh using 1 + congr 3 + ext i j + simp only [Matrix.sum_apply,Matrix.smul_apply,Matrix.submatrix_apply] + +variable {N M : Type*} [Fintype N] [Fintype M] [DecidableEq N] [DecidableEq M] + +theorem DeterminantLaw.reindex {p : Ω → R} {X : Ω → Matrix N N R} + (h : DeterminantLaw p X) (e : M ≃ N) : + DeterminantLaw p (fun ω => (X ω).submatrix e e) := by + intro D + have hh := h (D.submatrix e.symm e.symm) + have hr : ∀ Y : Matrix N N R, + (1-D.submatrix e.symm e.symm*Y).det = + (1-D*Y.submatrix e e).det := by + intro Y + rw [← Matrix.det_submatrix_equiv_self e] + congr 1 + change (1 : Matrix N N R).submatrix e e - + (D.submatrix e.symm e.symm*Y).submatrix e e = _ + rw [Matrix.submatrix_one_equiv] + rw [← Matrix.submatrix_mul_equiv _ _ e e e] + simp only [Matrix.submatrix_submatrix,Equiv.symm_comp_self,Matrix.submatrix_id_id] + simp only [hr] at hh + convert hh using 1 + congr 3 + ext i j + simp only [Matrix.sum_apply,Matrix.smul_apply,Matrix.submatrix_apply] + +theorem DeterminantLaw.subtype {p : Ω → R} {X : Ω → Matrix N N R} + (h : DeterminantLaw p X) (P : N → Prop) [DecidablePred P] : + DeterminantLaw p (fun ω => (X ω).submatrix (fun x : {i // P i} => x.val) (fun x => x.val)) := by + exact (h.reindex (Equiv.sumCompl P)).inl + +end + +variable {N Ω Ψ B R : Type*} [Fintype N] [DecidableEq N] + [Fintype Ω] [Fintype Ψ] [Fintype B] [CommRing R] + +lemma DeterminantLaw.reparam {p : Ω → R} {X : Ω → Matrix N N R} + (h : DeterminantLaw p X) (e : Ψ ≃ Ω) : + DeterminantLaw (p ∘ e) (X ∘ e) := by + intro D + change (∑ x, p (e x)*(1-D*X (e x)).det) = (1-D*(∑ x,p (e x) • X (e x))).det + rw [e.sum_comp (fun x => p x*(1-D*X x).det),e.sum_comp (fun x => p x • X x)] + exact h D + +lemma DeterminantLaw.const_left {p : Ω → R} {X : Ω → Matrix N N R} + (h : DeterminantLaw p X) (C : Matrix N N R) : + DeterminantLaw p (fun ω => C*X ω) := by + intro D + simpa only [Matrix.mul_assoc,Matrix.mul_sum,Matrix.mul_smul] using h (D*C) + +lemma determinantLaw_constant (p : Ω → R) (hp : ∑ x,p x=1) (C : Matrix N N R) : + DeterminantLaw p (fun _ => C) := by + intro D + simp only [← Finset.sum_mul,← Finset.sum_smul,hp,one_mul,one_smul] + +omit [Fintype N] [DecidableEq N] [Fintype Ω] [Fintype Ψ] [Fintype B] [CommRing R] in +def splitArray (n : ℕ) : (Fin (n+1) → B) ≃ B × (Fin n → B) where + toFun f := (f 0,fun i => f i.succ) + invFun z := Fin.cons z.1 z.2 + left_inv f := by funext i; refine Fin.cases rfl (fun i => rfl) i + right_inv z := by rfl + +omit [Fintype N] [DecidableEq N] [Fintype Ω] [Fintype Ψ] [Fintype B] [CommRing R] in +def orderedProduct {A : Type*} [Monoid A] : (n : ℕ) → (Fin n → A) → A + | 0, _ => 1 + | n+1, f => f 0 * orderedProduct n (fun i => f i.succ) + +theorem determinantLaw_array (n : ℕ) + (w : Fin n → B → R) (X : Fin n → B → Matrix N N R) + (h : ∀ i, DeterminantLaw (w i) (X i)) : + DeterminantLaw (fun b : Fin n → B => ∏ i,w i (b i)) + (fun b => orderedProduct n (fun i => X i (b i))) := by + induction n with + | zero => intro D; simp [orderedProduct] + | succ n ih => + have hh := (h 0).independent_mul (ih (fun i => w i.succ) (fun i => X i.succ) (fun i => h i.succ)) + have ht := hh.reparam (splitArray (B:=B) n) + convert ht using 1 + · funext b + exact Fin.prod_univ_succ _ + · rfl + +end Heisenberg.Exposure + +namespace Heisenberg.LayeredExchange +variable {T V : Type*} + +def fibers (σ : T → Equiv.Perm V) : Equiv.Perm (T × V) where + toFun z := (z.1, σ z.1 z.2) + invFun z := (z.1, (σ z.1).symm z.2) + left_inv z := by simp + right_inv z := by simp + +@[simp] lemma fibers_apply (σ : T → Equiv.Perm V) (t : T) (v : V) : + fibers σ (t,v) = (t,σ t v) := rfl + +@[simp] lemma fibers_one : fibers (fun _ : T => (1 : Equiv.Perm V)) = 1 := by + ext ⟨t,v⟩ <;> rfl + +lemma fibers_mul (σ τ : T → Equiv.Perm V) : + fibers (fun t => σ t * τ t) = fibers σ * fibers τ := by rfl + +def wiring (s : Equiv.Perm T) (σ : T → Equiv.Perm V) : Equiv.Perm (T × V) := + (Equiv.prodCongr s (Equiv.refl V)) * fibers σ + +@[simp] lemma wiring_apply (s : Equiv.Perm T) (σ : T → Equiv.Perm V) (t : T) (v : V) : + wiring s σ (t,v) = (s t,σ t v) := rfl + +lemma fibers_update [DecidableEq T] (σ : T → Equiv.Perm V) (t : T) (τ : Equiv.Perm V) : + fibers (Function.update σ t (τ * σ t)) = + fibers (Function.update (fun _ => 1) t τ) * fibers σ := by + ext ⟨u,v⟩ <;> by_cases h : u = t <;> simp [fibers,Function.update,h] + +lemma fibers_swap [DecidableEq T] [DecidableEq V] (t : T) (u v : V) : + fibers (Function.update (fun _ : T => 1) t (Equiv.swap u v)) = Equiv.swap (t,u) (t,v) := by + ext ⟨a,b⟩ <;> by_cases ht : a = t + · subst a + simp [fibers,Equiv.swap_apply_def] + split_ifs <;> simp_all + · simp [fibers,Function.update,ht,Equiv.swap_apply_def] + · subst a + simp [fibers,Equiv.swap_apply_def] + split_ifs <;> simp_all + · simp [fibers,Function.update,ht,Equiv.swap_apply_def] + +end Heisenberg.LayeredExchange + +namespace Heisenberg.Exposure +variable {A B : Type*} [Monoid A] [Monoid B] + +lemma orderedProduct_map (f : A →* B) (n : ℕ) (x : Fin n → A) : + f (orderedProduct n x) = orderedProduct n (fun i => f (x i)) := by + induction n with + | zero => exact f.map_one + | succ n ih => simp only [orderedProduct,map_mul,ih] + +lemma orderedProduct_one (n : ℕ) (x : Fin n → A) (hx : ∀ i,x i=1) : + orderedProduct n x = 1 := by + induction n with + | zero => rfl + | succ n ih => simp [orderedProduct,hx,ih _ fun _ => rfl] + +lemma orderedProduct_single {n : ℕ} (x : Fin n → A) (i : Fin n) + (hx : ∀ j,j ≠ i → x j=1) : orderedProduct n x = x i := by + induction n with + | zero => exact i.elim0 + | succ n ih => + cases i using Fin.cases with + | zero => + rw [orderedProduct,orderedProduct_one _ _ (fun j => hx j.succ (Fin.succ_ne_zero j)),mul_one] + | succ i => + rw [orderedProduct,hx 0 (Fin.succ_ne_zero i).symm,one_mul] + exact ih _ i (fun j hj => hx j.succ (by simpa using hj)) + +end Heisenberg.Exposure +namespace Heisenberg.LayeredExchange + +section +open Exposure +variable {T V : Type*} + +def fibersHom : (T → Equiv.Perm V) →* Equiv.Perm (T × V) where + toFun := fibers + map_one' := fibers_one + map_mul' := fibers_mul + +lemma fibers_ordered_product (n : ℕ) (σ : Fin n → Equiv.Perm V) : + fibers σ = orderedProduct n (fun i => fibers (Function.update (fun _ => 1) i (σ i))) := by + change fibersHom σ = orderedProduct n + (fun i => fibersHom (Function.update (fun _ => 1) i (σ i))) + rw [← orderedProduct_map (fibersHom (T:=Fin n) (V:=V))] + apply congrArg fibers + funext i + let eval : (Fin n → Equiv.Perm V) →* Equiv.Perm V := + { toFun := fun f => f i, map_one' := rfl, map_mul' := fun _ _ => rfl } + have he := orderedProduct_map eval n (fun j => Function.update (fun _ => 1) j (σ j)) + change σ i = eval (orderedProduct n (fun j => Function.update (fun _ => 1) j (σ j))) + rw [he,orderedProduct_single _ i] + · simp [eval] + · intro j hj + simp [eval,Function.update,Ne.symm hj] + +end + +open Exposure +variable {V : Type*} [Fintype V] [DecidableEq V] +variable {R : Type*} [CommRing R] + +def forwardHom : Equiv.Perm V →* Matrix V V R where + toFun π := (π.permMatrix R).transpose + map_one' := by simp + map_mul' π σ := by rw [Matrix.permMatrix_mul, Matrix.transpose_mul] + +lemma forwardHom_swap (a b : V) : + forwardHom (R:=R) (Equiv.swap a b) = (Equiv.swap a b).permMatrix R := by + simp [forwardHom,Matrix.transpose_permMatrix] + +lemma determinantLaw_phase {n : ℕ} (i : Fin n) (a b : V) (p : R) + (fixed : Option (Equiv.Perm V)) : + DeterminantLaw (fun c : Bool => if c then p else 1-p) + (fun c => forwardHom (R:=R) (fibers (Function.update (fun _ => 1) i + (fixed.getD (if c then Equiv.swap a b else 1))))) := by + cases fixed with + | some σ => + simp only [Option.getD_some] + exact determinantLaw_constant (fun c : Bool => if c then p else 1-p) + (by simp) (forwardHom (R:=R) (fibers (Function.update (fun _ => 1) i σ))) + | none => + have he : ∀ c : Bool, + forwardHom (R:=R) (fibers (Function.update (fun _ => 1) i + ((none : Option (Equiv.Perm V)).getD (if c then Equiv.swap a b else 1)))) = + if c then (Equiv.swap (i,a) (i,b)).permMatrix R else 1 := by + intro c + cases c + · simp [forwardHom,fibers_one] + · simp only [↓reduceIte,Option.getD_none,fibers_swap,forwardHom_swap] + simp_rw [he] + exact determinantLaw_bernoulli _ _ _ + +theorem determinantLaw_wiring {n : ℕ} (s : Equiv.Perm (Fin n)) + (a b : Fin n → V) (p : Fin n → R) (fixed : Fin n → Option (Equiv.Perm V)) : + DeterminantLaw (fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i) + (fun c => forwardHom (R:=R) (wiring s + (fun i => (fixed i).getD (if c i then Equiv.swap (a i) (b i) else 1)))) := by + have h := determinantLaw_array n (fun i (c : Bool) => if c then p i else 1-p i) + (fun i c => forwardHom (R:=R) (fibers (Function.update (fun _ => 1) i + ((fixed i).getD (if c then Equiv.swap (a i) (b i) else 1))))) + (fun i => determinantLaw_phase i (a i) (b i) (p i) (fixed i)) + have hh := h.const_left (forwardHom (R:=R) (Equiv.prodCongr s (Equiv.refl V))) + convert hh using 1 + funext c + rw [wiring,map_mul,fibers_ordered_product,orderedProduct_map] + +end Heisenberg.LayeredExchange +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeOnMesh.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeOnMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..90891bb2fcd8186614bee8d3a99a3bf3a3e3b444 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ExchangeOnMesh.lean @@ -0,0 +1,598 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinDirected + +namespace OAI + +section +noncomputable section + +open scoped Matrix Matrix.Norms.Operator +namespace Heisenberg.Heat +open MatrixContraction +variable {V : Type*} [Fintype V] [DecidableEq V] + +def kernel (G : Matrix V V ℝ) (t : ℝ) : Matrix V V ℝ := + NormedSpace.exp (t • G) + +lemma _root_.OAI.Heisenberg.MatrixContraction.DoublySubstochastic.one : DoublySubstochastic (1 : Matrix V V ℝ) := by + constructor + · intro i j; simp only [Matrix.one_apply]; split_ifs <;> norm_num + · intro i; simp only [Matrix.one_apply, Finset.sum_ite_eq, Finset.mem_univ, ite_true]; norm_num + · intro j; simp only [Matrix.one_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true]; norm_num + +lemma _root_.OAI.Heisenberg.MatrixContraction.DoublySubstochastic.pow {P : Matrix V V ℝ} (hP : DoublySubstochastic P) (n : ℕ) : + DoublySubstochastic (P ^ n) := by + induction n with + | zero => simpa using DoublySubstochastic.one (V := V) + | succ n ih => simpa only [pow_succ] using ih.mul hP + +def entry (i j : V) : Matrix V V ℝ →L[ℝ] ℝ := + (Matrix.entryLinearMap ℝ ℝ i j).toContinuousLinearMap + +omit [DecidableEq V] in +@[simp] lemma entry_apply (i j : V) (P : Matrix V V ℝ) : entry i j P = P i j := rfl + +lemma exp_scalar (a : ℝ) : + NormedSpace.exp (a • (1 : Matrix V V ℝ)) = Real.exp a • 1 := by + have result := (NormedSpace.algebraMap_exp_comm (𝔸 := Matrix V V ℝ) a).symm + simp only [Algebra.algebraMap_eq_smul_one, ← Real.exp_eq_exp_ℝ] at result + convert! result + +lemma uniformization (P : Matrix V V ℝ) (a : ℝ) : + NormedSpace.exp (a • (P - 1)) = Real.exp (-a) • NormedSpace.exp (a • P) := by + have he : a • (P - 1) = (-a) • (1 : Matrix V V ℝ) + a • P := by + simp only [smul_sub, neg_smul]; abel + rw [he, Matrix.exp_add_of_commute, exp_scalar, smul_mul_assoc, one_mul] + exact ((Commute.one_left P).smul_left (-a)).smul_right a + +lemma exp_series (P : Matrix V V ℝ) (a : ℝ) : + HasSum (fun n : ℕ => ((n.factorial : ℝ)⁻¹ * a ^ n) • P ^ n) + (NormedSpace.exp (a • P)) := by + have result := NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) (a • P) + simp only [smul_pow, smul_smul] at result + convert! result + +lemma exp_sub_identity_substochastic {P : Matrix V V ℝ} + (hP : DoublySubstochastic P) {a : ℝ} (ha : 0 ≤ a) : + DoublySubstochastic (NormedSpace.exp (a • (P - 1))) := by + rw [uniformization] + have hs := exp_series P a + have hw : HasSum (fun n : ℕ => (n.factorial : ℝ)⁻¹ * a ^ n) (Real.exp a) := by + simpa only [smul_eq_mul, ← Real.exp_eq_exp_ℝ] using + (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) a) + have hn (n : ℕ) : 0 ≤ (n.factorial : ℝ)⁻¹ * a ^ n := by positivity + have hnorm : Real.exp (-a) * Real.exp a = 1 := by rw [← Real.exp_add]; simp + constructor + · intro i j + change 0 ≤ Real.exp (-a) * NormedSpace.exp (a • P) i j + apply mul_nonneg (Real.exp_pos _).le + exact HasSum.nonneg (fun n => by + change 0 ≤ ((n.factorial : ℝ)⁻¹ * a ^ n) * (P ^ n) i j + exact mul_nonneg (hn n) ((hP.pow n).nonneg i j)) ((entry i j).hasSum hs) + · intro i + have hb : (∑ j, NormedSpace.exp (a • P) i j) ≤ Real.exp a := by + let row : Matrix V V ℝ →L[ℝ] ℝ := ∑ j : V, entry i j + have hr := row.hasSum hs + simp only [row, sum_apply, entry_apply, Matrix.smul_apply, smul_eq_mul] at hr + apply hasSum_le (fun n => ?_) hr hw + change (∑ j, ((n.factorial : ℝ)⁻¹ * a ^ n) * (P ^ n) i j) ≤ _ + rw [← Finset.mul_sum] + exact mul_le_of_le_one_right (hn n) ((hP.pow n).row i) + change (∑ j, Real.exp (-a) * NormedSpace.exp (a • P) i j) ≤ 1 + rw [← Finset.mul_sum] + exact (mul_le_mul_of_nonneg_left hb (Real.exp_pos _).le).trans_eq hnorm + · intro j + have hb : (∑ i, NormedSpace.exp (a • P) i j) ≤ Real.exp a := by + let col : Matrix V V ℝ →L[ℝ] ℝ := ∑ i : V, entry i j + have hr := col.hasSum hs + simp only [col, sum_apply, entry_apply, Matrix.smul_apply, smul_eq_mul] at hr + apply hasSum_le (fun n => ?_) hr hw + change (∑ i, ((n.factorial : ℝ)⁻¹ * a ^ n) * (P ^ n) i j) ≤ _ + rw [← Finset.mul_sum] + exact mul_le_of_le_one_right (hn n) ((hP.pow n).col j) + change (∑ i, Real.exp (-a) * NormedSpace.exp (a • P) i j) ≤ 1 + rw [← Finset.mul_sum] + exact (mul_le_mul_of_nonneg_left hb (Real.exp_pos _).le).trans_eq hnorm + +structure SubMarkovGenerator (G : Matrix V V ℝ) : Prop where + offdiag : ∀ i j, i ≠ j → 0 ≤ G i j + row : ∀ i, ∑ j, G i j ≤ 0 + col : ∀ j, ∑ i, G i j ≤ 0 + +lemma uniformized_substochastic {G : Matrix V V ℝ} (hG : SubMarkovGenerator G) + {c : ℝ} (hc : 0 < c) (hdiag : ∀ i, -G i i ≤ c) : + DoublySubstochastic (1 + c⁻¹ • G) := by + constructor + · intro i j + change 0 ≤ (1 : Matrix V V ℝ) i j + c⁻¹ * G i j + by_cases h : i = j + · subst j + simp only [Matrix.one_apply_eq] + have : -G i i / c ≤ 1 := (div_le_iff₀ hc).mpr (by simpa using hdiag i) + rw [neg_div] at this + rw [mul_comm, ← div_eq_mul_inv] + linarith + · simp only [Matrix.one_apply_ne h, zero_add] + exact mul_nonneg (inv_nonneg.mpr hc.le) (hG.offdiag i j h) + · intro i + change (∑ j, ((1 : Matrix V V ℝ) i j + c⁻¹ * G i j)) ≤ 1 + rw [Finset.sum_add_distrib, ← Finset.mul_sum] + simp only [Matrix.one_apply, Finset.sum_ite_eq, + Finset.mem_univ, ite_true, add_le_iff_nonpos_right] + exact mul_nonpos_of_nonneg_of_nonpos (inv_nonneg.mpr hc.le) (hG.row i) + · intro j + change (∑ i, ((1 : Matrix V V ℝ) i j + c⁻¹ * G i j)) ≤ 1 + rw [Finset.sum_add_distrib, ← Finset.mul_sum] + simp only [Matrix.one_apply, Finset.sum_ite_eq', + Finset.mem_univ, ite_true, add_le_iff_nonpos_right] + exact mul_nonpos_of_nonneg_of_nonpos (inv_nonneg.mpr hc.le) (hG.col j) + +theorem kernel_substochastic {G : Matrix V V ℝ} (hG : SubMarkovGenerator G) + {t : ℝ} (ht : 0 ≤ t) : DoublySubstochastic (kernel G t) := by + let c : ℝ := 1 + ∑ i, |G i i| + have hc : 0 < c := by + dsimp [c] + positivity + have hd (i : V) : -G i i ≤ c := by + have h := Finset.single_le_sum (fun j _ => abs_nonneg (G j j)) (Finset.mem_univ i) + have := neg_le_abs (G i i) + dsimp [c]; linarith + have hp := uniformized_substochastic hG hc hd + have he : (t * c) • ((1 + c⁻¹ • G) - 1) = t • G := by + rw [add_sub_cancel_left, smul_smul] + congr 1 + field_simp + simpa only [he, kernel] using exp_sub_identity_substochastic hp (mul_nonneg ht hc.le) + +def generator (r : Matrix V V ℝ) (κ : V → ℝ) : Matrix V V ℝ := + r - Matrix.diagonal (fun i => (∑ j, r i j) + κ i) + +lemma generator_subMarkov (r : Matrix V V ℝ) (κ : V → ℝ) + (hr : ∀ i j, 0 ≤ r i j) (hs : r.IsSymm) (hk : ∀ i, 0 ≤ κ i) : + SubMarkovGenerator (generator r κ) := by + constructor + · intro i j hij + simpa [generator, Matrix.diagonal_apply_ne _ hij] using hr i j + · intro i + simp only [generator, Matrix.sub_apply, Finset.sum_sub_distrib, + Matrix.diagonal_apply, Finset.sum_ite_eq, Finset.mem_univ, ite_true] + linarith [hk i] + · intro j + have he : ∑ i, r i j = ∑ i, r j i := by + apply Finset.sum_congr rfl + intro i _ + exact (congrFun (congrFun hs i) j).symm + simp only [generator, Matrix.sub_apply, Finset.sum_sub_distrib, + Matrix.diagonal_apply, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + rw [he] + linarith [hk j] + +lemma generator_action (r : Matrix V V ℝ) (κ v : V → ℝ) (i : V) : + (generator r κ).mulVec v i = ∑ j, r i j * (v j - v i) - κ i * v i := by + change (∑ j, (r i j - (Matrix.diagonal (fun i => (∑ j, r i j) + κ i)) i j) * v j) = _ + simp only [sub_mul, Finset.sum_sub_distrib, Matrix.diagonal_apply, ite_mul, + zero_mul, Finset.sum_ite_eq, Finset.mem_univ, ite_true] + simp_rw [mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul] + ring + +def energy (r : Matrix V V ℝ) (κ v : V → ℝ) : ℝ := + (1 / 2 : ℝ) * ∑ i, ∑ j, r i j * (v i - v j) ^ 2 + ∑ i, κ i * v i ^ 2 + +omit [DecidableEq V] in +lemma energy_nonneg (r : Matrix V V ℝ) (κ v : V → ℝ) + (hr : ∀ i j, 0 ≤ r i j) (hk : ∀ i, 0 ≤ κ i) : 0 ≤ energy r κ v := by + apply add_nonneg + · apply mul_nonneg (by norm_num) + exact Finset.sum_nonneg (fun i _ => Finset.sum_nonneg + (fun j _ => mul_nonneg (hr i j) (sq_nonneg _))) + · exact Finset.sum_nonneg (fun i _ => mul_nonneg (hk i) (sq_nonneg _)) + +lemma dirichlet_identity (r : Matrix V V ℝ) (κ v : V → ℝ) (hs : r.IsSymm) : + dot v ((generator r κ).mulVec v) = -energy r κ v := by + let A : ℝ := ∑ i, ∑ j, v i * r i j * (v j - v i) + have hswap : A = ∑ i, ∑ j, v j * r i j * (v i - v j) := by + dsimp [A] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [show r j i = r i j from congrFun (congrFun hs i) j] + have htwo : 2 * A = -(∑ i, ∑ j, r i j * (v i - v j) ^ 2) := by + calc + 2 * A = A + A := by ring + _ = A + ∑ i, ∑ j, v j * r i j * (v i - v j) := congrArg (A + ·) hswap + _ = ∑ i, ∑ j, (v i * r i j * (v j - v i) + + v j * r i j * (v i - v j)) := by + simp only [A, Finset.sum_add_distrib] + _ = _ := by + simp only [← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + have hd : dot v ((generator r κ).mulVec v) = A - ∑ i, κ i * v i ^ 2 := by + calc + _ = ∑ i, ((∑ j, v i * r i j * (v j - v i)) - κ i * v i ^ 2) := by + unfold dot + apply Finset.sum_congr rfl + intro i _ + rw [generator_action, mul_sub, Finset.mul_sum] + congr 1 + · apply Finset.sum_congr rfl + intro j _ + ring + · ring + _ = _ := by rw [Finset.sum_sub_distrib] + rw [hd] + dsimp [energy] + linarith + +lemma kernel_derivative (G : Matrix V V ℝ) (v : V → ℝ) (t : ℝ) (i : V) : + HasDerivAt (fun u => (kernel G u).mulVec v i) + (G.mulVec ((kernel G t).mulVec v) i) t := by + have h (j : V) : HasDerivAt (fun u => kernel G u i j) ((G * kernel G t) i j) t := by + have result := + (entry i j).hasFDerivAt.comp_hasDerivAt t (hasDerivAt_exp_smul_const' G t) + simp only [Function.comp_def, entry_apply] at result + convert! result + have hd := HasDerivAt.fun_sum (u := Finset.univ) (fun j _ => (h j).mul_const (v j)) + change HasDerivAt (fun u => (kernel G u).mulVec v i) (((G * kernel G t).mulVec v) i) t at hd + simpa only [Matrix.mulVec_mulVec] using hd + +theorem dissipation (r : Matrix V V ℝ) (κ v : V → ℝ) (hs : r.IsSymm) (t : ℝ) : + HasDerivAt (fun u => squareNorm ((kernel (generator r κ) u).mulVec v)) + (-2 * energy r κ ((kernel (generator r κ) t).mulVec v)) t := by + let w := (kernel (generator r κ) t).mulVec v + have hd := HasDerivAt.fun_sum (u := Finset.univ) + (fun i _ => (kernel_derivative (generator r κ) v t i).pow 2) + have he : (∑ i, 2 * w i ^ (2 - 1) * ((generator r κ).mulVec w) i) = + -2 * energy r κ w := by + simp only [show 2 - 1 = (1 : ℕ) from rfl, pow_one] + rw [show (∑ i, 2 * w i * ((generator r κ).mulVec w) i) = + 2 * dot w ((generator r κ).mulVec w) by + simp only [dot, Finset.mul_sum, mul_assoc]] + rw [dirichlet_identity r κ w hs]; ring + exact he ▸ hd + +end Heisenberg.Heat + +noncomputable section +open Filter Topology +namespace ExchangeLimit + +variable {E : Type*} [NormedRing E] [NormOneClass E] + +lemma contraction_power_difference (a b : E) (ha : ‖a‖ ≤ 1) (hb : ‖b‖ ≤ 1) (n : ℕ) : + ‖a^n-b^n‖ ≤ n * ‖a-b‖ := by + induction n with + | zero => simp + | succ n ih => + have hbn : ‖b^n‖ ≤ 1 := (norm_pow_le b n).trans (pow_le_one₀ (norm_nonneg _) hb) + have he : a^(n+1)-b^(n+1) = a*(a^n-b^n)+(a-b)*b^n := by + rw [pow_succ',pow_succ']; noncomm_ring + rw [he] + calc + _ ≤ ‖a‖*‖a^n-b^n‖+‖a-b‖*‖b^n‖ := + (norm_add_le _ _).trans (add_le_add (norm_mul_le _ _) (norm_mul_le _ _)) + _ ≤ ‖a^n-b^n‖ + ‖a-b‖ := add_le_add + (mul_le_of_le_one_left (norm_nonneg _) ha) + (mul_le_of_le_one_right (norm_nonneg _) hbn) + _ ≤ (n:ℝ)*‖a-b‖+‖a-b‖ := by linarith + _ = _ := by push_cast; ring + +variable [NormedAlgebra ℝ E] [CompleteSpace E] + +theorem contraction_product_limit (f : ℝ → E) (D : E) + (h0 : f 0 = 1) (hd : HasDerivAt f D 0) + (hf : ∀ t, 0 ≤ t → ‖f t‖ ≤ 1) + (hD : ∀ t : ℝ, 0 ≤ t → ‖NormedSpace.exp (t • D)‖ ≤ 1) + (t : ℝ) (ht : 0 ≤ t) : + Tendsto (fun n : ℕ => (f (t/(n+1)))^(n+1)) atTop (nhds (NormedSpace.exp (t • D))) := by + let : NormedAlgebra ℚ E := NormedAlgebra.restrictScalars ℚ ℝ E + let g : ℝ → E := fun s => f s - NormedSpace.exp (s • D) + have hg0 : g 0 = 0 := by simp [g,h0] + have hgd : HasDerivAt g 0 0 := by + have h := hd.sub (hasDerivAt_exp_smul_const D (0:ℝ)) + change HasDerivAt g _ _ at h + simpa only [zero_smul,NormedSpace.exp_zero,one_mul,sub_self] using h + have hs : Tendsto (fun n : ℕ => t/(n+1:ℝ)) atTop (nhds 0) := by + exact tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds) + have herr : Tendsto (fun n : ℕ => ((n+1:ℝ)) * ‖g (t/(n+1:ℝ))‖) atTop (nhds 0) := by + by_cases ht0 : t = 0 + · simp [ht0,hg0] + · have hpos : 0 < t := lt_of_le_of_ne ht (Ne.symm ht0) + have hsl := hgd.tendsto_slope_zero + have hsn : Tendsto (fun n : ℕ => t/(n+1:ℝ)) atTop (𝓝[≠] (0:ℝ)) := by + apply tendsto_nhdsWithin_iff.mpr + refine ⟨hs, Filter.Eventually.of_forall ?_⟩ + intro n + simp only [Set.mem_compl_iff,Set.mem_singleton_iff] + exact div_ne_zero ht0 (by positivity) + have hh := (hsl.comp hsn).norm.const_mul t + convert hh using 1 + · funext n + simp only [Function.comp_apply,hg0,sub_zero,zero_add,norm_smul,Real.norm_eq_abs] + rw [abs_of_pos (inv_pos.mpr (div_pos hpos (by positivity)))] + field_simp + · simp + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero (fun _ => norm_nonneg _) ?_ herr + intro n + have hpn : 0 < (n+1:ℝ) := by positivity + have hexp : (NormedSpace.exp ((t/(n+1:ℝ)) • D))^(n+1) = NormedSpace.exp (t • D) := by + rw [← NormedSpace.exp_nsmul] + congr 1 + rw [← Nat.cast_smul_eq_nsmul ℝ,smul_smul] + congr 1 + push_cast + field_simp + rw [← hexp] + simpa only [g,Nat.cast_add,Nat.cast_one] using contraction_power_difference + (f (t/(n+1:ℝ))) (NormedSpace.exp ((t/(n+1:ℝ)) • D)) + (hf _ (div_nonneg ht hpn.le)) (hD _ (div_nonneg ht hpn.le)) (n+1) + +end ExchangeLimit + +namespace Heisenberg.ExchangeMatrix +open MatrixContraction Heat +open scoped Matrix Matrix.Norms.Operator NNReal +variable {V : Type*} [Fintype V] [DecidableEq V] + +lemma substochastic_norm_le {P : Matrix V V ℝ} (hP : DoublySubstochastic P) : ‖P‖ ≤ 1 := by + rw [Matrix.linfty_opNorm_def] + change ((Finset.univ.sup fun i : V => ∑ j : V, ‖P i j‖₊ : ℝ≥0) : ℝ) ≤ (1:ℝ≥0) + rw [NNReal.coe_le_coe] + apply Finset.sup_le + intro i _ + apply NNReal.coe_le_coe.mp + simpa only [NNReal.coe_sum,coe_nnnorm,Real.norm_eq_abs,abs_of_nonneg (hP.nonneg i _), + NNReal.coe_one] using hP.row i + +def permutationMatrix (σ : Equiv.Perm V) : Matrix V V ℝ := fun i j => if σ j = i then 1 else 0 + +lemma permutationMatrix_substochastic (σ : Equiv.Perm V) : + DoublySubstochastic (permutationMatrix σ) := by + unfold permutationMatrix + simpa only [Option.some.injEq] using of_partial_permutation (fun i => some (σ i)) (fun i j a hi hj => + σ.injective ((Option.some.inj hi).trans (Option.some.inj hj).symm)) + +@[simp] lemma permutationMatrix_col (σ : Equiv.Perm V) (j : V) : + ∑ i, permutationMatrix σ i j = 1 := by simp [permutationMatrix] + +@[simp] lemma permutationMatrix_row (σ : Equiv.Perm V) (i : V) : + ∑ j, permutationMatrix σ i j = 1 := by + simp only [permutationMatrix,← σ.eq_symm_apply] + simp + +lemma permutationMatrix_mulVec (σ : Equiv.Perm V) (v : V → ℝ) (i : V) : + (permutationMatrix σ).mulVec v i = v (σ.symm i) := by + simp [Matrix.mulVec,dotProduct,permutationMatrix,← σ.eq_symm_apply] + +def bernoulliStep (r : ℝ) (σ : Equiv.Perm V) (t : ℝ) : Matrix V V ℝ := + Real.exp (-r*t) • 1 + (1-Real.exp (-r*t)) • permutationMatrix σ + +omit [Fintype V] in +lemma bernoulliStep_zero (r : ℝ) (σ : Equiv.Perm V) : bernoulliStep r σ 0 = 1 := by + simp [bernoulliStep] + +lemma bernoulliStep_substochastic (r : ℝ) (hr : 0 ≤ r) (σ : Equiv.Perm V) + (t : ℝ) (ht : 0 ≤ t) : DoublySubstochastic (bernoulliStep r σ t) := by + have he : Real.exp (-r*t) ≤ 1 := Real.exp_le_one_iff.mpr (by nlinarith) + have hp := weighted_average (V := V) + (fun b : Bool => if b then Real.exp (-r*t) else 1-Real.exp (-r*t)) + (fun b => by + cases b + · exact sub_nonneg.mpr he + · exact (Real.exp_pos _).le) + (by simp) (fun b : Bool => if b then 1 else permutationMatrix σ) + (fun b => by cases b; exact permutationMatrix_substochastic σ; exact DoublySubstochastic.one) + change DoublySubstochastic (fun i j => Real.exp (-r*t) * (1:Matrix V V ℝ) i j + + (1-Real.exp (-r*t)) * permutationMatrix σ i j) + simpa only [Fintype.sum_bool,ite_true,Bool.false_eq_true,ite_false] using hp + +lemma bernoulliStep_col (r : ℝ) (σ : Equiv.Perm V) (t : ℝ) (j : V) : + ∑ i, bernoulliStep r σ t i j = 1 := by + simp only [bernoulliStep,Matrix.add_apply,Matrix.smul_apply,smul_eq_mul, + Finset.sum_add_distrib,← Finset.mul_sum,permutationMatrix_col] + simp [Matrix.one_apply] + +lemma bernoulliStep_derivative (r : ℝ) (σ : Equiv.Perm V) : + HasDerivAt (bernoulliStep r σ) (r • (permutationMatrix σ - 1)) 0 := by + have hd : HasDerivAt (fun t : ℝ => Real.exp (-r*t)) (-r) 0 := by + convert ((hasDerivAt_id (0:ℝ)).const_mul (-r)).exp using 1 <;> simp + have h := (hd.smul_const (1 : Matrix V V ℝ)).fun_add + ((hasDerivAt_const (0:ℝ) 1).fun_sub hd |>.smul_const (permutationMatrix σ)) + change HasDerivAt (bernoulliStep r σ) _ _ at h + convert h using 1 + simp [smul_sub,neg_smul]; abel + +abbrev Clock (V : Type*) := ℝ≥0 × Equiv.Perm V + +def meshStep : List (Clock V) → ℝ → Matrix V V ℝ + | [], _ => 1 + | e::L,t => bernoulliStep e.1 e.2 t * meshStep L t + +def clockGenerator : List (Clock V) → Matrix V V ℝ + | [] => 0 + | e::L => (e.1:ℝ) • (permutationMatrix e.2 - 1) + clockGenerator L + +lemma meshStep_zero (L : List (Clock V)) : meshStep L 0 = 1 := by + induction L with + | nil => rfl + | cons e L ih => simp [meshStep,bernoulliStep_zero,ih] + +lemma meshStep_substochastic (L : List (Clock V)) (t : ℝ) (ht : 0 ≤ t) : + DoublySubstochastic (meshStep L t) := by + induction L with + | nil => exact DoublySubstochastic.one + | cons e L ih => exact (bernoulliStep_substochastic _ e.1.property _ t ht).mul ih + +lemma meshStep_derivative (L : List (Clock V)) : + HasDerivAt (meshStep L) (clockGenerator L) 0 := by + induction L with + | nil => exact hasDerivAt_const _ _ + | cons e L ih => + have h := (bernoulliStep_derivative (e.1:ℝ) e.2).fun_mul ih + change HasDerivAt (meshStep (e::L)) _ _ at h + simpa only [clockGenerator,meshStep_zero,bernoulliStep_zero,mul_one,one_mul] using h + +lemma clockGenerator_subMarkov (L : List (Clock V)) : SubMarkovGenerator (clockGenerator L) := by + induction L with + | nil => exact ⟨by simp [clockGenerator],by simp [clockGenerator],by simp [clockGenerator]⟩ + | cons e L ih => + have hp := permutationMatrix_substochastic e.2 + constructor + · intro i j hij + change 0 ≤ (e.1:ℝ) * (permutationMatrix e.2 i j - (1:Matrix V V ℝ) i j) + clockGenerator L i j + rw [Matrix.one_apply_ne hij,sub_zero] + exact add_nonneg (mul_nonneg e.1.property (hp.nonneg i j)) (ih.offdiag i j hij) + · intro i + change (∑ j, ((e.1:ℝ) * (permutationMatrix e.2 i j - (1:Matrix V V ℝ) i j) + clockGenerator L i j)) ≤ 0 + rw [Finset.sum_add_distrib,← Finset.mul_sum,Finset.sum_sub_distrib,permutationMatrix_row] + simpa [Matrix.one_apply] using ih.row i + · intro j + change (∑ i, ((e.1:ℝ) * (permutationMatrix e.2 i j - (1:Matrix V V ℝ) i j) + clockGenerator L i j)) ≤ 0 + rw [Finset.sum_add_distrib,← Finset.mul_sum,Finset.sum_sub_distrib,permutationMatrix_col] + simpa [Matrix.one_apply] using ih.col j + +theorem mesh_converges [Nonempty V] (L : List (Clock V)) (t : ℝ) (ht : 0 ≤ t) : + Filter.Tendsto (fun n : ℕ => (meshStep L (t/(n+1:ℝ)))^(n+1)) Filter.atTop + (nhds (NormedSpace.exp (t • clockGenerator L))) := by + apply ExchangeLimit.contraction_product_limit _ _ (meshStep_zero L) (meshStep_derivative L) + (fun u hu => substochastic_norm_le (meshStep_substochastic L u hu)) + (fun u hu => substochastic_norm_le (kernel_substochastic (clockGenerator_subMarkov L) hu)) t ht + +end Heisenberg.ExchangeMatrix +end + +noncomputable section +open Filter Topology +namespace ExchangeLimit +variable {E : Type*} [NormedRing E] [NormOneClass E] [NormedAlgebra ℝ E] [CompleteSpace E] +theorem local_contraction_product_limit (f : ℝ → E) (D : E) + (h0 : f 0 = 1) (hd : HasDerivAt f D 0) + (hf : ∀ᶠ t in 𝓝 (0:ℝ), 0 ≤ t → ‖f t‖ ≤ 1) + (hD : ∀ t : ℝ, 0 ≤ t → ‖NormedSpace.exp (t • D)‖ ≤ 1) + (t : ℝ) (ht : 0 ≤ t) : + Tendsto (fun n : ℕ => (f (t/(n+1)))^(n+1)) atTop (nhds (NormedSpace.exp (t • D))) := by + let : NormedAlgebra ℚ E := NormedAlgebra.restrictScalars ℚ ℝ E + let g : ℝ → E := fun s => f s - NormedSpace.exp (s • D) + have hg0 : g 0 = 0 := by simp [g,h0] + have hgd : HasDerivAt g 0 0 := by + have h := hd.sub (hasDerivAt_exp_smul_const D (0:ℝ)) + change HasDerivAt g _ _ at h + simpa only [zero_smul,NormedSpace.exp_zero,one_mul,sub_self] using h + have hs : Tendsto (fun n : ℕ => t/(n+1:ℝ)) atTop (nhds 0) := by + exact tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds) + have herr : Tendsto (fun n : ℕ => ((n+1:ℝ)) * ‖g (t/(n+1:ℝ))‖) atTop (nhds 0) := by + by_cases ht0 : t = 0 + · simp [ht0,hg0] + · have hpos : 0 < t := lt_of_le_of_ne ht (Ne.symm ht0) + have hsl := hgd.tendsto_slope_zero + have hsn : Tendsto (fun n : ℕ => t/(n+1:ℝ)) atTop (𝓝[≠] (0:ℝ)) := by + apply tendsto_nhdsWithin_iff.mpr + refine ⟨hs, Filter.Eventually.of_forall ?_⟩ + intro n + simp only [Set.mem_compl_iff,Set.mem_singleton_iff] + exact div_ne_zero ht0 (by positivity) + have hh := (hsl.comp hsn).norm.const_mul t + convert hh using 1 + · funext n + simp only [Function.comp_apply,hg0,sub_zero,zero_add,norm_smul,Real.norm_eq_abs] + rw [abs_of_pos (inv_pos.mpr (div_pos hpos (by positivity)))] + field_simp + · simp + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero' (Filter.Eventually.of_forall (fun _ => norm_nonneg _)) ?_ herr + filter_upwards [hs.eventually hf] with n hn + have hpn : 0 < (n+1:ℝ) := by positivity + have hexp : (NormedSpace.exp ((t/(n+1:ℝ)) • D))^(n+1) = NormedSpace.exp (t • D) := by + rw [← NormedSpace.exp_nsmul] + congr 1 + rw [← Nat.cast_smul_eq_nsmul ℝ,smul_smul] + congr 1 + push_cast + field_simp + rw [← hexp] + simpa only [g,Nat.cast_add,Nat.cast_one] using contraction_power_difference + (f (t/(n+1:ℝ))) (NormedSpace.exp ((t/(n+1:ℝ)) • D)) + (hn (div_nonneg ht hpn.le)) (hD _ (div_nonneg ht hpn.le)) (n+1) + +end ExchangeLimit + +namespace Heisenberg.ExchangeMatrix +open MatrixContraction Heat +open scoped Matrix Matrix.Norms.Operator NNReal +variable {V : Type*} [fV : Fintype V] [DecidableEq V] + +def linearStep (r : ℝ) (σ : Equiv.Perm V) (t : ℝ) : Matrix V V ℝ := + (1-r*t) • 1 + (r*t) • permutationMatrix σ + +omit [Fintype V] in +lemma linearStep_zero (r : ℝ) (σ : Equiv.Perm V) : linearStep r σ 0=1 := by + simp [linearStep] + +lemma linearStep_substochastic (r : ℝ) (σ : Equiv.Perm V) (t : ℝ) + (h0 : 0≤r*t) (h1 : r*t≤1) : DoublySubstochastic (linearStep r σ t) := by + have hh:=weighted_average (V:=V) (fun b : Bool=>if b then 1-r*t else r*t) + (fun b=>by cases b; exact h0; exact sub_nonneg.mpr h1) + (by simp) (fun b : Bool=>if b then 1 else permutationMatrix σ) + (fun b=>by cases b; exact permutationMatrix_substochastic σ; exact DoublySubstochastic.one) + change DoublySubstochastic (fun i j=>(1-r*t)*(1:Matrix V V ℝ) i j+(r*t)*permutationMatrix σ i j) + simpa only [Fintype.sum_bool,ite_true,Bool.false_eq_true,ite_false] using hh + +include fV in +lemma linearStep_derivative (r : ℝ) (σ : Equiv.Perm V) : + HasDerivAt (linearStep r σ) (r • (permutationMatrix σ-1)) 0 := by + have hd:=(hasDerivAt_id (0:ℝ)).const_mul r + have hh:=((hasDerivAt_const (0:ℝ) 1).sub hd |>.smul_const (1:Matrix V V ℝ)).add + (hd.smul_const (permutationMatrix σ)) + convert hh using 1 <;> try dsimp [linearStep] + all_goals try simp only [mul_one,zero_sub,smul_sub,neg_smul] + all_goals first | rfl | abel + +def linearMesh : List (Clock V) → ℝ → Matrix V V ℝ + | [],_=>1 + | e::L,t=>linearStep e.1 e.2 t*linearMesh L t + +lemma linearMesh_zero (L : List (Clock V)) : linearMesh L 0=1 := by + induction L with + | nil=>rfl + | cons e L ih=>simp [linearMesh,linearStep_zero,ih] + +lemma linearMesh_derivative (L : List (Clock V)) : HasDerivAt (linearMesh L) (clockGenerator L) 0 := by + induction L with + | nil=>exact hasDerivAt_const _ _ + | cons e L ih=> + have hh:=(linearStep_derivative (e.1:ℝ) e.2).fun_mul ih + change HasDerivAt (linearMesh (e::L)) _ _ at hh + simpa only [clockGenerator,linearMesh_zero,linearStep_zero,mul_one,one_mul] using hh + +lemma linearMesh_locally_substochastic (L : List (Clock V)) : + ∀ᶠ t in 𝓝 (0:ℝ),0≤t → DoublySubstochastic (linearMesh L t) := by + induction L with + | nil=>exact Filter.Eventually.of_forall (fun _ _=>DoublySubstochastic.one) + | cons e L ih=> + have hh : ∀ᶠ t in 𝓝 (0:ℝ),(e.1:ℝ)*t≤1 := by + have hc : ContinuousAt (fun t : ℝ=>(e.1:ℝ)*t) 0:=continuousAt_const.mul continuousAt_id + exact (hc.eventually (eventually_le_nhds (by simp : (e.1:ℝ)*0<1))) + filter_upwards [ih,hh] with t ht hrate + intro h0 + exact (linearStep_substochastic _ _ _ (mul_nonneg e.1.property h0) hrate).mul (ht h0) + +theorem linear_mesh_converges [Nonempty V] (L : List (Clock V)) (t : ℝ) (ht : 0≤t) : + Tendsto (fun n : ℕ=>(linearMesh L (t/(n+1:ℝ)))^(n+1)) atTop + (𝓝 (NormedSpace.exp (t • clockGenerator L))) := by + apply ExchangeLimit.local_contraction_product_limit _ _ (linearMesh_zero L) (linearMesh_derivative L) + ?_ (fun u hu=>substochastic_norm_le (kernel_substochastic (clockGenerator_subMarkov L) hu)) t ht + filter_upwards [linearMesh_locally_substochastic L] with u hu + intro h0 + exact substochastic_norm_le (hu h0) + +end Heisenberg.ExchangeMatrix +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ExponentialEvolution.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ExponentialEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..fad499f96e297bb4dec5a8d18f327bcc68ae475f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ExponentialEvolution.lean @@ -0,0 +1,275 @@ +import OAI.MathematicalPhysics.Heisenberg.LocalAlgebra + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators + +namespace SpinEvolution + +section +variable {E : Type*} [NormedRing E] [NormedAlgebra ℂ E] + +def leftRegular : E →ₐ[ℂ] (E →L[ℂ] E) where + toFun := ContinuousLinearMap.mul ℂ E + map_zero' := by ext A; simp + map_one' := by ext A; simp + map_add' H K := by ext A; simp + map_mul' H K := by ext A; simp [mul_assoc] + commutes' z := by ext A; simp [Algebra.algebraMap_eq_smul_one] + +@[simp] lemma leftRegular_apply (H A : E) : leftRegular H A = H*A := rfl + +lemma leftRegular_continuous : Continuous (leftRegular : E → E →L[ℂ] E) := + (ContinuousLinearMap.mul ℂ E).continuous + +def rightRegular : Eᵐᵒᵖ →ₐ[ℂ] (E →L[ℂ] E) where + toFun H := (ContinuousLinearMap.mul ℂ E).flip H.unop + map_zero' := by ext A; simp + map_one' := by ext A; simp + map_add' H K := by ext A; simp + map_mul' H K := by ext A; simp [mul_assoc] + commutes' z := by ext A; simp [Algebra.algebraMap_eq_smul_one] + +@[simp] lemma rightRegular_apply (H : Eᵐᵒᵖ) (A : E) : rightRegular H A = A*H.unop := rfl + +lemma rightRegular_continuous : Continuous (rightRegular : Eᵐᵒᵖ → E →L[ℂ] E) := + (ContinuousLinearMap.mul ℂ E).flip.continuous.comp MulOpposite.continuous_unop + +lemma left_right_commute (H K : E) : + Commute (leftRegular H) (rightRegular (MulOpposite.op K)) := by + ext A + simp [mul_assoc] + +variable [CompleteSpace E] + +lemma exp_left (H : E) : NormedSpace.exp (leftRegular H) = leftRegular (NormedSpace.exp H) := by + let : NormedAlgebra ℚ E := NormedAlgebra.restrictScalars ℚ ℂ E + let : NormedAlgebra ℚ (E →L[ℂ] E) := NormedAlgebra.restrictScalars ℚ ℂ _ + exact (NormedSpace.map_exp leftRegular leftRegular_continuous H).symm + +lemma exp_right (H : E) : NormedSpace.exp (rightRegular (MulOpposite.op H)) = + rightRegular (MulOpposite.op (NormedSpace.exp H)) := by + let : NormedAlgebra ℚ E := NormedAlgebra.restrictScalars ℚ ℂ E + let : NormedAlgebra ℚ (E →L[ℂ] E) := NormedAlgebra.restrictScalars ℚ ℂ _ + simpa only [NormedSpace.exp_op] using + (NormedSpace.map_exp (rightRegular (E := E)) rightRegular_continuous + (MulOpposite.op H)).symm + +theorem exp_left_add_right (H K A : E) : + NormedSpace.exp (leftRegular H + rightRegular (MulOpposite.op K)) A = + NormedSpace.exp H * A * NormedSpace.exp K := by + let : NormedAlgebra ℚ (E →L[ℂ] E) := NormedAlgebra.restrictScalars ℚ ℂ _ + rw [NormedSpace.exp_add_of_commute (left_right_commute H K), exp_left, exp_right] + simp [mul_assoc] + +def generator (H : E) : E →L[ℂ] E := + leftRegular (Complex.I • H) + rightRegular (MulOpposite.op ((-Complex.I) • H)) + +omit [CompleteSpace E] in +@[simp] lemma generator_apply (H A : E) : generator H A = Complex.I • (H*A-A*H) := by + simp [generator, sub_eq_add_neg] + +omit [CompleteSpace E] in +lemma time_generator (H : E) (z : ℂ) : + z • generator H = leftRegular ((z*Complex.I) • H) + + rightRegular (MulOpposite.op ((-(z*Complex.I)) • H)) := by + ext A + simp [generator, smul_add, smul_smul] + +theorem exp_generator (H A : E) (z : ℂ) : + NormedSpace.exp (z • generator H) A = + NormedSpace.exp ((z*Complex.I) • H) * A * NormedSpace.exp ((-(z*Complex.I)) • H) := by + rw [time_generator, exp_left_add_right] + +lemma exp_operator_apply (D : E →L[ℂ] E) (A : E) : + NormedSpace.exp D A = ∑' n : ℕ, ((n.factorial : ℂ)⁻¹) • (D^n) A := by + rw [NormedSpace.exp_eq_tsum ℂ] + exact (ContinuousLinearMap.apply ℂ E A).map_tsum (NormedSpace.expSeries_summable' (𝕂 := ℂ) D) + +theorem dynamics_series (H A : E) (z : ℂ) : + NormedSpace.exp ((z*Complex.I) • H) * A * NormedSpace.exp ((-(z*Complex.I)) • H) = + ∑' n : ℕ, ((n.factorial : ℂ)⁻¹ * z^n) • ((generator H)^n) A := by + rw [← exp_generator, exp_operator_apply] + apply tsum_congr + intro n + have hp : ((z • generator H)^n) A = z^n • ((generator H)^n) A := by + induction n with + | zero => simp + | succ n ih => + simp only [pow_succ', mul_apply_eq_comp, + smul_apply, ih, map_smul, smul_smul] + rw [mul_comm] + rw [hp, smul_smul] + +end + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + +structure LocalDecomposition (D : E →L[ℂ] E) (Local : ℕ → E → Prop) (C : ℝ) : Prop where + nonneg : 0 ≤ C + split : ∀ k A, Local k A → ∃ (r : ℕ) (g : Fin r → E), + D A = ∑ i, g i ∧ (∀ i, Local (k+1) (g i)) ∧ + ∑ i, ‖g i‖ ≤ C * (k+1) * ‖A‖ + +theorem LocalDecomposition.power_bound {D : E →L[ℂ] E} {Local : ℕ → E → Prop} + {C : ℝ} (h : LocalDecomposition D Local C) (n k : ℕ) (A : E) (hA : Local k A) : + ‖(D^n) A‖ ≤ C^n * ((k+1).ascFactorial n : ℝ) * ‖A‖ := by + induction n generalizing k A with + | zero => simp + | succ n ih => + obtain ⟨r, g, hsum, hloc, hnorm⟩ := h.split k A hA + have hc : 0 ≤ C^n * ((k+2).ascFactorial n : ℝ) := mul_nonneg (pow_nonneg h.nonneg _) (Nat.cast_nonneg _) + calc + ‖(D^(n+1)) A‖ = ‖∑ i, (D^n) (g i)‖ := by + rw [pow_succ, mul_apply_eq_comp, hsum, map_sum] + _ ≤ ∑ i, ‖(D^n) (g i)‖ := norm_sum_le _ _ + _ ≤ ∑ i, C^n * ((k+2).ascFactorial n : ℝ) * ‖g i‖ := + Finset.sum_le_sum (fun i _ => ih (k+1) (g i) (hloc i)) + _ = (C^n * ((k+2).ascFactorial n : ℝ)) * ∑ i, ‖g i‖ := by + rw [Finset.mul_sum] + _ ≤ (C^n * ((k+2).ascFactorial n : ℝ)) * (C*(k+1)*‖A‖) := + mul_le_mul_of_nonneg_left hnorm hc + _ = C^(n+1) * ((k+1).ascFactorial (n+1) : ℝ) * ‖A‖ := by + rw [Nat.ascFactorial_succ, ← Nat.succ_ascFactorial] + push_cast + ring + +lemma summable_ascFactorial {q : ℝ} (hq : 0 ≤ q) (hq1 : q < 1) (k : ℕ) : + Summable (fun n : ℕ => q^n * ((k+1).ascFactorial n : ℝ) / n.factorial) := by + have heq (n : ℕ) : q^n * ((k+1).ascFactorial n : ℝ) / n.factorial = + ((k+n).choose k : ℝ) * q^n := by + rw [Nat.ascFactorial_eq_factorial_mul_choose, ← Nat.choose_symm_add] + push_cast + field_simp + simp_rw [heq] + have hs : Summable (fun n : ℕ => ((k+n : ℕ) : ℝ)^k * q^n) := by + have hqnorm : ‖q‖ < 1 := by simpa [Real.norm_eq_abs, abs_of_nonneg hq] using hq1 + have hs (j : ℕ) : Summable (fun n : ℕ => + ((k : ℝ)^j * (k.choose j : ℝ)) * ((n : ℝ)^(k-j) * q^n)) := + (summable_pow_mul_geometric_of_norm_lt_one (k-j) hqnorm).mul_left _ + convert (summable_sum (s := Finset.range (k+1)) (fun j _ => hs j)) using 1 + ext n + rw [Nat.cast_add, add_pow, Finset.sum_mul] + apply Finset.sum_congr rfl + intro j _ + ring + exact Summable.of_nonneg_of_le (fun n => by positivity) + (fun n => mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.choose_le_pow (k+n) k) + (pow_nonneg hq n)) hs + +end SpinEvolution + +namespace Heisenberg +def neighbors {d : ℕ} (x : Site d) : Finset (Site d) := + Finset.univ.biUnion fun i => + {Function.update x i (x i + 1), Function.update x i (x i - 1)} + +lemma nearestNeighbor_symm {d : ℕ} {x y : Site d} (h : NearestNeighbor x y) : + NearestNeighbor y x := by + unfold NearestNeighbor at * + simpa only [abs_sub_comm] using h + +lemma nearestNeighbor_coordinate {d : ℕ} {x y : Site d} (h : NearestNeighbor x y) : + ∃ i, (y i = x i + 1 ∨ y i = x i - 1) ∧ ∀ j, j ≠ i → y j = x j := by + have hi : ∃ i, x i ≠ y i := by + by_contra! hh + have : ∑ i : Fin d, |x i - y i| = (0 : ℤ) := by simp [hh] + change ∑ i : Fin d, |x i - y i| = (1 : ℤ) at h + omega + obtain ⟨i, hi⟩ := hi + have hain : 1 ≤ |x i-y i| := by + have hn : x i-y i ≠ 0 := sub_ne_zero.mpr hi + have := abs_pos.mpr hn + omega + have hai : |x i-y i| ≤ 1 := by + change ∑ i : Fin d, |x i-y i| = (1 : ℤ) at h + rw [← h] + exact Finset.single_le_sum (f := fun j : Fin d => |x j - y j|) (fun j _ => abs_nonneg _) (Finset.mem_univ i) + refine ⟨i, ?_, ?_⟩ + · have hab : x i-y i = 1 ∨ x i-y i = -1 := by + have : |x i-y i| = 1 := le_antisymm hai hain + exact (abs_eq (by norm_num : (0 : ℤ) ≤ 1)).mp this + omega + · intro j hji + have hsum : |x i-y i| + |x j-y j| ≤ (1 : ℤ) := by + change ∑ i : Fin d, |x i-y i| = (1 : ℤ) at h + rw [← h] + rw [← Finset.sum_pair (f := fun j : Fin d => |x j-y j|) (Ne.symm hji)] + exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (by intros; positivity) + have : |x j-y j| = 0 := le_antisymm (by omega) (abs_nonneg _) + exact (sub_eq_zero.mp (abs_eq_zero.mp this)).symm + +lemma mem_neighbors_of_nearestNeighbor {d : ℕ} {x y : Site d} (h : NearestNeighbor x y) : + y ∈ neighbors x := by + obtain ⟨i, hi, he⟩ := nearestNeighbor_coordinate h + apply Finset.mem_biUnion.mpr + refine ⟨i, Finset.mem_univ _, ?_⟩ + rcases hi with hi | hi + · have hy : y = Function.update x i (x i+1) := by + ext j + by_cases hj : j = i + · subst j; simpa using hi + · simp [Function.update_of_ne hj, he j hj] + simp [hy] + · have hy : y = Function.update x i (x i-1) := by + ext j + by_cases hj : j = i + · subst j; simpa using hi + · simp [Function.update_of_ne hj, he j hj] + simp [hy] + +lemma card_neighbors_le {d : ℕ} (x : Site d) : (neighbors x).card ≤ 2*d := by + calc + (neighbors x).card ≤ ∑ i : Fin d, + ({Function.update x i (x i+1), Function.update x i (x i-1)} : Finset (Site d)).card := + Finset.card_biUnion_le + _ ≤ ∑ _ : Fin d, 2 := Finset.sum_le_sum (fun _ _ => Finset.card_le_two) + _ = 2*d := by simp [mul_comm] + +def incidentEdges {d : ℕ} (F : Finset (Site d)) : Finset (Site d × Site d) := + F.biUnion fun x => ((neighbors x).image (fun y => (x,y))) ∪ + ((neighbors x).image (fun y => (y,x))) + +lemma mem_incidentEdges {d : ℕ} {F : Finset (Site d)} {x y : Site d} + (h : NearestNeighbor x y) (hm : x ∈ F ∨ y ∈ F) : (x,y) ∈ incidentEdges F := by + rcases hm with hx | hy + · exact Finset.mem_biUnion.mpr ⟨x, hx, Finset.mem_union_left _ + (Finset.mem_image.mpr ⟨y, mem_neighbors_of_nearestNeighbor h, rfl⟩)⟩ + · exact Finset.mem_biUnion.mpr ⟨y, hy, Finset.mem_union_right _ + (Finset.mem_image.mpr ⟨x, mem_neighbors_of_nearestNeighbor (nearestNeighbor_symm h), rfl⟩)⟩ + +lemma card_incidentEdges_le {d : ℕ} (F : Finset (Site d)) : + (incidentEdges F).card ≤ (4*d)*F.card := by + calc + _ ≤ ∑ x ∈ F, (((neighbors x).image (fun y => (x,y))) ∪ + ((neighbors x).image (fun y => (y,x)))).card := Finset.card_biUnion_le + _ ≤ ∑ _ ∈ F, 4*d := by + apply Finset.sum_le_sum + intro x _ + exact (Finset.card_union_le _ _).trans ((add_le_add + ((Finset.card_image_le).trans (card_neighbors_le x)) + ((Finset.card_image_le).trans (card_neighbors_le x))).trans (by omega)) + _ = (4*d)*F.card := by simp [mul_comm] + +def neighborhood {d : ℕ} (F : Finset (Site d)) : Finset (Site d) := + F ∪ F.biUnion neighbors + +lemma subset_neighborhood {d : ℕ} (F : Finset (Site d)) : F ⊆ neighborhood F := + Finset.subset_union_left + +lemma nearestNeighbor_mem_neighborhood {d : ℕ} {F : Finset (Site d)} {x y : Site d} + (h : NearestNeighbor x y) (hm : x ∈ F ∨ y ∈ F) : + x ∈ neighborhood F ∧ y ∈ neighborhood F := by + rcases hm with hx | hy + · exact ⟨subset_neighborhood F hx, Finset.mem_union_right _ + (Finset.mem_biUnion.mpr ⟨x, hx, mem_neighbors_of_nearestNeighbor h⟩)⟩ + · exact ⟨Finset.mem_union_right _ (Finset.mem_biUnion.mpr + ⟨y, hy, mem_neighbors_of_nearestNeighbor (nearestNeighbor_symm h)⟩), + subset_neighborhood F hy⟩ + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ExposedEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ExposedEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..612423fad18dd7fef78aafdba345ab62b0b3fcff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ExposedEnergy.lean @@ -0,0 +1,284 @@ +import OAI.MathematicalPhysics.Heisenberg.QuietSweeps + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical +open scoped Classical +open Filter +open scoped Classical +open scoped Classical +open Filter Topology +open scoped RealInnerProductSpace Classical + +namespace Heisenberg.Exposure +open Heisenberg.MeshPair +variable {T V : Type*} [Fintype T] [Fintype V] [DecidableEq V] + +omit [Fintype T] in +lemma exposedStep_substochastic (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) (t : T) : + Heisenberg.MatrixContraction.DoublySubstochastic (exposedStep s a b base P I p t) := + residualBetween_substochastic _ _ _ _ _ _ _ (hp t).1 (hp t).2 + +omit [Fintype T] in +lemma exposedSweep_contraction (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) + (r : ℕ → T) (n : ℕ) (v : EuclideanSpace ℝ V) : + ‖exposedSweep s a b base P I p r n v‖≤‖v‖ := by + induction n with + | zero => rfl + | succ n ih => exact (euclideanMap_contraction _ (exposedStep_substochastic s a b base P I p hp _) _).trans ih + +omit [Fintype T] in + +theorem exposedSweep_energy (s : Equiv.Perm T) (a b : T → V) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,i Equiv.swap (a i) (b i)) base P (r 0)∩I → v.ofLp j=0) → + |‖exposedSweep s a b base P I (fun _ => t/2) r n v‖^2-‖v‖^2+ + t*quietEnergy (holeCut s (fun i => Equiv.swap (a i) (b i)) base P (r 0)) (a ∘ r) (b ∘ r) n v| + ≤ ε * |t| * ‖v‖^2 := by + filter_upwards [quietSweep_energy (a ∘ r) (b ∘ r) n hab hε] with t ht + intro base P I v hb hv + rw [exposedSweep_quiet s a b base P I r n t hr hb hab v] + exact ht _ _ v hv + +omit [Fintype T] [Fintype V] [DecidableEq V] in +lemma quietEnergy_le_card (H : Set V) (a b : ℕ → V) (n : ℕ) (v : EuclideanSpace ℝ V) + (hv : ∀ j,0≤v.ofLp j ∧ v.ofLp j≤1) : quietEnergy H a b n v≤n := by + apply le_trans (Finset.sum_le_sum (fun i _ => ?_)) (by simp : (∑ _i∈Finset.range n,(1:ℝ))=n).le + split_ifs + · nlinarith [(hv (a i)).1,(hv (a i)).2,(hv (b i)).1,(hv (b i)).2, + mul_nonneg (hv (a i)).1 (hv (b i)).1] + · norm_num + +omit [Fintype T] in + +theorem exposedSweep_loss (s : Equiv.Perm T) (a b : T → V) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,i Equiv.swap (a i) (b i)) base P (r 0)∩I → v.ofLp j=0) → + t*quietEnergy (holeCut s (fun i => Equiv.swap (a i) (b i)) base P (r 0)) (a ∘ r) (b ∘ r) n v ≤ + ‖v‖^2-‖exposedSweep s a b base P I (fun _ => t/2) r n v‖^2+ + ε*t*‖v‖^2+(if ∃ i,i t/2) + (fun _ => ⟨by positivity,by linarith⟩) r n v + have hl : 0≤‖v‖^2-‖exposedSweep s a b base P I (fun _ => t/2) r n v‖^2 := by + nlinarith [norm_nonneg v,norm_nonneg (exposedSweep s a b base P I (fun _ => t/2) r n v)] + by_cases hb : ∃ i,i Equiv.swap (a i) (b i)) base P (r 0)) (a ∘ r) (b ∘ r) n v hv) ht0 + have hz : 0≤ε*t*‖v‖^2 := by positivity + linarith + · rw [ite_eq_right hb] + have hquiet : ∀ i,i p j) d := by + unfold weight + rw [Fintype.prod_eq_mul_prod_subtype_ne _ i] + simp only [join_at,join_ne] + +lemma sum_split (p : I → ℝ) (F : (I → Bool) → ℝ) (i : I) : + (∑ c, weight p c * F c) = + ∑ d : {j // j ≠ i} → Bool, weight (fun j : {j // j ≠ i} => p j) d * + ((1-p i)*F (join i false d) + p i*F (join i true d)) := by + rw [← (Equiv.funSplitAt i Bool).symm.sum_comp] + change (∑ q : Bool × ({j // j ≠ i} → Bool), weight p (join i q.1 q.2) * F (join i q.1 q.2)) = _ + simp only [Fintype.sum_prod_type, Fintype.sum_bool, weight_join, Bool.false_eq_true, ↓reduceIte] + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro d _ + ring + +lemma scalar_bound {κ p W₀ W₁ : ℝ} (hκ : 1 ≤ κ) (hp : 0 ≤ p) (hp1 : p ≤ 1) + (hW₁ : 0 ≤ W₁) (hW : W₁ ≤ κ*W₀) : + W₁ ≤ κ*((1-p)*W₀+p*W₁) := by + have h1 := mul_le_mul_of_nonneg_left hW (sub_nonneg.mpr hp1) + have h2 := mul_le_mul_of_nonneg_left (show W₁ ≤ κ*W₁ by nlinarith) hp + nlinarith + +lemma weight_nonneg (p : I → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) (c : I → Bool) : + 0 ≤ weight p c := by + apply Finset.prod_nonneg + intro i _ + split_ifs <;> linarith [(hp i).1,(hp i).2] + +lemma one_coin (p : I → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) {κ : ℝ} (hκ : 1 ≤ κ) + (W G : (I → Bool) → ℝ) (i : I) + (hW : ∀ c, 0 ≤ W c) (hG : ∀ c, 0 ≤ G c) + (hins : ∀ c, W (Function.update c i true) ≤ κ*W (Function.update c i false)) + (hGi : ∀ c, G (Function.update c i true) = G (Function.update c i false)) : + (∑ c, weight p c * ((if c i then W c else 0)*G c)) ≤ + κ*p i * ∑ c, weight p c*(W c*G c) := by + rw [sum_split, sum_split, Finset.mul_sum] + apply Finset.sum_le_sum + intro d _ + have hi := hins (join i false d) + have hg := hGi (join i false d) + simp only [join_update] at hi hg + simp only [join_at,Bool.false_eq_true,↓reduceIte,zero_mul,mul_zero,zero_add] + rw [hg] + have hb := scalar_bound hκ (hp i).1 (hp i).2 (hW _) hi + have hn := mul_le_mul_of_nonneg_left hb (mul_nonneg (hp i).1 (hG (join i false d))) + have hf := mul_le_mul_of_nonneg_left hn + (weight_nonneg (fun j : {j // j ≠ i} => p j) (fun j => hp j) d) + nlinarith + +def test (s : Finset I) (c : I → Bool) : ℝ := if ∀ i ∈ s, c i = true then 1 else 0 + +lemma test_nonneg (s : Finset I) (c : I → Bool) : 0 ≤ test s c := by + unfold test; split_ifs <;> norm_num + +lemma test_update {s : Finset I} {i : I} (hi : i ∉ s) (c : I → Bool) (b : Bool) : + test s (Function.update c i b) = test s c := by + unfold test + congr 1 + apply propext + constructor <;> intro h j hj + · have hjn : j ≠ i := by intro he; subst j; exact hi hj + simpa only [Function.update_of_ne hjn] using h j hj + · rw [Function.update_of_ne (show j ≠ i by intro he; subst j; exact hi hj)] + exact h j hj + +lemma test_insert (s : Finset I) (i : I) (c : I → Bool) : + test (insert i s) c = (if c i then 1 else 0)*test s c := by + simp only [test,Finset.forall_mem_insert] + split_ifs <;> simp_all + +theorem factorial_bound (p : I → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) {κ : ℝ} (hκ : 1 ≤ κ) + (W : (I → Bool) → ℝ) (hW : ∀ c, 0 ≤ W c) + (hins : ∀ c i, W (Function.update c i true) ≤ κ*W (Function.update c i false)) + (s : Finset I) : + (∑ c, weight p c*(W c*test s c)) ≤ (∏ i ∈ s, κ*p i) * ∑ c, weight p c*W c := by + induction s using Finset.induction_on with + | empty => simp [test] + | @insert i s hi ih => + rw [Finset.prod_insert hi] + have hc := one_coin p hp hκ W (test s) i hW (test_nonneg s) + (fun c => hins c i) (fun c => by rw [test_update hi,test_update hi]) + have he : (∑ c, weight p c*(W c*test (insert i s) c)) = + ∑ c, weight p c*((if c i then W c else 0)*test s c) := by + apply Finset.sum_congr rfl + intro c _ + rw [test_insert] + cases c i <;> simp + rw [he] + exact hc.trans (by + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left ih (mul_nonneg (by linarith) (hp i).1)) + +theorem factorial_bound_rates (p κ : I → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hκ : ∀ i,1 ≤ κ i) (W : (I → Bool) → ℝ) (hW : ∀ c, 0 ≤ W c) + (hins : ∀ c i, W (Function.update c i true) ≤ κ i*W (Function.update c i false)) + (s : Finset I) : + (∑ c, weight p c*(W c*test s c)) ≤ (∏ i ∈ s, κ i*p i) * ∑ c, weight p c*W c := by + induction s using Finset.induction_on with + | empty => simp [test] + | @insert i s hi ih => + rw [Finset.prod_insert hi] + have hc := one_coin p hp (hκ i) W (test s) i hW (test_nonneg s) + (fun c => hins c i) (fun c => by rw [test_update hi,test_update hi]) + have he : (∑ c, weight p c*(W c*test (insert i s) c)) = + ∑ c, weight p c*((if c i then W c else 0)*test s c) := by + apply Finset.sum_congr rfl + intro c _ + rw [test_insert] + cases c i <;> simp + rw [he] + exact hc.trans (by + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left ih + (mul_nonneg (by linarith [hκ i]) (hp i).1)) + +theorem polynomial_bound (p κ : I → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hκ : ∀ i,1 ≤ κ i) (W : (I → Bool) → ℝ) (hW : ∀ c, 0 ≤ W c) + (hins : ∀ c i, W (Function.update c i true) ≤ κ i*W (Function.update c i false)) + (a : Finset I → ℝ) (ha : ∀ s,0 ≤ a s) : + (∑ c, weight p c * W c * (∑ s, a s*test s c)) ≤ + (∑ s, a s*(∏ i ∈ s, κ i*p i)) * ∑ c,weight p c*W c := by + simp only [Finset.mul_sum,Finset.sum_mul] + rw [Finset.sum_comm,Finset.sum_comm (f := fun x => fun i => (a i * ∏ j ∈ i, κ j * p j) * (weight p x * W x))] + apply Finset.sum_le_sum + intro s _ + have hh := mul_le_mul_of_nonneg_left (factorial_bound_rates p κ hp hκ W hW hins s) (ha s) + simpa only [Finset.mul_sum,Finset.sum_mul,mul_assoc,mul_left_comm] using hh + +lemma test_eq_prod (s : Finset I) (c : I → Bool) : + test s c = ∏ i ∈ s, if c i then (1:ℝ) else 0 := by + induction s using Finset.induction_on with + | empty => simp [test] + | @insert i s hi ih => rw [test_insert,Finset.prod_insert hi,ih] + +lemma weight_test_sum (p : I → ℝ) (s : Finset I) : + (∑ c,weight p c*test s c) = ∏ i ∈ s,p i := by + have he (c : I → Bool) : weight p c*test s c = + ∏ i, if c i then p i else if i ∈ s then 0 else 1-p i := by + rw [test_eq_prod] + have ht : (∏ i ∈ s, if c i then (1:ℝ) else 0) = ∏ i,if i ∈ s then (if c i then (1:ℝ) else 0) else 1 := by + simp only [Finset.prod_ite_mem,Finset.univ_inter] + rw [ht,weight,←Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + by_cases hi : i ∈ s <;> cases c i <;> simp [hi] + simp_rw [he] + rw [←Fintype.prod_sum (fun i (b : Bool) => if b then p i else if i ∈ s then 0 else 1-p i)] + simp only [Fintype.sum_bool,Bool.false_eq_true,↓reduceIte] + have he : (fun i => p i + if i ∈ s then (0:ℝ) else 1-p i) = fun i => if i ∈ s then p i else 1 := by + funext i + split_ifs <;> ring + rw [he] + simp only [Finset.prod_ite_mem,Finset.univ_inter] + +end Heisenberg.Bernoulli +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/FiniteAverage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..9151eea70bd0180421efcbbb241cd07d328d3eb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteAverage.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinBulk + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Average +variable {X E : Type*} [DecidableEq X] [NormedAddCommGroup E] + +lemma norm_sum_sub_le (Λ Ξ : Finset X) (f : X → E) (C : ℝ) + (hf : ∀ x,‖f x‖≤C) : + ‖∑ x∈Λ,f x-∑ x∈Ξ,f x‖≤((Λ\Ξ).card+(Ξ\Λ).card:ℝ)*C := by + rw [←Finset.sum_sdiff_sub_sum_sdiff] + calc _ ≤ ‖∑ x∈Λ\Ξ,f x‖+‖∑ x∈Ξ\Λ,f x‖ := norm_sub_le _ _ + _ ≤ (∑ _∈Λ\Ξ,C)+(∑ _∈Ξ\Λ,C) := add_le_add + ((norm_sum_le _ _).trans (Finset.sum_le_sum (fun x _=>hf x))) + ((norm_sum_le _ _).trans (Finset.sum_le_sum (fun x _=>hf x))) + _ = _ := by simp only [Finset.sum_const,nsmul_eq_mul,add_mul] + +lemma norm_sum_bulk_le (Λ F : Finset X) (hF : F⊆Λ) (f : X → E) (δ C : ℝ) + (hgood : ∀ x∈F,‖f x‖≤δ) (hall : ∀ x∈Λ,‖f x‖≤C) : + ‖∑ x∈Λ,f x‖≤(F.card:ℝ)*δ+((Λ\F).card:ℝ)*C := by + rw [←Finset.sum_sdiff hF] + calc _ ≤ ‖∑ x∈Λ\F,f x‖+‖∑ x∈F,f x‖ := norm_add_le _ _ + _ ≤ (∑ _∈Λ\F,C)+(∑ _∈F,δ) := add_le_add + ((norm_sum_le _ _).trans (Finset.sum_le_sum (fun x hx=>hall x (Finset.mem_sdiff.mp hx).1))) + ((norm_sum_le _ _).trans (Finset.sum_le_sum hgood)) + _ = _ := by simp only [Finset.sum_const,nsmul_eq_mul]; ring + +lemma norm_uniform_bulk_le (Λ F : Finset X) (hΛ : Λ.Nonempty) (hF : F⊆Λ) + (f : X → ℂ) {δ C : ℝ} (hδ : 0≤δ) + (hgood : ∀ x∈F,‖f x‖≤δ) (hall : ∀ x∈Λ,‖f x‖≤C) : + ‖(Λ.card:ℂ)⁻¹*∑ x∈Λ,f x‖≤δ+(((Λ\F).card:ℝ)/(Λ.card:ℝ))*C := by + have hp : (0:ℝ)<Λ.card := by exact_mod_cast Finset.card_pos.mpr hΛ + rw [norm_mul,norm_inv,Complex.norm_natCast] + calc _ ≤ (Λ.card:ℝ)⁻¹*((F.card:ℝ)*δ+((Λ\F).card:ℝ)*C) := + mul_le_mul_of_nonneg_left (norm_sum_bulk_le Λ F hF f δ C hgood hall) (inv_nonneg.mpr hp.le) + _ ≤ (Λ.card:ℝ)⁻¹*((Λ.card:ℝ)*δ+((Λ\F).card:ℝ)*C) := by + gcongr + _ = _ := by field_simp + +end Heisenberg.Average +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/FiniteHistories.lean b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteHistories.lean new file mode 100644 index 0000000000000000000000000000000000000000..19c64a8766e4ba1cc71ccfa5bbf855dc8972062e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteHistories.lean @@ -0,0 +1,259 @@ +import OAI.MathematicalPhysics.Heisenberg.ExchangeCycles + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical + +open scoped BigOperators Classical +namespace Heisenberg.Exposure + +section History +variable {V : Type*} + +def trajectory (τ : ℕ → Equiv.Perm V) (c : ℕ → Bool) : ℕ → Equiv.Perm V + | 0 => 1 + | n+1 => (if c n then τ n else 1) * trajectory τ c n + +@[simp] lemma trajectory_zero (τ : ℕ → Equiv.Perm V) (c : ℕ → Bool) : + trajectory τ c 0 = 1 := rfl + +@[simp] lemma trajectory_succ (τ : ℕ → Equiv.Perm V) (c : ℕ → Bool) (n : ℕ) (a : V) : + trajectory τ c (n+1) a = if c n then τ n (trajectory τ c n a) else trajectory τ c n a := by + cases hc : c n <;> simp [trajectory, hc] + +def SameHistory (τ : ℕ → Equiv.Perm V) (A : Set V) (b c : ℕ → Bool) (n : ℕ) : Prop := + ∀ t ≤ n, ∀ a ∈ A, trajectory τ b t a = trajectory τ c t a + +def Revealed (τ : ℕ → Equiv.Perm V) (A : Set V) (b : ℕ → Bool) (i : ℕ) : Prop := + ∃ a ∈ A, τ i (trajectory τ b i a) ≠ trajectory τ b i a + +theorem sameHistory_iff (τ : ℕ → Equiv.Perm V) (A : Set V) (b c : ℕ → Bool) (n : ℕ) : + SameHistory τ A b c n ↔ ∀ i < n, Revealed τ A b i → c i = b i := by + constructor + · intro h i hi hr + obtain ⟨a, ha, hne⟩ := hr + have hpre := h i (by omega) a ha + have hpost := h (i+1) (by omega) a ha + rw [trajectory_succ, trajectory_succ, ← hpre] at hpost + cases hb : b i <;> cases hc : c i + · rfl + · simp only [hb, hc, Bool.false_eq_true, ↓reduceIte] at hpost + exact (hne hpost.symm).elim + · simp only [hb, hc, Bool.false_eq_true, ↓reduceIte] at hpost + exact (hne hpost).elim + · rfl + · intro h + have ht : ∀ t, t ≤ n → ∀ a ∈ A, trajectory τ b t a = trajectory τ c t a := by + intro t + induction t with + | zero => simp + | succ t ih => + intro ht a ha + have hp := ih (by omega) a ha + rw [trajectory_succ, trajectory_succ, ← hp] + by_cases hr : Revealed τ A b t + · rw [h t (by omega) hr] + · have he : τ t (trajectory τ b t a) = trajectory τ b t a := by + by_contra hn + exact hr ⟨a,ha,hn⟩ + rw [he] + simp + exact ht + +theorem not_revealed_swap [DecidableEq V] (τ : ℕ → Equiv.Perm V) (A : Set V) + (b : ℕ → Bool) (i : ℕ) (u v : V) (huv : u ≠ v) (hτ : τ i = Equiv.swap u v) : + ¬Revealed τ A b i ↔ + (∀ a ∈ A, trajectory τ b i a ≠ u) ∧ (∀ a ∈ A, trajectory τ b i a ≠ v) := by + constructor + · intro h + constructor <;> intro a ha he + · apply h + refine ⟨a,ha,?_⟩ + rw [hτ,he,Equiv.swap_apply_left] + exact huv.symm + · apply h + refine ⟨a,ha,?_⟩ + rw [hτ,he,Equiv.swap_apply_right] + exact huv + · rintro ⟨hu,hv⟩ ⟨a,ha,hne⟩ + apply hne + rw [hτ,Equiv.swap_apply_of_ne_of_ne (hu a ha) (hv a ha)] + +end History + +variable {I B : Type*} [Fintype I] [Fintype B] + +def productWeight (w : I → B → ℝ) (c : I → B) : ℝ := ∏ i, w i (c i) + +lemma productWeight_sum (w : I → B → ℝ) (hw : ∀ i, ∑ b, w i b = 1) : + ∑ c, productWeight w c = 1 := by + classical + simp only [productWeight, ← Fintype.prod_sum, hw, Finset.prod_const_one] + +omit [Fintype B] in +lemma productWeight_nonneg (w : I → B → ℝ) (hw : ∀ i b, 0 ≤ w i b) (c : I → B) : + 0 ≤ productWeight w c := Finset.prod_nonneg fun i _ => hw i (c i) + +def merge (M : I → Prop) [DecidablePred M] (a : {i // M i} → B) (b : {i // ¬M i} → B) : I → B := + (Equiv.piEquivPiSubtypeProd M (fun _ => B)).symm (a,b) + +omit [Fintype I] [Fintype B] in +lemma merge_left (M : I → Prop) [DecidablePred M] (a : {i // M i} → B) + (b : {i // ¬M i} → B) (i : {i // M i}) : merge M a b i = a i := by + simp [merge,Equiv.piEquivPiSubtypeProd,i.property] + +omit [Fintype I] [Fintype B] in +lemma merge_right (M : I → Prop) [DecidablePred M] (a : {i // M i} → B) + (b : {i // ¬M i} → B) (i : {i // ¬M i}) : merge M a b i = b i := by + simp [merge,Equiv.piEquivPiSubtypeProd,i.property] + +omit [Fintype B] in +lemma productWeight_merge (w : I → B → ℝ) (M : I → Prop) [DecidablePred M] + (a : {i // M i} → B) (b : {i // ¬M i} → B) : + productWeight w (merge M a b) = + productWeight (fun i : {i // M i} => w i) a * + productWeight (fun i : {i // ¬M i} => w i) b := by + rw [productWeight, ← Fintype.prod_subtype_mul_prod_subtype M] + simp only [merge_left,merge_right,productWeight] + +theorem cylinder_disintegration (w : I → B → ℝ) (M : I → Prop) [DecidablePred M] + (a : {i // M i} → B) (F : (I → B) → ℝ) : + (∑ c : I → B, if (∀ i : {i // M i}, c i = a i) then productWeight w c * F c else 0) = + productWeight (fun i : {i // M i} => w i) a * + ∑ b : {i // ¬M i} → B, productWeight (fun i : {i // ¬M i} => w i) b * F (merge M a b) := by + classical + let e := Equiv.piEquivPiSubtypeProd M (fun _ => B) + rw [← e.symm.sum_comp] + rw [Fintype.sum_prod_type] + have hm (a' : {i // M i} → B) (b : {i // ¬M i} → B) : + (∀ i : {i // M i}, (e.symm (a',b)) i = a i) ↔ a' = a := by + change (∀ i : {i // M i}, merge M a' b i = a i) ↔ _ + simp only [merge_left,funext_iff] + simp only [hm] + rw [Finset.sum_eq_single a] + · simp only [ite_true] + change (∑ b, productWeight w (merge M a b) * F (merge M a b)) = _ + simp_rw [productWeight_merge] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + ring + · intro a' _ hne + simp [hne] + · simp + +theorem cylinder_mass (w : I → B → ℝ) (hw : ∀ i, ∑ b, w i b = 1) + (M : I → Prop) [DecidablePred M] (a : {i // M i} → B) : + (∑ c : I → B, if (∀ i : {i // M i}, c i = a i) then productWeight w c else 0) = + productWeight (fun i : {i // M i} => w i) a := by + classical + have h := cylinder_disintegration w M a (fun _ => 1) + simp only [mul_one] at h + simpa only [productWeight, ← Fintype.prod_sum, hw, Finset.prod_const_one, mul_one] using h + + +end Heisenberg.Exposure + +open scoped Classical + +namespace Heisenberg.LayeredExchange +variable {T V : Type*} +lemma wiring_update_swap [DecidableEq T] [DecidableEq V] + (s : Equiv.Perm T) (σ : T → Equiv.Perm V) (t : T) (u v : V) : + wiring s (Function.update σ t (Equiv.swap u v * σ t)) = + Equiv.swap (s t,u) (s t,v) * wiring s σ := by + have hc : Equiv.prodCongr s (Equiv.refl V) * Equiv.swap (t,u) (t,v) = + Equiv.swap (s t,u) (s t,v) * Equiv.prodCongr s (Equiv.refl V) := by + apply Equiv.ext + intro z + change (s (Equiv.swap (t,u) (t,v) z).1, (Equiv.swap (t,u) (t,v) z).2) = + Equiv.swap (s t,u) (s t,v) (s z.1,z.2) + by_cases hu : z = (t,u) + · subst z; simp + by_cases hv : z = (t,v) + · subst z; simp + have hu' : (s z.1,z.2) ≠ (s t,u) := by + intro he; apply hu; exact Prod.ext (s.injective (congrArg Prod.fst he)) (by simpa using congrArg (fun w : T × V => w.2) he) + have hv' : (s z.1,z.2) ≠ (s t,v) := by + intro he; apply hv; exact Prod.ext (s.injective (congrArg Prod.fst he)) (by simpa using congrArg (fun w : T × V => w.2) he) + rw [Equiv.swap_apply_of_ne_of_ne hu hv,Equiv.swap_apply_of_ne_of_ne hu' hv'] + unfold wiring + rw [fibers_update,fibers_swap,← mul_assoc,hc,mul_assoc] + +def transport (s : Equiv.Perm T) (σ : T → Equiv.Perm V) (t : T) : ℕ → Equiv.Perm V + | 0 => 1 + | n+1 => σ ((s^n) t) * transport s σ t n + +lemma wiring_pow (s : Equiv.Perm T) (σ : T → Equiv.Perm V) (t : T) (v : V) (n : ℕ) : + (wiring s σ ^ n) (t,v) = ((s^n) t, transport s σ t n v) := by + induction n with + | zero => rfl + | succ n ih => + rw [pow_succ',Equiv.Perm.mul_apply,ih,wiring_apply,pow_succ',Equiv.Perm.mul_apply] + rfl + +lemma invariant_propagates {B : Type*} (s : Equiv.Perm T) (σ : T → Equiv.Perm V) + (c : T × V → B) (hc : ∀ z, c (wiring s σ z) = c z) (t : T) (v : V) (n : ℕ) : + c ((s^n) t,transport s σ t n v) = c (t,v) := by + rw [← wiring_pow] + induction n with + | zero => rfl + | succ n ih => rw [pow_succ',Equiv.Perm.mul_apply,hc,ih] + +lemma invariant_cut {B : Type*} (s : Equiv.Perm T) (σ : T → Equiv.Perm V) + (c : T × V → B) (hc : ∀ z, c (wiring s σ z) = c z) + (t : T) (n : ℕ) (hn : (s^n) t = t) : + ∀ v, c (t,transport s σ t n v) = c (t,v) := by + intro v + simpa only [hn] using invariant_propagates s σ c hc t v n + +end Heisenberg.LayeredExchange + +namespace Heisenberg.Exposure +variable {T : Type*} [Fintype T] + +lemma filtered_cylinder_disintegration (w : T → Bool → ℝ) (M : T → Prop) [DecidablePred M] + (a : {t // M t} → Bool) (G E : (T → Bool) → Prop) + (v F : (T → Bool) → ℝ) (q : ℝ) + (hE : ∀ c, E c ↔ (∀ t : {t // M t}, c t = a t) ∧ G c) + (hv : ∀ c, E c → v c = q) : + (∑ c : T → Bool, if E c then productWeight w c * v c * F c else 0) = + q * productWeight (fun t : {t // M t} => w t) a * + ∑ c : {t // ¬M t} → Bool, if G (merge M a c) then + productWeight (fun t : {t // ¬M t} => w t) c * F (merge M a c) else 0 := by + classical + let e := Equiv.piEquivPiSubtypeProd M (fun _ => Bool) + rw [← e.symm.sum_comp,Fintype.sum_prod_type] + have he (a' : {t // M t} → Bool) (c : {t // ¬M t} → Bool) : + E (e.symm (a',c)) ↔ a' = a ∧ G (e.symm (a',c)) := by + rw [hE] + change (∀ t : {t // M t}, merge M a' c t = a t) ∧ _ ↔ _ + simp only [merge_left,funext_iff] + rw [Finset.sum_eq_single a] + · rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + change (if E (merge M a c) then productWeight w (merge M a c) * v (merge M a c) * F (merge M a c) else 0) = _ + have hh : E (merge M a c) ↔ G (merge M a c) := by + simpa only [e,merge,eq_self_iff_true,true_and] using he a c + by_cases hg : G (merge M a c) + · rw [ite_eq_left (hh.mpr hg),ite_eq_left hg,hv _ (hh.mpr hg),productWeight_merge] + ring + · rw [ite_eq_right (hh.not.mpr hg),ite_eq_right hg,mul_zero] + · intro a' _ hne + apply Finset.sum_eq_zero + intro c _ + exact ite_eq_right (fun h => hne ((he a' c).mp h).1) + · simp + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/FiniteTilt.lean b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteTilt.lean new file mode 100644 index 0000000000000000000000000000000000000000..389fd6204f12f9ef9f239d8a601b614b64b5a28a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/FiniteTilt.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinMatrixConservation + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Selection +variable {I : Type*} [Fintype I] + +def weightedTail (w : I → ℝ) (m : I → ℝ) (a : ℝ) : ℝ := + ∑ i,if a≤ m i then w i else 0 + +def tiltPartition (w m : I → ℝ) (b : ℝ) : ℝ := ∑ i,w i*Real.exp (b*m i) + +def tiltLowerMass (w m : I → ℝ) (b a : ℝ) : ℝ := + (∑ i,if m i simp_all + +lemma tiltPartition_pos (w m : I → ℝ) (hw : ∀ i,0≤w i) (hpos : 0<∑ i,w i) (b : ℝ) : + 0hw i) |>.mp hpos + apply Finset.sum_pos' + · intro j _; exact mul_nonneg (hw j) (Real.exp_pos _).le + · exact ⟨i,Finset.mem_univ _,mul_pos hi (Real.exp_pos _)⟩ + +lemma tilt_tail_denominator (w m : I → ℝ) (hw : ∀ i,0≤w i) {b : ℝ} (hb : 0≤b) (a : ℝ) : + Real.exp (b*a)*weightedTail w m a≤tiltPartition w m b := by + rw [weightedTail,Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + by_cases hi : a≤ m i + · rw [ite_eq_left hi] + exact (mul_comm _ _).le.trans (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hi hb)) (hw i)) + · rw [ite_eq_right hi,mul_zero] + exact mul_nonneg (hw i) (Real.exp_pos _).le + +lemma tilt_lower_numerator (w m : I → ℝ) (hw : ∀ i,0≤w i) {b : ℝ} (hb : 0≤b) (a : ℝ) : + (∑ i,if m i none + | Sum.inr r => some r + +def AllHit (π : Equiv.Perm (J ⊕ Q)) : Prop := + ∀ x, ∃ j, π.SameCycle x (Sum.inl j) + +omit [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] in +lemma cycle_hit_of_walk_none (π : Equiv.Perm (J ⊕ Q)) (n : ℕ) (q : Q) + (h : walk (restrictPerm π) n q = none) : + ∃ j, π.SameCycle (Sum.inr q) (Sum.inl j) := by + induction n generalizing q with + | zero => simp [walk] at h + | succ n ih => + cases he : π (Sum.inr q) with + | inl j => + refine ⟨j, ?_⟩ + rw [← he] + exact Equiv.Perm.SameCycle.rfl.apply_right + | inr r => + have hr : walk (restrictPerm π) n r = none := by simpa [walk, restrictPerm, he] using h + obtain ⟨j, hj⟩ := ih r hr + refine ⟨j, ?_⟩ + rw [← he] at hj + exact hj.of_apply_left + +omit [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] in +lemma escapes_of_pow_hit (π : Equiv.Perm (J ⊕ Q)) (n : ℕ) (q : Q) (j : J) + (h : (π ^ n) (Sum.inr q) = Sum.inl j) : Escapes (restrictPerm π) q := by + induction n generalizing q with + | zero => simp at h + | succ n ih => + cases he : π (Sum.inr q) with + | inl k => exact escapes_of_none (by simp [restrictPerm, he]) + | inr r => + have hr : restrictPerm π q = some r := by simp [restrictPerm, he] + apply (escapes_iff_of_some hr).mpr + apply ih r + simpa [pow_succ, Equiv.Perm.mul_apply, he] using h + +omit [DecidableEq J] [DecidableEq Q] in +lemma escapes_restrictPerm_iff (π : Equiv.Perm (J ⊕ Q)) (q : Q) : + Escapes (restrictPerm π) q ↔ ∃ j, π.SameCycle (Sum.inr q) (Sum.inl j) := by + constructor + · rintro ⟨n, hn⟩ + exact cycle_hit_of_walk_none π n q hn + · rintro ⟨j, hj⟩ + obtain ⟨n, hn⟩ := hj.exists_nat_pow_eq + exact escapes_of_pow_hit π n q j hn + +omit [DecidableEq J] [DecidableEq Q] in +lemma allHit_iff_escapes (π : Equiv.Perm (J ⊕ Q)) : + AllHit π ↔ ∀ q, Escapes (restrictPerm π) q := by + constructor + · intro h q + exact (escapes_restrictPerm_iff π q).mpr (h (Sum.inr q)) + · intro h x + cases x with + | inl j => exact ⟨j, Equiv.Perm.SameCycle.rfl⟩ + | inr q => exact (escapes_restrictPerm_iff π q).mp (h q) + +def columnPerm (π : Equiv.Perm (J ⊕ Q)) : Matrix (J ⊕ Q) (J ⊕ Q) R := + (π.permMatrix R).transpose + +omit [Fintype J] [Fintype Q] in +lemma columnPerm_QQ (π : Equiv.Perm (J ⊕ Q)) : + (columnPerm R π).submatrix Sum.inr Sum.inr = (partialMatrix R (restrictPerm π)).transpose := by + ext i j + simp only [columnPerm, Matrix.submatrix_apply, Matrix.transpose_apply, + Equiv.Perm.permMatrix, PEquiv.toMatrix_apply, Equiv.toPEquiv_apply, + partialMatrix] + have heq : (Sum.inr i ∈ some (π (Sum.inr j))) ↔ restrictPerm π j = some i := by + simp only [Option.mem_some_iff] + unfold restrictPerm + cases π (Sum.inr j) <;> simp [eq_comm] + simp only [heq] + +theorem det_one_sub_columnPerm_QQ (π : Equiv.Perm (J ⊕ Q)) : + (1 - (columnPerm R π).submatrix Sum.inr Sum.inr).det = if AllHit π then 1 else 0 := by + rw [columnPerm_QQ, ← Matrix.transpose_one, ← Matrix.transpose_sub, Matrix.det_transpose, + det_one_sub_partialMatrix] + simp only [← allHit_iff_escapes] + +def pinTestMatrix (W : Matrix J J R) : Matrix (J ⊕ Q) (J ⊕ Q) R := + Matrix.fromBlocks W 0 0 1 + +theorem det_pinTest_of_not_allHit (π : Equiv.Perm (J ⊕ Q)) (W : Matrix J J R) + (h : ¬ AllHit π) : (1 - pinTestMatrix R (Q := Q) W * columnPerm R π).det = 0 := by + obtain ⟨x, hx⟩ : ∃ x, ∀ j, ¬ π.SameCycle x (Sum.inl j) := by + simpa only [AllHit, not_forall, not_exists] using h + let v : (J ⊕ Q) → R := fun y => if π.SameCycle x y then 1 else 0 + have hv : columnPerm R π *ᵥ v = v := by + rw [columnPerm, Matrix.transpose_permMatrix, Matrix.permMatrix_mulVec] + ext y + simp [v] + have hvJ : v ∘ Sum.inl = 0 := by + ext j + simp [v, hx j] + have hd : pinTestMatrix R (Q := Q) W *ᵥ v = v := by + rw [pinTestMatrix, Matrix.fromBlocks_mulVec, hvJ] + simp only [Matrix.mulVec_zero, Matrix.zero_mulVec, add_zero, zero_add, Matrix.one_mulVec] + ext y + cases y with + | inl j => simpa [Function.comp_def] using (congrFun hvJ j).symm + | inr q => rfl + have hz : (1 - pinTestMatrix R (Q := Q) W * columnPerm R π) *ᵥ v = 0 := by + rw [Matrix.sub_mulVec, Matrix.one_mulVec, ← Matrix.mulVec_mulVec, hv, hd, sub_self] + by_contra hne + have hv0 := Matrix.eq_zero_of_mulVec_eq_zero hne hz + have := congrFun hv0 x + simp [v, Equiv.Perm.SameCycle.rfl] at this + +end + +section +variable {J Q : Type*} [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] +variable (R : Type*) [Field R] + +def hittingResolvent (K : Matrix (J ⊕ Q) (J ⊕ Q) R) : Matrix J J R := + K.toBlocks₁₁ + K.toBlocks₁₂ * (1 - K.toBlocks₂₂)⁻¹ * K.toBlocks₂₁ + +lemma pinTest_block_form (K : Matrix (J ⊕ Q) (J ⊕ Q) R) (W : Matrix J J R) : + 1 - pinTestMatrix R (Q := Q) W * K = + Matrix.fromBlocks (1 - W * K.toBlocks₁₁) (-(W * K.toBlocks₁₂)) + (-K.toBlocks₂₁) (1 - K.toBlocks₂₂) := by + have hk : pinTestMatrix R (Q := Q) W * K = + Matrix.fromBlocks (W * K.toBlocks₁₁) (W * K.toBlocks₁₂) + K.toBlocks₂₁ K.toBlocks₂₂ := by + conv_lhs => arg 2; rw [← Matrix.fromBlocks_toBlocks K] + simp [pinTestMatrix, Matrix.fromBlocks_multiply] + rw [hk] + ext (i | i) (j | j) <;> simp [Matrix.one_apply, Matrix.fromBlocks] + +theorem det_pinTest_schur (K : Matrix (J ⊕ Q) (J ⊕ Q) R) (W : Matrix J J R) + (hK : (1 - K.toBlocks₂₂).det ≠ 0) : + (1 - pinTestMatrix R (Q := Q) W * K).det = + (1 - K.toBlocks₂₂).det * (1 - W * hittingResolvent R K).det := by + let _ : Invertible (1 - K.toBlocks₂₂) := + Matrix.invertibleOfIsUnitDet _ (isUnit_iff_ne_zero.mpr hK) + rw [pinTest_block_form, Matrix.det_fromBlocks₂₂, Matrix.invOf_eq_nonsing_inv] + congr 2 + simp only [hittingResolvent, Matrix.mul_add, Matrix.mul_neg, Matrix.neg_mul, neg_neg, + Matrix.mul_assoc, sub_sub] + +theorem det_pinTest_zero (K : Matrix (J ⊕ Q) (J ⊕ Q) R) : + (1 - pinTestMatrix R (Q := Q) 0 * K).det = (1 - K.toBlocks₂₂).det := by + rw [pinTest_block_form] + simp only [Matrix.zero_mul, sub_zero, neg_zero] + rw [Matrix.det_fromBlocks_zero₁₂, Matrix.det_one, one_mul] + +theorem det_pinTest_allHit (π : Equiv.Perm (J ⊕ Q)) (W : Matrix J J R) + (h : AllHit π) : + (1 - pinTestMatrix R (Q := Q) W * columnPerm R π).det = + (1 - W * hittingResolvent R (columnPerm R π)).det := by + have he : (1 - (columnPerm R π).toBlocks₂₂).det = 1 := by + simpa only [Matrix.toBlocks₂₂, Matrix.submatrix, ite_eq_left h] using det_one_sub_columnPerm_QQ R π + rw [det_pinTest_schur R _ _ (by rw [he]; exact one_ne_zero), he, one_mul] + +end + +section + +variable {J Q Ω : Type*} [Fintype J] [Fintype Q] [Fintype Ω] + [DecidableEq J] [DecidableEq Q] +variable {R : Type*} [Field R] + +def hitWeight (μ : Ω → R) (π : Ω → Equiv.Perm (J ⊕ Q)) : R := + ∑ ω, if AllHit (π ω) then μ ω else 0 + +theorem allHit_determinant (μ : Ω → R) (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) : + hitWeight μ π = (1 - (∑ ω, μ ω • columnPerm R (π ω)).toBlocks₂₂).det := by + have ht := h (pinTestMatrix R (Q := Q) (0 : Matrix J J R)) + rw [det_pinTest_zero] at ht + convert ht using 1 + apply Finset.sum_congr rfl + intro ω _ + rw [det_pinTest_zero] + have he := det_one_sub_columnPerm_QQ R (π ω) + simp only [Matrix.toBlocks₂₂, Matrix.submatrix] at he ⊢ + rw [he] + by_cases hh : AllHit (π ω) <;> simp [hh] + +theorem allHit_determinant_before_division (μ : Ω → R) + (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) (W : Matrix J J R) : + (∑ ω, if AllHit (π ω) then μ ω * (1 - W * hittingResolvent R (columnPerm R (π ω))).det + else 0) = (1 - pinTestMatrix R (Q := Q) W * ∑ ω, μ ω • columnPerm R (π ω)).det := by + rw [← h] + apply Finset.sum_congr rfl + intro ω _ + by_cases hh : AllHit (π ω) + · rw [ite_eq_left hh, det_pinTest_allHit R _ _ hh] + · rw [ite_eq_right hh, det_pinTest_of_not_allHit R _ _ hh, mul_zero] + +theorem conditional_resolvent_determinant (μ : Ω → R) + (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm R (π ω))) + (hg : hitWeight μ π ≠ 0) (W : Matrix J J R) : + (∑ ω, if AllHit (π ω) then (μ ω / hitWeight μ π) * + (1 - W * hittingResolvent R (columnPerm R (π ω))).det else 0) = + (1 - W * hittingResolvent R (∑ ω, μ ω • columnPerm R (π ω))).det := by + have he := allHit_determinant μ π h + have hk : (1 - (∑ ω, μ ω • columnPerm R (π ω)).toBlocks₂₂).det ≠ 0 := he ▸ hg + have ht := allHit_determinant_before_division μ π h W + rw [det_pinTest_schur R _ _ hk, ← he] at ht + calc + _ = (∑ ω, if AllHit (π ω) then μ ω * + (1 - W * hittingResolvent R (columnPerm R (π ω))).det else 0) / hitWeight μ π := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> simp [div_mul_eq_mul_div] + _ = _ := by rw [ht, mul_div_cancel_left₀ _ hg] + +end + +variable {J : Type*} [Fintype J] [DecidableEq J] +variable {R : Type*} [CommRing R] + +lemma det_one_sub_single_mul (A : Matrix J J R) (i j : J) : + (1 - Matrix.single i j (1 : R) * A).det = 1 - A j i := by + let U : Matrix J Unit R := fun k _ => if k = i then 1 else 0 + let V : Matrix Unit J R := fun _ k => A j k + have hm : Matrix.single i j (1 : R) * A = U * V := by + ext k l + rw [Matrix.mul_apply, Matrix.mul_apply] + by_cases hk : k = i + · subst k + simp [U, V, Matrix.single_apply] + · simp [U, V, hk, Ne.symm hk] + rw [hm, Matrix.det_one_sub_mul_comm, Matrix.det_unique] + simp only [Matrix.sub_apply, Matrix.one_apply_eq, Matrix.mul_apply] + simp [U, V] + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/FlowCongestion.lean b/lean/OAI/MathematicalPhysics/Heisenberg/FlowCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..9fbaa58180fc0aee6acc04f42e6c0d36c33112b0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/FlowCongestion.lean @@ -0,0 +1,281 @@ +import OAI.MathematicalPhysics.Heisenberg.FlowRouting + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical + +namespace Heisenberg.Flow + +section +open Heisenberg.Geometry Heisenberg.RoutedFlow +variable {k : ℕ} + +lemma path_current_decay {Z : Set (ZSite k)} {y a : ZSite k} + (p : (latticeGraph Zᶜ).Walk y a) (hp : p.IsTrail) {L q : ℝ} + (hL : 0 ≤ L) (hq : 0 ≤ q) (hnear : ∀ z ∈ p.support, dist z y ≤ L) + (t : (latticeGraph Zᶜ).Dart) : + |pathCurrent p t| ≤ (1+L)^q*(1+dist t.fst y)^(-q) := by + by_cases ht : pathCurrent p t = 0 + · rw [ht,abs_zero]; positivity + have hz := hnear t.fst (p.dart_fst_mem_support_of_mem_darts ((pathCurrent_ne_zero_iff p t).mp ht)) + have hpos : 0 < 1+dist t.fst y := by positivity + have hb := Real.rpow_le_rpow (by positivity : 0 ≤ 1+dist t.fst y) (by linarith : 1+dist t.fst y ≤ 1+L) hq + have hpow : 0 < (1+dist t.fst y)^q := Real.rpow_pos_of_pos hpos _ + have hh : 1 ≤ (1+L)^q*(1+dist t.fst y)^(-q) := by + rw [Real.rpow_neg hpos.le,mul_comm,← div_eq_inv_mul] + exact (one_le_div hpow).mpr hb + exact (pathCurrent_abs_le_one p hp t).trans hh + +theorem connected_envelope (hk : 1 ≤ k) (ν C : ℝ) (hν0 : 0 ≤ ν) (hν1 : ν < 1) + (hq : 0 ≤ (k:ℝ)-(k+1:ℝ)*ν) (hC : 0 ≤ C) : + ∃ M : ℕ, ∃ B ≥ 0, ∀ (Z : Set (ZSite k)) (_hZ : Z.Finite) (y : ZSite k), + y ∉ Z → ((ballFinset (k+1) M y).filter (· ∈ Z)).card < 2*(k+1) → + (∀ z ∈ Z, ∀ w ∈ LatticeComponents.Component Z z, dist z w ≤ C*(1+dist z y)^ν) → + ∃ J : (latticeGraph Zᶜ).Dart → ℝ, + (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).UnitFlow J y ∧ + ∀ t, |J t| ≤ B*(1+dist t.fst y)^((k+1:ℝ)*ν-k) := by + obtain ⟨B,hB,D,hD,hflow⟩ := routed_envelope hk ν C hν0 hν1 hC + let K : ℕ := ⌈D⌉₊ + have hK : 1 ≤ K := by + have hD' : (1:ℝ) ≤ (K:ℝ) := hD.trans (Nat.le_ceil _) + exact_mod_cast hD' + let M := K+2*(k+1) + let q := (k:ℝ)-(k+1:ℝ)*ν + let B' := B+(1+(M:ℝ))^q + have hB' : 0 ≤ B' := add_nonneg hB (Real.rpow_nonneg (by positivity) _) + refine ⟨M,B',hB',?_⟩ + intro Z hZ y hy hcount hcomp + obtain ⟨a,ha,hay,J,hunit,hJ⟩ := hflow Z hZ y hcomp + have haB : a ∈ Ball (K:ℤ) y := (dist_le_iff_mem_ball ..).mp (hay.trans (Nat.le_ceil _)) + obtain ⟨p,hp,_hlen⟩ := local_connectivity (by omega : 2 ≤ k+1) K hK y a Z haB hy ha hcount + let hom : latticeGraph (Ball (M:ℤ) y \ Z) →g latticeGraph Zᶜ := + { toFun := id + map_rel' := fun h => ⟨h.1,h.2.1.2,h.2.2.2⟩ } + let P := p.map hom + have hP : P.IsTrail := (hp.map (by exact Function.injective_id)).isTrail + have hnear : ∀ z ∈ P.support, dist z y ≤ (M:ℝ) := by + intro z hz + have hzp : z ∈ p.support := by + change z ∈ (p.map hom).support at hz + rw [SimpleGraph.Walk.support_map,List.mem_map] at hz + obtain ⟨z',hz',heq⟩ := hz + change z' = z at heq + exact heq ▸ hz' + have hyU : y ∈ Ball ((K:ℤ)+2*(k+1:ℕ)) y \ Z := ⟨by intro j; simp; positivity,hy⟩ + have hzU := path_support_mem _ _ _ hyU p z hzp + have hzB : z ∈ Ball (M:ℤ) y := by simpa only [M,Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat] using hzU.1 + simpa only [dist_comm] using (dist_le_iff_mem_ball y z).mpr hzB + refine ⟨fun t => J t+pathCurrent P t,?_,?_⟩ + · intro g + change (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).pairing (J + (pathCurrent P : (latticeGraph Zᶜ).Dart → ℝ)) g = g y + rw [Network.pairing_add,hunit g,pathCurrent_pairing] + change g a+(g y-g a)=g y + ring + · intro t + have hpbound := path_current_decay P hP (by positivity : 0 ≤ (M:ℝ)) hq hnear t + have hqeq : -q = (k+1:ℝ)*ν-k := by dsimp [q]; ring + rw [hqeq] at hpbound + calc + _ ≤ |J t|+|pathCurrent P t| := abs_add_le _ _ + _ ≤ B*(1+dist t.fst y)^((k+1:ℝ)*ν-k)+(1+(M:ℝ))^q*(1+dist t.fst y)^((k+1:ℝ)*ν-k) := add_le_add (hJ t) hpbound + _ = B'*(1+dist t.fst y)^((k+1:ℝ)*ν-k) := by dsimp [B']; ring + +end + +open Heisenberg.Geometry Heisenberg.LatticeSum +variable {k : ℕ} + +def edgeCode {Z : Set (ZSite k)} (e : (latticeGraph Zᶜ).Dart) : + ↥(ballFinset (k+1) 1 0) × ZSite k := + (⟨e.snd-e.fst, by + apply (mem_ballFinset ..).mpr + apply (dist_le_iff_mem_ball ..).mp + simpa only [Nat.cast_one,dist_eq_norm,zero_sub,norm_neg] using step_dist_le_one (step_symm e.adj.1)⟩,e.fst) + +lemma edgeCode_injective (Z : Set (ZSite k)) : Function.Injective (edgeCode (Z:=Z)) := by + intro e f h + have hfst : e.fst = f.fst := congrArg Prod.snd h + have hdiff : e.snd-e.fst = f.snd-f.fst := congrArg (fun p : ↥(ballFinset (k+1) 1 0) × ZSite k => (p.1 : ZSite k)) h + have hsnd : e.snd = f.snd := by rw [hfst] at hdiff; exact sub_left_inj.mp hdiff + exact SimpleGraph.Dart.ext e f (Prod.ext hfst hsnd) + +lemma summable_graph_envelope (Z : Set (ZSite k)) (y : ZSite k) (C r : ℝ) + (hC : 0 ≤ C) (hr : r < -(k+1:ℝ)) : + Summable (fun e : (latticeGraph Zᶜ).Dart => C*(1+dist e.fst y)^r) := by + have hs := summable_radius_sub_rpow (k+1) r (by push_cast; exact hr) y + have hs' : Summable (fun e : ↥(ballFinset (k+1) 1 0) × ZSite k => + C*((radius (e.2-y):ℝ)+1)^r) := by + apply (summable_prod_of_nonneg (fun e => ?_)).mpr + · exact ⟨fun _ => hs.mul_left _, .of_finite⟩ + · exact mul_nonneg hC (Real.rpow_nonneg (by positivity) _) + have hh := hs'.comp_injective (edgeCode_injective Z) + change Summable (fun e : (latticeGraph Zᶜ).Dart => C*((radius (e.fst-y):ℝ)+1)^r) at hh + simpa only [radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using hh + +theorem graph_finite_energy {Z : Set (ZSite k)} (J : (latticeGraph Zᶜ).Dart → ℝ) + (y : ZSite k) (C q : ℝ) (hC : 0 ≤ C) (hq : (k+1:ℝ) < 2*q) + (hJ : ∀ e, |J e| ≤ C*(1+dist e.fst y)^(-q)) : Summable (fun e => J e^2) := by + have he : Summable (fun e : (latticeGraph Zᶜ).Dart => C^2*(1+dist e.fst y)^(-2*q)) := + summable_graph_envelope Z y (C^2) (-2*q) (sq_nonneg _) (by linarith) + apply Summable.of_nonneg_of_le (fun _ => sq_nonneg _) _ he + intro e + have hh := (sq_le_sq₀ (abs_nonneg (J e)) (by positivity : 0 ≤ C*(1+dist e.fst y)^(-q))).mpr (hJ e) + have hr : ((1+dist e.fst y)^(-q))^2 = (1+dist e.fst y)^(-2*q) := by + rw [← Real.rpow_natCast,← Real.rpow_mul (by positivity)] + congr 1 + ring + simpa only [sq_abs,mul_pow,hr] using hh + +end Heisenberg.Flow + +open scoped Classical BigOperators +namespace Heisenberg.FlowOverlap + +lemma weighted_half {a b H k q : ℝ} (ha : 1 ≤ a) (hb : 1 ≤ b) + (hH : 0 < H) (hq : 0 ≤ q) (hHa : H ≤ 2*a) : + H^q*(a^(-k)*b^(-k)) ≤ + (2:ℝ)^q*(a^(-2*(k-q))+b^(-2*(k-q))) := by + have ha0 : 0 < a := by linarith + have hb0 : 0 < b := by linarith + have hpow := Real.rpow_le_rpow hH.le hHa hq + rw [Real.mul_rpow (by norm_num) ha0.le] at hpow + have hbq : b^(-k) ≤ b^(-(k-q)) := Real.rpow_le_rpow_of_exponent_le hb (by linarith) + have hea : a^q*a^(-k) = a^(-(k-q)) := by + rw [←Real.rpow_add ha0] + congr 1 + ring + have hs (x : ℝ) (hx : 0 < x) : (x^(-(k-q)))^2 = x^(-2*(k-q)) := by + rw [←Real.rpow_natCast,←Real.rpow_mul hx.le] + congr 1 + ring + calc + _ ≤ ((2:ℝ)^q*a^q)*(a^(-k)*b^(-k)) := + mul_le_mul_of_nonneg_right hpow (by positivity) + _ = (2:ℝ)^q*(a^(-(k-q))*b^(-k)) := by rw [←hea]; ring + _ ≤ (2:ℝ)^q*(a^(-(k-q))*b^(-(k-q))) := by gcongr + _ ≤ (2:ℝ)^q*(a^(-2*(k-q))+b^(-2*(k-q))) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + rw [←hs a ha0,←hs b hb0] + nlinarith [sq_nonneg (a^(-(k-q))-b^(-(k-q))),sq_nonneg (a^(-(k-q))),sq_nonneg (b^(-(k-q)))] + +lemma weighted_product {a b H k q : ℝ} (ha : 1 ≤ a) (hb : 1 ≤ b) + (hH : 0 < H) (hq : 0 ≤ q) (htri : H ≤ a+b) : + a^(-k)*b^(-k) ≤ (2:ℝ)^q*H^(-q)* + (a^(-2*(k-q))+b^(-2*(k-q))) := by + have hw : H^q*(a^(-k)*b^(-k)) ≤ + (2:ℝ)^q*(a^(-2*(k-q))+b^(-2*(k-q))) := by + by_cases haH : H ≤ 2*a + · exact weighted_half ha hb hH hq haH + · have hh := weighted_half (k:=k) hb ha hH hq (show H ≤ 2*b by linarith) + simpa only [mul_comm (b^(-k)),add_comm (b^(-2*(k-q)))] using hh + have hh := mul_le_mul_of_nonneg_left hw (Real.rpow_nonneg hH.le (-q)) + have hc : H^(-q)*H^q=1 := by rw [←Real.rpow_add hH]; simp + calc + _ = H^(-q)*(H^q*(a^(-k)*b^(-k))) := by rw [←mul_assoc,hc,one_mul] + _ ≤ _ := by nlinarith [hh] + +theorem overlap_sum {E V : Type*} [PseudoMetricSpace V] + (site : E → V) (J K : E → ℝ) (y z : V) (C k q M : ℝ) + (hC : 0 ≤ C) (hq : 0 ≤ q) + (hJ : ∀ e, |J e| ≤ C*(1+dist (site e) y)^(-k)) + (hK : ∀ e, |K e| ≤ C*(1+dist (site e) z)^(-k)) + (hy : Summable (fun e => (1+dist (site e) y)^(-2*(k-q)))) + (hz : Summable (fun e => (1+dist (site e) z)^(-2*(k-q)))) + (hyM : (∑' e, (1+dist (site e) y)^(-2*(k-q))) ≤ M) + (hzM : (∑' e, (1+dist (site e) z)^(-2*(k-q))) ≤ M) : + Summable (fun e => |J e*K e|) ∧ + (∑' e, |J e*K e|) ≤ (2*C^2*(2:ℝ)^q*M)*(1+dist y z)^(-q) := by + let D := C^2*(2:ℝ)^q*(1+dist y z)^(-q) + have hD : 0 ≤ D := by dsimp [D]; positivity + have hs : Summable (fun e => D*((1+dist (site e) y)^(-2*(k-q))+ + (1+dist (site e) z)^(-2*(k-q)))) := (hy.add hz).mul_left D + have he : ∀ e, |J e*K e| ≤ D*((1+dist (site e) y)^(-2*(k-q))+ + (1+dist (site e) z)^(-2*(k-q))) := by + intro e + have ht := dist_triangle y (site e) z + rw [dist_comm y (site e)] at ht + have hp := weighted_product (k:=k) (q:=q) + (show 1 ≤ 1+dist (site e) y by linarith [dist_nonneg (x:=site e) (y:=y)]) + (show 1 ≤ 1+dist (site e) z by linarith [dist_nonneg (x:=site e) (y:=z)]) + (show 0 < 1+dist y z by positivity) hq (by linarith) + calc + _ = |J e| * |K e| := abs_mul .. + _ ≤ (C*(1+dist (site e) y)^(-k))*(C*(1+dist (site e) z)^(-k)) := + mul_le_mul (hJ e) (hK e) (abs_nonneg _) (by positivity) + _ = C^2*((1+dist (site e) y)^(-k)*(1+dist (site e) z)^(-k)) := by ring + _ ≤ C^2*((2:ℝ)^q*(1+dist y z)^(-q)* + ((1+dist (site e) y)^(-2*(k-q))+(1+dist (site e) z)^(-2*(k-q)))) := + mul_le_mul_of_nonneg_left hp (sq_nonneg C) + _ = _ := by dsimp [D]; ring + have hsum := Summable.of_nonneg_of_le (fun _ => abs_nonneg _) he hs + refine ⟨hsum,?_⟩ + calc + _ ≤ ∑' e, D*((1+dist (site e) y)^(-2*(k-q))+(1+dist (site e) z)^(-2*(k-q))) := + hsum.tsum_le_tsum he hs + _ = D*((∑' e, (1+dist (site e) y)^(-2*(k-q)))+ + (∑' e, (1+dist (site e) z)^(-2*(k-q)))) := by rw [tsum_mul_left,hy.tsum_add hz] + _ ≤ D*(M+M) := mul_le_mul_of_nonneg_left (add_le_add hyM hzM) hD + _ = _ := by dsimp [D]; ring + +end Heisenberg.FlowOverlap + +namespace Heisenberg.Flow +open Heisenberg.Geometry Heisenberg.LatticeSum +variable {k : ℕ} + +lemma uniform_graph_sum (r : ℝ) (hr : r < -(k+1:ℝ)) : + ∃ M ≥ 0, ∀ (Z : Set (ZSite k)) (y : ZSite k), + Summable (fun e : (latticeGraph Zᶜ).Dart => (1+dist e.fst y)^r) ∧ + (∑' e : (latticeGraph Zᶜ).Dart, (1+dist e.fst y)^r) ≤ M := by + let S := ∑' x : ZSite k, ((radius x:ℝ)+1)^r + let M := (Fintype.card ↥(ballFinset (k+1) 1 0):ℝ)*S + have hS : 0 ≤ S := tsum_nonneg (fun x => Real.rpow_nonneg (by positivity) _) + refine ⟨M,mul_nonneg (Nat.cast_nonneg _) hS,?_⟩ + intro Z y + have hs := summable_radius_sub_rpow (k+1) r (by push_cast; exact hr) y + have htrans : (∑' x : ZSite k, ((radius (x-y):ℝ)+1)^r) = S := + (Equiv.subRight y).tsum_eq (fun x : ZSite k => ((radius x:ℝ)+1)^r) + let F : ↥(ballFinset (k+1) 1 0) × ZSite k → ℝ := + fun e => ((radius (e.2-y):ℝ)+1)^r + have hsF : Summable F := by + apply (summable_prod_of_nonneg (fun _ => Real.rpow_nonneg (by positivity) _)).mpr + exact ⟨fun _ => hs, .of_finite⟩ + have hcomp := hsF.comp_injective (edgeCode_injective Z) + have hbound := tsum_comp_le_tsum_of_inj hsF + (fun e => Real.rpow_nonneg (by positivity : 0 ≤ (radius (e.2-y):ℝ)+1) r) (edgeCode_injective Z) + have htotal : (∑' e, F e) = M := by + rw [hsF.tsum_prod,tsum_fintype] + simp only [F,htrans,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + rfl + refine ⟨?_,?_⟩ + · simpa only [Function.comp_def,F,edgeCode,radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using hcomp + · rw [htotal] at hbound + simpa only [Function.comp_def,F,edgeCode,radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using hbound + +theorem graph_overlap_uniform (κ q C : ℝ) (hC : 0 ≤ C) (hq : 0 ≤ q) + (hexp : (k+1:ℝ) < 2*(κ-q)) : + ∃ B ≥ 0, ∀ (Z : Set (ZSite k)) (y z : ZSite k) + (J K : (latticeGraph Zᶜ).Dart → ℝ), + (∀ e, |J e| ≤ C*(1+dist e.fst y)^(-κ)) → + (∀ e, |K e| ≤ C*(1+dist e.fst z)^(-κ)) → + Summable (fun e => |J e*K e|) ∧ + (∑' e, |J e*K e|) ≤ B*(1+dist y z)^(-q) := by + obtain ⟨M,hM,huniform⟩ := uniform_graph_sum (k:=k) (-2*(κ-q)) (by linarith) + refine ⟨2*C^2*(2:ℝ)^q*M,by positivity,?_⟩ + intro Z y z J K hJ hK + exact Heisenberg.FlowOverlap.overlap_sum (fun e : (latticeGraph Zᶜ).Dart => e.fst) J K y z C κ q M hC hq + hJ hK (huniform Z y).1 (huniform Z z).1 (huniform Z y).2 (huniform Z z).2 + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/FlowRouting.lean b/lean/OAI/MathematicalPhysics/Heisenberg/FlowRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..717677bcdfa9cf4dae77c72d07b2105a9d523dad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/FlowRouting.lean @@ -0,0 +1,278 @@ +import OAI.MathematicalPhysics.Heisenberg.LatticeFlows + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical + +namespace Heisenberg.Flow + +theorem lattice_flow_finite_energy {k : ℕ} (hk : 2 ≤ k) : + Summable (fun e : Fin (k + 1) × ZSite k => latticeFlow e.2 e.1 ^ 2) := by + apply Heisenberg.LatticeSum.finite_energy_of_envelope + (fun e => latticeFlow e.2 e.1) 0 (k.factorial : ℝ) (k : ℝ) (by positivity) + · have hk' : (2 : ℝ) ≤ k := by exact_mod_cast hk + push_cast + linarith + · intro e + have h := lattice_flow_envelope e.2 e.1 + simp only [sub_zero] + change |latticeFlow e.2 e.1| ≤ (k.factorial : ℝ) * + ((radius e.2 : ℝ) + 1) ^ (-(k : ℝ)) + rw [Real.rpow_neg (by positivity : 0 ≤ (radius e.2 : ℝ) + 1), + Real.rpow_natCast] + simpa only [div_eq_mul_inv] using h + +open RoutedFlow +variable {k : ℕ} + +def next (x : ZSite k) (j : Fin (k+1)) : ZSite k := Function.update x j (x j+1) + +@[simp] lemma next_down (x : ZSite k) (j : Fin (k+1)) : next (down x j) j = x := by + ext i + by_cases hi : i=j <;> simp [next,down,hi] + +@[simp] lemma down_next (x : ZSite k) (j : Fin (k+1)) : down (next x j) j = x := by + ext i + by_cases hi : i=j <;> simp [next,down,hi] + +lemma next_ne (x : ZSite k) (j : Fin (k+1)) : next x j ≠ x := by + intro h + have hj := congrFun h j + simp [next] at hj + +lemma down_ne (x : ZSite k) (j : Fin (k+1)) : down x j ≠ x := by + intro h + have hj := congrFun h j + simp [down] at hj + +def latticeNetwork (k : ℕ) : Network (ZSite k) (ZSite k × Fin (k+1)) where + src e := e.1 + dst e := next e.1 e.2 + incidentFinite v := by + apply ((Set.finite_range (fun j : Fin (k+1) => (v,j))).union + (Set.finite_range (fun j : Fin (k+1) => (down v j,j)))).subset + rintro ⟨x,j⟩ (h|h) + · change x = v at h + exact Or.inl ⟨j,by rw [h]⟩ + · change next x j = v at h + exact Or.inr ⟨j,by dsimp; rw [← h,down_next]⟩ + +lemma incident_set (v : ZSite k) : + ((latticeNetwork k).incidentFinite v).toFinset = + (Finset.univ.image (fun j => (v,j))) ∪ (Finset.univ.image (fun j => (down v j,j))) := by + ext ⟨x,j⟩ + simp only [Set.Finite.mem_toFinset,Set.mem_ofPred_eq,latticeNetwork,Finset.mem_union, + Finset.mem_image,Finset.mem_univ,true_and,Prod.mk.injEq] + constructor + · rintro (h|h) + · exact Or.inl ⟨j,h.symm,rfl⟩ + · exact Or.inr ⟨j,by rw [← h,down_next],rfl⟩ + · rintro (⟨i,h,rfl⟩|⟨i,h,rfl⟩) + · exact Or.inl h.symm + · exact Or.inr (by rw [← h,next_down]) + +lemma incident_disjoint (v : ZSite k) : + Disjoint (Finset.univ.image (fun j : Fin (k+1) => (v,j))) + (Finset.univ.image (fun j : Fin (k+1) => (down v j,j))) := by + apply Finset.disjoint_left.mpr + intro e he hf + obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp he + obtain ⟨j,_,hj⟩ := Finset.mem_image.mp hf + have hji := congrArg Prod.snd hj + change j = i at hji + subst j + exact down_ne v i (congrArg Prod.fst hj) + +lemma latticeNetwork_divergence (F : ZSite k × Fin (k+1) → ℝ) (v : ZSite k) : + (latticeNetwork k).divergence F v = + (∑ j, F (v,j)) - ∑ j, F (down v j,j) := by + rw [Network.divergence,incident_set,Finset.sum_union (incident_disjoint v)] + rw [Finset.sum_image (by intro i _ j _ h; exact congrArg Prod.snd h), + Finset.sum_image (by intro i _ j _ h; exact congrArg Prod.snd h)] + simp [Network.boundary,latticeNetwork,next_ne,down_ne,sub_eq_add_neg] + +theorem latticeNetwork_unit : + (latticeNetwork k).UnitFlow (fun e => latticeFlow e.1 e.2) 0 := by + apply Network.unit_of_divergence + intro v + rw [latticeNetwork_divergence] + by_cases hv : v = 0 <;> simpa [hv] using lattice_divergence v + +end Heisenberg.Flow + +namespace Heisenberg.Geometry +lemma lattice_neighbor_finite {d : ℕ} (U : Set (Site d)) (v : Site d) : + ((latticeGraph U).neighborSet v).Finite := by + apply (ballFinset d 1 v).finite_toSet.subset + intro z hz + apply (mem_ballFinset ..).mpr + apply (dist_le_iff_mem_ball v z).mp + simpa only [Nat.cast_one] using step_dist_le_one hz.1 +end Heisenberg.Geometry + +namespace Heisenberg.Flow + +section +open Heisenberg.Geometry Heisenberg.HullRouting Heisenberg.RoutedFlow +variable {k : ℕ} + +lemma next_step (x : ZSite k) (j : Fin (k+1)) : Step x (next x j) := by + refine ⟨j,Or.inl ?_,?_⟩ + · simp [next] + · intro i hi + simp [next,hi] + +lemma down_sub (x y : ZSite k) (j : Fin (k+1)) : down x j-y = down (x-y) j := by + ext i + by_cases hi : i=j <;> simp [down,hi] + omega + +lemma translated_unit (y : ZSite k) : + (latticeNetwork k).UnitFlow (fun e => latticeFlow (e.1-y) e.2) y := by + apply Network.unit_of_divergence + intro v + rw [latticeNetwork_divergence] + simp_rw [down_sub] + have h := lattice_divergence (v-y) + by_cases hv : v = y <;> simpa [sub_eq_zero,hv] using h + +theorem routed_lattice (hk : 1 ≤ k) (ν C : ℝ) (hν0 : 0 ≤ ν) (hν1 : ν < 1) (hC : 0 ≤ C) : + ∃ A ≥ 0, ∃ K ≥ 1, ∃ D ≥ 1, ∀ (Z : Set (ZSite k)) (_hZ : Z.Finite) (y : ZSite k), + (∀ z ∈ Z, ∀ w ∈ LatticeComponents.Component Z z, dist z w ≤ C*(1+dist z y)^ν) → + ∃ ψ : ZSite k → ZSite k, + (∀ u, ψ u ∉ Z) ∧ (∀ u, dist u (ψ u) ≤ D*(1+dist u y)^ν) ∧ (∀ w, (ψ ⁻¹' {w}).Finite) ∧ + ∃ R : Routing (latticeNetwork k) (graphNetwork (latticeGraph Zᶜ) + (lattice_neighbor_finite Zᶜ)) ψ, + (∀ e t, |R.current e t| ≤ 1) ∧ + (∀ t, ((R.locallyFinite t).toFinset.card : ℝ) ≤ + (k+1:ℝ)*(2*⌈A*(1+dist t.fst y)^ν⌉₊+1)^ (k+1)) ∧ + (∀ e t, R.current e t ≠ 0 → 1+dist t.fst y ≤ K*(1+dist e.1 y)) ∧ + (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).UnitFlow + (R.push (fun e => latticeFlow (e.1-y) e.2)) (ψ y) := by + obtain ⟨D,hD,hroutes⟩ := radial_routing (d:=k+1) (by omega) ν C hν0 hν1 hC + obtain ⟨K,hK,hreverse⟩ := RoutingDecay.inverse_displacement (V:=ZSite k) hν0 hν1 (by linarith : 0≤D) + let A := D*K^ν + have hA : 0 ≤ A := by dsimp [A]; positivity + refine ⟨A,hA,K,hK,D,hD,?_⟩ + intro Z hZ y hcomp + obtain ⟨ψ,hψ,hfib,hP⟩ := hroutes Z hZ y hcomp + choose P hsimple hdisp using fun e : ZSite k × Fin (k+1) => hP e.1 (next e.1 e.2) (next_step e.1 e.2) + have hinverse (e : ZSite k × Fin (k+1)) (t : (latticeGraph Zᶜ).Dart) (ht : t ∈ (P e).darts) : + 1+dist t.fst y ≤ K*(1+dist e.1 y) ∧ dist e.1 t.fst ≤ A*(1+dist t.fst y)^ν := + hreverse y e.1 t.fst (hdisp e t.fst ((P e).dart_fst_mem_support_of_mem_darts ht)) + let B (t : (latticeGraph Zᶜ).Dart) := + (ballFinset (k+1) ⌈A*(1+dist t.fst y)^ν⌉₊ t.fst) ×ˢ (Finset.univ : Finset (Fin (k+1))) + have hB (e : ZSite k × Fin (k+1)) (t : (latticeGraph Zᶜ).Dart) (ht : t ∈ (P e).darts) : e ∈ B t := by + apply Finset.mem_product.mpr + refine ⟨(mem_ballFinset ..).mpr ((dist_le_iff_mem_ball ..).mp ?_),Finset.mem_univ _⟩ + rw [dist_comm] + exact (hinverse e t ht).2.trans (Nat.le_ceil _) + have hfin (t : (latticeGraph Zᶜ).Dart) : {e | t ∈ (P e).darts}.Finite := + (B t).finite_toSet.subset (fun e he => hB e t he) + let R := routingOfPaths (lattice_neighbor_finite Zᶜ) (latticeNetwork k) ψ P hfin + refine ⟨ψ,hψ,?_,hfib,R,?_,?_,?_,?_⟩ + · intro u + exact hdisp (u,0) (ψ u) (P (u,0)).start_mem_support + · exact routingOfPaths_abs_le_one _ _ _ _ _ (fun e => (hsimple e).isTrail) + · intro t + have hsub : (R.locallyFinite t).toFinset ⊆ B t := by + intro e he + have h : R.current e t ≠ 0 := (R.locallyFinite t).mem_toFinset.mp he + apply hB e t + exact (pathCurrent_ne_zero_iff (P e) t).mp h + have hc := Finset.card_le_card hsub + have hbcard : (B t).card = (2*⌈A*(1+dist t.fst y)^ν⌉₊+1)^(k+1)*(k+1) := by + dsimp [B] + rw [Finset.card_product,ballFinset_card,Finset.card_univ,Fintype.card_fin] + rw [hbcard] at hc + rw [mul_comm] at hc + exact_mod_cast hc + · intro e t ht + apply (hinverse e t ((pathCurrent_ne_zero_iff (P e) t).mp ht)).1 + · exact R.push_unit hfib _ _ (translated_unit y) + +end + +open Heisenberg.RoutedFlow Heisenberg.Geometry +variable {k : ℕ} + +lemma radius_eq_norm (x : ZSite k) : (radius x : ℝ) = ‖x‖ := by + apply le_antisymm + · obtain ⟨j,hj,he⟩ := Finset.exists_mem_eq_sup Finset.univ (Finset.univ_nonempty) (fun j : Fin (k+1) => (x j).natAbs) + change ((Finset.univ.sup (fun j => (x j).natAbs) : ℕ) : ℝ) ≤ ‖x‖ + rw [he] + simpa only [Int.norm_eq_abs,Nat.cast_natAbs,Int.cast_abs] using norm_le_pi_norm x j + · apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro j + have h : (x j).natAbs ≤ radius x := Finset.le_sup (f:=fun j => (x j).natAbs) (Finset.mem_univ j) + simpa only [Int.norm_eq_abs,Nat.cast_natAbs,Int.cast_abs] using (show ((x j).natAbs : ℝ) ≤ (radius x : ℝ) by exact_mod_cast h) + +lemma lattice_flow_dist_bound (x y : ZSite k) (j : Fin (k+1)) : + |latticeFlow (x-y) j| ≤ (k.factorial : ℝ) / (1+dist x y)^k := by + simpa only [radius_eq_norm,dist_eq_norm,add_comm (1:ℝ)] using lattice_flow_envelope (x-y) j + +lemma congestion_bound (d : ℕ) {A ν r : ℝ} (hA : 0 ≤ A) (hν : 0 ≤ ν) (hr : 1 ≤ r) : + (d:ℝ)*(2*⌈A*r^ν⌉₊+1)^d ≤ ((d:ℝ)*(2*A+3)^d)*r^((d:ℝ)*ν) := by + have hp : 1 ≤ r^ν := Real.one_le_rpow hr hν + have hn := Nat.ceil_lt_add_one (show 0 ≤ A*r^ν by positivity) + have hbase : 2*(⌈A*r^ν⌉₊:ℝ)+1 ≤ (2*A+3)*r^ν := by nlinarith + have hpow := pow_le_pow_left₀ (by positivity : 0 ≤ 2*(⌈A*r^ν⌉₊:ℝ)+1) hbase d + have he : ((2*A+3)*r^ν)^d = (2*A+3)^d*r^((d:ℝ)*ν) := by + rw [mul_pow] + congr 1 + rw [← Real.rpow_natCast (r^ν),← Real.rpow_mul (by linarith : 0≤r),mul_comm ν] + rw [he] at hpow + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left hpow (Nat.cast_nonneg d) + +lemma inverse_power_bound {K q r : ℝ} (_hk : 0 ≤ K) (hq : 0 < q) (hr : 0 < r) + (h : r ≤ K*q) (n : ℕ) : 1/q^n ≤ K^n/r^n := by + rw [div_le_div_iff₀ (pow_pos hq n) (pow_pos hr n),one_mul] + simpa only [mul_pow] using pow_le_pow_left₀ hr.le h n + +theorem routed_envelope (hk : 1 ≤ k) (ν C : ℝ) (hν0 : 0 ≤ ν) (hν1 : ν < 1) (hC : 0 ≤ C) : + ∃ B ≥ 0, ∃ D ≥ 1, ∀ (Z : Set (ZSite k)) (_hZ : Z.Finite) (y : ZSite k), + (∀ z ∈ Z, ∀ w ∈ LatticeComponents.Component Z z, dist z w ≤ C*(1+dist z y)^ν) → + ∃ a, a ∉ Z ∧ dist y a ≤ D ∧ ∃ J : (latticeGraph Zᶜ).Dart → ℝ, + (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).UnitFlow J a ∧ + ∀ t, |J t| ≤ B*(1+dist t.fst y)^((k+1:ℝ)*ν-k) := by + obtain ⟨A,hA,K,hK,D,hD,hroute⟩ := routed_lattice hk ν C hν0 hν1 hC + let B := ((k+1:ℝ)*(2*A+3)^(k+1))*((k.factorial:ℝ)*K^k) + have hB : 0 ≤ B := by dsimp [B]; positivity + refine ⟨B,hB,D,hD,?_⟩ + intro Z hZ y hcomp + obtain ⟨ψ,hψ,hψdist,_hfib,R,hcur,hcount,hcompare,hunit⟩ := hroute Z hZ y hcomp + refine ⟨ψ y,hψ y,by simpa using hψdist y,R.push (fun e => latticeFlow (e.1-y) e.2),hunit,?_⟩ + intro t + let r := 1+dist t.fst y + have hr : 1 ≤ r := by dsimp [r]; linarith [dist_nonneg (x:=t.fst) (y:=y)] + let F := (k.factorial:ℝ)*K^k/r^k + have hF : 0 ≤ F := by dsimp [F]; positivity + have hFe (e : ZSite k × Fin (k+1)) (he : R.current e t ≠ 0) : |latticeFlow (e.1-y) e.2| ≤ F := by + have hq : 0 < 1+dist e.1 y := by linarith [dist_nonneg (x:=e.1) (y:=y)] + have hi := inverse_power_bound (by linarith : 0≤K) hq (by linarith : 0 latticeFlow (e.1-y) e.2) t| ≤ ((R.locallyFinite t).toFinset.card:ℝ)*F := + R.abs_push_le _ t F hF hFe (fun e => hcur e t) + _ ≤ ((k+1:ℝ)*(2*⌈A*(1+dist t.fst y)^ν⌉₊+1)^(k+1))*F := mul_le_mul_of_nonneg_right (hcount t) hF + _ ≤ (((k+1:ℝ)*(2*A+3)^(k+1))*r^((k+1:ℝ)*ν))*F := + mul_le_mul_of_nonneg_right (by simpa only [Nat.cast_add,Nat.cast_one,r] using congestion_bound (k+1) hA hν0 hr) hF + _ = B*(1+dist t.fst y)^((k+1:ℝ)*ν-k) := by + dsimp [B,F,r] + rw [Real.rpow_sub (by positivity),Real.rpow_natCast] + ring + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/GibbsLimits.lean b/lean/OAI/MathematicalPhysics/Heisenberg/GibbsLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..197666e5d079f8c027bd61149c8f3c178ee7d26e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/GibbsLimits.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.Heisenberg.BoundedStrip + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators +open Filter Topology Metric +open scoped NNReal +open scoped ComplexConjugate Topology +open Set Filter Complex +open scoped Topology + +namespace Heisenberg + +open GibbsStrip + +lemma state_apply_norm_le {d ℓ : ℕ} (ω : State d ℓ) (A : QuasiLocal d ℓ) : + ‖ω.functional A‖ ≤ 4 * ‖A‖ := + (ω.functional.le_opNorm A).trans (mul_le_mul_of_nonneg_right (state_norm_bound ω) (norm_nonneg A)) + +lemma state_product_norm_le {d ℓ : ℕ} (ω : State d ℓ) (A B : QuasiLocal d ℓ) : + ‖ω.functional (A*B)‖ ≤ 4*‖A‖*‖B‖ := by + exact (state_apply_norm_le ω _).trans (by nlinarith [norm_mul_le A B]) + +theorem finite_gibbs_strip {d ℓ : ℕ} (τ : State d ℓ) + (hτ : ∀ A B, τ.functional (A*B) = τ.functional (B*A)) + {K : QuasiLocal d ℓ} (hK : IsSelfAdjoint K) {β : ℝ} (hβ : 0 < β) + (A B : QuasiLocal d ℓ) : + ∃ F : ℂ → ℂ, + DiffContOnCl ℂ F (HeisenbergStrip.openStrip β) ∧ + (∀ z ∈ HeisenbergStrip.closedStrip β, ‖F z‖ ≤ 4*‖A‖*‖B‖) ∧ + (∀ t : ℝ, F t = (gibbsState τ K β).functional (A * evolve K t B)) ∧ + (∀ t : ℝ, F ((t:ℂ)+Complex.I*β) = (gibbsState τ K β).functional (evolve K t B * A)) := by + let ω := gibbsState τ K β + let F : ℂ → ℂ := fun z => ω.functional (A*evolve K z B) + have hd : Differentiable ℂ F := ω.functional.differentiable.comp + ((evolve_differentiable K B).const_mul A) + have hu (t : ℝ) : F ((t:ℂ)+Complex.I*β) = ω.functional (evolve K t B*A) := by + change (gibbsState τ K β).functional (A*evolve K ((t:ℂ)+Complex.I*β) B) = + (gibbsState τ K β).functional (evolve K t B*A) + rw [gibbsState_apply τ hτ hK,gibbsState_apply τ hτ hK] + simpa only [gibbsDensity,Complex.ofReal_neg] using + gibbs_upper_boundary τ.functional hτ K β t ((τ.functional (gibbsDensity K β)).re : ℂ)⁻¹ A B + have hb : ∃ M : ℝ, ∀ z ∈ HeisenbergStrip.closedStrip β, ‖F z‖ ≤ M := by + obtain ⟨M,hM0,hM⟩ := strip_evolve_bounded hK B β + refine ⟨4*‖A‖*M, fun z hz => ?_⟩ + exact (state_product_norm_le ω A _).trans + (mul_le_mul_of_nonneg_left (hM z hz.1 hz.2) (by positivity)) + refine ⟨F,hd.diffContOnCl,?_, fun _ => rfl,hu⟩ + intro z hz + apply HeisenbergStrip.bounded_strip_max hβ hd.diffContOnCl hb ?_ ?_ hz + · intro w hw + have he : w = (w.re : ℂ) := by apply Complex.ext <;> simp [hw] + rw [he] + exact (state_product_norm_le ω A _).trans_eq (by rw [real_evolve_norm hK]) + · intro w hw + have he : w = (w.re:ℂ)+Complex.I*β := by apply Complex.ext <;> simp [hw] + rw [he,hu] + exact (state_product_norm_le ω _ A).trans_eq (by rw [real_evolve_norm hK]; ring) + +open Filter Topology GibbsStrip + +lemma limit_state_dynamics_locallyUniform {d ℓ : ℕ} {η : ℕ → State d ℓ} + {ω : State d ℓ} {κ : ℕ → ℕ} (hκ : StrictMono κ) + (hη : ∀ A, Tendsto (fun n => (η n).functional A) atTop (𝓝 (ω.functional A))) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (B : QuasiLocal d ℓ) : + TendstoLocallyUniformly + (fun n t => (η n).functional (M (finiteDynamics d ℓ (box d (κ n)) t B))) + (fun t => ω.functional (M (dynamics d ℓ t B))) atTop := by + have hb (n : ℕ) : ‖(η n).functional.comp M‖ ≤ 4*‖M‖ := + ((η n).functional.opNorm_comp_le M).trans + (mul_le_mul_of_nonneg_right (state_norm_bound (η n)) (norm_nonneg M)) + apply EquicontinuousLimits.locallyUniform + · exact EquicontinuousLimits.equicontinuous_apply (by positivity) hb + (fun t => (finiteDynamics_equicontinuous d ℓ B t).comp (fun n => box d (κ n))) + · intro t + exact EquicontinuousLimits.apply_varying (φ := atTop) (l := ω.functional.comp M) hb + (fun A => hη (M A)) + ((dynamics_converges d ℓ t B).comp hκ.tendsto_atTop) + +theorem gibbs_limit_KMS {d ℓ : ℕ} (τ : State d ℓ) + (hτ : ∀ A B, τ.functional (A*B) = τ.functional (B*A)) + {β : ℝ} (hβ : 0 < β) {κ : ℕ → ℕ} (hκ : StrictMono κ) + {ω : State d ℓ} + (hω : ∀ A, Tendsto + (fun n => (gibbsState τ (hamiltonian d ℓ (box d (κ n))) β).functional A) + atTop (𝓝 (ω.functional A))) : IsKMS β ω := by + refine ⟨hβ, fun A B => ?_⟩ + have hF (n : ℕ) := finite_gibbs_strip τ hτ + (hamiltonian_selfAdjoint d ℓ (box d (κ n))) hβ A B + choose F hd hb hzero htop using hF + let η : ℕ → State d ℓ := fun n => gibbsState τ (hamiltonian d ℓ (box d (κ n))) β + have hboundary₀ := limit_state_dynamics_locallyUniform hκ hω + (ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ) A) B + have hboundaryβ := limit_state_dynamics_locallyUniform hκ hω + ((ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ)).flip A) B + have he (n : ℕ) (t : ℝ) : evolve (hamiltonian d ℓ (box d (κ n))) t B = + finiteDynamics d ℓ (box d (κ n)) t B := by + simp only [evolve,finiteDynamics,mul_comm Complex.I (t:ℂ)] + have hf₀ : TendstoLocallyUniformly (fun n (t : ℝ) => F n (t:ℂ)) + (fun t => ω.functional (A*dynamics d ℓ t B)) atTop := by + simpa only [hzero,he,ContinuousLinearMap.mul_apply'] using hboundary₀ + have hfβ : TendstoLocallyUniformly (fun n (t : ℝ) => F n ((t:ℂ)+Complex.I*β)) + (fun t => ω.functional (dynamics d ℓ t B*A)) atTop := by + simpa only [htop,he,ContinuousLinearMap.flip_apply,ContinuousLinearMap.mul_apply'] using hboundaryβ + obtain ⟨f,_,hfd,hfb,hfzero,hftop⟩ := HeisenbergStrip.bounded_strip_limit + hβ (show 0 ≤ 4*‖A‖*‖B‖ by positivity) hd + (fun n => ⟨_,hb n⟩) + (fun n t => hb n t (by constructor <;> simp [hβ.le])) + (fun n t => hb n ((t:ℂ)+Complex.I*β) (by constructor <;> simp [hβ.le])) + hf₀ hfβ + refine ⟨f,?_,hfd.1,⟨_,fun z h₀ htop => hfb z ⟨h₀,htop⟩⟩,hfzero,hftop⟩ + apply hfd.2.mono + intro z hz + rw [HeisenbergStrip.closure_openStrip hβ] + exact hz + +theorem exists_KMS (d ℓ : ℕ) {β : ℝ} (hβ : 0 < β) : + ∃ ω : State d ℓ, IsKMS β ω := by + obtain ⟨τ,hτ⟩ := exists_tracial_state d ℓ + obtain ⟨ω,κ,hκ,hω⟩ := state_subsequence (fun n => gibbsState τ (hamiltonian d ℓ (box d n)) β) + exact ⟨ω,gibbs_limit_KMS τ hτ hβ hκ hω⟩ + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HistoryMarginals.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HistoryMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6f1246efc20da036998c4c35f41879b6cfc736f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HistoryMarginals.lean @@ -0,0 +1,266 @@ +import OAI.MathematicalPhysics.Heisenberg.CyclicEnergy + +namespace OAI + +noncomputable section + +open Filter Topology +open scoped RealInnerProductSpace Classical +open scoped Classical +open Filter + +open scoped BigOperators Classical + +namespace Heisenberg.Exposure +variable {I J B : Type*} [Fintype I] [Fintype J] [Fintype B] + +theorem product_marginal (w : I → B → ℝ) (hw : ∀ i,∑ b,w i b=1) + (r : J → I) (hr : Function.Injective r) (F : (J → B) → ℝ) : + (∑ c : I → B,productWeight w c*F (c ∘ r)) = + ∑ c : J → B,productWeight (fun j => w (r j)) c * F c := by + let M : I → Prop := fun i => i∈Set.range r + let e : J ≃ {i // M i} := Equiv.ofInjective r hr + let q := Equiv.piEquivPiSubtypeProd M (fun _ => B) + rw [←q.symm.sum_comp,Fintype.sum_prod_type] + have he (a : {i // M i} → B) (b : {i // ¬M i} → B) : + q.symm (a,b) ∘ r = a ∘ e := by + funext j + exact merge_left M a b (e j) + simp only [he] + change (∑ a,∑ b,productWeight w (merge M a b)*F (a ∘ e))=_ + simp_rw [productWeight_merge,mul_right_comm _ _ (F _),←Finset.mul_sum] + have hs : (∑ b : {i // ¬M i} → B, + productWeight (fun i : {i // ¬M i} => w i) b)=1 := + by simp only [productWeight, ←Fintype.prod_sum, hw, Finset.prod_const_one] + simp only [hs,mul_one] + let e' : ({i // M i} → B) ≃ (J → B) := Equiv.piCongrLeft (fun _ => B) e.symm + rw [←e'.sum_comp] + apply Finset.sum_congr rfl + intro a _ + have hf : e' a=a ∘ e := by + funext j + simp [e', Equiv.piCongrLeft_apply] + rw [hf] + congr 1 + unfold productWeight + convert (e.prod_comp (fun i => w i (a i))).symm using 1 + · congr 1 + ext j + simp + · apply Finset.prod_congr rfl + intro j _ + rfl + +end Heisenberg.Exposure + +namespace Heisenberg.Serial + +section +open Heisenberg.Exposure Heisenberg.MeshPair +variable {V B I : Type*} [Fintype V] [DecidableEq V] [Fintype B] [Fintype I] + +theorem mean_walkKernel (n : ℕ) (w : Fin n → B → ℝ) + (D : Fin (n+1) → Set V) (σ : Fin n → B → Equiv.Perm V) : + (∑ c : Fin n → B,(productWeight w c) • walkKernel n D (fun i => σ i (c i))) = + product n (fun i => ∑ b,w i b • killedBetween (D i.castSucc) (D i.succ) (σ i b)) * + projection (D 0) := by + simp only [walkKernel, ←Matrix.smul_mul, ←Finset.sum_mul] + congr 1 + exact mean_product n w (fun i b => killedBetween (D i.castSucc) (D i.succ) (σ i b)) + +theorem prefix_mean (n : ℕ) (w : I → B → ℝ) (hw : ∀ i,∑ b,w i b=1) + (r : Fin n → I) (hr : Function.Injective r) (D : Fin (n+1) → Set V) + (σ : Fin n → B → Equiv.Perm V) (x y : V) : + (∑ c : I → B,productWeight w c * walkKernel n D (fun i => σ i (c (r i))) x y) = + (product n (fun i => ∑ b,w (r i) b • killedBetween (D i.castSucc) (D i.succ) (σ i b)) * + projection (D 0)) x y := by + have h := product_marginal w hw r hr + (fun c => walkKernel n D (fun i => σ i (c i)) x y) + change (∑ c,productWeight w c * (fun c => walkKernel n D (fun i => σ i (c i)) x y) (c ∘ r)) = _ + rw [h] + have he := congrArg (fun A : Matrix V V ℝ => A x y) + (mean_walkKernel n (fun i => w (r i)) D σ) + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] at he + convert he using 1 + congr 1 + ext c + simp + +theorem prefix_endpoint_bound (n : ℕ) (w : I → B → ℝ) + (hw : ∀ i,∑ b,w i b=1) (hw0 : ∀ i b,0≤w i b) + (r : Fin n → I) (hr : Function.Injective r) (D : Fin (n+1) → Set V) + (σ : Fin n → B → Equiv.Perm V) (j : V) (A : Set V) : + (∑ i,if i∈A then + (product n (fun k => ∑ b,w (r k) b • killedBetween (D k.castSucc) (D k.succ) (σ k b)) * + projection (D 0)) i j else 0) ≤ + ∑ c : I → B,if follow n (fun k => σ k (c (r k))) j∈A then productWeight w c else 0 := by + simp_rw [←prefix_mean n w hw r hr D σ] + have hf (i : V) : (if i∈A then ∑ c,productWeight w c * walkKernel n D (fun k => σ k (c (r k))) i j else 0) = + ∑ c,productWeight w c * (if i∈A then walkKernel n D (fun k => σ k (c (r k))) i j else 0) := by + by_cases hi : i∈A <;> simp [hi] + simp only [hf] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro c _ + rw [←Finset.mul_sum] + have hn := productWeight_nonneg w hw0 c + simp only [walkKernel_apply] + by_cases hs : survives n D (fun k => σ k (c (r k))) j + · simp only [hs,ite_true] + rw [Finset.sum_eq_single (follow n (fun k => σ k (c (r k))) j)] + · by_cases ha : follow n (fun k => σ k (c (r k))) j∈A <;> simp [ha] + · intro i _ hi + simp [hi] + · simp + · simp only [hs,ite_false,ite_self,Finset.sum_const_zero,mul_zero] + split_ifs <;> positivity + +end + +open Heisenberg.Exposure +variable {V : Type*} + +lemma follow_snoc (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) (v : V) : + follow (n+1) σ v=σ (Fin.last n) (follow n (fun i=>σ i.castSucc) v) := by + induction n generalizing v with + | zero => rfl + | succ n ih => + rw [follow,ih] + rfl + +lemma follow_trajectory (τ : ℕ → Equiv.Perm V) (c : ℕ → Bool) (n : ℕ) (v : V) : + follow n (fun i => if c i then τ i else 1) v=trajectory τ c n v := by + induction n with + | zero => rfl + | succ n ih => + rw [follow_snoc] + change (if c n then τ n else 1) (follow n (fun i => if c i then τ i else 1) v) = _ + rw [ih,trajectory_succ] + split_ifs <;> rfl + +end Heisenberg.Serial + +open scoped BigOperators Classical + +open scoped BigOperators Classical +namespace Heisenberg.Clocks + +def WeakTimes (n r : ℕ) := {f : Fin r → Fin n // Monotone f} +instance (n r : ℕ) : Fintype (WeakTimes n r) := inferInstanceAs (Fintype {f : Fin r → Fin n // Monotone f}) + +def shifted {n r : ℕ} (f : WeakTimes n r) (i : Fin r) : Fin (n+r) := + ⟨(f.val i).val+i.val, by have h := (f.val i).isLt; have hi := i.isLt; omega⟩ + +lemma shifted_strictMono {n r : ℕ} (f : WeakTimes n r) : StrictMono (shifted f) := by + intro i j hij + have h := f.property hij.le + have h' : (f.val i).val ≤ (f.val j).val := h + change (f.val i).val+i.val < (f.val j).val+j.val + have hij' : i.val < j.val := hij + omega + +def timeSet {n r : ℕ} (f : WeakTimes n r) : Finset (Fin (n+r)) := + Finset.univ.image (shifted f) + +lemma timeSet_card {n r : ℕ} (f : WeakTimes n r) : (timeSet f).card = r := by + rw [timeSet,Finset.card_image_of_injective _ (shifted_strictMono f).injective] + simp + +lemma timeSet_injective {n r : ℕ} : Function.Injective (timeSet (n:=n) (r:=r)) := by + intro f g he + have hr : Set.range (shifted f) = Set.range (shifted g) := by + have hh := congrArg (fun s : Finset (Fin (n+r)) => (s : Set (Fin (n+r)))) he + simpa only [timeSet,Finset.coe_image,Finset.coe_univ,Set.image_univ] using hh + have hf := ((shifted_strictMono f).range_inj_of_wellFoundedLT (shifted_strictMono g)).mp hr + apply Subtype.ext + funext i + have hh := congrArg (fun f : Fin r → Fin (n+r) => (f i).val) hf + apply Fin.ext + change (f.val i).val+i.val = (g.val i).val+i.val at hh + omega + +theorem card_weakTimes_le (n r : ℕ) : Fintype.card (WeakTimes n r) ≤ (n+r).choose r := by + let e : WeakTimes n r → {s : Finset (Fin (n+r)) // s ∈ Finset.univ.powersetCard r} := + fun f => ⟨timeSet f,Finset.mem_powersetCard.mpr ⟨Finset.subset_univ _,timeSet_card f⟩⟩ + have he : Function.Injective e := fun f g h => timeSet_injective (congrArg Subtype.val h) + have hc := Fintype.card_le_of_injective e he + simpa only [Fintype.card_coe,Finset.card_powersetCard,Finset.card_univ,Fintype.card_fin] using hc + +lemma weakTimes_weight_bound (n r : ℕ) {δ K : ℝ} (hδ : 0 ≤ δ) (hK : 0 ≤ K) : + (Fintype.card (WeakTimes n r) : ℝ)*(K*δ)^r ≤ (K*((n:ℝ)+r)*δ)^r/(r.factorial:ℝ) := by + have hc : (Fintype.card (WeakTimes n r) : ℝ) ≤ ((n+r).choose r : ℝ) := by + exact_mod_cast card_weakTimes_le n r + have hh := hc.trans (Nat.choose_le_pow_div (α:=ℝ) r (n+r)) + have hm := mul_le_mul_of_nonneg_right hh (pow_nonneg (mul_nonneg hK hδ) r) + calc + _ ≤ ((n+r:ℕ):ℝ)^r/(r.factorial:ℝ)*(K*δ)^r := hm + _ = _ := by push_cast; rw [div_mul_eq_mul_div,← mul_pow]; congr 2; ring + +theorem chronological_bound_limit (r : ℕ) (t K : ℝ) : + Filter.Tendsto + (fun n : ℕ => (K*((n:ℝ)+r)*(t/(n:ℝ)))^r/(r.factorial:ℝ)) + Filter.atTop (nhds ((K*t)^r/(r.factorial:ℝ))) := by + have hi : Filter.Tendsto (fun n : ℕ => (n:ℝ)⁻¹) Filter.atTop (nhds 0) := + tendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop + have he : ∀ᶠ n : ℕ in Filter.atTop, + K*((n:ℝ)+r)*(t/(n:ℝ)) = K*t*(1+(r:ℝ)*(n:ℝ)⁻¹) := by + filter_upwards [Filter.eventually_gt_atTop 0] with n hn + have hnR : (n:ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hn + field_simp + apply Filter.Tendsto.congr' (he.mono (fun n h => by rw [h])) + convert ((tendsto_const_nhds.mul (tendsto_const_nhds.add (tendsto_const_nhds.mul hi))).pow r).div_const (r.factorial:ℝ) using 1; simp + +variable {X E : Type*} + +def edgeWords (choices : X → Finset E) (next : X → E → X) : ℕ → X → Finset (List E) + | 0,_ => {[]} + | r+1,x => (choices x).biUnion (fun e => (edgeWords choices next r (next x e)).image (List.cons e)) + +lemma mem_edgeWords_zero (choices : X → Finset E) (next : X → E → X) (x : X) (l : List E) : + l ∈ edgeWords choices next 0 x ↔ l=[] := by simp [edgeWords] + +lemma mem_edgeWords_cons (choices : X → Finset E) (next : X → E → X) (r : ℕ) + (x : X) (e : E) (l : List E) : + e::l ∈ edgeWords choices next (r+1) x ↔ + e ∈ choices x ∧ l ∈ edgeWords choices next r (next x e) := by + simp [edgeWords] + +lemma edgeWords_length (choices : X → Finset E) (next : X → E → X) (r : ℕ) + (x : X) {l : List E} (hl : l ∈ edgeWords choices next r x) : l.length=r := by + induction r generalizing x l with + | zero => simpa only [(mem_edgeWords_zero choices next x l).mp hl] using List.length_nil + | succ r ih => + obtain ⟨e,_he,himage⟩ := Finset.mem_biUnion.mp hl + obtain ⟨l',hl',heq⟩ := Finset.mem_image.mp himage + rw [←heq] + simpa using congrArg Nat.succ (ih (next x e) hl') + +lemma card_edgeWords (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card ≤ B) (r : ℕ) (x : X) : + (edgeWords choices next r x).card ≤ B^r := by + induction r generalizing x with + | zero => simp [edgeWords] + | succ r ih => + calc + _ ≤ ∑ e ∈ choices x, ((edgeWords choices next r (next x e)).image (List.cons e)).card := + Finset.card_biUnion_le + _ ≤ ∑ _e ∈ choices x,B^r := Finset.sum_le_sum (fun e _ => (Finset.card_image_le).trans (ih _)) + _ = (choices x).card*B^r := by simp + _ ≤ B*B^r := Nat.mul_le_mul_right _ (hB x) + _ = _ := (pow_succ' _ _).symm + +def Follows (choices : X → Finset E) (next : X → E → X) : X → List E → Prop + | _,[] => True + | x,e::l => e ∈ choices x ∧ Follows choices next (next x e) l + +lemma follows_mem (choices : X → Finset E) (next : X → E → X) (x : X) (l : List E) + (hl : Follows choices next x l) : l ∈ edgeWords choices next l.length x := by + induction l generalizing x with + | nil => simp [edgeWords] + | cons e l ih => exact (mem_edgeWords_cons choices next l.length x e l).mpr ⟨hl.1,ih _ hl.2⟩ + +end Heisenberg.Clocks + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HittingEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HittingEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe5de0f821fb3217f449a373783742c446d6d0d7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HittingEnergy.lean @@ -0,0 +1,300 @@ +import OAI.MathematicalPhysics.Heisenberg.HittingKernels + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical + +open scoped Classical +open Filter +namespace Heisenberg.Hitting + +variable {V : Type*} [Fintype V] + +structure DoublySubstochastic (U : Matrix V V ℝ) : Prop where + nonneg : ∀ i j, 0 ≤ U i j + row : ∀ i, ∑ j, U i j ≤ 1 + col : ∀ j, ∑ i, U i j ≤ 1 + +def backward (U : Matrix V V ℝ) (f : V → ℝ) (i : V) : ℝ := ∑ j, U j i * f j + +def hitStep (U : Matrix V V ℝ) (T : Finset V) (f : V → ℝ) (i : V) : ℝ := + if i ∈ T then 1 else backward U f i + +def hitIter (U : Matrix V V ℝ) (T : Finset V) : ℕ → V → ℝ + | 0 => fun i => if i ∈ T then 1 else 0 + | n + 1 => hitStep U T (hitIter U T n) + +lemma backward_mono {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + {f g : V → ℝ} (hfg : f ≤ g) : backward U f ≤ backward U g := by + intro i + apply Finset.sum_le_sum + intro j _ + exact mul_le_mul_of_nonneg_left (hfg j) (hU.nonneg j i) + +lemma backward_nonneg {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + {f : V → ℝ} (hf : 0 ≤ f) : 0 ≤ backward U f := by + intro i + exact Finset.sum_nonneg (fun j _ => mul_nonneg (hU.nonneg j i) (hf j)) + +lemma backward_le_one {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + {f : V → ℝ} (hf : f ≤ 1) : backward U f ≤ 1 := by + intro i + exact (Finset.sum_le_sum (fun j _ => + mul_le_of_le_one_right (hU.nonneg j i) (hf j))).trans (hU.col i) + +lemma hitStep_mono {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) : Monotone (hitStep U T) := by + intro f g h i + dsimp [hitStep] + split_ifs + · rfl + · exact backward_mono hU h i + +lemma hitIter_bounds {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) (n : ℕ) : 0 ≤ hitIter U T n ∧ hitIter U T n ≤ 1 := by + induction n with + | zero => constructor <;> intro i <;> simp [hitIter] <;> split_ifs <;> norm_num + | succ n ih => + constructor <;> intro i <;> dsimp [hitIter, hitStep] <;> split_ifs + · norm_num + · exact backward_nonneg hU ih.1 i + · rfl + · exact backward_le_one hU ih.2 i + +lemma hitIter_mono {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) : Monotone (hitIter U T) := by + apply monotone_nat_of_le_succ + intro n + induction n with + | zero => + intro i + dsimp [hitIter, hitStep] + split_ifs + · rfl + · exact backward_nonneg hU (hitIter_bounds hU T 0).1 i + | succ n ih => exact hitStep_mono hU T ih + +def hitting (U : Matrix V V ℝ) (T : Finset V) (i : V) : ℝ := + ⨆ n, hitIter U T n i + +lemma hitIter_bdd {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) (i : V) : BddAbove (Set.range (fun n => hitIter U T n i)) := + ⟨1, fun _ ⟨n, hn⟩ => hn ▸ (hitIter_bounds hU T n).2 i⟩ + +lemma hitIter_tendsto {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) (i : V) : + Tendsto (fun n => hitIter U T n i) atTop (nhds (hitting U T i)) := + tendsto_atTop_ciSup (fun _ _ h => hitIter_mono hU T h i) (hitIter_bdd hU T i) + +lemma hitting_bounds {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) : 0 ≤ hitting U T ∧ hitting U T ≤ 1 := by + constructor + · intro i + exact (hitIter_bounds hU T 0).1 i |>.trans (le_ciSup (hitIter_bdd hU T i) 0) + · intro i + exact ciSup_le (fun n => (hitIter_bounds hU T n).2 i) + +lemma hitting_on {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) {i : V} (hi : i ∈ T) : hitting U T i = 1 := by + apply le_antisymm ((hitting_bounds hU T).2 i) + have h := le_ciSup (hitIter_bdd hU T i) 0 + simpa only [hitIter, ite_eq_left hi, Pi.one_apply, hitting] using h + +lemma hitting_harmonic {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) {i : V} (hi : i ∉ T) : + backward U (hitting U T) i = hitting U T i := by + have ha : Tendsto (fun n => backward U (hitIter U T n) i) atTop + (nhds (backward U (hitting U T) i)) := by + unfold backward + exact tendsto_finsetSum _ (fun j _ => tendsto_const_nhds.mul (hitIter_tendsto hU T j)) + have hb : Tendsto (fun n => backward U (hitIter U T n) i) atTop + (nhds (hitting U T i)) := by + have ht := (hitIter_tendsto hU T i).comp (tendsto_add_atTop_nat 1) + change Tendsto (fun n => hitIter U T (n + 1) i) atTop _ at ht + simpa only [hitIter, hitStep, ite_eq_right hi] using ht + exact tendsto_nhds_unique ha hb + +theorem hitting_minimal {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) {g : V → ℝ} (hg : 0 ≤ g) + (hgT : ∀ i ∈ T, g i = 1) (hgh : ∀ i ∉ T, backward U g i = g i) : + hitting U T ≤ g := by + have hn (n : ℕ) : hitIter U T n ≤ g := by + induction n with + | zero => intro i; dsimp [hitIter]; split_ifs with hi + · rw [hgT i hi] + · exact hg i + | succ n ih => + intro i + dsimp [hitIter, hitStep] + split_ifs with hi + · rw [hgT i hi] + · exact (backward_mono hU ih i).trans_eq (hgh i hi) + exact fun i => ciSup_le (fun n => hn n i) + +def energy (U : Matrix V V ℝ) (f : V → ℝ) : ℝ := + ∑ i, f i * (f i - ∑ j, U i j * f j) + +lemma energy_transpose (U : Matrix V V ℝ) (f : V → ℝ) : + energy U f = ∑ i, f i * (f i - backward U f i) := by + simp only [energy, backward, mul_sub, Finset.sum_sub_distrib, Finset.mul_sum] + congr 1 + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem hitting_energy {U : Matrix V V ℝ} (hU : DoublySubstochastic U) + (T : Finset V) : + energy U (hitting U T) = ∑ i ∈ T, (1 - backward U (hitting U T) i) := by + rw [energy_transpose] + rw [← Finset.sum_subset (Finset.subset_univ T)] + · apply Finset.sum_congr rfl + intro i hi + rw [hitting_on hU T hi, one_mul] + · intro i _ hi + rw [hitting_harmonic hU T hi, sub_self, mul_zero] + +end Heisenberg.Hitting + +namespace Heisenberg.Exposure +open Matrix Heisenberg.Hitting +variable {V Ω : Type*} [Fintype V] [DecidableEq V] [Fintype Ω] + +def killedMean (μ : Ω → ℝ) (σ : Ω → Equiv.Perm V) (D : Set V) : Matrix V V ℝ := + fun i j => if i∈D ∧ j∈D then ∑ c,μ c*(if i=σ c j then 1 else 0) else 0 + +lemma killedMean_substochastic (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (hs : ∑ c,μ c=1) + (σ : Ω → Equiv.Perm V) (D : Set V) : DoublySubstochastic (killedMean μ σ D) := by + have hn : ∀ i j,0≤killedMean μ σ D i j := by + intro i j + unfold killedMean + split_ifs + · exact Finset.sum_nonneg (fun c _ => mul_nonneg (hμ c) (by split_ifs <;> norm_num)) + · rfl + constructor + · exact hn + · intro i + calc + _ ≤ ∑ j,∑ c,μ c*(if i=σ c j then 1 else 0) := by + apply Finset.sum_le_sum + intro j _ + unfold killedMean + split_ifs + · rfl + · exact Finset.sum_nonneg (fun c _ => mul_nonneg (hμ c) (by split_ifs <;> norm_num)) + _ = 1 := by + rw [Finset.sum_comm] + simp only [←Finset.mul_sum] + have he (c) : (∑ j : V,if i=σ c j then (1:ℝ) else 0)=1 := by + convert Finset.sum_ite_eq' Finset.univ ((σ c).symm i) (fun _ => (1:ℝ)) using 1 + · apply Finset.sum_congr rfl + intro j _ + congr 1 + exact propext (by rw [Equiv.eq_symm_apply,eq_comm]) + · simp + simp only [he,mul_one,hs] + · intro j + calc + _ ≤ ∑ i,∑ c,μ c*(if i=σ c j then 1 else 0) := by + apply Finset.sum_le_sum + intro i _ + unfold killedMean + split_ifs + · rfl + · exact Finset.sum_nonneg (fun c _ => mul_nonneg (hμ c) (by split_ifs <;> norm_num)) + _ = 1 := by + rw [Finset.sum_comm] + simp only [←Finset.mul_sum] + simpa using hs + +lemma killedMean_backward (μ : Ω → ℝ) (σ : Ω → Equiv.Perm V) (D : Set V) + (f : V → ℝ) (hf : ∀ x,x∉D → f x=0) (i : V) (hi : i∈D) : + backward (killedMean μ σ D) f i = ∑ c,μ c*f (σ c i) := by + unfold backward killedMean + have he : ∀ j,(if j∈D ∧ i∈D then ∑ c,μ c*(if j=σ c i then 1 else 0) else 0)*f j = + ∑ c,μ c*(if j=σ c i then f j else 0) := by + intro j + by_cases hj : j∈D + · simp only [hj,hi,and_self,ite_true,Finset.sum_mul] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + · simp [hj,hf j hj] + simp_rw [he] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro c _ + simp + +lemma killed_hitting_supported (μ : Ω → ℝ) (σ : Ω → Equiv.Perm V) (D : Set V) + (hK : DoublySubstochastic (killedMean μ σ D)) (T : Finset V) + (hT : (T:Set V) ⊆ D) (x : V) (hx : x∉D) : hitting (killedMean μ σ D) T x=0 := by + have ht : x∉T := fun h => hx (hT h) + rw [←hitting_harmonic hK T ht] + simp [backward,killedMean,hx] + +theorem split_conditional_return_energy (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (hs : ∑ c,μ c=1) + (σ : Ω → Equiv.Perm V) (A P D : Set V) + (hA : ∀ c x,σ c x∉A ↔ x∉A) + (hd : DeterminantLaw μ (fun c => (σ c).permMatrix ℝ |>.transpose)) + (hz : hitWeight μ (fun c => splitHolePerm (σ c) A P (hA c))≠0) + (T : Finset {x : {z : V // z∉A} // x.val∈P}) + (hT : ∀ j∈T,j.val.val∈D) (hQ : Aᶜ∩Pᶜ ⊆ D) : + let U := killedMean μ σ D + let T' := T.image (fun j => j.val.val) + (∑ c,if hw : AllHit (splitHolePerm (σ c) A P (hA c)) then + (μ c / hitWeight μ (fun c => splitHolePerm (σ c) A P (hA c))) * + (∑ j∈T,if nextPin (splitHolePerm (σ c) A P (hA c)) hw j∈T then (1:ℝ) else 0) else 0) ≤ + (T.card:ℝ)-energy U (hitting U T') := by + dsimp only + let T' := T.image (fun j => j.val.val) + let U := killedMean μ σ D + have hU := killedMean_substochastic μ hμ hs σ D + let f := hitting U T' + have hTD : (T':Set V) ⊆ D := by + intro x hx + obtain ⟨j,hj,rfl⟩ := Finset.mem_image.mp hx + exact hT j hj + have hf : ∀ x,x∉D → f x=0 := killed_hitting_supported μ σ D hU T' hTD + have hb := split_conditional_return_le μ hμ σ A P hA hd hz T f (hitting_bounds hU T').1 + (fun j hj => by + change 1 ≤ hitting U T' j.val.val + exact le_of_eq (hitting_on hU T' (Finset.mem_image.mpr ⟨j,hj,rfl⟩)).symm) + (by + intro x hxA hxP + rw [mean_perm_backward,←killedMean_backward μ σ D f hf x (hQ ⟨hxA,hxP⟩)] + have hxT : x∉T' := by + intro hx + obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hx + exact hxP j.property + exact le_of_eq (hitting_harmonic hU T' hxT)) + have hinj : Function.Injective (fun j : {x : {z : V // z∉A} // x.val∈P} => j.val.val) := + fun a b h => Subtype.ext (Subtype.ext h) + have he : energy U f = (T.card:ℝ)-∑ j∈T,backward U f j.val.val := by + rw [hitting_energy hU T',Finset.sum_sub_distrib] + simp only [Finset.sum_const,nsmul_eq_mul,mul_one,T',Finset.card_image_of_injective _ hinj] + rw [Finset.sum_image (by intro a _ b _ h; exact hinj h)] + rw [he] + have he' : (∑ j∈T,((∑ c,μ c • (σ c).permMatrix ℝ)*ᵥ f) j.val.val) = + ∑ j∈T,backward U f j.val.val := by + apply Finset.sum_congr rfl + intro j hj + rw [mean_perm_backward,killedMean_backward μ σ D f hf _ (hT j hj)] + rw [he'] at hb + linarith + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HittingKernels.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HittingKernels.lean new file mode 100644 index 0000000000000000000000000000000000000000..37e32624341c92ced6856e002ab696e88dec569d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HittingKernels.lean @@ -0,0 +1,283 @@ +import OAI.MathematicalPhysics.Heisenberg.LayerExposure + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical + +namespace Heisenberg.Hitting +open Filter +variable {V : Type*} [Fintype V] + +def affineIter (A : Matrix V V ℝ) (b : V → ℝ) : ℕ → V → ℝ + | 0 => 0 + | n+1 => b + A *ᵥ affineIter A b n + +omit [Fintype V] in +lemma mulVec_mono {W : Type*} [Fintype W] {A : Matrix V W ℝ} (hA : ∀ i j,0 ≤ A i j) + {f g : W → ℝ} (h : f ≤ g) : A *ᵥ f ≤ A *ᵥ g := by + intro i + exact Finset.sum_le_sum (fun j _ => mul_le_mul_of_nonneg_left (h j) (hA i j)) + +lemma affineIter_mono {A : Matrix V V ℝ} {b : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hb : 0 ≤ b) : Monotone (affineIter A b) := by + apply monotone_nat_of_le_succ + intro n + induction n with + | zero => simpa [affineIter] using hb + | succ n ih => exact add_le_add le_rfl (mulVec_mono hA ih) + +lemma affineIter_nonneg {A : Matrix V V ℝ} {b : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hb : 0 ≤ b) (n : ℕ) : 0 ≤ affineIter A b n := + affineIter_mono hA hb (Nat.zero_le n) + +lemma affineIter_super {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) (n : ℕ) : + affineIter A b n ≤ g := by + induction n with + | zero => exact hg + | succ n ih => exact (add_le_add le_rfl (mulVec_mono hA ih)).trans hs + +def affineHit (A : Matrix V V ℝ) (b : V → ℝ) (i : V) : ℝ := ⨆ n, affineIter A b n i + +lemma affineIter_bdd {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) (i : V) : + BddAbove (Set.range (fun n => affineIter A b n i)) := + ⟨g i,fun _ ⟨n,hn⟩ => hn ▸ affineIter_super hA hg hs n i⟩ + +lemma affineIter_tendsto {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hb : 0 ≤ b) + (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) (i : V) : + Tendsto (fun n => affineIter A b n i) atTop (nhds (affineHit A b i)) := + tendsto_atTop_ciSup (fun _ _ h => affineIter_mono hA hb h i) (affineIter_bdd hA hg hs i) + +lemma affineHit_fixed {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hb : 0 ≤ b) + (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) : b + A *ᵥ affineHit A b = affineHit A b := by + funext i + have h₁ : Tendsto (fun n => b i + ∑ j,A i j * affineIter A b n j) atTop + (nhds (b i + ∑ j,A i j * affineHit A b j)) := + tendsto_const_nhds.add (tendsto_finsetSum _ + (fun j _ => tendsto_const_nhds.mul (affineIter_tendsto hA hb hg hs j))) + have h₂ := (affineIter_tendsto hA hb hg hs i).comp (tendsto_add_atTop_nat 1) + exact tendsto_nhds_unique h₁ h₂ + +lemma affineHit_super {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) : + affineHit A b ≤ g := fun i => ciSup_le (fun n => affineIter_super hA hg hs n i) + +lemma affineHit_nonneg {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) : + 0 ≤ affineHit A b := by + intro i + exact le_ciSup (affineIter_bdd hA hg hs i) 0 + +variable [DecidableEq V] + +theorem affineHit_inverse {A : Matrix V V ℝ} {b g : V → ℝ} + (hA : ∀ i j,0 ≤ A i j) (hb : 0 ≤ b) + (hg : 0 ≤ g) (hs : b + A *ᵥ g ≤ g) (hd : (1-A).det ≠ 0) : + affineHit A b = (1-A)⁻¹ *ᵥ b := by + have he : (1-A) *ᵥ affineHit A b = b := by + rw [Matrix.sub_mulVec,Matrix.one_mulVec] + exact sub_eq_iff_eq_add.mpr (affineHit_fixed hA hb hg hs).symm + calc + affineHit A b = (1-A)⁻¹ *ᵥ ((1-A) *ᵥ affineHit A b) := by + rw [Matrix.mulVec_mulVec,Matrix.nonsing_inv_mul _ (isUnit_iff_ne_zero.mpr hd),Matrix.one_mulVec] + _ = (1-A)⁻¹ *ᵥ b := by rw [he] + +end Heisenberg.Hitting +namespace Heisenberg.Exposure + +section +variable {J Q : Type*} [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] +omit [DecidableEq J] [DecidableEq Q] in +lemma backward_split_left (K : Matrix (J ⊕ Q) (J ⊕ Q) ℝ) (g : (J ⊕ Q) → ℝ) : + (K.transpose *ᵥ g) ∘ Sum.inl = + K.toBlocks₁₁.transpose *ᵥ (g ∘ Sum.inl) + K.toBlocks₂₁.transpose *ᵥ (g ∘ Sum.inr) := by + ext i + simp [Matrix.mulVec, dotProduct,Fintype.sum_sum_type,Matrix.toBlocks₁₁,Matrix.toBlocks₂₁] + +omit [DecidableEq J] [DecidableEq Q] in +lemma backward_split_right (K : Matrix (J ⊕ Q) (J ⊕ Q) ℝ) (g : (J ⊕ Q) → ℝ) : + (K.transpose *ᵥ g) ∘ Sum.inr = + K.toBlocks₁₂.transpose *ᵥ (g ∘ Sum.inl) + K.toBlocks₂₂.transpose *ᵥ (g ∘ Sum.inr) := by + ext i + simp [Matrix.mulVec, dotProduct,Fintype.sum_sum_type,Matrix.toBlocks₁₂,Matrix.toBlocks₂₂] + +omit [DecidableEq J] in +lemma resolvent_backward (K : Matrix (J ⊕ Q) (J ⊕ Q) ℝ) (b : J → ℝ) : + (hittingResolvent ℝ K).transpose *ᵥ b = + K.toBlocks₁₁.transpose *ᵥ b + K.toBlocks₂₁.transpose *ᵥ + ((1-K.toBlocks₂₂.transpose)⁻¹ *ᵥ (K.toBlocks₁₂.transpose *ᵥ b)) := by + simp only [hittingResolvent,Matrix.transpose_add,Matrix.transpose_mul, + Matrix.add_mulVec,Matrix.mulVec_mulVec,Matrix.transpose_nonsing_inv, + Matrix.transpose_sub,Matrix.transpose_one] + +omit [DecidableEq J] in +theorem resolvent_le_supersolution (K : Matrix (J ⊕ Q) (J ⊕ Q) ℝ) + (hK : ∀ i j,0 ≤ K i j) (hd : (1-K.toBlocks₂₂).det ≠ 0) + (b : J → ℝ) (hb : 0 ≤ b) (g : (J ⊕ Q) → ℝ) (hg : 0 ≤ g) + (hP : b ≤ g ∘ Sum.inl) + (hQ : (K.transpose *ᵥ g) ∘ Sum.inr ≤ g ∘ Sum.inr) : + (hittingResolvent ℝ K).transpose *ᵥ b ≤ (K.transpose *ᵥ g) ∘ Sum.inl := by + let A := K.toBlocks₂₂.transpose + let c := K.toBlocks₁₂.transpose *ᵥ b + have hA : ∀ i j,0 ≤ A i j := fun i j => hK (Sum.inr j) (Sum.inr i) + have hc : 0 ≤ c := by + intro i + exact Finset.sum_nonneg (fun j _ => mul_nonneg (hK (Sum.inl j) (Sum.inr i)) (hb j)) + have hs : c + A *ᵥ (g ∘ Sum.inr) ≤ g ∘ Sum.inr := by + apply le_trans (add_le_add (Hitting.mulVec_mono + (A := K.toBlocks₁₂.transpose) (fun i j => hK (Sum.inl j) (Sum.inr i)) hP) le_rfl) + exact (backward_split_right K g) ▸ hQ + have hdA : (1-A).det ≠ 0 := by + have he : 1-A = (1-K.toBlocks₂₂).transpose := by + rw [Matrix.transpose_sub,Matrix.transpose_one] + rw [he,Matrix.det_transpose] + exact hd + have hv := Hitting.affineHit_super hA (fun i => hg (Sum.inr i)) hs + rw [Hitting.affineHit_inverse hA hc (fun i => hg (Sum.inr i)) hs hdA] at hv + rw [resolvent_backward,backward_split_left] + apply add_le_add + · exact Hitting.mulVec_mono (fun i j => hK (Sum.inl j) (Sum.inl i)) hP + · exact Hitting.mulVec_mono (fun i j => hK (Sum.inr j) (Sum.inl i)) hv + +end + +section +variable {J Q Ω : Type*} [Fintype J] [Fintype Q] [Fintype Ω] + [DecidableEq J] [DecidableEq Q] + +omit [Fintype J] [Fintype Q] in +lemma columnPerm_nonneg (π : Equiv.Perm (J ⊕ Q)) (i j : J ⊕ Q) : + 0 ≤ columnPerm ℝ π i j := by + change 0 ≤ if i ∈ (Equiv.toPEquiv π) j then (1:ℝ) else 0 + split_ifs <;> norm_num + +omit [DecidableEq Q] in +lemma nextPinMatrix_backward (π : Equiv.Perm (J ⊕ Q)) (h : AllHit π) (b : J → ℝ) : + (nextPinMatrix ℝ π h).transpose *ᵥ b = b ∘ nextPin π h := by + ext j + simp [Matrix.mulVec,dotProduct,nextPinMatrix] + +theorem conditional_return_le (μ : Ω → ℝ) (hμ : ∀ ω,0 ≤ μ ω) + (π : Ω → Equiv.Perm (J ⊕ Q)) + (h : DeterminantLaw μ (fun ω => columnPerm ℝ (π ω))) + (hz : hitWeight μ π ≠ 0) (T : Finset J) + (g : (J ⊕ Q) → ℝ) (hg : 0 ≤ g) + (hT : ∀ j ∈ T,1 ≤ g (Sum.inl j)) + (hQ : (((∑ ω,μ ω • columnPerm ℝ (π ω)).transpose *ᵥ g) ∘ Sum.inr) ≤ g ∘ Sum.inr) : + (∑ ω,if hw : AllHit (π ω) then + (μ ω / hitWeight μ π)*(∑ j ∈ T,if nextPin (π ω) hw j ∈ T then (1:ℝ) else 0) else 0) ≤ + ∑ j ∈ T,((∑ ω,μ ω • columnPerm ℝ (π ω)).transpose *ᵥ g) (Sum.inl j) := by + let b : J → ℝ := fun j => if j ∈ T then 1 else 0 + let K : Matrix (J ⊕ Q) (J ⊕ Q) ℝ := ∑ ω,μ ω • columnPerm ℝ (π ω) + have hK : ∀ i j,0 ≤ K i j := by + intro i j + simp only [K,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + exact Finset.sum_nonneg (fun ω _ => mul_nonneg (hμ ω) (columnPerm_nonneg (π ω) i j)) + have hd : (1-K.toBlocks₂₂).det ≠ 0 := by rw [←allHit_determinant μ π h]; exact hz + have hb : 0 ≤ b := by intro j; dsimp [b]; split_ifs <;> norm_num + have hP : b ≤ g ∘ Sum.inl := by + intro j + dsimp [b] + split_ifs with hj + · exact hT j hj + · exact hg _ + have hs := resolvent_le_supersolution K hK hd b hb g hg hP hQ + have he := conditional_nextPin_first_moment μ π h hz + have hv : (hittingResolvent ℝ K).transpose *ᵥ b = + ∑ ω,if hw : AllHit (π ω) then + (μ ω / hitWeight μ π) • (b ∘ nextPin (π ω) hw) else 0 := by + rw [←he,Matrix.transpose_sum,Matrix.sum_mulVec] + apply Finset.sum_congr rfl + intro ω _ + split_ifs with hw + · rw [Matrix.transpose_smul,Matrix.smul_mulVec,nextPinMatrix_backward] + · simp + have heq : (∑ ω,if hw : AllHit (π ω) then + (μ ω / hitWeight μ π)*(∑ j ∈ T,if nextPin (π ω) hw j ∈ T then (1:ℝ) else 0) else 0) = + ∑ j ∈ T,((hittingResolvent ℝ K).transpose *ᵥ b) j := by + rw [hv] + simp only [Finset.sum_apply,Finset.sum_comm (s:=T)] + apply Finset.sum_congr rfl + intro ω _ + by_cases hw : AllHit (π ω) + · simp only [dite_eq_left hw,Pi.smul_apply,smul_eq_mul,Function.comp_apply,b] + rw [Finset.mul_sum] + · simp [hw] + rw [heq] + exact Finset.sum_le_sum (fun j _ => hs j) + +end + +open Matrix +variable {V Ω : Type*} [Fintype V] [Fintype Ω] [DecidableEq V] + +lemma mean_perm_backward (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (g : V → ℝ) (x : V) : + ((∑ c, μ c • (π c).permMatrix ℝ) *ᵥ g) x = ∑ c,μ c*g (π c x) := by + rw [Matrix.sum_mulVec] + simp only [Finset.sum_apply,Matrix.smul_mulVec,Matrix.permMatrix_mulVec, + Pi.smul_apply,smul_eq_mul,Function.comp_apply] + +lemma split_mean_backward (μ : Ω → ℝ) (σ : Ω → Equiv.Perm V) (A P : Set V) + (hA : ∀ c x,σ c x ∉ A ↔ x ∉ A) (g : V → ℝ) + (x : {x : {z : V // z ∉ A} // x.val ∈ P} ⊕ + {x : {z : V // z ∉ A} // x.val ∉ P}) : + let e := Equiv.sumCompl (fun x : {z : V // z ∉ A} => x.val ∈ P) + ((∑ c,μ c • columnPerm ℝ (splitHolePerm (σ c) A P (hA c))).transpose *ᵥ + (fun z => g (e z).val)) x = + ((∑ c,μ c • (σ c).permMatrix ℝ) *ᵥ g) (e x).val := by + dsimp only + simp only [columnPerm,Matrix.transpose_sum,Matrix.transpose_smul,Matrix.transpose_transpose] + rw [mean_perm_backward,mean_perm_backward] + apply Finset.sum_congr rfl + intro c _ + congr 1 + simp [splitHolePerm,Equiv.permCongr_apply] + +theorem split_conditional_return_le (μ : Ω → ℝ) (hμ : ∀ c,0 ≤ μ c) + (σ : Ω → Equiv.Perm V) (A P : Set V) + (hA : ∀ c x,σ c x ∉ A ↔ x ∉ A) + (hd : DeterminantLaw μ (fun c => (σ c).permMatrix ℝ |>.transpose)) + (hz : hitWeight μ (fun c => splitHolePerm (σ c) A P (hA c)) ≠ 0) + (T : Finset {x : {z : V // z ∉ A} // x.val ∈ P}) + (g : V → ℝ) (hg : 0 ≤ g) (hT : ∀ j ∈ T,1 ≤ g j.val.val) + (hQ : ∀ x,x ∉ A → x ∉ P → ((∑ c,μ c • (σ c).permMatrix ℝ) *ᵥ g) x ≤ g x) : + (∑ c,if hw : AllHit (splitHolePerm (σ c) A P (hA c)) then + (μ c / hitWeight μ (fun c => splitHolePerm (σ c) A P (hA c))) * + (∑ j ∈ T,if nextPin (splitHolePerm (σ c) A P (hA c)) hw j ∈ T then (1:ℝ) else 0) else 0) ≤ + ∑ j ∈ T,((∑ c,μ c • (σ c).permMatrix ℝ) *ᵥ g) j.val.val := by + let e := Equiv.sumCompl (fun x : {z : V // z ∉ A} => x.val ∈ P) + let π := fun c => splitHolePerm (σ c) A P (hA c) + have hh := LayeredExchange.determinantLaw_holes (μ:=μ) (π:=σ) hd (fun z => z ∉ A) hA + have hh' := LayeredExchange.determinantLaw_reindexed hh e + have he : DeterminantLaw μ (fun c => columnPerm ℝ (π c)) := hh' + have hg' : 0 ≤ (fun z => g (e z).val) := fun _ => hg _ + have hT' : ∀ j ∈ T,1 ≤ g (e (Sum.inl j)).val := hT + have hQ' : (((∑ c,μ c • columnPerm ℝ (π c)).transpose *ᵥ + (fun z => g (e z).val)) ∘ Sum.inr) ≤ (fun z => g (e z).val) ∘ Sum.inr := by + intro x + change ((∑ c,μ c • columnPerm ℝ (splitHolePerm (σ c) A P (hA c))).transpose *ᵥ + (fun z => g (e z).val)) (Sum.inr x) ≤ g x.val.val + rw [split_mean_backward] + exact hQ x.val.val x.val.property x.property + have h := conditional_return_le μ hμ π he hz T (fun z => g (e z).val) hg' hT' hQ' + convert h using 1 + apply Finset.sum_congr rfl + intro j _ + exact (split_mean_backward μ σ A P hA g (Sum.inl j)).symm + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HoleReturns.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HoleReturns.lean new file mode 100644 index 0000000000000000000000000000000000000000..aba0fc77dad6b6912c3302156ac657827edf8cc0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HoleReturns.lean @@ -0,0 +1,265 @@ +import OAI.MathematicalPhysics.Heisenberg.ClockTails + +namespace OAI + +section +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +open Matrix +noncomputable section +open scoped Classical +noncomputable section +open scoped BigOperators Classical +noncomputable section +open scoped Classical + +namespace Heisenberg.Exposure +variable {T : Type*} [Fintype T] + +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.LayeredExchange +variable {T V : Type*} [Fintype T] [Fintype V] + +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +open LayeredExchange Heisenberg.Cycle +variable {V : Type*} [Fintype V] [DecidableEq V] + +attribute [local irreducible] MissingSet layerHistory + +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +open Heisenberg.Cycle LayeredExchange +variable {V W : Type*} + +variable [Fintype V] [DecidableEq V] + +end Heisenberg.Exposure + +namespace Heisenberg.Hitting +open Filter +variable {V : Type*} [Fintype V] + +variable [DecidableEq V] + +end Heisenberg.Hitting +namespace Heisenberg.Exposure +variable {J Q : Type*} [Fintype J] [Fintype Q] [DecidableEq J] [DecidableEq Q] +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +variable {J Q Ω : Type*} [Fintype J] [Fintype Q] [Fintype Ω] + [DecidableEq J] [DecidableEq Q] + +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +open Matrix +variable {V Ω : Type*} [Fintype V] [Fintype Ω] [DecidableEq V] + +end Heisenberg.Exposure + +noncomputable section +open scoped Classical +open Filter +namespace Heisenberg.Hitting + +variable {V : Type*} [Fintype V] + +end Heisenberg.Hitting + +namespace Heisenberg.Exposure +open Matrix Heisenberg.Hitting +variable {V Ω : Type*} [Fintype V] [DecidableEq V] [Fintype Ω] + +end Heisenberg.Exposure + +noncomputable section +open scoped Classical +namespace Heisenberg.Return +open Equiv +variable {V : Type*} + +variable [Fintype V] + +end Heisenberg.Return + +namespace Heisenberg.Exposure +open Heisenberg.Return +variable {V : Type*} [Fintype V] + +end Heisenberg.Exposure + +noncomputable section +open scoped Classical +namespace Heisenberg.Conditioning +variable {Ω : Type*} [Fintype Ω] + +end Heisenberg.Conditioning + +attribute [local instance] exposureDecEq +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.Conditioning +variable {V : Type*} [Fintype V] + +end Heisenberg.Exposure +attribute [-instance] exposureDecEq + +namespace Heisenberg.Exposure +open Heisenberg.Return Heisenberg.Hitting Heisenberg.Cycle +variable {V Ω : Type*} [Fintype V] [Fintype Ω] +variable [DecidableEq V] + +def holePinEquiv (A P : Set V) (hP : Disjoint A P) : + {x : {z : V // z∉A} // x.val∈P} ≃ P where + toFun j := ⟨j.val.val,j.property⟩ + invFun j := ⟨⟨j.val,fun h => Set.disjoint_left.mp hP h j.property⟩,j.property⟩ + left_inv _ := rfl + right_inv _ := rfl + +def returnCount (σ : Equiv.Perm V) (P : Set V) (T : Finset P) : ℝ := + ∑ j∈T, if nextPermutation σ P j∈T then 1 else 0 + +lemma returnCount_split (σ : Equiv.Perm V) (A P : Set V) + (hA : ∀ x,σ x∉A ↔ x∉A) (hP : Disjoint A P) + (hh : AllHit (splitHolePerm σ A P hA)) (T : Finset P) : + let H := T.map (holePinEquiv A P hP).symm.toEmbedding + (∑ j∈H,if nextPin (splitHolePerm σ A P hA) hh j∈H then (1:ℝ) else 0) = + returnCount σ P T := by + dsimp only + rw [Finset.sum_map] + apply Finset.sum_congr rfl + intro j _ + have he : nextPin (splitHolePerm σ A P hA) hh ((holePinEquiv A P hP).symm j) = + (holePinEquiv A P hP).symm (nextPermutation σ P j) := by + apply Subtype.ext + apply Subtype.ext + exact split_nextPin_eq σ A P hA hP hh _ + simp only [Equiv.toEmbedding_apply,he,Finset.mem_map_equiv,Equiv.symm_symm,Equiv.apply_symm_apply] + +omit [Fintype V] in +lemma holePins_image (A P : Set V) (hP : Disjoint A P) (T : Finset P) : + (T.map (holePinEquiv A P hP).symm.toEmbedding).image (fun j => j.val.val) = + T.image (fun j => j.val) := by + rw [Finset.map_eq_image,Finset.image_image] + rfl + +theorem outside_return_energy (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (hs : ∑ c,μ c=1) + (σ : Ω → Equiv.Perm V) (A P D : Set V) + (hA : ∀ c x,σ c x∉A ↔ x∉A) (hP : Disjoint A P) + (hd : DeterminantLaw μ (fun c => (σ c).permMatrix ℝ |>.transpose)) + (hz : (∑ c,if OutsideHit (σ c) P A then μ c else 0)≠0) + (T : Finset P) (hT : ∀ j∈T,j.val∈D) (hQ : Aᶜ∩Pᶜ ⊆ D) : + (∑ c,if OutsideHit (σ c) P A then μ c*returnCount (σ c) P T else 0) / + (∑ c,if OutsideHit (σ c) P A then μ c else 0) ≤ + (T.card:ℝ)-energy (killedMean μ σ D) (hitting (killedMean μ σ D) (T.image Subtype.val)) := by + let H := T.map (holePinEquiv A P hP).symm.toEmbedding + have hz' : hitWeight μ (fun c => splitHolePerm (σ c) A P (hA c)) ≠ 0 := by + simpa only [hitWeight,allHit_splitHolePerm _ _ _ _ hP] using hz + have hH : ∀ j∈H,j.val.val∈D := by + intro j hj + obtain ⟨i,hi,rfl⟩ := Finset.mem_map.mp hj + exact hT i hi + have h := split_conditional_return_energy μ hμ hs σ A P D hA hd hz' H hH hQ + dsimp only at h + rw [show H.card=T.card from Finset.card_map _,holePins_image A P hP T] at h + convert h using 1 + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro c _ + by_cases hc : OutsideHit (σ c) P A + · have hh := (allHit_splitHolePerm (σ c) A P (hA c) hP).mpr hc + rw [ite_eq_left hc,dite_eq_left hh,returnCount_split (σ c) A P (hA c) hP hh T] + unfold hitWeight + simp only [allHit_splitHolePerm _ _ _ _ hP] + ring + · rw [ite_eq_right hc,dite_eq_right (fun h => hc ((allHit_splitHolePerm _ _ _ _ hP).mp h))] + exact zero_div _ + +end Heisenberg.Exposure + +namespace Heisenberg.Exposure +attribute [local irreducible] killedMean Heisenberg.Hitting.hitting Heisenberg.Hitting.energy Heisenberg.Cycle.MissingSet layerHistory +open Heisenberg.Return Heisenberg.Hitting Heisenberg.Cycle Heisenberg.Conditioning +variable {V : Type*} [Fintype V] [DecidableEq V] + +theorem exposed_layer_energy {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (p : Fin n → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) (P : Set (Fin n×V)) + (base : Fin n → Bool) + (hbase : productWeight (fun i z => if z then p i else 1-p i) base≠0) + (D : Set (Fin n×V)) (T : Finset P) + (hT : ∀ j∈T,j.val∈D) + (hQ : (MissingSet (layerHistory s (fun i => Equiv.swap (a i) (b i)) base) P)ᶜ∩Pᶜ ⊆ D) : + let τ := fun i => Equiv.swap (a i) (b i) + let μ₀ := productWeight (fun i z => if z then p i else 1-p i) + let μ := fun c => μ₀ c*(2:ℝ)^missingCount (layerHistory s τ c) P + let M := layerRevealed τ (MissingSet (layerHistory s τ base) P) + let σ := fun c => layerHistory s τ (residualCoins M base c) + conditional μ (layerExposure s τ P) (fun c => returnCount (layerHistory s τ c) P T) base ≤ + (T.card:ℝ)-energy (killedMean μ₀ σ D) (hitting (killedMean μ₀ σ D) (T.image Subtype.val)) := by + dsimp only + let τ := fun i => Equiv.swap (a i) (b i) + let w : Fin n → Bool → ℝ := fun i z => if z then p i else 1-p i + have hw : ∀ i,∑ z,w i z=1 := by intro i; simp [w] + have hw0 : ∀ i z,0≤w i z := by + intro i z + cases z <;> simp only [w,Bool.false_eq_true,↓reduceIte] <;> linarith [(hp i).1,(hp i).2] + let A := MissingSet (layerHistory s τ base) P + let M := layerRevealed τ A + let σ := fun c => layerHistory s τ (residualCoins M base c) + have hσ : σ base=layerHistory s τ base := by + change layerHistory s τ (residualCoins M base base)=layerHistory s τ base + apply congrArg (layerHistory s τ) + funext i + simp only [residualCoins,ite_self] + have ho : OutsideHit (σ base) P A := by + rw [hσ] + exact (sameMissing_iff_outsideHit _ _ P (fun _ _ => rfl)).mp rfl + have hμ : ∀ c,0≤productWeight w c := productWeight_nonneg w hw0 + have hz : (∑ c : Fin n → Bool,if OutsideHit (σ c) P A then productWeight w c else 0)≠0 := by + apply ne_of_gt + have hb : 0 (σ c).permMatrix ℝ |>.transpose) := by + exact residual_determinantLaw s a b P base p + have hh := outside_return_energy (productWeight w) hμ hs σ A P D + (fun c => residual_invariant s τ P base c) (missing_disjoint_pins _ P) hd hz T hT hQ + exact hh + +end Heisenberg.Exposure +end +end +end +end +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HullComponents.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HullComponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..839c71f533899b70ad757690dd8389f9ac4e365a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HullComponents.lean @@ -0,0 +1,284 @@ +import OAI.MathematicalPhysics.Heisenberg.LatticeHulls + +namespace OAI + +noncomputable section +open scoped Classical + +namespace Heisenberg.LatticeCut +open Heisenberg.Geometry +open Heisenberg.LatticePotential (shift) + +def Boundary {d : ℕ} (H : Set (Site d)) : Set (Site d) := + {v | v ∉ H ∧ ∃ u ∈ H, Step u v} + +def outer {d : ℕ} (H : Set (Site d)) (e : Edge d) : Site d := + if e.1 ∈ H then shift e.1 e.2 else e.1 + +lemma step_to_shift {d : ℕ} (x : Site d) (i : Fin d) : Step x (shift x i) := by + refine ⟨i,Or.inl ?_,?_⟩ + · simp [shift] + · intro k hk; simp [shift,hk] + +lemma cut_mem_iff {d : ℕ} (H : Set (Site d)) (e : Edge d) : + Cut H e ↔ (e.1 ∈ H ∧ shift e.1 e.2 ∉ H) ∨ (e.1 ∉ H ∧ shift e.1 e.2 ∈ H) := by + by_cases h : e.1 ∈ H <;> by_cases h' : shift e.1 e.2 ∈ H <;> simp [Cut,color,h,h'] + +lemma outer_boundary {d : ℕ} (H : Set (Site d)) (e : Edge d) (he : Cut H e) : + outer H e ∈ Boundary H := by + rcases (cut_mem_iff H e).mp he with ⟨h,h'⟩ | ⟨h,h'⟩ + · rw [outer,ite_eq_left h] + exact ⟨h',e.1,h,step_to_shift e.1 e.2⟩ + · rw [outer,ite_eq_right h] + exact ⟨h,shift e.1 e.2,h',step_symm (step_to_shift e.1 e.2)⟩ + +lemma boundary_has_cut {d : ℕ} (H : Set (Site d)) (v : Site d) (hv : v ∈ Boundary H) : + ∃ e, Cut H e ∧ outer H e = v := by + obtain ⟨hv,u,hu,huv⟩ := hv + rcases step_shift huv with ⟨i,rfl⟩ | ⟨i,rfl⟩ + · exact ⟨(u,i),(cut_mem_iff ..).mpr (Or.inl ⟨hu,hv⟩),by simp [outer,hu]⟩ + · exact ⟨(v,i),(cut_mem_iff ..).mpr (Or.inr ⟨hv,hu⟩),by simp [outer,hv]⟩ + +lemma square_outer_bounds {d : ℕ} (H : Set (Site d)) {x : Site d} {i j : Fin d} + (hij : i ≠ j) {e : Edge d} (he : e ∈ square x i j) (k : Fin d) : + x k ≤ outer H e k ∧ outer H e k ≤ x k+1 := by + simp only [square,Finset.mem_insert,Finset.mem_singleton] at he + rcases he with rfl | rfl | rfl | rfl + all_goals + unfold outer + split_ifs + all_goals + by_cases hki : k = i + · subst k; simp [shift,hij,Ne.symm hij] + · by_cases hkj : k = j + · subst k; simp [shift,hij,Ne.symm hij] + · simp [shift,hki,hkj] + +lemma linked_outer_near {d : ℕ} (H : Set (Site d)) {e f : Edge d} + (h : Linked H e f) : outer H f ∈ Ball 1 (outer H e) := by + obtain ⟨_,_,x,i,j,hij,he,hf⟩ := h + intro k + have he' := square_outer_bounds H hij he k + have hf' := square_outer_bounds H hij hf k + rw [abs_le] + omega + +theorem boundary_connected {d : ℕ} (H : Set (Site d)) (hH : Connected H) (hU : Connected Hᶜ) + (x y : Site d) (hx : x ∈ Boundary H) (hy : y ∈ Boundary H) : + Relation.ReflTransGen (fun a b => b ∈ Ball 1 a ∧ a ∈ Boundary H ∧ b ∈ Boundary H) x y := by + obtain ⟨e,he,rfl⟩ := boundary_has_cut H x hx + obtain ⟨f,hf,rfl⟩ := boundary_has_cut H y hy + have hr := cut_connected H hH hU e f he hf + induction hr with + | refl => exact Relation.ReflTransGen.refl + | @tail g f hrg hgf ih => + exact (ih hgf.1 (outer_boundary H g hgf.1)).tail + ⟨linked_outer_near H hgf,outer_boundary H g hgf.1,outer_boundary H f hgf.2.1⟩ + +end Heisenberg.LatticeCut + +namespace Heisenberg.Geometry + +lemma ball_symm {d : ℕ} {r : ℤ} {x y : Site d} (h : y ∈ Ball r x) : x ∈ Ball r y := by + intro j + simpa only [abs_sub_comm] using h j + +lemma ball_triangle {d : ℕ} {r s : ℤ} {x y z : Site d} + (hxy : y ∈ Ball r x) (hyz : z ∈ Ball s y) : z ∈ Ball (r+s) x := by + intro j + have h : z j-x j = (z j-y j)+(y j-x j) := by omega + rw [h] + exact (abs_add_le ..).trans (by have := hxy j; have := hyz j; omega) + +lemma ball_mono {d : ℕ} {r s : ℤ} (h : r ≤ s) (x : Site d) : Ball r x ⊆ Ball s x := + fun _ hz j => (hz j).trans h + +lemma ball_self {d : ℕ} {r : ℤ} (hr : 0 ≤ r) (x : Site d) : x ∈ Ball r x := by + intro j; simpa using hr + +lemma ball_connected {d : ℕ} (r : ℤ) (x : Site d) : Heisenberg.LatticeCut.Connected (Ball r x) := by + intro y hy z hz + apply reach_rectangle + intro w hw j + have hyj := abs_le.mp (hy j) + have hzj := abs_le.mp (hz j) + have hwj := hw j + rw [abs_le] + constructor <;> omega + +lemma step_ball_one {d : ℕ} {x y : Site d} (h : Step x y) : y ∈ Ball 1 x := by + obtain ⟨j,hj,hother⟩ := h + intro k + by_cases hk : k = j + · subst k; rw [abs_le]; rcases hj with hj | hj <;> omega + · rw [hother k hk,sub_self,abs_zero]; omega + +lemma interpolate_near {d : ℕ} {U : Set (Site d)} {x y : Site d} + (hxy : y ∈ Ball 1 x) (hU : Ball 1 x ⊆ U) : Reach U x y := + reach_mono hU (ball_connected 1 x x (ball_self (by omega) x) y hxy) + +end Heisenberg.Geometry + +namespace Heisenberg.LatticeComponents +open Heisenberg.Geometry + +def Component {d : ℕ} (Z : Set (Site d)) (x : Site d) : Set (Site d) := + {y | y ∈ Z ∧ Relation.ReflTransGen (fun a b => b ∈ Ball 8 a ∧ a ∈ Z ∧ b ∈ Z) x y} + +def Thick {d : ℕ} (r : ℤ) (C : Set (Site d)) : Set (Site d) := + {z | ∃ x ∈ C, z ∈ Ball r x} + +lemma thick_mono {d : ℕ} {r s : ℤ} (hrs : r ≤ s) (C : Set (Site d)) : Thick r C ⊆ Thick s C := by + intro x hx + obtain ⟨y,hy,hxy⟩ := hx + exact ⟨y,hy,ball_mono hrs y hxy⟩ + +lemma self_mem_component {d : ℕ} (Z : Set (Site d)) {x : Site d} (hx : x ∈ Z) : x ∈ Component Z x := + ⟨hx,Relation.ReflTransGen.refl⟩ + +lemma component_closed {d : ℕ} (Z : Set (Site d)) (x : Site d) {y z : Site d} + (hy : y ∈ Component Z x) (hz : z ∈ Z) (hyz : z ∈ Ball 8 y) : z ∈ Component Z x := + ⟨hz,hy.2.tail ⟨hyz,hy.1,hz⟩⟩ + +lemma component_symmetric {d : ℕ} (Z : Set (Site d)) {x y : Site d} + (hx : x ∈ Z) (hy : y ∈ Component Z x) : x ∈ Component Z y := by + refine ⟨hx,?_⟩ + have hr := hy.2 + induction hr with + | refl => exact Relation.ReflTransGen.refl + | @tail z w _ hzw ih => + exact (Relation.ReflTransGen.single ⟨ball_symm hzw.1,hzw.2.2,hzw.2.1⟩).trans (ih ⟨hzw.2.1,by assumption⟩) + +lemma component_eq_of_mem {d : ℕ} (Z : Set (Site d)) {x y : Site d} + (hx : x ∈ Z) (hy : y ∈ Component Z x) : Component Z y = Component Z x := by + have hyx := component_symmetric Z hx hy + ext z + exact ⟨fun hz => ⟨hz.1,hy.2.trans hz.2⟩,fun hz => ⟨hz.1,hyx.2.trans hz.2⟩⟩ + +lemma components_disjoint {d : ℕ} (Z : Set (Site d)) {x y : Site d} + (hx : x ∈ Z) (hy : y ∈ Z) (hne : Component Z x ≠ Component Z y) : + Disjoint (Component Z x) (Component Z y) := by + apply Set.disjoint_left.mpr + intro z hzx hzy + exact hne ((component_eq_of_mem Z hx hzx).symm.trans (component_eq_of_mem Z hy hzy)) + +lemma thickenings_disjoint {d : ℕ} (Z : Set (Site d)) {x y : Site d} + (hx : x ∈ Z) (hy : y ∈ Z) (hne : Component Z x ≠ Component Z y) : + Disjoint (Thick 4 (Component Z x)) (Thick 4 (Component Z y)) := by + apply Set.disjoint_left.mpr + rintro z ⟨u,hu,hzu⟩ ⟨v,hv,hzv⟩ + have huv : v ∈ Ball 8 u := by + simpa using ball_triangle hzu (ball_symm hzv) + have hvx := component_closed Z x hu hv.1 huv + exact Set.disjoint_left.mp (components_disjoint Z hx hy hne) hvx hv + +lemma overlapping_balls {d : ℕ} {x y : Site d} (hxy : y ∈ Ball 8 x) : + ∃ z, z ∈ Ball 4 x ∧ z ∈ Ball 4 y := by + refine ⟨fun j => max (x j-4) (y j-4),?_,?_⟩ + all_goals + intro j + have h := abs_le.mp (hxy j) + dsimp only + rw [abs_le] + constructor <;> omega + +lemma thick_component_connected {d : ℕ} (Z : Set (Site d)) {x : Site d} (_hx : x ∈ Z) : + Heisenberg.LatticeCut.Connected (Thick 4 (Component Z x)) := by + let A := Thick 4 (Component Z x) + have hball : ∀ y ∈ Component Z x, Ball 4 y ⊆ A := fun y hy z hz => ⟨y,hy,hz⟩ + have hbase : ∀ y ∈ Component Z x, Reach A x y := by + intro y hy + have hr := hy.2 + induction hr with + | refl => exact reach_refl _ _ + | @tail v w hvw hstep ih => + have hv : v ∈ Component Z x := ⟨hstep.2.1,hvw⟩ + have hw : w ∈ Component Z x := ⟨hstep.2.2,hvw.tail hstep⟩ + obtain ⟨z,hzv,hzw⟩ := overlapping_balls hstep.1 + exact (ih hv).trans ((reach_mono (hball v hv) + (ball_connected 4 v v (ball_self (by omega) v) z hzv)).trans + (reach_mono (hball w hw) (ball_connected 4 w z hzw w (ball_self (by omega) w)))) + have hAll : ∀ y ∈ A, Reach A x y := by + rintro y ⟨z,hz,hyz⟩ + exact (hbase z hz).trans (reach_mono (hball z hz) + (ball_connected 4 z z (ball_self (by omega) z) y hyz)) + intro y hy z hz + exact (reach_symm (hAll y hy)).trans (hAll z hz) + +lemma boundary_unit_clear {d : ℕ} (Z : Set (Site d)) {x b v : Site d} + (hb : b ∉ Thick 4 (Component Z x)) + (hv : v ∈ Heisenberg.LatticeCut.Boundary (Heisenberg.LatticeHull.Hull (Thick 4 (Component Z x)) b)) : + Ball 1 v ⊆ Zᶜ := by + obtain ⟨hv,u,hu,huv⟩ := hv + have huA := Heisenberg.LatticeHull.inner_endpoint_mem _ hb hu hv huv + obtain ⟨c,hc,huc⟩ := huA + have hvc : v ∈ Ball 5 c := by simpa using ball_triangle huc (step_ball_one huv) + intro z hz hzZ + have hzc : z ∈ Ball 8 c := ball_mono (by omega : (6:ℤ) ≤ 8) c (ball_triangle hvc hz) + have hzC := component_closed Z x hc hzZ hzc + have hvA : v ∈ Thick 4 (Component Z x) := ⟨z,hzC,ball_mono (by omega : (1:ℤ) ≤ 4) z (ball_symm hz)⟩ + exact hv (Heisenberg.LatticeHull.subset_hull _ hb hvA) + +theorem surviving_boundary_connected {d : ℕ} (Z : Set (Site d)) {x b : Site d} + (hx : x ∈ Z) (hb : b ∉ Thick 4 (Component Z x)) + (u v : Site d) + (hu : u ∈ Heisenberg.LatticeCut.Boundary (Heisenberg.LatticeHull.Hull (Thick 4 (Component Z x)) b)) + (hv : v ∈ Heisenberg.LatticeCut.Boundary (Heisenberg.LatticeHull.Hull (Thick 4 (Component Z x)) b)) : + Reach Zᶜ u v := by + have hAn : (Thick 4 (Component Z x)).Nonempty := + ⟨x,x,self_mem_component Z hx,ball_self (by omega) x⟩ + have hr := Heisenberg.LatticeCut.boundary_connected _ + (Heisenberg.LatticeHull.hull_connected _ (thick_component_connected Z hx) hAn hb) + (Heisenberg.LatticeHull.complement_connected _ b) u v hu hv + induction hr with + | refl => exact reach_refl _ _ + | @tail w z _ hwz ih => + exact (ih hwz.2.1).trans (interpolate_near hwz.1 (boundary_unit_clear Z hb hwz.2.1)) + +end Heisenberg.LatticeComponents + +namespace Heisenberg.Geometry + +lemma exterior_ball_connected {d : ℕ} (hd : 2 ≤ d) (r : ℤ) (hr : 0 ≤ r) + (c x y : Site d) (hx : x ∉ Ball r c) (hy : y ∉ Ball r c) : + Reach (Ball r c)ᶜ x y := by + have hx' : x-c ∉ Box r := hx + have hy' : y-c ∉ Box r := hy + have hxy := exterior_connected hd r hr (x-c) (y-c) hx' hy' + have h := reach_translate c (Box r)ᶜ (Ball r c)ᶜ (fun z hz hzc => + hz ((translate_mem_ball c z r).mp hzc)) hxy + simpa only [add_sub_cancel] using h + +lemma ball_finite {d : ℕ} (r : ℕ) (x : Site d) : (Ball (r : ℤ) x).Finite := by + have he : Ball (r : ℤ) x = (ballFinset d r x : Set (Site d)) := by + ext z; exact (mem_ballFinset ..).symm + rw [he] + exact Finset.finite_toSet _ + +lemma ball_enlarge_step {d : ℕ} {c u v : Site d} {r : ℤ} + (hu : u ∈ Ball r c) (huv : Step u v) : v ∈ Ball (r+1) c := + ball_triangle hu (step_ball_one huv) + +lemma interpolate_near_confined {d : ℕ} {U : Set (Site d)} {c x y : Site d} {r : ℤ} + (hx : x ∈ Ball r c) (hy : y ∈ Ball r c) + (hxy : y ∈ Ball 1 x) (hU : Ball 1 x ⊆ U) : Reach (Ball r c ∩ U) x y := by + apply reach_rectangle + intro z hz + constructor + · intro j + have hxj := abs_le.mp (hx j) + have hyj := abs_le.mp (hy j) + have hzj := hz j + rw [abs_le] + constructor <;> omega + · apply hU + intro j + have hyj := abs_le.mp (hxy j) + have hzj := hz j + rw [abs_le] + constructor <;> omega + +end Heisenberg.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/HullRouting.lean b/lean/OAI/MathematicalPhysics/Heisenberg/HullRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9b62ac8e76c264c908040a78c092f5be07dd084 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/HullRouting.lean @@ -0,0 +1,293 @@ +import OAI.MathematicalPhysics.Heisenberg.HullComponents + +namespace OAI + +noncomputable section +open scoped Classical +namespace Heisenberg.LatticeHull +open Heisenberg.Geometry + +lemma hull_subset_ball {d : ℕ} (hd : 2 ≤ d) (A : Set (Site d)) (c : Site d) (r : ℤ) (hr : 0 ≤ r) + (hAr : A ⊆ Ball r c) {b : Site d} (hb : b ∉ Ball r c) : Hull A b ⊆ Ball r c := by + intro x hx + by_contra hxr + apply hx + apply reach_mono _ (exterior_ball_connected hd r hr c b x hb hxr) + intro z hz hzA + exact hz (hAr hzA) + +lemma boundary_subset_ball {d : ℕ} (H : Set (Site d)) (c : Site d) (r : ℤ) + (hH : H ⊆ Ball r c) : Heisenberg.LatticeCut.Boundary H ⊆ Ball (r+1) c := by + rintro v ⟨_,u,hu,huv⟩ + exact ball_enlarge_step (hH hu) huv + +lemma boundary_nonempty {d : ℕ} (H : Set (Site d)) {x y : Site d} (hx : x ∈ H) (hy : y ∉ H) : + (Heisenberg.LatticeCut.Boundary H).Nonempty := by + have hr := ambient_connected x y + have h : y ∈ H ∨ (Heisenberg.LatticeCut.Boundary H).Nonempty := by + clear hy + induction hr with + | refl => exact Or.inl hx + | @tail u v _ huv ih => + rcases ih with hu | hu + · by_cases hv : v ∈ H + · exact Or.inl hv + · exact Or.inr ⟨v,hv,u,hu,huv.1⟩ + · exact Or.inr hu + exact h.resolve_left hy + +end Heisenberg.LatticeHull +namespace Heisenberg.LatticeComponents +open Heisenberg.Geometry Heisenberg.LatticeHull + +lemma thick_finite {d : ℕ} (r : ℕ) (C : Set (Site d)) (hC : C.Finite) : (Thick (r : ℤ) C).Finite := by + have he : Thick (r : ℤ) C = ⋃ x ∈ C, Ball (r : ℤ) x := by + ext z; simp [Thick] + rw [he] + exact hC.biUnion (fun x _ => ball_finite r x) + +lemma component_finite {d : ℕ} (Z : Set (Site d)) (hZ : Z.Finite) (x : Site d) : + (Component Z x).Finite := hZ.subset (fun _ h => h.1) + +lemma thick_nonempty {d : ℕ} (Z : Set (Site d)) {x : Site d} (hx : x ∈ Z) : + (Thick 4 (Component Z x)).Nonempty := ⟨x,x,self_mem_component Z hx,ball_self (by omega) x⟩ + +lemma hull_cut_clearance {d : ℕ} (Z : Set (Site d)) {x b u v : Site d} + (hb : b ∉ Thick 4 (Component Z x)) + (hu : u ∈ Hull (Thick 4 (Component Z x)) b) + (hv : v ∉ Hull (Thick 4 (Component Z x)) b) (huv : Step u v) : + (u ∈ Thick 4 (Component Z x) ∧ u ∉ Thick 3 (Component Z x)) ∧ + (v ∈ Thick 5 (Component Z x) ∧ v ∉ Thick 4 (Component Z x)) ∧ u ∉ Z ∧ v ∉ Z := by + have huA := inner_endpoint_mem _ hb hu hv huv + have hvA : v ∉ Thick 4 (Component Z x) := fun h => hv (subset_hull _ hb h) + have hv5 : v ∈ Thick 5 (Component Z x) := by + obtain ⟨c,hc,huc⟩ := huA + exact ⟨c,hc,ball_triangle huc (step_ball_one huv)⟩ + have hu3 : u ∉ Thick 3 (Component Z x) := by + rintro ⟨c,hc,huc⟩ + exact hvA ⟨c,hc,ball_triangle huc (step_ball_one huv)⟩ + have huZ : u ∉ Z := by + intro huZ + obtain ⟨c,hc,huc⟩ := huA + have huC := component_closed Z x hc huZ (ball_mono (by omega : (4:ℤ) ≤ 8) c huc) + exact hu3 ⟨u,huC,ball_self (by omega) u⟩ + have hvZ : v ∉ Z := boundary_unit_clear Z hb ⟨hv,u,hu,huv⟩ (ball_self (by omega) v) + exact ⟨⟨huA,hu3⟩,⟨hv5,hvA⟩,huZ,hvZ⟩ + +theorem surviving_boundary_confined {d : ℕ} (Z : Set (Site d)) {x b c : Site d} + (hx : x ∈ Z) (hb : b ∉ Thick 4 (Component Z x)) (r : ℤ) + (hH : Hull (Thick 4 (Component Z x)) b ⊆ Ball r c) + (u v : Site d) + (hu : u ∈ Heisenberg.LatticeCut.Boundary (Hull (Thick 4 (Component Z x)) b)) + (hv : v ∈ Heisenberg.LatticeCut.Boundary (Hull (Thick 4 (Component Z x)) b)) : + Reach (Ball (r+1) c ∩ Zᶜ) u v := by + have hB := boundary_subset_ball _ c r hH + have hr := Heisenberg.LatticeCut.boundary_connected _ + (hull_connected _ (thick_component_connected Z hx) (thick_nonempty Z hx) hb) + (complement_connected _ b) u v hu hv + induction hr with + | refl => exact reach_refl _ _ + | @tail w z _ hwz ih => + exact (ih hwz.2.1).trans (interpolate_near_confined (hB hwz.2.1) (hB hwz.2.2) + hwz.1 (boundary_unit_clear Z hb hwz.2.1)) + +end Heisenberg.LatticeComponents + +namespace Heisenberg.HullRouting +open Heisenberg.Geometry Heisenberg.LatticeCut Heisenberg.LatticeHull Heisenberg.LatticeComponents + +variable {d : ℕ} + +def DisjointFamily (F : Finset (Set (Site d))) : Prop := + ∀ H ∈ F, ∀ K ∈ F, H ≠ K → Disjoint H K + +lemma member_unique {F : Finset (Set (Site d))} (hF : DisjointFamily F) + {H K : Set (Site d)} (hH : H ∈ F) (hK : K ∈ F) {x : Site d} + (hxH : x ∈ H) (hxK : x ∈ K) : H = K := by + by_contra hne + exact Set.disjoint_left.mp (hF H hH K hK hne) hxH hxK + +def collapse (F : Finset (Set (Site d))) (rep : Set (Site d) → Site d) (x : Site d) : Site d := + if h : ∃ H ∈ F, x ∈ H then rep h.choose else x + +lemma collapse_of_mem {F : Finset (Set (Site d))} (hF : DisjointFamily F) + (rep : Set (Site d) → Site d) {H : Set (Site d)} (hH : H ∈ F) {x : Site d} (hx : x ∈ H) : + collapse F rep x = rep H := by + have h : ∃ K ∈ F, x ∈ K := ⟨H,hH,hx⟩ + rw [collapse,dite_eq_left h] + rw [member_unique hF h.choose_spec.1 hH h.choose_spec.2 hx] + +lemma collapse_free {F : Finset (Set (Site d))} (rep : Set (Site d) → Site d) {x : Site d} + (hx : ¬ ∃ H ∈ F, x ∈ H) : collapse F rep x = x := by rw [collapse,dite_eq_right hx] + +lemma collapse_survives (Z : Set (Site d)) (F : Finset (Set (Site d))) + (rep : Set (Site d) → Site d) (hcover : ∀ x ∈ Z, ∃ H ∈ F, x ∈ H) + (hrep : ∀ H ∈ F, rep H ∉ Z) (x : Site d) : collapse F rep x ∉ Z := by + unfold collapse + split_ifs with h + · exact hrep h.choose h.choose_spec.1 + · exact fun hx => h (hcover x hx) + +def RouteRegion (Z : Set (Site d)) (F : Finset (Set (Site d))) + (E : Set (Site d) → Set (Site d)) (u v : Site d) : Set (Site d) := + {z | (z = u ∨ z = v ∨ ∃ H ∈ F, (u ∈ H ∨ v ∈ H) ∧ z ∈ E H) ∧ z ∉ Z} + +lemma region_boundary (Z : Set (Site d)) (F : Finset (Set (Site d))) + (E : Set (Site d) → Set (Site d)) (u v : Site d) + {H : Set (Site d)} (hH : H ∈ F) (hc : u ∈ H ∨ v ∈ H) : + E H ∩ Zᶜ ⊆ RouteRegion Z F E u v := by + exact fun z hz => ⟨Or.inr (Or.inr ⟨H,hH,hc,hz.1⟩),hz.2⟩ + +theorem route_exists (Z : Set (Site d)) (F : Finset (Set (Site d))) + (hF : DisjointFamily F) (rep : Set (Site d) → Site d) + (E : Set (Site d) → Set (Site d)) + (hcover : ∀ x ∈ Z, ∃ H ∈ F, x ∈ H) + (hroute : ∀ H ∈ F, ∀ v ∈ Boundary H, Reach (E H ∩ Zᶜ) (rep H) v) + (hclear : ∀ H ∈ F, Boundary H ⊆ Zᶜ) + {u v : Site d} (huv : Step u v) : + Reach (RouteRegion Z F E u v) (collapse F rep u) (collapse F rep v) := by + by_cases hu : ∃ H ∈ F, u ∈ H + · obtain ⟨H,hH,huH⟩ := hu + rw [collapse_of_mem hF rep hH huH] + by_cases hv : ∃ K ∈ F, v ∈ K + · obtain ⟨K,hK,hvK⟩ := hv + rw [collapse_of_mem hF rep hK hvK] + by_cases hHK : H = K + · subst K; exact reach_refl _ _ + have hvH : v ∉ H := fun hvH => hHK (member_unique hF hH hK hvH hvK) + have huK : u ∉ K := fun huK => hHK (member_unique hF hH hK huH huK) + have hvB : v ∈ Boundary H := ⟨hvH,u,huH,huv⟩ + have huB : u ∈ Boundary K := ⟨huK,v,hvK,step_symm huv⟩ + have hru := reach_mono (region_boundary Z F E u v hH (Or.inl huH)) (hroute H hH v hvB) + have hrv := reach_symm (reach_mono (region_boundary Z F E u v hK (Or.inr hvK)) + (hroute K hK u huB)) + exact hru.trans ((Relation.ReflTransGen.single ⟨step_symm huv, + ⟨Or.inr (Or.inl rfl),hclear H hH hvB⟩,⟨Or.inl rfl,hclear K hK huB⟩⟩).trans hrv) + · rw [collapse_free rep hv] + have hvH : v ∉ H := fun hvH => hv ⟨H,hH,hvH⟩ + exact reach_mono (region_boundary Z F E u v hH (Or.inl huH)) + (hroute H hH v ⟨hvH,u,huH,huv⟩) + · rw [collapse_free rep hu] + by_cases hv : ∃ K ∈ F, v ∈ K + · obtain ⟨K,hK,hvK⟩ := hv + rw [collapse_of_mem hF rep hK hvK] + have huK : u ∉ K := fun huK => hu ⟨K,hK,huK⟩ + exact reach_symm (reach_mono (region_boundary Z F E u v hK (Or.inr hvK)) + (hroute K hK u ⟨huK,v,hvK,step_symm huv⟩)) + · rw [collapse_free rep hv] + exact Relation.ReflTransGen.single ⟨huv, + ⟨Or.inl rfl,fun huZ => hu (hcover u huZ)⟩, + ⟨Or.inr (Or.inl rfl),fun hvZ => hv (hcover v hvZ)⟩⟩ + +def allHulls (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) : Finset (Set (Site d)) := + hZ.toFinset.image (fun x => Hull (Thick 4 (Component Z x)) b) + +def maxHulls (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) : Finset (Set (Site d)) := + (allHulls Z hZ b).filter (fun H => Maximal (· ∈ allHulls Z hZ b) H) + +lemma mem_allHulls (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) (H : Set (Site d)) : + H ∈ allHulls Z hZ b ↔ ∃ x ∈ Z, Hull (Thick 4 (Component Z x)) b = H := by + simp [allHulls] + +lemma mem_maxHulls (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) (H : Set (Site d)) : + H ∈ maxHulls Z hZ b ↔ Maximal (· ∈ allHulls Z hZ b) H := by + simp only [maxHulls,Finset.mem_filter] + exact ⟨And.right,fun h => ⟨h.prop,h⟩⟩ + +lemma allHulls_laminar (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) + (hb : b ∉ Thick 4 Z) {H K : Set (Site d)} + (hH : H ∈ allHulls Z hZ b) (hK : K ∈ allHulls Z hZ b) : + H ⊆ K ∨ K ⊆ H ∨ Disjoint H K := by + obtain ⟨x,hx,rfl⟩ := (mem_allHulls Z hZ b H).mp hH + obtain ⟨y,hy,rfl⟩ := (mem_allHulls Z hZ b K).mp hK + by_cases he : Component Z x = Component Z y + · exact Or.inl (by rw [he]) + have hbC : ∀ a, b ∉ Thick 4 (Component Z a) := by + rintro a ⟨c,hc,hbc⟩; exact hb ⟨c,hc.1,hbc⟩ + exact hull_laminar _ _ (thick_component_connected Z hx) (thick_component_connected Z hy) + (thick_nonempty Z hx) (thick_nonempty Z hy) (thickenings_disjoint Z hx hy he) (hbC x) (hbC y) + +lemma maxHulls_disjoint (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) + (hb : b ∉ Thick 4 Z) : DisjointFamily (maxHulls Z hZ b) := by + intro H hH K hK hne + have hHm := (mem_maxHulls Z hZ b H).mp hH + have hKm := (mem_maxHulls Z hZ b K).mp hK + rcases allHulls_laminar Z hZ b hb hHm.prop hKm.prop with h | h | h + · exact (hne (Set.Subset.antisymm h (hHm.le_of_ge hKm.prop h))).elim + · exact (hne (Set.Subset.antisymm (hKm.le_of_ge hHm.prop h) h)).elim + · exact h + +lemma maxHulls_cover (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) + (hb : b ∉ Thick 4 Z) (x : Site d) (hx : x ∈ Z) : ∃ H ∈ maxHulls Z hZ b, x ∈ H := by + let H := Hull (Thick 4 (Component Z x)) b + have hH : H ∈ allHulls Z hZ b := (mem_allHulls ..).mpr ⟨x,hx,rfl⟩ + obtain ⟨K,hHK,hK⟩ := (allHulls Z hZ b).exists_le_maximal hH + refine ⟨K,(mem_maxHulls ..).mpr hK,hHK ?_⟩ + have hbC : b ∉ Thick 4 (Component Z x) := by + rintro ⟨c,hc,hbc⟩; exact hb ⟨c,hc.1,hbc⟩ + exact subset_hull _ hbC ⟨x,self_mem_component Z hx,ball_self (by omega) x⟩ + +lemma allHulls_boundary_nonempty (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) + (hb : b ∉ Thick 4 Z) {H : Set (Site d)} (hH : H ∈ allHulls Z hZ b) : + (Boundary H).Nonempty := by + obtain ⟨x,hx,rfl⟩ := (mem_allHulls ..).mp hH + have hbC : b ∉ Thick 4 (Component Z x) := by + rintro ⟨c,hc,hbc⟩; exact hb ⟨c,hc.1,hbc⟩ + apply boundary_nonempty _ (subset_hull _ hbC ⟨x,self_mem_component Z hx,ball_self (by omega) x⟩) + exact fun h => h (reach_refl _ _) + +theorem finite_hull_routing (Z : Set (Site d)) (hZ : Z.Finite) (b : Site d) + (hb : b ∉ Thick 4 Z) : + ∃ rep : Set (Site d) → Site d, + (∀ H ∈ maxHulls Z hZ b, rep H ∈ Boundary H) ∧ + (∀ z, collapse (maxHulls Z hZ b) rep z ∉ Z) ∧ + ∀ (c : Set (Site d) → Site d) (r : Set (Site d) → ℤ), + (∀ H ∈ maxHulls Z hZ b, H ⊆ Ball (r H) (c H)) → + ∀ u v, Step u v → + ∃ p : (latticeGraph (RouteRegion Z (maxHulls Z hZ b) + (fun H => Ball (r H + 1) (c H)) u v)).Walk + (collapse (maxHulls Z hZ b) rep u) (collapse (maxHulls Z hZ b) rep v), p.IsPath := by + let F := maxHulls Z hZ b + have hF := maxHulls_disjoint Z hZ b hb + have hBn : ∀ H ∈ F, (Boundary H).Nonempty := fun H hH => + allHulls_boundary_nonempty Z hZ b hb ((mem_maxHulls ..).mp hH).prop + let rep (H : Set (Site d)) : Site d := if h : H ∈ F then (hBn H h).choose else 0 + have hrB : ∀ H ∈ F, rep H ∈ Boundary H := by + intro H hH + simpa only [rep,dite_eq_left hH] using (hBn H hH).choose_spec + have hclear : ∀ H ∈ F, Boundary H ⊆ Zᶜ := by + intro H hH v hv + obtain ⟨x,hx,rfl⟩ := (mem_allHulls ..).mp ((mem_maxHulls ..).mp hH).prop + have hbC : b ∉ Thick 4 (Component Z x) := by + rintro ⟨c,hc,hbc⟩; exact hb ⟨c,hc.1,hbc⟩ + exact boundary_unit_clear Z hbC hv (ball_self (by omega) v) + refine ⟨rep,hrB,collapse_survives Z F rep (maxHulls_cover Z hZ b hb) + (fun H hH => hclear H hH (hrB H hH)),?_⟩ + intro c r hbound u v huv + apply reach_has_simple_path + apply route_exists Z F hF rep _ (maxHulls_cover Z hZ b hb) _ hclear huv + intro H hH w hw + obtain ⟨x,hx,he⟩ := (mem_allHulls ..).mp ((mem_maxHulls ..).mp hH).prop + have hbC : b ∉ Thick 4 (Component Z x) := by + rintro ⟨a,ha,hba⟩; exact hb ⟨a,ha.1,hba⟩ + have hv : rep H ∈ Boundary (Hull (Thick 4 (Component Z x)) b) := by + simpa only [he] using hrB H hH + have hw' : w ∈ Boundary (Hull (Thick 4 (Component Z x)) b) := by + simpa only [he] using hw + have hB : Hull (Thick 4 (Component Z x)) b ⊆ Ball (r H) (c H) := by + simpa only [he] using hbound H hH + exact surviving_boundary_confined Z hx hbC (r H) hB (rep H) w hv hw' + +lemma exists_exterior_base (hd : 1 ≤ d) (Z : Set (Site d)) (hZ : Z.Finite) : + ∃ (r : ℕ) (b : Site d), Thick 4 Z ⊆ Box (r : ℤ) ∧ b ∉ Box (r : ℤ) := by + obtain ⟨r,hr⟩ := finite_contained_box (Thick 4 Z) (thick_finite 4 Z hZ) + refine ⟨r,(fun _ => (r : ℤ)+1),hr,?_⟩ + intro h + have h0 := h ⟨0,by omega⟩ + simp only [abs_of_nonneg (by positivity : (0:ℤ) ≤ (r:ℤ)+1)] at h0 + omega + +end Heisenberg.HullRouting +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/KilledContractions.lean b/lean/OAI/MathematicalPhysics/Heisenberg/KilledContractions.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c6fe95de5931da320e73b4a4d8ebce835f62e5d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/KilledContractions.lean @@ -0,0 +1,342 @@ +import OAI.MathematicalPhysics.Heisenberg.LayerEnergy + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical +open scoped Classical +open Filter +open scoped Classical +open scoped Classical +open Filter Topology +open scoped RealInnerProductSpace Classical + +namespace Heisenberg.MeshPair +open scoped RealInnerProductSpace Classical +variable {V : Type*} [Fintype V] [DecidableEq V] + +def killedPermutation (I : Set V) (σ : Equiv.Perm V) (v : EuclideanSpace ℝ V) : + EuclideanSpace ℝ V := WithLp.toLp 2 (fun i => if i ∈ I then v.ofLp (σ.symm i) else 0) + +def killedCoin (I : Set V) (a b : V) (t : ℝ) (v : EuclideanSpace ℝ V) : + EuclideanSpace ℝ V := (1-t/2) • v + (t/2) • killedPermutation I (Equiv.swap a b) v + +lemma killedCoin_generator (I : Set V) {a b : V} (hab : a ≠ b) (t : ℝ) + (v : EuclideanSpace ℝ V) (hv : ∀ i ∉ I, v.ofLp i = 0) : + killedCoin I a b t v = (1+t • generator (edgeVector I a b)) v := by + ext i + simp only [killedCoin,killedPermutation,PiLp.add_apply,PiLp.smul_apply, + smul_eq_mul,_root_.add_apply,one_apply_eq_self, + _root_.smul_apply,generator_apply] + simp only [edge_inner] + simp only [edgeVector,PiLp.sub_apply,PiLp.single_apply,Equiv.symm_swap] + by_cases hi : i = a + · subst i + rw [Equiv.swap_apply_left] + by_cases ha : a ∈ I <;> by_cases hb : b ∈ I <;> simp [ha,hb,hab,hv] <;> ring + · by_cases hi' : i = b + · subst i + rw [Equiv.swap_apply_right] + by_cases ha : a ∈ I <;> by_cases hb : b ∈ I <;> simp [ha,hb,Ne.symm hab,hv] <;> ring + · rw [Equiv.swap_apply_of_ne_of_ne hi hi'] + by_cases hI : i ∈ I <;> simp [hi,hi',hI,hv] + ring + +omit [Fintype V] in +lemma killedCoin_support (I : Set V) (a b : V) (t : ℝ) (v : EuclideanSpace ℝ V) + (hv : ∀ i ∉ I, v.ofLp i = 0) : + ∀ i ∉ I, (killedCoin I a b t v).ofLp i = 0 := by + intro i hi + simp [killedCoin,killedPermutation,hi,hv i hi] + +lemma killedCoin_bound (I : Set V) {a b : V} (hab : a ≠ b) {t : ℝ} + (ht : 0 ≤ t) (ht1 : t ≤ 1) (v : EuclideanSpace ℝ V) + (hv : ∀ i ∉ I, v.ofLp i = 0) : ‖killedCoin I a b t v‖ ≤ ‖v‖ := by + rw [killedCoin_generator I hab t v hv] + exact (ContinuousLinearMap.le_opNorm _ _).trans (mul_le_of_le_one_left (norm_nonneg _) (step_contraction _ (edge_norm I hab) ht ht1)) + +def killedSweep (I : Set V) (a b : ℕ → V) (t : ℝ) : ℕ → EuclideanSpace ℝ V → EuclideanSpace ℝ V + | 0, v => v + | n+1, v => killedCoin I (a n) (b n) t (killedSweep I a b t n v) + +omit [Fintype V] in +lemma killedSweep_support (I : Set V) (a b : ℕ → V) (t : ℝ) (n : ℕ) + (v : EuclideanSpace ℝ V) (hv : ∀ i ∉ I, v.ofLp i = 0) : + ∀ i ∉ I, (killedSweep I a b t n v).ofLp i = 0 := by + induction n with + | zero => exact hv + | succ n ih => exact killedCoin_support I (a n) (b n) t _ ih + +lemma killedSweep_eq (I : Set V) (a b : ℕ → V) (n : ℕ) + (hab : ∀ i generator (edgeVector I (a i) (b i))) n t v := by + induction n with + | zero => rfl + | succ n ih => + rw [killedSweep,killedCoin_generator I (hab n (by omega)) t _ + (killedSweep_support I a b t n v hv),ih (fun i hi => hab i (by omega))] + rfl + +theorem killedSweep_energy (I : Set V) (a b : ℕ → V) (n : ℕ) + (hab : ∀ i hU.nonneg j i, hU.col, hU.row⟩ + +lemma DoublySubstochastic.mul {U W : Matrix V V ℝ} + (hU : DoublySubstochastic U) (hW : DoublySubstochastic W) : + DoublySubstochastic (U * W) := by + constructor + · intro i j + exact Finset.sum_nonneg (fun k _ => mul_nonneg (hU.nonneg i k) (hW.nonneg k j)) + · intro i + change (∑ j, ∑ k, U i k * W k j) ≤ 1 + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum] + exact (Finset.sum_le_sum (fun k _ => + mul_le_of_le_one_right (hU.nonneg i k) (hW.row k))).trans (hU.row i) + · intro j + change (∑ i, ∑ k, U i k * W k j) ≤ 1 + rw [Finset.sum_comm] + simp_rw [← Finset.sum_mul] + exact (Finset.sum_le_sum (fun k _ => + mul_le_of_le_one_left (hW.nonneg k j) (hU.col k))).trans (hW.col j) + +lemma weighted_square (w f : V → ℝ) (hw : ∀ i, 0 ≤ w i) : + (∑ i, w i * f i) ^ 2 ≤ (∑ i, w i) * ∑ i, w i * f i ^ 2 := by + have h := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ + (fun i => Real.sqrt (w i)) (fun i => Real.sqrt (w i) * f i) + simpa only [← mul_assoc, Real.mul_self_sqrt (hw _), mul_pow, + Real.sq_sqrt (hw _)] using h + +theorem contraction {U : Matrix V V ℝ} (hU : DoublySubstochastic U) (f : V → ℝ) : + ∑ i, ((U.mulVec f) i) ^ 2 ≤ ∑ i, (f i) ^ 2 := by + calc + _ ≤ ∑ i, (∑ j, U i j) * (∑ j, U i j * f j ^ 2) := by + exact Finset.sum_le_sum (fun i _ => weighted_square (U i) f (hU.nonneg i)) + _ ≤ ∑ i, ∑ j, U i j * f j ^ 2 := by + apply Finset.sum_le_sum + intro i _ + exact mul_le_of_le_one_left + (Finset.sum_nonneg (fun j _ => mul_nonneg (hU.nonneg i j) (sq_nonneg _))) (hU.row i) + _ = ∑ j, (∑ i, U i j) * f j ^ 2 := by + rw [Finset.sum_comm] + simp_rw [Finset.sum_mul] + _ ≤ _ := Finset.sum_le_sum (fun j _ => mul_le_of_le_one_left (sq_nonneg _) (hU.col j)) + +theorem of_partial_permutation (p : V → Option V) + (hp : ∀ i j a, p i = some a → p j = some a → i = j) : + DoublySubstochastic (fun i j => if p j = some i then 1 else 0) := by + constructor + · intro i j; split_ifs <;> norm_num + · intro i + have hc : (Finset.univ.filter fun j => p j = some i).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro j hj k hk + exact hp j k i (Finset.mem_filter.mp hj).2 (Finset.mem_filter.mp hk).2 + simpa only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one, + Nat.cast_le_one] using (show ((Finset.univ.filter fun j => p j = some i).card : ℝ) ≤ 1 by + exact_mod_cast hc) + · intro j + cases hj : p j with + | none => simp + | some i => simp + +theorem weighted_average {I : Type*} [Fintype I] (w : I → ℝ) (hw : ∀ a, 0 ≤ w a) + (hs : ∑ a, w a = 1) (U : I → Matrix V V ℝ) + (hU : ∀ a, DoublySubstochastic (U a)) : + DoublySubstochastic (fun i j => ∑ a, w a * U a i j) := by + constructor + · intro i j + exact Finset.sum_nonneg (fun a _ => mul_nonneg (hw a) ((hU a).nonneg i j)) + · intro i + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum] + calc + _ ≤ ∑ a, w a := Finset.sum_le_sum (fun a _ => + mul_le_of_le_one_right (hw a) ((hU a).row i)) + _ = 1 := hs + · intro j + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum] + calc + _ ≤ ∑ a, w a := Finset.sum_le_sum (fun a _ => + mul_le_of_le_one_right (hw a) ((hU a).col j)) + _ = 1 := hs + +def squareNorm (f : V → ℝ) : ℝ := ∑ i, f i ^ 2 + +def dot (f g : V → ℝ) : ℝ := ∑ i, f i * g i + +lemma dot_half (f g : V → ℝ) : + 2 * dot f g ≤ squareNorm f + squareNorm g := by + have h : 0 ≤ ∑ i, (f i - g i) ^ 2 := Finset.sum_nonneg (fun i _ => sq_nonneg _) + have he : (∑ i, (f i - g i) ^ 2) = squareNorm f + squareNorm g - 2 * dot f g := by + unfold squareNorm dot + simp_rw [sub_sq, Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.mul_sum] + ring_nf + linarith + +lemma dot_transpose (B : Matrix V V ℝ) (f g : V → ℝ) : + dot f (B.mulVec g) = dot (B.transpose.mulVec f) g := by + simp only [dot, Matrix.mulVec, dotProduct, Finset.mul_sum, Finset.sum_mul, Matrix.transpose_apply] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem two_ends (A M B : Matrix V V ℝ) (hM : DoublySubstochastic M) (f : V → ℝ) : + squareNorm f - dot f ((B * M * A).mulVec f) ≥ + ((squareNorm f - squareNorm (A.mulVec f)) + + (squareNorm f - squareNorm (B.transpose.mulVec f))) / 2 := by + have he : (B * M * A).mulVec f = B.mulVec (M.mulVec (A.mulVec f)) := by + rw [Matrix.mulVec_mulVec, Matrix.mulVec_mulVec] + rw [he, dot_transpose] + have h := dot_half (B.transpose.mulVec f) (M.mulVec (A.mulVec f)) + have hc := contraction hM (A.mulVec f) + change squareNorm (M.mulVec (A.mulVec f)) ≤ squareNorm (A.mulVec f) at hc + linarith + +end Heisenberg.MatrixContraction + +namespace Heisenberg.MeshPair +open Heisenberg.MatrixContraction Matrix +open scoped BigOperators +variable {V : Type*} [Fintype V] [DecidableEq V] + +def killedMatrix (D : Set V) (σ : Equiv.Perm V) : Matrix V V ℝ := fun i j => + if j ∈ D ∧ σ j ∈ D then if i=σ j then 1 else 0 else 0 + +lemma killedMatrix_substochastic (D : Set V) (σ : Equiv.Perm V) : + DoublySubstochastic (killedMatrix D σ) := by + classical + have h := of_partial_permutation (fun j => if j ∈ D ∧ σ j ∈ D then some (σ j) else none) (by + intro i j a hi hj + split_ifs at hi hj with hiD hjD + exact σ.injective ((Option.some.inj hi).trans (Option.some.inj hj).symm)) + have he : killedMatrix D σ = (fun i j => if (if j ∈ D ∧ σ j ∈ D then some (σ j) else none) = some i then (1:ℝ) else 0) := by + ext i j + simp only [killedMatrix] + split_ifs <;> simp_all [eq_comm] + rw [he] + convert h using 1 + apply Iff.of_eq + apply congrArg DoublySubstochastic + funext i j + split_ifs <;> rfl + +def residualMatrix (D : Set V) (R : Prop) (c : Bool) (a b : V) (p : ℝ) : Matrix V V ℝ := + if R then killedMatrix D (if c then Equiv.swap a b else 1) + else (1-p) • killedMatrix D 1 + p • killedMatrix D (Equiv.swap a b) + +lemma residualMatrix_substochastic (D : Set V) (R : Prop) (c : Bool) + (a b : V) (p : ℝ) (hp : 0≤p) (hp1 : p≤1) : + DoublySubstochastic (residualMatrix D R c a b p) := by + by_cases hR : R + · simp only [residualMatrix,ite_eq_left hR] + apply killedMatrix_substochastic + · simp only [residualMatrix,ite_eq_right hR] + have h := weighted_average (fun z : Bool => if z then p else 1-p) + (by intro z; cases z <;> simp <;> linarith) + (by simp) (fun z => killedMatrix D (if z then Equiv.swap a b else 1)) + (fun _ => killedMatrix_substochastic _ _) + have he : (1-p) • killedMatrix D 1 + p • killedMatrix D (Equiv.swap a b) = + (fun i j => ∑ z : Bool,(if z then p else 1-p)*killedMatrix D (if z then Equiv.swap a b else 1) i j) := by + ext i j + simp [Matrix.add_apply,Matrix.smul_apply,smul_eq_mul,add_comm] + rw [he] + exact h + +def euclideanMap (K : Matrix V V ℝ) : EuclideanSpace ℝ V →ₗ[ℝ] EuclideanSpace ℝ V where + toFun v := WithLp.toLp 2 (K *ᵥ v.ofLp) + map_add' v w := by ext i; simp [Matrix.mulVec_add] + map_smul' r v := by ext i; simp [Matrix.mulVec_smul] + +omit [DecidableEq V] in +@[simp] lemma euclideanMap_apply (K : Matrix V V ℝ) (v : EuclideanSpace ℝ V) (i : V) : + (euclideanMap K v).ofLp i=(K *ᵥ v.ofLp) i := rfl + +omit [DecidableEq V] in +lemma euclideanMap_contraction (K : Matrix V V ℝ) (hK : DoublySubstochastic K) + (v : EuclideanSpace ℝ V) : ‖euclideanMap K v‖ ≤ ‖v‖ := by + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [EuclideanSpace.real_norm_sq_eq,EuclideanSpace.real_norm_sq_eq] + exact contraction hK v.ofLp + +lemma killedMatrix_apply (D : Set V) (σ : Equiv.Perm V) (v : EuclideanSpace ℝ V) + (hv : ∀ i ∉ D,v.ofLp i=0) : + euclideanMap (killedMatrix D σ) v = killedPermutation D σ v := by + ext i + simp only [euclideanMap_apply,Matrix.mulVec,dotProduct,killedMatrix,killedPermutation] + rw [Finset.sum_eq_single (σ.symm i)] + · by_cases hi : i ∈ D <;> by_cases hj : σ.symm i ∈ D <;> simp [hi,hj,hv] + · intro j _ hj + have hh : i ≠ σ j := by intro he; apply hj; exact (σ.symm_apply_eq.mpr he).symm + simp [hh] + · simp + +lemma killedMatrix_identity (D : Set V) (v : EuclideanSpace ℝ V) + (hv : ∀ i ∉ D,v.ofLp i=0) : euclideanMap (killedMatrix D 1) v=v := by + rw [killedMatrix_apply D 1 v hv] + ext i + by_cases hi : i ∈ D + · simp only [killedPermutation,hi,ite_true] + rfl + · simp [killedPermutation,hi,hv] + +lemma residual_quiet (H D : Set V) (a b : V) (p : ℝ) + (v : EuclideanSpace ℝ V) (hv : ∀ i ∉ D,v.ofLp i=0) : + euclideanMap (residualMatrix D (a ∉ H ∨ b ∉ H) false a b p) v = + if a ∈ H ∧ b ∈ H then killedCoin D a b (2*p) v else v := by + by_cases hh : a ∈ H ∧ b ∈ H + · simp only [residualMatrix,show ¬(a ∉ H ∨ b ∉ H) by tauto,ite_false,ite_eq_left hh] + have he : euclideanMap ((1-p) • killedMatrix D 1 + p • killedMatrix D (Equiv.swap a b)) v = + (1-p) • euclideanMap (killedMatrix D 1) v + p • euclideanMap (killedMatrix D (Equiv.swap a b)) v := by + ext i + simp only [euclideanMap_apply,Matrix.add_mulVec,Matrix.smul_mulVec,PiLp.add_apply, + PiLp.smul_apply,Pi.add_apply,Pi.smul_apply,smul_eq_mul] + rw [he,killedMatrix_identity D v hv,killedMatrix_apply D _ v hv] + simp [killedCoin] + · simp only [residualMatrix,show a ∉ H ∨ b ∉ H by tauto,ite_true,Bool.false_eq_true, + ite_false,ite_eq_right hh] + exact killedMatrix_identity D v hv + +end Heisenberg.MeshPair +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LatticeCuts.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeCuts.lean new file mode 100644 index 0000000000000000000000000000000000000000..c978b55701fca80f79d4143c793344d94ae82f5e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeCuts.lean @@ -0,0 +1,356 @@ +import OAI.MathematicalPhysics.Heisenberg.LatticePaths + +namespace OAI + +noncomputable section +open scoped Classical + +namespace Heisenberg.Geometry + +def Ball {d : ℕ} (r : ℤ) (x : Site d) : Set (Site d) := + {z | ∀ j, |z j - x j| ≤ r} + +lemma step_translate {d : ℕ} (u : Site d) {x y : Site d} (h : Step x y) : + Step (u + x) (u + y) := by + obtain ⟨j, hj, hk⟩ := h + refine ⟨j, ?_, ?_⟩ + · simp only [Pi.add_apply] + rcases hj with h | h + · left; omega + · right; omega + · intro k hkj + simp only [Pi.add_apply, hk k hkj] + +lemma reach_translate {d : ℕ} (u : Site d) (U W : Set (Site d)) + (hUW : ∀ z ∈ U, u + z ∈ W) {x y : Site d} (h : Reach U x y) : + Reach W (u + x) (u + y) := by + induction h with + | refl => exact reach_refl W (u + x) + | @tail b c hbc hstep ih => + exact ih.tail ⟨step_translate u hstep.1, hUW b hstep.2.1, hUW c hstep.2.2⟩ + +lemma translate_mem_ball {d : ℕ} (u z : Site d) (r : ℤ) : + u + z ∈ Ball r u ↔ z ∈ Box r := by + simp [Ball, Box] + +def ballFinset (d r : ℕ) (u : Site d) : Finset (Site d) := + (boxFinset d r).image (fun z => u + z) + +@[simp] lemma mem_ballFinset (d r : ℕ) (u z : Site d) : + z ∈ ballFinset d r u ↔ z ∈ Ball r u := by + constructor + · intro hz + obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp hz + exact (translate_mem_ball u a r).mpr ((mem_boxFinset ..).mp ha) + · intro hz + apply Finset.mem_image.mpr + refine ⟨z - u, ?_, by abel⟩ + exact (mem_boxFinset ..).mpr hz + +lemma ballFinset_card (d r : ℕ) (u : Site d) : + (ballFinset d r u).card = (2 * r + 1) ^ d := by + rw [ballFinset, Finset.card_image_of_injective _ (add_right_injective u), card_boxFinset] + +theorem local_connectivity {d : ℕ} (hd : 2 ≤ d) (K : ℕ) (hK : 1 ≤ K) + (u v : Site d) (F : Set (Site d)) (hvu : v ∈ Ball K u) + (huF : u ∉ F) (hvF : v ∉ F) + (hF : ((ballFinset d (K + 2 * d) u).filter (· ∈ F)).card < 2 * d) : + ∃ p : (latticeGraph (Ball (K + 2 * d) u \ F)).Walk u v, + p.IsPath ∧ p.length ≤ (2 * (K + 2 * d) + 1) ^ d := by + let C := (ballFinset d (K + 2 * d) u).filter (· ∈ F) + let G := C.image (fun z => z - u) + have hG : G.card < 2 * d := (Finset.card_image_le).trans_lt hF + have hzero : (0 : Site d) ∉ G := by + intro hz + obtain ⟨a, ha, he⟩ := Finset.mem_image.mp hz + have hae : a = u := sub_eq_zero.mp he + exact huF (hae ▸ (Finset.mem_filter.mp ha).2) + have hvG : v - u ∉ G := by + intro hz + obtain ⟨a, ha, he⟩ := Finset.mem_image.mp hz + have hae : a = v := sub_left_injective he + exact hvF (hae ▸ (Finset.mem_filter.mp ha).2) + have hzbox : (0 : Site d) ∈ Box K := by intro j; simp + have hvbox : v - u ∈ Box K := hvu + have hconn := finite_obstacle_connection hd K (by positivity) 0 (v - u) + hzbox hvbox G hzero hvG hG + have hball : Reach (Ball (K + 2 * d) u \ F) u v := by + have h := reach_translate u (Box (K + 2 * d) \ (G : Set (Site d))) + (Ball (K + 2 * d) u \ F) (fun z hz => ?_) hconn + · have he : u + (v - u) = v := by abel + simpa only [add_zero, he] using h + · refine ⟨(translate_mem_ball ..).mpr hz.1, ?_⟩ + intro hzF + apply hz.2 + apply Finset.mem_image.mpr + refine ⟨u + z, Finset.mem_filter.mpr ⟨?_, hzF⟩, by abel⟩ + apply (mem_ballFinset ..).mpr + simpa only [Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] using + (translate_mem_ball u z (K + 2 * d)).mpr hz.1 + obtain ⟨p, hp⟩ := reach_has_simple_path _ u v hball + refine ⟨p, hp, ?_⟩ + have hsupport : p.support.toFinset ⊆ ballFinset d (K + 2 * d) u := by + intro z hz + apply (mem_ballFinset ..).mpr + have hzU := path_support_mem (Ball (K + 2 * d) u \ F) u v + ⟨by intro j; simp; positivity, huF⟩ p z (List.mem_toFinset.mp hz) + simpa only [Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] using hzU.1 + have hc := Finset.card_le_card hsupport + rw [List.toFinset_card_of_nodup hp.support_nodup, SimpleGraph.Walk.length_support, + ballFinset_card] at hc + omega + +end Heisenberg.Geometry + +namespace Heisenberg.LatticePotential +variable {A : Type*} [AddCommGroup A] + +def integral (f : ℤ → A) : ℤ → A + | .ofNat n => ∑ k ∈ Finset.range n, f k + | .negSucc n => -(∑ k ∈ Finset.range (n+1), f (-(k:ℤ)-1)) + +@[simp] lemma integral_zero (f : ℤ → A) : integral f 0 = 0 := by simp [integral] + +lemma integral_succ (f : ℤ → A) (z : ℤ) : integral f (z+1) = integral f z + f z := by + cases z with + | ofNat n => + change (∑ k ∈ Finset.range (n+1), f (k:ℤ)) = (∑ k ∈ Finset.range n, f (k:ℤ)) + f (n:ℤ) + exact Finset.sum_range_succ (fun k => f (k:ℤ)) n + | negSucc n => + cases n with + | zero => simp [integral] + | succ n => + change -(∑ k ∈ Finset.range (n+1), f (-(k:ℤ)-1)) = + -(∑ k ∈ Finset.range (n+1+1), f (-(k:ℤ)-1)) + f (Int.negSucc (n+1)) + rw [Finset.sum_range_succ (fun k : ℕ => f (-(k:ℤ)-1)) (n+1)] + have he : Int.negSucc (n+1) = -((n+1:ℕ):ℤ)-1 := by omega + rw [he] + abel + +lemma integral_ext_zero (f g : ℤ → A) (h0 : f 0 = g 0) + (h : ∀ z, f (z+1)-f z = g (z+1)-g z) : f = g := by + funext z + induction z using Int.induction_on with + | zero => exact h0 + | succ z ih => have := h z; rw [ih] at this; simpa only [Nat.cast_add,Nat.cast_one] using sub_left_inj.mp this + | pred z ih => + have he := h (-(z:ℤ)-1) + simp only [sub_add_cancel] at he + rw [ih] at he + exact sub_right_inj.mp he + +lemma integral_sub (f g : ℤ → A) (z : ℤ) : + integral (fun k => f k-g k) z = integral f z-integral g z := by + cases z <;> simp [integral,Finset.sum_sub_distrib]; abel + +lemma integral_telescoping (f : ℤ → A) (z : ℤ) : + integral (fun k => f (k+1)-f k) z = f z-f 0 := by + have h := integral_ext_zero (integral (fun k => f (k+1)-f k)) (fun z => f z-f 0) + (by simp) (fun k => by rw [integral_succ]; abel) + exact congrFun h z + +abbrev Site (d : ℕ) := Fin d → ℤ + +def shift {d : ℕ} (x : Site d) (i : Fin d) : Site d := Function.update x i (x i+1) + +lemma shift_cons_zero {d : ℕ} (a : ℤ) (x : Site d) : + shift (Fin.cons a x) 0 = Fin.cons (a+1) x := by + funext j + refine Fin.cases ?_ (fun j => ?_) j <;> simp [shift] + +lemma shift_cons_succ {d : ℕ} (a : ℤ) (x : Site d) (i : Fin d) : + shift (Fin.cons a x) i.succ = Fin.cons a (shift x i) := by + funext j + refine Fin.cases ?_ (fun j => ?_) j + · simp [shift,Function.update_of_ne (Ne.symm (Fin.succ_ne_zero i))] + · by_cases he : j = i + · subst j; simp [shift] + · simp [shift,he] + +def Closed {d : ℕ} (F : Site d → Fin d → A) : Prop := + ∀ x i j, F x i+F (shift x i) j = F x j+F (shift x j) i + +theorem exists_potential (d : ℕ) (F : Site d → Fin d → A) (hF : Closed F) : + ∃ g : Site d → A, ∀ x i, g (shift x i)-g x = F x i := by + induction d with + | zero => exact ⟨fun _ => 0, fun _ i => Fin.elim0 i⟩ + | succ d ih => + let F₀ : Site d → Fin d → A := fun x i => F (Fin.cons 0 x) i.succ + have h₀ : Closed F₀ := by + intro x i j + simpa only [F₀,shift_cons_succ] using hF (Fin.cons 0 x) i.succ j.succ + obtain ⟨g₀,hg₀⟩ := ih F₀ h₀ + let g : Site (d+1) → A := fun x => + g₀ (Fin.tail x)+integral (fun k => F (Fin.cons k (Fin.tail x)) 0) (x 0) + refine ⟨g,?_⟩ + intro x i + have hx : x = Fin.cons (x 0) (Fin.tail x) := (Fin.cons_self_tail x).symm + nth_rw 1 [hx] + rw [hx] + generalize x 0 = a + generalize Fin.tail x = y + refine Fin.cases ?_ (fun j => ?_) i + · rw [shift_cons_zero] + simp only [g,Fin.tail_cons,Fin.cons_zero,integral_succ] + abel + · rw [shift_cons_succ] + simp only [g,Fin.tail_cons,Fin.cons_zero] + have hdiff : (fun k => F (Fin.cons k (shift y j)) 0-F (Fin.cons k y) 0) = + (fun k => F (Fin.cons (k+1) y) j.succ-F (Fin.cons k y) j.succ) := by + funext k + have hc := hF (Fin.cons k y) 0 j.succ + rw [shift_cons_zero,shift_cons_succ] at hc + apply sub_eq_sub_iff_add_eq_add.mpr + simpa only [add_comm] using hc.symm + have hent := integral_telescoping (fun k => F (Fin.cons k y) j.succ) a + rw [← hdiff,integral_sub] at hent + have hbase := hg₀ y j + dsimp only [F₀] at hbase + calc + _ = (g₀ (shift y j)-g₀ y) + + (integral (fun k => F (Fin.cons k (shift y j)) 0) a - + integral (fun k => F (Fin.cons k y) 0) a) := by abel + _ = _ := by rw [hbase,hent]; abel + +end Heisenberg.LatticePotential + +namespace Heisenberg.LatticeCut +open Heisenberg.LatticePotential +abbrev Edge (d : ℕ) := Site d × Fin d + +def color {d : ℕ} (H : Set (Site d)) (x : Site d) : ℤ := if x ∈ H then 1 else 0 + +def Cut {d : ℕ} (H : Set (Site d)) (e : Edge d) : Prop := color H e.1 ≠ color H (shift e.1 e.2) + +def square {d : ℕ} (x : Site d) (i j : Fin d) : Finset (Edge d) := + {(x,i),(shift x i,j),(x,j),(shift x j,i)} + +def Linked {d : ℕ} (H : Set (Site d)) (e f : Edge d) : Prop := + Cut H e ∧ Cut H f ∧ ∃ x i j, i ≠ j ∧ e ∈ square x i j ∧ f ∈ square x i j + +def CutReach {d : ℕ} (H : Set (Site d)) (e f : Edge d) := Relation.ReflTransGen (Linked H) e f + +lemma cutReach_cut {d : ℕ} {H : Set (Site d)} {e f : Edge d} (he : Cut H e) (h : CutReach H e f) : Cut H f := by + induction h with + | refl => exact he + | tail _ h _ => exact h.2.1 + +lemma cutReach_square {d : ℕ} {H : Set (Site d)} {e f f' : Edge d} {x : Site d} {i j : Fin d} + (he : Cut H e) (h : CutReach H e f) (hf : f ∈ square x i j) (hf' : f' ∈ square x i j) + (hc : Cut H f') (hij : i ≠ j) : CutReach H e f' := by + exact h.tail ⟨cutReach_cut he h,hc,⟨x,i,j,hij,hf,hf'⟩⟩ + +def gradient {d : ℕ} (H : Set (Site d)) (e : Edge d) (x : Site d) (i : Fin d) : ℤ := + if CutReach H e (x,i) then color H (shift x i)-color H x else 0 + +lemma shift_comm {d : ℕ} (x : Site d) (i j : Fin d) : shift (shift x i) j = shift (shift x j) i := by + by_cases hij : i = j + · subst j; rfl + funext k + by_cases hki : k = i + · subst k; simp [shift,Function.update_of_ne hij,Function.update_of_ne (Ne.symm hij)] + by_cases hkj : k = j + · subst k; simp [shift,Function.update_of_ne hij,Function.update_of_ne (Ne.symm hij)] + simp [shift,Function.update_of_ne hki,Function.update_of_ne hkj] + +lemma gradient_closed {d : ℕ} (H : Set (Site d)) (e : Edge d) (he : Cut H e) : Closed (gradient H e) := by + intro x i j + by_cases hij : i = j + · subst j; rfl + by_cases h : ∃ f ∈ square x i j, CutReach H e f + · obtain ⟨f,hf,hr⟩ := h + have hg : ∀ f' ∈ square x i j, + gradient H e f'.1 f'.2 = color H (shift f'.1 f'.2)-color H f'.1 := by + intro f' hf' + by_cases hc : Cut H f' + · exact ite_eq_left (cutReach_square he hr hf hf' hc hij) + · have hs : color H (shift f'.1 f'.2)-color H f'.1 = 0 := by + exact sub_eq_zero.mpr (not_not.mp hc).symm + simp [gradient,hs] + have h1 := hg (x,i) (by simp [square]) + have h2 := hg (shift x i,j) (by simp [square]) + have h3 := hg (x,j) (by simp [square]) + have h4 := hg (shift x j,i) (by simp [square]) + rw [h1,h2,h3,h4] + dsimp only + rw [shift_comm x i j] + omega + · have hg : ∀ f ∈ square x i j, gradient H e f.1 f.2 = 0 := by + intro f hf + exact ite_eq_right (fun hr => h ⟨f,hf,hr⟩) + rw [hg (x,i) (by simp [square]),hg (shift x i,j) (by simp [square]), + hg (x,j) (by simp [square]),hg (shift x j,i) (by simp [square])] + +def Connected {d : ℕ} (H : Set (Site d)) : Prop := + ∀ x ∈ H, ∀ y ∈ H, Heisenberg.Geometry.Reach H x y + +lemma step_shift {d : ℕ} {x y : Site d} (h : Heisenberg.Geometry.Step x y) : + (∃ i, y = shift x i) ∨ (∃ i, x = shift y i) := by + obtain ⟨i,hi,hother⟩ := h + rcases hi with hi | hi + · left + refine ⟨i,?_⟩ + funext j + by_cases hji : j = i + · subst j; simpa [shift] using hi + · simpa [shift,Function.update_of_ne hji] using hother j hji + · right + refine ⟨i,?_⟩ + funext j + by_cases hji : j = i + · subst j; simpa [shift] using hi + · simpa [shift,Function.update_of_ne hji] using (hother j hji).symm + +lemma potential_constant {d : ℕ} (H : Set (Site d)) (e : Edge d) (g : Site d → ℤ) + (hg : ∀ x i, g (shift x i)-g x = gradient H e x i) {U : Set (Site d)} + (hU : ∀ x ∈ U, ∀ y ∈ U, color H x = color H y) + {x y : Site d} (h : Heisenberg.Geometry.Reach U x y) : g x = g y := by + induction h with + | refl => rfl + | @tail a b hab hstep ih => + have hcol := hU a hstep.2.1 b hstep.2.2 + have he : g a = g b := by + rcases step_shift hstep.1 with ⟨j,rfl⟩ | ⟨j,rfl⟩ + · have hb := hg a j + simp only [gradient,← hcol,sub_self,ite_self] at hb + omega + · have hb := hg b j + simp only [gradient,hcol,sub_self,ite_self] at hb + omega + exact ih.trans he + +theorem cut_connected {d : ℕ} (H : Set (Site d)) (hH : Connected H) (hU : Connected Hᶜ) + (e f : Edge d) (he : Cut H e) (hf : Cut H f) : CutReach H e f := by + obtain ⟨g,hg⟩ := exists_potential d (gradient H e) (gradient_closed H e he) + have hconst : ∀ x y, (x ∈ H ↔ y ∈ H) → g x = g y := by + intro x y hxy + by_cases hx : x ∈ H + · apply potential_constant H e g hg (U := H) (fun z hz w hw => by simp [color,hz,hw]) + exact hH x hx y (hxy.mp hx) + · have hy : y ∈ Hᶜ := fun hy => hx (hxy.mpr hy) + apply potential_constant H e g hg (U := Hᶜ) (fun z hz w hw => by simp [color, show z ∉ H from hz, show w ∉ H from hw]) + exact hU x hx y hy + by_contra hn + have hf0 := hg f.1 f.2 + simp only [gradient,ite_eq_right hn] at hf0 + have her : CutReach H e e := Relation.ReflTransGen.refl + have he1 := hg e.1 e.2 + simp only [gradient,ite_eq_left her] at he1 + unfold Cut color at he hf + by_cases heH : e.1 ∈ H <;> by_cases heH' : shift e.1 e.2 ∈ H <;> + by_cases hfH : f.1 ∈ H <;> by_cases hfH' : shift f.1 f.2 ∈ H <;> + simp only [heH,heH',hfH,hfH',↓reduceIte,ne_eq] at he hf + all_goals try contradiction + all_goals + simp only [color,heH,heH',↓reduceIte] at he1 + have ha := hconst e.1 (if e.1 ∈ H ↔ f.1 ∈ H then f.1 else shift f.1 f.2) + (by split_ifs <;> simp_all) + have hb := hconst (shift e.1 e.2) (if shift e.1 e.2 ∈ H ↔ f.1 ∈ H then f.1 else shift f.1 f.2) + (by split_ifs <;> simp_all) + simp only [heH,heH',hfH,iff_self,true_iff,false_iff,not_true_eq_false,↓reduceIte] at ha hb + omega + +end Heisenberg.LatticeCut +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LatticeFlows.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeFlows.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcfe901e1cf26775ca1c295980df0081bcd0b7b0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeFlows.lean @@ -0,0 +1,261 @@ +import OAI.MathematicalPhysics.Heisenberg.NetworkEnergy + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module + +open scoped Classical + +namespace Heisenberg.Flow + +abbrev Orthant (k : ℕ) := Fin (k + 1) → ℕ + +def level {k : ℕ} (n : Orthant k) : ℕ := ∑ j, n j + +def layerMass (k N : ℕ) : ℝ := ((N + k).choose k : ℝ)⁻¹ + +lemma layerMass_pos (k N : ℕ) : 0 < layerMass k N := by + apply inv_pos.mpr + exact_mod_cast Nat.choose_pos (by omega : k ≤ N + k) + +lemma layerMass_zero (k : ℕ) : layerMass k 0 = 1 := by simp [layerMass] + +lemma layerMass_recurrence (k N : ℕ) : + layerMass k N * (N + 1) / (N + k + 1) = layerMass k (N + 1) := by + have hc : (0 : ℝ) < (N + k).choose k := by + exact_mod_cast Nat.choose_pos (by omega : k ≤ N + k) + have hc' : (0 : ℝ) < (N + 1 + k).choose k := by + exact_mod_cast Nat.choose_pos (by omega : k ≤ N + 1 + k) + have he := Nat.choose_mul_succ_eq (N + k) k + rw [show N + k + 1 - k = N + 1 by omega, + show N + k + 1 = N + 1 + k by omega] at he + have he' : ((N + k).choose k : ℝ) * (N + k + 1) = + ((N + 1 + k).choose k : ℝ) * (N + 1) := by + exact_mod_cast (by simpa [Nat.add_right_comm] using he) + dsimp [layerMass] + field_simp + nlinarith [he'] + +def orthantFlow {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) : ℝ := + layerMass k (level n) * (n j + 1) / (level n + k + 1) + +lemma flow_nonneg {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) : + 0 ≤ orthantFlow n j := by + unfold orthantFlow + exact div_nonneg (mul_nonneg (layerMass_pos _ _).le (by positivity)) (by positivity) + +lemma coord_le_level {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) : n j ≤ level n := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ j) + +lemma outgoing {k : ℕ} (n : Orthant k) : + ∑ j, orthantFlow n j = layerMass k (level n) := by + have hs : (∑ j : Fin (k + 1), ((n j : ℝ) + 1)) = (level n : ℝ) + k + 1 := by + simp [Finset.sum_add_distrib, level, Nat.cast_sum, add_assoc] + simp only [orthantFlow, ← Finset.sum_div, ← Finset.mul_sum] + rw [hs] + exact mul_div_cancel_right₀ _ (by positivity) + +def predecessor {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) : Orthant k := + Function.update n j (n j - 1) + +lemma predecessor_level {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) (hj : 0 < n j) : + level (predecessor n j) + 1 = level n := by + have hp : predecessor n j j + 1 = n j := by simp [predecessor]; omega + have he : ∑ i ∈ Finset.univ.erase j, predecessor n j i = + ∑ i ∈ Finset.univ.erase j, n i := by + apply Finset.sum_congr rfl + intro i hi + simp [predecessor, (Finset.mem_erase.mp hi).1] + have hsum := Finset.sum_erase_add (Finset.univ : Finset (Fin (k + 1))) + (predecessor n j) (Finset.mem_univ j) + have hsum' := Finset.sum_erase_add (Finset.univ : Finset (Fin (k + 1))) + n (Finset.mem_univ j) + dsimp [level] + omega + +lemma level_zero_iff {k : ℕ} (n : Orthant k) : level n = 0 ↔ n = 0 := by + constructor + · intro h + funext j + have := coord_le_level n j + simp only [Pi.zero_apply] + omega + · rintro rfl; simp [level] + +lemma incoming {k : ℕ} (n : Orthant k) (hn : n ≠ 0) : + ∑ j, (if 0 < n j then orthantFlow (predecessor n j) j else 0) = + layerMass k (level n) := by + have hN : 0 < level n := Nat.pos_of_ne_zero (mt (level_zero_iff n).mp hn) + obtain ⟨N, hlev⟩ := Nat.exists_eq_succ_of_ne_zero hN.ne' + have heach (j : Fin (k + 1)) : + (if 0 < n j then orthantFlow (predecessor n j) j else 0) = + layerMass k N * (n j : ℝ) / (N + k + 1) := by + split_ifs with hj + · have hp := predecessor_level n j hj + have hp' : level (predecessor n j) = N := by omega + have hj' : ((n j - 1 : ℕ) : ℝ) + 1 = n j := by exact_mod_cast Nat.sub_add_cancel hj + rw [orthantFlow, hp'] + simp only [predecessor, Function.update_self] + rw [hj'] + · have hj' : n j = 0 := by omega + simp [hj'] + simp_rw [heach] + rw [← Finset.sum_div, ← Finset.mul_sum, ← Nat.cast_sum] + change layerMass k N * (level n : ℝ) / _ = _ + rw [hlev] + push_cast + exact layerMass_recurrence k N + +theorem orthant_divergence {k : ℕ} (n : Orthant k) : + (∑ j, orthantFlow n j) - + (∑ j, if 0 < n j then orthantFlow (predecessor n j) j else 0) = + if n = 0 then 1 else 0 := by + by_cases hn : n = 0 + · subst n + simp [outgoing, level, layerMass_zero] + · rw [outgoing, incoming n hn, sub_self, ite_eq_right hn] + +lemma flow_le_layerMass {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) : + orthantFlow n j ≤ layerMass k (level n) := by + unfold orthantFlow + apply (div_le_iff₀ (by positivity : (0 : ℝ) < level n + k + 1)).mpr + apply mul_le_mul_of_nonneg_left _ (layerMass_pos _ _).le + have hc : (n j : ℝ) ≤ level n := by exact_mod_cast coord_le_level n j + have hk : (0 : ℝ) ≤ k := Nat.cast_nonneg _ + linarith + +lemma layerMass_decay (k N : ℕ) : + layerMass k N ≤ (k.factorial : ℝ) / (N + 1) ^ k := by + have hprod := Nat.pow_succ_le_ascFactorial (N + 1) k + rw [Nat.ascFactorial_eq_factorial_mul_choose] at hprod + have hprod' : (N + 1 : ℝ) ^ k ≤ (k.factorial : ℝ) * (N + k).choose k := by + exact_mod_cast hprod + have hc : (0 : ℝ) < (N + k).choose k := by + exact_mod_cast Nat.choose_pos (by omega : k ≤ N + k) + have hn : (0 : ℝ) < (N + 1) ^ k := by positivity + rw [layerMass, inv_eq_one_div, div_le_div_iff₀ hc hn] + simpa using hprod' + +theorem orthant_flow_envelope {k : ℕ} (n : Orthant k) (j : Fin (k + 1)) + (h : ℕ) (hh : h ≤ level n) : + |orthantFlow n j| ≤ (k.factorial : ℝ) / (h + 1) ^ k := by + rw [abs_of_nonneg (flow_nonneg n j)] + apply (flow_le_layerMass n j).trans + apply (layerMass_decay k (level n)).trans + apply div_le_div_of_nonneg_left (by positivity) (by positivity) + gcongr + +abbrev ZSite (k : ℕ) := Fin (k + 1) → ℤ + +def PositiveOrthant {k : ℕ} (x : ZSite k) : Prop := ∀ j, 0 ≤ x j + +def natPart {k : ℕ} (x : ZSite k) : Orthant k := fun j => (x j).toNat + +def down {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) : ZSite k := + Function.update x j (x j - 1) + +def latticeFlow {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) : ℝ := + if PositiveOrthant x then orthantFlow (natPart x) j else 0 + +lemma down_positive {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) + (hx : PositiveOrthant x) : PositiveOrthant (down x j) ↔ 0 < x j := by + constructor + · intro hp + have := hp j + simp only [down, Function.update_self] at this + omega + · intro hj i + by_cases hi : i = j + · subst i; simp only [down, Function.update_self]; omega + · simpa [down, hi] using hx i + +lemma positive_of_down {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) + (hx : PositiveOrthant (down x j)) : PositiveOrthant x := by + intro i + by_cases hi : i = j + · subst i + have := hx j + simp only [down, Function.update_self] at this + omega + · have := hx i + simpa [down, hi] using this + +lemma natPart_down {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) : + natPart (down x j) = predecessor (natPart x) j := by + funext i + by_cases hi : i = j + · subst i + simp only [natPart, down, predecessor, Function.update_self] + omega + · simp [natPart, down, predecessor, hi] + +lemma natPart_zero_iff {k : ℕ} (x : ZSite k) (hx : PositiveOrthant x) : + natPart x = 0 ↔ x = 0 := by + constructor + · intro h + funext j + have hj := congrFun h j + have := hx j + simp only [natPart, Pi.zero_apply] at hj ⊢ + omega + · rintro rfl; funext j; rfl + +lemma lattice_incoming_formula {k : ℕ} (x : ZSite k) (hx : PositiveOrthant x) + (j : Fin (k + 1)) : + latticeFlow (down x j) j = + if 0 < natPart x j then orthantFlow (predecessor (natPart x) j) j else 0 := by + have hc : 0 < natPart x j ↔ 0 < x j := by simp [natPart] + by_cases hj : 0 < x j + · rw [latticeFlow, ite_eq_left ((down_positive x j hx).mpr hj), + natPart_down, ite_eq_left (hc.mpr hj)] + · rw [latticeFlow, ite_eq_right (mt (down_positive x j hx).mp hj), + ite_eq_right (mt hc.mp hj)] + +theorem lattice_divergence {k : ℕ} (x : ZSite k) : + (∑ j, latticeFlow x j) - (∑ j, latticeFlow (down x j) j) = + if x = 0 then 1 else 0 := by + by_cases hx : PositiveOrthant x + · simp only [latticeFlow, ite_eq_left hx] + change (∑ j, orthantFlow (natPart x) j) - + (∑ j, latticeFlow (down x j) j) = _ + simp_rw [lattice_incoming_formula x hx] + simp only [orthant_divergence, natPart_zero_iff x hx] + · have hn : x ≠ 0 := by rintro rfl; exact hx (by intro j; simp) + have hp (j : Fin (k + 1)) : ¬PositiveOrthant (down x j) := + mt (positive_of_down x j) hx + simp only [latticeFlow, ite_eq_right hx, ite_eq_right (hp _), Finset.sum_const_zero, + sub_zero, ite_eq_right hn] + +def radius {k : ℕ} (x : ZSite k) : ℕ := Finset.univ.sup (fun j => (x j).natAbs) + +lemma radius_le_level {k : ℕ} (x : ZSite k) (hx : PositiveOrthant x) : + radius x ≤ level (natPart x) := by + apply Finset.sup_le + intro j _ + have he : (x j).natAbs = (x j).toNat := by + have ha := Int.natAbs_of_nonneg (hx j) + have hb := Int.toNat_of_nonneg (hx j) + omega + rw [he] + exact coord_le_level (natPart x) j + +theorem lattice_flow_envelope {k : ℕ} (x : ZSite k) (j : Fin (k + 1)) : + |latticeFlow x j| ≤ (k.factorial : ℝ) / (radius x + 1) ^ k := by + by_cases hx : PositiveOrthant x + · rw [latticeFlow, ite_eq_left hx] + exact orthant_flow_envelope (natPart x) j _ (radius_le_level x hx) + · rw [latticeFlow, ite_eq_right hx, abs_zero] + positivity + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LatticeHulls.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeHulls.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1007ec228ff7426d12bdc72d0d53288bc1867da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeHulls.lean @@ -0,0 +1,248 @@ +import OAI.MathematicalPhysics.Heisenberg.LatticeCuts + +namespace OAI + +noncomputable section +open scoped Classical + +namespace Heisenberg.Geometry + +lemma exists_box {d : ℕ} (x : Site d) : ∃ r : ℕ, x ∈ Box (r : ℤ) := by + refine ⟨Finset.univ.sup (fun i => (x i).natAbs),?_⟩ + intro j + rw [← Int.natCast_natAbs] + exact_mod_cast (Finset.le_sup (f := fun i => (x i).natAbs) (Finset.mem_univ j)) + +lemma exterior_to_shell {d : ℕ} (r R : ℤ) (hr : 0 ≤ r) (hR : r < R) + (x : Site d) (hx : x ∉ Box r) (hxR : x ∈ Box R) : + ∃ y ∈ Shell R, Reach (Box r)ᶜ x y := by + obtain ⟨j,hj⟩ : ∃ j, r < |x j| := by + simpa only [Box,Set.mem_ofPred_eq,not_forall,not_le] using hx + let b : ℤ := if 0 ≤ x j then R else -R + let y := Function.update x j b + have hb : |b| = R := by + dsimp [b] + split_ifs <;> simp [abs_of_nonneg (by omega : 0 ≤ R)] + have hy : y ∈ Shell R := by + refine ⟨?_,j,?_⟩ + · intro k + by_cases hk : k = j + · subst k; simpa [y] using hb.le + · simpa [y,hk] using hxR k + · simpa [y] using hb + refine ⟨y,hy,?_⟩ + rw [← Function.update_eq_self j x] + apply reach_axis + intro t ht₁ ht₂ ht + have htj : |t| ≤ r := by simpa using ht j + have hbound := abs_le.mp (hxR j) + have htbound := abs_le.mp htj + by_cases h : 0 ≤ x j + · have hb' : b = R := ite_eq_left h + rw [hb',min_eq_left hbound.2] at ht₁ + rw [abs_of_nonneg h] at hj + omega + · have hb' : b = -R := ite_eq_right h + rw [hb',max_eq_left hbound.1] at ht₂ + rw [abs_of_neg (by omega)] at hj + omega + +lemma exterior_connected {d : ℕ} (hd : 2 ≤ d) (r : ℤ) (hr : 0 ≤ r) + (x y : Site d) (hx : x ∉ Box r) (hy : y ∉ Box r) : + Reach (Box r)ᶜ x y := by + obtain ⟨a,ha⟩ := exists_box x + obtain ⟨b,hb⟩ := exists_box y + let R : ℤ := max (max a b) (r+1) + have hR : r < R := by have := le_max_right (max (a:ℤ) b) (r+1); dsimp [R]; omega + have haR : (a:ℤ) ≤ R := (le_max_left _ _).trans (le_max_left _ _) + have hbR : (b:ℤ) ≤ R := (le_max_right _ _).trans (le_max_left _ _) + obtain ⟨v,hv,hxv⟩ := exterior_to_shell r R hr hR x hx (box_mono haR ha) + obtain ⟨w,hw,hyw⟩ := exterior_to_shell r R hr hR y hy (box_mono hbR hb) + have hvw : Reach (Box r)ᶜ v w := by + apply reach_mono _ (shell_connected hd R (by omega) v w hv hw) + intro z hz hzr + obtain ⟨j,hj⟩ := hz.2 + have := hzr j + omega + exact hxv.trans (hvw.trans (reach_symm hyw)) + +lemma reach_end_mem {d : ℕ} {U : Set (Site d)} {x y : Site d} + (hx : x ∈ U) (h : Reach U x y) : y ∈ U := by + induction h with + | refl => exact hx + | tail _ h _ => exact h.2.2 + +lemma ambient_connected {d : ℕ} (x y : Site d) : Reach Set.univ x y := + reach_rectangle Set.univ x y (by simp) + +end Heisenberg.Geometry + +namespace Heisenberg.LatticeHull +open Heisenberg.Geometry + +def Hull {d : ℕ} (A : Set (Site d)) (b : Site d) : Set (Site d) := + {x | ¬ Reach Aᶜ b x} + +lemma subset_hull {d : ℕ} (A : Set (Site d)) {b : Site d} (hb : b ∉ A) : A ⊆ Hull A b := by + intro x hx hr + exact reach_end_mem hb hr hx + +lemma complement_connected {d : ℕ} (A : Set (Site d)) (b : Site d) : + Heisenberg.LatticeCut.Connected (Hull A b)ᶜ := by + intro x hx y hy + have hx' : Reach Aᶜ b x := not_not.mp hx + have hy' : Reach Aᶜ b y := not_not.mp hy + have hr : Reach Aᶜ x y := (reach_symm hx').trans hy' + induction hr with + | refl => exact reach_refl _ _ + | @tail z w hz hw ih => + have hz' : Reach Aᶜ b z := hx'.trans hz + exact (ih (not_not.mpr hz') hz').tail ⟨hw.1,not_not.mpr hz',not_not.mpr (hz'.tail hw)⟩ + +lemma inner_endpoint_mem {d : ℕ} (A : Set (Site d)) {b : Site d} (hb : b ∉ A) + {x y : Site d} (hx : x ∈ Hull A b) (hy : y ∉ Hull A b) (hxy : Step x y) : x ∈ A := by + by_contra h + have hy' : Reach Aᶜ b y := not_not.mp hy + exact hx (hy'.tail ⟨step_symm hxy,reach_end_mem hb hy',h⟩) + +lemma hull_connected {d : ℕ} (A : Set (Site d)) (hA : Heisenberg.LatticeCut.Connected A) + (hAn : A.Nonempty) {b : Site d} (hb : b ∉ A) : + Heisenberg.LatticeCut.Connected (Hull A b) := by + obtain ⟨a,ha⟩ := hAn + have hAH := subset_hull A hb + have hAll : ∀ x, x ∉ Hull A b ∨ Reach (Hull A b) a x := by + intro x + have hr := ambient_connected a x + induction hr with + | refl => exact Or.inr (reach_refl _ _) + | @tail z w _ hzw ih => + by_cases hw : w ∈ Hull A b + · right + rcases ih with hz | hz + · have hwA := inner_endpoint_mem A hb hw hz (step_symm hzw.1) + exact reach_mono hAH (hA a ha w hwA) + · exact hz.tail ⟨hzw.1,reach_end_mem (hAH ha) hz,hw⟩ + · exact Or.inl hw + intro x hx y hy + exact (reach_symm ((hAll x).resolve_left (fun h => h hx))).trans + ((hAll y).resolve_left (fun h => h hy)) + +lemma hull_subset_box {d : ℕ} (hd : 2 ≤ d) (A : Set (Site d)) (r : ℤ) (hr : 0 ≤ r) + (hAr : A ⊆ Box r) {b : Site d} (hb : b ∉ Box r) : Hull A b ⊆ Box r := by + intro x hx + by_contra hxr + apply hx + apply reach_mono _ (exterior_connected hd r hr b x hb hxr) + intro z hz hzA + exact hz (hAr hzA) + +lemma base_independence {d : ℕ} (A : Set (Site d)) {b c : Site d} + (hbc : Reach Aᶜ b c) : Hull A b = Hull A c := by + ext x + constructor + · intro hx hcx + exact hx (hbc.trans hcx) + · intro hx hbx + exact hx ((reach_symm hbc).trans hbx) + +lemma box_finite {d : ℕ} (r : ℕ) : (Box (r : ℤ) : Set (Site d)).Finite := by + have he : Box (r : ℤ) = (boxFinset d r : Set (Site d)) := by + ext x; exact (mem_boxFinset ..).symm + rw [he] + exact Finset.finite_toSet _ + +lemma finite_contained_box {d : ℕ} (A : Set (Site d)) (hA : A.Finite) : + ∃ r : ℕ, A ⊆ Box (r : ℤ) := by + have hx : ∀ x ∈ A, ∃ r : ℕ, x ∈ Box (r : ℤ) := fun x _ => exists_box x + choose r hr using hx + let R := hA.toFinset.sup (fun x => if h : x ∈ A then r x h else 0) + refine ⟨R,?_⟩ + intro x hx + apply box_mono _ (hr x hx) + have hle : r x hx ≤ R := by + simpa only [dite_eq_left hx] using Finset.le_sup (f := fun x => if h : x ∈ A then r x h else 0) + (hA.mem_toFinset.mpr hx) + exact_mod_cast hle + +lemma hull_finite {d : ℕ} (hd : 2 ≤ d) (A : Set (Site d)) (r : ℕ) + (hAr : A ⊆ Box (r : ℤ)) {b : Site d} (hb : b ∉ Box (r : ℤ)) : + (Hull A b).Finite := + (box_finite r).subset (hull_subset_box hd A r (by positivity) hAr hb) + +lemma exterior_iff_unbounded {d : ℕ} (hd : 2 ≤ d) (A : Set (Site d)) (r : ℕ) + (hAr : A ⊆ Box (r : ℤ)) {b x : Site d} (hb : b ∉ Box (r : ℤ)) : + x ∉ Hull A b ↔ ∀ R : ℕ, ∃ y, Reach Aᶜ x y ∧ y ∉ Box (R : ℤ) := by + have hbA : b ∉ A := fun h => hb (hAr h) + constructor + · intro hx R + let y : Site d := fun _ => (max r R : ℕ)+1 + have hy : y ∉ Box (max r R : ℕ) := by + intro h + have h0 := h ⟨0,by omega⟩ + simp only [y,abs_of_nonneg (by positivity : (0:ℤ) ≤ (max r R : ℕ)+1)] at h0 + omega + have hyr : y ∉ Box (r:ℤ) := fun h => hy (box_mono (by exact_mod_cast Nat.le_max_left r R) h) + have hyR : y ∉ Box (R:ℤ) := fun h => hy (box_mono (by exact_mod_cast Nat.le_max_right r R) h) + refine ⟨y,?_,hyR⟩ + apply (reach_symm (not_not.mp hx)).trans + apply reach_mono _ (exterior_connected hd r (by positivity) b y hb hyr) + intro z hz hzA + exact hz (hAr hzA) + · intro hx hH + obtain ⟨y,hxy,hy⟩ := hx r + have hby : Reach Aᶜ b y := by + apply reach_mono _ (exterior_connected hd r (by positivity) b y hb hy) + intro z hz hzA + exact hz (hAr hzA) + exact hH (hby.trans (reach_symm hxy)) + +lemma reach_preserves_hull {d : ℕ} (A : Set (Site d)) (b : Site d) {x y : Site d} + (hxy : Reach Aᶜ x y) : x ∈ Hull A b ↔ y ∈ Hull A b := by + constructor + · intro hx hy + exact hx (hy.trans (reach_symm hxy)) + · intro hy hx + exact hy (hx.trans hxy) + +lemma connected_avoids_hull {d : ℕ} (A V : Set (Site d)) (b : Site d) + (hV : Heisenberg.LatticeCut.Connected V) (hVA : Disjoint V A) + {x : Site d} (hx : x ∈ V) (hxH : x ∉ Hull A b) : V ⊆ (Hull A b)ᶜ := by + intro y hy hyH + apply hxH + apply (reach_preserves_hull A b ?_).mpr hyH + apply reach_mono _ (hV x hx y hy) + intro z hz hzA + exact Set.disjoint_left.mp hVA hz hzA + +lemma hull_subset_of_subset_hull {d : ℕ} (A B : Set (Site d)) (b : Site d) + (hAB : A ⊆ Hull B b) : Hull A b ⊆ Hull B b := by + intro x hx + by_contra hxB + apply hx + have hb : b ∈ (Hull B b)ᶜ := fun h => h (reach_refl Bᶜ b) + have hbx := complement_connected B b b hb x hxB + apply reach_mono _ hbx + intro z hz hzA + exact hz (hAB hzA) + +theorem hull_laminar {d : ℕ} (A B : Set (Site d)) + (hA : Heisenberg.LatticeCut.Connected A) (hB : Heisenberg.LatticeCut.Connected B) + (hAn : A.Nonempty) (_hBn : B.Nonempty) (hAB : Disjoint A B) + {b : Site d} (hbA : b ∉ A) (_hbB : b ∉ B) : + Hull A b ⊆ Hull B b ∨ Hull B b ⊆ Hull A b ∨ Disjoint (Hull A b) (Hull B b) := by + by_cases hsubA : A ⊆ Hull B b + · exact Or.inl (hull_subset_of_subset_hull A B b hsubA) + by_cases hsubB : B ⊆ Hull A b + · exact Or.inr (Or.inl (hull_subset_of_subset_hull B A b hsubB)) + obtain ⟨a,ha,haB⟩ : ∃ a ∈ A, a ∉ Hull B b := Set.not_subset.mp hsubA + obtain ⟨c,hc,hcA⟩ : ∃ c ∈ B, c ∉ Hull A b := Set.not_subset.mp hsubB + have hBext := connected_avoids_hull A B b hB hAB.symm hc hcA + have hHB : Disjoint (Hull A b) B := Set.disjoint_left.mpr (fun x hx hxB => hBext hxB hx) + have hHAext := connected_avoids_hull B (Hull A b) b (hull_connected A hA hAn hbA) + hHB (subset_hull A hbA ha) haB + exact Or.inr (Or.inr (Set.disjoint_left.mpr (fun x hx hxB => hHAext hx hxB))) + +end Heisenberg.LatticeHull +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LatticePaths.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LatticePaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..171576be30f14300d0048bbbde14879103213e48 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LatticePaths.lean @@ -0,0 +1,289 @@ +import OAI.MathematicalPhysics.Heisenberg.CycleWeights + +namespace OAI + +noncomputable section +open scoped Classical + +namespace Heisenberg.Geometry + +lemma reach_rectangle {d : ℕ} (U : Set (Site d)) (x y : Site d) + (hU : ∀ z, (∀ j, min (x j) (y j) ≤ z j ∧ z j ≤ max (x j) (y j)) → z ∈ U) : + Reach U x y := by + let v (s : Finset (Fin d)) : Site d := fun j => if j ∈ s then y j else x j + have hv : ∀ s : Finset (Fin d), Reach U x (v s) := by + intro s + induction s using Finset.induction_on with + | empty => simpa [v] using reach_refl U x + | @insert j s hj ih => + apply reach_trans ih + have hstart : Function.update (v s) j (x j) = v s := by + apply Function.update_eq_self_iff.mpr + simp [v, hj] + have hend : Function.update (v s) j (y j) = v (insert j s) := by + funext k + by_cases hk : k = j + · subst k; simp [v] + · simp [v, hk] + rw [← hstart, ← hend] + apply reach_axis + intro t ht₁ ht₂ + apply hU + intro k + by_cases hk : k = j + · subst k; simpa using And.intro ht₁ ht₂ + · simp only [Function.update_of_ne hk, v] + split_ifs + · exact ⟨min_le_right .., le_max_right ..⟩ + · exact ⟨min_le_left .., le_max_left ..⟩ + simpa [v] using hv Finset.univ + +lemma shell_to_corner {d : ℕ} (hd : 2 ≤ d) (r : ℤ) (hr : 0 ≤ r) + (x : Site d) (hx : x ∈ Shell r) : + Reach (Shell r) x (fun _ => r) := by + obtain ⟨hbox, j, hj⟩ := hx + let y : Site d := fun k => if k = j then x j else r + have hy : Reach (Shell r) x y := by + apply reach_rectangle + intro z hz + refine ⟨?_, j, ?_⟩ + · intro k + have h := hz k + have hbound := hbox k + have hybound : |y k| ≤ r := by + dsimp [y]; split_ifs + · exact hbox j + · simp only [abs_of_nonneg hr, le_refl] + rw [abs_le] at hbound hybound ⊢ + exact ⟨le_trans (le_min hbound.1 hybound.1) h.1, + le_trans h.2 (max_le hbound.2 hybound.2)⟩ + · have h := hz j + have hzj : z j = x j := by + simp only [y, ite_eq_left rfl, min_self, max_self] at h + exact le_antisymm h.2 h.1 + simpa [hzj] using hj + obtain ⟨k, hkj⟩ : ∃ k : Fin d, k ≠ j := by + have : Nontrivial (Fin d) := Fin.nontrivial_iff_two_le.mpr hd + exact exists_ne j + apply reach_trans hy + have hstart : Function.update y j (x j) = y := by + apply Function.update_eq_self_iff.mpr + simp [y] + have hend : Function.update y j r = (fun _ => r) := by + funext a + by_cases ha : a = j + · subst a; simp + · simp [y, ha] + rw [← hstart, ← hend] + apply reach_axis + intro t ht₁ ht₂ + refine ⟨?_, k, ?_⟩ + · intro a + by_cases ha : a = j + · subst a + simp only [Function.update_self] + rw [abs_le] + have hb := (abs_le.mp (hbox j)) + exact ⟨le_trans (le_min hb.1 (by omega)) ht₁, + le_trans ht₂ (max_le hb.2 le_rfl)⟩ + · simp [y, ha, abs_of_nonneg hr] + · simp [y, hkj, abs_of_nonneg hr] + +lemma shell_connected {d : ℕ} (hd : 2 ≤ d) (r : ℤ) (hr : 0 ≤ r) + (x y : Site d) (hx : x ∈ Shell r) (hy : y ∈ Shell r) : + Reach (Shell r) x y := + reach_trans (shell_to_corner hd r hr x hx) (reach_symm (shell_to_corner hd r hr y hy)) + + +abbrev Direction (d : ℕ) := Fin d × Bool + +def Ray {d : ℕ} (x : Site d) (q : Direction d) (z : Site d) : Prop := + (if q.2 then x q.1 < z q.1 else z q.1 < x q.1) ∧ + ∀ k, k ≠ q.1 → z k = x k + +lemma ray_unique {d : ℕ} (x z : Site d) (q q' : Direction d) + (h : Ray x q z) (h' : Ray x q' z) : q = q' := by + have hne : z q.1 ≠ x q.1 := by + have hlt := h.1 + cases hb : q.2 <;> simp only [hb, Bool.false_eq_true, ↓reduceIte] at hlt + · exact ne_of_lt hlt + · exact ne_of_gt hlt + have hj : q.1 = q'.1 := by + by_contra hn + exact hne (h'.2 q.1 hn) + apply Prod.ext hj + have h₁ := h.1 + have h₂ := h'.1 + rw [← hj] at h₂ + cases hb : q.2 <;> cases hb' : q'.2 <;> + simp only [hb, hb', Bool.false_eq_true, ↓reduceIte] at h₁ h₂ ⊢ <;> omega + +lemma exists_clear_ray {d : ℕ} (x : Site d) (F : Finset (Site d)) + (hF : F.card < 2 * d) : ∃ q : Direction d, ∀ z ∈ F, ¬ Ray x q z := by + by_contra hn + push Not at hn + choose z hzF hz using hn + let f : Direction d → F := fun q => ⟨z q, hzF q⟩ + have hf : Function.Injective f := by + intro q q' he + have hzEq : z q = z q' := congrArg Subtype.val he + exact ray_unique x (z q) q q' (hz q) (hzEq ▸ hz q') + have hc := Fintype.card_le_of_injective f hf + simp only [Fintype.card_prod, Fintype.card_fin, Fintype.card_bool, + Fintype.card_coe] at hc + omega + +lemma shell_radius_unique {d : ℕ} (x : Site d) (r t : ℤ) + (hr : x ∈ Shell r) (ht : x ∈ Shell t) : r = t := by + obtain ⟨hrbox, j, hj⟩ := hr + obtain ⟨htbox, k, hk⟩ := ht + exact le_antisymm (hj ▸ htbox j) (hk ▸ hrbox k) + +lemma exists_clean_shell {d : ℕ} (K : ℤ) (F : Finset (Site d)) + (hF : F.card < 2 * d) : + ∃ r : ℤ, K < r ∧ r ≤ K + 2 * d ∧ ∀ z ∈ F, z ∉ Shell r := by + by_contra hn + have hbad : ∀ n : Fin (2 * d), ∃ z ∈ F, z ∈ Shell (K + 1 + n.val) := by + intro n + have hl : K < K + 1 + (n.val : ℤ) := by omega + have hu : K + 1 + (n.val : ℤ) ≤ K + 2 * d := by omega + by_contra hn' + push Not at hn' + exact hn ⟨K + 1 + n.val, hl, hu, hn'⟩ + choose z hzF hz using hbad + let f : Fin (2 * d) → F := fun n => ⟨z n, hzF n⟩ + have hf : Function.Injective f := by + intro n n' he + have hzEq : z n = z n' := congrArg Subtype.val he + have hn := shell_radius_unique (z n) _ _ (hz n) (hzEq ▸ hz n') + apply Fin.ext + omega + have hc := Fintype.card_le_of_injective f hf + simp only [Fintype.card_fin, Fintype.card_coe] at hc + omega + +lemma reach_shell {d : ℕ} (r : ℤ) (hr : 0 ≤ r) (x : Site d) + (hx : x ∈ Box r) (F : Finset (Site d)) (hxF : x ∉ F) (hF : F.card < 2 * d) : + ∃ y ∈ Shell r, Reach (Box r \ (F : Set (Site d))) x y := by + obtain ⟨q, hq⟩ := exists_clear_ray x F hF + let b : ℤ := if q.2 then r else -r + let y := Function.update x q.1 b + have hb : |b| = r := by + dsimp [b]; split_ifs <;> simp [abs_of_nonneg hr] + have hybox : y ∈ Box r := by + intro k + by_cases hk : k = q.1 + · subst k; simpa [y] using hb.le + · simpa [y, hk] using hx k + have hyshell : y ∈ Shell r := ⟨hybox, q.1, by simpa [y] using hb⟩ + refine ⟨y, hyshell, ?_⟩ + have hstart := Function.update_eq_self q.1 x + rw [← hstart] + apply reach_axis + intro t ht₁ ht₂ + constructor + · intro k + by_cases hk : k = q.1 + · subst k + simp only [Function.update_self] + rw [abs_le] + have ha := abs_le.mp (hx q.1) + have hb' := abs_le.mp hb.le + exact ⟨le_trans (le_min ha.1 hb'.1) ht₁, + le_trans ht₂ (max_le ha.2 hb'.2)⟩ + · simpa [hk] using hx k + · intro htF + by_cases ht : t = x q.1 + · subst t + exact hxF (by simpa using htF) + · apply hq (Function.update x q.1 t) htF + refine ⟨?_, ?_⟩ + · simp only [Function.update_self] + cases hq₂ : q.2 + · have hb' : b = -r := by simp [b, hq₂] + have ha := abs_le.mp (hx q.1) + simp only [Bool.false_eq_true, ↓reduceIte] + have htmax : max (x q.1) b = x q.1 := max_eq_left (by omega) + rw [htmax] at ht₂ + omega + · have hb' : b = r := by simp [b, hq₂] + have ha := abs_le.mp (hx q.1) + simp only [↓reduceIte] + have htmin : min (x q.1) b = x q.1 := min_eq_left (by omega) + rw [htmin] at ht₁ + omega + · intro k hk + simp [hk] + + +lemma box_mono {d : ℕ} {r t : ℤ} (h : r ≤ t) : (Box r : Set (Site d)) ⊆ Box t := + fun _ hx j => (hx j).trans h + +theorem finite_obstacle_connection {d : ℕ} (hd : 2 ≤ d) (K : ℤ) (hK : 0 ≤ K) + (x y : Site d) (hx : x ∈ Box K) (hy : y ∈ Box K) (F : Finset (Site d)) + (hxF : x ∉ F) (hyF : y ∉ F) (hF : F.card < 2 * d) : + Reach (Box (K + 2 * d) \ (F : Set (Site d))) x y := by + obtain ⟨r, hKr, hrK, hrF⟩ := exists_clean_shell K F hF + have hr : 0 ≤ r := by omega + obtain ⟨a, ha, hxa⟩ := reach_shell r hr x (box_mono hKr.le hx) F hxF hF + obtain ⟨b, hb, hyb⟩ := reach_shell r hr y (box_mono hKr.le hy) F hyF hF + have hab : Reach (Box r \ (F : Set (Site d))) a b := by + apply reach_mono _ (shell_connected hd r hr a b ha hb) + intro z hz + exact ⟨hz.1, fun hzF => hrF z hzF hz⟩ + apply reach_mono _ (hxa.trans (hab.trans (reach_symm hyb))) + intro z hz + exact ⟨box_mono hrK hz.1, hz.2⟩ + +def latticeGraph {d : ℕ} (U : Set (Site d)) : SimpleGraph (Site d) where + Adj x y := Step x y ∧ x ∈ U ∧ y ∈ U + symm := ⟨fun _ _ h => ⟨step_symm h.1, h.2.2, h.2.1⟩⟩ + loopless := ⟨by + intro x h + obtain ⟨j, h, _⟩ := h.1 + omega⟩ + +lemma reach_has_simple_path {d : ℕ} (U : Set (Site d)) (x y : Site d) + (h : Reach U x y) : ∃ p : (latticeGraph U).Walk x y, p.IsPath := by + apply SimpleGraph.Reachable.exists_isPath + exact (SimpleGraph.reachable_iff_reflTransGen ..).mpr h + +def boxFinset (d r : ℕ) : Finset (Site d) := + Fintype.piFinset (fun _ : Fin d => Finset.Icc (-(r : ℤ)) r) + +@[simp] lemma mem_boxFinset (d r : ℕ) (x : Site d) : + x ∈ boxFinset d r ↔ x ∈ Box r := by + simp only [boxFinset, Fintype.mem_piFinset, Finset.mem_Icc, Box, Set.mem_ofPred_eq, abs_le] + +lemma card_boxFinset (d r : ℕ) : (boxFinset d r).card = (2 * r + 1) ^ d := by + simp only [boxFinset, Fintype.card_piFinset, Int.card_Icc] + have hc : ((r : ℤ) + 1 + (r : ℤ)).toNat = 2 * r + 1 := by omega + simp [hc] + +lemma path_support_mem {d : ℕ} (U : Set (Site d)) (x y : Site d) + (hx : x ∈ U) (p : (latticeGraph U).Walk x y) : ∀ z ∈ p.support, z ∈ U := by + induction p with + | nil => simpa using hx + | @cons a b c hab p ih => + intro z hz + simp only [SimpleGraph.Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hx + · exact ih hab.2.2 z hz + +lemma simple_path_length_bound {d : ℕ} (U : Set (Site d)) (r : ℕ) + (hU : U ⊆ Box r) (x y : Site d) (hx : x ∈ U) + (p : (latticeGraph U).Walk x y) (hp : p.IsPath) : + p.length < (2 * r + 1) ^ d := by + have hs : p.support.toFinset ⊆ boxFinset d r := by + intro z hz + exact (mem_boxFinset ..).mpr (hU (path_support_mem U x y hx p z (List.mem_toFinset.mp hz))) + have hc := Finset.card_le_card hs + rw [List.toFinset_card_of_nodup hp.support_nodup, SimpleGraph.Walk.length_support, + card_boxFinset] at hc + omega + +end Heisenberg.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LatticeRegularity.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..51f6a241b19768d7de4bae0e60dcb0a5a7ac51fd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LatticeRegularity.lean @@ -0,0 +1,249 @@ +import OAI.MathematicalPhysics.Heisenberg.CrossingTails + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical BigOperators +open scoped Classical +open Module +open scoped BigOperators + +namespace Heisenberg.Geometry +open Heisenberg.SparseWitness + +theorem lattice_stretched_tail {Ω : Type*} [Fintype Ω] + (d b : ℕ) (hb : 100 ≤ b) (α L : ℝ) (hα : 0 ≤ α) (hL : 1 ≤ L) + (hba : 2 ≤ (b:ℝ)^α) (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) + (hprob : ∑ ω, μ ω ≤ 1) (Z : Ω → Set (Site d)) + (q : ℝ) (hq : 0 ≤ q) (hsmall : (((49^d*(b^d)^2:ℕ):ℝ)*q) ≤ Real.exp (-2)) + (htest : ∀ F : Finset (Site d), Sparse α L F → + (∑ ω, if (F:Set (Site d)) ⊆ Z ω then μ ω else 0) ≤ q^F.card) : + ∃ c : ℝ, c > 0 ∧ ∃ γ : ℝ, γ > 0 ∧ ∀ z r, 0 ≤ r → + (∑ ω, if Crosses (Z ω) z r then μ ω else 0) ≤ Real.exp 1*Real.exp (-c*r^γ) := by + have hbR : (1:ℝ) < b := by exact_mod_cast (show 1 < b by omega) + obtain ⟨γ,hγ,hbγ⟩ := exists_scale_exponent hbR + let c := (16*(b:ℝ))^(-γ) + have hc : 0 < c := Real.rpow_pos_of_pos (by positivity) _ + refine ⟨c,hc,γ,hγ,?_⟩ + intro z r hr + have hh := stretched_tail_of_scales μ hμ hprob Z (b:ℝ) γ hbR hγ hbγ ?_ z r hr + · convert hh using 1 + rw [Real.div_rpow hr (by positivity)] + dsimp [c] + rw [Real.rpow_neg (by positivity)] + ring_nf + · intro n z + calc + _ ≤ (((49^d*(b^d)^2:ℕ):ℝ)*q)^(2^n) := lattice_crossing_mass_bound d b hb α L hα hL hba μ hμ Z q hq htest n z + _ ≤ (Real.exp (-2))^(2^n) := pow_le_pow_left₀ (by positivity) hsmall _ + _ = Real.exp (-2*(2:ℝ)^n) := by rw [←Real.exp_nat_mul]; congr 1; push_cast; ring + +end Heisenberg.Geometry + +namespace Heisenberg.LatticeRegular +open Heisenberg.Geometry Heisenberg.LatticeComponents Heisenberg.SparseWitness +variable {d : ℕ} + +lemma component_crosses (Z : Set (Site d)) {z w : Site d} (hz : z ∈ Z) + (hw : w ∈ Component Z z) (r : ℝ) (hr : r ≤ dist z w) : Crosses Z z r := by + have hp : ∃ (p : ℕ → Site d) (m : ℕ), p 0 = z ∧ p m = w ∧ + (∀ i ≤ m, p i ∈ Z) ∧ (∀ i < m, dist (p i) (p (i+1)) ≤ 8) := by + have hrel := hw.2 + clear hw hr + induction hrel with + | refl => exact ⟨fun _ => z,0,rfl,rfl,fun _ _ => hz,by simp⟩ + | @tail b c hzb hbc ih => + obtain ⟨p,m,hp0,hpm,hpZ,hpstep⟩ := ih + let t : ℕ → Site d := fun i => if i ≤ m then p i else c + refine ⟨t,m+1,?_,?_,?_,?_⟩ + · simp [t,hp0] + · simp [t] + · intro i hi + by_cases h : i ≤ m + · simpa [t,h] using hpZ i h + · simpa [t,h] using hbc.2.2 + · intro i hi + by_cases h : i < m + · simpa [t,show i ≤ m by omega,show i+1 ≤ m by omega] using hpstep i h + · have he : i = m := by omega + subst i + simpa [t,hpm] using (dist_le_iff_mem_ball (r:=8) b c).mpr hbc.1 + obtain ⟨p,m,hp0,hpm,hpZ,hpstep⟩ := hp + exact ⟨p,m,hp0,hpZ,hpstep,by simpa [hp0,hpm] using hr⟩ + +lemma local_bad_count_bound {Ω : Type*} [Fintype Ω] + (k M : ℕ) (α L p : ℝ) (hα : 0 ≤ α) (hL : (2*(k+1):ℕ) ≤ L) + (μ : Ω → ℝ) (Z : Ω → Set (Site (k+1))) (hμ : ∀ ω, 0 ≤ μ ω) + (htest : ∀ F : Finset (Site (k+1)), Sparse α L F → + (∑ ω, if (F:Set (Site (k+1))) ⊆ Z ω then μ ω else 0) ≤ p^F.card) + (x : Site (k+1)) (R : ℕ) : + (∑ ω, if ∃ z ∈ Ball (11*R:ℕ) x, + 2*(k+1) ≤ ((ballFinset (k+1) M z).filter (· ∈ Z ω)).card then μ ω else 0) ≤ + ((23:ℝ)^(k+1)*(((2*M+1)^(k+1)).choose (2*(k+1)):ℕ)) * + (1+(R:ℝ))^(k+1)*p^(2*(k+1)) := by + let B : ℝ := (23:ℝ)^(k+1)*(((2*M+1)^(k+1)).choose (2*(k+1)):ℕ) + calc + _ ≤ ∑ z ∈ ballFinset (k+1) (11*R) x, + ∑ ω, if 2*(k+1) ≤ ((ballFinset (k+1) M z).filter (· ∈ Z ω)).card then μ ω else 0 := + by + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro ω _ + split_ifs with h + · obtain ⟨z,hz,hh⟩ := h + have hzm := (mem_ballFinset (k+1) (11*R) x z).mpr hz + have hs := Finset.single_le_sum (f:=fun z => + if 2*(k+1) ≤ ((ballFinset (k+1) M z).filter (· ∈ Z ω)).card then μ ω else 0) + (fun j _ => by split_ifs <;> simp [hμ]) hzm + simpa only [ite_eq_left hh] using hs + · exact Finset.sum_nonneg (fun j _ => by split_ifs <;> simp [hμ]) + _ ≤ ∑ _z ∈ ballFinset (k+1) (11*R) x, ((((2*M+1)^(k+1)).choose (2*(k+1)):ℕ):ℝ)*p^(2*(k+1)) := by + apply Finset.sum_le_sum + intro z _ + simpa only [ballFinset_card] using bad_count_mass μ hμ Z α L p hα + ((by positivity : (0:ℝ) ≤ (2*(k+1):ℕ)).trans hL) (2*(k+1)) hL htest (ballFinset (k+1) M z) + _ = (((2*(11*R)+1)^(k+1)):ℝ)*(((((2*M+1)^(k+1)).choose (2*(k+1)):ℕ):ℝ)*p^(2*(k+1))) := by simp [ballFinset_card] + _ ≤ B*(1+(R:ℝ))^(k+1)*p^(2*(k+1)) := by + have hp : 0 ≤ p^(2*(k+1)) := by rw [pow_mul]; positivity + have hbase : (2*(11*R)+1:ℕ) ≤ 23*(1+(R:ℝ)) := by push_cast; nlinarith [Nat.cast_nonneg (α:=ℝ) R] + have hh := pow_le_pow_left₀ (by positivity : (0:ℝ) ≤ (2*(11*R)+1:ℕ)) hbase (k+1) + rw [mul_pow] at hh + dsimp [B] + push_cast at hh + nlinarith [mul_le_mul_of_nonneg_right hh (mul_nonneg (Nat.cast_nonneg (((2*M+1)^(k+1)).choose (2*(k+1)))) hp)] + +theorem regularity_bound_of_tail + (k M : ℕ) (α L ν a c γ : ℝ) (hα : 0 ≤ α) (hL : (2*(k+1):ℕ) ≤ L) + (hν : 0 < ν) (ha : 0 ≤ a) (hc : 0 < c) (hγ : 0 < γ) : + ∃ C ≥ 0, ∀ (Ω : Type*) [Fintype Ω] (μ : Ω → ℝ) (Z : Ω → Set (Site (k+1))) (p : ℝ), + (∀ ω, 0 ≤ μ ω) → + (∀ F : Finset (Site (k+1)), Sparse α L F → + (∑ ω, if (F:Set (Site (k+1))) ⊆ Z ω then μ ω else 0) ≤ p^F.card) → + (∀ z r, 0 ≤ r → (∑ ω, if Crosses (Z ω) z r then μ ω else 0) ≤ + Real.exp 1*Real.exp (-c*r^γ)) → + ∀ (x : Site (k+1)) (R : ℕ), + (∑ ω, if ¬ Regular (Z ω) x R M ν then μ ω else 0) ≤ + C*((1+(R:ℝ))^(k+1)*p^(2*(k+1))+(1+(R:ℝ))^(-a)) := by + obtain ⟨D,hD,hDt⟩ := Heisenberg.LatticeSum.exp_tail_polynomial k c (ν*γ) a hc (mul_pos hν hγ) ha + let B : ℝ := (23:ℝ)^(k+1)*(((2*M+1)^(k+1)).choose (2*(k+1)):ℕ) + refine ⟨B+Real.exp 1*D,by dsimp [B]; positivity,?_⟩ + intro Ω inst μ Z p hμ htest htail x R + let A : Ω → Prop := fun ω => ∃ z ∈ Ball (11*R:ℕ) x, + 2*(k+1) ≤ ((ballFinset (k+1) M z).filter (· ∈ Z ω)).card + let E : Site (k+1) → Ω → Prop := fun z ω => z ∉ Ball (10*R:ℕ) x ∧ + ∃ w ∈ Component (Z ω) z, (1+dist z x)^ν < dist z w ∧ z ∈ Z ω + have hA : (∑ ω, if A ω then μ ω else 0) ≤ B*(1+(R:ℝ))^(k+1)*p^(2*(k+1)) := + local_bad_count_bound k M α L p hα hL μ Z hμ htest x R + let G : Site (k+1) → ℝ := fun z => if (R:ℝ) < dist z x then Real.exp (-c*(1+dist z x)^(ν*γ)) else 0 + have ht := hDt x (R:ℝ) (Nat.cast_nonneg R) + have hsG : Summable G := ht.1 + have hE : ∀ z, (∑ ω, if E z ω then μ ω else 0) ≤ Real.exp 1*G z := by + intro z + by_cases hz : (R:ℝ) < dist z x + · calc + _ ≤ ∑ ω, if Crosses (Z ω) z ((1+dist z x)^ν) then μ ω else 0 := + by + have hm := event_mass_mono μ hμ (A:=E z) (B:=fun ω => Crosses (Z ω) z ((1+dist z x)^ν)) (by + intro ω h + obtain ⟨_,w,hw,hd,hzZ⟩ := h + exact component_crosses _ hzZ hw _ hd.le) + convert hm using 1 + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> rfl + _ ≤ Real.exp 1*Real.exp (-c*((1+dist z x)^ν)^γ) := + htail z _ (Real.rpow_nonneg (by positivity) _) + _ = _ := by dsimp [G]; rw [ite_eq_left hz,←Real.rpow_mul (by positivity)] + · have hempty : ∀ ω, ¬ E z ω := by + intro ω h + have hb : dist x z ≤ (10*R:ℕ) := by + rw [dist_comm]; push_cast; linarith [le_of_not_gt hz,Nat.cast_nonneg (α:=ℝ) R] + exact h.1 ((dist_le_iff_mem_ball x z).mp hb) + simp [hempty,G,hz] + have hremote : (∑ ω, if ∃ z, E z ω then μ ω else 0) ≤ Real.exp 1*D*(1+(R:ℝ))^(-a) := by + calc + _ ≤ ∑' z, Real.exp 1*G z := countable_union_mass μ hμ E (fun ω => ∃ z, E z ω) + (fun z => Real.exp 1*G z) (by intro z; dsimp [G]; split_ifs <;> positivity) + (hsG.mul_left _) (by + intro z + convert hE z using 1 + apply Finset.sum_congr rfl + intro ω _ + split_ifs <;> rfl) (fun ω h => h) + _ = Real.exp 1*(∑' z, G z) := tsum_mul_left + _ ≤ Real.exp 1*(D*(1+(R:ℝ))^(-a)) := mul_le_mul_of_nonneg_left ht.2 (Real.exp_pos _).le + _ = _ := by ring + have hsplit : (∑ ω, if ¬ Regular (Z ω) x R M ν then μ ω else 0) ≤ + (∑ ω, if A ω then μ ω else 0)+(∑ ω, if ∃ z, E z ω then μ ω else 0) := by + rw [←Finset.sum_add_distrib] + apply Finset.sum_le_sum + intro ω _ + have hcover : ¬ Regular (Z ω) x R M ν → A ω ∨ ∃ z, E z ω := by + intro hh + dsimp [Regular] at hh + push Not at hh + by_cases h : A ω + · exact Or.inl h + · right + have hn : ∀ z ∈ Ball (11*R:ℕ) x, ((ballFinset (k+1) M z).filter (· ∈ Z ω)).card < 2*(k+1) := by + intro z hz + exact lt_of_not_ge (fun hh => h ⟨z,hz,hh⟩) + obtain ⟨z,hz,hzn,w,hw,hd⟩ := hh hn + exact ⟨z,hzn,w,hw,hd,hz⟩ + split_ifs <;> try linarith [hμ ω] + exact False.elim (by rcases hcover ‹¬ Regular (Z ω) x R M ν› with h | h <;> contradiction) + calc + _ ≤ B*(1+(R:ℝ))^(k+1)*p^(2*(k+1))+Real.exp 1*D*(1+(R:ℝ))^(-a) := hsplit.trans (add_le_add hA hremote) + _ ≤ _ := by + have hp : 0 ≤ p^(2*(k+1)) := by rw [pow_mul]; positivity + have hB : 0 ≤ B := by dsimp [B]; positivity + nlinarith [mul_nonneg hB (Real.rpow_nonneg (by positivity : (0:ℝ) ≤ 1+(R:ℝ)) (-a)), + mul_nonneg (mul_nonneg (Real.exp_pos 1).le hD) (mul_nonneg (pow_nonneg (by positivity : (0:ℝ) ≤ 1+(R:ℝ)) (k+1)) hp)] + +theorem regularity_probability (k M b : ℕ) (hb : 100 ≤ b) + (α L ν a : ℝ) (hα : 0 ≤ α) (hL : (2*(k+1):ℕ) ≤ L) + (hba : 2 ≤ (b:ℝ)^α) (hν : 0 < ν) (ha : 0 ≤ a) : + ∃ p₀ > 0, ∃ C ≥ 0, ∀ (Ω : Type*) [Fintype Ω] + (μ : Ω → ℝ) (Z : Ω → Set (Site (k+1))) (p : ℝ), + (∀ ω, 0 ≤ μ ω) → (∑ ω, μ ω ≤ 1) → 0 ≤ p → p ≤ p₀ → + (∀ F : Finset (Site (k+1)), Sparse α L F → + (∑ ω, if (F:Set (Site (k+1))) ⊆ Z ω then μ ω else 0) ≤ p^F.card) → + ∀ (x : Site (k+1)) (R : ℕ), + (∑ ω, if ¬ Regular (Z ω) x R M ν then μ ω else 0) ≤ + C*((1+(R:ℝ))^(k+1)*p^(2*(k+1))+(1+(R:ℝ))^(-a)) := by + have hbR : (1:ℝ) < b := by exact_mod_cast (show 1 < b by omega) + obtain ⟨γ,hγ,hbγ⟩ := exists_scale_exponent hbR + let c : ℝ := (16*(b:ℝ))^(-γ) + have hc : 0 < c := Real.rpow_pos_of_pos (by positivity) _ + obtain ⟨C,hC,hreg⟩ := regularity_bound_of_tail k M α L ν a c γ hα hL hν ha hc hγ + let B : ℝ := (49^(k+1)*(b^(k+1))^2:ℕ) + have hB : 0 < B := by dsimp [B]; positivity + refine ⟨Real.exp (-2)/B,by positivity,C,hC,?_⟩ + intro Ω inst μ Z p hμ hprob hp hps htest x R + apply hreg Ω μ Z p hμ htest _ x R + intro z r hr + have hL' : (1:ℝ) ≤ L := by + have hh : (1:ℝ) ≤ (2*(k+1):ℕ) := by exact_mod_cast (show 1 ≤ 2*(k+1) by omega) + exact hh.trans hL + have ht := stretched_tail_of_scales μ hμ hprob Z (b:ℝ) γ hbR hγ hbγ ?_ z r hr + · convert ht using 1 + rw [Real.div_rpow hr (by positivity)] + dsimp [c] + rw [Real.rpow_neg (by positivity)] + ring_nf + · intro n z + calc + _ ≤ (B*p)^(2^n) := lattice_crossing_mass_bound (k+1) b hb α L hα hL' hba μ hμ Z p hp htest n z + _ ≤ (Real.exp (-2))^(2^n) := by + apply pow_le_pow_left₀ (mul_nonneg hB.le hp) + have hh := (le_div_iff₀ hB).mp hps + simpa only [mul_comm] using hh + _ = Real.exp (-2*(2:ℝ)^n) := by rw [←Real.exp_nat_mul]; congr 1; push_cast; ring + +end Heisenberg.LatticeRegular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LayerEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LayerEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d2b98fc41365b1c4203c1ec53b4bd1b964dca8c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LayerEnergy.lean @@ -0,0 +1,288 @@ +import OAI.MathematicalPhysics.Heisenberg.ReturnConditioning + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical +open scoped Classical +open Filter +open scoped Classical +open scoped Classical + +@[reducible] local instance exposureDecEq (α : Type*) : DecidableEq α := Classical.decEq α + +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.Conditioning +variable {V : Type*} [Fintype V] + +omit [Fintype V] in +lemma layerExposure_equivalence {T : Type*} [Fintype T] (s : Equiv.Perm T) + (τ : T → Equiv.Perm V) (P : Set (T×V)) : Equivalence (layerExposure s τ P) := by + constructor + · intro b + exact ⟨fun _ _ => rfl,rfl⟩ + · intro b c h + refine ⟨?_,h.2.symm⟩ + intro z hz + exact (h.1 z (h.2 ▸ hz)).symm + · intro b c d hbc hcd + refine ⟨?_,hcd.2.trans hbc.2⟩ + intro z hz + exact (hbc.1 z hz).trans (hcd.1 z (hbc.2.symm ▸ hz)) + +lemma residual_integral {n : ℕ} (w : Fin n → Bool → ℝ) + (hw : ∀ i,∑ b,w i b=1) (M : Fin n → Prop) (base : Fin n → Bool) + (F : (Fin n → Bool) → ℝ) : + (∑ c : Fin n → Bool,productWeight w c * F (residualCoins M base c)) = + ∑ c : {i // ¬M i} → Bool,productWeight (fun i : {i // ¬M i} => w i) c * + F (merge M (fun i => base i) c) := by + let e := Equiv.piEquivPiSubtypeProd M (fun _ => Bool) + rw [←e.symm.sum_comp,Fintype.sum_prod_type] + have hr (a : {i // M i} → Bool) (c : {i // ¬M i} → Bool) : + residualCoins M base (merge M a c)=merge M (fun i => base i) c := by + funext i + by_cases hi : M i + · simp [residualCoins,hi,merge] + · simp [residualCoins,hi,merge] + change (∑ a : {i // M i} → Bool, ∑ c : {i // ¬M i} → Bool, + productWeight w (merge M a c)*F (residualCoins M base (merge M a c))) = _ + simp_rw [hr,productWeight_merge,mul_assoc,←Finset.mul_sum] + have hs : (∑ a : {i // M i} → Bool, productWeight (fun i : {i // M i} => w i) a) = 1 := by + convert productWeight_sum (fun i : {i // M i} => w i) (fun i => hw i) using 1 + congr 1 + ext c + simp + rw [←Finset.sum_mul, hs, one_mul] + +theorem layer_exposure_full {n : ℕ} (s : Equiv.Perm (Fin n)) + (τ : Fin n → Equiv.Perm V) (w : Fin n → Bool → ℝ) (hw : ∀ i,∑ b,w i b=1) + (P : Set (Fin n×V)) (base : Fin n → Bool) (F : (Fin n → Bool) → ℝ) : + let A := MissingSet (layerHistory s τ base) P + let M := layerRevealed τ A + let c₀ := (2:ℝ)^missingCount (layerHistory s τ base) P * + productWeight (fun i : {i // M i} => w i) (fun i => base i) + (∑ c : Fin n → Bool,if layerExposure s τ P base c then + productWeight w c*(2:ℝ)^missingCount (layerHistory s τ c) P*F c else 0) = + c₀ * ∑ c : Fin n → Bool,if OutsideHit (layerHistory s τ (residualCoins M base c)) P A + then productWeight w c*F (residualCoins M base c) else 0 := by + dsimp only + have he := layer_exposure_disintegration s τ w P base F + have hu : @Finset.univ (Fin n → Bool) + (@Pi.instFintype (Fin n) (fun _ => Bool) (fun a b => Classical.propDecidable (a=b)) + (Fin.fintype n) (fun _ => Bool.fintype)) = (Finset.univ : Finset (Fin n → Bool)) := by + ext c + simp + rw [hu] at he + refine he.trans ?_ + congr 1 + have h := residual_integral w hw + (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base + (fun c => if OutsideHit (layerHistory s τ c) P (MissingSet (layerHistory s τ base) P) + then F c else 0) + simp only [mul_ite,mul_zero] at h + convert h.symm using 1 + congr 1 + ext c + simp + +theorem conditional_layer_exposure {n : ℕ} (s : Equiv.Perm (Fin n)) + (τ : Fin n → Equiv.Perm V) (w : Fin n → Bool → ℝ) + (hw : ∀ i,∑ b,w i b=1) (hw0 : ∀ i b,0≤w i b) + (P : Set (Fin n×V)) (base : Fin n → Bool) (F : (Fin n → Bool) → ℝ) + (hbase : productWeight w base≠0) : + let A := MissingSet (layerHistory s τ base) P + let M := layerRevealed τ A + let σ := fun c => layerHistory s τ (residualCoins M base c) + let μ := fun c => productWeight w c*(2:ℝ)^missingCount (layerHistory s τ c) P + conditional μ (layerExposure s τ P) F base = + (∑ c : Fin n → Bool,if OutsideHit (σ c) P A then + productWeight w c*F (residualCoins M base c) else 0)/ + (∑ c : Fin n → Bool,if OutsideHit (σ c) P A then productWeight w c else 0) := by + dsimp only + let μ := fun c => productWeight w c*(2:ℝ)^missingCount (layerHistory s τ c) P + have hμ : ∀ c,0≤μ c := by + intro c + exact mul_nonneg (Finset.prod_nonneg (fun i _ => hw0 i (c i))) (by positivity) + have hm : 0 < mass μ (layerExposure s τ P) base := lt_of_lt_of_le + (mul_pos (lt_of_le_of_ne (Finset.prod_nonneg (fun i _ => hw0 i (base i))) (Ne.symm hbase)) + (by positivity)) + (weight_le_mass μ hμ _ (layerExposure_equivalence s τ P).refl base) + have hden := layer_exposure_full s τ w hw P base (fun _ => 1) + simp only [mul_one] at hden + change mass μ (layerExposure s τ P) base = _ at hden + have hq := left_ne_zero_of_mul (hden ▸ ne_of_gt hm) + rw [conditional,layer_exposure_full s τ w hw P base F] + change (_*_) / mass μ (layerExposure s τ P) base = _ + rw [hden] + exact mul_div_mul_left _ _ hq + +end Heisenberg.Exposure + +open Filter Topology +open scoped RealInnerProductSpace Classical +namespace Heisenberg.MeshEnergy +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] +abbrev Op := E →L[ℝ] E + +variable [CompleteSpace E] + +lemma square_derivative {F : ℝ → Op (E:=E)} {D : Op (E:=E)} + (h0 : F 0 = 1) (hD : HasDerivAt F D 0) : + HasDerivAt (fun t => (ContinuousLinearMap.adjoint (F t)) * F t) + (ContinuousLinearMap.adjoint D + D) 0 := by + have ha := (ContinuousLinearMap.adjoint (𝕜:=ℝ) (E:=E) (F:=E)).toContinuousLinearEquiv.hasFDerivAt.comp_hasDerivAt 0 hD + change HasDerivAt (fun t => ContinuousLinearMap.adjoint (F t)) (ContinuousLinearMap.adjoint D) 0 at ha + have hh := ha.clm_comp hD + change HasDerivAt (fun t => (ContinuousLinearMap.adjoint (F t))*F t) + ((ContinuousLinearMap.adjoint D)*F 0 + (ContinuousLinearMap.adjoint (F 0))*D) 0 at hh + simpa only [h0,ContinuousLinearMap.adjoint_one,one_mul,mul_one] using hh + +theorem uniform_energy_error {F : ℝ → Op (E:=E)} {D : Op (E:=E)} + (h0 : F 0 = 1) (hD : HasDerivAt F D 0) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ t in 𝓝 (0:ℝ), ∀ v : E, + |‖F t v‖^2 - ‖v‖^2 - 2*t*⟪v,D v⟫| ≤ ε*|t| *‖v‖^2 := by + have hh := (square_derivative h0 hD).isLittleO.def hε + filter_upwards [hh] with t ht + intro v + let R : Op (E:=E) := (ContinuousLinearMap.adjoint (F t))*F t - 1 - + t • (ContinuousLinearMap.adjoint D + D) + have hR : ‖R‖ ≤ ε*|t| := by + simpa only [h0,sub_zero,ContinuousLinearMap.adjoint_one,mul_one, + Real.norm_eq_abs] using ht + have he : ⟪v,R v⟫ = ‖F t v‖^2 - ‖v‖^2 - 2*t*⟪v,D v⟫ := by + simp only [R,_root_.sub_apply,mul_apply_eq_comp, + one_apply_eq_self,_root_.smul_apply, + _root_.add_apply,inner_sub_right,inner_smul_right, + inner_add_right,ContinuousLinearMap.adjoint_inner_right,real_inner_self_eq_norm_sq, + real_inner_comm (D v) v] + ring + rw [← he] + calc + _ ≤ ‖v‖ * ‖R v‖ := abs_real_inner_le_norm _ _ + _ ≤ ‖v‖ * (‖R‖*‖v‖) := mul_le_mul_of_nonneg_left (R.le_opNorm v) (norm_nonneg _) + _ ≤ ‖v‖ * ((ε*|t|)*‖v‖) := by gcongr + _ = _ := by ring + +theorem finite_uniform_energy_error {I : Type*} [Finite I] + (F : I → ℝ → Op (E:=E)) (D : I → Op (E:=E)) + (h0 : ∀ i, F i 0 = 1) (hD : ∀ i, HasDerivAt (F i) (D i) 0) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ t in 𝓝 (0:ℝ), ∀ i v, + |‖F i t v‖^2 - ‖v‖^2 - 2*t*⟪v,D i v⟫| ≤ ε*|t| *‖v‖^2 := by + exact Filter.eventually_all.mpr fun i => uniform_energy_error (h0 i) (hD i) hε + +def sweep (D : ℕ → Op (E:=E)) : ℕ → ℝ → Op (E:=E) + | 0, _ => 1 + | n+1, t => (1+t • D n) * sweep D n t + +omit [CompleteSpace E] in +@[simp] lemma sweep_zero (D : ℕ → Op (E:=E)) (n : ℕ) : sweep D n 0 = 1 := by + induction n with + | zero => rfl + | succ n ih => simp [sweep,ih] + +omit [CompleteSpace E] in +lemma sweep_derivative (D : ℕ → Op (E:=E)) (n : ℕ) : + HasDerivAt (sweep D n) (∑ i ∈ Finset.range n, D i) 0 := by + induction n with + | zero => simpa [sweep] using hasDerivAt_const (0:ℝ) (1 : Op (E:=E)) + | succ n ih => + have hd : HasDerivAt (fun t : ℝ => (1:Op (E:=E))+t • D n) (D n) 0 := by + simpa using (hasDerivAt_id (0:ℝ)).smul_const (D n) |>.const_add 1 + have hh := hd.clm_comp ih + change HasDerivAt (sweep D (n+1)) (D n * sweep D n 0 + + (1+(0:ℝ) • D n) * (∑ i ∈ Finset.range n, D i)) 0 at hh + simpa only [sweep_zero,zero_smul,add_zero,zero_add,mul_one,one_mul,Finset.sum_range_succ,add_comm] using hh + +end Heisenberg.MeshEnergy +namespace Heisenberg.MeshPair +open MeshEnergy +open scoped RealInnerProductSpace Classical +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +def generator (w : E) : E →L[ℝ] E := (-1/2:ℝ) • (innerSL ℝ w).smulRight w + +lemma generator_apply (w v : E) : generator w v = (-⟪w,v⟫/2) • w := by + simp only [generator,_root_.smul_apply,ContinuousLinearMap.smulRight_apply,innerSL_apply_apply,smul_smul] + congr 1 + ring + +lemma generator_energy (w v : E) : -⟪v,generator w v⟫ = (1/2:ℝ)*⟪w,v⟫^2 := by + rw [generator_apply,inner_smul_right,real_inner_comm v w] + ring + +lemma step_norm_square (w v : E) (t : ℝ) : + ‖(1+t • generator w) v‖^2 = + ‖v‖^2-t*⟪w,v⟫^2+(t^2/4)*⟪w,v⟫^2*‖w‖^2 := by + simp only [_root_.add_apply,one_apply_eq_self,_root_.smul_apply,generator_apply,smul_smul,norm_add_sq_real, + inner_smul_right,real_inner_comm v w,norm_smul,Real.norm_eq_abs,mul_pow,sq_abs] + ring + +lemma step_contraction (w : E) (hw : ‖w‖^2 ≤ 2) {t : ℝ} (ht : 0 ≤ t) (ht1 : t ≤ 1) : + ‖(1+t • generator w : E →L[ℝ] E)‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro v + simp only [one_mul] + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [step_norm_square] + have hsmall : t^2/4*‖w‖^2 ≤ t := by + have hh := mul_le_mul_of_nonneg_left hw (show 0 ≤ t^2/4 by positivity) + have hh' : t^2 ≤ t := by nlinarith + nlinarith + have hh := mul_le_mul_of_nonneg_right hsmall (sq_nonneg ⟪w,v⟫) + nlinarith + +variable {V : Type*} [Fintype V] [DecidableEq V] + +def edgeVector (I : Set V) (a b : V) : EuclideanSpace ℝ V := + EuclideanSpace.single a (if a ∈ I then 1 else 0) - + EuclideanSpace.single b (if b ∈ I then 1 else 0) + +lemma edge_inner (I : Set V) (a b : V) (v : EuclideanSpace ℝ V) : + ⟪edgeVector I a b,v⟫ = (if a ∈ I then v.ofLp a else 0) - + (if b ∈ I then v.ofLp b else 0) := by + simp only [edgeVector,inner_sub_left,EuclideanSpace.inner_single_left] + split_ifs <;> simp + +lemma edge_norm (I : Set V) {a b : V} (hab : a ≠ b) : ‖edgeVector I a b‖^2 ≤ 2 := by + rw [← real_inner_self_eq_norm_sq,edge_inner] + simp only [edgeVector,PiLp.sub_apply,PiLp.single_apply] + split_ifs <;> simp_all + norm_num + +theorem sweep_dirichlet (I : Set V) (a b : ℕ → V) (n : ℕ) + (v : EuclideanSpace ℝ V) : + -⟪v,(∑ i ∈ Finset.range n, generator (edgeVector I (a i) (b i))) v⟫ = + (1/2:ℝ) * ∑ i ∈ Finset.range n, + ((if a i ∈ I then v.ofLp (a i) else 0) - + (if b i ∈ I then v.ofLp (b i) else 0))^2 := by + simp only [_root_.sum_apply,inner_sum,← Finset.sum_neg_distrib, + generator_energy,edge_inner,Finset.mul_sum] + +theorem sweep_energy (I : Set V) (a b : ℕ → V) (n : ℕ) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ t in 𝓝 (0:ℝ), ∀ v : EuclideanSpace ℝ V, + |‖sweep (fun i => generator (edgeVector I (a i) (b i))) n t v‖^2 - ‖v‖^2 + + t * ∑ i ∈ Finset.range n, + ((if a i ∈ I then v.ofLp (a i) else 0) - + (if b i ∈ I then v.ofLp (b i) else 0))^2| ≤ ε*|t| * ‖v‖^2 := by + have hh := uniform_energy_error (sweep_zero (fun i => generator (edgeVector I (a i) (b i))) n) + (sweep_derivative (fun i => generator (edgeVector I (a i) (b i))) n) hε + filter_upwards [hh] with t ht + intro v + have he := sweep_dirichlet I a b n v + convert ht v using 1 + congr 1 + nlinarith [congrArg (fun z : ℝ => t*z) he] + +end Heisenberg.MeshPair +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LayerExposure.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LayerExposure.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f62d47ed6702cf7b75036dd8117dc5ea0670f9a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LayerExposure.lean @@ -0,0 +1,262 @@ +import OAI.MathematicalPhysics.Heisenberg.FiniteHistories + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical + +namespace Heisenberg.Exposure + +section +open Heisenberg.Cycle Heisenberg.LayeredExchange +variable {T V : Type*} [Fintype T] [Fintype V] + +def layerHistory (s : Equiv.Perm T) (τ : T → Equiv.Perm V) (b : T → Bool) : + Equiv.Perm (T × V) := wiring s (fun t => if b t then τ t else 1) + +def layerRevealed (τ : T → Equiv.Perm V) (A : Set (T × V)) (t : T) : Prop := + ∃ v, (t,v) ∈ A ∧ τ t v ≠ v + +omit [Fintype T] [Fintype V] in +lemma layer_matches_iff (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (A : Set (T × V)) (b c : T → Bool) : + (∀ z ∈ A, layerHistory s τ b z = layerHistory s τ c z) ↔ + ∀ t, layerRevealed τ A t → c t = b t := by + constructor + · intro h t ht + obtain ⟨v,hv,hne⟩ := ht + have he := congrArg Prod.snd (h (t,v) hv) + change (if b t then τ t else 1) v = (if c t then τ t else 1) v at he + cases hb : b t <;> cases hc : c t + · rfl + · exact (hne (by simpa only [hb,hc,Bool.false_eq_true,↓reduceIte,Equiv.Perm.one_apply] using he.symm)).elim + · exact (hne (by simpa only [hb,hc,Bool.false_eq_true,↓reduceIte,Equiv.Perm.one_apply] using he)).elim + · rfl + · intro h ⟨t,v⟩ hv + simp only [layerHistory,wiring_apply] + by_cases ht : layerRevealed τ A t + · rw [h t ht] + · have he : τ t v = v := by by_contra hn; exact ht ⟨v,hv,hn⟩ + congr 1 + split_ifs <;> first | exact he | exact he.symm | rfl + +def layerExposure (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b c : T → Bool) : Prop := + (∀ z ∈ MissingSet (layerHistory s τ b) P, layerHistory s τ b z = layerHistory s τ c z) ∧ + MissingSet (layerHistory s τ c) P = MissingSet (layerHistory s τ b) P + +lemma layerExposure_iff (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b c : T → Bool) : + layerExposure s τ P b c ↔ + (∀ t, layerRevealed τ (MissingSet (layerHistory s τ b) P) t → c t = b t) ∧ + OutsideHit (layerHistory s τ c) P (MissingSet (layerHistory s τ b) P) := by + constructor + · rintro ⟨hm,he⟩ + exact ⟨(layer_matches_iff ..).mp hm,(sameMissing_iff_outsideHit _ _ _ hm).mp he⟩ + · rintro ⟨hc,hh⟩ + have hm := (layer_matches_iff s τ _ b c).mpr hc + exact ⟨hm,(sameMissing_iff_outsideHit _ _ _ hm).mpr hh⟩ + +lemma layerExposure_weight (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b c : T → Bool) (h : layerExposure s τ P b c) : + missingCount (layerHistory s τ c) P = missingCount (layerHistory s τ b) P := + (missing_weight_rigid _ _ P h.2.symm h.1).symm + +theorem layer_exposure_disintegration (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (w : T → Bool → ℝ) (P : Set (T × V)) (b : T → Bool) (F : (T → Bool) → ℝ) : + let A := MissingSet (layerHistory s τ b) P + let M := layerRevealed τ A + let a : {t // M t} → Bool := fun t => b t + (∑ c : T → Bool, if layerExposure s τ P b c then + productWeight w c * (2:ℝ)^missingCount (layerHistory s τ c) P * F c else 0) = + (2:ℝ)^missingCount (layerHistory s τ b) P * + productWeight (fun t : {t // M t} => w t) a * + ∑ c : {t // ¬M t} → Bool, if OutsideHit (layerHistory s τ (merge M a c)) P A then + productWeight (fun t : {t // ¬M t} => w t) c * F (merge M a c) else 0 := by + dsimp only + refine filtered_cylinder_disintegration w + (layerRevealed τ (MissingSet (layerHistory s τ b) P)) (fun t => b t) + (fun c => OutsideHit (layerHistory s τ c) P (MissingSet (layerHistory s τ b) P)) + (layerExposure s τ P b) (fun c => (2:ℝ)^missingCount (layerHistory s τ c) P) F + ((2:ℝ)^missingCount (layerHistory s τ b) P) ?_ ?_ + · intro c + rw [layerExposure_iff] + constructor + · rintro ⟨hc,hg⟩ + exact ⟨fun t => hc t t.property,hg⟩ + · rintro ⟨hc,hg⟩ + exact ⟨fun t ht => hc ⟨t,ht⟩,hg⟩ + · intro c hc + rw [layerExposure_weight s τ P b c hc] + +end + +section +open LayeredExchange Heisenberg.Cycle +variable {V : Type*} [Fintype V] [DecidableEq V] + +omit [Fintype V] [DecidableEq V] in +lemma invariant_of_agree (π σ : Equiv.Perm V) (A : Set V) + (hA : ∀ x,π x ∈ A ↔ x ∈ A) (he : ∀ x ∈ A,π x = σ x) : + ∀ x,σ x ∈ A ↔ x ∈ A := by + intro x + constructor + · intro hx + have hy : π.symm (σ x) ∈ A := (hA _).mp (by simpa using hx) + have hs := he _ hy + have hxy : π.symm (σ x) = x := σ.injective (by simpa using hs.symm) + exact hxy ▸ hy + · intro hx + rw [← he x hx] + exact (hA x).mpr hx + +def residualCoins {n : ℕ} (M : Fin n → Prop) (base c : Fin n → Bool) : Fin n → Bool := + fun i => if M i then base i else c i + +omit [Fintype V] [DecidableEq V] in +lemma residual_agrees {n : ℕ} (s : Equiv.Perm (Fin n)) (τ : Fin n → Equiv.Perm V) + (P : Set (Fin n × V)) (base c : Fin n → Bool) : + ∀ z ∈ MissingSet (layerHistory s τ base) P, + layerHistory s τ base z = layerHistory s τ + (residualCoins (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c) z := by + apply (layer_matches_iff _ _ _ _ _).mpr + intro t ht + simp [residualCoins,ht] + +omit [Fintype V] [DecidableEq V] in +lemma residual_invariant {n : ℕ} (s : Equiv.Perm (Fin n)) (τ : Fin n → Equiv.Perm V) + (P : Set (Fin n × V)) (base c : Fin n → Bool) : + ∀ z, layerHistory s τ + (residualCoins (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c) z ∉ + MissingSet (layerHistory s τ base) P ↔ z ∉ MissingSet (layerHistory s τ base) P := by + intro z + exact not_congr (invariant_of_agree _ _ _ (missing_apply _ _) + (residual_agrees s τ P base c) z) + +lemma residual_determinantLaw {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (P : Set (Fin n × V)) (base : Fin n → Bool) (p : Fin n → ℝ) : + let τ := fun i => Equiv.swap (a i) (b i) + let M := layerRevealed τ (MissingSet (layerHistory s τ base) P) + DeterminantLaw (fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i) + (fun c => forwardHom (R:=ℝ) (layerHistory s τ (residualCoins M base c))) := by + dsimp only + let τ := fun i => Equiv.swap (a i) (b i) + let M := layerRevealed τ (MissingSet (layerHistory s τ base) P) + let fixed := fun i => if M i then some (if base i then τ i else 1) else none + have h := determinantLaw_wiring s a b p fixed + convert h using 1 + funext c + apply congrArg (forwardHom (R:=ℝ)) + apply congrArg (wiring s) + funext i + change (if residualCoins M base c i then τ i else 1) = + (fixed i).getD (if c i then τ i else 1) + by_cases hi : M i <;> simp [fixed,residualCoins,hi] + +def residualHolePerm {n : ℕ} (s : Equiv.Perm (Fin n)) (τ : Fin n → Equiv.Perm V) + (P : Set (Fin n × V)) (base c : Fin n → Bool) : + Equiv.Perm {z : Fin n × V // z ∉ MissingSet (layerHistory s τ base) P} := + (layerHistory s τ (residualCoins + (layerRevealed τ (MissingSet (layerHistory s τ base) P)) base c)).subtypePerm + (p := fun z => z ∉ MissingSet (layerHistory s τ base) P) + (residual_invariant s τ P base c) + +attribute [local irreducible] MissingSet layerHistory + +theorem residual_holes_determinantLaw {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (P : Set (Fin n × V)) (base : Fin n → Bool) (p : Fin n → ℝ) : + DeterminantLaw (fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i) + (fun c => forwardHom (R:=ℝ) + (residualHolePerm s (fun i => Equiv.swap (a i) (b i)) P base c)) := by + let τ : Fin n → Equiv.Perm V := fun i => Equiv.swap (a i) (b i) + let A : Set (Fin n × V) := MissingSet (layerHistory s τ base) P + let π : (Fin n → Bool) → Equiv.Perm (Fin n × V) := fun c => + layerHistory s τ (residualCoins (layerRevealed τ A) base c) + let μ : (Fin n → Bool) → ℝ := fun c => ∏ i,if c i then p i else 1-p i + have h : DeterminantLaw μ (fun c => forwardHom (R:=ℝ) (π c)) := + residual_determinantLaw s a b P base p + have hi : ∀ c z,π c z ∉ A ↔ z ∉ A := fun c => residual_invariant s τ P base c + have hh := determinantLaw_holes (Ω:=Fin n → Bool) (V:=Fin n × V) (R:=ℝ) + (μ:=μ) (π:=π) h (fun z => z ∉ A) hi + change DeterminantLaw μ (fun c => forwardHom (R:=ℝ) ((π c).subtypePerm (p:= fun z => z ∉ A) (hi c))) + exact hh + +end + +open Heisenberg.Cycle LayeredExchange +variable {V W : Type*} + +lemma sameCycle_congr (e : V ≃ W) (π : Equiv.Perm V) (x y : V) : + (e.permCongr π).SameCycle (e x) (e y) ↔ π.SameCycle x y := by + change (∃ n : ℤ,((e.permCongr π)^n) (e x) = e y) ↔ ∃ n : ℤ,(π^n) x = y + apply exists_congr + intro n + have he := map_zpow e.permCongrHom π n + change e.permCongr (π^n) = (e.permCongr π)^n at he + rw [←he,Equiv.permCongr_apply,Equiv.symm_apply_apply,e.injective.eq_iff] + +def splitHolePerm (σ : Equiv.Perm V) (A P : Set V) + (hA : ∀ x,σ x ∉ A ↔ x ∉ A) : + Equiv.Perm ({x : {z : V // z ∉ A} // x.val ∈ P} ⊕ + {x : {z : V // z ∉ A} // x.val ∉ P}) := + (Equiv.sumCompl (fun x : {z : V // z ∉ A} => x.val ∈ P)).symm.permCongr + (σ.subtypePerm hA) + +lemma allHit_splitHolePerm (σ : Equiv.Perm V) (A P : Set V) + (hA : ∀ x,σ x ∉ A ↔ x ∉ A) (hP : Disjoint A P) : + AllHit (splitHolePerm σ A P hA) ↔ OutsideHit σ P A := by + let e := Equiv.sumCompl (fun x : {z : V // z ∉ A} => x.val ∈ P) + let π := σ.subtypePerm (p := fun z => z ∉ A) hA + have he (x y) : (splitHolePerm σ A P hA).SameCycle x y ↔ + π.SameCycle (e x) (e y) := by + have hh := sameCycle_congr e.symm π (e x) (e y) + simpa only [Equiv.symm_apply_apply,e,splitHolePerm] using hh + constructor + · intro h x hx + obtain ⟨j,hj⟩ := h (e.symm ⟨x,hx⟩) + refine ⟨j.val.val,j.property,?_⟩ + have hc := (he _ _).mp hj + rw [Equiv.apply_symm_apply] at hc + exact Equiv.Perm.sameCycle_subtypePerm.mp hc + · intro h x + obtain ⟨j,hj,hc⟩ := h (e x).val (e x).property + have hjA : j ∉ A := fun hA => Set.disjoint_left.mp hP hA hj + let y : {x : {z : V // z ∉ A} // x.val ∈ P} := ⟨⟨j,hjA⟩,hj⟩ + refine ⟨y,(he _ _).mpr ?_⟩ + exact Equiv.Perm.sameCycle_subtypePerm.mpr hc + +variable [Fintype V] [DecidableEq V] + +theorem exposed_nextPin_first_moment {n : ℕ} (s : Equiv.Perm (Fin n)) + (a b : Fin n → V) (P : Set (Fin n × V)) (base : Fin n → Bool) (p : Fin n → ℝ) : + let τ := fun i => Equiv.swap (a i) (b i) + let A := MissingSet (layerHistory s τ base) P + let π := fun c => splitHolePerm + (layerHistory s τ (residualCoins (layerRevealed τ A) base c)) A P + (residual_invariant s τ P base c) + let μ := fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i + hitWeight μ π ≠ 0 → + (∑ c, if hw : AllHit (π c) then + (μ c / hitWeight μ π) • nextPinMatrix ℝ (π c) hw else 0) = + hittingResolvent ℝ (∑ c,μ c • columnPerm ℝ (π c)) := by + dsimp only + intro hg + apply conditional_nextPin_first_moment _ _ _ hg + have h := residual_holes_determinantLaw s a b P base p + have hh := determinantLaw_reindexed h + (Equiv.sumCompl (fun x : {z : Fin n × V // z ∉ + MissingSet (layerHistory s (fun i => Equiv.swap (a i) (b i)) base) P} => x.val ∈ P)) + exact hh + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LayerRegularity.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LayerRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e37a2be46ded7a347b08a5f66256ccb294b966ec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LayerRegularity.lean @@ -0,0 +1,194 @@ +import OAI.MathematicalPhysics.Heisenberg.LatticeRegularity + +namespace OAI + +noncomputable section + +open scoped Classical BigOperators +open Module +open scoped BigOperators + +open scoped Classical + +open scoped BigOperators Classical +namespace Heisenberg.Exposure + +section +open Heisenberg.Cycle Heisenberg.LayeredExchange +variable {T V : Type*} [Fintype T] [Fintype V] + +def layerHoles (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b : T → Bool) (t : T) : Set V := + {v | (t,v) ∉ MissingSet (layerHistory s τ b) P} + +omit [Fintype T] [Fintype V] in +lemma layerHoles_pin (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b : T → Bool) (t : T) (v : V) (hv : (t,v) ∈ P) : + v ∈ layerHoles s τ P b t := by + intro h + exact h (t,v) hv rfl + +omit [Fintype T] [Fintype V] in +lemma layerHoles_transport (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b : T → Bool) (t : T) (v : V) : + (if b t then τ t else 1) v ∈ layerHoles s τ P b (s t) ↔ + v ∈ layerHoles s τ P b t := by + exact not_congr (missing_apply (layerHistory s τ b) P (t,v)) + +omit [Fintype T] [Fintype V] in +lemma layerHoles_quiet (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (b : T → Bool) (t : T) (hb : b t = false) : + layerHoles s τ P b (s t) = layerHoles s τ P b t := by + ext v + simpa only [hb,Bool.false_eq_true,ite_false,Equiv.Perm.one_apply] using + layerHoles_transport s τ P b t v + +omit [Fintype T] [Fintype V] in +lemma swap_layerRevealed [DecidableEq V] (a b : T → V) (hab : ∀ t,a t ≠ b t) + (A : Set (T × V)) (t : T) : + layerRevealed (fun t => Equiv.swap (a t) (b t)) A t ↔ + (t,a t) ∈ A ∨ (t,b t) ∈ A := by + constructor + · rintro ⟨v,hv,hne⟩ + by_cases hva : v=a t + · exact Or.inl (hva ▸ hv) + by_cases hvb : v=b t + · exact Or.inr (hvb ▸ hv) + exact False.elim (hne (Equiv.swap_apply_of_ne_of_ne hva hvb)) + · rintro (ha | hb) + · exact ⟨a t,ha,by simpa using (hab t).symm⟩ + · exact ⟨b t,hb,by simpa using hab t⟩ + +def layerBlocked {X : Type*} (loc : V → X) (s : Equiv.Perm T) + (τ : T → Equiv.Perm V) (P : Set (T × V)) (b : T → Bool) (t : T) : Set X := + {x | (∃ v,loc v=x) ∧ ∀ v,loc v=x → v ∉ layerHoles s τ P b t} + +omit [Fintype T] in +lemma layerBlocked_finite {X : Type*} (loc : V → X) (s : Equiv.Perm T) + (τ : T → Equiv.Perm V) (P : Set (T × V)) (b : T → Bool) (t : T) : + (layerBlocked loc s τ P b t).Finite := + (Set.finite_range loc).subset fun _ h => h.1 + +omit [Fintype T] [Fintype V] in +lemma layerBlocked_pin {X : Type*} (loc : V → X) (s : Equiv.Perm T) + (τ : T → Equiv.Perm V) (P : Set (T × V)) (b : T → Bool) (t : T) (v : V) + (hv : (t,v) ∈ P) : loc v ∉ layerBlocked loc s τ P b t := by + intro h + exact h.2 v rfl (layerHoles_pin s τ P b t v hv) + +def localGrowth {X Y : Type*} [PseudoMetricSpace X] (loc : Y → X) + (α L : ℝ) (U : Finset Y) : Prop := + ∀ (x : X) (h : ℝ), 0 ≤ h → + ((U.filter (fun v => dist (loc v) x ≤ h)).card : ℝ) ≤ L*(1+h)^α + +omit [Fintype T] [Fintype V] in +lemma localGrowth_image {X Y Z : Type*} [PseudoMetricSpace X] [DecidableEq Z] + (loc : Z → X) (f : Y → Z) (F : Finset Y) (α L : ℝ) + (hf : Function.Injective f) : + localGrowth loc α L (F.image f) ↔ localGrowth (loc ∘ f) α L F := by + unfold localGrowth + have he (x : X) (r : ℝ) : + ((F.image f).filter (fun v => dist (loc v) x ≤ r)).card = + (F.filter (fun v => dist (loc (f v)) x ≤ r)).card := by + rw [Finset.filter_image] + exact Finset.card_image_of_injective _ hf + simp only [he,Function.comp_apply] + +theorem layer_blocked_mass_le {X : Type*} [PseudoMetricSpace X] + (loc : V → X) (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (P : Set (T × V)) (t : T) (μ : (T → Bool) → ℝ) (hμ : ∀ b,0≤μ b) + (α L p : ℝ) (hp : 0≤p) + (htest : ∀ U : Finset V, localGrowth loc α L U → + (∀ v ∈ U,(t,v) ∉ P) → + (∑ b,if ∀ v ∈ U,(t,v) ∈ MissingSet (layerHistory s τ b) P then μ b else 0) ≤ p^U.card) + (F : Finset X) (hF : localGrowth id α L F) : + (∑ b,if (F:Set X) ⊆ layerBlocked loc s τ P b t then μ b else 0) ≤ p^F.card := by + classical + by_cases hr : ∀ x ∈ F,∃ v,loc v=x + · choose r hloc using (fun x : F => hr x x.property) + let U : Finset V := Finset.univ.image r + have hinj : Function.Injective r := by + intro x y h + apply Subtype.ext + exact (hloc x).symm.trans ((congrArg loc h).trans (hloc y)) + have hcard : U.card=F.card := by + rw [Finset.card_image_of_injective _ hinj,Finset.card_univ,Fintype.card_coe] + have hUg : localGrowth loc α L U := by + rw [localGrowth_image _ _ _ _ _ hinj] + intro x h hh + have he : (Finset.univ.filter (fun v : F => dist (loc (r v)) x ≤ h)).card = + (F.filter (fun v => dist v x ≤ h)).card := by + simp only [hloc] + apply Finset.card_bij (fun v _ => v.val) + · intro v hv + exact Finset.mem_filter.mpr ⟨v.property,(Finset.mem_filter.mp hv).2⟩ + · intro v _ w _ h + exact Subtype.ext h + · intro v hv + exact ⟨⟨v,(Finset.mem_filter.mp hv).1⟩,by simpa using (Finset.mem_filter.mp hv).2,rfl⟩ + simpa only [Function.comp_apply,he,id_eq] using hF x h hh + have hcover (b) (hb : (F:Set X) ⊆ layerBlocked loc s τ P b t) : + ∀ v ∈ U,(t,v) ∈ MissingSet (layerHistory s τ b) P := by + intro v hv + obtain ⟨x,_,rfl⟩ := Finset.mem_image.mp hv + exact not_not.mp ((hb x.property).2 (r x) (hloc x)) + by_cases hP : ∀ v ∈ U,(t,v) ∉ P + · calc + _ ≤ ∑ b,if ∀ v ∈ U,(t,v) ∈ MissingSet (layerHistory s τ b) P then μ b else 0 := by + apply Finset.sum_le_sum + intro b _ + split_ifs with hb hm + · rfl + · exact False.elim (hm (hcover b hb)) + · exact hμ b + · rfl + _ ≤ p^U.card := htest U hUg hP + _ = _ := by rw [hcard] + · have hz : ∀ b,¬(F:Set X) ⊆ layerBlocked loc s τ P b t := by + intro b hb + obtain ⟨v,hv,hvP⟩ := by simpa only [not_forall,Classical.not_imp,not_not] using hP + exact hcover b hb v hv (t,v) hvP rfl + simp only [hz,ite_false,Finset.sum_const_zero] + exact pow_nonneg hp _ + · have hz : ∀ b,¬(F:Set X) ⊆ layerBlocked loc s τ P b t := by + intro b hb + exact hr fun x hx => (hb hx).1 + simp only [hz,ite_false,Finset.sum_const_zero] + exact pow_nonneg hp _ + +end + +open Heisenberg.Geometry Heisenberg.SparseWitness Heisenberg.LatticeRegular +variable {T V : Type*} [Fintype T] [Fintype V] + +theorem layer_regularity (k M b : ℕ) (hb : 100≤b) + (α L ν a : ℝ) (hα : 0≤α) (hL : (2*(k+1):ℕ)≤L) + (hba : 2≤(b:ℝ)^α) (hν : 0<ν) (ha : 0≤a) : + ∃ p₀>0,∃ C≥0,∀ (loc : V → Site (k+1)) (s : Equiv.Perm T) + (u v : T → V) (P : Set (T×V)) (rates : T → ℝ) + (_hrates : ∀ i,0≤rates i ∧ rates i≤1) (t : T) (p : ℝ), + 0≤p → p≤p₀ → + (∀ U : Finset V,localGrowth loc α L U → (∀ j∈U,(t,j)∉P) → + (∑ c,if ∀ j∈U,(t,j)∈Cycle.MissingSet + (layerHistory s (fun i=>Equiv.swap (u i) (v i)) c) P then + layerMass s u v P rates c else 0)≤p^U.card) → + ∀ (x : Site (k+1)) (R : ℕ), + (∑ c,if ¬Regular (layerBlocked loc s (fun i=>Equiv.swap (u i) (v i)) P c t) + x R M ν then layerMass s u v P rates c else 0) ≤ + C*((1+(R:ℝ))^(k+1)*p^(2*(k+1))+(1+(R:ℝ))^(-a)) := by + obtain ⟨p₀,hp₀,C,hC,hr⟩ := regularity_probability k M b hb α L ν a hα hL hba hν ha + refine ⟨p₀,hp₀,C,hC,?_⟩ + intro loc s u v P rates hrates t p hp hpp htest x R + apply hr (T → Bool) (layerMass s u v P rates) + (fun c=>layerBlocked loc s (fun i=>Equiv.swap (u i) (v i)) P c t) p + (layerMass_nonneg s u v P rates hrates) (layerMass_sum s u v P rates hrates).le hp hpp _ x R + intro F hF + exact layer_blocked_mass_le loc s (fun i=>Equiv.swap (u i) (v i)) P t + (layerMass s u v P rates) (layerMass_nonneg s u v P rates hrates) + α L p hp htest F hF + +end Heisenberg.Exposure + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LocalAlgebra.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LocalAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..6feb135a16bd4ef3e93ae2f2aac658dcfa6e1e6a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LocalAlgebra.lean @@ -0,0 +1,475 @@ +import OAI.MathematicalPhysics.Heisenberg.Model + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical + +open scoped ComplexConjugate BigOperators +namespace Heisenberg + +instance quasiLocalNormedRing (d ℓ : ℕ) : NormedRing (QuasiLocal d ℓ) := + SubringClass.toNormedRing (quasiLocalAlgebra d ℓ) + +instance quasiLocalStarRing (d ℓ : ℕ) : StarRing (QuasiLocal d ℓ) := + (quasiLocalAlgebra d ℓ).starRing + +instance quasiLocalNormedAlgebra (d ℓ : ℕ) : NormedAlgebra ℂ (QuasiLocal d ℓ) := + SubalgebraClass.toNormedAlgebra (quasiLocalAlgebra d ℓ) + +instance quasiLocalAddCommGroup (d ℓ : ℕ) : AddCommGroup (QuasiLocal d ℓ) := + (SubringClass.toRing (quasiLocalAlgebra d ℓ)).toAddCommGroup + +instance quasiLocalAddCommMonoid (d ℓ : ℕ) : AddCommMonoid (QuasiLocal d ℓ) := + (quasiLocalAddCommGroup d ℓ).toAddCommMonoid + +instance quasiLocalAddMonoid (d ℓ : ℕ) : AddMonoid (QuasiLocal d ℓ) := + (quasiLocalAddCommMonoid d ℓ).toAddMonoid + +instance quasiLocalAddZeroClass (d ℓ : ℕ) : AddZeroClass (QuasiLocal d ℓ) := + (quasiLocalAddMonoid d ℓ).toAddZeroClass + +instance quasiLocalAddCommMagma (d ℓ : ℕ) : AddCommMagma (QuasiLocal d ℓ) := + (quasiLocalAddCommMonoid d ℓ).toAddCommMagma + +instance quasiLocalStarMul (d ℓ : ℕ) : StarMul (QuasiLocal d ℓ) := + (quasiLocalAlgebra d ℓ).starRing.toStarMul + +instance quasiLocalModule (d ℓ : ℕ) : Module ℂ (QuasiLocal d ℓ) := + (SubalgebraClass.toNormedAlgebra (quasiLocalAlgebra d ℓ)).toNormedSpace.toModule + +@[simp] theorem matrixUnit_mul_same (d ℓ : ℕ) (x : Site d) (a b c e : Level ℓ) : + matrixUnit d ℓ x a b * matrixUnit d ℓ x c e = + if b = c then matrixUnit d ℓ x a e else 0 := by + classical + ext v z + change (matrixUnit d ℓ x a b) ((matrixUnit d ℓ x c e) v) z = _ + by_cases hbc : b = c + · subst c + simp only [matrixUnit_apply, Finsupp.update_apply, ite_true] + by_cases hza : z x = a <;> simp [hza] + · simp only [matrixUnit_apply, Finsupp.update_apply, hbc, ite_false] + by_cases hza : z x = a <;> simp [hza, hbc] + +@[simp] theorem matrixUnit_diagonal_sum (d ℓ : ℕ) (x : Site d) : + ∑ a : Level ℓ, matrixUnit d ℓ x a a = 1 := by + classical + ext v z + simp only [sum_apply, lp.coeFn_sum, Finset.sum_apply, + matrixUnit_apply, one_apply_eq_self] + rw [Finset.sum_ite_eq] + simp [Finsupp.update_self] + +theorem matrixUnits_commute {d ℓ : ℕ} {x y : Site d} (hxy : x ≠ y) + (a b c e : Level ℓ) : + Commute (matrixUnit d ℓ x a b) (matrixUnit d ℓ y c e) := by + classical + change _ * _ = _ * _ + ext v z + change matrixUnit d ℓ x a b (matrixUnit d ℓ y c e v) z = + matrixUnit d ℓ y c e (matrixUnit d ℓ x a b v) z + simp only [matrixUnit_apply] + by_cases hx : z x = a <;> by_cases hy : z y = c <;> + simp [hx, hy, Finsupp.update_apply, hxy, Ne.symm hxy, Finsupp.update_comm z hxy] + +@[simp] theorem localUnit_mul_same (d ℓ : ℕ) (x : Site d) (a b c e : Level ℓ) : + localUnit d ℓ x a b * localUnit d ℓ x c e = + if b = c then localUnit d ℓ x a e else 0 := by + classical + apply Subtype.ext + change matrixUnit d ℓ x a b * matrixUnit d ℓ x c e = _ + rw [matrixUnit_mul_same] + split_ifs <;> rfl + +@[simp] theorem localUnit_diagonal_sum (d ℓ : ℕ) (x : Site d) : + ∑ a : Level ℓ, localUnit d ℓ x a a = 1 := by + apply Subtype.ext + change (quasiLocalAlgebra d ℓ).subtype (∑ a : Level ℓ, localUnit d ℓ x a a) = + (quasiLocalAlgebra d ℓ).subtype 1 + rw [map_sum, map_one] + exact matrixUnit_diagonal_sum d ℓ x + +theorem localUnits_commute {d ℓ : ℕ} {x y : Site d} (hxy : x ≠ y) + (a b c e : Level ℓ) : + Commute (localUnit d ℓ x a b) (localUnit d ℓ y c e) := by + change _ * _ = _ * _ + apply Subtype.ext + exact (matrixUnits_commute hxy a b c e).eq + +@[simp] theorem star_l2Projection {ι : Type*} (p : ι → Prop) : + star (l2Projection p) = l2Projection p := by + classical + rw [ContinuousLinearMap.star_eq_adjoint, eq_comm, + ContinuousLinearMap.eq_adjoint_iff] + intro v w + simp only [lp.inner_eq_tsum, l2Projection_apply] + apply tsum_congr + intro i + by_cases h : p i <;> simp [h] + +@[simp] theorem star_l2Reindex {ι : Type*} (e : Equiv.Perm ι) : + star ((l2Reindex e).toContinuousLinearEquiv.toContinuousLinearMap) = + (l2Reindex e.symm).toContinuousLinearEquiv.toContinuousLinearMap := by + rw [ContinuousLinearMap.star_eq_adjoint, eq_comm, + ContinuousLinearMap.eq_adjoint_iff] + intro v w + have h := (l2Reindex e).inner_map_map (l2Reindex e.symm v) w + have he : l2Reindex e (l2Reindex e.symm v) = v := by + ext i + simp + rw [he] at h + exact h.symm + +@[simp] theorem configPerm_swap_symm (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : + (configPerm d ℓ x (Equiv.swap a b)).symm = configPerm d ℓ x (Equiv.swap a b) := by + classical + ext c + simp [configPerm, Equiv.symm_swap] + +@[simp] theorem star_matrixUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : + star (matrixUnit d ℓ x a b) = matrixUnit d ℓ x b a := by + classical + change star (l2Projection (fun c : Configuration d ℓ => c x = a) * + (l2Reindex (configPerm d ℓ x (Equiv.swap a b))).toContinuousLinearEquiv.toContinuousLinearMap) = _ + rw [star_mul, star_l2Projection, star_l2Reindex, configPerm_swap_symm] + ext v z + change l2Reindex (configPerm d ℓ x (Equiv.swap a b)) + (l2Projection (fun c : Configuration d ℓ => c x = a) v) z = _ + simp only [l2Reindex_apply, l2Projection_apply, matrixUnit_apply] + change (if ((z.update x ((Equiv.swap a b).symm (z x))) x) = a then + v (z.update x ((Equiv.swap a b).symm (z x))) else 0) = + if z x = b then v (z.update x a) else 0 + simp only [Finsupp.update_apply, ite_true, Equiv.symm_swap] + by_cases h : z x = b + · simp [h] + · have hn : Equiv.swap a b (z x) ≠ a := by + intro he + have := congrArg (Equiv.swap a b) he + simp at this + exact h this + simp only [h, hn, ite_false] + +@[simp] theorem star_localUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : + star (localUnit d ℓ x a b) = localUnit d ℓ x b a := by + apply Subtype.ext + exact star_matrixUnit d ℓ x a b + +@[simp] theorem star_spinZ (d ℓ : ℕ) (x : Site d) : + star (spinZ d ℓ x) = spinZ d ℓ x := by + simp [spinZ, star_sum, star_smul] + +@[simp] theorem star_spinX (d ℓ : ℕ) (x : Site d) : + star (spinX d ℓ x) = spinX d ℓ x := by + simp [spinX, spinMinus, star_smul, add_comm] + +@[simp] theorem star_spinY (d ℓ : ℕ) (x : Site d) : + star (spinY d ℓ x) = spinY d ℓ x := by + simp only [spinY, spinMinus, star_smul, star_sub, star_star] + rw [← neg_sub (spinPlus d ℓ x) (star (spinPlus d ℓ x)), smul_neg, ← neg_smul] + congr 1 + simp + +@[simp] theorem spinZ_mul_localUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : + spinZ d ℓ x * localUnit d ℓ x a b = + (magneticLevel ℓ a : ℂ) • localUnit d ℓ x a b := by + classical + simp only [spinZ, Finset.sum_mul, smul_mul_assoc, localUnit_mul_same] + simp [smul_ite] + +@[simp] theorem localUnit_mul_spinZ (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : + localUnit d ℓ x a b * spinZ d ℓ x = + (magneticLevel ℓ b : ℂ) • localUnit d ℓ x a b := by + classical + simp only [spinZ, Finset.mul_sum, mul_smul_comm, localUnit_mul_same] + simp [smul_ite] + +lemma magneticLevel_succ (ℓ : ℕ) (k : Fin ℓ) : + magneticLevel ℓ k.succ = magneticLevel ℓ k.castSucc + 1 := by + simp [magneticLevel] + ring + +theorem spinZ_spinPlus (d ℓ : ℕ) (x : Site d) : + spinZ d ℓ x * spinPlus d ℓ x = + spinPlus d ℓ x * spinZ d ℓ x + spinPlus d ℓ x := by + classical + simp only [spinPlus, Finset.mul_sum, Finset.sum_mul, mul_smul_comm, + smul_mul_assoc, spinZ_mul_localUnit, localUnit_mul_spinZ, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro k _ + rw [magneticLevel_succ, Complex.ofReal_add, Complex.ofReal_one, + smul_smul, smul_smul, ← add_smul] + congr 1 + ring + +theorem spinZ_spinMinus (d ℓ : ℕ) (x : Site d) : + spinZ d ℓ x * spinMinus d ℓ x = + spinMinus d ℓ x * spinZ d ℓ x - spinMinus d ℓ x := by + have h := congrArg star (spinZ_spinPlus d ℓ x) + simp only [star_mul, star_add, star_spinZ] at h + change spinZ d ℓ x * star (spinPlus d ℓ x) = _ + rw [eq_sub_iff_add_eq] + exact h.symm + +def localAlgebra (d ℓ : ℕ) (F : Set (Site d)) : StarSubalgebra ℂ (QuasiLocal d ℓ) := + StarAlgebra.adjoin ℂ {A | ∃ x ∈ F, ∃ a b, A = localUnit d ℓ x a b} + +lemma localUnit_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} + (hx : x ∈ F) (a b : Level ℓ) : localUnit d ℓ x a b ∈ localAlgebra d ℓ F := + StarAlgebra.subset_adjoin ℂ _ ⟨x, hx, a, b, rfl⟩ + +lemma spinZ_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} (hx : x ∈ F) : + spinZ d ℓ x ∈ localAlgebra d ℓ F := by + apply Subalgebra.sum_mem + intro k _ + exact (localAlgebra d ℓ F).smul_mem (localUnit_mem_localAlgebra d ℓ F hx k k) _ + +lemma spinPlus_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} (hx : x ∈ F) : + spinPlus d ℓ x ∈ localAlgebra d ℓ F := by + apply Subalgebra.sum_mem + intro k _ + exact (localAlgebra d ℓ F).smul_mem (localUnit_mem_localAlgebra d ℓ F hx k.succ k.castSucc) _ + +lemma spinMinus_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} (hx : x ∈ F) : + spinMinus d ℓ x ∈ localAlgebra d ℓ F := + star_mem (spinPlus_mem_localAlgebra d ℓ F hx) + +lemma spinX_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} (hx : x ∈ F) : + spinX d ℓ x ∈ localAlgebra d ℓ F := + (localAlgebra d ℓ F).smul_mem ((localAlgebra d ℓ F).add_mem + (spinPlus_mem_localAlgebra d ℓ F hx) (spinMinus_mem_localAlgebra d ℓ F hx)) _ + +lemma spinY_mem_localAlgebra (d ℓ : ℕ) (F : Set (Site d)) {x : Site d} (hx : x ∈ F) : + spinY d ℓ x ∈ localAlgebra d ℓ F := + (localAlgebra d ℓ F).smul_mem ((localAlgebra d ℓ F).sub_mem + (spinPlus_mem_localAlgebra d ℓ F hx) (spinMinus_mem_localAlgebra d ℓ F hx)) _ + +theorem localAlgebras_commute {d ℓ : ℕ} {F G : Set (Site d)} (hFG : Disjoint F G) + {A B : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ F) (hB : B ∈ localAlgebra d ℓ G) : + Commute A B := by + have hg (x : Site d) (hx : x ∈ F) (a b : Level ℓ) : + localAlgebra d ℓ G ≤ StarSubalgebra.centralizer ℂ {localUnit d ℓ x a b} := by + apply StarAlgebra.adjoin_le + rintro _ ⟨y, hy, c, e, rfl⟩ + have hxy : x ≠ y := fun h => (Set.disjoint_left.mp hFG hx) (h ▸ hy) + change _ ∈ StarSubalgebra.centralizer ℂ _ + rw [StarSubalgebra.mem_centralizer_iff ℂ] + rintro _ rfl + exact ⟨(localUnits_commute hxy a b c e).eq, by + rw [star_localUnit] + exact (localUnits_commute hxy b a c e).eq⟩ + have hle : localAlgebra d ℓ F ≤ StarSubalgebra.centralizer ℂ {B} := by + apply StarAlgebra.adjoin_le + rintro _ ⟨x, hx, a, b, rfl⟩ + have h₁ := ((StarSubalgebra.mem_centralizer_iff ℂ).mp (hg x hx a b hB)) _ (Set.mem_singleton _) + have h₂ := ((StarSubalgebra.mem_centralizer_iff ℂ).mp + (hg x hx a b (star_mem hB))) _ (Set.mem_singleton _) + change _ ∈ StarSubalgebra.centralizer ℂ _ + rw [StarSubalgebra.mem_centralizer_iff ℂ] + rintro _ rfl + exact ⟨h₁.1.symm, h₂.1.symm⟩ + exact (((StarSubalgebra.mem_centralizer_iff ℂ).mp (hle hA)) B (Set.mem_singleton B)).1.symm + +lemma singleton_local_commute {d ℓ : ℕ} {x y : Site d} (hxy : x ≠ y) + {A B : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ {x}) + (hB : B ∈ localAlgebra d ℓ {y}) : Commute A B := + localAlgebras_commute (Set.disjoint_singleton.mpr hxy) hA hB + +lemma nearestNeighbor_ne {d : ℕ} {x y : Site d} (h : NearestNeighbor x y) : x ≠ y := by + intro he + subst y + simp [NearestNeighbor] at h + +theorem star_hamiltonian (d ℓ : ℕ) (Λ : Finset (Site d)) : + star (hamiltonian d ℓ Λ) = hamiltonian d ℓ Λ := by + classical + simp only [hamiltonian, star_neg, star_sum, star_add, star_mul, + star_spinX, star_spinY, star_spinZ] + congr 1 + apply Finset.sum_congr rfl + intro e he + have hxy := nearestNeighbor_ne (Finset.mem_filter.mp he).2.1 + have hX := singleton_local_commute hxy (spinX_mem_localAlgebra d ℓ {e.1} rfl) + (spinX_mem_localAlgebra d ℓ {e.2} rfl) + have hY := singleton_local_commute hxy (spinY_mem_localAlgebra d ℓ {e.1} rfl) + (spinY_mem_localAlgebra d ℓ {e.2} rfl) + have hZ := singleton_local_commute hxy (spinZ_mem_localAlgebra d ℓ {e.1} rfl) + (spinZ_mem_localAlgebra d ℓ {e.2} rfl) + rw [hX.eq, hY.eq, hZ.eq] + +instance quasiLocalComplete (d ℓ : ℕ) : CompleteSpace (QuasiLocal d ℓ) := + (StarSubalgebra.isClosed_topologicalClosure _).completeSpace_coe + +instance quasiLocalRationalAlgebra (d ℓ : ℕ) : NormedAlgebra ℚ (QuasiLocal d ℓ) := + NormedAlgebra.restrictScalars ℚ ℂ _ + +lemma imaginaryTime_skew (t : ℝ) : Complex.I * (t : ℂ) ∈ skewAdjoint ℂ := by + change star (Complex.I * (t : ℂ)) = -(Complex.I * (t : ℂ)) + simp + +lemma hamiltonian_selfAdjoint (d ℓ : ℕ) (Λ : Finset (Site d)) : + IsSelfAdjoint (hamiltonian d ℓ Λ) := star_hamiltonian d ℓ Λ + +lemma timeHamiltonian_skew (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + (Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ ∈ skewAdjoint (QuasiLocal d ℓ) := + IsSelfAdjoint.smul_mem_skewAdjoint (imaginaryTime_skew t) (hamiltonian_selfAdjoint d ℓ Λ) + +lemma finiteUnitary (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) ∈ unitary (QuasiLocal d ℓ) := + NormedSpace.exp_mem_unitary_of_mem_skewAdjoint (timeHamiltonian_skew d ℓ Λ t) + +lemma finiteInverseUnitary (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) ∈ unitary (QuasiLocal d ℓ) := by + convert finiteUnitary d ℓ Λ (-t) using 1; simp + +theorem norm_finiteDynamics (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A : QuasiLocal d ℓ) : + ‖finiteDynamics d ℓ Λ t A‖ = ‖A‖ := by + rw [finiteDynamics, CStarRing.norm_mul_mem_unitary _ (finiteInverseUnitary d ℓ Λ t), + CStarRing.norm_mem_unitary_mul _ (finiteUnitary d ℓ Λ t)] + +lemma finiteDynamics_add (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A B : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t (A + B) = finiteDynamics d ℓ Λ t A + finiteDynamics d ℓ Λ t B := by + simp [finiteDynamics, mul_add, add_mul] + +lemma finiteDynamics_smul (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (c : ℂ) (A : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t (c • A) = c • finiteDynamics d ℓ Λ t A := by + simp [finiteDynamics] + +lemma finiteDynamics_sub (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A B : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t (A - B) = finiteDynamics d ℓ Λ t A - finiteDynamics d ℓ Λ t B := by + simp [finiteDynamics, mul_sub, sub_mul] + +theorem finiteDynamics_isometry (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + Isometry (finiteDynamics d ℓ Λ t) := by + apply Isometry.of_dist_eq + intro A B + simp only [dist_eq_norm, ← finiteDynamics_sub, norm_finiteDynamics] + +@[simp] theorem finiteDynamics_zero (d ℓ : ℕ) (Λ : Finset (Site d)) (A : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ 0 A = A := by + simp [finiteDynamics] + +lemma exp_time_star (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + star (NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ)) = + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) := by + rw [NormedSpace.star_exp, star_smul, star_hamiltonian] + simp + +theorem finiteDynamics_star (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t (star A) = star (finiteDynamics d ℓ Λ t A) := by + rw [finiteDynamics, finiteDynamics, ← exp_time_star] + simp only [star_mul, star_star] + exact mul_assoc _ _ _ + +lemma exp_time_inverse_left (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) * + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) = 1 := by + rw [← exp_time_star] + exact Unitary.star_mul_self_of_mem (finiteUnitary d ℓ Λ t) + +lemma exp_time_inverse_right (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) * + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) = 1 := by + rw [← exp_time_star] + exact Unitary.mul_star_self_of_mem (finiteUnitary d ℓ Λ t) + +@[simp] theorem finiteDynamics_one (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + finiteDynamics d ℓ Λ t 1 = 1 := by + simp only [finiteDynamics, mul_one, exp_time_inverse_right] + +theorem finiteDynamics_mul (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A B : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t (A * B) = + finiteDynamics d ℓ Λ t A * finiteDynamics d ℓ Λ t B := by + let U := NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) + let V := NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) + have hVU : V * U = 1 := exp_time_inverse_left d ℓ Λ t + change U * (A * B) * V = (U * A * V) * (U * B * V) + calc + U * (A * B) * V = U * A * (V * U) * B * V := by rw [hVU]; simp [mul_assoc] + _ = (U * A * V) * (U * B * V) := by simp [mul_assoc] + +lemma exp_time_add (d ℓ : ℕ) (Λ : Finset (Site d)) (s t : ℝ) : + NormedSpace.exp ((Complex.I * ((s + t : ℝ) : ℂ)) • hamiltonian d ℓ Λ) = + NormedSpace.exp ((Complex.I * (s : ℂ)) • hamiltonian d ℓ Λ) * + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) := by + rw [Complex.ofReal_add, mul_add, add_smul] + exact NormedSpace.exp_add_of_commute ((Commute.refl _).smul_left _ |>.smul_right _) + +lemma exp_time_neg (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) : + NormedSpace.exp ((Complex.I * ((-t : ℝ) : ℂ)) • hamiltonian d ℓ Λ) = + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) := by + simp + +theorem finiteDynamics_group (d ℓ : ℕ) (Λ : Finset (Site d)) (s t : ℝ) (A : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ (s + t) A = + finiteDynamics d ℓ Λ s (finiteDynamics d ℓ Λ t A) := by + simp only [finiteDynamics, ← exp_time_neg, neg_add_rev, exp_time_add] + simp only [mul_assoc] + +@[simp] lemma translation_localUnit (d ℓ : ℕ) (x y : Site d) (a b : Level ℓ) : + translation d ℓ x (localUnit d ℓ y a b) = localUnit d ℓ (x+y) a b := by + apply Subtype.ext + exact relabel_matrixUnit d ℓ (Equiv.addLeft x) y a b + +lemma norm_translation (d ℓ : ℕ) (x : Site d) (A : QuasiLocal d ℓ) : + ‖translation d ℓ x A‖ = ‖A‖ := + (StarAlgEquiv.isometry (operatorRelabel d ℓ (Equiv.addLeft x))).norm_map_of_map_zero + (map_zero _) _ + +@[simp] lemma translation_spinZ (d ℓ : ℕ) (x y : Site d) : + translation d ℓ x (spinZ d ℓ y) = spinZ d ℓ (x+y) := by + simp only [spinZ, map_sum, map_smul, translation_localUnit] +@[simp] lemma translation_spinPlus (d ℓ : ℕ) (x y : Site d) : + translation d ℓ x (spinPlus d ℓ y) = spinPlus d ℓ (x+y) := by + simp only [spinPlus, map_sum, map_smul, translation_localUnit] +@[simp] lemma translation_spinMinus (d ℓ : ℕ) (x y : Site d) : + translation d ℓ x (spinMinus d ℓ y) = spinMinus d ℓ (x+y) := by + simp only [spinMinus, map_star, translation_spinPlus] +@[simp] lemma translation_spinX (d ℓ : ℕ) (x y : Site d) : + translation d ℓ x (spinX d ℓ y) = spinX d ℓ (x+y) := by simp [spinX] +@[simp] lemma translation_spinY (d ℓ : ℕ) (x y : Site d) : + translation d ℓ x (spinY d ℓ y) = spinY d ℓ (x+y) := by simp [spinY] + +def bond (d ℓ : ℕ) (x y : Site d) : QuasiLocal d ℓ := + spinX d ℓ x * spinX d ℓ y + spinY d ℓ x * spinY d ℓ y + spinZ d ℓ x * spinZ d ℓ y + +def bondBound (d ℓ : ℕ) : ℝ := + ‖spinX d ℓ 0‖^2 + ‖spinY d ℓ 0‖^2 + ‖spinZ d ℓ 0‖^2 + +lemma bondBound_nonneg (d ℓ : ℕ) : 0 ≤ bondBound d ℓ := by unfold bondBound; positivity + +lemma norm_bond_le (d ℓ : ℕ) (x y : Site d) : ‖bond d ℓ x y‖ ≤ bondBound d ℓ := by + have hX (x : Site d) : ‖spinX d ℓ x‖ = ‖spinX d ℓ 0‖ := by + simpa using norm_translation d ℓ x (spinX d ℓ 0) + have hY (x : Site d) : ‖spinY d ℓ x‖ = ‖spinY d ℓ 0‖ := by + simpa using norm_translation d ℓ x (spinY d ℓ 0) + have hZ (x : Site d) : ‖spinZ d ℓ x‖ = ‖spinZ d ℓ 0‖ := by + simpa using norm_translation d ℓ x (spinZ d ℓ 0) + calc + ‖bond d ℓ x y‖ ≤ (‖spinX d ℓ x‖*‖spinX d ℓ y‖ + + ‖spinY d ℓ x‖*‖spinY d ℓ y‖) + ‖spinZ d ℓ x‖*‖spinZ d ℓ y‖ := + (norm_add_le _ _).trans (add_le_add + ((norm_add_le _ _).trans (add_le_add (norm_mul_le _ _) (norm_mul_le _ _))) + (norm_mul_le _ _)) + _ = bondBound d ℓ := by simp only [hX, hY, hZ, bondBound, pow_two] + +lemma bond_mem_local {d ℓ : ℕ} {F : Set (Site d)} {x y : Site d} + (hx : x ∈ F) (hy : y ∈ F) : bond d ℓ x y ∈ localAlgebra d ℓ F := by + apply (localAlgebra d ℓ F).add_mem + · exact (localAlgebra d ℓ F).add_mem + ((localAlgebra d ℓ F).mul_mem (spinX_mem_localAlgebra d ℓ F hx) + (spinX_mem_localAlgebra d ℓ F hy)) + ((localAlgebra d ℓ F).mul_mem (spinY_mem_localAlgebra d ℓ F hx) + (spinY_mem_localAlgebra d ℓ F hy)) + · exact (localAlgebra d ℓ F).mul_mem (spinZ_mem_localAlgebra d ℓ F hx) + (spinZ_mem_localAlgebra d ℓ F hy) + +lemma localAlgebra_mono {d ℓ : ℕ} {F G : Set (Site d)} (h : F ⊆ G) : + localAlgebra d ℓ F ≤ localAlgebra d ℓ G := by + apply StarAlgebra.adjoin_mono + rintro A ⟨x, hx, a, b, rfl⟩ + exact ⟨x, h hx, a, b, rfl⟩ + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/LocalDynamics.lean b/lean/OAI/MathematicalPhysics/Heisenberg/LocalDynamics.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9a1b9603a1e1c08d2cd6ed08cc8fc2ef4f87487 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/LocalDynamics.lean @@ -0,0 +1,306 @@ +import OAI.MathematicalPhysics.Heisenberg.ExponentialEvolution + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators + +namespace Heisenberg + +def finiteGenerator (d ℓ : ℕ) (Λ : Finset (Site d)) : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ := + SpinEvolution.generator (hamiltonian d ℓ Λ) + +def commutatorTerm (d ℓ : ℕ) (e : Site d × Site d) (A : QuasiLocal d ℓ) : QuasiLocal d ℓ := + (-Complex.I) • (bond d ℓ e.1 e.2 * A - A * bond d ℓ e.1 e.2) + +lemma norm_commutatorTerm_le (d ℓ : ℕ) (e : Site d × Site d) (A : QuasiLocal d ℓ) : + ‖commutatorTerm d ℓ e A‖ ≤ 2*bondBound d ℓ*‖A‖ := by + calc + _ = ‖bond d ℓ e.1 e.2 * A - A*bond d ℓ e.1 e.2‖ := by + simp [commutatorTerm, norm_smul] + _ ≤ ‖bond d ℓ e.1 e.2*A‖+‖A*bond d ℓ e.1 e.2‖ := norm_sub_le _ _ + _ ≤ ‖bond d ℓ e.1 e.2‖*‖A‖+‖A‖*‖bond d ℓ e.1 e.2‖ := + add_le_add (norm_mul_le _ _) (norm_mul_le _ _) + _ ≤ bondBound d ℓ*‖A‖+‖A‖*bondBound d ℓ := + add_le_add (mul_le_mul_of_nonneg_right (norm_bond_le _ _ _ _) (norm_nonneg _)) + (mul_le_mul_of_nonneg_left (norm_bond_le _ _ _ _) (norm_nonneg _)) + _ = _ := by ring + +lemma finiteGenerator_eq_sum (d ℓ : ℕ) (Λ : Finset (Site d)) (A : QuasiLocal d ℓ) : + finiteGenerator d ℓ Λ A = ∑ e ∈ volumeEdges Λ, commutatorTerm d ℓ e A := by + simp only [finiteGenerator, SpinEvolution.generator_apply, hamiltonian, + commutatorTerm, bond, neg_mul, mul_neg, Finset.sum_mul, Finset.mul_sum, + smul_sub, smul_neg, Finset.smul_sum, Finset.sum_sub_distrib, neg_smul, Finset.sum_neg_distrib] + +lemma commutatorTerm_mem {d ℓ : ℕ} {F : Finset (Site d)} (e : Site d × Site d) + {A : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) : + commutatorTerm d ℓ e A ∈ localAlgebra d ℓ (↑(F ∪ {e.1,e.2}) : Set (Site d)) := by + let G : Set (Site d) := ↑(F ∪ {e.1,e.2}) + have hAg : A ∈ localAlgebra d ℓ G := + localAlgebra_mono (by intro x hx; exact Finset.mem_union_left _ hx) hA + have hb : bond d ℓ e.1 e.2 ∈ localAlgebra d ℓ G := bond_mem_local (by simp [G]) (by simp [G]) + exact (localAlgebra d ℓ G).smul_mem ((localAlgebra d ℓ G).sub_mem + ((localAlgebra d ℓ G).mul_mem hb hAg) ((localAlgebra d ℓ G).mul_mem hAg hb)) _ + +lemma commutatorTerm_eq_zero {d ℓ : ℕ} {F : Finset (Site d)} {e : Site d × Site d} + {A : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) + (h1 : e.1 ∉ F) (h2 : e.2 ∉ F) : commutatorTerm d ℓ e A = 0 := by + have hd : Disjoint ({e.1,e.2} : Set (Site d)) (F : Set (Site d)) := by + simp only [Set.disjoint_left, Set.mem_insert_iff, Set.mem_singleton_iff, Finset.mem_coe] + rintro x (rfl | rfl) hx <;> contradiction + have hb : bond d ℓ e.1 e.2 ∈ localAlgebra d ℓ ({e.1,e.2} : Set (Site d)) := + bond_mem_local (by simp) (by simp) + have hc := localAlgebras_commute hd hb hA + simp only [commutatorTerm, hc.eq, sub_self, smul_zero] + +def activeEdges {d : ℕ} (Λ F : Finset (Site d)) : Finset (Site d × Site d) := + (volumeEdges Λ).filter fun e => e.1 ∈ F ∨ e.2 ∈ F + +lemma activeEdges_subset_incident {d : ℕ} (Λ F : Finset (Site d)) : + activeEdges Λ F ⊆ incidentEdges F := by + intro e he + obtain ⟨hv, hm⟩ := Finset.mem_filter.mp he + exact mem_incidentEdges (Finset.mem_filter.mp hv).2.1 hm + +lemma finiteGenerator_eq_activeSum {d ℓ : ℕ} (Λ F : Finset (Site d)) + {A : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) : + finiteGenerator d ℓ Λ A = ∑ e ∈ activeEdges Λ F, commutatorTerm d ℓ e A := by + rw [finiteGenerator_eq_sum] + symm + apply Finset.sum_subset (Finset.filter_subset _ _) + intro e he hv + have he' : ¬ (e.1 ∈ F ∨ e.2 ∈ F) := by + intro hm; exact hv (Finset.mem_filter.mpr ⟨he, hm⟩) + exact commutatorTerm_eq_zero hA (not_or.mp he').1 (not_or.mp he').2 + +lemma card_union_edge_le {d : ℕ} (F : Finset (Site d)) {e : Site d × Site d} + (he : e.1 ∈ F ∨ e.2 ∈ F) : (F ∪ {e.1,e.2}).card ≤ F.card+1 := by + rcases he with h1 | h2 + · have hh : F ∪ {e.1,e.2} = insert e.2 F := by + ext x + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + aesop + rw [hh]; exact Finset.card_insert_le _ _ + · have hh : F ∪ {e.1,e.2} = insert e.1 F := by + ext x + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + aesop + rw [hh]; exact Finset.card_insert_le _ _ + +def SupportedOnAtMost (d ℓ k : ℕ) (A : QuasiLocal d ℓ) : Prop := + ∃ F : Finset (Site d), F.card ≤ k+1 ∧ A ∈ localAlgebra d ℓ (F : Set (Site d)) + +lemma finiteGenerator_localDecomposition (d ℓ : ℕ) (Λ : Finset (Site d)) : + SpinEvolution.LocalDecomposition (finiteGenerator d ℓ Λ) (SupportedOnAtMost d ℓ) + (8*d*bondBound d ℓ) := by + constructor + · exact mul_nonneg (by positivity) (bondBound_nonneg _ _) + · intro k A hA + obtain ⟨F, hk, hA⟩ := hA + let I := activeEdges Λ F + let e : I ≃ Fin I.card := (Fintype.equivFin I).trans (finCongr (Fintype.card_coe I)) + let g : Fin I.card → QuasiLocal d ℓ := fun j => commutatorTerm d ℓ (e.symm j) A + have hg : ∑ j, g j = ∑ x ∈ I, commutatorTerm d ℓ x A := by + calc + ∑ j, g j = ∑ x : I, commutatorTerm d ℓ x A := + Fintype.sum_equiv e.symm _ _ (fun _ => rfl) + _ = _ := Finset.sum_coe_sort I (fun x => commutatorTerm d ℓ x A) + refine ⟨I.card, g, ?_, ?_, ?_⟩ + · rw [hg]; exact finiteGenerator_eq_activeSum Λ F hA + · intro j + refine ⟨F ∪ {(e.symm j).val.1,(e.symm j).val.2}, ?_, commutatorTerm_mem _ hA⟩ + exact (card_union_edge_le F (Finset.mem_filter.mp (e.symm j).property).2).trans (by omega) + · have hcard : I.card ≤ (4*d)*(k+1) := + ((Finset.card_le_card (activeEdges_subset_incident Λ F)).trans + (card_incidentEdges_le F)).trans (Nat.mul_le_mul_left _ hk) + calc + ∑ j, ‖g j‖ ≤ ∑ _ : Fin I.card, 2*bondBound d ℓ*‖A‖ := + Finset.sum_le_sum (fun j _ => norm_commutatorTerm_le _ _ _ _) + _ = (I.card : ℝ)*(2*bondBound d ℓ*‖A‖) := by simp + _ ≤ ((4*d)*(k+1) : ℝ)*(2*bondBound d ℓ*‖A‖) := by + apply mul_le_mul_of_nonneg_right + · exact_mod_cast hcard + · exact mul_nonneg (mul_nonneg (by norm_num) (bondBound_nonneg _ _)) (norm_nonneg _) + _ = (8*d*bondBound d ℓ)*(k+1)*‖A‖ := by ring + + + +lemma activeEdges_stable {d : ℕ} (Λ F : Finset (Site d)) + (hΛ : neighborhood F ⊆ Λ) : activeEdges Λ F = activeEdges (neighborhood F) F := by + ext e + simp only [activeEdges, volumeEdges, Finset.mem_filter, Finset.mem_product] + constructor + · rintro ⟨⟨hmem,hnn,hord⟩,hm⟩ + exact ⟨⟨nearestNeighbor_mem_neighborhood hnn hm,hnn,hord⟩,hm⟩ + · rintro ⟨⟨hmem,hnn,hord⟩,hm⟩ + exact ⟨⟨⟨hΛ hmem.1,hΛ hmem.2⟩,hnn,hord⟩,hm⟩ + +lemma finiteGenerator_stable {d ℓ : ℕ} (Λ F : Finset (Site d)) + (hΛ : neighborhood F ⊆ Λ) {A : QuasiLocal d ℓ} + (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) : + finiteGenerator d ℓ Λ A = finiteGenerator d ℓ (neighborhood F) A := by + rw [finiteGenerator_eq_activeSum Λ F hA, + finiteGenerator_eq_activeSum (neighborhood F) F hA, activeEdges_stable Λ F hΛ] + +lemma finiteGenerator_local {d ℓ : ℕ} (Λ F : Finset (Site d)) + {A : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) : + finiteGenerator d ℓ Λ A ∈ localAlgebra d ℓ (↑(F ∪ Λ) : Set (Site d)) := by + rw [finiteGenerator_eq_activeSum Λ F hA] + apply Subalgebra.sum_mem + intro e he + have hv : e.1 ∈ Λ ∧ e.2 ∈ Λ := + Finset.mem_product.mp (Finset.mem_filter.mp (Finset.mem_filter.mp he).1).1 + apply localAlgebra_mono (F := (↑(F ∪ {e.1,e.2}) : Set (Site d))) ?_ (commutatorTerm_mem e hA) + intro x hx + simp only [Finset.mem_coe, Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] at hx ⊢ + rcases hx with hF | rfl | rfl + · exact Or.inl hF + · exact Or.inr hv.1 + · exact Or.inr hv.2 + +theorem eventually_mem_box {d : ℕ} (x : Site d) : + ∀ᶠ n : ℕ in Filter.atTop, x ∈ box d n := by + have hl (i : Fin d) : ∀ᶠ n : ℕ in Filter.atTop, (x i).natAbs ≤ n := + Filter.eventually_ge_atTop _ + have hh := (Filter.eventually_all).mpr hl + filter_upwards [hh] with n hn + simp only [box, Fintype.mem_piFinset, Finset.mem_Icc] + intro i + have h := hn i + have hcast : ((x i).natAbs : ℤ) ≤ n := by exact_mod_cast h + exact abs_le.mp (by simpa only [Int.natCast_natAbs] using hcast) + +lemma eventually_subset_box {d : ℕ} (F : Finset (Site d)) : + ∀ᶠ n : ℕ in Filter.atTop, F ⊆ box d n := by + have h : ∀ x : F, ∀ᶠ n : ℕ in Filter.atTop, (x : Site d) ∈ box d n := + fun x => eventually_mem_box (x : Site d) + filter_upwards [Filter.eventually_all.mpr h] with n hn + intro x hx + exact hn ⟨x,hx⟩ + +theorem local_coefficients_stabilize {d ℓ : ℕ} (F : Finset (Site d)) + {A : QuasiLocal d ℓ} (hA : A ∈ localAlgebra d ℓ (F : Set (Site d))) (n : ℕ) : + ∃ B : QuasiLocal d ℓ, ∀ᶠ m : ℕ in Filter.atTop, + ((finiteGenerator d ℓ (box d m))^n) A = B := by + let : Monoid (QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) := inferInstance + have hh : ∀ n : ℕ, ∃ (G : Finset (Site d)) (B : QuasiLocal d ℓ), + B ∈ localAlgebra d ℓ (G : Set (Site d)) ∧ + ∀ᶠ m : ℕ in Filter.atTop, ((finiteGenerator d ℓ (box d m))^n) A = B := by + intro n + induction n with + | zero => exact ⟨F,A,hA,by simp⟩ + | succ n ih => + obtain ⟨G,B,hB,hlim⟩ := ih + refine ⟨G ∪ neighborhood G,finiteGenerator d ℓ (neighborhood G) B, + finiteGenerator_local _ G hB,?_⟩ + filter_upwards [hlim,eventually_subset_box (neighborhood G)] with m hm hmG + rw [pow_succ', mul_apply_eq_comp, hm] + exact finiteGenerator_stable _ G hmG hB + obtain ⟨G,B,hB,hlim⟩ := hh n + exact ⟨B,hlim⟩ + +def localCore (d ℓ : ℕ) : StarSubalgebra ℂ (QuasiLocal d ℓ) := + StarAlgebra.adjoin ℂ {A | ∃ x a b, A = localUnit d ℓ x a b} + +theorem localCore_dense (d ℓ : ℕ) : Dense (localCore d ℓ : Set (QuasiLocal d ℓ)) := by + let B := StarAlgebra.adjoin ℂ {A : SpinOperator d ℓ | ∃ x a b, A = matrixUnit d ℓ x a b} + let f : B →⋆ₐ[ℂ] QuasiLocal d ℓ := StarSubalgebra.inclusion B.le_topologicalClosure + have hd : DenseRange f := by + change DenseRange (Set.inclusion B.le_topologicalClosure) + apply (denseRange_inclusion_iff B.le_topologicalClosure).mpr + rw [StarSubalgebra.topologicalClosure_coe] + have hle : B ≤ (localCore d ℓ).map (quasiLocalAlgebra d ℓ).subtype := by + apply StarAlgebra.adjoin_le + rintro A ⟨x,a,b,rfl⟩ + exact ⟨localUnit d ℓ x a b, StarAlgebra.subset_adjoin ℂ _ ⟨x,a,b,rfl⟩, rfl⟩ + apply Dense.mono (s₁ := Set.range f) ?_ hd + rintro A ⟨a,rfl⟩ + obtain ⟨b,hb,he⟩ := hle a.property + have heq : f a = b := Subtype.ext he.symm + rwa [heq] + +lemma localCore_finite_support {d ℓ : ℕ} {A : QuasiLocal d ℓ} + (hA : A ∈ localCore d ℓ) : ∃ F : Finset (Site d), A ∈ localAlgebra d ℓ (F : Set (Site d)) := by + induction hA using StarAlgebra.adjoin_induction with + | mem a ha => + obtain ⟨x,a,b,rfl⟩ := ha + exact ⟨{x},localUnit_mem_localAlgebra _ _ _ (by simp) _ _⟩ + | algebraMap z => exact ⟨∅, by simpa only [Finset.coe_empty] using + (localAlgebra d ℓ ∅).algebraMap_mem z⟩ + | add a b ha hb iha ihb => + obtain ⟨F,hF⟩ := iha + obtain ⟨G,hG⟩ := ihb + refine ⟨F ∪ G,(localAlgebra d ℓ (↑(F ∪ G) : Set (Site d))).add_mem ?_ ?_⟩ + · exact localAlgebra_mono (by intro x hx; exact Finset.mem_union_left _ hx) hF + · exact localAlgebra_mono (by intro x hx; exact Finset.mem_union_right _ hx) hG + | mul a b ha hb iha ihb => + obtain ⟨F,hF⟩ := iha + obtain ⟨G,hG⟩ := ihb + refine ⟨F ∪ G,(localAlgebra d ℓ (↑(F ∪ G) : Set (Site d))).mul_mem ?_ ?_⟩ + · exact localAlgebra_mono (by intro x hx; exact Finset.mem_union_left _ hx) hF + · exact localAlgebra_mono (by intro x hx; exact Finset.mem_union_right _ hx) hG + | star a ha iha => + obtain ⟨F,hF⟩ := iha + exact ⟨F,star_mem hF⟩ + +end Heisenberg + +namespace SpinEvolution +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] +variable [CompleteSpace E] + +omit [CompleteSpace E] in +lemma smul_operator_pow_apply (D : E →L[ℂ] E) (z : ℂ) (n : ℕ) (A : E) : + ((z • D)^n) A = z^n • (D^n) A := by + induction n with + | zero => simp + | succ n ih => + simp only [pow_succ', mul_apply_eq_comp, smul_apply, ih, map_smul, smul_smul] + rw [mul_comm] + +lemma exponential_operator_series (D : E →L[ℂ] E) (z : ℂ) (A : E) : + NormedSpace.exp (z • D) A = + ∑' n : ℕ, ((n.factorial : ℂ)⁻¹ * z^n) • (D^n) A := by + rw [NormedSpace.exp_eq_tsum ℂ] + change (ContinuousLinearMap.apply ℂ E A) (∑' n : ℕ, + (n.factorial : ℂ)⁻¹ • (z • D)^n) = _ + rw [(ContinuousLinearMap.apply ℂ E A).map_tsum + (NormedSpace.expSeries_summable' (𝕂 := ℂ) (z • D))] + apply tsum_congr + intro n + simp only [ContinuousLinearMap.apply_apply, smul_apply, smul_operator_pow_apply, smul_smul] + +theorem local_exponential_converges (D : ℕ → E →L[ℂ] E) (Local : ℕ → E → Prop) + (C : ℝ) (hD : ∀ m, LocalDecomposition (D m) Local C) + (k : ℕ) (A : E) (hA : Local k A) (z : ℂ) (hz : ‖z‖*C < 1) + (hstable : ∀ n : ℕ, ∃ B : E, ∀ᶠ m : ℕ in Filter.atTop, ((D m)^n) A = B) : + ∃ B : E, Filter.Tendsto (fun m => NormedSpace.exp (z • D m) A) + Filter.atTop (nhds B) := by + choose B hB using hstable + have hc : 0 ≤ C := (hD 0).nonneg + let q : ℝ := ‖z‖*C + have hq : 0 ≤ q := mul_nonneg (norm_nonneg _) hc + let b : ℕ → ℝ := fun n => q^n * ((k+1).ascFactorial n : ℝ) / n.factorial * ‖A‖ + have hb : Summable b := (summable_ascFactorial hq hz k).mul_right ‖A‖ + have hterm (m n : ℕ) : ‖((n.factorial : ℂ)⁻¹ * z^n) • ((D m)^n) A‖ ≤ b n := by + calc + _ = ((n.factorial : ℝ)⁻¹ * ‖z‖^n) * ‖((D m)^n) A‖ := by + simp only [norm_smul, norm_mul, norm_inv, norm_pow, Complex.norm_natCast] + _ ≤ ((n.factorial : ℝ)⁻¹ * ‖z‖^n) * + (C^n * ((k+1).ascFactorial n : ℝ) * ‖A‖) := + mul_le_mul_of_nonneg_left ((hD m).power_bound n k A hA) (by positivity) + _ = b n := by dsimp [b, q]; rw [mul_pow]; ring + refine ⟨∑' n : ℕ, ((n.factorial : ℂ)⁻¹*z^n) • B n, ?_⟩ + simp_rw [exponential_operator_series] + apply tendsto_tsum_of_dominated_convergence hb + · intro n + apply Filter.Tendsto.congr' ?_ tendsto_const_nhds + filter_upwards [hB n] with m hm + exact congrArg (fun X => ((n.factorial : ℂ)⁻¹*z^n) • X) hm.symm + · exact Filter.Eventually.of_forall hterm + +end SpinEvolution +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/Main.lean b/lean/OAI/MathematicalPhysics/Heisenberg/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..0922ea6326813be49122e971abd3090e9f9814d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/Main.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinAveragedKMS + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg + +lemma complex_nat_inv_mul_re (n : ℕ) (z : ℂ) : + ((n : ℂ)⁻¹ * z).re = z.re / (n : ℝ) := by + have hc : (n : ℂ)⁻¹ = Complex.ofReal ((n : ℝ)⁻¹) := by + simp only [Complex.ofReal_inv, Complex.ofReal_natCast] + rw [hc, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + ring + +lemma cubeAverage_order {d ℓ : ℕ} (Λ : Finset (Site d)) (hΛ : Λ.Nonempty) + (ω : State d ℓ) (hmag : (Λ.card : ℝ) * ℓ / 8 ≤ (ω.functional (totalZ Λ)).re) : + (ℓ : ℝ) / 8 ≤ ((cubeAverage Λ hΛ ω).functional (spinZ d ℓ 0)).re := by + have hr := congrArg Complex.re (cubeAverage_spinZ Λ hΛ ω) + rw [complex_nat_inv_mul_re] at hr + rw [hr] + have hp : 0 < (Λ.card : ℝ) := by exact_mod_cast hΛ.card_pos + exact (le_div_iff₀ hp).mpr (by nlinarith) + +theorem ordered_state_exists (d ℓ : ℕ) (hd : 2≤d) [NeZero ℓ] : + ∃ β₀ : ℝ,0<β₀ ∧ ∀ β : ℝ,β₀≤β → + ∃ ω : State (d+1) ℓ,TranslationInvariant ω ∧ IsKMS β ω ∧ + (ω.functional (spinZ (d+1) ℓ 0)).im=0 ∧ + (ℓ:ℝ)/8≤(ω.functional (spinZ (d+1) ℓ 0)).re := by + obtain ⟨τ,hτ⟩:=exists_tracial_state (d+1) ℓ + obtain ⟨β₀,hβ₀,horder⟩:=Selection.field_ordered_cubes d ℓ hd τ hτ + refine ⟨β₀,hβ₀,?_⟩ + intro β hβ + let h : ℕ → ℝ:=fun n=>(n+1:ℝ)⁻¹ + have hhpos (n : ℕ) : 0m n+1 + have hN : Tendsto N atTop atTop := tendsto_atTop_mono (fun n=>by exact (hm n).trans (Nat.le_succ _)) tendsto_id + let η : ℕ → State (d+1) ℓ:=fun n=>gibbsState τ (shiftedField (box (d+1) (N n)) (h n)) β + let ρ : ℕ → State (d+1) ℓ:=fun n=>cubeAverage (box (d+1) (N n)) (box_nonempty (d+1) (N n)) (η n) + have hρ (n : ℕ) : (ℓ:ℝ)/8≤((ρ n).functional (spinZ (d+1) ℓ 0)).re := + cubeAverage_order _ _ (η n) (hmag n) + obtain ⟨ω,κ,hκ,hω⟩:=state_subsequence ρ + refine ⟨ω,?_,?_,?_,?_⟩ + · exact cubeAverage_limit_TI (N∘κ) (hN.comp hκ.tendsto_atTop) (η∘κ) ω hω + · exact cubeAverage_limit_KMS τ hτ (lt_of_lt_of_le hβ₀ hβ) (N∘κ) (hN.comp hκ.tendsto_atTop) + (h∘κ) (hh.comp hκ.tendsto_atTop) ω hω + · exact state_selfAdjoint_im ω (star_spinZ (d+1) ℓ 0) + · exact ge_of_tendsto (Complex.continuous_re.tendsto _ |>.comp (hω (spinZ (d+1) ℓ 0))) + (Filter.Eventually.of_forall (fun n=>hρ (κ n))) + +theorem spontaneous_magnetization (d ℓ : ℕ) (hd : 3≤d) (hℓ : 1≤ℓ) : + DynamicsConverges d ℓ ∧ + ∃ β₀ : ℝ,0<β₀ ∧ ∀ β : ℝ,β₀≤β → + ∃ ω : State d ℓ,TranslationInvariant ω ∧ IsKMS β ω ∧ + (ω.functional (spinZ d ℓ 0)).im=0 ∧ + (ℓ:ℝ)/8≤(ω.functional (spinZ d ℓ 0)).re := by + have : NeZero ℓ:=⟨by omega⟩ + refine ⟨dynamics_converges d ℓ,?_⟩ + obtain ⟨k,rfl⟩:=Nat.exists_eq_succ_of_ne_zero (by omega : d≠0) + exact ordered_state_exists k ℓ (by omega) + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitLift.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..32916e851204609ca0a15fe0d0e00c2ab56fee45 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitLift.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.Heisenberg.TensorUnitSystem + +namespace OAI + +noncomputable section +open scoped Classical BigOperators Matrix +namespace Heisenberg.TensorUnits +variable {R E K : Type*} [CommSemiring R] [Semiring E] [Algebra R E] + [Fintype K] [DecidableEq K] + +def liftLinear (u : K → K → E) : Matrix K K R →ₗ[R] E where + toFun M:=∑ a,∑ b,M a b • u a b + map_add' M N:=by simp only [Matrix.add_apply,add_smul,Finset.sum_add_distrib] + map_smul' c M:=by simp only [Matrix.smul_apply,smul_eq_mul,mul_smul,Finset.smul_sum,RingHom.id_apply] + +lemma unit_mul_lift (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (a b : K) (N : Matrix K K R) : + u a b*liftLinear u N=∑ d,N b d • u a d := by + simp only [liftLinear,LinearMap.coe_mk,AddHom.coe_mk,Finset.mul_sum,mul_smul_comm,hu] + simp only [smul_ite,smul_zero] + rw [Finset.sum_comm] + simp only [Finset.sum_ite_eq,Finset.mem_univ,ite_true] + +lemma lift_mul (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (M N : Matrix K K R) : liftLinear u (M*N)=liftLinear u M*liftLinear u N := by + change (∑ a,∑ b,(M*N) a b • u a b)=(∑ a,∑ b,M a b • u a b)*liftLinear u N + simp only [Matrix.mul_apply,Finset.sum_smul,Finset.sum_mul,smul_mul_assoc, + unit_mul_lift u hu,Finset.smul_sum,smul_smul] + apply Finset.sum_congr rfl + intro a _ + rw [Finset.sum_comm] + +lemma lift_one (u : K → K → E) (hu : ∑ a,u a a=1) : liftLinear u (1:Matrix K K R)=1 := by + unfold liftLinear + simp only [LinearMap.coe_mk,AddHom.coe_mk,Matrix.one_apply,ite_smul,one_smul,zero_smul,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + exact hu + +def liftAlg (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (hs : ∑ a,u a a=1) : Matrix K K R →ₐ[R] E := + AlgHom.ofLinearMap (liftLinear u) (lift_one u hs) (lift_mul u hu) + +lemma liftAlg_apply (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (hs : ∑ a,u a a=1) (M : Matrix K K R) : + liftAlg u hu hs M=∑ a,∑ b,M a b • u a b := rfl + +end Heisenberg.TensorUnits +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitTrace.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dee8995f214f99ff7e377a6c91228cd6f0ea07e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixUnitTrace.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.Heisenberg.TensorLiftIndex + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.TensorUnits +variable {R E K : Type*} [Field R] [CharZero R] [Ring E] [Algebra R E] [Fintype K] [DecidableEq K] [Nonempty K] + +lemma trace_unit (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (hs : ∑ a,u a a=1) (τ : E →ₗ[R] R) (hτ : ∀ A B,τ (A*B)=τ (B*A)) + (h1 : τ 1=1) (a b : K) : + τ (u a b)=if a=b then (Fintype.card K:R)⁻¹ else 0 := by + have hd (a b : K) : τ (u a a)=τ (u b b) := by + have hh:=hτ (u a b) (u b a) + simpa only [hu,ite_true] using hh + by_cases hab : a=b + · subst b + rw [ite_eq_left rfl] + have hh:=congrArg τ hs + rw [map_sum,h1] at hh + simp_rw [hd _ a] at hh + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hh + apply (mul_left_cancel₀ (show (Fintype.card K:R)≠0 by exact_mod_cast Fintype.card_ne_zero)) + rw [hh,mul_inv_cancel₀ (show (Fintype.card K:R)≠0 by exact_mod_cast Fintype.card_ne_zero)] + · rw [ite_eq_right hab] + have hh:=hτ (u a b) (u b b) + simpa only [hu,ite_true,ite_eq_right (Ne.symm hab),map_zero] using hh + +lemma trace_lift (u : K → K → E) + (hu : ∀ a b c d,u a b*u c d=if b=c then u a d else 0) + (hs : ∑ a,u a a=1) (τ : E →ₗ[R] R) (hτ : ∀ A B,τ (A*B)=τ (B*A)) + (h1 : τ 1=1) (M : Matrix K K R) : + τ (liftAlg u hu hs M)=(Fintype.card K:R)⁻¹*Matrix.trace M := by + rw [liftAlg_apply] + simp only [map_sum,map_smul,trace_unit u hu hs τ hτ h1,smul_eq_mul,mul_ite,mul_zero] + simp only [Finset.sum_ite_eq,Finset.mem_univ,ite_true,Matrix.trace,←Finset.sum_mul] + exact mul_comm _ _ + +end Heisenberg.TensorUnits +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MatrixWeights.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..25b9ebfe321037b75bac1257713efdf0155b26b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MatrixWeights.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.Heisenberg.FiniteTilt + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.Selection +variable {I : Type*} [Fintype I] [DecidableEq I] + +lemma exp_diagonal_pos (A : Matrix I I ℝ) (hA : A.transpose=A) (i : I) : + 0M i i) hinv + norm_num only [Matrix.mul_apply,hh,zero_mul,Finset.sum_const_zero,Matrix.one_apply_eq] at he + rw [hsq,Matrix.mul_apply] + apply Finset.sum_pos' + · intro j _; change 0≤B i j*B i j; exact mul_self_nonneg _ + · obtain ⟨j,hj⟩:=hn + exact ⟨j,Finset.mem_univ _,mul_self_pos.mpr hj⟩ + +lemma exp_trace_pos [Nonempty I] (A : Matrix I I ℝ) (hA : A.transpose=A) : + 0exp_diagonal_pos A hA i) Finset.univ_nonempty + +lemma exp_tilt (A : Matrix I I ℝ) (m : I → ℝ) (b : ℝ) + (hcomm : Commute A (Matrix.diagonal m)) : + NormedSpace.exp (A+b • Matrix.diagonal m)= + NormedSpace.exp A*Matrix.diagonal (fun i=>Real.exp (b*m i)) := by + rw [Matrix.exp_add_of_commute _ _ (hcomm.smul_right b)] + congr 1 + rw [←Matrix.diagonal_smul,Matrix.exp_diagonal] + congr 1 + funext i + rw [Pi.coe_exp] + rw [Real.exp_eq_exp_ℝ] + rfl + +lemma trace_exp_tilt (A : Matrix I I ℝ) (m : I → ℝ) (b : ℝ) + (hcomm : Commute A (Matrix.diagonal m)) : + Matrix.trace (NormedSpace.exp (A+b • Matrix.diagonal m))= + tiltPartition (fun i=>NormedSpace.exp A i i) m b := by + rw [exp_tilt A m b hcomm] + simp only [Matrix.trace,Matrix.diag_apply,Matrix.mul_diagonal,tiltPartition] + +lemma trace_exp_tilt_mag (A : Matrix I I ℝ) (m : I → ℝ) (b : ℝ) + (hcomm : Commute A (Matrix.diagonal m)) : + Matrix.trace (NormedSpace.exp (A+b • Matrix.diagonal m)*Matrix.diagonal m)= + ∑ i,NormedSpace.exp A i i*Real.exp (b*m i)*m i := by + rw [exp_tilt A m b hcomm] + simp only [Matrix.trace,Matrix.diag_apply,Matrix.mul_diagonal] + +lemma trace_spectral_tail (E : Matrix I I ℝ) (m : I → ℝ) (a : ℝ) : + Matrix.trace (E*Matrix.diagonal (fun i=>if a≤ m i then (1:ℝ) else 0))= + weightedTail (fun i=>E i i) m a := by + simp only [Matrix.trace,Matrix.diag_apply,Matrix.mul_diagonal,weightedTail,mul_ite,mul_one,mul_zero] + +end Heisenberg.Selection +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeanLeakage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeanLeakage.lean new file mode 100644 index 0000000000000000000000000000000000000000..6346a40b0f5d80ebdb65eb80232598a5c551ec31 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeanLeakage.lean @@ -0,0 +1,331 @@ +import OAI.MathematicalPhysics.Heisenberg.WeightedLeakage + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical +open scoped Classical BigOperators +open scoped Classical BigOperators +open scoped BigOperators Classical + +namespace Heisenberg.FiniteLeakage + +section +open scoped RealInnerProductSpace +variable {H Ω : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [Fintype Ω] + +lemma triangle_prefix_le_one {n : ℕ} (hn : 0 + mul_le_mul_of_nonneg_left (contraction_chain_leakage (C ω) n hn (hC ω) eta (g ω) + (horth ω) (energy ω) (pair ω) (err ω) (residual ω) A δ hA hδ + (henergy ω) (hpair ω) (happrox ω) (henergy_loss ω)) (hμ ω)) + let W : Fin n → ℝ := fun i => ∑ j,if j ≤ i then triangle j else 0 + have swap (f : Ω → Fin n → ℝ) (w : Fin n → ℝ) : + (∑ ω,μ ω*(∑ i,w i*f ω i))=∑ i,w i*(∑ ω,μ ω*f ω i) := by + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro ω _ + ring + have he : (∑ ω,μ ω*(∑ i,triangle i*err ω i)) ≤ E := by + rw [swap] + calc + _ ≤ ∑ i,triangle i*E := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (herr i) (triangle_nonneg i)) + _ = E := by rw [←Finset.sum_mul,triangle_sum hn,one_mul] + have hr : (∑ ω,μ ω*(∑ i,W i*residual ω i)) ≤ (n:ℝ)*B := by + rw [swap] + calc + _ ≤ ∑ i,W i*B := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hres i) (triangle_prefix_pos i).le) + _ ≤ ∑ _i : Fin n,B := Finset.sum_le_sum (fun i _ => mul_le_of_le_one_left hB (triangle_prefix_le_one hn i)) + _ = _ := by simp + have heq : (∑ ω, μ ω * + (‖eta‖^2-2*(∑ i,triangle i*err ω i)-2*A/(δ*(n:ℝ))-(∑ i,W i*residual ω i))) = + ‖eta‖^2-2*(∑ ω,μ ω*(∑ i,triangle i*err ω i))-2*A/(δ*(n:ℝ))- + (∑ ω,μ ω*(∑ i,W i*residual ω i)) := by + simp only [mul_sub,Finset.sum_sub_distrib,←Finset.sum_mul,hs,one_mul] + simp only [mul_left_comm (μ _) (2:ℝ),←Finset.mul_sum] + change (∑ ω, μ ω * + (‖eta‖^2-2*(∑ i,triangle i*err ω i)-2*A/(δ*(n:ℝ))-(∑ i,W i*residual ω i))) ≤ _ at hh + rw [heq] at hh + linarith + +theorem ordered_leakage (P : ℕ → H →ₗ[ℝ] H) (n : ℕ) (hn : 0 ‖P j (eta+g)‖^2 + have hp : ∀ i : Fin n,‖eta‖^2-2*err i-2*pair i ≤ ‖eta+g‖^2-u i := by + intro i + have h := contraction_loss_lower (P i) eta g horth + (hP i i.isLt g) + dsimp only [u] + linarith [happrox i] + have ht : ∀ i : Fin n,(‖eta+g‖^2-u i)+ + (∑ j : Fin n,if i ≤ j then u j-u (j+1) else 0) ≤ + ‖eta+g‖^2-u n := by + intro i + rw [suffix_telescope_fin] + linarith + have h := finite_future_loss hn (fun i => ‖eta+g‖^2-u i) energy + (fun i => u i-u (i+1)) residual (fun i => 2*err i) pair + (‖eta‖^2) (‖eta+g‖^2-u n) A δ hA hδ henergy hpair henergy_loss hp ht + have he : (∑ i : Fin n,triangle i*(2*err i)) = 2*(∑ i,triangle i*err i) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + rw [he] at h + exact h + +theorem expected_ordered_leakage (μ : Ω → ℝ) (hμ : ∀ ω,0≤μ ω) (hs : ∑ ω,μ ω=1) + (P : Ω → ℕ → H →ₗ[ℝ] H) (n : ℕ) (hn : 0 + mul_le_mul_of_nonneg_left (ordered_leakage (P ω) n hn (hP ω) eta (g ω) + (horth ω) (energy ω) (pair ω) (err ω) (residual ω) A δ hA hδ + (henergy ω) (hpair ω) (happrox ω) (henergy_loss ω)) (hμ ω)) + let W : Fin n → ℝ := fun i => ∑ j,if j ≤ i then triangle j else 0 + have swap (f : Ω → Fin n → ℝ) (w : Fin n → ℝ) : + (∑ ω,μ ω*(∑ i,w i*f ω i))=∑ i,w i*(∑ ω,μ ω*f ω i) := by + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro ω _ + ring + have he : (∑ ω,μ ω*(∑ i,triangle i*err ω i)) ≤ E := by + rw [swap] + calc + _ ≤ ∑ i,triangle i*E := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (herr i) (triangle_nonneg i)) + _ = E := by rw [←Finset.sum_mul,triangle_sum hn,one_mul] + have hr : (∑ ω,μ ω*(∑ i,W i*residual ω i)) ≤ (n:ℝ)*B := by + rw [swap] + calc + _ ≤ ∑ i,W i*B := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hres i) (triangle_prefix_pos i).le) + _ ≤ ∑ _i : Fin n,B := Finset.sum_le_sum (fun i _ => mul_le_of_le_one_left hB (triangle_prefix_le_one hn i)) + _ = _ := by simp + have heq : (∑ ω, μ ω * + (‖eta‖^2-2*(∑ i,triangle i*err ω i)-2*A/(δ*(n:ℝ))-(∑ i,W i*residual ω i))) = + ‖eta‖^2-2*(∑ ω,μ ω*(∑ i,triangle i*err ω i))-2*A/(δ*(n:ℝ))- + (∑ ω,μ ω*(∑ i,W i*residual ω i)) := by + simp only [mul_sub,Finset.sum_sub_distrib,←Finset.sum_mul,hs,one_mul] + simp only [mul_left_comm (μ _) (2:ℝ),←Finset.mul_sum] + change (∑ ω, μ ω * + (‖eta‖^2-2*(∑ i,triangle i*err ω i)-2*A/(δ*(n:ℝ))-(∑ i,W i*residual ω i))) ≤ _ at hh + rw [heq] at hh + linarith + +end + +open scoped RealInnerProductSpace +variable {Ω H : Type*} [Fintype Ω] [NormedAddCommGroup H] [InnerProductSpace ℝ H] + +omit [NormedAddCommGroup H] [InnerProductSpace ℝ H] in +lemma mean_square_le (μ : Ω → ℝ) (hμ : ∀ ω,0≤μ ω) (hs : ∑ ω,μ ω=1) (f : Ω → ℝ) : + (∑ ω,μ ω*f ω)^2 ≤ ∑ ω,μ ω*(f ω)^2 := by + let m : ℝ := ∑ ω,μ ω*f ω + have hz : 0≤∑ ω,μ ω*(f ω-m)^2 := Finset.sum_nonneg (fun ω _ => mul_nonneg (hμ ω) (sq_nonneg _)) + have he : (∑ ω,μ ω*(f ω-m)^2)=(∑ ω,μ ω*(f ω)^2)-m^2 := by + have hterm (ω : Ω) : μ ω*(f ω-m)^2=μ ω*(f ω)^2-2*m*(μ ω*f ω)+m^2*μ ω := by ring + simp_rw [hterm,Finset.sum_add_distrib,Finset.sum_sub_distrib,←Finset.mul_sum] + rw [hs] + change (∑ ω,μ ω*(f ω)^2)-2*m*m+m^2*1= _ + ring + rw [he] at hz + exact sub_nonneg.mp hz + +theorem expected_ordered_leakage_moments + (μ : Ω → ℝ) (hμ : ∀ ω,0≤μ ω) (hs : ∑ ω,μ ω=1) + (P : Ω → ℕ → H →ₗ[ℝ] H) (n : ℕ) (hn : 0∑ ω,μ ω*‖P ω j (eta+g ω)‖^2 + let u₀ : ℝ := ∑ ω,μ ω*‖eta+g ω‖^2 + let q : Fin n → ℝ := fun i=>∑ ω,μ ω*pair ω i + let e : Fin n → ℝ := fun i=>∑ ω,μ ω*energy ω i + have hq (i : Fin n) : (q i)^2≤A*e i := by + apply (mean_square_le μ hμ hs (fun ω=>pair ω i)).trans + calc + _ ≤ ∑ ω,μ ω*(A*energy ω i) := Finset.sum_le_sum (fun ω _ => mul_le_mul_of_nonneg_left (hpair ω i) (hμ ω)) + _ = A*e i := by simp only [e,mul_left_comm (μ _) A,Finset.mul_sum] + have he (i : Fin n) : 0≤e i := Finset.sum_nonneg (fun ω _ => mul_nonneg (hμ ω) (henergy ω i)) + have hp (i : Fin n) : ‖eta‖^2-2*E-2*q i≤u₀-u i := by + have hpt (ω : Ω) : ‖eta‖^2-2*err ω i-2*pair ω i ≤ + ‖eta+g ω‖^2-‖P ω i (eta+g ω)‖^2 := by + have h := contraction_loss_lower (P ω i) eta (g ω) (horth ω) (hP ω i i.isLt (g ω)) + linarith [happrox ω i] + have ht := Finset.sum_le_sum (s:=Finset.univ) (fun ω _ => mul_le_mul_of_nonneg_left (hpt ω) (hμ ω)) + simp only [mul_sub,Finset.sum_sub_distrib,←Finset.sum_mul,hs,one_mul] at ht + simp only [mul_left_comm (μ _) (2:ℝ),←Finset.mul_sum] at ht + change ‖eta‖^2-2*(∑ ω,μ ω*err ω i)-2*q i≤u₀-u i at ht + linarith [herr i] + have hel (i : Fin n) : 2*δ*e i≤u i-u (i+1)+B := by + simpa only [u,e,mul_sub,Finset.sum_sub_distrib] using hloss i + have ht (i : Fin n) : (u₀-u i)+(∑ j : Fin n,if i≤j then u j-u (j+1) else 0)≤u₀-u n := by + rw [suffix_telescope_fin] + linarith + have h := finite_future_loss hn (fun i=>u₀-u i) e (fun i=>u i-u (i+1)) + (fun _=>B) (fun _=>2*E) q (‖eta‖^2) (u₀-u n) A δ hA hδ he hq hel hp ht + have her : (∑ i : Fin n,triangle i*(2*E))=2*E := by rw [←Finset.sum_mul,triangle_sum hn,one_mul] + have hr : (∑ i : Fin n, (∑ j : Fin n, if j ≤ i then triangle j else 0) * B) ≤ (n : ℝ) * B := by + calc + _ ≤ ∑ _i : Fin n,B := Finset.sum_le_sum (fun i _ => mul_le_of_le_one_left hB (triangle_prefix_le_one hn i)) + _ = _ := by simp + rw [her] at h + have hf : u₀-u n=(∑ ω,μ ω*(‖eta+g ω‖^2-‖P ω n (eta+g ω)‖^2)) := by + simp only [u₀,u,mul_sub,Finset.sum_sub_distrib] + rw [←hf] + linarith + +end Heisenberg.FiniteLeakage + +open scoped BigOperators Classical RealInnerProductSpace +namespace Heisenberg.Flow +open Heisenberg.Geometry Heisenberg.LatticeRegular Heisenberg.RoutedFlow Heisenberg.SpatialFrame Heisenberg.Exposure +variable {k : ℕ} + +theorem routed_mean_leakage (hk : 2 ≤ k) (L : ℝ) (hL : 0 ≤ L) : + ∃ M : ℕ, ∃ C ≥ 0, ∀ (Ω I B : Type*) [Fintype Ω] [Fintype I] + [Fintype B] [Nonempty B] + (Λ F : Finset (ZSite k)) (H : Ω → ℕ → Set (Slots (B:=B) Λ)) + (x : I → ZSite k) (R : ℕ) + (μ : Ω → ℝ) (eta : EuclideanSpace ℝ (Slots (B:=B) Λ)) + (g : Ω → EuclideanSpace ℝ (Slots (B:=B) Λ)) + (P : Ω → ℕ → EuclideanSpace ℝ (Slots (B:=B) Λ) →ₗ[ℝ] + EuclideanSpace ℝ (Slots (B:=B) Λ)) + (K : Ω → ℕ → Slots (B:=B) Λ → I → ℝ) + (a b : ℕ → Slots (B:=B) Λ) (q n : ℕ) (e : Fin q ≃ Edges Step Λ) + (δ ρ ζ rem : ℝ), + 0 < n → 0 < δ → 0 ≤ rem → + (∀ i : Fin q, a i = (e i).val.1) → (∀ i : Fin q, b i = (e i).val.2) → + F ⊆ Λ → (∀ z ∈ F, ∀ w, Step z w → w ∈ Λ) → + (∀ ω, 0 ≤ μ ω) → (∑ ω, μ ω = 1) → + (∀ ω, ⟪eta,g ω⟫ = 0) → + (∀ ω j, j < n → ∀ v, ‖P ω j v‖ ≤ ‖v‖) → + (∀ ω (i : Fin n) j, j.1.val ∉ F → (P ω i (eta+g ω)).ofLp j = 0) → + (∀ ω (i : Fin n) j, 0 ≤ (P ω i (eta+g ω)).ofLp j ∧ + (P ω i (eta+g ω)).ofLp j ≤ 1) → + (∀ ω (i : Fin n) j l, 0 ≤ K ω i j l) → + (∀ ω (i : Fin n) l, ∑ j, K ω i j l ≤ 1) → + (∀ z r, 0 ≤ r → ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card : ℝ) + ≤ L*(1+r)^((1:ℝ)/100)) → + (∀ ω (i : Fin n) j l, K ω i j l ≠ 0 → j ∈ H ω i) → + (∀ ω (i : Fin n), ⟪P ω i eta, P ω i (eta+g ω)⟫ = + ∑ l, ∑ j, K ω i j l*(P ω i (eta+g ω)).ofLp j) → + (∀ (i : Fin n) l, (∑ ω, μ ω*(if ¬Regular (blocked Λ (H ω i)) (x l) R M + (1/(100*(k+1:ℝ))) then (1:ℝ) else 0)) ≤ ρ) → + (∀ (i : Fin n) l, (∑ ω, μ ω*(∑ j, if (R:ℝ) quietEnergy (H ω i) a b q (P ω i (eta+g ω)) + let pair : Ω → Fin n → ℝ := fun ω i => ∑ l, ∑ j, + goodMass (K ω i) x (fun j => j.1.val) (blocked Λ (H ω i)) R M l j * + (P ω i (eta+g ω)).ofLp j + let err : Ω → Fin n → ℝ := fun ω i => + (∑ l, if ¬Regular (blocked Λ (H ω i)) (x l) R M (1/(100*(k+1:ℝ))) + then (1:ℝ) else 0) + + (∑ l, ∑ j, if (R:ℝ) (hv ω i j).1) + have happ (ω : Ω) (i : Fin n) : ⟪P ω i eta,P ω i (eta+g ω)⟫ ≤ err ω i+pair ω i := by + rw [hrep] + exact kernel_pairing_split (K ω i) (hK ω i) (hm ω i) x (fun j => j.1.val) + (blocked Λ (H ω i)) R M (P ω i (eta+g ω)).ofLp (hv ω i) + have herr (i : Fin n) : (∑ ω, μ ω*err ω i) ≤ (ρ+ζ)*Fintype.card I := by + simp only [err,mul_add (μ _) _ _,Finset.sum_add_distrib,Finset.mul_sum] + conv_lhs => lhs; rw [Finset.sum_comm] + conv_lhs => rhs; rw [Finset.sum_comm] + have h₁ := Finset.sum_le_sum (s:=Finset.univ) (fun l _ => hbad i l) + have h₂ := Finset.sum_le_sum (s:=Finset.univ) (fun l _ => hesc i l) + simp only [Finset.mul_sum] at h₂ + calc + _ ≤ (∑ _l : I, ρ)+(∑ _l : I, ζ) := add_le_add h₁ h₂ + _ = _ := by simp; ring + exact Heisenberg.FiniteLeakage.expected_ordered_leakage_moments μ hμ hs P n hn hP eta g horth + energy pair err (C*(1+(R:ℝ))^((1:ℝ)/100)*Fintype.card I) δ + ((ρ+ζ)*Fintype.card I) rem (by positivity) hδ hrem he hp happ hloss herr + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeshCompletion.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeshCompletion.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8d6e984f405ad3ccfced8106e7a96b851dfa6d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeshCompletion.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshCutProduct + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance completionDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open LayeredExchange MeshPair +variable {V : Type} [Fintype V] + +def completedEndpoint (a u : ℕ → V) (q c : ℕ) (j : ℕ) : V := + if j%(q+c)colorCoin + (completedEndpoint a u q c j) (completedEndpoint b v q c j) (completedRate δ q c k j))= + prefixMatrix (fun j=>SlotColor.matrix (Equiv.swap (u j) (v j))) c* + (prefixMatrix (fun j=>colorCoin (a j) (b j) (δ/2)) q)^(k+1) := by + let Q:=q+c + let A:=fun j=>colorCoin (a j) (b j) (δ/2) + let P:=fun j=>SlotColor.matrix (Equiv.swap (u j) (v j)) + rw [←Serial.prefix_product (fun j=>colorCoin + (completedEndpoint a u q c j) (completedEndpoint b v q c j) (completedRate δ q c k j))] + rw [←Serial.completed_sweeps A P q c k] + apply Serial.prefix_congr + intro j hj + change j<(k+1)*Q at hj + rw [Nat.add_mul,Nat.one_mul] at hj + change colorCoin _ _ _=(if jrw [hdecomp] + rw [Nat.add_mod,Nat.mul_mod_left,Nat.zero_add,Nat.mod_mod,Nat.mod_eq_of_lt hlt] + by_cases hsp : j-k*Q constructor <;> linarith + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeshCutProduct.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeshCutProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..b682f60db9224bae0b314ec78417552f44769305 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeshCutProduct.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.Heisenberg.SerialBlocks + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Fin.NatCast +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance meshCPDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open LayeredExchange +variable {V : Type} [Fintype V] + +lemma cut_test_eq (n : ℕ) : + (fun c : Fin (n+1)×V → Bool=>if (Finset.univ.image (fun v : V=>((0:Fin (n+1)),v))).card/4≤ + cutSpin (Finset.univ.image (fun v : V=>((0:Fin (n+1)),v))) c then (1:ℝ) else 0)= + (fun c : Fin (n+1)×V → Bool=>if (Fintype.card V:ℝ)/4≤SlotColor.magnetization (fun v=>c (0,v)) then (1:ℝ) else 0) := by + funext c + rw [cut_card,cut_spin] + +attribute [local irreducible] colorTail coinWiring layerWeight +lemma mesh_cut_product (n : ℕ) (a b : Fin (n+1) → V) (rates : Fin (n+1) → ℝ) : + colorTail (layerWeight rates) (coinWiring (finRotate (n+1)) a b) + (Finset.univ.image (fun v : V=>((0:Fin (n+1)),v)))= + Matrix.trace (Serial.product (n+1) (fun j=>colorCoin (a j) (b j) (rates j))* + Matrix.diagonal (fun c : V → Bool=>if (Fintype.card V:ℝ)/4≤SlotColor.magnetization c then (1:ℝ) else 0)) := by + unfold colorTail + rw [cut_test_eq] + exact mesh_trace_product n a b rates (fun c : V → Bool=>if (Fintype.card V:ℝ)/4≤SlotColor.magnetization c then (1:ℝ) else 0) + +lemma mesh_partition_product (n : ℕ) (a b : Fin (n+1) → V) (rates : Fin (n+1) → ℝ) : + Heisenberg.Pin.pinPartition (layerWeight rates) (coinWiring (finRotate (n+1)) a b) ∅= + Matrix.trace (Serial.product (n+1) (fun j=>colorCoin (a j) (b j) (rates j))) := by + rw [pinPartition_empty_trace] + have hh:=mesh_trace_product n a b rates (fun _=>1) + simpa only [Matrix.diagonal_one,Matrix.mul_one] using hh + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeshMatrixSurface.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeshMatrixSurface.lean new file mode 100644 index 0000000000000000000000000000000000000000..14f4634057eab56678803abec4229f3e90375e2c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeshMatrixSurface.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.Heisenberg.ColorClockLimit + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Filter Topology +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance matrixSurfaceDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open Heisenberg.Cycle Pin Return LayeredExchange Exposure LatticeRegular SpatialFrame Heisenberg.Geometry + +def tailProjection (V : Type) [Fintype V] : Matrix (V → Bool) (V → Bool) ℝ := + Matrix.diagonal (fun c=>if (Fintype.card V:ℝ)/4≤SlotColor.magnetization c then (1:ℝ) else 0) + +theorem mesh_matrix_surface (d : ℕ) (hd : 2≤d) (B : Type) [Fintype B] [Nonempty B] : + ∃ s : ℝ,0j.val%QcolorCoin (a j) (b j) (rates j)) + Real.exp (-(Real.log 2)*(((Finset.univ.filter (fun v : Slots (B:=B) Λ=>v.1.val∉F)).card:ℝ)+2*δ*K.card))/2 * + Matrix.trace T ≤ Matrix.trace (T*tailProjection (Slots (B:=B) Λ)) := by + obtain ⟨p,s,_hp,_hpq,hs,_hsp,hbound⟩:=mesh_surface_tail d hd B + refine ⟨s,hs,?_⟩ + intro Λ F hΛ q _ edge a₀ b₀ ha₀ hb₀ + filter_upwards [hbound Λ F hΛ q edge a₀ b₀ ha₀ hb₀] with δ hδ + intro hδpos L Q hL hQ hqQ hdiv a b hab hsite rates hp hrate hF hf hroom K T + cases L with + | zero=>omega + | succ N=> + have hh:=hδ hδpos N Q hQ hqQ hdiv a b hab hsite rates hp hrate hF hf hroom + have hsum : (∑ ω,layerWeight rates ω)=1 := by + with_reducible convert layerWeight_sum rates using 1 + congr! 20 + have hpos:=pinPartition_pos (layerWeight rates) (coinWiring (finRotate (N+1)) a b) + (layerWeight_nonneg rates hp) (by rw [hsum]; norm_num) ∅ + dsimp only at hh + rw [mesh_cut_product,mesh_partition_product] at hh + rw [mesh_partition_product] at hpos + exact (le_div_iff₀ hpos).mp hh + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeshPin.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeshPin.lean new file mode 100644 index 0000000000000000000000000000000000000000..a46e950b9cbcc098f9bb728fcd87b0f16b0df911 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeshPin.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.Heisenberg.BootstrapParameters + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Filter Topology +attribute [-instance] instDecidableEqFin +@[reducible] local instance meshDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Bootstrap +open Heisenberg.Geometry Heisenberg.Schedule Heisenberg.SpatialFrame Heisenberg.MeshPair Heisenberg.Exposure Heisenberg.LatticeRegular Heisenberg.Cycle Heisenberg.Pin + +attribute [local irreducible] Pin.pinDensity LayeredExchange.layerWeight LayeredExchange.coinWiring Heisenberg.Exposure.layerMass Heisenberg.Exposure.layerHistory Heisenberg.Cycle.MissingSet Heisenberg.Return.HasHit Heisenberg.Exposure.exposedSweep + +lemma image_testPins {X : Type*} (E : Set X) (U : Finset X) : + (testPins E U).image Subtype.val=U := by + ext x + simp only [Finset.mem_image,mem_testPins] + constructor + · rintro ⟨i,hi,rfl⟩; exact hi + · intro hx; exact ⟨⟨x,Or.inr hx⟩,hx,rfl⟩ + +theorem mesh_pin_bound (d : ℕ) (hd : 2≤d) (B : Type) [Fintype B] [Nonempty B] + (L : ℝ) (hL : (2*(d+1):ℕ)≤L) : + ∃ p s : ℝ,0

v.1.val) ((1:ℝ)/100) L U → + Disjoint E (U:Set (Fin (N+1)×Slots (B:=B) Λ)) → + (∑ c,if ∀ j∈U,¬Return.HasHit (LayeredExchange.coinWiring (finRotate (N+1)) a b c) E j then + pinDensity (LayeredExchange.layerWeight rates) (LayeredExchange.coinWiring (finRotate (N+1)) a b) E c else 0) ≤ p^U.card := by + have hL0 : 0≤L := le_trans (Nat.cast_nonneg _) hL + obtain ⟨M,C,hC,hret⟩:=periodic_return_estimate d hd L hL0 + obtain ⟨p₀,hp₀,G,hG,hreg⟩:=regularity_of_pin_induction d M L hL + obtain ⟨p,s,R,hp,hps,hpp,hs,hsp,hR1,_hRM,hclock,herr⟩:= + choose_parameters (d+1) (by omega) M (4*(d+1)*(Fintype.card B)^2:ℕ) C G p₀ + (by positivity) hC hG hp₀ + refine ⟨p,s,hp,hps,hs,hsp,?_⟩ + intro Λ F q _ edge a₀ b₀ ha₀ hb₀ + let ρ : ℝ:=G*((1+(R:ℝ))^(d+1)*p^(2*(d+1))+1/(1+(R:ℝ))) + filter_upwards [hret p s R ρ hp hs hR1 herr B Λ F q edge a₀ b₀ ha₀ hb₀ hclock] with δ hδret + intro hδ N Q hQ hqQ hdiv a b hab hsite rates hrates hrate hF hframe hroom + let E₀ : Set (Fin (N+1)×Slots (B:=B) Λ):={z | z.2.1.val∉F} + let μ:=LayeredExchange.layerWeight rates + let π:=LayeredExchange.coinWiring (finRotate (N+1)) a b + have hμ : ∀ c,0≤μ c:=LayeredExchange.layerWeight_nonneg rates hrates + have hpos : 0<∑ c,μ c := by + have hsum : (∑ c,μ c)=1 := by + with_reducible convert LayeredExchange.layerWeight_sum rates using 1 + congr! 20 + rw [hsum] + norm_num + have hstable : Stable (lawSymbol μ π) := by + with_reducible convert LayeredExchange.coinWiring_stable (finRotate (N+1)) a b rates hrates using 1 + congr! 20 + have hh:=finite_pin_induction μ π hμ hpos hstable E₀ + (cutAdmissible (fun v : Slots (B:=B) Λ=>v.1.val) ((1:ℝ)/100) L) p hp.le ?_ + · intro E hE U hU hdis + have hEE : E₀⊆E := by intro z hz; exact hE z hz + with_reducible convert hh E hEE U hU hdis using 1 + congr! 20 + · intro E hE U hUne hU hdis hIH + obtain ⟨t,J,rfl,hg⟩:=hU + have hinj : Function.Injective (fun j : Slots (B:=B) Λ=>(t,j)):=fun _ _ h=>(Prod.mk.inj h).2 + have hJpos : J.Nonempty := by simpa only [Finset.image_nonempty] using hUne + let U:=J.image (fun j=>(t,j)) + let P:=E∪(U:Set (Fin (N+1)×Slots (B:=B) Λ)) + have hdis' : Disjoint E (U:Set (Fin (N+1)×Slots (B:=B) Λ)) := by + with_reducible convert hdis using 1 + congr! 20 + have hJP : ∀ j∈J,(t,j)∈P := by + intro j hj + exact Or.inr (Finset.mem_image.mpr ⟨j,hj,rfl⟩) + have hJF : ∀ j∈J,j.1.val∈F := by + intro j hj + by_contra hn + have he : (t,j)∈E := hE hn + exact Set.disjoint_left.mp hdis' he (Finset.mem_image.mpr ⟨j,hj,rfl⟩) + have hP : ∀ z,z.2.1.val∉F → z∈P := fun z hz=>Or.inl (hE hz) + have hTJ : (testPins E U).image Subtype.val=Heisenberg.Serial.targetsAt N t J := by + with_reducible convert image_testPins E U using 1 + · congr! 20 + · unfold Heisenberg.Serial.targetsAt U + congr! 20 + have hb : ∀ u x,(∑ c,layerMass (finRotate (N+1)) a b P rates c * + (if ¬Regular (blocked Λ (holeCut (finRotate (N+1)) (fun i=>Equiv.swap (a i) (b i)) c P u)) + x R M (1/(100*(d+1:ℝ))) then (1:ℝ) else 0))≤ρ := by + intro u x + have hr:=hreg B Λ (N+1) (finRotate (N+1)) a b P rates hrates p hp.le hpp ?_ u x R + · with_reducible convert hr using 1 + · intro V hV hv + have hv' : Disjoint (E∪((J.image (fun j=>(t,j))):Set (Fin (N+1)×Slots (B:=B) Λ))) (V:Set (Fin (N+1)×Slots (B:=B) Λ)) := by + with_reducible convert hv using 1 + with_reducible convert hIH V hV (by with_reducible convert hv' using 1; congr! 20) using 1 + congr! 20 + have hcount:=hδret hδ N Q hQ hqQ hdiv a b hab hsite rates hrates hrate P hP t (testPins E U) J + (by with_reducible convert hTJ using 1) hJpos hJF hJP hF hframe + (by with_reducible convert growth_subtype _ _ _ J hg using 1) hroom (by with_reducible convert hb using 1) + rw [returnFraction_layer] + have hfinal : 2*((∑ c,layerMass (finRotate (N+1)) a b P rates c * + returnCount (layerHistory (finRotate (N+1)) (fun i=>Equiv.swap (a i) (b i)) c) P (testPins E U))/U.card)≤p := by + have hcard : U.card=J.card := Finset.card_image_of_injective _ hinj + rw [hcard] + have hcardpos : (0:ℝ)SlotColor.matrix (σ (j : Fin (n+1)))) k := by + induction k with + | zero=>exact SlotColor.matrix_one + | succ k ih=>rw [transport_succ_zero,SlotColor.matrix_mul,MeshPair.prefixMatrix,ih] + +lemma transport_matrix_product (n : ℕ) (σ : Fin (n+1) → Equiv.Perm V) : + SlotColor.matrix (transport (finRotate (n+1)) σ 0 (n+1))= + Serial.product (n+1) (fun j=>SlotColor.matrix (σ j)) := by + rw [transport_matrix_prefix] + have hh:=Serial.prefix_product (fun j : ℕ=>SlotColor.matrix (σ (j : Fin (n+1)))) (n+1) + with_reducible convert hh using 1; congr! 10 + simp + +def colorCoin (a b : V) (r : ℝ) : Matrix (V → Bool) (V → Bool) ℝ := + (1-r) • 1+r • SlotColor.matrix (Equiv.swap a b) + +lemma mean_transport (n : ℕ) (a b : Fin (n+1) → V) (rates : Fin (n+1) → ℝ) : + (∑ c : Fin (n+1) → Bool,layerWeight rates c • + SlotColor.matrix (transport (finRotate (n+1)) (fun t=>if c t then Equiv.swap (a t) (b t) else 1) 0 (n+1)))= + Serial.product (n+1) (fun j=>colorCoin (a j) (b j) (rates j)) := by + simp_rw [transport_matrix_product] + unfold layerWeight + have hh:=Serial.mean_product (V:=V → Bool) (n+1) + (fun (j : Fin (n+1)) (z : Bool)=>if z then rates j else 1-rates j) + (fun j z=>SlotColor.matrix (if z then Equiv.swap (a j) (b j) else 1)) + change _=_ at hh + with_reducible convert hh using 1 <;> congr! 5 + all_goals simp only [Fintype.sum_bool,ite_true,Bool.false_eq_true,ite_false,SlotColor.matrix_one,colorCoin] + all_goals first | rfl | exact add_comm _ _ + +lemma trace_mean_test {Ω : Type*} [Fintype Ω] (μ : Ω → ℝ) + (M : Ω → Matrix V V ℝ) (D : Matrix V V ℝ) : + (∑ ω,μ ω*Matrix.trace (M ω*D))=Matrix.trace ((∑ ω,μ ω • M ω)*D) := by + simp only [Finset.sum_mul,Matrix.smul_mul,Matrix.trace_sum,Matrix.trace_smul,smul_eq_mul] + +theorem mesh_trace_product (n : ℕ) (a b : Fin (n+1) → V) (rates : Fin (n+1) → ℝ) + (f : (V → Bool) → ℝ) : + (∑ c : Fin (n+1) → Bool,layerWeight rates c * Matrix.trace + (SlotColor.matrix (coinWiring (finRotate (n+1)) a b c)*Matrix.diagonal (fun x=>f (fun v=>x (0,v)))))= + Matrix.trace (Serial.product (n+1) (fun j=>colorCoin (a j) (b j) (rates j))*Matrix.diagonal f) := by + unfold coinWiring + simp_rw [trace_wiring_cut] + rw [trace_mean_test,mean_transport] + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/MeshRoom.lean b/lean/OAI/MathematicalPhysics/Heisenberg/MeshRoom.lean new file mode 100644 index 0000000000000000000000000000000000000000..731f916f1f11b4aa2c5bcb83bd5da3079b527d4a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/MeshRoom.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.Heisenberg.PeriodicCount + +namespace OAI + +section +noncomputable section +open scoped Classical +open Filter Topology +namespace Heisenberg.Surface +lemma mesh_room {s t δ : ℝ} (hs : 0 ≤ s) (hδ : 0<δ) (htδ : 2*(s+δ) ≤ t) + (k Q : ℕ) (hk : δ*(k+1:ℝ)=t) : + 2*(⌊s/δ⌋₊+1)*Q≤(k+1)*Q := by + apply Nat.mul_le_mul_right + have hf:=Nat.floor_le (div_nonneg hs hδ.le) + have hh:=mul_le_mul_of_nonneg_right hf hδ.le + rw [div_mul_cancel₀ _ hδ.ne'] at hh + have ht : (2:ℝ)*((⌊s/δ⌋₊:ℝ)+1)≤(k+1:ℝ) := by nlinarith + exact_mod_cast ht + +lemma mesh_step_tendsto (t : ℝ) : Tendsto (fun k : ℕ=>t/(k+1:ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds) + +lemma eventually_mesh_room {s t : ℝ} (hs : 0 ≤ s) (ht : 2*s < t) (Q : ℕ) : + ∀ᶠ k : ℕ in atTop,2*(⌊s/(t/(k+1:ℝ))⌋₊+1)*Q≤(k+1)*Q := by + have ht0 : 0dist (loc v) x≤r).card:ℝ)≤1 := by + exact_mod_cast (Finset.card_filter_le ({y}:Finset Y) _) + exact hc.trans (by nlinarith) + +lemma rotation_reaches_zero (n : ℕ) (t : Fin (n+1)) : ∃ k : ℕ,((finRotate (n+1))^k) t=0 := by + have h : (finRotate (n+1)).SameCycle 0 t := by + refine ⟨(t.val:ℤ),?_⟩ + rw [zpow_natCast,rotate_pow_zero] + simp + exact h.symm.exists_nat_pow_eq + +lemma pinPartition_empty_trace {V Ω : Type*} [Fintype V] [Fintype Ω] + (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) : + pinPartition μ π ∅=∑ ω,μ ω*Matrix.trace (SlotColor.matrix (π ω)) := by + unfold pinPartition + apply Finset.sum_congr rfl + intro ω _ + congr 1 + have hh:=pinned_trace (π ω) ∅ (fun _=>1) + have hcard:=card_pinnedColor (π ω) ∅ + simpa only [Set.mem_empty_iff_false,IsEmpty.forall_iff,implies_true,ite_true, + Matrix.diagonal_one,Matrix.mul_one,Finset.sum_const,Finset.card_univ, + nsmul_eq_mul,mul_one,hcard,Nat.cast_pow,Nat.cast_ofNat] using hh.symm + +lemma cut_card {V : Type*} [Fintype V] (n : ℕ) : + (Finset.univ.image (fun v : V=>((0:Fin (n+1)),v))).card=Fintype.card V := by + rw [Finset.card_image_of_injective _ (fun _ _ h=>(Prod.mk.inj h).2),Finset.card_univ] + +lemma cut_spin {V : Type*} [Fintype V] (n : ℕ) (c : Fin (n+1)×V → Bool) : + cutSpin (Finset.univ.image (fun v : V=>((0:Fin (n+1)),v))) c=SlotColor.magnetization (fun v=>c (0,v)) := by + rw [cutSpin,Finset.sum_image (fun _ _ _ _ h=>(Prod.mk.inj h).2)] + rfl + +attribute [local irreducible] colorTail coinWiring Heisenberg.LayeredExchange.layerWeight pinDensity + +theorem mesh_surface_tail (d : ℕ) (hd : 2≤d) (B : Type) [Fintype B] [Nonempty B] : + ∃ p s : ℝ,0

j.val%Q((0:Fin (N+1)),v)) + Real.exp (-(Real.log 2)*(((Finset.univ.filter (fun v : Slots (B:=B) Λ=>v.1.val∉F)).card:ℝ)+2*δ*K.card))/2 ≤ + colorTail (layerWeight rates) (coinWiring (finRotate (N+1)) a b) C/ + pinPartition (layerWeight rates) (coinWiring (finRotate (N+1)) a b) ∅ := by + obtain ⟨p,s,hp,hpq,hs,hsp,hbound⟩:=Heisenberg.Bootstrap.mesh_pin_bound d hd B (2*(d+1):ℕ) (by rfl) + refine ⟨p,s,hp,hpq,hs,hsp,?_⟩ + intro Λ F hΛ q _ edge a₀ b₀ ha₀ hb₀ + filter_upwards [hbound Λ F q edge a₀ b₀ ha₀ hb₀] with δ hδ + intro hδpos N Q hQ hqQ hdiv a b hab hsite rates hrates hrate hF hframe hroom K C + let D : Set (Slots (B:=B) Λ):={v | v.1.val∉F} + let P : Set (Fin (N+1)×Slots (B:=B) Λ):={z | z.2∈D} + let μ:=layerWeight rates + let π:=coinWiring (finRotate (N+1)) a b + have hμ:=layerWeight_nonneg rates hrates + have hpos : 0<∑ c,μ c := by + have hh:=layerWeight_sum rates + with_reducible convert (show (0:ℝ)<1 by norm_num) using 1 + with_reducible convert hh using 1 + congr! 20 + have hC : C.Nonempty := by + obtain ⟨x,hx⟩:=hΛ + exact Finset.image_nonempty.mpr ⟨(⟨x,hx⟩,Classical.choice (inferInstance : Nonempty B)),Finset.mem_univ _⟩ + apply color_surface_tail μ π hμ hpos P C hC p hpq.le + · intro i _ + by_cases hi : i∈P + · simp only [hasHit_of_mem (π _) hi,not_true_eq_false,ite_false,Finset.sum_const_zero] + exact hp.le + · have hh:=hδ hδpos N Q hQ hqQ hdiv a b hab hsite rates hrates hrate hF hframe hroom P + (fun z hz=>hz) {i} ?_ ?_ + · simpa only [Finset.mem_singleton,forall_eq,Finset.card_singleton,pow_one] using hh + · refine ⟨i.1,{i.2},by simp,?_⟩ + exact growth_singleton _ _ _ (by norm_num) (by exact_mod_cast (show 1≤2*(d+1) by omega)) _ + · simpa only [Finset.coe_singleton] using Set.disjoint_singleton_right.mpr hi + · have hK : ∀ t,t∉K → (a t∈D ↔ b t∈D) := by + intro t ht + by_cases hspatial : t.val%Q congr! 20 + all_goals exact Exposure.coinWiring_eq_history _ _ _ + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/Model.lean b/lean/OAI/MathematicalPhysics/Heisenberg/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..a38c8bfc1790b7285b0052df59d08636c03bd77d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/Model.lean @@ -0,0 +1,261 @@ +import Mathlib + +namespace OAI + +universe u v + + +noncomputable section +open scoped ComplexConjugate ENNReal Classical + +namespace Heisenberg + +abbrev L2 (ι : Type u) := lp (fun _ : ι => ℂ) 2 + +def l2Reindex {ι : Type u} {κ : Type v} (e : ι ≃ κ) : L2 ι ≃ₗᵢ[ℂ] L2 κ where + toFun f := ⟨fun j => f (e.symm j), by + apply memℓp_gen + exact e.symm.summable_iff.mpr ((lp.memℓp f).summable (by norm_num))⟩ + invFun f := ⟨fun i => f (e i), by + apply memℓp_gen + exact e.summable_iff.mpr ((lp.memℓp f).summable (by norm_num))⟩ + left_inv f := by ext i; simp + right_inv f := by ext j; simp + map_add' f g := by ext j; rfl + map_smul' c f := by ext j; rfl + norm_map' f := by + rw [lp.norm_eq_tsum_rpow (by norm_num), lp.norm_eq_tsum_rpow (by norm_num)] + congr 1 + exact e.symm.tsum_eq (fun i => ‖f i‖ ^ (2 : ℝ≥0∞).toReal) + +@[simp] theorem l2Reindex_apply {ι : Type u} {κ : Type v} (e : ι ≃ κ) (f : L2 ι) (j : κ) : + l2Reindex e f j = f (e.symm j) := rfl + +def l2Projection {ι : Type u} (p : ι → Prop) : L2 ι →L[ℂ] L2 ι := by + classical + let f : L2 ι →ₗ[ℂ] L2 ι := + { toFun := fun v => ⟨fun i => if p i then v i else 0, + (lp.memℓp v).mono' (fun i => by split_ifs <;> simp)⟩ + map_add' := fun v w => by + ext i + change (if p i then v i + w i else 0) = + (if p i then v i else 0) + (if p i then w i else 0) + by_cases h : p i <;> simp [h] + map_smul' := fun c v => by ext i; by_cases h : p i <;> simp [h] } + exact f.mkContinuous 1 (fun v => by + simpa only [one_mul] using lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + (x := f v) (y := v) (fun i => by + change ‖if p i then v i else 0‖ ≤ ‖v i‖ + split_ifs <;> simp)) + +@[simp] theorem l2Projection_apply {ι : Type u} (p : ι → Prop) (v : L2 ι) (i : ι) : + l2Projection p v i = if p i then v i else 0 := by classical rfl + +abbrev Site (d : ℕ) := Fin d → ℤ +abbrev Level (ℓ : ℕ) := Fin (ℓ + 1) +abbrev Configuration (d ℓ : ℕ) := Site d →₀ Level ℓ +abbrev SpinHilbert (d ℓ : ℕ) := L2 (Configuration d ℓ) +abbrev SpinOperator (d ℓ : ℕ) := SpinHilbert d ℓ →L[ℂ] SpinHilbert d ℓ + +def configPerm (d ℓ : ℕ) (x : Site d) (σ : Equiv.Perm (Level ℓ)) : + Equiv.Perm (Configuration d ℓ) where + toFun c := c.update x (σ (c x)) + invFun c := c.update x (σ.symm (c x)) + left_inv c := by + classical + ext y + by_cases h : y = x <;> simp [Finsupp.update_apply, h] + right_inv c := by + classical + ext y + by_cases h : y = x <;> simp [Finsupp.update_apply, h] + +def matrixUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : SpinOperator d ℓ := + (l2Projection (fun c : Configuration d ℓ => c x = a)).comp + (l2Reindex (configPerm d ℓ x (Equiv.swap a b))).toContinuousLinearEquiv.toContinuousLinearMap + +@[simp] theorem matrixUnit_apply (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) + (v : SpinHilbert d ℓ) (c : Configuration d ℓ) : + matrixUnit d ℓ x a b v c = if c x = a then v (c.update x b) else 0 := by + simp only [matrixUnit, ContinuousLinearMap.comp_apply, l2Projection_apply] + split_ifs with h + · change v (c.update x ((Equiv.swap a b).symm (c x))) = v (c.update x b) + simp [h] + · rfl + +@[simp] theorem l2Reindex_symm_apply {ι : Type u} {κ : Type v} (e : ι ≃ κ) (v : L2 κ) (i : ι) : + (l2Reindex e).symm v i = v (e i) := rfl + +def operatorRelabel (d ℓ : ℕ) (e : Equiv.Perm (Site d)) : + SpinOperator d ℓ ≃⋆ₐ[ℂ] SpinOperator d ℓ := + (l2Reindex (Finsupp.equivCongrLeft e)).conjStarAlgEquiv + +@[simp] theorem relabel_matrixUnit (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + (x : Site d) (a b : Level ℓ) : + operatorRelabel d ℓ e (matrixUnit d ℓ x a b) = matrixUnit d ℓ (e x) a b := by + ext v c + simp only [operatorRelabel, LinearIsometryEquiv.conjStarAlgEquiv_apply_apply, + l2Reindex_apply, matrixUnit_apply] + change (if c (e x) = a then + (l2Reindex (Finsupp.equivCongrLeft e)).symm v + (((Finsupp.equivCongrLeft e).symm c).update x b) else 0) = _ + rw [l2Reindex_symm_apply] + by_cases h : c (e x) = a + · simp only [h, ite_eq_left] + apply congrArg v + ext y + simp only [Finsupp.equivCongrLeft_apply, Finsupp.equivMapDomain_apply, + Finsupp.update_apply] + by_cases hy : y = e x + · subst y; simp + · have hy' : e.symm y ≠ x := fun hxy => hy (by simpa using congrArg e hxy) + simp [hy, hy'] + · simp only [h, ite_false] + +def quasiLocalAlgebra (d ℓ : ℕ) : StarSubalgebra ℂ (SpinOperator d ℓ) := + (StarAlgebra.adjoin ℂ {A | ∃ x a b, A = matrixUnit d ℓ x a b}).topologicalClosure + +abbrev QuasiLocal (d ℓ : ℕ) := quasiLocalAlgebra d ℓ + +def localUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : QuasiLocal d ℓ := + ⟨matrixUnit d ℓ x a b, (StarSubalgebra.le_topologicalClosure _) + (StarAlgebra.subset_adjoin ℂ _ ⟨x, a, b, rfl⟩)⟩ + +theorem relabel_mem (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + {A : SpinOperator d ℓ} (hA : A ∈ quasiLocalAlgebra d ℓ) : + operatorRelabel d ℓ e A ∈ quasiLocalAlgebra d ℓ := by + let f := (operatorRelabel d ℓ e).toStarAlgHom + have h : StarAlgebra.adjoin ℂ {A | ∃ x a b, A = matrixUnit d ℓ x a b} ≤ + (quasiLocalAlgebra d ℓ).comap f := by + apply StarAlgebra.adjoin_le + rintro _ ⟨x, a, b, rfl⟩ + change operatorRelabel d ℓ e (matrixUnit d ℓ x a b) ∈ quasiLocalAlgebra d ℓ + rw [relabel_matrixUnit] + exact (localUnit d ℓ (e x) a b).property + have hc : IsClosed ((quasiLocalAlgebra d ℓ).comap f : Set (SpinOperator d ℓ)) := + (StarSubalgebra.isClosed_topologicalClosure _).preimage + (StarAlgEquiv.isometry (operatorRelabel d ℓ e)).continuous + exact StarSubalgebra.topologicalClosure_minimal h hc hA + +def translation (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ →⋆ₐ[ℂ] QuasiLocal d ℓ := by + have l2Reindex_apply {ι : Type} {κ : Type} (e : ι ≃ κ) (f : L2 ι) (j : κ) : + l2Reindex e f j = f (e.symm j) := rfl + have l2Projection_apply {ι : Type} (p : ι → Prop) (v : L2 ι) (i : ι) : + l2Projection p v i = if p i then v i else 0 := by classical rfl + have matrixUnit_apply (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) + (v : SpinHilbert d ℓ) (c : Configuration d ℓ) : + matrixUnit d ℓ x a b v c = if c x = a then v (c.update x b) else 0 := by + simp only [matrixUnit, ContinuousLinearMap.comp_apply, l2Projection_apply] + split_ifs with h + · change v (c.update x ((Equiv.swap a b).symm (c x))) = v (c.update x b) + simp [h] + · rfl + have l2Reindex_symm_apply {ι : Type} {κ : Type} (e : ι ≃ κ) (v : L2 κ) (i : ι) : + (l2Reindex e).symm v i = v (e i) := rfl + have relabel_matrixUnit (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + (x : Site d) (a b : Level ℓ) : + operatorRelabel d ℓ e (matrixUnit d ℓ x a b) = matrixUnit d ℓ (e x) a b := by + ext v c + simp only [operatorRelabel, LinearIsometryEquiv.conjStarAlgEquiv_apply_apply, + l2Reindex_apply, matrixUnit_apply] + change (if c (e x) = a then + (l2Reindex (Finsupp.equivCongrLeft e)).symm v + (((Finsupp.equivCongrLeft e).symm c).update x b) else 0) = _ + rw [l2Reindex_symm_apply] + by_cases h : c (e x) = a + · simp only [h, ite_eq_left] + apply congrArg v + ext y + simp only [Finsupp.equivCongrLeft_apply, Finsupp.equivMapDomain_apply, + Finsupp.update_apply] + by_cases hy : y = e x + · subst y; simp + · have hy' : e.symm y ≠ x := fun hxy => hy (by simpa using congrArg e hxy) + simp [hy, hy'] + · simp only [h, ite_false] + have relabel_mem (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + {A : SpinOperator d ℓ} (hA : A ∈ quasiLocalAlgebra d ℓ) : + operatorRelabel d ℓ e A ∈ quasiLocalAlgebra d ℓ := by + let f := (operatorRelabel d ℓ e).toStarAlgHom + have h : StarAlgebra.adjoin ℂ {A | ∃ x a b, A = matrixUnit d ℓ x a b} ≤ + (quasiLocalAlgebra d ℓ).comap f := by + apply StarAlgebra.adjoin_le + rintro _ ⟨x, a, b, rfl⟩ + change operatorRelabel d ℓ e (matrixUnit d ℓ x a b) ∈ quasiLocalAlgebra d ℓ + rw [relabel_matrixUnit] + exact (localUnit d ℓ (e x) a b).property + have hc : IsClosed ((quasiLocalAlgebra d ℓ).comap f : Set (SpinOperator d ℓ)) := + (StarSubalgebra.isClosed_topologicalClosure _).preimage + (StarAlgEquiv.isometry (operatorRelabel d ℓ e)).continuous + exact StarSubalgebra.topologicalClosure_minimal h hc hA + exact let f := (operatorRelabel d ℓ (Equiv.addLeft x)).toStarAlgHom + (f.comp (quasiLocalAlgebra d ℓ).subtype).codRestrict (quasiLocalAlgebra d ℓ) + (fun A => relabel_mem d ℓ (Equiv.addLeft x) A.property) + +def magneticLevel (ℓ : ℕ) (k : Level ℓ) : ℝ := (k : ℝ) - (ℓ : ℝ) / 2 + +def spinZ (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + ∑ k : Level ℓ, (magneticLevel ℓ k : ℂ) • localUnit d ℓ x k k + +def spinPlus (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + ∑ k : Fin ℓ, + (Real.sqrt ((ℓ / 2 : ℝ) * (ℓ / 2 + 1) - + magneticLevel ℓ k.castSucc * (magneticLevel ℓ k.castSucc + 1)) : ℂ) • + localUnit d ℓ x k.succ k.castSucc + +def spinMinus (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := star (spinPlus d ℓ x) + +def spinX (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + (1 / 2 : ℂ) • (spinPlus d ℓ x + spinMinus d ℓ x) + +def spinY (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + (1 / (2 * Complex.I) : ℂ) • (spinPlus d ℓ x - spinMinus d ℓ x) + +def NearestNeighbor {d : ℕ} (x y : Site d) : Prop := + ∑ i : Fin d, |x i - y i| = (1 : ℤ) + +def volumeEdges {d : ℕ} (Λ : Finset (Site d)) : Finset (Site d × Site d) := + (Λ ×ˢ Λ).filter fun p => NearestNeighbor p.1 p.2 ∧ WellOrderingRel p.1 p.2 + +def hamiltonian (d ℓ : ℕ) (Λ : Finset (Site d)) : QuasiLocal d ℓ := + -∑ e ∈ volumeEdges Λ, + (spinX d ℓ e.1 * spinX d ℓ e.2 + spinY d ℓ e.1 * spinY d ℓ e.2 + + spinZ d ℓ e.1 * spinZ d ℓ e.2) + +def box (d n : ℕ) : Finset (Site d) := + Fintype.piFinset fun _ : Fin d => Finset.Icc (-(n : ℤ)) (n : ℤ) + +def finiteDynamics (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) + (A : QuasiLocal d ℓ) : QuasiLocal d ℓ := + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) * A * + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) + +def dynamics (d ℓ : ℕ) (t : ℝ) (A : QuasiLocal d ℓ) : QuasiLocal d ℓ := + Filter.limUnder Filter.atTop (fun n : ℕ => finiteDynamics d ℓ (box d n) t A) + +def DynamicsConverges (d ℓ : ℕ) : Prop := + ∀ (t : ℝ) (A : QuasiLocal d ℓ), + Filter.Tendsto (fun n : ℕ => finiteDynamics d ℓ (box d n) t A) + Filter.atTop (nhds (dynamics d ℓ t A)) + +structure State (d ℓ : ℕ) where + functional : QuasiLocal d ℓ →L[ℂ] ℂ + normalized : functional 1 = 1 + positive : ∀ A, (functional (star A * A)).im = 0 ∧ + 0 ≤ (functional (star A * A)).re + +def TranslationInvariant {d ℓ : ℕ} (ω : State d ℓ) : Prop := + ∀ (x : Site d) (A : QuasiLocal d ℓ), ω.functional (translation d ℓ x A) = ω.functional A + +def IsKMS {d ℓ : ℕ} (β : ℝ) (ω : State d ℓ) : Prop := + 0 < β ∧ ∀ A B : QuasiLocal d ℓ, ∃ F : ℂ → ℂ, + ContinuousOn F {z | 0 ≤ z.im ∧ z.im ≤ β} ∧ + DifferentiableOn ℂ F {z | 0 < z.im ∧ z.im < β} ∧ + (∃ C : ℝ, ∀ z : ℂ, 0 ≤ z.im → z.im ≤ β → ‖F z‖ ≤ C) ∧ + (∀ t : ℝ, F t = ω.functional (A * dynamics d ℓ t B)) ∧ + (∀ t : ℝ, F ((t : ℂ) + Complex.I * β) = ω.functional (dynamics d ℓ t B * A)) + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/NetworkEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/NetworkEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f8d5d7a1c1366f68bcaba0734b4002c3861b498 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/NetworkEnergy.lean @@ -0,0 +1,269 @@ +import OAI.MathematicalPhysics.Heisenberg.RoutedNetworks + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical + +namespace Heisenberg.RoutedFlow.Network +variable {V E : Type*} (N : Network V E) + +def boundary (e : E) (v : V) : ℝ := + (if N.src e = v then 1 else 0) - (if N.dst e = v then 1 else 0) + +def divergence (F : E → ℝ) (v : V) : ℝ := + ∑ e ∈ (N.incidentFinite v).toFinset, F e * N.boundary e v + +lemma vertex_sum (g : V →₀ ℝ) (e : E) : + (∑ v ∈ g.support, g v * N.boundary e v) = N.gradient g e := by + simp only [boundary,mul_sub,Finset.sum_sub_distrib,mul_ite,mul_one,mul_zero, + Finset.sum_ite_eq] + rw [show (if N.src e ∈ g.support then g (N.src e) else 0) = g (N.src e) by + split_ifs with h; rfl; exact (Finsupp.notMem_support_iff.mp h).symm] + rw [show (if N.dst e ∈ g.support then g (N.dst e) else 0) = g (N.dst e) by + split_ifs with h; rfl; exact (Finsupp.notMem_support_iff.mp h).symm] + rfl + +lemma boundary_zero {e : E} {v : V} (he : e ∉ (N.incidentFinite v).toFinset) : + N.boundary e v = 0 := by + have h : ¬(N.src e = v ∨ N.dst e = v) := by simpa using he + simp [boundary,not_or.mp h |>.1,not_or.mp h |>.2] + +lemma divergence_eq_sum (F : E → ℝ) (g : V →₀ ℝ) {v : V} (hv : v ∈ g.support) : + N.divergence F v = ∑ e ∈ N.edges g, F e * N.boundary e v := by + apply Finset.sum_subset + · intro e he + rcases (N.incidentFinite v).mem_toFinset.mp he with h|h + · exact (N.mem_edges g e).mpr (Or.inl (h ▸ hv)) + · exact (N.mem_edges g e).mpr (Or.inr (h ▸ hv)) + · intro e _ he + rw [N.boundary_zero he,mul_zero] + +theorem pairing_divergence (F : E → ℝ) (g : V →₀ ℝ) : + N.pairing F g = ∑ v ∈ g.support, g v * N.divergence F v := by + unfold pairing + simp_rw [← N.vertex_sum g] + simp_rw [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro v hv + rw [N.divergence_eq_sum F g hv,Finset.mul_sum] + apply Finset.sum_congr rfl + intro e _ + ring + +theorem unit_of_divergence (F : E → ℝ) (y : V) + (h : ∀ v, N.divergence F v = if v = y then 1 else 0) : N.UnitFlow F y := by + intro g + rw [N.pairing_divergence] + simp_rw [h,mul_ite,mul_one,mul_zero] + rw [Finset.sum_ite_eq'] + split_ifs with hy + · rfl + · exact (Finsupp.notMem_support_iff.mp hy).symm + +lemma pairing_single (e : E) (g : V →₀ ℝ) : + N.pairing (Finsupp.single e 1) g = N.gradient g e := by + rw [N.pairing_finsupp] + simp + +lemma pairing_add (F H : E → ℝ) (g : V →₀ ℝ) : + N.pairing (F+H) g = N.pairing F g + N.pairing H g := by + simp [pairing,add_mul,Finset.sum_add_distrib] + +end Heisenberg.RoutedFlow.Network + +namespace Heisenberg.RoutedFlow.Routing +variable {V E W T : Type*} {S : Network V E} {N : Network W T} {ψ : V → W} + +theorem abs_push_le (R : Routing S N ψ) (F : E → ℝ) (t : T) (A : ℝ) (hA : 0 ≤ A) + (hF : ∀ e, R.current e t ≠ 0 → |F e| ≤ A) + (hR : ∀ e, |R.current e t| ≤ 1) : + |R.push F t| ≤ ((R.locallyFinite t).toFinset.card : ℝ) * A := by + unfold push + calc + _ ≤ ∑ e ∈ (R.locallyFinite t).toFinset, |F e * R.current e t| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _e ∈ (R.locallyFinite t).toFinset, A := by + apply Finset.sum_le_sum + intro e he + rw [abs_mul] + exact (mul_le_mul (hF e ((R.locallyFinite t).mem_toFinset.mp he)) (hR e) + (abs_nonneg _) hA).trans_eq (mul_one A) + _ = _ := by simp + +end Heisenberg.RoutedFlow.Routing + +namespace Heisenberg.RoutedFlow +variable {V : Type*} (G : SimpleGraph V) (hG : ∀ v, (G.neighborSet v).Finite) + +def graphNetwork : Network V G.Dart where + src e := e.fst + dst e := e.snd + incidentFinite v := by + have hi : Function.Injective (fun e : G.Dart => e.toProd) := by + intro e f h + exact SimpleGraph.Dart.ext e f h + apply (((Set.finite_singleton v).prod (hG v)).union + ((hG v).prod (Set.finite_singleton v))).preimage hi.injOn |>.subset + intro e he + rcases he with h|h + · exact Or.inl ⟨h,by simpa only [← h,SimpleGraph.mem_neighborSet] using e.adj⟩ + · exact Or.inr ⟨by simpa [← h] using e.adj.symm,h⟩ + +variable {G} + +def pathCurrent {u v : V} : G.Walk u v → G.Dart →₀ ℝ + | .nil => 0 + | .cons h p => Finsupp.single ⟨(u,_),h⟩ 1 + pathCurrent p + +lemma pathCurrent_pairing {u v : V} (p : G.Walk u v) (g : V →₀ ℝ) : + (graphNetwork G hG).pairing (pathCurrent p) g = g u - g v := by + induction p with + | nil => simp [pathCurrent,Network.pairing] + | @cons u v w h p ih => + rw [pathCurrent,Finsupp.coe_add,Network.pairing_add,Network.pairing_single,ih] + change (g u-g v)+(g v-g w) = g u-g w + ring + +omit hG in +lemma pathCurrent_eq_count {u v : V} (p : G.Walk u v) (e : G.Dart) : + pathCurrent p e = (p.darts.count e : ℝ) := by + induction p with + | nil => simp [pathCurrent] + | @cons u v w h p ih => + simp only [pathCurrent,Finsupp.add_apply,ih,SimpleGraph.Walk.darts_cons, + List.count_cons] + by_cases he : (⟨(u,v),h⟩ : G.Dart) = e + · subst e; simp [add_comm] + · simp [he,Ne.symm he] + +omit hG in +lemma pathCurrent_abs_le_one {u v : V} (p : G.Walk u v) (hp : p.IsTrail) (e : G.Dart) : + |pathCurrent p e| ≤ 1 := by + rw [pathCurrent_eq_count,abs_of_nonneg (by positivity)] + have hd : p.darts.Nodup := List.Nodup.of_map SimpleGraph.Dart.edge hp.edges_nodup + exact_mod_cast List.nodup_iff_count_le_one.mp hd e + +omit hG in +lemma pathCurrent_ne_zero_iff {u v : V} (p : G.Walk u v) (e : G.Dart) : + pathCurrent p e ≠ 0 ↔ e ∈ p.darts := by + rw [pathCurrent_eq_count,Nat.cast_ne_zero,← Nat.pos_iff_ne_zero,List.count_pos_iff] + +def routingOfPaths {W E : Type*} (S : Network W E) (ψ : W → V) + (P : ∀ e, G.Walk (ψ (S.src e)) (ψ (S.dst e))) + (hP : ∀ t, {e | t ∈ (P e).darts}.Finite) : Routing S (graphNetwork G hG) ψ where + current e := pathCurrent (P e) + locallyFinite t := by simpa only [pathCurrent_ne_zero_iff] using hP t + telescopes e g := pathCurrent_pairing hG (P e) g + +lemma routingOfPaths_abs_le_one {W E : Type*} (S : Network W E) (ψ : W → V) + (P : ∀ e, G.Walk (ψ (S.src e)) (ψ (S.dst e))) + (hP : ∀ t, {e | t ∈ (P e).darts}.Finite) (hsimple : ∀ e, (P e).IsTrail) + (e : E) (t : G.Dart) : |(routingOfPaths hG S ψ P hP).current e t| ≤ 1 := + pathCurrent_abs_le_one (P e) (hsimple e) t + +end Heisenberg.RoutedFlow + +open scoped Classical +open Module +namespace Heisenberg.LatticeSum + +abbrev Site (d : ℕ) := Fin d → ℤ + +def radius {d : ℕ} (x : Site d) : ℕ := Finset.univ.sup (fun j => (x j).natAbs) + +def integerLattice (d : ℕ) : Submodule ℤ (Fin d → ℝ) := + Submodule.span ℤ (Set.range (Pi.basisFun ℝ (Fin d))) + +instance (d : ℕ) : DiscreteTopology (integerLattice d) := by + unfold integerLattice + infer_instance + +instance (d : ℕ) : IsZLattice ℝ (integerLattice d) := by + unfold integerLattice + infer_instance + +def embed {d : ℕ} (x : Site d) : integerLattice d := + ⟨fun j => (x j : ℝ), by + apply ((Pi.basisFun ℝ (Fin d)).mem_span_iff_repr_mem ℤ _).mpr + intro j + exact ⟨x j, by simp⟩⟩ + +lemma embed_injective (d : ℕ) : Function.Injective (embed (d := d)) := by + intro x y h + ext j + have hj := congrFun (congrArg Subtype.val h) j + change (x j : ℝ) = (y j : ℝ) at hj + exact_mod_cast hj + +lemma embed_norm_le {d : ℕ} (x : Site d) : ‖embed x‖ ≤ (radius x : ℝ) := by + change ‖fun j => (x j : ℝ)‖ ≤ (radius x : ℝ) + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro j + have hj : (x j).natAbs ≤ radius x := by + exact Finset.le_sup (α := ℕ) (f := fun j => (x j).natAbs) (Finset.mem_univ j) + simpa only [Real.norm_eq_abs, Nat.cast_natAbs, Int.cast_abs] using + (show ((x j).natAbs : ℝ) ≤ (radius x : ℝ) by exact_mod_cast hj) + +lemma embed_ne_zero {d : ℕ} {x : Site d} (hx : x ≠ 0) : embed x ≠ 0 := by + intro he + apply hx + apply embed_injective d + convert he using 1 + apply Subtype.ext + funext j + simp [embed] + +theorem summable_radius_rpow (d : ℕ) (r : ℝ) (hr : r < -(d : ℝ)) : + Summable (fun x : Site d => ((radius x : ℝ) + 1) ^ r) := by + have hrank : Module.finrank ℤ (integerLattice d) = d := by + rw [ZLattice.rank ℝ] + simp + have hs := ZLattice.summable_norm_rpow (integerLattice d) r (by simpa [hrank] using hr) + have ht : Summable (fun x : Site d => ‖embed x‖ ^ r) := + hs.comp_injective (embed_injective d) + apply Summable.of_norm_bounded_eventually ht + apply Set.Finite.subset (Set.finite_singleton (0 : Site d)) + intro x hx + by_contra hn + have hpos : 0 < ‖embed x‖ := norm_pos_iff.mpr (embed_ne_zero hn) + have hle : ‖((radius x : ℝ) + 1) ^ r‖ ≤ ‖embed x‖ ^ r := by + rw [Real.norm_eq_abs, abs_of_pos (Real.rpow_pos_of_pos (by positivity) _)] + exact Real.rpow_le_rpow_of_nonpos hpos (by linarith [embed_norm_le x]) (by linarith) + exact hx hle + +theorem summable_radius_sub_rpow (d : ℕ) (r : ℝ) (hr : r < -(d : ℝ)) (y : Site d) : + Summable (fun x : Site d => ((radius (x - y) : ℝ) + 1) ^ r) := by + exact (Equiv.subRight y).summable_iff.mpr (summable_radius_rpow d r hr) + +theorem finite_energy_of_envelope {d : ℕ} {I : Type*} [Fintype I] + (J : I × Site d → ℝ) (y : Site d) (C k : ℝ) (hC : 0 ≤ C) + (hk : (d : ℝ) < 2 * k) + (hJ : ∀ e, |J e| ≤ C * ((radius (e.2 - y) : ℝ) + 1) ^ (-k)) : + Summable (fun e => J e ^ 2) := by + have hs := summable_radius_sub_rpow d (-2 * k) (by linarith) y + have hs' : Summable (fun e : I × Site d => + C ^ 2 * ((radius (e.2 - y) : ℝ) + 1) ^ (-2 * k)) := by + apply (summable_prod_of_nonneg (fun _ => by positivity)).mpr + refine ⟨fun _ => hs.mul_left _, ?_⟩ + exact .of_finite + apply Summable.of_nonneg_of_le (fun e => sq_nonneg _) _ hs' + intro e + have he := sq_le_sq₀ (abs_nonneg (J e)) + (mul_nonneg hC (Real.rpow_nonneg (by positivity) _)) |>.mpr (hJ e) + have hr : (((radius (e.2 - y) : ℝ) + 1) ^ (-k)) ^ 2 = + ((radius (e.2 - y) : ℝ) + 1) ^ (-2 * k) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (by positivity)] + congr 1 + ring + simpa only [sq_abs, mul_pow, hr] using he + +end Heisenberg.LatticeSum + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/OnsiteSwaps.lean b/lean/OAI/MathematicalPhysics/Heisenberg/OnsiteSwaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc7ab4d984ff1892ede593f8ff426f94a75d86e5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/OnsiteSwaps.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.Heisenberg.CompletedSurface + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Onsite + +theorem swap_factorization {V X : Type*} [Fintype V] (loc : V → X) + (π : Equiv.Perm V) (hπ : ∀ v,loc (π v)=loc v) : + ∃ L : List (V×V),(∀ e∈L,loc e.1=loc e.2) ∧ + (L.map (fun e=>Equiv.swap e.1 e.2)).prod=π := by + classical + generalize hn : π.support.card=n + induction n using Nat.strong_induction_on generalizing π with + | h n ih=> + by_cases hp : π=1 + · subst π; exact ⟨[],by simp,by simp⟩ + obtain ⟨a,ha⟩ : ∃ a,π a≠a := by + by_contra hf + push Not at hf + apply hp + ext a + exact hf a + let τ:=Equiv.swap a (π a)*π + have hτ : ∀ v,loc (τ v)=loc v := by + intro v + change loc (Equiv.swap a (π a) (π v))=loc v + by_cases h1 : π v=a + · rw [h1,Equiv.swap_apply_left] + exact (hπ a).trans ((congrArg loc h1).symm.trans (hπ v)) + by_cases h2 : π v=π a + · have hv : v=a:=π.injective h2 + subst v + simp only [Equiv.swap_apply_right] + rw [Equiv.swap_apply_of_ne_of_ne h1 h2] + exact hπ v + obtain ⟨L,hL,hprod⟩:=ih τ.support.card (by simpa [hn] using Equiv.Perm.card_support_swap_mul ha) τ hτ rfl + refine ⟨(a,π a)::L,?_,?_⟩ + · intro e he + rcases List.mem_cons.mp he with rfl|he + · exact (hπ a).symm + · exact hL e he + · simp only [List.map_cons,List.prod_cons,hprod,τ] + rw [←mul_assoc,Equiv.swap_mul_self,one_mul] + +end Heisenberg.Onsite +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicCount.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..960e627d0bae37a316a3794d990e908acc007e11 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicCount.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshMatrixSurface + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface + +lemma periodic_count (k Q : ℕ) (P : ℕ → Prop) : + (Finset.univ.filter (fun j : Fin (k*Q)=>P (j.val%Q))).card= + k*(Finset.univ.filter (fun j : Fin Q=>P j.val)).card := by + simp only [Finset.card_filter] + have hh:=Fintype.sum_equiv (finProdFinEquiv (m:=k) (n:=Q)) + (fun j : Fin k × Fin Q=>if P j.2.val then (1:ℕ) else 0) + (fun j : Fin (k*Q)=>if P (j.val%Q) then (1:ℕ) else 0) + (fun j=>by simp [finProdFinEquiv,Nat.mod_eq_of_lt j.2.isLt]) + rw [←hh] + rw [Fintype.sum_prod_type] + trans ∑ _ : Fin k,∑ j : Fin Q,if P j.val then (1:ℕ) else 0 + · congr! 20 + · simp + +lemma truncated_count (q Q : ℕ) (hq : q≤Q) (P : ℕ → Prop) : + (Finset.univ.filter (fun j : Fin Q=>j.valj.val) + · intro j hj + simpa only [Finset.mem_coe,Finset.mem_filter,Finset.mem_univ,true_and,Finset.mem_range] using hj + · intro i _ j _ h; exact Fin.ext h + · intro j hj + have h:=Finset.mem_filter.mp hj + exact ⟨⟨j,lt_of_lt_of_le (Finset.mem_range.mp h.1) hq⟩,by simpa using h,rfl⟩ + +lemma periodic_truncated_count (k q Q : ℕ) (hq : q≤Q) (P : ℕ → Prop) : + (Finset.univ.filter (fun j : Fin (k*Q)=>j.val%Qj.valj congr! 10 + · rw [truncated_count q Q hq] + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicLeakage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicLeakage.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f290899cbd7390d6c424b27b161918e41b71fae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicLeakage.lean @@ -0,0 +1,322 @@ +import OAI.MathematicalPhysics.Heisenberg.ReversedExposure + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators + +end + +noncomputable section +lemma swap_classical {α : Type*} [h : DecidableEq α] (a b : α) : + Equiv.swap a b = @Equiv.swap α (Classical.decEq α) a b := by + have he : h=Classical.decEq α := Subsingleton.elim _ _ + cases he + rfl +lemma exposedSweep_classical {T V : Type*} [fv : Fintype V] + [h : DecidableEq V] : + @Heisenberg.Exposure.exposedSweep T V fv h = + @Heisenberg.Exposure.exposedSweep T V fv (Classical.decEq V) := by + have he : h=Classical.decEq V := Subsingleton.elim _ _ + cases he + rfl + +end + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +namespace Heisenberg.SpatialFrame +open Heisenberg.Geometry Heisenberg.Schedule Heisenberg.MeshPair Heisenberg.Exposure +variable {d : ℕ} {B T : Type} [Fintype B] [Fintype T] + +theorem frame_indexed_localization {m q Q : ℕ} [NeZero m] [NeZero q] + (s : Equiv.Perm T) (ι : Fin m ≃ T) (hι : ∀ j,s (ι j)=ι (finRotate m j)) + (hQ : 0 < Q) (hqQ : q ≤ Q) (hdiv : Q∣m) (Λ : Finset (Site d)) + (e : Fin q ≃ Edges (B:=B) Step Λ) (a₀ b₀ : Fin q → Slots (B:=B) Λ) + (ha₀ : ∀ j,a₀ j=(e j).val.1) (hb₀ : ∀ j,b₀ j=(e j).val.2) + (a b : T → Slots (B:=B) Λ) + (hab : ∀ j : Fin m,∀ hj : j.val%Q < q,a (ι j)=a₀ ⟨j.val%Q,hj⟩ ∧ b (ι j)=b₀ ⟨j.val%Q,hj⟩) + (hsite : ∀ j : Fin m,q ≤ j.val%Q → (a (ι j)).1.val=(b (ι j)).1.val) + (P : Set (T×Slots (B:=B) Λ)) (I : Set (Slots (B:=B) Λ)) (p : T → ℝ) + (hp : ∀ j,0 ≤ p j ∧ p j ≤ 1) (δ : ℝ) (hδ : 0 ≤ δ) + (hrate : ∀ j : Fin m,j.val%Q < q → 2*p (ι j) ≤ δ) + (t : Fin m) (n u R : ℕ) (hn : n ≤ m) (hu : n ≤ u * Q) + (v : Slots (B:=B) Λ) + (hv : ∀ base,v∈holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (ι t)∩I) : + (∑ base,layerMass s a b P p base * + (∑ j,if (R:ℝ) < dist j.1.val v.1.val then + prefixMatrix (fun l=>exposedStep s a b base P I p (ι (run t l))) n j v else 0)) ≤ + ((u+1+R).choose R:ℝ)*(2*(4*d*(Fintype.card B)^2:ℕ)*δ)^R := by + let C : Site d → Finset (Fin q) := fun x=>(choices (B:=B) Λ x).map e.symm.toEmbedding + have hC : ∀ x,(C x).card ≤ 4*d*(Fintype.card B)^2 := by + intro x + simpa only [C,Finset.card_map] using choices_card (B:=B) Λ x + apply indexed_cyclic_localization s ι hι hQ hqQ hdiv (fun v : Slots (B:=B) Λ=>v.1.val) C + (fun x j=>next x (e j)) _ hC a₀ b₀ a b hab hsite + (fun j v=>by rw [ha₀,hb₀]; exact swap_step _ _) ?_ P I p hp δ hδ hrate t n u R hn hu v hv + intro j v h + rw [ha₀,hb₀] at h ⊢ + obtain ⟨hc,he⟩:=swap_move (e j) v h + refine ⟨?_,he⟩ + exact Finset.mem_map.mpr ⟨e j,hc,e.symm_apply_apply j⟩ + +end Heisenberg.SpatialFrame + +noncomputable section +open scoped Classical BigOperators Fin.NatCast RealInnerProductSpace +open Filter Topology +namespace Heisenberg.Flow +@[reducible] local instance periodicDecEq (α : Type*) : DecidableEq α := Classical.decEq α +open Heisenberg.Geometry Heisenberg.Schedule Heisenberg.SpatialFrame Heisenberg.MeshPair Heisenberg.Exposure Heisenberg.LatticeRegular +variable {d : ℕ} + +theorem indexed_prefix_leakage (hd : 2 ≤ d) (L : ℝ) (hL : 0 ≤ L) : + ∃ M : ℕ,∃ C ≥ 0,∀ (B : Type) [Fintype B] [Nonempty B] + (Λ F : Finset (Site (d+1))) (q : ℕ) [NeZero q] + (edge : Fin q ≃ Edges (B:=B) Step Λ) + (a₀ b₀ : ℕ → Slots (B:=B) Λ) + (_ha₀ : ∀ j : Fin q,a₀ j=(edge j).val.1) + (_hb₀ : ∀ j : Fin q,b₀ j=(edge j).val.2) + (ε : ℝ),0 < ε → + ∀ᶠ δ in 𝓝 (0:ℝ),0 < δ → δ ≤ 2 → + ∀ (T : Type) [Fintype T] (m Q : ℕ) [NeZero m] + (s : Equiv.Perm T) (ι : Fin m ≃ T) + (_hι : ∀ j,s (ι j)=ι (finRotate m j)) + (_hQ : 0 < Q) (_hqQ : q ≤ Q) (_hdiv : Q∣m) + (a b : T → Slots (B:=B) Λ) + (_hab : ∀ j : Fin m,∀ _hj : j.val%Q < q, + a (ι j)=a₀ (j.val%Q) ∧ b (ι j)=b₀ (j.val%Q)) + (_hsite : ∀ j : Fin m,q ≤ j.val%Q → (a (ι j)).1.val=(b (ι j)).1.val) + (p : T → ℝ) (_hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) + (_hrate : ∀ j : Fin m,j.val%Q < q → p (ι j)=δ/2) + (P : Set (T×Slots (B:=B) Λ)) (t : Fin m) + (J : Finset (Slots (B:=B) Λ)) + (f : (T → Bool) → EuclideanSpace ℝ (Slots (B:=B) Λ)) + (n R : ℕ) (ρ : ℝ), + 0 < n → Heisenberg.Schedule.cut t Q n ≤ m → + F⊆Λ → (∀ z∈F,∀ w,Step z w → w∈Λ) → + (∀ base j,j∈J → j∈holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (ι t) ∧ j.1.val∈F) → + (∀ base j,j∈J → (f base).ofLp j=1) → + (∀ base j,0 ≤ (f base).ofLp j ∧ (f base).ofLp j ≤ 1) → + (∀ base j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (ι t)∩{j | j.1.val∈F} → (f base).ofLp j=0) → + (∀ z u,0 ≤ u → ((Finset.univ.filter (fun j : J=>dist j.val.1.val z ≤ u)).card:ℝ) ≤ L*(1+u)^((1:ℝ)/100)) → + (∀ (i : Fin n) (j : J), (∑ base,Exposure.layerMass s a b P p base * + (if ¬Regular (blocked Λ (holeCut s (fun l=>Equiv.swap (a l) (b l)) base P (ι (run t (Heisenberg.Schedule.cut t Q i))))) + j.val.1.val R M (1/(100*(d+1:ℝ))) then (1:ℝ) else 0)) ≤ ρ) → + (J.card:ℝ)-2*((ρ+((n+2+R).choose R:ℝ)*(2*(4*(d+1)*(Fintype.card B)^2:ℕ)*δ)^R)*J.card)- + 2*(C*(1+(R:ℝ))^((1:ℝ)/100)*J.card)/((δ/2)*(n:ℝ))- + (n:ℝ)*(ε*δ*Fintype.card (Slots (B:=B) Λ)+δ^2*q^2) ≤ + ∑ base,Exposure.layerMass s a b P p base * + (‖f base‖^2-‖exposedSweep s a b base P {v | v.1.val∈F} p (fun l=>ι (run t l)) (Heisenberg.Schedule.cut t Q n) (f base)‖^2) := by + obtain ⟨M,C,hC,hflow⟩:=exposed_prefix_leakage hd L hL + refine ⟨M,C,hC,?_⟩ + intro B _ _ Λ F q _ edge a₀ b₀ ha₀ hb₀ ε hε + have hab₀ : ∀ j,j < q → a₀ j≠b₀ j := by + intro j hj he + apply edge_site_ne (edge ⟨j,hj⟩) + have he' : (edge ⟨j,hj⟩).val.1=(edge ⟨j,hj⟩).val.2 := + (ha₀ ⟨j,hj⟩).symm.trans (he.trans (hb₀ ⟨j,hj⟩)) + exact congrArg (fun z : Slots (B:=B) Λ=>z.1.val) he' + filter_upwards [round_energy a₀ b₀ q hab₀ hε] with δ hδE + intro hδ hδ2 T _ m Q _ s ι hι hQ hqQ hdiv a b hab hsite p hp hrate P t J f n R ρ hn hhor hF hframe hJ hfJ hf hs hg hbad + let r : ℕ → T := fun l=>ι (run t l) + let c : ℕ → ℕ := Heisenberg.Schedule.cut t Q + have hr : ∀ j,r (j+1)=s (r j) := by intro j; simp only [r,run_succ,←hι] + have hc (i : ℕ) : c i+q ≤ c (i+1) := by + dsimp only [c] + rw [cut_step] + omega + have hmod (i j : ℕ) (hj : j < q) : (run t (c i+j)).val%Q=j := by + rw [cut_mod t hQ hdiv,Nat.mod_eq_of_lt (lt_of_lt_of_le hj hqQ)] + have ha : ∀ i j,j < q → a (r (c i+j))=a₀ j := by + intro i j hj + have h:= hab (run t (c i+j)) (by rw [hmod i j hj]; exact hj) + simpa only [hmod i j hj] using h.1 + have hb : ∀ i j,j < q → b (r (c i+j))=b₀ j := by + intro i j hj + have h:= hab (run t (c i+j)) (by rw [hmod i j hj]; exact hj) + simpa only [hmod i j hj] using h.2 + have hrate' : ∀ i j,j < q → p (r (c i+j))=δ/2 := by + intro i j hj + exact hrate _ (by rw [hmod i j hj]; exact hj) + have hrem : 0 ≤ ε*δ*Fintype.card (Slots (B:=B) Λ)+δ^2*q^2 := by positivity + apply hflow T B Λ F s a b p hp P r c J f a₀ b₀ q n R edge (δ/2) ρ + (((n+2+R).choose R:ℝ)*(2*(4*(d+1)*(Fintype.card B)^2:ℕ)*δ)^R) + (ε*δ*Fintype.card (Slots (B:=B) Λ)+δ^2*q^2) hn (by positivity) hrem hr ha₀ hb₀ hF hframe + (by simpa only [r,run_zero] using hJ) hfJ hf (by simpa only [r,run_zero] using hs) hg hbad + · intro i j + have hcn : c i ≤ c n := by + dsimp only [c,cut] + exact Nat.add_le_add_left (Nat.mul_le_mul_right _ i.isLt.le) _ + have hcu : c i ≤ (n+1)*Q := by + have hw := warm_le (Q:=Q) t + dsimp only [c,cut] + nlinarith [i.isLt] + convert frame_indexed_localization s ι hι hQ hqQ hdiv Λ edge + (fun j : Fin q=>a₀ j) (fun j : Fin q=>b₀ j) ha₀ hb₀ a b hab hsite + P {v | v.1.val∈F} p hp δ hδ.le (fun j hj=>by rw [hrate j hj]; ring_nf; exact le_refl δ) + t (c i) (n+1) R (hcn.trans hhor) hcu j.val (fun base=>hJ base j.val j.property) using 1 + · intro i + have h:=hδE hδ.le hδ2 T s a b r c hr hc ha hb p hp hrate' P {v | v.1.val∈F} f hf + (by simpa only [r,run_zero,swap_classical] using hs) i + simpa only [swap_classical,exposedSweep_classical,show 2*(δ/2)=δ by ring,add_assoc] using h + +end Heisenberg.Flow + +end +end + +noncomputable section +end + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Matrix +namespace Heisenberg.Schedule +variable {m : ℕ} [NeZero m] +@[simp] lemma run_period (t : Fin m) : run t m=t := by simp [run] +lemma run_ne_start (t : Fin m) {j : ℕ} (hj : 0 < j) (hjm : j < m) : run t j≠t := by + intro h + have hh:=run_inj t (le_refl m) hjm (NeZero.pos m) (h.trans (run_zero t).symm) + omega +end Heisenberg.Schedule +namespace Heisenberg.Serial +open Heisenberg.Schedule Heisenberg.Hitting +variable {V : Type} [Fintype V] [DecidableEq V] + +lemma cyclic_backward_return_at (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (t : Fin (n+1)) (f : Fin (n+1) → V → ℝ) + (hf : ∀ u,u≠t → (K u).transpose*ᵥ f (finRotate (n+1) u)=f u) : + (product (n+1) (fun i=>K (run t i))).transpose*ᵥ f t= + (K t).transpose*ᵥ f (finRotate (n+1) t) := by + have hh := backward_profile n (fun i=>K (run t (i.val+1))) + (fun i=>f (run t (i.val+1))) (by + intro i + simpa only [Fin.val_castSucc,Fin.val_succ,run_succ] using + hf (run t (i.val+1)) (run_ne_start t (by omega) (by omega))) + simp only [Fin.val_last,run_period,Fin.val_zero,Nat.zero_add,run_succ,run_zero] at hh + rw [product,Matrix.transpose_mul,←Matrix.mulVec_mulVec] + simp only [Fin.val_zero,run_zero,Fin.val_succ] + change (K t).transpose*ᵥ ((product n (fun i=>K (run t (i.val+1)))).transpose*ᵥ f t)=_ + simp only [run_succ] + rw [hh] + +def targetsAt (n : ℕ) (t : Fin (n+1)) (J : Finset V) : Finset (Fin (n+1)×V) := + J.image (fun j=>(t,j)) +omit [Fintype V] in +@[simp] lemma mem_targetsAt (n : ℕ) (t u : Fin (n+1)) (J : Finset V) (j : V) : + (u,j)∈targetsAt n t J ↔ u=t ∧ j∈J := by simp [targetsAt,and_comm,eq_comm] + +theorem cyclic_hitting_energy_at (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) + (hK : ∀ t,DoublySubstochastic (K t)) (t : Fin (n+1)) (J : Finset V) : + let F := hitting (cyclicKernel n K) (targetsAt n t J) + energy (cyclicKernel n K) F = + energy (product (n+1) (fun i=>K (run t i))) (fun v=>F (t,v)) := by + dsimp only + let U:=cyclicKernel n K + let F:=hitting U (targetsAt n t J) + have hU:=cyclicKernel_substochastic n K hK + have hf (u : Fin (n+1)) (hu : u≠t) : + (K u).transpose*ᵥ (fun v=>F (finRotate (n+1) u,v))=(fun v=>F (u,v)) := by + funext v + rw [←cyclicKernel_backward] + exact hitting_harmonic hU _ (by simp [hu]) + have hr:=cyclic_backward_return_at n K t (fun u v=>F (u,v)) hf + have hr' (v : V) : backward (product (n+1) (fun i=>K (run t i))) (fun v=>F (t,v)) v= + backward U F (t,v) := by + rw [cyclicKernel_backward] + exact congrFun hr v + rw [energy_transpose] + change (∑ z,F z*(F z-backward U F z))=energy _ _ + rw [Fintype.sum_prod_type,Finset.sum_eq_single t] + · rw [energy_transpose] + apply Finset.sum_congr rfl + intro v _ + rw [hr'] + · intro u _ hu + apply Finset.sum_eq_zero + intro v _ + have hh:=hitting_harmonic hU (targetsAt n t J) (i:=(u,v)) (by simp [hu]) + change backward U F (u,v)=F (u,v) at hh + rw [hh,sub_self,mul_zero] + · simp + +end Heisenberg.Serial + +namespace Heisenberg.Exposure +open Heisenberg.Serial Heisenberg.Schedule Heisenberg.Hitting Heisenberg.MeshPair Heisenberg.Cycle +variable {V : Type} [Fintype V] [DecidableEq V] + +theorem cut_return_energy_at (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) (P : Set (Fin (n+1)×V)) + (D : (Fin (n+1) → Bool) → Fin (n+1) → Set V) (t : Fin (n+1)) + (T : Finset P) (J : Finset V) (himage : T.image Subtype.val=targetsAt n t J) + (hT : ∀ base j,j∈T → j.val.2∈D base j.val.1) + (hQ : ∀ base,(MissingSet (layerHistory (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) base) P)ᶜ∩Pᶜ ⊆ + {z | z.2∈D base z.1}) : + ∃ f : (Fin (n+1) → Bool) → V → ℝ, + (∀ base j,0 ≤ f base j ∧ f base j ≤ 1) ∧ + (∀ base j,j∈J → f base j=1) ∧ + (∀ base j,j∉D base t → f base j=0) ∧ + (∑ c,layerMass (finRotate (n+1)) a b P p c * + returnCount (layerHistory (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) c) P T) ≤ (J.card:ℝ)- + ∑ base,layerMass (finRotate (n+1)) a b P p base * + energy (product (n+1) (fun i=>cutFactors n a b p P D base (run t i))) (f base) := by + let K:=cutFactors n a b p P D + let F:=fun base=>hitting (cyclicKernel n (K base)) (targetsAt n t J) + have hK:=cutFactors_substochastic n a b p hp P D + have hU:=fun base=>cyclicKernel_substochastic n (K base) (hK base) + have hTb (base : Fin (n+1) → Bool) {j : V} (hj : j∈J) : j∈D base t := by + have ht : (t,j)∈T.image Subtype.val := by rw [himage]; simp [hj] + obtain ⟨z,hz,he⟩:=Finset.mem_image.mp ht + have hh:=hT base z hz + simpa only [he] using hh + refine ⟨fun base j=>F base (t,j),?_,?_,?_,?_⟩ + · intro base j + exact ⟨(hitting_bounds (hU base) _).1 _,(hitting_bounds (hU base) _).2 _⟩ + · intro base j hj + exact hitting_on (hU base) _ (by simp [hj]) + · intro base j hj + apply hitting_zero_column (hU base) (targetsAt n t J) + · simp only [mem_targetsAt,true_and] + exact fun ht=>hj (hTb base ht) + · intro z + simp only [cyclicKernel] + split_ifs + · dsimp [K,cutFactors] + simp only [residualBetween] + split_ifs <;> simp [killedBetween,hj,Matrix.add_apply,Matrix.smul_apply] + · rfl + · have hh:=averaged_layer_energy (finRotate (n+1)) a b p hp P + (fun base=>{z | z.2∈D base z.1}) T hT hQ + dsimp only at hh + have hc : T.card=J.card := by + have h:=congrArg Finset.card himage + rw [Finset.card_image_of_injective _ Subtype.val_injective] at h + simpa [targetsAt,Finset.card_image_of_injective _ (fun _ _ h=>(Prod.mk.inj h).2)] using h + rw [hc] at hh + have hweight : ∀ base,layerMass (finRotate (n+1)) a b P p base= + (productWeight (fun i z=>if z then p i else 1-p i) base * + (2:ℝ)^missingCount (layerHistory (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) base) P)/ + (∑ c,productWeight (fun i z=>if z then p i else 1-p i) c * + (2:ℝ)^missingCount (layerHistory (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) c) P) := by + intro base + simp only [layerMass,layerPartition,layerWeight,Heisenberg.Bernoulli.weight,productWeight,swap_classical] + congr 1 + apply Finset.sum_congr + · ext c; simp + · intro c _; rfl + simp only [hweight] + convert hh using 2 + congr 1 + ext base + congr 1 + rw [killed_residual_cyclic,himage] + exact (cyclic_hitting_energy_at n (K base) (hK base) t J).symm + +end Heisenberg.Exposure +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicReturnEstimate.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicReturnEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a781463eee6868a487f5c8c8efd38ae7290a410 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PeriodicReturnEstimate.lean @@ -0,0 +1,142 @@ +import OAI.MathematicalPhysics.Heisenberg.BootstrapMeshBounds + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Filter Topology +namespace Heisenberg.Bootstrap +attribute [-instance] instDecidableEqFin +@[reducible] local instance retDecEq (α : Type*) : DecidableEq α := Classical.decEq α +attribute [local irreducible] Pin.pinDensity LayeredExchange.layerWeight LayeredExchange.coinWiring Heisenberg.Exposure.layerMass Heisenberg.Exposure.layerHistory Heisenberg.Cycle.MissingSet Heisenberg.Return.HasHit Heisenberg.Exposure.exposedSweep +open Heisenberg.Geometry Heisenberg.Schedule Heisenberg.SpatialFrame Heisenberg.MeshPair Heisenberg.Exposure Heisenberg.LatticeRegular Heisenberg.Cycle + +theorem periodic_return_estimate (d : ℕ) (hd : 2 ≤ d) (L : ℝ) (hL : 0 ≤ L) : + ∃ M : ℕ,∃ C≥0,∀ (p s : ℝ) (R : ℕ) (ρ : ℝ),0

dist j.val.1.val z≤u)).card:ℝ)≤L*(1+u)^((1:ℝ)/100)) → + 2*(⌊s/δ⌋₊+1)*Q ≤ N+1 → + (∀ u x,(∑ c,layerMass (finRotate (N+1)) a b P rates c * + (if ¬Regular (blocked Λ (holeCut (finRotate (N+1)) (fun i=>Equiv.swap (a i) (b i)) c P u)) + x R M (1/(100*(d+1:ℝ))) then (1:ℝ) else 0)) ≤ ρ) → + (∑ c,layerMass (finRotate (N+1)) a b P rates c * + returnCount (layerHistory (finRotate (N+1)) (fun i=>Equiv.swap (a i) (b i)) c) P T) ≤ p/2*J.card := by + obtain ⟨M,C,hC,hflow⟩:=Heisenberg.Flow.indexed_prefix_leakage hd L hL + refine ⟨M,C,hC,?_⟩ + intro p s R ρ hp hs hR1 herr B _ _ Λ F q _ edge a₀ b₀ ha₀ hb₀ hR + let ar : ℕ → Slots (B:=B) Λ := fun j=>a₀ (q-1-j) + let br : ℕ → Slots (B:=B) Λ := fun j=>b₀ (q-1-j) + let er : Fin q ≃ Edges (B:=B) Step Λ := Fin.revPerm.trans edge + have har (j : Fin q) : ar j=(er j).val.1 := by simpa [ar,er,Fin.rev,Nat.sub_sub,Nat.add_comm] using ha₀ j.rev + have hbr (j : Fin q) : br j=(er j).val.2 := by simpa [br,er,Fin.rev,Nat.sub_sub,Nat.add_comm] using hb₀ j.rev + let ε : ℝ:=p/(16*s*((Fintype.card (Slots (B:=B) Λ):ℝ)+1)) + have hε : 0<ε := by dsimp [ε]; positivity + have h1 : (0:ℝ) first | (solve | ring) | congr! 20 + · intro f hf hfJ hfs + apply harith.trans + have hh:=hforward hδ hδ2 (Fin (N+1)) (N+1) Q (finRotate (N+1)) (Equiv.refl _) (fun _=>rfl) + hQ hqQ hdiv a b hab hsite rates hrates hrate P t J f n R ρ hn (by omega) + hF hframe ?_ hfJ hf hfs hg ?_ + · convert hh using 1; first | rfl | (congr 2; first | rfl | exact Subsingleton.elim _ _) + · intro c j hj + refine ⟨?_,hJF j hj⟩ + exact fun h=>Set.disjoint_left.mp (missing_disjoint_pins _ P) h (hJP j hj) + · intro i j + exact hbad _ _ + · intro f hf hfJ hfs + apply harith.trans + have hh:=hback hδ hδ2 (Fin (N+1)) (N+1) Q (finRotate (N+1)).symm (reverseIndex q) + (reverseIndex_next) hQ hqQ hdiv + (a ∘ (finRotate (N+1)).symm) (b ∘ (finRotate (N+1)).symm) ?_ ?_ + (rates ∘ (finRotate (N+1)).symm) (fun j=>hrates _) ?_ P (reverseIndex q t) J f n R ρ hn (by omega) + hF hframe ?_ hfJ hf ?_ hg ?_ + · convert hh using 1; first | rfl | (congr 2; first | rfl | exact Subsingleton.elim _ _) + · intro j hj + have hh:=reverse_phase_spatial hdiv (NeZero.pos q) hqQ j hj + have hj' : q-1-j.val%Q < q := by omega + have ht:=hab ((finRotate (N+1)).symm (reverseIndex q j)) (by rw [hh]; exact hj') + simpa only [Function.comp_apply,hh,ar,br] using ht + · intro j hj + exact hsite _ (reverse_phase_completion hdiv (NeZero.pos q) hqQ j hj) + · intro j hj + have hh:=reverse_phase_spatial hdiv (NeZero.pos q) hqQ j hj + exact hrate _ (by rw [hh]; omega) + · intro c j hj + have ht : reverseIndex q (reverseIndex q t)=t := by exact sub_sub_cancel (q : Fin (N+1)) t + rw [ht] + refine ⟨?_,hJF j hj⟩ + exact fun h=>Set.disjoint_left.mp (missing_disjoint_pins _ P) h (hJP j hj) + · have ht : reverseIndex q (reverseIndex q t)=t := by exact sub_sub_cancel (q : Fin (N+1)) t + simp only [ht,Function.comp_apply] + convert hfs using 1 + · intro i j + have he:=regularity_reverse (finRotate (N+1)) a b P rates + (fun D : Set (Slots (B:=B) Λ)=>¬Regular (blocked Λ D) j.val.1.val R M (1/(100*(d+1:ℝ)))) + (reverseIndex q (run (reverseIndex q t) (cut (reverseIndex q t) Q i.val))) + have hx:=hbad (reverseIndex q (run (reverseIndex q t) (cut (reverseIndex q t) Q i.val))) j.val.1.val + have hz:=he.le.trans (show _≤ρ from by convert hx using 1; congr! 20) + simp only [Function.comp_apply] + convert hz using 1; congr! 20 + +end Heisenberg.Bootstrap +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PermutationSymbols.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PermutationSymbols.lean new file mode 100644 index 0000000000000000000000000000000000000000..91ef56ba41e974b90ca29c9c7d855688c5ff3d76 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PermutationSymbols.lean @@ -0,0 +1,264 @@ +import OAI.MathematicalPhysics.Heisenberg.PinSymmetrization + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate + +namespace Heisenberg.Pin + +variable {V : Type*} [Fintype V] [DecidableEq V] + +def permutationSymbol (π : Equiv.Perm V) : MvPolynomial (V ⊕ V) ℂ := + ∏ i, (MvPolynomial.X (Sum.inl i) + MvPolynomial.X (Sum.inr (π i))) + +omit [DecidableEq V] in +lemma stable_permutationSymbol (π : Equiv.Perm V) : Stable (permutationSymbol π) := by + intro z hz + simp only [permutationSymbol, MvPolynomial.eval_prod, map_add, MvPolynomial.eval_X] + apply Finset.prod_ne_zero_iff.mpr + intro i _ hzero + have hpos := add_pos (hz (Sum.inl i)) (hz (Sum.inr (π i))) + rw [← Complex.add_im, hzero, Complex.zero_im] at hpos + exact (lt_irrefl 0) hpos + +lemma multiAffine_permutationSymbol (π : Equiv.Perm V) : + MultiAffine (permutationSymbol π) := by + intro j + apply (MvPolynomial.degreeOf_prod_le j Finset.univ _).trans + apply (Finset.sum_le_sum fun i _ => MvPolynomial.degreeOf_add_le j _ _).trans + cases j with + | inl j => simp [MvPolynomial.degreeOf_X] + | inr j => + simp only [MvPolynomial.degreeOf_X, reduceCtorEq, ite_false, zero_le, max_eq_right, + Sum.inr.injEq] + simp [← π.symm_apply_eq, eq_comm] + +omit [DecidableEq V] in +lemma permutationSymbol_eval_one (π : Equiv.Perm V) : + MvPolynomial.eval (fun _ => 1) (permutationSymbol π) = 2 ^ Fintype.card V := by + norm_num [permutationSymbol] + +lemma Stable.rename {σ τ : Type*} {p : MvPolynomial σ ℂ} + (hp : Stable p) (f : σ → τ) : Stable (MvPolynomial.rename f p) := by + intro z hz + rw [MvPolynomial.eval_rename] + exact hp (z ∘ f) (fun i => hz (f i)) + +omit [DecidableEq V] in +lemma rename_permutationSymbol (π τ : Equiv.Perm V) : + MvPolynomial.rename (Sum.map id τ) (permutationSymbol π) = + permutationSymbol (τ * π) := by + simp [permutationSymbol, map_prod, map_add, + MvPolynomial.rename_X, Equiv.Perm.mul_apply] + +omit [Fintype V] [DecidableEq V] in + +lemma stable_rename_outputs {p : MvPolynomial (V ⊕ V) ℂ} (hp : Stable p) + (τ : Equiv.Perm V) : Stable (MvPolynomial.rename (Sum.map id τ) p) := + hp.rename (Sum.map id τ) + +end Heisenberg.Pin + +namespace Heisenberg.Pin + +variable {V Ω : Type*} [Fintype V] [DecidableEq V] [Fintype Ω] + +def lawSymbol (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) : MvPolynomial (V ⊕ V) ℂ := + ∑ ω, MvPolynomial.C (μ ω : ℂ) * permutationSymbol (π ω) + +lemma multiAffine_lawSymbol (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) : + MultiAffine (lawSymbol μ π) := by + intro i + apply (MvPolynomial.degreeOf_sum_le i Finset.univ _).trans + apply Finset.sup_le + intro ω _ + exact ((multiAffine_permutationSymbol (π ω)).const_mul (μ ω)) i + +omit [DecidableEq V] in +lemma lawSymbol_eval_one (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∑ ω, μ ω = 1) : + MvPolynomial.eval (fun _ => 1) (lawSymbol μ π) = 2 ^ Fintype.card V := by + simp only [lawSymbol, map_sum, map_mul, MvPolynomial.eval_C, permutationSymbol_eval_one] + rw [← Finset.sum_mul, ← Complex.ofReal_sum, hμ, Complex.ofReal_one, one_mul] + +omit [DecidableEq V] in +lemma lawSymbol_ne_zero (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∑ ω, μ ω = 1) : lawSymbol μ π ≠ 0 := by + intro hzero + have he := lawSymbol_eval_one μ π hμ + rw [hzero, map_zero] at he + exact (pow_ne_zero _ (by norm_num : (2 : ℂ) ≠ 0)) he.symm + +omit [Fintype V] in +lemma swap_output_map (i j : V) : + Sum.map (id : V → V) (Equiv.swap i j) = Equiv.swap (Sum.inr i) (Sum.inr j) := by + funext k + cases k with + | inl k => simp [Equiv.swap_apply_def] + | inr k => + by_cases hki : k = i <;> by_cases hkj : k = j <;> + simp [Equiv.swap_apply_def, hki, hkj] + +lemma lawSymbol_bernoulli (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (i j : V) (u : ℝ) : + lawSymbol (fun z : Bool × Ω => (if z.1 then u else 1 - u) * μ z.2) + (fun z : Bool × Ω => (if z.1 then Equiv.swap i j else 1) * π z.2) = + symmetrize (lawSymbol μ π) (Sum.inr i) (Sum.inr j) u := by + simp only [lawSymbol, Fintype.sum_prod_type, Fintype.sum_bool, ite_true, + Bool.false_eq_true, ite_false, one_mul] + unfold symmetrize + rw [map_sum, Finset.mul_sum, Finset.mul_sum] + simp only [map_mul, MvPolynomial.rename_C] + rw [add_comm] + apply congrArg₂ (· + ·) + · apply Finset.sum_congr rfl + intro ω _ + push_cast + rw [map_mul, mul_assoc] + · apply Finset.sum_congr rfl + intro ω _ + rw [← swap_output_map, rename_permutationSymbol] + push_cast + rw [map_mul, mul_assoc] + +theorem stable_lawSymbol_bernoulli (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hs : Stable (lawSymbol μ π)) (i j : V) {u : ℝ} (h0 : 0 ≤ u) (h1 : u ≤ 1) : + Stable (lawSymbol (fun z : Bool × Ω => (if z.1 then u else 1 - u) * μ z.2) + (fun z : Bool × Ω => (if z.1 then Equiv.swap i j else 1) * π z.2)) := by + rw [lawSymbol_bernoulli] + exact stable_symmetrize hs (multiAffine_lawSymbol μ π) _ _ h0 h1 + +omit [DecidableEq V] in +lemma lawSymbol_deterministic_output (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (τ : Equiv.Perm V) : + lawSymbol μ (fun ω => τ * π ω) = MvPolynomial.rename (Sum.map id τ) (lawSymbol μ π) := by + simp only [lawSymbol, map_sum, map_mul, MvPolynomial.rename_C, rename_permutationSymbol] + +omit [DecidableEq V] in + +theorem stable_lawSymbol_limit {ι : Type*} {φ : Filter ι} [φ.NeBot] + (μ : ι → Ω → ℝ) (ν : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hc : ∀ ω, Filter.Tendsto (fun i => μ i ω) φ (nhds (ν ω))) + (hν : ∑ ω, ν ω = 1) (hs : ∀ᶠ i in φ, Stable (lawSymbol (μ i) π)) : + Stable (lawSymbol ν π) := by + apply stable_locallyUniform_limit (lawSymbol_ne_zero ν π hν) _ hs + simp only [lawSymbol, map_sum, map_mul, MvPolynomial.eval_C] + apply locallyUniform_finset_sum + intro ω _ + apply TendstoLocallyUniformlyOn.mul₀ + · exact ((Complex.continuous_ofReal.tendsto (ν ω)).comp (hc ω)).tendstoUniformlyOn_const + Upper |>.tendstoLocallyUniformlyOn + · exact locallyUniform_const φ _ Upper + · exact continuousOn_const + · exact (permutationSymbol (π ω)).continuous_eval.continuousOn + +end Heisenberg.Pin + +namespace Heisenberg.Pin +variable {V Ω : Type*} [Fintype V] [DecidableEq V] [Fintype Ω] + +def partialSymbol (π : V → V) (U : Finset V) : MvPolynomial (V ⊕ V) ℂ := + ∏ i ∈ U, (MvPolynomial.X (Sum.inl i) + MvPolynomial.X (Sum.inr (π i))) + +omit [Fintype V] in +lemma partialSymbol_insert (π : V → V) (i : V) (U : Finset V) (hi : i ∉ U) : + partialSymbol π (insert i U) = + (MvPolynomial.X (Sum.inl i) + MvPolynomial.X (Sum.inr (π i))) * partialSymbol π U := by + simp [partialSymbol, hi] + +omit [Fintype V] in +lemma pderiv_partialSymbol (π : V → V) (i : V) (U : Finset V) : + MvPolynomial.pderiv (Sum.inl i) (partialSymbol π U) = + if i ∈ U then partialSymbol π (U.erase i) else 0 := by + induction U using Finset.induction_on with + | empty => simp [partialSymbol] + | @insert j U hj ih => + rw [partialSymbol_insert π j U hj, MvPolynomial.pderiv_mul, ih] + by_cases hij : i = j + · subst j + simp [hj] + · simp only [map_add, MvPolynomial.pderiv_X_of_ne (by simpa using Ne.symm hij : (Sum.inl j : V ⊕ V) ≠ Sum.inl i), + MvPolynomial.pderiv_X_of_ne (by simp : Sum.inr (π j) ≠ Sum.inl i), + zero_add, zero_mul, Finset.mem_insert, hij, false_or] + by_cases hi : i ∈ U + · rw [ite_eq_left hi, ite_eq_left hi, Finset.erase_insert_of_ne (Ne.symm hij)] + rw [partialSymbol_insert π j (U.erase i) (fun h => hj (Finset.mem_of_mem_erase h))] + · simp [hi] + +def partialLawSymbol (μ : Ω → ℝ) (π : Ω → V → V) (U : Finset V) : + MvPolynomial (V ⊕ V) ℂ := ∑ ω, MvPolynomial.C (μ ω : ℂ) * partialSymbol (π ω) U + +omit [Fintype V] [DecidableEq V] in +lemma partialLawSymbol_eval_one (μ : Ω → ℝ) (π : Ω → V → V) (U : Finset V) : + MvPolynomial.eval (fun _ => 1) (partialLawSymbol μ π U) = + ((∑ ω, μ ω : ℝ) : ℂ) * 2 ^ U.card := by + simp only [partialLawSymbol, partialSymbol, map_sum, map_mul, MvPolynomial.eval_C, + MvPolynomial.eval_prod, map_add, MvPolynomial.eval_X, one_add_one_eq_two, + Finset.prod_const] + rw [← Finset.sum_mul, Complex.ofReal_sum] + +omit [Fintype V] [DecidableEq V] in +lemma partialLawSymbol_ne_zero (μ : Ω → ℝ) (π : Ω → V → V) (U : Finset V) + (hμ : ∑ ω, μ ω ≠ 0) : partialLawSymbol μ π U ≠ 0 := by + intro hz + have he := partialLawSymbol_eval_one μ π U + rw [hz, map_zero] at he + exact mul_ne_zero (Complex.ofReal_ne_zero.mpr hμ) (pow_ne_zero _ (by norm_num)) he.symm + +omit [Fintype V] in +lemma pderiv_partialLawSymbol (μ : Ω → ℝ) (π : Ω → V → V) (U : Finset V) + (i : V) (hi : i ∈ U) : + MvPolynomial.pderiv (Sum.inl i) (partialLawSymbol μ π U) = + partialLawSymbol μ π (U.erase i) := by + simp only [partialLawSymbol, map_sum, MvPolynomial.pderiv_C_mul, + pderiv_partialSymbol, hi, ite_true] + +theorem stable_partialLawSymbol (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∑ ω, μ ω ≠ 0) (hs : Stable (lawSymbol μ π)) (U : Finset V) : + Stable (partialLawSymbol μ (fun ω => π ω) U) := by + have hall (B : Finset V) : Stable (partialLawSymbol μ (fun ω => π ω) (Finset.univ \ B)) := by + induction B using Finset.induction_on with + | empty => simpa [partialLawSymbol, partialSymbol, lawSymbol, permutationSymbol] using hs + | @insert i B hi ih => + have hm : i ∈ Finset.univ \ B := by simp [hi] + have he : (Finset.univ \ B).erase i = Finset.univ \ insert i B := by ext j; simp + have hd := stable_pderiv ih (Sum.inl i) + rw [pderiv_partialLawSymbol μ (fun ω => π ω) _ i hm, he] at hd + exact hd.resolve_left (partialLawSymbol_ne_zero μ _ _ hμ) + simpa using hall (Finset.univ \ U) + +def outputSymbol (μ : Ω → ℝ) (π : Ω → V → V) (T : Finset V) : MvPolynomial V ℂ := + ∑ ω, MvPolynomial.C (μ ω : ℂ) * ∏ i ∈ T, MvPolynomial.X (π ω i) + +omit [Fintype V] [DecidableEq V] in +lemma output_extraction (μ : Ω → ℝ) (π : Ω → V → V) (T : Finset V) : + boundarySection (partialLawSymbol μ π T) + (Sum.elim (fun _ => none) (fun i => some i)) (fun _ => 0) = outputSymbol μ π T := by + simp [boundarySection, partialLawSymbol, partialSymbol, outputSymbol] + +omit [Fintype V] [DecidableEq V] in +lemma outputSymbol_eval_one (μ : Ω → ℝ) (π : Ω → V → V) (T : Finset V) : + MvPolynomial.eval (fun _ => 1) (outputSymbol μ π T) = ((∑ ω, μ ω : ℝ) : ℂ) := by + simp [outputSymbol] + +theorem stable_outputSymbol (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∑ ω, μ ω ≠ 0) (hs : Stable (lawSymbol μ π)) (T : Finset V) : + Stable (outputSymbol μ (fun ω => π ω) T) := by + have hn : outputSymbol μ (fun ω => π ω) T ≠ 0 := by + intro hz + have he := outputSymbol_eval_one μ (fun ω => π ω) T + rw [hz, map_zero] at he + exact (Complex.ofReal_ne_zero.mpr hμ) he.symm + rw [← output_extraction] at hn ⊢ + exact stable_boundarySection (stable_partialLawSymbol μ π hμ hs T) + _ (fun _ => 0) hn + +end Heisenberg.Pin +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalClock.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..05573903b36b9725e5f41f71d2c3f0ed5560bd35 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalClock.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.Heisenberg.SpectralTransfer + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type} [Fintype X] [DecidableEq X] + +abbrev SiteEdges (R : X → X → Prop) := {e : X×X // R e.1 e.2} +abbrev ClockEdges (R : X → X → Prop) (ℓ : ℕ) := {e : (X×Fin ℓ)×(X×Fin ℓ) // R e.1.1 e.2.1} + +def clockEdgeEquiv (R : X → X → Prop) (ℓ : ℕ) : ClockEdges R ℓ ≃ SiteEdges R × (Fin ℓ×Fin ℓ) where + toFun e:=⟨⟨(e.val.1.1,e.val.2.1),e.property⟩,(e.val.1.2,e.val.2.2)⟩ + invFun e:=⟨((e.1.val.1,e.2.1),(e.1.val.2,e.2.2)),e.1.property⟩ + left_inv _:=rfl + right_inv _:=rfl + +def clockGenerator (R : X → X → Prop) (ℓ : ℕ) : Matrix ((X×Fin ℓ) → Bool) ((X×Fin ℓ) → Bool) ℝ := + ∑ e : ClockEdges R ℓ,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap e.val.1 e.val.2)-1) + +def spinGenerator (R : X → X → Prop) (ℓ : ℕ) : Matrix (X → Level ℓ) (X → Level ℓ) ℝ := + ∑ e : SiteEdges R,(spinBond ℓ e.val.1 e.val.2-((ℓ:ℝ)^2/4) • 1) + +lemma sum_clock_pair (ℓ : ℕ) (x y : X) : + (∑ a : Fin ℓ,∑ b : Fin ℓ,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (x,a) (y,b))-1))= + slotBond ℓ x y-((ℓ:ℝ)^2/4) • 1 := by + simp only [smul_sub,Finset.sum_sub_distrib,←Finset.smul_sum,slotBond] + simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin] + rw [←Nat.cast_smul_eq_nsmul ℝ,←Nat.cast_smul_eq_nsmul ℝ,smul_smul,smul_smul] + module + +lemma generator_intertwines (R : X → X → Prop) (hR : ∀ x y,R x y → x≠y) (ℓ : ℕ) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (clockGenerator R ℓ)*tensor (fun _ : X=>basis ℓ)= + tensor (fun _ : X=>basis ℓ)*spinGenerator R ℓ := by + let r:=Matrix.reindexAlgEquiv ℝ ℝ (configEquiv (X:=X) ℓ) + have hr (A : Matrix ((X×Fin ℓ) → Bool) ((X×Fin ℓ) → Bool) ℝ) : + r A=Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) A:=rfl + rw [←hr] + have he : clockGenerator R ℓ=∑ e : SiteEdges R,∑ a : Fin ℓ,∑ b : Fin ℓ, + (1/2:ℝ) • (SlotColor.matrix (Equiv.swap (e.val.1,a) (e.val.2,b))-1) := by + rw [clockGenerator,←(clockEdgeEquiv R ℓ).symm.sum_comp] + rw [Fintype.sum_prod_type] + simp only [Fintype.sum_prod_type] + rfl + rw [he] + simp only [sum_clock_pair,map_sum,map_sub,map_smul,map_one,Matrix.sum_mul,Matrix.sub_mul, + Matrix.smul_mul,Matrix.one_mul,spinGenerator,Matrix.mul_sum,Matrix.mul_sub, + Matrix.mul_smul,Matrix.mul_one] + apply Finset.sum_congr rfl + intro e _ + rw [hr,bond_intertwines ℓ (hR _ _ e.property)] + +end Heisenberg.SlotTensor +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSpectral.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSpectral.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f6b09babbf64bee297214202efa05ae60550cda --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSpectral.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.Heisenberg.SymmetrizedSurface + +namespace OAI + +attribute [instance] instDecidableEqFin instDecidableEqProd +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.TensorMatrix +variable {m n : Type} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] + +omit [DecidableEq m] [DecidableEq n] in +lemma trace_reindex_eq (e : m ≃ n) (A : Matrix m m ℝ) : + Matrix.trace (Matrix.reindex e e A)=Matrix.trace A := by + exact e.symm.sum_comp (fun i=>A i i) + +lemma reindex_exp (e : m ≃ n) (A : Matrix m m ℝ) : + Matrix.reindex e e (NormedSpace.exp A)=NormedSpace.exp (Matrix.reindex e e A) := + NormedSpace.map_exp (Matrix.reindexAlgEquiv ℝ ℝ e) + (Matrix.reindexAlgEquiv ℝ ℝ e).toLinearMap.continuous_of_finiteDimensional A +lemma trace_reindex_exp_compression {p : Type} [Fintype p] [DecidableEq p] + (e : m ≃ p) (P A D : Matrix m m ℝ) (B E : Matrix n n ℝ) (V : Matrix p n ℝ) + (hV : V.transpose*V=1) (hP : Matrix.reindex e e P=V*V.transpose) + (hAB : Matrix.reindex e e A*V=V*B) (hDE : Matrix.reindex e e D*V=V*E) : + Matrix.trace (P*NormedSpace.exp A*D)=Matrix.trace (NormedSpace.exp B*E) := by + let r:=Matrix.reindexAlgEquiv ℝ ℝ e + rw [←trace_reindex_eq e] + change Matrix.trace (r (P*NormedSpace.exp A*D))=_ + rw [_root_.map_mul,_root_.map_mul] + change Matrix.trace (Matrix.reindex e e P * Matrix.reindex e e (NormedSpace.exp A) * Matrix.reindex e e D)=_ + rw [hP,reindex_exp] + exact trace_exp_compression _ _ _ hV hAB _ _ hDE + +end Heisenberg.TensorMatrix + +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type} [Fintype X] [DecidableEq X] + +omit [DecidableEq X] in +lemma reindex_spectral (ℓ : ℕ) (f : ℝ → ℝ) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (Matrix.diagonal (fun c : (X×Fin ℓ) → Bool=>f (SlotColor.magnetization c)))= + Matrix.diagonal (fun a : X → Config ℓ=>f (configMagnetization ℓ a)) := by + ext a b + by_cases hab : a=b + · subst b + simp only [Matrix.reindex_apply,Matrix.submatrix_apply,Matrix.diagonal_apply_eq,color_config_mag] + · have he : (configEquiv ℓ).symm a ≠ (configEquiv ℓ).symm b := fun hh=>hab ((configEquiv ℓ).symm.injective hh) + simp only [Matrix.reindex_apply,Matrix.submatrix_apply,Matrix.diagonal_apply_ne _ he, + Matrix.diagonal_apply_ne _ hab] + +theorem trace_clock_spectral (R : X → X → Prop) (hR : ∀ x y,R x y → x≠y) + (ℓ : ℕ) (t : ℝ) (f : ℝ → ℝ) : + Matrix.trace (Surface.colorSymmetrizer X ℓ * NormedSpace.exp (t • clockGenerator R ℓ) * + Matrix.diagonal (fun c : (X×Fin ℓ) → Bool=>f (SlotColor.magnetization c)))= + Matrix.trace (NormedSpace.exp (t • spinGenerator R ℓ) * + Matrix.diagonal (fun k : X → Level ℓ=>f (physicalMagnetization ℓ k))) := by + have hAB : Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (t • clockGenerator R ℓ)*tensor (fun _ : X=>basis ℓ)= + tensor (fun _ : X=>basis ℓ)*(t • spinGenerator R ℓ) := by + have he := congrArg (fun M : Matrix (X → Config ℓ) (X → Level ℓ) ℝ=>t • M) + (generator_intertwines R hR ℓ) + have hs : Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (t • clockGenerator R ℓ) = + t • Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (clockGenerator R ℓ) := rfl + rw [hs,Matrix.smul_mul,Matrix.mul_smul] + exact he + have hDE : Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (Matrix.diagonal (fun c : (X×Fin ℓ) → Bool=>f (SlotColor.magnetization c)))*tensor (fun _ : X=>basis ℓ)= + tensor (fun _ : X=>basis ℓ)*Matrix.diagonal (fun k : X → Level ℓ=>f (physicalMagnetization ℓ k)) := by + rw [reindex_spectral] + exact diagonal_function_intertwines _ _ _ (total_diagonal_intertwines (X:=X) ℓ) f + have hP : Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (Surface.colorSymmetrizer X ℓ)= + tensor (fun _ : X=>basis ℓ)*(tensor (fun _ : X=>basis ℓ)).transpose := by + convert Surface.colorSymmetrizer_reindex X ℓ using 1; congr! 20 + exact trace_reindex_exp_compression (configEquiv ℓ) _ _ _ _ _ + (tensor (fun _ : X=>basis ℓ)) (basis_orthonormal ℓ) hP hAB hDE + +end Heisenberg.SlotTensor +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSurface.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSurface.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b97a9ee3d11c224bd0384adc7e0131d24d8a142 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalSurface.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinField + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +attribute [instance] instDecidableEqFin instDecidableEqProd +namespace Heisenberg.Surface +open Heisenberg.Geometry SpatialFrame SlotTensor TensorMatrix + +lemma cycleGenerator_eq {d ℓ q : ℕ} (Λ : Finset (Site d)) + (edge : Fin q ≃ Edges (B:=Fin ℓ) Step Λ) (a₀ b₀ : ℕ → Slots (B:=Fin ℓ) Λ) + (ha₀ : ∀ j : Fin q,a₀ j=(edge j).val.1) (hb₀ : ∀ j : Fin q,b₀ j=(edge j).val.2) : + (∑ j∈Finset.range q,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a₀ j) (b₀ j))-1))= + clockGenerator (fun x y : Λ=>Step x.val y.val) ℓ := by + rw [←Fin.sum_univ_eq_sum_range] + simp_rw [ha₀,hb₀] + exact edge.sum_comp (fun e : Edges (B:=Fin ℓ) Step Λ => + (1/2:ℝ) • (SlotColor.matrix (Equiv.swap e.val.1 e.val.2)-1)) + +lemma step_ne {d : ℕ} {x y : Site d} (h : Step x y) : x≠y := by + obtain ⟨j,hj,_⟩:=h + intro he + subst y + omega + +lemma spectral_tail_eq {X : Type} [Fintype X] (ℓ : ℕ) : + tailProjection (X×Fin ℓ)=Matrix.diagonal + (fun c : (X×Fin ℓ) → Bool=>if (Fintype.card X:ℝ)*ℓ/4≤SlotColor.magnetization c then (1:ℝ) else 0) := by + simp only [tailProjection,Fintype.card_prod,Fintype.card_fin,Nat.cast_mul] + +theorem physical_surface_bound (d ℓ : ℕ) (hd : 2≤d) [NeZero ℓ] : + ∃ s : ℝ,0v.1.val∉F)).card:ℝ) + let J:=(((Finset.range q).filter (fun j=>(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card:ℝ) + let E:=NormedSpace.exp (t • spinGenerator (fun x y : Λ=>Step x.val y.val) ℓ) + Real.exp (-(Real.log 2)*(Z+2*t*J))/2*Matrix.trace E≤ + Matrix.trace (E*Matrix.diagonal (fun k : Λ → SpinSlots.Level ℓ=> + if (Λ.card:ℝ)*ℓ/4≤physicalMagnetization ℓ k then (1:ℝ) else 0)) := by + obtain ⟨s,hs,hbound⟩:=symmetrized_surface_bound d ℓ hd + refine ⟨s,hs,?_⟩ + intro Λ F hΛ q _ edge a₀ b₀ ha₀ hb₀ hF hf t ht Z J E + have hh : Real.exp (-(Real.log 2)*(Z+2*t*J))/2* + Matrix.trace (colorSymmetrizer Λ ℓ*NormedSpace.exp (t • ∑ j∈Finset.range q, + (1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a₀ j) (b₀ j))-1)))≤ + Matrix.trace (colorSymmetrizer Λ ℓ*NormedSpace.exp (t • ∑ j∈Finset.range q, + (1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a₀ j) (b₀ j))-1))*tailProjection (Slots (B:=Fin ℓ) Λ)) := by + convert hbound Λ F hΛ q edge a₀ b₀ ha₀ hb₀ hF hf t ht using 1 <;> congr! 30 + rw [cycleGenerator_eq Λ edge a₀ b₀ ha₀ hb₀,spectral_tail_eq] at hh + have hn : ∀ x y : Λ,Step x.val y.val → x≠y := fun x y h he=>step_ne h (congrArg Subtype.val he) + have hb:=trace_clock_spectral (fun x y : Λ=>Step x.val y.val) hn ℓ t (fun _=>1) + simp only [Matrix.diagonal_one,Matrix.mul_one] at hb + rw [hb] at hh + have htail:=trace_clock_spectral (fun x y : Λ=>Step x.val y.val) hn ℓ t + (fun m=>if (Fintype.card Λ:ℝ)*ℓ/4≤ m then (1:ℝ) else 0) + rw [htail] at hh + simpa only [Fintype.card_coe] using hh + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalTilt.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalTilt.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8a3975632b5973238a386029629cc7959e2e03e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PhysicalTilt.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.Heisenberg.CubeSurface + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.Selection +open SlotTensor + +lemma matrix_tilt_mean {I : Type*} [Fintype I] [DecidableEq I] [Nonempty I] + (A : Matrix I I ℝ) (hA : A.transpose=A) (m : I → ℝ) (V b L : ℝ) + (hV : 0≤V) (hb : 0≤b) (hL : 0if V/4≤ m i then (1:ℝ) else 0))) + (hsmall : L⁻¹*Real.exp (-(b*V/16))≤1/11) : + V/8≤(∑ i,NormedSpace.exp A i i*Real.exp (b*m i)*m i)/ + tiltPartition (fun i=>NormedSpace.exp A i i) m b := by + have hw : ∀ i,0≤NormedSpace.exp A i i:=fun i=>(exp_diagonal_pos A hA i).le + have hp : 0<∑ i,NormedSpace.exp A i i:=exp_trace_pos A hA + rw [trace_spectral_tail] at htail + have ht:=tilt_tail_bound _ m hw hp hb hL htail (a:=3*V/16) + have he : b*(3*V/16-V/4)= -(b*V/16):=by ring + rw [he] at ht + have hbnd :=ht.trans hsmall + have hl:=tilt_mean_lower _ m hw hp b (3*V/16) (V/2) (by simpa only [neg_div] using hm) + nlinarith [mul_le_mul_of_nonneg_left hbnd (show 0≤3*V/16+V/2 by positivity)] + +lemma physical_field_mean {d ℓ : ℕ} (Λ : Finset (Site d)) + (τ : State d ℓ) (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + (β h L : ℝ) (hb : 0≤β*h) (hL : 0NearestNeighbor x.val y.val) ℓ))≤ + Matrix.trace (NormedSpace.exp ((β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ)* + Matrix.diagonal (fun k : Λ → SpinSlots.Level ℓ=>if (Λ.card:ℝ)*ℓ/4≤physicalMagnetization ℓ k then (1:ℝ) else 0))) + (hsmall : L⁻¹*Real.exp (-((β*h)*((Λ.card:ℝ)*ℓ)/16))≤1/11) : + (Λ.card:ℝ)*ℓ/8≤((gibbsState τ (shiftedField Λ h) β).functional (totalZ Λ)).re := by + rw [shiftedField_gibbs_totalZ Λ τ hτ] + apply matrix_tilt_mean _ _ _ _ _ _ (by positivity) hb hL _ htail hsmall + · rw [Matrix.transpose_smul,spinGenerator_transpose _ + (fun x y h he=>nearestNeighbor_ne h (congrArg Subtype.val he))] + · intro k + simpa only [Fintype.card_coe,neg_mul] using (physicalMagnetization_bounds ℓ k).1 + +end Heisenberg.Selection +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinBridge.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..233bf05766689a1624e44d2d054d69cac2e2f719 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinBridge.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.Heisenberg.CutColors + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +attribute [-instance] instDecidableEqFin +@[reducible] local instance pinDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Cycle +open Heisenberg.Return +variable {V : Type*} [Fintype V] +lemma missing_iff_not_hit (π : Equiv.Perm V) (P : Set V) (v : V) : + v∈MissingSet π P ↔ ¬HasHit π P v := by + simp only [MissingSet,Set.mem_ofPred_eq,hasHit_iff_cycle] + simp only [not_exists,not_and,ne_eq,classOf_eq_iff] +end Heisenberg.Cycle + +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.Pin Heisenberg.Return Heisenberg.Serial Heisenberg.SparseWitness +variable {V : Type} [Fintype V] + +omit [Fintype V] in +lemma coinWiring_eq_history {m : ℕ} (s : Equiv.Perm (Fin m)) (a b : Fin m → V) : + LayeredExchange.coinWiring s a b=layerHistory s (fun i=>Equiv.swap (a i) (b i)) := by + funext c + apply congrArg (LayeredExchange.wiring s) + funext i + cases c i <;> rfl + +omit [Fintype V] in +lemma layerMass_pinDensity {m : ℕ} (s : Equiv.Perm (Fin m)) (a b : Fin m → V) + (P : Set (Fin m×V)) (p : Fin m → ℝ) (c : Fin m → Bool) : + layerMass s a b P p c=pinDensity (LayeredExchange.layerWeight p) + (LayeredExchange.coinWiring s a b) P c := by + simp only [layerMass,layerPartition,layerWeight,pinDensity,pinPartition,LayeredExchange.layerWeight,Bernoulli.weight,layerHistory,LayeredExchange.coinWiring,swap_classical] + +def cutAdmissible {X : Type} [PseudoMetricSpace X] {m : ℕ} (loc : V → X) + (α L : ℝ) (U : Finset (Fin m×V)) : Prop := + ∃ t J, U=J.image (fun j=>(t,j)) ∧ localGrowth loc α L J + +omit [Fintype V] in +lemma growth_subtype {X : Type} [PseudoMetricSpace X] (loc : V → X) + (α L : ℝ) (J : Finset V) (hg : localGrowth loc α L J) : + ∀ z r,0 ≤ r → ((Finset.univ.filter (fun j : J=>dist (loc j.val) z ≤ r)).card:ℝ) ≤ L*(1+r)^α := by + intro z r hr + have he : (Finset.univ.filter (fun j : J=>dist (loc j.val) z ≤ r)).card= + (J.filter (fun j=>dist (loc j) z ≤ r)).card := by + rw [←Finset.card_image_of_injective _ Subtype.val_injective] + congr 1 + ext j + simp [and_comm] + rw [he] + exact hg z r hr + +lemma cut_moment_of_induction {X : Type} [PseudoMetricSpace X] {m : ℕ} + (loc : V → X) (α L : ℝ) (s : Equiv.Perm (Fin m)) (a b : Fin m → V) + (P : Set (Fin m×V)) (rates : Fin m → ℝ) (p : ℝ) + (hIH : ∀ U : Finset (Fin m×V),cutAdmissible loc α L U → Disjoint P (U:Set (Fin m×V)) → + (∑ c,if ∀ j∈U,¬HasHit (LayeredExchange.coinWiring s a b c) P j then + pinDensity (LayeredExchange.layerWeight rates) (LayeredExchange.coinWiring s a b) P c else 0) ≤ p^U.card) : + ∀ t U,localGrowth loc α L U → (∀ j∈U,(t,j)∉P) → + (∑ c,if ∀ j∈U,(t,j)∈MissingSet (layerHistory s (fun i=>Equiv.swap (a i) (b i)) c) P then + layerMass s a b P rates c else 0) ≤ p^U.card := by + intro t U hU hP + have hh:=hIH (U.image (fun j=>(t,j))) ⟨t,U,rfl,hU⟩ (by + apply Set.disjoint_left.mpr + intro z hz hzu + obtain ⟨j,hj,rfl⟩:=Finset.mem_image.mp hzu + exact hP j hj hz) + have hinj : Function.Injective (fun j : V=>(t,j)) := fun _ _ h=>(Prod.mk.inj h).2 + simpa only [Finset.card_image_of_injective _ hinj,Finset.forall_mem_image, + missing_iff_not_hit,layerMass_pinDensity,layerHistory,LayeredExchange.coinWiring] using hh + +lemma returnFraction_layer {m : ℕ} (s : Equiv.Perm (Fin m)) (a b : Fin m → V) + (rates : Fin m → ℝ) (E : Set (Fin m×V)) (U : Finset (Fin m×V)) : + returnFraction (LayeredExchange.layerWeight rates) (LayeredExchange.coinWiring s a b) E U= + (∑ c,layerMass s a b (E∪(U:Set (Fin m×V))) rates c * + returnCount (layerHistory s (fun i=>Equiv.swap (a i) (b i)) c) (E∪(U:Set (Fin m×V))) (testPins E U))/U.card := by + unfold returnFraction returnCount + rw [coinWiring_eq_history] + congr 1 + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro c _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + rw [layerMass_pinDensity,coinWiring_eq_history] + split_ifs <;> simp_all only [mul_one,mul_zero] + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinDensity.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e85d6c64ce3028daabc558b61858cd8f657c5b1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinDensity.lean @@ -0,0 +1,316 @@ +import OAI.MathematicalPhysics.Heisenberg.SimultaneousPins + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical + +namespace Heisenberg.Pin +attribute [-instance] Subtype.instDecidableEq +open Heisenberg.Cycle Heisenberg.Return +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +lemma pinDensity_comparison (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (E : Set V) (T : Finset V) (ω : Ω) : + pinDensity μ π E ω ≤ (2 : ℝ) ^ T.card * pinDensity μ π (E ∪ (T : Set V)) ω := by + have hZ : pinPartition μ π (E ∪ (T : Set V)) ≤ pinPartition μ π E := by + apply Finset.sum_le_sum + intro o _ + exact mul_le_mul_of_nonneg_left (pin_weight_comparison (π o) E T).1 (hμ o) + have hn : μ ω * (2 : ℝ) ^ missingCount (π ω) E ≤ + (2 : ℝ) ^ T.card * (μ ω * (2 : ℝ) ^ missingCount (π ω) (E ∪ (T : Set V))) := by + calc + _ ≤ μ ω * ((2 : ℝ) ^ T.card * (2 : ℝ) ^ missingCount (π ω) (E ∪ (T : Set V))) := + mul_le_mul_of_nonneg_left (pin_weight_comparison (π ω) E T).2 (hμ ω) + _ = _ := by ring + have hμω := hμ ω + unfold pinDensity + rw [← mul_div_assoc] + exact div_le_div₀ (by positivity) hn (pinPartition_pos μ π hμ hpos _) hZ + +def testPins (E : Set V) (T : Finset V) : Finset ↥(E ∪ (T : Set V)) := + T.subtype (fun i => i ∈ E ∪ (T : Set V)) + +omit [Fintype V] in +@[simp] lemma mem_testPins (E : Set V) (T : Finset V) (i : ↥(E ∪ (T : Set V))) : + i ∈ testPins E T ↔ (i : V) ∈ T := Finset.mem_subtype + +omit [Fintype V] in +@[simp] lemma card_testPins (E : Set V) (T : Finset V) : + (testPins E T).card = T.card := by + rw [testPins, Finset.card_subtype, Finset.filter_eq_self.mpr] + intro i hi + exact Or.inr hi + +lemma testPins_event (π : Equiv.Perm V) (E : Set V) (T : Finset V) + (hET : Disjoint E (T : Set V)) : + (∀ i ∈ testPins E T, nextPermutation π (E ∪ (T : Set V)) i ∈ testPins E T) ↔ + ∀ i ∈ T, ¬ HasHit π E i := by + refine Iff.trans ?_ (nextPoint_preserves_iff π E (T : Set V) hET) + simp only [mem_testPins] + constructor + · intro h i hi + exact h ⟨i, Or.inr hi⟩ hi + · intro h i hi + exact h i hi + +def returnFraction (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (E : Set V) (T : Finset V) : ℝ := + (∑ i ∈ testPins E T, ∑ ω, + if nextPermutation (π ω) (E ∪ (T : Set V)) i ∈ testPins E T + then pinDensity μ π (E ∪ (T : Set V)) ω else 0) / T.card + +lemma pinned_input_return_bound (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (hs : Stable (lawSymbol μ π)) + (P : Set V) (T : Finset P) (hT : T.Nonempty) : + (∑ ω, if ∀ i ∈ T, nextPermutation (π ω) P i ∈ T then pinDensity μ π P ω else 0) ≤ + ((∑ i ∈ T, ∑ ω, if nextPermutation (π ω) P i ∈ T then pinDensity μ π P ω else 0) + / T.card) ^ T.card := by + have h := finite_input_return_bound (pinDensity μ π P) + (fun ω => nextPermutation (π ω) P) (pinDensity_nonneg μ π hμ hpos P) + (pinDensity_sum μ π hμ hpos P) (stable_pinDensity μ π hμ hpos hs P) T hT + simpa only using h + +theorem finite_simultaneous_pin_test (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (hs : Stable (lawSymbol μ π)) + (E : Set V) (T : Finset V) (hT : T.Nonempty) (hET : Disjoint E (T : Set V)) : + (∑ ω, if ∀ i ∈ T, ¬ HasHit (π ω) E i then pinDensity μ π E ω else 0) ≤ + (2 * returnFraction μ π E T) ^ T.card := by + have hTP : (testPins E T).Nonempty := by + obtain ⟨i, hi⟩ := hT + exact ⟨⟨i, Or.inr hi⟩, (mem_testPins E T _).mpr hi⟩ + have hb := pinned_input_return_bound μ π hμ hpos hs (E ∪ (T : Set V)) + (testPins E T) hTP + simp only [testPins_event _ _ _ hET, card_testPins] at hb + change (∑ ω, if ∀ i ∈ T, ¬ HasHit (π ω) E i then + pinDensity μ π (E ∪ (T : Set V)) ω else 0) ≤ returnFraction μ π E T ^ T.card at hb + calc + _ ≤ ∑ ω, (2 : ℝ) ^ T.card * (if ∀ i ∈ T, ¬ HasHit (π ω) E i then + pinDensity μ π (E ∪ (T : Set V)) ω else 0) := by + apply Finset.sum_le_sum + intro ω _ + split_ifs + · exact pinDensity_comparison μ π hμ hpos E T ω + · simp + _ = (2 : ℝ) ^ T.card * (∑ ω, if ∀ i ∈ T, ¬ HasHit (π ω) E i then + pinDensity μ π (E ∪ (T : Set V)) ω else 0) := (Finset.mul_sum ..).symm + _ ≤ (2 : ℝ) ^ T.card * returnFraction μ π E T ^ T.card := + mul_le_mul_of_nonneg_left hb (by positivity) + _ = _ := (mul_pow ..).symm + +end Heisenberg.Pin + +namespace Heisenberg.FiniteExchange +open Pin +open scoped Classical + +def Bits : ℕ → Type + | 0 => PUnit + | n+1 => Bool × Bits n +instance bitsFintype : (n : ℕ) → Fintype (Bits n) + | 0 => inferInstanceAs (Fintype PUnit) + | n+1 => @instFintypeProd Bool (Bits n) inferInstance (bitsFintype n) + +def weight (p : ℕ → ℝ) : (n : ℕ) → Bits n → ℝ + | 0, _ => 1 + | n+1, b => (if b.1 then p n else 1-p n) * weight p n b.2 + +def endpoint {V : Type*} [DecidableEq V] (a b : ℕ → V) (initial : Equiv.Perm V) : + (n : ℕ) → Bits n → Equiv.Perm V + | 0, _ => initial + | n+1, c => (if c.1 then Equiv.swap (a n) (b n) else 1) * endpoint a b initial n c.2 + +lemma weight_nonneg (p : ℕ → ℝ) (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (n : ℕ) (c : Bits n) : 0 ≤ weight p n c := by + induction n with + | zero => exact zero_le_one + | succ n ih => + apply mul_nonneg _ (ih c.2) + rcases c with ⟨x,c⟩ + cases x <;> simp only [Bool.false_eq_true,ite_false,ite_true] + · exact sub_nonneg.mpr (hp n).2 + · exact (hp n).1 + +lemma weight_sum (p : ℕ → ℝ) (n : ℕ) : ∑ c, weight p n c = 1 := by + induction n with + | zero => + change (∑ c : PUnit, (1 : ℝ)) = 1 + simp + | succ n ih => + change (∑ c : Bool × Bits n, (if c.1 then p n else 1-p n) * weight p n c.2) = 1 + rw [Fintype.sum_prod_type,Fintype.sum_bool] + simp only [ite_true,Bool.false_eq_true,ite_false,← Finset.mul_sum,ih,mul_one] + ring + +theorem endpoint_stable {V : Type*} [Fintype V] [DecidableEq V] + (a b : ℕ → V) (initial : Equiv.Perm V) (p : ℕ → ℝ) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) (n : ℕ) : + Stable (lawSymbol (weight p n) (endpoint a b initial n)) := by + induction n with + | zero => + have h : lawSymbol (weight p 0) (endpoint a b initial 0) = permutationSymbol initial := by + change (∑ _ : PUnit, MvPolynomial.C ((1 : ℝ) : ℂ) * permutationSymbol initial) = _ + simp + rw [h] + exact stable_permutationSymbol initial + | succ n ih => + exact stable_lawSymbol_bernoulli (weight p n) (endpoint a b initial n) ih + (a n) (b n) (hp n).1 (hp n).2 + +end Heisenberg.FiniteExchange + +namespace Heisenberg.FiniteExchange +open Pin Return +variable {V : Type*} [Fintype V] + +theorem finite_history_pin_test + (a b : ℕ → V) (initial : Equiv.Perm V) (p : ℕ → ℝ) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) (n : ℕ) + (E : Set V) (T : Finset V) (hT : T.Nonempty) (hET : Disjoint E (T : Set V)) : + (∑ c : Bits n, if ∀ i ∈ T, ¬ HasHit (endpoint a b initial n c) E i then + pinDensity (weight p n) (endpoint a b initial n) E c else 0) ≤ + (2 * returnFraction (weight p n) (endpoint a b initial n) E T) ^ T.card := by + exact finite_simultaneous_pin_test (weight p n) (endpoint a b initial n) + (weight_nonneg p hp n) (by rw [weight_sum]; exact zero_lt_one) + (endpoint_stable a b initial p hp n) E T hT hET + +end Heisenberg.FiniteExchange + +namespace Heisenberg.Exposure +variable {B : Type*} +end Heisenberg.Exposure +namespace Heisenberg.LayeredExchange +variable {T V : Type*} + +end Heisenberg.LayeredExchange + +namespace Heisenberg.Exposure +variable {A B : Type*} [Monoid A] [Monoid B] + +end Heisenberg.Exposure +namespace Heisenberg.LayeredExchange +open Exposure +variable {T V : Type*} + +end Heisenberg.LayeredExchange + +namespace Heisenberg.Pin +open Exposure +variable {V Ω Ψ : Type*} [Fintype V] [Fintype Ω] [Fintype Ψ] + +lemma lawSymbol_reparam (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (e : Ψ ≃ Ω) : + lawSymbol (μ ∘ e) (π ∘ e) = lawSymbol μ π := by + exact e.sum_comp (fun ω => MvPolynomial.C (μ ω : ℂ) * permutationSymbol (π ω)) + +lemma stable_array (n : ℕ) (a b : Fin n → V) (p : Fin n → ℝ) + (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) : + Stable (lawSymbol (fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i) + (fun c => orderedProduct n (fun i => if c i then Equiv.swap (a i) (b i) else 1))) := by + classical + induction n with + | zero => simpa [lawSymbol,orderedProduct] using stable_permutationSymbol (1 : Equiv.Perm V) + | succ n ih => + have ht := ih (fun i => a i.succ) (fun i => b i.succ) (fun i => p i.succ) (fun i => hp i.succ) + have hh := stable_lawSymbol_bernoulli + (fun c : Fin n → Bool => ∏ i,if c i then p i.succ else 1-p i.succ) + (fun c => orderedProduct n (fun i => if c i then Equiv.swap (a i.succ) (b i.succ) else 1)) + ht (a 0) (b 0) (hp 0).1 (hp 0).2 + rw [←lawSymbol_reparam _ _ (splitArray n)] at hh + convert hh using 1 + congr 1 + funext c + exact Fin.prod_univ_succ _ + +end Heisenberg.Pin + +namespace Heisenberg.LayeredExchange +attribute [-instance] instDecidableEqProd +open Exposure Pin Return +variable {V : Type*} [Fintype V] + +theorem stable_wiring {n : ℕ} (s : Equiv.Perm (Fin n)) + (a b : Fin n → V) (p : Fin n → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) : + Stable (lawSymbol (fun c : Fin n → Bool => ∏ i,if c i then p i else 1-p i) + (fun c => wiring s (fun i => if c i then Equiv.swap (a i) (b i) else 1))) := by + classical + have h := stable_array n (fun i => (i,a i)) (fun i => (i,b i)) p hp + have hh := stable_rename_outputs h (Equiv.prodCongr s (Equiv.refl V)) + rw [←lawSymbol_deterministic_output] at hh + convert hh using 1 + apply congrArg (lawSymbol _) + funext c + rw [wiring,fibers_ordered_product] + congr 1 + congr 1 + funext i + cases c i <;> simp only [Bool.false_eq_true,ite_false,ite_true,fibers_swap] + · simp [fibers_one] + · ext z <;> simp only [Equiv.swap_apply_def] <;> split_ifs <;> rfl + +def layerWeight {n : ℕ} (p : Fin n → ℝ) (c : Fin n → Bool) : ℝ := + ∏ i,if c i then p i else 1-p i + +def coinWiring {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (c : Fin n → Bool) : Equiv.Perm (Fin n × V) := + wiring s (fun i => if c i then Equiv.swap (a i) (b i) else 1) + +lemma layerWeight_nonneg {n : ℕ} (p : Fin n → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) : + ∀ c,0 ≤ layerWeight p c := by + intro c + apply Finset.prod_nonneg + intro i _ + split_ifs <;> linarith [(hp i).1,(hp i).2] + +lemma layerWeight_sum {n : ℕ} (p : Fin n → ℝ) : (∑ c,layerWeight p c)=1 := by + unfold layerWeight + rw [←Fintype.prod_sum (fun i (c : Bool) => if c then p i else 1-p i)] + simp + +lemma coinWiring_stable {n : ℕ} (s : Equiv.Perm (Fin n)) (a b : Fin n → V) + (p : Fin n → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) : + Stable (lawSymbol (layerWeight p) (coinWiring s a b)) := stable_wiring s a b p hp + +attribute [local irreducible] pinDensity returnFraction lawSymbol wiring fibers layerWeight coinWiring + +theorem layer_pin_test {n : ℕ} (s : Equiv.Perm (Fin n)) + (a b : Fin n → V) (p : Fin n → ℝ) (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) + (E : Set (Fin n × V)) (T : Finset (Fin n × V)) (hT : T.Nonempty) + (hET : Disjoint E (T : Set (Fin n × V))) : + (∑ c,if ∀ i ∈ T,¬HasHit (coinWiring s a b c) E i then + pinDensity (layerWeight p) (coinWiring s a b) E c else 0) ≤ + (2*returnFraction (layerWeight p) (coinWiring s a b) E T)^T.card := by + exact finite_simultaneous_pin_test (layerWeight p) (coinWiring s a b) + (layerWeight_nonneg p hp) (by rw [layerWeight_sum]; exact zero_lt_one) + (coinWiring_stable s a b p hp) E T hT hET + +end Heisenberg.LayeredExchange +end +end +end +end +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinSplicing.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinSplicing.lean new file mode 100644 index 0000000000000000000000000000000000000000..51b03a6169014cf6c1584258b4eb9680be180455 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinSplicing.lean @@ -0,0 +1,429 @@ +import OAI.MathematicalPhysics.Heisenberg.PermutationSymbols + +namespace OAI + +noncomputable section + +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate + +open scoped Classical +namespace Heisenberg.Pin + +section + +variable {V : Type*} [Fintype V] [DecidableEq V] + +def spliceVariables : Option V ⊕ Option V → Option (V ⊕ V) + | Sum.inl none => none + | Sum.inr none => none + | Sum.inl (some i) => some (Sum.inl i) + | Sum.inr (some i) => some (Sum.inr i) + +def eraseNone {σ : Type*} : MvPolynomial (Option σ) ℂ →ₐ[ℂ] MvPolynomial σ ℂ := + MvPolynomial.aeval (fun j => j.elim 0 MvPolynomial.X) + +def splice (p : MvPolynomial (Option V ⊕ Option V) ℂ) : MvPolynomial (V ⊕ V) ℂ := + eraseNone (MvPolynomial.pderiv none (MvPolynomial.rename spliceVariables p)) + +lemma eraseNone_rename_some {σ : Type*} (p : MvPolynomial σ ℂ) : + eraseNone (MvPolynomial.rename some p) = p := by + induction p using MvPolynomial.induction_on with + | C c => simp [eraseNone] + | add p q hp hq => simp [hp, hq] + | mul_X p i hp => + rw [map_mul, map_mul, hp] + simp [eraseNone] + +lemma pderiv_none_rename_some {σ : Type*} (p : MvPolynomial σ ℂ) : + MvPolynomial.pderiv none (MvPolynomial.rename some p) = 0 := by + classical + induction p using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp [hp, hq] + | mul_X p i hp => simp [hp] + +lemma eraseNone_X_none {σ : Type*} : + eraseNone (MvPolynomial.X (none : Option σ)) = 0 := by simp [eraseNone] + +lemma eraseNone_X_some {σ : Type*} (i : σ) : + eraseNone (MvPolynomial.X (some i)) = MvPolynomial.X i := by simp [eraseNone] + +omit [DecidableEq V] in +lemma renamed_symbol_fixed (π : Equiv.Perm (Option V)) (h : π none = none) : + MvPolynomial.rename spliceVariables (permutationSymbol π) = + (2 * MvPolynomial.X none) * + MvPolynomial.rename some (permutationSymbol (Equiv.removeNone π)) := by + have hs (i : V) : π (some i) = some (Equiv.removeNone π i) := by + apply Eq.symm + apply Equiv.removeNone_some + cases he : π (some i) with + | none => exact False.elim (Option.some_ne_none i (π.injective (he.trans h.symm))) + | some j => exact ⟨j, rfl⟩ + simp only [permutationSymbol, map_prod, Fintype.prod_option, map_mul, map_add, + MvPolynomial.rename_X, h, spliceVariables, hs] + congr 1 + ring + +theorem splice_permutationSymbol_fixed (π : Equiv.Perm (Option V)) (h : π none = none) : + splice (permutationSymbol π) = 2 * permutationSymbol (Equiv.removeNone π) := by + have hd : MvPolynomial.pderiv none (2 : MvPolynomial (Option (V ⊕ V)) ℂ) = 0 := + (MvPolynomial.pderiv none).map_natCast 2 + rw [splice, renamed_symbol_fixed π h, MvPolynomial.pderiv_mul] + simp [hd, pderiv_none_rename_some, eraseNone_rename_some, map_ofNat] + +omit [Fintype V] [DecidableEq V] in +lemma removeNone_at_predecessor (π : Equiv.Perm (Option V)) (a b : V) + (ha : π (some a) = none) (hb : π none = some b) : Equiv.removeNone π a = b := by + exact Option.some.inj ((Equiv.removeNone_none π ha).trans hb) + +omit [Fintype V] [DecidableEq V] in +lemma removeNone_off_predecessor (π : Equiv.Perm (Option V)) (a i : V) + (ha : π (some a) = none) (hi : i ≠ a) : + π (some i) = some (Equiv.removeNone π i) := by + apply Eq.symm + apply Equiv.removeNone_some + cases he : π (some i) with + | none => exact False.elim (hi (Option.some.inj (π.injective (he.trans ha.symm)))) + | some j => exact ⟨j, rfl⟩ + +lemma renamed_symbol_spliced (π : Equiv.Perm (Option V)) (a b : V) + (ha : π (some a) = none) (hb : π none = some b) : + MvPolynomial.rename spliceVariables (permutationSymbol π) = + (MvPolynomial.X none + MvPolynomial.X (some (Sum.inr b))) * + (MvPolynomial.X (some (Sum.inl a)) + MvPolynomial.X none) * + MvPolynomial.rename some + (∏ i ∈ Finset.univ.erase a, + (MvPolynomial.X (Sum.inl i) + MvPolynomial.X (Sum.inr (Equiv.removeNone π i)))) := by + rw [permutationSymbol, Fintype.prod_option] + rw [← Finset.mul_prod_erase Finset.univ (fun i : V => + MvPolynomial.X (Sum.inl (some i)) + MvPolynomial.X (Sum.inr (π (some i)))) + (Finset.mem_univ a)] + simp only [map_mul, map_add, map_prod, MvPolynomial.rename_X, ha, hb, + spliceVariables, mul_assoc] + congr 2 + apply Finset.prod_congr rfl + intro i hi + rw [removeNone_off_predecessor π a i ha (Finset.mem_erase.mp hi).1] + +theorem splice_permutationSymbol_nonfixed (π : Equiv.Perm (Option V)) + (h : π none ≠ none) : + splice (permutationSymbol π) = permutationSymbol (Equiv.removeNone π) := by + obtain ⟨b, hb⟩ := Option.ne_none_iff_exists'.mp h + have hi : π.symm none ≠ none := by simpa using h + obtain ⟨a, ha'⟩ := Option.ne_none_iff_exists'.mp hi + have ha : π (some a) = none := by rw [← ha']; exact π.apply_symm_apply none + rw [splice, renamed_symbol_spliced π a b ha hb, MvPolynomial.pderiv_mul] + simp only [pderiv_none_rename_some, mul_zero, add_zero, MvPolynomial.pderiv_mul, + map_add, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne (Option.some_ne_none _), + add_zero, zero_add, one_mul, mul_one, map_mul, eraseNone_X_none, + eraseNone_X_some, eraseNone_rename_some] + rw [permutationSymbol, ← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ a)] + rw [removeNone_at_predecessor π a b ha hb] + +end + +variable {V Ω : Type*} [Fintype V] [DecidableEq V] [Fintype Ω] + +lemma eraseNone_eq_boundarySection {σ : Type*} (p : MvPolynomial (Option σ) ℂ) : + eraseNone p = boundarySection p id (fun _ => 0) := by + simp only [eraseNone, boundarySection, MvPolynomial.aeval_def] + congr 1 + funext j + cases j <;> simp + +omit [DecidableEq V] in + +theorem stable_splice {p : MvPolynomial (Option V ⊕ Option V) ℂ} + (hp : Stable p) (hn : splice p ≠ 0) : Stable (splice p) := by + have hr : Stable (MvPolynomial.rename spliceVariables p) := by + intro z hz + rw [MvPolynomial.eval_rename] + exact hp (z ∘ spliceVariables) (fun i => hz (spliceVariables i)) + obtain hz | hd := stable_pderiv hr none + · exact False.elim (hn (by simp [splice, hz])) + rw [splice, eraseNone_eq_boundarySection] at hn ⊢ + exact stable_boundarySection hd id (fun _ => 0) hn + +omit [Fintype V] [DecidableEq V] in +lemma splice_add (p q : MvPolynomial (Option V ⊕ Option V) ℂ) : + splice (p + q) = splice p + splice q := by simp [splice] + +omit [Fintype V] [DecidableEq V] in +lemma splice_C_mul (c : ℂ) (p : MvPolynomial (Option V ⊕ Option V) ℂ) : + splice (MvPolynomial.C c * p) = MvPolynomial.C c * splice p := by + simp only [splice, map_mul, MvPolynomial.rename_C, MvPolynomial.pderiv_C_mul] + congr 1 + simp [eraseNone] + +omit [Fintype V] [DecidableEq V] in +lemma splice_sum (p : Ω → MvPolynomial (Option V ⊕ Option V) ℂ) : + splice (∑ ω, p ω) = ∑ ω, splice (p ω) := by simp [splice] + +def spliceWeight (π : Equiv.Perm (Option V)) : ℝ := if π none = none then 2 else 1 + +omit [Fintype V] [DecidableEq V] in +lemma spliceWeight_ge_one (π : Equiv.Perm (Option V)) : 1 ≤ spliceWeight π := by + unfold spliceWeight + split_ifs <;> norm_num + +lemma splice_permutationSymbol (π : Equiv.Perm (Option V)) : + splice (permutationSymbol π) = + MvPolynomial.C (spliceWeight π : ℂ) * permutationSymbol (Equiv.removeNone π) := by + by_cases h : π none = none + · rw [splice_permutationSymbol_fixed π h] + norm_num [spliceWeight, h, map_ofNat] + · rw [splice_permutationSymbol_nonfixed π h] + simp [spliceWeight, h] + +lemma splice_lawSymbol (μ : Ω → ℝ) (π : Ω → Equiv.Perm (Option V)) : + splice (lawSymbol μ π) = + lawSymbol (fun ω => μ ω * spliceWeight (π ω)) (fun ω => Equiv.removeNone (π ω)) := by + simp only [lawSymbol, splice_sum, splice_C_mul, splice_permutationSymbol, + Complex.ofReal_mul, map_mul, mul_assoc] + +omit [DecidableEq V] in +lemma lawSymbol_eval_one_general (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) : + MvPolynomial.eval (fun _ => 1) (lawSymbol μ π) = + ((∑ ω, μ ω : ℝ) : ℂ) * 2 ^ Fintype.card V := by + simp only [lawSymbol, permutationSymbol, map_sum, map_mul, MvPolynomial.eval_C, + MvPolynomial.eval_prod, map_add, MvPolynomial.eval_X, one_add_one_eq_two, + Finset.prod_const, Finset.card_univ] + rw [← Finset.sum_mul, Complex.ofReal_sum] + +omit [DecidableEq V] in +lemma lawSymbol_ne_zero_general (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∑ ω, μ ω ≠ 0) : lawSymbol μ π ≠ 0 := by + intro hzero + have he := lawSymbol_eval_one_general μ π + rw [hzero, map_zero] at he + exact mul_ne_zero (Complex.ofReal_ne_zero.mpr hμ) (pow_ne_zero _ (by norm_num)) he.symm + +theorem stable_spliced_law (μ : Ω → ℝ) (π : Ω → Equiv.Perm (Option V)) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (hs : Stable (lawSymbol μ π)) : + Stable (lawSymbol (fun ω => μ ω * spliceWeight (π ω)) + (fun ω => Equiv.removeNone (π ω))) := by + rw [← splice_lawSymbol] + apply stable_splice hs + rw [splice_lawSymbol] + apply lawSymbol_ne_zero_general + apply ne_of_gt + apply hpos.trans_le + apply Finset.sum_le_sum + intro ω _ + exact le_mul_of_one_le_right (hμ ω) (spliceWeight_ge_one (π ω)) + +end Heisenberg.Pin + +namespace Heisenberg.Cycle + +open Equiv + +variable {V : Type*} + +def projection (π : Perm (Option V)) : Option V → Option (Classes (removeNone π)) + | some i => some (classOf (removeNone π) i) + | none => (π none).map (classOf (removeNone π)) + +lemma projection_apply (π : Perm (Option V)) (i : Option V) : + projection π (π i) = projection π i := by + cases i with + | none => + cases h : π none <;> simp [projection, h] + | some i => + cases h : π (some i) with + | none => + have he := removeNone_none π h + change (π none).map (classOf (removeNone π)) = _ + rw [← he] + simp [projection] + | some j => + have he := removeNone_some π ⟨j, h⟩ + have he' : removeNone π i = j := Option.some.inj (he.trans h) + simp only [projection] + rw [← he', classOf_apply] + +lemma projection_pow (π : Perm (Option V)) (n : ℕ) (i : Option V) : + projection π ((π ^ n) i) = projection π i := by + induction n with + | zero => rfl + | succ n hn => + rw [pow_succ', Perm.mul_apply, projection_apply, hn] + +variable [Fintype V] + +lemma sameCycle_removeNone_iff (π : Perm (Option V)) (i j : V) : + Perm.SameCycle (removeNone π) i j ↔ π.SameCycle (some i) (some j) := by + constructor + · intro h + obtain ⟨n, hn⟩ := h.exists_nat_pow_eq + have hstep (k : V) : π.SameCycle (some k) (some (removeNone π k)) := by + cases he : π (some k) with + | none => + rw [removeNone_none π he] + have h1 : π.SameCycle (some k) none := by + rw [← he] + exact (Perm.SameCycle.refl π _).apply_right + exact h1.apply_right + | some l => + rw [removeNone_some π ⟨l, he⟩] + exact (Perm.SameCycle.refl π _).apply_right + have hall (m : ℕ) : π.SameCycle (some i) (some ((removeNone π ^ m) i)) := by + induction m with + | zero => exact Perm.SameCycle.refl _ _ + | succ m hm => + rw [pow_succ', Perm.mul_apply] + exact hm.trans (hstep _) + simpa [hn] using hall n + · intro h + obtain ⟨n, hn⟩ := h.exists_nat_pow_eq + have he := projection_pow π n (some i) + rw [hn] at he + exact (classOf_eq_iff _ _ _).mp (Option.some.inj he).symm + +def classInclusion (π : Perm (Option V)) : Classes (removeNone π) → Classes π := + Quotient.map some (fun i j h => (sameCycle_removeNone_iff π i j).mp h) + +@[simp] lemma classInclusion_mk (π : Perm (Option V)) (i : V) : + classInclusion π (classOf (removeNone π) i) = classOf π (some i) := rfl + +lemma classInclusion_injective (π : Perm (Option V)) : + Function.Injective (classInclusion π) := by + intro a b h + induction a using Quotient.inductionOn with | _ i => + induction b using Quotient.inductionOn with | _ j => + exact (classOf_eq_iff _ _ _).mpr + ((sameCycle_removeNone_iff π i j).mpr ((classOf_eq_iff _ _ _).mp h)) + +lemma classInclusion_surjective (π : Perm (Option V)) (hn : π none ≠ none) : + Function.Surjective (classInclusion π) := by + intro c + induction c using Quotient.inductionOn with | _ i => + cases i with + | some i => exact ⟨classOf (removeNone π) i, rfl⟩ + | none => + obtain ⟨i, hi⟩ := Option.ne_none_iff_exists'.mp hn + refine ⟨classOf (removeNone π) i, ?_⟩ + simp only [classInclusion_mk] + rw [← hi, classOf_apply] + rfl + +lemma classInclusion_range_fixed (π : Perm (Option V)) (hfix : π none = none) : + Set.range (classInclusion π) = {c | c ≠ classOf π none} := by + ext c + constructor + · rintro ⟨a, rfl⟩ h + induction a using Quotient.inductionOn with | _ i => + have hs := (classOf_eq_iff π (some i) none).mp h + exact Option.some_ne_none i (hs.eq_of_right hfix) + · intro h + induction c using Quotient.inductionOn with | _ i => + cases i with + | none => exact False.elim (h rfl) + | some i => exact ⟨classOf (removeNone π) i, rfl⟩ + +lemma missingInclusion_condition (π : Perm (Option V)) (P : Set V) + (c : Classes (removeNone π)) : + (∀ i ∈ some '' P, classInclusion π c ≠ classOf π i) ↔ + ∀ i ∈ P, c ≠ classOf (removeNone π) i := by + constructor + · intro h i hi he + apply h (some i) ⟨i, hi, rfl⟩ + rw [he, classInclusion_mk] + · rintro h _ ⟨i, hi, rfl⟩ he + exact h i hi (classInclusion_injective π he) + +def missingInclusion (π : Perm (Option V)) (P : Set V) : + MissingClasses (removeNone π) P → MissingClasses π (some '' P) := + fun c => ⟨classInclusion π c.val, (missingInclusion_condition π P c.val).mpr c.property⟩ + +lemma missingInclusion_injective (π : Perm (Option V)) (P : Set V) : + Function.Injective (missingInclusion π P) := by + intro a b h + apply Subtype.ext + exact classInclusion_injective π (congrArg Subtype.val h) + +lemma missingInclusion_surjective (π : Perm (Option V)) (P : Set V) + (hn : π none ≠ none) : Function.Surjective (missingInclusion π P) := by + intro c + obtain ⟨a, ha⟩ := classInclusion_surjective π hn c.val + refine ⟨⟨a, (missingInclusion_condition π P a).mp (by simpa [ha] using c.property)⟩, ?_⟩ + exact Subtype.ext ha + +lemma missingCount_nonfixed (π : Perm (Option V)) (P : Set V) (hn : π none ≠ none) : + missingCount π (some '' P) = missingCount (removeNone π) P := by + unfold missingCount + exact (Nat.card_congr (Equiv.ofBijective (missingInclusion π P) + ⟨missingInclusion_injective π P, missingInclusion_surjective π P hn⟩)).symm + +omit [Fintype V] in +lemma none_missing (π : Perm (Option V)) (P : Set V) (hf : π none = none) : + ∀ i ∈ some '' P, classOf π none ≠ classOf π i := by + rintro _ ⟨i, _, rfl⟩ he + have hs := (classOf_eq_iff π none (some i)).mp he + exact Option.some_ne_none i (hs.eq_of_left hf).symm + +def missingOption (π : Perm (Option V)) (P : Set V) (hf : π none = none) : + Option (MissingClasses (removeNone π) P) → MissingClasses π (some '' P) + | none => ⟨classOf π none, none_missing π P hf⟩ + | some c => missingInclusion π P c + +lemma missingOption_injective (π : Perm (Option V)) (P : Set V) (hf : π none = none) : + Function.Injective (missingOption π P hf) := by + intro a b he + have hv := congrArg Subtype.val he + cases a with + | none => + cases b with + | none => rfl + | some b => + have hb : classInclusion π b.val ≠ classOf π none := by + have hr : classInclusion π b.val ∈ Set.range (classInclusion π) := ⟨b.val, rfl⟩ + rw [classInclusion_range_fixed π hf] at hr + exact hr + exact False.elim (hb hv.symm) + | some a => + cases b with + | none => + have ha : classInclusion π a.val ≠ classOf π none := by + have hr : classInclusion π a.val ∈ Set.range (classInclusion π) := ⟨a.val, rfl⟩ + rw [classInclusion_range_fixed π hf] at hr + exact hr + exact False.elim (ha hv) + | some b => exact congrArg some (missingInclusion_injective π P he) + +lemma missingOption_surjective (π : Perm (Option V)) (P : Set V) (hf : π none = none) : + Function.Surjective (missingOption π P hf) := by + classical + intro c + by_cases hc : c.val = classOf π none + · exact ⟨none, Subtype.ext hc.symm⟩ + · have hr : c.val ∈ Set.range (classInclusion π) := by + rw [classInclusion_range_fixed π hf] + exact hc + obtain ⟨a, ha⟩ := hr + refine ⟨some ⟨a, (missingInclusion_condition π P a).mp ?_⟩, Subtype.ext ha⟩ + simpa [ha] using c.property + +lemma missingCount_fixed (π : Perm (Option V)) (P : Set V) (hf : π none = none) : + missingCount π (some '' P) = missingCount (removeNone π) P + 1 := by + unfold missingCount + have he := Nat.card_congr (Equiv.ofBijective (missingOption π P hf) + ⟨missingOption_injective π P hf, missingOption_surjective π P hf⟩) + let _ : Fintype (MissingClasses (removeNone π) P) := Fintype.ofFinite _ + simpa only [Nat.card_eq_fintype_card, Fintype.card_option] using he.symm + +theorem cycle_weight_splice (π : Perm (Option V)) (P : Set V) : + (2 : ℝ) ^ missingCount π (some '' P) = + (if π none = none then 2 else 1) * (2 : ℝ) ^ missingCount (removeNone π) P := by + classical + by_cases hf : π none = none + · rw [ite_eq_left hf, missingCount_fixed π P hf, pow_succ, mul_comm] + · rw [ite_eq_right hf, missingCount_nonfixed π P hf, one_mul] + +end Heisenberg.Cycle + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinSymmetrization.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinSymmetrization.lean new file mode 100644 index 0000000000000000000000000000000000000000..738113ed9b0fcf5fe461cbda921695330e4be177 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinSymmetrization.lean @@ -0,0 +1,308 @@ +import OAI.MathematicalPhysics.Heisenberg.StableSections + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate + +namespace Heisenberg.Pin + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +def pairAssignment (i j : σ) (z w : ℂ) (k : σ) : ℂ := + if k = i then z else if k = j then w else 1 + +omit [Fintype σ] in +lemma prod_pairAssignment (A : Finset σ) (i j : σ) (hij : i ≠ j) (z w : ℂ) : + (∏ k ∈ A, pairAssignment i j z w k) = + (if i ∈ A then z else 1) * (if j ∈ A then w else 1) := by + have he (k : σ) : pairAssignment i j z w k = + (if k = i then z else 1) * (if k = j then w else 1) := by + by_cases hi : k = i + · subst k; simp [pairAssignment, hij] + · by_cases hj : k = j <;> simp [pairAssignment, hi, hj, Ne.symm hij] + simp_rw [he, Finset.prod_mul_distrib] + simp + +lemma ofReal_presence (μ : Finset σ → ℝ) (B : Finset σ) : + (presence μ B : ℂ) = ∑ A : Finset σ, if B ⊆ A then (μ A : ℂ) else 0 := by + simp [presence, apply_ite] + +lemma eval_presencePolynomial_pair (μ : Finset σ → ℝ) (B : Finset σ) + (i j : σ) (hij : i ≠ j) (hi : i ∉ B) (hj : j ∉ B) (z w : ℂ) : + MvPolynomial.eval (pairAssignment i j z w) (presencePolynomial μ B) = + (presence μ B : ℂ) + (presence μ (insert i B) : ℂ) * (z - 1) + + (presence μ (insert j B) : ℂ) * (w - 1) + + (presence μ (insert i (insert j B)) : ℂ) * (z - 1) * (w - 1) := by + simp only [presencePolynomial, map_sum, apply_ite, map_mul, MvPolynomial.eval_C, + map_zero, subsetMonomial, MvPolynomial.eval_prod, MvPolynomial.eval_X] + simp_rw [prod_pairAssignment _ i j hij z w] + simp_rw [ofReal_presence, Finset.sum_mul, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro A _ + by_cases hB : B ⊆ A + · by_cases hiA : i ∈ A <;> by_cases hjA : j ∈ A <;> + simp [Finset.insert_subset_iff, Finset.mem_sdiff, hi, hj, hB, hiA, hjA] <;> ring + · have hBi : ¬ insert i B ⊆ A := fun h => hB (Finset.Subset.trans (Finset.subset_insert _ _) h) + have hBj : ¬ insert j B ⊆ A := fun h => hB (Finset.Subset.trans (Finset.subset_insert _ _) h) + have hBij : ¬ insert i (insert j B) ⊆ A := fun h => hBj (Finset.Subset.trans (Finset.subset_insert _ _) h) + simp [hB, hBi, hBj, hBij] + +lemma presence_mono {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) + {B C : Finset σ} (hBC : B ⊆ C) : presence μ C ≤ presence μ B := by + unfold presence + apply Finset.sum_le_sum + intro A _ + by_cases hC : C ⊆ A + · simp [hC, Finset.Subset.trans hBC hC] + · simp only [ite_eq_right hC] + split_ifs + · exact hμ A + · exact le_rfl + +theorem presence_pair_inequality {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) + (hs : Stable (presencePolynomial μ ∅)) (B : Finset σ) (i j : σ) + (hij : i ≠ j) (hi : i ∉ B) (hj : j ∉ B) : + presence μ (insert i (insert j B)) * presence μ B ≤ + presence μ (insert i B) * presence μ (insert j B) := by + by_cases hB : presence μ B = 0 + · rw [hB, mul_zero] + exact mul_nonneg (presence_nonneg hμ _) (presence_nonneg hμ _) + have hBpos : 0 < presence μ B := lt_of_le_of_ne (presence_nonneg hμ B) (Ne.symm hB) + have hsB : Stable (presencePolynomial μ B) := + (stable_presencePolynomial hs B).resolve_left (presence_polynomial_ne_zero hBpos) + let f : σ → Option Bool := fun k => if k = i then some false else if k = j then some true else none + let q := boundarySection (presencePolynomial μ B) f (fun _ => (1 : ℂ)) + have evalq (z w : ℂ) : + MvPolynomial.eval (fun b : Bool => if b then w else z) q = + MvPolynomial.eval (pairAssignment i j z w) (presencePolynomial μ B) := by + rw [eval_boundarySection] + apply congrArg (fun z => MvPolynomial.eval z (presencePolynomial μ B)) + funext k + by_cases hki : k = i <;> by_cases hkj : k = j <;> simp [f, pairAssignment, hki, hkj, Ne.symm hij] + have hq : q ≠ 0 := by + intro h + have he := evalq 1 1 + simp only [h, map_zero] at he + have hone : pairAssignment i j 1 1 = fun _ => 1 := by funext k; simp [pairAssignment] + rw [hone, eval_presencePolynomial_one] at he + exact hB (by exact_mod_cast he.symm) + have hsq : Stable q := stable_boundarySection hsB f (fun _ => 1) hq + have hsection : StableSection + ((presence μ B - presence μ (insert i B) - presence μ (insert j B) + + presence μ (insert i (insert j B)) : ℝ) : ℂ) + ((presence μ (insert i B) - presence μ (insert i (insert j B)) : ℝ) : ℂ) + ((presence μ (insert j B) - presence μ (insert i (insert j B)) : ℝ) : ℂ) + (presence μ (insert i (insert j B)) : ℂ) := by + intro z w hz hw + have hn := hsq (fun b : Bool => if b then w else z) (by intro b; cases b <;> assumption) + rw [evalq, eval_presencePolynomial_pair μ B i j hij hi hj] at hn + convert hn using 1 + push_cast + unfold biaffine + ring + have hiq := stable_section_real_rayleigh hsection + nlinarith + +end Heisenberg.Pin + +namespace Heisenberg.Pin + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +theorem presence_insert_le {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) + (h₁ : presence μ ∅ = 1) (hs : Stable (presencePolynomial μ ∅)) + (B : Finset σ) (i : σ) (hi : i ∉ B) : + presence μ (insert i B) ≤ presence μ {i} * presence μ B := by + induction B using Finset.induction_on with + | empty => simp [h₁] + | @insert j B hj ih => + have hij : i ≠ j := fun h => hi (by simp [h]) + have hiB : i ∉ B := fun h => hi (Finset.mem_insert_of_mem h) + by_cases hB : presence μ B = 0 + · have hBi : presence μ (insert i (insert j B)) = 0 := by + apply le_antisymm + · calc + _ ≤ presence μ B := presence_mono hμ (B := B) + (C := insert i (insert j B)) (by intro k hk; simp [hk]) + _ = 0 := hB + · exact presence_nonneg hμ _ + rw [hBi] + exact mul_nonneg (presence_nonneg hμ _) (presence_nonneg hμ _) + have hp : 0 < presence μ B := lt_of_le_of_ne (presence_nonneg hμ B) (Ne.symm hB) + have hpair := presence_pair_inequality hμ hs B i j hij hiB hj + have hstep := mul_le_mul_of_nonneg_right (ih hiB) (presence_nonneg hμ (insert j B)) + apply (mul_le_mul_iff_left₀ hp).mp + calc + presence μ (insert i (insert j B)) * presence μ B + ≤ presence μ (insert i B) * presence μ (insert j B) := hpair + _ ≤ (presence μ {i} * presence μ B) * presence μ (insert j B) := hstep + _ = (presence μ {i} * presence μ (insert j B)) * presence μ B := by ring + +theorem presence_product {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) + (h₁ : presence μ ∅ = 1) (hs : Stable (presencePolynomial μ ∅)) + (J : Finset σ) : presence μ J ≤ ∏ j ∈ J, presence μ {j} := by + induction J using Finset.induction_on with + | empty => simp [h₁] + | @insert i J hi ih => + rw [Finset.prod_insert hi] + exact (presence_insert_le hμ h₁ hs J i hi).trans + (mul_le_mul_of_nonneg_left ih (presence_nonneg hμ _)) + +end Heisenberg.Pin + +namespace Heisenberg.Pin + +lemma product_le_mean_pow {σ : Type*} (J : Finset σ) (hJ : J.Nonempty) + (v : σ → ℝ) (hv : ∀ j ∈ J, 0 ≤ v j) : + (∏ j ∈ J, v j) ≤ ((∑ j ∈ J, v j) / J.card) ^ J.card := by + have hn : 0 < (J.card : ℝ) := by exact_mod_cast hJ.card_pos + have hmean := Real.geom_mean_le_arith_mean J (fun _ => 1) v (by intros; norm_num) + (by simpa using hn) hv + simp only [Real.rpow_one, Finset.sum_const, nsmul_eq_mul, mul_one, one_mul] at hmean + have hpow := pow_le_pow_left₀ (Real.rpow_nonneg (Finset.prod_nonneg hv) _) hmean J.card + rw [Real.rpow_inv_natCast_pow (Finset.prod_nonneg hv) (ne_of_gt hJ.card_pos)] at hpow + exact hpow + +theorem presence_mean_bound {σ : Type*} [Fintype σ] [DecidableEq σ] + {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) (h₁ : presence μ ∅ = 1) + (hs : Stable (presencePolynomial μ ∅)) (J : Finset σ) (hJ : J.Nonempty) : + presence μ J ≤ ((∑ j ∈ J, presence μ {j}) / J.card) ^ J.card := + (presence_product hμ h₁ hs J).trans + (product_le_mean_pow J hJ (fun j => presence μ {j}) (fun _ _ => presence_nonneg hμ _)) + +end Heisenberg.Pin + +namespace Heisenberg.Pin + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +def MultiAffine (p : MvPolynomial σ ℂ) : Prop := ∀ i, p.degreeOf i ≤ 1 + +lemma prod_pow_update (z : σ → ℂ) (i : σ) (u : ℂ) (a : σ →₀ ℕ) : + (∏ k, (Function.update z i u k) ^ a k) = + u ^ a i * ∏ k ∈ Finset.univ.erase i, z k ^ a k := by + rw [← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ i)] + simp only [Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro k hk + rw [Function.update_of_ne (Finset.mem_erase.mp hk).1] + +lemma eval_update_affine (p : MvPolynomial σ ℂ) (i : σ) (hi : p.degreeOf i ≤ 1) + (z : σ → ℂ) (u : ℂ) : + MvPolynomial.eval (Function.update z i u) p = + MvPolynomial.eval (Function.update z i 0) p + + (MvPolynomial.eval (Function.update z i 1) p - + MvPolynomial.eval (Function.update z i 0) p) * u := by + simp only [MvPolynomial.eval_eq', prod_pow_update] + rw [← Finset.sum_sub_distrib, Finset.sum_mul, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a ha + have hdeg : a i ≤ 1 := (MvPolynomial.degreeOf_le_iff.mp hi) a ha + interval_cases a i + · simp + · simp only [pow_one, zero_mul, mul_zero, sub_zero, zero_add]; ring + +lemma exists_biaffine_section (p : MvPolynomial σ ℂ) (hp : MultiAffine p) + (i j : σ) (hij : i ≠ j) (z : σ → ℂ) : + ∃ a b c e : ℂ, ∀ u v, + MvPolynomial.eval (Function.update (Function.update z i u) j v) p = + biaffine a b c e u v := by + let f (u v : ℂ) := MvPolynomial.eval (Function.update (Function.update z i u) j v) p + have hf (u v : ℂ) : f u v = f 0 v + (f 1 v - f 0 v) * u := by + unfold f + rw [Function.update_comm hij] + rw [eval_update_affine p i (hp i)] + simp only [Function.update_comm hij] + have hg (u v : ℂ) : f u v = f u 0 + (f u 1 - f u 0) * v := + eval_update_affine p j (hp j) _ _ + refine ⟨f 0 0, f 1 0 - f 0 0, f 0 1 - f 0 0, + f 1 1 - f 1 0 - f 0 1 + f 0 0, ?_⟩ + intro u v + change f u v = _ + rw [hf u v, hg 0 v, hg 1 v] + unfold biaffine + ring + +def symmetrize (p : MvPolynomial σ ℂ) (i j : σ) (u : ℝ) : MvPolynomial σ ℂ := + MvPolynomial.C (1 - (u : ℂ)) * p + + MvPolynomial.C (u : ℂ) * MvPolynomial.rename (Equiv.swap i j) p + +omit [Fintype σ] [DecidableEq σ] in +lemma MultiAffine.add {p q : MvPolynomial σ ℂ} (hp : MultiAffine p) + (hq : MultiAffine q) : MultiAffine (p + q) := + fun i => (MvPolynomial.degreeOf_add_le i p q).trans (max_le (hp i) (hq i)) + +omit [Fintype σ] [DecidableEq σ] in +lemma MultiAffine.const_mul {p : MvPolynomial σ ℂ} (hp : MultiAffine p) (c : ℂ) : + MultiAffine (MvPolynomial.C c * p) := by + intro i + exact (MvPolynomial.degreeOf_mul_le i _ _).trans (by simpa using hp i) + +omit [Fintype σ] [DecidableEq σ] in +lemma MultiAffine.rename {p : MvPolynomial σ ℂ} (hp : MultiAffine p) + (e : Equiv.Perm σ) : MultiAffine (MvPolynomial.rename e p) := by + intro i + have he := MvPolynomial.degreeOf_rename_of_injective (p := p) e.injective (e.symm i) + calc + MvPolynomial.degreeOf i (MvPolynomial.rename e p) = + MvPolynomial.degreeOf (e.symm i) p := by simpa using he + _ ≤ 1 := hp (e.symm i) + +omit [Fintype σ] in +lemma MultiAffine.symmetrize {p : MvPolynomial σ ℂ} (hp : MultiAffine p) + (i j : σ) (u : ℝ) : MultiAffine (symmetrize p i j u) := + (hp.const_mul _).add ((hp.rename (Equiv.swap i j)).const_mul _) + +theorem stable_symmetrize {p : MvPolynomial σ ℂ} (hp : Stable p) + (hm : MultiAffine p) (i j : σ) {u : ℝ} (h0 : 0 ≤ u) (h1 : u ≤ 1) : + Stable (symmetrize p i j u) := by + by_cases hij : i = j + · subst j + have he : symmetrize p i i u = p := by + simp only [symmetrize, Equiv.swap_self, Equiv.coe_refl, MvPolynomial.rename_id, AlgHom.id_apply] + rw [← add_mul, ← map_add] + simp + rw [he] + exact hp + intro z hz + obtain ⟨a, b, c, e, hsec⟩ := exists_biaffine_section p hm i j hij z + have hs : StableSection a b c e := by + intro v w hv hw + rw [← hsec v w] + apply hp + intro k + by_cases hj : k = j + · subst k; simpa using hw + by_cases hi : k = i + · subst k; simpa [Function.update_of_ne hij] using hv + simpa [Function.update_of_ne hj, Function.update_of_ne hi] using hz k + have hs' := partial_symmetrization hs h0 h1 (z i) (z j) (hz i) (hz j) + have hzself : Function.update (Function.update z i (z i)) j (z j) = z := by simp + have hzswap : Function.update (Function.update z i (z j)) j (z i) = z ∘ Equiv.swap i j := by + funext k + by_cases hi : k = i + · subst k; simp [hij] + by_cases hj : k = j + · subst k; simp + simp [Function.update_of_ne hi, Function.update_of_ne hj, + Equiv.swap_apply_of_ne_of_ne hi hj] + have heval : MvPolynomial.eval z (symmetrize p i j u) = + biaffine a ((1 - (u : ℂ)) * b + (u : ℂ) * c) + ((1 - (u : ℂ)) * c + (u : ℂ) * b) e (z i) (z j) := by + simp only [symmetrize, map_add, map_mul, MvPolynomial.eval_C, MvPolynomial.eval_rename] + rw [← hzself, hsec] + rw [hzself, ← hzswap, hsec] + unfold biaffine + ring + rwa [heval] + +end Heisenberg.Pin +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinnedColors.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinnedColors.lean new file mode 100644 index 0000000000000000000000000000000000000000..17faa9f6777fd1622819c1f12a155356c5fa5b70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinnedColors.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.Heisenberg.SlotColorTrace + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.Pin Heisenberg.Return +variable {V : Type*} [Fintype V] + +abbrev PinnedColor (π : Equiv.Perm V) (P : Set V) := + {c : V → Bool // (∀ i,c (π i)=c i) ∧ ∀ i∈P,c i=true} +instance (π : Equiv.Perm V) (P : Set V) : Fintype (PinnedColor π P) := Fintype.ofFinite _ +local instance (π : Equiv.Perm V) (P : Set V) : Fintype (MissingClasses π P) := Fintype.ofFinite _ + +lemma pinnedColor_sameCycle (π : Equiv.Perm V) (P : Set V) (c : PinnedColor π P) + {i j : V} (h : π.SameCycle i j) : c.val i=c.val j := + SlotColor.const_cycle π ⟨c.val,c.property.1⟩ h + +def pinnedColorEquiv (π : Equiv.Perm V) (P : Set V) : + PinnedColor π P ≃ (MissingClasses π P → Bool) where + toFun c q := Quotient.lift c.val (fun _ _ h=>pinnedColor_sameCycle π P c h) q.val + invFun ε := ⟨fun i=>if h : ∀ j∈P,classOf π i≠classOf π j then ε ⟨classOf π i,h⟩ else true,by + constructor + · intro i; simp only [classOf_apply] + · intro i hi; exact dite_eq_right (by intro h; exact h i hi rfl)⟩ + left_inv c := by + apply Subtype.ext + funext i + dsimp + split_ifs with h + · rfl + · obtain ⟨j,hj,hij⟩:=by simpa only [not_forall,not_not] using h + exact ((pinnedColor_sameCycle π P c ((classOf_eq_iff π i j).mp hij)).trans (c.property.2 j hj)).symm + right_inv ε := by + funext q + rcases q with ⟨q,hq⟩ + induction q using Quotient.inductionOn with | _ i => + dsimp + split_ifs with h + · rfl + · exact (h hq).elim + +lemma card_pinnedColor (π : Equiv.Perm V) (P : Set V) : + Fintype.card (PinnedColor π P)=2^missingCount π P := by + rw [Fintype.card_congr (pinnedColorEquiv π P),Fintype.card_fun,Fintype.card_bool] + rw [missingCount,Nat.card_eq_fintype_card] + +def halfSpin (b : Bool) : ℝ := if b then 1/2 else -1/2 + +lemma sum_halfSpin_bit {X : Type*} [Fintype X] (x : X) : + (∑ ε : X → Bool,halfSpin (ε x))=0 := by + let e : Equiv.Perm (X → Bool):=Equiv.piCongrRight (fun i=>if i=x then Equiv.boolNot else Equiv.refl Bool) + have hn (ε : X → Bool) : halfSpin (e ε x)= -halfSpin (ε x) := by + have he : e ε x= !(ε x) := by simp [e] + rw [he] + cases ε x <;> norm_num [halfSpin] + have hh:=Equiv.sum_comp e (fun ε : X → Bool=>halfSpin (ε x)) + simp_rw [hn,Finset.sum_neg_distrib] at hh + linarith + +lemma missing_iff_nohit (π : Equiv.Perm V) (P : Set V) (i : V) : + (∀ j∈P,classOf π i≠classOf π j) ↔ ¬HasHit π P i := by + rw [hasHit_iff_cycle] + simp only [not_exists,not_and] + constructor + · intro h j hj hs; exact h j hj ((classOf_eq_iff π i j).mpr hs) + · intro h j hj he; exact h j hj ((classOf_eq_iff π i j).mp he) + +theorem sum_pinned_spin (π : Equiv.Perm V) (P : Set V) (i : V) : + (∑ c : PinnedColor π P,halfSpin (c.val i))= + if HasHit π P i then (2:ℝ)^missingCount π P/2 else 0 := by + rw [←(pinnedColorEquiv π P).symm.sum_comp (fun c=>halfSpin (c.val i))] + by_cases hh : HasHit π P i + · have hm : ¬∀ j∈P,classOf π i≠classOf π j := fun h=>(missing_iff_nohit π P i).mp h hh + simp [hh,pinnedColorEquiv,hm,halfSpin,Fintype.card_bool,missingCount, + Nat.card_eq_fintype_card,div_eq_mul_inv] + · have hm:=(missing_iff_nohit π P i).mpr hh + rw [ite_eq_right hh] + change (∑ ε : MissingClasses π P → Bool, halfSpin (if h : ∀ j∈P,classOf π i≠classOf π j then ε ⟨classOf π i,h⟩ else true))=0 + simp only [dite_eq_left hm] + with_reducible convert sum_halfSpin_bit (X:=MissingClasses π P) ⟨classOf π i,hm⟩ using 1 + congr! 20 + +theorem pinned_trace (π : Equiv.Perm V) (P : Set V) (f : (V → Bool) → ℝ) : + Matrix.trace (SlotColor.matrix π * Matrix.diagonal (fun c=>if ∀ i∈P,c i=true then f c else 0))= + ∑ c : PinnedColor π P,f c.val := by + rw [SlotColor.trace_diagonal] + have he : (∑ c : V → Bool,if ∀ i,c (π i)=c i then (if ∀ i∈P,c i=true then f c else 0) else 0)= + ∑ c : V → Bool,if (∀ i,c (π i)=c i) ∧ (∀ i∈P,c i=true) then f c else 0 := by + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp_all + rw [he,←Finset.sum_filter] + exact Finset.sum_subtype _ (fun c=>by simp) f + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/PinnedMagnetization.lean b/lean/OAI/MathematicalPhysics/Heisenberg/PinnedMagnetization.lean new file mode 100644 index 0000000000000000000000000000000000000000..731ad0757569cc9a90e7a44c0a73bd99b14ee393 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/PinnedMagnetization.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.Heisenberg.PinnedColors + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.Pin Heisenberg.Return +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +def cutSpin (C : Finset V) (c : V → Bool) : ℝ := ∑ i∈C,halfSpin (c i) + +omit [Fintype V] in +lemma cutSpin_le (C : Finset V) (c : V → Bool) : cutSpin C c≤C.card/2 := by + calc + _ ≤ ∑ _i∈C,(1:ℝ)/2 := by + apply Finset.sum_le_sum + intro i _ + cases c i <;> norm_num [halfSpin] + _ = _ := by simp [div_eq_mul_inv] + +lemma sum_pinned_cutSpin (π : Equiv.Perm V) (P : Set V) (C : Finset V) : + (∑ c : PinnedColor π P,cutSpin C c.val)= + (2:ℝ)^missingCount π P/2 * ∑ i∈C,if HasHit π P i then (1:ℝ) else 0 := by + unfold cutSpin + rw [Finset.sum_comm] + simp_rw [sum_pinned_spin] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + split_ifs <;> simp + +lemma pinned_color_normalization (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0≤μ ω) (hpos : 0<∑ ω,μ ω) (P : Set V) : + (∑ ω,∑ _c : PinnedColor (π ω) P,μ ω/pinPartition μ π P)=1 := by + simp_rw [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,card_pinnedColor] + simp only [Nat.cast_pow,Nat.cast_ofNat] + have he : (∑ ω,(2:ℝ)^missingCount (π ω) P*μ ω)=pinPartition μ π P := by + unfold pinPartition + apply Finset.sum_congr rfl + intro ω _ + ring + simp_rw [←mul_div_assoc] + rw [←Finset.sum_div,he,div_self (ne_of_gt (pinPartition_pos μ π hμ hpos P))] + +lemma mean_pinned_cutSpin (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0≤μ ω) (hpos : 0<∑ ω,μ ω) (P : Set V) (C : Finset V) + (p : ℝ) (hmiss : ∀ i∈C,(∑ ω,if ¬HasHit (π ω) P i then pinDensity μ π P ω else 0)≤p) : + (1-p)*C.card/2 ≤ ∑ ω,∑ c : PinnedColor (π ω) P, + μ ω/pinPartition μ π P*cutSpin C c.val := by + have he : (∑ ω,∑ c : PinnedColor (π ω) P,μ ω/pinPartition μ π P*cutSpin C c.val)= + (∑ i∈C,(1-(∑ ω,if ¬HasHit (π ω) P i then pinDensity μ π P ω else 0))/2) := by + simp_rw [←Finset.mul_sum,sum_pinned_cutSpin,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + have hh (ω : Ω) : μ ω/pinPartition μ π P*((2:ℝ)^missingCount (π ω) P/2 * + (if HasHit (π ω) P i then 1 else 0))= + (pinDensity μ π P ω-(if ¬HasHit (π ω) P i then pinDensity μ π P ω else 0))/2 := by + unfold pinDensity + split_ifs <;> simp_all + ring + simp_rw [hh] + rw [←Finset.sum_div,Finset.sum_sub_distrib,pinDensity_sum μ π hμ hpos P] + rw [he] + calc + _ = ∑ _i∈C,(1-p)/2 := by simp [div_eq_mul_inv]; ring + _ ≤ _ := Finset.sum_le_sum (fun i hi=>by linarith [hmiss i hi]) + +theorem pinned_cut_tail (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0≤μ ω) (hpos : 0<∑ ω,μ ω) (P : Set V) (C : Finset V) + (hC : C.Nonempty) (p : ℝ) (hp : p≤1/4) + (hmiss : ∀ i∈C,(∑ ω,if ¬HasHit (π ω) P i then pinDensity μ π P ω else 0)≤p) : + (1:ℝ)/2 ≤ ∑ ω,∑ c : PinnedColor (π ω) P, + if C.card/4≤cutSpin C c.val then μ ω/pinPartition μ π P else 0 := by + have hZ:=pinPartition_pos μ π hμ hpos P + have hmean:=mean_pinned_cutSpin μ π hμ hpos P C p hmiss + have hn:=pinned_color_normalization μ π hμ hpos P + have hu : (∑ ω,∑ c : PinnedColor (π ω) P,μ ω/pinPartition μ π P*cutSpin C c.val)≤ + C.card/4+(C.card/4)*(∑ ω,∑ c : PinnedColor (π ω) P, + if C.card/4≤cutSpin C c.val then μ ω/pinPartition μ π P else 0) := by + calc + _ ≤ ∑ ω,∑ c : PinnedColor (π ω) P,((μ ω/pinPartition μ π P)*(C.card/4)+ + C.card/4*(if C.card/4≤cutSpin C c.val then μ ω/pinPartition μ π P else 0)) := by + apply Finset.sum_le_sum + intro ω _ + apply Finset.sum_le_sum + intro c _ + have hw:=div_nonneg (hμ ω) hZ.le + split_ifs with hh + · have hh':=mul_le_mul_of_nonneg_left (cutSpin_le C c.val) hw + nlinarith + · have hh':=mul_le_mul_of_nonneg_left (le_of_not_ge hh) hw + nlinarith + _ = _ := by + simp_rw [Finset.sum_add_distrib,←Finset.sum_mul,←Finset.mul_sum] + rw [hn] + ring + have hcard : (0:ℝ)K (j+1)) n*K 0 := by + induction n with + | zero => simp [prefixMatrix] + | succ n ih => + rw [prefixMatrix,ih,prefixMatrix,Matrix.mul_assoc] + +lemma prefix_congr (K L : ℕ → Matrix V V ℝ) (n : ℕ) + (h : ∀ j,j < n → K j=L j) : prefixMatrix K n=prefixMatrix L n := by + induction n with + | zero => rfl + | succ n ih => rw [prefixMatrix,prefixMatrix,h n (by omega),ih (fun j hj=>h j (by omega))] + +lemma prefix_reverse (K : ℕ → Matrix V V ℝ) (n a : ℕ) : + (prefixMatrix (fun j=>(K (a+n-1-j)).transpose) n).transpose= + prefixMatrix (fun j=>K (a+j)) n := by + induction n with + | zero => simp [prefixMatrix] + | succ n ih => + rw [prefix_cons,Matrix.transpose_mul,Matrix.transpose_transpose] + have he : prefixMatrix (fun j=>(K (a+(n+1)-1-(j+1))).transpose) n= + prefixMatrix (fun j=>(K (a+n-1-j)).transpose) n := by + apply prefix_congr + intro j hj + congr 2 + omega + rw [he,ih,prefixMatrix] + congr 1 + +omit [DecidableEq V] in +lemma squareNorm_toLp (f : EuclideanSpace ℝ V) : squareNorm f.ofLp=‖f‖^2 := by + simpa only [squareNorm,Real.norm_eq_abs,sq_abs] using (EuclideanSpace.norm_sq_eq f).symm + +lemma energy_two_prefixes (K : ℕ → Matrix V V ℝ) (N u v : ℕ) (huv : u+v ≤ N) + (hK : ∀ j,j < N → DoublySubstochastic (K j)) (f : EuclideanSpace ℝ V) : + ((‖f‖^2-‖euclideanMap (prefixMatrix K u) f‖^2)+ + (‖f‖^2-‖euclideanMap (prefixMatrix (fun j=>(K (N-1-j)).transpose) v) f‖^2))/2 ≤ + Heisenberg.Hitting.energy (prefixMatrix K N) f.ofLp := by + let A:=prefixMatrix K u + let M:=prefixMatrix (fun j=>K (u+j)) (N-v-u) + let B:=prefixMatrix (fun j=>K (N-v+j)) v + have hM : DoublySubstochastic M := prefix_substochastic _ _ (fun j hj=>hK _ (by omega)) + have he : prefixMatrix K N=B*M*A := by + have hN : N=(u+(N-v-u))+v := by omega + conv_lhs => rw [hN,prefix_add,prefix_add] + change prefixMatrix (fun j=>K (u+(N-v-u)+j)) v*(M*A)=B*M*A + have hu : u+(N-v-u)=N-v := by omega + rw [hu,Matrix.mul_assoc] + have hB : B.transpose=prefixMatrix (fun j=>(K (N-1-j)).transpose) v := by + have hh:=prefix_reverse K v (N-v) + have hNv : N-v+v=N := by omega + rw [hNv] at hh + exact (congrArg Matrix.transpose hh).symm.trans (Matrix.transpose_transpose _) + have hh:=two_ends A M B hM f.ofLp + rw [←he,hB] at hh + change (_+_)/2 ≤ _ at hh + have heE : Heisenberg.Hitting.energy (prefixMatrix K N) f.ofLp= + squareNorm f.ofLp-dot f.ofLp ((prefixMatrix K N)*ᵥ f.ofLp) := by + simp [Heisenberg.Hitting.energy,squareNorm,dot,Matrix.mulVec,dotProduct,mul_sub, + Finset.sum_sub_distrib,Finset.mul_sum,pow_two] + rw [heE] + convert hh using 1 + simp only [←squareNorm_toLp,A] + rfl + +end Heisenberg.MeshPair + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Matrix +namespace Heisenberg.Schedule +variable {m : ℕ} [NeZero m] + +lemma reverse_run (q : ℕ) (t : Fin m) (j : ℕ) : + reverseIndex q (run (reverseIndex q t) j)=t-(j:Fin m) := by + simp only [reverseIndex,Equiv.coe_fn_mk,run] + rw [sub_add_eq_sub_sub,sub_sub_cancel] + +lemma reverse_predecessor (q : ℕ) (t : Fin m) (j : ℕ) (hj : j < m) : + (finRotate m).symm (reverseIndex q (run (reverseIndex q t) j))=run t (m-1-j) := by + rw [reverse_run,finRotate_symm_apply] + have he : (m-1-j)+j+1=m := by omega + have hh : ((m-1-j:ℕ):Fin m)+(j:Fin m)+1=0 := by + calc + _ = ((m-1-j+j+1:ℕ):Fin m) := by simp only [Nat.cast_add,Nat.cast_one] + _ = 0 := by rw [he]; simp + apply add_right_cancel (b:=(j:Fin m)+1) + change (t-(j:Fin m)-1)+((j:Fin m)+1)=(t+((m-1-j:ℕ):Fin m))+((j:Fin m)+1) + rw [←sub_add_eq_sub_sub,sub_add_cancel,add_assoc,←add_assoc _ (j:Fin m),hh,add_zero] + +end Heisenberg.Schedule + +namespace Heisenberg.Exposure +open Heisenberg.Schedule Heisenberg.MeshPair +variable {T V : Type*} [Fintype T] [Fintype V] [DecidableEq V] + +omit [DecidableEq V] in +lemma layerSum_reverse (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) (p : T → ℝ) + (F : (T → Bool) → ℝ) : + (∑ c,layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm) c*F (c ∘ s))= + ∑ c,layerMass s a b P p c*F c := by + let e : (T → Bool) ≃ (T → Bool) := Equiv.arrowCongr s (Equiv.refl Bool) + rw [←e.sum_comp] + apply Finset.sum_congr rfl + intro c _ + change layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm) (c ∘ s.symm)*F ((c ∘ s.symm) ∘ s)=_ + rw [layerMass_reverse] + congr 2 + funext i + simp + +omit [Fintype T] in +lemma reversed_period_sweep {m : ℕ} [NeZero m] (q : ℕ) + (a b : Fin m → V) (P : Set (Fin m×V)) (p : Fin m → ℝ) + (base : Fin m → Bool) (I : Set V) (t : Fin m) (v : ℕ) (hv : v ≤ m) + (f : EuclideanSpace ℝ V) : + exposedSweep (finRotate m).symm (a ∘ (finRotate m).symm) (b ∘ (finRotate m).symm) + (base ∘ (finRotate m).symm) P I (p ∘ (finRotate m).symm) + (fun j=>reverseIndex q (run (reverseIndex q t) j)) v f= + euclideanMap (prefixMatrix + (fun j=>(exposedStep (finRotate m) a b base P I p (run t (m-1-j))).transpose) v) f := by + rw [exposedSweep_prefix] + apply congrArg (fun K=>euclideanMap K f) + apply prefix_congr + intro j hj + rw [exposedStep_reverse,reverse_predecessor q t j (lt_of_lt_of_le hj hv)] + +end Heisenberg.Exposure + +end +end + +noncomputable section +open scoped Classical Topology +open Set Filter Metric +namespace Heisenberg.Pin + +lemma nonzero_uniform_limit_disk {ι : Type*} {φ : Filter ι} [φ.NeBot] + {F : ι → ℂ → ℂ} {f : ℂ → ℂ} {c : ℂ} {r ε : ℝ} + (hr : 0 < r) (hε : 0 < ε) + (hF : ∀ᶠ i in φ, DiffContOnCl ℂ (F i) (ball c r)) + (h₀ : ∀ᶠ i in φ, ∀ z ∈ closedBall c r, F i z ≠ 0) + (hf : TendstoUniformlyOn F f φ (closedBall c r)) + (hbound : ∀ z ∈ sphere c r, ε ≤ ‖f z‖) : f c ≠ 0 := by + have hevent : ∀ᶠ i in φ, ε / 2 ≤ ‖F i c‖ := by + filter_upwards [hF, h₀, (Metric.tendstoUniformlyOn_iff.mp hf) (ε / 2) + (half_pos hε)] with i hi hz hclose + have hfront : ∀ z ∈ frontier (ball c r), ‖(F i z)⁻¹‖ ≤ (ε / 2)⁻¹ := by + intro z hz' + rw [frontier_ball c hr.ne'] at hz' + have hcz := hclose z (sphere_subset_closedBall hz') + have hlen : ε / 2 ≤ ‖F i z‖ := by + have htriangle := norm_sub_norm_le (f z) (F i z) + rw [dist_eq_norm] at hcz + linarith [hbound z hz'] + rw [norm_inv] + exact (inv_le_inv₀ (lt_of_lt_of_le (half_pos hε) hlen) (half_pos hε)).mpr hlen + have hb : ‖(F i c)⁻¹‖ ≤ (ε / 2)⁻¹ := by + apply Complex.norm_le_of_forall_mem_frontier_norm_le isBounded_ball + (hi.inv (by simpa [closure_ball c hr.ne'] using hz)) hfront + rw [closure_ball c hr.ne'] + exact mem_closedBall_self hr.le + rw [norm_inv] at hb + exact (inv_le_inv₀ (norm_pos_iff.mpr (hz c (mem_closedBall_self hr.le))) + (half_pos hε)).mp hb + have hlim := (hf.tendsto_at (mem_closedBall_self hr.le)).norm + have hlen : ε / 2 ≤ ‖f c‖ := ge_of_tendsto hlim hevent + intro hz + simp only [hz, norm_zero] at hlen + exact (not_le_of_gt (half_pos hε)) hlen + +lemma polynomial_disk {p : Polynomial ℂ} (hp : p ≠ 0) {U : Set ℂ} (hU : IsOpen U) + {c : ℂ} (hc : c ∈ U) : + ∃ r > 0, closedBall c r ⊆ U ∧ ∀ z ∈ sphere c r, p.eval z ≠ 0 := by + let Z : Set ℂ := {z | p.IsRoot z} \ {c} + have hZ : IsClosed Z := ((Polynomial.finite_setOfPred_isRoot hp).sdiff).isClosed + have hcZ : c ∈ Zᶜ := by simp [Z] + have hn : U ∩ Zᶜ ∈ 𝓝 c := (hU.inter hZ.isOpen_compl).mem_nhds ⟨hc, hcZ⟩ + obtain ⟨δ, hδ, hδU⟩ := Metric.mem_nhds_iff.mp hn + refine ⟨δ / 2, half_pos hδ, ?_, ?_⟩ + · exact fun z hz => (hδU (closedBall_subset_ball (half_lt_self hδ) hz)).1 + · intro z hz hzero + have hmem := (hδU (closedBall_subset_ball (half_lt_self hδ) + (sphere_subset_closedBall hz))).2 + apply hmem + refine ⟨hzero, ?_⟩ + simp only [mem_singleton_iff] + intro heq + subst z + have hs : dist c c = δ / 2 := hz + rw [dist_self] at hs + exact (half_pos hδ).ne' hs.symm + +theorem polynomial_nonvanishing_limit {ι : Type*} {φ : Filter ι} [φ.NeBot] + {F : ι → ℂ → ℂ} {p : Polynomial ℂ} (hp : p ≠ 0) + {U : Set ℂ} (hU : IsOpen U) + (hF : ∀ᶠ i in φ, DifferentiableOn ℂ (F i) U) + (h₀ : ∀ᶠ i in φ, ∀ z ∈ U, F i z ≠ 0) + (hf : TendstoLocallyUniformlyOn F (fun z => p.eval z) φ U) : + ∀ c ∈ U, p.eval c ≠ 0 := by + intro c hc + obtain ⟨r, hr, hball, hsphere⟩ := polynomial_disk hp hU hc + obtain ⟨z₀, hz₀, hmin⟩ := (isCompact_sphere c r).exists_isMinOn + (NormedSpace.sphere_nonempty.mpr hr.le) (p.continuous.norm.continuousOn) + refine nonzero_uniform_limit_disk (F := F) (φ := φ) (f := fun z => p.eval z) (c := c) (r := r) hr (norm_pos_iff.mpr (hsphere z₀ hz₀)) ?_ ?_ ?_ ?_ + · filter_upwards [hF] with i hi + apply DifferentiableOn.diffContOnCl + exact hi.mono (by simpa only [closure_ball c hr.ne'] using hball) + · filter_upwards [h₀] with i hi z hz + exact hi z (hball hz) + · exact (tendstoLocallyUniformlyOn_iff_forall_isCompact hU).mp hf + (closedBall c r) hball (isCompact_closedBall c r) + · exact fun z hz => hmin hz + +end Heisenberg.Pin +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/QuietSweeps.lean b/lean/OAI/MathematicalPhysics/Heisenberg/QuietSweeps.lean new file mode 100644 index 0000000000000000000000000000000000000000..b68bf63e68d8b3cca383d42e56a0b838535dc97c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/QuietSweeps.lean @@ -0,0 +1,344 @@ +import OAI.MathematicalPhysics.Heisenberg.KilledContractions + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical +open scoped Classical +open Filter +open scoped Classical +open scoped Classical +open Filter Topology +open scoped RealInnerProductSpace Classical + +namespace Heisenberg.MeshPair + +section +open Heisenberg.MeshEnergy Heisenberg.MatrixContraction Matrix Filter Topology +open scoped RealInnerProductSpace +variable {V : Type*} [Fintype V] [DecidableEq V] + +def quietSweep (H D : Set V) (a b : ℕ → V) (t : ℝ) : ℕ → EuclideanSpace ℝ V → EuclideanSpace ℝ V + | 0,v => v + | n+1,v => euclideanMap (residualMatrix D (a n ∉ H ∨ b n ∉ H) false (a n) (b n) (t/2)) + (quietSweep H D a b t n v) + +lemma residual_supported (D : Set V) (R : Prop) (c : Bool) (a b : V) (p : ℝ) + (v : EuclideanSpace ℝ V) (i : V) (hi : i ∉ D) : + (euclideanMap (residualMatrix D R c a b p) v).ofLp i=0 := by + have hh (σ : Equiv.Perm V) : ∀ j,killedMatrix D σ i j=0 := by + intro j + by_cases he : i=σ j + · have hn : σ j ∉ D := he ▸ hi + simp [killedMatrix,hn] + · simp [killedMatrix,he] + simp only [euclideanMap_apply,Matrix.mulVec,dotProduct,residualMatrix] + split_ifs <;> simp [hh,Matrix.add_apply,Matrix.smul_apply,smul_eq_mul] + +lemma quietSweep_supported (H D : Set V) (a b : ℕ → V) (t : ℝ) (n : ℕ) + (v : EuclideanSpace ℝ V) (hv : ∀ i ∉ D,v.ofLp i=0) : + ∀ i ∉ D,(quietSweep H D a b t n v).ofLp i=0 := by + cases n with + | zero => exact hv + | succ n => exact residual_supported D _ _ _ _ _ _ + +def maskedGenerator (H D : Set V) (a b : ℕ → V) (i : ℕ) : + EuclideanSpace ℝ V →L[ℝ] EuclideanSpace ℝ V := + if a i ∈ H ∧ b i ∈ H then generator (edgeVector D (a i) (b i)) else 0 + +lemma quietSweep_eq (H D : Set V) (a b : ℕ → V) (n : ℕ) + (hab : ∀ i,i rfl + | succ n ih => + rw [quietSweep,residual_quiet H D (a n) (b n) (t/2) _ + (quietSweep_supported H D a b t n v hv)] + have he : 2*(t/2)=t := by ring + rw [he] + by_cases hh : a n ∈ H ∧ b n ∈ H + · rw [ite_eq_left hh,killedCoin_generator D (hab n (by omega)) t _ + (quietSweep_supported H D a b t n v hv),ih (fun i hi => hab i (by omega))] + simp only [sweep,maskedGenerator,ite_eq_left hh,mul_apply_eq_comp] + · rw [ite_eq_right hh,ih (fun i hi => hab i (by omega))] + simp only [sweep,maskedGenerator,ite_eq_right hh,smul_zero,add_zero,one_mul] + +def quietEnergy (H : Set V) (a b : ℕ → V) (n : ℕ) (v : EuclideanSpace ℝ V) : ℝ := + ∑ i ∈ Finset.range n,if a i ∈ H ∧ b i ∈ H then (v.ofLp (a i)-v.ofLp (b i))^2 else 0 + +omit [Fintype V] [DecidableEq V] in +lemma quietEnergy_nonneg (H : Set V) (a b : ℕ → V) (n : ℕ) (v : EuclideanSpace ℝ V) : + 0≤quietEnergy H a b n v := by + apply Finset.sum_nonneg + intro i _ + split_ifs <;> positivity + +lemma masked_dirichlet (H D : Set V) (a b : ℕ → V) (n : ℕ) + (v : EuclideanSpace ℝ V) (hv : ∀ i ∉ D,v.ofLp i=0) : + -⟪v,(∑ i ∈ Finset.range n,maskedGenerator H D a b i) v⟫ = + (1/2:ℝ)*quietEnergy H a b n v := by + simp only [_root_.sum_apply,inner_sum,←Finset.sum_neg_distrib,quietEnergy,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + unfold maskedGenerator + split_ifs + · rw [generator_energy,edge_inner] + have he (j : V) : (if j ∈ D then v.ofLp j else 0)=v.ofLp j := by + split_ifs with h + · rfl + · exact (hv j h).symm + simp only [he] + · simp + +theorem quietSweep_energy (a b : ℕ → V) (n : ℕ) (hab : ∀ i,i t*z) he] + exact Filter.eventually_all.mpr fun H => Filter.eventually_all.mpr (hh H) + +lemma quietSweep_contraction (H D : Set V) (a b : ℕ → V) (t : ℝ) + (ht : 0≤t) (ht2 : t≤2) (n : ℕ) (v : EuclideanSpace ℝ V) : + ‖quietSweep H D a b t n v‖ ≤ ‖v‖ := by + induction n with + | zero => rfl + | succ n ih => + exact (euclideanMap_contraction _ (residualMatrix_substochastic D _ false _ _ (t/2) + (by positivity) (by linarith)) _).trans ih + +end + +open Heisenberg.MatrixContraction +variable {V : Type*} [Fintype V] [DecidableEq V] + +def killedBetween (D E : Set V) (σ : Equiv.Perm V) : Matrix V V ℝ := + fun i j => if j∈D ∧ i∈E ∧ i=σ j then 1 else 0 + +lemma killedBetween_substochastic (D E : Set V) (σ : Equiv.Perm V) : + DoublySubstochastic (killedBetween D E σ) := by + let p : V → Option V := fun j => if j∈D ∧ σ j∈E then some (σ j) else none + have hp : ∀ i j a,p i=some a → p j=some a → i=j := by + intro i j a hi hj + dsimp [p] at hi hj + split_ifs at hi hj + exact σ.injective ((Option.some.inj hi).trans (Option.some.inj hj).symm) + have hh := of_partial_permutation p hp + have he : killedBetween D E σ = fun i j => if p j=some i then 1 else 0 := by + funext i j + dsimp [killedBetween,p] + by_cases hj : j∈D + · by_cases he : σ j∈E + · simp only [hj,he,and_self,ite_true,true_and,Option.some.injEq] + by_cases h : i=σ j + · subst i; simp [he] + · simp [h,Ne.symm h] + · simp only [hj,he,and_false,ite_false,true_and,reduceCtorEq,ite_false] + split_ifs with h + · exact False.elim (he (h.2 ▸ h.1)) + · rfl + · simp [hj] + rw [he] + convert hh using 1 + apply Iff.of_eq + apply congrArg DoublySubstochastic + funext i j + split_ifs <;> rfl + +omit [Fintype V] in +lemma killedBetween_same (D : Set V) (σ : Equiv.Perm V) : + killedBetween D D σ=killedMatrix D σ := by + ext i j + simp only [killedBetween,killedMatrix] + by_cases h : i=σ j + · subst i; simp + · simp [h] + +omit [Fintype V] in +lemma killedBetween_transpose (D E : Set V) (σ : Equiv.Perm V) : + (killedBetween D E σ).transpose=killedBetween E D σ.symm := by + ext i j + simp only [killedBetween,Matrix.transpose_apply] + have he : j=σ i ↔ i=σ.symm j := by rw [eq_comm,Equiv.eq_symm_apply,eq_comm] + simp only [he] + congr 1 + exact propext (by tauto) + +def residualBetween (D E : Set V) (revealed : Prop) + (c : Bool) (a b : V) (p : ℝ) : Matrix V V ℝ := + if revealed then killedBetween D E (if c then Equiv.swap a b else 1) + else (1-p) • killedBetween D E 1+p • killedBetween D E (Equiv.swap a b) + +lemma residualBetween_substochastic (D E : Set V) (revealed : Prop) + (c : Bool) (a b : V) (p : ℝ) (hp : 0≤p) (hp1 : p≤1) : + DoublySubstochastic (residualBetween D E revealed c a b p) := by + by_cases hr : revealed + · simp only [residualBetween,ite_eq_left hr] + exact killedBetween_substochastic _ _ _ + · simp only [residualBetween,ite_eq_right hr] + have h := weighted_average (fun z : Bool => if z then p else 1-p) + (by intro z; cases z <;> simp <;> linarith) + (by simp) (fun z => killedBetween D E (if z then Equiv.swap a b else 1)) + (fun _ => killedBetween_substochastic _ _ _) + have he : (1-p) • killedBetween D E 1 + p • killedBetween D E (Equiv.swap a b) = + (fun i j => ∑ z : Bool,(if z then p else 1-p)*killedBetween D E (if z then Equiv.swap a b else 1) i j) := by + ext i j + simp [Matrix.add_apply,Matrix.smul_apply,smul_eq_mul,add_comm] + rw [he] + exact h + +omit [Fintype V] in +lemma residualBetween_same (D : Set V) (revealed : Prop) + (c : Bool) (a b : V) (p : ℝ) : + residualBetween D D revealed c a b p=residualMatrix D revealed c a b p := by + unfold residualBetween residualMatrix + simp only [killedBetween_same] + +omit [Fintype V] in +lemma residualBetween_transpose (D E : Set V) (revealed : Prop) + (c : Bool) (a b : V) (p : ℝ) : + (residualBetween D E revealed c a b p).transpose = residualBetween E D revealed c a b p := by + unfold residualBetween + by_cases hr : revealed + · simp only [ite_eq_left hr,killedBetween_transpose] + cases c <;> simp [show (Equiv.symm (1:Equiv.Perm V))=1 from rfl] + · simp only [ite_eq_right hr,Matrix.transpose_add,Matrix.transpose_smul,killedBetween_transpose] + simp [show (Equiv.symm (1:Equiv.Perm V))=1 from rfl] + +lemma residualBetween_supported (D E : Set V) (revealed : Prop) + (c : Bool) (a b : V) (p : ℝ) (v : EuclideanSpace ℝ V) : + ∀ i∉E,(euclideanMap (residualBetween D E revealed c a b p) v).ofLp i=0 := by + intro i hi + simp only [euclideanMap_apply,Matrix.mulVec,dotProduct] + apply Finset.sum_eq_zero + intro j _ + have hz : ∀ σ : Equiv.Perm V,killedBetween D E σ i j=0 := by + intro σ + simp [killedBetween,hi] + by_cases hr : revealed <;> simp [residualBetween,hr,Matrix.add_apply,Matrix.smul_apply,hz] + +end Heisenberg.MeshPair + +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.LayeredExchange Heisenberg.MeshPair +variable {T V : Type*} [Fintype T] [Fintype V] [DecidableEq V] + +def holeCut (s : Equiv.Perm T) (τ : T → Equiv.Perm V) (base : T → Bool) + (P : Set (T×V)) (t : T) : Set V := + {v | (t,v)∉MissingSet (layerHistory s τ base) P} + +omit [Fintype T] [Fintype V] [DecidableEq V] in +lemma holeCut_transport (s : Equiv.Perm T) (τ : T → Equiv.Perm V) (base : T → Bool) + (P : Set (T×V)) (t : T) (v : V) : + (if base t then τ t else 1) v∈holeCut s τ base P (s t) ↔ + v∈holeCut s τ base P t := by + exact not_congr (missing_apply (layerHistory s τ base) P (t,v)) + +omit [Fintype T] [Fintype V] [DecidableEq V] in +lemma holeCut_quiet (s : Equiv.Perm T) (τ : T → Equiv.Perm V) (base : T → Bool) + (P : Set (T×V)) (t : T) (ht : base t=false) : + holeCut s τ base P (s t)=holeCut s τ base P t := by + ext v + simpa only [ht,Bool.false_eq_true,↓reduceIte,Equiv.Perm.one_apply] using + holeCut_transport s τ base P t v + +omit [Fintype T] [Fintype V] in +lemma layerRevealed_swap (a b : T → V) (A : Set (T×V)) (t : T) (hab : a t≠b t) : + layerRevealed (fun i => Equiv.swap (a i) (b i)) A t ↔ (t,a t)∈A ∨ (t,b t)∈A := by + constructor + · rintro ⟨v,hv,hn⟩ + by_cases ha : v=a t + · exact Or.inl (ha ▸ hv) + · have hb : v=b t := by + by_contra hb + exact hn (Equiv.swap_apply_of_ne_of_ne ha hb) + exact Or.inr (hb ▸ hv) + · rintro (ha|hb) + · exact ⟨a t,ha,by simpa using hab.symm⟩ + · exact ⟨b t,hb,by simpa using hab⟩ + +def exposedStep (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (t : T) : Matrix V V ℝ := + let τ := fun i => Equiv.swap (a i) (b i) + residualBetween (holeCut s τ base P t∩I) (holeCut s τ base P (s t)∩I) + (layerRevealed τ (MissingSet (layerHistory s τ base) P) t) (base t) (a t) (b t) (p t) + +omit [Fintype T] [Fintype V] in +lemma exposedStep_quiet (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (t : T) + (ht : base t=false) (hab : a t≠b t) : + exposedStep s a b base P I p t = + residualMatrix (holeCut s (fun i => Equiv.swap (a i) (b i)) base P t∩I) + (a t∉holeCut s (fun i => Equiv.swap (a i) (b i)) base P t ∨ + b t∉holeCut s (fun i => Equiv.swap (a i) (b i)) base P t) + false (a t) (b t) (p t) := by + unfold exposedStep + dsimp only + rw [holeCut_quiet s _ base P t ht,ht,residualBetween_same] + congr 1 + rw [layerRevealed_swap a b _ t hab] + simp only [holeCut,Set.mem_ofPred_eq,not_not] + +def exposedSweep (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (r : ℕ → T) : + ℕ → EuclideanSpace ℝ V → EuclideanSpace ℝ V + | 0,v => v + | n+1,v => euclideanMap (exposedStep s a b base P I p (r n)) + (exposedSweep s a b base P I p r n v) + +omit [Fintype T] [Fintype V] [DecidableEq V] in +lemma holeCut_quiet_segment (s : Equiv.Perm T) (τ : T → Equiv.Perm V) + (base : T → Bool) (P : Set (T×V)) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,i rfl + | succ n ih => + rw [hr n (by omega),holeCut_quiet s τ base P (r n) (hb n (by omega))] + exact ih (fun i hi => hr i (by omega)) (fun i hi => hb i (by omega)) + +omit [Fintype T] in + +theorem exposedSweep_quiet (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (r : ℕ → T) (n : ℕ) (t : ℝ) + (hr : ∀ i,i t/2) r n v = + quietSweep (holeCut s (fun i => Equiv.swap (a i) (b i)) base P (r 0)) + (holeCut s (fun i => Equiv.swap (a i) (b i)) base P (r 0)∩I) + (a ∘ r) (b ∘ r) t n v := by + induction n with + | zero => rfl + | succ n ih => + rw [exposedSweep,exposedStep_quiet s a b base P I _ (r n) (hb n (by omega)) + (hab n (by omega)),holeCut_quiet_segment s _ base P r n + (fun i hi => hr i (by omega)) (fun i hi => hb i (by omega)), + ih (fun i hi => hr i (by omega)) (fun i hi => hb i (by omega)) + (fun i hi => hab i (by omega))] + rfl + +end Heisenberg.Exposure +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RectangularExp.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RectangularExp.lean new file mode 100644 index 0000000000000000000000000000000000000000..7bc40b9ebd526fcf830caa3a6f99abd4cea54cf0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RectangularExp.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinMatrixTrace + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.TensorMatrix +variable {m n : Type} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] + +lemma pow_intertwines (A : Matrix m m ℝ) (B : Matrix n n ℝ) (V : Matrix m n ℝ) + (h : A*V=V*B) (k : ℕ) : A^k*V=V*B^k := by + induction k with + | zero=> simp + | succ k ih=> + rw [pow_succ',Matrix.mul_assoc,ih,←Matrix.mul_assoc,h,Matrix.mul_assoc,←pow_succ'] + +theorem exp_intertwines (A : Matrix m m ℝ) (B : Matrix n n ℝ) (V : Matrix m n ℝ) + (h : A*V=V*B) : NormedSpace.exp A*V=V*NormedSpace.exp B := by + let L:=mulRightLinearMap m ℝ V + let R:=mulLeftLinearMap n ℝ V + have hL : Continuous L:=L.continuous_of_finiteDimensional + have hR : Continuous R:=R.continuous_of_finiteDimensional + have ha:=(NormedSpace.exp_series_hasSum_exp' (𝕂:=ℝ) A).map L.toAddMonoidHom hL + have hb:=(NormedSpace.exp_series_hasSum_exp' (𝕂:=ℝ) B).map R.toAddMonoidHom hR + have he : (fun k : ℕ=>L ((k.factorial:ℝ)⁻¹ • A^k))= + (fun k : ℕ=>R ((k.factorial:ℝ)⁻¹ • B^k)) := by + funext k + change ((k.factorial:ℝ)⁻¹ • A^k)*V=V*((k.factorial:ℝ)⁻¹ • B^k) + rw [Matrix.smul_mul,Matrix.mul_smul,pow_intertwines A B V h] + change HasSum (fun k : ℕ=>L ((k.factorial:ℝ)⁻¹ • A^k)) (NormedSpace.exp A*V) at ha + change HasSum (fun k : ℕ=>R ((k.factorial:ℝ)⁻¹ • B^k)) (V*NormedSpace.exp B) at hb + rw [he] at ha + exact ha.unique hb + +end Heisenberg.TensorMatrix +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RegularComponents.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RegularComponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..08dd91ab880cd3b449a7b25a11c7652bc006f772 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RegularComponents.lean @@ -0,0 +1,256 @@ +import OAI.MathematicalPhysics.Heisenberg.HullRouting + +namespace OAI + +noncomputable section + +open scoped Classical + +namespace Heisenberg.LatticeRegular +open Heisenberg.Geometry Heisenberg.LatticeComponents Heisenberg.LatticeHull +variable {d : ℕ} + +lemma component_exit (Z : Set (Site d)) {x y : Site d} (s : Finset (Site d)) + (hx : x ∈ s) (hy : y ∈ Component Z x) (hyout : y ∉ s) : + ∃ u ∈ s, ∃ v ∈ Component Z x, v ∉ s ∧ v ∈ Ball 8 u := by + have hr := hy.2 + have h : y ∈ s ∨ ∃ u ∈ s, ∃ v ∈ Component Z x, v ∉ s ∧ v ∈ Ball 8 u := by + clear hyout + induction hr with + | refl => exact Or.inl hx + | @tail u v hxu huv ih => + rcases ih ⟨huv.2.1,hxu⟩ with hu | he + · by_cases hv : v ∈ s + · exact Or.inl hv + · exact Or.inr ⟨u,hu,v,⟨huv.2.2,hxu.tail huv⟩,hv,huv.1⟩ + · exact Or.inr he + exact h.resolve_left hyout + +lemma component_witness (Z : Set (Site d)) (hZ : Z.Finite) {x : Site d} (hx : x ∈ Z) + (n : ℕ) (hn : n+1 ≤ (component_finite Z hZ x).toFinset.card) : + ∃ s : Finset (Site d), x ∈ s ∧ s.card = n+1 ∧ + (∀ z ∈ s, z ∈ Component Z x) ∧ ∀ z ∈ s, z ∈ Ball (8*(n : ℤ)) x := by + induction n with + | zero => + refine ⟨{x},by simp,by simp,?_,?_⟩ + · intro z hz; simpa only [Finset.mem_singleton.mp hz] using self_mem_component Z hx + · intro z hz; rw [Finset.mem_singleton.mp hz]; exact ball_self (by omega) x + | succ n ih => + obtain ⟨s,hxs,hcard,hsC,hsball⟩ := ih (by omega) + have hns : ¬ (component_finite Z hZ x).toFinset ⊆ s := by + intro hsub + have hc := Finset.card_le_card hsub + omega + obtain ⟨y,hyC,hys⟩ := Finset.not_subset.mp hns + obtain ⟨u,hus,v,hvC,hvs,hvu⟩ := component_exit Z s hxs + ((component_finite Z hZ x).mem_toFinset.mp hyC) hys + refine ⟨insert v s,Finset.mem_insert_of_mem hxs,by simp [hvs,hcard],?_,?_⟩ + · intro z hz + rcases Finset.mem_insert.mp hz with rfl | hz + · exact hvC + · exact hsC z hz + · intro z hz + rcases Finset.mem_insert.mp hz with rfl | hz + · simpa only [Nat.cast_succ,mul_add,mul_one] using ball_triangle (hsball u hus) hvu + · exact ball_mono (by push_cast; omega) x (hsball z hz) + +theorem small_component_of_local_count (Z : Set (Site d)) (hZ : Z.Finite) + {x : Site d} (hx : x ∈ Z) (N : ℕ) (hN : 1 ≤ N) + (hcount : (hZ.toFinset.filter (fun z => z ∈ Ball (8*((N-1 : ℕ) : ℤ)) x)).card < N) : + (component_finite Z hZ x).toFinset.card < N := by + by_contra h + have hlarge : (N-1)+1 ≤ (component_finite Z hZ x).toFinset.card := by omega + obtain ⟨s,_,hcard,hsC,hsB⟩ := component_witness Z hZ hx (N-1) hlarge + have hs : s ⊆ hZ.toFinset.filter (fun z => z ∈ Ball (8*((N-1 : ℕ) : ℤ)) x) := by + intro z hz + exact Finset.mem_filter.mpr ⟨hZ.mem_toFinset.mpr (hsC z hz).1,hsB z hz⟩ + have hc := Finset.card_le_card hs + have hlt : s.card < N := lt_of_le_of_lt hc hcount + omega + +theorem component_radius (Z : Set (Site d)) (hZ : Z.Finite) + {x : Site d} (hx : x ∈ Z) : + Component Z x ⊆ Ball (8*(((component_finite Z hZ x).toFinset.card-1 : ℕ) : ℤ)) x := by + let C := (component_finite Z hZ x).toFinset + have hpos : 1 ≤ C.card := by + apply Finset.one_le_card.mpr + exact ⟨x,(component_finite Z hZ x).mem_toFinset.mpr (self_mem_component Z hx)⟩ + obtain ⟨s,_,hcard,hsC,hsB⟩ := component_witness Z hZ hx (C.card-1) (by change C.card-1+1 ≤ C.card; omega) + have hs : s ⊆ C := fun z hz => (component_finite Z hZ x).mem_toFinset.mpr (hsC z hz) + have he : s = C := Finset.eq_of_subset_of_card_le hs (by omega) + intro z hz + apply hsB z + rw [he] + exact (component_finite Z hZ x).mem_toFinset.mpr hz + +end Heisenberg.LatticeRegular + +namespace Heisenberg.Geometry +lemma dist_le_iff_mem_ball {d r : ℕ} (x y : Site d) : + dist x y ≤ (r:ℝ) ↔ y ∈ Ball r x := by + rw [dist_pi_le_iff (by positivity)] + change (∀ j, dist (x j) (y j) ≤ (r:ℝ)) ↔ ∀ j, |y j-x j| ≤ (r:ℤ) + simp only [Int.dist_eq', abs_sub_comm (x _) (y _)] + exact forall_congr' (fun j => by exact_mod_cast (Iff.rfl : + ((|y j-x j|:ℤ):ℝ) ≤ (r:ℝ) ↔ ((|y j-x j|:ℤ):ℝ) ≤ (r:ℝ))) + +lemma step_dist_le_one {d : ℕ} {u v : Site d} (h : Step u v) : dist u v ≤ 1 := by + simpa only [Nat.cast_one] using (dist_le_iff_mem_ball (r:=1) u v).mpr (step_ball_one h) +end Heisenberg.Geometry + +namespace Heisenberg.LatticeRegular +open Heisenberg.Geometry Heisenberg.LatticeComponents +variable {d : ℕ} + +def Regular (Z : Set (Site d)) (x : Site d) (R M : ℕ) (ν : ℝ) : Prop := + (∀ z ∈ Ball (11*R : ℕ) x, ((ballFinset d M z).filter (· ∈ Z)).card < 2*d) ∧ + (∀ z ∈ Z, z ∉ Ball (10*R : ℕ) x → ∀ w ∈ Component Z z, + dist z w ≤ (1+dist z x)^ν) + +theorem regular_component_envelope (hd : 1 ≤ d) (Z : Set (Site d)) (hZ : Z.Finite) + (x y : Site d) (R M : ℕ) (hM : 8*(2*d) ≤ M) (ν : ℝ) + (hν0 : 0 ≤ ν) (hν1 : ν < 1) (hy : y ∈ Ball (R:ℤ) x) + (hreg : Regular Z x R M ν) : + ∀ z ∈ Z, ∀ w ∈ Component Z z, + dist z w ≤ (16*(d:ℝ)+2)*(1+dist z y)^ν := by + intro z hz w hw + have hp : 1 ≤ (1+dist z y)^ν := Real.one_le_rpow (by linarith [dist_nonneg (x:=z) (y:=y)]) hν0 + by_cases hnear : z ∈ Ball (10*R : ℕ) x + · have hz11 : z ∈ Ball (11*R : ℕ) x := ball_mono (by omega) x hnear + have hcount : (hZ.toFinset.filter (fun w => w ∈ Ball (8*((2*d-1 : ℕ):ℤ)) z)).card < 2*d := by + apply lt_of_le_of_lt (Finset.card_le_card ?_) (hreg.1 z hz11) + intro a ha + obtain ⟨haZ,haB⟩ := Finset.mem_filter.mp ha + apply Finset.mem_filter.mpr + refine ⟨(mem_ballFinset ..).mpr ?_,hZ.mem_toFinset.mp haZ⟩ + apply ball_mono _ z haB + have hh : 8*(2*d-1) ≤ M := (Nat.mul_le_mul_left 8 (Nat.sub_le ..)).trans hM + exact_mod_cast hh + have hc := small_component_of_local_count Z hZ hz (2*d) (by omega) hcount + have hb := component_radius Z hZ hz hw + have hb' : w ∈ Ball (16*d : ℕ) z := by + apply ball_mono _ z hb + have : 8*((component_finite Z hZ z).toFinset.card-1) ≤ 16*d := by omega + exact_mod_cast this + have hdist := (dist_le_iff_mem_ball z w).mpr hb' + have hdR : (0:ℝ) ≤ d := Nat.cast_nonneg _ + push_cast at hdist + have := mul_le_mul_of_nonneg_left hp (show 0 ≤ 16*(d:ℝ)+2 by positivity) + nlinarith + · have hremote := hreg.2 z hz hnear w hw + have hfar : (10*R:ℕ) < dist x z := lt_of_not_ge (mt (dist_le_iff_mem_ball x z).mp hnear) + have hxy : dist x y ≤ (R:ℝ) := (dist_le_iff_mem_ball x y).mpr hy + have hzx : dist z x ≤ dist z y + (R:ℝ) := by + have h := dist_triangle z y x + rw [dist_comm y x] at h + linarith + have hcmp : 1+dist z x ≤ 2*(1+dist z y) := by + rw [dist_comm x z] at hfar + push_cast at hfar + linarith [Nat.cast_nonneg (α:=ℝ) R] + have hpow : (1+dist z x)^ν ≤ 2*(1+dist z y)^ν := by + calc + _ ≤ (2*(1+dist z y))^ν := Real.rpow_le_rpow (by positivity) hcmp hν0 + _ = (2:ℝ)^ν*(1+dist z y)^ν := Real.mul_rpow (by norm_num) (by positivity) + _ ≤ 2*(1+dist z y)^ν := mul_le_mul_of_nonneg_right + (Real.rpow_le_self_of_one_le (by norm_num) hν1.le) (Real.rpow_nonneg (by positivity) _) + exact hremote.trans (hpow.trans (mul_le_mul_of_nonneg_right (by nlinarith [Nat.cast_nonneg (α:=ℝ) d]) + (Real.rpow_nonneg (by positivity) _))) + +end Heisenberg.LatticeRegular + +open scoped Classical +open Filter Topology +namespace Heisenberg.RoutingDecay + +lemma eventually_half {ν C : ℝ} (hν : ν < 1) : + ∃ T ≥ 1, ∀ t ≥ T, C*t^ν ≤ t/2 := by + have hlim : Tendsto (fun t : ℝ => C*t^(ν-1)) atTop (nhds 0) := by + have h := (tendsto_rpow_neg_atTop (sub_pos.mpr hν)).const_mul C + simpa only [neg_sub,mul_zero] using h + obtain ⟨T,hT⟩ := eventually_atTop.mp (hlim.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1/2))) + refine ⟨max 1 T,le_max_left ..,?_⟩ + intro t ht + have ht1 : 1 ≤ t := (le_max_left ..).trans ht + have hsmall := hT t ((le_max_right ..).trans ht) + have he : t^ν = t^(ν-1)*t := by + calc + t^ν = t^((ν-1)+1) := by congr 1; ring + _ = t^(ν-1)*t := by rw [Real.rpow_add (by linarith : 0 lt_of_le_of_lt (Finset.card_le_card ?_) (h.1 z hz),h.2⟩ + intro w hw + obtain ⟨hwB,hwZ⟩ := Finset.mem_filter.mp hw + refine Finset.mem_filter.mpr ⟨?_,hwZ⟩ + apply (mem_ballFinset ..).mpr + exact ball_mono (by exact_mod_cast hMN) z ((mem_ballFinset ..).mp hwB) + +theorem regular_injection_energy (hk : 2 ≤ k) (L : ℝ) (hL : 0 ≤ L) : + ∃ M : ℕ, ∃ C ≥ 0, ∀ (I A : Type*) [Fintype I] [Fintype A] + (Z : Set (ZSite k)) (_hZ : Z.Finite) (x : I → ZSite k) (y : I → A → ZSite k) + (μ : I → A → ℝ) (R : ℕ), + (∀ i a,0 ≤ μ i a) → (∀ i,∑ a,μ i a ≤ 1) → + (∀ z r,0 ≤ r → ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card:ℝ) ≤ + L*(1+r)^((1:ℝ)/100)) → + (∀ i a,μ i a ≠ 0 → y i a ∉ Z ∧ dist (y i a) (x i) ≤ R ∧ + Regular Z (x i) R M (1/(100*(k+1:ℝ)))) → + ∃ J : I → A → (latticeGraph Zᶜ).Dart → ℝ, + (∀ i a,μ i a ≠ 0 → (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).UnitFlow (J i a) (y i a)) ∧ + Summable (fun e => (∑ i,∑ a,μ i a*J i a e)^2) ∧ + (∑' e,(∑ i,∑ a,μ i a*J i a e)^2) ≤ C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I) := by + let ν : ℝ := 1/(100*(k+1:ℝ)) + have hkR : (2:ℝ) ≤ k := by exact_mod_cast hk + have hdim : (0:ℝ) < k+1 := by positivity + have hν : 0 ≤ ν := by dsimp [ν]; positivity + have hν1 : ν < 1 := by dsimp [ν]; rw [div_lt_iff₀ (by positivity)]; nlinarith + have hprod : (k+1:ℝ)*ν = 1/100 := by dsimp [ν]; field_simp + let κ : ℝ := (k:ℝ)-(k+1:ℝ)*ν + have hκ : 0 ≤ κ := by dsimp [κ]; rw [hprod]; linarith + have hexp : (k+1:ℝ) < 2*(κ-1/4) := by dsimp [κ]; rw [hprod]; linarith + obtain ⟨M₀,B,hB,hflow⟩ := connected_envelope (k:=k) (by omega) ν (16*(k+1:ℝ)+2) hν hν1 hκ (by positivity) + obtain ⟨D,hD,hoverlap⟩ := graph_overlap_uniform (k:=k) κ (1/4) B hB (by norm_num) hexp + let M := max M₀ (8*(2*(k+1))) + let C := D*(L*(4:ℝ)^((1:ℝ)/100) + (2:ℝ)^((1:ℝ)/4)* + ((2:ℝ)^((1:ℝ)/4)*(L*(2:ℝ)^((1:ℝ)/100))*(1-(2:ℝ)^((1:ℝ)/100-1/4))⁻¹)) + have hC : 0 ≤ C := by + have hh : (2:ℝ)^((1:ℝ)/100-1/4)<1 := Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (by norm_num) + dsimp [C] + positivity + refine ⟨M,C,hC,?_⟩ + intro I A _ _ Z hZ x y μ R hμ hmass hgrowth hgood + have hchoose : ∀ i a,∃ J : (latticeGraph Zᶜ).Dart → ℝ, + (μ i a ≠ 0 → (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).UnitFlow J (y i a)) ∧ + ∀ e,|J e| ≤ B*(1+dist e.fst (y i a))^(-κ) := by + intro i a + by_cases ha : μ i a=0 + · refine ⟨0,by simp [ha],fun e => ?_⟩ + simpa using mul_nonneg hB (Real.rpow_nonneg (by positivity : 0≤1+dist e.fst (y i a)) (-κ)) + · obtain ⟨hz,hnear,hreg⟩ := hgood i a ha + have hy : y i a ∈ Ball (R:ℤ) (x i) := (dist_le_iff_mem_ball ..).mp (by rwa [dist_comm]) + have hy11 : y i a ∈ Ball (11*R:ℕ) (x i) := ball_mono (by omega) _ hy + have hreg₀ := regular_mono_M Z (x i) R M₀ M ν (le_max_left ..) hreg + have henv := regular_component_envelope (by omega : 1 ≤ k+1) Z hZ (x i) (y i a) R M + (le_max_right ..) ν hν hν1 hy hreg + obtain ⟨J,hunit,hdecay⟩ := hflow Z hZ (y i a) hz (hreg₀.1 _ hy11) (by simpa only [Nat.cast_add,Nat.cast_one] using henv) + refine ⟨J,fun _ => hunit,?_⟩ + have he : (k+1:ℝ)*ν-k = -κ := by dsimp [κ]; ring + simpa only [he] using hdecay + choose J hunit hdecay using hchoose + have hov := fun i a j b => hoverlap Z (y i a) (y j b) (J i a) (J j b) (hdecay i a) (hdecay j b) + have hen := Heisenberg.FlowAggregation.injection_energy x y μ J (1/100) (1/4) L D + (by norm_num) (by norm_num) hL hD hgrowth hμ hmass (fun i a j b => (hov i a j b).1) + (fun i a j b => (hov i a j b).2) (R:ℝ) (Nat.cast_nonneg _) + (fun i a ha => (hgood i a ha).2.1) + exact ⟨J,hunit,hen.1,hen.2⟩ + +end Heisenberg.Flow + +namespace Heisenberg.SlotMaximum +variable {X I : Type*} + +def value (s : Finset I) (v : I → ℝ) : ℝ := + if h : s.Nonempty then (s.image v).max' (h.image v) else 0 + +lemma attained {s : Finset I} (hs : s.Nonempty) (v : I → ℝ) : + ∃ i ∈ s, value s v = v i := by + rw [value,dite_eq_left hs] + obtain ⟨i,hi,he⟩ := Finset.mem_image.mp (Finset.max'_mem (s.image v) (hs.image v)) + exact ⟨i,hi,he.symm⟩ + +lemma dominates (s : Finset I) (v : I → ℝ) {i : I} (hi : i ∈ s) : + v i ≤ value s v := by + rw [value,dite_eq_left ⟨i,hi⟩] + exact Finset.le_max' _ _ (Finset.mem_image.mpr ⟨i,hi,rfl⟩) + +lemma nonneg (s : Finset I) (v : I → ℝ) (hv : ∀ i ∈ s,0 ≤ v i) : + 0 ≤ value s v := by + by_cases hs : s.Nonempty + · obtain ⟨i,hi,he⟩ := attained hs v + rw [he] + exact hv i hi + · simp [value,hs] + +lemma zero_of_zero (s : Finset I) (v : I → ℝ) (hv : ∀ i ∈ s,v i=0) : + value s v=0 := by + by_cases hs : s.Nonempty + · obtain ⟨i,hi,he⟩ := attained hs v + rw [he,hv i hi] + · simp [value,hs] + +theorem edge_energy (s t : Finset I) (hs : s.Nonempty) (ht : t.Nonempty) + (v w : I → ℝ) : + (value s v-value t w)^2 ≤ ∑ i ∈ s, ∑ j ∈ t,(v i-w j)^2 := by + obtain ⟨i,hi,hei⟩ := attained hs v + obtain ⟨j,hj,hej⟩ := attained ht w + rw [hei,hej] + exact (Finset.single_le_sum (fun b _ => sq_nonneg (v i-w b)) hj).trans + (Finset.single_le_sum (fun a _ => Finset.sum_nonneg (fun b _ => sq_nonneg (v a-w b))) hi) + +theorem pairing_le (s : Finset I) (v μ : I → ℝ) (hμ : ∀ i ∈ s,0 ≤ μ i) : + (∑ i ∈ s,μ i*v i) ≤ (∑ i ∈ s,μ i)*value s v := by + rw [Finset.sum_mul] + exact Finset.sum_le_sum (fun i hi => mul_le_mul_of_nonneg_left (dominates s v hi) (hμ i hi)) + +def test (s : X → Finset I) (v : X → I → ℝ) (F : Finset X) + (hv : ∀ x,x ∉ F → ∀ i ∈ s x,v x i=0) : X →₀ ℝ := + Finsupp.ofSupportFinite (fun x => value (s x) (v x)) (by + apply F.finite_toSet.subset + intro x hx + by_contra hn + exact hx (zero_of_zero (s x) (v x) (hv x hn))) + +@[simp] lemma test_apply (s : X → Finset I) (v : X → I → ℝ) (F : Finset X) + (hv : ∀ x,x ∉ F → ∀ i ∈ s x,v x i=0) (x : X) : + test s v F hv x=value (s x) (v x) := rfl + +end Heisenberg.SlotMaximum + +namespace Heisenberg.RoutedFlow.Network +variable {X E I L : Type*} [Fintype I] +open Heisenberg.SlotMaximum + +lemma pairing_square_bound (N : Network X E) (J : E → ℝ) (g : X →₀ ℝ) + (hs : Summable (fun e => (J e)^2)) : + (N.pairing J g)^2 ≤ (∑' e,(J e)^2)*(∑ e ∈ N.edges g,(N.gradient g e)^2) := by + have hc := Finset.sum_mul_sq_le_sq_mul_sq (N.edges g) J (N.gradient g) + have ht := Summable.sum_le_tsum (N.edges g) (fun e _ => sq_nonneg (J e)) hs + exact hc.trans (mul_le_mul_of_nonneg_right ht (Finset.sum_nonneg (fun e _ => sq_nonneg _))) + +lemma pairing_injections (N : Network X E) (μ : I → ℝ) (y : I → X) + (J : I → E → ℝ) (hJ : ∀ i, μ i ≠ 0 → N.UnitFlow (J i) (y i)) (g : X →₀ ℝ) : + N.pairing (fun e => ∑ i,μ i*J i e) g = ∑ i,μ i*g (y i) := by + simp only [pairing,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + simp only [mul_assoc,←Finset.mul_sum] + by_cases hi : μ i=0 + · simp [hi] + · rw [show (∑ e ∈ N.edges g,J i e*N.gradient g e)=g (y i) from hJ i hi g] + +theorem slot_injection_bound (N : Network X E) (s : X → Finset L) + (v : X → L → ℝ) (F : Finset X) + (hvF : ∀ x,x ∉ F → ∀ a ∈ s x,v x a=0) + (hv : ∀ x a,0 ≤ v x a) + (hs : ∀ e ∈ N.edges (test s v F hvF), + (s (N.src e)).Nonempty ∧ (s (N.dst e)).Nonempty) + (μ : I → ℝ) (hμ : ∀ i,0 ≤ μ i) (y : I → X) (a : I → L) + (ha : ∀ i,μ i ≠ 0 → a i ∈ s (y i)) + (J : I → E → ℝ) (hJ : ∀ i,μ i ≠ 0 → N.UnitFlow (J i) (y i)) + (A : ℝ) (hA : 0 ≤ A) + (hJs : Summable (fun e => (∑ i,μ i*J i e)^2)) + (hJE : (∑' e,(∑ i,μ i*J i e)^2) ≤ A) : + (∑ i, μ i*v (y i) (a i))^2 ≤ A * + ∑ e ∈ N.edges (test s v F hvF), + ∑ b ∈ s (N.src e),∑ c ∈ s (N.dst e),(v (N.src e) b-v (N.dst e) c)^2 := by + let g := test s v F hvF + let K : E → ℝ := fun e => ∑ i,μ i*J i e + have hi : (∑ i,μ i*v (y i) (a i)) ≤ N.pairing K g := by + rw [pairing_injections N μ y J hJ] + apply Finset.sum_le_sum + intro i _ + by_cases h : μ i=0 + · simp [h] + · exact mul_le_mul_of_nonneg_left (dominates _ _ (ha i h)) (hμ i) + have hi0 : 0 ≤ ∑ i,μ i*v (y i) (a i) := Finset.sum_nonneg (fun i _ => mul_nonneg (hμ i) (hv _ _)) + have hc := pairing_square_bound N K g hJs + have hgrad : (∑ e ∈ N.edges g,(N.gradient g e)^2) ≤ + ∑ e ∈ N.edges g,∑ b ∈ s (N.src e),∑ c ∈ s (N.dst e), + (v (N.src e) b-v (N.dst e) c)^2 := by + apply Finset.sum_le_sum + intro e he + exact edge_energy _ _ (hs e he).1 (hs e he).2 _ _ + calc + _ ≤ (N.pairing K g)^2 := sq_le_sq₀ hi0 (hi0.trans hi) |>.mpr hi + _ ≤ _ := hc.trans ((mul_le_mul_of_nonneg_right hJE + (Finset.sum_nonneg (fun e _ => sq_nonneg _))).trans (mul_le_mul_of_nonneg_left hgrad hA)) + +end Heisenberg.RoutedFlow.Network + +namespace Heisenberg.Flow + +section +open Heisenberg.Geometry Heisenberg.LatticeRegular Heisenberg.RoutedFlow +open Heisenberg.SlotMaximum +variable {k : ℕ} + +theorem regular_slot_test (hk : 2 ≤ k) (L : ℝ) (hL : 0 ≤ L) : + ∃ M : ℕ, ∃ C ≥ 0, ∀ (I A B : Type*) [Fintype I] [Fintype A] + (Z : Set (ZSite k)) (_hZ : Z.Finite) (x : I → ZSite k) (y : I → A → ZSite k) + (μ : I → A → ℝ) (R : ℕ) (s : ZSite k → Finset B) + (slot : I → A → B) (v : ZSite k → B → ℝ) (F : Finset (ZSite k)) + (hvF : ∀ z,z ∉ F → ∀ a ∈ s z,v z a=0), + (∀ i a,0 ≤ μ i a) → (∀ i,∑ a,μ i a ≤ 1) → + (∀ z r,0 ≤ r → ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card:ℝ) ≤ + L*(1+r)^((1:ℝ)/100)) → + (∀ i a,μ i a ≠ 0 → y i a ∉ Z ∧ dist (y i a) (x i) ≤ R ∧ + Regular Z (x i) R M (1/(100*(k+1:ℝ)))) → + (∀ z,z ∉ Z → (s z).Nonempty) → + (∀ i a,μ i a ≠ 0 → slot i a ∈ s (y i a)) → + (∀ z a,0 ≤ v z a) → + (∑ i,∑ a,μ i a*v (y i a) (slot i a))^2 ≤ + (C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I)) * + ∑ e ∈ (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).edges + (test s v F hvF),∑ a ∈ s e.fst,∑ b ∈ s e.snd,(v e.fst a-v e.snd b)^2 := by + obtain ⟨M,C,hC,hflow⟩ := regular_injection_energy hk L hL + refine ⟨M,C,hC,?_⟩ + intro I A B _ _ Z hZ x y μ R s slot v F hvF hμ hmass hgrowth hgood havail hslot hv + obtain ⟨J,hJ,hs,hbound⟩ := hflow I A Z hZ x y μ R hμ hmass hgrowth hgood + let N := graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ) + have ha : ∀ e ∈ N.edges (test s v F hvF),(s (N.src e)).Nonempty ∧ (s (N.dst e)).Nonempty := by + intro e _ + exact ⟨havail e.fst e.adj.2.1,havail e.snd e.adj.2.2⟩ + have h := Network.slot_injection_bound N s v F hvF hv ha + (I:=I×A) (fun ia => μ ia.1 ia.2) (fun ia => hμ ia.1 ia.2) + (fun ia => y ia.1 ia.2) (fun ia => slot ia.1 ia.2) (fun ia => hslot ia.1 ia.2) + (fun ia => J ia.1 ia.2) (fun ia => hJ ia.1 ia.2) + (C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I)) (by positivity) + (by simpa only [Fintype.sum_prod_type] using hs) + (by simpa only [Fintype.sum_prod_type] using hbound) + simpa only [Fintype.sum_prod_type, N, graphNetwork] using h + +end + +open Heisenberg.Geometry Heisenberg.LatticeRegular Heisenberg.RoutedFlow Heisenberg.SlotMaximum +variable {k : ℕ} + +def goodMass {I V : Type*} (K : V → I → ℝ) (x : I → ZSite k) (y : V → ZSite k) + (Z : Set (ZSite k)) (R M : ℕ) (i : I) (j : V) : ℝ := + if Regular Z (x i) R M (1/(100*(k+1:ℝ))) ∧ dist (y j) (x i)≤R then K j i else 0 + +lemma goodMass_nonneg {I V : Type*} (K : V → I → ℝ) (hK : ∀ j i,0≤K j i) + (x : I → ZSite k) (y : V → ZSite k) (Z : Set (ZSite k)) (R M : ℕ) (i : I) (j : V) : + 0≤goodMass K x y Z R M i j := by + unfold goodMass + split_ifs + · exact hK j i + · rfl + +theorem kernel_pairing_split {I V : Type*} [Fintype I] [Fintype V] + (K : V → I → ℝ) (hK : ∀ j i,0≤K j i) (hm : ∀ i,∑ j,K j i≤1) + (x : I → ZSite k) (y : V → ZSite k) (Z : Set (ZSite k)) (R M : ℕ) + (v : V → ℝ) (hv : ∀ j,0≤v j ∧ v j≤1) : + (∑ i,∑ j,K j i*v j) ≤ + (∑ i,if ¬Regular Z (x i) R M (1/(100*(k+1:ℝ))) then (1:ℝ) else 0)+ + (∑ i,∑ j,if (R:ℝ) mul_le_of_le_one_right (hK j i) (hv j).2)).trans (hm i) + have hz : 0≤∑ j,if (R:ℝ) dist (x i) z≤r)).card:ℝ) ≤ L*(1+r)^((1:ℝ)/100)) → + (∀ j i,K j i≠0 → y j∉Z ∧ slot j∈s (y j)) → + (∀ z,z∉Z → (s z).Nonempty) → (∀ z a,0≤v z a) → + (∑ i,∑ j,goodMass K x y Z R M i j*v (y j) (slot j))^2 ≤ + (C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I))* + ∑ e ∈ (graphNetwork (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ)).edges (test s v F hvF), + ∑ a∈s e.fst,∑ b∈s e.snd,(v e.fst a-v e.snd b)^2 := by + obtain ⟨M,C,hC,hh⟩ := regular_slot_test hk L hL + refine ⟨M,C,hC,?_⟩ + intro I V B _ _ K x y Z hZ R s slot v F hvF hK hm hg hslot hav hv + apply hh I V B Z hZ x (fun _ => y) (goodMass K x y Z R M) R s (fun _ => slot) v F hvF + · exact goodMass_nonneg K hK x y Z R M + · intro i + apply le_trans (Finset.sum_le_sum (fun j _ => ?_)) (hm i) + unfold goodMass + split_ifs + · rfl + · exact hK j i + · exact hg + · intro i j hij + unfold goodMass at hij + split_ifs at hij with hh + · exact ⟨(hslot j i hij).1,hh.2,hh.1⟩ + · contradiction + · exact hav + · intro i j hij + unfold goodMass at hij + split_ifs at hij + · exact (hslot j i hij).2 + · contradiction + · exact hv + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RegularPin.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RegularPin.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ca59546eae9e4a2f9715dae969e30dedc879344 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RegularPin.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.Heisenberg.PinBridge + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +attribute [-instance] instDecidableEqFin +@[reducible] local instance regDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Exposure +open Heisenberg.Geometry Heisenberg.Schedule Heisenberg.SpatialFrame Heisenberg.MeshPair Heisenberg.LatticeRegular Heisenberg.SparseWitness Heisenberg.Cycle + +attribute [local irreducible] Pin.pinDensity LayeredExchange.layerWeight LayeredExchange.coinWiring cutAdmissible layerMass layerHistory MissingSet Return.HasHit localGrowth + +lemma exists_witness_scale : ∃ b : ℕ,100 ≤ b ∧ 2 ≤ (b:ℝ)^((1:ℝ)/100) := by + obtain ⟨b,hb⟩:=exists_nat_ge (max (2^100:ℝ) 100) + refine ⟨b,?_,?_⟩ + · exact_mod_cast (le_max_right _ _).trans hb + · have hh:=Real.rpow_le_rpow (by positivity : (0:ℝ) ≤ 2^100) + ((le_max_left _ _).trans hb) (by norm_num : (0:ℝ) ≤ 1/100) + have he : ((2:ℝ)^100)^((1:ℝ)/100)=2 := by + rw [←Real.rpow_natCast,←Real.rpow_mul (by norm_num)] + norm_num + rwa [he] at hh + +theorem regularity_of_pin_induction (d M : ℕ) (L : ℝ) (hL : (2*(d+1):ℕ) ≤ L) : + ∃ p₀>0,∃ C≥0,∀ (B : Type) [Fintype B] [Nonempty B] + (Λ : Finset (Site (d+1))) (m : ℕ) (s : Equiv.Perm (Fin m)) + (a b : Fin m → Slots (B:=B) Λ) (P : Set (Fin m×Slots (B:=B) Λ)) + (rates : Fin m → ℝ) (_hrates : ∀ i,0≤rates i ∧ rates i≤1) (p : ℝ), + 0≤p → p≤p₀ → + (∀ U : Finset (Fin m×Slots (B:=B) Λ), + cutAdmissible (fun v : Slots (B:=B) Λ=>v.1.val) ((1:ℝ)/100) L U → + Disjoint P (U:Set (Fin m×Slots (B:=B) Λ)) → + (∑ c,if ∀ j∈U,¬Return.HasHit (LayeredExchange.coinWiring s a b c) P j then + Pin.pinDensity (LayeredExchange.layerWeight rates) (LayeredExchange.coinWiring s a b) P c else 0) ≤ p^U.card) → + ∀ t x R,(∑ c,layerMass s a b P rates c * + (if ¬Regular (blocked Λ (holeCut s (fun i=>Equiv.swap (a i) (b i)) c P t)) x R M (1/(100*(d+1:ℝ))) then (1:ℝ) else 0)) ≤ + C*((1+(R:ℝ))^(d+1)*p^(2*(d+1))+1/(1+(R:ℝ))) := by + obtain ⟨b,hb,hba⟩:=exists_witness_scale + obtain ⟨p₀,hp₀,C,hC,hr⟩:=uniform_layer_regularity d M b hb ((1:ℝ)/100) L + (1/(100*(d+1:ℝ))) 1 (by norm_num) hL hba (by positivity) (by norm_num) + refine ⟨p₀,hp₀,C,hC,?_⟩ + intro B _ _ Λ m s a b P rates hrates p hp hpp hIH t x R + have hcut:=cut_moment_of_induction (fun v : Slots (B:=B) Λ=>v.1.val) ((1:ℝ)/100) L s a b P rates p (by + intro U hU hdis + have h1:=hIH U + have h2:=h1 hU + have h3:=h2 hdis + with_reducible convert h3 using 1 ; congr! 20) t + have hh:=hr (Fin m) (Slots (B:=B) Λ) (fun v=>v.1.val) s a b P rates hrates t p hp hpp hcut x R + simp only [layerBlocked_frame,Real.rpow_neg_one,←one_div,mul_ite,mul_one,mul_zero] at hh ⊢ + with_reducible convert hh using 1 ; congr! 20 + +lemma regularity_reverse {V : Type} [Fintype V] {m : ℕ} (s : Equiv.Perm (Fin m)) + (a b : Fin m → V) (P : Set (Fin m×V)) (rates : Fin m → ℝ) + (F : Set V → Prop) (t : Fin m) : + (∑ c,layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (rates ∘ s.symm) c * + if F (holeCut s.symm (fun i=>Equiv.swap (a (s.symm i)) (b (s.symm i))) c P t) then (1:ℝ) else 0)= + ∑ c,layerMass s a b P rates c * + if F (holeCut s (fun i=>Equiv.swap (a i) (b i)) c P t) then (1:ℝ) else 0 := by + have he : ∀ c,holeCut s.symm (fun i=>Equiv.swap (a (s.symm i)) (b (s.symm i))) c P t= + holeCut s (fun i=>Equiv.swap (a i) (b i)) (c ∘ s) P t := by + intro c + have hh:=holeCut_reverse s a b (c ∘ s) P t + have hc : (c ∘ s) ∘ s.symm=c := by funext i; simp + rwa [hc] at hh + simp_rw [he] + exact layerSum_reverse s a b P rates (fun c=>if F (holeCut s (fun i=>Equiv.swap (a i) (b i)) c P t) then 1 else 0) + +end Heisenberg.Exposure +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ReturnConditioning.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ReturnConditioning.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce7341df51ab3eae4a9f78f903a730f711655bea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ReturnConditioning.lean @@ -0,0 +1,321 @@ +import OAI.MathematicalPhysics.Heisenberg.HittingEnergy + +namespace OAI + +noncomputable section +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open Matrix +open scoped Classical +open scoped BigOperators Classical +open scoped Classical +open scoped Classical +open Filter + +open scoped Classical +namespace Heisenberg.Return +open Equiv +variable {V : Type*} + +def HasHit (π : Perm V) (P : Set V) (x : V) : Prop := ∃ n : ℕ, (π ^ n) x ∈ P + +lemma hasHit_iff_cycle [Fintype V] (π : Perm V) (P : Set V) (x : V) : + HasHit π P x ↔ ∃ p ∈ P, π.SameCycle x p := by + constructor + · rintro ⟨n, hn⟩ + exact ⟨(π ^ n) x, hn, (Perm.SameCycle.refl π x).pow_right⟩ + · rintro ⟨p, hp, hc⟩ + obtain ⟨n, hn⟩ := hc.exists_nat_pow_eq + exact ⟨n, hn ▸ hp⟩ + +lemma hasHit_apply [Fintype V] (π : Perm V) (P : Set V) (x : V) : + HasHit π P (π x) ↔ HasHit π P x := by + simp only [hasHit_iff_cycle, Perm.sameCycle_apply_left] + +lemma hasHit_of_mem (π : Perm V) {P : Set V} {x : V} (hx : x ∈ P) : HasHit π P x := + ⟨0, hx⟩ + +def hitTime (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) := Nat.find h + +def hitPoint (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) : V := + (π ^ hitTime π P x h) x + +lemma hitPoint_mem (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) : + hitPoint π P x h ∈ P := Nat.find_spec h + +lemma hitTime_le (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) + {n : ℕ} (hn : (π ^ n) x ∈ P) : hitTime π P x h ≤ n := Nat.find_min' h hn + +lemma hitTime_zero (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) + (hx : x ∈ P) : hitTime π P x h = 0 := by + exact Nat.eq_zero_of_le_zero (hitTime_le π P x h (n := 0) hx) + +lemma hitTime_pos (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) + (hx : x ∉ P) : 0 < hitTime π P x h := by + by_contra hn + have he : hitTime π P x h = 0 := by omega + have hm := hitPoint_mem π P x h + exact hx (by simpa [hitPoint, he] using hm) + +variable [Fintype V] + +lemma hitTime_step (π : Perm V) (P : Set V) (x : V) (h : HasHit π P x) + (hx : x ∉ P) : + hitTime π P x h = hitTime π P (π x) ((hasHit_apply π P x).mpr h) + 1 := by + have hm := hitPoint_mem π P (π x) ((hasHit_apply π P x).mpr h) + have hp := hitTime_pos π P x h hx + apply Nat.le_antisymm + · apply hitTime_le + simpa only [hitPoint, pow_succ, Perm.mul_apply] using hm + · have he : (π ^ (hitTime π P x h - 1)) (π x) ∈ P := by + rw [← Perm.mul_apply, ← pow_succ, Nat.sub_add_cancel hp] + exact hitPoint_mem π P x h + have hl := hitTime_le π P (π x) ((hasHit_apply π P x).mpr h) he + omega + +def firstValue (π : Perm V) (P : Set V) (x : V) : Option V := + if h : HasHit π P x then some (hitPoint π P x h) else none + +omit [Fintype V] in +lemma firstValue_of_mem (π : Perm V) {P : Set V} {x : V} (hx : x ∈ P) : + firstValue π P x = some x := by + have h := hasHit_of_mem π hx + simp [firstValue, h, hitPoint, hitTime_zero π P x h hx] + +lemma firstValue_step (π : Perm V) (P : Set V) (x : V) (hx : x ∉ P) : + firstValue π P (π x) = firstValue π P x := by + by_cases h : HasHit π P x + · have h' := (hasHit_apply π P x).mpr h + simp only [firstValue, dite_eq_left h, dite_eq_left h'] + congr 1 + simp only [hitPoint, hitTime_step π P x h hx, pow_succ, Perm.mul_apply] + · have h' : ¬ HasHit π P (π x) := by simpa only [hasHit_apply] using h + simp [firstValue, h, h'] + +lemma harmonic_firstHit {W : Type*} (π : Perm V) (P : Set V) (g : V → W) + (hg : ∀ x ∉ P, g (π x) = g x) (x : V) (h : HasHit π P x) : + g (hitPoint π P x h) = g x := by + have hn (n : ℕ) : ∀ x (h : HasHit π P x), hitTime π P x h = n → + g (hitPoint π P x h) = g x := by + induction n using Nat.strong_induction_on with + | h n ih => + intro x h he + by_cases hx : x ∈ P + · simp [hitPoint, hitTime_zero π P x h hx] + · have ht := hitTime_step π P x h hx + have hl : hitTime π P (π x) ((hasHit_apply π P x).mpr h) < n := by omega + have hr := ih _ hl (π x) ((hasHit_apply π P x).mpr h) rfl + rw [hitPoint, ht, pow_succ, Perm.mul_apply] + exact hr.trans (hg x hx) + exact hn _ x h rfl + +lemma firstValue_unique {W : Type*} (π : Perm V) (P : Set V) + (g : V → Option W) (b : V → W) + (hb : ∀ x ∈ P, g x = some (b x)) + (hg : ∀ x ∉ P, g (π x) = g x) + (x : V) (h : HasHit π P x) : + g x = (firstValue π P x).map b := by + rw [firstValue, dite_eq_left h] + exact (harmonic_firstHit π P g hg x h).symm.trans + (hb _ (hitPoint_mem π P x h)) + +lemma firstValue_splice_step (π : Perm (Option V)) (P : Set V) (i : V) : + firstValue π (some '' P) (some (removeNone π i)) = + firstValue π (some '' P) (π (some i)) := by + cases h : π (some i) with + | none => + rw [removeNone_none π h] + exact firstValue_step π (some '' P) none (by simp) + | some j => + rw [removeNone_some π ⟨j, h⟩, h] + +lemma firstValue_spliced_harmonic (π : Perm (Option V)) (P : Set V) : + ∀ i ∉ P, firstValue π (some '' P) (some (removeNone π i)) = + firstValue π (some '' P) (some i) := by + intro i hi + rw [firstValue_splice_step] + exact firstValue_step π _ _ (by simpa using hi) + +theorem nextValue_splice (π : Perm (Option V)) (P : Set V) (i : V) (hi : i ∈ P) : + firstValue π (some '' P) (π (some i)) = + (firstValue (removeNone π) P (removeNone π i)).map some := by + rw [← firstValue_splice_step] + apply firstValue_unique (removeNone π) P + (fun i => firstValue π (some '' P) (some i)) some + · intro i hi + exact firstValue_of_mem π ⟨i, hi, rfl⟩ + · exact firstValue_spliced_harmonic π P + · exact (hasHit_apply (removeNone π) P i).mpr (hasHit_of_mem _ hi) + +def nextTime (π : Perm V) (P : Set V) (i : P) : ℕ := + hitTime π P (π i) ((hasHit_apply π P i).mpr (hasHit_of_mem π i.property)) + 1 + +def nextPoint (π : Perm V) (P : Set V) (i : P) : P := + ⟨hitPoint π P (π i) ((hasHit_apply π P i).mpr (hasHit_of_mem π i.property)), + hitPoint_mem π P _ _⟩ + +lemma nextTime_pos (π : Perm V) (P : Set V) (i : P) : 0 < nextTime π P i := Nat.succ_pos _ + +lemma nextPoint_spec (π : Perm V) (P : Set V) (i : P) : + (π ^ nextTime π P i) i = (nextPoint π P i : V) := by + simp only [nextTime, nextPoint, hitPoint, pow_succ, Perm.mul_apply] + +lemma nextTime_min (π : Perm V) (P : Set V) (i : P) {n : ℕ} + (hn : 0 < n) (hp : (π ^ n) i ∈ P) : nextTime π P i ≤ n := by + have he : (π ^ (n - 1)) (π i) ∈ P := by + rw [← Perm.mul_apply, ← pow_succ, Nat.sub_add_cancel hn] + exact hp + have hm := hitTime_le π P (π i) ((hasHit_apply π P i).mpr (hasHit_of_mem π i.property)) he + exact Nat.succ_le_of_lt (lt_of_le_of_lt hm (Nat.sub_lt hn (by omega))) + +lemma nextPoint_injective (π : Perm V) (P : Set V) : Function.Injective (nextPoint π P) := by + have haux (i j : P) (hn : nextTime π P i ≤ nextTime π P j) + (he : nextPoint π P i = nextPoint π P j) : i = j := by + let n := nextTime π P i + let m := nextTime π P j + have hn0 : 0 < n := nextTime_pos π P i + have hm0 : 0 < m := nextTime_pos π P j + have hb : (π ^ (m - n)) (j : V) = (i : V) := by + apply (π ^ n).injective + calc + (π ^ n) ((π ^ (m - n)) (j : V)) = (π ^ m) (j : V) := by + rw [← Perm.mul_apply, ← pow_add, Nat.add_sub_cancel' hn] + _ = (nextPoint π P j : V) := nextPoint_spec π P j + _ = (nextPoint π P i : V) := congrArg Subtype.val he.symm + _ = (π ^ n) (i : V) := (nextPoint_spec π P i).symm + have hz : m - n = 0 := by + by_contra hne + have ht := nextTime_min π P j (Nat.pos_of_ne_zero hne) (hb ▸ i.property) + change m ≤ m - n at ht + omega + apply Subtype.ext + simpa only [hz, pow_zero, Perm.one_apply] using hb.symm + intro i j he + rcases le_total (nextTime π P i) (nextTime π P j) with hle | hle + · exact haux i j hle he + · exact (haux j i hle he.symm).symm + +def nextPermutation (π : Perm V) (P : Set V) : Perm P := + Equiv.ofBijective (nextPoint π P) ((Finite.injective_iff_bijective).mp (nextPoint_injective π P)) + +lemma nextValue_eq_nextPoint (π : Perm V) (P : Set V) (i : P) : + firstValue π P (π i) = some (nextPoint π P i : V) := by + rw [firstValue, dite_eq_left ((hasHit_apply π P i).mpr (hasHit_of_mem π i.property))] + rfl + +end Heisenberg.Return + +namespace Heisenberg.Exposure +open Heisenberg.Return +variable {V : Type*} [Fintype V] + +lemma semiconj_perm_pow {X Y : Type*} (f : X → Y) (π : Equiv.Perm X) (σ : Equiv.Perm Y) + (hf : ∀ x,f (π x)=σ (f x)) (n : ℕ) (x : X) : f ((π^n) x)=(σ^n) (f x) := by + induction n with + | zero => rfl + | succ n ih => rw [pow_succ',Equiv.Perm.mul_apply,hf,ih,pow_succ',Equiv.Perm.mul_apply] + +theorem split_nextPin_eq (σ : Equiv.Perm V) (A P : Set V) + (hA : ∀ x,σ x∉A ↔ x∉A) (hP : Disjoint A P) + (hh : AllHit (splitHolePerm σ A P hA)) + (j : {x : {z : V // z∉A} // x.val∈P}) : + (nextPin (splitHolePerm σ A P hA) hh j).val.val = + (nextPermutation σ P ⟨j.val.val,j.property⟩).val := by + let e := Equiv.sumCompl (fun x : {z : V // z∉A} => x.val∈P) + let f : _ → V := fun x => (e x).val + let π := splitHolePerm σ A P hA + have hf : ∀ x,f (π x)=σ (f x) := by + intro x + simp only [f,π,splitHolePerm,Equiv.permCongr_apply,Equiv.apply_symm_apply,e] + rfl + have hinj : Function.Injective f := Subtype.val_injective.comp e.injective + have hi (k : {x : {z : V // z∉A} // x.val∈P}) : f (Sum.inl k)=k.val.val := rfl + let i : P := ⟨j.val.val,j.property⟩ + let k : {x : {z : V // z∉A} // x.val∈P} := + ⟨⟨(nextPoint σ P i).val,fun h => Set.disjoint_left.mp hP h (nextPoint σ P i).property⟩, + (nextPoint σ P i).property⟩ + let n := firstPinTime π hh (π (Sum.inl j))+1 + have hnp : (σ^n) i.val=(nextPin π hh j).val.val := by + rw [show i.val=f (Sum.inl j) from rfl,←semiconj_perm_pow f π σ hf] + rw [nextPin_spec,hi] + have hmn : nextTime σ P i≤n := nextTime_min σ P i (Nat.succ_pos _) + (hnp ▸ (nextPin π hh j).property) + have hmj : (π^nextTime σ P i) (Sum.inl j)=Sum.inl k := by + apply hinj + rw [semiconj_perm_pow f π σ hf,hi,hi] + exact nextPoint_spec σ P i + have hnm : n≤nextTime σ P i := nextPin_is_first π hh j (nextTime_pos σ P i) hmj + have he : n=nextTime σ P i := Nat.le_antisymm hnm hmn + rw [he,nextPoint_spec] at hnp + exact hnp.symm + +end Heisenberg.Exposure + +open scoped Classical +namespace Heisenberg.Conditioning +variable {Ω : Type*} [Fintype Ω] + +def mass (μ : Ω → ℝ) (E : Ω → Ω → Prop) (b : Ω) : ℝ := + ∑ c,if E b c then μ c else 0 + +def conditional (μ : Ω → ℝ) (E : Ω → Ω → Prop) (F : Ω → ℝ) (b : Ω) : ℝ := + (∑ c,if E b c then μ c * F c else 0)/mass μ E b + +lemma mass_nonneg (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (E : Ω → Ω → Prop) (b : Ω) : + 0 ≤ mass μ E b := Finset.sum_nonneg (by intro c _; split_ifs; exact hμ c; rfl) + +lemma mass_eq (μ : Ω → ℝ) (E : Ω → Ω → Prop) (hE : Equivalence E) + {a b : Ω} (hab : E a b) : mass μ E a=mass μ E b := by + apply Finset.sum_congr rfl + intro c _ + have hh : E a c ↔ E b c := ⟨fun h => hE.trans (hE.symm hab) h,fun h => hE.trans hab h⟩ + simp only [hh] + +lemma weight_le_mass (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (E : Ω → Ω → Prop) + (hr : ∀ b,E b b) (b : Ω) : μ b ≤ mass μ E b := by + simpa only [mass,ite_eq_left (hr b)] using Finset.single_le_sum + (s:=Finset.univ) (f:=fun c => if E b c then μ c else 0) + (by intro c _; split_ifs; exact hμ c; rfl) (Finset.mem_univ b) + +theorem tower (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (E : Ω → Ω → Prop) + (hE : Equivalence E) (F : Ω → ℝ) : + (∑ b,μ b*conditional μ E F b)=∑ c,μ c*F c := by + simp only [conditional,Finset.sum_div,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro c _ + by_cases hc : μ c=0 + · simp [hc] + have hm : mass μ E c≠0 := ne_of_gt (lt_of_lt_of_le (lt_of_le_of_ne (hμ c) (Ne.symm hc)) + (weight_le_mass μ hμ E hE.refl c)) + have hs : (∑ b, μ b*((if E b c then μ c*F c else 0)/mass μ E b)) = + (mass μ E c/mass μ E c)*(μ c*F c) := by + change _ = (∑ b,if E c b then μ b else 0)/(mass μ E c)*(μ c*F c) + rw [Finset.sum_div,Finset.sum_mul] + apply Finset.sum_congr rfl + intro b _ + by_cases hb : E b c + · rw [ite_eq_left hb,ite_eq_left (hE.symm hb),mass_eq μ E hE hb] + ring + · rw [ite_eq_right hb,ite_eq_right (fun h => hb (hE.symm h))] + simp + rw [hs,div_self hm,one_mul] + +theorem expected_le (μ : Ω → ℝ) (hμ : ∀ c,0≤μ c) (E : Ω → Ω → Prop) + (hE : Equivalence E) (F G : Ω → ℝ) + (h : ∀ b,μ b≠0 → conditional μ E F b≤G b) : + (∑ c,μ c*F c)≤∑ b,μ b*G b := by + rw [←tower μ hμ E hE F] + apply Finset.sum_le_sum + intro b _ + by_cases hb : μ b=0 + · simp [hb] + · exact mul_le_mul_of_nonneg_left (h b hb) (hμ b) + +end Heisenberg.Conditioning +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ReversedExposure.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ReversedExposure.lean new file mode 100644 index 0000000000000000000000000000000000000000..5033f875cf727e1cfc8ff6a32e9cd2ed5cd17b59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ReversedExposure.lean @@ -0,0 +1,260 @@ +import OAI.MathematicalPhysics.Heisenberg.ScheduledResiduals + +namespace OAI + +section +noncomputable section +open scoped BigOperators Classical + +end + +noncomputable section +open scoped BigOperators Classical +namespace Heisenberg.Exposure +open Heisenberg.Geometry Heisenberg.SpatialFrame Heisenberg.SparseWitness Heisenberg.LatticeRegular + +lemma layerBlocked_frame {X B T : Type} [Fintype B] [Nonempty B] [Fintype T] + (Λ : Finset X) (s : Equiv.Perm T) (τ : T → Equiv.Perm (Slots (B:=B) Λ)) + (P : Set (T×Slots (B:=B) Λ)) (base : T → Bool) (t : T) : + layerBlocked (fun v : Slots (B:=B) Λ=>v.1.val) s τ P base t = + blocked Λ (holeCut s τ base P t) := by + ext x + constructor + · rintro ⟨⟨v,hv⟩,hh⟩ + have hx : x∈Λ := hv ▸ v.1.property + refine ⟨hx,?_⟩ + intro a + exact hh (⟨x,hx⟩,a) rfl + · rintro ⟨hx,hh⟩ + refine ⟨⟨(⟨x,hx⟩,Classical.choice inferInstance),rfl⟩,?_⟩ + intro v hv + obtain ⟨⟨y,hy⟩,a⟩ := v + dsimp only at hv + subst y + exact hh a + +theorem uniform_layer_regularity (k M b : ℕ) (hb : 100≤b) + (α L ν a : ℝ) (hα : 0≤α) (hL : (2*(k+1):ℕ)≤L) + (hba : 2≤(b:ℝ)^α) (hν : 0<ν) (ha : 0≤a) : + ∃ p₀>0,∃ C≥0,∀ (T V : Type) [Fintype T] [Fintype V] (loc : V → Site (k+1)) (s : Equiv.Perm T) + (u v : T → V) (P : Set (T×V)) (rates : T → ℝ) + (_hrates : ∀ i,0≤rates i ∧ rates i≤1) (t : T) (p : ℝ), + 0≤p → p≤p₀ → + (∀ U : Finset V,localGrowth loc α L U → (∀ j∈U,(t,j)∉P) → + (∑ c,if ∀ j∈U,(t,j)∈Cycle.MissingSet + (layerHistory s (fun i=>Equiv.swap (u i) (v i)) c) P then + layerMass s u v P rates c else 0)≤p^U.card) → + ∀ (x : Site (k+1)) (R : ℕ), + (∑ c,if ¬Regular (layerBlocked loc s (fun i=>Equiv.swap (u i) (v i)) P c t) + x R M ν then layerMass s u v P rates c else 0) ≤ + C*((1+(R:ℝ))^(k+1)*p^(2*(k+1))+(1+(R:ℝ))^(-a)) := by + obtain ⟨p₀,hp₀,C,hC,hr⟩ := regularity_probability k M b hb α L ν a hα hL hba hν ha + refine ⟨p₀,hp₀,C,hC,?_⟩ + intro T V _ _ loc s u v P rates hrates t p hp hpp htest x R + apply hr (T → Bool) (layerMass s u v P rates) + (fun c=>layerBlocked loc s (fun i=>Equiv.swap (u i) (v i)) P c t) p + (layerMass_nonneg s u v P rates hrates) (layerMass_sum s u v P rates hrates).le hp hpp _ x R + intro F hF + exact layer_blocked_mass_le loc s (fun i=>Equiv.swap (u i) (v i)) P t + (layerMass s u v P rates) (layerMass_nonneg s u v P rates hrates) + α L p hp htest F hF + +end Heisenberg.Exposure + +end + +noncomputable section +open scoped BigOperators Classical Fin.NatCast +namespace Heisenberg.Schedule +open Heisenberg.MeshPair Heisenberg.Exposure Heisenberg.Serial Heisenberg.Clocks +variable {T V X : Type} [Fintype T] [Fintype V] [DecidableEq V] [PseudoMetricSpace X] + +theorem indexed_cyclic_localization {m q Q : ℕ} [NeZero m] [NeZero q] + (s : Equiv.Perm T) (e : Fin m ≃ T) (he : ∀ j,s (e j)=e (finRotate m j)) + (hQ : 0Equiv.swap (a i) (b i)) base P (e t)∩I) : + (∑ base,layerMass s a b P p base * + (∑ j,if (R:ℝ)exposedStep s a b base P I p (e (run t l))) n j v else 0)) ≤ + ((u+1+R).choose R:ℝ)*(2*(B:ℝ)*δ)^R := by + let edge : ℕ → Fin q := fun j=>⟨(run t j).val%Q%q,Nat.mod_lt _ (NeZero.pos q)⟩ + let time : ℕ → Fin (u+1) := fun j=>⟨min (round t Q j) u,by omega⟩ + let index : Fin (u+1) → Fin q → Bool → T⊕T := fun g edge c=> + if c then Sum.inl (e (clock t Q g edge)) else Sum.inr (e (clock t Q g edge)) + have htime : Monotone time := by + intro i j hij + exact min_le_min_right u (round_mono t hij) + have hother (j : Fin m) (hj : q≤j.val%Q) (v : V) : + loc (Equiv.swap (a (e j)) (b (e j)) v)=loc v := by + by_cases ha : v=a (e j) + · subst v; simpa using (hsite j hj).symm + by_cases hb : v=b (e j) + · subst v; simpa using hsite j hj + rw [Equiv.swap_apply_of_ne_of_ne ha hb] + have hsp (j : ℕ) (hj : (run t j).val%Qe (run t j)) (Set.Iio n) := by + intro i hi j hj h + exact run_inj t hn hi hj (e.injective h) + apply exposedPrefix_localization choices next B hB loc s a b P I p hp + (fun j=>e (run t j)) n (u+1) R + (fun j _=>by rw [run_succ,←he]) hir edge time index htime + · intro j _ w + by_cases hj : (run t j).val%Q simp only [index,Bool.false_eq_true,ite_false,ite_true,Sum.elim_inr,Sum.elim_inl,Heisenberg.Bernoulli.doubleRates,one_mul] + · linarith [(hp (e (clock t Q g edge))).1] + · exact hh + · simpa only [run_zero] using hv + +end Heisenberg.Schedule + +end + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Cycle +open Equiv +variable {V : Type*} [Fintype V] + +omit [Fintype V] in +lemma missingSet_inv (π : Perm V) (P : Set V) : MissingSet π⁻¹ P=MissingSet π P := by + ext i + simp only [MissingSet,Set.mem_ofPred_eq,ne_eq,classOf_eq_iff,Perm.sameCycle_inv] + +omit [Fintype V] in +lemma colorSpace_inv (π : Perm V) (P : Set V) : colorSpace π⁻¹ P=colorSpace π P := by + ext f + simp only [colorSpace_mem] + constructor + · rintro ⟨h,hP⟩ + exact ⟨fun i=>(by simpa using (h (π i)).symm),hP⟩ + · rintro ⟨h,hP⟩ + exact ⟨fun i=>(by simpa using (h (π⁻¹ i)).symm),hP⟩ + +lemma missingCount_inv (π : Perm V) (P : Set V) : missingCount π⁻¹ P=missingCount π P := by + have h : 2^missingCount π⁻¹ P=2^missingCount π P := by + rw [←card_colorSpace,←card_colorSpace,colorSpace_inv] + exact (Nat.pow_right_injective (by decide : 1<2)) h +end Heisenberg.Cycle + +namespace Heisenberg.Exposure +open Heisenberg.Cycle Heisenberg.LayeredExchange Heisenberg.Bernoulli Heisenberg.MeshPair +variable {T V : Type*} [Fintype T] [Fintype V] [DecidableEq V] + +omit [Fintype T] [Fintype V] in +lemma layerHistory_reverse (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) : + layerHistory s.symm (fun j=>Equiv.swap (a (s.symm j)) (b (s.symm j))) (base ∘ s.symm)= + (layerHistory s (fun j=>Equiv.swap (a j) (b j)) base)⁻¹ := by + apply eq_inv_iff_mul_eq_one.mpr + apply Equiv.ext + rintro ⟨t,v⟩ + simp only [Equiv.Perm.mul_apply,layerHistory,wiring_apply,Function.comp_apply, + Equiv.symm_apply_apply,Equiv.Perm.one_apply] + cases base t <;> simp + +omit [Fintype T] [Fintype V] in +lemma holeCut_reverse (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (t : T) : + holeCut s.symm (fun j=>Equiv.swap (a (s.symm j)) (b (s.symm j))) (base ∘ s.symm) P t= + holeCut s (fun j=>Equiv.swap (a j) (b j)) base P t := by + simp only [holeCut,layerHistory_reverse,missingSet_inv] + +omit [DecidableEq V] in +lemma layerWeight_reverse (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) : + layerWeight s.symm (a ∘ s.symm) (b ∘ s.symm) P (base ∘ s.symm)=layerWeight s a b P base := by + simp only [layerWeight,Function.comp_apply,layerHistory_reverse,missingCount_inv] + +omit [Fintype V] [DecidableEq V] in +lemma coin_reverse (s : Equiv.Perm T) (p : T → ℝ) (base : T → Bool) : + weight (p ∘ s.symm) (base ∘ s.symm)=weight p base := by + unfold weight + exact s.symm.prod_comp (fun i=>if base i then p i else 1-p i) + +omit [DecidableEq V] in +lemma layerPartition_reverse (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) (p : T → ℝ) : + layerPartition s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm)=layerPartition s a b P p := by + unfold layerPartition + let e : (T → Bool) ≃ (T → Bool) := Equiv.arrowCongr s (Equiv.refl Bool) + conv_lhs => rw [←e.sum_comp] + apply Finset.sum_congr rfl + intro c _ + change weight (p ∘ s.symm) (c ∘ s.symm)*layerWeight s.symm (a ∘ s.symm) (b ∘ s.symm) P (c ∘ s.symm)=_ + rw [coin_reverse,layerWeight_reverse] + +omit [DecidableEq V] in +lemma layerMass_reverse (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) (p : T → ℝ) + (base : T → Bool) : + layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm) (base ∘ s.symm)=layerMass s a b P p base := by + rw [layerMass,layerMass,coin_reverse,layerWeight_reverse,layerPartition_reverse] + +omit [Fintype T] [Fintype V] in +lemma revealed_reverse (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (t : T) : + layerRevealed (fun j=>Equiv.swap (a (s.symm j)) (b (s.symm j))) + (MissingSet (layerHistory s.symm (fun j=>Equiv.swap (a (s.symm j)) (b (s.symm j))) (base ∘ s.symm)) P) t ↔ + layerRevealed (fun j=>Equiv.swap (a j) (b j)) + (MissingSet (layerHistory s (fun j=>Equiv.swap (a j) (b j)) base) P) (s.symm t) := by + rw [layerHistory_reverse,missingSet_inv] + by_cases hab : a (s.symm t)=b (s.symm t) + · simp [layerRevealed,hab] + rw [layerRevealed_swap (fun j=>a (s.symm j)) (fun j=>b (s.symm j)) _ t hab, + layerRevealed_swap a b _ (s.symm t) hab] + have h₁ := missing_apply (layerHistory s (fun j=>Equiv.swap (a j) (b j)) base) P (s.symm t,a (s.symm t)) + have h₂ := missing_apply (layerHistory s (fun j=>Equiv.swap (a j) (b j)) base) P (s.symm t,b (s.symm t)) + simp only [layerHistory,wiring_apply,Equiv.apply_symm_apply] at h₁ h₂ + cases h : base (s.symm t) <;> simp [h] at h₁ h₂ + · exact or_congr h₁ h₂ + · exact (or_congr h₂ h₁).trans or_comm + +omit [Fintype T] [Fintype V] in +lemma exposedStep_reverse (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (t : T) : + exposedStep s.symm (a ∘ s.symm) (b ∘ s.symm) (base ∘ s.symm) P I (p ∘ s.symm) t= + (exposedStep s a b base P I p (s.symm t)).transpose := by + simp only [exposedStep,Function.comp_apply,holeCut_reverse] + rw [revealed_reverse,residualBetween_transpose] + simp + +end Heisenberg.Exposure +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RoundEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RoundEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..fccb9197e74256fc332da0f3e17f83127fa15d1e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RoundEnergy.lean @@ -0,0 +1,296 @@ +import OAI.MathematicalPhysics.Heisenberg.MeanLeakage + +namespace OAI + +noncomputable section + +open Filter Topology +open Module +open scoped Classical +open scoped Classical BigOperators +open scoped BigOperators Classical + +open scoped BigOperators Classical RealInnerProductSpace +namespace Heisenberg.MeshPair +open Heisenberg.MatrixContraction +variable {V : Type*} [Fintype V] [DecidableEq V] + +@[simp] lemma euclideanMap_one : euclideanMap (1 : Matrix V V ℝ) = LinearMap.id := by + ext v i + simp [euclideanMap_apply] + +omit [DecidableEq V] in +lemma euclideanMap_mul (A B : Matrix V V ℝ) (v : EuclideanSpace ℝ V) : + euclideanMap (A*B) v = euclideanMap A (euclideanMap B v) := by + ext i + change ((A*B).mulVec v.ofLp) i = (A.mulVec (B.mulVec v.ofLp)) i + rw [Matrix.mulVec_mulVec] + +lemma substochastic_one : DoublySubstochastic (1 : Matrix V V ℝ) := by + constructor + · intro i j; simp only [Matrix.one_apply]; split_ifs <;> norm_num + · intro i + change (∑ j, if i=j then (1:ℝ) else 0)≤1 + simp + · intro i + change (∑ j, if j=i then (1:ℝ) else 0)≤1 + simp + +def prefixMatrix (K : ℕ → Matrix V V ℝ) : ℕ → Matrix V V ℝ + | 0 => 1 + | n+1 => K n*prefixMatrix K n + +lemma prefix_substochastic (K : ℕ → Matrix V V ℝ) (n : ℕ) + (hK : ∀ i,i exact substochastic_one + | succ n ih => exact (hK n (by omega)).mul (ih (fun i hi=>hK i (by omega))) + +lemma prefix_add (K : ℕ → Matrix V V ℝ) (m n : ℕ) : + prefixMatrix K (m+n)=prefixMatrix (fun i=>K (m+i)) n*prefixMatrix K m := by + induction n with + | zero => simp [prefixMatrix] + | succ n ih => + change K (m+n)*prefixMatrix K (m+n)=(K (m+n)*prefixMatrix (fun i=>K (m+i)) n)*prefixMatrix K m + rw [ih,Matrix.mul_assoc] + +omit [DecidableEq V] in +lemma euclideanMap_bounds (A : Matrix V V ℝ) (hA : DoublySubstochastic A) + (f : EuclideanSpace ℝ V) (hf : ∀ i,0≤f.ofLp i ∧ f.ofLp i≤1) : + ∀ i,0≤(euclideanMap A f).ofLp i ∧ (euclideanMap A f).ofLp i≤1 := by + intro i + simp only [euclideanMap_apply,Matrix.mulVec,dotProduct] + constructor + · exact Finset.sum_nonneg (fun j _=>mul_nonneg (hA.nonneg i j) (hf j).1) + · calc + _ ≤ ∑ j,A i j*1 := Finset.sum_le_sum (fun j _=>mul_le_mul_of_nonneg_left (hf j).2 (hA.nonneg i j)) + _ ≤ 1 := by simpa using hA.row i + +lemma pairing_columns (A : Matrix V V ℝ) (J : Finset V) (f : EuclideanSpace ℝ V) : + ⟪euclideanMap A (WithLp.toLp 2 (fun j=>if j∈J then (1:ℝ) else 0)),f⟫ = + ∑ j∈J,∑ i,A i j*f.ofLp i := by + rw [EuclideanSpace.inner_eq_star_dotProduct] + change (∑ i, f.ofLp i*(A.mulVec (fun j=>if j∈J then (1:ℝ) else 0) i))=_ + simp only [Matrix.mulVec,dotProduct,mul_ite,mul_one,mul_zero, + Finset.sum_ite_mem,Finset.univ_inter,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + ring + +end Heisenberg.MeshPair + +namespace Heisenberg.Exposure +open Heisenberg.MeshPair Heisenberg.MatrixContraction +variable {T V : Type*} [Fintype T] [Fintype V] [DecidableEq V] + +omit [Fintype T] in +lemma exposedSweep_prefix (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (r : ℕ → T) (n : ℕ) + (v : EuclideanSpace ℝ V) : + exposedSweep s a b base P I p r n v = + euclideanMap (prefixMatrix (fun i=>exposedStep s a b base P I p (r i)) n) v := by + induction n with + | zero => simp [exposedSweep,prefixMatrix] + | succ n ih => rw [exposedSweep,prefixMatrix,euclideanMap_mul,ih] + +omit [Fintype T] in +lemma exposedSweep_add (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (r : ℕ → T) (m n : ℕ) + (v : EuclideanSpace ℝ V) : + exposedSweep s a b base P I p r (m+n) v = + exposedSweep s a b base P I p (fun i=>r (m+i)) n + (exposedSweep s a b base P I p r m v) := by + simp only [exposedSweep_prefix,prefix_add,euclideanMap_mul] + +omit [Fintype T] in +lemma exposedSweep_bounds (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (hp : ∀ i,0≤p i ∧ p i≤1) + (r : ℕ → T) (n : ℕ) (v : EuclideanSpace ℝ V) + (hv : ∀ i,0≤v.ofLp i ∧ v.ofLp i≤1) : + ∀ i,0≤(exposedSweep s a b base P I p r n v).ofLp i ∧ + (exposedSweep s a b base P I p r n v).ofLp i≤1 := by + rw [exposedSweep_prefix] + exact euclideanMap_bounds _ (prefix_substochastic _ n (fun i _=> + exposedStep_substochastic s a b base P I p hp (r i))) v hv + +omit [Fintype T] in +lemma exposedSweep_supported (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (r : ℕ → T) (n : ℕ) + (hr : ∀ i,iEquiv.swap (a i) (b i)) base P (r 0)∩I → v.ofLp j=0) : + ∀ j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r n)∩I → + (exposedSweep s a b base P I p r n v).ofLp j=0 := by + cases n with + | zero => exact hv + | succ n => + intro j hj + rw [hr n (by omega)] at hj + exact residualBetween_supported _ _ _ _ _ _ _ _ j hj + +end Heisenberg.Exposure + +open scoped BigOperators Classical RealInnerProductSpace +open Filter Topology +namespace Heisenberg.MeshPair +variable {V : Type*} [Fintype V] [DecidableEq V] +lemma quietSweep_congr (H D : Set V) (a b c d : ℕ → V) (t : ℝ) (q : ℕ) + (ha : ∀ i,i rfl + | succ q ih => rw [quietSweep,quietSweep,ha q (by omega),hb q (by omega), + ih (fun i hi=>ha i (by omega)) (fun i hi=>hb i (by omega))] +omit [Fintype V] [DecidableEq V] in +lemma quietEnergy_congr (H : Set V) (a b c d : ℕ → V) (q : ℕ) + (ha : ∀ i,iEquiv.swap (a i) (b i)) base P (r 0)∩I → + (v base).ofLp j=0) → + (∑ base,layerMass s a b P p base * + (t*MeshPair.quietEnergy (holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)) + a₀ b₀ q (v base))) ≤ + (∑ base,layerMass s a b P p base * + (‖v base‖^2-‖exposedSweep s a b base P I p r q (v base)‖^2))+ + ε*t*Fintype.card V+t^2*q^2 := by + filter_upwards [quietSweep_energy a₀ b₀ q hab hε] with t ht + intro ht0 _ht2 T _ s a b r hr ha hb p hp hrate P I v hv hvI + have hab' : ∀ i,iEquiv.swap (a i) (b i)) base P (r 0)) a₀ b₀ q (v base) ≤ + ‖v base‖^2-‖exposedSweep s a b base P I p r q (v base)‖^2+ + ε*t*‖v base‖^2+(if ∃ i,iEquiv.swap (a i) (b i)) base P (r 0)) + a₀ b₀ q (v base) (hv base)) ht0 + have hz : 0≤ε*t*‖v base‖^2 := by positivity + linarith + · rw [ite_eq_right hnon] + have hquiet : ∀ i,it/2) r q hrate (v base) + rw [heq,exposedSweep_quiet s a b base P I r q t hr hquiet hab' (v base), + quietSweep_congr _ _ (a ∘ r) (b ∘ r) a₀ b₀ t q ha hb] + have he := (abs_le.mp (ht (holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)) (holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)∩I) (v base) (hvI base))).2 + rw [abs_of_nonneg ht0] at he + linarith + have hs := layerMass_sum s a b P p hp + have h := Finset.sum_le_sum (s:=Finset.univ) (fun base _=> + mul_le_mul_of_nonneg_left (hl base) (layerMass_nonneg s a b P p hp base)) + have he : (∑ base,layerMass s a b P p base*(ε*t*‖v base‖^2))≤ + ε*t*Fintype.card V := by + calc + _ ≤ ∑ base,layerMass s a b P p base*(ε*t*Fintype.card V) := + Finset.sum_le_sum (fun base _=>mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left (bounded_euclidean_sq (v base) (hv base)) (by positivity)) + (layerMass_nonneg s a b P p hp base)) + _ = _ := by rw [←Finset.sum_mul,hs,one_mul] + have hn := tilted_nonquiet_error s a b P p hp r q ht0 hrate + simp only [mul_add,Finset.sum_add_distrib] at h + linarith + +lemma exposedSweep_norm_antitone {T : Type} [Fintype T] + (s : Equiv.Perm T) (a b : T → V) (base : T → Bool) + (P : Set (T×V)) (I : Set V) (p : T → ℝ) (hp : ∀ j,0≤p j ∧ p j≤1) + (r : ℕ → T) {m n : ℕ} (hmn : m≤n) (v : EuclideanSpace ℝ V) : + ‖exposedSweep s a b base P I p r n v‖≤‖exposedSweep s a b base P I p r m v‖ := by + obtain ⟨l,rfl⟩ := Nat.exists_eq_add_of_le hmn + rw [exposedSweep_add] + exact exposedSweep_contraction s a b base P I p hp _ _ _ + +theorem round_energy (a₀ b₀ : ℕ → V) (q : ℕ) + (hab : ∀ j,jEquiv.swap (a i) (b i)) base P (r 0)∩I → + (f base).ofLp j=0) → + ∀ i, t*(∑ base,layerMass s a b P p base * + MeshPair.quietEnergy (holeCut s (fun j=>Equiv.swap (a j) (b j)) base P (r (c i))) + a₀ b₀ q (exposedSweep s a b base P I p r (c i) (f base))) ≤ + (∑ base,layerMass s a b P p base * + (‖exposedSweep s a b base P I p r (c i) (f base)‖^2- + ‖exposedSweep s a b base P I p r (c (i+1)) (f base)‖^2))+ + ε*t*Fintype.card V+t^2*q^2 := by + filter_upwards [fixed_sweep_energy a₀ b₀ q hab hε] with t ht + intro ht0 ht2 T _ s a b r c hr hc ha hb p hp hrate P I f hf hs i + let v : (T → Bool) → EuclideanSpace ℝ V := + fun base=>exposedSweep s a b base P I p r (c i) (f base) + have hv (base : T → Bool) : ∀ j,0≤(v base).ofLp j ∧ (v base).ofLp j≤1 := + exposedSweep_bounds s a b base P I p hp r (c i) (f base) (hf base) + have hvI (base : T → Bool) : ∀ j, + j∉holeCut s (fun j=>Equiv.swap (a j) (b j)) base P (r (c i))∩I → (v base).ofLp j=0 := + exposedSweep_supported s a b base P I p r (c i) (fun j _=>hr j) (f base) (hs base) + have hseg : ∀ j,jr (c i+j)) hseg (ha i) (hb i) + p hp (hrate i) P I v hv (by simpa only [Nat.add_zero] using hvI) + simp only [Nat.add_zero] at h + have hcolon (base : T → Bool) : + ‖exposedSweep s a b base P I p (fun j=>r (c i+j)) q (v base)‖^2 ≥ + ‖exposedSweep s a b base P I p r (c (i+1)) (f base)‖^2 := by + change ‖exposedSweep s a b base P I p (fun j=>r (c i+j)) q + (exposedSweep s a b base P I p r (c i) (f base))‖^2≥_ + rw [←exposedSweep_add] + exact pow_le_pow_left₀ (norm_nonneg _) (exposedSweep_norm_antitone s a b base P I p hp r (hc i) (f base)) 2 + rw [Finset.mul_sum] + have hrew : (∑ base,layerMass s a b P p base*(t*MeshPair.quietEnergy + (holeCut s (fun j=>Equiv.swap (a j) (b j)) base P (r (c i))) a₀ b₀ q (v base)))= + ∑ base,t*(layerMass s a b P p base*MeshPair.quietEnergy + (holeCut s (fun j=>Equiv.swap (a j) (b j)) base P (r (c i))) a₀ b₀ q (v base)) := by + apply Finset.sum_congr rfl + intro base _ + ring + rw [hrew] at h + apply h.trans + apply add_le_add _ (le_refl _) + apply add_le_add _ (le_refl _) + apply Finset.sum_le_sum + intro base _ + exact mul_le_mul_of_nonneg_left (sub_le_sub_left (hcolon base) _) (layerMass_nonneg s a b P p hp base) + +end Heisenberg.Exposure + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RoutedDissipation.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RoutedDissipation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0c69a58a3d80c8bdc72ea91c4f452232fa7faf3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RoutedDissipation.lean @@ -0,0 +1,263 @@ +import OAI.MathematicalPhysics.Heisenberg.RegularKernels + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical +open scoped Classical BigOperators +open scoped Classical BigOperators + +namespace Heisenberg.Flow +open Heisenberg.Geometry Heisenberg.LatticeRegular Heisenberg.RoutedFlow Heisenberg.SlotMaximum +variable {X B : Type*} + +def frameEnergy (R : X → X → Prop) (Λ : Finset X) (s : X → Finset B) + (v : X → B → ℝ) : ℝ := + ∑ x∈Λ,∑ y∈Λ,if R x y then ∑ a∈s x,∑ b∈s y,(v x a-v y b)^2 else 0 + +lemma frameEnergy_nonneg (R : X → X → Prop) (Λ : Finset X) (s : X → Finset B) + (v : X → B → ℝ) : 0≤frameEnergy R Λ s v := by + apply Finset.sum_nonneg + intro x _ + apply Finset.sum_nonneg + intro y _ + split_ifs + · exact Finset.sum_nonneg (fun a _ => Finset.sum_nonneg (fun b _ => sq_nonneg _)) + · rfl + +lemma test_support_subset (s : X → Finset B) (v : X → B → ℝ) (F : Finset X) + (hvF : ∀ x,x∉F → ∀ a∈s x,v x a=0) : (test s v F hvF).support⊆F := by + intro x hx + by_contra hn + have hz := zero_of_zero (s x) (v x) (hvF x hn) + exact (Finsupp.mem_support_iff.mp hx) hz + +theorem finite_frame_energy (G : SimpleGraph X) (hG : ∀ x,(G.neighborSet x).Finite) + (R : X → X → Prop) (hR : ∀ x y,G.Adj x y → R x y) + (Λ F : Finset X) (hF : F⊆Λ) + (hframe : ∀ x∈F,∀ y,G.Adj x y → y∈Λ) + (s : X → Finset B) (v : X → B → ℝ) + (hvF : ∀ x,x∉F → ∀ a∈s x,v x a=0) : + (∑ e∈(graphNetwork G hG).edges (test s v F hvF), + ∑ a∈s e.fst,∑ b∈s e.snd,(v e.fst a-v e.snd b)^2) ≤ frameEnergy R Λ s v := by + let E := (graphNetwork G hG).edges (test s v F hvF) + let f : X×X → ℝ := fun p => if R p.1 p.2 then + ∑ a∈s p.1,∑ b∈s p.2,(v p.1 a-v p.2 b)^2 else 0 + have he (e : G.Dart) (h : e∈E) : e.fst∈Λ ∧ e.snd∈Λ := by + have hh := (Network.mem_edges (graphNetwork G hG) (test s v F hvF) e).mp h + rcases hh with hh|hh + · have hhF := test_support_subset s v F hvF hh + exact ⟨hF hhF,hframe e.fst hhF e.snd e.adj⟩ + · have hhF := test_support_subset s v F hvF hh + exact ⟨hframe e.snd hhF e.fst e.adj.symm,hF hhF⟩ + have hnon (p : X×X) : 0≤f p := by + dsimp [f] + split_ifs + · exact Finset.sum_nonneg (fun a _ => Finset.sum_nonneg (fun b _ => sq_nonneg _)) + · rfl + have hmap : E.image (fun e => e.toProd)⊆Λ×ˢΛ := by + intro p hp + obtain ⟨e,heE,rfl⟩ := Finset.mem_image.mp hp + exact Finset.mem_product.mpr (he e heE) + calc + _ = ∑ e∈E,f e.toProd := Finset.sum_congr rfl (fun e _ => by simp only [f,ite_eq_left (hR _ _ e.adj)]) + _ = ∑ p∈E.image (fun e => e.toProd),f p := by + symm + apply Finset.sum_image + intro e _ d _ h + exact SimpleGraph.Dart.ext e d h + _ ≤ ∑ p∈Λ×ˢΛ,f p := Finset.sum_le_sum_of_subset_of_nonneg hmap (fun p _ _ => hnon p) + _ = _ := by rw [Finset.sum_product]; rfl + +variable {k : ℕ} + +theorem regular_frame_test (hk : 2≤k) (L : ℝ) (hL : 0≤L) : + ∃ M : ℕ,∃ C≥0,∀ (I V B : Type*) [Fintype I] [Fintype V] + (K : V → I → ℝ) (x : I → ZSite k) (y : V → ZSite k) + (Z : Set (ZSite k)) (_hZ : Z.Finite) (R : ℕ) (s : ZSite k → Finset B) + (slot : V → B) (v : ZSite k → B → ℝ) (Λ F : Finset (ZSite k)) + (_hvF : ∀ z,z∉F → ∀ a∈s z,v z a=0), + F⊆Λ → (∀ z∈F,∀ w,Step z w → w∈Λ) → + (∀ j i,0≤K j i) → (∀ i,∑ j,K j i≤1) → + (∀ z r,0≤r → ((Finset.univ.filter (fun i => dist (x i) z≤r)).card:ℝ) ≤ L*(1+r)^((1:ℝ)/100)) → + (∀ j i,K j i≠0 → y j∉Z ∧ slot j∈s (y j)) → + (∀ z,z∉Z → (s z).Nonempty) → (∀ z a,0≤v z a) → + (∑ i,∑ j,goodMass K x y Z R M i j*v (y j) (slot j))^2 ≤ + (C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I))*frameEnergy Step Λ s v := by + obtain ⟨M,C,hC,htest⟩ := regular_kernel_test hk L hL + refine ⟨M,C,hC,?_⟩ + intro I V B _ _ K x y Z hZ R s slot v Λ F hvF hF hframe hK hm hg hs ha hv + have hh := htest I V B K x y Z hZ R s slot v F hvF hK hm hg hs ha hv + apply hh.trans + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact finite_frame_energy (latticeGraph Zᶜ) (lattice_neighbor_finite Zᶜ) Step + (fun _ _ h => h.1) Λ F hF (fun z hz w h => hframe z hz w h.1) s v hvF + +end Heisenberg.Flow + +namespace Heisenberg.Exposure +variable {V : Type*} [Fintype V] +def quietEnergy (H : Set V) (a b : ℕ → V) (n : ℕ) (v : EuclideanSpace ℝ V) : ℝ := + ∑ i ∈ Finset.range n,if a i ∈ H ∧ b i ∈ H then (v.ofLp (a i)-v.ofLp (b i))^2 else 0 +end Heisenberg.Exposure + +namespace Heisenberg.SpatialFrame + +section +variable {X B : Type*} [Fintype B] +abbrev Slots (Λ : Finset X) := Λ × B + +def available (Λ : Finset X) (H : Set (Slots (B:=B) Λ)) (x : X) : Finset B := + if hx : x∈Λ then Finset.univ.filter (fun a => (⟨x,hx⟩,a)∈H) else Finset.univ + +def extend (Λ : Finset X) (v : Slots (B:=B) Λ → ℝ) (x : X) (a : B) : ℝ := + if hx : x∈Λ then v (⟨x,hx⟩,a) else 0 + +omit [Fintype B] in +lemma extend_apply (Λ : Finset X) (v : Slots (B:=B) Λ → ℝ) (x : Λ) (a : B) : + extend Λ v x a=v (x,a) := by simp [extend] + +lemma available_apply (Λ : Finset X) (H : Set (Slots (B:=B) Λ)) (x : Λ) (a : B) : + a∈available Λ H x ↔ (x,a)∈H := by simp [available] + +lemma available_nonempty (Λ : Finset X) [Nonempty B] (H : Set (Slots (B:=B) Λ)) + (x : X) (hx : ¬∃ h : x∈Λ,∀ a : B,(⟨x,h⟩,a)∉H) : + (available Λ H x).Nonempty := by + by_cases h : x∈Λ + · have hx : ∃ a : B,(⟨x,h⟩,a)∈H := by + by_contra hn + apply hx + exact ⟨h,by simpa only [not_exists] using hn⟩ + obtain ⟨a,ha⟩ := hx + exact ⟨a,by simpa [available,h] using ha⟩ + · simp [available,h] + +omit [Fintype B] in +lemma extend_nonneg (Λ : Finset X) (v : Slots (B:=B) Λ → ℝ) (hv : ∀ j,0≤v j) : + ∀ x a,0≤extend Λ v x a := by + intro x a + dsimp [extend] + split_ifs + · exact hv _ + · rfl + +omit [Fintype B] in +lemma extend_supported (Λ F : Finset X) (v : Slots (B:=B) Λ → ℝ) + (hv : ∀ j,j.1.val∉F → v j=0) : ∀ x,x∉F → ∀ a,extend Λ v x a=0 := by + intro x hx a + dsimp [extend] + split_ifs + · exact hv _ hx + · rfl + +abbrev Edges (R : X → X → Prop) (Λ : Finset X) := + {e : Slots (B:=B) Λ × Slots (B:=B) Λ // R e.1.1 e.2.1} + +lemma frame_eq_pairs (R : X → X → Prop) (Λ : Finset X) + (H : Set (Slots (B:=B) Λ)) (v : Slots (B:=B) Λ → ℝ) : + Heisenberg.Flow.frameEnergy R Λ (available Λ H) (extend Λ v) = + ∑ e : Edges R Λ,if e.val.1∈H ∧ e.val.2∈H then (v e.val.1-v e.val.2)^2 else 0 := by + unfold Heisenberg.Flow.frameEnergy + simp_rw [←Finset.sum_coe_sort Λ] + have he := Finset.sum_subtype + (Finset.univ.filter (fun e : Slots (B:=B) Λ × Slots (B:=B) Λ => R e.1.1 e.2.1)) + (p:=fun e => R e.1.1 e.2.1) (F:=inferInstance) (by simp) + (fun e => if e.1∈H ∧ e.2∈H then (v e.1-v e.2)^2 else 0) + rw [←he] + simp only [Finset.sum_filter,Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro x _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y _ + by_cases hr : R x y + · simp only [hr,ite_true,available,extend,dite_eq_left x.property,dite_eq_left y.property,Finset.sum_filter] + apply Finset.sum_congr rfl + intro a _ + by_cases hh : (x,a)∈H + · simp only [hh,ite_true,true_and] + · simp [hh] + · simp [hr] + +theorem frame_eq_sweep (R : X → X → Prop) (Λ : Finset X) + (H : Set (Slots (B:=B) Λ)) (v : EuclideanSpace ℝ (Slots (B:=B) Λ)) + (a b : ℕ → Slots (B:=B) Λ) (n : ℕ) + (e : Fin n ≃ Edges R Λ) + (ha : ∀ i : Fin n,a i=(e i).val.1) (hb : ∀ i : Fin n,b i=(e i).val.2) : + Heisenberg.Flow.frameEnergy R Λ (available Λ H) (extend Λ v.ofLp) = + Heisenberg.Exposure.quietEnergy H a b n v := by + rw [frame_eq_pairs] + rw [←e.sum_comp] + unfold Heisenberg.Exposure.quietEnergy + rw [←Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i _ + rw [ha i,hb i] + +end + +variable {X B : Type*} [Fintype B] +def blocked (Λ : Finset X) (H : Set (Slots (B:=B) Λ)) : Set X := + {x | ∃ h : x∈Λ,∀ a : B,(⟨x,h⟩,a)∉H} + +omit [Fintype B] in +lemma blocked_finite (Λ : Finset X) (H : Set (Slots (B:=B) Λ)) : + (blocked Λ H).Finite := Λ.finite_toSet.subset (fun _ h => h.choose) + +omit [Fintype B] in +lemma hole_not_blocked (Λ : Finset X) (H : Set (Slots (B:=B) Λ)) + (j : Slots (B:=B) Λ) (hj : j∈H) : j.1.val∉blocked Λ H := by + rintro ⟨h,hb⟩ + exact hb j.2 hj + +lemma available_unblocked (Λ : Finset X) [Nonempty B] (H : Set (Slots (B:=B) Λ)) + (x : X) (hx : x∉blocked Λ H) : (available Λ H x).Nonempty := available_nonempty Λ H x hx +end Heisenberg.SpatialFrame + +namespace Heisenberg.Flow +open Heisenberg.Geometry Heisenberg.RoutedFlow Heisenberg.SpatialFrame +variable {k : ℕ} + +theorem routed_sweep_pair (hk : 2≤k) (L : ℝ) (hL : 0≤L) : + ∃ M : ℕ,∃ C≥0,∀ (I B : Type*) [Fintype I] [Fintype B] [Nonempty B] + (Λ F : Finset (ZSite k)) (H : Set (Slots (B:=B) Λ)) + (x : I → ZSite k) (K : Slots (B:=B) Λ → I → ℝ) + (v : EuclideanSpace ℝ (Slots (B:=B) Λ)) (R : ℕ) + (a b : ℕ → Slots (B:=B) Λ) (n : ℕ) (e : Fin n ≃ Edges Step Λ), + (∀ i : Fin n,a i=(e i).val.1) → (∀ i : Fin n,b i=(e i).val.2) → + F⊆Λ → (∀ z∈F,∀ w,Step z w → w∈Λ) → + (∀ j,j.1.val∉F → v.ofLp j=0) → + (∀ j i,0≤K j i) → (∀ i,∑ j,K j i≤1) → + (∀ z r,0≤r → ((Finset.univ.filter (fun i => dist (x i) z≤r)).card:ℝ) ≤ L*(1+r)^((1:ℝ)/100)) → + (∀ j i,K j i≠0 → j∈H) → (∀ j,0≤v.ofLp j) → + (∑ i,∑ j,goodMass K x (fun j=>j.1.val) (blocked Λ H) R M i j*v.ofLp j)^2 ≤ + (C*(1+(R:ℝ))^((1:ℝ)/100)*(Fintype.card I))* + Heisenberg.Exposure.quietEnergy H a b n v := by + obtain ⟨M,C,hC,h⟩ := regular_frame_test hk L hL + refine ⟨M,C,hC,?_⟩ + intro I B _ _ _ Λ F H x K v R a b n e ha hb hF hframe hvF hK hm hg hKH hv + have hvext : ∀ z,z∉F → ∀ a∈available Λ H z,extend Λ v.ofLp z a=0 := by + intro z hz a _ + exact extend_supported Λ F v.ofLp hvF z hz a + have hs : ∀ j i,K j i≠0 → j.1.val∉blocked Λ H ∧ j.2∈available Λ H j.1 := by + intro j i hji + exact ⟨hole_not_blocked Λ H j (hKH j i hji),(available_apply Λ H j.1 j.2).mpr (hKH j i hji)⟩ + have hh := h I (Slots (B:=B) Λ) B K x (fun j=>j.1.val) (blocked Λ H) + (blocked_finite Λ H) R (available Λ H) (fun j=>j.2) (extend Λ v.ofLp) + Λ F hvext hF hframe hK hm hg hs (available_unblocked Λ H) (extend_nonneg Λ v.ofLp hv) + simp only [extend_apply] at hh + rw [frame_eq_sweep Step Λ H v a b n e ha hb] at hh + exact hh + +end Heisenberg.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/RoutedNetworks.lean b/lean/OAI/MathematicalPhysics/Heisenberg/RoutedNetworks.lean new file mode 100644 index 0000000000000000000000000000000000000000..8961350b61a583e3821605ce6043f003c1607f2f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/RoutedNetworks.lean @@ -0,0 +1,318 @@ +import OAI.MathematicalPhysics.Heisenberg.RegularComponents + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology + +namespace Heisenberg.HullRouting +open Heisenberg.Geometry Heisenberg.LatticeCut Heisenberg.LatticeHull Heisenberg.LatticeComponents +variable {d : ℕ} + +theorem radial_hull_bounds (hd : 2 ≤ d) (Z : Set (Site d)) (hZ : Z.Finite) + (y : Site d) (ν C : ℝ) (hν : 0 ≤ ν) (hC : 0 ≤ C) + (hcomp : ∀ z ∈ Z, ∀ w ∈ Component Z z, dist z w ≤ C*(1+dist z y)^ν) : + ∃ (b : Site d) (c : Set (Site d) → Site d) (r : Set (Site d) → ℕ), + b ∉ Thick 4 Z ∧ + ∀ H ∈ maxHulls Z hZ b, + H ⊆ Ball (r H : ℤ) (c H) ∧ + (r H : ℝ)+1 ≤ (C+6)*(1+dist (c H) y)^ν := by + let ρ (z : Site d) : ℕ := ⌈C*(1+dist z y)^ν⌉₊+4 + have hrad (z : Site d) : (ρ z : ℝ)+1 ≤ (C+6)*(1+dist z y)^ν := by + have hp : 1 ≤ (1+dist z y)^ν := Real.one_le_rpow (by linarith [dist_nonneg (x:=z) (y:=y)]) hν + have hceil := Nat.ceil_lt_add_one (show 0 ≤ C*(1+dist z y)^ν from mul_nonneg hC (Real.rpow_nonneg (by positivity) _)) + dsimp [ρ] + push_cast + nlinarith + have hthick (z : Site d) (hz : z ∈ Z) : Thick 4 (Component Z z) ⊆ Ball (ρ z : ℤ) z := by + rintro w ⟨a,ha,hwa⟩ + have haB : a ∈ Ball (⌈C*(1+dist z y)^ν⌉₊ : ℤ) z := + (dist_le_iff_mem_ball z a).mp ((hcomp z hz a ha).trans (Nat.le_ceil _)) + simpa only [ρ,Nat.cast_add,Nat.cast_ofNat] using ball_triangle haB hwa + let U : Set (Site d) := ⋃ z ∈ Z, Ball (ρ z : ℤ) z + have hU : U.Finite := hZ.biUnion (fun z _ => ball_finite (ρ z) z) + obtain ⟨N,hN⟩ := finite_contained_box U hU + let b : Site d := fun _ => (N:ℤ)+1 + have hbN : b ∉ Box (N:ℤ) := by + intro h + have h0 := h ⟨0,by omega⟩ + simp only [b,abs_of_nonneg (by positivity : (0:ℤ) ≤ (N:ℤ)+1)] at h0 + omega + have hb (z : Site d) (hz : z ∈ Z) : b ∉ Ball (ρ z : ℤ) z := by + intro h + apply hbN (hN ?_) + exact Set.mem_iUnion.mpr ⟨z,Set.mem_iUnion.mpr ⟨hz,h⟩⟩ + have hbZ : b ∉ Thick 4 Z := by + rintro ⟨z,hz,hbz⟩ + apply hb z hz + exact ball_mono (by dsimp [ρ]; omega) z hbz + have hroot : ∀ H ∈ maxHulls Z hZ b, ∃ z ∈ Z, Hull (Thick 4 (Component Z z)) b = H := by + intro H hH + exact (mem_allHulls ..).mp ((mem_maxHulls ..).mp hH).prop + let c (H : Set (Site d)) : Site d := if h : H ∈ maxHulls Z hZ b then (hroot H h).choose else 0 + have hc (H : Set (Site d)) (hH : H ∈ maxHulls Z hZ b) : + c H ∈ Z ∧ Hull (Thick 4 (Component Z (c H))) b = H := by + simpa only [c,dite_eq_left hH] using (hroot H hH).choose_spec + refine ⟨b,c,fun H => ρ (c H),hbZ,?_⟩ + intro H hH + refine ⟨?_,hrad (c H)⟩ + simpa only [(hc H hH).2] using hull_subset_ball hd _ _ _ (by positivity) (hthick _ (hc H hH).1) (hb _ (hc H hH).1) + +lemma collapse_finite_fibers (F : Finset (Set (Site d))) (rep : Set (Site d) → Site d) + (hfin : ∀ H ∈ F, H.Finite) (w : Site d) : (collapse F rep ⁻¹' {w}).Finite := by + apply ((F.finite_toSet.biUnion hfin).union (Set.finite_singleton w)).subset + intro z hz + by_cases h : ∃ H ∈ F, z ∈ H + · obtain ⟨H,hH,hzH⟩ := h + exact Or.inl (Set.mem_iUnion.mpr ⟨H,Set.mem_iUnion.mpr ⟨hH,hzH⟩⟩) + · exact Or.inr (by simpa only [Set.mem_preimage,Set.mem_singleton_iff,collapse_free rep h] using hz) + +end Heisenberg.HullRouting + +namespace Heisenberg.Geometry +lemma walk_support_mem {d : ℕ} {U : Set (Site d)} {u v : Site d} + (p : (latticeGraph U).Walk u v) (hu : u ∈ U) : ∀ z ∈ p.support, z ∈ U := by + induction p with + | nil => simpa only [SimpleGraph.Walk.support_nil,List.mem_singleton] using (fun z hz => hz ▸ hu) + | @cons u v w huv p ih => + intro z hz + simp only [SimpleGraph.Walk.support_cons,List.mem_cons] at hz + rcases hz with rfl | hz + · exact hu + · exact ih huv.2.2 z hz +end Heisenberg.Geometry + +namespace Heisenberg.HullRouting +open Heisenberg.Geometry Heisenberg.LatticeCut Heisenberg.LatticeHull Heisenberg.LatticeComponents +variable {d : ℕ} + +lemma collapse_mem_region (Z : Set (Site d)) (F : Finset (Set (Site d))) + (rep c : Set (Site d) → Site d) (r : Set (Site d) → ℕ) + (hrep : ∀ H ∈ F, rep H ∈ Boundary H) + (hbound : ∀ H ∈ F, H ⊆ Ball (r H:ℤ) (c H)) + (hsurvive : ∀ u, collapse F rep u ∉ Z) (u v : Site d) : + collapse F rep u ∈ RouteRegion Z F (fun H => Ball ((r H:ℤ)+1) (c H)) u v := by + refine ⟨?_,hsurvive u⟩ + by_cases h : ∃ H ∈ F, u ∈ H + · unfold collapse + rw [dite_eq_left h] + exact Or.inr (Or.inr ⟨h.choose,h.choose_spec.1,Or.inl h.choose_spec.2, + boundary_subset_ball _ _ _ (hbound _ h.choose_spec.1) (hrep _ h.choose_spec.1)⟩) + · exact Or.inl (collapse_free rep h) + +theorem radial_routing (hd : 2 ≤ d) (ν C : ℝ) (hν0 : 0 ≤ ν) (hν1 : ν < 1) (hC : 0 ≤ C) : + ∃ D ≥ 1, ∀ (Z : Set (Site d)) (_hZ : Z.Finite) (y : Site d), + (∀ z ∈ Z, ∀ w ∈ Component Z z, dist z w ≤ C*(1+dist z y)^ν) → + ∃ ψ : Site d → Site d, + (∀ u, ψ u ∉ Z) ∧ (∀ w, (ψ ⁻¹' {w}).Finite) ∧ + ∀ u v, Step u v → ∃ p : (latticeGraph Zᶜ).Walk (ψ u) (ψ v), + p.IsPath ∧ ∀ z ∈ p.support, dist u z ≤ D*(1+dist u y)^ν := by + obtain ⟨D,hD,hdisp⟩ := RoutingDecay.neighborhood_displacement (V:=Site d) hν0 hν1 (show 1 ≤ C+6 by linarith) + refine ⟨D,hD,?_⟩ + intro Z hZ y hcomp + obtain ⟨b,c,r,hb,hbound⟩ := radial_hull_bounds hd Z hZ y ν C hν0 hC hcomp + obtain ⟨rep,hrep,hsurvive,hpaths⟩ := finite_hull_routing Z hZ b hb + let F := maxHulls Z hZ b + let ψ := collapse F rep + refine ⟨ψ,hsurvive,?_,?_⟩ + · apply collapse_finite_fibers + intro H hH + exact (ball_finite (r H) (c H)).subset (hbound H hH).1 + · intro u v huv + let U := RouteRegion Z F (fun H => Ball ((r H:ℤ)+1) (c H)) u v + obtain ⟨p,hp⟩ := hpaths c (fun H => r H) (fun H hH => (hbound H hH).1) u v huv + have hG : latticeGraph U ≤ latticeGraph Zᶜ := by + intro a b hab + exact ⟨hab.1,hab.2.1.2,hab.2.2.2⟩ + refine ⟨p.mapLe hG,hp.mapLe hG,?_⟩ + intro z hz + rw [SimpleGraph.Walk.support_mapLe_eq_support] at hz + have hstart : ψ u ∈ U := collapse_mem_region Z F rep c r hrep + (fun H hH => (hbound H hH).1) hsurvive u v + have hzU := walk_support_mem p hstart z hz + have hunit : 1 ≤ D*(1+dist u y)^ν := one_le_mul_of_one_le_of_one_le hD + (Real.one_le_rpow (by linarith [dist_nonneg (x:=u) (y:=y)]) hν0) + rcases hzU.1 with rfl | rfl | ⟨H,hH,hincident,hzH⟩ + · exact (by simp : dist z z ≤ 1).trans hunit + · exact (step_dist_le_one huv).trans hunit + · have hzc : dist z (c H) ≤ (C+6)*(1+dist (c H) y)^ν := by + have h := (dist_le_iff_mem_ball (r:=r H+1) (c H) z).mpr (by simpa only [Nat.cast_add,Nat.cast_one] using hzH) + rw [dist_comm (c H) z] at h + push_cast at h + exact h.trans (hbound H hH).2 + have hqc (q : Site d) (hq : q ∈ H) : dist q (c H)+1 ≤ (C+6)*(1+dist (c H) y)^ν := by + have h := (dist_le_iff_mem_ball (c H) q).mpr ((hbound H hH).1 hq) + rw [dist_comm (c H) q] at h + linarith [(hbound H hH).2] + rcases hincident with huH | hvH + · exact hdisp y u u (c H) z (by simp) (hqc u huH) hzc + · exact hdisp y u v (c H) z (step_dist_le_one huv) (hqc v hvH) hzc + +end Heisenberg.HullRouting + +open scoped Classical +namespace Heisenberg.RoutedFlow + +lemma sum_eq_of_zero_off {E : Type*} (s t : Finset E) (f : E → ℝ) + (hs : ∀ e ∈ s, e ∉ t → f e = 0) (ht : ∀ e ∈ t, e ∉ s → f e = 0) : + (∑ e ∈ s, f e) = ∑ e ∈ t, f e := by + calc + _ = ∑ e ∈ s ∩ t, f e := by + symm + apply Finset.sum_subset Finset.inter_subset_left + intro e he hne + exact hs e he (fun h => hne (Finset.mem_inter.mpr ⟨he,h⟩)) + _ = ∑ e ∈ t, f e := by + apply Finset.sum_subset Finset.inter_subset_right + intro e he hne + exact ht e he (fun h => hne (Finset.mem_inter.mpr ⟨h,he⟩)) + +structure Network (V E : Type*) where + src : E → V + dst : E → V + incidentFinite : ∀ v, {e | src e = v ∨ dst e = v}.Finite + +namespace Network +variable {V E : Type*} (N : Network V E) + +def gradient (g : V → ℝ) (e : E) : ℝ := g (N.src e) - g (N.dst e) + +def edges (g : V →₀ ℝ) : Finset E := + g.support.biUnion (fun v => (N.incidentFinite v).toFinset) + +lemma mem_edges (g : V →₀ ℝ) (e : E) : + e ∈ N.edges g ↔ N.src e ∈ g.support ∨ N.dst e ∈ g.support := by + simp only [edges,Finset.mem_biUnion,Set.Finite.mem_toFinset,Set.mem_ofPred_eq] + constructor + · rintro ⟨v,hv,h|h⟩ + · exact Or.inl (h ▸ hv) + · exact Or.inr (h ▸ hv) + · rintro (h|h) + · exact ⟨N.src e,h,Or.inl rfl⟩ + · exact ⟨N.dst e,h,Or.inr rfl⟩ + +lemma gradient_zero_of_not_mem (g : V →₀ ℝ) {e : E} (he : e ∉ N.edges g) : + N.gradient g e = 0 := by + have h := mt (N.mem_edges g e).mpr he + push Not at h + simp only [Finsupp.notMem_support_iff] at h + simp [gradient,h.1,h.2] + +def pairing (F : E → ℝ) (g : V →₀ ℝ) : ℝ := + ∑ e ∈ N.edges g, F e * N.gradient g e + +lemma pairing_eq_sum (F : E → ℝ) (g : V →₀ ℝ) (s : Finset E) + (hs : ∀ e, N.gradient g e ≠ 0 → e ∈ s) : + N.pairing F g = ∑ e ∈ s, F e * N.gradient g e := by + unfold pairing + apply sum_eq_of_zero_off + · intro e he hne + rw [show N.gradient g e = 0 from by_contra (fun h => hne (hs e h)),mul_zero] + · intro e he hne + rw [N.gradient_zero_of_not_mem g hne,mul_zero] + +def UnitFlow (F : E → ℝ) (y : V) : Prop := ∀ g : V →₀ ℝ, N.pairing F g = g y + +lemma pairing_finsupp (F : E →₀ ℝ) (g : V →₀ ℝ) : + N.pairing F g = ∑ e ∈ F.support, F e * N.gradient g e := by + unfold pairing + apply sum_eq_of_zero_off + · intro e he hne + rw [Finsupp.notMem_support_iff.mp hne,zero_mul] + · intro e he hne + rw [N.gradient_zero_of_not_mem g hne,mul_zero] + +end Network + +variable {V E W T : Type*} + +def pullback (ψ : V → W) (hψ : ∀ w, (ψ ⁻¹' {w}).Finite) (g : W →₀ ℝ) : V →₀ ℝ := + Finsupp.ofSupportFinite (fun v => g (ψ v)) (by + apply Set.Finite.subset (Set.Finite.biUnion g.support.finite_toSet (fun w _ => hψ w)) + intro v hv + simp only [Set.mem_iUnion] + exact ⟨ψ v,Finsupp.mem_support_iff.mpr hv,rfl⟩) + +@[simp] lemma pullback_apply (ψ : V → W) (hψ : ∀ w, (ψ ⁻¹' {w}).Finite) + (g : W →₀ ℝ) (v : V) : pullback ψ hψ g v = g (ψ v) := rfl + +structure Routing (S : Network V E) (N : Network W T) (ψ : V → W) where + current : E → T →₀ ℝ + locallyFinite : ∀ t, {e | current e t ≠ 0}.Finite + telescopes : ∀ e (g : W →₀ ℝ), N.pairing (current e) g = g (ψ (S.src e)) - g (ψ (S.dst e)) + +namespace Routing +variable {S : Network V E} {N : Network W T} {ψ : V → W} (R : Routing S N ψ) + +def sources (s : Finset T) : Finset E := s.biUnion (fun t => (R.locallyFinite t).toFinset) + +lemma mem_sources (s : Finset T) (e : E) : e ∈ R.sources s ↔ ∃ t ∈ s, R.current e t ≠ 0 := by + simp [sources] + +def push (F : E → ℝ) (t : T) : ℝ := + ∑ e ∈ (R.locallyFinite t).toFinset, F e * R.current e t + +lemma push_eq_sum (F : E → ℝ) (s : Finset T) {t : T} (ht : t ∈ s) : + R.push F t = ∑ e ∈ R.sources s, F e * R.current e t := by + unfold push + apply Finset.sum_subset + · intro e he + exact (R.mem_sources s e).mpr ⟨t,ht,(R.locallyFinite t).mem_toFinset.mp he⟩ + · intro e he hne + rw [show R.current e t = 0 from by simpa using hne, mul_zero] + +lemma pairing_push (F : E → ℝ) (g : W →₀ ℝ) : + N.pairing (R.push F) g = + ∑ e ∈ R.sources (N.edges g), F e * N.pairing (R.current e) g := by + unfold Network.pairing + calc + _ = ∑ t ∈ N.edges g, ∑ e ∈ R.sources (N.edges g), + F e * R.current e t * N.gradient g t := by + apply Finset.sum_congr rfl + intro t ht + rw [R.push_eq_sum F _ ht,Finset.sum_mul] + _ = _ := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro e _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + ring + +lemma source_gradient_zero (hψ : ∀ w, (ψ ⁻¹' {w}).Finite) (g : W →₀ ℝ) + {e : E} (he : e ∉ R.sources (N.edges g)) : S.gradient (pullback ψ hψ g) e = 0 := by + have hzero : N.pairing (R.current e) g = 0 := by + apply Finset.sum_eq_zero + intro t ht + have hct : R.current e t = 0 := by + by_contra h + exact he ((R.mem_sources _ e).mpr ⟨t,ht,h⟩) + rw [hct,zero_mul] + rw [R.telescopes] at hzero + exact hzero + +theorem push_unit (hψ : ∀ w, (ψ ⁻¹' {w}).Finite) (F : E → ℝ) (y : V) + (hF : S.UnitFlow F y) : N.UnitFlow (R.push F) (ψ y) := by + intro g + rw [R.pairing_push] + have hsum := S.pairing_eq_sum F (pullback ψ hψ g) (R.sources (N.edges g)) + (fun e he => by_contra (fun h => he (R.source_gradient_zero hψ g h))) + rw [show (∑ e ∈ R.sources (N.edges g), F e * N.pairing (R.current e) g) = + S.pairing F (pullback ψ hψ g) from by + rw [hsum] + apply Finset.sum_congr rfl + intro e _ + rw [R.telescopes] + rfl] + exact hF _ + +end Routing +end Heisenberg.RoutedFlow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ScheduledResiduals.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ScheduledResiduals.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cace83ac826eaf8e4a92f3452911dfdf065c4b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ScheduledResiduals.lean @@ -0,0 +1,311 @@ +import OAI.MathematicalPhysics.Heisenberg.CutContractions + +namespace OAI + +section +noncomputable section +open scoped Classical Fin.NatCast + +noncomputable section +open scoped BigOperators Classical +namespace Heisenberg.Serial +open Heisenberg.MeshPair Heisenberg.Exposure Heisenberg.Bernoulli Heisenberg.Clocks +variable {V T X E : Type} [Fintype V] [DecidableEq V] [Fintype T] + [PseudoMetricSpace X] [Fintype E] + +omit [Fintype T] [PseudoMetricSpace X] [Fintype E] in +lemma product_snoc (n : ℕ) (K : Fin (n+1) → Matrix V V ℝ) : + product (n+1) K=K (Fin.last n)*product n (fun i=>K i.castSucc) := by + induction n with + | zero => simp [product] + | succ n ih => + rw [product,ih,product,Matrix.mul_assoc] + rfl + +omit [Fintype T] [PseudoMetricSpace X] [Fintype E] in +lemma prefix_product (K : ℕ → Matrix V V ℝ) (n : ℕ) : + prefixMatrix K n=product n (fun i=>K i) := by + induction n with + | zero => rfl + | succ n ih => + rw [prefixMatrix,product_snoc] + simpa only [Fin.val_last,Fin.val_castSucc] using congrArg (K n * ·) ih + +omit [Fintype V] [Fintype T] [PseudoMetricSpace X] [Fintype E] in +lemma residualBetween_coin (D F : Set V) (M : Prop) (base : Bool) (a b : V) (p : ℝ) : + (∑ z : Bool,(if z then p else 1-p) • + killedBetween D F (if (if M then base else z) then Equiv.swap a b else 1))= + residualBetween D F M base a b p := by + by_cases hM : M + · simp only [hM,ite_true,residualBetween] + rw [←Finset.sum_smul] + simp + · simp [hM,residualBetween,add_comm] + +omit [Fintype T] [PseudoMetricSpace X] [Fintype E] in +lemma mul_projection_column (A : Matrix V V ℝ) (D : Set V) {j : V} (hj : j∈D) (v : V) : + (A*projection D) v j=A v j := by + simp only [Matrix.mul_apply,projection,killedBetween,Equiv.Perm.one_apply] + rw [Finset.sum_eq_single j] + · simp [hj] + · intro k _ hk + simp [hk] + · simp + +omit [Fintype T] [PseudoMetricSpace X] [Fintype E] in +lemma sampledPrefix_exposed (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) + (I : Set V) (p : T → ℝ) (r : ℕ → T) (n : ℕ) + (hr : ∀ j,jEquiv.swap (a (r j)) (b (r j))) p r + (fun base=>layerRevealed (fun i=>Equiv.swap (a i) (b i)) + (Heisenberg.Cycle.MissingSet (layerHistory s (fun i=>Equiv.swap (a i) (b i)) base) P)) n + (fun base j=>holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r j)∩I) base= + prefixMatrix (fun j=>exposedStep s a b base P I p (r j)) n * + projection (holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)∩I) := by + rw [sampledPrefix,prefix_product] + congr 1 + congr 1 + funext j + rw [residualBetween_coin] + simp only [exposedStep,Fin.val_castSucc,Fin.val_succ,hr j j.isLt] + +theorem exposedPrefix_localization + (choices : X → Finset E) (next : X → E → X) (B : ℕ) (hB : ∀ x,(choices x).card≤B) + (loc : V → X) (s : Equiv.Perm T) (a b : T → V) (P : Set (T×V)) + (I : Set V) (p : T → ℝ) (hp : ∀ j,0≤p j ∧ p j≤1) + (r : ℕ → T) (n N R : ℕ) (hr : ∀ j,j(2:ℝ)) (fun _=>(1:ℝ)) (index t e c))* + doubleRates p (index t e c)≤δ) + (v : V) (hv : ∀ base,v∈holeCut s (fun i=>Equiv.swap (a i) (b i)) base P (r 0)∩I) : + (∑ base,layerMass s a b P p base * + (∑ j,if (R:ℝ)exposedStep s a b base P I p (r l)) n j v else 0)) ≤ + ((N+R).choose R:ℝ)*(2*(B:ℝ)*δ)^R := by + let τ := fun j=>Equiv.swap (a j) (b j) + let M := fun base=>layerRevealed τ (Heisenberg.Cycle.MissingSet (layerHistory s τ base) P) + let D := fun base (j : Fin (n+1))=>holeCut s τ base P (r j)∩I + have h := sampledPrefix_localization choices next B hB (fun j=>τ (r j)) loc v r n N R hir + edge time index htime hstep hmove hindex M p hp (κ:=2) (by norm_num) hδ + (layerWeight s a b P) (layerWeight_nonneg s a b P) (layerWeight_insertion s a b P) + D hrate + have he (base : T → Bool) (j : V) : + sampledPrefix (fun j=>τ (r j)) p r M n D base j v= + prefixMatrix (fun l=>exposedStep s a b base P I p (r l)) n j v := by + rw [sampledPrefix_exposed s a b P I p r n hr base] + exact mul_projection_column _ _ (hv base) j + simp only [he] at h + have hz : 0Equiv.swap (a i) (b i)) base P t∩I) : + (∑ base,layerMass (finRotate m) a b P p base * + (∑ j,if (R:ℝ)exposedStep (finRotate m) a b base P I p (run t l)) n j v else 0)) ≤ + ((u+1+R).choose R:ℝ)*(2*(B:ℝ)*δ)^R := by + let edge : ℕ → Fin q := fun j=>⟨(run t j).val%Q%q,Nat.mod_lt _ (NeZero.pos q)⟩ + let time : ℕ → Fin (u+1) := fun j=>⟨min (round t Q j) u,by omega⟩ + let index : Fin (u+1) → Fin q → Bool → Fin m⊕Fin m := fun g e c=> + if c then Sum.inl (clock t Q g e) else Sum.inr (clock t Q g e) + have htime : Monotone time := by + intro i j hij + exact min_le_min_right u (round_mono t hij) + have hother (j : Fin m) (hj : q≤j.val%Q) (v : V) : + loc (Equiv.swap (a j) (b j) v)=loc v := by + by_cases ha : v=a j + · subst v; simpa using (hsite j hj).symm + by_cases hb : v=b j + · subst v; simpa using hsite j hj + rw [Equiv.swap_apply_of_ne_of_ne ha hb] + have hsp (j : ℕ) (hj : (run t j).val%Qrun_succ t j) (run_inj t hn) edge time index htime + ?_ ?_ ?_ hδ ?_ v ?_) using 1 + · congr 1 + ext x + simp + · intro j _ w + by_cases hj : (run t j).val%Q simp only [index,Bool.false_eq_true,ite_false,ite_true,Sum.elim_inr,Sum.elim_inl,Heisenberg.Bernoulli.doubleRates,one_mul] + · linarith [(hp (clock t Q g e)).1] + · exact hh + · simpa only [run_zero] using hv + +end Heisenberg.Schedule + +end +end +end + +noncomputable section +open scoped BigOperators Classical +namespace Heisenberg.SpatialFrame +open Heisenberg.Geometry +variable {d : ℕ} {B : Type} [Fintype B] + +def neighbors (x : Site d) : Finset (Site d) := + Finset.univ.image fun j : Fin d × Bool=>Function.update x j.1 (x j.1+if j.2 then 1 else -1) + +lemma step_mem_neighbors {x y : Site d} (h : Step x y) : y∈neighbors x := by + obtain ⟨j,h,hj⟩:=h + rcases h with h|h + · refine Finset.mem_image.mpr ⟨(j,true),Finset.mem_univ _,?_⟩ + funext k + by_cases hk : k=j + · subst k; simp [h] + · simp [hk,←hj k hk] + · refine Finset.mem_image.mpr ⟨(j,false),Finset.mem_univ _,?_⟩ + funext k + by_cases hk : k=j + · subst k; simp; omega + · simp [hk,←hj k hk] + +lemma neighbors_card (x : Site d) : (neighbors x).card≤2*d := by + exact (Finset.card_image_le).trans (by simp [mul_comm]) + +def choices (Λ : Finset (Site d)) (x : Site d) : Finset (Edges (B:=B) Step Λ) := + Finset.univ.filter fun e=>e.val.1.1.val=x ∨ e.val.2.1.val=x + +lemma choices_card (Λ : Finset (Site d)) (x : Site d) : + (choices (B:=B) Λ x).card≤4*d*(Fintype.card B)^2 := by + let C := ((neighbors x).image (fun y=>(x,y)))∪((neighbors x).image (fun y=>(y,x))) + let code : Edges (B:=B) Step Λ → (Site d × Site d) × (B×B) := + fun e=>((e.val.1.1.val,e.val.2.1.val),(e.val.1.2,e.val.2.2)) + have hm : Set.MapsTo code (↑(choices (B:=B) Λ x) : Set (Edges (B:=B) Step Λ)) (↑(C ×ˢ (Finset.univ : Finset (B×B))) : Set ((Site d × Site d) × (B×B))) := by + intro e he + apply Finset.mem_product.mpr + refine ⟨?_,Finset.mem_univ _⟩ + rcases (Finset.mem_filter.mp he).2 with h|h + · apply Finset.mem_union_left + refine Finset.mem_image.mpr ⟨e.val.2.1.val,?_,?_⟩ + · exact step_mem_neighbors (h ▸ e.property) + · exact Prod.ext h.symm rfl + · apply Finset.mem_union_right + refine Finset.mem_image.mpr ⟨e.val.1.1.val,?_,?_⟩ + · exact step_mem_neighbors (h ▸ step_symm e.property) + · exact Prod.ext rfl h.symm + have hi : Function.Injective code := by + intro e f h + apply Subtype.ext + apply Prod.ext + · apply Prod.ext + · exact Subtype.ext (congrArg (fun z : (Site d × Site d) × (B×B)=>z.1.1) h) + · exact congrArg (fun z : (Site d × Site d) × (B×B)=>z.2.1) h + · apply Prod.ext + · exact Subtype.ext (congrArg (fun z : (Site d × Site d) × (B×B)=>z.1.2) h) + · exact congrArg (fun z : (Site d × Site d) × (B×B)=>z.2.2) h + have hC : C.card≤4*d := by + exact (Finset.card_union_le _ _).trans ((add_le_add + (Finset.card_image_le.trans (neighbors_card x)) + (Finset.card_image_le.trans (neighbors_card x))).trans (by omega)) + calc + _ ≤ (C ×ˢ (Finset.univ : Finset (B×B))).card := Finset.card_le_card_of_injOn code hm hi.injOn + _ = C.card*(Fintype.card B)^2 := by simp [pow_two] + _ ≤ _ := Nat.mul_le_mul_right _ hC + +def next (x : Site d) {Λ : Finset (Site d)} (e : Edges (B:=B) Step Λ) : Site d := + if x=e.val.1.1.val then e.val.2.1.val else e.val.1.1.val + +omit [Fintype B] in +lemma edge_site_ne {Λ : Finset (Site d)} (e : Edges (B:=B) Step Λ) : + e.val.1.1.val≠e.val.2.1.val := by + intro h + obtain ⟨j,hj,_⟩:=e.property + rw [h] at hj + omega + +omit [Fintype B] in +lemma swap_step {Λ : Finset (Site d)} (e : Edges (B:=B) Step Λ) (v : Slots (B:=B) Λ) : + dist (Equiv.swap e.val.1 e.val.2 v).1.val v.1.val≤1 := by + by_cases h₁ : v=e.val.1 + · subst v + rw [Equiv.swap_apply_left,dist_comm] + exact step_dist_le_one e.property + by_cases h₂ : v=e.val.2 + · subst v + rw [Equiv.swap_apply_right] + exact step_dist_le_one e.property + rw [Equiv.swap_apply_of_ne_of_ne h₁ h₂] + simp + +lemma swap_move {Λ : Finset (Site d)} (e : Edges (B:=B) Step Λ) (v : Slots (B:=B) Λ) + (h : (Equiv.swap e.val.1 e.val.2 v).1.val≠v.1.val) : + e∈choices Λ v.1.val ∧ (Equiv.swap e.val.1 e.val.2 v).1.val=next v.1.val e := by + by_cases h₁ : v=e.val.1 + · subst v; simp [choices,next] + by_cases h₂ : v=e.val.2 + · subst v; simp [choices,next,(edge_site_ne e).symm] + rw [Equiv.swap_apply_of_ne_of_ne h₁ h₂] at h + exact False.elim (h rfl) + +omit [Fintype B] in +lemma same_site_swap {Λ : Finset (Site d)} (a b v : Slots (B:=B) Λ) + (h : a.1.val=b.1.val) : (Equiv.swap a b v).1.val=v.1.val := by + by_cases ha : v=a + · subst v; simpa using h.symm + by_cases hb : v=b + · subst v; simpa using h + rw [Equiv.swap_apply_of_ne_of_ne ha hb] + +end Heisenberg.SpatialFrame +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SerialBlocks.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SerialBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..b593304552c2084a060fcdfe5f63f5cede72cd70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SerialBlocks.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshProduct + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Serial +open MeshPair +variable {V : Type} [Fintype V] [DecidableEq V] + +lemma prefix_add (K : ℕ → Matrix V V ℝ) (m n : ℕ) : + prefixMatrix K (m+n)=prefixMatrix (fun j=>K (m+j)) n*prefixMatrix K m := by + induction n with + | zero=>simp [prefixMatrix] + | succ n ih=>rw [Nat.add_succ,prefixMatrix,ih,prefixMatrix,Matrix.mul_assoc] + +lemma prefix_congr (K L : ℕ → Matrix V V ℝ) (n : ℕ) + (h : ∀ j,jrfl + | succ n ih=>rw [prefixMatrix,prefixMatrix,h n (by omega),ih (fun j hj=>h j (by omega))] + +lemma prefix_periodic (K : ℕ → Matrix V V ℝ) (Q k : ℕ) : + prefixMatrix (fun j=>K (j%Q)) (k*Q)=(prefixMatrix (fun j=>K (j%Q)) Q)^k := by + induction k with + | zero=>simp [prefixMatrix] + | succ k ih=> + rw [Nat.succ_mul,prefix_add,ih,pow_succ'] + congr 1 + apply prefix_congr + intro j _ + rw [Nat.add_mod] + simp + +lemma prefix_period (K : ℕ → Matrix V V ℝ) (Q : ℕ) : + prefixMatrix (fun j=>K (j%Q)) Q=prefixMatrix K Q := by + apply prefix_congr + intro j hj + rw [Nat.mod_eq_of_lt hj] + +lemma completed_sweeps (A P : ℕ → Matrix V V ℝ) (q c k : ℕ) : + let Q:=q+c + let base : ℕ → Matrix V V ℝ:=fun j=>if jif jif jbase (j%Q)) (k*Q) + · apply prefix_congr; intro j hj; simp [all,hj] + rw [prefix_periodic,prefix_period] + congr 1 + change prefixMatrix base (q+c)=_ + rw [prefix_add] + have he : prefixMatrix (fun j=>base (q+j)) c=1 := by + suffices ∀ n,prefixMatrix (fun j=>base (q+j)) n=1 from this c + intro n + induction n with + | zero=>rfl + | succ n ih=>rw [prefixMatrix,ih]; simp [base] + rw [he,Matrix.one_mul] + apply prefix_congr; intro j hj; simp [base,hj] + have hlast : prefixMatrix (fun j=>all (k*Q+j)) Q=prefixMatrix P c*prefixMatrix A q := by + trans prefixMatrix final Q + · apply prefix_congr; intro j _; simp [all] + change prefixMatrix final (q+c)=_ + rw [prefix_add] + congr 1 + · apply prefix_congr; intro j _; simp [final] + · apply prefix_congr; intro j hj; simp [final,hj] + rw [hfirst,hlast,Matrix.mul_assoc,pow_succ'] + +end Heisenberg.Serial +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SimultaneousPins.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SimultaneousPins.lean new file mode 100644 index 0000000000000000000000000000000000000000..84a840aa276560bea5404affb16cf066059d3c46 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SimultaneousPins.lean @@ -0,0 +1,307 @@ +import OAI.MathematicalPhysics.Heisenberg.StablePinLaw + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical + +noncomputable section +open scoped Classical +namespace Heisenberg.Pin +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +def subsetLaw (μ : Ω → ℝ) (A : Ω → Finset V) (B : Finset V) : ℝ := + ∑ ω, if A ω = B then μ ω else 0 + +omit [Fintype V] in +lemma subsetLaw_nonneg (μ : Ω → ℝ) (A : Ω → Finset V) + (hμ : ∀ ω, 0 ≤ μ ω) (B : Finset V) : 0 ≤ subsetLaw μ A B := by + apply Finset.sum_nonneg + intro ω _ + split_ifs <;> simp [hμ] + +lemma presence_subsetLaw (μ : Ω → ℝ) (A : Ω → Finset V) (J : Finset V) : + presence (subsetLaw μ A) J = ∑ ω, if J ⊆ A ω then μ ω else 0 := by + have hterm (B : Finset V) : (if J ⊆ B then subsetLaw μ A B else 0) = + ∑ ω, if A ω = B then (if J ⊆ A ω then μ ω else 0) else 0 := by + by_cases hJ : J ⊆ B + · rw [ite_eq_left hJ] + unfold subsetLaw + apply Finset.sum_congr rfl + intro ω _ + by_cases he : A ω = B <;> simp [he, hJ] + · rw [ite_eq_right hJ] + symm + apply Finset.sum_eq_zero + intro ω _ + by_cases he : A ω = B <;> simp [he, hJ] + unfold presence + simp_rw [hterm] + rw [Finset.sum_comm] + simp + +lemma presencePolynomial_subsetLaw (μ : Ω → ℝ) (A : Ω → Finset V) : + presencePolynomial (subsetLaw μ A) ∅ = + ∑ ω, MvPolynomial.C (μ ω : ℂ) * subsetMonomial (A ω) := by + simp only [presencePolynomial, Finset.empty_subset, ite_true, Finset.sdiff_empty, + subsetLaw, Complex.ofReal_sum, map_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro ω _ + simp only [apply_ite, Complex.ofReal_zero, map_zero, ite_mul, zero_mul] + simp + +omit [Fintype V] in +lemma subsetMonomial_image (π : Equiv.Perm V) (T : Finset V) : + subsetMonomial (T.image π) = ∏ i ∈ T, MvPolynomial.X (π i) := by + simp only [subsetMonomial] + exact Finset.prod_image (fun i _ j _ h => π.injective h) + +lemma subsetLaw_output (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (T : Finset V) : + presencePolynomial (subsetLaw μ (fun ω => T.image (π ω))) ∅ = + outputSymbol μ (fun ω => π ω) T := by + rw [presencePolynomial_subsetLaw] + simp only [subsetMonomial_image, outputSymbol] + +theorem finite_output_return_bound (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (h₁ : ∑ ω, μ ω = 1) (hs : Stable (lawSymbol μ π)) + (T : Finset V) (hT : T.Nonempty) : + (∑ ω, if T ⊆ T.image (π ω) then μ ω else 0) ≤ + ((∑ j ∈ T, ∑ ω, if j ∈ T.image (π ω) then μ ω else 0) / T.card) ^ T.card := by + let ν := subsetLaw μ (fun ω => T.image (π ω)) + have hν : ∀ B, 0 ≤ ν B := subsetLaw_nonneg μ _ hμ + have hν₁ : presence ν ∅ = 1 := by + rw [presence_subsetLaw] + simpa using h₁ + have hνs : Stable (presencePolynomial ν ∅) := by + rw [subsetLaw_output] + exact stable_outputSymbol μ π (by rw [h₁]; norm_num) hs T + have hb := presence_mean_bound hν hν₁ hνs T hT + simpa only [ν, presence_subsetLaw, Finset.singleton_subset_iff] using hb + +end Heisenberg.Pin + +noncomputable section +open scoped Classical +namespace Heisenberg.Cycle +open Equiv +variable {V : Type*} [Fintype V] + +lemma missingCount_antitone (π : Perm V) {E P : Set V} (hEP : E ⊆ P) : + missingCount π P ≤ missingCount π E := by + apply Nat.card_le_card_of_injective + (fun c : MissingClasses π P => (⟨c.val, fun i hi => c.property i (hEP hi)⟩ : MissingClasses π E)) + intro a b h + exact Subtype.ext (congrArg (fun c : MissingClasses π E => c.val) h) + +lemma missingCount_union_le (π : Perm V) (E : Set V) (T : Finset V) : + missingCount π E ≤ missingCount π (E ∪ (T : Set V)) + T.card := by + let _ : Fintype (Classes π) := Fintype.ofFinite _ + let A : Finset (Classes π) := Finset.univ.filter (fun c => ∀ i ∈ E, c ≠ classOf π i) + let B : Finset (Classes π) := Finset.univ.filter (fun c => ∀ i ∈ E ∪ (T : Set V), c ≠ classOf π i) + have hA : missingCount π E = A.card := by + simp [missingCount, A, Nat.card_eq_fintype_card, Fintype.card_subtype] + have hB : missingCount π (E ∪ (T : Set V)) = B.card := by + simp [missingCount, B, Nat.card_eq_fintype_card, Fintype.card_subtype] + have hsub : A ⊆ B ∪ T.image (classOf π) := by + intro c hc + have hcE : ∀ i ∈ E, c ≠ classOf π i := (Finset.mem_filter.mp hc).2 + by_cases hcB : c ∈ B + · exact Finset.mem_union_left _ hcB + · apply Finset.mem_union_right + have hh : ¬ ∀ i ∈ E ∪ (T : Set V), c ≠ classOf π i := by + simpa only [B, Finset.mem_filter, Finset.mem_univ, true_and] using hcB + push Not at hh + obtain ⟨i, hi, he⟩ := hh + rcases hi with hi | hi + · exact False.elim (hcE i hi he) + · exact Finset.mem_image.mpr ⟨i, hi, he.symm⟩ + rw [hA, hB] + exact (Finset.card_le_card hsub).trans + ((Finset.card_union_le _ _).trans (Nat.add_le_add_left (Finset.card_image_le) _)) + +theorem pin_weight_comparison (π : Perm V) (E : Set V) (T : Finset V) : + (2 : ℝ) ^ missingCount π (E ∪ (T : Set V)) ≤ (2 : ℝ) ^ missingCount π E ∧ + (2 : ℝ) ^ missingCount π E ≤ + (2 : ℝ) ^ T.card * (2 : ℝ) ^ missingCount π (E ∪ (T : Set V)) := by + constructor + · exact pow_le_pow_right₀ (by norm_num) (missingCount_antitone π Set.subset_union_left) + · calc + (2 : ℝ) ^ missingCount π E ≤ + (2 : ℝ) ^ (missingCount π (E ∪ (T : Set V)) + T.card) := + pow_le_pow_right₀ (by norm_num) (missingCount_union_le π E T) + _ = _ := by rw [pow_add, mul_comm] + +end Heisenberg.Cycle + +noncomputable section +open scoped Classical +namespace Heisenberg.Return +open Equiv +variable {V : Type*} [Fintype V] + +theorem nextPoint_preserves_iff (π : Perm V) (E T : Set V) + (hET : Disjoint E T) : + (∀ i (hi : i ∈ T), (nextPoint π (E ∪ T) ⟨i, Or.inr hi⟩ : V) ∈ T) ↔ + ∀ i ∈ T, ¬ HasHit π E i := by + constructor + · intro hnext + have hall (n : ℕ) : ∀ i ∈ T, (π ^ n) i ∉ E := by + induction n using Nat.strong_induction_on with + | h n ih => + intro i hi hE + have hn : 0 < n := by + by_contra h + have hz : n = 0 := by omega + rw [hz, pow_zero, Perm.one_apply] at hE + exact Set.disjoint_left.mp hET hE hi + let p : ↥(E ∪ T) := ⟨i, Or.inr hi⟩ + let m := nextTime π (E ∪ T) p + have hm0 : 0 < m := nextTime_pos π (E ∪ T) p + have hmn : m ≤ n := nextTime_min π (E ∪ T) p hn (Or.inl hE) + have hlt : n - m < n := Nat.sub_lt hn hm0 + have hp : (nextPoint π (E ∪ T) p : V) ∈ T := hnext i hi + have he : (π ^ (n - m)) (nextPoint π (E ∪ T) p : V) = (π ^ n) i := by + rw [← nextPoint_spec, ← Perm.mul_apply, ← pow_add, Nat.sub_add_cancel hmn] + exact ih _ hlt _ hp (he ▸ hE) + intro i hi ⟨n, hn⟩ + exact hall n i hi hn + · intro havoid i hi + have hp := (nextPoint π (E ∪ T) ⟨i, Or.inr hi⟩).property + rcases hp with hE | hT + · exact False.elim (havoid i hi ⟨nextTime π (E ∪ T) ⟨i, Or.inr hi⟩, + (nextPoint_spec π (E ∪ T) ⟨i, Or.inr hi⟩).symm ▸ hE⟩) + · exact hT + +omit [Fintype V] in +lemma subset_image_iff_mapsTo (π : Perm V) (T : Finset V) : + T ⊆ T.image π ↔ ∀ i ∈ T, π i ∈ T := by + have hc : (T.image π).card = T.card := Finset.card_image_of_injective T π.injective + constructor + · intro h i hi + have he : T.image π = T := (Finset.eq_of_subset_of_card_le h (by omega)).symm + rw [← he] + exact Finset.mem_image.mpr ⟨i, hi, rfl⟩ + · intro h + have hsub : T.image π ⊆ T := by + rintro j hj + obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hj + exact h i hi + rw [Finset.eq_of_subset_of_card_le hsub (by omega)] + +end Heisenberg.Return + +noncomputable section +open scoped Classical +namespace Heisenberg.Pin +attribute [-instance] Subtype.instDecidableEq +open Heisenberg.Cycle Heisenberg.Return +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +omit [Fintype V] in +lemma input_output_card (π : Equiv.Perm V) (T : Finset V) : + (T.filter (fun j => j ∈ T.image π)).card = + (T.filter (fun i => π i ∈ T)).card := by + symm + apply Finset.card_bij (fun i _ => π i) + · intro i hi + obtain ⟨hi, hπ⟩ := Finset.mem_filter.mp hi + exact Finset.mem_filter.mpr ⟨hπ, Finset.mem_image.mpr ⟨i, hi, rfl⟩⟩ + · intro i _ j _ hij + exact π.injective hij + · intro j hj + obtain ⟨hj, hmem⟩ := Finset.mem_filter.mp hj + obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hmem + exact ⟨i, Finset.mem_filter.mpr ⟨hi, hj⟩, rfl⟩ + +omit [Fintype V] in +lemma input_output_sum (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (T : Finset V) : + (∑ j ∈ T, ∑ ω, if j ∈ T.image (π ω) then μ ω else 0) = + ∑ i ∈ T, ∑ ω, if π ω i ∈ T then μ ω else 0 := by + rw [Finset.sum_comm, Finset.sum_comm (s := T)] + apply Finset.sum_congr rfl + intro ω _ + rw [← Finset.sum_filter, ← Finset.sum_filter] + simp only [Finset.sum_const, nsmul_eq_mul, input_output_card] + +def pinPartition (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (P : Set V) : ℝ := + ∑ ω, μ ω * (2 : ℝ) ^ missingCount (π ω) P + +omit [Fintype V] in +lemma pinPartition_pos (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (P : Set V) : + 0 < pinPartition μ π P := by + apply hpos.trans_le + apply Finset.sum_le_sum + intro ω _ + exact le_mul_of_one_le_right (hμ ω) (one_le_pow₀ (by norm_num)) + +def pinDensity (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (P : Set V) (ω : Ω) : ℝ := + (μ ω * (2 : ℝ) ^ missingCount (π ω) P) / pinPartition μ π P + +omit [Fintype V] in +lemma pinDensity_nonneg (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (P : Set V) (ω : Ω) : + 0 ≤ pinDensity μ π P ω := + div_nonneg (mul_nonneg (hμ ω) (by positivity)) (pinPartition_pos μ π hμ hpos P).le + +omit [Fintype V] in +lemma pinDensity_sum (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (P : Set V) : + ∑ ω, pinDensity μ π P ω = 1 := by + simp only [pinDensity, ← Finset.sum_div] + change pinPartition μ π P / pinPartition μ π P = 1 + exact div_self (pinPartition_pos μ π hμ hpos P).ne' + +lemma stable_pinDensity (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) + (hs : Stable (lawSymbol μ π)) (P : Set V) : + Stable (lawSymbol (pinDensity μ π P) (fun ω => nextPermutation (π ω) P)) := by + have he : lawSymbol (pinDensity μ π P) (fun ω => nextPermutation (π ω) P) = + MvPolynomial.C ((pinPartition μ π P : ℂ)⁻¹) * pinLaw μ π P := by + simp only [pinLaw, lawSymbol, pinDensity, Finset.mul_sum] + apply Finset.sum_congr rfl + intro ω _ + push_cast + simp only [div_eq_mul_inv, map_mul] + ring + rw [he] + intro z hz + simp only [map_mul, MvPolynomial.eval_C] + apply mul_ne_zero + · exact inv_ne_zero (Complex.ofReal_ne_zero.mpr (pinPartition_pos μ π hμ hpos P).ne') + · exact stable_pinLaw μ π hμ hpos hs P z hz + +lemma finite_input_return_bound (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (h₁ : ∑ ω, μ ω = 1) (hs : Stable (lawSymbol μ π)) + (T : Finset V) (hT : T.Nonempty) : + (∑ ω, if ∀ i ∈ T, π ω i ∈ T then μ ω else 0) ≤ + ((∑ i ∈ T, ∑ ω, if π ω i ∈ T then μ ω else 0) / T.card) ^ T.card := by + have h := finite_output_return_bound μ π hμ h₁ hs T hT + rw [input_output_sum] at h + simpa only [subset_image_iff_mapsTo] using h + +end Heisenberg.Pin +end +end +end +end +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SlotColorTrace.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SlotColorTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..0698947d10c7f1f66164c275ff256061bc1d3164 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SlotColorTrace.lean @@ -0,0 +1,134 @@ +import OAI.MathematicalPhysics.Heisenberg.BoundaryPartition + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators Matrix.Norms.Operator +namespace Heisenberg.SlotColor +variable {V : Type*} +abbrev Color := V → Bool +abbrev Cycles (π : Equiv.Perm V) := Quotient (Equiv.Perm.SameCycle.setoid π) + +def cycleOf (π : Equiv.Perm V) (i : V) : Cycles π := Quotient.mk _ i + +@[simp] lemma cycleOf_apply (π : Equiv.Perm V) (i : V) : cycleOf π (π i) = cycleOf π i := + Quotient.sound ((Equiv.Perm.SameCycle.refl π i).apply_left) + +def permute (π : Equiv.Perm V) : Equiv.Perm (Color (V:=V)) where + toFun c := c ∘ π.symm + invFun c := c ∘ π + left_inv c := by ext i; simp + right_inv c := by ext i; simp + +@[simp] lemma permute_apply (π : Equiv.Perm V) (c : Color (V:=V)) (i : V) : + permute π c i = c (π.symm i) := rfl + +lemma permute_mul (π ρ : Equiv.Perm V) : permute (π*ρ) = permute π * permute ρ := by + ext c i + rfl + +lemma permute_fixed (π : Equiv.Perm V) (c : Color (V:=V)) : + permute π c = c ↔ ∀ i, c (π i) = c i := by + constructor + · intro h i + have he := congrFun h (π i) + simpa using he.symm + · intro h + ext i + have he := h (π.symm i) + simpa using he.symm + +variable [Fintype V] + +def matrix (π : Equiv.Perm V) : Matrix (Color (V:=V)) (Color (V:=V)) ℝ := + fun c b => if permute π b = c then 1 else 0 + +lemma matrix_one : matrix (1 : Equiv.Perm V) = 1 := by + ext c b + have he : permute (1 : Equiv.Perm V) b = b := by ext i; rfl + simp [matrix,he,Matrix.one_apply,eq_comm] + +lemma matrix_mul (π ρ : Equiv.Perm V) : matrix (π*ρ) = matrix π * matrix ρ := by + ext c b + simp only [matrix,Matrix.mul_apply,permute_mul,Equiv.Perm.mul_apply] + rw [Finset.sum_eq_single (permute ρ b)] + · simp + · intro a _ ha + simp [Ne.symm ha] + · simp + +def representation : Equiv.Perm V →* Matrix (Color (V:=V)) (Color (V:=V)) ℝ where + toFun := matrix + map_one' := matrix_one + map_mul' := matrix_mul + +lemma trace_diagonal (π : Equiv.Perm V) (f : Color (V:=V) → ℝ) : + Matrix.trace (matrix π * Matrix.diagonal f) = + ∑ c, if ∀ i, c (π i) = c i then f c else 0 := by + simp only [Matrix.trace,Matrix.diag,Matrix.mul_diagonal,matrix,permute_fixed] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + +abbrev ClosedColor (π : Equiv.Perm V) := {c : Color (V:=V) // ∀ i, c (π i) = c i} +instance (π : Equiv.Perm V) : Fintype (ClosedColor π) := Fintype.ofFinite _ +instance (π : Equiv.Perm V) : Fintype (Cycles π) := Fintype.ofFinite _ + +lemma const_cycle (π : Equiv.Perm V) (c : ClosedColor π) {i j : V} + (h : π.SameCycle i j) : c.val i = c.val j := by + obtain ⟨n,hn⟩ := h.exists_nat_pow_eq + have hh : ∀ n, c.val ((π^n) i) = c.val i := by + intro n + induction n with + | zero => rfl + | succ n ih => rw [pow_succ',Equiv.Perm.mul_apply,c.property,ih] + rw [← hn,hh] + +def cycleColorEquiv (π : Equiv.Perm V) : (Cycles π → Bool) ≃ ClosedColor π where + toFun c := ⟨fun i => c (cycleOf π i),fun i => by simp⟩ + invFun c := Quotient.lift c.val (fun _ _ h => const_cycle π c h) + left_inv c := by + funext q + induction q using Quotient.inductionOn with | _ i => rfl + right_inv c := by ext i; rfl + +theorem trace_cycle_colors (π : Equiv.Perm V) (f : Color (V:=V) → ℝ) : + Matrix.trace (matrix π * Matrix.diagonal f) = + ∑ ε : Cycles π → Bool, f (fun i => ε (cycleOf π i)) := by + rw [trace_diagonal] + calc + _ = ∑ c : ClosedColor π, f c.val := by + symm + rw [← Finset.sum_filter] + exact (Finset.sum_subtype _ (fun c => by simp) f).symm + _ = _ := (cycleColorEquiv π).sum_comp (fun c => f c.val) |>.symm + +lemma trace_cycle_weight (π : Equiv.Perm V) : + Matrix.trace (matrix π) = (2:ℝ) ^ Fintype.card (Cycles π) := by + have he := trace_cycle_colors π (fun _ => 1) + simpa using he + +def magnetization (c : Color (V:=V)) : ℝ := ∑ i, if c i then (1:ℝ)/2 else -1/2 + +lemma magnetization_bound (c : Color (V:=V)) : + |magnetization c| ≤ (Fintype.card V : ℝ)/2 := by + calc + _ ≤ ∑ i, |if c i then (1:ℝ)/2 else -1/2| := Finset.abs_sum_le_sum_abs _ _ + _ = _ := by + have he (i : V) : |if c i then (1:ℝ)/2 else -1/2| = (1:ℝ)/2 := by + cases c i <;> norm_num + simp only [he,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + ring + +theorem spectral_cycle_law (π : Equiv.Perm V) (Φ : ℝ → ℝ) : + Matrix.trace (matrix π * Matrix.diagonal (fun c => Φ (magnetization c))) = + ∑ ε : Cycles π → Bool, Φ (∑ i, if ε (cycleOf π i) then (1:ℝ)/2 else -1/2) := + trace_cycle_colors π _ + +end Heisenberg.SlotColor +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SlotOnMesh.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SlotOnMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..07d99c617ac4720317044d503661b97ffddf9f10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SlotOnMesh.lean @@ -0,0 +1,849 @@ +import OAI.MathematicalPhysics.Heisenberg.MeshCompletion + +namespace OAI + +noncomputable section + +open scoped Classical +namespace Heisenberg.SpinSlots +abbrev Config (ℓ : ℕ) := Finset (Fin ℓ) +abbrev Level (ℓ : ℕ) := Fin (ℓ+1) + +def basis (ℓ : ℕ) : Matrix (Config ℓ) (Level ℓ) ℝ := + fun A k => if A.card = k.val then (Real.sqrt (ℓ.choose k.val))⁻¹ else 0 + +lemma config_card_le (ℓ : ℕ) (A : Config ℓ) : A.card ≤ ℓ := by + simpa using Finset.card_le_univ A + +lemma multiplicity_pos (ℓ : ℕ) (k : Level ℓ) : 0 < (ℓ.choose k.val : ℝ) := by + exact_mod_cast Nat.choose_pos (by omega : k.val ≤ ℓ) + +lemma sqrt_multiplicity_pos (ℓ : ℕ) (k : Level ℓ) : 0 < Real.sqrt (ℓ.choose k.val) := + Real.sqrt_pos.mpr (multiplicity_pos ℓ k) + +lemma basis_nonneg (ℓ : ℕ) (A : Config ℓ) (k : Level ℓ) : 0 ≤ basis ℓ A k := by + unfold basis + split_ifs <;> positivity + +lemma card_layer (ℓ k : ℕ) : + (Finset.univ.filter (fun A : Config ℓ => A.card = k)).card = ℓ.choose k := by + have he : Finset.univ.filter (fun A : Config ℓ => A.card = k) = + (Finset.univ : Finset (Fin ℓ)).powersetCard k := by + ext A + simp + rw [he,Finset.card_powersetCard,Finset.card_univ,Fintype.card_fin] + +theorem basis_orthonormal (ℓ : ℕ) : (basis ℓ).transpose * basis ℓ = 1 := by + ext k m + simp only [Matrix.mul_apply,Matrix.transpose_apply] + by_cases hkm : k = m + · subst m + have he : ∑ A : Config ℓ, basis ℓ A k * basis ℓ A k = + ((ℓ.choose k.val : ℝ)) / (Real.sqrt (ℓ.choose k.val))^2 := by + calc + _ = ∑ A ∈ (Finset.univ.filter (fun A : Config ℓ => A.card = k.val)), + (Real.sqrt (ℓ.choose k.val))⁻¹ * (Real.sqrt (ℓ.choose k.val))⁻¹ := by + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro A _ + by_cases hk : A.card = k.val <;> simp [basis,hk] + _ = _ := by + simp only [Finset.sum_const,nsmul_eq_mul,card_layer] + ring + rw [he,Real.sq_sqrt (multiplicity_pos ℓ k).le] + simp [ne_of_gt (multiplicity_pos ℓ k)] + · rw [Matrix.one_apply_ne hkm] + apply Finset.sum_eq_zero + intro A _ + by_cases hk : A.card = k.val + · have hm : A.card ≠ m.val := fun hm => hkm (Fin.ext (hk.symm.trans hm)) + simp [basis,hm] + · simp [basis,hk] + +def raising (ℓ : ℕ) : Matrix (Config ℓ) (Config ℓ) ℝ := + fun A B => ∑ j ∈ A, if B = A.erase j then 1 else 0 + +def diagonalZ (ℓ : ℕ) : Matrix (Config ℓ) (Config ℓ) ℝ := + Matrix.diagonal (fun A => (A.card : ℝ) - (ℓ : ℝ)/2) + +def physicalZ (ℓ : ℕ) : Matrix (Level ℓ) (Level ℓ) ℝ := + Matrix.diagonal (fun k => (k.val : ℝ) - (ℓ : ℝ)/2) + +def physicalPlus (ℓ : ℕ) : Matrix (Level ℓ) (Level ℓ) ℝ := + fun m k => if m.val = k.val+1 then Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) else 0 + +lemma raising_mul_basis (ℓ : ℕ) (A : Config ℓ) (k : Level ℓ) : + (raising ℓ * basis ℓ) A k = ∑ j ∈ A, basis ℓ (A.erase j) k := by + simp only [Matrix.mul_apply,raising,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j hj + simp + +lemma binomial_raising_coefficient (ℓ : ℕ) (k : Fin ℓ) : + ((k.val+1 : ℕ) : ℝ) * (Real.sqrt (ℓ.choose k.val))⁻¹ = + Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) * (Real.sqrt (ℓ.choose (k.val+1)))⁻¹ := by + have hA := multiplicity_pos ℓ k.castSucc + have hB := multiplicity_pos ℓ k.succ + have ha := sqrt_multiplicity_pos ℓ k.castSucc + have hb := sqrt_multiplicity_pos ℓ k.succ + simp only [Fin.val_castSucc,Fin.val_succ] at hA hB ha hb + have he : ((ℓ.choose (k.val+1) : ℝ)) * (k.val+1) = + (ℓ.choose k.val : ℝ) * (ℓ-k.val : ℕ) := by + exact_mod_cast Nat.choose_succ_right_eq ℓ k.val + have hc : 0 ≤ (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) := by positivity + have hsqA := Real.sq_sqrt hA.le + have hsqB := Real.sq_sqrt hB.le + have hsqC := Real.sq_sqrt hc + have he' : ((k.val+1 : ℕ) : ℝ) * Real.sqrt (ℓ.choose (k.val+1)) = + Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) * Real.sqrt (ℓ.choose k.val) := by + apply (sq_eq_sq₀ (by positivity) (by positivity)).mp + rw [mul_pow,mul_pow,hsqB,hsqC,hsqA] + push_cast + nlinarith [he] + simpa only [div_eq_mul_inv] using (div_eq_div_iff (ne_of_gt ha) (ne_of_gt hb)).mpr he' + +lemma raising_coefficient_source (ℓ : ℕ) (k : Fin ℓ) : + ((ℓ-k.val : ℕ) : ℝ)*(k.val+1) = + (ℓ/2 : ℝ)*(ℓ/2+1) - ((k.val : ℝ)-ℓ/2)*((k.val : ℝ)-ℓ/2+1) := by + rw [Nat.cast_sub (Nat.le_of_lt k.isLt)] + ring + +lemma raising_basis_entry (ℓ : ℕ) (A : Config ℓ) (k : Level ℓ) : + (raising ℓ * basis ℓ) A k = + if A.card = k.val+1 then (A.card : ℝ) * (Real.sqrt (ℓ.choose k.val))⁻¹ else 0 := by + rw [raising_mul_basis] + have he : ∀ j ∈ A, basis ℓ (A.erase j) k = + if A.card = k.val+1 then (Real.sqrt (ℓ.choose k.val))⁻¹ else 0 := by + intro j hj + have hcard := Finset.card_pos.mpr ⟨j,hj⟩ + simp only [basis,Finset.card_erase_of_mem hj] + have hi : (A.card-1=k.val) ↔ (A.card=k.val+1) := by omega + simp only [hi] + rw [Finset.sum_congr rfl he] + simp only [Finset.sum_const,nsmul_eq_mul] + split_ifs <;> simp + +theorem diagonal_intertwines (ℓ : ℕ) : diagonalZ ℓ * basis ℓ = basis ℓ * physicalZ ℓ := by + ext A k + simp only [diagonalZ,physicalZ,Matrix.diagonal_mul,Matrix.mul_diagonal] + by_cases h : A.card = k.val <;> simp [basis,h,mul_comm] + +theorem raising_intertwines (ℓ : ℕ) : raising ℓ * basis ℓ = basis ℓ * physicalPlus ℓ := by + ext A k + rw [raising_basis_entry] + by_cases hk : k.val < ℓ + · let j : Fin ℓ := ⟨k.val,hk⟩ + have he : (basis ℓ * physicalPlus ℓ) A k = + basis ℓ A j.succ * Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) := by + rw [Matrix.mul_apply] + rw [Finset.sum_eq_single j.succ] + · simp [physicalPlus,j] + · intro m hm hmj + have hne : m.val ≠ k.val+1 := fun h => hmj (Fin.ext h) + simp [physicalPlus,hne] + · simp + rw [he] + by_cases hA : A.card = k.val+1 + · simpa [basis,hA,j,mul_comm] using binomial_raising_coefficient ℓ j + · simp [basis,hA,j] + · have htop : k.val = ℓ := by omega + have hA : A.card ≠ k.val+1 := by have := config_card_le ℓ A; omega + rw [ite_eq_right hA,Matrix.mul_apply] + symm + apply Finset.sum_eq_zero + intro m _ + have hm : m.val ≠ k.val+1 := by omega + simp [physicalPlus,hm] + +def average (ℓ : ℕ) : Matrix (Config ℓ) (Config ℓ) ℝ := + fun A B => (Fintype.card (Equiv.Perm (Fin ℓ)) : ℝ)⁻¹ * + ∑ σ : Equiv.Perm (Fin ℓ), if A = B.map σ.toEmbedding then 1 else 0 + +lemma map_mul (ℓ : ℕ) (A : Config ℓ) (σ τ : Equiv.Perm (Fin ℓ)) : + A.map (σ*τ).toEmbedding = (A.map τ.toEmbedding).map σ.toEmbedding := by + rw [Finset.map_map] + rfl + +lemma average_map_left (ℓ : ℕ) (A B : Config ℓ) (τ : Equiv.Perm (Fin ℓ)) : + average ℓ (A.map τ.toEmbedding) B = average ℓ A B := by + unfold average + congr 1 + rw [← Equiv.sum_comp (Equiv.mulLeft τ)] + apply Finset.sum_congr rfl + intro σ _ + change (if A.map τ.toEmbedding = B.map (τ*σ).toEmbedding then (1 : ℝ) else 0) = _ + rw [map_mul] + simp only [(Finset.map_injective τ.toEmbedding).eq_iff] + +lemma average_column_sum (ℓ : ℕ) (B : Config ℓ) : ∑ A, average ℓ A B = 1 := by + have hp : (Fintype.card (Equiv.Perm (Fin ℓ)) : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + unfold average + rw [← Finset.mul_sum,Finset.sum_comm] + simp [hp] + +lemma average_eq_zero (ℓ : ℕ) (A B : Config ℓ) (h : A.card ≠ B.card) : + average ℓ A B = 0 := by + unfold average + have hn : ∀ σ : Equiv.Perm (Fin ℓ), A ≠ B.map σ.toEmbedding := by + intro σ he + exact h (by rw [he,Finset.card_map]) + simp [hn] + +lemma average_eq_diagonal (ℓ : ℕ) (A B : Config ℓ) (h : A.card = B.card) : + average ℓ A B = average ℓ B B := by + obtain ⟨τ,hτ⟩ := Equiv.Perm.exists_map_finset_eq B A h.symm + rw [← hτ,average_map_left] + +lemma average_diagonal (ℓ : ℕ) (B : Config ℓ) : + average ℓ B B = (ℓ.choose B.card : ℝ)⁻¹ := by + have hp : (ℓ.choose B.card : ℝ) ≠ 0 := by + exact_mod_cast ne_of_gt (Nat.choose_pos (config_card_le ℓ B)) + have he := average_column_sum ℓ B + have hf : ∑ A, average ℓ A B = + (ℓ.choose B.card : ℝ) * average ℓ B B := by + calc + _ = ∑ A : Config ℓ, if A.card = B.card then average ℓ B B else 0 := by + apply Finset.sum_congr rfl + intro A _ + by_cases h : A.card = B.card + · rw [ite_eq_left h,average_eq_diagonal ℓ A B h] + · rw [ite_eq_right h,average_eq_zero ℓ A B h] + _ = _ := by rw [← Finset.sum_filter]; simp + rw [hf] at he + simpa only [one_div] using (eq_div_iff hp).mpr (show average ℓ B B * (ℓ.choose B.card : ℝ) = 1 by simpa [mul_comm] using he) + +theorem average_entry (ℓ : ℕ) (A B : Config ℓ) : + average ℓ A B = if A.card = B.card then (ℓ.choose B.card : ℝ)⁻¹ else 0 := by + split_ifs with h + · rw [average_eq_diagonal ℓ A B h,average_diagonal] + · exact average_eq_zero ℓ A B h + +lemma basis_projection_entry (ℓ : ℕ) (A B : Config ℓ) : + (basis ℓ * (basis ℓ).transpose) A B = + if A.card = B.card then (ℓ.choose B.card : ℝ)⁻¹ else 0 := by + let k : Level ℓ := ⟨B.card,by have := config_card_le ℓ B; omega⟩ + have he : (basis ℓ * (basis ℓ).transpose) A B = basis ℓ A k * basis ℓ B k := by + simp only [Matrix.mul_apply,Matrix.transpose_apply] + apply Finset.sum_eq_single k + · intro m hm hmk + have hne : B.card ≠ m.val := fun h => hmk (Fin.ext h.symm) + simp [basis,hne] + · simp + rw [he] + have hp : 0 ≤ (ℓ.choose B.card : ℝ) := by positivity + by_cases h : A.card = B.card + · simp only [basis,k,h,ite_true] + rw [← mul_inv_rev,← sq,Real.sq_sqrt hp] + · simp [basis,k,h] + +theorem symmetrizer (ℓ : ℕ) : average ℓ = basis ℓ * (basis ℓ).transpose := by + ext A B + rw [average_entry,basis_projection_entry] + +lemma erase_relation (ℓ : ℕ) (A B : Config ℓ) (j : Fin ℓ) : + (j ∈ B ∧ A = B.erase j) ↔ (j ∉ A ∧ B = insert j A) := by + constructor + · rintro ⟨hj,rfl⟩ + exact ⟨by simp,(Finset.insert_erase hj).symm⟩ + · rintro ⟨hj,rfl⟩ + exact ⟨Finset.mem_insert_self _ _,(Finset.erase_insert hj).symm⟩ + +lemma lowering_entry (ℓ : ℕ) (A B : Config ℓ) : + (raising ℓ).transpose A B = ∑ j ∈ (Finset.univ \ A), if B = insert j A then 1 else 0 := by + simp only [Matrix.transpose_apply,raising] + rw [← Finset.sum_filter,← Finset.sum_filter] + apply Finset.sum_congr + · ext j + simp only [Finset.mem_filter,Finset.mem_sdiff,Finset.mem_univ,true_and] + exact erase_relation ℓ A B j + · intro j hj + rfl + +lemma lowering_mul_basis (ℓ : ℕ) (A : Config ℓ) (k : Level ℓ) : + ((raising ℓ).transpose * basis ℓ) A k = + ∑ j ∈ (Finset.univ \ A), basis ℓ (insert j A) k := by + simp only [Matrix.mul_apply,lowering_entry,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + simp + +lemma lowering_basis_entry (ℓ : ℕ) (A : Config ℓ) (k : Level ℓ) : + ((raising ℓ).transpose * basis ℓ) A k = + if A.card+1 = k.val then ((ℓ-A.card : ℕ) : ℝ) * + (Real.sqrt (ℓ.choose k.val))⁻¹ else 0 := by + rw [lowering_mul_basis] + have he : ∀ j ∈ (Finset.univ \ A), basis ℓ (insert j A) k = + if A.card+1 = k.val then (Real.sqrt (ℓ.choose k.val))⁻¹ else 0 := by + intro j hj + simp only [basis,Finset.card_insert_of_notMem (Finset.mem_sdiff.mp hj).2] + rw [Finset.sum_congr rfl he] + simp only [Finset.sum_const,nsmul_eq_mul,Finset.card_sdiff,Finset.inter_univ, + Finset.card_univ,Fintype.card_fin] + split_ifs <;> simp + +lemma binomial_lowering_coefficient (ℓ : ℕ) (k : Fin ℓ) : + ((ℓ-k.val : ℕ) : ℝ) * (Real.sqrt (ℓ.choose (k.val+1)))⁻¹ = + Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) * (Real.sqrt (ℓ.choose k.val))⁻¹ := by + have hA := multiplicity_pos ℓ k.castSucc + have hB := multiplicity_pos ℓ k.succ + have ha := sqrt_multiplicity_pos ℓ k.castSucc + have hb := sqrt_multiplicity_pos ℓ k.succ + simp only [Fin.val_castSucc,Fin.val_succ] at hA hB ha hb + have he : ((ℓ.choose (k.val+1) : ℝ)) * (k.val+1) = + (ℓ.choose k.val : ℝ) * (ℓ-k.val : ℕ) := by + exact_mod_cast Nat.choose_succ_right_eq ℓ k.val + have hc : 0 ≤ (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) := by positivity + have hsqA := Real.sq_sqrt hA.le + have hsqB := Real.sq_sqrt hB.le + have hsqC := Real.sq_sqrt hc + have he' : ((ℓ-k.val : ℕ) : ℝ) * Real.sqrt (ℓ.choose k.val) = + Real.sqrt (((ℓ-k.val : ℕ) : ℝ)*(k.val+1)) * Real.sqrt (ℓ.choose (k.val+1)) := by + apply (sq_eq_sq₀ (by positivity) (by positivity)).mp + rw [mul_pow,mul_pow,hsqA,hsqC,hsqB] + nlinarith [he] + simpa only [div_eq_mul_inv] using (div_eq_div_iff (ne_of_gt hb) (ne_of_gt ha)).mpr he' + +theorem lowering_intertwines (ℓ : ℕ) : + (raising ℓ).transpose * basis ℓ = basis ℓ * (physicalPlus ℓ).transpose := by + ext A k + rw [lowering_basis_entry] + by_cases hk : 0 < k.val + · let j : Fin ℓ := ⟨k.val-1,by omega⟩ + have hjs : j.val+1 = k.val := by dsimp [j]; omega + have he : (basis ℓ * (physicalPlus ℓ).transpose) A k = + basis ℓ A j.castSucc * Real.sqrt (((ℓ-j.val : ℕ) : ℝ)*(j.val+1)) := by + rw [Matrix.mul_apply,Finset.sum_eq_single j.castSucc] + · simp [physicalPlus,hjs] + · intro m hm hmj + have hne : k.val ≠ m.val+1 := by + intro h + apply hmj + apply Fin.ext + dsimp [j] + omega + simp [physicalPlus,hne] + · simp + rw [he] + by_cases hA : A.card+1 = k.val + · have hAj : A.card = j.val := by omega + simpa [basis,hAj,← hjs,mul_comm] using binomial_lowering_coefficient ℓ j + · have hAj : A.card ≠ j.val := by omega + simp [basis,hA,hAj] + · have hzero : k.val = 0 := by omega + have hA : A.card+1 ≠ k.val := by omega + rw [ite_eq_right hA,Matrix.mul_apply] + symm + apply Finset.sum_eq_zero + intro m _ + have hm : k.val ≠ m.val+1 := by omega + simp [physicalPlus,hm] + +end Heisenberg.SpinSlots + +open scoped Classical BigOperators +namespace Heisenberg.TensorMatrix +variable {X α β γ R : Type*} [Fintype X] [DecidableEq X] [CommSemiring R] + +def tensor (M : X → Matrix α β R) : Matrix (X → α) (X → β) R := + fun a b => ∏ x, M x (a x) (b x) + +lemma tensor_mul [Fintype β] (M : X → Matrix α β R) (N : X → Matrix β γ R) : + tensor M * tensor N = tensor (fun x => M x * N x) := by + ext a b + simp only [Matrix.mul_apply,tensor,← Finset.prod_mul_distrib] + exact (Fintype.prod_sum fun x y => M x (a x) y * N x y (b x)).symm + +omit [DecidableEq X] in +lemma tensor_one [DecidableEq α] : tensor (fun _ : X => (1 : Matrix α α R)) = 1 := by + ext a b + by_cases h : a = b + · subst b + simp [tensor] + · obtain ⟨x,hx⟩ := Function.ne_iff.mp h + rw [Matrix.one_apply_ne h] + apply Finset.prod_eq_zero (Finset.mem_univ x) + exact Matrix.one_apply_ne hx + +omit [DecidableEq X] in +lemma tensor_transpose (M : X → Matrix α β R) : + (tensor M).transpose = tensor (fun x => (M x).transpose) := rfl + +lemma tensor_trace [Fintype α] (M : X → Matrix α α R) : + Matrix.trace (tensor M) = ∏ x, Matrix.trace (M x) := by + simp only [Matrix.trace,Matrix.diag,tensor] + exact (Fintype.prod_sum fun x a => M x a a).symm + +def onsite [DecidableEq α] (x : X) (M : Matrix α α R) : + Matrix (X → α) (X → α) R := + tensor (Function.update (fun _ => 1) x M) + +lemma local_one [DecidableEq α] (x : X) : + onsite x (1 : Matrix α α R) = 1 := by + rw [onsite,Function.update_eq_self,tensor_one] + +lemma local_mul [DecidableEq α] [Fintype α] + (x : X) (M N : Matrix α α R) : onsite x M * onsite x N = onsite x (M*N) := by + simp only [onsite] + rw [tensor_mul (X := X) (α := α) (β := α) (γ := α)] + congr 1 + funext y + by_cases h : y = x <;> simp [h] + +lemma local_entry [DecidableEq α] (x : X) (M : Matrix α α R) + (a b : X → α) : onsite x M a b = + M (a x) (b x) * ∏ y ∈ (Finset.univ.erase x), (1 : Matrix α α R) (a y) (b y) := by + unfold onsite tensor + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ x)] + simp only [Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro y hy + simp only [Function.update_of_ne (Finset.mem_erase.mp hy).1] + +lemma local_add [DecidableEq α] (x : X) (M N : Matrix α α R) : + onsite x (M+N) = onsite x M + onsite x N := by + ext a b + simp only [local_entry,Matrix.add_apply,add_mul] + +lemma local_zero [DecidableEq α] (x : X) : + onsite x (0 : Matrix α α R) = 0 := by + ext a b + simp [local_entry] + +lemma local_smul [DecidableEq α] (x : X) (r : R) (M : Matrix α α R) : + onsite x (r • M) = r • onsite x M := by + ext a b + simp [local_entry,mul_assoc] + +lemma local_commute [DecidableEq α] [Fintype α] + {x y : X} (hxy : x ≠ y) (M N : Matrix α α R) : Commute (onsite x M) (onsite y N) := by + change onsite x M * onsite y N = onsite y N * onsite x M + simp only [onsite] + rw [tensor_mul (X := X) (α := α) (β := α) (γ := α),tensor_mul (X := X) (α := α) (β := α) (γ := α)] + congr 1 + funext z + by_cases hx : z = x + · subst z; simp [hxy] + · by_cases hy : z = y + · subst z; simp [hxy.symm] + · simp [hx,hy] + +lemma local_intertwines [DecidableEq α] [DecidableEq β] + [Fintype α] [Fintype β] (x : X) (V : Matrix α β R) + (A : Matrix α α R) (B : Matrix β β R) (h : A * V = V * B) : + onsite x A * tensor (fun _ : X => V) = tensor (fun _ : X => V) * onsite x B := by + simp only [onsite] + rw [tensor_mul (X := X) (α := α) (β := α) (γ := β),tensor_mul (X := X) (α := α) (β := β) (γ := β)] + congr 1 + funext y + by_cases hy : y = x + · simp [hy,h] + · simp [hy] + +lemma tensor_orthonormal [Fintype α] [DecidableEq β] (V : Matrix α β R) + (h : V.transpose * V = 1) : + (tensor (fun _ : X => V)).transpose * tensor (fun _ : X => V) = 1 := by + rw [tensor_transpose,tensor_mul] + simpa only [h] using (tensor_one (X := X) (α := β) (R := R)) + +end Heisenberg.TensorMatrix + +namespace Heisenberg.SlotTensor +open SpinSlots TensorMatrix +variable {X : Type*} [Fintype X] [DecidableEq X] + +def configEquiv (ℓ : ℕ) : SlotColor.Color (V:=X × Fin ℓ) ≃ (X → Config ℓ) where + toFun c x := Finset.univ.filter (fun a => c (x,a) = true) + invFun A p := decide (p.2 ∈ A p.1) + left_inv c := by + funext ⟨x,a⟩ + cases h : c (x,a) <;> simp [h] + right_inv A := by ext x a; simp + +omit [Fintype X] [DecidableEq X] in +@[simp] lemma mem_configEquiv (ℓ : ℕ) (c : SlotColor.Color (V:=X × Fin ℓ)) + (x : X) (a : Fin ℓ) : a ∈ configEquiv ℓ c x ↔ c (x,a) = true := by + simp [configEquiv] + +def fiberPerm {ℓ : ℕ} (κ : X → Equiv.Perm (Fin ℓ)) : Equiv.Perm (X × Fin ℓ) where + toFun p := (p.1,κ p.1 p.2) + invFun p := (p.1,(κ p.1).symm p.2) + left_inv p := by simp + right_inv p := by simp + +omit [Fintype X] [DecidableEq X] in +lemma configEquiv_fiberPerm {ℓ : ℕ} (κ : X → Equiv.Perm (Fin ℓ)) + (c : SlotColor.Color (V:=X × Fin ℓ)) : + configEquiv ℓ (SlotColor.permute (fiberPerm κ) c) = + fun x => (configEquiv ℓ c x).map (κ x).toEmbedding := by + ext x a + simp [Finset.mem_map_equiv,SlotColor.permute,fiberPerm] + +def matrix {ℓ : ℕ} (π : Equiv.Perm (X × Fin ℓ)) : + Matrix (X → Config ℓ) (X → Config ℓ) ℝ := + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (SlotColor.matrix π) + +omit [DecidableEq X] in +lemma matrix_fiberPerm {ℓ : ℕ} (κ : X → Equiv.Perm (Fin ℓ)) : + matrix (fiberPerm κ) = tensor (fun x => fun A B : Config ℓ => + if A = B.map (κ x).toEmbedding then (1:ℝ) else 0) := by + ext A B + have he : SlotColor.permute (fiberPerm κ) ((configEquiv ℓ).symm B) = + (configEquiv ℓ).symm A ↔ A = fun x => (B x).map (κ x).toEmbedding := by + rw [← (configEquiv ℓ).injective.eq_iff,configEquiv_fiberPerm] + simp [eq_comm] + change (if SlotColor.permute (fiberPerm κ) ((configEquiv ℓ).symm B) = + (configEquiv ℓ).symm A then (1:ℝ) else 0) = _ + simp only [he] + by_cases h : A = fun x => (B x).map (κ x).toEmbedding + · subst A + simp [tensor] + · rw [ite_eq_right h] + symm + obtain ⟨x,hx⟩ := Function.ne_iff.mp h + exact Finset.prod_eq_zero (Finset.mem_univ x) (ite_eq_right hx) + +theorem symmetrizer (ℓ : ℕ) : + (Fintype.card (X → Equiv.Perm (Fin ℓ)) : ℝ)⁻¹ • + (∑ κ : X → Equiv.Perm (Fin ℓ), matrix (fiberPerm κ)) = + tensor (fun _ : X => basis ℓ) * (tensor (fun _ : X => basis ℓ)).transpose := by + rw [tensor_transpose,tensor_mul] + simp_rw [← SpinSlots.symmetrizer,matrix_fiberPerm] + ext A B + simp only [Matrix.smul_apply,smul_eq_mul,Matrix.sum_apply,tensor,average, + Fintype.card_fun,Finset.prod_mul_distrib,Finset.prod_const,Finset.card_univ, + Nat.cast_pow,inv_pow] + rw [Fintype.prod_sum] + +lemma basis_orthonormal (ℓ : ℕ) : + (tensor (fun _ : X => basis ℓ)).transpose * tensor (fun _ : X => basis ℓ) = 1 := + tensor_orthonormal _ (SpinSlots.basis_orthonormal ℓ) + +lemma raising_intertwines (ℓ : ℕ) (x : X) : + onsite x (SpinSlots.raising ℓ) * tensor (fun _ : X => basis ℓ) = + tensor (fun _ : X => basis ℓ) * onsite x (physicalPlus ℓ) := + local_intertwines x _ _ _ (SpinSlots.raising_intertwines ℓ) + +lemma lowering_intertwines (ℓ : ℕ) (x : X) : + onsite x (SpinSlots.raising ℓ).transpose * tensor (fun _ : X => basis ℓ) = + tensor (fun _ : X => basis ℓ) * onsite x (physicalPlus ℓ).transpose := + local_intertwines x _ _ _ (SpinSlots.lowering_intertwines ℓ) + +lemma diagonal_intertwines (ℓ : ℕ) (x : X) : + onsite x (SpinSlots.diagonalZ ℓ) * tensor (fun _ : X => basis ℓ) = + tensor (fun _ : X => basis ℓ) * onsite x (physicalZ ℓ) := + local_intertwines x _ _ _ (SpinSlots.diagonal_intertwines ℓ) + +end Heisenberg.SlotTensor +namespace Heisenberg.SlotHalf +open SlotColor +variable {V : Type*} [Fintype V] [DecidableEq V] + +def change (i : V) (s : Bool) : Matrix (Color (V:=V)) (Color (V:=V)) ℝ := + fun a b => if b i ≠ s ∧ a = Function.update b i s then 1 else 0 + +def z (i : V) : Matrix (Color (V:=V)) (Color (V:=V)) ℝ := + Matrix.diagonal (fun a => if a i then (1:ℝ)/2 else -1/2) + +lemma change_entry (i : V) (s : Bool) (a b : Color (V:=V)) : + change i s a b = if b i ≠ s then if a = Function.update b i s then 1 else 0 else 0 := by + simp only [change,ite_and] + +lemma change_mul {i j : V} (hij : i ≠ j) (s t : Bool) (a b : Color (V:=V)) : + (change i s * change j t) a b = if b j ≠ t ∧ b i ≠ s ∧ + a = Function.update (Function.update b j t) i s then 1 else 0 := by + rw [Matrix.mul_apply] + by_cases hj : b j = t + · simp [change,hj] + · rw [Finset.sum_eq_single (Function.update b j t)] + · simp [change,hj,Function.update_of_ne hij] + · intro c _ hc + have he : c ≠ Function.update b j t := hc + simp [change,he] + · simp + +omit [Fintype V] in +lemma swapped_same {i j : V} (b : Color (V:=V)) (h : b i = b j) : + SlotColor.permute (Equiv.swap i j) b = b := by + ext k + by_cases hi : k = i + · subst k; simp [permute,h] + · by_cases hj : k = j + · subst k; simp [permute,h] + · simp [permute,Equiv.swap_apply_of_ne_of_ne hi hj] + +omit [Fintype V] in +lemma swapped_different {i j : V} (hij : i ≠ j) (b : Color (V:=V)) : + SlotColor.permute (Equiv.swap i j) b = + Function.update (Function.update b j (b i)) i (b j) := by + ext k + by_cases hi : k = i + · subst k; simp [permute] + · by_cases hj : k = j + · subst k; simp [permute,hij.symm] + · simp [permute,hi,hj,Equiv.swap_apply_of_ne_of_ne hi hj] + +theorem swap_spin {i j : V} (hij : i ≠ j) : + SlotColor.matrix (Equiv.swap i j) = + change i true * change j false + change i false * change j true + + (2:ℝ) • (z i * z j) + (1/2:ℝ) • (1:Matrix (Color (V:=V)) (Color (V:=V)) ℝ) := by + ext a b + rw [Matrix.add_apply,Matrix.add_apply,Matrix.add_apply,change_mul hij,change_mul hij] + simp only [z,Matrix.diagonal_mul_diagonal,Matrix.smul_apply,smul_eq_mul, + Matrix.diagonal_apply,Matrix.one_apply] + cases hi : b i <;> cases hj : b j + · have he := swapped_same b (hi.trans hj.symm) + by_cases hab : a = b + · subst a; norm_num [SlotColor.matrix,he,hi,hj] + · simp [SlotColor.matrix,he,hab,Ne.symm hab] + · have he := swapped_different hij b + rw [hi,hj] at he + by_cases hab : a = b + · subst a + have hn : b ≠ Function.update (Function.update b j false) i true := by + intro hh + have hh' := congrFun hh i + simp [hi] at hh' + norm_num [SlotColor.matrix,he,hi,hj,hn,Ne.symm hn] + · simp [SlotColor.matrix,he,hab,eq_comm] + · have he := swapped_different hij b + rw [hi,hj] at he + by_cases hab : a = b + · subst a + have hn : b ≠ Function.update (Function.update b j true) i false := by + intro hh + have hh' := congrFun hh i + simp [hi] at hh' + norm_num [SlotColor.matrix,he,hi,hj,hn,Ne.symm hn] + · simp [SlotColor.matrix,he,hab,eq_comm] + · have he := swapped_same b (hi.trans hj.symm) + by_cases hab : a = b + · subst a; norm_num [SlotColor.matrix,he,hi,hj] + · simp [SlotColor.matrix,he,hab,Ne.symm hab] + +end Heisenberg.SlotHalf +namespace Heisenberg.TensorMatrix +variable {X α R : Type*} [Fintype X] [DecidableEq X] [DecidableEq α] [CommSemiring R] +lemma local_entry_ite (x : X) (M : Matrix α α R) (A B : X → α) : + onsite x M A B = if ∀ y, y ≠ x → A y = B y then M (A x) (B x) else 0 := by + rw [local_entry] + by_cases h : ∀ y, y ≠ x → A y = B y + · rw [ite_eq_left h] + have he : ∏ y ∈ Finset.univ.erase x, (1:Matrix α α R) (A y) (B y) = 1 := by + apply Finset.prod_eq_one + intro y hy + rw [h y (Finset.mem_erase.mp hy).1] + exact Matrix.one_apply_eq _ + rw [he,mul_one] + · rw [ite_eq_right h] + obtain ⟨y,hy,hab⟩ := not_forall.mp h |>.imp (fun _ => Classical.not_imp.mp) + have he : ∏ y ∈ Finset.univ.erase x, (1:Matrix α α R) (A y) (B y) = 0 := + Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨hy,Finset.mem_univ _⟩) (Matrix.one_apply_ne hab) + rw [he,mul_zero] +end Heisenberg.TensorMatrix + +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type*} [Fintype X] [DecidableEq X] + +omit [Fintype X] in +lemma config_update_true (ℓ : ℕ) (b : SlotColor.Color (V:=X × Fin ℓ)) (x : X) (a : Fin ℓ) : + configEquiv ℓ (Function.update b (x,a) true) = + Function.update (configEquiv ℓ b) x (insert a (configEquiv ℓ b x)) := by + ext y k + by_cases hy : y = x + · subst y + by_cases hk : k = a + · subst k; simp + · simp [hk] + · simp [Function.update_of_ne hy,Function.update_of_ne (show (y,k) ≠ (x,a) by simp [hy])] + +lemma reindex_change_true_entry (ℓ : ℕ) (x : X) (a : Fin ℓ) (A B : X → Config ℓ) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (SlotHalf.change (x,a) true) A B = + if a ∉ B x ∧ A = Function.update B x (insert a (B x)) then (1:ℝ) else 0 := by + have he : (configEquiv ℓ).symm A = Function.update ((configEquiv ℓ).symm B) (x,a) true ↔ + A = Function.update B x (insert a (B x)) := by + rw [← (configEquiv ℓ).injective.eq_iff,config_update_true] + simp + change (if ((configEquiv ℓ).symm B) (x,a) ≠ true ∧ + (configEquiv ℓ).symm A = Function.update ((configEquiv ℓ).symm B) (x,a) true then (1:ℝ) else 0) = _ + simp only [he] + simp [configEquiv] + +lemma erase_insert_condition {ℓ : ℕ} (a : Fin ℓ) (A B : Config ℓ) : + (a ∉ B ∧ A = insert a B) ↔ (a ∈ A ∧ B = A.erase a) := by + constructor + · rintro ⟨ha,rfl⟩ + simp [ha] + · rintro ⟨ha,rfl⟩ + simp [Finset.insert_erase ha] + +theorem slot_raising (ℓ : ℕ) (x : X) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (∑ a : Fin ℓ, SlotHalf.change (x,a) true) = onsite x (SpinSlots.raising ℓ) := by + ext A B + simp only [Matrix.reindex_apply,Matrix.submatrix_apply,Matrix.sum_apply] + change (∑ a : Fin ℓ, Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (SlotHalf.change (x,a) true) A B) = _ + simp_rw [reindex_change_true_entry,Function.eq_update_iff] + rw [local_entry_ite] + by_cases h : ∀ y, y ≠ x → A y = B y + · simp only [iff_true_intro h,and_true,ite_true] + simp_rw [erase_insert_condition] + unfold SpinSlots.raising + have he : Finset.univ.filter (fun a : Fin ℓ => a ∈ A x) = A x := by ext a; simp + simp only [ite_and] + rw [← Finset.sum_filter,he] + · simp only [iff_false_intro h,and_false,ite_false,Finset.sum_const_zero] + +end Heisenberg.SlotTensor + +namespace Heisenberg.SlotHalf +variable {V : Type*} [Fintype V] [DecidableEq V] +lemma change_transpose (i : V) : (change i true).transpose = change i false := by + ext a b + have he : (b i ≠ false ∧ a = Function.update b i false) ↔ + (a i ≠ true ∧ b = Function.update a i true) := by + constructor + · rintro ⟨hb,rfl⟩ + have hb' : b i = true := by cases h : b i <;> simp_all + simp [Function.update_idem,hb'] + · rintro ⟨ha,rfl⟩ + have ha' : a i = false := by cases h : a i <;> simp_all + simp [Function.update_idem,ha'] + simp only [Matrix.transpose_apply,change,he] +end Heisenberg.SlotHalf + +namespace Heisenberg.TensorMatrix +variable {X α R : Type*} [Fintype X] [DecidableEq X] [DecidableEq α] [CommSemiring R] +lemma local_transpose (x : X) (M : Matrix α α R) : + (onsite x M).transpose = onsite x M.transpose := by + rw [onsite,tensor_transpose] + congr 1 + funext y + by_cases h : y=x <;> simp [h] +lemma local_diagonal (x : X) (f : α → R) : + onsite x (Matrix.diagonal f) = Matrix.diagonal (fun A => f (A x)) := by + ext A B + rw [local_entry_ite] + by_cases h : A = B + · subst B + simp + · rw [Matrix.diagonal_apply_ne _ h] + split_ifs with ho + · apply Matrix.diagonal_apply_ne + intro hx + apply h + funext y + by_cases hy : y=x + · simpa [hy] using hx + · exact ho y hy + · rfl +end Heisenberg.TensorMatrix + +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type*} [Fintype X] [DecidableEq X] +theorem slot_lowering (ℓ : ℕ) (x : X) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (∑ a : Fin ℓ, SlotHalf.change (x,a) false) = onsite x (SpinSlots.raising ℓ).transpose := by + rw [← local_transpose,← slot_raising] + ext A B + simp only [Matrix.reindex_apply,Matrix.submatrix_apply,Matrix.sum_apply,Matrix.transpose_apply] + apply Finset.sum_congr rfl + intro a _ + exact congrFun (congrFun (SlotHalf.change_transpose (x,a)).symm ((configEquiv ℓ).symm A)) + ((configEquiv ℓ).symm B) + +theorem slot_z (ℓ : ℕ) (x : X) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) + (∑ a : Fin ℓ, SlotHalf.z (x,a)) = onsite x (SpinSlots.diagonalZ ℓ) := by + rw [diagonalZ,local_diagonal] + ext A B + simp only [Matrix.reindex_apply,Matrix.submatrix_apply,Matrix.sum_apply,SlotHalf.z] + by_cases h : A = B + · subst B + simp only [Matrix.diagonal_apply_eq] + have he : ∀ a : Fin ℓ, (if ((configEquiv ℓ).symm A) (x,a) then (1:ℝ)/2 else -1/2) = + (if a ∈ A x then (1:ℝ) else 0) - 1/2 := by + intro a + change (if decide (a ∈ A x) then (1:ℝ)/2 else -1/2) = _ + by_cases ha : a ∈ A x <;> simp [ha] <;> norm_num + simp_rw [he] + rw [Finset.sum_sub_distrib] + simp [div_eq_mul_inv] + · have hn : (configEquiv ℓ).symm A ≠ (configEquiv ℓ).symm B := + (configEquiv ℓ).symm.injective.ne h + simp [Matrix.diagonal_apply_ne _ h,Matrix.diagonal_apply_ne _ hn] + +end Heisenberg.SlotTensor + +namespace Heisenberg.SlotHalf +variable {X : Type*} [Fintype X] [DecidableEq X] + +def totalPlus (ℓ : ℕ) (x : X) := ∑ a : Fin ℓ, change (x,a) true +def totalMinus (ℓ : ℕ) (x : X) := ∑ a : Fin ℓ, change (x,a) false +def totalZ (ℓ : ℕ) (x : X) := ∑ a : Fin ℓ, z (x,a) + +theorem cross_site_swaps (ℓ : ℕ) {x y : X} (hxy : x ≠ y) : + (∑ a : Fin ℓ, ∑ b : Fin ℓ, SlotColor.matrix (Equiv.swap (x,a) (y,b))) = + totalPlus ℓ x * totalMinus ℓ y + totalMinus ℓ x * totalPlus ℓ y + + (2:ℝ) • (totalZ ℓ x * totalZ ℓ y) + + ((ℓ:ℝ)^2/2) • (1:Matrix (SlotColor.Color (V:=X × Fin ℓ)) (SlotColor.Color (V:=X × Fin ℓ)) ℝ) := by + have hh : ∀ a b : Fin ℓ, (x,a) ≠ (y,b) := fun _ _ => fun h => hxy (congrArg Prod.fst h) + simp_rw [swap_spin (hh _ _),Finset.sum_add_distrib] + simp_rw [← Finset.mul_sum,← Finset.sum_mul,← Finset.smul_sum] + simp only [totalPlus,totalMinus,totalZ] + have hz : (∑ a : Fin ℓ, ∑ b : Fin ℓ, z (x,a)*z (y,b)) = + (∑ a : Fin ℓ, z (x,a))*(∑ b : Fin ℓ, z (y,b)) := by + simp only [Finset.sum_mul,Finset.mul_sum] + rw [Finset.sum_comm] + rw [hz] + congr 1 + simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin] + rw [← Nat.cast_smul_eq_nsmul ℝ,← Nat.cast_smul_eq_nsmul ℝ,smul_smul,smul_smul] + congr 1 + ring +end Heisenberg.SlotHalf + +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type*} [Fintype X] [DecidableEq X] + +def spinBond (ℓ : ℕ) (x y : X) : Matrix (X → Level ℓ) (X → Level ℓ) ℝ := + (1/2:ℝ) • (onsite x (physicalPlus ℓ)*onsite y (physicalPlus ℓ).transpose + + onsite x (physicalPlus ℓ).transpose*onsite y (physicalPlus ℓ)) + + onsite x (physicalZ ℓ)*onsite y (physicalZ ℓ) + +def slotBond (ℓ : ℕ) (x y : X) : Matrix (SlotColor.Color (V:=X × Fin ℓ)) + (SlotColor.Color (V:=X × Fin ℓ)) ℝ := + (1/2:ℝ) • (∑ a : Fin ℓ, ∑ b : Fin ℓ, SlotColor.matrix (Equiv.swap (x,a) (y,b))) - + ((ℓ:ℝ)^2/4) • 1 + +theorem bond_intertwines (ℓ : ℕ) {x y : X} (hxy : x ≠ y) : + Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) (slotBond ℓ x y) * + tensor (fun _ : X => basis ℓ) = + tensor (fun _ : X => basis ℓ) * spinBond ℓ x y := by + let R := Matrix.reindexAlgEquiv ℝ ℝ (configEquiv (X:=X) ℓ) + have hR (M : Matrix (SlotColor.Color (V:=X × Fin ℓ)) (SlotColor.Color (V:=X × Fin ℓ)) ℝ) : + R M = Matrix.reindex (configEquiv ℓ) (configEquiv ℓ) M := rfl + have hmul (M N : Matrix (SlotColor.Color (V:=X × Fin ℓ)) (SlotColor.Color (V:=X × Fin ℓ)) ℝ) : R (M*N)=R M*R N := by + exact map_mul R M N + rw [← hR] + rw [slotBond,SlotHalf.cross_site_swaps ℓ hxy] + simp only [map_sub,map_smul,map_add,map_one,hmul] + simp only [hR,SlotHalf.totalPlus,SlotHalf.totalMinus,SlotHalf.totalZ,slot_raising,slot_lowering,slot_z] + simp only [Matrix.sub_mul,Matrix.smul_mul,Matrix.add_mul,Matrix.one_mul, + Matrix.mul_assoc,raising_intertwines,lowering_intertwines,diagonal_intertwines] + simp only [← Matrix.mul_assoc,raising_intertwines,lowering_intertwines,diagonal_intertwines] + simp only [spinBond,Matrix.mul_add,Matrix.mul_smul] + simp only [Matrix.mul_assoc] + module + +end Heisenberg.SlotTensor + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SparseCrossings.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SparseCrossings.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5f0d9f8471d310c9eaa8569c77052a2aa2c4bb5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SparseCrossings.lean @@ -0,0 +1,267 @@ +import OAI.MathematicalPhysics.Heisenberg.SpatialClocks + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical BigOperators + +namespace Heisenberg.SparseWitness + +section +variable {V : Type*} [PseudoMetricSpace V] + +lemma first_crossing (p : ℕ → V) (m : ℕ) (hstep : ∀ i < m, dist (p i) (p (i+1)) ≤ 8) + (r : ℝ) (hr : 0 < r) (hend : r ≤ dist (p 0) (p m)) : + ∃ k ≤ m, r ≤ dist (p 0) (p k) ∧ dist (p 0) (p k) ≤ r+8 := by + have hex : ∃ k : ℕ, k ≤ m ∧ r ≤ dist (p 0) (p k) := ⟨m,le_rfl,hend⟩ + let k := Nat.find hex + have hk := Nat.find_spec hex + change k ≤ m ∧ r ≤ dist (p 0) (p k) at hk + have hk0 : 0 < k := by + by_contra hn + have he : k = 0 := by omega + rw [he,dist_self] at hk + linarith + have hpre : dist (p 0) (p (k-1)) < r := by + by_contra hn + have hmin := Nat.find_min' hex (show k-1 ≤ m ∧ r ≤ dist (p 0) (p (k-1)) from + ⟨by omega,by linarith⟩) + change k ≤ k-1 at hmin + omega + refine ⟨k,hk.1,hk.2,?_⟩ + have hs := hstep (k-1) (by omega) + have he : k-1+1 = k := by omega + rw [he] at hs + have ht := dist_triangle (p 0) (p (k-1)) (p k) + linarith + +theorem crossing_witness (h : ℕ → ℝ) (hp : ∀ n, 0 < h n) + (hg : ∀ n, 8*h n+64 ≤ h (n+1)) (n : ℕ) + (p : ℕ → V) (m : ℕ) (hstep : ∀ i < m, dist (p i) (p (i+1)) ≤ 8) + (hend : h n ≤ dist (p 0) (p m)) : + ∃ t : Tree V n, Admissible h t ∧ root t = p 0 ∧ + (∀ a ∈ leaves t, ∃ i ≤ m, p i = a) ∧ + (∀ a ∈ leaves t, dist (p 0) a ≤ h n+8) := by + induction n generalizing p m with + | zero => + refine ⟨p 0,True.intro,rfl,?_,?_⟩ + · intro a ha + change a ∈ ({p 0} : Finset V) at ha + have he := Finset.mem_singleton.mp ha + exact ⟨0,Nat.zero_le _,he.symm⟩ + · intro a ha + change a ∈ ({p 0} : Finset V) at ha + rw [Finset.mem_singleton.mp ha,dist_self] + linarith [hp 0] + | succ n ih => + obtain ⟨k,hkm,hklo,hkhi⟩ := first_crossing p m hstep (h (n+1)/2) + (by linarith [hp (n+1)]) (by linarith [hp (n+1)]) + obtain ⟨l,hl,hlroot,hlpath,hlball⟩ := ih p m hstep (by linarith [hg n,hp n]) + let q : ℕ → V := fun j => p (j+k) + have hqstep : ∀ j < m-k, dist (q j) (q (j+1)) ≤ 8 := by + intro j hj + simpa [q,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hstep (j+k) (by omega) + have hqend : h n ≤ dist (q 0) (q (m-k)) := by + have he : m-k+k = m := by omega + simp only [q,zero_add,he] + have htri := dist_triangle (p 0) (p k) (p m) + linarith [hg n,hp n] + obtain ⟨r,hr,hrroot,hrpath,hrball⟩ := ih q (m-k) hqstep hqend + have hrroot' : root r = p k := by simpa [q] using hrroot + have hsep : ∀ a ∈ leaves l, ∀ b ∈ leaves r, h (n+1)/4 ≤ dist a b := by + intro a ha b hb + have hla := hlball a ha + have hrb := hrball b hb + simp only [q,zero_add] at hrb + have ht₁ := dist_triangle (p 0) a (p k) + have ht₂ := dist_triangle a b (p k) + rw [dist_comm b (p k)] at ht₂ + linarith [hg n] + refine ⟨(l,r),⟨hl,hr,?_,hsep⟩,hlroot,?_,?_⟩ + · rw [hlroot,hrroot'] + linarith [hp (n+1)] + · intro a ha + rcases Finset.mem_union.mp ha with ha | ha + · exact hlpath a ha + · obtain ⟨j,hj,hja⟩ := hrpath a ha + exact ⟨j+k,by omega,hja⟩ + · intro a ha + rcases Finset.mem_union.mp ha with ha | ha + · have hh := hlball a ha + linarith [hg n,hp n] + · have hh := hrball a ha + simp only [q,zero_add] at hh + have htri := dist_triangle (p 0) (p k) a + linarith [hg n,hp n] + +lemma geometric_scale_gap (b : ℝ) (hb : 100 ≤ b) (n : ℕ) : + 8*(16*b^n)+64 ≤ 16*b^(n+1) := by + rw [pow_succ] + have hn : 1 ≤ b^n := one_le_pow₀ (by linarith) + nlinarith + +end + +section +variable {V : Type*} + +def candidates (B : ℕ → V → Finset V) : (n : ℕ) → V → Finset (Tree V n) + | 0, z => {z} + | n+1, z => (B (n+1) z).biUnion (fun y => (candidates B n z).product (candidates B n y)) + +lemma mem_candidates_root (B : ℕ → V → Finset V) {n : ℕ} {z : V} {t : Tree V n} + (ht : t ∈ candidates B n z) : root t = z := by + induction n with + | zero => exact Finset.mem_singleton.mp ht + | succ n ih => + obtain ⟨y,_,h⟩ := Finset.mem_biUnion.mp ht + exact ih (Finset.mem_product.mp h).1 + +variable [PseudoMetricSpace V] +lemma admissible_mem_candidates (h : ℕ → ℝ) (B : ℕ → V → Finset V) + (hB : ∀ n z y, dist z y ≤ h (n+1)+8 → y ∈ B (n+1) z) + {n : ℕ} (t : Tree V n) (ht : Admissible h t) : t ∈ candidates B n (root t) := by + induction n with + | zero => exact Finset.mem_singleton_self _ + | succ n ih => + apply Finset.mem_biUnion.mpr + refine ⟨root t.2,hB n (root t.1) (root t.2) ht.2.2.1,?_⟩ + exact Finset.mem_product.mpr ⟨ih t.1 ht.1,ih t.2 ht.2.1⟩ + +omit [PseudoMetricSpace V] in +lemma card_candidates_le (B : ℕ → V → Finset V) (M A : ℕ → ℕ) + (hB : ∀ n z, (B (n+1) z).card ≤ M (n+1)) (hA0 : 1 ≤ A 0) + (hA : ∀ n, M (n+1)*A n^2 ≤ A (n+1)) (n : ℕ) (z : V) : + (candidates B n z).card ≤ A n := by + induction n generalizing z with + | zero => + change ({(show V from z)} : Finset V).card ≤ _ + simpa only [Finset.card_singleton] using hA0 + | succ n ih => + simp only [candidates] + apply Finset.card_biUnion_le.trans + calc + _ ≤ ∑ _y ∈ B (n+1) z, A n^2 := by + apply Finset.sum_le_sum + intro y _ + exact (Finset.card_product (candidates B n z) (candidates B n y)).le.trans + (by simpa only [pow_two] using Nat.mul_le_mul (ih z) (ih y)) + _ ≤ M (n+1)*A n^2 := by + simp only [Finset.sum_const,nsmul_eq_mul] + exact Nat.mul_le_mul_right _ (hB n z) + _ ≤ A (n+1) := hA n + +def assignmentBound (a c : ℕ) : ℕ → ℕ + | 0 => 1 + | n+1 => (a*c^(n+1))*assignmentBound a c n^2 + +lemma assignmentBound_formula (a c n : ℕ) : + assignmentBound a c n * a*c^(n+2) = (a*c^2)^(2^n) := by + induction n with + | zero => simp [assignmentBound] + | succ n ih => + calc + _ = (assignmentBound a c n*a*c^(n+2))^2 := by + simp only [assignmentBound,pow_succ] + ring + _ = ((a*c^2)^(2^n))^2 := by rw [ih] + _ = (a*c^2)^(2^(n+1)) := by rw [← pow_mul,pow_succ 2 n] + +lemma assignmentBound_le (a c : ℕ) (ha : 1 ≤ a) (hc : 1 ≤ c) (n : ℕ) : + assignmentBound a c n ≤ (a*c^2)^(2^n) := by + rw [← assignmentBound_formula] + have hp : 1 ≤ c^(n+2) := one_le_pow₀ hc + calc + _ ≤ assignmentBound a c n*a := by simpa using Nat.mul_le_mul_left (assignmentBound a c n) ha + _ ≤ assignmentBound a c n*a*c^(n+2) := by + simpa using Nat.mul_le_mul_left (assignmentBound a c n*a) hp + +omit [PseudoMetricSpace V] in + +theorem geometric_candidates_count (B : ℕ → V → Finset V) (a c : ℕ) + (ha : 1 ≤ a) (hc : 1 ≤ c) + (hB : ∀ n z, (B (n+1) z).card ≤ a*c^(n+1)) (n : ℕ) (z : V) : + (candidates B n z).card ≤ (a*c^2)^(2^n) := by + apply (card_candidates_le B (fun j => a*c^j) (assignmentBound a c) hB + le_rfl (fun _ => le_rfl) n z).trans + exact assignmentBound_le a c ha hc n + +end + +variable {V Ω : Type*} [PseudoMetricSpace V] [Fintype Ω] + +lemma Sparse.mono_constant {α L L' : ℝ} {F : Finset V} + (hF : Sparse α L F) (hL : L ≤ L') : Sparse α L' F := by + intro z r hr + exact (hF z r hr).trans (mul_le_mul_of_nonneg_right hL (Real.rpow_nonneg (by linarith) _)) + +def Crosses (Z : Set V) (z : V) (r : ℝ) : Prop := + ∃ (p : ℕ → V) (m : ℕ), p 0 = z ∧ (∀ i ≤ m, p i ∈ Z) ∧ + (∀ i < m, dist (p i) (p (i+1)) ≤ 8) ∧ r ≤ dist (p 0) (p m) + +lemma finite_union_mass {W : Type*} (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) + (F : Finset W) (E : W → Ω → Prop) (A : Ω → Prop) + (hA : ∀ ω, A ω → ∃ t ∈ F, E t ω) : + (∑ ω, if A ω then μ ω else 0) ≤ ∑ t ∈ F, ∑ ω, if E t ω then μ ω else 0 := by + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro ω _ + by_cases ha : A ω + · rw [ite_eq_left ha] + obtain ⟨t,ht,he⟩ := hA ω ha + have h := Finset.single_le_sum (f:=fun t => if E t ω then μ ω else 0) + (fun i _ => by split_ifs <;> simp [hμ]) ht + simpa only [ite_eq_left he] using h + · rw [ite_eq_right ha] + exact Finset.sum_nonneg (fun i _ => by split_ifs <;> simp [hμ]) + +theorem crossing_mass_bound (μ : Ω → ℝ) (hμ : ∀ ω, 0 ≤ μ ω) (Z : Ω → Set V) + (h : ℕ → ℝ) (hp : ∀ n, 0 < h n) (hg : ∀ n, 8*h n+64 ≤ h (n+1)) + (α L : ℝ) (hα : 0 ≤ α) (hL : 1 ≤ L) + (hscale : ∀ n, (2:ℝ)^(n+1) ≤ (1+h (n+1)/8)^α) + (B : ℕ → V → Finset V) + (hB : ∀ n z y, dist z y ≤ h (n+1)+8 → y ∈ B (n+1) z) + (a c : ℕ) (ha : 1 ≤ a) (hc : 1 ≤ c) + (hcard : ∀ n z, (B (n+1) z).card ≤ a*c^(n+1)) + (q : ℝ) (hq : 0 ≤ q) + (htest : ∀ F : Finset V, Sparse α L F → + (∑ ω, if (F:Set V) ⊆ Z ω then μ ω else 0) ≤ q^F.card) + (n : ℕ) (z : V) : + (∑ ω, if Crosses (Z ω) z (h n) then μ ω else 0) ≤ + ((a*c^2:ℕ)*q)^(2^n) := by + let F := (candidates B n z).filter (Admissible h) + have hcover : ∀ ω, Crosses (Z ω) z (h n) → + ∃ t ∈ F, (leaves t : Set V) ⊆ Z ω := by + intro ω hω + obtain ⟨p,m,hp0,hpz,hps,hpe⟩ := hω + obtain ⟨t,ht,htroot,htpath,_⟩ := crossing_witness h hp hg n p m hps hpe + refine ⟨t,?_,?_⟩ + · apply Finset.mem_filter.mpr + refine ⟨?_,ht⟩ + rw [← hp0,← htroot] + exact admissible_mem_candidates h B hB t ht + · intro v hv + obtain ⟨i,hi,rfl⟩ := htpath v hv + exact hpz i hi + calc + _ ≤ ∑ t ∈ F, ∑ ω, if (leaves t:Set V) ⊆ Z ω then μ ω else 0 := + finite_union_mass μ hμ F _ _ hcover + _ ≤ ∑ _t ∈ F, q^(2^n) := by + apply Finset.sum_le_sum + intro t ht + have had := (Finset.mem_filter.mp ht).2 + have hsp := (admissible_sparse h (fun i => hp (i+1)) α hα hscale t had).mono_constant hL + simpa only [card_leaves h (fun i => hp (i+1)) t had] using htest (leaves t) hsp + _ = (F.card:ℝ)*q^(2^n) := by simp + _ ≤ ((a*c^2:ℕ):ℝ)^(2^n)*q^(2^n) := by + apply mul_le_mul_of_nonneg_right _ (pow_nonneg hq _) + exact_mod_cast ((Finset.card_filter_le _ _).trans (geometric_candidates_count B a c ha hc hcard n z)) + _ = _ := (mul_pow ..).symm + +end Heisenberg.SparseWitness + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SparseEnergy.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SparseEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..d39a4f19db84c9c9f8409255de8e8053a0f059b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SparseEnergy.lean @@ -0,0 +1,281 @@ +import OAI.MathematicalPhysics.Heisenberg.FlowCongestion + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical +open scoped Classical BigOperators + +open scoped Classical BigOperators +namespace Heisenberg.SparseSum + +lemma dyadic_power (r : ℝ) (n : ℕ) : ((2:ℝ)^n)^r = ((2:ℝ)^r)^n := by + rw [←Real.rpow_natCast,←Real.rpow_mul (by norm_num),mul_comm, + Real.rpow_mul (by norm_num),Real.rpow_natCast] + +theorem sparse_kernel_sum {I V : Type*} [Fintype I] [PseudoMetricSpace V] + (x : I → V) (z : V) (α q L : ℝ) (hα : 0 ≤ α) (hαq : α < q) (hL : 0 ≤ L) + (hgrowth : ∀ r : ℝ, 0 ≤ r → + ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card:ℝ) ≤ L*(1+r)^α) : + (∑ i, (1+dist (x i) z)^(-q)) ≤ + (2:ℝ)^q * (L*(2:ℝ)^α) * (1-(2:ℝ)^(α-q))⁻¹ := by + have hq : 0 < q := lt_of_le_of_lt hα hαq + let a : ℝ := (2:ℝ)^(-q) + have ha0 : 0 ≤ a := by dsimp [a]; positivity + have ha1 : a < 1 := Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (by linarith) + have hs : Summable (fun n : ℕ => a^n) := (hasSum_geometric_of_lt_one ha0 ha1).summable + let F : I → ℕ → ℝ := fun i n => if dist (x i) z ≤ (2:ℝ)^n then a^n else 0 + have hF : ∀ i n, 0 ≤ F i n := by intro i n; dsimp [F]; split_ifs <;> positivity + have hsF : ∀ i, Summable (F i) := by + intro i + exact Summable.of_nonneg_of_le (hF i) (fun n => by dsimp [F]; split_ifs <;> simp [pow_nonneg ha0]) hs + have hbound : ∀ i, (1+dist (x i) z)^(-q) ≤ (2:ℝ)^q*(∑' n, F i n) := by + intro i + obtain ⟨n,hn,hn'⟩ := exists_nat_pow_near + (show 1 ≤ 1+dist (x i) z by linarith [dist_nonneg (x:=x i) (y:=z)]) (by norm_num : (1:ℝ) < 2) + have hd : dist (x i) z ≤ (2:ℝ)^(n+1) := by linarith + have hp : (1+dist (x i) z)^(-q) ≤ ((2:ℝ)^n)^(-q) := + Real.rpow_le_rpow_of_nonpos (by positivity) hn (by linarith) + rw [dyadic_power] at hp + have hprod : (2:ℝ)^q*a=1 := by dsimp [a]; rw [←Real.rpow_add (by norm_num)]; simp + have he : ((2:ℝ)^(-q))^n = (2:ℝ)^q*a^(n+1) := by + rw [pow_succ] + calc + _ = 1*a^n := by simp [a] + _ = _ := by rw [←hprod]; ring + rw [he] at hp + apply hp.trans + apply mul_le_mul_of_nonneg_left _ (by positivity) + have hh := (hsF i).le_tsum (n+1) (fun j _ => hF i j) + simpa only [F,ite_eq_left hd] using hh + let b : ℝ := (2:ℝ)^(α-q) + have hb0 : 0 ≤ b := by dsimp [b]; positivity + have hb1 : b < 1 := Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (by linarith) + have hsb : Summable (fun n : ℕ => L*(2:ℝ)^α*b^n) := + (hasSum_geometric_of_lt_one hb0 hb1).summable.mul_left _ + have hc : ∀ n, (∑ i, F i n) ≤ L*(2:ℝ)^α*b^n := by + intro n + have hcount := hgrowth ((2:ℝ)^n) (by positivity) + have ht : 1+(2:ℝ)^n ≤ 2*(2:ℝ)^n := by linarith [one_le_pow₀ (n:=n) (by norm_num : (1:ℝ) ≤ 2)] + have hp := Real.rpow_le_rpow (by positivity) ht hα + rw [Real.mul_rpow (by norm_num) (by positivity),dyadic_power] at hp + calc + _ = ((Finset.univ.filter (fun i => dist (x i) z ≤ (2:ℝ)^n)).card:ℝ)*a^n := by + simp [F,←Finset.sum_filter] + _ ≤ (L*(1+(2:ℝ)^n)^α)*a^n := mul_le_mul_of_nonneg_right hcount (pow_nonneg ha0 _) + _ ≤ (L*((2:ℝ)^α*((2:ℝ)^α)^n))*a^n := by gcongr + _ = _ := by + have hab : (2:ℝ)^α*a=b := by dsimp [a,b]; rw [←Real.rpow_add (by norm_num)]; congr 1 + rw [show (L*((2:ℝ)^α*((2:ℝ)^α)^n))*a^n = L*(2:ℝ)^α*(((2:ℝ)^α)^n*a^n) by ring, + ←mul_pow,hab] + calc + _ ≤ ∑ i, (2:ℝ)^q*(∑' n, F i n) := Finset.sum_le_sum (fun i _ => hbound i) + _ = (2:ℝ)^q*(∑' n, ∑ i, F i n) := by + rw [←Finset.mul_sum,←Summable.tsum_finsetSum (fun i _ => hsF i)] + _ ≤ (2:ℝ)^q*(∑' n, L*(2:ℝ)^α*b^n) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact (summable_sum (fun i _ => hsF i)).tsum_le_tsum hc hsb + _ = _ := by rw [tsum_mul_left,tsum_geometric_of_lt_one hb0 hb1]; dsimp [b]; ring + +end Heisenberg.SparseSum + +namespace Heisenberg.FlowAggregation + +theorem total_energy {I E V : Type*} [Fintype I] [PseudoMetricSpace V] + (x : I → V) (J : I → E → ℝ) (α q L B : ℝ) + (hα : 0 ≤ α) (hαq : α < q) (hL : 0 ≤ L) (hB : 0 ≤ B) + (hgrowth : ∀ z r, 0 ≤ r → + ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card:ℝ) ≤ L*(1+r)^α) + (hs : ∀ i j, Summable (fun e => |J i e*J j e|)) + (hoverlap : ∀ i j, (∑' e, |J i e*J j e|) ≤ B*(1+dist (x i) (x j))^(-q)) : + Summable (fun e => (∑ i, J i e)^2) ∧ + (∑' e, (∑ i, J i e)^2) ≤ + (B*((2:ℝ)^q*(L*(2:ℝ)^α)*(1-(2:ℝ)^(α-q))⁻¹))*(Fintype.card I) := by + let F : E → ℝ := fun e => ∑ i, ∑ j, |J i e*J j e| + have hF : Summable F := summable_sum (fun i _ => summable_sum (fun j _ => hs i j)) + have hbound : ∀ e, (∑ i, J i e)^2 ≤ F e := by + intro e + calc + _ = ∑ i, ∑ j, J i e*J j e := by rw [sq,Finset.sum_mul]; simp only [Finset.mul_sum] + _ ≤ _ := Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => le_abs_self _)) + have hsquare := Summable.of_nonneg_of_le (fun e => sq_nonneg _) hbound hF + refine ⟨hsquare,?_⟩ + calc + _ ≤ ∑' e, F e := hsquare.tsum_le_tsum hbound hF + _ = ∑ i, ∑ j, ∑' e, |J i e*J j e| := by + rw [Summable.tsum_finsetSum (fun i _ => summable_sum (fun j _ => hs i j))] + apply Finset.sum_congr rfl + intro i _ + exact Summable.tsum_finsetSum (fun j _ => hs i j) + _ ≤ ∑ i, ∑ j, B*(1+dist (x i) (x j))^(-q) := + Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => hoverlap i j)) + _ ≤ ∑ _i : I, B*((2:ℝ)^q*(L*(2:ℝ)^α)*(1-(2:ℝ)^(α-q))⁻¹) := by + apply Finset.sum_le_sum + intro i _ + rw [←Finset.mul_sum] + apply mul_le_mul_of_nonneg_left _ hB + simpa only [dist_comm (x i)] using + Heisenberg.SparseSum.sparse_kernel_sum x (x i) α q L hα hαq hL (hgrowth (x i)) + _ = _ := by simp [mul_comm] + +lemma kernel_displacement {V : Type*} [PseudoMetricSpace V] + (x x' y y' : V) (R q : ℝ) (_hR : 0 ≤ R) (hq : 0 ≤ q) + (hy : dist y x ≤ R) (hy' : dist y' x' ≤ R) : + (1+dist y y')^(-q) ≤ if dist x x' ≤ 4*R then 1 else + (2:ℝ)^q*(1+dist x x')^(-q) := by + split_ifs with hn + · exact Real.rpow_le_one_of_one_le_of_nonpos (by linarith [dist_nonneg (x:=y) (y:=y')]) (by linarith) + · have ht : dist x x' ≤ 2*R+dist y y' := by + have h := dist_triangle4 x y y' x' + rw [dist_comm x y] at h + linarith + have hbase : 1+dist x x' ≤ 2*(1+dist y y') := by linarith [lt_of_not_ge hn] + have hp := Real.rpow_le_rpow_of_nonpos (by positivity : (0:ℝ) < 1+dist x x') hbase (show -q ≤ 0 by linarith) + rw [Real.mul_rpow (by norm_num) (by positivity)] at hp + have hc : (2:ℝ)^q*(2:ℝ)^(-q)=1 := by rw [←Real.rpow_add (by norm_num)]; simp + have hh := mul_le_mul_of_nonneg_left hp (Real.rpow_nonneg (by norm_num : (0:ℝ) ≤ 2) q) + simpa only [←mul_assoc,hc,one_mul] using hh + +lemma averaged_overlap {A B E : Type*} [Fintype A] [Fintype B] + (μ : A → ℝ) (ν : B → ℝ) (J : A → E → ℝ) (K : B → E → ℝ) (C : ℝ) + (hμ : ∀ a, 0 ≤ μ a) (hν : ∀ b, 0 ≤ ν b) + (hm : ∑ a, μ a ≤ 1) (hn : ∑ b, ν b ≤ 1) (hC : 0 ≤ C) + (hs : ∀ a b, Summable (fun e => |J a e*K b e|)) + (hb : ∀ a b, μ a ≠ 0 → ν b ≠ 0 → (∑' e, |J a e*K b e|) ≤ C) : + Summable (fun e => |(∑ a, μ a*J a e)*(∑ b, ν b*K b e)|) ∧ + (∑' e, |(∑ a, μ a*J a e)*(∑ b, ν b*K b e)|) ≤ C := by + let F : E → ℝ := fun e => ∑ a, ∑ b, (μ a*ν b)*|J a e*K b e| + have hsF : Summable F := summable_sum (fun a _ => summable_sum (fun b _ => (hs a b).mul_left _)) + have hle : ∀ e, |(∑ a, μ a*J a e)*(∑ b, ν b*K b e)| ≤ F e := by + intro e + calc + _ = |∑ a, ∑ b, (μ a*ν b)*(J a e*K b e)| := by + congr 1 + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro a _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro b _ + ring + _ ≤ ∑ a, |∑ b, (μ a*ν b)*(J a e*K b e)| := Finset.abs_sum_le_sum_abs .. + _ ≤ F e := by + apply Finset.sum_le_sum + intro a _ + simpa only [abs_mul,abs_of_nonneg (hμ a),abs_of_nonneg (hν _)] using + (Finset.abs_sum_le_sum_abs (s:=Finset.univ) (f:=fun b => (μ a*ν b)*(J a e*K b e))) + have hsres := Summable.of_nonneg_of_le (fun e => abs_nonneg _) hle hsF + refine ⟨hsres,?_⟩ + calc + _ ≤ ∑' e, F e := hsres.tsum_le_tsum hle hsF + _ = ∑ a, ∑ b, (μ a*ν b)*(∑' e, |J a e*K b e|) := by + rw [Summable.tsum_finsetSum (fun a _ => summable_sum (fun b _ => (hs a b).mul_left _))] + apply Finset.sum_congr rfl + intro a _ + rw [Summable.tsum_finsetSum (fun b _ => (hs a b).mul_left _)] + simp only [tsum_mul_left] + _ ≤ ∑ a, ∑ b, (μ a*ν b)*C := by + apply Finset.sum_le_sum + intro a _ + apply Finset.sum_le_sum + intro b _ + by_cases ha : μ a = 0 + · simp [ha] + by_cases hb' : ν b = 0 + · simp [hb'] + exact mul_le_mul_of_nonneg_left (hb a b ha hb') (mul_nonneg (hμ a) (hν b)) + _ = (∑ a, μ a)*(∑ b, ν b)*C := by + simp only [Finset.sum_mul,Finset.mul_sum] + exact Finset.sum_comm + _ ≤ C := by + have hprod : (∑ a, μ a)*(∑ b, ν b) ≤ 1 := by + exact (mul_le_mul hm hn (Finset.sum_nonneg (fun b _ => hν b)) (by norm_num)).trans_eq (by norm_num) + simpa using mul_le_mul_of_nonneg_right hprod hC + +lemma energy_le_row {I E : Type*} [Fintype I] (J : I → E → ℝ) + (K : I → I → ℝ) (C : ℝ) + (hs : ∀ i j, Summable (fun e => |J i e*J j e|)) + (hK : ∀ i j, (∑' e, |J i e*J j e|) ≤ K i j) + (hrow : ∀ i, (∑ j, K i j) ≤ C) : + Summable (fun e => (∑ i, J i e)^2) ∧ + (∑' e, (∑ i, J i e)^2) ≤ C*(Fintype.card I) := by + let F : E → ℝ := fun e => ∑ i, ∑ j, |J i e*J j e| + have hsF : Summable F := summable_sum (fun i _ => summable_sum (fun j _ => hs i j)) + have hb : ∀ e, (∑ i, J i e)^2 ≤ F e := by + intro e + calc + _ = ∑ i, ∑ j, J i e*J j e := by rw [sq,Finset.sum_mul]; simp only [Finset.mul_sum] + _ ≤ _ := Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => le_abs_self _)) + have hsquare := Summable.of_nonneg_of_le (fun e => sq_nonneg _) hb hsF + refine ⟨hsquare,?_⟩ + calc + _ ≤ ∑' e, F e := hsquare.tsum_le_tsum hb hsF + _ = ∑ i, ∑ j, ∑' e, |J i e*J j e| := by + rw [Summable.tsum_finsetSum (fun i _ => summable_sum (fun j _ => hs i j))] + apply Finset.sum_congr rfl + intro i _ + exact Summable.tsum_finsetSum (fun j _ => hs i j) + _ ≤ ∑ i, ∑ j, K i j := Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => hK i j)) + _ ≤ ∑ _i : I, C := Finset.sum_le_sum (fun i _ => hrow i) + _ = _ := by simp [mul_comm] + +theorem injection_energy {I A E V : Type*} [Fintype I] [Fintype A] [PseudoMetricSpace V] + (x : I → V) (y : I → A → V) (μ : I → A → ℝ) (J : I → A → E → ℝ) + (α q L B : ℝ) (hα : 0 ≤ α) (hαq : α < q) (hL : 0 ≤ L) (hB : 0 ≤ B) + (hgrowth : ∀ z r, 0 ≤ r → + ((Finset.univ.filter (fun i => dist (x i) z ≤ r)).card:ℝ) ≤ L*(1+r)^α) + (hμ : ∀ i a, 0 ≤ μ i a) (hmass : ∀ i, ∑ a, μ i a ≤ 1) + (hs : ∀ i a j b, Summable (fun e => |J i a e*J j b e|)) + (hoverlap : ∀ i a j b, (∑' e, |J i a e*J j b e|) ≤ B*(1+dist (y i a) (y j b))^(-q)) + (R : ℝ) (hR : 0 ≤ R) (hloc : ∀ i a, μ i a ≠ 0 → dist (y i a) (x i) ≤ R) : + Summable (fun e => (∑ i, ∑ a, μ i a*J i a e)^2) ∧ + (∑' e, (∑ i, ∑ a, μ i a*J i a e)^2) ≤ + B*(L*(4:ℝ)^α + (2:ℝ)^q*((2:ℝ)^q*(L*(2:ℝ)^α)*(1-(2:ℝ)^(α-q))⁻¹)) * + (1+R)^α*(Fintype.card I) := by + let K : I → I → ℝ := fun i j => B*((if dist (x i) (x j) ≤ 4*R then 1 else 0) + + (2:ℝ)^q*(1+dist (x i) (x j))^(-q)) + have hK : ∀ i j, 0 ≤ K i j := by intro i j; dsimp [K]; split_ifs <;> positivity + have hover : ∀ i j, Summable (fun e => |(∑ a, μ i a*J i a e)*(∑ b, μ j b*J j b e)|) ∧ + (∑' e, |(∑ a, μ i a*J i a e)*(∑ b, μ j b*J j b e)|) ≤ K i j := by + intro i j + apply averaged_overlap (μ i) (μ j) (J i) (J j) (K i j) (hμ i) (hμ j) (hmass i) (hmass j) (hK i j) (hs i · j ·) + intro a b ha hb + apply (hoverlap i a j b).trans + apply mul_le_mul_of_nonneg_left _ hB + have hh := kernel_displacement (x i) (x j) (y i a) (y j b) R q hR (by linarith) (hloc i a ha) (hloc j b hb) + have hp : 0 ≤ (2:ℝ)^q*(1+dist (x i) (x j))^(-q) := by positivity + split_ifs at hh ⊢ <;> linarith + apply energy_le_row (fun i e => ∑ a, μ i a*J i a e) K _ (fun i j => (hover i j).1) (fun i j => (hover i j).2) + intro i + have hcount := hgrowth (x i) (4*R) (by positivity) + have hsum := Heisenberg.SparseSum.sparse_kernel_sum x (x i) α q L hα hαq hL (hgrowth (x i)) + have hrpow : (1+4*R)^α ≤ (4:ℝ)^α*(1+R)^α := by + calc + _ ≤ (4*(1+R))^α := Real.rpow_le_rpow (by positivity) (by linarith) hα + _ = _ := Real.mul_rpow (by norm_num) (by positivity) + have hunit : 1 ≤ (1+R)^α := Real.one_le_rpow (by linarith) hα + have hSS : 0 ≤ (2:ℝ)^q*(L*(2:ℝ)^α)*(1-(2:ℝ)^(α-q))⁻¹ := by + have hh : (2:ℝ)^(α-q) < 1 := Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (by linarith) + positivity + have he : (∑ j, K i j) = B*((Finset.univ.filter (fun j => dist (x j) (x i) ≤ 4*R)).card + + (2:ℝ)^q*(∑ j, (1+dist (x j) (x i))^(-q))) := by + simp only [K,←Finset.mul_sum,Finset.sum_add_distrib] + simp [dist_comm] + rw [he,mul_assoc] + apply mul_le_mul_of_nonneg_left _ hB + nlinarith [mul_le_mul_of_nonneg_left hsum (Real.rpow_nonneg (by norm_num : (0:ℝ) ≤ 2) q), + mul_le_mul_of_nonneg_left hrpow hL, + mul_nonneg (mul_nonneg (Real.rpow_nonneg (by norm_num : (0:ℝ) ≤ 2) q) hSS) (sub_nonneg.mpr hunit)] + +end Heisenberg.FlowAggregation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpatialClocks.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpatialClocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..cac567f2fed5b8e9664f6bf749c3c3500f3bbd79 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpatialClocks.lean @@ -0,0 +1,402 @@ +import OAI.MathematicalPhysics.Heisenberg.ClockInsertions + +namespace OAI + +noncomputable section + +open Filter Topology +open scoped RealInnerProductSpace Classical +open scoped Classical +open Filter +open scoped BigOperators Classical + +namespace Heisenberg.Clocks +open Heisenberg.Exposure Heisenberg.Bernoulli +variable {V X E I : Type*} [PseudoMetricSpace X] [Fintype E] [Fintype I] + +def mixedCoins (M : (I → Bool) → I → Prop) (c : I ⊕ I → Bool) (r : ℕ → I) : ℕ → Bool := + fun j=>if M (original c) (r j) then original c (r j) else fresh c (r j) + +def mixedSource (M : (I → Bool) → I → Prop) (c : I ⊕ I → Bool) (r : ℕ → I) : ℕ → Bool := + fun j=>decide (M (original c) (r j)) + +omit [PseudoMetricSpace X] [Fintype E] [Fintype I] in +lemma mixedCoins_index (M : (I → Bool) → I → Prop) (c : I ⊕ I → Bool) (r : ℕ → I) (j : ℕ) : + mixedCoins M c r j=c (if mixedSource M c r j then Sum.inl (r j) else Sum.inr (r j)) := by + simp only [mixedCoins,mixedSource,decide_eq_true_eq] + split_ifs <;> rfl + +theorem joint_trajectory_localization + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card≤B) + (τ : ℕ → Equiv.Perm V) (site : V → X) (v : V) + (r : ℕ → I) (n N R : ℕ) (hr : Set.InjOn r (Set.Iio n)) + (edge : ℕ → E) (time : ℕ → Fin N) (index : Fin N → E → Bool → I ⊕ I) + (htime : Monotone time) + (hstep : ∀ j,jκ) (fun _=>(1:ℝ)) (index t e b)) * doubleRates p (index t e b)≤δ) : + (∑ c : I ⊕ I → Bool,if (R:ℝ)≤dist (site v) + (site (trajectory τ (mixedCoins M c r) n v)) then + weight (doubleRates p) c*W (original c) else 0) ≤ + ((N+R).choose R:ℝ)*(2*(B:ℝ)*δ)^R*(∑ c,weight p c*W c) := by + let x : (I ⊕ I → Bool) → ℕ → X := fun c j=>site (trajectory τ (mixedCoins M c r) j v) + have hd (c : I ⊕ I → Bool) (j : ℕ) (_hj : jindex (time j) (edge j) (mixedSource M c r j)) + {j | j exact he' + have hm (c : I ⊕ I → Bool) (j : ℕ) (hj : jrfl) + edge n N R time index (fun c=>mixedSource M c r) htime hb hs hm + (doubleRates p) (Sum.elim (fun _=>κ) (fun _=>(1:ℝ))) + (by intro i; cases i <;> exact hp _) (by intro i; cases i <;> simp [hκ]) + (fun c=>W (original c)) (fun c=>hW _) + (by + intro c i + convert double_insertion W hins c i using 1 <;> + congr 2 <;> funext j <;> simp only [original,Function.comp_apply,Function.update_apply] <;> split_ifs <;> rfl) δ hδ hrate + have hz : (∑ c : I ⊕ I → Bool,weight (doubleRates p) c*W (original c)) = + ∑ c : I → Bool,weight p c*W c := by + convert double_partition p W using 1 + convert hh using 1 + · congr 1 + ext c + simp + · rw [←hz] + congr 2 + ext c + simp + +end Heisenberg.Clocks + +open scoped BigOperators Classical +namespace Heisenberg.Serial + +section +open Heisenberg.Exposure Heisenberg.Bernoulli Heisenberg.Clocks Heisenberg.MeshPair +variable {V I : Type*} [Fintype V] [DecidableEq V] [Fintype I] + +def sampledPrefix (τ : ℕ → Equiv.Perm V) (p : I → ℝ) (r : ℕ → I) + (M : (I → Bool) → I → Prop) (n : ℕ) (D : (I → Bool) → Fin (n+1) → Set V) + (base : I → Bool) : Matrix V V ℝ := + product n (fun i=>∑ b : Bool,(if b then p (r i) else 1-p (r i)) • + killedBetween (D base i.castSucc) (D base i.succ) + (if (if M base (r i) then base (r i) else b) then τ i else 1)) * projection (D base 0) + +theorem sampledPrefix_event (τ : ℕ → Equiv.Perm V) (p : I → ℝ) + (hp : ∀ i,0≤p i ∧ p i≤1) (r : ℕ → I) (n : ℕ) + (hr : Set.InjOn r (Set.Iio n)) (M : (I → Bool) → I → Prop) + (D : (I → Bool) → Fin (n+1) → Set V) + (W : (I → Bool) → ℝ) (hW : ∀ c,0≤W c) (v : V) (A : Set V) : + (∑ base : I → Bool,weight p base*W base* + (∑ i,if i∈A then sampledPrefix τ p r M n D base i v else 0)) ≤ + ∑ c : I ⊕ I → Bool,if trajectory τ (mixedCoins M c r) n v∈A then + weight (doubleRates p) c*W (original c) else 0 := by + have hir : Function.Injective (fun i : Fin n=>r i) := by + intro i j h + exact Fin.ext (hr i.isLt j.isLt h) + have hw (i : I) : (∑ b : Bool,if b then p i else 1-p i)=1 := by simp + have hw0 (i : I) (b : Bool) : 0≤(if b then p i else 1-p i) := by + cases b <;> simp <;> linarith [(hp i).1,(hp i).2] + have hbase (base : I → Bool) := prefix_endpoint_bound n + (fun i b=>if b then p i else 1-p i) hw hw0 (fun i=>r i) hir (D base) + (fun i b=>if (if M base (r i) then base (r i) else b) then τ i else 1) v A + have h := Finset.sum_le_sum (s:=Finset.univ) (fun base _=> + mul_le_mul_of_nonneg_left (hbase base) + (mul_nonneg (weight_nonneg p hp base) (hW base))) + change (∑ base : I → Bool,weight p base*W base* + (∑ i,if i∈A then sampledPrefix τ p r M n D base i v else 0)) ≤ _ at h + apply h.trans_eq + simp only [Finset.mul_sum] + rw [←(Equiv.sumArrowEquivProdArrow I I Bool).symm.sum_comp,Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro base _ + apply Finset.sum_congr rfl + intro c _ + have he : follow n (fun i=>if (if M base (r i) then base (r i) else c (r i)) then τ i else 1) v= + trajectory τ (fun j=>if M base (r j) then base (r j) else c (r j)) n v := + follow_trajectory τ (fun j=>if M base (r j) then base (r j) else c (r j)) n v + change weight p base*W base*(if follow n _ v∈A then productWeight _ c else 0) = _ + rw [he] + have ho : original ((Equiv.sumArrowEquivProdArrow I I Bool).symm (base,c))=base := rfl + have hf : fresh ((Equiv.sumArrowEquivProdArrow I I Bool).symm (base,c))=c := rfl + have hc : mixedCoins M ((Equiv.sumArrowEquivProdArrow I I Bool).symm (base,c)) r= + (fun j=>if M base (r j) then base (r j) else c (r j)) := by + funext j + simp only [mixedCoins,ho,hf] + rw [hc,double_weight,ho,hf] + split_ifs <;> simp only [productWeight,weight,mul_zero] + ring + +end + +open Heisenberg.Exposure Heisenberg.Bernoulli Heisenberg.Clocks Heisenberg.MeshPair +variable {V X E I : Type*} [Fintype V] [DecidableEq V] [PseudoMetricSpace X] [Fintype E] [Fintype I] + +theorem sampledPrefix_localization + (choices : X → Finset E) (next : X → E → X) (B : ℕ) + (hB : ∀ x,(choices x).card≤B) + (τ : ℕ → Equiv.Perm V) (site : V → X) (v : V) + (r : ℕ → I) (n N R : ℕ) (hr : Set.InjOn r (Set.Iio n)) + (edge : ℕ → E) (time : ℕ → Fin N) (index : Fin N → E → Bool → I ⊕ I) + (htime : Monotone time) + (hstep : ∀ j,jκ) (fun _=>(1:ℝ)) (index t e b)) * doubleRates p (index t e b)≤δ) : + (∑ base : I → Bool, weight p base*W base* + (∑ j,if (R:ℝ) exact hp _) c) (hW _) + · rfl + +end Heisenberg.Serial + +open scoped Classical + +open scoped Classical BigOperators +namespace Heisenberg.SparseWitness + +variable (V : Type*) +def Tree : ℕ → Type _ + | 0 => V + | n+1 => Tree n × Tree n +variable {V} + +def root : {n : ℕ} → Tree V n → V + | 0, t => t + | _+1, t => root t.1 + +def leaves [DecidableEq V] : {n : ℕ} → Tree V n → Finset V + | 0, t => {t} + | _+1, t => leaves t.1 ∪ leaves t.2 + +lemma root_mem [DecidableEq V] {n : ℕ} (t : Tree V n) : root t ∈ leaves t := by + induction n with + | zero => exact Finset.mem_singleton_self _ + | succ n ih => exact Finset.mem_union_left _ (ih t.1) + +variable [PseudoMetricSpace V] + +def Admissible (h : ℕ → ℝ) : {n : ℕ} → Tree V n → Prop + | 0, _ => True + | n+1, t => Admissible h t.1 ∧ Admissible h t.2 ∧ + dist (root t.1) (root t.2) ≤ h (n+1) + 8 ∧ + ∀ a ∈ leaves t.1, ∀ b ∈ leaves t.2, h (n+1)/4 ≤ dist a b + +lemma leaves_disjoint (h : ℕ → ℝ) (hp : ∀ n, 0 < h (n+1)) + {n : ℕ} (t : Tree V (n+1)) (ht : Admissible h t) : + Disjoint (leaves t.1) (leaves t.2) := by + apply Finset.disjoint_left.mpr + intro a ha hb + have hh := ht.2.2.2 a ha a hb + simp only [dist_self] at hh + linarith [hp n] + +lemma card_leaves (h : ℕ → ℝ) (hp : ∀ n, 0 < h (n+1)) + {n : ℕ} (t : Tree V n) (ht : Admissible h t) : (leaves t).card = 2^n := by + induction n with + | zero => + change ({(show V from t)} : Finset V).card = 1 + exact Finset.card_singleton _ + | succ n ih => + rw [leaves,Finset.card_union_of_disjoint (leaves_disjoint h hp t ht), + ih t.1 ht.1,ih t.2 ht.2.1,pow_succ] + omega + +lemma small_diameter_count (h : ℕ → ℝ) (hm : Monotone h) + {n k : ℕ} (hk : 1 ≤ k) (hkn : k ≤ n+1) (t : Tree V n) (ht : Admissible h t) + (A : Set V) (hA : ∀ a ∈ A, ∀ b ∈ A, dist a b < h k/4) : + ((leaves t).filter (fun a => a ∈ A)).card ≤ 2^(k-1) := by + induction n with + | zero => + have hk1 : k = 1 := by omega + subst k + change ({a ∈ ({(show V from t)} : Finset V) | a ∈ A}).card ≤ 1 + exact (Finset.card_filter_le _ _).trans (le_of_eq (Finset.card_singleton _)) + | succ n ih => + by_cases hk' : k = n+2 + · subst k + calc + _ ≤ (leaves t).card := Finset.card_filter_le _ _ + _ ≤ 2^(n+1) := by + have hc : ∀ {j} (s : Tree V j), (leaves s).card ≤ 2^j := by + intro j + induction j with + | zero => + intro s + change ({(show V from s)} : Finset V).card ≤ 1 + exact le_of_eq (Finset.card_singleton _) + | succ j hj => + intro s + exact (Finset.card_union_le _ _).trans (by + rw [pow_succ] + linarith [hj s.1,hj s.2]) + exact hc t + _ = 2^(n+2-1) := by congr 1 + · have hkn' : k ≤ n+1 := by omega + let L := (leaves t.1).filter (fun a => a ∈ A) + let R := (leaves t.2).filter (fun a => a ∈ A) + have hone : L = ∅ ∨ R = ∅ := by + by_cases hL : L = ∅ + · exact Or.inl hL + · right + apply Finset.eq_empty_iff_forall_notMem.mpr + intro b hb + obtain ⟨a,ha⟩ := Finset.nonempty_iff_ne_empty.mpr hL + obtain ⟨hal,haA⟩ := Finset.mem_filter.mp ha + obtain ⟨hbr,hbA⟩ := Finset.mem_filter.mp hb + have hs := ht.2.2.2 a hal b hbr + have hlt := hA a haA b hbA + have hm' := hm (show k ≤ n+1 by omega) + linarith + rw [leaves,Finset.filter_union] + change (L ∪ R).card ≤ _ + rcases hone with hL | hR + · rw [hL,Finset.empty_union] + exact ih hkn' t.2 ht.2.1 + · rw [hR,Finset.union_empty] + exact ih hkn' t.1 ht.1 + +lemma ball_count (h : ℕ → ℝ) (hm : Monotone h) + {n k : ℕ} (hk : 1 ≤ k) (hkn : k ≤ n+1) (t : Tree V n) (ht : Admissible h t) + (z : V) (r : ℝ) (hr : r < h k/8) : + ((leaves t).filter (fun a => dist a z ≤ r)).card ≤ 2^(k-1) := by + apply small_diameter_count h hm hk hkn t ht {a | dist a z ≤ r} + intro a ha b hb + calc + dist a b ≤ dist a z + dist b z := dist_triangle_right a b z + _ < h k/4 := by dsimp at ha hb; linarith + +lemma ball_meets_one_child (h : ℕ → ℝ) {n : ℕ} (t : Tree V (n+1)) + (ht : Admissible h t) (z : V) (r : ℝ) (hr : r < h (n+1)/8) : + ((leaves t).filter (fun a => dist a z ≤ r)) = + ((leaves t.1).filter (fun a => dist a z ≤ r)) ∨ + ((leaves t).filter (fun a => dist a z ≤ r)) = + ((leaves t.2).filter (fun a => dist a z ≤ r)) := by + let L := (leaves t.1).filter (fun a => dist a z ≤ r) + let R := (leaves t.2).filter (fun a => dist a z ≤ r) + rw [leaves,Finset.filter_union] + change L ∪ R = L ∨ L ∪ R = R + by_cases hL : L = ∅ + · exact Or.inr (by rw [hL,Finset.empty_union]) + · left + have hR : R = ∅ := by + apply Finset.eq_empty_iff_forall_notMem.mpr + intro b hb + obtain ⟨a,ha⟩ := Finset.nonempty_iff_ne_empty.mpr hL + obtain ⟨ha,har⟩ := Finset.mem_filter.mp ha + obtain ⟨hb,hbr⟩ := Finset.mem_filter.mp hb + have hs := ht.2.2.2 a ha b hb + have hd := dist_triangle_right a b z + linarith + rw [hR,Finset.union_empty] + +def Sparse (α L : ℝ) (F : Finset V) : Prop := + ∀ z r, 0 ≤ r → (((F.filter (fun a => dist a z ≤ r)).card : ℕ) : ℝ) ≤ L*(1+r)^α + +theorem admissible_sparse (h : ℕ → ℝ) (hp : ∀ n, 0 < h (n+1)) + (α : ℝ) (hα : 0 ≤ α) + (hg : ∀ n, (2:ℝ)^(n+1) ≤ (1+h (n+1)/8)^α) + {n : ℕ} (t : Tree V n) (ht : Admissible h t) : Sparse α 1 (leaves t) := by + intro z r hr + simp only [one_mul] + induction n with + | zero => + have hc : ((leaves t).filter (fun a => dist a z ≤ r)).card ≤ 1 := by + exact (Finset.card_filter_le _ _).trans (le_of_eq (card_leaves h hp t ht)) + calc + _ ≤ (1:ℝ) := by exact_mod_cast hc + _ ≤ (1+r)^α := Real.one_le_rpow (by linarith) hα + | succ n ih => + by_cases hh : r < h (n+1)/8 + · rcases ball_meets_one_child h t ht z r hh with he | he + · rw [he]; exact ih t.1 ht.1 + · rw [he]; exact ih t.2 ht.2.1 + · calc + _ ≤ ((leaves t).card:ℝ) := by + exact_mod_cast (Finset.card_filter_le (leaves t) (fun a => dist a z ≤ r)) + _ = (2:ℝ)^(n+1) := by rw [card_leaves h hp t ht]; norm_cast + _ ≤ (1+h (n+1)/8)^α := hg n + _ ≤ (1+r)^α := Real.rpow_le_rpow (by linarith [hp n]) (by linarith) hα + +lemma geometric_scale_growth (b α : ℝ) (hb : 1 ≤ b) (hα : 0 ≤ α) + (hba : 2 ≤ b^α) (n : ℕ) : + (2:ℝ)^(n+1) ≤ (1+(16*b^(n+1))/8)^α := by + calc + _ ≤ (b^α)^(n+1) := pow_le_pow_left₀ (by positivity) hba _ + _ = (b^(n+1))^α := by rw [← Real.rpow_natCast,← Real.rpow_mul (by linarith), + mul_comm,Real.rpow_mul (by linarith),Real.rpow_natCast] + _ ≤ (1+(16*b^(n+1))/8)^α := by + apply Real.rpow_le_rpow (by positivity) _ hα + have : 0 ≤ b^(n+1) := by positivity + linarith + +end Heisenberg.SparseWitness + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpectralTransfer.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpectralTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..80fc77e7fa4a615a66bdef74129049bc7e83b731 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpectralTransfer.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.Heisenberg.RectangularExp + +namespace OAI + +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.TensorMatrix +variable {m n : Type} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] + +lemma diagonal_function_intertwines (a : m → ℝ) (b : n → ℝ) (V : Matrix m n ℝ) + (h : Matrix.diagonal a*V=V*Matrix.diagonal b) (f : ℝ → ℝ) : + Matrix.diagonal (f ∘ a)*V=V*Matrix.diagonal (f ∘ b) := by + ext i j + have he:=congrFun (congrFun h i) j + simp only [Matrix.diagonal_mul,Matrix.mul_diagonal] at he ⊢ + by_cases hv : V i j=0 + · simp [hv] + · have hab : a i=b j:=mul_right_cancel₀ hv (he.trans (mul_comm _ _)) + simp only [Function.comp_apply,hab,mul_comm] + +omit [Fintype m] in +lemma diagonal_fintype_sum {I : Type*} [Fintype I] (f : I → m → ℝ) : + (∑ i,Matrix.diagonal (f i))=Matrix.diagonal (fun j=>∑ i,f i j) := by + ext a b + by_cases h : a=b + · subst b; simp [Matrix.sum_apply] + · simp [Matrix.sum_apply,Matrix.diagonal_apply_ne _ h] + +theorem trace_exp_compression (A : Matrix m m ℝ) (B : Matrix n n ℝ) + (V : Matrix m n ℝ) (hV : V.transpose*V=1) (hAB : A*V=V*B) + (D : Matrix m m ℝ) (E : Matrix n n ℝ) (hDE : D*V=V*E) : + Matrix.trace (V*V.transpose*NormedSpace.exp A*D)=Matrix.trace (NormedSpace.exp B*E) := by + rw [Matrix.mul_assoc,Matrix.mul_assoc,Matrix.trace_mul_comm] + simp only [Matrix.mul_assoc] + rw [hDE,←Matrix.mul_assoc (NormedSpace.exp A) V E,exp_intertwines A B V hAB] + simp only [←Matrix.mul_assoc,hV,Matrix.one_mul] + +end Heisenberg.TensorMatrix + +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type} [Fintype X] [DecidableEq X] + +def physicalMagnetization (ℓ : ℕ) (k : X → Level ℓ) : ℝ := + ∑ x,((k x:ℝ)-(ℓ:ℝ)/2) + +def configMagnetization (ℓ : ℕ) (A : X → Config ℓ) : ℝ := + ∑ x,((A x).card-(ℓ:ℝ)/2) + +lemma total_diagonal_intertwines (ℓ : ℕ) : + Matrix.diagonal (configMagnetization (X:=X) ℓ)*tensor (fun _ : X=>basis ℓ)= + tensor (fun _ : X=>basis ℓ)*Matrix.diagonal (physicalMagnetization (X:=X) ℓ) := by + have hh:=congrArg (fun f : X → Matrix (X → Config ℓ) (X → Level ℓ) ℝ=>∑ x,f x) + (funext (diagonal_intertwines (X:=X) ℓ)) + simp only [SpinSlots.diagonalZ,physicalZ,local_diagonal,←Matrix.sum_mul,←Matrix.mul_sum, + diagonal_fintype_sum] at hh + exact hh + +omit [DecidableEq X] in +lemma color_config_mag (ℓ : ℕ) (A : X → Config ℓ) : + SlotColor.magnetization ((configEquiv ℓ).symm A)=configMagnetization ℓ A := by + unfold SlotColor.magnetization configMagnetization + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro x _ + have he (a : Fin ℓ) : (if ((configEquiv ℓ).symm A) (x,a) then (1:ℝ)/2 else -1/2)= + (if a∈A x then (1:ℝ) else 0)-1/2 := by + change (if decide (a∈A x) then (1:ℝ)/2 else -1/2)=_ + by_cases ha : a∈A x <;> simp [ha] <;> norm_num + simp_rw [he] + rw [Finset.sum_sub_distrib] + simp [div_eq_mul_inv] + +end Heisenberg.SlotTensor +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..1eb1b22fd32257915522ae7854614047c24f3a31 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverage.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.Heisenberg.CubeSelection + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg + +variable {d ℓ : ℕ} + +def averageState {I : Type*} [Fintype I] (μ : I → ℝ) (hμ : ∀ i,0≤μ i) + (hm : ∑ i,μ i=1) (ω : I → State d ℓ) : State d ℓ where + functional:=∑ i,(μ i:ℂ) • (ω i).functional + normalized:=by + simp only [sum_apply,smul_apply,smul_eq_mul,State.normalized,mul_one] + exact_mod_cast hm + positive:=by + intro A + simp only [sum_apply,smul_apply,smul_eq_mul, + Complex.im_sum,Complex.re_sum,Complex.mul_im,Complex.ofReal_im,zero_mul,add_zero, + Complex.mul_re,Complex.ofReal_re,sub_zero] + constructor + · simp only [(ω _).positive A |>.1,mul_zero,Finset.sum_const_zero] + · exact Finset.sum_nonneg (fun i _=>mul_nonneg (hμ i) ((ω i).positive A).2) + +lemma averageState_apply {I : Type*} [Fintype I] (μ : I → ℝ) (hμ : ∀ i,0≤μ i) + (hm : ∑ i,μ i=1) (ω : I → State d ℓ) (A : QuasiLocal d ℓ) : + (averageState μ hμ hm ω).functional A=∑ i,(μ i:ℂ)*(ω i).functional A := by + simp only [averageState,sum_apply,smul_apply,smul_eq_mul] + +def translationLinear (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ := + (translation d ℓ x).toLinearMap.mkContinuous 1 (fun A=>by change ‖translation d ℓ x A‖≤1*‖A‖; rw [norm_translation,one_mul]) + +@[simp] lemma translationLinear_apply (x : Site d) (A : QuasiLocal d ℓ) : + translationLinear d ℓ x A=translation d ℓ x A := rfl + +def translatedState (ω : State d ℓ) (x : Site d) : State d ℓ where + functional:=ω.functional.comp (translationLinear d ℓ x) + normalized:=by simp only [ContinuousLinearMap.comp_apply,translationLinear_apply,map_one,State.normalized] + positive:=by + intro A + simpa only [ContinuousLinearMap.comp_apply,translationLinear_apply,map_mul,map_star] using + ω.positive (translation d ℓ x A) + +lemma diffContOnCl_sum {I : Type*} [Fintype I] {s : Set ℂ} (F : I → ℂ → ℂ) + (hF : ∀ i,DiffContOnCl ℂ (F i) s) : DiffContOnCl ℂ (fun z=>∑ i,F i z) s := by + constructor + · convert DifferentiableOn.sum (u:=Finset.univ) (fun i _=>(hF i).1) using 1 + ext z + simp only [Finset.sum_apply] + · exact continuousOn_finsetSum _ (fun i _=>(hF i).2) + +lemma norm_convex_sum {I : Type*} [Fintype I] (μ : I → ℝ) (hμ : ∀ i,0≤μ i) + (hm : ∑ i,μ i=1) (f : I → ℂ) (C : ℝ) (hf : ∀ i,‖f i‖≤C) : + ‖∑ i,(μ i:ℂ)*f i‖≤C := by + calc _ ≤ ∑ i,‖(μ i:ℂ)*f i‖ := norm_sum_le _ _ + _ = ∑ i,μ i*‖f i‖ := by simp only [norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (hμ _)] + _ ≤ ∑ i,μ i*C := Finset.sum_le_sum (fun i _=>mul_le_mul_of_nonneg_left (hf i) (hμ i)) + _ = C := by rw [←Finset.sum_mul,hm,one_mul] + +theorem averaged_gibbs_strip {I : Type*} [Fintype I] (μ : I → ℝ) (hμ : ∀ i,0≤μ i) + (hm : ∑ i,μ i=1) (x : I → Site d) (τ : State d ℓ) + (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + (K : QuasiLocal d ℓ) (hK : IsSelfAdjoint K) {β : ℝ} (hβ : 0<β) (A B : QuasiLocal d ℓ) : + ∃ F : ℂ → ℂ,DiffContOnCl ℂ F (HeisenbergStrip.openStrip β) ∧ + (∀ z ∈ HeisenbergStrip.closedStrip β,‖F z‖≤4*‖A‖*‖B‖) ∧ + (∀ t : ℝ,F t=∑ i,(μ i:ℂ)*(gibbsState τ K β).functional + (translation d ℓ (x i) A*GibbsStrip.evolve K t (translation d ℓ (x i) B))) ∧ + (∀ t : ℝ,F ((t:ℂ)+Complex.I*β)=∑ i,(μ i:ℂ)*(gibbsState τ K β).functional + (GibbsStrip.evolve K t (translation d ℓ (x i) B)*translation d ℓ (x i) A)) := by + have hh (i : I):=finite_gibbs_strip τ hτ hK hβ (translation d ℓ (x i) A) (translation d ℓ (x i) B) + choose F hd hb hzero htop using hh + refine ⟨fun z=>∑ i,(μ i:ℂ)*F i z,?_,?_,?_,?_⟩ + · apply diffContOnCl_sum + intro i + exact ⟨(hd i).1.const_mul _,(hd i).2.const_mul _⟩ + · intro z hz + apply norm_convex_sum μ hμ hm _ _ + intro i + simpa only [norm_translation] using hb i z hz + · intro t + simp_rw [hzero] + · intro t + simp_rw [htop] + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverageBoundary.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverageBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..aec11e7d4af585f9b85d8139ab7cf2e06335665e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAverageBoundary.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinFieldUniform + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma dynamics_norm (t : ℝ) (B : QuasiLocal d ℓ) : ‖dynamics d ℓ t B‖=‖B‖ := by + classical + have h:=((dynamics_converges d ℓ t B).norm) + have hn (n : ℕ) := norm_finiteDynamics d ℓ (box d n) t B + simp only [hn] at h + exact tendsto_nhds_unique h tendsto_const_nhds + +lemma dynamics_continuous (B : QuasiLocal d ℓ) : Continuous (fun t=>dynamics d ℓ t B) := + (dynamics_locallyUniform d ℓ B).continuous + (Filter.Eventually.of_forall (fun n=>(finiteDynamics_equicontinuous d ℓ B).continuous (box d n))).frequently + +lemma state_limit_locallyUniform {η : ℕ → State d ℓ} {ω : State d ℓ} + (hη : ∀ A,Tendsto (fun n=>(η n).functional A) atTop (𝓝 (ω.functional A))) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (B : QuasiLocal d ℓ) : + TendstoLocallyUniformly (fun n t=>(η n).functional (M (dynamics d ℓ t B))) + (fun t=>ω.functional (M (dynamics d ℓ t B))) atTop := by + classical + apply EquicontinuousLimits.locallyUniform + · apply EquicontinuousLimits.equicontinuous_apply (C:=4) (by norm_num) (fun n=>state_norm_bound (η n)) + intro t + rw [Metric.equicontinuousAt_iff] + intro ε hε + obtain ⟨δ,hδ,hh⟩:=Metric.continuousAt_iff.mp (M.continuous.comp (dynamics_continuous B)).continuousAt ε hε + exact ⟨δ,hδ,fun y hy _=>by rw [dist_comm]; exact hh (by simpa only [dist_comm] using hy)⟩ + · intro t + exact hη _ + +def cubeBoundary (Λ : Finset (Site d)) (ω : State d ℓ) (h : ℝ) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (B : QuasiLocal d ℓ) (t : ℝ) : ℂ := + (Λ.card:ℂ)⁻¹*∑ x∈Λ,ω.functional (translation d ℓ x + (M (GibbsStrip.evolve (shiftedField (Λ.image (fun y=>-x+y)) h) t B))) + +lemma translated_state_difference (ω : State d ℓ) (x : Site d) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (v w : QuasiLocal d ℓ) : + ‖ω.functional (translation d ℓ x (M v))-ω.functional (translation d ℓ x (M w))‖≤4*‖M‖*dist v w := by + rw [←map_sub ω.functional _ _,←map_sub (translation d ℓ x) _ _,←map_sub M _ _,dist_eq_norm] + calc _ ≤ 4*‖translation d ℓ x (M (v-w))‖ := state_apply_norm_le ω _ + _ ≤ 4*(‖M‖*‖v-w‖) := by rw [norm_translation]; exact mul_le_mul_of_nonneg_left (M.le_opNorm _) (by norm_num) + _ = _ := by ring + +lemma cubeBoundary_error (N r : ℕ) (hr : r≤N) (ω : State d ℓ) (h t : ℝ) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (B : QuasiLocal d ℓ) + {δ : ℝ} (hδ : 0≤δ) + (hgood : ∀ Γ : Finset (Site d),box d r⊆Γ → + dist (GibbsStrip.evolve (shiftedField Γ h) t B) (dynamics d ℓ t B)≤δ) : + ‖cubeBoundary (box d N) ω h M B t- + (cubeAverage (box d N) (box_nonempty d N) ω).functional (M (dynamics d ℓ t B))‖≤ + 4*‖M‖*δ+(((box d N\box d (N-r)).card:ℝ)/(box d N).card)*(8*‖M‖*‖B‖) := by + classical + rw [cubeBoundary,cubeAverage_apply,←mul_sub,←Finset.sum_sub_distrib] + apply Average.norm_uniform_bulk_le _ (box d (N-r)) (box_nonempty d N) (box_mono (Nat.sub_le N r)) _ (by positivity) + · intro x hx + exact (translated_state_difference ω _ M _ _).trans (mul_le_mul_of_nonneg_left (hgood _ (box_deep_translate hr hx)) (by positivity)) + · intro x _ + have hb : dist (GibbsStrip.evolve (shiftedField ((box d N).image (fun y=>-x+y)) h) t B) (dynamics d ℓ t B)≤2*‖B‖ := by + classical + rw [dist_eq_norm] + exact (norm_sub_le _ _).trans_eq (by rw [GibbsStrip.real_evolve_norm (shiftedField_selfAdjoint _ _),dynamics_norm]; ring) + exact (translated_state_difference ω _ M _ _).trans (by nlinarith [mul_le_mul_of_nonneg_left hb (show 0≤4*‖M‖ by positivity)]) + +lemma scaled_quarter {ε C : ℝ} (hε : 0<ε) (hC : 0≤C) : + C*(ε/(4*(C+1)))<ε/4 := by + have hp : 0(cubeAverage (box d (N n)) (box_nonempty d (N n)) (η n)).functional A) atTop (𝓝 (ω.functional A))) + (M : QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) (B : QuasiLocal d ℓ) : + TendstoLocallyUniformly (fun n t=>cubeBoundary (box d (N n)) (η n) (h n) M B t) + (fun t=>ω.functional (M (dynamics d ℓ t B))) atTop := by + classical + apply tendstoLocallyUniformly_iff_forall_isCompact.mpr + intro K hK + rw [Metric.tendstoUniformlyOn_iff] + intro ε hε + obtain ⟨r,δ,hδ,hgood⟩:=field_deep_uniform B K hK (show 0<ε/(4*(4*‖M‖+1)) by positivity) + have hsmall := (Metric.tendsto_nhds.mp hh) δ hδ + have hratio : Tendsto (fun n=>(((box d (N n)\box d (N n-r)).card:ℝ)/(box d (N n)).card)*(8*‖M‖*‖B‖)) atTop (𝓝 0) := by + classical + simpa only [Function.comp_def,zero_mul] using ((box_boundary_inner_tendsto d r).comp hN).mul_const (8*‖M‖*‖B‖) + have heval := tendstoLocallyUniformly_iff_forall_isCompact.mp (state_limit_locallyUniform hω M B) K hK + filter_upwards [hN.eventually (eventually_ge_atTop r),hsmall, + hratio.eventually (eventually_lt_nhds (show (0:ℝ)<ε/4 by positivity)), + (Metric.tendstoUniformlyOn_iff.mp heval) (ε/4) (by positivity)] with n hn hhn hb he + intro t ht + have hhn' : |h n|<δ := by simpa only [dist_zero_right,Real.norm_eq_abs] using hhn + have herr:=cubeBoundary_error (N n) r hn (η n) (h n) t M B (show 0≤ε/(4*(4*‖M‖+1)) by positivity) + (fun Γ hΓ=>(hgood Γ hΓ (h n) hhn' t ht).le) + have hpart:=scaled_quarter hε (show 0≤4*‖M‖ by positivity) + have htri:=dist_triangle (ω.functional (M (dynamics d ℓ t B))) + ((cubeAverage (box d (N n)) (box_nonempty d (N n)) (η n)).functional (M (dynamics d ℓ t B))) + (cubeBoundary (box d (N n)) (η n) (h n) M B t) + rw [←dist_eq_norm,dist_comm] at herr + have hei:=he t ht + linarith + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinAveragedKMS.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAveragedKMS.lean new file mode 100644 index 0000000000000000000000000000000000000000..258d96bec5e4d750e820ae3f62bd6d40bca3b293 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinAveragedKMS.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinAverageBoundary + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma uniform_mass {X : Type*} (Λ : Finset X) (hΛ : Λ.Nonempty) : + ∑ _ : Λ,(Λ.card:ℝ)⁻¹=1 := by + simp only [Finset.sum_const,Finset.card_univ,Fintype.card_coe,nsmul_eq_mul] + exact mul_inv_cancel₀ (show (Λ.card:ℝ)≠0 by exact_mod_cast Finset.card_ne_zero.mpr hΛ) + +lemma uniform_sum {X : Type*} (Λ : Finset X) (f : X → ℂ) : + (∑ x : Λ,Complex.ofReal ((Λ.card:ℝ)⁻¹)*f x.val)=(Λ.card:ℂ)⁻¹*∑ x∈Λ,f x := by + rw [←Finset.mul_sum,Finset.sum_coe_sort Λ f] + simp only [Complex.ofReal_inv,Complex.ofReal_natCast] + +lemma cubeBoundary_lower (Λ : Finset (Site d)) (ω : State d ℓ) (h : ℝ) + (A B : QuasiLocal d ℓ) (t : ℝ) : + cubeBoundary Λ ω h (ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ) A) B t= + (Λ.card:ℂ)⁻¹*∑ x∈Λ,ω.functional (translation d ℓ x A* + GibbsStrip.evolve (shiftedField Λ h) t (translation d ℓ x B)) := by + simp only [cubeBoundary,ContinuousLinearMap.mul_apply',map_mul,translation_fieldDynamics,translated_volume_cancel] + +lemma cubeBoundary_upper (Λ : Finset (Site d)) (ω : State d ℓ) (h : ℝ) + (A B : QuasiLocal d ℓ) (t : ℝ) : + cubeBoundary Λ ω h ((ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ)).flip A) B t= + (Λ.card:ℂ)⁻¹*∑ x∈Λ,ω.functional (GibbsStrip.evolve (shiftedField Λ h) t (translation d ℓ x B)*translation d ℓ x A) := by + simp only [cubeBoundary,ContinuousLinearMap.flip_apply,ContinuousLinearMap.mul_apply',map_mul,translation_fieldDynamics,translated_volume_cancel] + +lemma finite_cube_gibbs_strip (Λ : Finset (Site d)) (hΛ : Λ.Nonempty) (h : ℝ) + (τ : State d ℓ) (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + {β : ℝ} (hβ : 0<β) (A B : QuasiLocal d ℓ) : + ∃ F : ℂ → ℂ,DiffContOnCl ℂ F (HeisenbergStrip.openStrip β) ∧ + (∀ z∈HeisenbergStrip.closedStrip β,‖F z‖≤4*‖A‖*‖B‖) ∧ + (∀ t : ℝ,F t=cubeBoundary Λ (gibbsState τ (shiftedField Λ h) β) h + (ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ) A) B t) ∧ + (∀ t : ℝ,F ((t:ℂ)+Complex.I*β)=cubeBoundary Λ (gibbsState τ (shiftedField Λ h) β) h + ((ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ)).flip A) B t) := by + let μ : Λ → ℝ := fun _ => (Λ.card : ℝ)⁻¹ + have hμ : ∀ i, 0 ≤ μ i := fun _ => inv_nonneg.mpr (Nat.cast_nonneg _) + have hm : ∑ i, μ i = 1 := uniform_mass Λ hΛ + have hh := averaged_gibbs_strip μ hμ hm (fun x : Λ => x.val) τ hτ + (shiftedField Λ h) (shiftedField_selfAdjoint Λ h) hβ A B + obtain ⟨F,hd,hb,h0,h1⟩ := hh + refine ⟨F,hd,hb,?_,?_⟩ + · intro t + exact (h0 t).trans ((uniform_sum Λ (fun x => + (gibbsState τ (shiftedField Λ h) β).functional + (translation d ℓ x A * GibbsStrip.evolve (shiftedField Λ h) t (translation d ℓ x B)))).trans + (cubeBoundary_lower Λ (gibbsState τ (shiftedField Λ h) β) h A B t).symm) + · intro t + exact (h1 t).trans ((uniform_sum Λ (fun x => + (gibbsState τ (shiftedField Λ h) β).functional + (GibbsStrip.evolve (shiftedField Λ h) t (translation d ℓ x B) * translation d ℓ x A))).trans + (cubeBoundary_upper Λ (gibbsState τ (shiftedField Λ h) β) h A B t).symm) + +theorem cubeAverage_limit_KMS (τ : State d ℓ) + (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + {β : ℝ} (hβ : 0<β) (N : ℕ → ℕ) (hN : Tendsto N atTop atTop) + (h : ℕ → ℝ) (hh : Tendsto h atTop (𝓝 0)) (ω : State d ℓ) + (hω : ∀ A,Tendsto (fun n=>(cubeAverage (box d (N n)) (box_nonempty d (N n)) + (gibbsState τ (shiftedField (box d (N n)) (h n)) β)).functional A) atTop (𝓝 (ω.functional A))) : IsKMS β ω := by + refine ⟨hβ,fun A B=>?_⟩ + choose F hd hb hzero htop using fun n=>finite_cube_gibbs_strip (box d (N n)) (box_nonempty d (N n)) (h n) τ hτ hβ A B + let η : ℕ → State d ℓ:=fun n=>gibbsState τ (shiftedField (box d (N n)) (h n)) β + have hl:=cubeBoundary_locallyUniform N hN h hh η ω hω (ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ) A) B + have hu:=cubeBoundary_locallyUniform N hN h hh η ω hω ((ContinuousLinearMap.mul ℂ (QuasiLocal d ℓ)).flip A) B + have hf0 : TendstoLocallyUniformly (fun n (t : ℝ)=>F n t) (fun t=>ω.functional (A*dynamics d ℓ t B)) atTop := by + simpa only [hzero,ContinuousLinearMap.mul_apply',η] using hl + have hf1 : TendstoLocallyUniformly (fun n (t : ℝ)=>F n ((t:ℂ)+Complex.I*β)) (fun t=>ω.functional (dynamics d ℓ t B*A)) atTop := by + simpa only [htop,ContinuousLinearMap.flip_apply,ContinuousLinearMap.mul_apply',η] using hu + obtain ⟨f,_,hfd,hfb,hfzero,hftop⟩:=HeisenbergStrip.bounded_strip_limit hβ + (show 0≤4*‖A‖*‖B‖ by positivity) hd (fun n=>⟨4*‖A‖*‖B‖,hb n⟩) + (fun n t=>hb n t (by constructor <;> simp [hβ.le])) + (fun n t=>hb n ((t:ℂ)+Complex.I*β) (by constructor <;> simp [hβ.le])) hf0 hf1 + refine ⟨f,?_,hfd.1,⟨4*‖A‖*‖B‖,fun z hz0 hz1=>hfb z ⟨hz0,hz1⟩⟩,hfzero,hftop⟩ + simpa only [HeisenbergStrip.closure_openStrip hβ, HeisenbergStrip.closedStrip, Set.preimage, Set.mem_Icc] using hfd.2 + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinBulk.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinBulk.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2c42aed13ad7d3530d23f0b481288e83c5d6d34 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinBulk.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinTranslations + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma translation_totalZ (x : Site d) (Γ : Finset (Site d)) : + translation d ℓ x (totalZ Γ)=totalZ (Γ.image (fun y=>x+y)) := by + simp only [totalZ,map_sum,translation_spinZ,Finset.sum_image (fun _ _ _ _ he=>add_left_cancel he)] + +lemma translation_evolve (x : Site d) (H : QuasiLocal d ℓ) (z : ℂ) (A : QuasiLocal d ℓ) : + translation d ℓ x (GibbsStrip.evolve H z A)=GibbsStrip.evolve (translation d ℓ x H) z (translation d ℓ x A) := by + have hmul (B C : QuasiLocal d ℓ) : + translation d ℓ x (B * C) = translation d ℓ x B * translation d ℓ x C := + (translation d ℓ x).map_mul' B C + have hsmul (scalar : ℂ) (B : QuasiLocal d ℓ) : + translation d ℓ x (scalar • B) = scalar • translation d ℓ x B := + (translation d ℓ x).toAlgHom.toLinearMap.map_smul scalar B + simp only [GibbsStrip.evolve, hmul, translation_exp, hsmul] + +lemma translation_fieldDynamics (x : Site d) (Γ : Finset (Site d)) (h t : ℝ) (A : QuasiLocal d ℓ) : + translation d ℓ x (GibbsStrip.evolve (shiftedField Γ h) t A)= + GibbsStrip.evolve (shiftedField (Γ.image (fun y=>x+y)) h) t (translation d ℓ x A) := by + simp only [shiftedField_evolve,translation_finiteDynamics,translation_evolve,translation_totalZ] + +lemma translated_volume_cancel (x : Site d) (Λ : Finset (Site d)) : + (Λ.image (fun y=>-x+y)).image (fun y=>x+y)=Λ := by + rw [Finset.image_image] + simp only [Function.comp_def,←add_assoc,add_neg_cancel,zero_add] + exact Finset.image_id' + +lemma box_add_mem {N r : ℕ} {x y : Site d} (hx : x∈box d N) (hy : y∈box d r) : x+y∈box d (N+r) := by + apply (box_mem _ _ _).mpr + intro i + exact (abs_add_le (x i) (y i)).trans (by + simpa only [Nat.cast_add] using add_le_add ((box_mem _ _ _).mp hx i) ((box_mem _ _ _).mp hy i)) + +lemma box_deep_translate {N r : ℕ} (hr : r≤N) {x : Site d} (hx : x∈box d (N-r)) : + box d r⊆(box d N).image (fun y=>-x+y) := by + intro y hy + refine Finset.mem_image.mpr ⟨x+y,?_,by simp only [←add_assoc,neg_add_cancel,zero_add]⟩ + simpa only [Nat.sub_add_cancel hr] using box_add_mem hx hy + +lemma box_boundary_inner_tendsto (d r : ℕ) : + Tendsto (fun N : ℕ=>((box d N\box d (N-r)).card:ℝ)/((box d N).card:ℝ)) atTop (𝓝 0) := by + have hn : Tendsto (fun N : ℕ=>N-r) atTop atTop := by + refine tendsto_atTop.2 (fun b=>?_) + filter_upwards [eventually_ge_atTop (b+r)] with N hN + omega + apply ((box_boundary_ratio_tendsto d r).comp hn).congr' + filter_upwards [eventually_ge_atTop r] with N hN + change ((box d (N-r+r)\box d (N-r)).card:ℝ)/((box d (N-r+r)).card:ℝ)=_ + rw [Nat.sub_add_cancel hN] + +lemma image_sdiff_card_le (Λ F : Finset (Site d)) (x : Site d) + (_hF : F⊆Λ) (hshift : ∀ y∈F,x+y∈Λ) : + ((Λ.image (fun y=>x+y))\Λ).card≤(Λ\F).card := by + apply le_trans (Finset.card_le_card (show (Λ.image (fun y=>x+y))\Λ⊆(Λ\F).image (fun y=>x+y) from ?_)) Finset.card_image_le + intro z hz + obtain ⟨hz,hzout⟩:=Finset.mem_sdiff.mp hz + obtain ⟨y,hy,rfl⟩:=Finset.mem_image.mp hz + exact Finset.mem_image.mpr ⟨y,Finset.mem_sdiff.mpr ⟨hy,fun hyF=>hzout (hshift y hyF)⟩,rfl⟩ + +lemma sdiff_image_card (Λ : Finset (Site d)) (x : Site d) : + (Λ\Λ.image (fun y=>x+y)).card=(Λ.image (fun y=>x+y)\Λ).card := by + rw [Finset.card_sdiff,Finset.card_sdiff,Finset.card_image_of_injective _ (add_right_injective x),Finset.inter_comm] + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinCubeAverage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinCubeAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d93827530ee260b9b7340868fb704d525902768 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinCubeAverage.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.Heisenberg.FiniteAverage + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma cube_card_pos (d N : ℕ) : (0:ℝ)<(box d N).card := by + classical + exact_mod_cast Finset.card_pos.mpr (box_nonempty d N) + +def cubeAverage (Λ : Finset (Site d)) (hΛ : Λ.Nonempty) (ω : State d ℓ) : State d ℓ := + averageState (fun _ : Λ=>(Λ.card:ℝ)⁻¹) (fun _=>by positivity) + (by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_coe,nsmul_eq_mul]; exact mul_inv_cancel₀ (show (Λ.card:ℝ)≠0 by exact_mod_cast Finset.card_ne_zero.mpr hΛ)) + (fun x=>translatedState ω x.val) + +lemma cubeAverage_apply (Λ : Finset (Site d)) (hΛ : Λ.Nonempty) (ω : State d ℓ) (A : QuasiLocal d ℓ) : + (cubeAverage Λ hΛ ω).functional A=(Λ.card:ℂ)⁻¹*∑ x∈Λ,ω.functional (translation d ℓ x A) := by + classical + simp only [cubeAverage,averageState_apply,translatedState,ContinuousLinearMap.comp_apply,translationLinear_apply] + rw [←Finset.mul_sum] + have hs : (∑ i : Λ,ω.functional (translation d ℓ i.val A))=∑ x∈Λ,ω.functional (translation d ℓ x A) := Finset.sum_coe_sort Λ (fun x=>ω.functional (translation d ℓ x A)) + rw [hs] + simp only [Complex.ofReal_inv,Complex.ofReal_natCast] + +lemma cubeAverage_spinZ (Λ : Finset (Site d)) (hΛ : Λ.Nonempty) (ω : State d ℓ) : + (cubeAverage Λ hΛ ω).functional (spinZ d ℓ 0)=(Λ.card:ℂ)⁻¹*ω.functional (totalZ Λ) := by + classical + rw [cubeAverage_apply] + simp only [translation_spinZ,add_zero,totalZ,map_sum] + +lemma state_selfAdjoint_im (ω : State d ℓ) {A : QuasiLocal d ℓ} (hA : IsSelfAdjoint A) : + (ω.functional A).im=0 := by + classical + have h1:=(ω.positive (A+1)).1 + have h2:=(ω.positive A).1 + simp only [star_add,hA.star_eq,star_one,add_mul,mul_add,mul_one,one_mul,map_add,Complex.add_im,ω.normalized,Complex.one_im] at h1 h2 + linarith + +lemma cubeAverage_translation_bound (N r : ℕ) (hr : r≤N) (x : Site d) (hx : x∈box d r) + (ω : State d ℓ) (A : QuasiLocal d ℓ) : + ‖(cubeAverage (box d N) (box_nonempty d N) ω).functional (translation d ℓ x A)- + (cubeAverage (box d N) (box_nonempty d N) ω).functional A‖≤ + (((box d N\box d (N-r)).card:ℝ)/(box d N).card)*(8*‖A‖) := by + classical + let Λ:=box d N + let F:=box d (N-r) + have hF : F⊆Λ:=box_mono (Nat.sub_le N r) + have hshift : ∀ y∈F,x+y∈Λ := by + classical + intro y hy + simpa only [Nat.sub_add_cancel hr,add_comm x] using box_add_mem hy hx + have hbound:=image_sdiff_card_le Λ F x hF hshift + rw [cubeAverage_apply,cubeAverage_apply,←mul_sub,norm_mul,norm_inv,Complex.norm_natCast] + have he : (∑ y∈Λ,ω.functional (translation d ℓ y (translation d ℓ x A)))= + ∑ y∈Λ.image (fun y=>x+y),ω.functional (translation d ℓ y A) := by + classical + rw [Finset.sum_image (fun _ _ _ _ he=>add_left_cancel he)] + apply Finset.sum_congr rfl + intro y hy + rw [translation_add,add_comm] + rw [he] + have hs:=(Average.norm_sum_sub_le (Λ.image (fun y=>x+y)) Λ + (fun y=>ω.functional (translation d ℓ y A)) (4*‖A‖) (fun y=>by simpa only [norm_translation] using state_apply_norm_le ω (translation d ℓ y A))) + have hecard : (((Λ\Λ.image (fun y=>x+y)).card:ℕ):ℝ)=(((Λ.image (fun y=>x+y)\Λ).card:ℕ):ℝ) := by exact_mod_cast sdiff_image_card Λ x + rw [hecard] at hs + have hb : ((Λ.image (fun y=>x+y)\Λ).card:ℝ)≤(Λ\F).card := by exact_mod_cast hbound + have hp : (0:ℝ)<Λ.card:=cube_card_pos d N + calc _ ≤ (Λ.card:ℝ)⁻¹*((((Λ.image (fun y=>x+y)\Λ).card:ℝ)+((Λ.image (fun y=>x+y)\Λ).card:ℝ))*(4*‖A‖)) := mul_le_mul_of_nonneg_left hs (inv_nonneg.mpr hp.le) + _ ≤ (Λ.card:ℝ)⁻¹*(((Λ\F).card+(Λ\F).card:ℝ)*(4*‖A‖)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right (add_le_add hb hb) (by positivity)) (inv_nonneg.mpr hp.le) + _ = _ := by dsimp [Λ,F]; ring + +lemma cubeAverage_limit_TI (N : ℕ → ℕ) (hN : Tendsto N atTop atTop) (η : ℕ → State d ℓ) + (ω : State d ℓ) (hω : ∀ A,Tendsto (fun n=>(cubeAverage (box d (N n)) (box_nonempty d (N n)) (η n)).functional A) atTop (𝓝 (ω.functional A))) : TranslationInvariant ω := by + classical + intro x A + obtain ⟨r,hr⟩:=(eventually_mem_box x).exists + have hlim : Tendsto (fun n=>(cubeAverage (box d (N n)) (box_nonempty d (N n)) (η n)).functional (translation d ℓ x A)- + (cubeAverage (box d (N n)) (box_nonempty d (N n)) (η n)).functional A) atTop (𝓝 0) := by + classical + apply squeeze_zero_norm' (a:=fun n=>(((box d (N n)\box d (N n-r)).card:ℝ)/(box d (N n)).card)*(8*‖A‖)) + · filter_upwards [hN.eventually (eventually_ge_atTop r)] with n hn + exact cubeAverage_translation_bound (N n) r hn x hr (η n) A + · simpa only [Function.comp_def,zero_mul] using ((box_boundary_inner_tendsto d r).comp hN).mul_const (8*‖A‖) + exact sub_eq_zero.mp (tendsto_nhds_unique ((hω _).sub (hω A)) hlim) + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinDeep.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinDeep.lean new file mode 100644 index 0000000000000000000000000000000000000000..08b24ef36a13469bebce845651783d67e391cddd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinDeep.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinExhaustion + +namespace OAI + +section +noncomputable section +open scoped Classical +open Filter Topology +namespace Heisenberg + +lemma dynamics_exhausting_locallyUniform (d ℓ : ℕ) (Γ : ℕ → Finset (Site d)) + (hΓ : ∀ F : Finset (Site d),∀ᶠ n : ℕ in atTop,F⊆Γ n) (A : QuasiLocal d ℓ) : + TendstoLocallyUniformly (fun n t=>finiteDynamics d ℓ (Γ n) t A) + (fun t=>dynamics d ℓ t A) atTop := by + apply EquicontinuousLimits.locallyUniform + · intro t + exact (finiteDynamics_equicontinuous d ℓ A t).comp Γ + · intro t + exact dynamics_tendsto_exhausting d ℓ Γ hΓ t A + +theorem finiteDynamics_deep_uniform (d ℓ : ℕ) (A : QuasiLocal d ℓ) + (K : Set ℝ) (hK : IsCompact K) {ε : ℝ} (hε : 0<ε) : + ∃ r : ℕ,∀ Γ : Finset (Site d),box d r⊆Γ → + ∀ t∈K,dist (finiteDynamics d ℓ Γ t A) (dynamics d ℓ t A)<ε := by + by_contra! hn + choose Γ hΓ t ht he using hn + have hex : ∀ F : Finset (Site d),∀ᶠ n : ℕ in atTop,F⊆Γ n := by + intro F + filter_upwards [eventually_subset_box F] with n hn + exact hn.trans (hΓ n) + have hu := (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK).mp + ((dynamics_exhausting_locallyUniform d ℓ Γ hex A).tendstoLocallyUniformlyOn) + have hh := (Metric.tendstoUniformlyOn_iff.mp hu) ε hε + obtain ⟨n,hn⟩:=hh.exists + have hh':=hn (t n) (ht n) + rw [dist_comm] at hh' + exact (not_lt_of_ge (he n)) hh' + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinDirected.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinDirected.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a69c94036e5b3033ab7dea91484de43b53a2696 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinDirected.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.Heisenberg.PhysicalClock + +namespace OAI + +section +attribute [instance] instDecidableEqFin instDecidableEqProd +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg +open SlotTensor + +lemma directed_sum {X E : Type*} [Fintype X] [AddCommMonoid E] + (R r : X → X → Prop) (hR : ∀ x y,R x y → R y x) (hne : ∀ x y,R x y → x≠y) + (hr : ∀ x y,x≠y → r x y ∨ r y x) (ha : ∀ x y,r x y → ¬r y x) + (f : X → X → E) (hf : ∀ x y,R x y → f x y=f y x) : + (∑ e : X×X,if R e.1 e.2 then f e.1 e.2 else 0)= + 2 • (∑ e : X×X,if R e.1 e.2 ∧ r e.1 e.2 then f e.1 e.2 else 0) := by + let g : X×X → E:=fun e=>if R e.1 e.2 ∧ r e.1 e.2 then f e.1 e.2 else 0 + have h (e : X×X) : (if R e.1 e.2 then f e.1 e.2 else 0)=g e+g e.swap := by + dsimp only [g] + by_cases hh : R e.1 e.2 + · rw [ite_eq_left hh] + by_cases he : r e.1 e.2 + · rw [ite_eq_left ⟨hh,he⟩,ite_eq_right (fun h=>ha _ _ he h.2),add_zero] + · have he' : r e.2 e.1:=(hr _ _ (hne _ _ hh)).resolve_left he + rw [ite_eq_right (fun h=>he h.2),ite_eq_left ⟨hR _ _ hh,he'⟩,zero_add,hf _ _ hh] + rfl + · have hh' : ¬R e.2 e.1:=fun h=>hh (hR _ _ h) + rw [ite_eq_right hh,ite_eq_right (fun h=>hh h.1),ite_eq_right (fun h=>hh' h.1),add_zero] + simp_rw [h] + rw [Finset.sum_add_distrib] + change (∑ e,g e)+(∑ e,g ((Equiv.prodComm X X) e))=2 • ∑ e,g e + rw [(Equiv.prodComm X X).sum_comp,two_smul] + +lemma bond_symm {d ℓ : ℕ} {x y : Site d} (hxy : x≠y) : bond d ℓ x y=bond d ℓ y x := by + have hX:=singleton_local_commute hxy (spinX_mem_localAlgebra d ℓ {x} (Set.mem_singleton x)) + (spinX_mem_localAlgebra d ℓ {y} (Set.mem_singleton y)) + have hY:=singleton_local_commute hxy (spinY_mem_localAlgebra d ℓ {x} (Set.mem_singleton x)) + (spinY_mem_localAlgebra d ℓ {y} (Set.mem_singleton y)) + have hZ:=singleton_local_commute hxy (spinZ_mem_localAlgebra d ℓ {x} (Set.mem_singleton x)) + (spinZ_mem_localAlgebra d ℓ {y} (Set.mem_singleton y)) + simp only [bond,hX.eq,hY.eq,hZ.eq] + +lemma sum_siteEdges {X : Type} {E : Type*} [Fintype X] [AddCommMonoid E] + (R : X → X → Prop) (f : X → X → E) : + (∑ e : SiteEdges R,f e.val.1 e.val.2)=∑ e : X×X,if R e.1 e.2 then f e.1 e.2 else 0 := by + rw [←Finset.sum_subtype (Finset.univ.filter (fun e : X×X=>R e.1 e.2)) (by simp) (fun e=>f e.1 e.2)] + simp only [Finset.sum_filter] + +lemma sum_volumeEdges {d ℓ : ℕ} (Λ : Finset (Site d)) : + (∑ e : Λ×Λ,if NearestNeighbor e.1.val e.2.val ∧ WellOrderingRel e.1.val e.2.val + then bond d ℓ e.1.val e.2.val else 0)= -hamiltonian d ℓ Λ := by + rw [hamiltonian,neg_neg,volumeEdges,Finset.sum_filter,Finset.sum_product,Fintype.sum_prod_type] + rw [←Finset.sum_coe_sort Λ] + apply Finset.sum_congr rfl + intro x _ + exact Finset.sum_coe_sort Λ (fun y=>if NearestNeighbor x.val y ∧ WellOrderingRel x.val y then bond d ℓ x.val y else 0) + +lemma directed_bond_sum {d ℓ : ℕ} (Λ : Finset (Site d)) : + (∑ e : SiteEdges (fun x y : Λ=>NearestNeighbor x.val y.val),bond d ℓ e.val.1.val e.val.2.val)= + 2 • (-hamiltonian d ℓ Λ) := by + rw [sum_siteEdges (fun x y : Λ=>NearestNeighbor x.val y.val) (fun x y : Λ=>bond d ℓ x.val y.val)] + have hh:=directed_sum (fun x y : Λ=>NearestNeighbor x.val y.val) (fun x y : Λ=>WellOrderingRel x.val y.val) + (fun _ _ h=>nearestNeighbor_symm h) + (fun x y h he=>nearestNeighbor_ne h (congrArg Subtype.val he)) + (fun x y h=>by + rcases trichotomous_of WellOrderingRel x.val y.val with hxy | hxy | hxy + · exact Or.inl hxy + · exact False.elim (h (Subtype.ext hxy)) + · exact Or.inr hxy) + (fun x y h=>asymm h) + (fun x y : Λ=>bond d ℓ x.val y.val) (fun x y h=>bond_symm (nearestNeighbor_ne h)) + rw [sum_volumeEdges] at hh + exact hh + +lemma finiteRepresentation_generator {d ℓ : ℕ} (Λ : Finset (Site d)) : + finiteRepresentation (ℓ:=ℓ) (fun x : Λ=>x.val) Subtype.val_injective + (spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ)= + (-2:ℝ) • hamiltonian d ℓ Λ- + ((Fintype.card (SiteEdges (fun x y : Λ=>NearestNeighbor x.val y.val)):ℝ)*(ℓ:ℝ)^2/4) • 1 := by + simp only [spinGenerator,map_sum,map_sub,finiteRepresentation_bond, + Finset.sum_sub_distrib,Finset.sum_const,Finset.card_univ,directed_bond_sum] + rw [←Nat.cast_smul_eq_nsmul ℝ,←Nat.cast_smul_eq_nsmul ℝ,smul_smul] + rw [map_smul, map_one] + norm_num + module + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinExhaustion.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinExhaustion.lean new file mode 100644 index 0000000000000000000000000000000000000000..576f81c431c99344ba44ec434f54c6d633bf2e84 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinExhaustion.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinAverage + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators +open Filter Topology +namespace Heisenberg +lemma local_coefficients_stabilize_exhausting {d ℓ : ℕ} (Γ : ℕ → Finset (Site d)) + (hΓ : ∀ F : Finset (Site d),∀ᶠ n : ℕ in atTop,F⊆Γ n) + (F : Finset (Site d)) {A : QuasiLocal d ℓ} + (hA : A∈localAlgebra d ℓ (F : Set (Site d))) (n : ℕ) : + ∃ B : QuasiLocal d ℓ,∀ᶠ m : ℕ in atTop,((finiteGenerator d ℓ (Γ m))^n) A=B := by + let : Monoid (QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ):=inferInstance + have hh : ∀ n : ℕ,∃ (G : Finset (Site d)) (B : QuasiLocal d ℓ), + B∈localAlgebra d ℓ (G : Set (Site d)) ∧ + ∀ᶠ m : ℕ in atTop,((finiteGenerator d ℓ (Γ m))^n) A=B := by + intro n + induction n with + | zero=>exact ⟨F,A,hA,by simp⟩ + | succ n ih=> + obtain ⟨G,B,hB,hlim⟩:=ih + refine ⟨G∪neighborhood G,finiteGenerator d ℓ (neighborhood G) B, + finiteGenerator_local _ G hB,?_⟩ + filter_upwards [hlim,hΓ (neighborhood G)] with m hm hmG + rw [pow_succ',mul_apply_eq_comp,hm] + exact finiteGenerator_stable _ G hmG hB + obtain ⟨G,B,hB,hlim⟩:=hh n + exact ⟨B,hlim⟩ + +private theorem clm_topologicalRing' {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] : + IsTopologicalRing (E →L[ℂ] E):=inferInstance +local instance (d ℓ : ℕ) : IsTopologicalRing (QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ):=clm_topologicalRing' + +theorem dynamics_exhausting_exists (d ℓ : ℕ) (Γ : ℕ → Finset (Site d)) + (hΓ : ∀ F : Finset (Site d),∀ᶠ n : ℕ in Filter.atTop,F⊆Γ n) : + ∀ t : ℝ,∀ A : QuasiLocal d ℓ,∃ B,Filter.Tendsto (fun n=>finiteDynamics d ℓ (Γ n) t A) Filter.atTop (nhds B) := by + let C : ℝ := 8*d*bondBound d ℓ + have hC : 0 ≤ C := (finiteGenerator_localDecomposition d ℓ (Γ 0)).nonneg + let δ : ℝ := 1/(C+1) + have hδ : 0 < δ := one_div_pos.mpr (by linarith) + have hs : ∀ t : ℝ, |t| < δ → ∀ A : QuasiLocal d ℓ, ∃ B, + Filter.Tendsto (fun n => finiteDynamics d ℓ (Γ n) t A) Filter.atTop (nhds B) := by + intro t ht + apply IsometricLimits.limit_on_dense (fun n => finiteDynamics d ℓ (Γ n) t) + (fun n => finiteDynamics_isometry _ _ _ _) (localCore d ℓ) (localCore_dense d ℓ) + intro A hA + obtain ⟨F,hF⟩ := localCore_finite_support hA + have hz : ‖(t : ℂ)‖*C < 1 := by + rw [Complex.norm_real, Real.norm_eq_abs] + have h := (lt_div_iff₀ (by linarith : 0 < C+1)).mp ht + nlinarith [abs_nonneg t] + have hh := SpinEvolution.local_exponential_converges + (fun n => finiteGenerator d ℓ (Γ n)) (SupportedOnAtMost d ℓ) C + (fun n => finiteGenerator_localDecomposition d ℓ (Γ n)) F.card A + ⟨F,Nat.le_succ _,hF⟩ (t : ℂ) hz (local_coefficients_stabilize_exhausting Γ hΓ F hF) + simpa only [← finiteDynamics_generator] using hh + have hall := IsometricLimits.all_times (fun n => finiteDynamics d ℓ (Γ n)) + (fun n t => finiteDynamics_isometry _ _ _ _) + (fun n A => finiteDynamics_zero _ _ _ _) + (fun n s t A => finiteDynamics_group _ _ _ _ _ _) δ hδ hs + exact hall + +theorem dynamics_tendsto_exhausting (d ℓ : ℕ) (Γ : ℕ → Finset (Site d)) + (hΓ : ∀ F : Finset (Site d),∀ᶠ n : ℕ in atTop,F⊆Γ n) (t : ℝ) (A : QuasiLocal d ℓ) : + Tendsto (fun n=>finiteDynamics d ℓ (Γ n) t A) atTop (𝓝 (dynamics d ℓ t A)) := by + let Δ : ℕ → Finset (Site d):=fun n=>if n%2=0 then box d (n/2) else Γ (n/2) + have hΔ : ∀ F : Finset (Site d),∀ᶠ n : ℕ in atTop,F⊆Δ n := by + intro F + obtain ⟨N,hN⟩:=eventually_atTop.mp (hΓ F) + obtain ⟨M,hM⟩:=eventually_atTop.mp (eventually_subset_box F) + apply eventually_atTop.mpr + refine ⟨2*(max N M)+2,?_⟩ + intro n hn + have hN' : N≤n/2:=by omega + have hM' : M≤n/2:=by omega + dsimp only [Δ] + split_ifs + · exact hM _ hM' + · exact hN _ hN' + obtain ⟨B,hB⟩:=dynamics_exhausting_exists d ℓ Δ hΔ t A + have heven : Tendsto (fun n : ℕ=>2*n) atTop atTop := tendsto_atTop_mono (fun n=>by change n≤_; omega) tendsto_id + have hodd : Tendsto (fun n : ℕ=>2*n+1) atTop atTop := tendsto_atTop_mono (fun n=>by change n≤_; omega) tendsto_id + have he : Tendsto (fun n=>finiteDynamics d ℓ (box d n) t A) atTop (𝓝 B) := by + convert hB.comp heven using 1 + funext n + simp [Δ] + have ho : Tendsto (fun n=>finiteDynamics d ℓ (Γ n) t A) atTop (𝓝 B) := by + convert hB.comp hodd using 1 + funext n + simp [Δ,Nat.add_div] + have hb : B=dynamics d ℓ t A:=tendsto_nhds_unique he (dynamics_converges d ℓ t A) + rwa [hb] at ho + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinField.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinField.lean new file mode 100644 index 0000000000000000000000000000000000000000..c76da2cfd2d1f6cf87d1aece7c37ebdc5d6e55bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinField.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.Heisenberg.MatrixWeights + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg +open SlotTensor TensorMatrix +variable {d ℓ : ℕ} + +def totalZ (Λ : Finset (Site d)) : QuasiLocal d ℓ:=∑ x∈Λ,spinZ d ℓ x + +lemma totalZ_selfAdjoint (Λ : Finset (Site d)) : IsSelfAdjoint (totalZ (ℓ:=ℓ) Λ) := by + change star (totalZ Λ)=totalZ Λ + simp only [totalZ,star_sum,star_spinZ] + +lemma finiteRepresentation_totalZ (Λ : Finset (Site d)) : + finiteRepresentation (ℓ:=ℓ) (fun x : Λ=>x.val) Subtype.val_injective + (Matrix.diagonal (physicalMagnetization (X:=Λ) ℓ))=totalZ Λ := by + have he : Matrix.diagonal (physicalMagnetization (X:=Λ) ℓ)= + ∑ x : Λ,onsite x (SpinSlots.physicalZ ℓ) := by + simp only [SpinSlots.physicalZ,local_diagonal,diagonal_fintype_sum] + rfl + rw [he,map_sum] + simp only [finiteRepresentation_z,totalZ] + exact Finset.sum_coe_sort Λ _ + +def shiftedField (Λ : Finset (Site d)) (h : ℝ) : QuasiLocal d ℓ:= + hamiltonian d ℓ Λ+ + (((Fintype.card (SiteEdges (fun x y : Λ=>NearestNeighbor x.val y.val)):ℝ)*(ℓ:ℝ)^2/8)) • 1- + h • totalZ (ℓ:=ℓ) Λ + +lemma shiftedField_selfAdjoint (Λ : Finset (Site d)) (h : ℝ) : + IsSelfAdjoint (shiftedField (ℓ:=ℓ) Λ h) := by + change star (shiftedField Λ h)=shiftedField Λ h + simp only [shiftedField,star_sub,star_add,star_smul,star_trivial,star_one, + (hamiltonian_selfAdjoint d ℓ Λ).star_eq,(totalZ_selfAdjoint (ℓ:=ℓ) Λ).star_eq] + +lemma finiteRepresentation_field (Λ : Finset (Site d)) (h : ℝ) : + finiteRepresentation (ℓ:=ℓ) (fun x : Λ=>x.val) Subtype.val_injective + ((-1/2:ℝ) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ- + h • Matrix.diagonal (physicalMagnetization (X:=Λ) ℓ))=shiftedField Λ h := by + rw [map_sub,map_smul,map_smul,finiteRepresentation_generator,finiteRepresentation_totalZ,shiftedField] + module + +lemma field_commute (Λ : Finset (Site d)) : Commute (hamiltonian d ℓ Λ) (totalZ Λ) := by + have hh:=(spinGenerator_mag (fun x y : Λ=>NearestNeighbor x.val y.val) + (fun x y h he=>nearestNeighbor_ne h (congrArg Subtype.val he)) ℓ).map + (finiteRepresentation (ℓ:=ℓ) (fun x : Λ=>x.val) Subtype.val_injective) + rw [finiteRepresentation_generator,finiteRepresentation_totalZ] at hh + change ((-2:ℝ) • hamiltonian d ℓ Λ-_) * totalZ Λ=totalZ Λ*((-2:ℝ) • hamiltonian d ℓ Λ-_) at hh + simp only [sub_mul,mul_sub,smul_mul_assoc,mul_smul_comm,one_mul,mul_one] at hh + have he : (-2:ℝ) • (hamiltonian d ℓ Λ*totalZ Λ)=(-2:ℝ) • (totalZ Λ*hamiltonian d ℓ Λ):=sub_left_injective hh + have he':=congrArg (fun A : QuasiLocal d ℓ=>(-1/2:ℝ) • A) he + norm_num only [smul_smul,neg_div,neg_mul_neg,div_mul_cancel₀ _ (by norm_num : (2:ℝ)≠0),one_smul] at he' + exact he' + +lemma shiftedField_gibbs_totalZ (Λ : Finset (Site d)) (τ : State d ℓ) + (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) (β h : ℝ) : + ((gibbsState τ (shiftedField Λ h) β).functional (totalZ Λ)).re= + (∑ k : Λ → SpinSlots.Level ℓ, + NormedSpace.exp ((β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ) k k * + Real.exp ((β*h)*physicalMagnetization ℓ k)*physicalMagnetization ℓ k)/ + Selection.tiltPartition (fun k : Λ → SpinSlots.Level ℓ=> + NormedSpace.exp ((β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ) k k) + (physicalMagnetization ℓ) (β*h) := by + rw [←finiteRepresentation_field Λ h,←finiteRepresentation_totalZ Λ] + rw [finiteRepresentation_gibbs_re _ _ τ hτ _ _ (by rw [finiteRepresentation_field]; exact shiftedField_selfAdjoint Λ h)] + have he : (-β) • ((-1/2:ℝ) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ- + h • Matrix.diagonal (physicalMagnetization (X:=Λ) ℓ))= + (β/2) • spinGenerator (fun x y : Λ=>NearestNeighbor x.val y.val) ℓ+ + (β*h) • Matrix.diagonal (physicalMagnetization (X:=Λ) ℓ) := by module + rw [he] + have hc:=(spinGenerator_mag (fun x y : Λ=>NearestNeighbor x.val y.val) + (fun x y h he=>nearestNeighbor_ne h (congrArg Subtype.val he)) ℓ).smul_left (β/2) + rw [Selection.trace_exp_tilt _ _ _ hc,Selection.trace_exp_tilt_mag _ _ _ hc] + +lemma nearestNeighbor_iff_step {x y : Site d} : NearestNeighbor x y ↔ Geometry.Step x y := by + constructor + · intro h + obtain ⟨i,hi,hj⟩:=nearestNeighbor_coordinate h + exact ⟨i,by omega,hj⟩ + · rintro ⟨i,hi,hj⟩ + change ∑ j : Fin d,|x j-y j|=(1:ℤ) + rw [Finset.sum_eq_single i] + · rcases hi with hi | hi <;> rw [hi] <;> simp + · intro j _ hji + rw [hj j hji,sub_self,abs_zero] + · exact fun h=>False.elim (h (Finset.mem_univ i)) + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldDynamics.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldDynamics.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9c3ba9390092825b7cd176c1bd8c5e029fffe53 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldDynamics.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinDeep + +namespace OAI + +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace GibbsStrip +variable {E : Type*} [CStarAlgebra E] +local instance : NormedAlgebra ℚ E:=NormedAlgebra.restrictScalars ℚ ℂ E + +lemma evolve_hamiltonian_add (H K : E) (hHK : Commute H K) (z : ℂ) (A : E) : + evolve (H+K) z A=evolve H z (evolve K z A) := by + unfold evolve + rw [smul_add,NormedSpace.exp_add_of_commute ((hHK.smul_left _).smul_right _)] + have he : (-(Complex.I*z)) • (H+K)=(-(Complex.I*z)) • K+(-(Complex.I*z)) • H:=by module + rw [he,NormedSpace.exp_add_of_commute ((hHK.symm.smul_left _).smul_right _)] + simp only [mul_assoc] + +lemma evolve_of_commute (K A : E) (hKA : Commute K A) (z : ℂ) : evolve K z A=A := by + rw [evolve,((hKA.smul_left (Complex.I*z)).exp_left).eq,mul_assoc,exp_cancel_left,mul_one] + +lemma evolve_smul_real (K A : E) (h : ℝ) (z : ℂ) : + evolve (h • K) z A=evolve K ((h:ℂ)*z) A := by + rw [←IsScalarTower.algebraMap_smul ℂ h K] + simp only [evolve,smul_smul,Complex.coe_algebraMap] + congr 2 <;> congr 1 <;> ring_nf + +lemma evolve_sub (K A B : E) (z : ℂ) : evolve K z (A-B)=evolve K z A-evolve K z B := by + simp only [evolve,mul_sub,sub_mul] + +lemma real_evolve_dist (K : E) (hK : IsSelfAdjoint K) (t : ℝ) (A B : E) : + dist (evolve K t A) (evolve K t B)=dist A B := by + rw [dist_eq_norm,←evolve_sub,real_evolve_norm hK,dist_eq_norm] + +end GibbsStrip +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma totalZ_mem_localAlgebra (F : Finset (Site d)) : + totalZ (ℓ:=ℓ) F∈localAlgebra d ℓ (F : Set (Site d)) := by + apply (localAlgebra d ℓ (F : Set (Site d))).sum_mem + intro x hx + exact spinZ_mem_localAlgebra d ℓ _ hx + +lemma totalZ_commute (F G : Finset (Site d)) : Commute (totalZ (ℓ:=ℓ) F) (totalZ G) := by + apply Commute.sum_left + intro x hx + apply Commute.sum_right + intro y hy + by_cases hxy : x=y + · subst y + exact Commute.refl _ + · exact singleton_local_commute hxy (spinZ_mem_localAlgebra d ℓ {x} rfl) + (spinZ_mem_localAlgebra d ℓ {y} rfl) + +lemma totalZ_split {F Γ : Finset (Site d)} (hF : F⊆Γ) : + totalZ (ℓ:=ℓ) Γ=totalZ F+totalZ (Γ\F) := by + unfold totalZ + exact (Finset.sum_sdiff hF).symm.trans (add_comm _ _) + +lemma local_field_evolve {F Γ : Finset (Site d)} (hF : F⊆Γ) {A : QuasiLocal d ℓ} + (hA : A∈localAlgebra d ℓ (F : Set (Site d))) (z : ℂ) : + GibbsStrip.evolve (totalZ Γ) z A=GibbsStrip.evolve (totalZ F) z A := by + rw [totalZ_split hF,GibbsStrip.evolve_hamiltonian_add _ _ (totalZ_commute F (Γ\F))] + rw [GibbsStrip.evolve_of_commute _ _ (localAlgebras_commute _ (totalZ_mem_localAlgebra (Γ\F)) hA)] + exact Set.disjoint_left.mpr (fun _ hx hy=>(Finset.mem_sdiff.mp hx).2 hy) + +lemma shiftedField_evolve (Γ : Finset (Site d)) (h t : ℝ) (A : QuasiLocal d ℓ) : + GibbsStrip.evolve (shiftedField Γ h) t A= + finiteDynamics d ℓ Γ t (GibbsStrip.evolve (totalZ Γ) ((-h*t:ℝ):ℂ) A) := by + let c : ℝ:=(Fintype.card (SlotTensor.SiteEdges (fun x y : Γ=>NearestNeighbor x.val y.val)):ℝ)*(ℓ:ℝ)^2/8 + have hc : Commute (hamiltonian d ℓ Γ+c • (1:QuasiLocal d ℓ)) (h • totalZ (ℓ:=ℓ) Γ) := + ((field_commute (ℓ:=ℓ) Γ).smul_right h).add_left ((Commute.one_left (h • totalZ (ℓ:=ℓ) Γ)).smul_left c) + change GibbsStrip.evolve (hamiltonian d ℓ Γ+c • (1:QuasiLocal d ℓ)-h • totalZ (ℓ:=ℓ) Γ) t A=_ + rw [sub_eq_add_neg,GibbsStrip.evolve_hamiltonian_add _ _ hc.neg_right] + rw [GibbsStrip.evolve_hamiltonian_add _ _ ((Commute.one_right _).smul_right c)] + rw [GibbsStrip.evolve_of_commute (c • (1:QuasiLocal d ℓ)) _ ((Commute.one_left _).smul_left c)] + rw [←neg_smul,GibbsStrip.evolve_smul_real] + simp only [Complex.ofReal_mul,Complex.ofReal_neg] + rfl + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldUniform.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldUniform.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae7a1bab9a135c18cbf942285d21fe38a688581 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinFieldUniform.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinCubeAverage + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +open Filter Topology +namespace Heisenberg +lemma metric_triangle5 {E : Type*} [PseudoMetricSpace E] (a b c d e : E) : + dist a e≤dist a b+dist b c+dist c d+dist d e := + (dist_triangle a d e).trans (add_le_add (dist_triangle4 a b c d) le_rfl) +variable {d ℓ : ℕ} + +lemma field_local_small (F : Finset (Site d)) (B : QuasiLocal d ℓ) + (hB : B∈localAlgebra d ℓ (F : Set (Site d))) (K : Set ℝ) (hK : IsCompact K) + {ε : ℝ} (hε : 0<ε) : ∃ δ : ℝ,0<δ ∧ ∀ Γ : Finset (Site d),F⊆Γ → + ∀ h : ℝ,|h|<δ → ∀ t∈K, + dist (GibbsStrip.evolve (shiftedField Γ h) t B) (finiteDynamics d ℓ Γ t B)<ε := by + have hc : ContinuousAt (fun s : ℝ=>GibbsStrip.evolve (totalZ (ℓ:=ℓ) F) (s:ℂ) B) 0 := + (GibbsStrip.evolve_differentiable _ _).continuous.continuousAt.comp Complex.continuous_ofReal.continuousAt + obtain ⟨η,hη,hsmall⟩:=Metric.continuousAt_iff.mp hc ε hε + obtain ⟨M,hM⟩:=hK.exists_bound_of_continuousOn continuous_id.continuousOn + refine ⟨η/(|M|+1),by positivity,?_⟩ + intro Γ hΓ h hh t ht + rw [shiftedField_evolve,local_field_evolve hΓ hB,(finiteDynamics_isometry d ℓ Γ t).dist_eq] + have htime : dist (-h*t) 0<η := by + rw [Real.dist_eq,sub_zero,abs_mul,abs_neg] + have htM : |t|≤|M|+1:=(hM t ht).trans ((le_abs_self M).trans (by linarith [abs_nonneg M])) + exact (mul_le_mul_of_nonneg_left htM (abs_nonneg h)).trans_lt ((lt_div_iff₀ (by positivity : 0 < |M|+1)).mp hh) + simpa only [Complex.ofReal_zero,GibbsStrip.evolve,mul_zero,neg_zero,zero_smul,NormedSpace.exp_zero,one_mul,mul_one] using hsmall htime + +theorem field_deep_uniform (A : QuasiLocal d ℓ) (K : Set ℝ) (hK : IsCompact K) + {ε : ℝ} (hε : 0<ε) : ∃ r : ℕ,∃ δ : ℝ,0<δ ∧ + ∀ Γ : Finset (Site d),box d r⊆Γ → ∀ h : ℝ,|h|<δ → ∀ t∈K, + dist (GibbsStrip.evolve (shiftedField Γ h) t A) (dynamics d ℓ t A)<ε := by + obtain ⟨B,hB,hAB⟩:=(localCore_dense d ℓ).exists_dist_lt A (show 0<ε/8 by positivity) + obtain ⟨F,hF⟩:=localCore_finite_support hB + obtain ⟨r₀,hr₀⟩:=(eventually_subset_box F).exists + obtain ⟨r₁,hr₁⟩:=finiteDynamics_deep_uniform d ℓ A K hK (show 0<ε/4 by positivity) + obtain ⟨δ,hδ,hfield⟩:=field_local_small F B hF K hK (show 0<ε/4 by positivity) + refine ⟨max r₀ r₁,δ,hδ,?_⟩ + intro Γ hΓ h hh t ht + have hFΓ : F⊆Γ :=hr₀.trans ((box_mono (le_max_left r₀ r₁)).trans hΓ) + have hdeep : box d r₁⊆Γ :=(box_mono (le_max_right r₀ r₁)).trans hΓ + calc _ ≤ dist (GibbsStrip.evolve (shiftedField Γ h) t A) (GibbsStrip.evolve (shiftedField Γ h) t B)+ + dist (GibbsStrip.evolve (shiftedField Γ h) t B) (finiteDynamics d ℓ Γ t B)+ + dist (finiteDynamics d ℓ Γ t B) (finiteDynamics d ℓ Γ t A)+ + dist (finiteDynamics d ℓ Γ t A) (dynamics d ℓ t A) := metric_triangle5 _ _ _ _ _ + _ = dist A B+dist (GibbsStrip.evolve (shiftedField Γ h) t B) (finiteDynamics d ℓ Γ t B)+dist B A+ + dist (finiteDynamics d ℓ Γ t A) (dynamics d ℓ t A) := by + rw [GibbsStrip.real_evolve_dist _ (shiftedField_selfAdjoint Γ h), (finiteDynamics_isometry d ℓ Γ t).dist_eq] + _ < ε := by have h1:=hfield Γ hFΓ h hh t ht; have h2:=hr₁ Γ hdeep t ht; rw [dist_comm B A]; linarith + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixConservation.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixConservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..441a81f64a15f8efd0a9947e2b389e8966e24e9a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixConservation.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.Heisenberg.PhysicalSpectral + +namespace OAI + +attribute [instance] instDecidableEqFin instDecidableEqProd +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg.TensorMatrix +variable {m n : Type} [Fintype m] [Fintype n] [DecidableEq m] [DecidableEq n] +omit [DecidableEq m] in +lemma compress_eq (A : Matrix m m ℝ) (B : Matrix n n ℝ) (V : Matrix m n ℝ) + (hV : V.transpose*V=1) (hAB : A*V=V*B) : V.transpose*A*V=B := by + rw [Matrix.mul_assoc,hAB,←Matrix.mul_assoc,hV,Matrix.one_mul] +omit [DecidableEq m] in +lemma compress_symmetric (A : Matrix m m ℝ) (B : Matrix n n ℝ) (V : Matrix m n ℝ) + (hV : V.transpose*V=1) (hAB : A*V=V*B) (hA : A.transpose=A) : B.transpose=B := by + rw [←compress_eq A B V hV hAB] + simp only [Matrix.transpose_mul,Matrix.transpose_transpose,hA,Matrix.mul_assoc] +omit [DecidableEq m] in +lemma compress_commute (A D : Matrix m m ℝ) (B E : Matrix n n ℝ) (V : Matrix m n ℝ) + (hV : V.transpose*V=1) (hAB : A*V=V*B) (hDE : D*V=V*E) (hAD : Commute A D) : Commute B E := by + have he:=congrArg (fun M : Matrix m m ℝ=>V.transpose*M*V) hAD.eq + simp only [Matrix.mul_assoc] at he + rw [hDE,hAB,←Matrix.mul_assoc A V E,hAB,←Matrix.mul_assoc D V B,hDE] at he + simp only [←Matrix.mul_assoc,hV,Matrix.one_mul] at he + exact he +end Heisenberg.TensorMatrix +namespace Heisenberg.SlotColor +variable {V : Type} [Fintype V] +lemma magnetization_permute (π : Equiv.Perm V) (c : V → Bool) : + magnetization (permute π c)=magnetization c := by + exact π.symm.sum_comp (fun v=>if c v then (1:ℝ)/2 else -1/2) +lemma matrix_mag_commute (π : Equiv.Perm V) : + Commute (matrix π) (Matrix.diagonal (magnetization (V:=V))) := by + ext a b + simp only [Matrix.mul_diagonal,Matrix.diagonal_mul,matrix] + split_ifs with h + · subst a + simp only [one_mul,mul_one,magnetization_permute] + · simp +lemma matrix_swap_transpose [DecidableEq V] (x y : V) : (matrix (Equiv.swap x y)).transpose=matrix (Equiv.swap x y) := by + ext a b + simp only [Matrix.transpose_apply,matrix] + congr 1 + have hi : Function.Involutive (permute (Equiv.swap x y)) := by + intro c + ext v + simp only [permute_apply,Equiv.symm_swap,Equiv.swap_apply_self] + exact propext ⟨fun h=>by rw [←h,hi],fun h=>by rw [←h,hi]⟩ +end Heisenberg.SlotColor +namespace Heisenberg.SlotTensor +open TensorMatrix SpinSlots +variable {X : Type} [Fintype X] [DecidableEq X] +lemma clockGenerator_transpose (R : X → X → Prop) (ℓ : ℕ) : + (clockGenerator R ℓ).transpose=clockGenerator R ℓ := by + simp only [clockGenerator,Matrix.transpose_sum,Matrix.transpose_smul,Matrix.transpose_sub, + SlotColor.matrix_swap_transpose,Matrix.transpose_one] +lemma clockGenerator_mag (R : X → X → Prop) (ℓ : ℕ) : + Commute (clockGenerator R ℓ) (Matrix.diagonal (SlotColor.magnetization (V:=X×Fin ℓ))) := by + change clockGenerator R ℓ * _ = _ * clockGenerator R ℓ + ext a b + simp only [Matrix.mul_diagonal,Matrix.diagonal_mul,clockGenerator,Matrix.sum_apply, + Matrix.smul_apply,Matrix.sub_apply,smul_eq_mul,Finset.sum_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro e _ + simp only [SlotColor.matrix,Matrix.one_apply] + split_ifs with h h' + · subst a + ring + · subst a + rw [SlotColor.magnetization_permute] + ring + · subst a + ring + · ring + +lemma spinGenerator_transpose (R : X → X → Prop) (hR : ∀ x y,R x y → x≠y) (ℓ : ℕ) : + (spinGenerator R ℓ).transpose=spinGenerator R ℓ := by + apply compress_symmetric _ _ (tensor (fun _ : X=>basis ℓ)) (basis_orthonormal ℓ) (generator_intertwines R hR ℓ) + change Matrix.reindex _ _ ((clockGenerator R ℓ).transpose)=_ + rw [clockGenerator_transpose] +lemma spinGenerator_mag (R : X → X → Prop) (hR : ∀ x y,R x y → x≠y) (ℓ : ℕ) : + Commute (spinGenerator R ℓ) (Matrix.diagonal (physicalMagnetization (X:=X) ℓ)) := by + apply compress_commute _ (Matrix.diagonal (configMagnetization (X:=X) ℓ)) _ _ + (tensor (fun _ : X=>basis ℓ)) (basis_orthonormal ℓ) (generator_intertwines R hR ℓ) (total_diagonal_intertwines ℓ) + have hh:=(clockGenerator_mag R ℓ).map (Matrix.reindexAlgEquiv ℝ ℝ (configEquiv (X:=X) ℓ)) + change Commute (Matrix.reindex _ _ _) (Matrix.reindex _ _ _) at hh + rw [show Matrix.diagonal (SlotColor.magnetization (V:=X×Fin ℓ))= + Matrix.diagonal (fun c=>id (SlotColor.magnetization c)) from rfl, + reindex_spectral ℓ id] at hh + exact hh +omit [DecidableEq X] in +lemma physicalMagnetization_bounds (ℓ : ℕ) (k : X → Level ℓ) : + -(Fintype.card X:ℝ)*ℓ/2≤physicalMagnetization ℓ k ∧ + physicalMagnetization ℓ k≤(Fintype.card X:ℝ)*ℓ/2 := by + have hl : ∑ x : X,(-((ℓ:ℝ)/2))≤physicalMagnetization ℓ k := by + apply Finset.sum_le_sum + intro x _ + have hk : (0:ℝ)≤k x:=by positivity + linarith + have hu : physicalMagnetization ℓ k≤∑ _ : X,(ℓ:ℝ)/2 := by + apply Finset.sum_le_sum + intro x _ + have hk : (k x:ℝ)≤ℓ:=by exact_mod_cast Nat.le_of_lt_succ (k x).isLt + linarith + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hl hu + constructor <;> linarith +end Heisenberg.SlotTensor +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixTrace.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d46459b5eabfd1920013a8d71d68c09229e5840 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinMatrixTrace.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinPhysicalOperators + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg +open TensorUnits +variable {d ℓ : ℕ} {X : Type} [Fintype X] [DecidableEq X] + +def realFunctional (τ : State d ℓ) : QuasiLocal d ℓ →ₗ[ℝ] ℝ := + (Complex.reCLM.comp (τ.functional.restrictScalars ℝ)).toLinearMap + +lemma finiteRepresentation_trace (site : X → Site d) (hinj : Function.Injective site) + (τ : State d ℓ) (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + (M : Matrix (X → Level ℓ) (X → Level ℓ) ℝ) : + (τ.functional (finiteRepresentation site hinj M)).re= + (Fintype.card (X → Level ℓ):ℝ)⁻¹*Matrix.trace M := by + have ht : ∀ A B,realFunctional τ (A*B)=realFunctional τ (B*A) := fun A B=>congrArg Complex.re (hτ A B) + have h1 : realFunctional τ 1=1 := by change (τ.functional 1).re=1; rw [τ.normalized]; rfl + change realFunctional τ (liftAlg (tensorUnits site) (tensorUnits_mul site hinj) (tensorUnits_sum site) + (Matrix.reindex (functionReindex (Fintype.equivFin X)) (functionReindex (Fintype.equivFin X)) M))=_ + rw [trace_lift _ _ _ _ ht h1] + have he : Fintype.card (Fin (Fintype.card X) → Level ℓ)=Fintype.card (X → Level ℓ) := + Fintype.card_congr (functionReindex (Fintype.equivFin X)).symm + rw [he] + congr 1 + exact (functionReindex (Fintype.equivFin X)).symm.sum_comp (fun i=>M i i) + +lemma finiteRepresentation_exp (site : X → Site d) (hinj : Function.Injective site) + (M : Matrix (X → Level ℓ) (X → Level ℓ) ℝ) : + finiteRepresentation site hinj (NormedSpace.exp M)=NormedSpace.exp (finiteRepresentation site hinj M) := + NormedSpace.map_exp (finiteRepresentation (ℓ:=ℓ) site hinj) + (finiteRepresentation (ℓ:=ℓ) site hinj).toLinearMap.continuous_of_finiteDimensional M + +lemma finiteRepresentation_gibbsDensity (site : X → Site d) (hinj : Function.Injective site) + (H : Matrix (X → Level ℓ) (X → Level ℓ) ℝ) (β : ℝ) : + gibbsDensity (finiteRepresentation site hinj H) β= + finiteRepresentation site hinj (NormedSpace.exp ((-β) • H)) := by + rw [finiteRepresentation_exp,map_smul,gibbsDensity] + exact congrArg NormedSpace.exp (IsScalarTower.algebraMap_smul ℂ (-β) _) + +lemma finiteRepresentation_gibbs_re (site : X → Site d) (hinj : Function.Injective site) + (τ : State d ℓ) (hτ : ∀ A B,τ.functional (A*B)=τ.functional (B*A)) + (H A : Matrix (X → Level ℓ) (X → Level ℓ) ℝ) + (hH : IsSelfAdjoint (finiteRepresentation site hinj H)) (β : ℝ) : + ((gibbsState τ (finiteRepresentation site hinj H) β).functional + (finiteRepresentation site hinj A)).re= + Matrix.trace (NormedSpace.exp ((-β) • H)*A)/Matrix.trace (NormedSpace.exp ((-β) • H)) := by + rw [gibbsState_apply τ hτ hH,finiteRepresentation_gibbsDensity,←map_mul] + rw [←Complex.ofReal_inv,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + rw [finiteRepresentation_trace site hinj τ hτ,finiteRepresentation_trace site hinj τ hτ] + have hc : (Fintype.card (X → Level ℓ):ℝ)≠0 := by exact_mod_cast Fintype.card_ne_zero + rw [mul_inv_rev,inv_inv] + field_simp + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinPhysicalOperators.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinPhysicalOperators.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0600dfc92d2f44f2602c01761c0105a4cfac0ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinPhysicalOperators.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinTensorRepresentation + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg +open TensorUnits +variable {d ℓ : ℕ} + +lemma plus_coefficient (k : Fin ℓ) : + Real.sqrt (((ℓ-k.val:ℕ):ℝ)*(k.val+1))= + Real.sqrt ((ℓ/2:ℝ)*(ℓ/2+1)-magneticLevel ℓ k.castSucc*(magneticLevel ℓ k.castSucc+1)) := by + congr 1 + rw [Nat.cast_sub k.isLt.le] + simp only [magneticLevel,Fin.val_castSucc] + ring + +lemma oneSite_plus (x : Site d) : + liftLinear (localUnit d ℓ x) (SpinSlots.physicalPlus ℓ)=spinPlus d ℓ x := by + change (∑ a : Level ℓ,∑ b : Level ℓ, + (if a.val=b.val+1 then Real.sqrt (((ℓ-b.val:ℕ):ℝ)*(b.val+1)) else 0) • localUnit d ℓ x a b)=_ + rw [Finset.sum_comm,Fin.sum_univ_castSucc] + have hsum (k : Fin ℓ) : + (∑ a : Level ℓ,(if a.val=k.val+1 then Real.sqrt (((ℓ-k.val:ℕ):ℝ)*(k.val+1)) else 0) • localUnit d ℓ x a k.castSucc)= + Real.sqrt (((ℓ-k.val:ℕ):ℝ)*(k.val+1)) • localUnit d ℓ x k.succ k.castSucc := by + rw [Finset.sum_eq_single k.succ] + · simp only [Fin.val_succ,ite_true] + · intro a _ ha + have hne : a.val≠k.val+1:=fun he=>ha (Fin.ext he) + rw [ite_eq_right hne,zero_smul] + · exact fun h=>False.elim (h (Finset.mem_univ _)) + have hlast : (∑ a : Level ℓ,(if a.val=(Fin.last ℓ).val+1 then Real.sqrt (((ℓ-(Fin.last ℓ).val:ℕ):ℝ)*((Fin.last ℓ).val+1)) else 0) • localUnit d ℓ x a (Fin.last ℓ))=0 := by + apply Finset.sum_eq_zero + intro a _ + rw [ite_eq_right (by have := a.isLt; simp only [Fin.val_last]; omega),zero_smul] + simp only [Fin.val_castSucc,hsum,hlast,add_zero,spinPlus] + apply Finset.sum_congr rfl + intro k _ + rw [plus_coefficient] + exact (IsScalarTower.algebraMap_smul ℂ _ _).symm + +lemma oneSite_transpose (x : Site d) (M : Matrix (Level ℓ) (Level ℓ) ℝ) : + liftLinear (localUnit d ℓ x) M.transpose=star (liftLinear (localUnit d ℓ x) M) := by + simp only [liftLinear,LinearMap.coe_mk,AddHom.coe_mk,Matrix.transpose_apply,star_sum,star_smul, + star_trivial,star_localUnit] + rw [Finset.sum_comm] + +variable {X : Type} [Fintype X] [DecidableEq X] +lemma finiteRepresentation_plus (site : X → Site d) (hinj : Function.Injective site) (x : X) : + finiteRepresentation site hinj (TensorMatrix.onsite x (SpinSlots.physicalPlus ℓ))=spinPlus d ℓ (site x) := by + rw [finiteRepresentation_onsite,oneSite_plus] + +lemma finiteRepresentation_minus (site : X → Site d) (hinj : Function.Injective site) (x : X) : + finiteRepresentation site hinj (TensorMatrix.onsite x (SpinSlots.physicalPlus ℓ).transpose)=spinMinus d ℓ (site x) := by + rw [finiteRepresentation_onsite,oneSite_transpose,oneSite_plus] + rfl + +lemma xy_bond (d ℓ : ℕ) (x y : Site d) : + spinX d ℓ x*spinX d ℓ y+spinY d ℓ x*spinY d ℓ y= + (1/2:ℝ) • (spinPlus d ℓ x*spinMinus d ℓ y+spinMinus d ℓ x*spinPlus d ℓ y) := by + have hc : (1/(2*Complex.I):ℂ)*(1/(2*Complex.I))= -(1/4:ℂ) := by + simp only [one_div,mul_inv_rev,Complex.inv_I] + ring_nf + norm_num [Complex.I_sq] + rw [spinX,spinX,spinY,spinY,smul_mul_smul_comm,smul_mul_smul_comm,hc] + rw [←IsScalarTower.algebraMap_smul ℂ (1/2:ℝ)] + norm_num only [map_div₀,map_one,map_ofNat] + simp only [mul_add,add_mul,mul_sub,sub_mul] + module + +lemma finiteRepresentation_bond (site : X → Site d) (hinj : Function.Injective site) (x y : X) : + finiteRepresentation site hinj (SlotTensor.spinBond ℓ x y)=bond d ℓ (site x) (site y) := by + simp only [SlotTensor.spinBond,map_add,map_smul,map_mul, + finiteRepresentation_plus,finiteRepresentation_minus,finiteRepresentation_z] + rw [←xy_bond] + rfl + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinTensorRepresentation.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinTensorRepresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c3727038e8a56ee3189d48f98e525e941b9db8e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinTensorRepresentation.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.Heisenberg.MatrixUnitTrace + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix Matrix.Norms.Operator +namespace Heisenberg +open TensorUnits +variable {d ℓ : ℕ} {X : Type} [Fintype X] [DecidableEq X] + +def tensorUnits (site : X → Site d) (a b : Fin (Fintype.card X) → Level ℓ) : QuasiLocal d ℓ := + system (fun i=>localUnit d ℓ (site ((Fintype.equivFin X).symm i))) a b + +omit [DecidableEq X] in +lemma tensorUnits_mul (site : X → Site d) (hinj : Function.Injective site) + (a b c e : Fin (Fintype.card X) → Level ℓ) : + tensorUnits site a b*tensorUnits site c e=if b=c then tensorUnits site a e else 0 := by + apply system_mul _ (fun i=>localUnit_mul_same d ℓ _) + intro i j hij a b c e + exact localUnits_commute (fun h=>hij ((Fintype.equivFin X).symm.injective (hinj h))) a b c e + +omit [DecidableEq X] in +lemma tensorUnits_sum (site : X → Site d) : + ∑ a : Fin (Fintype.card X) → Level ℓ,tensorUnits site a a=1 := + system_diagonal_sum ℝ _ (fun _=>localUnit_diagonal_sum d ℓ _) + +def finiteRepresentation (site : X → Site d) (hinj : Function.Injective site) : + Matrix (X → Level ℓ) (X → Level ℓ) ℝ →ₐ[ℝ] QuasiLocal d ℓ := + (liftAlg (tensorUnits site) (tensorUnits_mul site hinj) (tensorUnits_sum site)).comp + (Matrix.reindexAlgEquiv ℝ ℝ (functionReindex (Fintype.equivFin X))).toAlgHom + +lemma finiteRepresentation_onsite (site : X → Site d) (hinj : Function.Injective site) + (x : X) (M : Matrix (Level ℓ) (Level ℓ) ℝ) : + finiteRepresentation site hinj (TensorMatrix.onsite x M)= + liftLinear (localUnit d ℓ (site x)) M := by + change liftLinear (system (fun i=>localUnit d ℓ (site ((Fintype.equivFin X).symm i)))) + (Matrix.reindex (functionReindex (Fintype.equivFin X)) (functionReindex (Fintype.equivFin X)) + (TensorMatrix.onsite x M))=_ + rw [reindex_onsite,lift_onsiteFin _ (fun i=>localUnit_diagonal_sum d ℓ _)] + simp only [Equiv.symm_apply_apply] + +lemma finiteRepresentation_z (site : X → Site d) (hinj : Function.Injective site) (x : X) : + finiteRepresentation site hinj (TensorMatrix.onsite x (SpinSlots.physicalZ ℓ))=spinZ d ℓ (site x) := by + rw [finiteRepresentation_onsite] + change (∑ a,∑ b,Matrix.diagonal (fun k : Level ℓ=>(k:ℝ)-(ℓ:ℝ)/2) a b • localUnit d ℓ (site x) a b)=_ + simp only [Matrix.diagonal_apply,ite_smul,zero_smul,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + apply Finset.sum_congr rfl + intro a _ + exact (IsScalarTower.algebraMap_smul ℂ ((a:ℝ)-(ℓ:ℝ)/2) (localUnit d ℓ (site x) a a)).symm + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SpinTranslations.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SpinTranslations.lean new file mode 100644 index 0000000000000000000000000000000000000000..4da7f293981e5eeba2ef6c1828983737f4263f2a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SpinTranslations.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.Heisenberg.SpinFieldDynamics + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators ComplexConjugate +namespace Heisenberg +variable {d ℓ : ℕ} + +lemma hom_ext_localUnit (f g : QuasiLocal d ℓ →⋆ₐ[ℂ] QuasiLocal d ℓ) + (hf : Continuous f) (hg : Continuous g) + (h : ∀ x a b,f (localUnit d ℓ x a b)=g (localUnit d ℓ x a b)) : f=g := by + apply DFunLike.ext + intro A + have hs : (localCore d ℓ : Set (QuasiLocal d ℓ))⊆{B | f B=g B} := by + intro B hB + exact StarAlgHom.adjoin_le_equalizer f g (by rintro _ ⟨x,a,b,rfl⟩; exact h x a b) hB + exact (isClosed_eq hf hg).closure_subset_iff.mpr hs ((localCore_dense d ℓ) A) + +lemma translation_add (x y : Site d) (A : QuasiLocal d ℓ) : + translation d ℓ x (translation d ℓ y A)=translation d ℓ (x+y) A := by + have h : (translation d ℓ x).comp (translation d ℓ y)=translation d ℓ (x+y) := by + apply hom_ext_localUnit + · exact (translationLinear d ℓ x).continuous.comp (translationLinear d ℓ y).continuous + · exact (translationLinear d ℓ (x+y)).continuous + · intro z a b + simp only [StarAlgHom.comp_apply,translation_localUnit,add_assoc] + exact DFunLike.congr_fun h A + +lemma translation_zero (A : QuasiLocal d ℓ) : translation d ℓ 0 A=A := by + have h : translation d ℓ 0=StarAlgHom.id ℂ (QuasiLocal d ℓ) := by + apply hom_ext_localUnit (hf:=(translationLinear d ℓ 0).continuous) (hg:=continuous_id) + intro z a b + change translation d ℓ 0 (localUnit d ℓ z a b)=localUnit d ℓ z a b + simp only [translation_localUnit,zero_add] + exact DFunLike.congr_fun h A + +lemma nearestNeighbor_add (x y z : Site d) : NearestNeighbor (x+y) (x+z) ↔ NearestNeighbor y z := by + simp only [NearestNeighbor,Pi.add_apply,add_sub_add_left_eq_sub] + +lemma translation_bond (x y z : Site d) : translation d ℓ x (bond d ℓ y z)=bond d ℓ (x+y) (x+z) := by + have hadd (A B : QuasiLocal d ℓ) : + translation d ℓ x (A + B) = translation d ℓ x A + translation d ℓ x B := + (translation d ℓ x).map_add' A B + have hmul (A B : QuasiLocal d ℓ) : + translation d ℓ x (A * B) = translation d ℓ x A * translation d ℓ x B := + (translation d ℓ x).map_mul' A B + simp only [bond, hadd, hmul, translation_spinX, translation_spinY, translation_spinZ] + +lemma directed_bond_double_sum (Λ : Finset (Site d)) : + (∑ x∈Λ,∑ y∈Λ,if NearestNeighbor x y then bond d ℓ x y else 0)=2 • (-hamiltonian d ℓ Λ) := by + rw [←directed_bond_sum Λ,sum_siteEdges (fun x y : Λ=>NearestNeighbor x.val y.val) (fun x y : Λ=>bond d ℓ x.val y.val),Fintype.sum_prod_type] + rw [←Finset.sum_coe_sort Λ] + apply Finset.sum_congr rfl + intro x _ + exact (Finset.sum_coe_sort Λ _).symm + +lemma translation_hamiltonian (x : Site d) (Λ : Finset (Site d)) : + translation d ℓ x (hamiltonian d ℓ Λ)=hamiltonian d ℓ (Λ.image (fun y=>x+y)) := by + have he :=congrArg (translation d ℓ x) (directed_bond_double_sum (ℓ:=ℓ) Λ) + have hsum : translation d ℓ x (∑ y∈Λ,∑ z∈Λ,if NearestNeighbor y z then bond d ℓ y z else 0)= + ∑ y∈Λ.image (fun y=>x+y),∑ z∈Λ.image (fun y=>x+y),if NearestNeighbor y z then bond d ℓ y z else 0 := by + rw [Finset.sum_image (fun _ _ _ _ he=>add_left_cancel he)] + simp_rw [Finset.sum_image (fun _ _ _ _ he=>add_left_cancel he)] + simp only [map_sum,apply_ite,map_zero,translation_bond,nearestNeighbor_add] + rw [hsum,directed_bond_double_sum,map_nsmul,map_neg] at he + have he2 : (2:ℂ) • (-hamiltonian d ℓ (Λ.image (fun y=>x+y)))=(2:ℂ) • (-translation d ℓ x (hamiltonian d ℓ Λ)) := by + simpa only [two_smul] using he + have he' := congrArg (fun A : QuasiLocal d ℓ=>(1/2:ℂ) • A) he2 + norm_num only [smul_smul,one_div,inv_mul_cancel₀ (by norm_num : (2:ℂ)≠0),one_smul] at he' + exact neg_injective he'.symm + +lemma translation_exp (x : Site d) (A : QuasiLocal d ℓ) : + translation d ℓ x (NormedSpace.exp A)=NormedSpace.exp (translation d ℓ x A) := by + let : NormedAlgebra ℚ (QuasiLocal d ℓ):=NormedAlgebra.restrictScalars ℚ ℂ _ + exact NormedSpace.map_exp (translation d ℓ x) (translationLinear d ℓ x).continuous A + +lemma translation_finiteDynamics (x : Site d) (Λ : Finset (Site d)) (t : ℝ) (A : QuasiLocal d ℓ) : + translation d ℓ x (finiteDynamics d ℓ Λ t A)= + finiteDynamics d ℓ (Λ.image (fun y=>x+y)) t (translation d ℓ x A) := by + have hmul (B C : QuasiLocal d ℓ) : + translation d ℓ x (B * C) = translation d ℓ x B * translation d ℓ x C := + (translation d ℓ x).map_mul' B C + have hsmul (scalar : ℂ) (B : QuasiLocal d ℓ) : + translation d ℓ x (scalar • B) = scalar • translation d ℓ x B := + (translation d ℓ x).toAlgHom.toLinearMap.map_smul scalar B + simp only [finiteDynamics, hmul, translation_exp, hsmul, translation_hamiltonian] + +end Heisenberg +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/StablePinLaw.lean b/lean/OAI/MathematicalPhysics/Heisenberg/StablePinLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..79982d708065f8a89403ac76fb7e87f10e6c05cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/StablePinLaw.lean @@ -0,0 +1,288 @@ +import OAI.MathematicalPhysics.Heisenberg.PinSplicing + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate +noncomputable section +open scoped Classical + +noncomputable section +open scoped Classical +namespace Heisenberg.Return +open Equiv +variable {V : Type*} + +variable [Fintype V] + +end Heisenberg.Return + +noncomputable section +open scoped Classical +namespace Heisenberg.Transport +open Equiv +open Heisenberg.Cycle Heisenberg.Return +variable {V W : Type*} [Fintype V] [Fintype W] + +omit [Fintype V] [Fintype W] in +lemma pow_congr (e : V ≃ W) (π : Perm V) (n : ℕ) (x : V) : + (e.permCongr π ^ n) (e x) = e ((π ^ n) x) := by + induction n with + | zero => rfl + | succ n hn => simp only [pow_succ', Perm.mul_apply, hn, permCongr_apply, symm_apply_apply] + +lemma sameCycle_congr (e : V ≃ W) (π : Perm V) (i j : V) : + π.SameCycle i j ↔ (e.permCongr π).SameCycle (e i) (e j) := by + constructor + · intro h + obtain ⟨n, hn⟩ := h.exists_nat_pow_eq + have he : (e.permCongr π ^ n) (e i) = e j := by rw [pow_congr, hn] + rw [← he] + exact (Perm.SameCycle.refl _ _).pow_right + · intro h + obtain ⟨n, hn⟩ := h.exists_nat_pow_eq + rw [pow_congr] at hn + have he := e.injective hn + rw [← he] + exact (Perm.SameCycle.refl _ _).pow_right + +def classCongr (e : V ≃ W) (π : Perm V) : Classes π ≃ Classes (e.permCongr π) := + Quotient.congr e (sameCycle_congr e π) + +@[simp] lemma classCongr_mk (e : V ≃ W) (π : Perm V) (i : V) : + classCongr e π (classOf π i) = classOf (e.permCongr π) (e i) := rfl + +lemma missing_pred_congr (e : V ≃ W) (π : Perm V) (P : Set V) (Q : Set W) + (h : ∀ i, i ∈ P ↔ e i ∈ Q) (c : Classes π) : + (∀ i ∈ P, c ≠ classOf π i) ↔ + ∀ j ∈ Q, classCongr e π c ≠ classOf (e.permCongr π) j := by + constructor + · intro hc j hj he + have hm : e.symm j ∈ P := (h _).mpr (by simpa using hj) + apply hc _ hm + apply (classCongr e π).injective + simpa using he + · intro hc i hi he + apply hc (e i) ((h i).mp hi) + rw [he, classCongr_mk] + +lemma missingCount_congr (e : V ≃ W) (π : Perm V) (P : Set V) (Q : Set W) + (h : ∀ i, i ∈ P ↔ e i ∈ Q) : + missingCount π P = missingCount (e.permCongr π) Q := + Nat.card_congr ((classCongr e π).subtypeEquiv (missing_pred_congr e π P Q h)) + +lemma firstValue_congr_at_hit (e : V ≃ W) (π : Perm V) (P : Set V) (Q : Set W) + (h : ∀ i, i ∈ P ↔ e i ∈ Q) (x : V) (hx : HasHit π P x) : + firstValue (e.permCongr π) Q (e x) = (firstValue π P x).map e := by + apply firstValue_unique π P (fun x => firstValue (e.permCongr π) Q (e x)) e + · intro i hi + exact firstValue_of_mem _ ((h i).mp hi) + · intro i hi + have he := firstValue_step (e.permCongr π) Q (e i) (mt (h i).mpr hi) + simpa using he + · exact hx + +lemma nextPoint_congr (e : V ≃ W) (π : Perm V) (P : Set V) (Q : Set W) + (h : ∀ i, i ∈ P ↔ e i ∈ Q) (i : P) : + nextPoint (e.permCongr π) Q (e.subtypeEquiv h i) = + e.subtypeEquiv h (nextPoint π P i) := by + apply Subtype.ext + have hh := firstValue_congr_at_hit e π P Q h (π i) + ((hasHit_apply π P i).mpr (hasHit_of_mem π i.property)) + have he : e (π i) = (e.permCongr π) (e.subtypeEquiv h i : W) := by simp + rw [he, nextValue_eq_nextPoint, nextValue_eq_nextPoint] at hh + exact Option.some.inj hh + +lemma nextPermutation_congr (e : V ≃ W) (π : Perm V) (P : Set V) (Q : Set W) + (h : ∀ i, i ∈ P ↔ e i ∈ Q) : + (e.subtypeEquiv h).permCongr (nextPermutation π P) = + nextPermutation (e.permCongr π) Q := by + apply Equiv.ext + intro j + obtain ⟨i, rfl⟩ := (e.subtypeEquiv h).surjective j + simpa only [permCongr_apply, symm_apply_apply, nextPermutation, Equiv.ofBijective_apply] using (nextPoint_congr e π P Q h i).symm + +def somePins (P : Set V) : P ≃ (some '' P : Set (Option V)) := + Equiv.ofBijective (fun i => ⟨some (i : V), ⟨i, i.property, rfl⟩⟩) + ⟨by intro i j h; exact Subtype.ext (Option.some.inj (congrArg Subtype.val h)), + by rintro ⟨_, i, hi, rfl⟩; exact ⟨⟨i, hi⟩, rfl⟩⟩ + +omit [Fintype V] in +@[simp] lemma somePins_apply (P : Set V) (i : P) : + (somePins P i : Option V) = some i := rfl + +lemma nextPoint_splice (π : Perm (Option V)) (P : Set V) (i : P) : + nextPoint π (some '' P) (somePins P i) = + somePins P (nextPoint (removeNone π) P i) := by + apply Subtype.ext + have hh := nextValue_splice π P (i : V) i.property + change firstValue π (some '' P) (π (somePins P i : Option V)) = _ at hh + rw [nextValue_eq_nextPoint, nextValue_eq_nextPoint] at hh + exact Option.some.inj hh + +lemma nextPermutation_splice (π : Perm (Option V)) (P : Set V) : + (somePins P).permCongr (nextPermutation (removeNone π) P) = + nextPermutation π (some '' P) := by + apply Equiv.ext + intro j + obtain ⟨i, rfl⟩ := (somePins P).surjective j + simpa only [permCongr_apply, symm_apply_apply, nextPermutation, Equiv.ofBijective_apply] using (nextPoint_splice π P i).symm + +omit [Fintype V] in +lemma missingCount_univ (π : Perm V) : missingCount π Set.univ = 0 := by + let : IsEmpty (MissingClasses π Set.univ) := ⟨by + rintro ⟨c, hc⟩ + induction c using Quotient.inductionOn with | _ i => exact hc i (Set.mem_univ i) rfl⟩ + exact Nat.card_of_isEmpty + +lemma nextPoint_all (π : Perm V) (i : V) : + (nextPoint π Set.univ ⟨i, Set.mem_univ i⟩ : V) = π i := by + have h := firstValue_of_mem π (P := Set.univ) (x := π i) (Set.mem_univ _) + rw [nextValue_eq_nextPoint π Set.univ ⟨i, Set.mem_univ i⟩] at h + exact Option.some.inj h + +lemma nextPermutation_all (π : Perm V) : + (Equiv.Set.univ V).symm.permCongr π = nextPermutation π Set.univ := by + apply Equiv.ext + intro i + apply Subtype.ext + change π (i : V) = (nextPoint π Set.univ i : V) + exact (nextPoint_all π i).symm + +end Heisenberg.Transport + +noncomputable section +open scoped Classical +namespace Heisenberg.Pin +open Heisenberg.Cycle Heisenberg.Return Heisenberg.Transport +open Equiv +variable {V W Ω : Type*} [Fintype V] [Fintype W] [Fintype Ω] + +lemma permutationSymbol_congr (e : V ≃ W) (π : Perm V) : + MvPolynomial.rename (Sum.map e e) (permutationSymbol π) = + permutationSymbol (e.permCongr π) := by + simp only [permutationSymbol, map_prod, map_add, MvPolynomial.rename_X, + Sum.map_inl, Sum.map_inr] + rw [← e.prod_comp (fun j => MvPolynomial.X (Sum.inl j) + + MvPolynomial.X (Sum.inr (e.permCongr π j)))] + simp only [permCongr_apply, symm_apply_apply] + +lemma lawSymbol_congr (e : V ≃ W) (μ : Ω → ℝ) (π : Ω → Perm V) : + MvPolynomial.rename (Sum.map e e) (lawSymbol μ π) = + lawSymbol μ (fun ω => e.permCongr (π ω)) := by + simp only [lawSymbol, map_sum, map_mul, MvPolynomial.rename_C, permutationSymbol_congr] + +lemma stable_law_congr (e : V ≃ W) (μ : Ω → ℝ) (π : Ω → Perm V) + (hs : Stable (lawSymbol μ π)) : Stable (lawSymbol μ (fun ω => e.permCongr (π ω))) := by + rw [← lawSymbol_congr] + exact hs.rename (Sum.map e e) + +def pinLaw (μ : Ω → ℝ) (π : Ω → Perm V) (P : Set V) : MvPolynomial (P ⊕ P) ℂ := + lawSymbol (fun ω => μ ω * (2 : ℝ) ^ missingCount (π ω) P) + (fun ω => nextPermutation (π ω) P) + +lemma pinLaw_all (μ : Ω → ℝ) (π : Ω → Perm V) : + pinLaw μ π Set.univ = MvPolynomial.rename + (Sum.map (Equiv.Set.univ V).symm (Equiv.Set.univ V).symm) (lawSymbol μ π) := by + rw [lawSymbol_congr] + unfold pinLaw + simp only [missingCount_univ, pow_zero, mul_one, nextPermutation_all] + exact congrArg (fun f : Fintype (Set.univ : Set V) => + @lawSymbol (Set.univ : Set V) Ω f inferInstance μ + (fun ω => nextPermutation (π ω) Set.univ)) (Subsingleton.elim _ _) + +lemma stable_pinLaw_all (μ : Ω → ℝ) (π : Ω → Perm V) + (hs : Stable (lawSymbol μ π)) : Stable (pinLaw μ π Set.univ) := by + rw [pinLaw_all] + exact hs.rename _ + +omit [Fintype V] [Fintype Ω] in +lemma splice_mass_nonneg (μ : Ω → ℝ) (π : Ω → Perm (Option V)) + (hμ : ∀ ω, 0 ≤ μ ω) (ω : Ω) : 0 ≤ μ ω * spliceWeight (π ω) := + mul_nonneg (hμ ω) (le_trans zero_le_one (spliceWeight_ge_one (π ω))) + +omit [Fintype V] in +lemma splice_mass_pos (μ : Ω → ℝ) (π : Ω → Perm (Option V)) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) : + 0 < ∑ ω, μ ω * spliceWeight (π ω) := by + apply hpos.trans_le + apply Finset.sum_le_sum + intro ω _ + exact le_mul_of_one_le_right (hμ ω) (spliceWeight_ge_one (π ω)) + +universe u + +theorem stable_pinLaw {V : Type u} [Fintype V] (μ : Ω → ℝ) (π : Ω → Perm V) + (hμ : ∀ ω, 0 ≤ μ ω) (hpos : 0 < ∑ ω, μ ω) (hs : Stable (lawSymbol μ π)) + (P : Set V) : Stable (pinLaw μ π P) := by + have hall (n : ℕ) : ∀ (V : Type u) [Fintype V], Fintype.card V = n → + ∀ (μ : Ω → ℝ) (π : Ω → Perm V), (∀ ω, 0 ≤ μ ω) → + 0 < ∑ ω, μ ω → Stable (lawSymbol μ π) → + ∀ P : Set V, Stable (pinLaw μ π P) := by + induction n using Nat.strong_induction_on with + | h n ih => + intro V _ hn μ π hμ hpos hs P + by_cases hP : P = Set.univ + · subst P + exact stable_pinLaw_all μ π hs + obtain ⟨q, hq⟩ : ∃ q : V, q ∉ P := by + by_contra h + apply hP + exact Set.eq_univ_of_forall (by simpa only [not_exists, not_not] using h) + let W := {i : V // i ≠ q} + let e : Option W ≃ V := Equiv.optionSubtypeNe q + let π' : Ω → Perm (Option W) := fun ω => e.symm.permCongr (π ω) + let P' : Set W := {i | (i : V) ∈ P} + have heπ (ω : Ω) : e.permCongr (π' ω) = π ω := by + exact e.permCongr.apply_symm_apply (π ω) + have heP : ∀ i : Option W, i ∈ some '' P' ↔ e i ∈ P := by + intro i + cases i with + | none => + change (none ∈ some '' P') ↔ (Equiv.optionSubtypeNe q) none ∈ P + rw [Equiv.optionSubtypeNe_none] + simp [hq] + | some i => + change (some i ∈ some '' P') ↔ (Equiv.optionSubtypeNe q) (some i) ∈ P + rw [Equiv.optionSubtypeNe_some] + simp [P'] + have hs' := stable_law_congr e.symm μ π hs + have hss := stable_spliced_law μ π' hμ hpos hs' + let μ' : Ω → ℝ := fun ω => μ ω * spliceWeight (π' ω) + let π'' : Ω → Perm W := fun ω => Equiv.removeNone (π' ω) + have hcard : Fintype.card W < n := by + rw [← hn] + exact Fintype.card_subtype_lt (x := q) (by simp) + have hi := ih (Fintype.card W) hcard W rfl μ' π'' + (splice_mass_nonneg μ π' hμ) (splice_mass_pos μ π' hμ hpos) hss P' + let ep : P' ≃ P := (somePins P').trans (e.subtypeEquiv heP) + have hnext (ω : Ω) : ep.permCongr (nextPermutation (π'' ω) P') = + nextPermutation (π ω) P := by + have he := nextPermutation_congr e (π' ω) (some '' P') P heP + rw [heπ] at he + rw [← he, ← nextPermutation_splice] + rfl + have hweight (ω : Ω) : μ' ω * (2 : ℝ) ^ missingCount (π'' ω) P' = + μ ω * (2 : ℝ) ^ missingCount (π ω) P := by + have hc := missingCount_congr e (π' ω) (some '' P') P heP + rw [heπ] at hc + rw [← hc, cycle_weight_splice] + simp only [μ', π'', spliceWeight, mul_assoc] + have ht := stable_law_congr ep + (fun ω => μ' ω * (2 : ℝ) ^ missingCount (π'' ω) P') + (fun ω => nextPermutation (π'' ω) P') hi + simpa only [hnext, hweight, pinLaw] using ht + exact hall (Fintype.card V) V rfl μ π hμ hpos hs P + +end Heisenberg.Pin +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/StablePolynomials.lean b/lean/OAI/MathematicalPhysics/Heisenberg/StablePolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..29febadb5302fec4775f13771c06a8cb9e38a72a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/StablePolynomials.lean @@ -0,0 +1,336 @@ +import OAI.MathematicalPhysics.Heisenberg.PolynomialLimits + +namespace OAI + +noncomputable section +open scoped Classical Topology +open Set Filter Metric + +namespace Heisenberg.Pin + +def Upper {σ : Type*} : Set (σ → ℂ) := {z | ∀ j, 0 < (z j).im} + +def Stable {σ : Type*} (p : MvPolynomial σ ℂ) : Prop := + ∀ z ∈ Upper, MvPolynomial.eval z p ≠ 0 + +lemma isOpen_upper {σ : Type*} [Finite σ] : IsOpen (Upper (σ := σ)) := by + have he : Upper (σ := σ) = ⋂ j : σ, {z | 0 < (z j).im} := by ext; simp [Upper] + rw [he] + exact isOpen_iInter_of_finite fun j => isOpen_lt continuous_const + (Complex.continuous_im.comp (continuous_apply j)) + +def linePolynomial {σ : Type*} (p : MvPolynomial σ ℂ) (z v : σ → ℂ) : Polynomial ℂ := + MvPolynomial.eval₂ Polynomial.C (fun j => Polynomial.C (z j) + + Polynomial.X * Polynomial.C (v j)) p + +lemma linePolynomial_eval {σ : Type*} (p : MvPolynomial σ ℂ) (z v : σ → ℂ) (t : ℂ) : + (linePolynomial p z v).eval t = MvPolynomial.eval (fun j => z j + t * v j) p := by + unfold linePolynomial + rw [MvPolynomial.polynomial_eval_eval₂] + have hc : (Polynomial.evalRingHom t).comp Polynomial.C = RingHom.id ℂ := by ext; simp + simp only [Polynomial.eval_add, Polynomial.eval_mul, Polynomial.eval_C, + Polynomial.eval_X, hc, MvPolynomial.eval₂_id] + +lemma eval_sum_of_support_subset {σ : Type*} [Fintype σ] (p : MvPolynomial σ ℂ) + (s : Finset (σ →₀ ℕ)) (hp : p.support ⊆ s) (z : σ → ℂ) : + MvPolynomial.eval z p = ∑ a ∈ s, p.coeff a * ∏ j, (z j) ^ (a j) := by + rw [MvPolynomial.eval_eq'] + exact Finset.sum_subset hp fun a _ ha => by + have hz : p.coeff a = 0 := by simpa [MvPolynomial.mem_support_iff] using ha + rw [hz, zero_mul] + +lemma locallyUniform_const {ι X : Type*} [TopologicalSpace X] (φ : Filter ι) + (f : X → ℂ) (U : Set X) : TendstoLocallyUniformlyOn (fun _ => f) f φ U := by + apply TendstoUniformlyOn.tendstoLocallyUniformlyOn + rw [Metric.tendstoUniformlyOn_iff] + intro ε hε + exact Filter.Eventually.of_forall fun _ x _ => by simpa using hε + +lemma locallyUniform_finset_sum {ι X κ : Type*} [TopologicalSpace X] (φ : Filter ι) + (U : Set X) (s : Finset κ) (F : κ → ι → X → ℂ) (f : κ → X → ℂ) + (h : ∀ a ∈ s, TendstoLocallyUniformlyOn (F a) (f a) φ U) : + TendstoLocallyUniformlyOn (fun i x => ∑ a ∈ s, F a i x) + (fun x => ∑ a ∈ s, f a x) φ U := by + induction s using Finset.induction_on with + | empty => simpa using locallyUniform_const φ (fun _ : X => (0 : ℂ)) U + | @insert a s ha ih => + have h₁ := h a (Finset.mem_insert_self _ _) + have h₂ := ih (fun b hb => h b (Finset.mem_insert_of_mem hb)) + simp only [Finset.sum_insert ha] + exact h₁.add h₂ + +lemma coefficient_limit_locallyUniform {ι σ X : Type*} [Fintype σ] [TopologicalSpace X] + {φ : Filter ι} {P : ι → MvPolynomial σ ℂ} {p : MvPolynomial σ ℂ} + (s : Finset (σ →₀ ℕ)) (hP : ∀ i, (P i).support ⊆ s) (hp : p.support ⊆ s) + (hc : ∀ a ∈ s, Tendsto (fun i => (P i).coeff a) φ + (𝓝 (p.coeff a))) (z : X → σ → ℂ) (hz : Continuous z) (U : Set X) : + TendstoLocallyUniformlyOn (fun i x => MvPolynomial.eval (z x) (P i)) + (fun x => MvPolynomial.eval (z x) p) φ U := by + simp_rw [eval_sum_of_support_subset _ s (hP _), eval_sum_of_support_subset _ s hp] + apply locallyUniform_finset_sum + intro a ha + apply TendstoLocallyUniformlyOn.mul₀ + · exact ((hc a ha).tendstoUniformlyOn_const U).tendstoLocallyUniformlyOn + · exact locallyUniform_const φ _ U + · exact continuousOn_const + · exact (continuous_finsetProd _ fun j _ => ((continuous_apply j).comp hz).pow _).continuousOn + +theorem stable_coefficient_limit {ι σ : Type*} [Fintype σ] {φ : Filter ι} [φ.NeBot] + {P : ι → MvPolynomial σ ℂ} {p : MvPolynomial σ ℂ} (hp0 : p ≠ 0) + (s : Finset (σ →₀ ℕ)) (hP : ∀ i, (P i).support ⊆ s) (hp : p.support ⊆ s) + (hc : ∀ a ∈ s, Tendsto (fun i => (P i).coeff a) φ + (𝓝 (p.coeff a))) (hstable : ∀ᶠ i in φ, Stable (P i)) : Stable p := by + obtain ⟨w, hw⟩ : ∃ w, MvPolynomial.eval w p ≠ 0 := by + by_contra h + apply hp0 + apply MvPolynomial.funext + simpa using (not_exists.mp h) + intro z hz + let v : σ → ℂ := fun j => w j - z j + let f : ℂ → σ → ℂ := fun t j => z j + t * v j + have hf : Continuous f := by fun_prop + let U : Set ℂ := f ⁻¹' Upper + have hU : IsOpen U := isOpen_upper.preimage hf + have hzero : (0 : ℂ) ∈ U := by simpa [U, f, Upper] using hz + have hp' : linePolynomial p z v ≠ 0 := by + intro h + have he := congrArg (fun q : Polynomial ℂ => q.eval 1) h + simp only [linePolynomial_eval, one_mul, Polynomial.eval_zero] at he + have hv : (fun j => z j + v j) = w := by funext j; dsimp [v]; ring + rw [hv] at he + exact hw he + have hval := polynomial_nonvanishing_limit (φ := φ) + (F := fun i t => (linePolynomial (P i) z v).eval t) hp' hU + (Eventually.of_forall fun i => (linePolynomial (P i) z v).differentiable.differentiableOn) + (by + filter_upwards [hstable] with i hi t ht + rw [linePolynomial_eval] + exact hi (f t) ht) + (by + simp_rw [linePolynomial_eval] + exact coefficient_limit_locallyUniform s hP hp hc f hf U) 0 hzero + simpa only [linePolynomial_eval, zero_mul, add_zero] using hval + +theorem stable_locallyUniform_limit {ι σ : Type*} [Fintype σ] {φ : Filter ι} [φ.NeBot] + {P : ι → MvPolynomial σ ℂ} {p : MvPolynomial σ ℂ} (hp0 : p ≠ 0) + (hc : TendstoLocallyUniformlyOn (fun i z => MvPolynomial.eval z (P i)) + (fun z => MvPolynomial.eval z p) φ Upper) + (hstable : ∀ᶠ i in φ, Stable (P i)) : Stable p := by + obtain ⟨w, hw⟩ : ∃ w, MvPolynomial.eval w p ≠ 0 := by + by_contra h + apply hp0 + apply MvPolynomial.funext + simpa using (not_exists.mp h) + intro z hz + let v : σ → ℂ := fun j => w j - z j + let f : ℂ → σ → ℂ := fun t j => z j + t * v j + have hf : Continuous f := by fun_prop + let U : Set ℂ := f ⁻¹' Upper + have hU : IsOpen U := isOpen_upper.preimage hf + have hzero : (0 : ℂ) ∈ U := by simpa [U, f, Upper] using hz + have hp' : linePolynomial p z v ≠ 0 := by + intro h + have he := congrArg (fun q : Polynomial ℂ => q.eval 1) h + simp only [linePolynomial_eval, one_mul, Polynomial.eval_zero] at he + have hv : (fun j => z j + v j) = w := by funext j; dsimp [v]; ring + rw [hv] at he + exact hw he + have hval := polynomial_nonvanishing_limit (φ := φ) + (F := fun i t => (linePolynomial (P i) z v).eval t) hp' hU + (Eventually.of_forall fun i => (linePolynomial (P i) z v).differentiable.differentiableOn) + (by + filter_upwards [hstable] with i hi t ht + rw [linePolynomial_eval] + exact hi (f t) ht) + (by + simp_rw [linePolynomial_eval] + exact hc.comp f (fun _ ht => ht) hf.continuousOn) 0 hzero + simpa only [linePolynomial_eval, zero_mul, add_zero] using hval + +lemma locallyUniform_eval {ι σ X : Type*} [TopologicalSpace X] {φ : Filter ι} + {z : ι → X → σ → ℂ} {w : X → σ → ℂ} {U : Set X} + (hz : ∀ j, TendstoLocallyUniformlyOn (fun i x => z i x j) (fun x => w x j) φ U) + (hw : ContinuousOn w U) (p : MvPolynomial σ ℂ) : + TendstoLocallyUniformlyOn (fun i x => MvPolynomial.eval (z i x) p) + (fun x => MvPolynomial.eval (w x) p) φ U := by + induction p using MvPolynomial.induction_on with + | C c => simpa using locallyUniform_const φ (fun _ : X => c) U + | add p q hp hq => + simp only [map_add] + exact hp.add hq + | mul_X p j hp => + simp only [map_mul, MvPolynomial.eval_X] + exact hp.mul₀ (hz j) (p.continuous_eval.comp_continuousOn hw) + ((continuous_apply j).comp_continuousOn hw) + +def specialize {σ : Type*} (p : MvPolynomial σ ℂ) (j : σ) (t : ℂ) : MvPolynomial σ ℂ := + MvPolynomial.eval₂ MvPolynomial.C (fun k => if k = j then MvPolynomial.C t + else MvPolynomial.X k) p + +lemma eval_specialize {σ : Type*} (p : MvPolynomial σ ℂ) (j : σ) (t : ℂ) (z : σ → ℂ) : + MvPolynomial.eval z (specialize p j t) = MvPolynomial.eval (Function.update z j t) p := by + induction p using MvPolynomial.induction_on with + | C c => simp [specialize] + | add p q hp hq => simpa only [specialize, MvPolynomial.eval₂_add, map_add] using congrArg₂ (· + ·) hp hq + | mul_X p k hp => + simp only [specialize, MvPolynomial.eval₂_mul, MvPolynomial.eval₂_X, map_mul, MvPolynomial.eval_X] + rw [show MvPolynomial.eval₂ MvPolynomial.C + (fun k => if k = j then MvPolynomial.C t else MvPolynomial.X k) p = specialize p j t from rfl, + hp] + congr 1 + by_cases h : k = j <;> simp [h, Function.update] + +theorem stable_specialize_real {σ : Type*} [Fintype σ] {p : MvPolynomial σ ℂ} + (hp : Stable p) (j : σ) (a : ℝ) : + specialize p j (a : ℂ) = 0 ∨ Stable (specialize p j (a : ℂ)) := by + by_cases hzero : specialize p j (a : ℂ) = 0 + · exact Or.inl hzero + right + let t : ℝ → ℂ := fun r => (a : ℂ) + (r : ℂ) * Complex.I + have ht : Tendsto t (𝓝[>] (0 : ℝ)) (𝓝 (a : ℂ)) := by + have h : Continuous t := by fun_prop + simpa [t] using (h.tendsto 0).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) + apply stable_locallyUniform_limit (φ := 𝓝[>] (0 : ℝ)) + (P := fun r => specialize p j (t r)) hzero + · simp_rw [eval_specialize] + apply locallyUniform_eval + · intro k + by_cases hk : k = j + · subst k + simpa using (ht.tendstoUniformlyOn_const Upper).tendstoLocallyUniformlyOn + · simpa [Function.update_of_ne hk] using + locallyUniform_const (𝓝[>] (0 : ℝ)) (fun z : σ → ℂ => z k) Upper + · apply Continuous.continuousOn + apply continuous_pi + intro k + by_cases hk : k = j + · subst k; simpa using (continuous_const : Continuous (fun _ : σ → ℂ => (a : ℂ))) + · simpa [Function.update_of_ne hk] using continuous_apply k + · filter_upwards [self_mem_nhdsWithin] with r hr z hz + rw [eval_specialize] + apply hp + intro k + by_cases hk : k = j + · subst k + simpa [t] using hr + · simpa [Function.update_of_ne hk] using hz k + +def variablePolynomial {σ : Type*} (p : MvPolynomial σ ℂ) (z : σ → ℂ) (j : σ) : Polynomial ℂ := + MvPolynomial.eval₂ Polynomial.C (fun k => if k = j then Polynomial.X + else Polynomial.C (z k)) p + +lemma variablePolynomial_eval {σ : Type*} (p : MvPolynomial σ ℂ) (z : σ → ℂ) + (j : σ) (t : ℂ) : + (variablePolynomial p z j).eval t = MvPolynomial.eval (Function.update z j t) p := by + unfold variablePolynomial + rw [MvPolynomial.polynomial_eval_eval₂] + have hc : (Polynomial.evalRingHom t).comp Polynomial.C = RingHom.id ℂ := by ext; simp + rw [hc, MvPolynomial.eval₂_id] + congr 2 + funext k + by_cases h : k = j <;> simp [h, Function.update] + +lemma variablePolynomial_pderiv {σ : Type*} (p : MvPolynomial σ ℂ) (z : σ → ℂ) (j : σ) : + variablePolynomial (MvPolynomial.pderiv j p) z j = + (variablePolynomial p z j).derivative := by + induction p using MvPolynomial.induction_on with + | C c => simp [variablePolynomial] + | add p q hp hq => + simpa only [map_add, variablePolynomial, MvPolynomial.eval₂_add, Polynomial.derivative_add] + using congrArg₂ (· + ·) hp hq + | mul_X p k hp => + simp only [MvPolynomial.pderiv_mul, variablePolynomial, MvPolynomial.eval₂_add, + MvPolynomial.eval₂_mul, MvPolynomial.eval₂_X, Polynomial.derivative_mul] + rw [show MvPolynomial.eval₂ Polynomial.C + (fun k => if k = j then Polynomial.X else Polynomial.C (z k)) (MvPolynomial.pderiv j p) = + variablePolynomial (MvPolynomial.pderiv j p) z j from rfl, hp] + by_cases h : k = j + · subst k + simp [variablePolynomial] + · simp [h, MvPolynomial.pderiv_X_of_ne h, variablePolynomial] + +lemma polynomial_logDerivative_im_nonpos {p : Polynomial ℂ} + (hp : ∀ z : ℂ, 0 < z.im → p.eval z ≠ 0) {z : ℂ} (hz : 0 < z.im) : + (p.derivative.eval z / p.eval z).im ≤ 0 := by + have hpz := hp z hz + have hp0 : p ≠ 0 := by intro h; simp [h] at hpz + rw [(IsAlgClosed.splits p).eval_derivative_div_eval_of_ne_zero hpz] + have hterm : ∀ w ∈ p.roots, (1 / (z - w)).im ≤ 0 := by + intro w hw + have hw0 : p.eval w = 0 := (Polynomial.mem_roots hp0).mp hw + have hwim : w.im ≤ 0 := by + by_contra h + exact hp w (lt_of_not_ge h) hw0 + rw [one_div, Complex.inv_im] + apply div_nonpos_of_nonpos_of_nonneg + · simp only [Complex.sub_im] + linarith + · exact Complex.normSq_nonneg _ + generalize p.roots = s at * + induction s using Multiset.induction_on with + | empty => simp + | @cons w s ih => + simp only [Multiset.map_cons, Multiset.sum_cons, Complex.add_im] + exact add_nonpos (hterm w (Multiset.mem_cons_self _ _)) + (ih (fun v hv => hterm v (Multiset.mem_cons_of_mem hv))) + +lemma stable_add_imaginary_derivative {σ : Type*} {p : MvPolynomial σ ℂ} + (hp : Stable p) (j : σ) {r : ℝ} (hr : 0 < r) : + Stable (MvPolynomial.C (r : ℂ) * p + MvPolynomial.C Complex.I * MvPolynomial.pderiv j p) := by + intro z hz heq + have hpz := hp z hz + let q := variablePolynomial p z j + have hq : ∀ t : ℂ, 0 < t.im → q.eval t ≠ 0 := by + intro t ht + rw [variablePolynomial_eval] + apply hp + intro k + by_cases hk : k = j + · subst k; simpa using ht + · simpa [Function.update_of_ne hk] using hz k + have hlog := polynomial_logDerivative_im_nonpos hq (hz j) + have hv : Function.update z j (z j) = z := Function.update_eq_self j z + rw [show q = variablePolynomial p z j from rfl, + ← variablePolynomial_pderiv, variablePolynomial_eval, variablePolynomial_eval, hv] at hlog + simp only [map_add, map_mul, MvPolynomial.eval_C] at heq + have hdiv : (r : ℂ) + Complex.I * + (MvPolynomial.eval z (MvPolynomial.pderiv j p) / MvPolynomial.eval z p) = 0 := by + apply (mul_left_inj' hpz).mp + rw [add_mul, mul_assoc, div_mul_cancel₀ _ hpz, zero_mul] + exact heq + have hreal := congrArg Complex.re hdiv + simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, + Complex.I_im, zero_mul, one_mul, zero_sub, Complex.zero_re] at hreal + linarith + +theorem stable_pderiv {σ : Type*} [Fintype σ] {p : MvPolynomial σ ℂ} + (hp : Stable p) (j : σ) : MvPolynomial.pderiv j p = 0 ∨ Stable (MvPolynomial.pderiv j p) := by + by_cases hzero : MvPolynomial.pderiv j p = 0 + · exact Or.inl hzero + right + let q := MvPolynomial.C Complex.I * MvPolynomial.pderiv j p + have hq0 : q ≠ 0 := mul_ne_zero (MvPolynomial.C_ne_zero.mpr Complex.I_ne_zero) hzero + have hc : Tendsto (fun r : ℝ => (r : ℂ)) (𝓝[>] (0 : ℝ)) (𝓝 (0 : ℂ)) := + (Complex.continuous_ofReal.tendsto 0).mono_left nhdsWithin_le_nhds + have hq : Stable q := by + apply stable_locallyUniform_limit (φ := 𝓝[>] (0 : ℝ)) + (P := fun r => MvPolynomial.C (r : ℂ) * p + q) hq0 + · have hconv := ((hc.tendstoUniformlyOn_const Upper).tendstoLocallyUniformlyOn.mul₀ + (locallyUniform_const (𝓝[>] (0 : ℝ)) (fun z => MvPolynomial.eval z p) Upper) + continuousOn_const p.continuous_eval.continuousOn).add + (locallyUniform_const (𝓝[>] (0 : ℝ)) (fun z => MvPolynomial.eval z q) Upper) + change TendstoLocallyUniformlyOn + (fun (r : ℝ) (z : σ → ℂ) => (r : ℂ) * MvPolynomial.eval z p + MvPolynomial.eval z q) + (fun z => (0 : ℂ) * MvPolynomial.eval z p + MvPolynomial.eval z q) + (𝓝[>] (0 : ℝ)) Upper at hconv + simpa only [zero_mul, zero_add, map_add, map_mul, MvPolynomial.eval_C] using hconv + · filter_upwards [self_mem_nhdsWithin] with r hr + exact stable_add_imaginary_derivative hp j hr + intro z hz hv + apply hq z hz + simp [q, hv] + +end Heisenberg.Pin +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/StableSections.lean b/lean/OAI/MathematicalPhysics/Heisenberg/StableSections.lean new file mode 100644 index 0000000000000000000000000000000000000000..af0cda87e3f50fc8384ed58ee5cb5fa4303a624c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/StableSections.lean @@ -0,0 +1,253 @@ +import OAI.MathematicalPhysics.Heisenberg.StablePolynomials + +namespace OAI + +noncomputable section +open scoped Classical Topology +open Set Filter Metric + +open scoped ComplexConjugate +namespace Heisenberg.Pin + +section + +def biaffine (a b c e z w : ℂ) : ℂ := a + b * z + c * w + e * z * w + +def StableSection (a b c e : ℂ) : Prop := + ∀ z w : ℂ, 0 < z.im → 0 < w.im → biaffine a b c e z w ≠ 0 + +def rootCriterion (a b c e z : ℂ) : ℝ := + ((a + b * z) * conj (c + e * z)).im + +lemma quotient_im (x y : ℂ) : + (-(x / y)).im = -((x * conj y).im) / Complex.normSq y := by + simp only [Complex.neg_im, Complex.div_im, Complex.mul_im, + Complex.conj_re, Complex.conj_im] + ring + +lemma section_swap {a b c e : ℂ} (h : StableSection a b c e) : + StableSection a c b e := by + intro z w hz hw + have hs := h w z hw hz + have he : biaffine a c b e z w = biaffine a b c e w z := by + unfold biaffine + ring + exact he ▸ hs + +lemma rootCriterion_nonneg {a b c e : ℂ} (h : StableSection a b c e) + {z : ℂ} (hz : 0 < z.im) : 0 ≤ rootCriterion a b c e z := by + by_cases hc : c + e * z = 0 + · simp [rootCriterion, hc] + · by_contra hn + have hn' : rootCriterion a b c e z < 0 := lt_of_not_ge hn + have hip : 0 < (-( (a + b * z) / (c + e * z))).im := by + rw [quotient_im] + exact div_pos (neg_pos.mpr hn') (Complex.normSq_pos.mpr hc) + apply h z (-( (a + b * z) / (c + e * z))) hz hip + calc + _ = (a + b * z) - ((a + b * z) / (c + e * z)) * (c + e * z) := by + unfold biaffine + ring + _ = 0 := by rw [div_mul_cancel₀ _ hc, sub_self] + +lemma symmetrization_identity (a b c e z : ℂ) (u : ℝ) : + rootCriterion a ((1 - (u : ℂ)) * b + (u : ℂ) * c) + ((1 - (u : ℂ)) * c + (u : ℂ) * b) e z = + (1 - u) * rootCriterion a b c e z + u * rootCriterion a c b e z + + u * (1 - u) * Complex.normSq (b - c) * z.im := by + simp only [rootCriterion, Complex.add_re, Complex.add_im, Complex.sub_re, + Complex.sub_im, Complex.mul_re, Complex.mul_im, Complex.conj_re, + Complex.conj_im, Complex.ofReal_re, Complex.ofReal_im, Complex.one_re, + Complex.one_im, Complex.normSq_apply] + ring + +lemma criterion_ne_zero {a b c e z w : ℂ} + (hn : 0 < rootCriterion a b c e z) (hw : 0 < w.im) : + biaffine a b c e z w ≠ 0 := by + intro he + have hc : c + e * z ≠ 0 := by + intro hc + simp [rootCriterion, hc] at hn + have hw' : w = -((a + b * z) / (c + e * z)) := by + rw [← neg_div] + apply (eq_div_iff hc).mpr + dsimp [biaffine] at he + linear_combination he + rw [hw', quotient_im] at hw + have hneg : -rootCriterion a b c e z / Complex.normSq (c + e * z) < 0 := + div_neg_of_neg_of_pos (neg_neg_of_pos hn) (Complex.normSq_pos.mpr hc) + exact (not_lt_of_ge hneg.le) hw + +theorem partial_symmetrization {a b c e : ℂ} (h : StableSection a b c e) + {u : ℝ} (hu0 : 0 ≤ u) (hu1 : u ≤ 1) : + StableSection a ((1 - (u : ℂ)) * b + (u : ℂ) * c) + ((1 - (u : ℂ)) * c + (u : ℂ) * b) e := by + by_cases hu : u = 0 + · simpa [hu] using h + by_cases hv : u = 1 + · simpa [hv] using section_swap h + by_cases hbc : b = c + · have hb : (1 - (u : ℂ)) * b + (u : ℂ) * c = b := by rw [← hbc]; ring + have hc : (1 - (u : ℂ)) * c + (u : ℂ) * b = c := by rw [hbc]; ring + rw [hb, hc] + exact h + intro z w hz hw + apply criterion_ne_zero (hw := hw) + rw [symmetrization_identity] + have h₁ := rootCriterion_nonneg h hz + have h₂ := rootCriterion_nonneg (section_swap h) hz + have hp : 0 < u * (1 - u) * Complex.normSq (b - c) * z.im := by + exact mul_pos (mul_pos (mul_pos (lt_of_le_of_ne hu0 (Ne.symm hu)) + (sub_pos.mpr (lt_of_le_of_ne hu1 hv))) + (Complex.normSq_pos.mpr (sub_ne_zero.mpr hbc))) hz + exact add_pos_of_nonneg_of_pos (add_nonneg (mul_nonneg (sub_nonneg.mpr hu1) h₁) + (mul_nonneg hu0 h₂)) hp + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +def subsetMonomial (A : Finset σ) : MvPolynomial σ ℂ := ∏ i ∈ A, MvPolynomial.X i + +omit [Fintype σ] [DecidableEq σ] in +@[simp] lemma subsetMonomial_empty : subsetMonomial (∅ : Finset σ) = 1 := by + simp [subsetMonomial] + +omit [Fintype σ] in +lemma subsetMonomial_insert (i : σ) (A : Finset σ) (hi : i ∉ A) : + subsetMonomial (insert i A) = MvPolynomial.X i * subsetMonomial A := by + simp [subsetMonomial, hi] + +omit [Fintype σ] in +lemma pderiv_subsetMonomial (i : σ) (A : Finset σ) : + MvPolynomial.pderiv i (subsetMonomial A) = + if i ∈ A then subsetMonomial (A.erase i) else 0 := by + induction A using Finset.induction_on with + | empty => simp + | @insert a A ha ih => + rw [subsetMonomial_insert a A ha, Derivation.leibniz, ih] + simp only [smul_eq_mul] + by_cases hia : i = a + · subst a + simp [ha] + · simp only [MvPolynomial.pderiv_X_of_ne (Ne.symm hia), mul_zero, add_zero, + Finset.mem_insert, hia, false_or] + by_cases hi : i ∈ A + · rw [ite_eq_left hi, ite_eq_left hi, Finset.erase_insert_of_ne (Ne.symm hia)] + rw [subsetMonomial_insert a (A.erase i) (fun h => ha (Finset.mem_of_mem_erase h))] + · simp [hi] + +def presence (μ : Finset σ → ℝ) (B : Finset σ) : ℝ := + ∑ A : Finset σ, if B ⊆ A then μ A else 0 + +def presencePolynomial (μ : Finset σ → ℝ) (B : Finset σ) : MvPolynomial σ ℂ := + ∑ A : Finset σ, if B ⊆ A then MvPolynomial.C (μ A : ℂ) * subsetMonomial (A \ B) else 0 + +lemma eval_presencePolynomial_one (μ : Finset σ → ℝ) (B : Finset σ) : + MvPolynomial.eval (fun _ => 1) (presencePolynomial μ B) = (presence μ B : ℂ) := by + simp [presencePolynomial, presence, subsetMonomial, apply_ite] + +lemma pderiv_presencePolynomial (μ : Finset σ → ℝ) (B : Finset σ) (i : σ) + (hi : i ∉ B) : + MvPolynomial.pderiv i (presencePolynomial μ B) = presencePolynomial μ (insert i B) := by + unfold presencePolynomial + rw [map_sum] + apply Finset.sum_congr rfl + intro A _ + by_cases hB : B ⊆ A + · by_cases hiA : i ∈ A + · rw [ite_eq_left hB, ite_eq_left (Finset.insert_subset hiA hB), MvPolynomial.pderiv_C_mul, + pderiv_subsetMonomial, ite_eq_left (Finset.mem_sdiff.mpr ⟨hiA, hi⟩)] + congr 2 + ext j + simp only [Finset.mem_erase, Finset.mem_sdiff, Finset.mem_insert] + tauto + · rw [ite_eq_left hB, ite_eq_right (fun h => hiA (h (Finset.mem_insert_self _ _))), MvPolynomial.pderiv_C_mul, + pderiv_subsetMonomial, ite_eq_right (fun h => hiA (Finset.mem_sdiff.mp h).1), mul_zero] + · have hB' : ¬ insert i B ⊆ A := fun h => hB (Finset.Subset.trans (Finset.subset_insert _ _) h) + simp [hB, hB'] + +lemma presence_nonneg {μ : Finset σ → ℝ} (hμ : ∀ A, 0 ≤ μ A) (B : Finset σ) : + 0 ≤ presence μ B := by + unfold presence + exact Finset.sum_nonneg fun A _ => by split_ifs; exact hμ A; exact le_rfl + +lemma presence_polynomial_ne_zero {μ : Finset σ → ℝ} {B : Finset σ} + (hB : 0 < presence μ B) : presencePolynomial μ B ≠ 0 := by + intro h + have hv := eval_presencePolynomial_one μ B + rw [h, map_zero] at hv + exact hB.ne' (by exact_mod_cast hv.symm) + +theorem stable_presencePolynomial {μ : Finset σ → ℝ} + (hs : Stable (presencePolynomial μ ∅)) (B : Finset σ) : + presencePolynomial μ B = 0 ∨ Stable (presencePolynomial μ B) := by + induction B using Finset.induction_on with + | empty => exact Or.inr hs + | @insert i B hi ih => + rw [← pderiv_presencePolynomial μ B i hi] + rcases ih with h | h + · simp [h] + · exact stable_pderiv h i + +end + +def boundarySection {σ τ : Type*} (p : MvPolynomial σ ℂ) (f : σ → Option τ) + (a : σ → ℂ) : MvPolynomial τ ℂ := + MvPolynomial.eval₂ MvPolynomial.C + (fun j => (f j).elim (MvPolynomial.C (a j)) MvPolynomial.X) p + +lemma eval_boundarySection {σ τ : Type*} (p : MvPolynomial σ ℂ) + (f : σ → Option τ) (a : σ → ℂ) (z : τ → ℂ) : + MvPolynomial.eval z (boundarySection p f a) = + MvPolynomial.eval (fun j => (f j).elim (a j) z) p := by + rw [boundarySection, MvPolynomial.eval_eval₂] + have hc : (MvPolynomial.eval z).comp MvPolynomial.C = RingHom.id ℂ := by ext; simp + simp only [hc, MvPolynomial.eval₂_id] + apply congrArg (fun z => MvPolynomial.eval z p) + funext j + cases f j <;> simp + +theorem stable_boundarySection {σ τ : Type*} [Fintype τ] + {p : MvPolynomial σ ℂ} (hp : Stable p) (f : σ → Option τ) (a : σ → ℝ) + (hn : boundarySection p f (fun j => (a j : ℂ)) ≠ 0) : + Stable (boundarySection p f (fun j => (a j : ℂ))) := by + let ar : ℝ → σ → ℂ := fun r j => (a j : ℂ) + (r : ℂ) * Complex.I + apply stable_locallyUniform_limit (φ := 𝓝[>] (0 : ℝ)) + (P := fun r => boundarySection p f (ar r)) hn + · simp_rw [eval_boundarySection] + apply locallyUniform_eval + · intro j + cases h : f j with + | none => + simp only [Option.elim_none] + have ht : Tendsto (fun r : ℝ => ar r j) (𝓝[>] 0) (𝓝 (a j : ℂ)) := by + have hc : Continuous (fun r : ℝ => ar r j) := by fun_prop + simpa [ar] using (hc.tendsto 0).mono_left (nhdsWithin_le_nhds (s := Set.Ioi 0)) + exact (ht.tendstoUniformlyOn_const Upper).tendstoLocallyUniformlyOn + | some k => + simp only [Option.elim_some] + exact locallyUniform_const _ _ _ + · apply Continuous.continuousOn + apply continuous_pi + intro j + cases h : f j <;> simp only [Option.elim_none, Option.elim_some] <;> fun_prop + · filter_upwards [self_mem_nhdsWithin] with r hr z hz + rw [eval_boundarySection] + apply hp + intro j + cases h : f j with + | none => simpa [h, ar] using hr + | some k => simpa [h] using hz k + +lemma stable_section_real_rayleigh {a b c e : ℝ} + (h : StableSection (a : ℂ) (b : ℂ) (c : ℂ) (e : ℂ)) : a * e ≤ b * c := by + have hn := rootCriterion_nonneg h (z := Complex.I) (by simp) + have he : rootCriterion (a : ℂ) (b : ℂ) (c : ℂ) (e : ℂ) Complex.I = b * c - a * e := by + simp [rootCriterion, Complex.mul_im, Complex.mul_re] + ring + rw [he] at hn + linarith + +end Heisenberg.Pin +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/StateCompactness.lean b/lean/OAI/MathematicalPhysics/Heisenberg/StateCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..e67cba372a31ed59493834b36e1733847e84dc92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/StateCompactness.lean @@ -0,0 +1,510 @@ +import OAI.MathematicalPhysics.Heisenberg.ThermodynamicDynamics + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators +open Filter Topology Metric +open scoped NNReal +open scoped NNReal + +namespace Heisenberg +instance quasiLocalClosed (d ℓ : ℕ) : IsClosed (quasiLocalAlgebra d ℓ : Set (SpinOperator d ℓ)) := + StarSubalgebra.isClosed_topologicalClosure _ + +theorem countable_monoidClosure {M : Type*} [Monoid M] {s : Set M} + (hs : s.Countable) : (Submonoid.closure s : Set M).Countable := by + have : Countable s := hs.to_subtype + let f : List s → M := fun l => (l.map Subtype.val).prod + apply (Set.countable_range f).mono + intro x hx + induction hx using Submonoid.closure_induction with + | mem x hx => exact ⟨[⟨x, hx⟩], by simp [f]⟩ + | one => exact ⟨[], rfl⟩ + | mul x y hx hy ihx ihy => + obtain ⟨l, rfl⟩ := ihx + obtain ⟨k, rfl⟩ := ihy + exact ⟨l ++ k, by simp [f]⟩ + +instance quasiLocalSeparable (d ℓ : ℕ) : TopologicalSpace.SeparableSpace (QuasiLocal d ℓ) := by + let s : Set (SpinOperator d ℓ) := {A | ∃ x a b, A = matrixUnit d ℓ x a b} + have hs : s.Countable := by + have h := Set.countable_range (fun p : Site d × Level ℓ × Level ℓ => + matrixUnit d ℓ p.1 p.2.1 p.2.2) + apply h.mono + rintro A ⟨x, a, b, rfl⟩ + exact ⟨⟨x,a,b⟩, rfl⟩ + have hu : (s ∪ star s).Countable := hs.union (by simpa only [Set.image_star] using hs.image star) + have hsep := (countable_monoidClosure hu).isSeparable.span (R := ℂ) + have hadj : TopologicalSpace.IsSeparable (StarAlgebra.adjoin ℂ s : Set (SpinOperator d ℓ)) := by + change TopologicalSpace.IsSeparable + ((StarAlgebra.adjoin ℂ s).toSubalgebra.toSubmodule : Set (SpinOperator d ℓ)) + rw [StarAlgebra.adjoin_eq_span] + exact hsep + have hc : TopologicalSpace.IsSeparable (quasiLocalAlgebra d ℓ : Set (SpinOperator d ℓ)) := by + change TopologicalSpace.IsSeparable ((StarAlgebra.adjoin ℂ s).topologicalClosure : Set (SpinOperator d ℓ)) + rw [StarSubalgebra.topologicalClosure_coe] + exact hadj.closure + exact hc.separableSpace + +open scoped ComplexOrder + +theorem positive_norm_bound {E : Type*} [CStarAlgebra E] [PartialOrder E] + [StarOrderedRing E] (φ : E →L[ℂ] ℂ) (hn : φ 1 = 1) + (hpos : ∀ B, 0 ≤ φ (star B * B)) : ‖φ‖ ≤ 4 := by + have hp : ∀ A : E, 0 ≤ A → 0 ≤ φ A := by + intro A hA + obtain ⟨B, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hA + exact hpos B + let f : E →ₚ[ℂ] ℂ := + { φ.toLinearMap with + monotone' := by + intro A B h + change φ A ≤ φ B + have h' := hp (B - A) (sub_nonneg.mpr h) + simpa only [map_sub, sub_nonneg] using h' } + apply ContinuousLinearMap.opNorm_le_bound _ (by norm_num) + intro A + obtain ⟨x, hx, hnorm, hA⟩ := CStarAlgebra.exists_sum_four_nonneg A + conv_lhs => rw [hA, map_sum] + calc + ‖∑ i : Fin 4, φ (Complex.I ^ (i : ℕ) • x i)‖ ≤ + ∑ i : Fin 4, ‖φ (Complex.I ^ (i : ℕ) • x i)‖ := norm_sum_le _ _ + _ ≤ ∑ _i : Fin 4, ‖A‖ := by + apply Finset.sum_le_sum + intro i _ + rw [map_smul, norm_smul, norm_pow, Complex.norm_I, one_pow, one_mul] + have hi := PositiveLinearMap.norm_apply_le_of_nonneg f (x i) (hx i) + change ‖φ (x i)‖ ≤ ‖φ 1‖ * ‖x i‖ at hi + simpa only [hn, norm_one, one_mul] using hi.trans + (by simpa only [hn, norm_one, one_mul] using hnorm i) + _ = 4 * ‖A‖ := by simp + +theorem state_norm_bound {d ℓ : ℕ} (ω : State d ℓ) : ‖ω.functional‖ ≤ 4 := by + let : PartialOrder (QuasiLocal d ℓ) := CStarAlgebra.spectralOrder _ + let : StarOrderedRing (QuasiLocal d ℓ) := CStarAlgebra.spectralOrderedRing _ + exact positive_norm_bound ω.functional ω.normalized + (fun B => ⟨(ω.positive B).2, by simpa using (ω.positive B).1.symm⟩) + +open Filter in +theorem bounded_functionals_subsequence {E : Type*} [NormedAddCommGroup E] + [NormedSpace ℂ E] [TopologicalSpace.SeparableSpace E] + (φ : ℕ → E →L[ℂ] ℂ) (C : ℝ) (hb : ∀ n, ‖φ n‖ ≤ C) : + ∃ ψ : E →L[ℂ] ℂ, ∃ κ : ℕ → ℕ, StrictMono κ ∧ + ∀ A : E, Tendsto (fun n => φ (κ n) A) atTop (nhds (ψ A)) := by + let u : ℕ → WeakDual ℂ E := fun n => WeakDual.toStrongDual.symm (φ n) + have hu : ∀ n, u n ∈ WeakDual.toStrongDual ⁻¹' Metric.closedBall 0 C := by + intro n + simpa only [Set.mem_preimage, Metric.mem_closedBall, dist_zero_right, + u, LinearEquiv.apply_symm_apply] using hb n + obtain ⟨ψ, _, κ, hκ, hlim⟩ := WeakDual.isSeqCompact_closedBall ℂ E 0 C hu + exact ⟨WeakDual.toStrongDual ψ, κ, hκ, + fun A => (WeakDual.eval_continuous A).tendsto ψ |>.comp hlim⟩ + +open Filter in + +theorem state_subsequence {d ℓ : ℕ} (ω : ℕ → State d ℓ) : + ∃ η : State d ℓ, ∃ κ : ℕ → ℕ, StrictMono κ ∧ + ∀ A : QuasiLocal d ℓ, Tendsto (fun n => (ω (κ n)).functional A) + atTop (nhds (η.functional A)) := by + obtain ⟨ψ, κ, hκ, hA⟩ := bounded_functionals_subsequence + (fun n => (ω n).functional) 4 (fun n => state_norm_bound (ω n)) + have hn : ψ 1 = 1 := by + have h := hA 1 + simp only [(ω _).normalized] at h + exact tendsto_nhds_unique h tendsto_const_nhds + have hp (A : QuasiLocal d ℓ) : (ψ (star A * A)).im = 0 ∧ 0 ≤ (ψ (star A * A)).re := by + constructor + · have h := Complex.continuous_im.tendsto _ |>.comp (hA (star A * A)) + change Tendsto (fun n => ((ω (κ n)).functional (star A * A)).im) atTop + (nhds ((ψ (star A * A)).im)) at h + simp only [((ω _).positive A).1] at h + exact tendsto_nhds_unique h tendsto_const_nhds + · exact ge_of_tendsto (Complex.continuous_re.tendsto _ |>.comp (hA (star A * A))) + (Filter.Eventually.of_forall fun n => ((ω (κ n)).positive A).2) + exact ⟨⟨ψ, hn, hp⟩, κ, hκ, hA⟩ + +open scoped InnerProductSpace + +def operatorInclusion (d ℓ : ℕ) : QuasiLocal d ℓ →L[ℂ] SpinOperator d ℓ := + (quasiLocalAlgebra d ℓ).toSubalgebra.toSubmodule.subtypeL + +def vectorFunctional {d ℓ : ℕ} (v : SpinHilbert d ℓ) : QuasiLocal d ℓ →L[ℂ] ℂ := + (innerSL ℂ v).comp ((ContinuousLinearMap.apply ℂ (SpinHilbert d ℓ) v).comp + (operatorInclusion d ℓ)) + +@[simp] theorem vectorFunctional_apply {d ℓ : ℕ} (v : SpinHilbert d ℓ) + (A : QuasiLocal d ℓ) : vectorFunctional v A = ⟪v, (A : SpinOperator d ℓ) v⟫_ℂ := rfl + +def vectorState {d ℓ : ℕ} (v : SpinHilbert d ℓ) (hv : ‖v‖ = 1) : State d ℓ where + functional := vectorFunctional v + normalized := by + change ⟪v, v⟫_ℂ = 1 + rw [inner_self_eq_norm_sq_to_K, hv] + norm_num + positive A := by + have h : vectorFunctional v (star A * A) = + ⟪(A : SpinOperator d ℓ) v, (A : SpinOperator d ℓ) v⟫_ℂ := by + change ⟪v, (star (A : SpinOperator d ℓ)) ((A : SpinOperator d ℓ) v)⟫_ℂ = _ + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_right] + rw [h] + exact ⟨inner_self_im (𝕜 := ℂ) _, inner_self_nonneg (𝕜 := ℂ)⟩ + +def configVector {d ℓ : ℕ} (c : Configuration d ℓ) : SpinHilbert d ℓ := + lp.single 2 c 1 + +@[simp] theorem norm_configVector {d ℓ : ℕ} (c : Configuration d ℓ) : + ‖configVector c‖ = 1 := by + simp [configVector, lp.norm_single (by norm_num : (0 : ℝ≥0∞) < 2)] + +@[simp] theorem vectorFunctional_configVector {d ℓ : ℕ} (c : Configuration d ℓ) + (A : QuasiLocal d ℓ) : vectorFunctional (configVector c) A = + (A : SpinOperator d ℓ) (configVector c) c := by + simp [vectorFunctional_apply, configVector, lp.inner_single_left] + +abbrev FiniteConfiguration {d : ℕ} (ℓ : ℕ) (F : Finset (Site d)) := F → Level ℓ + +def extendConfig {d ℓ : ℕ} (F : Finset (Site d)) (c : FiniteConfiguration ℓ F) : + Configuration d ℓ := + Finsupp.onFinset F (fun x => if hx : x ∈ F then c ⟨x,hx⟩ else 0) + (by intro x; contrapose!; simp_all) + +@[simp] theorem extendConfig_apply {d ℓ : ℕ} (F : Finset (Site d)) + (c : FiniteConfiguration ℓ F) (x : Site d) : + extendConfig F c x = if hx : x ∈ F then c ⟨x,hx⟩ else 0 := by + rfl + +def finiteTraceFunctional (d ℓ : ℕ) (F : Finset (Site d)) : QuasiLocal d ℓ →L[ℂ] ℂ := + (Fintype.card (FiniteConfiguration ℓ F) : ℂ)⁻¹ • + ∑ c : FiniteConfiguration ℓ F, vectorFunctional (configVector (extendConfig F c)) + +@[simp] theorem finiteTraceFunctional_apply (d ℓ : ℕ) (F : Finset (Site d)) + (A : QuasiLocal d ℓ) : finiteTraceFunctional d ℓ F A = + (Fintype.card (FiniteConfiguration ℓ F) : ℂ)⁻¹ * + ∑ c : FiniteConfiguration ℓ F, (A : SpinOperator d ℓ) + (configVector (extendConfig F c)) (extendConfig F c) := by + simp only [finiteTraceFunctional, smul_apply, sum_apply, smul_eq_mul, + vectorFunctional_configVector] + +def finiteTraceState (d ℓ : ℕ) (F : Finset (Site d)) : State d ℓ where + functional := finiteTraceFunctional d ℓ F + normalized := by + have hcard : (Fintype.card (FiniteConfiguration ℓ F) : ℂ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have h (c : FiniteConfiguration ℓ F) : + vectorFunctional (configVector (extendConfig F c)) 1 = 1 := + (vectorState _ (norm_configVector _)).normalized + simp only [finiteTraceFunctional, smul_apply, sum_apply, h, Finset.sum_const, + Finset.card_univ, nsmul_eq_mul, mul_one, smul_eq_mul] + exact inv_mul_cancel₀ hcard + positive A := by + have h (c : FiniteConfiguration ℓ F) := + (vectorState (configVector (extendConfig F c)) (norm_configVector _)).positive A + change ((finiteTraceFunctional d ℓ F) (star A * A)).im = 0 ∧ + 0 ≤ ((finiteTraceFunctional d ℓ F) (star A * A)).re + simp only [finiteTraceFunctional, smul_apply, + sum_apply, smul_eq_mul] + simp only [← Complex.ofReal_natCast, ← Complex.ofReal_inv, Complex.mul_im, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, add_zero, + Complex.mul_re, sub_zero] + rw [Complex.im_sum, Complex.re_sum] + constructor + · convert mul_zero ((Fintype.card (FiniteConfiguration ℓ F) : ℝ)⁻¹) using 1 + congr 1 + apply Finset.sum_eq_zero + intro c _ + exact (h c).1 + · exact mul_nonneg (inv_nonneg.mpr (Nat.cast_nonneg _)) + (Finset.sum_nonneg fun c _ => (h c).2) + +@[simp] theorem configVector_apply {d ℓ : ℕ} (c z : Configuration d ℓ) : + configVector c z = if z = c then 1 else 0 := by + simp only [configVector, lp.single_apply, Pi.single_apply, eq_comm] + +@[simp] theorem matrixUnit_configVector {d ℓ : ℕ} (x : Site d) (a b : Level ℓ) + (c : Configuration d ℓ) : matrixUnit d ℓ x a b (configVector c) = + if c x = b then configVector (c.update x a) else 0 := by + ext z + simp only [matrixUnit_apply, configVector_apply] + by_cases hc : c x = b + · simp only [hc, ite_true, configVector_apply] + by_cases hz : z x = a + · simp only [hz, ite_true] + have hh : z.update x b = c ↔ z = c.update x a := by + constructor + · intro he + have hh := congrArg (fun q : Configuration d ℓ => q.update x a) he + simpa only [Finsupp.update_idem, ← hz, Finsupp.update_self] using hh + · rintro rfl + simp [← hc] + simp only [hh] + · have hne : z ≠ c.update x a := by + intro he + have hh := congrArg (fun q : Configuration d ℓ => q x) he + simp only [Finsupp.update_apply, ite_true] at hh + exact hz hh + simp [hz, hne] + · simp only [hc, ite_false, lp.coeFn_zero, Pi.zero_apply] + have hne : z.update x b ≠ c := by + intro he + have hh := congrArg (fun q : Configuration d ℓ => q x) he + simp only [Finsupp.update_apply, ite_true] at hh + exact hc hh.symm + simp [hne] + +def finiteConfigPerm {d ℓ : ℕ} {F : Finset (Site d)} (x : F) + (σ : Equiv.Perm (Level ℓ)) : Equiv.Perm (FiniteConfiguration ℓ F) where + toFun c := Function.update c x (σ (c x)) + invFun c := Function.update c x (σ.symm (c x)) + left_inv c := by ext y; by_cases h : y = x <;> simp [h] + right_inv c := by ext y; by_cases h : y = x <;> simp [h] + +@[simp] theorem extendConfig_perm {d ℓ : ℕ} {F : Finset (Site d)} (x : F) + (σ : Equiv.Perm (Level ℓ)) (c : FiniteConfiguration ℓ F) : + extendConfig F (finiteConfigPerm x σ c) = + (extendConfig F c).update x (σ (c x)) := by + ext y + by_cases h : y = x + · subst y + simp [extendConfig_apply, finiteConfigPerm, Finsupp.update_apply, x.property] + · by_cases hy : y ∈ F + · have hn : (⟨y, hy⟩ : F) ≠ x := fun he => h (congrArg Subtype.val he) + simp [extendConfig_apply, finiteConfigPerm, + Finsupp.update_apply, hy, h, hn] + · simp [extendConfig_apply, Finsupp.update_apply, hy, h] + +theorem finiteTraceFunctional_cyclic_unit {d ℓ : ℕ} (F : Finset (Site d)) + {x : Site d} (hx : x ∈ F) (a b : Level ℓ) (A : QuasiLocal d ℓ) : + finiteTraceFunctional d ℓ F (localUnit d ℓ x a b * A) = + finiteTraceFunctional d ℓ F (A * localUnit d ℓ x a b) := by + simp only [finiteTraceFunctional_apply] + congr 1 + let e := finiteConfigPerm (⟨x,hx⟩ : F) (Equiv.swap a b) + rw [← Equiv.sum_comp e] + apply Finset.sum_congr rfl + intro c _ + change (matrixUnit d ℓ x a b) ((A : SpinOperator d ℓ) + (configVector (extendConfig F (e c)))) (extendConfig F (e c)) = + (A : SpinOperator d ℓ) ((matrixUnit d ℓ x a b) + (configVector (extendConfig F c))) (extendConfig F c) + rw [matrixUnit_apply, matrixUnit_configVector] + have hext : extendConfig F (e c) = (extendConfig F c).update x + (Equiv.swap a b (c ⟨x,hx⟩)) := extendConfig_perm _ _ _ + have hcx : extendConfig F c x = c ⟨x,hx⟩ := by simp [hx] + rw [hext] + simp only [Finsupp.update_apply, ite_true, Equiv.swap_apply_eq_iff, Equiv.swap_apply_left, hcx] + by_cases hc : c ⟨x,hx⟩ = b + · simp only [hc, ite_true, Equiv.swap_apply_right, Finsupp.update_idem] + rw [← hc, ← hcx, Finsupp.update_self] + · simp only [hc, ite_false, map_zero, lp.coeFn_zero, Pi.zero_apply] + +theorem cyclic_adjoin {E : Type*} [NormedRing E] [NormedAlgebra ℂ E] + [StarRing E] [StarModule ℂ E] (φ : E →L[ℂ] ℂ) (s : Set E) + (h : ∀ a ∈ s, (∀ b, φ (a*b) = φ (b*a)) ∧ + (∀ b, φ (star a*b) = φ (b*star a))) + {a : E} (ha : a ∈ StarAlgebra.adjoin ℂ s) : + (∀ b, φ (a*b) = φ (b*a)) ∧ (∀ b, φ (star a*b) = φ (b*star a)) := by + let P : E → Prop := fun a => ∀ b, φ (a*b) = φ (b*a) + have mulP (a c : E) (ha : P a) (hc : P c) : P (a*c) := by + intro b + calc + φ ((a*c)*b) = φ (a*(c*b)) := by rw [mul_assoc] + _ = φ ((c*b)*a) := ha _ + _ = φ (c*(b*a)) := by rw [mul_assoc] + _ = φ ((b*a)*c) := hc _ + _ = φ (b*(a*c)) := by rw [mul_assoc] + have addP (a c : E) (ha : P a) (hc : P c) : P (a+c) := by + intro b + simp only [add_mul, mul_add, map_add, ha b, hc b] + change P a ∧ P (star a) + induction ha using StarAlgebra.adjoin_induction with + | mem a ha => exact h a ha + | algebraMap z => + constructor <;> intro b <;> + simp [Algebra.algebraMap_eq_smul_one] + | add a c ha hc iha ihc => + exact ⟨addP a c iha.1 ihc.1, by rw [star_add]; exact addP _ _ iha.2 ihc.2⟩ + | mul a c ha hc iha ihc => + exact ⟨mulP a c iha.1 ihc.1, by rw [star_mul]; exact mulP _ _ ihc.2 iha.2⟩ + | star a ha iha => exact ⟨iha.2, by simpa only [star_star] using iha.1⟩ + +theorem cyclic_of_cyclic_units {d ℓ : ℕ} (φ : QuasiLocal d ℓ →L[ℂ] ℂ) + (h : ∀ x a b A, φ (localUnit d ℓ x a b * A) = φ (A * localUnit d ℓ x a b)) : + ∀ A B, φ (A*B) = φ (B*A) := by + intro A B + have hd : DenseRange ((↑) : localCore d ℓ → QuasiLocal d ℓ) := + denseRange_subtype_val.mpr (localCore_dense d ℓ) + refine hd.induction_on (p := fun C => φ (C*B) = φ (B*C)) A ?_ ?_ + · exact isClosed_eq (φ.continuous.comp (continuous_id.mul continuous_const)) + (φ.continuous.comp (continuous_const.mul continuous_id)) + · intro a + apply (cyclic_adjoin φ _ ?_ a.property).1 + rintro C ⟨x,a,b,rfl⟩ + exact ⟨h x a b, by simpa only [star_localUnit] using h x b a⟩ + +theorem exists_tracial_state (d ℓ : ℕ) : + ∃ τ : State d ℓ, ∀ A B, τ.functional (A*B) = τ.functional (B*A) := by + obtain ⟨τ,κ,hκ,hlim⟩ := state_subsequence (fun n => finiteTraceState d ℓ (box d n)) + refine ⟨τ, cyclic_of_cyclic_units τ.functional ?_⟩ + intro x a b A + have he : ∀ᶠ n : ℕ in Filter.atTop, + (finiteTraceState d ℓ (box d (κ n))).functional (localUnit d ℓ x a b*A) = + (finiteTraceState d ℓ (box d (κ n))).functional (A*localUnit d ℓ x a b) := by + filter_upwards [hκ.tendsto_atTop.eventually (eventually_mem_box x)] with n hn + exact finiteTraceFunctional_cyclic_unit _ hn a b A + exact tendsto_nhds_unique (hlim _) ((hlim _).congr' (Filter.EventuallyEq.symm he)) + +theorem positive_norm_le_four_one {E : Type*} [CStarAlgebra E] [PartialOrder E] + [StarOrderedRing E] (φ : E →L[ℂ] ℂ) + (hpos : ∀ B, 0 ≤ φ (star B * B)) : ‖φ‖ ≤ 4 * ‖φ 1‖ := by + have hp : ∀ A : E, 0 ≤ A → 0 ≤ φ A := by + intro A hA + obtain ⟨B, rfl⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp hA + exact hpos B + let f : E →ₚ[ℂ] ℂ := + { φ.toLinearMap with + monotone' := by + intro A B h + change φ A ≤ φ B + have h' := hp (B - A) (sub_nonneg.mpr h) + simpa only [map_sub, sub_nonneg] using h' } + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro A + obtain ⟨x, hx, hnorm, hA⟩ := CStarAlgebra.exists_sum_four_nonneg A + conv_lhs => rw [hA, map_sum] + calc + ‖∑ i : Fin 4, φ (Complex.I ^ (i : ℕ) • x i)‖ ≤ + ∑ i : Fin 4, ‖φ (Complex.I ^ (i : ℕ) • x i)‖ := norm_sum_le _ _ + _ ≤ ∑ _i : Fin 4, ‖φ 1‖ * ‖A‖ := by + apply Finset.sum_le_sum + intro i _ + rw [map_smul, norm_smul, norm_pow, Complex.norm_I, one_pow, one_mul] + exact (PositiveLinearMap.norm_apply_le_of_nonneg f (x i) (hx i)).trans + (mul_le_mul_of_nonneg_left (hnorm i) (norm_nonneg _)) + _ = (4 * ‖φ 1‖) * ‖A‖ := by simp; ring + +def sandwichFunctional {E : Type*} [CStarAlgebra E] (φ : E →L[ℂ] ℂ) (B : E) : + E →L[ℂ] ℂ := φ.comp (ContinuousLinearMap.mulLeftRight ℂ E (star B) B) + +@[simp] theorem sandwichFunctional_apply {E : Type*} [CStarAlgebra E] + (φ : E →L[ℂ] ℂ) (B A : E) : sandwichFunctional φ B A = φ (star B * A * B) := rfl + +theorem sandwichFunctional_positive {E : Type*} [CStarAlgebra E] + (φ : E →L[ℂ] ℂ) (hpos : ∀ B, 0 ≤ φ (star B * B)) (B A : E) : + 0 ≤ sandwichFunctional φ B (star A*A) := by + simpa only [sandwichFunctional_apply, star_mul, mul_assoc] using hpos (A*B) + +theorem sandwich_one_pos {E : Type*} [CStarAlgebra E] [PartialOrder E] + [StarOrderedRing E] (φ : E →L[ℂ] ℂ) (hn : φ 1 = 1) + (hpos : ∀ B, 0 ≤ φ (star B * B)) {B : E} (hB : IsUnit B) : + 0 < (sandwichFunctional φ B 1).re := by + have hp := hpos B + simp only [sandwichFunctional_apply, mul_one] + apply lt_of_le_of_ne hp.1 + intro hz + have hzero : φ (star B * B) = 0 := by + apply Complex.ext + · exact hz.symm + · exact hp.2.symm + have hnorm := positive_norm_le_four_one (sandwichFunctional φ B) + (sandwichFunctional_positive φ hpos B) + have hzfun : sandwichFunctional φ B = 0 := by + apply norm_eq_zero.mp + apply le_antisymm _ (norm_nonneg _) + simpa only [sandwichFunctional_apply, mul_one, hzero, norm_zero, mul_zero] using hnorm + obtain ⟨u, rfl⟩ := hB + have hh := congrArg (fun f : E →L[ℂ] ℂ => f (star (↑u⁻¹ : E) * (↑u⁻¹ : E))) hzfun + simp only [sandwichFunctional_apply, zero_apply] at hh + have hc : star (↑u : E) * (star (↑u⁻¹ : E) * (↑u⁻¹ : E)) * ↑u = 1 := by + calc + _ = star ((↑u⁻¹ : E) * ↑u) * ((↑u⁻¹ : E) * ↑u) := by rw [star_mul]; simp only [mul_assoc] + _ = 1 := by simp + rw [hc, hn] at hh + exact one_ne_zero hh + +def sandwichState {d ℓ : ℕ} (ω : State d ℓ) (B : QuasiLocal d ℓ) (hB : IsUnit B) : + State d ℓ := by + let : PartialOrder (QuasiLocal d ℓ) := CStarAlgebra.spectralOrder _ + let : StarOrderedRing (QuasiLocal d ℓ) := CStarAlgebra.spectralOrderedRing _ + have hp : ∀ C, 0 ≤ ω.functional (star C * C) := + fun C => ⟨(ω.positive C).2, by simpa using (ω.positive C).1.symm⟩ + have hZ := sandwich_one_pos ω.functional ω.normalized hp hB + let Z := (sandwichFunctional ω.functional B 1).re + refine ⟨((Z : ℂ)⁻¹) • sandwichFunctional ω.functional B, ?_, ?_⟩ + · change (Z : ℂ)⁻¹ * sandwichFunctional ω.functional B 1 = 1 + have hz : sandwichFunctional ω.functional B 1 = (Z : ℂ) := by + apply Complex.ext + · rfl + · simpa only [sandwichFunctional_apply, mul_one, Complex.ofReal_im] using (ω.positive B).1 + rw [hz] + exact inv_mul_cancel₀ (Complex.ofReal_ne_zero.mpr (ne_of_gt hZ)) + · intro A + change (((Z : ℂ)⁻¹) * sandwichFunctional ω.functional B (star A*A)).im = 0 ∧ _ + have hA := sandwichFunctional_positive ω.functional hp B A + have hi : 0 ≤ ((Z : ℂ)⁻¹) := by + rw [← Complex.ofReal_inv] + exact ⟨le_of_lt (inv_pos.mpr hZ), by simp⟩ + have hh := mul_nonneg hi hA + exact ⟨hh.2.symm, hh.1⟩ + +def gibbsDensity {d ℓ : ℕ} (K : QuasiLocal d ℓ) (β : ℝ) : QuasiLocal d ℓ := + NormedSpace.exp (((-β : ℝ) : ℂ) • K) + +def gibbsHalf {d ℓ : ℕ} (K : QuasiLocal d ℓ) (β : ℝ) : QuasiLocal d ℓ := + NormedSpace.exp (((-β/2 : ℝ) : ℂ) • K) + +lemma star_gibbsHalf {d ℓ : ℕ} {K : QuasiLocal d ℓ} (hK : IsSelfAdjoint K) (β : ℝ) : + star (gibbsHalf K β) = gibbsHalf K β := by + rw [gibbsHalf, NormedSpace.star_exp, star_smul, hK] + simp + +lemma gibbsHalf_sq {d ℓ : ℕ} (K : QuasiLocal d ℓ) (β : ℝ) : + gibbsHalf K β * gibbsHalf K β = gibbsDensity K β := by + unfold gibbsHalf gibbsDensity + rw [← NormedSpace.exp_add_of_commute (Commute.refl _), ← add_smul] + congr 2 + push_cast + ring + +def gibbsState {d ℓ : ℕ} (τ : State d ℓ) (K : QuasiLocal d ℓ) (β : ℝ) : State d ℓ := + sandwichState τ (gibbsHalf K β) (NormedSpace.isUnit_exp _) + +theorem gibbs_normalization_pos {d ℓ : ℕ} (τ : State d ℓ) {K : QuasiLocal d ℓ} + (hK : IsSelfAdjoint K) (β : ℝ) : 0 < (τ.functional (gibbsDensity K β)).re := by + let : PartialOrder (QuasiLocal d ℓ) := CStarAlgebra.spectralOrder _ + let : StarOrderedRing (QuasiLocal d ℓ) := CStarAlgebra.spectralOrderedRing _ + have hp : ∀ C, 0 ≤ τ.functional (star C*C) := + fun C => ⟨(τ.positive C).2, by simpa using (τ.positive C).1.symm⟩ + have h := sandwich_one_pos τ.functional τ.normalized hp + (NormedSpace.isUnit_exp (((-β/2 : ℝ) : ℂ) • K)) + change 0 < (τ.functional (star (gibbsHalf K β) * gibbsHalf K β)).re at h + simpa only [star_gibbsHalf hK, gibbsHalf_sq] using h + +theorem gibbsState_apply {d ℓ : ℕ} (τ : State d ℓ) + (hτ : ∀ A B, τ.functional (A*B) = τ.functional (B*A)) + {K : QuasiLocal d ℓ} (hK : IsSelfAdjoint K) (β : ℝ) (A : QuasiLocal d ℓ) : + (gibbsState τ K β).functional A = + ((τ.functional (gibbsDensity K β)).re : ℂ)⁻¹ * + τ.functional (gibbsDensity K β * A) := by + change ((sandwichFunctional τ.functional (gibbsHalf K β) 1).re : ℂ)⁻¹ * + sandwichFunctional τ.functional (gibbsHalf K β) A = _ + simp only [sandwichFunctional_apply, mul_one, star_gibbsHalf hK, gibbsHalf_sq] + congr 1 + rw [hτ (_*A), ← mul_assoc, gibbsHalf_sq] + +theorem exists_gibbs_states (d ℓ : ℕ) : + ∃ τ : State d ℓ, (∀ A B, τ.functional (A*B) = τ.functional (B*A)) ∧ + ∀ (K : QuasiLocal d ℓ), IsSelfAdjoint K → ∀ β : ℝ, + 0 < (τ.functional (gibbsDensity K β)).re ∧ + ∃ ω : State d ℓ, ∀ A, ω.functional A = + ((τ.functional (gibbsDensity K β)).re : ℂ)⁻¹ * + τ.functional (gibbsDensity K β*A) := by + obtain ⟨τ,hτ⟩ := exists_tracial_state d ℓ + refine ⟨τ,hτ,fun K hK β => ⟨gibbs_normalization_pos τ hK β, gibbsState τ K β, ?_⟩⟩ + exact gibbsState_apply τ hτ hK β + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SurfaceTail.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SurfaceTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fc01a78b7baa37ad9ef290b887a88bfa9c0943c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SurfaceTail.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.Heisenberg.PinnedMagnetization + +namespace OAI + +section + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Surface +open Heisenberg.Cycle Heisenberg.Pin Heisenberg.Return +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +lemma pinned_sum_le_trace (π : Equiv.Perm V) (P : Set V) (f : (V → Bool) → ℝ) + (hf : ∀ c,0≤f c) : + (∑ c : PinnedColor π P,f c.val)≤Matrix.trace (SlotColor.matrix π * Matrix.diagonal f) := by + rw [←pinned_trace,SlotColor.trace_diagonal,SlotColor.trace_diagonal] + apply Finset.sum_le_sum + intro c _ + split_ifs <;> simp_all + +def colorTail (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (C : Finset V) : ℝ := + ∑ ω,μ ω * Matrix.trace (SlotColor.matrix (π ω) * + Matrix.diagonal (fun c=>if C.card/4≤cutSpin C c then (1:ℝ) else 0)) + +lemma normalized_pinned_tail (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) (P : Set V) (C : Finset V) : + (∑ ω,∑ c : PinnedColor (π ω) P,if C.card/4≤cutSpin C c.val then μ ω/pinPartition μ π P else 0)= + (∑ ω,μ ω*∑ c : PinnedColor (π ω) P,if C.card/4≤cutSpin C c.val then (1:ℝ) else 0)/pinPartition μ π P := by + simp_rw [Finset.sum_div,Finset.mul_sum] + apply Finset.sum_congr rfl + intro ω _ + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + +theorem color_surface_tail (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0≤μ ω) (hpos : 0<∑ ω,μ ω) (P : Set V) (C : Finset V) + (hC : C.Nonempty) (p : ℝ) (hp : p≤1/4) + (hmiss : ∀ i∈C,(∑ ω,if ¬HasHit (π ω) P i then pinDensity μ π P ω else 0)≤p) + (K : ℝ) (hK : (∑ ω,pinDensity μ π ∅ ω*((hitClasses (π ω) P).card:ℝ))≤K) : + Real.exp (-(Real.log 2)*K)/2 ≤ colorTail μ π C/pinPartition μ π ∅ := by + have hpin:=pinned_cut_tail μ π hμ hpos P C hC p hp hmiss + rw [normalized_pinned_tail] at hpin + have hZP:=pinPartition_pos μ π hμ hpos P + have hZ0:=pinPartition_pos μ π hμ hpos ∅ + have hsum : (∑ ω,μ ω*∑ c : PinnedColor (π ω) P,if C.card/4≤cutSpin C c.val then (1:ℝ) else 0)≤colorTail μ π C := by + apply Finset.sum_le_sum + intro ω _ + exact mul_le_mul_of_nonneg_left (pinned_sum_le_trace (π ω) P (fun c=>if C.card/4≤cutSpin C c then 1 else 0) (fun c=>by split_ifs <;> norm_num)) (hμ ω) + have hpin' : pinPartition μ π P/2≤colorTail μ π C := by + have hh:=(le_div_iff₀ hZP).mp hpin + linarith + have hsurface:=partition_surface_lower μ π hμ hpos P K hK + have hh:=div_le_div_of_nonneg_right hpin' hZ0.le + rw [div_right_comm] at hh + linarith + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/SymmetrizedSurface.lean b/lean/OAI/MathematicalPhysics/Heisenberg/SymmetrizedSurface.lean new file mode 100644 index 0000000000000000000000000000000000000000..16113b316d2b54bc615355d9fe137abb19648125 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/SymmetrizedSurface.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.Heisenberg.CompletionFactor + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Fin.NatCast Matrix Matrix.Norms.Operator +open Filter Topology +attribute [-instance] instDecidableEqFin instDecidableEqProd +@[reducible] local instance symSurfaceDecEq (α : Type*) : DecidableEq α := Classical.decEq α +namespace Heisenberg.Surface +open Heisenberg.Geometry LatticeRegular SpatialFrame MeshPair + +def colorSymmetrizer (X : Type) [Fintype X] (ℓ : ℕ) : + Matrix ((X×Fin ℓ) → Bool) ((X×Fin ℓ) → Bool) ℝ := + (Fintype.card (X → Equiv.Perm (Fin ℓ)):ℝ)⁻¹ • + ∑ κ : X → Equiv.Perm (Fin ℓ),SlotColor.matrix (SlotTensor.fiberPerm κ) + +lemma colorSymmetrizer_reindex (X : Type) [Fintype X] (ℓ : ℕ) : + Matrix.reindex (SlotTensor.configEquiv ℓ) (SlotTensor.configEquiv ℓ) (colorSymmetrizer X ℓ)= + TensorMatrix.tensor (fun _ : X=>SpinSlots.basis ℓ) * + (TensorMatrix.tensor (fun _ : X=>SpinSlots.basis ℓ)).transpose := by + rw [← SlotTensor.symmetrizer] + ext A B + simp only [colorSymmetrizer,SlotTensor.matrix,Matrix.reindex_apply,Matrix.submatrix_apply, + Matrix.smul_apply,Matrix.sum_apply,smul_eq_mul] + congr! 20 + +theorem symmetrized_surface_bound (d ℓ : ℕ) (hd : 2≤d) [NeZero ℓ] : + ∃ s : ℝ,0v.1.val∉F)).card:ℝ) + let J:=(((Finset.range q).filter (fun j=>(a₀ j).1.val∉F ∨ (b₀ j).1.val∉F)).card:ℝ) + let E:=NormedSpace.exp (t • ∑ j∈Finset.range q,(1/2:ℝ) • (SlotColor.matrix (Equiv.swap (a₀ j) (b₀ j))-1)) + let P:=colorSymmetrizer Λ ℓ + Real.exp (-(Real.log 2)*(Z+2*t*J))/2*Matrix.trace (P*E)≤ + Matrix.trace (P*E*tailProjection (Slots (B:=Fin ℓ) Λ)) := by + obtain ⟨s,hs,hbound⟩:=completed_surface_bound d hd (Fin ℓ) + refine ⟨s,hs,?_⟩ + intro Λ F hΛ q _ edge a₀ b₀ ha₀ hb₀ hF hf t ht Z J E P + let : Nonempty Λ:=Finset.Nonempty.coe_sort hΛ + have hh (κ : Λ → Equiv.Perm (Fin ℓ)) : + Real.exp (-(Real.log 2)*(Z+2*t*J))/2*Matrix.trace (SlotColor.matrix (SlotTensor.fiberPerm κ)*E)≤ + Matrix.trace (SlotColor.matrix (SlotTensor.fiberPerm κ)*E*tailProjection (Slots (B:=Fin ℓ) Λ)) := by + obtain ⟨c,u,v,huv,hp⟩:=completion_factorization (fun p : Slots (B:=Fin ℓ) Λ=>p.1.val) + (SlotTensor.fiberPerm κ) (fun _=>rfl) + have hh:=hbound Λ F hΛ q edge a₀ b₀ ha₀ hb₀ c u v huv hF hf t ht + dsimp only at hh + rw [hp] at hh + exact hh + have hsum:=Finset.sum_le_sum (s:=Finset.univ) (fun κ _=>hh κ) + rw [←Finset.mul_sum] at hsum + have hm:=mul_le_mul_of_nonneg_left hsum + (inv_nonneg.mpr (Nat.cast_nonneg (Fintype.card (Λ → Equiv.Perm (Fin ℓ))) : 0≤(Fintype.card (Λ → Equiv.Perm (Fin ℓ)):ℝ))) + dsimp only [P,colorSymmetrizer] + simp only [Matrix.smul_mul,Matrix.sum_mul,Matrix.trace_smul,Matrix.trace_sum,smul_eq_mul] + with_reducible convert hm using 1 <;> (try ring_nf) <;> congr! 20 + +end Heisenberg.Surface +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/TensorLift.lean b/lean/OAI/MathematicalPhysics/Heisenberg/TensorLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e3dc1da4173f726b0300bfc7e42b8d0c6439613 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/TensorLift.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.Heisenberg.MatrixUnitLift + +namespace OAI + +noncomputable section +open scoped Classical BigOperators Matrix +namespace Heisenberg.TensorUnits +variable {R E K : Type*} [CommSemiring R] [Semiring E] [Algebra R E] + [Fintype K] [DecidableEq K] + +lemma list_prod_smul {I : Type*} (L : List I) (c : I → R) (f : I → E) : + (L.map (fun i=>c i • f i)).prod=(L.map c).prod • (L.map f).prod := by + induction L with + | nil=>simp + | cons a L ih=>simp only [List.map_cons,List.prod_cons,ih,smul_mul_smul_comm] + +lemma ofFn_prod_smul {n : ℕ} (c : Fin n → R) (f : Fin n → E) : + (List.ofFn (fun i=>c i • f i)).prod=(∏ i,c i) • (List.ofFn f).prod := by + have hh:=list_prod_smul (List.ofFn (id:Fin n → Fin n)) c f + simpa only [List.map_ofFn,Function.comp_id,List.prod_ofFn] using hh + +def pairConfigEquiv (n : ℕ) (K : Type*) : (Fin n → K×K) ≃ (Fin n → K)×(Fin n → K) where + toFun f:=(fun i=>(f i).1,fun i=>(f i).2) + invFun f i:=(f.1 i,f.2 i) + left_inv _:=rfl + right_inv _:=rfl + +omit [DecidableEq K] in +lemma lift_tensorFin {n : ℕ} (u : Fin n → K → K → E) (M : Fin n → Matrix K K R) : + liftLinear (system u) (fun a b=>∏ i,M i (a i) (b i))= + (List.ofFn (fun i=>liftLinear (u i) (M i))).prod := by + have hh:=(MultilinearMap.mkPiAlgebraFin R n E).map_sum + (fun i (v : K×K)=>M i v.1 v.2 • u i v.1 v.2) + simp only [Fintype.sum_prod_type,MultilinearMap.mkPiAlgebraFin_apply] at hh + rw [←(pairConfigEquiv n K).symm.sum_comp,Fintype.sum_prod_type] at hh + simp only [ofFn_prod_smul] at hh + exact hh.symm + +end Heisenberg.TensorUnits +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/TensorLiftIndex.lean b/lean/OAI/MathematicalPhysics/Heisenberg/TensorLiftIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..605152264b72813d1ced5d52a91f60badcb35de1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/TensorLiftIndex.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.Heisenberg.SlotOnMesh + +namespace OAI + +section +noncomputable section +open scoped Classical BigOperators Matrix +namespace Heisenberg.TensorUnits +variable {R E K : Type*} [CommSemiring R] [Semiring E] [Algebra R E] + [Fintype K] [DecidableEq K] + +lemma ofFn_prod_eq_single {n : ℕ} (f : Fin n → E) (i : Fin n) + (h : ∀ j,j≠i → f j=1) : (List.ofFn f).prod=f i := by + induction n with + | zero=>exact Fin.elim0 i + | succ n ih=> + induction i using Fin.cases with + | zero=> + rw [List.ofFn_succ,List.prod_cons] + have he : (fun j : Fin n=>f j.succ)=fun _=>1 := by + funext j + exact h _ (Fin.succ_ne_zero j) + rw [he,List.ofFn_const,List.prod_replicate,one_pow,mul_one] + | succ i=> + rw [List.ofFn_succ,List.prod_cons,h 0 (Ne.symm (Fin.succ_ne_zero i)),one_mul] + exact ih (fun j=>f j.succ) i (fun j hj=>h _ (fun he=>hj (Fin.succ_injective _ he))) + +lemma lift_onsiteFin {n : ℕ} (u : Fin n → K → K → E) + (hs : ∀ i,∑ a,u i a a=1) (i : Fin n) (M : Matrix K K R) : + liftLinear (system u) (TensorMatrix.onsite i M)=liftLinear (u i) M := by + unfold TensorMatrix.onsite TensorMatrix.tensor + rw [lift_tensorFin] + have he:=ofFn_prod_eq_single (fun j=>liftLinear (u j) (Function.update (fun _ : Fin n=>(1:Matrix K K R)) i M j)) i + (fun j hj=>by rw [Function.update_of_ne hj,lift_one (u j) (hs j)]) + simpa only [Function.update_self] using he + +variable {X : Type*} [Fintype X] [DecidableEq X] + +def functionReindex {n : ℕ} (e : X ≃ Fin n) : (X → K) ≃ (Fin n → K) where + toFun f:=f ∘ e.symm + invFun f:=f ∘ e + left_inv f:=by ext x; simp + right_inv f:=by ext x; simp + +omit [Fintype K] [DecidableEq K] [DecidableEq X] in +lemma reindex_tensor {n : ℕ} (e : X ≃ Fin n) (M : X → Matrix K K R) : + Matrix.reindex (functionReindex e) (functionReindex e) (TensorMatrix.tensor M)= + TensorMatrix.tensor (fun i=>M (e.symm i)) := by + ext a b + change (∏ x,M x (a (e x)) (b (e x)))=∏ i,M (e.symm i) (a i) (b i) + simpa only [Equiv.apply_symm_apply] using (e.symm.prod_comp (fun x=>M x (a (e x)) (b (e x)))).symm + +omit [Fintype K] in +lemma reindex_onsite {n : ℕ} (e : X ≃ Fin n) (x : X) (M : Matrix K K R) : + Matrix.reindex (functionReindex e) (functionReindex e) (TensorMatrix.onsite x M)= + TensorMatrix.onsite (e x) M := by + unfold TensorMatrix.onsite + rw [reindex_tensor] + congr 1 + ext i a b + by_cases hi : i=e x + · subst i; simp + · have hx : e.symm i≠x:=fun hh=>hi (by rw [←hh,Equiv.apply_symm_apply]) + simp [Function.update_of_ne hi,Function.update_of_ne hx] + +end Heisenberg.TensorUnits +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/TensorUnitSystem.lean b/lean/OAI/MathematicalPhysics/Heisenberg/TensorUnitSystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7c8c05ba0d7fa0e5918a620ec7fbae7c4928e38 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/TensorUnitSystem.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.Heisenberg.GibbsLimits + +namespace OAI + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.TensorUnits + +lemma prod_interleave {X E : Type*} [Monoid E] (L : List X) (hL : L.Nodup) + (f g : X → E) (hfg : ∀ x∈L,∀ y∈L,x≠y → Commute (f x) (g y)) : + (L.map f).prod*(L.map g).prod=(L.map (fun x=>f x*g x)).prod := by + induction L with + | nil=>simp + | cons a L ih=> + obtain ⟨ha,hL⟩:=List.nodup_cons.mp hL + have hc : Commute (L.map f).prod (g a) := by + apply Commute.list_prod_left + intro z hz + obtain ⟨x,hx,rfl⟩:=List.mem_map.mp hz + exact hfg x (List.mem_cons_of_mem a hx) a (List.mem_cons_self ..) + (fun he=>ha (he ▸ hx)) + simp only [List.map_cons,List.prod_cons] + calc + _=f a*((L.map f).prod*g a)*(L.map g).prod := by simp only [mul_assoc] + _=(f a*g a)*((L.map f).prod*(L.map g).prod) := by rw [hc.eq]; simp only [mul_assoc] + _=_ := by rw [ih hL (fun x hx y hy hxy=>hfg x (List.mem_cons_of_mem a hx) y (List.mem_cons_of_mem a hy) hxy)] + +variable {R E : Type*} [CommSemiring R] [Semiring E] [Algebra R E] +variable {n : ℕ} {K : Type*} [Fintype K] [DecidableEq K] + +def system (u : Fin n → K → K → E) (a b : Fin n → K) : E := + (List.ofFn (fun i=>u i (a i) (b i))).prod + +omit [Fintype K] in +lemma system_mul (u : Fin n → K → K → E) + (hu : ∀ i a b c d,u i a b*u i c d=if b=c then u i a d else 0) + (hc : ∀ i j,i≠j → ∀ a b c d,Commute (u i a b) (u j c d)) + (a b c d : Fin n → K) : + system u a b*system u c d=if b=c then system u a d else 0 := by + have he := prod_interleave (List.ofFn (id : Fin n → Fin n)) + (List.nodup_ofFn.mpr Function.injective_id) (fun i=>u i (a i) (b i)) + (fun i=>u i (c i) (d i)) (fun i _ j _ hij=>hc i j hij ..) + simp only [List.map_ofFn,Function.comp_def,id_eq] at he + unfold system + rw [he] + by_cases hbc : b=c + · subst c + simp only [hu,ite_true] + · rw [ite_eq_right hbc] + obtain ⟨i,hi⟩:=Function.ne_iff.mp hbc + apply List.prod_eq_zero + apply List.mem_ofFn.mpr + exact ⟨i,by rw [hu,ite_eq_right hi]⟩ + +omit [DecidableEq K] in +lemma system_diagonal_sum (R : Type*) [CommSemiring R] [Algebra R E] (u : Fin n → K → K → E) (hu : ∀ i,∑ a,u i a a=1) : + ∑ a : Fin n → K,system u a a=1 := by + have hh:=(MultilinearMap.mkPiAlgebraFin R n E).map_sum (fun i a=>u i a a) + simp only [hu,MultilinearMap.mkPiAlgebraFin_apply] at hh + simpa only [system,List.ofFn_const,List.prod_replicate,one_pow] using hh.symm + +end Heisenberg.TensorUnits +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/ThermodynamicDynamics.lean b/lean/OAI/MathematicalPhysics/Heisenberg/ThermodynamicDynamics.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7dde1db69d5484724e965092b6cfe6e87d23cd2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/ThermodynamicDynamics.lean @@ -0,0 +1,269 @@ +import OAI.MathematicalPhysics.Heisenberg.LocalDynamics + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal Classical +open scoped ComplexConjugate BigOperators + +namespace IsometricLimits +variable {E : Type*} [MetricSpace E] [CompleteSpace E] + +theorem limit_on_dense (F : ℕ → E → E) (hF : ∀ n, Isometry (F n)) + (s : Set E) (hs : Dense s) + (hlim : ∀ x ∈ s, ∃ y, Filter.Tendsto (fun n => F n x) Filter.atTop (nhds y)) : + ∀ x, ∃ y, Filter.Tendsto (fun n => F n x) Filter.atTop (nhds y) := by + intro x + apply cauchySeq_tendsto_of_complete + rw [Metric.cauchySeq_iff] + intro ε hε + obtain ⟨a, ha, hax⟩ := hs.exists_dist_lt x (by linarith : 0 < ε/3) + obtain ⟨b, hb⟩ := hlim a ha + obtain ⟨N, hN⟩ := Metric.cauchySeq_iff.mp hb.cauchySeq (ε/3) (by linarith) + refine ⟨N, fun n hn m hm => ?_⟩ + calc + dist (F n x) (F m x) ≤ dist (F n x) (F n a) + dist (F n a) (F m a) + + dist (F m a) (F m x) := dist_triangle4 _ _ _ _ + _ = dist x a + dist (F n a) (F m a) + dist a x := by + rw [(hF n).dist_eq, (hF m).dist_eq] + _ < ε := by have := hN n hn m hm; rw [dist_comm a x]; linarith + +omit [CompleteSpace E] in + +theorem limit_iterate (F : ℕ → E → E) (f : E → E) (hF : ∀ n, Isometry (F n)) + (hlim : ∀ x, Filter.Tendsto (fun n => F n x) Filter.atTop (nhds (f x))) + (k : ℕ) (x : E) : + Filter.Tendsto (fun n => (F n)^[k] x) Filter.atTop (nhds (f^[k] x)) := by + induction k with + | zero => simp + | succ k ih => + have hsum := (tendsto_iff_dist_tendsto_zero.mp ih).add + (tendsto_iff_dist_tendsto_zero.mp (hlim (f^[k] x))) + rw [add_zero] at hsum + apply tendsto_iff_dist_tendsto_zero.mpr + apply squeeze_zero (fun _ => dist_nonneg) ?_ hsum + intro n + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] + calc + _ ≤ dist (F n ((F n)^[k] x)) (F n (f^[k] x)) + + dist (F n (f^[k] x)) (f (f^[k] x)) := dist_triangle _ _ _ + _ = _ := by rw [(hF n).dist_eq] + +omit [CompleteSpace E] in + +theorem all_times (g : ℕ → ℝ → E → E) + (hg : ∀ n t, Isometry (g n t)) + (hzero : ∀ n x, g n 0 x = x) + (hadd : ∀ n s t x, g n (s+t) x = g n s (g n t x)) + (δ : ℝ) (hδ : 0 < δ) + (hsmall : ∀ t : ℝ, |t| < δ → ∀ x, ∃ y, + Filter.Tendsto (fun n => g n t x) Filter.atTop (nhds y)) : + ∀ t : ℝ, ∀ x, ∃ y, Filter.Tendsto (fun n => g n t x) Filter.atTop (nhds y) := by + intro t x + obtain ⟨N, hN⟩ := exists_nat_gt (|t|/δ) + have hN0 : (0 : ℝ) < N := (div_nonneg (abs_nonneg _) hδ.le).trans_lt hN + let a : ℝ := t/N + have ha : |a| < δ := by + dsimp [a] + rw [abs_div, abs_of_pos hN0, div_lt_iff₀ hN0] + have := (div_lt_iff₀ hδ).mp hN + nlinarith + choose f hf using hsmall a ha + have hi (n k : ℕ) (x : E) : (g n a)^[k] x = g n ((k : ℝ)*a) x := by + induction k with + | zero => simp [hzero] + | succ k ih => + rw [Function.iterate_succ_apply', ih] + have heq : ((k+1 : ℕ) : ℝ)*a = a+(k : ℝ)*a := by push_cast; ring + rw [heq, hadd] + refine ⟨f^[N] x, ?_⟩ + have hh := limit_iterate (fun n => g n a) f (fun n => hg n a) hf N x + simpa only [hi, a, mul_div_cancel₀ t (ne_of_gt hN0)] using hh + +end IsometricLimits + +namespace Heisenberg + +private theorem clm_topologicalRing {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] : + IsTopologicalRing (E →L[ℂ] E) := inferInstance + +local instance (d ℓ : ℕ) : IsTopologicalRing (QuasiLocal d ℓ →L[ℂ] QuasiLocal d ℓ) := + clm_topologicalRing + +lemma finiteDynamics_generator (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) (A : QuasiLocal d ℓ) : + finiteDynamics d ℓ Λ t A = NormedSpace.exp ((t : ℂ) • finiteGenerator d ℓ Λ) A := by + rw [finiteGenerator, SpinEvolution.exp_generator] + simp only [finiteDynamics, mul_comm (t : ℂ) Complex.I] + +theorem dynamics_converges (d ℓ : ℕ) : DynamicsConverges d ℓ := by + let C : ℝ := 8*d*bondBound d ℓ + have hC : 0 ≤ C := (finiteGenerator_localDecomposition d ℓ (box d 0)).nonneg + let δ : ℝ := 1/(C+1) + have hδ : 0 < δ := one_div_pos.mpr (by linarith) + have hs : ∀ t : ℝ, |t| < δ → ∀ A : QuasiLocal d ℓ, ∃ B, + Filter.Tendsto (fun n => finiteDynamics d ℓ (box d n) t A) Filter.atTop (nhds B) := by + intro t ht + apply IsometricLimits.limit_on_dense (fun n => finiteDynamics d ℓ (box d n) t) + (fun n => finiteDynamics_isometry _ _ _ _) (localCore d ℓ) (localCore_dense d ℓ) + intro A hA + obtain ⟨F,hF⟩ := localCore_finite_support hA + have hz : ‖(t : ℂ)‖*C < 1 := by + rw [Complex.norm_real, Real.norm_eq_abs] + have h := (lt_div_iff₀ (by linarith : 0 < C+1)).mp ht + nlinarith [abs_nonneg t] + have hh := SpinEvolution.local_exponential_converges + (fun n => finiteGenerator d ℓ (box d n)) (SupportedOnAtMost d ℓ) C + (fun n => finiteGenerator_localDecomposition d ℓ (box d n)) F.card A + ⟨F,Nat.le_succ _,hF⟩ (t : ℂ) hz (local_coefficients_stabilize F hF) + simpa only [← finiteDynamics_generator] using hh + have hall := IsometricLimits.all_times (fun n => finiteDynamics d ℓ (box d n)) + (fun n t => finiteDynamics_isometry _ _ _ _) + (fun n A => finiteDynamics_zero _ _ _ _) + (fun n s t A => finiteDynamics_group _ _ _ _ _ _) δ hδ hs + intro t A + exact tendsto_nhds_limUnder (hall t A) + +end Heisenberg + +open Filter Topology Metric +namespace EquicontinuousLimits + +section +variable {ι X Y : Type*} [PseudoMetricSpace X] [PseudoMetricSpace Y] +variable {φ : Filter ι} [φ.NeBot] + +theorem locallyUniform {F : ι → X → Y} {f : X → Y} + (he : Equicontinuous F) (hf : ∀ x, Tendsto (fun i => F i x) φ (𝓝 (f x))) : + TendstoLocallyUniformly F f φ := by + rw [Metric.tendstoLocallyUniformly_iff] + intro ε hε x + obtain ⟨δ,hδ,hd⟩ := Metric.equicontinuousAt_iff.mp (he x) (ε/4) (by positivity) + refine ⟨ball x δ,ball_mem_nhds x hδ,?_⟩ + filter_upwards [Metric.tendsto_nhds.mp (hf x) (ε/4) (by positivity)] with i hi + intro y hy + have hh : dist (f x) (f y) ≤ ε/4 := + le_of_tendsto ((hf x).dist (hf y)) (Filter.Eventually.of_forall fun j => (hd y hy j).le) + have htriangle := dist_triangle (f y) (f x) (F i y) + have htriangle' := dist_triangle (f x) (F i x) (F i y) + rw [dist_comm (F i x) (f x)] at hi + rw [dist_comm (f y) (f x)] at htriangle + exact lt_of_le_of_lt htriangle (by linarith [hd y hy i]) + +end + +variable {ι X E : Type*} [PseudoMetricSpace X] [NormedAddCommGroup E] [NormedSpace ℂ E] +variable {φ : Filter ι} [φ.NeBot] + +omit [φ.NeBot] in + +theorem apply_varying {L : ι → E →L[ℂ] ℂ} {l : E →L[ℂ] ℂ} + {C : ℝ} (hC : ∀ i, ‖L i‖ ≤ C) (hL : ∀ A, Tendsto (fun i => L i A) φ (𝓝 (l A))) + {v : ι → E} {w : E} (hv : Tendsto v φ (𝓝 w)) : + Tendsto (fun i => L i (v i)) φ (𝓝 (l w)) := by + have hdiff : Tendsto (fun i => L i (v i-w)) φ (𝓝 0) := by + apply squeeze_zero_norm (a := fun i => C*‖v i-w‖) + · intro i + exact ((L i).le_opNorm _).trans (mul_le_mul_of_nonneg_right (hC i) (norm_nonneg _)) + · simpa using (tendsto_const_nhds (x := C)).mul ((hv.sub (tendsto_const_nhds (x := w))).norm) + have hh := hdiff.add (hL w) + simpa only [map_sub,sub_add_cancel,zero_add] using hh + +theorem equicontinuous_apply {L : ι → E →L[ℂ] ℂ} {C : ℝ} + (hC0 : 0 ≤ C) (hC : ∀ i, ‖L i‖ ≤ C) {F : ι → X → E} + (he : Equicontinuous F) : Equicontinuous (fun i x => L i (F i x)) := by + intro x + rw [Metric.equicontinuousAt_iff] + intro ε hε + have hp : 0 < C+1 := by linarith + obtain ⟨δ,hδ,hd⟩ := Metric.equicontinuousAt_iff.mp (he x) (ε/(C+1)) (div_pos hε hp) + refine ⟨δ,hδ,fun y hy i => ?_⟩ + have hb : dist (L i (F i x)) (L i (F i y)) ≤ C*dist (F i x) (F i y) := by + rw [dist_eq_norm,dist_eq_norm,← map_sub] + exact ((L i).le_opNorm _).trans (mul_le_mul_of_nonneg_right (hC i) (norm_nonneg _)) + have hh := (lt_div_iff₀ hp).mp (hd y hy i) + exact hb.trans_lt (by nlinarith [(dist_nonneg : 0 ≤ dist (F i x) (F i y))]) + +end EquicontinuousLimits +open scoped NNReal +namespace SpinEvolution +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +lemma exponential_derivative (D : E →L[ℂ] E) (A : E) (t : ℝ) : + HasDerivAt (fun s : ℝ => NormedSpace.exp ((s : ℂ) • D) A) + (NormedSpace.exp ((t : ℂ) • D) (D A)) t := by + let : NormedAlgebra ℝ (E →L[ℂ] E) := NormedAlgebra.restrictScalars ℝ ℂ _ + have hd := hasDerivAt_exp_smul_const (𝕂 := ℝ) D t + have he := ((ContinuousLinearMap.apply ℂ E A).restrictScalars ℝ).hasFDerivAt.comp_hasDerivAt t hd + change HasDerivAt (fun s : ℝ => NormedSpace.exp (s • D) A) + ((NormedSpace.exp (t • D) * D) A) t at he + have hr (s : ℝ) : (s : ℂ) • D = s • D := IsScalarTower.algebraMap_smul ℂ s D + simpa only [hr,mul_apply_eq_comp] using he + +end SpinEvolution + +open scoped NNReal +namespace Heisenberg + +lemma finiteDynamics_hasDerivAt (d ℓ : ℕ) (Λ : Finset (Site d)) + (A : QuasiLocal d ℓ) (t : ℝ) : + HasDerivAt (fun s : ℝ => finiteDynamics d ℓ Λ s A) + (finiteDynamics d ℓ Λ t (finiteGenerator d ℓ Λ A)) t := by + simpa only [← finiteDynamics_generator] using + SpinEvolution.exponential_derivative (finiteGenerator d ℓ Λ) A t + +lemma finiteDynamics_local_lipschitz {d ℓ : ℕ} {A : QuasiLocal d ℓ} + (hA : A ∈ localCore d ℓ) : + ∃ M : ℝ≥0, ∀ Λ : Finset (Site d), LipschitzWith M (fun t => finiteDynamics d ℓ Λ t A) := by + obtain ⟨F,hF⟩ := localCore_finite_support hA + let C : ℝ := 8*d*bondBound d ℓ + have hC : 0 ≤ C := (finiteGenerator_localDecomposition d ℓ ∅).nonneg + let M : ℝ≥0 := ⟨C*(F.card+1)*‖A‖, by positivity⟩ + refine ⟨M,fun Λ => lipschitzWith_of_nnnorm_deriv_le + (fun t => (finiteDynamics_hasDerivAt d ℓ Λ A t).differentiableAt) ?_⟩ + intro t + rw [(finiteDynamics_hasDerivAt d ℓ Λ A t).deriv] + change ‖finiteDynamics d ℓ Λ t (finiteGenerator d ℓ Λ A)‖ ≤ M + rw [norm_finiteDynamics] + obtain ⟨r,g,hg,_,hbound⟩ := (finiteGenerator_localDecomposition d ℓ Λ).split F.card A + ⟨F,Nat.le_succ _,hF⟩ + rw [hg] + exact (norm_sum_le _ _).trans hbound + +lemma finiteDynamics_equicontinuous (d ℓ : ℕ) (A : QuasiLocal d ℓ) : + Equicontinuous (fun Λ : Finset (Site d) => fun t : ℝ => finiteDynamics d ℓ Λ t A) := by + intro t + rw [Metric.equicontinuousAt_iff] + intro ε hε + obtain ⟨B,hB,hAB⟩ := (localCore_dense d ℓ).exists_dist_lt A (show 0 < ε/8 by positivity) + obtain ⟨M,hM⟩ := finiteDynamics_local_lipschitz hB + have hp : 0 < (4:ℝ)*(M+1) := by positivity + refine ⟨ε/(4*(M+1)),div_pos hε hp,?_⟩ + intro s hs Λ + have hl := (hM Λ).dist_le_mul t s + have htime : dist t s < ε/(4*(M+1)) := by simpa [dist_comm] using hs + have ht : (M:ℝ)*dist t s < ε/4 := by + have hm : 0 ≤ (M:ℝ) := M.property + have hh := (lt_div_iff₀ hp).mp htime + nlinarith [(dist_nonneg : 0 ≤ dist t s)] + calc + dist (finiteDynamics d ℓ Λ t A) (finiteDynamics d ℓ Λ s A) ≤ + dist (finiteDynamics d ℓ Λ t A) (finiteDynamics d ℓ Λ t B) + + dist (finiteDynamics d ℓ Λ t B) (finiteDynamics d ℓ Λ s B) + + dist (finiteDynamics d ℓ Λ s B) (finiteDynamics d ℓ Λ s A) := dist_triangle4 _ _ _ _ + _ = dist A B + dist (finiteDynamics d ℓ Λ t B) (finiteDynamics d ℓ Λ s B) + dist B A := by + rw [(finiteDynamics_isometry d ℓ Λ t).dist_eq,(finiteDynamics_isometry d ℓ Λ s).dist_eq] + _ < ε := by rw [dist_comm B A]; linarith + +theorem dynamics_locallyUniform (d ℓ : ℕ) (A : QuasiLocal d ℓ) : + TendstoLocallyUniformly (fun n t => finiteDynamics d ℓ (box d n) t A) + (fun t => dynamics d ℓ t A) Filter.atTop := by + apply EquicontinuousLimits.locallyUniform + · intro t + exact (finiteDynamics_equicontinuous d ℓ A t).comp (fun n => box d n) + · intro t + exact dynamics_converges d ℓ t A + +end Heisenberg +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/TwoEndedReturns.lean b/lean/OAI/MathematicalPhysics/Heisenberg/TwoEndedReturns.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fea698559f1e95db1e24ae0198bf5be12b1180a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/TwoEndedReturns.lean @@ -0,0 +1,261 @@ +import OAI.MathematicalPhysics.Heisenberg.PinDensity + +namespace OAI + +section +noncomputable section +open scoped Classical Topology +open Set Filter Metric +open scoped ComplexConjugate +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical +noncomputable section +open scoped Classical + +end +end +end +end +end +end +end +end +end + +noncomputable section +open scoped Classical BigOperators +namespace Heisenberg.Pin +open Heisenberg.Cycle Heisenberg.Return +variable {V Ω : Type*} [Fintype V] [Fintype Ω] + +def unpinned (E : Set V) : Finset V := Finset.univ.filter (fun j=>j∉E) + +theorem finite_pin_induction (μ : Ω → ℝ) (π : Ω → Equiv.Perm V) + (hμ : ∀ ω,0 ≤ μ ω) (hpos : 0 < ∑ ω,μ ω) (hs : Stable (lawSymbol μ π)) + (E₀ : Set V) (admissible : Finset V → Prop) (p : ℝ) (_hp : 0 ≤ p) + (hstep : ∀ E : Set V,E₀ ⊆ E → ∀ T : Finset V,T.Nonempty → + admissible T → Disjoint E (T : Set V) → + (∀ U : Finset V,admissible U → Disjoint (E∪(T:Set V)) (U:Set V) → + (∑ ω,if ∀ i∈U,¬HasHit (π ω) (E∪(T:Set V)) i then + pinDensity μ π (E∪(T:Set V)) ω else 0) ≤ p^U.card) → + 2*returnFraction μ π E T ≤ p) : + ∀ E : Set V,E₀ ⊆ E → ∀ T : Finset V,admissible T → Disjoint E (T:Set V) → + (∑ ω,if ∀ i∈T,¬HasHit (π ω) E i then pinDensity μ π E ω else 0) ≤ p^T.card := by + classical + let Good := fun E : Set V=>∀ T : Finset V,admissible T → Disjoint E (T:Set V) → + (∑ ω,if ∀ i∈T,¬HasHit (π ω) E i then pinDensity μ π E ω else 0) ≤ p^T.card + suffices h : ∀ n : ℕ,∀ E : Set V,(unpinned E).card=n → E₀⊆E → Good E by + intro E hE + exact h _ E rfl hE + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro E hcard hE T hT hET + by_cases hn : T.Nonempty + · have hproper : unpinned (E∪(T:Set V)) ⊂ unpinned E := by + apply Finset.ssubset_iff_subset_ne.mpr + constructor + · intro i hi + have hh : i∉E ∧ i∉T := by simpa [unpinned] using hi + simpa [unpinned] using hh.1 + · intro heq + obtain ⟨j,hj⟩:=hn + have hjE : j∉E := fun h=>Set.disjoint_left.mp hET h hj + have hh : j∈unpinned (E∪(T:Set V)) := by rw [heq]; simpa [unpinned] using hjE + have hh' : j∉T := (by simpa [unpinned] using hh : j∉E ∧ j∉T).2 + exact hh' hj + have hlt : (unpinned (E∪(T:Set V))).card < n := by + rw [←hcard] + exact Finset.card_lt_card hproper + have hgood : Good (E∪(T:Set V)) := ih _ hlt _ rfl + (fun i hi=>Or.inl (hE hi)) + have hr:=hstep E hE T hn hT hET hgood + have htest:=finite_simultaneous_pin_test μ π hμ hpos hs E T hn hET + apply htest.trans + apply pow_le_pow_left₀ _ hr + apply mul_nonneg (by norm_num) + apply div_nonneg _ (Nat.cast_nonneg _) + apply Finset.sum_nonneg + intro i _ + apply Finset.sum_nonneg + intro ω _ + split_ifs + · exact pinDensity_nonneg μ π hμ hpos _ _ + · exact le_refl 0 + · have ht : T=∅ := Finset.not_nonempty_iff_eq_empty.mp hn + subst T + simpa using (pinDensity_sum μ π hμ hpos E).le + +end Heisenberg.Pin + +end + +noncomputable section +open scoped BigOperators +namespace Heisenberg.Clocks + +lemma factorial_lower_of_pos (R : ℕ) (hR : 1 ≤ R) : + ((R:ℝ)/Real.exp 1)^R ≤ (R.factorial:ℝ) := by + have hr : (1:ℝ) ≤ R := by exact_mod_cast hR + have hs : (1:ℝ) ≤ Real.sqrt (2*Real.pi*R) := by + rw [Real.le_sqrt (by norm_num) (by positivity)] + nlinarith [Real.pi_gt_three] + calc + _ ≤ Real.sqrt (2*Real.pi*R)*((R:ℝ)/Real.exp 1)^R := + le_mul_of_one_le_left (by positivity) hs + _ ≤ _ := Stirling.le_factorial_stirling R + +lemma geometric_le_recip (R : ℕ) : (1/2:ℝ)^R ≤ 1/(1+(R:ℝ)) := by + have h : (1:ℝ)+R ≤ 2^R := by + have := one_add_mul_le_pow (by norm_num : (-2:ℝ) ≤ 1) R + norm_num at this ⊢ + linarith + rw [one_div_pow] + exact one_div_le_one_div_of_le (by positivity) h + +theorem binomial_clock_tail (n R : ℕ) (B δ s : ℝ) + (hB : 0 ≤ B) (hδ : 0 ≤ δ) (hs : 0 ≤ s) (hR : 1 ≤ R) + (hsmall : ((n+2+R:ℕ):ℝ)*δ ≤ 2*s) + (hlarge : 8*B*Real.exp 1*s ≤ R) : + ((n+2+R).choose R:ℝ)*(2*B*δ)^R ≤ 1/(1+(R:ℝ)) := by + have hfact : 0 < (R.factorial:ℝ) := by positivity + have hr : 0 < (R:ℝ) := by exact_mod_cast (lt_of_lt_of_le (by decide : 0 < 1) hR) + calc + _ ≤ (((n+2+R:ℕ):ℝ)^R/(R.factorial:ℝ))*(2*B*δ)^R := + mul_le_mul_of_nonneg_right (Nat.choose_le_pow_div R (n+2+R)) (by positivity) + _ = (((n+2+R:ℕ):ℝ)*(2*B*δ))^R/(R.factorial:ℝ) := by rw [mul_pow]; ring + _ ≤ (4*B*s)^R/(R.factorial:ℝ) := by + apply div_le_div_of_nonneg_right _ hfact.le + apply pow_le_pow_left₀ (by positivity) + nlinarith + _ ≤ (4*B*s)^R/(((R:ℝ)/Real.exp 1)^R) := + div_le_div_of_nonneg_left (by positivity) (by positivity) (factorial_lower_of_pos R hR) + _ = (4*B*s/((R:ℝ)/Real.exp 1))^R := (div_pow ..).symm + _ ≤ (1/2:ℝ)^R := by + apply pow_le_pow_left₀ (by positivity) + apply (div_le_iff₀ (by positivity : 0 < (R:ℝ)/Real.exp 1)).mpr + rw [←mul_div_assoc] + apply (le_div_iff₀ (Real.exp_pos 1)).mpr + nlinarith + _ ≤ _ := geometric_le_recip R + +end Heisenberg.Clocks + +end + +noncomputable section +open scoped Classical BigOperators Fin.NatCast +open Matrix +namespace Heisenberg.Exposure +open Heisenberg.Serial Heisenberg.Schedule Heisenberg.Hitting Heisenberg.MeshPair Heisenberg.Cycle +variable {V : Type} [Fintype V] [DecidableEq V] + +omit [Fintype V] in +lemma exposedStep_cutFactors (n : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (P : Set (Fin (n+1)×V)) (I : Set V) (base : Fin (n+1) → Bool) (i : Fin (n+1)) : + cutFactors n a b p P (fun c t=>holeCut (finRotate (n+1)) (fun j=>Equiv.swap (a j) (b j)) c P t∩I) base i= + exposedStep (finRotate (n+1)) a b base P I p i := rfl + +theorem period_return_two_ends (n q : ℕ) (a b : Fin (n+1) → V) (p : Fin (n+1) → ℝ) + (hp : ∀ i,0 ≤ p i ∧ p i ≤ 1) (P : Set (Fin (n+1)×V)) (I : Set V) + (hP : ∀ z,z.2∉I → z∈P) (t : Fin (n+1)) (T : Finset P) (J : Finset V) + (himage : T.image Subtype.val=targetsAt n t J) (hJ : ∀ j∈J,j∈I) + (u v : ℕ) (huv : u+v ≤ n+1) (rF rB : ℝ) + (hF : ∀ f : ((Fin (n+1) → Bool) → EuclideanSpace ℝ V), + (∀ c j,0 ≤ (f c).ofLp j ∧ (f c).ofLp j ≤ 1) → + (∀ c j,j∈J → (f c).ofLp j=1) → + (∀ c j,j∉holeCut (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) c P t∩I → (f c).ofLp j=0) → + rF ≤ ∑ c,layerMass (finRotate (n+1)) a b P p c * + (‖f c‖^2-‖exposedSweep (finRotate (n+1)) a b c P I p (run t) u (f c)‖^2)) + (hB : ∀ f : ((Fin (n+1) → Bool) → EuclideanSpace ℝ V), + (∀ c j,0 ≤ (f c).ofLp j ∧ (f c).ofLp j ≤ 1) → + (∀ c j,j∈J → (f c).ofLp j=1) → + (∀ c j,j∉holeCut (finRotate (n+1)).symm + (fun i=>Equiv.swap (a ((finRotate (n+1)).symm i)) (b ((finRotate (n+1)).symm i))) c P t∩I → (f c).ofLp j=0) → + rB ≤ ∑ c,layerMass (finRotate (n+1)).symm (a ∘ (finRotate (n+1)).symm) + (b ∘ (finRotate (n+1)).symm) P (p ∘ (finRotate (n+1)).symm) c * + (‖f c‖^2-‖exposedSweep (finRotate (n+1)).symm (a ∘ (finRotate (n+1)).symm) + (b ∘ (finRotate (n+1)).symm) c P I (p ∘ (finRotate (n+1)).symm) + (fun j=>reverseIndex q (run (reverseIndex q t) j)) v (f c)‖^2)) : + (∑ c,layerMass (finRotate (n+1)) a b P p c * + returnCount (layerHistory (finRotate (n+1)) (fun i=>Equiv.swap (a i) (b i)) c) P T) ≤ + (J.card:ℝ)-(rF+rB)/2 := by + let s:=finRotate (n+1) + let D:=fun c i=>holeCut s (fun j=>Equiv.swap (a j) (b j)) c P i∩I + have hT : ∀ base j,j∈T → j.val.2∈D base j.val.1 := by + intro c j hj + have ht : j.val∈targetsAt n t J := himage ▸ Finset.mem_image.mpr ⟨j,hj,rfl⟩ + have hh:=(mem_targetsAt ..).mp ht + refine ⟨?_,hJ _ hh.2⟩ + exact fun h=>Set.disjoint_left.mp (missing_disjoint_pins _ P) h j.property + have hQ : ∀ base,(MissingSet (layerHistory s (fun i=>Equiv.swap (a i) (b i)) base) P)ᶜ∩Pᶜ ⊆ + {z | z.2∈D base z.1} := by + intro c z hz + exact ⟨hz.1,by by_contra h; exact hz.2 (hP z h)⟩ + obtain ⟨A,hA,hAJ,hAs,hret⟩:=cut_return_energy_at n a b p hp P D t T J himage hT hQ + let f:=fun c=>WithLp.toLp 2 (A c) + have hf : ∀ c j,0 ≤ (f c).ofLp j ∧ (f c).ofLp j ≤ 1 := hA + have hfJ : ∀ c j,j∈J → (f c).ofLp j=1 := hAJ + have hfs : ∀ c j,j∉holeCut s (fun i=>Equiv.swap (a i) (b i)) c P t∩I → (f c).ofLp j=0 := hAs + have hF' := hF f hf hfJ hfs + have hB' := hB (fun c=>f (c ∘ s)) (fun c j=>hf _ _) (fun c j hj=>hfJ _ _ hj) (by + intro c j hj + apply hfs + have he := holeCut_reverse s a b (c ∘ s) P t + have hc : (c ∘ s) ∘ s.symm=c := by funext i; simp + rw [hc] at he + exact fun h=>hj (by rw [he]; exact h)) + have hbmean : (∑ c,layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm) c * + (‖f (c ∘ s)‖^2-‖exposedSweep s.symm (a ∘ s.symm) (b ∘ s.symm) c P I (p ∘ s.symm) + (fun j=>reverseIndex q (run (reverseIndex q t) j)) v (f (c ∘ s))‖^2))= + ∑ c,layerMass s a b P p c * + (‖f c‖^2-‖euclideanMap (prefixMatrix + (fun j=>(exposedStep s a b c P I p (run t (n+1-1-j))).transpose) v) (f c)‖^2) := by + let e : ((Fin (n+1) → Bool)) ≃ ((Fin (n+1) → Bool)) := Equiv.arrowCongr s (Equiv.refl Bool) + conv_lhs => rw [←e.sum_comp] + apply Finset.sum_congr rfl + intro c _ + change layerMass s.symm (a ∘ s.symm) (b ∘ s.symm) P (p ∘ s.symm) (c ∘ s.symm) * + (‖f ((c ∘ s.symm) ∘ s)‖^2-‖exposedSweep s.symm (a ∘ s.symm) (b ∘ s.symm) (c ∘ s.symm) P I (p ∘ s.symm) + (fun j=>reverseIndex q (run (reverseIndex q t) j)) v (f ((c ∘ s.symm) ∘ s))‖^2)=_ + have hc : (c ∘ s.symm) ∘ s=c := by funext i; simp + rw [hc,layerMass_reverse,reversed_period_sweep q a b P p c I t v (by omega)] + rw [hbmean] at hB' + have he : (rF+rB)/2 ≤ ∑ c,layerMass s a b P p c * + energy (product (n+1) (fun i=>cutFactors n a b p P D c (run t i))) (A c) := by + have hh : rF+rB ≤ (∑ c,layerMass s a b P p c * + (‖f c‖^2-‖exposedSweep s a b c P I p (run t) u (f c)‖^2))+ + (∑ c,layerMass s a b P p c *(‖f c‖^2-‖euclideanMap (prefixMatrix + (fun j=>(exposedStep s a b c P I p (run t (n+1-1-j))).transpose) v) (f c)‖^2)) := add_le_add hF' hB' + apply (div_le_div_of_nonneg_right hh (by norm_num)).trans + rw [←Finset.sum_add_distrib,Finset.sum_div] + apply Finset.sum_le_sum + intro c _ + rw [←mul_add,mul_div_assoc,exposedSweep_prefix] + have hK : ∀ j,j < n+1 → Heisenberg.MatrixContraction.DoublySubstochastic (exposedStep s a b c P I p (run t j)) := by + intro j _ + exact exposedStep_substochastic s a b c P I p hp _ + have ht:=energy_two_prefixes (fun j=>exposedStep s a b c P I p (run t j)) (n+1) u v huv hK (f c) + apply mul_le_mul_of_nonneg_left _ (layerMass_nonneg s a b P p hp c) + rw [prefix_product (fun j=>exposedStep s a b c P I p (run t j)) (n+1)] at ht + exact ht + linarith + +end Heisenberg.Exposure + +end +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Heisenberg/WeightedLeakage.lean b/lean/OAI/MathematicalPhysics/Heisenberg/WeightedLeakage.lean new file mode 100644 index 0000000000000000000000000000000000000000..189cf831f2e837962672544c2dd754d52f6a4111 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Heisenberg/WeightedLeakage.lean @@ -0,0 +1,260 @@ +import OAI.MathematicalPhysics.Heisenberg.RoutedDissipation + +namespace OAI + +noncomputable section + +open scoped Classical +open scoped Classical +open Filter Topology +open scoped Classical +open scoped Classical +open Module +open scoped Classical +open scoped Classical BigOperators +open scoped Classical BigOperators + +open scoped BigOperators Classical +namespace Heisenberg.FiniteLeakage + +section + +lemma weighted_young {A D b w p : ℝ} (hA : 0 ≤ A) (hD : 0 ≤ D) + (hb : 0 < b) (hp : p^2 ≤ A*D) : + 2*w*p ≤ b*D+A*w^2/b := by + by_cases hz : A = 0 + · subst A + have hp0 : p=0 := by nlinarith [sq_nonneg p] + simp only [hp0,mul_zero,zero_mul,zero_div,add_zero] + exact mul_nonneg hb.le hD + have hAp : 0 < A := lt_of_le_of_ne hA (Ne.symm hz) + have hh : 0 ≤ A*(b^2*D+A*w^2-2*b*w*p) := by + have h1 := mul_nonneg (sq_nonneg b) (sub_nonneg.mpr hp) + nlinarith [sq_nonneg (b*p-A*w)] + have hn : 0 ≤ b^2*D+A*w^2-2*b*w*p := (mul_nonneg_iff_of_pos_left hAp).mp hh + apply (mul_le_mul_iff_of_pos_right hb).mp + field_simp + nlinarith + +lemma weighted_suffix {n : ℕ} (w G : Fin n → ℝ) : + (∑ i, w i*(∑ j, if i ≤ j then G j else 0)) = + ∑ j, (∑ i, if i ≤ j then w i else 0)*G j := by + simp only [Finset.mul_sum,Finset.sum_mul,mul_ite,ite_mul,mul_zero,zero_mul] + exact Finset.sum_comm + +theorem weighted_leakage {n : ℕ} (w L err pair energy loss residual : Fin n → ℝ) + (m final A δ : ℝ) (hA : 0 ≤ A) (hδ : 0 < δ) + (hw : ∀ i, 0 ≤ w i) (hws : ∑ i, w i = 1) + (hW : ∀ i, 0 < ∑ j, if j ≤ i then w j else 0) + (henergy : ∀ i, 0 ≤ energy i) + (hpair : ∀ i, (pair i)^2 ≤ A*energy i) + (hloss : ∀ i, 2*δ*energy i ≤ loss i+residual i) + (hlower : ∀ i, m-err i-2*pair i+(∑ j, if i ≤ j then loss j else 0) ≤ L i) + (hfinal : ∀ i, L i ≤ final) : + m-(∑ i, w i*err i)- + (∑ i, A*(w i)^2/(2*δ*(∑ j, if j ≤ i then w j else 0)))- + (∑ i, (∑ j, if j ≤ i then w j else 0)*residual i) ≤ final := by + let W : Fin n → ℝ := fun i => ∑ j, if j ≤ i then w j else 0 + have hp : ∀ i, 2*w i*pair i ≤ W i*loss i+W i*residual i+ + A*(w i)^2/(2*δ*W i) := by + intro i + have hh := weighted_young (w := w i) hA (henergy i) (show 0 < 2*δ*W i from mul_pos (mul_pos (by norm_num) hδ) (hW i)) (hpair i) + have he := mul_le_mul_of_nonneg_left (hloss i) (hW i).le + nlinarith + have hl : (∑ i, w i*(m-err i-2*pair i+(∑ j, if i ≤ j then loss j else 0))) ≤ final := by + calc + _ ≤ ∑ i, w i*final := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left ((hlower i).trans (hfinal i)) (hw i)) + _ = final := by rw [← Finset.sum_mul,hws,one_mul] + have he : (∑ i, w i*(m-err i-2*pair i+(∑ j, if i ≤ j then loss j else 0))) = + m-(∑ i,w i*err i)-(∑ i,2*w i*pair i)+(∑ i,W i*loss i) := by + simp only [mul_add,mul_sub,Finset.sum_add_distrib,Finset.sum_sub_distrib, + weighted_suffix,←Finset.sum_mul,hws,one_mul] + congr 2 + apply Finset.sum_congr rfl + intro i _ + ring + rw [he] at hl + have hs := Finset.sum_le_sum (s:=Finset.univ) (fun i _ => hp i) + simp only [Finset.sum_add_distrib] at hs + change m-(∑ i,w i*err i)-(∑ i,A*(w i)^2/(2*δ*W i))-(∑ i,W i*residual i) ≤ final + linarith + +lemma sum_succ_real (n : ℕ) : + (∑ i ∈ Finset.range n, ((i:ℝ)+1)) = (n:ℝ)*((n:ℝ)+1)/2 := by + induction n with + | zero => simp + | succ n ih => rw [Finset.sum_range_succ,ih]; push_cast; ring + +lemma fin_prefix_succ {n : ℕ} (i : Fin n) : + (∑ j : Fin n, if j ≤ i then ((j:ℕ):ℝ)+1 else 0) = + ((i:ℕ)+1:ℝ)*(((i:ℕ):ℝ)+2)/2 := by + change (∑ j : Fin n, if (j:ℕ) ≤ (i:ℕ) then ((j:ℕ):ℝ)+1 else 0) = _ + rw [Fin.sum_univ_eq_sum_range (fun j : ℕ => if j ≤ (i:ℕ) then (j:ℝ)+1 else 0)] + have he : (∑ j ∈ Finset.range n, if j ≤ (i:ℕ) then (j:ℝ)+1 else 0) = + ∑ j ∈ Finset.range ((i:ℕ)+1), ((j:ℝ)+1) := by + rw [← Finset.sum_filter] + congr 1 + ext j + simp only [Finset.mem_filter,Finset.mem_range] + omega + rw [he,sum_succ_real] + push_cast + ring + +def triangle {n : ℕ} (i : Fin n) : ℝ := 2*(((i:ℕ):ℝ)+1)/((n:ℝ)*((n:ℝ)+1)) + +lemma triangle_nonneg {n : ℕ} (i : Fin n) : 0 ≤ triangle i := by unfold triangle; positivity + +lemma triangle_sum {n : ℕ} (hn : 0 < n) : (∑ i : Fin n, triangle i) = 1 := by + simp only [triangle] + rw [←Finset.sum_div,←Finset.mul_sum,Fin.sum_univ_eq_sum_range (fun j : ℕ => (j:ℝ)+1),sum_succ_real] + have hnR : (0:ℝ) < n := by exact_mod_cast hn + field_simp + +lemma triangle_prefix {n : ℕ} (i : Fin n) : + (∑ j : Fin n, if j ≤ i then triangle j else 0) = + ((((i:ℕ):ℝ)+1)*(((i:ℕ):ℝ)+2))/((n:ℝ)*((n:ℝ)+1)) := by + have he : ∀ j : Fin n, (if j ≤ i then triangle j else 0) = + 2*(if j ≤ i then ((j:ℕ):ℝ)+1 else 0)/((n:ℝ)*((n:ℝ)+1)) := by + intro j + by_cases h : j ≤ i <;> simp [triangle,h] + simp_rw [he] + rw [← Finset.sum_div,← Finset.mul_sum,fin_prefix_succ] + ring + +lemma triangle_prefix_pos {n : ℕ} (i : Fin n) : 0 < ∑ j : Fin n, if j ≤ i then triangle j else 0 := by + rw [triangle_prefix] + have hn : (0:ℝ) < n := by exact_mod_cast (Nat.zero_lt_of_lt i.isLt) + positivity + +theorem triangle_remainder {n : ℕ} (hn : 0 < n) {A δ : ℝ} + (hA : 0 ≤ A) (hδ : 0 < δ) : + (∑ i : Fin n, A*(triangle i)^2/(2*δ*(∑ j : Fin n, if j ≤ i then triangle j else 0))) ≤ + 2*A/(δ*(n:ℝ)) := by + have hnR : (0:ℝ) < n := by exact_mod_cast hn + have hh : ∀ i : Fin n, + A*(triangle i)^2/(2*δ*(∑ j : Fin n, if j ≤ i then triangle j else 0)) ≤ + 2*A/(δ*(n:ℝ)*((n:ℝ)+1)) := by + intro i + rw [triangle_prefix] + dsimp [triangle] + have hi : (0:ℝ) ≤ (i:ℕ) := Nat.cast_nonneg _ + field_simp + nlinarith + calc + _ ≤ ∑ _i : Fin n, 2*A/(δ*(n:ℝ)*((n:ℝ)+1)) := Finset.sum_le_sum (fun i _ => hh i) + _ = 2*A/(δ*((n:ℝ)+1)) := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; field_simp + _ ≤ _ := div_le_div_of_nonneg_left (by positivity) (by positivity) (by nlinarith) + +open scoped RealInnerProductSpace +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] + +theorem contraction_loss_lower (C : H →ₗ[ℝ] H) (eta g : H) + (horth : ⟪eta,g⟫ = 0) (hg : ‖C g‖ ≤ ‖g‖) : + ‖eta‖^2 - 2*⟪C eta,C (eta+g)⟫ ≤ ‖eta+g‖^2-‖C (eta+g)‖^2 := by + have h0 := norm_add_sq_real eta g + have h1 := norm_add_sq_real (C eta) (C g) + rw [horth,mul_zero,add_zero] at h0 + have hcg : ‖C g‖^2 ≤ ‖g‖^2 := sq_le_sq₀ (norm_nonneg _) (norm_nonneg _) |>.mpr hg + simp only [map_add,inner_add_right,real_inner_self_eq_norm_sq] + nlinarith [sq_nonneg ‖C eta‖] + +theorem finite_future_loss {n : ℕ} (hn : 0 < n) + (partLoss energy loss residual err pair : Fin n → ℝ) + (m final A δ : ℝ) (hA : 0 ≤ A) (hδ : 0 < δ) + (henergy : ∀ i, 0 ≤ energy i) + (hpair : ∀ i, (pair i)^2 ≤ A*energy i) + (hloss : ∀ i, 2*δ*energy i ≤ loss i+residual i) + (hinitial : ∀ i, m-err i-2*pair i ≤ partLoss i) + (htelescope : ∀ i, partLoss i+(∑ j, if i ≤ j then loss j else 0) ≤ final) : + m-(∑ i,triangle i*err i)-2*A/(δ*(n:ℝ))- + (∑ i,(∑ j,if j ≤ i then triangle j else 0)*residual i) ≤ final := by + have hh := weighted_leakage (triangle (n:=n)) (fun _ => final) err pair energy loss residual + m final A δ hA hδ triangle_nonneg (triangle_sum hn) triangle_prefix_pos + henergy hpair hloss (fun i => by linarith [hinitial i,htelescope i]) (fun _ => le_rfl) + have ht := triangle_remainder hn hA hδ + linarith + +end + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] +open scoped RealInnerProductSpace + +def chain (C : ℕ → H →ₗ[ℝ] H) : ℕ → H →ₗ[ℝ] H + | 0 => LinearMap.id + | j+1 => (C j).comp (chain C j) + +@[simp] lemma chain_zero (C : ℕ → H →ₗ[ℝ] H) (v : H) : chain C 0 v=v := rfl +@[simp] lemma chain_succ (C : ℕ → H →ₗ[ℝ] H) (j : ℕ) (v : H) : + chain C (j+1) v=C j (chain C j v) := rfl + +lemma chain_contraction (C : ℕ → H →ₗ[ℝ] H) (n : ℕ) + (hC : ∀ j,j simp + | succ n ih => + exact (hC n (Nat.lt_succ_self n) _).trans (ih (fun j hj => hC j (by omega))) + +lemma suffix_telescope (u : ℕ → ℝ) (m n : ℕ) : + (∑ j ∈ Finset.range n,if m≤j then u j-u (j+1) else 0) = + if m≤n then u m-u n else 0 := by + induction n with + | zero => by_cases hm : m=0 <;> simp [hm] + | succ n ih => + rw [Finset.sum_range_succ,ih] + by_cases hm : m≤n + · simp only [ite_eq_left hm,ite_eq_left (show m≤n+1 by omega)] + ring + · by_cases he : m=n+1 + · subst m + simp + · simp [hm,show ¬m≤n+1 by omega] + +lemma suffix_telescope_fin {n : ℕ} (u : ℕ → ℝ) (i : Fin n) : + (∑ j : Fin n,if i ≤ j then u j-u (j+1) else 0) = u i-u n := by + have hh := suffix_telescope u (i:ℕ) n + rw [ite_eq_left (Nat.le_of_lt i.isLt)] at hh + simpa only [Fin.le_iff_val_le_val] using + ((Fin.sum_univ_eq_sum_range (fun j : ℕ => if (i:ℕ) ≤ j then u j-u (j+1) else 0) n).trans hh) + +theorem contraction_chain_leakage (C : ℕ → H →ₗ[ℝ] H) (n : ℕ) (hn : 0 ‖chain C j (eta+g)‖^2 + have hp : ∀ i : Fin n,‖eta‖^2-2*err i-2*pair i ≤ ‖eta+g‖^2-u i := by + intro i + have h := contraction_loss_lower (chain C i) eta g horth + (chain_contraction C i (fun j hj => hC j (hj.trans i.isLt)) g) + dsimp only [u] + linarith [happrox i] + have ht : ∀ i : Fin n,(‖eta+g‖^2-u i)+ + (∑ j : Fin n,if i ≤ j then u j-u (j+1) else 0) ≤ + ‖eta+g‖^2-u n := by + intro i + rw [suffix_telescope_fin] + linarith + have h := finite_future_loss hn (fun i => ‖eta+g‖^2-u i) energy + (fun i => u i-u (i+1)) residual (fun i => 2*err i) pair + (‖eta‖^2) (‖eta+g‖^2-u n) A δ hA hδ henergy hpair henergy_loss hp ht + have he : (∑ i : Fin n,triangle i*(2*err i)) = 2*(∑ i,triangle i*err i) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + rw [he] at h + exact h + +end Heisenberg.FiniteLeakage + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/BoxCoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/BoxCoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..be4f5723b5aefa5ef236247700f99a02d0b89582 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/BoxCoding.lean @@ -0,0 +1,368 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.PrefixCoding + +namespace OAI + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} +open Stream' + +theorem disjoint_of_first_difference {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (p u v : List S) (a b : S) (hab : digit a + 1 < digit b) : + Disjoint (interval r digit (p ++ a :: u)) (interval r digit (p ++ b :: v)) := by + apply Set.disjoint_left.mpr + intro x hx hy + have hh := prefix_gap hr digit hd₀ hd₁ p u v a b hx hy + have hp : 0 < r ^ (p.length + 1) * (digit b - digit a - 1) := + mul_pos (pow_pos hr _) (by linarith) + linarith + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Recorder.Instruction +variable {Q Γ : Type*} + +def sourcePrefixes (r : Instruction Q Γ) : Fin 3 → List (Letter Q Γ) := + ![r.sourceLeft, r.sourceRight, r.sourceHistory] + +def targetPrefixes (r : Instruction Q Γ) : Fin 3 → List (Letter Q Γ) := + ![r.targetLeft, r.targetRight, r.targetHistory] + +theorem balanced_determinant (inst : Instruction Q Γ) (h : inst.Balanced) + {r : ℝ} (hr : r ≠ 0) : + Matrix.det (Matrix.diagonal (Coding.scales r inst.sourcePrefixes inst.targetPrefixes)) = 1 := by + apply Coding.determinant_one hr + simpa [sourcePrefixes, targetPrefixes, Fin.sum_univ_succ, Instruction.Balanced, + add_assoc] using h + +end BalancedTransport.Recorder.Instruction +end + +noncomputable section +namespace BalancedTransport + +theorem Recorder.Row.determinant_one {Q Γ : Type*} (M : Recorder.Machine Q Γ) + (row : Recorder.Row Q Γ) {r : ℝ} (hr : r ≠ 0) : + Matrix.det (Matrix.diagonal (Coding.scales r + (row.instruction M).sourcePrefixes (row.instruction M).targetPrefixes)) = 1 := + (row.instruction M).balanced_determinant (row.balanced M) hr + +theorem residual_zero_pressure_solution (ν : ℝ) (U : Velocity) + (hU : Smooth U) (hzero : ∀ x, U 0 x = 0) + (hdiv : ∀ t, 0 ≤ t → ∀ x, div U t x = 0) : + ZeroDataSolution ν (affineForce (inertialCoefficient U) (viscousCoefficient U) ν) + U (fun _ _ => 0) := by + refine ⟨hU, contDiffOn_const, hzero, hdiv, ?_⟩ + intro t ht x + have hp : gradient (fun _ _ => 0) t x = 0 := by + ext i + simp [gradient, spaceD] + rw [hp] + simp only [affineForce, inertialCoefficient, viscousCoefficient, smul_neg, neg_zero, zero_add] + abel + +end BalancedTransport +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} + +theorem first_difference {u v : List S} (hu : ¬ u.IsPrefix v) (hv : ¬ v.IsPrefix u) : + ∃ p a b u' v', u = p ++ a :: u' ∧ v = p ++ b :: v' ∧ a ≠ b := by + classical + induction u generalizing v with + | nil => exact False.elim (hu ⟨v, by simp⟩) + | cons a u ih => + cases v with + | nil => exact False.elim (hv ⟨a :: u, by simp⟩) + | cons b v => + by_cases hab : a = b + · subst b + have hu' : ¬u.IsPrefix v := by + rintro ⟨w, hw⟩ + exact hu ⟨w, by simpa using congrArg (List.cons a) hw⟩ + have hv' : ¬v.IsPrefix u := by + rintro ⟨w, hw⟩ + exact hv ⟨w, by simpa using congrArg (List.cons a) hw⟩ + obtain ⟨p, b, c, u', v', hu'', hv'', hbc⟩ := ih hu' hv' + exact ⟨a :: p, b, c, u', v', by simp [hu''], by simp [hv''], hbc⟩ + · exact ⟨[], a, b, u, v, rfl, rfl, hab⟩ + +theorem incompatible_intervals_disjoint {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (hgap : ∀ a b, a ≠ b → digit a + 1 < digit b ∨ digit b + 1 < digit a) + {u v : List S} (hu : ¬u.IsPrefix v) (hv : ¬v.IsPrefix u) : + Disjoint (interval r digit u) (interval r digit v) := by + obtain ⟨p, a, b, u', v', rfl, rfl, hab⟩ := first_difference hu hv + rcases hgap a b hab with hab' | hba' + · exact disjoint_of_first_difference hr digit hd₀ hd₁ p u' v' a b hab' + · exact (disjoint_of_first_difference hr digit hd₀ hd₁ p v' u' b a hba').symm + +theorem comparable_of_intersection {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (hgap : ∀ a b, a ≠ b → digit a + 1 < digit b ∨ digit b + 1 < digit a) + {u v : List S} {x : ℝ} (hu : x ∈ interval r digit u) (hv : x ∈ interval r digit v) : + u.IsPrefix v ∨ v.IsPrefix u := by + by_contra h + push Not at h + exact Set.disjoint_left.mp (incompatible_intervals_disjoint hr digit hd₀ hd₁ hgap h.1 h.2) + hu hv + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} +open Stream' + +theorem common_extensions (filler : S) {u v : List S} + (h : u.IsPrefix v ∨ v.IsPrefix u) : + ∃ s t : Stream' S, u ++ₛ s = v ++ₛ t := by + rcases h with ⟨w, rfl⟩ | ⟨w, rfl⟩ + · exact ⟨w ++ₛ Stream'.const filler, Stream'.const filler, + (Stream'.append_append_stream _ _ _).symm⟩ + · exact ⟨Stream'.const filler, w ++ₛ Stream'.const filler, + Stream'.append_append_stream _ _ _⟩ + +def oddDigit {n : ℕ} (a : Fin n) : Fin (2 * n + 1) := + ⟨2 * a.val + 1, by omega⟩ + +theorem oddDigit_pos {n : ℕ} (a : Fin n) : 0 < (oddDigit a : ℝ) := by + dsimp [oddDigit] + positivity + +theorem oddDigit_upper {n : ℕ} (a : Fin n) : + (oddDigit a : ℝ) + 1 < (2 * n + 1 : ℕ) := by + have hh : (2 * a.val + 1) + 1 < 2 * n + 1 := by omega + exact_mod_cast hh + +theorem oddDigit_gap {n : ℕ} (a b : Fin n) (hab : a ≠ b) : + (oddDigit a : ℝ) + 1 < (oddDigit b : ℝ) ∨ + (oddDigit b : ℝ) + 1 < (oddDigit a : ℝ) := by + have hv : a.val ≠ b.val := fun hh => hab (Fin.ext hh) + rcases lt_or_gt_of_ne hv with h | h + · left + have hh : (2 * a.val + 1) + 1 < 2 * b.val + 1 := by omega + exact_mod_cast hh + · right + have hh : (2 * b.val + 1) + 1 < 2 * a.val + 1 := by omega + exact_mod_cast hh + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} + +def box (r : ℝ) (digit : S → ℝ) (o : Space) (u : Fin 3 → List S) : Set Space := + {x | ∀ i, x i - o i ∈ interval r digit (u i)} + +def boxMap (r : ℝ) (digit : S → ℝ) (o o' : Space) + (u v : Fin 3 → List S) (x : Space) : Space := + fun i => o' i + replacement r digit (u i) (v i) (x i - o i) + +theorem boxMap_image {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (o o' : Space) (u v : Fin 3 → List S) : + boxMap r digit o o' u v '' box r digit o u = box r digit o' v := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ i + have hi : replacement r digit (u i) (v i) (x i - o i) ∈ interval r digit (v i) := by + rw [← replacement_interval hr digit (u i) (v i)] + exact ⟨x i - o i, hx i, rfl⟩ + simpa only [boxMap, add_sub_cancel_left] using hi + · intro hy + have hex : ∀ i, ∃ z : ℝ, z ∈ interval r digit (u i) ∧ + replacement r digit (u i) (v i) z = y i - o' i := by + intro i + have hi := hy i + rw [← replacement_interval hr digit (u i) (v i)] at hi + exact hi + choose z hz he using hex + refine ⟨fun i => o i + z i, ?_, ?_⟩ + · intro i + simpa only [add_sub_cancel_left] using hz i + · funext i + simp only [boxMap, add_sub_cancel_left, he] + ring + +theorem boxMap_sub (r : ℝ) (digit : S → ℝ) (o o' : Space) + (u v : Fin 3 → List S) (x y : Space) (i : Fin 3) : + boxMap r digit o o' u v x i - boxMap r digit o o' u v y i = + scales r u v i * (x i - y i) := by + dsimp [boxMap, replacement, scales] + ring + +def codedPoint {B : ℕ} (digit : S → Fin B) (o : Space) (s : Fin 3 → Stream' S) : Space := + fun i => o i + stream digit (s i) + +theorem codedPoint_mem_box {B : ℕ} (digit : S → Fin B) (o : Space) + (u : Fin 3 → List S) (s : Fin 3 → Stream' S) : + codedPoint digit o (fun i => u i ++ₛ s i) ∈ + box (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) o u := by + intro i + simpa only [codedPoint, add_sub_cancel_left] using + stream_append_mem_interval digit (u i) (s i) + +theorem boxMap_codedPoint {B : ℕ} (hB : B ≠ 0) (digit : S → Fin B) (o o' : Space) + (u v : Fin 3 → List S) (s : Fin 3 → Stream' S) : + boxMap (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) o o' u v + (codedPoint digit o (fun i => u i ++ₛ s i)) = + codedPoint digit o' (fun i => v i ++ₛ s i) := by + funext i + simp only [boxMap, codedPoint, add_sub_cancel_left] + rw [replacement_stream hB] + +def origin (k : ℕ) : Space := ![4 * (k : ℝ), 0, 0] + +theorem control_eq_of_box_intersection {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + {k l : ℕ} {u v : Fin 3 → List S} {x : Space} + (hu : x ∈ box r digit (origin k) u) (hv : x ∈ box r digit (origin l) v) : k = l := by + have hu' := interval_subset_unit hr digit hd₀ hd₁ (u 0) (hu 0) + have hv' := interval_subset_unit hr digit hd₀ hd₁ (v 0) (hv 0) + simp only [origin, Matrix.cons_val_zero, Set.mem_Icc] at hu' hv' + rcases lt_trichotomy k l with h | h | h + · have h' : (k : ℝ) + 1 ≤ (l : ℝ) := by exact_mod_cast h + linarith [hu'.2, hv'.1] + · exact h + · have h' : (l : ℝ) + 1 ≤ (k : ℝ) := by exact_mod_cast h + linarith [hv'.2, hu'.1] + +theorem box_compact (r : ℝ) (digit : S → ℝ) (o : Space) (u : Fin 3 → List S) : + IsCompact (box r digit o u) := by + have he : box r digit o u = Set.pi Set.univ + (fun i => Set.Icc (o i + word r digit (u i)) + (o i + word r digit (u i) + r ^ (u i).length)) := by + ext x + simp only [box, Set.mem_ofPred_eq, Set.mem_univ_pi, interval, Set.mem_Icc] + congr! 1 with i + constructor <;> rintro ⟨h₁, h₂⟩ <;> constructor <;> linarith + rw [he] + exact isCompact_univ_pi (fun _ => isCompact_Icc) + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} + +def placement [Fintype Q] [DecidableEq Q] (M : Machine Q Γ) (s : Control Q) : ℕ := + if s = .ready M.halt then 0 else (Fintype.equivFin (Control Q) s).val + 1 + +@[simp] theorem placement_halt [Fintype Q] [DecidableEq Q] (M : Machine Q Γ) : + placement M (.ready M.halt) = 0 := by simp [placement] + +theorem placement_positive [Fintype Q] [DecidableEq Q] (M : Machine Q Γ) + (s : Control Q) (hs : s ≠ .ready M.halt) : 0 < placement M s := by simp [placement, hs] + +theorem placement_injective [Fintype Q] [DecidableEq Q] (M : Machine Q Γ) : + Function.Injective (placement M) := by + intro s t h + by_cases hs : s = .ready M.halt <;> by_cases ht : t = .ready M.halt + · exact hs.trans ht.symm + · simp [placement, hs, ht] at h + · simp [placement, hs, ht] at h + · simp only [placement, hs, ht, ↓reduceIte, Nat.add_right_cancel_iff] at h + exact (Fintype.equivFin (Control Q)).injective (Fin.ext h) + +def Instruction.sourceBox (inst : Instruction Q Γ) (r : ℝ) (digit : Letter Q Γ → ℝ) + (id : Control Q → ℕ) : Set Space := + Coding.box r digit (Coding.origin (id inst.sourceControl)) inst.sourcePrefixes + +def Instruction.targetBox (inst : Instruction Q Γ) (r : ℝ) (digit : Letter Q Γ → ℝ) + (id : Control Q → ℕ) : Set Space := + Coding.box r digit (Coding.origin (id inst.targetControl)) inst.targetPrefixes + +theorem source_boxes_disjoint [DecidableEq Q] [DecidableEq Γ] (M : Machine Q Γ) + {r : ℝ} (hr : 0 < r) (digit : Letter Q Γ → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (hgap : ∀ a b, a ≠ b → digit a + 1 < digit b ∨ digit b + 1 < digit a) + (id : Control Q → ℕ) (hid : Function.Injective id) + {a b : Row Q Γ} (ha : a.valid M) (hb : b.valid M) (hab : a ≠ b) : + Disjoint ((a.instruction M).sourceBox r digit id) + ((b.instruction M).sourceBox r digit id) := by + apply Set.disjoint_left.mpr + intro x hx hy + have hcontrol : (a.instruction M).sourceControl = (b.instruction M).sourceControl := + hid (Coding.control_eq_of_box_intersection hr digit hd₀ hd₁ hx hy) + have hi : ∀ i : Fin 3, + ((a.instruction M).sourcePrefixes i).IsPrefix ((b.instruction M).sourcePrefixes i) ∨ + ((b.instruction M).sourcePrefixes i).IsPrefix ((a.instruction M).sourcePrefixes i) := by + intro i + apply Coding.comparable_of_intersection hr digit hd₀ hd₁ hgap (hx i) + simpa only [Instruction.sourceBox, hcontrol] using hy i + choose s t he using fun i => Coding.common_extensions (Letter.boundary : Letter Q Γ) (hi i) + have heq : (a.instruction M).source ⟨s 0, s 1, s 2⟩ = + (b.instruction M).source ⟨t 0, t 1, t 2⟩ := by + dsimp [Instruction.source] + congr 1 + · exact he 0 + · exact he 1 + · exact he 2 + exact hab (source_separation M ha hb heq).1 + +theorem target_boxes_disjoint (M : Machine Q Γ) + {r : ℝ} (hr : 0 < r) (digit : Letter Q Γ → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (hgap : ∀ a b, a ≠ b → digit a + 1 < digit b ∨ digit b + 1 < digit a) + (id : Control Q → ℕ) (hid : Function.Injective id) + {a b : Row Q Γ} (hab : a ≠ b) : + Disjoint ((a.instruction M).targetBox r digit id) + ((b.instruction M).targetBox r digit id) := by + apply Set.disjoint_left.mpr + intro x hx hy + have hcontrol : (a.instruction M).targetControl = (b.instruction M).targetControl := + hid (Coding.control_eq_of_box_intersection hr digit hd₀ hd₁ hx hy) + have hi : ∀ i : Fin 3, + ((a.instruction M).targetPrefixes i).IsPrefix ((b.instruction M).targetPrefixes i) ∨ + ((b.instruction M).targetPrefixes i).IsPrefix ((a.instruction M).targetPrefixes i) := by + intro i + apply Coding.comparable_of_intersection hr digit hd₀ hd₁ hgap (hx i) + simpa only [Instruction.targetBox, hcontrol] using hy i + choose s t he using fun i => Coding.common_extensions (Letter.boundary : Letter Q Γ) (hi i) + have heq : (a.instruction M).target ⟨s 0, s 1, s 2⟩ = + (b.instruction M).target ⟨t 0, t 1, t 2⟩ := by + dsimp [Instruction.target] + congr 1 + · exact he 0 + · exact he 1 + · exact he 2 + exact hab (target_separation M heq).1 + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] + +def base (Q Γ : Type*) [Fintype Q] [Fintype Γ] : ℕ := + 2 * Fintype.card (Letter Q Γ) + 1 + +def digit (a : Letter Q Γ) : Fin (base Q Γ) := + Coding.oddDigit (Fintype.equivFin (Letter Q Γ) a) + +theorem base_pos : 0 < base Q Γ := by simp [base] + +theorem digit_pos (a : Letter Q Γ) : 0 < (digit a : ℝ) := + Coding.oddDigit_pos _ + +theorem digit_upper (a : Letter Q Γ) : (digit a : ℝ) + 1 < base Q Γ := + Coding.oddDigit_upper _ + +theorem digit_gap (a b : Letter Q Γ) (hab : a ≠ b) : + (digit a : ℝ) + 1 < (digit b : ℝ) ∨ (digit b : ℝ) + 1 < (digit a : ℝ) := + Coding.oddDigit_gap _ _ (fun he => hab ((Fintype.equivFin _).injective he)) + +end BalancedTransport.Recorder +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Bridge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Bridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..57f4052d386921beb407c2f8404038aa7e9a1757 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Bridge.lean @@ -0,0 +1,277 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MachineHalting +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Periodic + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder.Exec +variable {Q Γ : Type*} {M : Machine Q Γ} + +theorem split {n m : ℕ} {c d : Configuration Q Γ} (h : Exec M (n + m) c d) : + ∃ e, Exec M n c e ∧ Exec M m e d := by + induction n generalizing c with + | zero => exact ⟨c, .refl _, by simpa using h⟩ + | succ n ih => + have hh : Exec M ((n + m) + 1) c d := by simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using h + cases hh with + | @cons _ _ b _ hcb hbd => + obtain ⟨e, hce, hed⟩ := ih hbd + exact ⟨e, .cons hcb hce, hed⟩ + +lemma take {m n : ℕ} {c d : Configuration Q Γ} (h : Exec M n c d) (hm : m ≤ n) : + ∃ e, Exec M m c e := by + have hh : Exec M (m + (n - m)) c d := by rwa [Nat.add_sub_of_le hm] + obtain ⟨e, he, _⟩ := hh.split + exact ⟨e, he⟩ + +lemma one_iff {c d : Configuration Q Γ} : Exec M 1 c d ↔ Step M c d := by + constructor + · intro h + cases h with + | cons h h' => cases h'; exact h + · exact single + +lemma snoc {n : ℕ} {c d : Configuration Q Γ} (h : Exec M (n + 1) c d) : + ∃ e, Exec M n c e ∧ Step M e d := by + obtain ⟨e, he, hed⟩ := h.split + exact ⟨e, he, one_iff.mp hed⟩ + +end BalancedTransport.Recorder.Exec +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint +variable {Q Γ : Type*} {M : Machine Q Γ} + +theorem arbitrarily_long_execution (M : Machine Q Γ) (c : Checkpoint Q Γ) + (hh : ¬∃ d, Relation.ReflTransGen (WorkStep M) c d ∧ d.state = M.halt) + (n : ℕ) : ∃ d, Exec M n (c.expand M) d := by + induction n using Nat.strong_induction_on generalizing c with + | h n ih => + have hc : c.state ≠ M.halt := fun he => hh ⟨c, .refl, he⟩ + let m := 2 * (c.right.length + 1) + 2 + have hm : 0 < m := by dsimp [m]; omega + have he : Exec M m (c.expand M) ((c.next M).expand M) := next_exec M c hc + by_cases hnm : n ≤ m + · exact he.take hnm + · have hh' : ¬∃ d, Relation.ReflTransGen (WorkStep M) (c.next M) d ∧ d.state = M.halt := by + rintro ⟨d, hd, hs⟩ + exact hh ⟨d, (Relation.ReflTransGen.single (show WorkStep M c (c.next M) from + ⟨hc, rfl⟩)).trans hd, hs⟩ + obtain ⟨d, hd⟩ := ih (n - m) (by omega) (c.next M) hh' + exact ⟨d, by simpa [Nat.add_sub_of_le (le_of_not_ge hnm)] using he.trans hd⟩ + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} {M : Machine Q Γ} +variable [Fintype Q] [Fintype Γ] [DecidableEq Q] + +lemma Configuration.code_guard {M : Machine Q Γ} {c : Configuration Q Γ} + (hc : c.control ≠ .ready M.halt) : 4 ≤ c.code M 0 := by + have hp : (1 : ℝ) ≤ placement M c.control := by + exact_mod_cast placement_positive M c.control hc + have hb := (Coding.stream_mem_interior base_pos digit digit_pos digit_upper (c.stacks 0)).1 + change 4 ≤ 4 * (placement M c.control : ℝ) + Coding.stream digit (c.stacks 0) + linarith + +def GuardedTemplate (M : Machine Q Γ) (v : Velocity) : Prop := + ∀ r : Row Q Γ, r.valid M → ∀ x, + x ∈ (r.instruction M).sourceBox (base Q Γ : ℝ)⁻¹ + (fun a => (digit a : ℝ)) (placement M) → + ∃ γ : ℝ → Space, + γ 0 = x ∧ γ 1 = (r.instruction M).fullMap M x ∧ + (∀ t ∈ Set.Icc (0 : ℝ) 1, + HasDerivWithinAt γ (v t (γ t)) (Set.Icc 0 1) t) ∧ + ((r.instruction M).targetControl ≠ .ready M.halt → + ∀ t ∈ Set.Icc (0 : ℝ) 1, γ t ∉ observer) + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Geometry +open Set +open scoped NNReal + +lemma IsMaterialFlow.shift_unit {U : Velocity} {X : MaterialFlow} + (hX : IsMaterialFlow U X) (a : Space) {b : ℝ} (hb : 0 ≤ b) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + HasDerivWithinAt (fun s => X (s + b) a) (U (t + b) (X (t + b) a)) (Icc 0 1) t := by + have hd := (hX.2 a (t + b) (add_nonneg ht.1 hb)).scomp t + ((hasDerivAt_id t).add_const b).hasDerivWithinAt + (show MapsTo (fun s : ℝ => s + b) (Icc 0 1) (Ici 0) from + fun s hs => add_nonneg hs.1 hb) + simpa only [Function.comp_def, one_smul, id_eq] using hd + +lemma loadedRepeat_on_later_unit {load v : Velocity} + (hl : TimeCollars load) (hv : TimeCollars v) (n : ℕ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + loadedRepeat load v (t + ((n : ℝ) + 1)) = v t := by + rw [loadedRepeat_after hl (by linarith [ht.1, Nat.cast_nonneg (α := ℝ) n])] + have hp := (repeatTemplate_zero_period v).nat_mul (n + 1) t + simp only [Nat.cast_add, Nat.cast_one, mul_one] at hp + rw [hp, repeatTemplate_on_unit hv ht] + +lemma materialFlow_loading {z : Space} {η : ℝ} (hη : 0 < η) + {v : Velocity} (hv : TimeCollars v) {X : MaterialFlow} + (hX : IsMaterialFlow (loadedRepeat (loadingVelocity z η) v) X) + {L : ℝ≥0} + (hL : ∀ t, 0 ≤ t → LipschitzWith L (loadingVelocity z η t)) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + X t fixedLabel = loadingPath z t := by + have hd : ∀ s ∈ Icc (0 : ℝ) 1, + HasDerivWithinAt (fun s => X s fixedLabel) + (loadingVelocity z η s (X s fixedLabel)) (Icc 0 1) s := by + intro s hs + have hh := (hX.2 fixedLabel s hs.1).mono (show Icc (0 : ℝ) 1 ⊆ Ici 0 from Icc_subset_Ici_self) + rwa [loadedRepeat_before hv hs.1 hs.2] at hh + exact curves_agree_on_overlap hL (HasDerivWithinAt.continuousOn hd) + (HasDerivWithinAt.continuousOn (fun s _ => (loadingPath_hasDerivAt z hη s).hasDerivWithinAt)) + hd (fun s _ => (loadingPath_hasDerivAt z hη s).hasDerivWithinAt) + ((hX.1 fixedLabel).trans (loadingPath_start z).symm) ht.1 ht.2 ht.2 + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Recorder +open Set BalancedTransport.Geometry +open scoped NNReal +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] [DecidableEq Q] +variable {M : Machine Q Γ} {v load : Velocity} {X : MaterialFlow} {L : ℝ≥0} + +lemma guarded_period_step (hg : GuardedTemplate M v) (hv : TimeCollars v) + (hl : TimeCollars load) + (hLip : ∀ t, 0 ≤ t → LipschitzWith L (v t)) + (hX : IsMaterialFlow (loadedRepeat load v) X) + {c d : Configuration Q Γ} (hcd : Step M c d) (n : ℕ) (a : Space) + (hstart : X ((n : ℝ) + 1) a = c.code M) : + X ((n : ℝ) + 2) a = d.code M ∧ + (d.control ≠ .ready M.halt → ∀ t ∈ Icc (0 : ℝ) 1, + X (t + ((n : ℝ) + 1)) a ∉ observer) := by + obtain ⟨r, hr, tails, rfl, rfl⟩ := hcd + obtain ⟨γ, hγ₀, hγ₁, hdγ, hguard⟩ := hg r hr _ + ((r.instruction M).source_code_mem M tails) + have hdX : ∀ s ∈ Icc (0 : ℝ) 1, + HasDerivWithinAt (fun s => X (s + ((n : ℝ) + 1)) a) + (v s (X (s + ((n : ℝ) + 1)) a)) (Icc 0 1) s := by + intro s hs + have hh := Geometry.IsMaterialFlow.shift_unit hX a + (show (0 : ℝ) ≤ (n : ℝ) + 1 by positivity) hs + rwa [loadedRepeat_on_later_unit hl hv n hs] at hh + have heq : ∀ t ∈ Icc (0 : ℝ) 1, X (t + ((n : ℝ) + 1)) a = γ t := by + intro t ht + exact curves_agree_on_overlap hLip (HasDerivWithinAt.continuousOn hdX) + (HasDerivWithinAt.continuousOn hdγ) hdX hdγ + (by simpa only [zero_add] using hstart.trans hγ₀.symm) ht.1 ht.2 ht.2 + constructor + · have he := (heq 1 ⟨by norm_num, le_rfl⟩).trans + (hγ₁.trans ((r.instruction M).fullMap_code M tails)) + simpa only [show (1 : ℝ) + ((n : ℝ) + 1) = (n : ℝ) + 2 by ring] using he + · intro hnh t ht + rw [heq t ht] + exact hguard hnh t ht + +lemma guarded_execution_endpoint (hg : GuardedTemplate M v) (hv : TimeCollars v) + (hl : TimeCollars load) + (hLip : ∀ t, 0 ≤ t → LipschitzWith L (v t)) + (hX : IsMaterialFlow (loadedRepeat load v) X) + {c d : Configuration Q Γ} {n : ℕ} (h : Exec M n c d) (a : Space) + (hinit : X 1 a = c.code M) : X ((n : ℝ) + 1) a = d.code M := by + induction n generalizing d with + | zero => cases h; simpa using hinit + | succ n ih => + obtain ⟨e, he, hed⟩ := h.snoc + have hn := guarded_period_step hg hv hl hLip hX hed n a (ih he) + simpa only [Nat.cast_add, Nat.cast_one, add_assoc, one_add_one_eq_two] using hn.1 + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Geometry +open Set + +lemma TimeCollars.repeats {v : Velocity} (hv : TimeCollars v) : RepeatsAfter 1 v := by + intro t ht + rw [hv t (Or.inr (by linarith)), hv (t + 1) (Or.inr (by linarith))] + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Recorder +open Set BalancedTransport.Geometry +open scoped NNReal +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] [DecidableEq Q] [DecidableEq Γ] + +theorem loaded_template_halting_iff (M : Machine Q Γ) (c : Checkpoint Q Γ) + {η : ℝ} (hη : 0 < η) {K : Set Space} (hK : IsCompact K) {v : Velocity} + (hv : JointSmooth v) (hc : TimeCollars v) (hs : SpatiallySupported K v) + (hg : GuardedTemplate M v) {X : MaterialFlow} + (hX : IsMaterialFlow (loadedRepeat (loadingVelocity ((c.expand M).code M) η) v) X) : + (∃ t : ℝ, 0 ≤ t ∧ X t fixedLabel ∈ observer) ↔ + ∃ d, Relation.ReflTransGen (Checkpoint.WorkStep M) c d ∧ d.state = M.halt := by + let z := (c.expand M).code M + have hlc : TimeCollars (loadingVelocity z η) := fun _ ht => loadingVelocity_zero ht + obtain ⟨L, hLip⟩ := spatial_lipschitz_of_boundedMixed hv + (boundedMixed_of_compact_repeating hK hv hs hc.repeats) + obtain ⟨L₀, hLip₀⟩ := spatial_lipschitz_of_boundedMixed (loadingVelocity_jointSmooth z η) + (loadingVelocity_boundedMixed z hη) + have hload : ∀ t ∈ Icc (0 : ℝ) 1, X t fixedLabel = loadingPath z t := + fun _ ht => materialFlow_loading hη hc hX hLip₀ ht + have hinit : X 1 fixedLabel = z := + (hload 1 ⟨by norm_num, le_rfl⟩).trans (loadingPath_end z) + have hend {n : ℕ} {d : Configuration Q Γ} (hd : Exec M n (c.expand M) d) : + X ((n : ℝ) + 1) fixedLabel = d.code M := + guarded_execution_endpoint hg hc hlc hLip hX hd fixedLabel hinit + constructor + · rintro ⟨t, ht, hobs⟩ + by_contra hn + have hstate : c.state ≠ M.halt := fun he => hn ⟨c, .refl, he⟩ + by_cases ht₁ : t ≤ 1 + · rw [hload t ⟨ht, ht₁⟩] at hobs + exact loadingPath_avoids_observer + (Configuration.code_guard (show (c.expand M).control ≠ .ready M.halt by + exact fun he => hstate (Control.ready.inj he))) t hobs + · let n : ℕ := ⌊t - 1⌋₊ + have hnf : (n : ℝ) ≤ t - 1 := Nat.floor_le (by linarith) + have hnt : t - 1 < (n : ℝ) + 1 := Nat.lt_floor_add_one (t - 1) + let s := t - ((n : ℝ) + 1) + have hs' : s ∈ Icc (0 : ℝ) 1 := by dsimp [s]; constructor <;> linarith + obtain ⟨e, he⟩ := c.arbitrarily_long_execution M hn (n + 1) + obtain ⟨d, hd, hde⟩ := he.snoc + have hne : e.control ≠ .ready M.halt := fun hh => + hn (Checkpoint.halt_reflection M he hh) + have hguard := (guarded_period_step hg hc hlc hLip hX hde n fixedLabel (hend hd)).2 + hne s hs' + have heq : s + ((n : ℝ) + 1) = t := sub_add_cancel _ _ + exact hguard (by rwa [heq]) + · intro hhalt + obtain ⟨n, d, hd, hh⟩ := (Checkpoint.halting_iff M c).mpr hhalt + exact ⟨(n : ℝ) + 1, by positivity, by rw [hend hd]; exact (code_mem_observer_iff M d).mpr hh⟩ + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.FiniteMachine +open BalancedTransport.Geometry + +theorem compiled_continuous_halting_iff (M : FiniteMachine) (w : Input M) + {η : ℝ} (hη : 0 < η) {K : Set Space} (hK : IsCompact K) {v : Velocity} + (hv : JointSmooth v) (hc : TimeCollars v) (hs : SpatiallySupported K v) + (hg : Recorder.GuardedTemplate M.normalized v) {X : MaterialFlow} + (hX : IsMaterialFlow + (loadedRepeat (loadingVelocity (((M.initialWork w).expand M.normalized).code M.normalized) η) v) X) : + (∃ t : ℝ, 0 ≤ t ∧ X t fixedLabel ∈ observer) ↔ Halts M w := + (Recorder.loaded_template_halting_iff M.normalized (M.initialWork w) hη hK hv hc hs hg hX).trans + (normalized_halting_iff M w) + +end BalancedTransport.FiniteMachine +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompactFamilies.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompactFamilies.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb71beef998322c828d525b256ebfb1eb7a382d7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompactFamilies.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.TimeRegularity + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] +variable {ι : Type*} [Fintype ι] + +lemma JointSmooth.sum {v : ι → Field F} (hv : ∀ i, JointSmooth (v i)) : + JointSmooth (fun t x => ∑ i, v i t x) := by + exact ContDiff.sum (fun i _ => hv i) + +lemma div_sum {v : ι → Velocity} (hv : ∀ i, JointSmooth (v i)) (t : ℝ) (x : Space) : + div (fun t x => ∑ i, v i t x) t x = ∑ i, div (v i) t x := by + have hd (i : ι) := ((hv i).slice t).differentiable (by simp) x + simp only [div, spaceD, fderiv_fun_sum (fun i _ => hd i), sum_apply, + Finset.sum_apply] + exact Finset.sum_comm + +def familyVelocity (a b : ι → Space) (c d : ι → ℝ → Space) (η : ℝ) : Velocity := + fun t x => ∑ i, movingBoxVelocity (a i) (b i) (c i) (d i) η t x + +lemma familyVelocity_jointSmooth {c d : ι → ℝ → Space} + (hc : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (c i)) + (hd : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (d i)) + (hn : ∀ i t j, d i t j ≠ 0) (a b : ι → Space) (η : ℝ) : + JointSmooth (familyVelocity a b c d η) := + JointSmooth.sum (fun i => movingBoxVelocity_jointSmooth (hc i) (hd i) (hn i) (a i) (b i) η) + +lemma familyVelocity_divergence {c d : ι → ℝ → Space} + (hc : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (c i)) + (hd : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (d i)) + (hn : ∀ i t j, d i t j ≠ 0) (a b : ι → Space) (η t : ℝ) (x : Space) : + div (familyVelocity a b c d η) t x = 0 := by + change div (fun t x => ∑ i, movingBoxVelocity (a i) (b i) (c i) (d i) η t x) t x = 0 + rw [div_sum + (fun i => movingBoxVelocity_jointSmooth (hc i) (hd i) (hn i) (a i) (b i) η)] + exact Finset.sum_eq_zero (fun i _ => + movingBoxVelocity_divergence (hc i) (hd i) (hn i) (a i) (b i) η t x) + +lemma tsupport_familyVelocity_subset (a b : ι → Space) (c d : ι → ℝ → Space) + {η : ℝ} (hη : 0 < η) (t : ℝ) : + tsupport (familyVelocity a b c d η t) ⊆ + ⋃ i, closedEnlargement (lowerEndpoint (a i) (c i) (d i) t) + (lowerEndpoint (b i) (c i) (d i) t) (2 * η) := by + apply closure_minimal _ (isClosed_iUnion_of_finite (fun _ => isCompact_Icc.isClosed)) + intro x hx + by_contra hn + apply hx + apply Finset.sum_eq_zero + intro i _ + apply image_eq_zero_of_notMem_tsupport + intro hi + exact hn (mem_iUnion.mpr ⟨i, + tsupport_movingBoxVelocity_subset (a i) (b i) (c i) (d i) hη t hi⟩) + +lemma openEnlargement_subset_closedEnlargement {a b : Space} {η δ : ℝ} + (h : η ≤ δ) : openEnlargement a b η ⊆ closedEnlargement a b δ := by + intro x hx + rw [mem_openEnlargement] at hx + rw [mem_closedEnlargement] + intro i + constructor <;> linarith [(hx i).1, (hx i).2] + +lemma familyVelocity_eq_on_plateau {a b : ι → Space} {c d : ι → ℝ → Space} + {η t : ℝ} (hη : 0 < η) (i : ι) {x : Space} + (hx : x ∈ openEnlargement (lowerEndpoint (a i) (c i) (d i) t) + (lowerEndpoint (b i) (c i) (d i) t) η) + (hsep : Pairwise fun i j => Disjoint + (closedEnlargement (lowerEndpoint (a i) (c i) (d i) t) + (lowerEndpoint (b i) (c i) (d i) t) (2 * η)) + (closedEnlargement (lowerEndpoint (a j) (c j) (d j) t) + (lowerEndpoint (b j) (c j) (d j) t) (2 * η))) : + familyVelocity a b c d η t x = movingBoxVelocity (a i) (b i) (c i) (d i) η t x := by + apply Finset.sum_eq_single i + · intro j _ hji + apply image_eq_zero_of_notMem_tsupport + intro hxj + exact Set.disjoint_left.mp (hsep (Ne.symm hji)) + (openEnlargement_subset_closedEnlargement (by linarith) hx) + (tsupport_movingBoxVelocity_subset (a j) (b j) (c j) (d j) hη t hxj) + · simp + +theorem familyVelocity_affinePath {a b : ι → Space} {c d : ι → ℝ → Space} + {η δ : ℝ} (hη : 0 < η) + (hc : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (c i)) + (hd : ∀ i, ContDiff ℝ (⊤ : ℕ∞) (d i)) + (hp : ∀ i t j, 0 < d i t j) (hdet : ∀ i t, ∏ j, d i t j = 1) + (i : ι) {z : Space} (hz : z ∈ openEnlargement (a i) (b i) δ) (t : ℝ) + (hscale : ∀ j, d i t j * δ ≤ η) + (hsep : Pairwise fun i j => Disjoint + (closedEnlargement (lowerEndpoint (a i) (c i) (d i) t) + (lowerEndpoint (b i) (c i) (d i) t) (2 * η)) + (closedEnlargement (lowerEndpoint (a j) (c j) (d j) t) + (lowerEndpoint (b j) (c j) (d j) t) (2 * η))) : + HasDerivAt (affinePath (c i) (d i) z) + (familyVelocity a b c d η t (affinePath (c i) (d i) z t)) t := by + rw [familyVelocity_eq_on_plateau hη i + (affinePath_mem_plateau_of_scaled_bound hz (hp i t) hscale) hsep] + exact affinePath_neighborhood hη (hc i) (hd i) (hp i) (hdet i) hz t hscale + +lemma familyVelocity_zero {a b : ι → Space} {c d : ι → ℝ → Space} {η t : ℝ} + (hc : ∀ i, deriv (c i) t = 0) (hd : ∀ i j, deriv (fun s => d i s j) t = 0) : + familyVelocity a b c d η t = 0 := by + ext x j + simp [familyVelocity, movingBoxVelocity_zero (hc _) (hd _)] + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Comparison.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Comparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ce7391e91e08ed4f8003d49eff75c884b2e897d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Comparison.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EnergyCurve +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EnergySlice + +namespace OAI + +noncomputable section +namespace BalancedTransport.Analysis +open MeasureTheory Filter Set +open scoped Topology ENNReal +open BalancedTransport.Geometry + +lemma difference_divergence {u U : Velocity} (hu : Smooth u) (hU : Smooth U) + {t : ℝ} (ht : 0 ≤ t) (hdu : ∀ x, div u t x = 0) (hdU : ∀ x, div U t x = 0) + (x : Space) : ∑ j, pd j (fun x => u t x - U t x) x j = 0 := by + simp only [pd_sub _ ((Smooth.slice hu ht).differentiable (by simp) x) + ((Smooth.slice hU ht).differentiable (by simp) x), Pi.sub_apply, + Finset.sum_sub_distrib] + exact sub_eq_zero.mpr ((hdu x).trans (hdU x).symm) + +lemma difference_equation {ν : ℝ} {f u U : Velocity} {p : Pressure} + (hu : ZeroDataSolution ν f u p) (hU : ZeroDataSolution ν f U (fun _ _ => 0)) + {t : ℝ} (ht : 0 ≤ t) (c : ℝ) (x : Space) (i : Fin 3) : + timeD u t x i - timeD U t x i = + ν * (∑ j, pd j (pd j (fun x => u t x - U t x)) x i) - + (∑ j, u t x j * pd j (fun x => u t x - U t x) x i) - + (∑ j, (u t x j - U t x j) * pd j (U t) x i) - pd i (fun x => p t x - c) x := by + have hus := Smooth.slice hu.1 ht + have hUs := Smooth.slice hU.1 ht + have hd (j : Fin 3) : pd j (fun x => u t x - U t x) = fun x => pd j (u t) x - pd j (U t) x := + funext (fun x => pd_sub j (hus.differentiable (by simp) x) (hUs.differentiable (by simp) x)) + have hdu := congrFun (hu.2.2.2.2 t ht x) i + have hdU := congrFun (hU.2.2.2.2 t ht x) i + simp only [convection, laplacian, gradient, Pi.add_apply, Pi.neg_apply, Pi.smul_apply, + Finset.sum_apply, smul_eq_mul] at hdu hdU + have hu' : timeD u t x i + (∑ j, u t x j * pd j (u t) x i) = + -pd i (p t) x + ν * (∑ j, pd j (pd j (u t)) x i) + f t x i := hdu + have hU' : timeD U t x i + (∑ j, U t x j * pd j (U t) x i) = + ν * (∑ j, pd j (pd j (U t)) x i) + f t x i := by + change timeD U t x i + (∑ j, U t x j * pd j (U t) x i) = + -pd i (fun _ => (0 : ℝ)) x + ν * (∑ j, pd j (pd j (U t)) x i) + f t x i at hdU + simpa only [pd_const, neg_zero, zero_add] using hdU + simp only [hd, pd_sub _ ((pd_contDiff _ hus).differentiable (by simp) x) + ((pd_contDiff _ hUs).differentiable (by simp) x), Pi.sub_apply, pd_sub_const] + simp only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] at hu' hU' ⊢ + linear_combination hu' - hU' + +lemma constant_pressure_of_velocity_eq {ν : ℝ} {f u U : Velocity} {p : Pressure} + (hu : ZeroDataSolution ν f u p) (hU : ZeroDataSolution ν f U (fun _ _ => 0)) + (he : ∀ t, 0 ≤ t → ∀ x, u t x = U t x) : + ∀ t, 0 ≤ t → ∀ x y, p t x = p t y := by + have hf : ForwardEq u U := fun t ht => funext (he t ht) + intro t ht + have hg (x : Space) : gradient p t x = 0 := by + have hd := hu.2.2.2.2 t ht x + have hD := hU.2.2.2.2 t ht x + have heD := congrFun (hf.mixedD [none] t ht) x + change timeD u t x = timeD U t x at heD + have heL : laplacian u t x = laplacian U t x := by + apply Finset.sum_congr rfl + intro i _ + exact congrFun (hf.mixedD [some i, some i] t ht) x + have heC : convection u t x = convection U t x := by + apply Finset.sum_congr rfl + intro i _ + rw [he t ht x, show spaceD i u t x = spaceD i U t x from + congrFun (hf.mixedD [some i] t ht) x] + have hz : gradient (fun _ _ => 0) t x = 0 := by ext i; simp [gradient, spaceD] + rw [heD, heL, heC] at hd + rw [hz, neg_zero, zero_add] at hD + have hh : -gradient p t x = 0 := by + exact add_left_cancel (a := ν • laplacian U t x + f t x) + (by simpa only [add_assoc, zero_add, add_zero, add_comm, add_left_comm] using hd.symm.trans hD) + exact neg_eq_zero.mp hh + apply is_const_of_fderiv_eq_zero ((Smooth.slice hu.2.1 ht).differentiable (by simp)) + intro x + ext y + have hd (i : Fin 3) : fderiv ℝ (p t) x (Pi.single i 1) = 0 := congrFun (hg x) i + have hy : y = ∑ i : Fin 3, y i • (Pi.single i (1 : ℝ) : Space) := by + ext i + simp only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] + fin_cases i <;> simp + rw [hy, map_sum] + simp only [map_smul, hd, smul_zero, Finset.sum_const_zero, zero_apply] + +theorem unique_in_comparison {ν : ℝ} (hν : 0 ≤ ν) {f U : Velocity} + (hU : ZeroDataSolution ν f U (fun _ _ => 0)) (hUC : ComparisonClass U (fun _ _ => 0)) : + UniqueInComparison ν f U := by + intro u p hu hc + obtain ⟨Vu, Wu, hVu, _, hdu⟩ := hc.2.1 + obtain ⟨VU, WU, hVU, _, hdU⟩ := hUC.2.1 + let V : ℝ → Lp Space 2 (volume : Measure Space) := fun t => Vu t - VU t + let W : ℝ → Lp Space 2 (volume : Measure Space) := fun t => Wu t - WU t + have hV : ContinuousOn V (Ici 0) := hVu.sub hVU + have hv (t : ℝ) (ht : 0 ≤ t) : (V t : Space → Space) =ᵐ[volume] fun x => u t x - U t x := + (Lp.coeFn_sub _ _).trans ((hdu t ht).1.sub (hdU t ht).1) + have hw (t : ℝ) (ht : 0 ≤ t) : (W t : Space → Space) =ᵐ[volume] fun x => timeD u t x - timeD U t x := + (Lp.coeFn_sub _ _).trans ((hdu t ht).2.1.sub (hdU t ht).2.1) + have hd (t : ℝ) (ht : 0 ≤ t) : HasDerivWithinAt V (W t) (Ici 0) t := + (hdu t ht).2.2.sub (hdU t ht).2.2 + have hzero : V 0 = 0 := by + apply Lp.ext + filter_upwards [hv 0 le_rfl, Lp.coeFn_zero Space 2 (volume : Measure Space)] with x hx hy + rw [hx, hu.2.2.1, hU.2.2.1, sub_self, hy] + rfl + have he : ∀ t, 0 ≤ t → ∀ x, u t x = U t x := by + intro T hT + obtain ⟨C, hC, hbU⟩ := hUC.2.2.1 T hT + obtain ⟨A, _, hbu⟩ := hc.2.2.1 T hT + obtain ⟨c, hpc⟩ := hc.2.2.2 + have hbound (t : ℝ) (ht : t ∈ Ico (0 : ℝ) T) : + l2EnergyRate (V t) (W t) ≤ (12 * C) * l2Energy (V t) := by + have hpair := energy_pairing_bound + ((sliceH2_of_CH hu.1 hc.1 ht.1).sub (sliceH2_of_CH hU.1 hUC.1 ht.1)) + (Smooth.slice hu.1 ht.1) (Smooth.slice hU.1 ht.1) + ((Smooth.slice hu.2.1 ht.1).sub contDiff_const) hν hC + (fun x => (hbu t ⟨ht.1, ht.2.le⟩ x).1) + (fun x j => (hbu t ⟨ht.1, ht.2.le⟩ x).2 j) + (fun x j => (hbU t ⟨ht.1, ht.2.le⟩ x).2 j) + (hu.2.2.2.1 t ht.1) + (difference_divergence hu.1 hU.1 ht.1 (hu.2.2.2.1 t ht.1) (hU.2.2.2.1 t ht.1)) + (CH.memLp hpc [] (by simp) ht.1) (fun j => CH.memLp hpc [j] (by simp) ht.1) + (difference_equation hu hU ht.1 (c t)) + simp only [l2EnergyRate, l2Inner_integral (hv t ht.1) (hw t ht.1), + l2Energy_integral (hv t ht.1), Pi.sub_apply] + simpa only [Pi.sub_apply, ← mul_assoc, show (2 : ℝ) * 6 = 12 from by norm_num] using + mul_le_mul_of_nonneg_left hpair (by norm_num : (0 : ℝ) ≤ 2) + have hz := l2Energy_eq_zero_of_bound hV hd hzero hT hbound + have hzv := l2Energy_zero_pointwise (hv T hT) + ((Smooth.slice hu.1 hT).continuous.sub (Smooth.slice hU.1 hT).continuous) hz + intro x + exact sub_eq_zero.mp (congrFun hzv x) + exact ⟨he, constant_pressure_of_velocity_eq hu hU he⟩ + +end BalancedTransport.Analysis +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompiledGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompiledGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..01bcf7191666e756424a7d2e92576560a23540ef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/CompiledGeometry.lean @@ -0,0 +1,201 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Bridge +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Routing +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MotionField + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Set +variable {ι : Type*} [Fintype ι] + +omit [Fintype ι] in +lemma BoxLayout.lower_mem {A : BoxLayout ι} (hp : A.Positive) (i : ι) : + A.center i - A.width i ∈ A.solid i := by + rw [BoxLayout.mem_solid] + intro k + exact ⟨le_rfl, by dsimp; linarith [hp i k]⟩ + +omit [Fintype ι] in +lemma BoxLayout.separated_of_disjoint {A : BoxLayout ι} (hp : A.Positive) + (hs : Pairwise fun i j => Disjoint (A.solid i) (A.solid j)) : A.Separated 0 := by + intro i j hij + by_contra! h + let x : Space := fun k => max (A.center i k - A.width i k) (A.center j k - A.width j k) + have hh (k : Fin 3) : + -(A.width i k + A.width j k) ≤ A.center i k - A.center j k ∧ + A.center i k - A.center j k ≤ A.width i k + A.width j k := by + have := h k + simp only [mul_zero, add_zero] at this + exact abs_le.mp this + have hi : x ∈ A.solid i := by + rw [BoxLayout.mem_solid] + intro k + refine ⟨le_max_left _ _, max_le ?_ ?_⟩ + · linarith [hp i k] + · linarith [(hh k).1] + have hj : x ∈ A.solid j := by + rw [BoxLayout.mem_solid] + intro k + refine ⟨le_max_right _ _, max_le ?_ ?_⟩ + · linarith [(hh k).2] + · linarith [hp j k] + exact Set.disjoint_left.mp (hs hij) hi hj + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Coding +open BalancedTransport.Geometry +variable {S ι : Type*} + +def layout (r : ℝ) (digit : S → ℝ) (o : ι → Space) (u : ι → Fin 3 → List S) : + BoxLayout ι where + center i k := o i k + word r digit (u i k) + r ^ (u i k).length / 2 + width i k := r ^ (u i k).length / 2 + +lemma layout_positive {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (o : ι → Space) (u : ι → Fin 3 → List S) : (layout r digit o u).Positive := by + intro i k + exact div_pos (pow_pos hr _) (by norm_num) + +lemma layout_solid [Fintype ι] (r : ℝ) (digit : S → ℝ) (o : ι → Space) + (u : ι → Fin 3 → List S) (i : ι) : + (layout r digit o u).solid i = box r digit (o i) (u i) := by + ext x + rw [BoxLayout.mem_solid] + change (∀ k, o i k + word r digit (u i k) + r ^ (u i k).length / 2 - + r ^ (u i k).length / 2 ≤ x k ∧ + x k ≤ o i k + word r digit (u i k) + r ^ (u i k).length / 2 + + r ^ (u i k).length / 2) ↔ + ∀ k, word r digit (u i k) ≤ x k - o i k ∧ + x k - o i k ≤ word r digit (u i k) + r ^ (u i k).length + constructor <;> intro h k <;> have := h k <;> constructor <;> linarith + +lemma layout_affineMap {r : ℝ} (hr : r ≠ 0) (digit : S → ℝ) (o p : ι → Space) + (u v : ι → Fin 3 → List S) (i : ι) (x : Space) : + (layout r digit o u).affineMap (layout r digit p v) i x = + boxMap r digit (o i) (p i) (u i) (v i) x := by + ext k + dsimp [BoxLayout.affineMap, layout, boxMap, replacement] + field_simp + ring + +lemma layout_volume (r : ℝ) (digit : S → ℝ) (o p : ι → Space) + (u v : ι → Fin 3 → List S) (i : ι) + (h : ∑ k, (u i k).length = ∑ k, (v i k).length) : + ∏ k, (layout r digit o u).width i k = ∏ k, (layout r digit p v).width i k := by + simp only [layout, Finset.prod_div_distrib, Finset.prod_pow_eq_pow_sum, h] + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Recorder +open BalancedTransport.Geometry +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] [DecidableEq Q] [DecidableEq Γ] + +abbrev ActiveRow (M : Machine Q Γ) := {r : Row Q Γ // r ∈ table M} + +def sourceLayout (M : Machine Q Γ) : BoxLayout (ActiveRow M) := + Coding.layout (base Q Γ : ℝ)⁻¹ (fun a : Letter Q Γ => (digit a : ℝ)) + (fun i => Coding.origin (placement M (i.val.instruction M).sourceControl)) + (fun i => (i.val.instruction M).sourcePrefixes) + +def targetLayout (M : Machine Q Γ) : BoxLayout (ActiveRow M) := + Coding.layout (base Q Γ : ℝ)⁻¹ (fun a : Letter Q Γ => (digit a : ℝ)) + (fun i => Coding.origin (placement M (i.val.instruction M).targetControl)) + (fun i => (i.val.instruction M).targetPrefixes) + +def safeRows (M : Machine Q Γ) : Set (ActiveRow M) := + {i | (i.val.instruction M).targetControl ≠ .ready M.halt} + +omit [DecidableEq Γ] in +lemma sourceLayout_solid (M : Machine Q Γ) (i : ActiveRow M) : + (sourceLayout M).solid i = (i.val.instruction M).sourceBox + (base Q Γ : ℝ)⁻¹ (fun a => (digit a : ℝ)) (placement M) := + Coding.layout_solid _ _ _ _ _ + +omit [DecidableEq Γ] in +lemma targetLayout_solid (M : Machine Q Γ) (i : ActiveRow M) : + (targetLayout M).solid i = (i.val.instruction M).targetBox + (base Q Γ : ℝ)⁻¹ (fun a => (digit a : ℝ)) (placement M) := + Coding.layout_solid _ _ _ _ _ + +omit [DecidableEq Γ] in +lemma sourceLayout_positive (M : Machine Q Γ) : (sourceLayout M).Positive := + Coding.layout_positive inverse_base_pos _ _ _ + +omit [DecidableEq Γ] in +lemma targetLayout_positive (M : Machine Q Γ) : (targetLayout M).Positive := + Coding.layout_positive inverse_base_pos _ _ _ + +lemma sourceLayout_separated (M : Machine Q Γ) : (sourceLayout M).Separated 0 := by + apply BoxLayout.separated_of_disjoint (sourceLayout_positive M) + intro i j hij + rw [sourceLayout_solid, sourceLayout_solid] + exact (compiled_boxes_disjoint M).1 i.property j.property (fun h => hij (Subtype.ext h)) + +lemma targetLayout_separated (M : Machine Q Γ) : (targetLayout M).Separated 0 := by + apply BoxLayout.separated_of_disjoint (targetLayout_positive M) + intro i j hij + rw [targetLayout_solid, targetLayout_solid] + exact (compiled_boxes_disjoint M).2 i.property j.property (fun h => hij (Subtype.ext h)) + +omit [DecidableEq Γ] in +lemma layouts_equal_volume (M : Machine Q Γ) (i : ActiveRow M) : + ∏ k, (sourceLayout M).width i k = ∏ k, (targetLayout M).width i k := by + apply Coding.layout_volume + simpa [Instruction.sourcePrefixes, Instruction.targetPrefixes, Fin.sum_univ_succ, + Instruction.Balanced, Nat.add_assoc] using i.val.balanced M + +omit [DecidableEq Γ] in +lemma sourceLayout_guard (M : Machine Q Γ) : (sourceLayout M).Guarded (safeRows M) := by + intro i _ + have hh := BoxLayout.lower_mem (sourceLayout_positive M) i + rw [sourceLayout_solid] at hh + have hn := source_box_guard M i.val ((mem_table M _).mp i.property) hh + change 2 < (sourceLayout M).center i 0 - (sourceLayout M).width i 0 + change 4 ≤ (sourceLayout M).center i 0 - (sourceLayout M).width i 0 at hn + linarith + +omit [DecidableEq Γ] in +lemma targetLayout_guard (M : Machine Q Γ) : (targetLayout M).Guarded (safeRows M) := by + intro i hi + have hh := BoxLayout.lower_mem (targetLayout_positive M) i + rw [targetLayout_solid] at hh + have hn := nonhalt_box_guard M _ hi _ hh + change 2 < (targetLayout M).center i 0 - (targetLayout M).width i 0 + change 4 ≤ (targetLayout M).center i 0 - (targetLayout M).width i 0 at hn + linarith + +omit [DecidableEq Γ] in +lemma layouts_affineMap (M : Machine Q Γ) (i : ActiveRow M) (x : Space) : + (sourceLayout M).affineMap (targetLayout M) i x = (i.val.instruction M).fullMap M x := + Coding.layout_affineMap inverse_base_pos.ne' _ _ _ _ _ _ _ + +theorem exists_guarded_template (M : Machine Q Γ) : + ∃ (v : Velocity) (K : Set Space), IsCompact K ∧ JointSmooth v ∧ TimeCollars v ∧ + SpatiallySupported K v ∧ (∀ t x, div v t x = 0) ∧ GuardedTemplate M v := by + obtain ⟨η, hη, ⟨m⟩⟩ := guarded_solid_box_motion (sourceLayout M) (targetLayout M) + (safeRows M) (sourceLayout_positive M) (targetLayout_positive M) + (sourceLayout_separated M) (targetLayout_separated M) (layouts_equal_volume M) + (sourceLayout_guard M) (targetLayout_guard M) + obtain ⟨K, hK, hs⟩ := m.velocity_compact_support hη + refine ⟨m.velocity, K, hK, m.velocity_jointSmooth, m.velocity_collars, hs, + m.velocity_divergence, ?_⟩ + intro r hr x hx + let i : ActiveRow M := ⟨r, (mem_table M r).mpr hr⟩ + have hm : x ∈ (sourceLayout M).solid i := by rwa [sourceLayout_solid] + refine ⟨m.path i x, m.path_start i x, ?_, ?_, ?_⟩ + · rw [m.path_end, layouts_affineMap] + · intro t _ + exact (m.path_hasDerivAt hη hm t).hasDerivWithinAt + · intro hsafe t _ + exact m.path_guarded hsafe hm t + +end BalancedTransport.Recorder +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputabilityRules.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputabilityRules.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b09b528fd47a8de56bf3494695f71166f967574 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputabilityRules.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericPrograms + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.ComputableRules +attribute [fun_prop] Computable +variable {α β γ : Type*} [Primcodable α] [Primcodable β] [Primcodable γ] + +@[fun_prop] lemma identity : Computable (fun x : α => x) := Computable.id + +@[fun_prop] lemma constant (b : β) : Computable (fun _ : α => b) := Computable.const b + +@[fun_prop] lemma compose (f : β → γ) (g : α → β) (hf : Computable f) (hg : Computable g) : + Computable (fun x => f (g x)) := hf.comp hg + +@[fun_prop] lemma fst (f : α → β × γ) (hf : Computable f) : + Computable (fun x => (f x).1) := Computable.fst.comp hf + +@[fun_prop] lemma snd (f : α → β × γ) (hf : Computable f) : + Computable (fun x => (f x).2) := Computable.snd.comp hf + +@[fun_prop] lemma pair (f : α → β) (g : α → γ) (hf : Computable f) (hg : Computable g) : + Computable (fun x => (f x, g x)) := hf.pair hg + +@[fun_prop] lemma addNat : Computable (fun p : ℕ × ℕ => p.1 + p.2) := Primrec.nat_add.to_comp + +@[fun_prop] lemma mulNat : Computable (fun p : ℕ × ℕ => p.1 * p.2) := Primrec.nat_mul.to_comp + +@[fun_prop] lemma subNat : Computable (fun p : ℕ × ℕ => p.1 - p.2) := Primrec.nat_sub.to_comp + +@[fun_prop] lemma succNat : Computable Nat.succ := Computable.succ + +@[fun_prop] lemma constAddRat : Computable (fun p : ℚ × ℚ => p.1 + p.2) := computable_rat_add + +@[fun_prop] lemma constMulRat : Computable (fun p : ℚ × ℚ => p.1 * p.2) := computable_rat_mul + +@[fun_prop] lemma negRat : Computable (fun q : ℚ => -q) := computable_rat_neg + +@[fun_prop] lemma invRat : Computable (fun q : ℚ => q⁻¹) := computable_rat_inv + +@[fun_prop] lemma absNat : Computable Int.natAbs := primrec_int_natAbs.to_comp + +@[fun_prop] lemma ratNum : Computable Rat.num := computable_rat_num + +@[fun_prop] lemma consList : Computable (fun p : β × List β => p.1 :: p.2) := Primrec.list_cons.to_comp + +@[fun_prop] lemma appendList : Computable (fun p : List β × List β => p.1 ++ p.2) := Primrec.list_append.to_comp + +@[fun_prop] lemma lengthList : Computable (fun p : List β => p.length) := Computable.list_length + +@[fun_prop] lemma getDList (b : β) : Computable (fun p : List β × ℕ => p.1.getD p.2 b) := + (Primrec.list_getD b).to_comp + +@[fun_prop] lemma valFin {n : ℕ} : Computable (fun i : Fin n => i.val) := Primrec.fin_val.to_comp + +@[fun_prop] lemma appFin {n : ℕ} : Computable (fun p : (Fin n → β) × Fin n => p.1 p.2) := Computable.fin_app + +@[fun_prop] lemma ofFnList {n : ℕ} (f : α → Fin n → β) (hf : ∀ i, Computable (fun a => f a i)) : + Computable (fun a => List.ofFn (f a)) := Computable.list_ofFn hf + +lemma mapList [Inhabited β] {f : α → List β} {g : α → β → γ} (hf : Computable f) + (hg : Computable (fun p : α × β => g p.1 p.2)) : + Computable (fun a => (f a).map (g a)) := by + have h := computable_foldl hf (Computable.const ([] : List γ)) + (h := fun a p => p.1 ++ [g a p.2]) (by change Computable (fun p : α × (List γ × β) => _); fun_prop) + apply h.of_eq + intro a + have hh : ∀ (l : List β) (s : List γ), l.foldl (fun s b => s ++ [g a b]) s = s ++ l.map (g a) := by + intro l + induction l with + | nil => simp + | cons b l ih => intro s; simp only [List.foldl_cons, List.map_cons, ih, List.append_assoc, List.singleton_append] + simpa using hh (f a) [] + +lemma flatMapList [Inhabited β] {f : α → List β} {g : α → β → List γ} (hf : Computable f) + (hg : Computable (fun p : α × β => g p.1 p.2)) : + Computable (fun a => (f a).flatMap (g a)) := by + have h := computable_foldl hf (Computable.const ([] : List γ)) + (h := fun a p => p.1 ++ g a p.2) (by change Computable (fun p : α × (List γ × β) => _); fun_prop) + apply h.of_eq + intro a + have hh : ∀ (l : List β) (s : List γ), l.foldl (fun s b => s ++ g a b) s = s ++ l.flatMap (g a) := by + intro l + induction l with + | nil => simp + | cons b l ih => intro s; simp only [List.foldl_cons, List.flatMap_cons, ih, List.append_assoc] + simpa using hh (f a) [] + +end BalancedTransport.Effectivity.ComputableRules +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputableInitial.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputableInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f0c18f9de7db8ab1baab48b2a3694337a36e26f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ComputableInitial.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MachineHalting +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveGluing + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Recorder Coding BalancedTransport.Geometry +open scoped Classical + +lemma computable_rationalWord {S : Type*} [Primcodable S] [Fintype S] [Inhabited S] + {B : ℕ} (digit : S → Fin B) : Computable (Coding.rationalWord digit) := by + have h : Computable (fun w : List S => w.reverse.foldl + (fun q a => (B : ℚ)⁻¹ * ((digit a : ℚ) + q)) 0) := + computable_foldl Primrec.list_reverse.to_comp (Computable.const 0) + (computable_rat_mul.comp (Computable.const ((B : ℚ)⁻¹)) + (computable_rat_add.comp + ((Primrec.dom_finite (fun a : S => (digit a : ℚ))).to_comp.comp + (Computable.snd.comp Computable.snd)) + (Computable.fst.comp Computable.snd))).to₂ + apply h.of_eq + intro w + induction w with + | nil => rfl + | cons a w ih => simpa only [List.reverse_cons,List.foldl_append,List.foldl_cons, + List.foldl_nil, Coding.rationalWord] using + (congrArg (fun q => (B : ℚ)⁻¹ * ((digit a : ℚ) + q)) ih) + +lemma computable_rationalTailCode {S : Type*} [Primcodable S] [Fintype S] [Inhabited S] + {B : ℕ} (digit : S → Fin B) (a : S) : + Computable (fun w => Coding.rationalTailCode digit w a) := + computable_rat_add.comp (computable_rationalWord digit) + (computable_rat_mul.comp + (computable_rat_pow.comp (Computable.const ((B : ℚ)⁻¹)) Computable.list_length) + (Computable.const ((digit a : ℚ) / ((B : ℚ) - 1)))) + +lemma computable_rationalInitial (N : FiniteMachine) : + Computable (Recorder.Checkpoint.rationalInitial N.normalized (some N.initial)) := by + let S := Recorder.Letter (Option (Fin (N.states+1))) (Fin (N.symbols+1)) + let : Primcodable S := Primcodable.ofEquiv (Fin (Fintype.card S)) (Fintype.equivFin S) + let : Inhabited S := ⟨.boundary⟩ + have hwork : Primrec (fun a : Fin (N.symbols+1) => (Letter.work a : S)) := Primrec.dom_finite _ + have hh : Computable (fun w : Input N => w.headD N.blank) := by + exact (Primrec.option_getD.comp Primrec.list_head? (Primrec.const N.blank)).to_comp.of_eq + (fun w => by cases w <;> rfl) + have hw : Computable (fun w : Input N => + (Letter.work (w.headD N.blank) : S) :: (w.tail.map Letter.work ++ [Letter.boundary])) := + Primrec.list_cons.to_comp.comp (hwork.to_comp.comp hh) + (Primrec.list_append.to_comp.comp + ((Primrec.list_map Primrec.list_tail (hwork.comp Primrec.snd).to₂).to_comp) + (Computable.const [Letter.boundary])) + apply computable_fin_lam + intro i + fin_cases i + · exact Computable.const _ + · exact (computable_rationalTailCode (Recorder.digit (Q := Option (Fin (N.states+1))) + (Γ := Fin (N.symbols+1))) (Letter.work N.blank)).comp hw + · exact Computable.const _ + +lemma rationalInitial_bounded (N : FiniteMachine) : + ∃ C : ℕ, ∀ w : Input N, ∀ i, + |(Recorder.Checkpoint.rationalInitial N.normalized (some N.initial) w i : ℝ)| ≤ C := by + let k := Recorder.placement N.normalized (.ready (some N.initial)) + refine ⟨4*k+1, ?_⟩ + intro w i + have he := congrFun (Recorder.Checkpoint.rationalInitial_cast N.normalized (some N.initial) w) i + change (Recorder.Checkpoint.rationalInitial N.normalized (some N.initial) w i : ℝ) = _ at he + rw [he] + change |Coding.origin k i + Coding.stream Recorder.digit _| ≤ _ + have hh := Coding.stream_mem_unit Recorder.digit + (((Recorder.Checkpoint.initial N.normalized (some N.initial) w).expand N.normalized).stacks i) + have ho : 0 ≤ Coding.origin k i ∧ Coding.origin k i ≤ 4*(k : ℝ) := by + fin_cases i <;> dsimp [Coding.origin] <;> constructor <;> + first | positivity | exact le_rfl + rw [abs_of_nonneg (add_nonneg ho.1 hh.1)] + push_cast + linarith [hh.2, ho.2] + +lemma fixedLabel_bound (i : Fin 3) : |fixedLabel i| ≤ (4 : ℝ) := by + fin_cases i <;> norm_num [fixedLabel] + +lemma loadingSupport_ball {z : Space} {C : ℕ} (hz : ∀i, |z i| ≤ C) : + loadingSupport z 1 ⊆ Metric.closedBall (0 : Space) (C+6 : ℕ) := by + intro x hx + rw [Metric.mem_closedBall,dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (Nat.cast_nonneg _)).mpr + intro i + rw [Real.norm_eq_abs, abs_le] + have hh := (mem_closedEnlargement _ _ _ x).mp hx i + have h₀ := (abs_le.mp (fixedLabel_bound i)) + have hz' := abs_le.mp (hz i) + have hlo : -(C : ℝ)-4 ≤ min (fixedLabel i) (z i) := le_min (by linarith) (by linarith) + have hhi : max (fixedLabel i) (z i) ≤ (C : ℝ)+4 := max_le (by linarith) (by linarith) + push_cast + constructor <;> linarith [hh.1,hh.2] + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Deformation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Deformation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e47b2da478adb4c1d1d588637dbdfa2d119fd49d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Deformation.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Parking + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Set +variable {ι : Type*} [Fintype ι] + +def expandCenters {a w : ι → Space} {safe : Set ι} {η Λ : ℝ} + (hp : ∀ i k, 0 < w i k) (hs : (BoxLayout.mk a w).Separated η) + (hg : (BoxLayout.mk a w).Guarded safe) (hΛ : 1 ≤ Λ) : + BoxMotion ⟨a, w⟩ ⟨fun i k => Λ * a i k, w⟩ safe η := + segmentMotion hp (by + intro r hr i j hij + obtain ⟨k, hk⟩ := hs i j hij + refine ⟨k, hk.trans_le ?_⟩ + have hh : 1 ≤ 1 - r + r * Λ := by nlinarith [mul_nonneg hr.1 (sub_nonneg.mpr hΛ)] + have he : (1 - r) * a i k + r * (Λ * a i k) - + ((1 - r) * a j k + r * (Λ * a j k)) = (1 - r + r * Λ) * (a i k - a j k) := by ring + change |a i k - a j k| ≤ |(1 - r) * a i k + r * (Λ * a i k) - + ((1 - r) * a j k + r * (Λ * a j k))| + rw [he, abs_mul, abs_of_nonneg (by linarith : 0 ≤ 1 - r + r * Λ)] + nlinarith [abs_nonneg (a i k - a j k)]) (by + intro r hr + apply segment_guard hg _ hr + intro i hi + have hh := hg i hi + have hpos : 0 < a i 0 := by linarith [hp i 0] + change 2 < Λ * a i 0 - w i 0 + nlinarith [mul_nonneg (sub_nonneg.mpr hΛ) hpos.le]) + +def geometricWidth (h k : ι → Space) (r : ℝ) (i : ι) (j : Fin 3) : ℝ := + Real.exp ((1 - r) * Real.log (h i j) + r * Real.log (k i j)) + +omit [Fintype ι] in +lemma geometricWidth_zero {h k : ι → Space} (hp : ∀ i j, 0 < h i j) : + geometricWidth h k 0 = h := by + ext i j + simp [geometricWidth, Real.exp_log (hp i j)] + +omit [Fintype ι] in +lemma geometricWidth_one {h k : ι → Space} (hp : ∀ i j, 0 < k i j) : + geometricWidth h k 1 = k := by + ext i j + simp [geometricWidth, Real.exp_log (hp i j)] + +omit [Fintype ι] in +lemma geometricWidth_pos (h k : ι → Space) (r : ℝ) (i : ι) (j : Fin 3) : + 0 < geometricWidth h k r i j := Real.exp_pos _ + +omit [Fintype ι] in +lemma geometricWidth_le {h k : ι → Space} {R r : ℝ} + (hh : ∀ i j, 0 < h i j) (hk : ∀ i j, 0 < k i j) + (hhR : ∀ i j, h i j ≤ R) (hkR : ∀ i j, k i j ≤ R) + (hr : r ∈ Icc (0 : ℝ) 1) (i : ι) (j : Fin 3) : + geometricWidth h k r i j ≤ R := by + have hR : 0 < R := (hh i j).trans_le (hhR i j) + have h₀ := Real.log_le_log (hh i j) (hhR i j) + have h₁ := Real.log_le_log (hk i j) (hkR i j) + rw [geometricWidth, ← Real.exp_log hR] + apply Real.exp_le_exp.mpr + nlinarith [mul_nonneg (sub_nonneg.mpr h₀) (sub_nonneg.mpr hr.2), + mul_nonneg (sub_nonneg.mpr h₁) hr.1] + +omit [Fintype ι] in +lemma geometricWidth_prod {h k : ι → Space} + (hh : ∀ i j, 0 < h i j) (hk : ∀ i j, 0 < k i j) + (he : ∀ i, ∏ j, h i j = ∏ j, k i j) (r : ℝ) (i : ι) : + ∏ j, geometricWidth h k r i j = ∏ j, h i j := by + have hl : ∑ j, Real.log (h i j) = ∑ j, Real.log (k i j) := by + rw [← Real.log_prod (fun j _ => (hh i j).ne'), + ← Real.log_prod (fun j _ => (hk i j).ne'), he] + simp only [geometricWidth] + rw [← Real.exp_sum, Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, ← hl] + have hh' : (1 - r) * ∑ j, Real.log (h i j) + r * ∑ j, Real.log (h i j) = + ∑ j, Real.log (h i j) := by ring + rw [hh', ← Real.log_prod (fun j _ => (hh i j).ne'), + Real.exp_log (Finset.prod_pos (fun j _ => hh i j))] + +def reshapeMotion {a h k : ι → Space} {safe : Set ι} {η R D : ℝ} + (hh : ∀ i j, 0 < h i j) (hk : ∀ i j, 0 < k i j) + (hR : ∀ i j, h i j ≤ R) (kR : ∀ i j, k i j ≤ R) + (he : ∀ i, ∏ j, h i j = ∏ j, k i j) + (hD : 2 * R + 4 * η ≤ D) (hs : CenterSeparated a D) + (hg : ∀ i ∈ safe, 2 + R < a i 0) : + BoxMotion ⟨a, h⟩ ⟨a, k⟩ safe η where + center := fun _ => a + width := fun t => geometricWidth h k (Real.smoothTransition t) + smooth_center := contDiff_const + smooth_width := by unfold geometricWidth; fun_prop + start_center := by intros; rfl + start_width := by + intro t ht + rw [Real.smoothTransition.zero_of_nonpos ht, geometricWidth_zero hh] + end_center := by intros; rfl + end_width := by + intro t ht + rw [Real.smoothTransition.one_of_one_le ht, geometricWidth_one hk] + positive := fun _ => geometricWidth_pos _ _ _ + volume := fun _ => geometricWidth_prod hh hk he _ + separation := by + classical + intro t + apply separated_of_centerSeparated hs + intro i j l + have hi := geometricWidth_le hh hk hR kR + ⟨Real.smoothTransition.nonneg t, Real.smoothTransition.le_one t⟩ i l + have hj := geometricWidth_le hh hk hR kR + ⟨Real.smoothTransition.nonneg t, Real.smoothTransition.le_one t⟩ j l + linarith + guard := by + intro t i hi + have hw := geometricWidth_le hh hk hR kR + ⟨Real.smoothTransition.nonneg t, Real.smoothTransition.le_one t⟩ i 0 + have hhg := hg i hi + change 2 < a i 0 - geometricWidth h k (Real.smoothTransition t) i 0 + linarith + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveArithmetic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..b679e1767bee05ea74dd6d0cbe575ea1797aa747 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveArithmetic.lean @@ -0,0 +1,281 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Encodable + +lemma primrec_int_ofNat : Primrec (Int.ofNat : ℕ → ℤ) := by + apply Primrec.encode_iff.mp + exact Primrec.nat_double + +lemma primrec_int_negSucc : Primrec (Int.negSucc : ℕ → ℤ) := by + apply Primrec.encode_iff.mp + exact Primrec.nat_double_succ + +lemma primrec_int_cases {α β : Type*} [Primcodable α] [Primcodable β] + {f : α → ℤ} {g h : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) (hh : Primrec₂ h) : + Primrec fun a => Int.casesOn (motive := fun _ => β) (f a) (g a) (h a) := by + refine (Primrec.cond (Primrec.nat_bodd.comp (Primrec.encode.comp hf)) + (hh.comp Primrec.id (Primrec.nat_div2.comp (Primrec.encode.comp hf))) + (hg.comp Primrec.id (Primrec.nat_div2.comp (Primrec.encode.comp hf)))).of_eq ?_ + intro a + generalize he : f a = z + cases z with + | ofNat n => + change (bif (2*n).bodd then h a (2*n).div2 else g a (2*n).div2) = g a n + simp [Nat.div2_val] + | negSucc n => + change (bif (2*n+1).bodd then h a (2*n+1).div2 else g a (2*n+1).div2) = h a n + simp [Nat.div2_val] + +lemma primrec_int_natAbs : Primrec Int.natAbs := by + exact (primrec_int_cases Primrec.id Primrec.snd.to₂ + (Primrec.succ.comp Primrec.snd).to₂).of_eq (fun z => by cases z <;> rfl) + +lemma primrec_int_toNat : Primrec Int.toNat := by + exact (primrec_int_cases Primrec.id Primrec.snd.to₂ + (Primrec.const 0).to₂).of_eq (fun z => by cases z <;> rfl) + +lemma primrec_int_neg : Primrec (fun z : ℤ => -z) := by + have h₀ : Primrec (fun n : ℕ => -(n : ℤ)) := by + refine (Primrec.nat_casesOn Primrec.id (Primrec.const (0 : ℤ)) + (primrec_int_negSucc.comp Primrec.snd).to₂).of_eq ?_ + intro n; cases n <;> rfl + exact (primrec_int_cases Primrec.id (h₀.comp Primrec.snd).to₂ + (primrec_int_ofNat.comp (Primrec.succ.comp Primrec.snd)).to₂).of_eq + (fun z => by cases z <;> rfl) + +lemma primrec_int_natSub : Primrec₂ (fun a b : ℕ => (a : ℤ) - b) := by + refine (Primrec.ite Primrec.nat_le + (primrec_int_neg.comp (primrec_int_ofNat.comp (Primrec.nat_sub.comp Primrec.snd Primrec.fst))) + (primrec_int_ofNat.comp Primrec.nat_sub)).of_eq ?_ + intro ⟨a,b⟩ + dsimp + split_ifs with h + · rw [Int.ofNat_sub h]; ring + · rw [Int.ofNat_sub (by omega)] + +lemma primrec_int_add : Primrec₂ ((· + ·) : ℤ → ℤ → ℤ) := by + have h₀ : Primrec₂ (fun a : ℕ => fun z : ℤ => (a : ℤ) + z) := by + refine (primrec_int_cases Primrec.snd + (primrec_int_ofNat.comp (Primrec.nat_add.comp (Primrec.fst.comp Primrec.fst) Primrec.snd)).to₂ + (primrec_int_natSub.comp (Primrec.fst.comp Primrec.fst) (Primrec.succ.comp Primrec.snd)).to₂).of_eq ?_ + intro ⟨a,z⟩; cases z <;> simp [Int.negSucc_eq, sub_eq_add_neg] + have h₁ : Primrec₂ (fun a : ℕ => fun z : ℤ => Int.negSucc a + z) := by + refine (primrec_int_neg.comp + (h₀.comp (Primrec.succ.comp Primrec.fst) (primrec_int_neg.comp Primrec.snd))).of_eq ?_ + intro ⟨a,z⟩; simp; omega + exact (primrec_int_cases Primrec.fst + (h₀.comp Primrec.snd (Primrec.snd.comp Primrec.fst)).to₂ + (h₁.comp Primrec.snd (Primrec.snd.comp Primrec.fst)).to₂).of_eq + (fun ⟨z,w⟩ => by cases z <;> rfl) + +lemma primrec_int_mul : Primrec₂ ((· * ·) : ℤ → ℤ → ℤ) := by + have h₀ : Primrec₂ (fun a : ℕ => fun z : ℤ => (a : ℤ) * z) := by + refine (primrec_int_cases Primrec.snd + (primrec_int_ofNat.comp (Primrec.nat_mul.comp (Primrec.fst.comp Primrec.fst) Primrec.snd)).to₂ + (primrec_int_neg.comp (primrec_int_ofNat.comp + (Primrec.nat_mul.comp (Primrec.fst.comp Primrec.fst) (Primrec.succ.comp Primrec.snd)))).to₂).of_eq ?_ + intro ⟨a,z⟩; cases z <;> simp [Int.negSucc_eq, mul_add] + have h₁ : Primrec₂ (fun a : ℕ => fun z : ℤ => Int.negSucc a * z) := by + refine (primrec_int_neg.comp + (h₀.comp (Primrec.succ.comp Primrec.fst) Primrec.snd)).of_eq ?_ + intro ⟨a,z⟩; simp only [Int.negSucc_eq]; push_cast; ring + exact (primrec_int_cases Primrec.fst + (h₀.comp Primrec.snd (Primrec.snd.comp Primrec.fst)).to₂ + (h₁.comp Primrec.snd (Primrec.snd.comp Primrec.fst)).to₂).of_eq + (fun ⟨z,w⟩ => by cases z <;> rfl) + +lemma computable_find {α : Type*} [Primcodable α] {p : α → ℕ → Prop} + [DecidableRel p] (hp : Computable₂ (fun a n => decide (p a n))) + (hex : ∀ a, ∃ n, p a n) : Computable (fun a => Nat.find (hex a)) := by + have hp' : Partrec₂ (fun a n => Part.some (decide (p a n))) := hp.partrec + refine (Partrec.rfind hp').of_eq_tot ?_ + intro a + apply Nat.mem_rfind.mpr + constructor + · simpa using Nat.find_spec (hex a) + · intro m hm + simpa using Nat.find_min (hex a) hm + +lemma primrec_nat_dvd : PrimrecRel ((· ∣ ·) : ℕ → ℕ → Prop) := by + exact (Primrec.eq.comp (Primrec.nat_mod.comp Primrec.snd Primrec.fst) + (Primrec.const 0)).of_eq (fun _ => Nat.dvd_iff_mod_eq_zero.symm) + +lemma primrec_nat_gcd : Primrec₂ Nat.gcd := by + have hp : PrimrecRel (fun ab : ℕ × ℕ => fun k => k ∣ ab.1 ∧ k ∣ ab.2) := + (primrec_nat_dvd.comp Primrec.snd (Primrec.fst.comp Primrec.fst)).and + (primrec_nat_dvd.comp Primrec.snd (Primrec.snd.comp Primrec.fst)) + refine (Primrec.nat_findGreatest Primrec.nat_add hp).of_eq ?_ + intro ⟨a,b⟩ + dsimp only + apply Nat.findGreatest_eq_iff.mpr + refine ⟨?_, (fun _ => ⟨Nat.gcd_dvd_left _ _, Nat.gcd_dvd_right _ _⟩), ?_⟩ + · rcases eq_or_lt_of_le (Nat.zero_le (a+b)) with h | h + · have : a = 0 ∧ b = 0 := by omega + simp [this.1, this.2] + · exact Nat.le_of_dvd h (dvd_add (Nat.gcd_dvd_left _ _) (Nat.gcd_dvd_right _ _)) + · intro k hk hkb ⟨hka, hkb'⟩ + have hd := Nat.dvd_gcd hka hkb' + have hg : 0 < a.gcd b := by + by_contra hn + have : a = 0 ∧ b = 0 := Nat.gcd_eq_zero_iff.mp (Nat.eq_zero_of_not_pos hn) + omega + exact (not_le_of_gt hk) (Nat.le_of_dvd hg hd) + +lemma primrec_nat_coprime : PrimrecRel Nat.Coprime := by + exact (Primrec.eq.comp primrec_nat_gcd (Primrec.const 1)).of_eq + (fun _ => Iff.rfl) + +def rawRatCode (q : ℚ) : ℕ := Nat.pair (Encodable.encode q.num) q.den + +def validRatCode (n : ℕ) : Prop := + 0 < n.unpair.2 ∧ (Denumerable.ofNat ℤ n.unpair.1).natAbs.Coprime n.unpair.2 + +instance : DecidablePred validRatCode := fun _ => inferInstanceAs (Decidable (_ ∧ _)) + +lemma primrec_validRatCode : PrimrecPred validRatCode := by + exact (Primrec.nat_lt.comp (Primrec.const 0) (Primrec.snd.comp Primrec.unpair)).and + (primrec_nat_coprime.comp + (primrec_int_natAbs.comp ((Primrec.ofNat ℤ).comp (Primrec.fst.comp Primrec.unpair))) + (Primrec.snd.comp Primrec.unpair)) + +lemma rawRatCode_eq (q : ℚ) : rawRatCode q = @Encodable.encode ℚ Rat.instEncodable q := rfl + +lemma validRatCode_iff (n : ℕ) : + validRatCode n ↔ n ∈ Set.range (@Encodable.encode ℚ Rat.instEncodable) := by + constructor + · rintro ⟨hp, hc⟩ + let q : ℚ := ⟨Denumerable.ofNat ℤ n.unpair.1, n.unpair.2, hp.ne', hc⟩ + refine ⟨q, ?_⟩ + change Nat.pair (Encodable.encode (Denumerable.ofNat ℤ n.unpair.1)) n.unpair.2 = n + exact (congrArg (fun k => Nat.pair k n.unpair.2) (Denumerable.encode_ofNat _)).trans (Nat.pair_unpair _) + · rintro ⟨q, rfl⟩ + change validRatCode (rawRatCode q) + simpa only [validRatCode, rawRatCode, Nat.unpair_pair, Denumerable.ofNat_encode] using And.intro q.pos q.reduced + +def ratRank (n : ℕ) : ℕ := ((List.range n).filter (fun n => decide (validRatCode n))).length + +lemma primrec_ratRank : Primrec ratRank := + Primrec.list_length.comp ((Primrec.listFilter primrec_validRatCode).comp Primrec.list_range) + +lemma ratRank_code (q : ℚ) : ratRank (rawRatCode q) = + @Encodable.encode ℚ (inferInstance : Primcodable ℚ).toEncodable q := by + let := @Encodable.decidableRangeEncode ℚ Rat.instEncodable + change ((List.range (rawRatCode q)).filter _).length = + (List.range (rawRatCode q)).countP (fun n => decide + (n ∈ Set.range (@Encodable.encode ℚ Rat.instEncodable))) + rw [List.countP_eq_length_filter] + simp only [validRatCode_iff] + +lemma rawRatCode_injective : Function.Injective rawRatCode := + @Encodable.encode_injective ℚ Rat.instEncodable + +lemma ratRank_injective_valid {m n : ℕ} (hm : validRatCode m) (hn : validRatCode n) + (h : ratRank m = ratRank n) : m = n := by + obtain ⟨a, rfl⟩ := (validRatCode_iff m).mp hm + obtain ⟨b, rfl⟩ := (validRatCode_iff n).mp hn + rw [← rawRatCode_eq, ← rawRatCode_eq, ratRank_code, ratRank_code] at h + exact congrArg (@Encodable.encode ℚ Rat.instEncodable) + (@Encodable.encode_injective ℚ (inferInstance : Primcodable ℚ).toEncodable _ _ h) + +lemma computable_rawRatCode : Computable rawRatCode := by + have hx : ∀ n : ℕ, ∃ k, validRatCode k ∧ ratRank k = n := by + intro n + refine ⟨rawRatCode (Denumerable.ofNat ℚ n), ?_, ?_⟩ + · exact (validRatCode_iff _).mpr ⟨_, rfl⟩ + · rw [ratRank_code, Denumerable.encode_ofNat] + have hp : PrimrecRel (fun n k => validRatCode k ∧ ratRank k = n) := + (primrec_validRatCode.comp Primrec.snd).and + (Primrec.eq.comp (primrec_ratRank.comp Primrec.snd) Primrec.fst) + refine ((computable_find hp.decide.to_comp hx).comp Primrec.encode.to_comp).of_eq ?_ + intro q + apply ratRank_injective_valid (Nat.find_spec (hx _)).1 ((validRatCode_iff _).mpr ⟨q,rfl⟩) + exact (Nat.find_spec (hx _)).2.trans (ratRank_code q).symm + +lemma computable_rat_num : Computable Rat.num := by + refine (((Primrec.ofNat ℤ).to_comp.comp + (Primrec.fst.to_comp.comp (Primrec.unpair.to_comp.comp computable_rawRatCode)))).of_eq ?_ + intro q + simp only [rawRatCode, Nat.unpair_pair, Denumerable.ofNat_encode] + +lemma computable_rat_den : Computable Rat.den := by + exact ((Primrec.snd.to_comp.comp (Primrec.unpair.to_comp.comp computable_rawRatCode))).of_eq + (fun q => by simp [rawRatCode]) + +lemma rat_fraction_eq_iff (q : ℚ) (n : ℤ) (d : ℕ) (hd : d ≠ 0) : + q = (n : ℚ) / d ↔ q.num * (d : ℤ) = n * (q.den : ℤ) := by + have hden : (q.den : ℤ) ≠ 0 := by exact_mod_cast q.den_ne_zero + have hd' : (d : ℤ) ≠ 0 := by exact_mod_cast hd + have h := @Rat.divInt_eq_divInt_iff q.den d q.num n hden hd' + simpa only [Rat.num_divInt_den, Rat.divInt_eq_div, Rat.intCast_natCast, Rat.num_div_den] using h + +lemma computable_rat_of_parts {α : Type*} [Primcodable α] + {n : α → ℤ} {d : α → ℕ} (hn : Computable n) (hd : Computable d) + (hpos : ∀ a, d a ≠ 0) : Computable (fun a => (n a : ℚ) / d a) := by + let p : α → ℕ → Prop := fun a k => + (Denumerable.ofNat ℚ k).num * (d a : ℤ) = + n a * ((Denumerable.ofNat ℚ k).den : ℤ) + have hn' : Computable (fun k => (Denumerable.ofNat ℚ k).num) := + computable_rat_num.comp (Computable.ofNat ℚ) + have hd' : Computable (fun k => ((Denumerable.ofNat ℚ k).den : ℤ)) := + primrec_int_ofNat.to_comp.comp (computable_rat_den.comp (Computable.ofNat ℚ)) + have hl : Computable (fun ak : α × ℕ => (Denumerable.ofNat ℚ ak.2).num * (d ak.1 : ℤ)) := + primrec_int_mul.to_comp.comp (hn'.comp Computable.snd) + ((primrec_int_ofNat.to_comp.comp hd).comp Computable.fst) + have hr : Computable (fun ak : α × ℕ => n ak.1 * ((Denumerable.ofNat ℚ ak.2).den : ℤ)) := + primrec_int_mul.to_comp.comp (hn.comp Computable.fst) (hd'.comp Computable.snd) + have hp : Computable₂ (fun a k => decide (p a k)) := + Primrec.eq.decide.to_comp.comp hl hr + have hx : ∀ a, ∃ k, p a k := by + intro a + refine ⟨@Encodable.encode ℚ (inferInstance : Primcodable ℚ).toEncodable ((n a : ℚ) / d a), ?_⟩ + dsimp [p] + rw [Denumerable.ofNat_encode] + exact (rat_fraction_eq_iff _ _ _ (hpos a)).mp rfl + refine ((Computable.ofNat ℚ).comp (computable_find hp hx)).of_eq ?_ + intro a + exact (rat_fraction_eq_iff _ _ _ (hpos a)).mpr (Nat.find_spec (hx a)) + +lemma computable_rat_add : Computable₂ ((· + ·) : ℚ → ℚ → ℚ) := by + have ha : Computable (fun p : ℚ × ℚ => p.1.num * (p.2.den : ℤ)) := + primrec_int_mul.to_comp.comp (computable_rat_num.comp Computable.fst) + ((primrec_int_ofNat.to_comp.comp computable_rat_den).comp Computable.snd) + have hb : Computable (fun p : ℚ × ℚ => p.2.num * (p.1.den : ℤ)) := + primrec_int_mul.to_comp.comp (computable_rat_num.comp Computable.snd) + ((primrec_int_ofNat.to_comp.comp computable_rat_den).comp Computable.fst) + have hn : Computable (fun p : ℚ × ℚ => p.1.num * (p.2.den : ℤ) + p.2.num * (p.1.den : ℤ)) := + primrec_int_add.to_comp.comp ha hb + have hd : Computable (fun p : ℚ × ℚ => p.1.den * p.2.den) := + Primrec.nat_mul.to_comp.comp (computable_rat_den.comp Computable.fst) (computable_rat_den.comp Computable.snd) + refine (computable_rat_of_parts hn hd (fun p => mul_ne_zero p.1.den_ne_zero p.2.den_ne_zero)).of_eq ?_ + intro ⟨a,b⟩ + dsimp + push_cast + rw [add_div, mul_div_mul_right _ _ (by exact_mod_cast b.den_ne_zero : (b.den : ℚ) ≠ 0)] + rw [mul_comm (a.den : ℚ), mul_div_mul_right _ _ (by exact_mod_cast a.den_ne_zero : (a.den : ℚ) ≠ 0)] + rw [Rat.num_div_den, Rat.num_div_den] + +lemma computable_rat_mul : Computable₂ ((· * ·) : ℚ → ℚ → ℚ) := by + have hn : Computable (fun p : ℚ × ℚ => p.1.num * p.2.num) := + primrec_int_mul.to_comp.comp (computable_rat_num.comp Computable.fst) (computable_rat_num.comp Computable.snd) + have hd : Computable (fun p : ℚ × ℚ => p.1.den * p.2.den) := + Primrec.nat_mul.to_comp.comp (computable_rat_den.comp Computable.fst) (computable_rat_den.comp Computable.snd) + refine (computable_rat_of_parts hn hd (fun p => mul_ne_zero p.1.den_ne_zero p.2.den_ne_zero)).of_eq ?_ + intro ⟨a,b⟩ + dsimp + push_cast + rw [mul_div_mul_comm, Rat.num_div_den, Rat.num_div_den] + +lemma computable_rat_neg : Computable (fun q : ℚ => -q) := by + exact (computable_rat_of_parts (primrec_int_neg.to_comp.comp computable_rat_num) + computable_rat_den Rat.den_ne_zero).of_eq (fun q => by + push_cast + rw [neg_div, Rat.num_div_den]) + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveConstruction.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..8eda6ac16b56324a8d4482473d220395a3ff4e1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveConstruction.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ComputableInitial + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set Filter +open scoped Topology + +lemma EffectiveFamily.forwardEq {V W : Family Velocity} (hV : EffectiveFamily V) + (h : ∀M w, ForwardEq (V M w) (W M w)) : EffectiveFamily W := by + obtain ⟨E,b,R,hE,hb,hR,he,hB,hs⟩ := hV + refine ⟨E,b,R,hE,hb,hR,?_,?_,?_⟩ + · intro M w a z n hz i + rw [← (h M w).mixedD a _ (by exact_mod_cast hz)] + exact he M w a z n hz i + · intro M w a t ht x + rw [← (h M w).mixedD a t ht] + exact hB M w a t ht x + · intro M w t ht x hx + rw [← h M w t ht] + exact hs M w t ht x hx + +lemma ElementaryPieces.fullInertial {d : ℕ} {L V : (Fin d → ℝ) → Velocity} + {κ : ℕ → Fin d → ℚ} {F : Family Velocity} (h : ElementaryPieces L V κ F) : + ElementaryPieces (fun p => fullInertial (L p)) (fun p => fullInertial (V p)) κ + (fun M w => fullInertial (F M w)) := by + intro M w t ht + have hh := h M w t ht + split_ifs at hh ⊢ with hlt + · exact timeGerm_fullInertial hh + · simpa only [fullInertial_translate] using timeGerm_fullInertial hh + +lemma ElementaryPieces.viscous {d : ℕ} {L V : (Fin d → ℝ) → Velocity} + {κ : ℕ → Fin d → ℚ} {F : Family Velocity} (h : ElementaryPieces L V κ F) : + ElementaryPieces (fun p => viscousCoefficient (L p)) (fun p => viscousCoefficient (V p)) κ + (fun M w => viscousCoefficient (F M w)) := by + intro M w t ht + have hh := h M w t ht + split_ifs at hh ⊢ with hlt + · exact timeGerm_viscous hh + · simpa only [viscous_translate] using timeGerm_viscous hh + +theorem effective_loaded_family {κ : ℕ → Fin 3 → ℚ} (hκ : Computable κ) + (C : ℕ) (hC : ∀n i, |(κ n i : ℝ)| ≤ C) + {v : Velocity} {K : Set Space} (hK : IsCompact K) + (hv : JointSmooth v) (hc : TimeCollars v) (hs : SpatiallySupported K v) + (he : ElementaryField (fun _ : Fin 3 → ℝ => v)) : + let U : Family Velocity := fun M w => + loadedRepeat (loadingVelocity (rationalSpace (κ (inputCode M w))) 1) v + EffectiveFamily U ∧ EffectiveFamily (fun M w => inertialCoefficient (U M w)) ∧ + EffectiveFamily (fun M w => viscousCoefficient (U M w)) := by + dsimp only + let U : Family Velocity := fun M w => + loadedRepeat (loadingVelocity (rationalSpace (κ (inputCode M w))) 1) v + have hU (M : FiniteMachine) (w : Input M) : JointSmooth (U M w) := + loadedRepeat_jointSmooth (loadingVelocity_jointSmooth _ _) hv hc + have hp : ElementaryPieces (fun p : Fin 3 → ℝ => loadingVelocity p 1) + (fun _ : Fin 3 → ℝ => v) κ U := by + intro M w t ht + split_ifs with hlt + · exact loadedRepeat_germ_before hc hlt + · exact loadedRepeat_germ_after (fun _ ht => loadingVelocity_zero ht) hc (le_of_not_gt hlt) + obtain ⟨r,hr⟩ := hK.isBounded.subset_closedBall (0 : Space) + obtain ⟨n,hn⟩ := exists_nat_ge r + let R : ℕ := max n (C+6) + have hS (M : FiniteMachine) (w : Input M) : + SpatiallySupported (Metric.closedBall (0 : Space) R) (U M w) := by + intro t x hx + apply loadedRepeat_support (loadingVelocity_supported _ (by norm_num : (0 : ℝ) < 1)) hs t x + intro hm + apply hx + rcases hm with hm | hm + · exact Metric.closedBall_subset_closedBall (by exact_mod_cast (Nat.le_max_right n (C+6))) + (loadingSupport_ball (hC (inputCode M w)) hm) + · exact Metric.closedBall_subset_closedBall + (hn.trans (by exact_mod_cast (Nat.le_max_left n (C+6)))) (hr hm) + have el : ElementaryField (fun p : Fin 3 → ℝ => loadingVelocity p 1) := + elementary_loadingVelocity ⟨1, by simp⟩ + have sl := fun p : Fin 3 → ℝ => loadingVelocity_jointSmooth p 1 + have eu := effectiveFamily_of_elementary_pieces el he sl (fun _ => hv) hκ C R hC hU hS hp + have e₀ := effectiveFamily_of_elementary_pieces el.fullInertial he.fullInertial + (fun p => (sl p).fullInertial) (fun _ => hv.fullInertial) hκ C R hC + (fun M w => (hU M w).fullInertial) (fun M w => (hS M w).fullInertial) hp.fullInertial + have e₁ := effectiveFamily_of_elementary_pieces el.viscous he.viscous + (fun p => (sl p).viscousCoefficient) (fun _ => hv.viscousCoefficient) hκ C R hC + (fun M w => (hU M w).viscousCoefficient) + (fun M w => (hS M w).viscousCoefficient Metric.isClosed_closedBall) hp.viscous + exact ⟨eu,EffectiveFamily.forwardEq e₀ (fun M w => fullInertial_forwardEq (hU M w)),e₁⟩ + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveExp.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveExp.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb5d2aee89bcf0aeeacb26093387d45daa0a8951 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveExp.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Model +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.RationalAlgorithms + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Filter +open scoped Topology + +def expAccurate (q : ℚ) (n k : ℕ) : Prop := + |q| / ((k + 1 : ℕ) : ℚ) ≤ 1 / 2 ∧ + |q| ^ k / ((k.factorial : ℕ) : ℚ) * 2 ≤ (1 / 2 : ℚ) ^ n + +instance (q : ℚ) (n : ℕ) : DecidablePred (expAccurate q n) := + fun _ => inferInstanceAs (Decidable (_ ∧ _)) + +lemma computable_decide_and {α : Type*} [Primcodable α] + {p q : α → Prop} [DecidablePred p] [DecidablePred q] + (hp : Computable fun a => decide (p a)) (hq : Computable fun a => decide (q a)) : + Computable (fun a => decide (p a ∧ q a)) := by + exact (Computable.cond hp hq (Computable.const false)).of_eq (fun a => by + by_cases h : p a <;> simp [h]) + +lemma computable_expAccurate : + Computable₂ (fun p : ℚ × ℕ => fun k => decide (expAccurate p.1 p.2 k)) := by + have hq : Computable (fun p : (ℚ × ℕ) × ℕ => |p.1.1|) := + computable_rat_abs.comp (Computable.fst.comp Computable.fst) + have hr : Computable (fun p : (ℚ × ℕ) × ℕ => |p.1.1| / ((p.2 + 1 : ℕ) : ℚ)) := + computable_rat_div.comp hq (computable_rat_natCast.comp (Computable.succ.comp Computable.snd)) + have ha : Computable (fun p : (ℚ × ℕ) × ℕ => + |p.1.1| ^ p.2 / (p.2.factorial : ℚ) * 2) := + computable_rat_mul.comp (computable_rat_div.comp (computable_rat_pow.comp hq Computable.snd) + (computable_rat_natCast.comp (primrec_nat_factorial.to_comp.comp Computable.snd))) + (Computable.const 2) + exact computable_decide_and + (computable_rat_le.comp hr (Computable.const (1 / 2))) + (computable_rat_le.comp ha (computable_rat_pow.comp (Computable.const (1 / 2)) + (Computable.snd.comp Computable.fst))) + +lemma exists_expAccurate (q : ℚ) (n : ℕ) : ∃ k, expAccurate q n k := by + have h₀ : Tendsto (fun k : ℕ => (|q| : ℝ) / ((k + 1 : ℕ) : ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.mpr (tendsto_add_atTop_nat 1)) + have h₁ : Tendsto (fun k : ℕ => (|q| : ℝ) ^ k / (k.factorial : ℝ) * 2) + atTop (𝓝 0) := by + simpa using (Real.summable_pow_div_factorial (|q| : ℝ)).tendsto_atTop_zero.mul_const 2 + have he : (0 : ℝ) < (1 / 2 : ℝ) ^ n := by positivity + have hh₀ := h₀.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2) + have hh₁ := h₁.eventually_lt_const he + obtain ⟨k, hk₀, hk₁⟩ := (hh₀.and hh₁).exists + refine ⟨k, ?_, ?_⟩ + · apply (Rat.cast_le (K := ℝ)).mp + push_cast + simpa only [Nat.cast_add, Nat.cast_one] using hk₀.le + · apply (Rat.cast_le (K := ℝ)).mp + push_cast + exact hk₁.le + +noncomputable def expCutoff (q : ℚ) (n : ℕ) : ℕ := + Nat.find (exists_expAccurate q n) + +lemma computable_expCutoff : Computable₂ expCutoff := + computable_find computable_expAccurate (fun p => exists_expAccurate p.1 p.2) + +noncomputable def expApprox (q : ℚ) (n : ℕ) : ℚ := + ∑ k ∈ Finset.range (expCutoff q n), q ^ k / (k.factorial : ℚ) + +lemma computable_expApprox : Computable₂ expApprox := by + have hs : Computable₂ (fun q : ℚ => fun n : ℕ => + ∑ k ∈ Finset.range n, q ^ k / (k.factorial : ℚ)) := + computable_sum_range (computable_rat_div.comp computable_rat_pow + (computable_rat_natCast.comp (primrec_nat_factorial.to_comp.comp Computable.snd))) + exact hs.comp Computable.fst computable_expCutoff + +lemma real_exp_tail_bound (x : ℝ) (k : ℕ) (h : |x| / (k + 1 : ℕ) ≤ 1 / 2) : + |Real.exp x - ∑ j ∈ Finset.range k, x ^ j / (j.factorial : ℝ)| ≤ + |x| ^ k / (k.factorial : ℝ) * 2 := by + have hc : ‖(x : ℂ)‖ / (k + 1 : ℕ) ≤ 1 / 2 := by + simpa only [Complex.norm_real, Real.norm_eq_abs] using h + have hh := @Complex.exp_bound' (x : ℂ) k hc + rw [← Complex.ofReal_exp] at hh + simpa only [← Complex.ofReal_natCast, ← Complex.ofReal_pow, ← Complex.ofReal_div, + ← Complex.ofReal_sum, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hh + +lemma expApprox_spec (q : ℚ) (n : ℕ) : + |(expApprox q n : ℝ) - Real.exp (q : ℝ)| ≤ error n := by + have hk := Nat.find_spec (exists_expAccurate q n) + change expAccurate q n (expCutoff q n) at hk + have hrat : |(q : ℝ)| / ((expCutoff q n + 1 : ℕ) : ℝ) ≤ 1 / 2 := by + have hh := (Rat.cast_le (K := ℝ)).mpr hk.1 + push_cast at hh + simpa only [Nat.cast_add, Nat.cast_one] using hh + have hb := real_exp_tail_bound (q : ℝ) (expCutoff q n) hrat + have ht : |(q : ℝ)| ^ expCutoff q n / ((expCutoff q n).factorial : ℝ) * 2 ≤ error n := by + dsimp [error] + have hh := (Rat.cast_le (K := ℝ)).mpr hk.2 + push_cast at hh + simpa only [one_div] using hh + rw [abs_sub_comm] + simpa only [expApprox, Rat.cast_sum, Rat.cast_div, Rat.cast_pow, Rat.cast_natCast] + using hb.trans ht + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveGluing.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveGluing.lean new file mode 100644 index 0000000000000000000000000000000000000000..edfd46cab26f44a9a41d92278ea5f38da2ec5310 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveGluing.lean @@ -0,0 +1,288 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryJets +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.TemporalJets + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set Filter +open scoped Topology + +lemma computable_fin_lam {α β : Type*} [Primcodable α] [Primcodable β] + {n : ℕ} {f : α → Fin n → β} (hf : ∀ i, Computable (fun a => f a i)) : + Computable f := by + exact (Primrec.vector_get'.to_comp.comp (Computable.vector_ofFn hf)).of_eq + (fun a => by funext i; simp) + +def rationalNatFloor (q : ℚ) : ℕ := q.num.toNat / q.den + +lemma computable_rationalNatFloor : Computable rationalNatFloor := + Primrec.nat_div.to_comp.comp (primrec_int_toNat.to_comp.comp computable_rat_num) + computable_rat_den + +lemma rationalNatFloor_eq {q : ℚ} (hq : 0 ≤ q) : rationalNatFloor q = ⌊q⌋₊ := by + have hn : 0 ≤ q.num := Rat.num_nonneg.mpr hq + have he : ((q.num.toNat : ℕ) : ℚ) / (q.den : ℚ) = q := by + rw [← Int.cast_natCast, Int.toNat_of_nonneg hn, Rat.num_div_den] + conv_rhs => rw [← he, Rat.natFloor_natCast_div_natCast] + rfl + +lemma rationalNatFloor_cast {q : ℚ} (hq : 0 ≤ q) : + (rationalNatFloor q : ℝ) = (⌊(q : ℝ)⌋ : ℤ) := by + rw [Rat.floor_cast, rationalNatFloor_eq hq, ← Int.natCast_floor_eq_floor hq] + simp + +def rationalPhase (q : ℚ) : ℚ := if q < 1 then q else q - rationalNatFloor q + +lemma computable_rationalPhase : Computable rationalPhase := by + apply computable_ite (computable_rat_lt.comp Computable.id (Computable.const 1)) Computable.id + exact computable_rat_sub.comp Computable.id + (computable_rat_natCast.comp computable_rationalNatFloor) + +lemma rationalPhase_cast (q : ℚ) (hq : 0 ≤ q) : + (rationalPhase q : ℝ) = if (q : ℝ) < 1 then (q : ℝ) else (q : ℝ) - (⌊(q : ℝ)⌋ : ℤ) := by + by_cases h : q < 1 + · have hr : (q : ℝ) < 1 := by exact_mod_cast h + simp [rationalPhase,h,hr] + · have hr : ¬ (q : ℝ) < 1 := by exact_mod_cast h + simp [rationalPhase,h,hr,rationalNatFloor_cast hq] + +lemma rationalPhase_bound (q : ℚ) (hq : 0 ≤ q) : |(rationalPhase q : ℝ)| ≤ 1 := by + rw [rationalPhase_cast q hq] + split_ifs with h + · rw [abs_of_nonneg (by exact_mod_cast hq)] + exact h.le + · have hlo := Int.floor_le (q : ℝ) + have hhi := Int.lt_floor_add_one (q : ℝ) + rw [abs_of_nonneg (by linarith)] + linarith + +def fieldRationalArgs {d : ℕ} (p : Fin d → ℚ) (t : ℚ) (x : Fin 3 → ℚ) : + Fin (4+d) → ℚ := Fin.addCases (Fin.cases t x) p + +lemma fieldRationalArgs_cast {d : ℕ} (p : Fin d → ℚ) (t : ℚ) (x : Fin 3 → ℚ) : + (fun i => (fieldRationalArgs p t x i : ℝ)) = fieldArgs (fun i => (p i : ℝ)) t (rationalSpace x) := by + funext i + refine Fin.addCases (fun j => ?_) (fun k => ?_) i + · refine Fin.cases ?_ (fun l => ?_) j <;> simp [fieldRationalArgs, fieldArgs, rationalSpace] + · simp [fieldRationalArgs, fieldArgs] + +lemma computable_fieldRationalArgs (d : ℕ) : + Computable (fun z : (Fin d → ℚ) × RationalPoint => fieldRationalArgs z.1 z.2.1 z.2.2) := by + apply computable_fin_lam + intro i + refine Fin.addCases (fun j => ?_) (fun k => ?_) i + · refine Fin.cases ?_ (fun l => ?_) j + · simpa only [id_eq,fieldRationalArgs,Fin.addCases_left,Fin.cases_zero] using + (Computable.fst.comp Computable.snd : Computable (fun z : (Fin d → ℚ) × RationalPoint => z.2.1)) + · simpa only [id_eq,fieldRationalArgs,Fin.addCases_left,Fin.cases_succ] using + (Computable.fin_app.comp (Computable.snd.comp Computable.snd) (Computable.const l) : + Computable (fun z : (Fin d → ℚ) × RationalPoint => z.2.2 l)) + · simpa only [id_eq,fieldRationalArgs,Fin.addCases_right] using + (Computable.fin_app.comp Computable.fst (Computable.const k) : + Computable (fun z : (Fin d → ℚ) × RationalPoint => z.1 k)) + +lemma fieldArgs_bound {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) (C S : ℕ) + (hp : ∀ i, |p i| ≤ C) (ht : |t| ≤ 1) (hx : ∀ i, |x i| ≤ S) : + ∀ j, |fieldArgs p t x j| ≤ (C+1+S : ℕ) := by + intro j + refine Fin.addCases (fun k => ?_) (fun k => ?_) j + · refine Fin.cases ?_ (fun i => ?_) k + · change |t| ≤ _; push_cast; linarith [Nat.cast_nonneg C (α := ℝ), Nat.cast_nonneg S (α := ℝ)] + · simp only [fieldArgs,Fin.append_left,Fin.cons_succ]; push_cast; linarith [hx i, Nat.cast_nonneg C (α := ℝ)] + · simp only [fieldArgs,Fin.append_right]; push_cast; linarith [hp k, Nat.cast_nonneg S (α := ℝ)] + +def ElementaryPieces {d : ℕ} (L V : (Fin d → ℝ) → Velocity) + (κ : ℕ → Fin d → ℚ) (F : Family Velocity) : Prop := + ∀ M w t, 0 ≤ t → + if t < 1 then + F M w =ᶠ[𝓝 t] L (fun i => (κ (inputCode M w) i : ℝ)) + else F M w =ᶠ[𝓝 t] + (fun s => V (fun i => (κ (inputCode M w) i : ℝ)) (s - (⌊t⌋ : ℤ))) + +lemma ElementaryPieces.jet {d : ℕ} {L V : (Fin d → ℝ) → Velocity} + {κ : ℕ → Fin d → ℚ} {F : Family Velocity} (h : ElementaryPieces L V κ F) + (M : FiniteMachine) (w : Input M) (a : MultiIndex) (t : ℝ) (ht : 0 ≤ t) (x : Space) : + fullMixedD a (F M w) t x = + if t < 1 then fullMixedD a (L (fun i => (κ (inputCode M w) i : ℝ))) t x + else fullMixedD a (V (fun i => (κ (inputCode M w) i : ℝ))) (t - (⌊t⌋ : ℤ)) x := by + have hh := h M w t ht + split_ifs at hh ⊢ with hlt + · exact congrFun (timeGerm_fullMixedD hh a |>.self_of_nhds) x + · simpa only [fullMixedD_translate] using + (congrFun (timeGerm_fullMixedD hh a |>.self_of_nhds) x) + +lemma computable_sum_nat {α ι : Type*} [Primcodable α] (s : Finset ι) + {f : ι → α → ℕ} (hf : ∀ i ∈ s, Computable (f i)) : + Computable (fun a => ∑ i ∈ s, f i a) := by + classical + induction s using Finset.induction_on with + | empty => simpa using (Computable.const (0 : ℕ) : Computable (fun _ : α => 0)) + | @insert i s hi ih => + simpa only [Finset.sum_insert hi] using + Primrec.nat_add.to_comp.comp (hf i (Finset.mem_insert_self _ _)) + (ih (fun j hj => hf j (Finset.mem_insert_of_mem hj))) + +def gridRadius (C : ℕ) (x : Fin 3 → ℚ) : ℕ := C + 1 + ∑ i, (x i).num.natAbs + +lemma computable_gridRadius (C : ℕ) : Computable (gridRadius C) := by + apply Primrec.nat_add.to_comp.comp (Computable.const (C+1)) + apply computable_sum_nat + intro i _ + exact primrec_int_natAbs.to_comp.comp (computable_rat_num.comp + (Computable.fin_app.comp Computable.id (Computable.const i))) + +lemma gridRadius_bound {d : ℕ} (p : Fin d → ℚ) (t : ℚ) (x : Fin 3 → ℚ) (C : ℕ) + (hp : ∀ i, |(p i : ℝ)| ≤ C) (ht : |(t : ℝ)| ≤ 1) : + ∀ j, |(fieldRationalArgs p t x j : ℝ)| ≤ gridRadius C x := by + intro j + rw [congrFun (fieldRationalArgs_cast p t x) j] + apply fieldArgs_bound _ _ _ C _ hp ht _ j + intro i + exact (rat_abs_le_num (x i)).trans (by exact_mod_cast + (Finset.single_le_sum (fun j _ => Nat.zero_le ((x j).num.natAbs)) (Finset.mem_univ i))) + +theorem elementary_jet_evaluators {d : ℕ} {v : (Fin d → ℝ) → Velocity} + (hv : ElementaryField v) (hs : ∀ p, JointSmooth (v p)) + {κ : ℕ → Fin d → ℚ} (hκ : Computable κ) (C : ℕ) + (hC : ∀ n i, |(κ n i : ℝ)| ≤ C) : + ∃ E : (ℕ × MultiIndex × RationalPoint × ℕ) → Fin 3 → ℚ, + ∃ b : MultiIndex × ℕ → ℕ, + Computable E ∧ Computable b ∧ + (∀ m a z n, |(z.1 : ℝ)| ≤ 1 → ∀ i, + |(E (m,a,z,n) i : ℝ) - fullMixedD a (v (fun j => (κ m j : ℝ))) + z.1 (rationalSpace z.2) i| ≤ error n) ∧ + (∀ m a t x (S : ℕ), |t| ≤ 1 → ‖x‖ ≤ (S : ℝ) → + ‖fullMixedD a (v (fun j => (κ m j : ℝ))) t x‖ ≤ (b (a,S) : ℝ)) := by + obtain ⟨ps,hps⟩ := elementary_jet_programs hv hs + let E : (ℕ × MultiIndex × RationalPoint × ℕ) → Fin 3 → ℚ := fun z i => + (NumericProgram.fieldJet d z.2.1 (ps i)).approximation (gridRadius C z.2.2.1.2) + (fieldRationalArgs (κ z.1) z.2.2.1.1 z.2.2.1.2) z.2.2.2 + let b : MultiIndex × ℕ → ℕ := fun z => + ∑ i, ((NumericProgram.fieldJet d z.1 (ps i)).bound (C+1+z.2)).1 + have hE : Computable E := by + apply computable_fin_lam + intro i + let A := ℕ × MultiIndex × RationalPoint × ℕ + have hp : Computable (fun z : A => NumericProgram.fieldJet d z.2.1 (ps i)) := + (NumericProgram.computable_fieldJet d).comp + ((Computable.fst.comp Computable.snd).pair (Computable.const (ps i))) + have hc : Computable (fun z : A => gridRadius C z.2.2.1.2) := + (computable_gridRadius C).comp (Computable.snd.comp + (Computable.fst.comp (Computable.snd.comp Computable.snd))) + have hx : Computable (fun z : A => fieldRationalArgs (κ z.1) z.2.2.1.1 z.2.2.1.2) := + Computable.comp (f := fun z : (Fin d → ℚ) × RationalPoint => fieldRationalArgs z.1 z.2.1 z.2.2) + (g := fun z : A => (κ z.1,z.2.2.1)) (computable_fieldRationalArgs d) + ((hκ.comp Computable.fst).pair (Computable.fst.comp (Computable.snd.comp Computable.snd))) + have hn : Computable (fun z : A => z.2.2.2) := + Computable.snd.comp (Computable.snd.comp Computable.snd) + exact Computable.comp + (f := fun z : NumericProgram × ℕ × (Fin (4+d) → ℚ) × ℕ => + z.1.approximation z.2.1 z.2.2.1 z.2.2.2) + (g := fun z : A => (NumericProgram.fieldJet d z.2.1 (ps i), gridRadius C z.2.2.1.2, + fieldRationalArgs (κ z.1) z.2.2.1.1 z.2.2.1.2, z.2.2.2)) + (NumericProgram.computable_approximation (4+d)) (hp.pair (hc.pair (hx.pair hn))) + have hb : Computable b := by + apply computable_sum_nat + intro i _ + have hp : Computable (fun z : MultiIndex × ℕ => NumericProgram.fieldJet d z.1 (ps i)) := + (NumericProgram.computable_fieldJet d).comp + (Computable.fst.pair (Computable.const (ps i))) + have hc : Computable (fun z : MultiIndex × ℕ => C+1+z.2) := + Primrec.nat_add.to_comp.comp (Computable.const (C+1)) Computable.snd + exact Computable.fst.comp (NumericProgram.computable_bound.comp hp hc) + refine ⟨E,b,hE,hb,?_,?_⟩ + · intro m a z n ht i + have hh := hps i a (fieldArgs (fun j => (κ m j : ℝ)) z.1 (rationalSpace z.2)) + simp only [fieldParam_args,fieldTime_args,fieldSpace_args] at hh + have he := (NumericProgram.fieldJet d a (ps i)).approximation_spec (gridRadius C z.2) + (fieldRationalArgs (κ m) z.1 z.2) n (gridRadius_bound _ _ _ C (hC m) ht) + (by rw [fieldRationalArgs_cast]; exact hh.1) + rw [fieldRationalArgs_cast, hh.2] at he + exact he + · intro m a t x S ht hx + apply (pi_norm_le_iff_of_nonneg (Nat.cast_nonneg (b (a,S)))).mpr + intro i + rw [Real.norm_eq_abs] + have hh := hps i a (fieldArgs (fun j => (κ m j : ℝ)) t x) + simp only [fieldParam_args,fieldTime_args,fieldSpace_args] at hh + have hi : ∀ i, |x i| ≤ S := fun i => + (le_trans (norm_le_pi_norm x i) hx) + have he := (NumericProgram.fieldJet d a (ps i)).magnitude (C+1+S) + (fieldArgs (fun j => (κ m j : ℝ)) t x) + (fieldArgs_bound _ _ _ C S (hC m) ht hi) hh.1 + rw [hh.2] at he + exact he.trans (by exact_mod_cast + (Finset.single_le_sum (fun j _ => Nat.zero_le + ((NumericProgram.fieldJet d a (ps j)).bound (C+1+S)).1) (Finset.mem_univ i))) + +theorem effectiveFamily_of_elementary_pieces {d : ℕ} + {L V : (Fin d → ℝ) → Velocity} (hL : ElementaryField L) (hV : ElementaryField V) + (hsL : ∀p, JointSmooth (L p)) (hsV : ∀p, JointSmooth (V p)) + {κ : ℕ → Fin d → ℚ} (hκ : Computable κ) (C R : ℕ) + (hC : ∀n i, |(κ n i : ℝ)| ≤ C) {F : Family Velocity} + (hF : ∀M w, JointSmooth (F M w)) + (hS : ∀M w, SpatiallySupported (Metric.closedBall (0 : Space) R) (F M w)) + (hp : ElementaryPieces L V κ F) : EffectiveFamily F := by + obtain ⟨EL,bL,hEL,hbL,heL,hmL⟩ := elementary_jet_evaluators hL hsL hκ C hC + obtain ⟨EV,bV,hEV,hbV,heV,hmV⟩ := elementary_jet_evaluators hV hsV hκ C hC + let phaseInput : (ℕ × MultiIndex × RationalPoint × ℕ) → + (ℕ × MultiIndex × RationalPoint × ℕ) := + fun z => (z.1,z.2.1,(rationalPhase z.2.2.1.1,z.2.2.1.2),z.2.2.2) + have hc : Computable phaseInput := by + dsimp only [phaseInput] + exact Computable.fst.pair ((Computable.fst.comp Computable.snd).pair + (((computable_rationalPhase.comp (Computable.fst.comp + (Computable.fst.comp (Computable.snd.comp Computable.snd)))).pair + (Computable.snd.comp (Computable.fst.comp (Computable.snd.comp Computable.snd)))).pair + (Computable.snd.comp (Computable.snd.comp Computable.snd)))) + let E : (ℕ × MultiIndex × RationalPoint × ℕ) → Fin 3 → ℚ := + fun z => if z.2.2.1.1 < 1 then EL (phaseInput z) else EV (phaseInput z) + have hE : Computable E := + computable_ite (computable_rat_lt.comp (Computable.fst.comp + (Computable.fst.comp (Computable.snd.comp Computable.snd))) (Computable.const 1)) + (hEL.comp hc) (hEV.comp hc) + let b : ℕ × MultiIndex → ℕ := fun z => bL (z.2,R) + bV (z.2,R) + have hb : Computable b := Primrec.nat_add.to_comp.comp + (hbL.comp (Computable.snd.pair (Computable.const R))) + (hbV.comp (Computable.snd.pair (Computable.const R))) + refine ⟨E,b,(fun _ => R),hE,hb,Computable.const R,?_,?_,?_⟩ + · intro M w a z n hz i + have ht : 0 ≤ (z.1 : ℝ) := by exact_mod_cast hz + rw [← fullMixedD_eq_mixedD (hF M w) a _ ht _, hp.jet M w a _ ht _] + dsimp only [E,phaseInput] + by_cases hz' : z.1 < 1 + · have hr : (z.1 : ℝ) < 1 := by exact_mod_cast hz' + simp only [ite_eq_left hz',ite_eq_left hr] + have he := heL (inputCode M w) a (rationalPhase z.1,z.2) n + (rationalPhase_bound _ hz) i + simpa only [rationalPhase,ite_eq_left hz'] using he + · have hr : ¬(z.1 : ℝ) < 1 := by exact_mod_cast hz' + simp only [ite_eq_right hz',ite_eq_right hr] + have he := heV (inputCode M w) a (rationalPhase z.1,z.2) n + (rationalPhase_bound _ hz) i + simpa only [rationalPhase_cast _ hz,ite_eq_right hr] using he + · intro M w a t ht x + rw [← fullMixedD_eq_mixedD (hF M w) a _ ht _] + by_cases hx : ‖x‖ ≤ (R : ℝ) + · rw [hp.jet M w a t ht x] + split_ifs with hlt + · have he := hmL (inputCode M w) a t x R + (by rw [abs_of_nonneg ht]; exact hlt.le) hx + exact he.trans (by dsimp [b]; push_cast; exact le_add_of_nonneg_right (Nat.cast_nonneg _)) + · have hlo := Int.floor_le t + have hhi := Int.lt_floor_add_one t + have he := hmV (inputCode M w) a (t-(⌊t⌋ : ℤ)) x R + (by rw [abs_of_nonneg (by linarith)]; linarith) hx + exact he.trans (by dsimp [b]; push_cast; exact le_add_of_nonneg_left (Nat.cast_nonneg _)) + · have he := (hS M w).fullMixedD Metric.isClosed_closedBall a t x + (by simpa only [Metric.mem_closedBall, dist_zero_right] using hx) + rw [he, norm_zero] + exact Nat.cast_nonneg _ + · intro M w t _ x hx + exact hS M w t x (by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hx) + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveLog.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..6335de313b9b583e2ce0203a693a218514b9d25f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EffectiveLog.lean @@ -0,0 +1,151 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.RhoAlgorithms + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Filter +open scoped Topology + +lemma computable_rat_lt : Computable₂ (fun a b : ℚ => decide (a < b)) := by + exact (Computable.cond (computable_rat_le.comp Computable.snd Computable.fst) + (Computable.const false) (Computable.const true)).of_eq + (fun p => by + by_cases h : p.2 ≤ p.1 + · simp [h, not_lt.mpr h] + · simp [h, lt_of_not_ge h]) + +noncomputable def logBracket (q : ℚ) (n c : ℕ) : Prop := + let r := Denumerable.ofNat ℚ c.unpair.1 + let k := c.unpair.2 + expApprox (r - (1 / 2 : ℚ) ^ n) k + (1 / 2 : ℚ) ^ k < q ∧ + q < expApprox (r + (1 / 2 : ℚ) ^ n) k - (1 / 2 : ℚ) ^ k + +noncomputable instance (q : ℚ) (n : ℕ) : DecidablePred (logBracket q n) := + fun _ => inferInstanceAs (Decidable (_ ∧ _)) + +lemma computable_logBracket : + Computable₂ (fun p : ℚ × ℕ => fun c => decide (logBracket p.1 p.2 c)) := by + have hr : Computable (fun p : (ℚ × ℕ) × ℕ => Denumerable.ofNat ℚ p.2.unpair.1) := + (Computable.ofNat ℚ).comp (Computable.fst.comp (Primrec.unpair.to_comp.comp Computable.snd)) + have hk : Computable (fun p : (ℚ × ℕ) × ℕ => p.2.unpair.2) := + Computable.snd.comp (Primrec.unpair.to_comp.comp Computable.snd) + have he : Computable (fun p : (ℚ × ℕ) × ℕ => (1 / 2 : ℚ) ^ p.1.2) := + computable_rat_pow.comp (Computable.const (1 / 2)) (Computable.snd.comp Computable.fst) + have hd : Computable (fun p : (ℚ × ℕ) × ℕ => (1 / 2 : ℚ) ^ p.2.unpair.2) := + computable_rat_pow.comp (Computable.const (1 / 2)) hk + exact computable_decide_and + (computable_rat_lt.comp + (computable_rat_add.comp (computable_expApprox.comp (computable_rat_sub.comp hr he) hk) hd) + (Computable.fst.comp Computable.fst)) + (computable_rat_lt.comp (Computable.fst.comp Computable.fst) + (computable_rat_sub.comp (computable_expApprox.comp (computable_rat_add.comp hr he) hk) hd)) + +lemma cast_error (n : ℕ) : (((1 / 2 : ℚ) ^ n : ℚ) : ℝ) = error n := by + simp [error, one_div] + +lemma error_tendsto : Tendsto error atTop (𝓝 0) := + tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) + +lemma exists_logBracket {q : ℚ} (hq : 0 < q) (n : ℕ) : ∃ c, logBracket q n c := by + have he : 0 < error n := by unfold error; positivity + obtain ⟨r, hr₀, hr₁⟩ := exists_rat_btwn + (show Real.log (q : ℝ) - error n < Real.log (q : ℝ) + error n by linarith) + have hq' : (0 : ℝ) < q := Rat.cast_pos.mpr hq + have h₀ : Real.exp ((r : ℝ) - error n) < (q : ℝ) := by + rw [← Real.exp_log hq', Real.exp_lt_exp] + linarith + have h₁ : (q : ℝ) < Real.exp ((r : ℝ) + error n) := by + rw [← Real.exp_log hq', Real.exp_lt_exp] + linarith + have hd : Tendsto (fun k => 2 * error k) atTop (𝓝 0) := by + simpa using error_tendsto.const_mul 2 + obtain ⟨k, hk₀, hk₁⟩ := ((hd.eventually_lt_const (sub_pos.mpr h₀)).and + (hd.eventually_lt_const (sub_pos.mpr h₁))).exists + refine ⟨Nat.pair (@Encodable.encode ℚ (inferInstance : Primcodable ℚ).toEncodable r) k, ?_⟩ + simp only [logBracket, Nat.unpair_pair, Denumerable.ofNat_encode] + have hl := (abs_le.mp (expApprox_spec (r - (1 / 2 : ℚ) ^ n) k)).2 + have hu := (abs_le.mp (expApprox_spec (r + (1 / 2 : ℚ) ^ n) k)).1 + simp only [Rat.cast_sub, Rat.cast_add, cast_error] at hl hu + constructor + · apply (Rat.cast_lt (K := ℝ)).mp + rw [Rat.cast_add, cast_error] + linarith + · apply (Rat.cast_lt (K := ℝ)).mp + rw [Rat.cast_sub, cast_error] + linarith + +lemma logBracket_spec {q : ℚ} (hq : 0 < q) {n c : ℕ} (hc : logBracket q n c) : + |(Denumerable.ofNat ℚ c.unpair.1 : ℝ) - Real.log (q : ℝ)| ≤ error n := by + let r := Denumerable.ofNat ℚ c.unpair.1 + let k := c.unpair.2 + have he₀ := (abs_le.mp (expApprox_spec (r - (1 / 2 : ℚ) ^ n) k)).1 + have he₁ := (abs_le.mp (expApprox_spec (r + (1 / 2 : ℚ) ^ n) k)).2 + simp only [Rat.cast_sub, Rat.cast_add, cast_error] at he₀ he₁ + have hb₀ := (Rat.cast_lt (K := ℝ)).mpr hc.1 + have hb₁ := (Rat.cast_lt (K := ℝ)).mpr hc.2 + change ((expApprox (r - (1 / 2 : ℚ) ^ n) k + (1 / 2 : ℚ) ^ k : ℚ) : ℝ) < _ at hb₀ + change (q : ℝ) < ((expApprox (r + (1 / 2 : ℚ) ^ n) k - (1 / 2 : ℚ) ^ k : ℚ) : ℝ) at hb₁ + simp only [Rat.cast_add, Rat.cast_sub, cast_error] at hb₀ hb₁ + have hl : (r : ℝ) - error n < Real.log (q : ℝ) := + (Real.lt_log_iff_exp_lt (Rat.cast_pos.mpr hq)).mpr (by linarith) + have hu : Real.log (q : ℝ) < (r : ℝ) + error n := + (Real.log_lt_iff_lt_exp (Rat.cast_pos.mpr hq)).mpr (by linarith) + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +noncomputable def logSearchPredicate (p : ℚ × ℕ) (c : ℕ) : Prop := + if 0 < p.1 then logBracket p.1 p.2 c else True + +noncomputable instance : DecidableRel logSearchPredicate := by + intro p c + unfold logSearchPredicate + infer_instance + +lemma exists_logSearchPredicate (p : ℚ × ℕ) : ∃ c, logSearchPredicate p c := by + by_cases hq : 0 < p.1 + · simpa [logSearchPredicate, hq] using exists_logBracket hq p.2 + · exact ⟨0, by simp [logSearchPredicate, hq]⟩ + +noncomputable def logCutoff (p : ℚ × ℕ) : ℕ := Nat.find (exists_logSearchPredicate p) + +lemma computable_logCutoff : Computable logCutoff := by + apply computable_find (hex := exists_logSearchPredicate) + exact (Computable.cond (computable_rat_lt.comp (Computable.const 0) + (Computable.fst.comp Computable.fst)) computable_logBracket (Computable.const true)).of_eq + (fun p => by by_cases hq : 0 < p.1.1 <;> simp [logSearchPredicate, hq]) + +noncomputable def logApprox (q : ℚ) (n : ℕ) : ℚ := + if 0 < q then Denumerable.ofNat ℚ (logCutoff (q,n)).unpair.1 else 0 + +lemma computable_logApprox : Computable₂ logApprox := by + exact computable_ite (computable_rat_lt.comp (Computable.const 0) Computable.fst) + ((Computable.ofNat ℚ).comp (Computable.fst.comp + (Primrec.unpair.to_comp.comp computable_logCutoff))) (Computable.const 0) + +lemma logApprox_spec {q : ℚ} (hq : 0 < q) (n : ℕ) : + |(logApprox q n : ℝ) - Real.log (q : ℝ)| ≤ error n := by + rw [logApprox, ite_eq_left hq] + apply logBracket_spec hq + have hh := Nat.find_spec (exists_logSearchPredicate (q,n)) + simpa only [logSearchPredicate, ite_eq_left hq, logCutoff] using hh + +lemma log_abs_bound {q : ℚ} (hq : 0 < q) : + |Real.log (q : ℝ)| ≤ (q.num.natAbs + q⁻¹.num.natAbs : ℕ) := by + have hq' : (0 : ℝ) < q := Rat.cast_pos.mpr hq + have h₀ := Real.log_le_sub_one_of_pos hq' + have h₁ := Real.log_le_sub_one_of_pos (inv_pos.mpr hq') + rw [Real.log_inv] at h₁ + have ha := rat_abs_le_num q + have hb := rat_abs_le_num q⁻¹ + rw [Rat.cast_inv] at hb + rw [abs_of_pos hq'] at ha + rw [abs_of_pos (inv_pos.mpr hq')] at hb + apply abs_le.mpr + push_cast + constructor <;> linarith [Nat.cast_nonneg q.num.natAbs (α := ℝ), + Nat.cast_nonneg q⁻¹.num.natAbs (α := ℝ)] + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Elementary.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Elementary.lean new file mode 100644 index 0000000000000000000000000000000000000000..2725607f049abd592a209995ad4b38ba55e26d5b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Elementary.lean @@ -0,0 +1,197 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericAlgebra + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity + +def Elementary {d : ℕ} [NeZero d] (f : (Fin d → ℝ) → ℝ) : Prop := + ∃ p : NumericProgram, p ≠ [] ∧ p.Closed ∧ (∀ x : Fin d → ℝ, p.Valid x) ∧ p.real = f + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.Elementary +variable {d e : ℕ} [NeZero d] [NeZero e] {f g : (Fin d → ℝ) → ℝ} + +lemma literal (q : ℚ) : Elementary (fun _ : Fin d → ℝ => (q : ℝ)) := + ⟨NumericProgram.literal q, by simp [NumericProgram.literal], + NumericProgram.literal_closed q, NumericProgram.literal_valid q, rfl⟩ + +lemma coordinate (k : Fin d) : Elementary (fun z : Fin d → ℝ => z k) := + ⟨NumericProgram.coordinate k, by simp [NumericProgram.coordinate], + NumericProgram.coordinate_closed k, NumericProgram.coordinate_valid k, + funext (NumericProgram.coordinate_real k)⟩ + +lemma add (hf : Elementary f) (hg : Elementary g) : Elementary (fun x => f x + g x) := by + obtain ⟨p, hpn, hpc, hpv, rfl⟩ := hf + obtain ⟨q, hqn, hqc, hqv, rfl⟩ := hg + exact ⟨NumericProgram.binary 2 p q, by simp [NumericProgram.binary], + NumericProgram.binary_closed 2 p q hpc hqc hpn hqn (Or.inl rfl), + fun x => NumericProgram.binary_valid 2 p q hqc (by decide) x (hpv x) (hqv x), + funext (NumericProgram.binary_add_real p q hqc hqn)⟩ + +lemma mul (hf : Elementary f) (hg : Elementary g) : Elementary (fun x => f x * g x) := by + obtain ⟨p, hpn, hpc, hpv, rfl⟩ := hf + obtain ⟨q, hqn, hqc, hqv, rfl⟩ := hg + exact ⟨NumericProgram.binary 3 p q, by simp [NumericProgram.binary], + NumericProgram.binary_closed 3 p q hpc hqc hpn hqn (Or.inr rfl), + fun x => NumericProgram.binary_valid 3 p q hqc (by decide) x (hpv x) (hqv x), + funext (NumericProgram.binary_mul_real p q hqc hqn)⟩ + +lemma neg (hf : Elementary f) : Elementary (fun x => -f x) := by + obtain ⟨p, hn, hc, hv, rfl⟩ := hf + refine ⟨NumericProgram.unary 4 0 p, by simp [NumericProgram.unary], + NumericProgram.unary_closed 4 0 p hc hn (Or.inl rfl), + fun x => NumericProgram.unary_valid 4 0 p x (hv x) (by simp), ?_⟩ + funext x + rw [NumericProgram.unary_real] + rfl + +lemma sub (hf : Elementary f) (hg : Elementary g) : Elementary (fun x => f x - g x) := by + simpa only [sub_eq_add_neg] using hf.add hg.neg + +lemma inv (hf : Elementary f) (n : ℕ) (hn : ∀ x, ((n+1:ℕ):ℝ)⁻¹ ≤ f x) : + Elementary (fun x => (f x)⁻¹) := by + obtain ⟨p, hne, hc, hv, rfl⟩ := hf + refine ⟨NumericProgram.unary 5 n p, by simp [NumericProgram.unary], + NumericProgram.unary_closed 5 n p hc hne (Or.inr (Or.inl rfl)), + fun x => NumericProgram.unary_valid 5 n p x (hv x) (fun _ => hn x), ?_⟩ + funext x + rw [NumericProgram.unary_real] + rfl + +lemma exp (hf : Elementary f) : Elementary (fun x => Real.exp (f x)) := by + obtain ⟨p, hn, hc, hv, rfl⟩ := hf + refine ⟨NumericProgram.unary 7 0 p, by simp [NumericProgram.unary], + NumericProgram.unary_closed 7 0 p hc hn (Or.inr (Or.inr rfl)), + fun x => NumericProgram.unary_valid 7 0 p x (hv x) (by simp), ?_⟩ + funext x + rw [NumericProgram.unary_real] + rfl + +lemma rho (n : ℕ) (hf : Elementary f) : Elementary (fun x => rhoJet n (f x)) := by + obtain ⟨p, hn, hc, hv, rfl⟩ := hf + refine ⟨p ++ [(6,0,n,0)], by simp, ?_, ?_, ?_⟩ + · apply (NumericProgram.scopedFrom_concat _ _ _).mpr + exact ⟨hc, ⟨by simpa [NumericOp.Scoped, NumericOp.tag, NumericOp.right] using List.length_pos_iff.mpr hn, trivial⟩⟩ + · intro x + exact (NumericProgram.validFrom_concat _ _ _ _).mpr ⟨hv x, ⟨by simp [NumericOp.Valid, NumericOp.tag], trivial⟩⟩ + · funext x + simp only [NumericProgram.real, NumericProgram.realFrom_concat] + rfl + +lemma logLiteral (q : ℚ) : Elementary (fun _ : Fin d → ℝ => if 0 < q then Real.log (q : ℝ) else 0) := by + refine ⟨[(8,q,0,0)], by simp, by simp [NumericProgram.Closed, NumericProgram.ScopedFrom, NumericOp.Scoped, NumericOp.tag], ?_, rfl⟩ + intro x + exact ⟨by simp [NumericOp.Valid, NumericOp.tag], trivial⟩ + +lemma log_rat {q : ℚ} (hq : 0 < q) : Elementary (fun _ : Fin d → ℝ => Real.log (q : ℝ)) := by + simpa only [ite_eq_left hq] using (logLiteral (d := d) q) + +lemma differentiable (hf : Elementary f) : Differentiable ℝ f := by + obtain ⟨p, _, _, hv, rfl⟩ := hf + exact fun x => p.differentiableAt x (hv x) + +lemma coordinateDerivative (hf : Elementary f) (k : Fin d) : + Elementary (fun x => fderiv ℝ f x (Pi.single k 1)) := by + obtain ⟨p, hn, hc, hv, rfl⟩ := hf + refine ⟨p.jetStep k, ?_, p.jetStep_closed k hc, fun x => p.jetStep_valid k (hv x), ?_⟩ + · apply List.length_pos_iff.mp + rw [NumericProgram.jetStep_length] + exact Nat.mul_pos (by decide) (List.length_pos_iff.mpr hn) + · funext x + exact p.jetStep_real k x (hv x) + +lemma sum {ι : Type*} (s : Finset ι) (f : ι → (Fin d → ℝ) → ℝ) + (hf : ∀ i ∈ s, Elementary (f i)) : Elementary (fun x => ∑ i ∈ s, f i x) := by + classical + induction s using Finset.induction_on with + | empty => simpa using (literal (d := d) 0) + | @insert a s ha ih => + simpa only [Finset.sum_insert ha] using + (hf a (Finset.mem_insert_self _ _)).add (ih (fun i hi => hf i (Finset.mem_insert_of_mem hi))) + +lemma prod {ι : Type*} (s : Finset ι) (f : ι → (Fin d → ℝ) → ℝ) + (hf : ∀ i ∈ s, Elementary (f i)) : Elementary (fun x => ∏ i ∈ s, f i x) := by + classical + induction s using Finset.induction_on with + | empty => simpa using (literal (d := d) 1) + | @insert a s ha ih => + simpa only [Finset.prod_insert ha] using + (hf a (Finset.mem_insert_self _ _)).mul (ih (fun i hi => hf i (Finset.mem_insert_of_mem hi))) + +end BalancedTransport.Effectivity.Elementary +end + +noncomputable section +namespace BalancedTransport.Effectivity.Elementary +variable {d e : ℕ} [NeZero d] [NeZero e] + +lemma zero : Elementary (fun _ : Fin d → ℝ => (0 : ℝ)) := by simpa using (literal (d := d) 0) + +lemma one : Elementary (fun _ : Fin d → ℝ => (1 : ℝ)) := by simpa using (literal (d := d) 1) + +lemma const_nat (n : ℕ) : Elementary (fun _ : Fin d → ℝ => (n : ℝ)) := by + simpa using literal (d := d) (n : ℚ) + +lemma div_rat (q : ℚ) {f : (Fin d → ℝ) → ℝ} (hf : Elementary f) : + Elementary (fun x => f x / (q : ℝ)) := by + simpa [div_eq_mul_inv] using hf.mul (literal q⁻¹) + +lemma operation (o : NumericOp) (g : (Fin d → ℝ) → (Fin e → ℝ)) + (s : (Fin d → ℝ) → List ℝ) + (hg : ∀ k, Elementary (fun x => g x k)) + (hs : ∀ n, Elementary (fun x => (s x).getD n 0)) + (hv : ∀ x, o.Valid (s x)) : Elementary (fun x => o.real e (g x) (s x)) := by + rcases o with ⟨j,q,a,b⟩ + fin_cases j <;> dsimp only [NumericOp.real, NumericOp.tag, NumericOp.rat, + NumericOp.left, NumericOp.right] + · exact literal q + · exact hg _ + · exact (hs a).add (hs b) + · exact (hs a).mul (hs b) + · exact (hs a).neg + · exact (hs a).inv b (fun x => hv x rfl) + · exact (hs b).rho a + · exact (hs a).exp + · exact logLiteral q + +lemma program_registers (p : NumericProgram) + (g : (Fin d → ℝ) → (Fin e → ℝ)) (s : (Fin d → ℝ) → List ℝ) + (hg : ∀ k, Elementary (fun x => g x k)) + (hs : ∀ n, Elementary (fun x => (s x).getD n 0)) + (hv : ∀ x, p.ValidFrom (g x) (s x)) : + ∀ n, Elementary (fun x => (p.realFrom (g x) (s x)).getD n 0) := by + induction p generalizing s with + | nil => exact hs + | cons o p ih => + apply ih (fun x => o.real e (g x) (s x) :: s x) + · intro n + cases n with + | zero => exact operation o g s hg hs (fun x => (hv x).1) + | succ n => exact hs n + · exact fun x => (hv x).2 + +lemma comp {f : (Fin e → ℝ) → ℝ} (hf : Elementary f) + (g : (Fin d → ℝ) → (Fin e → ℝ)) + (hg : ∀ k, Elementary (fun x => g x k)) : Elementary (fun x => f (g x)) := by + obtain ⟨p, _, _, hv, rfl⟩ := hf + exact program_registers p g (fun _ => []) hg (fun n => by simpa using (zero (d:=d))) + (fun x => hv (g x)) 0 + +lemma smoothTransition {f : (Fin d → ℝ) → ℝ} (hf : Elementary f) : + Elementary (fun x => Real.smoothTransition (f x)) := by + have hρ : Elementary (fun x => expNegInvGlue (f x)) := by + simpa only [rhoJet_zero] using hf.rho 0 + have hρ' : Elementary (fun x => expNegInvGlue (1 - f x)) := by + simpa only [rhoJet_zero] using (one.sub hf).rho 0 + have hi := (hρ.add hρ').inv 8 (fun x => by + simpa using transition_denom_lower (f x)) + simpa only [Real.smoothTransition, div_eq_mul_inv] using hρ.mul hi + +end BalancedTransport.Effectivity.Elementary +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0766f6686c9b36d1c4791ec491e7d84adee662d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryCalculus.lean @@ -0,0 +1,156 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryMotion + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.Elementary +open BalancedTransport.Geometry + +lemma congr {d : ℕ} [NeZero d] {f g : (Fin d → ℝ) → ℝ} (hf : Elementary f) (he : ∀x, f x = g x) : Elementary g := by + rwa [← funext he] + +end BalancedTransport.Effectivity.Elementary +end + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryCurve +open BalancedTransport.Geometry + +lemma deriv {f : ℝ → ℝ} (hf : ElementaryCurve f) : ElementaryCurve (_root_.deriv f) := by + have hd := (Elementary.coordinateDerivative hf 0) + have h (x : Fin 1 → ℝ) : + fderiv ℝ (fun z : Fin 1 → ℝ => f (z 0)) x (Pi.single 0 1) = _root_.deriv f (x 0) := by + have he : (fun t : ℝ => f ((fun _ : Fin 1 => t) 0)) = f := rfl + have hg : HasDerivAt (fun t : ℝ => fun _ : Fin 1 => t) (Pi.single 0 1) (x 0) := by + apply hasDerivAt_pi.mpr + intro i + fin_cases i + change HasDerivAt (fun s : ℝ => s) (1 : ℝ) (x 0) + exact hasDerivAt_id _ + have hfx : (fun _ : Fin 1 => x 0) = x := by ext i; fin_cases i; rfl + have hh := ((Elementary.differentiable hf) (fun _ => x 0)).hasFDerivAt + simpa only [hfx, Function.comp_def] using (hh.comp_hasDerivAt (x 0) hg).deriv.symm + change Elementary (fun x : Fin 1 → ℝ => _root_.deriv f (x 0)) + exact hd.congr h + +end BalancedTransport.Effectivity.ElementaryCurve +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry + +def fieldArgs {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : Fin (4+d) → ℝ := + Fin.append (Fin.cons t x) p + +def fieldParam {d : ℕ} (z : Fin (4+d) → ℝ) : Fin d → ℝ := fun k => z (Fin.natAdd 4 k) + +def fieldTime {d : ℕ} (z : Fin (4+d) → ℝ) : ℝ := z (Fin.castAdd d 0) + +def fieldSpace {d : ℕ} (z : Fin (4+d) → ℝ) : Space := fun k => z (Fin.castAdd d k.succ) + +@[simp] lemma fieldParam_args {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : + fieldParam (fieldArgs p t x) = p := by ext k; simp [fieldParam,fieldArgs] + +@[simp] lemma fieldTime_args {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : + fieldTime (fieldArgs p t x) = t := by simp [fieldTime,fieldArgs] + +@[simp] lemma fieldSpace_args {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : + fieldSpace (fieldArgs p t x) = x := by ext k; simp [fieldSpace,fieldArgs] + +@[simp] lemma fieldArgs_parts {d : ℕ} (z : Fin (4+d) → ℝ) : + fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z) = z := by + ext k + refine Fin.addCases ?_ ?_ k + · intro j + refine Fin.cases ?_ (fun i => ?_) j + · simp [fieldArgs,fieldTime] + · simp [fieldArgs,fieldTime,fieldSpace] + · intro j + simp [fieldArgs,fieldParam,fieldTime] + +def ElementaryScalar {d : ℕ} (f : (Fin d → ℝ) → Field ℝ) : Prop := + Elementary (fun z => f (fieldParam z) (fieldTime z) (fieldSpace z)) + +def ElementaryField {d : ℕ} (f : (Fin d → ℝ) → Velocity) : Prop := + ∀ i, ElementaryScalar (fun p t x => f p t x i) + +lemma fieldArgs_time_hasDerivAt {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : + HasDerivAt (fun s => fieldArgs p s x) (Pi.single (Fin.castAdd d 0) 1) t := by + apply hasDerivAt_pi.mpr + intro k + refine Fin.addCases ?_ ?_ k + · intro j + refine Fin.cases ?_ (fun i => ?_) j + · simp only [fieldArgs, Fin.append_left, Fin.cons_zero, Pi.single_eq_same] + exact hasDerivAt_id _ + · have hn : Fin.castAdd d i.succ ≠ Fin.castAdd d (0 : Fin 4) := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_succ, Fin.val_zero] at this; omega + simpa only [fieldArgs, Fin.append_left, Fin.cons_succ, Pi.single_apply, ite_eq_right hn] using hasDerivAt_const t (x i) + · intro j + have hn : Fin.natAdd 4 j ≠ Fin.castAdd d (0 : Fin 4) := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_natAdd, Fin.val_zero] at this; omega + simpa only [fieldArgs, Fin.append_right, Pi.single_apply, ite_eq_right hn] using hasDerivAt_const t (p j) + +lemma fieldArgs_space_hasFDerivAt {d : ℕ} (p : Fin d → ℝ) (t : ℝ) (x : Space) : + HasFDerivAt (fun y => fieldArgs p t y) + (ContinuousLinearMap.pi (fun k : Fin (4+d) => + Fin.addCases (Fin.cases (0 : Space →L[ℝ] ℝ) (fun i => ContinuousLinearMap.proj i)) + (fun _ => 0) k)) x := by + apply hasFDerivAt_pi.mpr + intro k + refine Fin.addCases ?_ ?_ k + · intro j + refine Fin.cases ?_ (fun i => ?_) j + · simpa [fieldArgs] using hasFDerivAt_const t x + · simpa [fieldArgs] using hasFDerivAt_apply i x + · intro j + simpa [fieldArgs] using hasFDerivAt_const (p j) x + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryScalar +open BalancedTransport.Geometry +variable {d : ℕ} {f g : (Fin d → ℝ) → Field ℝ} + +lemma fullTimeD (h : ElementaryScalar f) : ElementaryScalar (fun p => Geometry.fullTimeD (f p)) := by + have hd := h.coordinateDerivative (Fin.castAdd d 0) + apply hd.congr + intro z + have hh := (h.differentiable (fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z))).hasFDerivAt + have he := hh.comp_hasDerivAt (fieldTime z) (fieldArgs_time_hasDerivAt (fieldParam z) (fieldTime z) (fieldSpace z)) + simpa only [Function.comp_def, fieldArgs_parts,fieldParam_args,fieldTime_args,fieldSpace_args,Geometry.fullTimeD] using he.deriv.symm + +lemma spaceD (h : ElementaryScalar f) (i : Fin 3) : ElementaryScalar (fun p => BalancedTransport.spaceD i (f p)) := by + have hd := h.coordinateDerivative (Fin.castAdd d i.succ) + apply hd.congr + intro z + have hh := (h.differentiable (fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z))).hasFDerivAt + have he := hh.comp (fieldSpace z) (fieldArgs_space_hasFDerivAt (fieldParam z) (fieldTime z) (fieldSpace z)) + have hl : (ContinuousLinearMap.pi (fun k : Fin (4+d) => + Fin.addCases (Fin.cases (0 : Space →L[ℝ] ℝ) (fun i => ContinuousLinearMap.proj i)) + (fun _ => 0) k) : Space →L[ℝ] (Fin (4+d) → ℝ)) (Pi.single i 1) = Pi.single (Fin.castAdd d i.succ) 1 := by + ext k + refine Fin.addCases ?_ ?_ k + · intro j + refine Fin.cases ?_ (fun l => ?_) j + · have hn : Fin.castAdd d (0 : Fin 4) ≠ Fin.castAdd d i.succ := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_succ, Fin.val_zero] at this; omega + simp only [ContinuousLinearMap.pi_apply, Fin.addCases_left, Fin.cases_zero, + zero_apply, Pi.single_apply, ite_eq_right hn] + · simp only [ContinuousLinearMap.pi_apply, Fin.addCases_left, Fin.cases_succ, + ContinuousLinearMap.proj_apply, Pi.single_apply, Fin.castAdd_inj, Fin.succ_inj] + · intro j + have hn : Fin.natAdd 4 j ≠ Fin.castAdd d i.succ := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_natAdd, Fin.val_succ] at this; omega + simp only [ContinuousLinearMap.pi_apply, Fin.addCases_right, + zero_apply, Pi.single_apply, ite_eq_right hn] + simpa only [Function.comp_def, fieldArgs_parts,fieldParam_args,fieldTime_args,fieldSpace_args, BalancedTransport.spaceD, + ContinuousLinearMap.comp_apply, hl] using congrArg (fun l => l (Pi.single i 1)) he.fderiv.symm + +end BalancedTransport.Effectivity.ElementaryScalar +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryFields.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ede4eb9ba86058964620042531064ee6c66ec9d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryFields.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Loading +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryCalculus + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryScalar +open BalancedTransport.Geometry +variable {d : ℕ} {f g : (Fin d → ℝ) → Field ℝ} + +lemma literal (q : ℚ) : ElementaryScalar (fun _ : Fin d → ℝ => fun _ _ => (q : ℝ)) := Elementary.literal q + +lemma rational {q : ℝ} (hq : RationalConstant q) : ElementaryScalar (fun _ : Fin d → ℝ => fun _ _ => q) := hq.elementary + +lemma add (hf : ElementaryScalar f) (hg : ElementaryScalar g) : ElementaryScalar (fun p t x => f p t x + g p t x) := Elementary.add hf hg + +lemma mul (hf : ElementaryScalar f) (hg : ElementaryScalar g) : ElementaryScalar (fun p t x => f p t x * g p t x) := Elementary.mul hf hg + +lemma sub (hf : ElementaryScalar f) (hg : ElementaryScalar g) : ElementaryScalar (fun p t x => f p t x - g p t x) := Elementary.sub hf hg + +lemma neg (hf : ElementaryScalar f) : ElementaryScalar (fun p t x => -f p t x) := Elementary.neg hf + +lemma div_rat (q : ℚ) (hf : ElementaryScalar f) : ElementaryScalar (fun p t x => f p t x / (q : ℝ)) := Elementary.div_rat q hf + +lemma div_const {q : ℝ} (hq : RationalConstant q) (hf : ElementaryScalar f) : ElementaryScalar (fun p t x => f p t x / q) := by + obtain ⟨q,rfl⟩ := hq; exact hf.div_rat q + +lemma inv (hf : ElementaryScalar f) (n : ℕ) (hn : ∀ p t x, ((n+1:ℕ):ℝ)⁻¹ ≤ f p t x) : + ElementaryScalar (fun p t x => (f p t x)⁻¹) := Elementary.inv hf n (fun _ => hn _ _ _) + +lemma exp (hf : ElementaryScalar f) : ElementaryScalar (fun p t x => Real.exp (f p t x)) := Elementary.exp hf + +lemma transition (hf : ElementaryScalar f) : ElementaryScalar (fun p t x => Real.smoothTransition (f p t x)) := Elementary.smoothTransition hf + +lemma time : ElementaryScalar (fun _ : Fin d → ℝ => fun t _ => t) := Elementary.coordinate (Fin.castAdd d 0) + +lemma space (i : Fin 3) : ElementaryScalar (fun _ : Fin d → ℝ => fun _ x => x i) := Elementary.coordinate (Fin.castAdd d i.succ) + +lemma parameter (i : Fin d) : ElementaryScalar (fun p : Fin d → ℝ => fun _ _ => p i) := Elementary.coordinate (Fin.natAdd 4 i) + +lemma curve {h : ℝ → ℝ} (hh : ElementaryCurve h) (hf : ElementaryScalar f) : + ElementaryScalar (fun p t x => h (f p t x)) := + Elementary.comp hh (fun z _ => f (fieldParam z) (fieldTime z) (fieldSpace z)) (fun _ => hf) + +lemma sum {ι : Type*} (s : Finset ι) (f : ι → (Fin d → ℝ) → Field ℝ) + (hf : ∀ i ∈ s, ElementaryScalar (f i)) : ElementaryScalar (fun p t x => ∑ i ∈ s, f i p t x) := + Elementary.sum s _ hf + +lemma prod {ι : Type*} (s : Finset ι) (f : ι → (Fin d → ℝ) → Field ℝ) + (hf : ∀ i ∈ s, ElementaryScalar (f i)) : ElementaryScalar (fun p t x => ∏ i ∈ s, f i p t x) := + Elementary.prod s _ hf + +lemma congr (hf : ElementaryScalar f) (he : ∀p t x, f p t x = g p t x) : ElementaryScalar g := + Elementary.congr hf (fun _ => he _ _ _) + +lemma time_differentiable (hf : ElementaryScalar f) (p : Fin d → ℝ) (x : Space) : + Differentiable ℝ (fun t => f p t x) := by + intro t + have hh := (hf.differentiable (fieldArgs p t x)).comp t + (fieldArgs_time_hasDerivAt p t x).differentiableAt + simpa only [Function.comp_def,fieldParam_args,fieldTime_args,fieldSpace_args] using hh + +lemma space_differentiable (hf : ElementaryScalar f) (p : Fin d → ℝ) (t : ℝ) : + Differentiable ℝ (f p t) := by + intro x + have hh := (hf.differentiable (fieldArgs p t x)).comp x + (fieldArgs_space_hasFDerivAt p t x).differentiableAt + simpa only [Function.comp_def,fieldParam_args,fieldTime_args,fieldSpace_args] using hh + +end BalancedTransport.Effectivity.ElementaryScalar +end + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryField +open BalancedTransport.Geometry +variable {d : ℕ} {v w : (Fin d → ℝ) → Velocity} + +lemma fullTimeD (hv : ElementaryField v) : ElementaryField (fun p => Geometry.fullTimeD (v p)) := by + intro i + apply (ElementaryScalar.fullTimeD (hv i)).congr + intro p t x + simp only [Geometry.fullTimeD, deriv_pi (fun k => (hv k).time_differentiable p x t)] + +lemma spaceD (hv : ElementaryField v) (i : Fin 3) : ElementaryField (fun p => BalancedTransport.spaceD i (v p)) := by + intro k + apply (ElementaryScalar.spaceD (hv k) i).congr + intro p t x + simp only [BalancedTransport.spaceD, fderiv_pi (fun j => (hv j).space_differentiable p t x), + ContinuousLinearMap.pi_apply] + +lemma curl (hv : ElementaryField v) : ElementaryField (fun p t => Geometry.curl (v p t)) := by + intro k + fin_cases k + · exact ((hv 2).spaceD 1).sub ((hv 1).spaceD 2) + · exact ((hv 0).spaceD 2).sub ((hv 2).spaceD 0) + · exact ((hv 1).spaceD 0).sub ((hv 0).spaceD 1) + +lemma sum {ι : Type*} (s : Finset ι) (f : ι → (Fin d → ℝ) → Velocity) + (hf : ∀ i ∈ s, ElementaryField (f i)) : ElementaryField (fun p t x => ∑ i ∈ s, f i p t x) := by + intro k + simpa only [Finset.sum_apply] using ElementaryScalar.sum s (fun i p t x => f i p t x k) (fun i hi => hf i hi k) + +lemma fullMixedD (hv : ElementaryField v) (a : MultiIndex) : + ElementaryField (fun p => Geometry.fullMixedD a (v p)) := by + induction a with + | nil => exact hv + | cons i a ih => cases i with + | none => exact ih.fullTimeD + | some i => exact ih.spaceD i + +end BalancedTransport.Effectivity.ElementaryField +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry + +lemma elementary_boxCutoff {d : ℕ} {a b : (Fin d → ℝ) → Velocity} + (ha : ElementaryField a) (hb : ElementaryField b) {η : ℝ} (hη : RationalConstant η) : + ElementaryScalar (fun p t x => boxCutoff (a p t x) (b p t x) η x) := by + apply ElementaryScalar.prod Finset.univ + intro i _ + exact ((((ElementaryScalar.space i).sub (ha i)).add + ((ElementaryScalar.literal 2).mul (ElementaryScalar.rational hη))).div_const hη).transition.mul + ((((hb i).add ((ElementaryScalar.literal 2).mul (ElementaryScalar.rational hη))).sub + (ElementaryScalar.space i)).div_const hη).transition + +lemma elementary_affinePotential {d : ℕ} {c v l : (Fin d → ℝ) → Velocity} + (hc : ElementaryField c) (hv : ElementaryField v) (hl : ElementaryField l) : + ElementaryField (fun p t x => affinePotential (c p t x) (v p t x) (l p t x) x) := by + have hh (i j : Fin 3) := ((ElementaryScalar.literal (1/2)).mul + (((hv i).mul ((ElementaryScalar.space j).sub (hc j))).sub + ((hv j).mul ((ElementaryScalar.space i).sub (hc i))))).add + (((ElementaryScalar.literal (1/3)).mul ((hl i).sub (hl j))).mul + ((ElementaryScalar.space i).sub (hc i)) |>.mul ((ElementaryScalar.space j).sub (hc j))) + intro k + fin_cases k + · simpa [affinePotential] using hh 1 2 + · simpa [affinePotential] using hh 2 0 + · simpa [affinePotential] using hh 0 1 + +lemma elementary_movingBoxVelocity {d : ℕ} (a b : Space) (ar : ∀i, RationalConstant (a i)) + (br : ∀i, RationalConstant (b i)) {c w : (Fin d → ℝ) → ℝ → Space} + (hc : ElementaryField (fun p t _ => c p t)) (hw : ElementaryField (fun p t _ => w p t)) + (hn : ∀ i, ∃ n : ℕ, ∀ p t, ((n+1:ℕ):ℝ)⁻¹ ≤ w p t i) + {η : ℝ} (ηr : RationalConstant η) : ElementaryField (fun p => movingBoxVelocity a b (c p) (w p) η) := by + have ha : ElementaryField (fun p t _ => lowerEndpoint a (c p) (w p) t) := + fun i => (hc i).add ((hw i).mul (ElementaryScalar.rational (ar i))) + have hb : ElementaryField (fun p t _ => lowerEndpoint b (c p) (w p) t) := + fun i => (hc i).add ((hw i).mul (ElementaryScalar.rational (br i))) + have hl : ElementaryField (fun p t _ => logarithmicRate (w p) t) := by + intro i + obtain ⟨n,hn⟩ := hn i + simpa only [logarithmicRate, fullTimeD, div_eq_mul_inv] using + (ElementaryScalar.fullTimeD (hw i)).mul ((hw i).inv n (fun p t _ => hn p t)) + have hP := elementary_affinePotential hc hc.fullTimeD hl + have hχ := elementary_boxCutoff ha hb ηr + exact ElementaryField.curl (fun i => hχ.mul (hP i)) + +lemma elementary_loadingVelocity {η : ℝ} (hr : RationalConstant η) : + ElementaryField (fun p : Fin 3 → ℝ => loadingVelocity p η) := by + have labelRat : ∀ i, RationalConstant (fixedLabel i) := by + intro i + fin_cases i + · exact RationalConstant.nat 4 + · exact RationalConstant.zero + · exact RationalConstant.zero + apply elementary_movingBoxVelocity fixedLabel fixedLabel labelRat labelRat + · intro i + simpa only [loadingCenter, loadingSwitch, Pi.smul_apply, Pi.sub_apply, smul_eq_mul, + Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using + ((((ElementaryScalar.literal 2).mul ElementaryScalar.time).sub + (ElementaryScalar.literal (1/2))).transition.mul + ((ElementaryScalar.parameter i).sub (ElementaryScalar.rational (labelRat i)))) + · intro i + simpa using (ElementaryScalar.literal (d:=3) 1) + · intro i + exact ⟨0, by intro p t; norm_num⟩ + · exact hr + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d38aa1c4fb7978a8a923ba290a4043b7bb464da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryJets.lean @@ -0,0 +1,173 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryCalculus + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open _root_.OAI.BalancedTransport.Geometry + +def fieldCoordinate (d : ℕ) : Option (Fin 3) → Fin (4+d) + | none => Fin.castAdd d 0 + | some i => Fin.castAdd d i.succ + +def scalarMixedD : MultiIndex → Field ℝ → Field ℝ + | [], f => f + | none :: a, f => fullTimeD (scalarMixedD a f) + | some i :: a, f => spaceD i (scalarMixedD a f) + +lemma ElementaryScalar.scalarMixedD {d : ℕ} {f : (Fin d → ℝ) → Field ℝ} + (hf : ElementaryScalar f) (a : MultiIndex) : + ElementaryScalar (fun p => scalarMixedD a (f p)) := by + induction a with + | nil => exact hf + | cons i a ih => cases i with + | none => exact ih.fullTimeD + | some i => exact ih.spaceD i + +lemma coordinateDerivative_field_time {d : ℕ} {f : (Fin d → ℝ) → Field ℝ} + (hf : ElementaryScalar f) (z : Fin (4+d) → ℝ) : + fderiv ℝ (fun z => f (fieldParam z) (fieldTime z) (fieldSpace z)) z + (Pi.single (fieldCoordinate d none) 1) = + fullTimeD (f (fieldParam z)) (fieldTime z) (fieldSpace z) := by + have hh := (hf.differentiable (fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z))).hasFDerivAt + have he := hh.comp_hasDerivAt (fieldTime z) (fieldArgs_time_hasDerivAt (fieldParam z) (fieldTime z) (fieldSpace z)) + simpa only [Function.comp_def, fieldArgs_parts,fieldParam_args,fieldTime_args,fieldSpace_args,Geometry.fullTimeD, + fieldCoordinate] using he.deriv.symm + +lemma fieldArgs_space_single {d : ℕ} (i : Fin 3) : + (ContinuousLinearMap.pi (fun k : Fin (4+d) => + Fin.addCases (Fin.cases (0 : Space →L[ℝ] ℝ) (fun i => ContinuousLinearMap.proj i)) + (fun _ => 0) k) : Space →L[ℝ] (Fin (4+d) → ℝ)) (Pi.single i 1) = + Pi.single (fieldCoordinate d (some i)) 1 := by + ext k + refine Fin.addCases ?_ ?_ k + · intro j + refine Fin.cases ?_ (fun l => ?_) j + · have hn : Fin.castAdd d (0 : Fin 4) ≠ Fin.castAdd d i.succ := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_succ, Fin.val_zero] at this; omega + simp only [ContinuousLinearMap.pi_apply, Fin.addCases_left, Fin.cases_zero, + zero_apply, Pi.single_apply, ite_eq_right hn,fieldCoordinate] + · simp only [ContinuousLinearMap.pi_apply, Fin.addCases_left, Fin.cases_succ, + ContinuousLinearMap.proj_apply, Pi.single_apply, Fin.castAdd_inj, Fin.succ_inj,fieldCoordinate] + · intro j + have hn : Fin.natAdd 4 j ≠ Fin.castAdd d i.succ := by + intro h; have := congrArg Fin.val h; simp only [Fin.val_castAdd, Fin.val_natAdd, Fin.val_succ] at this; omega + simp only [ContinuousLinearMap.pi_apply, Fin.addCases_right, + zero_apply, Pi.single_apply, ite_eq_right hn,fieldCoordinate] + +lemma coordinateDerivative_field_space {d : ℕ} {f : (Fin d → ℝ) → Field ℝ} + (hf : ElementaryScalar f) (z : Fin (4+d) → ℝ) (i : Fin 3) : + fderiv ℝ (fun z => f (fieldParam z) (fieldTime z) (fieldSpace z)) z + (Pi.single (fieldCoordinate d (some i)) 1) = + spaceD i (f (fieldParam z)) (fieldTime z) (fieldSpace z) := by + have hh := (hf.differentiable (fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z))).hasFDerivAt + have he := hh.comp (fieldSpace z) (fieldArgs_space_hasFDerivAt (fieldParam z) (fieldTime z) (fieldSpace z)) + simpa only [Function.comp_def, fieldArgs_parts,fieldParam_args,fieldTime_args,fieldSpace_args,spaceD, + ContinuousLinearMap.comp_apply, fieldArgs_space_single] using congrArg (fun l => l (Pi.single i 1)) he.fderiv.symm + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericProgram +open _root_.OAI.BalancedTransport.Geometry + +def fieldJet (d : ℕ) : MultiIndex → NumericProgram → NumericProgram + | [], p => p + | i :: a, p => (fieldJet d a p).jetStep (fieldCoordinate d i) + +lemma fieldJet_fold (d : ℕ) (a : MultiIndex) (p : NumericProgram) : + fieldJet d a p = a.reverse.foldl (fun q i => q.jetStep (fieldCoordinate d i)) p := by + induction a with + | nil => rfl + | cons i a ih => simp [fieldJet, ih] + +lemma computable_fieldCoordinate (d : ℕ) : Computable (fieldCoordinate d) := by + have h : Primrec (fun i : Option (Fin 3) => (Option.casesOn i 0 (fun j => j.val+1) : ℕ)) := + Primrec.option_casesOn Primrec.id (Primrec.const 0) + (Primrec.succ.comp (Primrec.fin_val.comp Primrec.snd)).to₂ + have hv : Primrec (fun i : Option (Fin 3) => (fieldCoordinate d i).val) := + h.of_eq (fun i => by cases i <;> rfl) + exact (Primrec.fin_val_iff.mp hv).to_comp + +lemma computable_fieldJet_step (d : ℕ) : + Computable (fun z : (MultiIndex × NumericProgram) × (NumericProgram × Option (Fin 3)) => + jetStep (fieldCoordinate d z.2.2) z.2.1) := by + let A := (MultiIndex × NumericProgram) × (NumericProgram × Option (Fin 3)) + have hk : Computable (fun z : A => fieldCoordinate d z.2.2) := + (computable_fieldCoordinate d).comp (Computable.snd.comp Computable.snd) + have hp : Computable (fun z : A => z.2.1) := Computable.fst.comp Computable.snd + exact Computable.comp + (f := fun z : Fin (4+d) × NumericProgram => jetStep z.1 z.2) + (g := fun z : A => (fieldCoordinate d z.2.2, z.2.1)) + (computable_jetStep (d := 4+d)) (hk.pair hp) + +lemma computable_fieldJet (d : ℕ) : + Computable (fun z : MultiIndex × NumericProgram => fieldJet d z.1 z.2) := by + have hl : Computable (fun z : MultiIndex × NumericProgram => z.1.reverse) := + Primrec.list_reverse.to_comp.comp Computable.fst + have h := computable_foldl hl Computable.snd (computable_fieldJet_step d).to₂ + exact h.of_eq (fun z => (fieldJet_fold d z.1 z.2).symm) + +lemma fieldJet_valid (d : ℕ) (a : MultiIndex) (p : NumericProgram) (z : Fin (4+d) → ℝ) + (hp : p.Valid z) : (fieldJet d a p).Valid z := by + induction a with + | nil => exact hp + | cons i a ih => exact jetStep_valid _ _ ih + +lemma fieldJet_real {d : ℕ} {f : (Fin d → ℝ) → Field ℝ} (hf : ElementaryScalar f) + (p : NumericProgram) (hp : ∀ z : Fin (4+d) → ℝ, p.Valid z) + (he : ∀z, p.real z = f (fieldParam z) (fieldTime z) (fieldSpace z)) (a : MultiIndex) : + ∀ z : Fin (4+d) → ℝ, (fieldJet d a p).real z = + scalarMixedD a (f (fieldParam z)) (fieldTime z) (fieldSpace z) := by + induction a with + | nil => exact he + | cons i a ih => + intro z + rw [fieldJet, jetStep_real _ _ _ (fieldJet_valid d a p z (hp z)), funext ih] + cases i with + | none => exact coordinateDerivative_field_time (hf.scalarMixedD a) z + | some i => exact coordinateDerivative_field_space (hf.scalarMixedD a) z i + +end BalancedTransport.Effectivity.NumericProgram +end + +noncomputable section +namespace BalancedTransport.Effectivity +open _root_.OAI.BalancedTransport.Geometry + +lemma scalarMixedD_component {v : Velocity} (hv : JointSmooth v) (a : MultiIndex) (i : Fin 3) : + scalarMixedD a (fun t x => v t x i) = fun t x => fullMixedD a v t x i := by + induction a with + | nil => rfl + | cons j a ih => + cases j with + | none => + simp only [scalarMixedD, ih, fullMixedD, fullTimeD] + ext t x + exact ((hasDerivAt_pi.mp + (((hv.fullMixedD a).timeSlice x).differentiable (by simp) t).hasDerivAt) i).deriv + | some j => + simp only [scalarMixedD, ih, fullMixedD, spaceD] + ext t x + have he := (ContinuousLinearMap.proj i : Space →L[ℝ] ℝ).hasFDerivAt.comp x + (((hv.fullMixedD a).slice t).differentiable (by simp) x).hasFDerivAt + exact congrArg (fun l => l (Pi.single j 1)) he.fderiv + +theorem elementary_jet_programs {d : ℕ} {v : (Fin d → ℝ) → Velocity} + (hv : ElementaryField v) (hs : ∀p, JointSmooth (v p)) : + ∃ ps : Fin 3 → NumericProgram, + ∀ i a z, (NumericProgram.fieldJet d a (ps i)).Valid (fieldArgs (fieldParam z) (fieldTime z) (fieldSpace z)) ∧ + (NumericProgram.fieldJet d a (ps i)).real z = + fullMixedD a (v (fieldParam z)) (fieldTime z) (fieldSpace z) i := by + choose ps hne hclosed hp he using (fun i => hv i) + refine ⟨ps, ?_⟩ + intro i a z + refine ⟨NumericProgram.fieldJet_valid d a (ps i) _ (hp i _), ?_⟩ + rw [NumericProgram.fieldJet_real (hv i) (ps i) (hp i) (fun z => congrFun (he i) z)] + exact congrFun (congrFun (scalarMixedD_component (hs (fieldParam z)) a i) (fieldTime z)) (fieldSpace z) + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryMotion.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryMotion.lean new file mode 100644 index 0000000000000000000000000000000000000000..17386b2f010834711b0cfa3b580df5b12b1e8f25 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryMotion.lean @@ -0,0 +1,208 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Deformation + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set + +def RationalConstant (x : ℝ) : Prop := ∃ q : ℚ, (q : ℝ) = x + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.RationalConstant +open BalancedTransport.Geometry Set + +lemma rat (q : ℚ) : RationalConstant (q : ℝ) := ⟨q,rfl⟩ + +lemma nat (n : ℕ) : RationalConstant (n : ℝ) := ⟨n, by simp⟩ + +lemma zero : RationalConstant 0 := by simpa using rat 0 + +lemma one : RationalConstant 1 := by simpa using rat 1 + +lemma add {a b : ℝ} (ha : RationalConstant a) (hb : RationalConstant b) : RationalConstant (a+b) := by + obtain ⟨a,rfl⟩ := ha; obtain ⟨b,rfl⟩ := hb + exact ⟨a+b, by simp⟩ + +lemma sub {a b : ℝ} (ha : RationalConstant a) (hb : RationalConstant b) : RationalConstant (a-b) := by + obtain ⟨a,rfl⟩ := ha; obtain ⟨b,rfl⟩ := hb + exact ⟨a-b, by simp⟩ + +lemma mul {a b : ℝ} (ha : RationalConstant a) (hb : RationalConstant b) : RationalConstant (a*b) := by + obtain ⟨a,rfl⟩ := ha; obtain ⟨b,rfl⟩ := hb + exact ⟨a*b, by simp⟩ + +lemma elementary {d : ℕ} [NeZero d] {a : ℝ} (ha : RationalConstant a) : + Elementary (fun _ : Fin d → ℝ => a) := by + obtain ⟨a,rfl⟩ := ha; exact Elementary.literal a + +end BalancedTransport.Effectivity.RationalConstant +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set + +def RationalCenters {ι : Type*} (a : ι → Space) : Prop := ∀ i k, RationalConstant (a i k) + +def RationalLayout {ι : Type*} (A : BoxLayout ι) : Prop := RationalCenters A.center ∧ RationalCenters A.width + +def ElementaryCurve (f : ℝ → ℝ) : Prop := Elementary (fun x : Fin 1 → ℝ => f (x 0)) + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryCurve +open BalancedTransport.Geometry Set + +lemma const {c : ℝ} (hc : RationalConstant c) : ElementaryCurve (fun _ => c) := hc.elementary + +lemma id : ElementaryCurve (fun t => t) := Elementary.coordinate 0 + +lemma add {f g : ℝ → ℝ} (hf : ElementaryCurve f) (hg : ElementaryCurve g) : + ElementaryCurve (fun t => f t + g t) := Elementary.add hf hg + +lemma sub {f g : ℝ → ℝ} (hf : ElementaryCurve f) (hg : ElementaryCurve g) : + ElementaryCurve (fun t => f t - g t) := Elementary.sub hf hg + +lemma mul {f g : ℝ → ℝ} (hf : ElementaryCurve f) (hg : ElementaryCurve g) : + ElementaryCurve (fun t => f t * g t) := Elementary.mul hf hg + +lemma div_const {f : ℝ → ℝ} (hf : ElementaryCurve f) {c : ℝ} (hc : RationalConstant c) : + ElementaryCurve (fun t => f t / c) := by + obtain ⟨c,rfl⟩ := hc; exact hf.div_rat c + +lemma exp {f : ℝ → ℝ} (hf : ElementaryCurve f) : ElementaryCurve (fun t => Real.exp (f t)) := Elementary.exp hf + +lemma comp {f g : ℝ → ℝ} (hf : ElementaryCurve f) (hg : ElementaryCurve g) : + ElementaryCurve (fun t => f (g t)) := Elementary.comp hf (fun x _ => g (x 0)) (fun _ => hg) + +lemma transition : ElementaryCurve Real.smoothTransition := id.smoothTransition + +lemma log {c : ℝ} (hc : RationalConstant c) (hp : 0 < c) : ElementaryCurve (fun _ => Real.log c) := by + obtain ⟨c,rfl⟩ := hc + exact Elementary.log_rat (by exact_mod_cast hp) + +end BalancedTransport.Effectivity.ElementaryCurve +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set +variable {ι : Type*} [Fintype ι] + +def ElementaryMotion {A B : BoxLayout ι} {safe : Set ι} {η : ℝ} + (m : BoxMotion A B safe η) : Prop := + (∀ i k, ElementaryCurve (fun t => m.center t i k)) ∧ + (∀ i k, ElementaryCurve (fun t => m.width t i k)) + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.ElementaryMotion +open BalancedTransport.Geometry Set +variable {ι : Type*} [Fintype ι] +variable {A B C : BoxLayout ι} {safe : Set ι} {η : ℝ} + +lemma stationary (hA : RationalLayout A) (hp : A.Positive) (hs : A.Separated η) + (hg : A.Guarded safe) : ElementaryMotion (BoxMotion.stationary hp hs hg) := + ⟨fun i k => ElementaryCurve.const (hA.1 i k), fun i k => ElementaryCurve.const (hA.2 i k)⟩ + +lemma trans {m : BoxMotion A B safe η} {n : BoxMotion B C safe η} + (hm : ElementaryMotion m) (hn : ElementaryMotion n) (hB : RationalLayout B) : + ElementaryMotion (m.trans n) := by + have h₂ : ElementaryCurve (fun t => 2*t) := + (ElementaryCurve.const (RationalConstant.nat 2)).mul ElementaryCurve.id + have h₂' : ElementaryCurve (fun t => 2*t-1) := h₂.sub (ElementaryCurve.const RationalConstant.one) + constructor <;> intro i k + · exact ((hm.1 i k).comp h₂).add ((hn.1 i k).comp h₂') |>.sub (ElementaryCurve.const (hB.1 i k)) + · exact (((hm.2 i k).comp h₂).mul ((hn.2 i k).comp h₂')).div_const (hB.2 i k) + +lemma reverse {m : BoxMotion A B safe η} (hm : ElementaryMotion m) : ElementaryMotion m.reverse := by + have h : ElementaryCurve (fun t => 1-t) := + (ElementaryCurve.const RationalConstant.one).sub ElementaryCurve.id + exact ⟨fun i k => (hm.1 i k).comp h, fun i k => (hm.2 i k).comp h⟩ + +lemma segment {a b w : ι → Space} (ha : RationalCenters a) (hb : RationalCenters b) + (hw : RationalCenters w) (hp : ∀ i k, 0 < w i k) + (hs : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Separated η) + (hg : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Guarded safe) : + ElementaryMotion (segmentMotion hp hs hg) := by + refine ⟨?_, fun i k => ElementaryCurve.const (hw i k)⟩ + intro i k + exact (((ElementaryCurve.const RationalConstant.one).sub ElementaryCurve.transition).mul + (ElementaryCurve.const (ha i k))).add + (ElementaryCurve.transition.mul (ElementaryCurve.const (hb i k))) + +lemma expansion {a w : ι → Space} {Λ : ℝ} (ha : RationalCenters a) + (hw : RationalCenters w) (hΛr : RationalConstant Λ) + (hp : ∀ i k, 0 < w i k) (hs : (BoxLayout.mk a w).Separated η) + (hg : (BoxLayout.mk a w).Guarded safe) (hΛ : 1 ≤ Λ) : + ElementaryMotion (expandCenters hp hs hg hΛ) := + segment ha (fun i k => hΛr.mul (ha i k)) hw _ _ _ + +lemma reshape {a h k : ι → Space} {R D : ℝ} + (ha : RationalCenters a) (hr : RationalCenters h) (kr : RationalCenters k) + (hh : ∀ i j, 0 < h i j) (hk : ∀ i j, 0 < k i j) + (hR : ∀ i j, h i j ≤ R) (kR : ∀ i j, k i j ≤ R) + (he : ∀ i, ∏ j, h i j = ∏ j, k i j) + (hD : 2 * R + 4 * η ≤ D) (hs : CenterSeparated a D) + (hg : ∀ i ∈ safe, 2 + R < a i 0) : + ElementaryMotion (reshapeMotion hh hk hR kR he hD hs hg) := by + refine ⟨fun i j => ElementaryCurve.const (ha i j), ?_⟩ + intro i j + exact ((((ElementaryCurve.const RationalConstant.one).sub ElementaryCurve.transition).mul + (ElementaryCurve.log (hr i j) (hh i j))).add + (ElementaryCurve.transition.mul (ElementaryCurve.log (kr i j) (hk i j)))).exp + +end BalancedTransport.Effectivity.ElementaryMotion +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set +variable {ι : Type*} [Fintype ι] + +omit [Fintype ι] in +lemma RationalCenters.update [DecidableEq ι] {a : ι → Space} (ha : RationalCenters a) + (i : ι) {b : Space} (hb : ∀ k, RationalConstant (b k)) : RationalCenters (Function.update a i b) := by + intro j k + by_cases h : j = i + · subst j; simpa using hb k + · simpa [Function.update_of_ne h] using ha j k + +lemma rational_space_update {a : Space} (ha : ∀ k, RationalConstant (a k)) + (j : Fin 3) {b : ℝ} (hb : RationalConstant b) : ∀ k, RationalConstant ((Function.update a j b) k) := by + intro k + by_cases he : k = j + · subst k; simpa using hb + · simpa [Function.update_of_ne he] using ha k + +omit [Fintype ι] in +lemma rational_remaining [DecidableEq ι] {a p : ι → Space} (ha : RationalCenters a) + (hp : RationalCenters p) (S : Finset ι) : RationalCenters (remainingCenters a p S) := by + intro i k + by_cases hi : i ∈ S + · simpa [remainingCenters, hi] using ha i k + · simpa [remainingCenters, hi] using hp i k + +lemma elementary_singleSegment [DecidableEq ι] {a w : ι → Space} {D η : ℝ} {safe : Set ι} + (ar : RationalCenters a) (wr : RationalCenters w) + (i : ι) (b : Space) (br : ∀ k, RationalConstant (b k)) + (hp : ∀ j k, 0 < w j k) (hw : ∀ j l k, w j k + w l k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hb : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → ∃ k, D < |(1-r)*a i k+r*b k-a j k|) + (hga : (BoxLayout.mk a w).Guarded safe) + (hgb : (BoxLayout.mk (Function.update a i b) w).Guarded safe) : + ElementaryMotion (singleSegmentMotion i b hp hw ha hb hga hgb) := + ElementaryMotion.segment ar (ar.update i br) wr _ _ _ + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryParking.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryParking.lean new file mode 100644 index 0000000000000000000000000000000000000000..d704d774be9ce4d1becbeef89ba1b9db7f6c027e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryParking.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryCalculus + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem elementary_evacuateHighest {a p w : ι → Space} {D η H : ℝ} {safe : Set ι} + (ar : RationalCenters a) (pr : RationalCenters p) (wr : RationalCenters w) + (Hr : RationalConstant H) + (hwidth : ∀ i k, 0 < w i k) + (hsize : ∀ i j k, w i k + w j k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hcross : ∀ i j, D < |a i 0 - p j 0|) + (hp : ∀ i j, i ≠ j → D < |p i 0 - p j 0|) + (hhigha : ∀ i, D < H - a i 1) (hhighp : ∀ i, D < H - p i 1) + (hD : 0 ≤ D) + (hga : (BoxLayout.mk a w).Guarded safe) (hgp : (BoxLayout.mk p w).Guarded safe) + (S : Finset ι) (i : ι) (hi : i ∈ S) (hmax : ∀ j ∈ S, a j 1 ≤ a i 1) : + ∃ m : BoxMotion ⟨remainingCenters a p S, w⟩ ⟨remainingCenters a p (S.erase i), w⟩ safe η, + ElementaryMotion m := by + let u := remainingCenters a p S + let v₁ := Function.update (a i) 1 H + let v₂ := Function.update (p i) 1 H + have hui : u i = a i := by simp [u, remainingCenters, hi] + have hu := remainingCenters_separated ha hcross hp S + have hgu := remainingCenters_guarded hga hgp S + have hv₁ : (BoxLayout.mk (Function.update u i v₁) w).Guarded safe := + guarded_update hgu i v₁ (by intro his; simpa [v₁] using hga i his) + have hv₂ : (BoxLayout.mk (Function.update u i v₂) w).Guarded safe := + guarded_update hgu i v₂ (by intro his; simpa [v₂] using hgp i his) + have hp₃ : (BoxLayout.mk (Function.update u i (p i)) w).Guarded safe := + guarded_update hgu i (p i) (fun his => hgp i his) + have hfirst : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * u i k + r * v₁ k - u j k| := by + intro r hr j hji + rw [hui] + by_cases hj : j ∈ S + · have huj : u j = a j := by simp [u, remainingCenters, hj] + rw [huj] + exact raising_gap (hmax j hj) (by linarith [hhigha i]) hr (ha i j (Ne.symm hji)) + · have huj : u j = p j := by simp [u, remainingCenters, hj] + rw [huj] + exact fixed_first_gap (by simp [v₁]) (by simpa [v₁] using hcross i j) + have hsecond : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * (Function.update u i v₁) i k + + r * v₂ k - (Function.update u i v₁) j k| := by + intro r _ j hji + simp only [Function.update_self, Function.update_of_ne hji] + apply high_plane_gap (H := H) (by simp [v₁]) (by simp [v₂]) + by_cases hj : j ∈ S + · simpa [u, remainingCenters, hj] using hhigha j + · simpa [u, remainingCenters, hj] using hhighp j + have hthird : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * (Function.update u i v₂) i k + + r * p i k - (Function.update u i v₂) j k| := by + intro r _ j hji + simp only [Function.update_self, Function.update_of_ne hji] + apply fixed_first_gap (by simp [v₂]) + by_cases hj : j ∈ S + · simpa [u, remainingCenters, hj, abs_sub_comm] using hcross j i + · simpa [u, remainingCenters, hj] using hp i j (Ne.symm hji) + have hsep₁ := hu.update i v₁ (fun j hji => by simpa using hfirst 1 ⟨by norm_num, le_rfl⟩ j hji) + have hsep₂ : CenterSeparated (Function.update u i v₂) D := by + have hh := hsep₁.update i v₂ (fun j hji => by simpa using hsecond 1 ⟨by norm_num, le_rfl⟩ j hji) + simpa [Function.update_idem] using hh + let m₁ := singleSegmentMotion i v₁ hwidth hsize hu hfirst hgu hv₁ + let m₂ := singleSegmentMotion i v₂ hwidth hsize hsep₁ hsecond hv₁ + (by simpa [Function.update_idem] using hv₂) + let m₃ := singleSegmentMotion i (p i) hwidth hsize hsep₂ hthird hv₂ + (by simpa [Function.update_idem] using hp₃) + have ur : RationalCenters u := rational_remaining ar pr S + have v₁r : ∀ k, RationalConstant (v₁ k) := rational_space_update (ar i) 1 Hr + have v₂r : ∀ k, RationalConstant (v₂ k) := rational_space_update (pr i) 1 Hr + have e₁ : ElementaryMotion m₁ := elementary_singleSegment ur wr i v₁ v₁r _ _ _ _ _ _ + have e₂ : ElementaryMotion m₂ := elementary_singleSegment (ur.update i v₁r) wr i v₂ v₂r _ _ _ _ _ _ + have e₃ : ElementaryMotion m₃ := elementary_singleSegment (ur.update i v₂r) wr i (p i) (pr i) _ _ _ _ _ _ + have h₂ := Exists.intro m₂ e₂ + change ∃ m : BoxMotion ⟨Function.update u i v₁, w⟩ + ⟨Function.update (Function.update u i v₁) i v₂, w⟩ safe η, ElementaryMotion m at h₂ + rw [Function.update_idem] at h₂ + have h₃ := Exists.intro m₃ e₃ + change ∃ m : BoxMotion ⟨Function.update u i v₂, w⟩ + ⟨Function.update (Function.update u i v₂) i (p i), w⟩ safe η, ElementaryMotion m at h₃ + rw [Function.update_idem] at h₃ + obtain ⟨m₂',e₂'⟩ := h₂ + obtain ⟨m₃',e₃'⟩ := h₃ + have h : ElementaryMotion ((m₁.trans m₂').trans m₃') := + (e₁.trans e₂' ⟨ur.update i v₁r,wr⟩).trans e₃' ⟨ur.update i v₂r,wr⟩ + rw [remainingCenters_erase hi] + exact ⟨_,h⟩ + +theorem elementary_evacuateToParking {a p w : ι → Space} {D η H : ℝ} {safe : Set ι} + (ar : RationalCenters a) (pr : RationalCenters p) (wr : RationalCenters w) + (Hr : RationalConstant H) + (hwidth : ∀ i k, 0 < w i k) + (hsize : ∀ i j k, w i k + w j k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hcross : ∀ i j, D < |a i 0 - p j 0|) + (hp : ∀ i j, i ≠ j → D < |p i 0 - p j 0|) + (hhigha : ∀ i, D < H - a i 1) (hhighp : ∀ i, D < H - p i 1) + (hD : 0 ≤ D) + (hga : (BoxLayout.mk a w).Guarded safe) (hgp : (BoxLayout.mk p w).Guarded safe) : + ∃ m : BoxMotion ⟨a, w⟩ ⟨p, w⟩ safe η, ElementaryMotion m := by + have h : ∀ S : Finset ι, ∃ m : BoxMotion ⟨remainingCenters a p S, w⟩ ⟨p, w⟩ safe η, + ElementaryMotion m := by + intro S + refine Finset.strongInductionOn S ?_ + intro S ih + by_cases hS : S.Nonempty + · obtain ⟨i, hi, hmax⟩ := S.exists_max_image (fun i => a i 1) hS + obtain ⟨m,em⟩ := ih (S.erase i) (Finset.erase_ssubset hi) + obtain ⟨v,ev⟩ := elementary_evacuateHighest ar pr wr Hr hwidth hsize ha hcross hp hhigha hhighp hD + hga hgp S i hi hmax + exact ⟨v.trans m, ev.trans em ⟨rational_remaining ar pr _,wr⟩⟩ + · have he : S = ∅ := Finset.not_nonempty_iff_eq_empty.mp hS + subst S + have hempty : remainingCenters a p ∅ = p := by ext i k; simp [remainingCenters] + rw [hempty] + exact ⟨BoxMotion.stationary (A := ⟨p, w⟩) hwidth + (separated_of_centerSeparated (fun i j hij => ⟨0, hp i j hij⟩) hsize) hgp, + ElementaryMotion.stationary ⟨pr,wr⟩ _ _ _⟩ + have hh := h Finset.univ + have he : remainingCenters a p Finset.univ = a := by ext i k; simp [remainingCenters] + rw [he] at hh + exact hh + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryRouting.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a6f00a6ca8e36c0c50d37aee7d73eb9fee98b28 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryRouting.lean @@ -0,0 +1,214 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Routing +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryParking + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set +variable {ι : Type*} [Fintype ι] + +lemma RationalConstant.max {a b : ℝ} (ha : RationalConstant a) (hb : RationalConstant b) : + RationalConstant (max a b) := by + rcases le_total a b with h | h + · simpa only [max_eq_right h] using hb + · simpa only [max_eq_left h] using ha + +lemma finite_upper_bound_nat {α : Type*} [Finite α] (f : α → ℝ) : + ∃ R : ℕ, ∀ i, f i < (R : ℝ) := by + obtain ⟨R,hR⟩ := finite_upper_bound f + obtain ⟨N,hN⟩ := exists_nat_gt R + exact ⟨N, fun i => (hR i).trans hN⟩ + +omit [Fintype ι] in +lemma scale_separation_mono {a : ι → Space} {D L N : ℝ} (hL : 0 ≤ L) (hLN : L ≤ N) + (h : CenterSeparated (fun i k => L * a i k) D) : + CenterSeparated (fun i k => N * a i k) D := by + intro i j hij + obtain ⟨k,hk⟩ := h i j hij + refine ⟨k,hk.trans_le ?_⟩ + simp only [← mul_sub, abs_mul, abs_of_nonneg hL, abs_of_nonneg (hL.trans hLN)] + exact mul_le_mul_of_nonneg_right hLN (abs_nonneg _) + +lemma exists_nat_expansion {a b : ι → Space} (ha : Function.Injective a) + (hb : Function.Injective b) {D R : ℝ} (hD : 0 ≤ D) : + ∃ L : ℕ, 1 ≤ (L : ℝ) ∧ R + 2 ≤ (L : ℝ) ∧ + CenterSeparated (fun i k => (L : ℝ) * a i k) D ∧ + CenterSeparated (fun i k => (L : ℝ) * b i k) D := by + obtain ⟨L,hL,hLR,hLa,hLb⟩ := exists_expansion ha hb (R := R) hD + obtain ⟨N,hN⟩ := exists_nat_gt L + exact ⟨N,hL.trans hN.le,hLR.trans hN.le, + scale_separation_mono (by linarith) hN.le hLa, + scale_separation_mono (by linarith) hN.le hLb⟩ + +lemma exists_rational_parking (a b : ι → Space) {D R : ℝ} (hD : 0 ≤ D) : + RationalConstant D → RationalConstant R → + ∃ p : ι → Space, RationalCenters p ∧ + (∀ i j, D < |a i 0 - p j 0|) ∧ + (∀ i j, D < |b i 0 - p j 0|) ∧ + (∀ i j, i ≠ j → D < |p i 0 - p j 0|) ∧ + (∀ i, 2 + R < p i 0) := by + classical + intro Dr Rr + obtain ⟨La, hLa⟩ := finite_upper_bound_nat (fun i => a i 0) + obtain ⟨Lb, hLb⟩ := finite_upper_bound_nat (fun i => b i 0) + let K := max (3 + R) (max (La : ℝ) (Lb : ℝ)) + D + 1 + let e := Fintype.equivFin ι + let p : ι → Space := fun i => ![K + (D + 1) * (e i).val, 0, 0] + have hKs : 2 + R < K := by dsimp [K]; have := le_max_left (3 + R) (max (La : ℝ) (Lb : ℝ)); linarith + have hKa : ∀ i, D < K - a i 0 := by + intro i + have := (le_max_left (La : ℝ) (Lb : ℝ)).trans (le_max_right (3 + R) (max (La : ℝ) (Lb : ℝ))) + have := hLa i + dsimp [K] + linarith + have hKb : ∀ i, D < K - b i 0 := by + intro i + have := (le_max_right (La : ℝ) (Lb : ℝ)).trans (le_max_right (3 + R) (max (La : ℝ) (Lb : ℝ))) + have := hLb i + dsimp [K] + linarith + have hpn : ∀ i, K ≤ p i 0 := by + intro i + dsimp [p] + exact le_add_of_nonneg_right (mul_nonneg (by linarith) (Nat.cast_nonneg _)) + have Kr : RationalConstant K := + ((RationalConstant.nat 3).add Rr |>.max + ((RationalConstant.nat La).max (RationalConstant.nat Lb))).add Dr |>.add RationalConstant.one + have pr : RationalCenters p := by + intro i k + fin_cases k + · exact Kr.add ((Dr.add RationalConstant.one).mul (RationalConstant.nat _)) + · exact RationalConstant.zero + · exact RationalConstant.zero + refine ⟨p, pr, ?_, ?_, ?_, fun i => hKs.trans_le (hpn i)⟩ + · intro i j + have := hKa i + have := hpn j + rw [abs_sub_comm] + exact lt_of_lt_of_le (by linarith : D < p j 0 - a i 0) (le_abs_self _) + · intro i j + have := hKb i + have := hpn j + rw [abs_sub_comm] + exact lt_of_lt_of_le (by linarith : D < p j 0 - b i 0) (le_abs_self _) + · intro i j hij + have hv : (e i).val ≠ (e j).val := by intro h; exact hij (e.injective (Fin.ext h)) + have hh : (1 : ℝ) ≤ |(e i).val - ((e j).val : ℝ)| := by + rcases lt_or_gt_of_ne hv with hl | hl + · have hcast : ((e i).val : ℝ) + 1 ≤ (e j).val := by exact_mod_cast hl + rw [abs_of_nonpos (by linarith : ((e i).val : ℝ) - (e j).val ≤ 0)] + linarith + · have hcast : ((e j).val : ℝ) + 1 ≤ (e i).val := by exact_mod_cast hl + rw [abs_of_nonneg (by linarith : 0 ≤ ((e i).val : ℝ) - (e j).val)] + linarith + have he : p i 0 - p j 0 = (D + 1) * (((e i).val : ℝ) - (e j).val) := by dsimp [p]; ring + rw [he, abs_mul, abs_of_nonneg (by linarith : 0 ≤ D + 1)] + nlinarith + +theorem elementary_guarded_solid_box_motion (A B : BoxLayout ι) (safe : Set ι) + (Ar : RationalLayout A) (Br : RationalLayout B) + (hA : A.Positive) (hB : B.Positive) + (hsA : A.Separated 0) (hsB : B.Separated 0) + (hvol : ∀ i, ∏ k, A.width i k = ∏ k, B.width i k) + (hgA : A.Guarded safe) (hgB : B.Guarded safe) : + ∃ η : ℚ, 0 < η ∧ ∃ m : BoxMotion A B safe (η : ℝ), ElementaryMotion m := by + classical + obtain ⟨ηA, hηA, hmA⟩ := hsA.positive_margin + obtain ⟨ηB, hηB, hmB⟩ := hsB.positive_margin + obtain ⟨q,hq,hqm⟩ := exists_rat_btwn (lt_min hηA hηB) + let η : ℝ := q + have hη : 0 < η := hq + have ηr : RationalConstant η := RationalConstant.rat q + have hmA' := hmA.mono (hqm.le.trans (min_le_left ηA ηB)) + have hmB' := hmB.mono (hqm.le.trans (min_le_right ηA ηB)) + obtain ⟨RA, hRA⟩ := finite_upper_bound_nat (fun p : ι × Fin 3 => A.width p.1 p.2) + obtain ⟨RB, hRB⟩ := finite_upper_bound_nat (fun p : ι × Fin 3 => B.width p.1 p.2) + let R : ℝ := max 1 (max (RA : ℝ) (RB : ℝ)) + have Rr : RationalConstant R := RationalConstant.one.max + ((RationalConstant.nat RA).max (RationalConstant.nat RB)) + have hR : 1 ≤ R := le_max_left _ _ + have hAR : ∀ i k, A.width i k ≤ R := fun i k => (hRA (i,k)).le.trans + ((le_max_left _ _).trans (le_max_right _ _)) + have hBR : ∀ i k, B.width i k ≤ R := fun i k => (hRB (i,k)).le.trans + ((le_max_right _ _).trans (le_max_right _ _)) + let D := 2 * R + 4 * η + have hD : 0 ≤ D := by dsimp [D]; linarith + obtain ⟨L, hΛ, hΛR, hΛA, hΛB⟩ := exists_nat_expansion + (BoxLayout.center_injective hA hsA) (BoxLayout.center_injective hB hsB) (R := R) hD + let Λ : ℝ := L + have Λr : RationalConstant Λ := RationalConstant.nat L + let a : ι → Space := fun i k => Λ * A.center i k + let b : ι → Space := fun i k => Λ * B.center i k + have ar : RationalCenters a := fun i k => Λr.mul (Ar.1 i k) + have br : RationalCenters b := fun i k => Λr.mul (Br.1 i k) + have Dr : RationalConstant D := ((RationalConstant.nat 2).mul Rr).add + ((RationalConstant.nat 4).mul ηr) + obtain ⟨p, pr, hpa, hpb, hpp, hpg⟩ := exists_rational_parking a b (R := R) hD Dr Rr + have hag : ∀ i ∈ safe, 2 + R < a i 0 := by + intro i hi + have hh : 2 < A.center i 0 := by have := hgA i hi; linarith [hA i 0] + have hΛp : 0 < Λ := by linarith + have hh' := mul_lt_mul_of_pos_left hh hΛp + dsimp [a] + nlinarith + have hbg : ∀ i ∈ safe, 2 + R < b i 0 := by + intro i hi + have hh : 2 < B.center i 0 := by have := hgB i hi; linarith [hB i 0] + have hΛp : 0 < Λ := by linarith + have hh' := mul_lt_mul_of_pos_left hh hΛp + dsimp [b] + nlinarith + have hga : (BoxLayout.mk a B.width).Guarded safe := by + intro i hi + change 2 < a i 0 - B.width i 0 + linarith [hag i hi, hBR i 0] + have hgb : (BoxLayout.mk b B.width).Guarded safe := by + intro i hi + change 2 < b i 0 - B.width i 0 + linarith [hbg i hi, hBR i 0] + have hgp : (BoxLayout.mk p B.width).Guarded safe := by + intro i _ + change 2 < p i 0 - B.width i 0 + linarith [hpg i, hBR i 0] + have hsize : ∀ i j k, B.width i k + B.width j k + 4 * η ≤ D := by + intro i j k + dsimp [D] + linarith [hBR i k, hBR j k] + obtain ⟨HA, hHA⟩ := finite_upper_bound_nat (fun i => a i 1) + obtain ⟨HB, hHB⟩ := finite_upper_bound_nat (fun i => b i 1) + obtain ⟨HP, hHP⟩ := finite_upper_bound_nat (fun i => p i 1) + let H : ℝ := max (HA : ℝ) (max (HB : ℝ) (HP : ℝ)) + D + 1 + have Hr : RationalConstant H := ((RationalConstant.nat HA).max + ((RationalConstant.nat HB).max (RationalConstant.nat HP))).add Dr |>.add RationalConstant.one + have hhA : ∀ i, D < H - a i 1 := by + intro i + have := le_max_left (HA : ℝ) (max (HB : ℝ) (HP : ℝ)) + have := hHA i + dsimp [H]; linarith + have hhB : ∀ i, D < H - b i 1 := by + intro i + have := (le_max_left (HB : ℝ) (HP : ℝ)).trans (le_max_right (HA : ℝ) (max (HB : ℝ) (HP : ℝ))) + have := hHB i + dsimp [H]; linarith + have hhP : ∀ i, D < H - p i 1 := by + intro i + have := (le_max_right (HB : ℝ) (HP : ℝ)).trans (le_max_right (HA : ℝ) (max (HB : ℝ) (HP : ℝ))) + have := hHP i + dsimp [H]; linarith + let m₁ := expandCenters hA hmA' hgA hΛ + let m₂ := reshapeMotion hA hB hAR hBR hvol (le_refl D) hΛA hag + obtain ⟨m₃,e₃⟩ := elementary_evacuateToParking ar pr Br.2 Hr hB hsize hΛA hpa hpp hhA hhP hD hga hgp + obtain ⟨m₄,e₄⟩ := elementary_evacuateToParking br pr Br.2 Hr hB hsize hΛB hpb hpp hhB hhP hD hgb hgp + let m₅ := expandCenters hB hmB' hgB hΛ + have e₁ : ElementaryMotion m₁ := ElementaryMotion.expansion Ar.1 Ar.2 Λr _ _ _ _ + have e₂ : ElementaryMotion m₂ := ElementaryMotion.reshape ar Ar.2 Br.2 _ _ _ _ _ _ _ _ + have e₅ : ElementaryMotion m₅ := ElementaryMotion.expansion Br.1 Br.2 Λr _ _ _ _ + exact ⟨q, by exact_mod_cast hq, _, + (((e₁.trans e₂ ⟨ar,Ar.2⟩).trans e₃ ⟨ar,Br.2⟩).trans e₄.reverse ⟨pr,Br.2⟩).trans + e₅.reverse ⟨br,Br.2⟩⟩ + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryTemplate.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryTemplate.lean new file mode 100644 index 0000000000000000000000000000000000000000..5926e7feb0021bc1f5a3f4d6e02a88f896169018 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ElementaryTemplate.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryFields +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryRouting +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.CompiledGeometry + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.RationalConstant +open BalancedTransport.Geometry Set + +lemma neg {x : ℝ} (h : RationalConstant x) : RationalConstant (-x) := by + obtain ⟨q,rfl⟩ := h; exact ⟨-q, by simp⟩ + +lemma inv {x : ℝ} (h : RationalConstant x) : RationalConstant x⁻¹ := by + obtain ⟨q,rfl⟩ := h; exact ⟨q⁻¹, by simp⟩ + +lemma div {x y : ℝ} (hx : RationalConstant x) (hy : RationalConstant y) : RationalConstant (x/y) := by + simpa only [div_eq_mul_inv] using hx.mul hy.inv + +lemma pow {x : ℝ} (h : RationalConstant x) (n : ℕ) : RationalConstant (x^n) := by + obtain ⟨q,rfl⟩ := h; exact ⟨q^n, by simp⟩ + +end BalancedTransport.Effectivity.RationalConstant +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry Set + +lemma elementary_motion_velocity {ι : Type*} [Fintype ι] {A B : BoxLayout ι} {safe : Set ι} + {η : ℝ} (hr : RationalConstant η) (Ar : RationalLayout A) {m : BoxMotion A B safe η} + (hm : ElementaryMotion m) (d : ℕ) : ElementaryField (fun _ : Fin d → ℝ => m.velocity) := by + apply ElementaryField.sum Finset.univ + intro i _ + have ht : ElementaryCurve (fun t : ℝ => 2*t-1/2) := by + simpa using + ((ElementaryCurve.const (RationalConstant.nat 2)).mul ElementaryCurve.id).sub + (ElementaryCurve.const (RationalConstant.rat (1/2))) + have hc : ElementaryField (fun _ : Fin d → ℝ => fun t _ => m.fieldCenter i t) := + fun k => ElementaryScalar.time.curve ((hm.1 i k).comp ht) + have hw : ElementaryField (fun _ : Fin d → ℝ => fun t _ => m.fieldScale i t) := + fun k => (ElementaryScalar.time.curve ((hm.2 i k).comp ht)).div_const (Ar.2 i k) + apply elementary_movingBoxVelocity (-A.width i) (A.width i) + (fun k => (Ar.2 i k).neg) (Ar.2 i) hc hw + · intro k + obtain ⟨t,ht,hmin⟩ := isCompact_Icc.exists_isMinOn + (show (Icc (0 : ℝ) 1).Nonempty from ⟨0, by simp⟩) + (contDiff_pi.mp (m.fieldScale_smooth i) k).continuous.continuousOn + obtain ⟨n,hn⟩ := exists_nat_one_div_lt (m.fieldScale_pos i t k) + have hn' : (((n+1:ℕ):ℝ)⁻¹) ≤ m.fieldScale i t k := by simpa [one_div] using hn.le + refine ⟨n, fun _ s => hn'.trans ?_⟩ + have hh : ∀ s ∈ Icc (0 : ℝ) 1, m.fieldScale i t k ≤ m.fieldScale i s k := hmin + by_cases hs : s ≤ 1/4 + · simpa only [m.fieldScale_before i hs, m.fieldScale_before i (by norm_num : (0:ℝ) ≤ 1/4), + Nat.cast_add, Nat.cast_one, one_div] using hh 0 (by simp) + · by_cases hs' : 3/4 ≤ s + · simpa only [m.fieldScale_after i hs', m.fieldScale_after i (by norm_num : (3:ℝ)/4 ≤ 1)] using hh 1 (by simp) + · exact hh s ⟨by linarith,by linarith⟩ + · exact hr + +lemma rational_word {S : Type*} {r : ℝ} {digit : S → ℝ} (hr : RationalConstant r) + (hd : ∀s, RationalConstant (digit s)) (w : List S) : RationalConstant (Coding.word r digit w) := by + induction w with + | nil => exact RationalConstant.zero + | cons a w ih => exact hr.mul ((hd a).add ih) + +lemma rational_origin (n : ℕ) : ∀i, RationalConstant (Coding.origin n i) := by + intro i + fin_cases i + · exact (RationalConstant.nat 4).mul (RationalConstant.nat n) + · exact RationalConstant.zero + · exact RationalConstant.zero + +lemma rational_coding_layout {S ι : Type*} {r : ℝ} {digit : S → ℝ} {o : ι → Space} + (hr : RationalConstant r) (hd : ∀s, RationalConstant (digit s)) (ho : RationalCenters o) + (u : ι → Fin 3 → List S) : RationalLayout (Coding.layout r digit o u) := by + constructor + · intro i k + exact ((ho i k).add (rational_word hr hd _)).add ((hr.pow _).div (RationalConstant.nat 2)) + · intro i k + exact (hr.pow _).div (RationalConstant.nat 2) + +lemma rational_sourceLayout {Q Γ : Type*} [Fintype Q] [Fintype Γ] [DecidableEq Q] [DecidableEq Γ] + (M : Recorder.Machine Q Γ) : RationalLayout (Recorder.sourceLayout M) := + rational_coding_layout (RationalConstant.nat _).inv (fun _ => RationalConstant.nat _) + (fun _ => rational_origin _) _ + +lemma rational_targetLayout {Q Γ : Type*} [Fintype Q] [Fintype Γ] [DecidableEq Q] [DecidableEq Γ] + (M : Recorder.Machine Q Γ) : RationalLayout (Recorder.targetLayout M) := + rational_coding_layout (RationalConstant.nat _).inv (fun _ => RationalConstant.nat _) + (fun _ => rational_origin _) _ + +theorem exists_elementary_guarded_template {Q Γ : Type*} [Fintype Q] [Fintype Γ] + [DecidableEq Q] [DecidableEq Γ] (M : Recorder.Machine Q Γ) (d : ℕ) : + ∃ (v : Velocity) (K : Set Space), IsCompact K ∧ JointSmooth v ∧ TimeCollars v ∧ + SpatiallySupported K v ∧ (∀ t x, div v t x = 0) ∧ Recorder.GuardedTemplate M v ∧ + ElementaryField (fun _ : Fin d → ℝ => v) := by + obtain ⟨η,hη,m,hm⟩ := elementary_guarded_solid_box_motion (Recorder.sourceLayout M) + (Recorder.targetLayout M) (Recorder.safeRows M) (rational_sourceLayout M) (rational_targetLayout M) + (Recorder.sourceLayout_positive M) (Recorder.targetLayout_positive M) + (Recorder.sourceLayout_separated M) (Recorder.targetLayout_separated M) + (Recorder.layouts_equal_volume M) (Recorder.sourceLayout_guard M) (Recorder.targetLayout_guard M) + have hp : (0 : ℝ) < (η : ℝ) := by exact_mod_cast hη + obtain ⟨K,hK,hs⟩ := m.velocity_compact_support hp + refine ⟨m.velocity,K,hK,m.velocity_jointSmooth,m.velocity_collars,hs,m.velocity_divergence,?_, + elementary_motion_velocity (RationalConstant.rat η) (rational_sourceLayout M) hm d⟩ + intro r hr x hx + let i : Recorder.ActiveRow M := ⟨r, (Recorder.mem_table M r).mpr hr⟩ + have hm : x ∈ (Recorder.sourceLayout M).solid i := by rwa [Recorder.sourceLayout_solid] + refine ⟨m.path i x,m.path_start i x,?_,?_,?_⟩ + · rw [m.path_end, Recorder.layouts_affineMap] + · intro t _ + exact (m.path_hasDerivAt hp hm t).hasDerivWithinAt + · intro hsafe t _ + exact m.path_guarded hsafe hm t + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Energy.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Energy.lean new file mode 100644 index 0000000000000000000000000000000000000000..23ffc5bf123ff4d4543a9e9c5e1db1e769c462a4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Energy.lean @@ -0,0 +1,144 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Sobolev + +namespace OAI + +noncomputable section +namespace BalancedTransport.Analysis +open MeasureTheory Filter Set +open scoped Topology ENNReal +open BalancedTransport.Geometry +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +lemma Smooth.slice {v : Field F} (hv : Smooth v) {t : ℝ} (ht : 0 ≤ t) : + ContDiff ℝ (⊤ : ℕ∞) (v t) := by + apply contDiffOn_univ.mp + exact hv.comp (contDiff_const.prodMk contDiff_id).contDiffOn + (fun x _ => ⟨ht, mem_univ x⟩) + +lemma Smooth.sub {v w : Field F} (hv : Smooth v) (hw : Smooth w) : + Smooth (fun t x => v t x - w t x) := hv.sub hw + +lemma CH.memLp {v : Field F} {k : ℕ} (hv : CH k v) + (a : List (Fin 3)) (ha : a.length ≤ k) {t : ℝ} (ht : 0 ≤ t) : + MemLp (spatialD a v t) 2 (volume : Measure Space) := by + obtain ⟨V, _, he⟩ := hv a ha + exact (Lp.memLp (V t)).ae_eq (he t ht) + +lemma membrane_component {f : Space → Space} (hf : MemLp f 2 (volume : Measure Space)) + (hc : Continuous f) (i : Fin 3) : MemLp (fun x => f x i) 2 (volume : Measure Space) := by + apply hf.of_le ((continuous_apply i).comp hc).aestronglyMeasurable + exact Eventually.of_forall (fun x => norm_le_pi_norm (f x) i) + +lemma integrable_bounded_mul_l2_mul_l2 {a f g : Space → ℝ} {C : ℝ} + (ha : Continuous a) (hab : ∀ x, ‖a x‖ ≤ C) + (hf : MemLp f 2 (volume : Measure Space)) (hg : MemLp g 2 (volume : Measure Space)) : + Integrable (fun x => a x * f x * g x) (volume : Measure Space) := by + convert (hf.integrable_mul hg).bdd_mul ha.aestronglyMeasurable + (Eventually.of_forall hab) using 1 + ext x + simp only [Pi.mul_apply, mul_assoc] + +lemma integral_mul_pd_eq_neg_pd_mul {f g : Space → ℝ} + (hf : Differentiable ℝ f) (hg : Differentiable ℝ g) (j : Fin 3) + (hdg : Integrable (fun x => pd j f x * g x) (volume : Measure Space)) + (hfd : Integrable (fun x => f x * pd j g x) (volume : Measure Space)) + (hfg : Integrable (fun x => f x * g x) (volume : Measure Space)) : + (∫ x, f x * pd j g x) = - ∫ x, pd j f x * g x := + integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable hdg hfd hfg + (fun x _ => hf x) (fun x _ => hg x) + +lemma transport_component {a w : Space → ℝ} + (ha : ContDiff ℝ (⊤ : ℕ∞) a) (hw : ContDiff ℝ (⊤ : ℕ∞) w) + (j : Fin 3) {C : ℝ} (hc : ∀ x, ‖a x‖ ≤ C) (hd : ∀ x, ‖pd j a x‖ ≤ C) + (hw₂ : MemLp w 2 (volume : Measure Space)) + (hdw₂ : MemLp (pd j w) 2 (volume : Measure Space)) : + 2 * (∫ x, a x * pd j w x * w x) = - ∫ x, pd j a x * w x * w x := by + have Hi := integrable_bounded_mul_l2_mul_l2 ha.continuous hc hdw₂ hw₂ + have Hj := integrable_bounded_mul_l2_mul_l2 (pd_contDiff j ha).continuous hd hw₂ hw₂ + have Hk := integrable_bounded_mul_l2_mul_l2 ha.continuous hc hw₂ hw₂ + have he (x : Space) : pd j (fun x => w x * w x) x = 2 * (pd j w x * w x) := by + rw [pd_mul j (hw.differentiable (by simp) x) (hw.differentiable (by simp) x)] + ring + have hdg : Integrable (fun x => pd j a x * (w x * w x)) (volume : Measure Space) := by + simpa only [mul_assoc] using Hj + have hfg : Integrable (fun x => a x * (w x * w x)) (volume : Measure Space) := by + simpa only [mul_assoc] using Hk + have hfd : Integrable (fun x => a x * pd j (fun x => w x * w x) x) + (volume : Measure Space) := by + convert Hi.const_mul 2 using 1 + ext x + rw [he] + ring + have H := integral_mul_pd_eq_neg_pd_mul (ha.differentiable (by simp)) + ((hw.mul hw).differentiable (by simp)) j hdg hfd hfg + have he' : (fun x => a x * pd j (fun x => w x * w x) x) = + (fun x => 2 * (a x * pd j w x * w x)) := by + ext x + rw [he] + ring + rw [he', integral_const_mul] at H + simpa only [mul_assoc] using H + +theorem transport_cancellation {v : Space → Space} {w : Space → ℝ} + (hv : ContDiff ℝ (⊤ : ℕ∞) v) (hw : ContDiff ℝ (⊤ : ℕ∞) w) + {C : ℝ} (hb : ∀ x, ‖v x‖ ≤ C) (hdb : ∀ x j, ‖pd j v x‖ ≤ C) + (hdiv : ∀ x, ∑ j, pd j v x j = 0) + (hw₂ : MemLp w 2 (volume : Measure Space)) + (hdw₂ : ∀ j, MemLp (pd j w) 2 (volume : Measure Space)) : + (∑ j, ∫ x, v x j * pd j w x * w x) = 0 := by + have he (j : Fin 3) (x : Space) : pd j (fun x => v x j) x = pd j v x j := + pd_apply j j (hv.differentiable (by simp) x) + have H (j : Fin 3) := transport_component (contDiff_pi.mp hv j) hw j + (fun x => (norm_le_pi_norm (v x) j).trans (hb x)) + (fun x => by rw [he]; exact (norm_le_pi_norm (pd j v x) j).trans (hdb x j)) + hw₂ (hdw₂ j) + have hdj (j : Fin 3) : Integrable (fun x => pd j v x j * w x * w x) (volume : Measure Space) := by + apply integrable_bounded_mul_l2_mul_l2 + ((continuous_apply j).comp (pd_contDiff j hv).continuous) + (fun x => (norm_le_pi_norm (pd j v x) j).trans (hdb x j)) hw₂ hw₂ + have hsum : (∑ j, ∫ x, pd j v x j * w x * w x) = 0 := by + rw [← integral_finsetSum _ (fun j _ => hdj j)] + have hz (x : Space) : (∑ j, pd j v x j * w x * w x) = 0 := by + rw [← Finset.sum_mul, ← Finset.sum_mul, hdiv x, zero_mul, zero_mul] + simp only [hz, integral_zero] + have Hsum := congrArg (fun f : Fin 3 → ℝ => ∑ j, f j) (funext H) + simp only [he, Finset.sum_neg_distrib, ← Finset.mul_sum, hsum, neg_zero] at Hsum + linarith + +lemma diffusion_component {w : Space → ℝ} (hw : ContDiff ℝ (⊤ : ℕ∞) w) + (j : Fin 3) (hw₂ : MemLp w 2 (volume : Measure Space)) + (hd₂ : MemLp (pd j w) 2 (volume : Measure Space)) + (hdd₂ : MemLp (pd j (pd j w)) 2 (volume : Measure Space)) : + (∫ x, w x * pd j (pd j w) x) = - ∫ x, (pd j w x) ^ 2 := by + simpa only [pow_two] using integral_mul_pd_eq_neg_pd_mul + (hw.differentiable (by simp)) ((pd_contDiff j hw).differentiable (by simp)) j + (hd₂.integrable_mul hd₂) (hw₂.integrable_mul hdd₂) (hw₂.integrable_mul hd₂) + +theorem pressure_cancellation {w : Space → Space} {p : Space → ℝ} + (hw : ContDiff ℝ (⊤ : ℕ∞) w) (hp : ContDiff ℝ (⊤ : ℕ∞) p) + (hdiv : ∀ x, ∑ j, pd j w x j = 0) + (hw₂ : ∀ j, MemLp (fun x => w x j) 2 (volume : Measure Space)) + (hdw₂ : ∀ j, MemLp (fun x => pd j w x j) 2 (volume : Measure Space)) + (hp₂ : MemLp p 2 (volume : Measure Space)) + (hdp₂ : ∀ j, MemLp (pd j p) 2 (volume : Measure Space)) : + (∑ j, ∫ x, w x j * pd j p x) = 0 := by + have he (j : Fin 3) (x : Space) : pd j (fun x => w x j) x = pd j w x j := + pd_apply j j (hw.differentiable (by simp) x) + have hdj (j : Fin 3) : Integrable (fun x => pd j w x j * p x) (volume : Measure Space) := + (hdw₂ j).integrable_mul hp₂ + have H (j : Fin 3) : (∫ x, w x j * pd j p x) = -∫ x, pd j w x j * p x := by + have hdj' : Integrable (fun x => pd j (fun x => w x j) x * p x) (volume : Measure Space) := by + simpa only [he] using hdj j + simpa only [he] using integral_mul_pd_eq_neg_pd_mul + ((contDiff_pi.mp hw j).differentiable (by simp)) (hp.differentiable (by simp)) j + hdj' ((hw₂ j).integrable_mul (hdp₂ j)) ((hw₂ j).integrable_mul hp₂) + simp only [H, Finset.sum_neg_distrib] + rw [← integral_finsetSum _ (fun j _ => hdj j)] + have hz (x : Space) : (∑ j, pd j w x j * p x) = 0 := by + rw [← Finset.sum_mul, hdiv x, zero_mul] + simp only [hz, integral_zero, neg_zero] + +end BalancedTransport.Analysis +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergyCurve.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergyCurve.lean new file mode 100644 index 0000000000000000000000000000000000000000..31e18b36aa8b05bcd9b01dd76ac70bc86566f583 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergyCurve.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary + +namespace OAI + +noncomputable section +namespace BalancedTransport.Analysis +open MeasureTheory Filter Set +open scoped Topology ENNReal + +def coordinateL2 (i : Fin 3) : + Lp Space 2 (volume : Measure Space) →L[ℝ] Lp ℝ 2 (volume : Measure Space) := + ContinuousLinearMap.compLpL 2 volume (ContinuousLinearMap.proj i) + +lemma coordinateL2_coe (i : Fin 3) (V : Lp Space 2 (volume : Measure Space)) : + (coordinateL2 i V : Space → ℝ) =ᵐ[volume] fun x => (V : Space → Space) x i := + ContinuousLinearMap.coeFn_compLpL _ _ + +lemma coordinateL2_hasDerivWithinAt + {V W : ℝ → Lp Space 2 (volume : Measure Space)} {t : ℝ} {s : Set ℝ} + (h : HasDerivWithinAt V (W t) s t) (i : Fin 3) : + HasDerivWithinAt (fun t => coordinateL2 i (V t)) (coordinateL2 i (W t)) s t := + (coordinateL2 i).hasFDerivAt.comp_hasDerivWithinAt t h + +def l2Energy (V : Lp Space 2 (volume : Measure Space)) : ℝ := + ∑ i : Fin 3, ‖coordinateL2 i V‖ ^ 2 + +def l2EnergyRate (V W : Lp Space 2 (volume : Measure Space)) : ℝ := + 2 * ∑ i : Fin 3, inner ℝ (coordinateL2 i V) (coordinateL2 i W) + +lemma l2Energy_nonneg (V : Lp Space 2 (volume : Measure Space)) : 0 ≤ l2Energy V := + Finset.sum_nonneg (fun _ _ => sq_nonneg _) + +lemma l2Energy_continuous : Continuous l2Energy := by + unfold l2Energy + fun_prop + +lemma l2Energy_hasDerivWithinAt + {V W : ℝ → Lp Space 2 (volume : Measure Space)} {t : ℝ} {s : Set ℝ} + (h : HasDerivWithinAt V (W t) s t) : + HasDerivWithinAt (fun t => l2Energy (V t)) (l2EnergyRate (V t) (W t)) s t := by + simpa only [l2Energy, l2EnergyRate, Finset.mul_sum] using + HasDerivWithinAt.fun_sum (fun (i : Fin 3) (_ : i ∈ Finset.univ) => + (coordinateL2_hasDerivWithinAt h i).norm_sq) + +lemma l2Inner_integral {V W : Lp Space 2 (volume : Measure Space)} + {v w : Space → Space} (hv : (V : Space → Space) =ᵐ[volume] v) + (hw : (W : Space → Space) =ᵐ[volume] w) (i : Fin 3) : + inner ℝ (coordinateL2 i V) (coordinateL2 i W) = ∫ x, v x i * w x i := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [coordinateL2_coe i V, coordinateL2_coe i W, hv, hw] with x hv' hw' hx hy + simp only [hv', hw', hx, hy, RCLike.inner_apply, conj_trivial] + ring + +lemma l2Energy_integral {V : Lp Space 2 (volume : Measure Space)} + {v : Space → Space} (hv : (V : Space → Space) =ᵐ[volume] v) : + l2Energy V = ∑ i : Fin 3, ∫ x, (v x i)^2 := by + unfold l2Energy + apply Finset.sum_congr rfl + intro i _ + rw [← real_inner_self_eq_norm_sq, l2Inner_integral hv hv] + simp only [pow_two] + +lemma l2Energy_eq_zero_of_bound + {V W : ℝ → Lp Space 2 (volume : Measure Space)} + (hV : ContinuousOn V (Ici 0)) + (hderiv : ∀ t, 0 ≤ t → HasDerivWithinAt V (W t) (Ici 0) t) + (hzero : V 0 = 0) {T K : ℝ} (hT : 0 ≤ T) + (hbound : ∀ t ∈ Ico (0 : ℝ) T, l2EnergyRate (V t) (W t) ≤ K * l2Energy (V t)) : + l2Energy (V T) = 0 := by + have hec : ContinuousOn (fun t => l2Energy (V t)) (Icc 0 T) := + l2Energy_continuous.comp_continuousOn (hV.mono (fun _ ht => ht.1)) + have he0 : l2Energy (V 0) ≤ 0 := by simp [hzero, l2Energy] + have he' : ∀ x ∈ Ico (0 : ℝ) T, ∀ r : ℝ, l2EnergyRate (V x) (W x) < r → + ∃ᶠ z in 𝓝[>] x, (z-x)⁻¹ * (l2Energy (V z) - l2Energy (V x)) < r := by + intro x hx r hr + have hh : HasDerivWithinAt (fun t => l2Energy (V t)) + (l2EnergyRate (V x) (W x)) (Ici x) x := + (l2Energy_hasDerivWithinAt (hderiv x hx.1)).mono (Ici_subset_Ici.mpr hx.1) + simpa only [slope_def_field, vsub_eq_sub, smul_eq_mul, div_eq_mul_inv, mul_comm] using hh.liminf_right_slope_le hr + have H := le_gronwallBound_of_liminf_deriv_right_le (K := K) (ε := 0) hec he' he0 + (fun t ht => by simpa only [add_zero] using hbound t ht) T ⟨hT, le_rfl⟩ + rw [gronwallBound_ε0_δ0] at H + exact le_antisymm H (l2Energy_nonneg _) + +lemma l2Energy_zero_pointwise {V : Lp Space 2 (volume : Measure Space)} + {v : Space → Space} (hv : (V : Space → Space) =ᵐ[volume] v) (hc : Continuous v) + (he : l2Energy V = 0) : v = 0 := by + have hz (i : Fin 3) : coordinateL2 i V = 0 := by + have hi := (Finset.sum_eq_zero_iff_of_nonneg (fun j (_ : j ∈ Finset.univ) => + sq_nonneg ‖coordinateL2 j V‖)).mp he i (Finset.mem_univ _) + exact norm_eq_zero.mp (sq_eq_zero_iff.mp hi) + ext x i + have hae : (fun x => v x i) =ᵐ[volume] (0 : Space → ℝ) := by + filter_upwards [coordinateL2_coe i V, hv, Lp.coeFn_zero ℝ 2 (volume : Measure Space)] with x h₁ h₂ h₃ + rw [hz, h₃, h₂] at h₁ + exact h₁.symm + have hi := ((Continuous.ae_eq_iff_eq volume ((continuous_apply i).comp hc) continuous_const).mp hae) + exact congrFun hi x + +end BalancedTransport.Analysis +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergySlice.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergySlice.lean new file mode 100644 index 0000000000000000000000000000000000000000..437332115cb59502ed7f14a143750982c5f70957 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/EnergySlice.lean @@ -0,0 +1,180 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Energy + +namespace OAI + +noncomputable section +namespace BalancedTransport.Analysis +open MeasureTheory Filter Set +open scoped Topology ENNReal +open BalancedTransport.Geometry + +structure SliceH2 (w : Space → Space) : Prop where + smooth : ContDiff ℝ (⊤ : ℕ∞) w + l2 : ∀ i, MemLp (fun x => w x i) 2 (volume : Measure Space) + d_l2 : ∀ i j, MemLp (fun x => pd j w x i) 2 (volume : Measure Space) + dd_l2 : ∀ i j, MemLp (fun x => pd j (pd j w) x i) 2 (volume : Measure Space) + +lemma sliceH2_of_CH {u : Velocity} (hu : Smooth u) (hH : CH 2 u) {t : ℝ} (ht : 0 ≤ t) : + SliceH2 (u t) := by + have hs := Smooth.slice hu ht + exact ⟨hs, fun i => membrane_component (CH.memLp hH [] (by simp) ht) hs.continuous i, + fun i j => membrane_component (CH.memLp hH [j] (by simp) ht) (pd_contDiff j hs).continuous i, + fun i j => membrane_component (CH.memLp hH [j,j] (by simp) ht) + (pd_contDiff j (pd_contDiff j hs)).continuous i⟩ + +lemma SliceH2.sub {u v : Space → Space} (hu : SliceH2 u) (hv : SliceH2 v) : + SliceH2 (fun x => u x - v x) := by + have he (j : Fin 3) : pd j (fun x => u x - v x) = fun x => pd j u x - pd j v x := by + ext x i + rw [pd_sub _ (hu.smooth.differentiable (by simp) x) (hv.smooth.differentiable (by simp) x)] + refine ⟨hu.smooth.sub hv.smooth, fun i => (hu.l2 i).sub (hv.l2 i), ?_, ?_⟩ + · intro i j + rw [he] + exact (hu.d_l2 i j).sub (hv.d_l2 i j) + · intro i j + rw [he] + have hh : pd j (fun x => pd j u x - pd j v x) = + fun x => pd j (pd j u) x - pd j (pd j v) x := + funext (fun x => pd_sub j ((pd_contDiff j hu.smooth).differentiable (by simp) x) + ((pd_contDiff j hv.smooth).differentiable (by simp) x)) + rw [hh] + exact (hu.dd_l2 i j).sub (hv.dd_l2 i j) + +lemma SliceH2.scalar_d {w : Space → Space} (hw : SliceH2 w) (i j : Fin 3) : + MemLp (pd j (fun x => w x i)) 2 (volume : Measure Space) := by + have he : pd j (fun x => w x i) = fun x => pd j w x i := + funext (fun x => pd_apply j i (hw.smooth.differentiable (by simp) x)) + rw [he] + exact hw.d_l2 i j + +lemma SliceH2.scalar_dd {w : Space → Space} (hw : SliceH2 w) (i j : Fin 3) : + MemLp (pd j (pd j (fun x => w x i))) 2 (volume : Measure Space) := by + have he : pd j (fun x => w x i) = fun x => pd j w x i := + funext (fun x => pd_apply j i (hw.smooth.differentiable (by simp) x)) + have he' : pd j (fun x => pd j w x i) = fun x => pd j (pd j w) x i := + funext (fun x => pd_apply j i ((pd_contDiff j hw.smooth).differentiable (by simp) x)) + rw [he, he'] + exact hw.dd_l2 i j + +lemma minus_triple_bound {a x y C : ℝ} (ha : |a| ≤ C) (hC : 0 ≤ C) : + -(a*x*y) ≤ C*(x^2+y^2) := by + have hxy : |x| * |y| ≤ x^2+y^2 := by + nlinarith [sq_nonneg (|x|-|y|), sq_abs x, sq_abs y, sq_nonneg x, sq_nonneg y] + calc + -(a*x*y) ≤ |a*x*y| := neg_le_abs _ + _ = |a| * (|x| * |y|) := by rw [abs_mul, abs_mul]; ring + _ ≤ C * (|x| * |y|) := mul_le_mul_of_nonneg_right ha (mul_nonneg (abs_nonneg _) (abs_nonneg _)) + _ ≤ C*(x^2+y^2) := mul_le_mul_of_nonneg_left hxy hC + +lemma stretching_bound {a f g : Space → ℝ} {C : ℝ} + (ha : Continuous a) (hb : ∀ x, ‖a x‖ ≤ C) (hC : 0 ≤ C) + (hf : MemLp f 2 (volume : Measure Space)) (hg : MemLp g 2 (volume : Measure Space)) : + -(∫ x, a x * f x * g x) ≤ C * ((∫ x, (f x)^2) + ∫ x, (g x)^2) := by + have hff : Integrable (fun x => (f x)^2) (volume : Measure Space) := by + simpa only [pow_two, Pi.mul_def] using hf.integrable_mul hf + have hgg : Integrable (fun x => (g x)^2) (volume : Measure Space) := by + simpa only [pow_two, Pi.mul_def] using hg.integrable_mul hg + rw [← integral_neg, ← integral_add hff hgg, ← integral_const_mul] + apply integral_mono (integrable_bounded_mul_l2_mul_l2 ha hb hf hg).neg + ((hff.add hgg).const_mul C) + exact fun x => minus_triple_bound (hb x) hC + +theorem energy_pairing_bound + {w a v g : Space → Space} {p : Space → ℝ} {ν C A : ℝ} + (hw : SliceH2 w) (ha : ContDiff ℝ (⊤ : ℕ∞) a) + (hv : ContDiff ℝ (⊤ : ℕ∞) v) (hp : ContDiff ℝ (⊤ : ℕ∞) p) + (hν : 0 ≤ ν) (hC : 0 ≤ C) + (ha_b : ∀ x, ‖a x‖ ≤ A) (ha_d : ∀ x j, ‖pd j a x‖ ≤ A) + (hv_d : ∀ x j, ‖pd j v x‖ ≤ C) + (ha_div : ∀ x, ∑ j, pd j a x j = 0) + (hw_div : ∀ x, ∑ j, pd j w x j = 0) + (hp₂ : MemLp p 2 (volume : Measure Space)) + (hp_d : ∀ j, MemLp (pd j p) 2 (volume : Measure Space)) + (hPDE : ∀ x i, g x i = ν * (∑ j, pd j (pd j w) x i) - + (∑ j, a x j * pd j w x i) - (∑ j, w x j * pd j v x i) - pd i p x) : + (∑ i : Fin 3, ∫ x, w x i * g x i) ≤ + 6 * C * (∑ i : Fin 3, ∫ x, (w x i)^2) := by + let E : Fin 3 → ℝ := fun i => ∫ x, (w x i)^2 + let D : Fin 3 → Fin 3 → ℝ := fun i j => ∫ x, w x i * pd j (pd j w) x i + let T : Fin 3 → Fin 3 → ℝ := fun i j => ∫ x, a x j * pd j w x i * w x i + let S : Fin 3 → Fin 3 → ℝ := fun i j => ∫ x, pd j v x i * w x j * w x i + let P : Fin 3 → ℝ := fun i => ∫ x, w x i * pd i p x + have hdcomp (i j : Fin 3) : pd j (fun x => w x i) = fun x => pd j w x i := + funext (fun x => pd_apply j i (hw.smooth.differentiable (by simp) x)) + have hddcomp (i j : Fin 3) : pd j (fun x => pd j w x i) = fun x => pd j (pd j w) x i := + funext (fun x => pd_apply j i ((pd_contDiff j hw.smooth).differentiable (by simp) x)) + have hDe (i j : Fin 3) : D i j = -∫ x, (pd j w x i)^2 := by + simpa only [D, hdcomp, hddcomp] using + diffusion_component (contDiff_pi.mp hw.smooth i) j (hw.l2 i) + (hw.scalar_d i j) (hw.scalar_dd i j) + have hDn (i j : Fin 3) : D i j ≤ 0 := by + rw [hDe] + exact neg_nonpos.mpr (integral_nonneg (fun _ => sq_nonneg _)) + have hTe (i : Fin 3) : ∑ j, T i j = 0 := by + simpa only [T, pd_apply _ i (hw.smooth.differentiable (by simp) _)] using + transport_cancellation ha (contDiff_pi.mp hw.smooth i) ha_b ha_d ha_div (hw.l2 i) + (hw.scalar_d i) + have hPe : ∑ i, P i = 0 := pressure_cancellation hw.smooth hp hw_div hw.l2 + (fun i => hw.d_l2 i i) hp₂ hp_d + have hSb (i j : Fin 3) : -(S i j) ≤ C * (E j + E i) := + stretching_bound ((continuous_apply i).comp (pd_contDiff j hv).continuous) + (fun x => (norm_le_pi_norm (pd j v x) i).trans (hv_d x j)) hC (hw.l2 j) (hw.l2 i) + have hdint (i j : Fin 3) : Integrable (fun x => w x i * pd j (pd j w) x i) + (volume : Measure Space) := (hw.l2 i).integrable_mul (hw.dd_l2 i j) + have htint (i j : Fin 3) : Integrable (fun x => a x j * pd j w x i * w x i) + (volume : Measure Space) := + integrable_bounded_mul_l2_mul_l2 ((continuous_apply j).comp ha.continuous) + (fun x => (norm_le_pi_norm (a x) j).trans (ha_b x)) (hw.d_l2 i j) (hw.l2 i) + have hsint (i j : Fin 3) : Integrable (fun x => pd j v x i * w x j * w x i) + (volume : Measure Space) := + integrable_bounded_mul_l2_mul_l2 ((continuous_apply i).comp (pd_contDiff j hv).continuous) + (fun x => (norm_le_pi_norm (pd j v x) i).trans (hv_d x j)) (hw.l2 j) (hw.l2 i) + have hpint (i : Fin 3) : Integrable (fun x => w x i * pd i p x) + (volume : Measure Space) := (hw.l2 i).integrable_mul (hp_d i) + have he (i : Fin 3) : (∫ x, w x i * g x i) = + ν * (∑ j, D i j) - (∑ j, T i j) - (∑ j, S i j) - P i := by + have hfun : (fun x => w x i * g x i) = fun x => + ν * (∑ j, w x i * pd j (pd j w) x i) - + (∑ j, a x j * pd j w x i * w x i) - + (∑ j, pd j v x i * w x j * w x i) - w x i * pd i p x := by + ext x + rw [hPDE] + simp only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] + ring + have hdI : Integrable (fun x => ν * ∑ j, w x i * pd j (pd j w) x i) + (volume : Measure Space) := + (integrable_finsetSum Finset.univ (fun j _ => hdint i j)).const_mul ν + have htI : Integrable (fun x => ∑ j, a x j * pd j w x i * w x i) + (volume : Measure Space) := integrable_finsetSum Finset.univ (fun j _ => htint i j) + have hsI : Integrable (fun x => ∑ j, pd j v x i * w x j * w x i) + (volume : Measure Space) := integrable_finsetSum Finset.univ (fun j _ => hsint i j) + have hdtI : Integrable (fun x => ν * (∑ j, w x i * pd j (pd j w) x i) - + ∑ j, a x j * pd j w x i * w x i) (volume : Measure Space) := hdI.sub htI + have hdtsI : Integrable (fun x => ν * (∑ j, w x i * pd j (pd j w) x i) - + (∑ j, a x j * pd j w x i * w x i) - ∑ j, pd j v x i * w x j * w x i) + (volume : Measure Space) := hdtI.sub hsI + rw [hfun, integral_sub hdtsI (hpint i), integral_sub hdtI hsI, integral_sub hdI htI] + rw [integral_const_mul, + integral_finsetSum _ (fun j _ => hdint i j), + integral_finsetSum _ (fun j _ => htint i j), + integral_finsetSum _ (fun j _ => hsint i j)] + + simp only [he, hTe, sub_zero, Finset.sum_sub_distrib, hPe, sub_zero] + have hdiff : ∑ i, ν * (∑ j, D i j) ≤ 0 := + Finset.sum_nonpos (fun i _ => mul_nonpos_of_nonneg_of_nonpos hν + (Finset.sum_nonpos (fun j _ => hDn i j))) + have hstr := Finset.sum_le_sum (fun (i : Fin 3) (_ : i ∈ Finset.univ) => + Finset.sum_le_sum (fun (j : Fin 3) (_ : j ∈ Finset.univ) => hSb i j)) + have hdouble : (∑ i : Fin 3, ∑ j : Fin 3, C * (E j + E i)) = 6*C*(∑ i, E i) := by + simp only [mul_add, Finset.sum_add_distrib, ← Finset.mul_sum, Finset.sum_const, + Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + ring + rw [hdouble] at hstr + simp only [Finset.sum_neg_distrib] at hstr + change _ ≤ 6*C*(∑ i, E i) + linarith + +end BalancedTransport.Analysis +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FieldBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FieldBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ed121fff5a421b575a6b5123e4c2a2c4c62a90c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FieldBounds.lean @@ -0,0 +1,152 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.TimeRegularity + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def fullMixedD : MultiIndex → Field F → Field F + | [], v => v + | none :: a, v => fullTimeD (fullMixedD a v) + | some i :: a, v => spaceD i (fullMixedD a v) + +lemma JointSmooth.fullMixedD {v : Field F} (hv : JointSmooth v) (a : MultiIndex) : + JointSmooth (fullMixedD a v) := by + induction a with + | nil => exact hv + | cons i a ha => + cases i with + | none => exact ha.fullTimeD + | some i => exact ha.spaceD i + +lemma JointSmooth.timeSlice {v : Field F} (hv : JointSmooth v) (x : Space) : + ContDiff ℝ (⊤ : ℕ∞) (fun t => v t x) := hv.comp (contDiff_id.prodMk contDiff_const) + +lemma fullMixedD_eq_mixedD {v : Field F} (hv : JointSmooth v) (a : MultiIndex) + (t : ℝ) (ht : 0 ≤ t) (x : Space) : fullMixedD a v t x = mixedD a v t x := by + induction a generalizing t x with + | nil => rfl + | cons i a ha => + cases i with + | none => + change deriv (fun s => fullMixedD a v s x) t = + derivWithin (fun s => mixedD a v s x) (Ici 0) t + rw [← derivWithin_congr (s := Ici (0 : ℝ)) (fun s hs => ha s hs x) (ha t ht x)] + exact (((hv.fullMixedD a).timeSlice x).differentiable (by simp) t).derivWithin + (uniqueDiffOn_Ici 0 t ht) |>.symm + | some i => + change fderiv ℝ (fullMixedD a v t) x _ = fderiv ℝ (mixedD a v t) x _ + rw [show fullMixedD a v t = mixedD a v t from funext (ha t ht)] + +def SpatiallySupported (K : Set Space) (v : Field F) : Prop := + ∀ t x, x ∉ K → v t x = 0 + +lemma SpatiallySupported.fullTimeD {K : Set Space} {v : Field F} + (h : SpatiallySupported K v) : SpatiallySupported K (fullTimeD v) := by + intro t x hx + have he : (fun s => v s x) = fun _ => (0 : F) := funext (fun s => h s x hx) + change deriv (fun s => v s x) t = 0 + rw [he] + exact deriv_const t (0 : F) + +lemma SpatiallySupported.spaceD {K : Set Space} {v : Field F} + (h : SpatiallySupported K v) (hK : IsClosed K) (i : Fin 3) : + SpatiallySupported K (spaceD i v) := by + intro t x hx + have he : v t =ᶠ[𝓝 x] 0 := by + filter_upwards [hK.isOpen_compl.mem_nhds hx] with y hy + exact h t y hy + change fderiv ℝ (v t) x (Pi.single i 1) = 0 + rw [he.fderiv_eq] + simp + +lemma SpatiallySupported.fullMixedD {K : Set Space} {v : Field F} + (h : SpatiallySupported K v) (hK : IsClosed K) (a : MultiIndex) : + SpatiallySupported K (fullMixedD a v) := by + induction a with + | nil => exact h + | cons i a ha => + cases i with + | none => exact ha.fullTimeD + | some i => exact ha.spaceD hK i + +def RepeatsAfter (T : ℝ) (v : Field F) : Prop := + ∀ t, T ≤ t → v (t + 1) = v t + +lemma RepeatsAfter.spaceD {T : ℝ} {v : Field F} (h : RepeatsAfter T v) (i : Fin 3) : + RepeatsAfter T (spaceD i v) := by + intro t ht + funext x + change fderiv ℝ (v (t + 1)) x (Pi.single i 1) = fderiv ℝ (v t) x (Pi.single i 1) + rw [h t ht] + +lemma RepeatsAfter.fullTimeD {T : ℝ} {v : Field F} (h : RepeatsAfter T v) + (hv : JointSmooth v) : RepeatsAfter T (fullTimeD v) := by + intro t ht + funext x + have hh := (hv.timeSlice x).differentiable (by simp) + have hs : DifferentiableAt ℝ (fun s => v (s + 1) x) t := + (hh (t + 1)).comp t (differentiableAt_id.add_const 1) + have he : EqOn (fun s => v (s + 1) x) (fun s => v s x) (Ici T) := + fun s hs => congrFun (h s hs) x + change deriv (fun s => v s x) (t + 1) = deriv (fun s => v s x) t + rw [← deriv_comp_add_const (fun s => v s x) 1 t, + ← hs.derivWithin (uniqueDiffOn_Ici T t ht), + derivWithin_congr he (he ht), + (hh t).derivWithin (uniqueDiffOn_Ici T t ht)] + +lemma RepeatsAfter.fullMixedD {T : ℝ} {v : Field F} (h : RepeatsAfter T v) + (hv : JointSmooth v) (a : MultiIndex) : RepeatsAfter T (fullMixedD a v) := by + induction a with + | nil => exact h + | cons i a ha => + cases i with + | none => exact ha.fullTimeD (hv.fullMixedD a) + | some i => exact ha.spaceD i + +omit [NormedAddCommGroup F] [NormedSpace ℝ F] in +lemma RepeatsAfter.add_nat {T : ℝ} {v : Field F} (h : RepeatsAfter T v) + {t : ℝ} (ht : T ≤ t) (n : ℕ) : v (t + n) = v t := by + induction n with + | zero => simp + | succ n ih => + rw [Nat.cast_add, Nat.cast_one, ← add_assoc, h _ (by linarith [Nat.cast_nonneg (α := ℝ) n]), ih] + +omit [NormedAddCommGroup F] [NormedSpace ℝ F] in +lemma RepeatsAfter.reduce {v : Field F} (h : RepeatsAfter 1 v) {t : ℝ} (ht : 0 ≤ t) : + ∃ s ∈ Icc (0 : ℝ) 2, v t = v s := by + by_cases ht' : t ≤ 2 + · exact ⟨t, ⟨ht, ht'⟩, rfl⟩ + · have htn : 0 ≤ t - 1 := by linarith + let n := ⌊t - 1⌋₊ + have hle : (n : ℝ) ≤ t - 1 := Nat.floor_le htn + have hlt : t - 1 < (n : ℝ) + 1 := Nat.lt_floor_add_one (t - 1) + refine ⟨t - n, ⟨by linarith, by linarith⟩, ?_⟩ + have he := h.add_nat (t := t - n) (by linarith) n + simpa using he + +theorem boundedMixed_of_compact_repeating {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) + (hp : RepeatsAfter 1 v) : BoundedMixed v := by + intro a + have ha := hv.fullMixedD a + have hsa := hs.fullMixedD hK.isClosed a + have hpa := hp.fullMixedD hv a + obtain ⟨C, hC⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn + ha.continuous.continuousOn + refine ⟨max C 0, le_max_right _ _, fun t ht x => ?_⟩ + rw [← fullMixedD_eq_mixedD hv a t ht x] + obtain ⟨s, hs, he⟩ := hpa.reduce ht + rw [congrFun he x] + by_cases hx : x ∈ K + · exact (hC (s, x) ⟨hs,hx⟩).trans (le_max_left _ _) + · rw [hsa s x hx, norm_zero] + exact le_max_right _ _ + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FiniteSimulator.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FiniteSimulator.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d4f7783f2068e81ef32ff17ca94aeca505fcc33 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FiniteSimulator.lean @@ -0,0 +1,159 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MachineRecursion + +namespace OAI + +noncomputable section +namespace BalancedTransport.Universal +open Turing StateTransition +open scoped Classical +variable {α : Type*} [Fintype α] + +def finiteIndex (a : α) : Fin (Fintype.card α + 1) := (Fintype.equivFin α a).castSucc + +def finiteUnindex (a₀ : α) (i : Fin (Fintype.card α + 1)) : α := + if h : i.val < Fintype.card α then (Fintype.equivFin α).symm ⟨i.val,h⟩ else a₀ + +@[simp] lemma finiteUnindex_index (a₀ a : α) : finiteUnindex a₀ (finiteIndex a) = a := by + simp [finiteUnindex, finiteIndex] + +lemma finiteIndex_injective : Function.Injective (finiteIndex (α := α)) := + fun a b h => by simpa using congrArg (finiteUnindex a) h + +end BalancedTransport.Universal +end + +noncomputable section +namespace BalancedTransport.Universal +open Turing StateTransition +open scoped Classical +variable {Γ Λ : Type*} [Fintype Γ] [Inhabited Γ] [Inhabited Λ] +variable (P : TM0.Machine Γ Λ) (S : Finset Λ) (ss : TM0.Supports P S) + +def stateIndex (q : Λ) : Fin (Fintype.card {q : Λ // q ∈ S} + 1) := + finiteIndex (if h : q ∈ S then (⟨q,h⟩ : {q : Λ // q ∈ S}) else ⟨default,ss.1⟩) + +omit [Fintype Γ] [Inhabited Γ] in +lemma stateIndex_decode {q : Λ} (hq : q ∈ S) : + (finiteUnindex ⟨default,ss.1⟩ (stateIndex P S ss q) : {q : Λ // q ∈ S}).val = q := by + simp [stateIndex, hq] + +def postInstruction (a : Fin (Fintype.card Γ + 1)) (v : Λ × TM0.Stmt Γ) : + Recorder.Transition (Fin (Fintype.card {q : Λ // q ∈ S} + 1)) (Fin (Fintype.card Γ + 1)) := + ⟨stateIndex P S ss v.1, + (match v.2 with | .write b => finiteIndex b | .move _ => a), + (match v.2 with | .write _ => .stay | .move .left => .left | .move .right => .right)⟩ + +abbrev finitePostMachine : FiniteMachine where + states := Fintype.card {q : Λ // q ∈ S} + symbols := Fintype.card Γ + initial := stateIndex P S ss default + blank := finiteIndex (default : Γ) + transition q a := (P (finiteUnindex ⟨default,ss.1⟩ q : {q : Λ // q ∈ S}).val (finiteUnindex default a)).map + (postInstruction P S ss a) + +lemma finitePostMachine_instruction (q : Λ) (hq : q ∈ S) (a : Γ) : + (finitePostMachine P S ss).transition (stateIndex P S ss q) (finiteIndex a) = + (P q a).map (postInstruction P S ss (finiteIndex a)) := by + simp [finitePostMachine, stateIndex_decode P S ss hq] + +def PostRel (c : TM0.Cfg Γ Λ) (d : TapeConfiguration (finitePostMachine P S ss)) : Prop := + c.q ∈ S ∧ d.state = stateIndex P S ss c.q ∧ + ∀ i : ℤ, d.tape (d.head + i) = finiteIndex (c.Tape.nth i) + +lemma post_initial_rel (w : List Γ) : PostRel P S ss (TM0.init w) + (initialConfiguration (finitePostMachine P S ss) (w.map finiteIndex)) := by + refine ⟨ss.1, rfl, ?_⟩ + intro i + simp only [initialConfiguration, zero_add, TM0.init, Tape.mk₁, Tape.mk₂] + by_cases hi : 0 ≤ i + · rw [ite_eq_left hi, ← Int.toNat_of_nonneg hi] + simp only [Tape.mk'_nth_nat, ListBlank.nth_mk, List.getI_eq_getElem?_getD, + List.getElem?_map, Int.toNat_natCast] + cases w[i.toNat]? <;> rfl + · have hi' : i < 0 := lt_of_not_ge hi + rw [ite_eq_right hi] + cases i with + | ofNat n => exact False.elim (not_lt_of_ge (Int.natCast_nonneg _) hi') + | negSucc n => + change finiteIndex (default : Γ) = finiteIndex ((ListBlank.mk []).nth n) + rw [ListBlank.nth_mk] + rfl + +lemma post_tape_head {c : TM0.Cfg Γ Λ} {d : TapeConfiguration (finitePostMachine P S ss)} + (h : PostRel P S ss c d) : d.tape d.head = finiteIndex c.Tape.head := by + simpa using h.2.2 0 + +lemma post_step (c : TM0.Cfg Γ Λ) (d : TapeConfiguration (finitePostMachine P S ss)) + (h : PostRel P S ss c d) : + match TM0.step P c with + | none => machineStep (finitePostMachine P S ss) d = none + | some c' => ∃ d', machineStep (finitePostMachine P S ss) d = some d' ∧ PostRel P S ss c' d' := by + have ht : (finitePostMachine P S ss).transition d.state (d.tape d.head) = + (P c.q c.Tape.head).map (postInstruction P S ss (finiteIndex c.Tape.head)) := by + rw [h.2.1, post_tape_head P S ss h, finitePostMachine_instruction P S ss _ h.1] + unfold machineStep + rw [ht] + simp only [TM0.step] + cases hp : P c.q c.Tape.head with + | none => rfl + | some v => + rcases v with ⟨q', act⟩ + have hq' : q' ∈ S := ss.2 hp h.1 + cases act with + | write b => + simp only [Option.map_some, postInstruction] + refine ⟨_,rfl,hq',rfl,?_⟩ + intro i + change Function.update d.tape d.head (finiteIndex b) (d.head + 0 + i) = + finiteIndex ((c.Tape.write b).nth i) + simp only [Int.add_zero, Tape.write_nth] + by_cases hi : i = 0 + · subst i; simp + · have hi' : d.head + i ≠ d.head := by omega + rw [ite_eq_right hi, Function.update_of_ne hi'] + exact h.2.2 i + | move dir => + have hu : Function.update d.tape d.head (finiteIndex c.Tape.head) = d.tape := by + rw [← post_tape_head P S ss h, Function.update_eq_self] + cases dir with + | left => + simp only [Option.map_some, postInstruction] + refine ⟨_,rfl,hq',rfl,?_⟩ + intro i + change Function.update d.tape d.head (finiteIndex c.Tape.head) (d.head + (-1) + i) = + finiteIndex ((c.Tape.move .left).nth i) + rw [hu, Tape.move_left_nth] + convert h.2.2 (i-1) using 1 + congr 1 + ring + | right => + simp only [Option.map_some, postInstruction] + refine ⟨_,rfl,hq',rfl,?_⟩ + intro i + change Function.update d.tape d.head (finiteIndex c.Tape.head) (d.head + 1 + i) = + finiteIndex ((c.Tape.move .right).nth i) + rw [hu, Tape.move_right_nth] + convert h.2.2 (i+1) using 1 + congr 1 + ring + +lemma post_respects : StateTransition.Respects (TM0.step P) (machineStep (finitePostMachine P S ss)) + (PostRel P S ss) := by + intro c d hr + have h := post_step P S ss c d hr + cases he : TM0.step P c with + | none => simpa [he] using h + | some c' => + simp only [he] at h + obtain ⟨d',hd,hr'⟩ := h + exact ⟨d',hr',Relation.TransGen.single hd⟩ + +lemma halts_finitePostMachine (w : List Γ) : + Halts (finitePostMachine P S ss) (w.map finiteIndex) ↔ (TM0.eval P w).Dom := by + exact (halts_iff_eval_dom _ _).trans + (StateTransition.tr_eval_dom (post_respects P S ss) (post_initial_rel P S ss w)) + +end BalancedTransport.Universal +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FlatBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FlatBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..149014c2748ccd1e05d57279e0b0a7c73dbbd35f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/FlatBounds.lean @@ -0,0 +1,214 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Polynomial + +def rhoPolynomial : ℕ → Polynomial ℤ + | 0 => 1 + | n + 1 => X ^ 2 * (rhoPolynomial n - (rhoPolynomial n).derivative) + +def rhoWeight (p : Polynomial ℤ) (k : ℕ) : ℕ := + ∑ j ∈ p.support, (p.coeff j).natAbs * (j + k).factorial + +def rhoJet (n : ℕ) (x : ℝ) : ℝ := + (rhoPolynomial n).eval₂ (Int.castRingHom ℝ) x⁻¹ * expNegInvGlue x + +lemma rhoJet_zero (x : ℝ) : rhoJet 0 x = expNegInvGlue x := by + simp [rhoJet, rhoPolynomial] + +lemma rhoJet_hasDerivAt (n : ℕ) (x : ℝ) : + HasDerivAt (rhoJet n) (rhoJet (n + 1) x) x := by + unfold rhoJet + have h := expNegInvGlue.hasDerivAt_polynomial_eval_inv_mul + ((rhoPolynomial n).map (Int.castRingHom ℝ)) x + simpa [rhoJet, rhoPolynomial, ← Polynomial.eval₂_eq_eval_map, + Polynomial.derivative_map] using h + +lemma rhoJet_contDiff (n : ℕ) : ContDiff ℝ (⊤ : ℕ∞) (rhoJet n) := by + unfold rhoJet + simpa only [← Polynomial.eval₂_eq_eval_map] using + (expNegInvGlue.contDiff_polynomial_eval_inv_mul + ((rhoPolynomial n).map (Int.castRingHom ℝ)) (n := (⊤ : ℕ∞))) + +lemma rhoJet_eq_iteratedDeriv (n : ℕ) : rhoJet n = iteratedDeriv n expNegInvGlue := by + induction n with + | zero => exact funext rhoJet_zero + | succ n ih => + rw [iteratedDeriv_succ, ← ih] + exact funext (fun x => (rhoJet_hasDerivAt n x).deriv.symm) + +lemma rhoJet_zero_of_nonpos (n : ℕ) {x : ℝ} (hx : x ≤ 0) : rhoJet n x = 0 := by + simp [rhoJet, expNegInvGlue.zero_of_nonpos hx] + +lemma inv_pow_mul_rho_le {x : ℝ} (hx : 0 < x) (j k : ℕ) : + x⁻¹ ^ j * expNegInvGlue x ≤ ((j + k).factorial : ℝ) * x ^ k := by + have hf : (0 : ℝ) < (j + k).factorial := by positivity + have he := Real.pow_div_factorial_le_exp x⁻¹ (inv_nonneg.mpr hx.le) (j + k) + have hdiv : x⁻¹ ^ (j + k) / Real.exp x⁻¹ ≤ ((j + k).factorial : ℝ) := by + apply (div_le_iff₀ (Real.exp_pos _)).mpr + simpa [mul_comm] using (div_le_iff₀ hf).mp he + have hid : x⁻¹ ^ j * expNegInvGlue x = + (x⁻¹ ^ (j + k) / Real.exp x⁻¹) * x ^ k := by + rw [expNegInvGlue, ite_eq_right hx.not_ge, Real.exp_neg, pow_add] + field_simp + simp [inv_mul_cancel₀ (pow_ne_zero k hx.ne')] + rw [hid] + exact mul_le_mul_of_nonneg_right hdiv (pow_nonneg hx.le _) + +lemma polynomial_rho_seam_bound (p : Polynomial ℤ) (k : ℕ) {x : ℝ} (hx : 0 < x) : + |p.eval₂ (Int.castRingHom ℝ) x⁻¹ * expNegInvGlue x| ≤ + (rhoWeight p k : ℝ) * x ^ k := by + rw [Polynomial.eval₂_eq_sum, Polynomial.sum_def, Finset.sum_mul] + calc + |∑ j ∈ p.support, (Int.castRingHom ℝ) (p.coeff j) * x⁻¹ ^ j * expNegInvGlue x| ≤ + ∑ j ∈ p.support, |(Int.castRingHom ℝ) (p.coeff j) * x⁻¹ ^ j * expNegInvGlue x| := + Finset.abs_sum_le_sum_abs _ _ + _ = ∑ j ∈ p.support, ((p.coeff j).natAbs : ℝ) * (x⁻¹ ^ j * expNegInvGlue x) := by + apply Finset.sum_congr rfl + intro j _ + simp [abs_mul, abs_of_pos hx, + abs_of_nonneg (expNegInvGlue.nonneg x), mul_assoc] + _ ≤ ∑ j ∈ p.support, ((p.coeff j).natAbs : ℝ) * + (((j + k).factorial : ℝ) * x ^ k) := by + apply Finset.sum_le_sum + intro j _ + exact mul_le_mul_of_nonneg_left (inv_pow_mul_rho_le hx j k) (Nat.cast_nonneg _) + _ = (rhoWeight p k : ℝ) * x ^ k := by + simp [rhoWeight, Nat.cast_sum, Nat.cast_mul, Finset.sum_mul, mul_assoc] + +lemma rhoJet_bound (n : ℕ) (x : ℝ) : |rhoJet n x| ≤ (rhoWeight (rhoPolynomial n) 0 : ℝ) := by + by_cases hx : 0 < x + · simpa [rhoJet] using polynomial_rho_seam_bound (rhoPolynomial n) 0 hx + · rw [rhoJet_zero_of_nonpos n (le_of_not_gt hx), abs_zero] + exact Nat.cast_nonneg _ + +lemma rhoJet_seam_bound (n k : ℕ) {x ε : ℝ} (hε : 0 ≤ ε) (hx : x ≤ ε) : + |rhoJet n x| ≤ (rhoWeight (rhoPolynomial n) k : ℝ) * ε ^ k := by + by_cases hxpos : 0 < x + · exact (polynomial_rho_seam_bound (rhoPolynomial n) k hxpos).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hxpos.le hx _) (Nat.cast_nonneg _)) + · rw [rhoJet_zero_of_nonpos n (le_of_not_gt hxpos), abs_zero] + positivity + +lemma transition_denom_lower (x : ℝ) : + 1 / 9 ≤ expNegInvGlue x + expNegInvGlue (1 - x) := by + have hb : (1 / 9 : ℝ) ≤ expNegInvGlue (1 / 2) := by + have he : Real.exp (2 : ℝ) < 9 := by + have hh := Real.exp_one_lt_three + have hp := Real.exp_pos 1 + rw [show (2 : ℝ) = 1 + 1 by norm_num, Real.exp_add] + nlinarith + norm_num [expNegInvGlue, Real.exp_neg] + rw [← one_div] + apply (le_div_iff₀ (Real.exp_pos (2 : ℝ))).mpr + linarith + by_cases hx : 1 / 2 ≤ x + · exact hb.trans ((expNegInvGlue.monotone hx).trans + (le_add_of_nonneg_right (expNegInvGlue.nonneg _))) + · have hh : 1 / 2 ≤ 1 - x := by linarith + exact hb.trans ((expNegInvGlue.monotone hh).trans + (le_add_of_nonneg_left (expNegInvGlue.nonneg _))) + +def transitionWeight : ℕ → ℕ + | 0 => 1 + | n + 1 => 9 * (rhoWeight (rhoPolynomial (n + 1)) 0 + + ∑ i : Fin (n + 1), + (n + 1).choose i * transitionWeight i * + (2 * rhoWeight (rhoPolynomial (n + 1 - i)) 0)) +termination_by n => n +decreasing_by exact i.isLt + +def transitionDenom (x : ℝ) : ℝ := expNegInvGlue x + expNegInvGlue (1 - x) + +lemma transitionDenom_contDiff : ContDiff ℝ (⊤ : ℕ∞) transitionDenom := by + unfold transitionDenom + fun_prop + +lemma transitionDenom_jet_bound (n : ℕ) (x : ℝ) : + |iteratedDeriv n transitionDenom x| ≤ (2 * rhoWeight (rhoPolynomial n) 0 : ℕ) := by + have ha : ContDiffAt ℝ n expNegInvGlue x := expNegInvGlue.contDiff.contDiffAt + have hb : ContDiffAt ℝ n (fun x : ℝ => expNegInvGlue (1 - x)) x := by fun_prop + unfold transitionDenom + rw [iteratedDeriv_fun_add ha hb, iteratedDeriv_comp_const_sub] + calc + |iteratedDeriv n expNegInvGlue x + (-1 : ℝ) ^ n • iteratedDeriv n expNegInvGlue (1 - x)| ≤ + |iteratedDeriv n expNegInvGlue x| + + |(-1 : ℝ) ^ n • iteratedDeriv n expNegInvGlue (1 - x)| := abs_add_le _ _ + _ = |rhoJet n x| + |rhoJet n (1 - x)| := by + simp [← rhoJet_eq_iteratedDeriv, smul_eq_mul, abs_mul, abs_pow] + _ ≤ (2 * rhoWeight (rhoPolynomial n) 0 : ℕ) := by + have h₁ := rhoJet_bound n x + have h₂ := rhoJet_bound n (1 - x) + push_cast + linarith + +lemma transition_mul_denom : Real.smoothTransition * transitionDenom = expNegInvGlue := by + funext x + exact div_mul_cancel₀ _ (Real.smoothTransition.pos_denom x).ne' + +lemma transition_jet_bound (n : ℕ) (x : ℝ) : + |iteratedDeriv n Real.smoothTransition x| ≤ (transitionWeight n : ℝ) := by + induction n using Nat.strong_induction_on with + | h n ih => + cases n with + | zero => + simp only [iteratedDeriv_zero, transitionWeight] + rw [abs_of_nonneg (Real.smoothTransition.nonneg x)] + simpa using Real.smoothTransition.le_one x + | succ n => + have hs : ContDiffAt ℝ (n + 1) Real.smoothTransition x := + Real.smoothTransition.contDiffAt + have hd : ContDiffAt ℝ (n + 1) transitionDenom x := + transitionDenom_contDiff.contDiffAt.of_le + (WithTop.coe_le_coe.mpr (show (↑(n + 1) : ℕ∞) ≤ ⊤ from le_top)) + have hL := iteratedDeriv_mul hs hd + rw [transition_mul_denom, Finset.sum_range_succ] at hL + simp only [Nat.choose_self, Nat.cast_one, one_mul, Nat.sub_self, + iteratedDeriv_zero] at hL + let S : ℝ := ∑ i ∈ Finset.range (n + 1), + (n + 1).choose i * iteratedDeriv i Real.smoothTransition x * + iteratedDeriv (n + 1 - i) transitionDenom x + let Q : ℕ := ∑ i ∈ Finset.range (n + 1), + (n + 1).choose i * transitionWeight i * + (2 * rhoWeight (rhoPolynomial (n + 1 - i)) 0) + have hS : |S| ≤ (Q : ℝ) := by + refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ + dsimp only [Q] + push_cast + apply Finset.sum_le_sum + intro i hi + rw [abs_mul, abs_mul, abs_of_nonneg (Nat.cast_nonneg _)] + apply mul_le_mul + · exact mul_le_mul_of_nonneg_left (ih i (Finset.mem_range.mp hi)) (Nat.cast_nonneg _) + · simpa using transitionDenom_jet_bound (n + 1 - i) x + · exact abs_nonneg _ + · positivity + have he : iteratedDeriv (n + 1) Real.smoothTransition x * transitionDenom x = + rhoJet (n + 1) x - S := by + rw [rhoJet_eq_iteratedDeriv] + linarith [hL] + have hden := transition_denom_lower x + change 1 / 9 ≤ transitionDenom x at hden + have hp : 0 < transitionDenom x := by linarith + have hbound : |iteratedDeriv (n + 1) Real.smoothTransition x| * transitionDenom x ≤ + (rhoWeight (rhoPolynomial (n + 1)) 0 : ℝ) + (Q : ℝ) := by + rw [← abs_of_pos hp, ← abs_mul, he] + exact (abs_sub _ _).trans (add_le_add (rhoJet_bound _ _) hS) + have habs := abs_nonneg (iteratedDeriv (n + 1) Real.smoothTransition x) + have hprod := mul_le_mul_of_nonneg_left hden habs + rw [transitionWeight, show (∑ i : Fin (n + 1), + (n + 1).choose i * transitionWeight i * + (2 * rhoWeight (rhoPolynomial (n + 1 - i)) 0)) = Q from + Fin.sum_univ_eq_sum_range (fun i : ℕ => (n + 1).choose i * transitionWeight i * + (2 * rhoWeight (rhoPolynomial (n + 1 - i)) 0)) (n + 1)] + push_cast + change _ ≤ 9 * ((rhoWeight (rhoPolynomial (n + 1)) 0 : ℝ) + (Q : ℝ)) + nlinarith + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Loading.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Loading.lean new file mode 100644 index 0000000000000000000000000000000000000000..67d99d9d41507652587f4ab7cb7bce7b95bc0b02 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Loading.lean @@ -0,0 +1,167 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set + +def loadingSwitch (t : ℝ) : ℝ := Real.smoothTransition (2 * t - 1 / 2) + +lemma loadingSwitch_contDiff : ContDiff ℝ (⊤ : ℕ∞) loadingSwitch := by + unfold loadingSwitch + fun_prop + +lemma loadingSwitch_nonneg (t : ℝ) : 0 ≤ loadingSwitch t := + Real.smoothTransition.nonneg _ + +lemma loadingSwitch_le_one (t : ℝ) : loadingSwitch t ≤ 1 := + Real.smoothTransition.le_one _ + +lemma loadingSwitch_zero {t : ℝ} (ht : t ≤ 1 / 4) : loadingSwitch t = 0 := + Real.smoothTransition.zero_of_nonpos (by linarith) + +lemma loadingSwitch_one {t : ℝ} (ht : 3 / 4 ≤ t) : loadingSwitch t = 1 := + Real.smoothTransition.one_of_one_le (by linarith) + +def loadingCenter (z : Space) (t : ℝ) : Space := loadingSwitch t • (z - fixedLabel) + +def loadingVelocity (z : Space) (η : ℝ) : Velocity := + movingBoxVelocity fixedLabel fixedLabel (loadingCenter z) (fun _ => 1) η + +def loadingPath (z : Space) : ℝ → Space := + affinePath (loadingCenter z) (fun _ => 1) fixedLabel + +lemma loadingCenter_contDiff (z : Space) : ContDiff ℝ (⊤ : ℕ∞) (loadingCenter z) := + loadingSwitch_contDiff.smul contDiff_const + +lemma loadingVelocity_jointSmooth (z : Space) (η : ℝ) : + JointSmooth (loadingVelocity z η) := + movingBoxVelocity_jointSmooth (loadingCenter_contDiff z) contDiff_const + (by intros; norm_num) _ _ _ + +lemma loadingVelocity_divergence (z : Space) (η t : ℝ) (x : Space) : + div (loadingVelocity z η) t x = 0 := + movingBoxVelocity_divergence (loadingCenter_contDiff z) contDiff_const + (by intros; norm_num) _ _ _ _ _ + +lemma loadingCenter_deriv_zero {z : Space} {t : ℝ} (ht : t < 1 / 4 ∨ 3 / 4 < t) : + deriv (loadingCenter z) t = 0 := by + rcases ht with ht | ht + · have he : loadingCenter z =ᶠ[𝓝 t] fun _ => (0 : Space) := by + filter_upwards [Iio_mem_nhds ht] with s hs + simp [loadingCenter, loadingSwitch_zero hs.le] + rw [he.deriv_eq, deriv_const] + · have he : loadingCenter z =ᶠ[𝓝 t] fun _ => z - fixedLabel := by + filter_upwards [Ioi_mem_nhds ht] with s hs + simp [loadingCenter, loadingSwitch_one hs.le] + rw [he.deriv_eq, deriv_const] + +lemma loadingVelocity_zero {z : Space} {η t : ℝ} (ht : t < 1 / 4 ∨ 3 / 4 < t) : + loadingVelocity z η t = 0 := + movingBoxVelocity_zero (loadingCenter_deriv_zero ht) (by intros; simp) + +lemma loadingPath_hasDerivAt (z : Space) {η : ℝ} (hη : 0 < η) (t : ℝ) : + HasDerivAt (loadingPath z) (loadingVelocity z η t (loadingPath z t)) t := + affinePath_hasDerivAt hη (loadingCenter_contDiff z) contDiff_const + (by intros; norm_num) (by intros; simp) (by exact ⟨le_rfl, le_rfl⟩) t + +lemma loadingPath_eq (z : Space) (t : ℝ) (i : Fin 3) : + loadingPath z t i = (1 - loadingSwitch t) * fixedLabel i + loadingSwitch t * z i := by + dsimp [loadingPath, affinePath, loadingCenter] + ring + +lemma loadingPath_start (z : Space) : loadingPath z 0 = fixedLabel := by + ext i + rw [loadingPath_eq, loadingSwitch_zero (by norm_num)] + ring + +lemma loadingPath_end (z : Space) : loadingPath z 1 = z := by + ext i + rw [loadingPath_eq, loadingSwitch_one (by norm_num)] + ring + +lemma loadingPath_between (z : Space) (t : ℝ) (i : Fin 3) : + min (fixedLabel i) (z i) ≤ loadingPath z t i ∧ + loadingPath z t i ≤ max (fixedLabel i) (z i) := by + rw [loadingPath_eq] + have h₀ := loadingSwitch_nonneg t + have h₁ := loadingSwitch_le_one t + constructor + · nlinarith [mul_nonneg (sub_nonneg.mpr (min_le_left (fixedLabel i) (z i))) + (sub_nonneg.mpr h₁), + mul_nonneg (sub_nonneg.mpr (min_le_right (fixedLabel i) (z i))) h₀] + · nlinarith [mul_nonneg (sub_nonneg.mpr (le_max_left (fixedLabel i) (z i))) + (sub_nonneg.mpr h₁), + mul_nonneg (sub_nonneg.mpr (le_max_right (fixedLabel i) (z i))) h₀] + +def loadingSupport (z : Space) (η : ℝ) : Set Space := + closedEnlargement (fun i => min (fixedLabel i) (z i)) + (fun i => max (fixedLabel i) (z i)) (2 * η) + +lemma loadingSupport_compact (z : Space) (η : ℝ) : IsCompact (loadingSupport z η) := + isCompact_Icc + +lemma loadingVelocity_supported (z : Space) {η : ℝ} (hη : 0 < η) : + SpatiallySupported (loadingSupport z η) (loadingVelocity z η) := by + intro t x hx + apply image_eq_zero_of_notMem_tsupport + intro ht + apply hx + have hh := tsupport_movingBoxVelocity_subset fixedLabel fixedLabel + (loadingCenter z) (fun _ => 1) hη t ht + unfold loadingSupport + rw [mem_closedEnlargement] at hh ⊢ + intro i + have hbound := loadingPath_between z t i + have hpoint : lowerEndpoint fixedLabel (loadingCenter z) (fun _ => 1) t = loadingPath z t := rfl + rw [hpoint] at hh + constructor <;> linarith [(hh i).1, (hh i).2] + +lemma loadingVelocity_repeats (z : Space) (η : ℝ) : RepeatsAfter 1 (loadingVelocity z η) := by + intro t ht + rw [loadingVelocity_zero (Or.inr (by linarith)), + loadingVelocity_zero (Or.inr (by linarith))] + +lemma loadingVelocity_boundedMixed (z : Space) {η : ℝ} (hη : 0 < η) : + BoundedMixed (loadingVelocity z η) := + boundedMixed_of_compact_repeating (loadingSupport_compact z η) + (loadingVelocity_jointSmooth z η) (loadingVelocity_supported z hη) + (loadingVelocity_repeats z η) + +theorem loadingPath_avoids_observer {z : Space} (hz : 4 ≤ z 0) (t : ℝ) : + loadingPath z t ∉ observer := by + intro h + have hh : loadingPath z t 0 < 2 := (Set.mem_pi.mp h 0 (Set.mem_univ _)).2 + have hb := (loadingPath_between z t 0).1 + have hf : fixedLabel 0 = 4 := rfl + rw [hf, min_eq_left hz] at hb + linarith + +theorem loading_realization (z : Space) {η : ℝ} (hη : 0 < η) : + JointSmooth (loadingVelocity z η) ∧ + SpatiallySupported (loadingSupport z η) (loadingVelocity z η) ∧ + BoundedMixed (loadingVelocity z η) ∧ + (∀ x, loadingVelocity z η 0 x = 0) ∧ + loadingPath z 0 = fixedLabel ∧ loadingPath z 1 = z ∧ + (∀ t, HasDerivAt (loadingPath z) (loadingVelocity z η t (loadingPath z t)) t) ∧ + (4 ≤ z 0 → ∀ t, loadingPath z t ∉ observer) ∧ + ∀ ν : ℝ, ZeroDataSolution ν + (affineForce (inertialCoefficient (loadingVelocity z η)) + (viscousCoefficient (loadingVelocity z η)) ν) + (loadingVelocity z η) (fun _ _ => 0) := by + have hzero : ∀ x, loadingVelocity z η 0 x = 0 := by + intro x + rw [loadingVelocity_zero (Or.inl (by norm_num))] + rfl + exact ⟨loadingVelocity_jointSmooth z η, loadingVelocity_supported z hη, + loadingVelocity_boundedMixed z hη, hzero, loadingPath_start z, loadingPath_end z, + loadingPath_hasDerivAt z hη, fun hz t => loadingPath_avoids_observer hz t, + fun ν => residual_zero_pressure_solution ν _ (loadingVelocity_jointSmooth z η).smooth hzero + (fun t _ x => loadingVelocity_divergence z η t x)⟩ + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineHalting.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineHalting.lean new file mode 100644 index 0000000000000000000000000000000000000000..89fa458a33a5af03192d469727aa7e1650e763c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineHalting.lean @@ -0,0 +1,324 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.RecorderSimulation + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint + +theorem coded_halting_iff {Q Γ : Type*} [Fintype Q] [Fintype Γ] + [DecidableEq Q] [DecidableEq Γ] (M : Machine Q Γ) (c : Checkpoint Q Γ) : + (∃ n d, Exec M n (c.expand M) d ∧ d.code M ∈ observer) ↔ + ∃ e, Relation.ReflTransGen (WorkStep M) c e ∧ e.state = M.halt := by + constructor + · rintro ⟨n, d, h, hd⟩ + exact (halting_iff M c).mp ⟨n, d, h, (code_mem_observer_iff M d).mp hd⟩ + · intro h + obtain ⟨n, d, hh, hd⟩ := (halting_iff M c).mpr h + exact ⟨n, d, hh, (code_mem_observer_iff M d).mpr hd⟩ + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.FiniteMachine + +def normalized (M : FiniteMachine) : + Recorder.Machine (Option (Fin (M.states + 1))) (Fin (M.symbols + 1)) where + halt := none + blank := M.blank + transition q a := match q with + | none => ⟨none, a, .stay⟩ + | some q => match M.transition q a with + | none => ⟨none, a, .stay⟩ + | some v => ⟨some v.state, v.write, v.move⟩ + +abbrev WorkConfiguration (M : FiniteMachine) := + Recorder.Checkpoint (Option (Fin (M.states + 1))) (Fin (M.symbols + 1)) + +def initialWork (M : FiniteMachine) (w : Input M) : WorkConfiguration M := + Recorder.Checkpoint.initial M.normalized (some M.initial) w + +end BalancedTransport.FiniteMachine +end + +noncomputable section +namespace BalancedTransport.TapeConfiguration + +def advance {M : FiniteMachine} (c : TapeConfiguration M) + (v : Recorder.Transition (Fin (M.states + 1)) (Fin (M.symbols + 1))) : + TapeConfiguration M := + ⟨v.state, c.head + (match v.move with | .stay => 0 | .left => -1 | .right => 1), + Function.update c.tape c.head v.write⟩ + +end BalancedTransport.TapeConfiguration +end + +noncomputable section +namespace BalancedTransport.FiniteMachine +open Recorder +open Stream' + +structure Represents (M : FiniteMachine) (w : M.WorkConfiguration) + (c : TapeConfiguration M) : Prop where + current : w.current = c.tape c.head + left : ∀ n : ℕ, w.left n = c.tape (c.head - ((n : ℤ) + 1)) + right : ∀ n : ℕ, w.right[n]?.getD M.blank = c.tape (c.head + ((n : ℤ) + 1)) + +theorem initialWork_represents (M : FiniteMachine) (w : Input M) : + Represents M (M.initialWork w) (initialConfiguration M w) := by + constructor + · cases w <;> simp [initialWork, Checkpoint.initial, normalized, initialConfiguration] + · intro n + change M.blank = (if 0 ≤ (0 : ℤ) - ((n : ℤ) + 1) + then w[((0 : ℤ) - ((n : ℤ) + 1)).toNat]?.getD M.blank else M.blank) + rw [ite_eq_right (by omega)] + · intro n + simp only [initialWork, Checkpoint.initial, normalized, initialConfiguration, zero_add, + show (0 : ℤ) ≤ (n : ℤ) + 1 by omega, ↓reduceIte] + have hn : ((n : ℤ) + 1).toNat = n + 1 := by omega + rw [hn] + cases w <;> simp + +end BalancedTransport.FiniteMachine +end + +noncomputable section +namespace BalancedTransport.FiniteMachine.Represents +open Recorder +open Stream' +variable {M : FiniteMachine} {w : M.WorkConfiguration} {c : TapeConfiguration M} + +theorem advance (h : Represents M w c) + (v : Transition (Fin (M.states + 1)) (Fin (M.symbols + 1))) + (hv : M.normalized.transition w.state w.current = ⟨some v.state, v.write, v.move⟩) : + Represents M (w.next M.normalized) (c.advance v) := by + cases hm : v.move with + | stay => + simp only [Checkpoint.next, hv, hm] + constructor + · simp [TapeConfiguration.advance, hm] + · intro n + change w.left n = Function.update c.tape c.head v.write + (c.head + (match v.move with | .stay => 0 | .left => -1 | .right => 1) - + ((n : ℤ) + 1)) + simp only [hm, add_zero] + rw [Function.update_of_ne (by omega) _ _] + exact h.left n + · intro n + simp only [TapeConfiguration.advance, hm, add_zero] + rw [Function.update_of_ne (by omega) _ _] + exact h.right n + | left => + simp only [Checkpoint.next, hv, hm] + constructor + · simp only [TapeConfiguration.advance, hm, Stream'.head, Stream'.get] + rw [Function.update_of_ne (by omega) _ _] + simpa [sub_eq_add_neg] using h.left 0 + · intro n + simp only [TapeConfiguration.advance, hm, Stream'.tail, Stream'.get] + rw [Function.update_of_ne (by omega) _ _] + convert h.left (n + 1) using 1 + congr 1 + omega + · intro n + simp only [TapeConfiguration.advance, hm] + cases n with + | zero => simp + | succ n => + rw [Function.update_of_ne (by omega) _ _] + simp only [List.getElem?_cons_succ] + convert h.right n using 1 + congr 1 + omega + | right => + cases hr : w.right with + | nil => + simp only [Checkpoint.next, hv, hm, hr] + constructor + · simp only [TapeConfiguration.advance, hm] + rw [Function.update_of_ne (by omega) _ _] + change M.blank = c.tape (c.head + 1) + simpa only [hr, List.getElem?_nil, Option.getD_none, Nat.cast_zero, zero_add] + using h.right 0 + · intro n + simp only [TapeConfiguration.advance, hm] + cases n with + | zero => simp [Stream'.cons] + | succ n => + rw [Function.update_of_ne (by omega) _ _] + simp only [Stream'.cons] + convert h.left n using 1 + congr 1 + omega + · intro n + simp only [TapeConfiguration.advance, hm] + rw [Function.update_of_ne (by omega) _ _] + have he : c.head + 1 + ((n : ℤ) + 1) = + c.head + (((n + 1 : ℕ) : ℤ) + 1) := by omega + rw [he] + simpa only [hr, List.getElem?_nil, Option.getD_none] using h.right (n + 1) + | cons a r => + simp only [Checkpoint.next, hv, hm, hr] + constructor + · simp only [TapeConfiguration.advance, hm] + rw [Function.update_of_ne (by omega) _ _] + simpa only [hr, List.getElem?_cons_zero, Option.getD_some, Nat.cast_zero, zero_add] + using h.right 0 + · intro n + simp only [TapeConfiguration.advance, hm] + cases n with + | zero => simp [Stream'.cons] + | succ n => + rw [Function.update_of_ne (by omega) _ _] + simp only [Stream'.cons] + convert h.left n using 1 + congr 1 + omega + · intro n + simp only [TapeConfiguration.advance, hm] + rw [Function.update_of_ne (by omega) _ _] + have he : c.head + 1 + ((n : ℤ) + 1) = + c.head + (((n + 1 : ℕ) : ℤ) + 1) := by omega + rw [he] + simpa only [hr, List.getElem?_cons_succ] using h.right (n + 1) + +theorem stop (h : Represents M w c) + (hv : M.normalized.transition w.state w.current = ⟨none, w.current, .stay⟩) : + Represents M (w.next M.normalized) c := by + simp only [Checkpoint.next, hv] + exact ⟨h.current, h.left, h.right⟩ + +end BalancedTransport.FiniteMachine.Represents +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint + +theorem next_state {Q Γ : Type*} (M : Machine Q Γ) (w : Checkpoint Q Γ) : + (w.next M).state = (M.transition w.state w.current).state := by + cases hm : (M.transition w.state w.current).move <;> + simp only [next, hm] + cases w.right <;> rfl + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.FiniteMachine +open Recorder +variable {M : FiniteMachine} + +theorem lift_step {c d : TapeConfiguration M} {w : M.WorkConfiguration} + (h : machineStep M c = some d) (hs : w.state = some c.state) + (ht : Represents M w c) : + Checkpoint.WorkStep M.normalized w (w.next M.normalized) ∧ + (w.next M.normalized).state = some d.state ∧ + Represents M (w.next M.normalized) d := by + cases hv : M.transition c.state (c.tape c.head) with + | none => simp [machineStep, hv] at h + | some v => + have hd : c.advance v = d := by + cases hm : v.move <;> + simpa only [machineStep, hv, Option.map_some, Option.some.injEq, + TapeConfiguration.advance, hm] using h + subst d + have hv' : M.normalized.transition w.state w.current = + ⟨some v.state, v.write, v.move⟩ := by + simp [normalized, hs, ht.current, hv] + refine ⟨⟨?_, rfl⟩, ?_, ht.advance v hv'⟩ + · simp [normalized, hs] + · rw [Checkpoint.next_state, hv'] + rfl + +theorem lift_execution {c d : TapeConfiguration M} + (h : Relation.ReflTransGen (fun c d => machineStep M c = some d) c d) + {w : M.WorkConfiguration} (hs : w.state = some c.state) (ht : Represents M w c) : + ∃ w', Relation.ReflTransGen (Checkpoint.WorkStep M.normalized) w w' ∧ + w'.state = some d.state ∧ Represents M w' d := by + induction h with + | refl => exact ⟨w, .refl, hs, ht⟩ + | @tail c' d hc' hd ih => + obtain ⟨w', hw', hs', ht'⟩ := ih + obtain ⟨hstep, hs'', ht''⟩ := lift_step hd hs' ht' + exact ⟨w'.next M.normalized, hw'.tail hstep, hs'', ht''⟩ + +theorem lift_halt {c : TapeConfiguration M} {w : M.WorkConfiguration} + (h : machineStep M c = none) (hs : w.state = some c.state) + (ht : Represents M w c) : + Checkpoint.WorkStep M.normalized w (w.next M.normalized) ∧ + (w.next M.normalized).state = none := by + have hv : M.transition c.state (c.tape c.head) = none := by + simpa only [machineStep, Option.map_eq_none_iff] using h + have hv' : M.normalized.transition w.state w.current = + ⟨none, w.current, .stay⟩ := by + simp [normalized, hs, ht.current, hv] + refine ⟨⟨?_, rfl⟩, ?_⟩ + · simp [normalized, hs] + · rw [Checkpoint.next_state, hv'] + +def Corresponds (M : FiniteMachine) (w : M.WorkConfiguration) + (c : TapeConfiguration M) : Prop := + Represents M w c ∧ + (w.state = some c.state ∨ (w.state = none ∧ machineStep M c = none)) + +theorem reflect_step {c : TapeConfiguration M} {w w' : M.WorkConfiguration} + (hc : Corresponds M w c) (h : Checkpoint.WorkStep M.normalized w w') : + ∃ d, Relation.ReflTransGen (fun c d => machineStep M c = some d) c d ∧ + Corresponds M w' d := by + obtain ⟨ht, hs | ⟨hs, _⟩⟩ := hc + · obtain ⟨hnh, rfl⟩ := h + cases hv : M.transition c.state (c.tape c.head) with + | none => + have hv' : M.normalized.transition w.state w.current = + ⟨none, w.current, .stay⟩ := by + simp [normalized, hs, ht.current, hv] + refine ⟨c, .refl, ht.stop hv', Or.inr ⟨?_, ?_⟩⟩ + · rw [Checkpoint.next_state, hv'] + · simp [machineStep, hv] + | some v => + have hd : machineStep M c = some (c.advance v) := by + cases hm : v.move <;> simp [machineStep, hv, TapeConfiguration.advance, hm] + obtain ⟨_, hs', ht'⟩ := lift_step hd hs ht + exact ⟨c.advance v, .single hd, ht', Or.inl hs'⟩ + · exact False.elim (h.1 hs) + +theorem reflect_execution {c : TapeConfiguration M} {w w' : M.WorkConfiguration} + (hc : Corresponds M w c) + (h : Relation.ReflTransGen (Checkpoint.WorkStep M.normalized) w w') : + ∃ d, Relation.ReflTransGen (fun c d => machineStep M c = some d) c d ∧ + Corresponds M w' d := by + induction h with + | refl => exact ⟨c, .refl, hc⟩ + | @tail w' w'' hw' hstep ih => + obtain ⟨d, hd, hcd⟩ := ih + obtain ⟨e, he, hce⟩ := reflect_step hcd hstep + exact ⟨e, hd.trans he, hce⟩ + +theorem normalized_halting_iff (M : FiniteMachine) (input : Input M) : + (∃ w', Relation.ReflTransGen (Checkpoint.WorkStep M.normalized) + (M.initialWork input) w' ∧ w'.state = M.normalized.halt) ↔ Halts M input := by + constructor + · rintro ⟨w', hw', hhalt⟩ + have hc : Corresponds M (M.initialWork input) (initialConfiguration M input) := + ⟨initialWork_represents M input, Or.inl rfl⟩ + obtain ⟨d, hd, _, hs | ⟨_, hterm⟩⟩ := reflect_execution hc hw' + · simp only [normalized] at hhalt + rw [hhalt] at hs + cases hs + · exact ⟨d, hd, hterm⟩ + · rintro ⟨d, hd, hterm⟩ + obtain ⟨w', hw', hs', ht'⟩ := lift_execution hd (w := M.initialWork input) + rfl (initialWork_represents M input) + obtain ⟨hst, hh⟩ := lift_halt hterm hs' ht' + exact ⟨w'.next M.normalized, hw'.tail hst, hh⟩ + +theorem discrete_compiled_halting_iff (M : FiniteMachine) (input : Input M) : + (∃ n d, Exec M.normalized n ((M.initialWork input).expand M.normalized) d ∧ + d.code M.normalized ∈ observer) ↔ Halts M input := + (Checkpoint.coded_halting_iff M.normalized (M.initialWork input)).trans + (normalized_halting_iff M input) + +end BalancedTransport.FiniteMachine +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineRecursion.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc9115c34c01774e35a4506261d8aca0f6164c31 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MachineRecursion.lean @@ -0,0 +1,251 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ComputabilityRules + +namespace OAI + +noncomputable section +namespace BalancedTransport.Universal +open Effectivity +open Effectivity.ComputableRules + +abbrev RawInstruction := ℕ × ℕ × ℕ + +abbrev RawMachine := ℕ × ℕ × ℕ × ℕ × List (List (Option RawInstruction)) + +abbrev RawState := ℕ × ℤ × List (ℤ × ℕ) + +abbrev RawRun := RawMachine × List ℕ × RawState + +def serialize (M : FiniteMachine) : RawMachine := + (M.states, M.symbols, M.initial.val, M.blank.val, + (List.finRange (M.states + 1)).map fun q => + (List.finRange (M.symbols + 1)).map fun a => + (M.transition q a).map fun v => (v.state.val, v.write.val, v.move.number)) + +def rawBase (blank : ℕ) (w : List ℕ) (z : ℤ) : ℕ := + if (z.toNat : ℤ) = z then w.getD z.toNat blank else blank + +def rawRead (blank : ℕ) (w : List ℕ) (writes : List (ℤ × ℕ)) (z : ℤ) : ℕ := + writes.foldl (fun value p => if z = p.1 then p.2 else value) (rawBase blank w z) + +def rawMove (d : ℕ) : ℤ := if d = 0 then 0 else if d = 1 then -1 else 1 + +def rawStep (r : RawRun) : Option RawRun := + let m := r.1 + let w := r.2.1 + let c := r.2.2 + ((m.2.2.2.2.getD c.1 []).getD (rawRead m.2.2.2.1 w c.2.2 c.2.1) none).map + fun v => (m, w, v.1, c.2.1 + rawMove v.2.2, c.2.2 ++ [(c.2.1, v.2.1)]) + +def rawInit (n : ℕ) : RawRun := + let p := (Encodable.decode (α := ℕ × List ℕ) n).getD (0, []) + let m := (Encodable.decode (α := RawMachine) p.1).getD (0,0,0,0,[]) + (m, p.2, m.2.2.1, 0, []) + +@[fun_prop] lemma computable_int_toNat : Computable Int.toNat := primrec_int_toNat.to_comp + +@[fun_prop] lemma computable_int_ofNat : Computable (Int.ofNat : ℕ → ℤ) := primrec_int_ofNat.to_comp + +@[fun_prop] lemma computable_int_add : Computable (fun p : ℤ × ℤ => p.1 + p.2) := primrec_int_add.to_comp + +lemma primrec_rawBase : Primrec (fun p : ℕ × List ℕ × ℤ => rawBase p.1 p.2.1 p.2.2) := by + unfold rawBase + exact Primrec.ite + (Primrec.eq.comp (primrec_int_ofNat.comp (primrec_int_toNat.comp (Primrec.snd.comp Primrec.snd))) + (Primrec.snd.comp Primrec.snd)) + (Primrec.option_getD.comp (Primrec.list_getElem?.comp (Primrec.fst.comp Primrec.snd) + (primrec_int_toNat.comp (Primrec.snd.comp Primrec.snd))) Primrec.fst) + Primrec.fst + +lemma computable_rawRead : Computable (fun p : ℕ × List ℕ × List (ℤ × ℕ) × ℤ => + rawRead p.1 p.2.1 p.2.2.1 p.2.2.2) := by + unfold rawRead + apply Primrec.to_comp + apply Primrec.list_foldl (h := fun (p : ℕ × List ℕ × List (ℤ × ℕ) × ℤ) (v : ℕ × (ℤ × ℕ)) => + if p.2.2.2 = v.2.1 then v.2.2 else v.1) (Primrec.fst.comp (Primrec.snd.comp Primrec.snd)) + (primrec_rawBase.comp (Primrec.fst.pair ((Primrec.fst.comp Primrec.snd).pair + (Primrec.snd.comp (Primrec.snd.comp Primrec.snd))))) + exact (Primrec.ite + (Primrec.eq.comp (Primrec.snd.comp (Primrec.snd.comp (Primrec.snd.comp Primrec.fst))) + (Primrec.fst.comp (Primrec.snd.comp Primrec.snd))) + (Primrec.snd.comp (Primrec.snd.comp Primrec.snd)) + (Primrec.fst.comp Primrec.snd)).to₂ + +lemma computable_rawMove : Computable rawMove := by + unfold rawMove + exact (Primrec.ite (Primrec.eq.comp Primrec.id (Primrec.const 0)) (Primrec.const (0:ℤ)) + (Primrec.ite (Primrec.eq.comp Primrec.id (Primrec.const 1)) + (Primrec.const (-1:ℤ)) (Primrec.const (1:ℤ)))).to_comp + +lemma computable_rawSymbol : Computable (fun r : RawRun => + rawRead r.1.2.2.2.1 r.2.1 r.2.2.2.2 r.2.2.2.1) := by + have hM : Computable (fun r : RawRun => r.1) := Computable.fst + have hw : Computable (fun r : RawRun => r.2.1) := Computable.fst.comp Computable.snd + have hc : Computable (fun r : RawRun => r.2.2) := Computable.snd.comp Computable.snd + have hh : Computable (fun r : RawRun => r.2.2.2.1) := Computable.fst.comp (Computable.snd.comp hc) + have hs : Computable (fun r : RawRun => r.2.2.2.2) := Computable.snd.comp (Computable.snd.comp hc) + have hb : Computable (fun r : RawRun => r.1.2.2.2.1) := + Computable.fst.comp (Computable.snd.comp (Computable.snd.comp (Computable.snd.comp hM))) + exact computable_rawRead.comp + (g := fun r : RawRun => (r.1.2.2.2.1,r.2.1,r.2.2.2.2,r.2.2.2.1)) + (hb.pair (hw.pair (hs.pair hh))) + +lemma computable_rawInstruction : Computable (fun r : RawRun => + (r.1.2.2.2.2.getD r.2.2.1 []).getD + (rawRead r.1.2.2.2.1 r.2.1 r.2.2.2.2 r.2.2.2.1) none) := by + have hq : Computable (fun r : RawRun => r.2.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.snd) + have ht : Computable (fun r : RawRun => r.1.2.2.2.2) := + Computable.snd.comp (Computable.snd.comp (Computable.snd.comp (Computable.snd.comp Computable.fst))) + exact (Primrec.list_getD (none : Option RawInstruction)).to_comp.comp + ((Primrec.list_getD ([] : List (Option RawInstruction))).to_comp.comp ht hq) computable_rawSymbol + +lemma computable_rawAdvanceState : Computable (fun p : RawState × RawInstruction => + (p.2.1, p.1.2.1 + rawMove p.2.2.2, p.1.2.2 ++ [(p.1.2.1,p.2.2.1)])) := by + have hh : Computable (fun p : RawState × RawInstruction => p.1.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.fst) + have hs : Computable (fun p : RawState × RawInstruction => p.1.2.2) := + Computable.snd.comp (Computable.snd.comp Computable.fst) + have hw : Computable (fun p : RawState × RawInstruction => p.2.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.snd) + have hd : Computable (fun p : RawState × RawInstruction => rawMove p.2.2.2) := + computable_rawMove.comp (Computable.snd.comp (Computable.snd.comp Computable.snd)) + exact (Computable.fst.comp Computable.snd).pair + ((primrec_int_add.to_comp.comp hh hd).pair + (Primrec.list_append.to_comp.comp hs + (Primrec.list_cons.to_comp.comp (hh.pair hw) (Computable.const [])))) + +lemma computable_rawAdvance : Computable (fun p : RawRun × RawInstruction => + (p.1.1, p.1.2.1, p.2.1, p.1.2.2.2.1 + rawMove p.2.2.2, + p.1.2.2.2.2 ++ [(p.1.2.2.2.1,p.2.2.1)])) := by + have hc : Computable (fun p : RawRun × RawInstruction => p.1.2.2) := + Computable.snd.comp (Computable.snd.comp Computable.fst) + exact (Computable.fst.comp Computable.fst).pair + ((Computable.fst.comp (Computable.snd.comp Computable.fst)).pair + (computable_rawAdvanceState.comp (g := fun p : RawRun × RawInstruction => (p.1.2.2,p.2)) + (hc.pair Computable.snd))) + +lemma computable_rawStep : Computable rawStep := + Computable.option_map computable_rawInstruction computable_rawAdvance.to₂ + +lemma computable_rawInit : Computable rawInit := by + have hp : Computable (fun n : ℕ => (Encodable.decode (α := ℕ × List ℕ) n).getD (0,[])) := + Computable.option_getD Computable.decode (Computable.const _) + have hm : Computable (fun n : ℕ => + (Encodable.decode (α := RawMachine) ((Encodable.decode (α := ℕ × List ℕ) n).getD (0,[])).1).getD (0,0,0,0,[])) := + Computable.option_getD (Computable.decode.comp (Computable.fst.comp hp)) (Computable.const _) + exact hm.pair ((Computable.snd.comp hp).pair + ((Computable.fst.comp (Computable.snd.comp (Computable.snd.comp hm))).pair + ((Computable.const (0 : ℤ)).pair (Computable.const [])))) + +@[simp] lemma rawInit_inputCode (M : FiniteMachine) (w : Input M) : + rawInit (inputCode M w) = (serialize M, w.map Fin.val, M.initial.val, 0, []) := by + simp [rawInit, inputCode, FiniteMachine.code, serialize] + +@[simp] lemma rawMove_number (d : Recorder.Direction) : rawMove d.number = + match d with | .stay => 0 | .left => -1 | .right => 1 := by + cases d <;> simp [rawMove, Recorder.Direction.number] + +lemma rawBase_initial (M : FiniteMachine) (w : Input M) (z : ℤ) : + rawBase M.blank.val (w.map Fin.val) z = ((initialConfiguration M w).tape z).val := by + have hz : ((z.toNat : ℤ) = z) ↔ 0 ≤ z := by omega + simp only [rawBase, initialConfiguration, hz] + split_ifs with h + · simp only [List.getD_eq_getElem?_getD, List.getElem?_map] + cases w[z.toNat]? <;> rfl + · rfl + +lemma rawRead_append (b : ℕ) (w : List ℕ) (s : List (ℤ × ℕ)) (z k : ℤ) (a : ℕ) : + rawRead b w (s ++ [(k,a)]) z = if z = k then a else rawRead b w s z := by + simp [rawRead, List.foldl_append] + +lemma serialize_instruction (M : FiniteMachine) (q : Fin (M.states+1)) (a : Fin (M.symbols+1)) : + (((serialize M).2.2.2.2.getD q.val []).getD a.val none) = + (M.transition q a).map (fun v => (v.state.val, v.write.val, v.move.number)) := by + have hq : q.val < (List.finRange (M.states+1)).length := by simpa using q.isLt + have ha : a.val < (List.finRange (M.symbols+1)).length := by simpa using a.isLt + simp [serialize, List.getD_eq_getElem?_getD, List.getElem?_eq_getElem hq, + List.getElem?_eq_getElem ha] + +def RawRel (M : FiniteMachine) (w : Input M) (c : TapeConfiguration M) (r : RawRun) : Prop := + r.1 = serialize M ∧ r.2.1 = w.map Fin.val ∧ r.2.2.1 = c.state.val ∧ r.2.2.2.1 = c.head ∧ + ∀ z, rawRead M.blank.val (w.map Fin.val) r.2.2.2.2 z = (c.tape z).val + +lemma rawRel_initial (M : FiniteMachine) (w : Input M) : + RawRel M w (initialConfiguration M w) (rawInit (inputCode M w)) := by + rw [rawInit_inputCode] + exact ⟨rfl,rfl,rfl,rfl, fun z => rawBase_initial M w z⟩ + +lemma rawStep_rel (M : FiniteMachine) (w : Input M) (c : TapeConfiguration M) (r : RawRun) + (hr : RawRel M w c r) : + match machineStep M c with + | none => rawStep r = none + | some c' => ∃ r', rawStep r = some r' ∧ RawRel M w c' r' := by + rcases r with ⟨m,w',q,h,s⟩ + rcases hr with ⟨rfl,rfl,hq,hh,hs⟩ + dsimp at hq hh + subst q; subst h + have hi := serialize_instruction M c.state (c.tape c.head) + dsimp only [rawStep] + rw [show (serialize M).2.2.2.1 = M.blank.val from rfl, hs, hi] + unfold machineStep + cases hv : M.transition c.state (c.tape c.head) with + | none => rfl + | some v => + simp only [Option.map_some, rawMove_number] + refine ⟨_, rfl, rfl, rfl, rfl, rfl, ?_⟩ + intro z + rw [rawRead_append, hs] + by_cases hz : z = c.head + · subst z; simp + · simp [hz] + +lemma raw_respects (M : FiniteMachine) (w : Input M) : + StateTransition.Respects (machineStep M) rawStep (RawRel M w) := by + intro c r hr + have h := rawStep_rel M w c r hr + cases he : machineStep M c with + | none => simpa [he] using h + | some c' => + simp only [he] at h + obtain ⟨r',hs,hr'⟩ := h + exact ⟨r',hr', Relation.TransGen.single hs⟩ + +lemma halts_iff_eval_dom (M : FiniteMachine) (w : Input M) : + Halts M w ↔ (StateTransition.eval (machineStep M) (initialConfiguration M w)).Dom := by + rw [Part.dom_iff_mem] + simp only [StateTransition.mem_eval] + rfl + +lemma raw_eval_dom (M : FiniteMachine) (w : Input M) : + (StateTransition.eval rawStep (rawInit (inputCode M w))).Dom ↔ Halts M w := by + exact (StateTransition.tr_eval_dom (raw_respects M w) (rawRel_initial M w)).trans + (halts_iff_eval_dom M w).symm + +lemma partrec_raw_eval : Partrec (StateTransition.eval rawStep) := by + unfold StateTransition.eval + apply Partrec.fix + apply Computable.partrec + exact (Computable.option_casesOn computable_rawStep Computable.sumInl + (Computable.sumInr.comp Computable.snd).to₂).of_eq (fun r => by + cases rawStep r <;> rfl) + +def universalPartial (n : ℕ) : Part ℕ := + (StateTransition.eval rawStep (rawInit n)).map (fun _ => 0) + +lemma universalPartial_partrec : Partrec universalPartial := + (partrec_raw_eval.comp computable_rawInit).map (Computable.const 0).to₂ + +lemma universalPartial_dom (M : FiniteMachine) (w : Input M) : + (universalPartial (inputCode M w)).Dom ↔ Halts M w := raw_eval_dom M w + +lemma exists_universal_code : ∃ c : Turing.ToPartrec.Code, ∀ n, + (c.eval [n]).Dom ↔ (universalPartial n).Dom := by + obtain ⟨c,hc⟩ := Turing.ToPartrec.Code.exists_code (Nat.Partrec'.part_iff₁.mpr universalPartial_partrec) + refine ⟨c, fun n => ?_⟩ + have h := hc ⟨[n],rfl⟩ + simpa [List.Vector.head] using congrArg Part.Dom h + +end BalancedTransport.Universal +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MainResult.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MainResult.lean new file mode 100644 index 0000000000000000000000000000000000000000..b468c1096cc36ba561a51c76c90417cd4b45ff97 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MainResult.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.UniversalMachine +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Realization +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryTemplate +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveConstruction + +namespace OAI + +noncomputable section +namespace BalancedTransport +open BalancedTransport.Geometry + +theorem balanced_three_stack_realization : + ∃ U f₀ f₁ : Family Velocity, + ∃ X : Family MaterialFlow, + ∃ repeated : FiniteMachine → Velocity, + EffectiveFamily U ∧ EffectiveFamily f₀ ∧ EffectiveFamily f₁ ∧ + (∀ M, Function.Periodic (repeated M) 1) ∧ + ∀ (M : FiniteMachine) (w : Input M), + Smooth (U M w) ∧ Smooth (f₀ M w) ∧ Smooth (f₁ M w) ∧ + f₀ M w = inertialCoefficient (U M w) ∧ + f₁ M w = viscousCoefficient (U M w) ∧ + CommonCompactSupport (U M w) (f₀ M w) (f₁ M w) ∧ + BoundedMixed (U M w) ∧ + PeriodicAfterOne (U M w) ∧ + (∀ t, 1 ≤ t → ∀ x, U M w t x = repeated M t x) ∧ + ComparisonClass (U M w) (fun _ _ => 0) ∧ + IsMaterialFlow (U M w) (X M w) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ X M w t fixedLabel ∈ observer) ↔ Halts M w) ∧ + ∀ ν : ℝ, 0 < ν → + let f := affineForce (f₀ M w) (f₁ M w) ν + ZeroDataSolution ν f (U M w) (fun _ _ => 0) ∧ + Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f ∧ + UniqueInComparison ν f (U M w) ∧ + (ComputableReal ν → EffectiveFieldIn ∅ f) ∧ + (∀ name : ℕ → ℚ, RealName name ν → EffectiveFieldIn {nameOracle name} f) := by + obtain ⟨N, δ, hδ, hh⟩ := Universal.exists_universal_machine + obtain ⟨v, K, hK, hv, hc, hs, hd, hg, he⟩ := + Effectivity.exists_elementary_guarded_template N.normalized 3 + let κ : ℕ → Fin 3 → ℚ := fun n => + Recorder.Checkpoint.rationalInitial N.normalized (some N.initial) (δ n) + have hκ : Computable κ := (Effectivity.computable_rationalInitial N).comp hδ + obtain ⟨C, hC⟩ := Effectivity.rationalInitial_bounded N + let z : Family Space := fun M w => rationalSpace (κ (inputCode M w)) + let U : Family Velocity := fun M w => loadedRepeat (loadingVelocity (z M w) 1) v + have hz (M : FiniteMachine) (w : Input M) : z M w = + ((N.initialWork (δ (inputCode M w))).expand N.normalized).code N.normalized := + Recorder.Checkpoint.rationalInitial_cast N.normalized (some N.initial) (δ (inputCode M w)) + have hu (M : FiniteMachine) (w : Input M) := + loaded_template_realization (z M w) (by norm_num : (0 : ℝ) < 1) hK hv hc hs hd + have hlc (M : FiniteMachine) (w : Input M) : TimeCollars (loadingVelocity (z M w) 1) := + fun _ ht => loadingVelocity_zero ht + have hr (M : FiniteMachine) (w : Input M) := + prescribed_residual_realization ((loadingSupport_compact (z M w) 1).union hK) + (hu M w).1 (hu M w).2.1 (loadedRepeat_repeats (hlc M w)) (hu M w).2.2.2.1 + (fun t (_ : 0 ≤ t) x => loadedRepeat_divergence + (loadingVelocity_jointSmooth (z M w) 1) hv hc + (loadingVelocity_divergence (z M w) 1) hd t x) + have ef : EffectiveFamily U ∧ + EffectiveFamily (fun M w => inertialCoefficient (U M w)) ∧ + EffectiveFamily (fun M w => viscousCoefficient (U M w)) := + Effectivity.effective_loaded_family hκ C (fun n => hC (δ n)) hK hv hc hs he + choose X hX using (fun M w => (hu M w).2.2.2.2.2.2.1) + refine ⟨U, (fun M w => inertialCoefficient (U M w)), + (fun M w => viscousCoefficient (U M w)), X, (fun _ => repeatTemplate v), + ef.1, ef.2.1, ef.2.2, (fun _ => repeatTemplate_zero_period v), ?_⟩ + intro M w + obtain ⟨hsm, hsm₀, hsm₁, hsupp, hb, _, _, hp, hclass, _, hres⟩ := hr M w + refine ⟨hsm, hsm₀, hsm₁, rfl, rfl, hsupp, hb, hp, ?_, hclass, hX M w, ?_, ?_⟩ + · intro t ht x + exact congrFun ((hu M w).2.2.2.2.2.1 t ht) x + · have hx : IsMaterialFlow + (loadedRepeat (loadingVelocity + (((N.initialWork (δ (inputCode M w))).expand N.normalized).code N.normalized) 1) v) + (X M w) := by + rw [← hz M w] + exact hX M w + exact (N.compiled_continuous_halting_iff (δ (inputCode M w)) + (by norm_num : (0 : ℝ) < 1) hK hv hc hs hg hx).trans (hh M w) + · intro ν hν + obtain ⟨hsol, hsf, hbf, hpf, huniq⟩ := hres ν hν + have heff := Effectivity.residual_effective_viscosity (fun M w => (hu M w).1) + ef.2.1 ef.2.2 M w ν + exact ⟨hsol, hsf, hbf, hpf, huniq, heff.1, heff.2⟩ + +end BalancedTransport +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Material.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Material.lean new file mode 100644 index 0000000000000000000000000000000000000000..7acfdb1b8b107988340125d7863ab8cc1210caf7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Material.lean @@ -0,0 +1,175 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology NNReal +open Filter Set Metric +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] + +lemma exists_curve_on_interval {v : ℝ → E → E} {L K : ℝ≥0} + (hc : ∀ x, ContinuousOn (fun t => v t x) (Ici 0)) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖v t x‖ ≤ L) + (hl : ∀ t, 0 ≤ t → LipschitzWith K (v t)) + {T : ℝ} (hT : 0 ≤ T) (a : E) : + ∃ γ : ℝ → E, γ 0 = a ∧ Continuous γ ∧ + ∀ t ∈ Icc (0 : ℝ) T, HasDerivWithinAt γ (v t (γ t)) (Icc 0 T) t := by + let t₀ : Icc (0 : ℝ) T := ⟨0, le_rfl, hT⟩ + let R : ℝ≥0 := ⟨(L : ℝ) * T, mul_nonneg L.coe_nonneg hT⟩ + have hp : IsPicardLindelof v t₀ a R 0 L K := by + constructor + · intro t ht + exact (hl t ht.1).lipschitzOnWith + · intro x _ + exact (hc x).mono Icc_subset_Ici_self + · intro t ht x _ + exact hb t ht.1 x + · change (L : ℝ) * max (T - (t₀ : ℝ)) ((t₀ : ℝ) - 0) ≤ (L : ℝ) * T - 0 + simp [t₀, max_eq_left hT] + have ha : a ∈ closedBall a (0 : ℝ≥0) := by simp + obtain ⟨γ, hγ⟩ := ODE.FunSpace.exists_isFixedPt_next hp ha + have he : ∀ t ∈ Icc (0 : ℝ) T, + γ.compProj t = ODE.picard v 0 a γ.compProj t := by + intro t ht + rw [ODE.FunSpace.compProj_of_mem ht] + exact (ODE.FunSpace.isFixedPt_next_iff hp ha).mp hγ ⟨t, ht⟩ + refine ⟨γ.compProj, ?_, γ.continuous_compProj, fun t ht => ?_⟩ + · rw [he 0 ⟨le_rfl, hT⟩, ODE.picard_apply₀] + · exact (ODE.hasDerivWithinAt_picard_Icc ⟨le_rfl, hT⟩ hp.continuousOn_uncurry + γ.continuous_compProj.continuousOn + (fun s hs => γ.compProj_mem_closedBall hp.mul_max_le) a ht).congr + he (he t ht) + +omit [CompleteSpace E] in +lemma hasDerivWithinAt_forward_of_Icc {γ : ℝ → E} {d : E} {t T : ℝ} + (hd : HasDerivWithinAt γ d (Icc 0 T) t) (ht : t < T) : + HasDerivWithinAt γ d (Ici 0) t := by + apply hd.mono_of_mem_nhdsWithin + filter_upwards [self_mem_nhdsWithin, mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds ht)] with s hs₀ hs₁ + exact ⟨hs₀, hs₁.le⟩ + +omit [CompleteSpace E] in +lemma curves_agree_on_overlap {v : ℝ → E → E} {K : ℝ≥0} + (hl : ∀ t, 0 ≤ t → LipschitzWith K (v t)) + {γ δ : ℝ → E} {S T : ℝ} + (hγ : ContinuousOn γ (Icc (0 : ℝ) S)) + (hδ : ContinuousOn δ (Icc (0 : ℝ) T)) + (hdγ : ∀ t ∈ Icc (0 : ℝ) S, HasDerivWithinAt γ (v t (γ t)) (Icc 0 S) t) + (hdδ : ∀ t ∈ Icc (0 : ℝ) T, HasDerivWithinAt δ (v t (δ t)) (Icc 0 T) t) + (hinit : γ 0 = δ 0) {t : ℝ} (ht : 0 ≤ t) (htS : t ≤ S) (htT : t ≤ T) : + γ t = δ t := by + apply ODE_solution_unique_of_mem_Icc_right (s := fun _ => univ) + (fun s hs => (hl s hs.1).lipschitzOnWith) + (hγ.mono (Icc_subset_Icc_right htS)) _ (fun _ _ => mem_univ _) + (hδ.mono (Icc_subset_Icc_right htT)) _ (fun _ _ => mem_univ _) hinit ⟨ht, le_rfl⟩ + · intro s hs + exact (hasDerivWithinAt_forward_of_Icc (hdγ s ⟨hs.1, hs.2.le.trans htS⟩) + (hs.2.trans_le htS)).mono (Ici_subset_Ici.mpr hs.1) + · intro s hs + exact (hasDerivWithinAt_forward_of_Icc (hdδ s ⟨hs.1, hs.2.le.trans htT⟩) + (hs.2.trans_le htT)).mono (Ici_subset_Ici.mpr hs.1) + +theorem exists_global_curve {v : ℝ → E → E} {L K : ℝ≥0} + (hc : ∀ x, ContinuousOn (fun t => v t x) (Ici 0)) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖v t x‖ ≤ L) + (hl : ∀ t, 0 ≤ t → LipschitzWith K (v t)) (a : E) : + ∃ γ : ℝ → E, γ 0 = a ∧ + ∀ t, 0 ≤ t → HasDerivWithinAt γ (v t (γ t)) (Ici 0) t := by + have hex (n : ℕ) := exists_curve_on_interval hc hb hl + (T := (n : ℝ) + 1) (by positivity) a + choose C hC₀ hCcts hCd using hex + have hagree (m n : ℕ) {t : ℝ} (ht : 0 ≤ t) + (htm : t ≤ (m : ℝ) + 1) (htn : t ≤ (n : ℝ) + 1) : C m t = C n t := + curves_agree_on_overlap hl (hCcts m).continuousOn (hCcts n).continuousOn + (hCd m) (hCd n) ((hC₀ m).trans (hC₀ n).symm) ht htm htn + let γ : ℝ → E := fun t => C ⌈t⌉₊ t + have heq (n : ℕ) {t : ℝ} (ht : 0 ≤ t) (htn : t ≤ (n : ℝ) + 1) : γ t = C n t := + hagree ⌈t⌉₊ n ht (by linarith [Nat.le_ceil t]) htn + refine ⟨γ, hC₀ _, fun t ht => ?_⟩ + let n := ⌈t⌉₊ + have htlt : t < (n : ℝ) + 1 := by dsimp [n]; linarith [Nat.le_ceil t] + have hd := hasDerivWithinAt_forward_of_Icc (hCd n t ⟨ht, htlt.le⟩) htlt + have hne : γ =ᶠ[𝓝[Ici 0] t] C n := by + filter_upwards [self_mem_nhdsWithin, + mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds htlt)] with s hs₀ hs₁ + exact heq n hs₀ hs₁.le + rw [heq n ht htlt.le] + exact hd.congr_of_eventuallyEq hne (heq n ht htlt.le) + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology NNReal +open Filter Set Metric + +theorem exists_materialFlow_of_bounded_lipschitz {U : Velocity} {L K : ℝ≥0} + (hc : ∀ x, ContinuousOn (fun t => U t x) (Ici 0)) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖U t x‖ ≤ L) + (hl : ∀ t, 0 ≤ t → LipschitzWith K (U t)) : + ∃ X : MaterialFlow, IsMaterialFlow U X := by + choose γ hγ₀ hγd using exists_global_curve hc hb hl + exact ⟨fun t a => γ a t, hγ₀, hγd⟩ + +theorem materialFlow_unique {U : Velocity} {X Y : MaterialFlow} {K : ℝ≥0} + (hl : ∀ t, 0 ≤ t → LipschitzWith K (U t)) + (hX : IsMaterialFlow U X) (hY : IsMaterialFlow U Y) + {t : ℝ} (ht : 0 ≤ t) (a : Space) : X t a = Y t a := by + apply curves_agree_on_overlap hl + (HasDerivWithinAt.continuousOn (fun s hs => (hX.2 a s hs.1).mono Icc_subset_Ici_self)) + (HasDerivWithinAt.continuousOn (fun s hs => (hY.2 a s hs.1).mono Icc_subset_Ici_self)) + (fun s hs => (hX.2 a s hs.1).mono Icc_subset_Ici_self) + (fun s hs => (hY.2 a s hs.1).mono Icc_subset_Ici_self) + ((hX.1 a).trans (hY.1 a).symm) ht le_rfl le_rfl + +lemma norm_linearMap_le_sum_basis {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + (A : Space →L[ℝ] F) : ‖A‖ ≤ ∑ i : Fin 3, ‖A (Pi.single i 1)‖ := by + apply A.opNorm_le_bound (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + intro x + have he : A x = ∑ i : Fin 3, x i • A (Pi.single i 1) := by + conv_lhs => rw [pi_eq_sum_univ' x] + simp only [map_sum, map_smul] + rw [he] + calc + ‖∑ i : Fin 3, x i • A (Pi.single i 1)‖ ≤ + ∑ i : Fin 3, ‖x i • A (Pi.single i 1)‖ := norm_sum_le _ _ + _ ≤ ∑ i : Fin 3, ‖x‖ * ‖A (Pi.single i 1)‖ := by + apply Finset.sum_le_sum + intro i _ + rw [norm_smul] + exact mul_le_mul_of_nonneg_right (norm_le_pi_norm x i) (norm_nonneg _) + _ = (∑ i : Fin 3, ‖A (Pi.single i 1)‖) * ‖x‖ := by rw [← Finset.mul_sum, mul_comm] + +lemma spatial_lipschitz_of_boundedMixed {U : Velocity} + (hU : JointSmooth U) (hb : BoundedMixed U) : + ∃ K : ℝ≥0, ∀ t, 0 ≤ t → LipschitzWith K (U t) := by + choose C hC hbound using fun i : Fin 3 => hb [some i] + let K : ℝ≥0 := ⟨∑ i, C i, Finset.sum_nonneg (fun i _ => hC i)⟩ + refine ⟨K, fun t ht => lipschitzWith_of_nnnorm_fderiv_le + ((hU.slice t).differentiable (by simp)) (fun x => ?_)⟩ + change ‖fderiv ℝ (U t) x‖ ≤ ∑ i, C i + apply (norm_linearMap_le_sum_basis _).trans + exact Finset.sum_le_sum (fun i _ => hbound i t ht x) + +theorem exists_materialFlow_of_boundedMixed {U : Velocity} + (hU : JointSmooth U) (hb : BoundedMixed U) : + ∃ X : MaterialFlow, IsMaterialFlow U X := by + obtain ⟨L, hL, hbound⟩ := hb [] + obtain ⟨K, hK⟩ := spatial_lipschitz_of_boundedMixed hU hb + apply exists_materialFlow_of_bounded_lipschitz (L := ⟨L, hL⟩) (K := K) + · intro x + exact (hU.continuous.comp (continuous_id.prodMk continuous_const)).continuousOn + · exact hbound + · exact hK + +theorem exists_materialFlow_of_compact_repeating {K : Set Space} (hK : IsCompact K) + {U : Velocity} (hU : JointSmooth U) (hs : SpatiallySupported K U) + (hp : RepeatsAfter 1 U) : ∃ X : MaterialFlow, IsMaterialFlow U X := + exists_materialFlow_of_boundedMixed hU (boundedMixed_of_compact_repeating hK hU hs hp) + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Model.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..f361cc8d034c818dbbde324e893f013114acc4af --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Model.lean @@ -0,0 +1,224 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder + +inductive Direction where + | stay | left | right + deriving DecidableEq + +instance : Fintype Direction := + ⟨{.stay, .left, .right}, by intro d; cases d <;> simp⟩ + +structure Transition (Q Γ : Type*) where + state : Q + write : Γ + move : Direction + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport + +structure FiniteMachine where + states : ℕ + symbols : ℕ + initial : Fin (states + 1) + blank : Fin (symbols + 1) + transition : Fin (states + 1) → Fin (symbols + 1) → + Option (Recorder.Transition (Fin (states + 1)) (Fin (symbols + 1))) + +abbrev Input (M : FiniteMachine) := List (Fin (M.symbols + 1)) + +structure TapeConfiguration (M : FiniteMachine) where + state : Fin (M.states + 1) + head : ℤ + tape : ℤ → Fin (M.symbols + 1) + +def initialConfiguration (M : FiniteMachine) (w : Input M) : TapeConfiguration M := + ⟨M.initial, 0, fun z => if 0 ≤ z then w[z.toNat]?.getD M.blank else M.blank⟩ + +def machineStep (M : FiniteMachine) (c : TapeConfiguration M) : Option (TapeConfiguration M) := + (M.transition c.state (c.tape c.head)).map fun v => + ⟨v.state, c.head + (match v.move with | .stay => 0 | .left => -1 | .right => 1), + Function.update c.tape c.head v.write⟩ + +def Halts (M : FiniteMachine) (w : Input M) : Prop := + ∃ c, Relation.ReflTransGen (fun c d => machineStep M c = some d) + (initialConfiguration M w) c ∧ machineStep M c = none + +def Recorder.Direction.number : Recorder.Direction → ℕ + | .stay => 0 + | .left => 1 + | .right => 2 + +def FiniteMachine.code (M : FiniteMachine) : ℕ := + Encodable.encode (M.states, M.symbols, M.initial.val, M.blank.val, + (List.finRange (M.states + 1)).map fun q => + (List.finRange (M.symbols + 1)).map fun a => + (M.transition q a).map fun v => (v.state.val, v.write.val, v.move.number)) + +def inputCode (M : FiniteMachine) (w : Input M) : ℕ := + Encodable.encode (M.code, w.map Fin.val) + +abbrev Space := Fin 3 → ℝ + +abbrev Field (F : Type*) := ℝ → Space → F + +abbrev Velocity := Field Space + +abbrev Pressure := Field ℝ + +abbrev Family (F : Type*) := (M : FiniteMachine) → Input M → F + +abbrev MaterialFlow := ℝ → Space → Space + +abbrev MultiIndex := List (Option (Fin 3)) + +abbrev RationalPoint := ℚ × (Fin 3 → ℚ) + +end BalancedTransport +end + +noncomputable section +namespace BalancedTransport +open MeasureTheory +open scoped ENNReal +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def timeD (v : Field F) : Field F := + fun t x => derivWithin (fun s => v s x) (Set.Ici 0) t + +def spaceD (i : Fin 3) (v : Field F) : Field F := + fun t x => fderiv ℝ (v t) x (Pi.single i 1) + +def mixedD : MultiIndex → Field F → Field F + | [], v => v + | none :: a, v => timeD (mixedD a v) + | some i :: a, v => spaceD i (mixedD a v) + +def spatialD : List (Fin 3) → Field F → Field F + | [], v => v + | i :: a, v => spaceD i (spatialD a v) + +def Smooth (v : Field F) : Prop := + ContDiffOn ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => v z.1 z.2) (Set.Ici 0 ×ˢ Set.univ) + +def BoundedMixed (v : Field F) : Prop := + ∀ a : MultiIndex, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ C + +def CH (k : ℕ) (v : Field F) : Prop := + ∀ a : List (Fin 3), a.length ≤ k → + ∃ V : ℝ → Lp F 2 (volume : Measure Space), + ContinuousOn V (Set.Ici 0) ∧ + ∀ t, 0 ≤ t → (V t : Space → F) =ᵐ[volume] spatialD a v t + +def C1L2 (v : Field F) : Prop := + ∃ V W : ℝ → Lp F 2 (volume : Measure Space), + ContinuousOn V (Set.Ici 0) ∧ ContinuousOn W (Set.Ici 0) ∧ + ∀ t, 0 ≤ t → + (V t : Space → F) =ᵐ[volume] v t ∧ + (W t : Space → F) =ᵐ[volume] timeD v t ∧ + HasDerivWithinAt V (W t) (Set.Ici 0) t + +def div (u : Velocity) (t : ℝ) (x : Space) : ℝ := + ∑ i, spaceD i u t x i + +def laplacian (u : Velocity) : Velocity := + fun t x => ∑ i, spaceD i (spaceD i u) t x + +def convection (u : Velocity) : Velocity := + fun t x => ∑ i, (u t x i) • spaceD i u t x + +def gradient (p : Pressure) (t : ℝ) (x : Space) : Space := + fun i => spaceD i p t x + +def affineForce (f₀ f₁ : Velocity) (ν : ℝ) : Velocity := + fun t x => f₀ t x + ν • f₁ t x + +def inertialCoefficient (u : Velocity) : Velocity := + fun t x => timeD u t x + convection u t x + +def viscousCoefficient (u : Velocity) : Velocity := + fun t x => -laplacian u t x + +def ZeroDataSolution (ν : ℝ) (f u : Velocity) (p : Pressure) : Prop := + Smooth u ∧ Smooth p ∧ + (∀ x, u 0 x = 0) ∧ + (∀ t, 0 ≤ t → ∀ x, div u t x = 0) ∧ + (∀ t, 0 ≤ t → ∀ x, + timeD u t x + convection u t x = + -gradient p t x + ν • laplacian u t x + f t x) + +def BoundedOnFiniteSlabs (u : Velocity) : Prop := + ∀ T : ℝ, 0 ≤ T → ∃ C : ℝ, 0 ≤ C ∧ + ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ x, + ‖u t x‖ ≤ C ∧ ∀ i : Fin 3, ‖spaceD i u t x‖ ≤ C + +def ComparisonClass (u : Velocity) (p : Pressure) : Prop := + CH 2 u ∧ C1L2 u ∧ BoundedOnFiniteSlabs u ∧ + ∃ c : ℝ → ℝ, CH 1 (fun t x => p t x - c t) + +def UniqueInComparison (ν : ℝ) (f U : Velocity) : Prop := + ∀ u p, ZeroDataSolution ν f u p → ComparisonClass u p → + (∀ t, 0 ≤ t → ∀ x, u t x = U t x) ∧ + (∀ t, 0 ≤ t → ∀ x y, p t x = p t y) + +def CommonCompactSupport (U f₀ f₁ : Velocity) : Prop := + ∃ K : Set Space, IsCompact K ∧ + ∀ t, 0 ≤ t → ∀ x, x ∉ K → U t x = 0 ∧ f₀ t x = 0 ∧ f₁ t x = 0 + +def PeriodicAfterOne (v : Velocity) : Prop := + ∀ t, 1 ≤ t → ∀ x, v (t + 1) x = v t x + +def IsMaterialFlow (u : Velocity) (X : MaterialFlow) : Prop := + (∀ a, X 0 a = a) ∧ + ∀ a t, 0 ≤ t → HasDerivWithinAt (fun s => X s a) (u t (X t a)) (Set.Ici 0) t + +def fixedLabel : Space := ![4, 0, 0] + +def observer : Set Space := + Set.pi Set.univ (fun _ : Fin 3 => Set.Ioo (-1 : ℝ) 2) + +def rationalSpace (x : Fin 3 → ℚ) : Space := fun i => (x i : ℝ) + +def error (n : ℕ) : ℝ := (2 : ℝ)⁻¹ ^ n + +def EffectiveFamily (v : Family Velocity) : Prop := + ∃ E : (ℕ × MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ), + ∃ b : (ℕ × MultiIndex) → ℕ, + ∃ R : ℕ → ℕ, + Computable E ∧ Computable b ∧ Computable R ∧ + (∀ M w a z n, 0 ≤ z.1 → ∀ i, + |(E (inputCode M w, a, z, n) i : ℝ) - + mixedD a (v M w) (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧ + (∀ M w a t, 0 ≤ t → ∀ x, + ‖mixedD a (v M w) t x‖ ≤ (b (inputCode M w, a) : ℝ)) ∧ + (∀ M w t, 0 ≤ t → ∀ x, + (R (inputCode M w) : ℝ) < ‖x‖ → v M w t x = 0) + +def EffectiveFieldIn (O : Set (ℕ →. ℕ)) (v : Velocity) : Prop := + ∃ E : (MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ), + ∃ b : MultiIndex → ℕ, + ComputableIn O E ∧ ComputableIn O b ∧ + (∀ a z n, 0 ≤ z.1 → ∀ i, + |(E (a, z, n) i : ℝ) - + mixedD a v (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧ + (∀ a t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ (b a : ℝ)) + +def RealName (name : ℕ → ℚ) (x : ℝ) : Prop := + ∀ n, |(name n : ℝ) - x| ≤ error n + +def ComputableReal (x : ℝ) : Prop := + ∃ name : ℕ → ℚ, Computable name ∧ RealName name x + +def nameOracle (name : ℕ → ℚ) : ℕ →. ℕ := + fun n => Part.some (Encodable.encode (name n)) + +end BalancedTransport +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Motion.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Motion.lean new file mode 100644 index 0000000000000000000000000000000000000000..07ce8b6e606203c4a2bfcbdf602b87aec1328075 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Motion.lean @@ -0,0 +1,243 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] + +@[ext] structure BoxLayout (ι : Type*) where + center : ι → Space + width : ι → Space + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Geometry.BoxLayout +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] + +def Positive (A : BoxLayout ι) : Prop := ∀ i k, 0 < A.width i k + +def Separated (A : BoxLayout ι) (η : ℝ) : Prop := + ∀ i j, i ≠ j → ∃ k, A.width i k + A.width j k + 4 * η < |A.center i k - A.center j k| + +def Guarded (A : BoxLayout ι) (safe : Set ι) : Prop := + ∀ i ∈ safe, 2 < A.center i 0 - A.width i 0 + +end BalancedTransport.Geometry.BoxLayout +end + +noncomputable section +namespace BalancedTransport.Geometry +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] + +structure BoxMotion (A B : BoxLayout ι) (safe : Set ι) (η : ℝ) where + center : ℝ → ι → Space + width : ℝ → ι → Space + smooth_center : ContDiff ℝ (⊤ : ℕ∞) center + smooth_width : ContDiff ℝ (⊤ : ℕ∞) width + start_center : ∀ t, t ≤ 0 → center t = A.center + start_width : ∀ t, t ≤ 0 → width t = A.width + end_center : ∀ t, 1 ≤ t → center t = B.center + end_width : ∀ t, 1 ≤ t → width t = B.width + positive : ∀ t i k, 0 < width t i k + volume : ∀ t i, ∏ k, width t i k = ∏ k, A.width i k + separation : ∀ t, (BoxLayout.mk (center t) (width t)).Separated η + guard : ∀ t, (BoxLayout.mk (center t) (width t)).Guarded safe + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Geometry.BoxMotion +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] +variable {A B C : BoxLayout ι} {safe : Set ι} {η : ℝ} + +lemma positive_start (m : BoxMotion A B safe η) : A.Positive := by + have hh := m.positive 0 + rwa [m.start_width 0 le_rfl] at hh + +lemma positive_end (m : BoxMotion A B safe η) : B.Positive := by + have hh := m.positive 1 + rwa [m.end_width 1 le_rfl] at hh + +lemma volume_end (m : BoxMotion A B safe η) (i : ι) : + ∏ k, B.width i k = ∏ k, A.width i k := by + simpa only [m.end_width 1 le_rfl] using m.volume 1 i + +def stationary (hp : A.Positive) (hs : A.Separated η) (hg : A.Guarded safe) : + BoxMotion A A safe η where + center := fun _ => A.center + width := fun _ => A.width + smooth_center := contDiff_const + smooth_width := contDiff_const + start_center := fun _ _ => rfl + start_width := fun _ _ => rfl + end_center := fun _ _ => rfl + end_width := fun _ _ => rfl + positive := fun _ => hp + volume := by intros; rfl + separation := fun _ => hs + guard := fun _ => hg + +private def joinedCenter (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) + (t : ℝ) : ι → Space := m.center (2 * t) + n.center (2 * t - 1) - B.center + +private def joinedWidth (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) + (t : ℝ) (i : ι) (k : Fin 3) : ℝ := + m.width (2 * t) i k * n.width (2 * t - 1) i k / B.width i k + +private lemma joined_left (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) + {t : ℝ} (ht : t ≤ 1 / 2) : + joinedCenter m n t = m.center (2 * t) ∧ joinedWidth m n t = m.width (2 * t) := by + have h := n.start_center (2 * t - 1) (by linarith) + have hw := n.start_width (2 * t - 1) (by linarith) + constructor + · simp [joinedCenter, h] + · ext i k + simp [joinedWidth, hw, ne_of_gt (m.positive_end i k)] + +private lemma joined_right (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) + {t : ℝ} (ht : 1 / 2 ≤ t) : + joinedCenter m n t = n.center (2 * t - 1) ∧ joinedWidth m n t = n.width (2 * t - 1) := by + have h := m.end_center (2 * t) (by linarith) + have hw := m.end_width (2 * t) (by linarith) + constructor + · simp [joinedCenter, h, add_sub_cancel_left] + · ext i k + simp [joinedWidth, hw, mul_div_cancel_left₀ _ (ne_of_gt (m.positive_end i k))] + +def trans (m : BoxMotion A B safe η) (n : BoxMotion B C safe η) : + BoxMotion A C safe η where + center := joinedCenter m n + width := joinedWidth m n + smooth_center := by + exact ((m.smooth_center.comp (contDiff_const.mul contDiff_id)).add + (n.smooth_center.comp ((contDiff_const.mul contDiff_id).sub contDiff_const))).sub contDiff_const + smooth_width := by + apply contDiff_pi.mpr + intro i + apply contDiff_pi.mpr + intro k + exact (((contDiff_pi.mp (contDiff_pi.mp m.smooth_width i) k).comp + (contDiff_const.mul contDiff_id)).mul + ((contDiff_pi.mp (contDiff_pi.mp n.smooth_width i) k).comp + ((contDiff_const.mul contDiff_id).sub contDiff_const))).div_const _ + start_center := by + intro t ht + rw [(joined_left m n (by linarith : t ≤ 1 / 2)).1, m.start_center _ (by linarith)] + start_width := by + intro t ht + rw [(joined_left m n (by linarith : t ≤ 1 / 2)).2, m.start_width _ (by linarith)] + end_center := by + intro t ht + rw [(joined_right m n (by linarith : 1 / 2 ≤ t)).1, n.end_center _ (by linarith)] + end_width := by + intro t ht + rw [(joined_right m n (by linarith : 1 / 2 ≤ t)).2, n.end_width _ (by linarith)] + positive := by + intro t i k + rcases le_total t (1 / 2) with ht | ht + · rw [(joined_left m n ht).2]; exact m.positive _ _ _ + · rw [(joined_right m n ht).2]; exact n.positive _ _ _ + volume := by + intro t i + rcases le_total t (1 / 2) with ht | ht + · rw [(joined_left m n ht).2]; exact m.volume _ _ + · rw [(joined_right m n ht).2, n.volume, m.volume_end] + separation := by + intro t + rcases le_total t (1 / 2) with ht | ht + · rw [(joined_left m n ht).1, (joined_left m n ht).2]; exact m.separation _ + · rw [(joined_right m n ht).1, (joined_right m n ht).2]; exact n.separation _ + guard := by + intro t + rcases le_total t (1 / 2) with ht | ht + · rw [(joined_left m n ht).1, (joined_left m n ht).2]; exact m.guard _ + · rw [(joined_right m n ht).1, (joined_right m n ht).2]; exact n.guard _ + +def reverse (m : BoxMotion A B safe η) : BoxMotion B A safe η where + center := fun t => m.center (1 - t) + width := fun t => m.width (1 - t) + smooth_center := m.smooth_center.comp (contDiff_const.sub contDiff_id) + smooth_width := m.smooth_width.comp (contDiff_const.sub contDiff_id) + start_center := fun _ ht => m.end_center _ (by linarith) + start_width := fun _ ht => m.end_width _ (by linarith) + end_center := fun _ ht => m.start_center _ (by linarith) + end_width := fun _ ht => m.start_width _ (by linarith) + positive := fun _ => m.positive _ + volume := fun _ i => (m.volume _ i).trans (m.volume_end i).symm + separation := fun _ => m.separation _ + guard := fun _ => m.guard _ + +end BalancedTransport.Geometry.BoxMotion +end + +noncomputable section +namespace BalancedTransport.Geometry +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] + +def segmentLayout (a b w : ι → Space) (r : ℝ) : BoxLayout ι := + ⟨fun i k => (1 - r) * a i k + r * b i k, w⟩ + +omit [Fintype ι] in +lemma segmentLayout_start (a b w : ι → Space) : segmentLayout a b w 0 = ⟨a, w⟩ := by + ext i k <;> simp [segmentLayout] + +omit [Fintype ι] in +lemma segmentLayout_end (a b w : ι → Space) : segmentLayout a b w 1 = ⟨b, w⟩ := by + ext i k <;> simp [segmentLayout] + +def segmentMotion {a b w : ι → Space} {safe : Set ι} {η : ℝ} + (hp : ∀ i k, 0 < w i k) + (hs : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Separated η) + (hg : ∀ r ∈ Icc (0 : ℝ) 1, (segmentLayout a b w r).Guarded safe) : + BoxMotion ⟨a, w⟩ ⟨b, w⟩ safe η where + center := fun t => (segmentLayout a b w (Real.smoothTransition t)).center + width := fun _ => w + smooth_center := by + unfold segmentLayout + fun_prop + smooth_width := contDiff_const + start_center := by + intro t ht + simp [segmentLayout, Real.smoothTransition.zero_of_nonpos ht] + start_width := by intros; rfl + end_center := by + intro t ht + simp [segmentLayout, Real.smoothTransition.one_of_one_le ht] + end_width := by intros; rfl + positive := fun _ => hp + volume := by intros; rfl + separation := fun _ => hs _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ + guard := fun _ => hg _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ + +omit [Fintype ι] in +lemma segment_guard {a b w : ι → Space} {safe : Set ι} + (ha : (BoxLayout.mk a w).Guarded safe) (hb : (BoxLayout.mk b w).Guarded safe) + {r : ℝ} (hr : r ∈ Icc (0 : ℝ) 1) : (segmentLayout a b w r).Guarded safe := by + intro i hi + have hh₀ := ha i hi + have hh₁ := hb i hi + change 2 < (1 - r) * a i 0 + r * b i 0 - w i 0 + by_cases he : r = 1 + · simpa [he] using hh₁ + · have h₀ : 0 < 1 - r := sub_pos.mpr (lt_of_le_of_ne hr.2 he) + nlinarith [mul_pos (sub_pos.mpr hh₀) h₀, + mul_nonneg (sub_nonneg.mpr (le_of_lt hh₁)) hr.1] + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MotionField.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MotionField.lean new file mode 100644 index 0000000000000000000000000000000000000000..80455b46266587775168c4eccaeec74851edbb82 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/MotionField.lean @@ -0,0 +1,256 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Periodic +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryMotion + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry.BoxLayout +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] + +def solid (A : BoxLayout ι) (i : ι) : Set Space := + Icc (A.center i - A.width i) (A.center i + A.width i) + +omit [Fintype ι] in +lemma mem_solid {A : BoxLayout ι} {i : ι} {x : Space} : x ∈ A.solid i ↔ + ∀ k, A.center i k - A.width i k ≤ x k ∧ x k ≤ A.center i k + A.width i k := by + simp only [solid, mem_Icc, Pi.le_def, Pi.sub_apply, Pi.add_apply] + exact forall_and.symm + +def affineMap (A B : BoxLayout ι) (i : ι) (x : Space) : Space := + fun k => B.center i k + B.width i k / A.width i k * (x k - A.center i k) + +end BalancedTransport.Geometry.BoxLayout +end + +noncomputable section +namespace BalancedTransport.Geometry.BoxMotion +open Set Filter +open scoped Topology +variable {ι : Type*} [Fintype ι] +variable {A B : BoxLayout ι} {safe : Set ι} {η : ℝ} + +def fieldCenter (m : BoxMotion A B safe η) (i : ι) (t : ℝ) : Space := + m.center (2 * t - 1 / 2) i + +def fieldScale (m : BoxMotion A B safe η) (i : ι) (t : ℝ) : Space := + fun k => m.width (2 * t - 1 / 2) i k / A.width i k + +def velocity (m : BoxMotion A B safe η) : Velocity := + familyVelocity (fun i => -A.width i) A.width m.fieldCenter m.fieldScale η + +def path (m : BoxMotion A B safe η) (i : ι) (x : Space) : ℝ → Space := + affinePath (m.fieldCenter i) (m.fieldScale i) (x - A.center i) + +lemma fieldCenter_smooth (m : BoxMotion A B safe η) (i : ι) : + ContDiff ℝ (⊤ : ℕ∞) (m.fieldCenter i) := + (contDiff_pi.mp m.smooth_center i).comp ((contDiff_const.mul contDiff_id).sub contDiff_const) + +lemma fieldScale_smooth (m : BoxMotion A B safe η) (i : ι) : + ContDiff ℝ (⊤ : ℕ∞) (m.fieldScale i) := by + apply contDiff_pi.mpr + intro k + exact (((contDiff_pi.mp (contDiff_pi.mp m.smooth_width i) k).comp + ((contDiff_const.mul contDiff_id).sub contDiff_const))).div_const _ + +lemma fieldScale_pos (m : BoxMotion A B safe η) (i : ι) (t : ℝ) (k : Fin 3) : + 0 < m.fieldScale i t k := div_pos (m.positive _ _ _) (m.positive_start _ _) + +lemma fieldScale_det (m : BoxMotion A B safe η) (i : ι) (t : ℝ) : + ∏ k, m.fieldScale i t k = 1 := by + simp only [fieldScale, Finset.prod_div_distrib, m.volume] + exact div_self (ne_of_gt (Finset.prod_pos (fun k _ => m.positive_start i k))) + +lemma velocity_jointSmooth (m : BoxMotion A B safe η) : JointSmooth m.velocity := + familyVelocity_jointSmooth m.fieldCenter_smooth m.fieldScale_smooth + (fun i t k => (m.fieldScale_pos i t k).ne') _ _ _ + +lemma velocity_divergence (m : BoxMotion A B safe η) (t : ℝ) (x : Space) : + div m.velocity t x = 0 := + familyVelocity_divergence m.fieldCenter_smooth m.fieldScale_smooth + (fun i t k => (m.fieldScale_pos i t k).ne') _ _ _ _ _ + +lemma lowerEndpoint_eq (m : BoxMotion A B safe η) (i : ι) (t : ℝ) : + lowerEndpoint (-A.width i) (m.fieldCenter i) (m.fieldScale i) t = + m.center (2 * t - 1 / 2) i - m.width (2 * t - 1 / 2) i := by + ext k + dsimp [lowerEndpoint, fieldCenter, fieldScale] + field_simp [(m.positive_start i k).ne'] + ring + +lemma upperEndpoint_eq (m : BoxMotion A B safe η) (i : ι) (t : ℝ) : + lowerEndpoint (A.width i) (m.fieldCenter i) (m.fieldScale i) t = + m.center (2 * t - 1 / 2) i + m.width (2 * t - 1 / 2) i := by + ext k + dsimp [lowerEndpoint, fieldCenter, fieldScale] + rw [div_mul_cancel₀ _ (m.positive_start i k).ne'] + +lemma enlarged_disjoint (m : BoxMotion A B safe η) (t : ℝ) : + Pairwise fun i j => Disjoint + (closedEnlargement (lowerEndpoint (-A.width i) (m.fieldCenter i) (m.fieldScale i) t) + (lowerEndpoint (A.width i) (m.fieldCenter i) (m.fieldScale i) t) (2 * η)) + (closedEnlargement (lowerEndpoint (-A.width j) (m.fieldCenter j) (m.fieldScale j) t) + (lowerEndpoint (A.width j) (m.fieldCenter j) (m.fieldScale j) t) (2 * η)) := by + intro i j hij + apply Set.disjoint_left.mpr + intro x hi hj + rw [m.lowerEndpoint_eq, m.upperEndpoint_eq, mem_closedEnlargement] at hi hj + obtain ⟨k, hk⟩ := m.separation (2 * t - 1 / 2) i j hij + have hbound : |m.center (2 * t - 1 / 2) i k - m.center (2 * t - 1 / 2) j k| ≤ + m.width (2 * t - 1 / 2) i k + m.width (2 * t - 1 / 2) j k + 4 * η := by + apply abs_le.mpr + have hi' := hi k + have hj' := hj k + dsimp at hi' hj' + constructor <;> linarith + exact hk.not_ge hbound + +lemma path_start (m : BoxMotion A B safe η) (i : ι) (x : Space) : m.path i x 0 = x := by + ext k + have hc := m.start_center (-(1 / 2)) (by norm_num) + have hw := m.start_width (-(1 / 2)) (by norm_num) + simp only [path, affinePath, fieldCenter, fieldScale, mul_zero, zero_sub, Pi.sub_apply] + rw [hc, hw, div_self (m.positive_start i k).ne', one_mul] + ring + +lemma path_end (m : BoxMotion A B safe η) (i : ι) (x : Space) : + m.path i x 1 = A.affineMap B i x := by + ext k + change m.center (2 * 1 - 1 / 2) i k + + m.width (2 * 1 - 1 / 2) i k / A.width i k * (x k - A.center i k) = _ + rw [m.end_center _ (by norm_num), m.end_width _ (by norm_num)] + rfl + +omit [Fintype ι] in +lemma reference_mem {i : ι} {x : Space} (hx : x ∈ A.solid i) : + x - A.center i ∈ Icc (-A.width i) (A.width i) := by + rw [BoxLayout.mem_solid] at hx + constructor <;> intro k <;> dsimp <;> linarith [(hx k).1, (hx k).2] + +lemma path_hasDerivAt (m : BoxMotion A B safe η) (hη : 0 < η) + {i : ι} {x : Space} (hx : x ∈ A.solid i) (t : ℝ) : + HasDerivAt (m.path i x) (m.velocity t (m.path i x t)) t := by + have hz := reference_mem hx + have hplateau := affinePath_mem_plateau (c := m.fieldCenter i) hη hz (m.fieldScale_pos i t) + unfold path + rw [velocity, familyVelocity_eq_on_plateau hη i hplateau (m.enlarged_disjoint t)] + exact affinePath_hasDerivAt hη (m.fieldCenter_smooth i) (m.fieldScale_smooth i) + (m.fieldScale_pos i) (m.fieldScale_det i) hz t + +lemma path_guarded (m : BoxMotion A B safe η) {i : ι} (hi : i ∈ safe) + {x : Space} (hx : x ∈ A.solid i) (t : ℝ) : m.path i x t ∉ observer := by + intro hobs + have hob : m.path i x t 0 < 2 := (Set.mem_pi.mp hobs 0 (Set.mem_univ _)).2 + have hg := m.guard (2 * t - 1 / 2) i hi + have hz := (reference_mem hx).1 0 + have hp := m.fieldScale_pos i t 0 + have hmul := mul_le_mul_of_nonneg_left hz hp.le + change m.fieldScale i t 0 * (-A.width i 0) ≤ + m.fieldScale i t 0 * (x - A.center i) 0 at hmul + have hlow : m.center (2 * t - 1 / 2) i 0 - m.width (2 * t - 1 / 2) i 0 ≤ m.path i x t 0 := by + have he := congrFun (m.lowerEndpoint_eq i t) 0 + change m.fieldCenter i t 0 + m.fieldScale i t 0 * (-A.width i 0) = + m.center (2 * t - 1 / 2) i 0 - m.width (2 * t - 1 / 2) i 0 at he + change _ ≤ m.fieldCenter i t 0 + m.fieldScale i t 0 * (x - A.center i) 0 + rw [← he] + linarith + exact (lt_of_lt_of_le hg hlow).not_gt hob + +lemma fieldCenter_before (m : BoxMotion A B safe η) (i : ι) {t : ℝ} (ht : t ≤ 1 / 4) : + m.fieldCenter i t = A.center i := by + unfold fieldCenter + rw [m.start_center _ (by linarith)] + +lemma fieldScale_before (m : BoxMotion A B safe η) (i : ι) {t : ℝ} (ht : t ≤ 1 / 4) : + m.fieldScale i t = 1 := by + ext k + change m.width (2 * t - 1 / 2) i k / A.width i k = 1 + rw [m.start_width _ (by linarith), div_self (m.positive_start i k).ne'] + +lemma fieldCenter_after (m : BoxMotion A B safe η) (i : ι) {t : ℝ} (ht : 3 / 4 ≤ t) : + m.fieldCenter i t = B.center i := by + unfold fieldCenter + rw [m.end_center _ (by linarith)] + +lemma fieldScale_after (m : BoxMotion A B safe η) (i : ι) {t : ℝ} (ht : 3 / 4 ≤ t) : + m.fieldScale i t = fun k => B.width i k / A.width i k := by + unfold fieldScale + rw [m.end_width _ (by linarith)] + +lemma velocity_collars (m : BoxMotion A B safe η) : TimeCollars m.velocity := by + intro t ht + apply familyVelocity_zero + · intro i + rcases ht with ht | ht + · have he : m.fieldCenter i =ᶠ[𝓝 t] fun _ => A.center i := by + filter_upwards [Iio_mem_nhds ht] with s hs using m.fieldCenter_before i hs.le + rw [he.deriv_eq, deriv_const] + · have he : m.fieldCenter i =ᶠ[𝓝 t] fun _ => B.center i := by + filter_upwards [Ioi_mem_nhds ht] with s hs using m.fieldCenter_after i hs.le + rw [he.deriv_eq, deriv_const] + · intro i k + rcases ht with ht | ht + · have he : (fun s => m.fieldScale i s k) =ᶠ[𝓝 t] fun _ => (1 : ℝ) := by + filter_upwards [Iio_mem_nhds ht] with s hs + rw [m.fieldScale_before i hs.le] + rfl + rw [he.deriv_eq, deriv_const] + · have he : (fun s => m.fieldScale i s k) =ᶠ[𝓝 t] fun _ => B.width i k / A.width i k := by + filter_upwards [Ioi_mem_nhds ht] with s hs + rw [m.fieldScale_after i hs.le] + rw [he.deriv_eq, deriv_const] + +lemma bounded_geometry (m : BoxMotion A B safe η) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t i k, + |m.center t i k| ≤ C ∧ |m.width t i k| ≤ C := by + obtain ⟨Cc, hc⟩ := (isCompact_Icc (a := (0 : ℝ)) (b := 1)).exists_bound_of_continuousOn + m.smooth_center.continuous.continuousOn + obtain ⟨Cw, hw⟩ := (isCompact_Icc (a := (0 : ℝ)) (b := 1)).exists_bound_of_continuousOn + m.smooth_width.continuous.continuousOn + have hh : ∀ t ∈ Icc (0 : ℝ) 1, ∀ i k, + |m.center t i k| ≤ max 0 (max Cc Cw) ∧ + |m.width t i k| ≤ max 0 (max Cc Cw) := by + intro t ht i k + constructor + · exact (norm_le_pi_norm (m.center t i) k).trans + ((norm_le_pi_norm (m.center t) i).trans ((hc t ht).trans + ((le_max_left _ _).trans (le_max_right _ _)))) + · exact (norm_le_pi_norm (m.width t i) k).trans + ((norm_le_pi_norm (m.width t) i).trans ((hw t ht).trans + ((le_max_right _ _).trans (le_max_right _ _)))) + refine ⟨max 0 (max Cc Cw), le_max_left _ _, fun t i k => ?_⟩ + by_cases ht : t ≤ 0 + · simpa only [m.start_center t ht, m.start_width t ht, + m.start_center 0 le_rfl, m.start_width 0 le_rfl] using hh 0 ⟨le_rfl, by norm_num⟩ i k + · by_cases ht' : 1 ≤ t + · simpa only [m.end_center t ht', m.end_width t ht', + m.end_center 1 le_rfl, m.end_width 1 le_rfl] using hh 1 ⟨by norm_num, le_rfl⟩ i k + · exact hh t ⟨le_of_not_ge ht, le_of_not_ge ht'⟩ i k + +lemma velocity_compact_support (m : BoxMotion A B safe η) (hη : 0 < η) : + ∃ K : Set Space, IsCompact K ∧ SpatiallySupported K m.velocity := by + obtain ⟨C, hC, hb⟩ := m.bounded_geometry + let K : Set Space := Icc (fun _ => -(2 * C + 2 * η)) (fun _ => 2 * C + 2 * η) + refine ⟨K, isCompact_Icc, fun t x hx => image_eq_zero_of_notMem_tsupport ?_⟩ + intro ht + obtain ⟨i, hi⟩ := mem_iUnion.mp (tsupport_familyVelocity_subset + (fun i => -A.width i) A.width m.fieldCenter m.fieldScale hη t ht) + rw [m.lowerEndpoint_eq, m.upperEndpoint_eq, mem_closedEnlargement] at hi + apply hx + constructor <;> intro k + · have hh := hi k + have hbc := (abs_le.mp (hb (2 * t - 1 / 2) i k).1).1 + have hbw := (abs_le.mp (hb (2 * t - 1 / 2) i k).2).2 + dsimp at hh ⊢ + linarith [hh.1] + · have hh := hi k + have hbc := (abs_le.mp (hb (2 * t - 1 / 2) i k).1).2 + have hbw := (abs_le.mp (hb (2 * t - 1 / 2) i k).2).2 + dsimp at hh ⊢ + linarith [hh.2] + +end BalancedTransport.Geometry.BoxMotion +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericAlgebra.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2b8ab9a658395275e698dc1aa3ad0bf52555950 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericAlgebra.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericJets +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ComputabilityRules + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp +variable (d : ℕ) [NeZero d] + +lemma computable_dual : Computable (fun z : Fin d × NumericOp => z.2.dual d z.1) := by + have hi : Computable (fun a : ℕ => Fin.ofNat d a) := + (Primrec.fin_val_iff.mp (Primrec.nat_mod.comp Primrec.id (Primrec.const d))).to_comp + have he : Computable (fun z : Fin d × NumericOp => decide (Fin.ofNat d z.2.left = z.1)) := + Primrec.eq.decide.to_comp.comp (hi.comp (by unfold left; fun_prop)) Computable.fst + have hb : Computable (fun z : Fin d × NumericOp => + if Fin.ofNat d z.2.left = z.1 then (1:ℚ) else 0) := + computable_ite he (Computable.const 1) (Computable.const 0) + have hc (j : Fin 9) : Computable (fun z : Fin d × NumericOp => + dualCase d z.1 j z.2) := by + fin_cases j <;> dsimp only [dualCase, left, right] <;> fun_prop + exact computable_fin_cases (i := fun z => z.2.tag) (by unfold tag; fun_prop) hc + +end BalancedTransport.Effectivity.NumericOp +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericProgram +variable {d : ℕ} [NeZero d] + +lemma computable_jetStep : Computable (fun z : Fin d × NumericProgram => z.2.jetStep z.1) := by + unfold jetStep + have hd : Computable (fun z : (Fin d × NumericProgram) × NumericOp => z.2.dual d z.1.1) := + Computable.comp (f := fun z : Fin d × NumericOp => z.2.dual d z.1) + (g := fun z : (Fin d × NumericProgram) × NumericOp => (z.1.1,z.2)) + (NumericOp.computable_dual d) (by fun_prop) + exact ComputableRules.flatMapList (f := fun z : Fin d × NumericProgram => z.2) + (g := fun z o => o.dual d z.1) Computable.snd + hd + +def literal (q : ℚ) : NumericProgram := [(0,q,0,0)] + +def coordinate (k : Fin d) : NumericProgram := [(1,0,k.val,0)] + +def unary (j : Fin 9) (n : ℕ) (p : NumericProgram) : NumericProgram := p ++ [(j,0,0,n)] + +def binary (j : Fin 9) (p q : NumericProgram) : NumericProgram := + (p ++ q) ++ [(j,0,q.length,0)] + +lemma literal_closed (q : ℚ) : (literal q).Closed := by trivial + +lemma literal_valid (q : ℚ) (x : Fin d → ℝ) : (literal q).Valid x := by + simp [literal, Valid, ValidFrom, NumericOp.Valid, NumericOp.tag] + +lemma literal_real (q : ℚ) (x : Fin d → ℝ) : (literal q).real x = q := rfl + +omit [NeZero d] in +lemma coordinate_closed (k : Fin d) : (coordinate k).Closed := by trivial + +lemma coordinate_valid (k : Fin d) (x : Fin d → ℝ) : (coordinate k).Valid x := by + simp [coordinate, Valid, ValidFrom, NumericOp.Valid, NumericOp.tag] + +lemma coordinate_real (k : Fin d) (x : Fin d → ℝ) : (coordinate k).real x = x k := by + simp [coordinate, real, realFrom, NumericOp.real, NumericOp.tag, NumericOp.left, Fin.ofNat_eq_cast] + +lemma unary_real (j : Fin 9) (n : ℕ) (p : NumericProgram) (x : Fin d → ℝ) : + (unary j n p).real x = NumericOp.real d (j,0,0,n) x (p.realFrom x []) := by + simp [unary, real, realFrom, List.foldl_append] + +lemma unary_valid (j : Fin 9) (n : ℕ) (p : NumericProgram) (x : Fin d → ℝ) + (hp : p.Valid x) (hi : j = 5 → ((n+1:ℕ):ℝ)⁻¹ ≤ p.real x) : + (unary j n p).Valid x := by + exact (validFrom_concat _ _ _ _).mpr ⟨hp, ⟨hi, trivial⟩⟩ + +lemma unary_closed (j : Fin 9) (n : ℕ) (p : NumericProgram) (hp : p.Closed) + (hne : p ≠ []) (hj : j = 4 ∨ j = 5 ∨ j = 7) : (unary j n p).Closed := by + have hn : 0 < p.length := List.length_pos_iff.mpr hne + apply (scopedFrom_concat _ _ _).mpr + refine ⟨hp, ?_⟩ + rcases hj with rfl | rfl | rfl <;> exact ⟨by simpa [NumericOp.Scoped, NumericOp.tag, NumericOp.left] using hn,trivial⟩ + +lemma realFrom_head {s : List ℝ} (hs : 0 < s.length) (t : List ℝ) : + (s ++ t).getD 0 0 = s.getD 0 0 := by + simp only [List.getD, List.getElem?_append_left hs] + +lemma binary_real (j : Fin 9) (p q : NumericProgram) (hq : q.Closed) (hne : q ≠ []) + (x : Fin d → ℝ) : + (binary j p q).real x = + NumericOp.real d (j,0,q.length,0) x (q.realFrom x [] ++ p.realFrom x []) := by + cases q with + | nil => exact (hne rfl).elim + | cons head tail => + simp only [binary, real, realFrom_concat] + rw [realFrom_empty_append (head :: tail) hq] + rfl + +lemma binary_register_left (p q : NumericProgram) (x : Fin d → ℝ) : + (q.realFrom x [] ++ p.realFrom x []).getD q.length 0 = p.real x := by + have he := q.realFrom_length x [] + simp only [List.length_nil, Nat.add_zero] at he + rw [← he] + simp only [List.getD, List.getElem?_append_right (le_refl _), Nat.sub_self] + rfl + +lemma binary_register_right (p q : NumericProgram) (hne : q ≠ []) (x : Fin d → ℝ) : + (q.realFrom x [] ++ p.realFrom x []).getD 0 0 = q.real x := by + apply realFrom_head + simpa only [realFrom_length, List.length_nil, Nat.add_zero] using List.length_pos_iff.mpr hne + +lemma binary_valid (j : Fin 9) (p q : NumericProgram) (hq : q.Closed) (hj : j ≠ 5) + (x : Fin d → ℝ) (hpv : p.Valid x) (hqv : q.Valid x) : (binary j p q).Valid x := by + apply (validFrom_concat _ _ _ _).mpr + refine ⟨(validFrom_concat _ _ _ _).mpr ⟨hpv, + (validFrom_of_closed q hq x _).mpr hqv⟩, ?_⟩ + exact ⟨fun h => (hj h).elim, trivial⟩ + +lemma binary_closed (j : Fin 9) (p q : NumericProgram) (hp : p.Closed) (hq : q.Closed) + (hnep : p ≠ []) (hneq : q ≠ []) (hj : j = 2 ∨ j = 3) : (binary j p q).Closed := by + have hn : 0 < p.length := List.length_pos_iff.mpr hnep + have hqn : 0 < q.length := List.length_pos_iff.mpr hneq + apply (scopedFrom_concat _ _ _).mpr + refine ⟨(scopedFrom_concat _ _ _).mpr ⟨hp, q.scopedFrom_mono (Nat.zero_le _) hq⟩, ?_⟩ + rcases hj with rfl | rfl <;> + simp only [ScopedFrom, NumericOp.Scoped, NumericOp.tag, NumericOp.left, + NumericOp.right, List.length_append] + all_goals exact ⟨⟨by omega, by omega⟩,trivial⟩ + +lemma binary_add_real (p q : NumericProgram) (hq : q.Closed) (hne : q ≠ []) (x : Fin d → ℝ) : + (binary 2 p q).real x = p.real x + q.real x := by + rw [binary_real 2 p q hq hne] + exact congrArg₂ (· + ·) (binary_register_left p q x) (binary_register_right p q hne x) + +lemma binary_mul_real (p q : NumericProgram) (hq : q.Closed) (hne : q ≠ []) (x : Fin d → ℝ) : + (binary 3 p q).real x = p.real x * q.real x := by + rw [binary_real 3 p q hq hne] + exact congrArg₂ (· * ·) (binary_register_left p q x) (binary_register_right p q hne x) + +end BalancedTransport.Effectivity.NumericProgram +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa22a21c606711ff2baf1b055c5ee9d9dbac0dad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericBounds.lean @@ -0,0 +1,163 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericPrograms + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity + +lemma exp_difference_bound {x y T : ℝ} (hx : x ≤ T) (hy : y ≤ T) : + |Real.exp x - Real.exp y| ≤ Real.exp T * |x - y| := by + simpa only [Real.norm_eq_abs] using + (convex_Iic T).norm_image_sub_le_of_norm_deriv_le + (fun z _ => Real.differentiableAt_exp) (fun z hz => by + rw [Real.deriv_exp, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact Real.exp_le_exp.mpr hz) hy hx + +lemma exp_nat_bound (n : ℕ) : Real.exp (n : ℝ) ≤ (3 : ℝ) ^ n := by + rw [← mul_one (n : ℝ), Real.exp_nat_mul] + exact pow_le_pow_left₀ (Real.exp_pos _).le (by linarith [Real.exp_one_lt_d9]) _ + +lemma clipped_inverse_bound {x q c : ℝ} (hc : 0 < c) (hx : c ≤ x) : + |(max c q)⁻¹ - x⁻¹| ≤ c⁻¹ ^ 2 * |q - x| := by + have hm : c ≤ max c q := le_max_left _ _ + have hmp := hc.trans_le hm + have hxp := hc.trans_le hx + have hdist : |max c q - x| ≤ |q - x| := by + rcases le_total c q with h | h + · rw [max_eq_right h] + · rw [max_eq_left h, abs_of_nonpos (sub_nonpos.mpr hx), + abs_of_nonpos (sub_nonpos.mpr (h.trans hx))] + linarith + have hlow : c*c ≤ max c q * x := mul_le_mul hm hx hc.le hmp.le + calc + |(max c q)⁻¹ - x⁻¹| = |max c q - x| / (max c q * x) := by + rw [inv_sub_inv hmp.ne' hxp.ne', abs_div, + abs_of_pos (mul_pos hmp hxp), abs_sub_comm] + _ ≤ |q - x| / (c*c) := div_le_div₀ (abs_nonneg _) hdist (mul_pos hc hc) hlow + _ = c⁻¹ ^ 2 * |q - x| := by rw [div_eq_mul_inv, mul_inv_rev]; ring + +structure RegisterEstimate (p : ℕ) (s : List ℝ) (q : List ℚ) (b : List (ℕ × ℕ)) : Prop where + magnitude : ∀ j, |s.getD j 0| ≤ ((b.getD j (0,0)).1 : ℝ) + accuracy : ∀ j, |(q.getD j 0 : ℝ) - s.getD j 0| ≤ ((b.getD j (0,0)).2 : ℝ) * error p + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp + +lemma estimate (d : ℕ) [NeZero d] (o : NumericOp) (x : Fin d → ℚ) + (p C : ℕ) (s : List ℝ) (q : List ℚ) (b : List (ℕ × ℕ)) + (hi : ∀ i, |(x i : ℝ)| ≤ C) (hb : RegisterEstimate p s q b) (hv : Valid o s) : + |real d o (fun i => (x i : ℝ)) s| ≤ ((bound o C b).1 : ℝ) ∧ + |(rational d o x p q : ℝ) - real d o (fun i => (x i : ℝ)) s| ≤ + ((bound o C b).2 : ℝ) * error p := by + rcases o with ⟨j,r,a,b'⟩ + have hA := hb.magnitude a + have hB := hb.magnitude b' + have hE := hb.accuracy a + have hF := hb.accuracy b' + have herr := error_nonneg p + have herr1 := error_le_one p + have hsize : |(q.getD a 0 : ℝ)| ≤ ((b.getD a (0,0)).1 : ℝ) + + ((b.getD a (0,0)).2 : ℝ) := by + calc + _ ≤ |(q.getD a 0 : ℝ) - s.getD a 0| + |s.getD a 0| := + by simpa only [sub_add_cancel] using abs_add_le ((q.getD a 0 : ℝ) - s.getD a 0) (s.getD a 0) + _ ≤ ((b.getD a (0,0)).2 : ℝ) * error p + ((b.getD a (0,0)).1 : ℝ) := + add_le_add hE hA + _ ≤ _ := by nlinarith [Nat.cast_nonneg (b.getD a (0,0)).2 (α := ℝ)] + fin_cases j <;> simp only [real, rational, rationalCase, bound, boundCase, tag, rat, left, right, Valid] at hv ⊢ + · exact ⟨rat_abs_le_num r, by simp⟩ + · exact ⟨hi _, by simp⟩ + · constructor + · simpa only [Nat.cast_add] using (abs_add_le _ _).trans (add_le_add hA hB) + · push_cast + have he : (q.getD a 0 : ℝ) + (q.getD b' 0 : ℝ) - (s.getD a 0 + s.getD b' 0) = + ((q.getD a 0 : ℝ) - s.getD a 0) + ((q.getD b' 0 : ℝ) - s.getD b' 0) := by ring + rw [he, add_mul] + exact (abs_add_le _ _).trans (add_le_add hE hF) + · constructor + · simpa only [Nat.cast_mul, abs_mul] using + mul_le_mul hA hB (abs_nonneg _) (by positivity) + · push_cast + have he : (q.getD a 0 : ℝ) * (q.getD b' 0 : ℝ) - s.getD a 0 * s.getD b' 0 = + (q.getD a 0 : ℝ) * ((q.getD b' 0 : ℝ) - s.getD b' 0) + + s.getD b' 0 * ((q.getD a 0 : ℝ) - s.getD a 0) := by ring + rw [he] + calc + _ ≤ |(q.getD a 0 : ℝ)| * |(q.getD b' 0 : ℝ) - s.getD b' 0| + + |s.getD b' 0| * |(q.getD a 0 : ℝ) - s.getD a 0| := by + simpa only [abs_mul] using abs_add_le + ((q.getD a 0 : ℝ) * ((q.getD b' 0 : ℝ) - s.getD b' 0)) + (s.getD b' 0 * ((q.getD a 0 : ℝ) - s.getD a 0)) + _ ≤ (((b.getD a (0,0)).1 : ℝ) + (b.getD a (0,0)).2) * + ((b.getD b' (0,0)).2 * error p) + + (b.getD b' (0,0)).1 * ((b.getD a (0,0)).2 * error p) := + add_le_add (mul_le_mul hsize hF (abs_nonneg _) (by positivity)) + (mul_le_mul hB hE (abs_nonneg _) (by positivity)) + _ = _ := by ring + · constructor + · simpa only [abs_neg] using hA + · simpa only [Rat.cast_neg, neg_sub_neg, abs_sub_comm] using hE + · have hh := hv rfl + have hpos : (0 : ℝ) < ((b' + 1 : ℕ) : ℝ)⁻¹ := by positivity + constructor + · rw [abs_inv, abs_of_pos (hpos.trans_le hh)] + have h := inv_anti₀ hpos hh + simpa only [inv_inv] using h + · push_cast + have hh' := clipped_inverse_bound (q := (q.getD a 0 : ℝ)) hpos hh + simp only [inv_inv] at hh' + have hcast : max ((b' : ℝ) + 1)⁻¹ (q.getD a 0 : ℝ) = + max (((b'+1 : ℕ) : ℝ)⁻¹) (q.getD a 0 : ℝ) := by norm_cast + rw [hcast] + calc + _ ≤ (((b'+1 : ℕ) : ℝ) ^ 2) * |(q.getD a 0 : ℝ) - s.getD a 0| := hh' + _ ≤ (((b'+1 : ℕ) : ℝ) ^ 2) * ((b.getD a (0,0)).2 * error p) := + mul_le_mul_of_nonneg_left hE (sq_nonneg _) + _ = _ := by push_cast; ring + · constructor + · exact rhoJet_bound_computable _ _ + · have hL := (rhoJet_lipschitz a).dist_le_mul (q.getD b' 0 : ℝ) (s.getD b' 0) + simp only [Real.dist_eq, NNReal.coe_natCast] at hL + calc + _ ≤ |(rhoApprox a (q.getD b' 0) p : ℝ) - rhoJet a (q.getD b' 0 : ℝ)| + + |rhoJet a (q.getD b' 0 : ℝ) - rhoJet a (s.getD b' 0)| := abs_sub_le _ _ _ + _ ≤ error p + (rhoBound (a + 1) 0 : ℝ) * |(q.getD b' 0 : ℝ) - s.getD b' 0| := + add_le_add (rhoApprox_spec _ _ _) hL + _ ≤ error p + (rhoBound (a + 1) 0 : ℝ) * ((b.getD b' (0,0)).2 * error p) := + add_le_add_right (mul_le_mul_of_nonneg_left hF (Nat.cast_nonneg _)) _ + _ = _ := by push_cast; ring + · constructor + · rw [abs_of_pos (Real.exp_pos _), Nat.cast_pow, Nat.cast_ofNat] + exact (Real.exp_le_exp.mpr (le_abs_self _ |>.trans hA)).trans (exp_nat_bound _) + · have hL := exp_difference_bound (le_abs_self _ |>.trans hsize) + ((le_abs_self _ |>.trans hA).trans (le_add_of_nonneg_right (Nat.cast_nonneg _))) + have hL' : |Real.exp (q.getD a 0 : ℝ) - Real.exp (s.getD a 0)| ≤ + (3 : ℝ)^((b.getD a (0,0)).1 + (b.getD a (0,0)).2) * + ((b.getD a (0,0)).2 * error p) := by + have hh : Real.exp ((b.getD a (0,0)).1 + (b.getD a (0,0)).2) ≤ + (3 : ℝ) ^ ((b.getD a (0,0)).1 + (b.getD a (0,0)).2) := by + simpa only [Nat.cast_add] using exp_nat_bound ((b.getD a (0,0)).1 + (b.getD a (0,0)).2) + exact hL.trans (mul_le_mul hh hE (abs_nonneg _) (by positivity)) + calc + _ ≤ |(expApprox (q.getD a 0) p : ℝ) - Real.exp (q.getD a 0 : ℝ)| + + |Real.exp (q.getD a 0 : ℝ) - Real.exp (s.getD a 0)| := abs_sub_le _ _ _ + _ ≤ error p + (3 : ℝ)^((b.getD a (0,0)).1 + (b.getD a (0,0)).2) * + ((b.getD a (0,0)).2 * error p) := add_le_add (expApprox_spec _ _) hL' + _ = _ := by push_cast; ring + · change (|if 0 < r then Real.log (r : ℝ) else 0| ≤ ↑(r.num.natAbs + r⁻¹.num.natAbs)) ∧ + (|(logApprox r p : ℝ) - (if 0 < r then Real.log (r : ℝ) else 0)| ≤ ((1 : ℕ) : ℝ) * error p) + by_cases hr : 0 < r + · rw [ite_eq_left hr] + exact ⟨log_abs_bound hr, by simpa using logApprox_spec hr p⟩ + · rw [ite_eq_right hr] + exact ⟨by simpa only [abs_zero] using + (Nat.cast_nonneg (r.num.natAbs + r⁻¹.num.natAbs) (α := ℝ)), + by simp [logApprox, hr, error_nonneg]⟩ + +end BalancedTransport.Effectivity.NumericOp +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericDifferentiation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericDifferentiation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f45defb8db0771b35208d14467aec1185a9c903 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericDifferentiation.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericEvaluation + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp +variable (d : ℕ) [NeZero d] + +def differential (k : Fin d) (o : NumericOp) (s v : ℕ → ℝ) : ℝ := + let a := o.left + let b := o.right + match o.tag with + | 0 => 0 + | 1 => if Fin.ofNat d a = k then 1 else 0 + | 2 => v a + v b + | 3 => v a * s b + s a * v b + | 4 => -v a + | 5 => -(v a * (s a)⁻¹ ^ 2) + | 6 => rhoJet (a+1) (s b) * v b + | 7 => Real.exp (s a) * v a + | 8 => 0 + +lemma hasDerivAt (k : Fin d) (o : NumericOp) (x : ℝ → Fin d → ℝ) + (s : ℝ → List ℝ) (v : ℕ → ℝ) (t : ℝ) + (hx : ∀ i, HasDerivAt (fun t => x t i) (if i = k then 1 else 0) t) + (hs : ∀ a, HasDerivAt (fun t => (s t).getD a 0) (v a) t) + (hv : o.Valid (s t)) : + HasDerivAt (fun t => o.real d (x t) (s t)) + (o.differential d k (fun a => (s t).getD a 0) v) t := by + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> dsimp only [real, differential, tag, rat, left, right, Valid] at hv ⊢ + · exact hasDerivAt_const t _ + · exact hx _ + · exact (hs a).add (hs b) + · exact (hs a).mul (hs b) + · exact (hs a).neg + · have hh : (s t).getD a 0 ≠ 0 := ne_of_gt ((by positivity : (0 : ℝ) < ((b+1 : ℕ) : ℝ)⁻¹).trans_le (hv rfl)) + apply HasDerivAt.congr_deriv ((hs a).inv hh) + simp only [div_eq_mul_inv, inv_pow, neg_mul] + · exact (rhoJet_hasDerivAt a ((s t).getD b 0)).comp t (hs b) + · simpa only [mul_comm] using (hs a).exp + · exact hasDerivAt_const t _ + +def dualCase (k : Fin d) (j : Fin 9) (o : NumericOp) : NumericProgram := + let a := o.left + let b := o.right + let z : NumericOp := (0,0,0,0) + match j with + | 0 => [o,z,z,z,z] + | 1 => [o,z,z,z,(0,(if Fin.ofNat d a = k then 1 else 0),0,0)] + | 2 => [(2,0,5*a+4,5*b+4),z,z,z,(2,0,5*a+4,5*b+4)] + | 3 => [(3,0,5*a+4,5*b+4),(3,0,5*a+1,5*b+5), + (3,0,5*a+6,5*b+2),z,(2,0,2,1)] + | 4 => [(4,0,5*a+4,0),z,z,z,(4,0,5*a+4,0)] + | 5 => [(5,0,5*a+4,b),z,(3,0,1,1),(3,0,5*a+3,0),(4,0,0,0)] + | 6 => [(6,0,a,5*b+4),(6,0,a+1,5*b+5),z,z,(3,0,2,5*b+4)] + | 7 => [(7,0,5*a+4,0),z,z,z,(3,0,3,5*a+4)] + | 8 => [o,z,z,z,z] + +def dual (k : Fin d) (o : NumericOp) : NumericProgram := dualCase d k o.tag o + +lemma dual_drop (k : Fin d) (o : NumericOp) (x : Fin d → ℝ) (q : List ℝ) : + ((o.dual d k).realFrom x q).drop 5 = q := by + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> simp [dual, dualCase, NumericProgram.realFrom, tag] + +lemma dual_value (k : Fin d) (o : NumericOp) (x : Fin d → ℝ) (s q : List ℝ) + (h : ∀ a, q.getD (5*a+4) 0 = s.getD a 0) : + ((o.dual d k).realFrom x q).getD 4 0 = o.real d x s := by + simp only [List.getD] at h + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> simp [dual, dualCase, NumericProgram.realFrom, real, tag, rat, left, right, h] + +lemma dual_differential (k : Fin d) (o : NumericOp) (x : Fin d → ℝ) (s q : List ℝ) + (h : ∀ a, q.getD (5*a+4) 0 = s.getD a 0) : + ((o.dual d k).realFrom x q).getD 0 0 = + o.differential d k (fun a => s.getD a 0) (fun a => q.getD (5*a) 0) := by + simp only [List.getD] at h + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> + simp [dual, dualCase, NumericProgram.realFrom, real, differential, tag, rat, left, right, + Nat.add_assoc, h, pow_two] + change (((if Fin.ofNat d a = k then 1 else 0) : ℚ) : ℝ) = + (if Fin.ofNat d a = k then 1 else 0) + by_cases hh : Fin.ofNat d a = k <;> + simp only [hh, ite_true, ite_false, Rat.cast_one, Rat.cast_zero] + +lemma dual_valid (k : Fin d) (o : NumericOp) (x : Fin d → ℝ) (s q : List ℝ) + (h : ∀ a, q.getD (5*a+4) 0 = s.getD a 0) (hv : o.Valid s) : + (o.dual d k).ValidFrom x q := by + simp only [List.getD] at h + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> + simp [dual, dualCase, NumericProgram.ValidFrom, Valid, real, tag, rat, left, right, h] at hv ⊢ + exact hv + +lemma differentiableAt (o : NumericOp) (x : Fin d → ℝ) + (s : (Fin d → ℝ) → List ℝ) + (hs : ∀ a, DifferentiableAt ℝ (fun y => (s y).getD a 0) x) + (hv : o.Valid (s x)) : DifferentiableAt ℝ (fun y => o.real d y (s y)) x := by + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> dsimp only [real, tag, rat, left, right, Valid] at hv ⊢ + · exact differentiableAt_const _ + · exact (differentiable_apply _).differentiableAt + · exact (hs a).add (hs b) + · exact (hs a).mul (hs b) + · exact (hs a).neg + · have hh : (s x).getD a 0 ≠ 0 := ne_of_gt ((by positivity : (0 : ℝ) < ((b+1 : ℕ) : ℝ)⁻¹).trans_le (hv rfl)) + exact (hs a).inv hh + · exact (rhoJet_hasDerivAt a _).differentiableAt.comp x (hs b) + · exact (hs a).exp + · exact differentiableAt_const _ + +end BalancedTransport.Effectivity.NumericOp +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6cd6b69092577dea28ee9905d9c0192fdaab007 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericEvaluation.lean @@ -0,0 +1,169 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericBounds + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp + +lemma magnitude (d : ℕ) [NeZero d] (o : NumericOp) (x : Fin d → ℝ) + (C : ℕ) (s : List ℝ) (b : List (ℕ × ℕ)) + (hi : ∀ i, |x i| ≤ C) (hb : ∀ j, |s.getD j 0| ≤ ((b.getD j (0,0)).1 : ℝ)) + (hv : Valid o s) : |real d o x s| ≤ ((bound o C b).1 : ℝ) := by + rcases o with ⟨j,r,a,b'⟩ + have hA := hb a + have hB := hb b' + fin_cases j <;> + dsimp +instances only [real, bound, boundCase, tag, rat, left, right, Valid] at hv ⊢ + · exact rat_abs_le_num r + · exact hi _ + · simpa only [Nat.cast_add] using (abs_add_le _ _).trans (add_le_add hA hB) + · simpa only [Nat.cast_mul, abs_mul] using mul_le_mul hA hB (abs_nonneg _) (by positivity) + · simpa only [abs_neg] using hA + · have hh := hv rfl + have hpos : (0 : ℝ) < ((b' + 1 : ℕ) : ℝ)⁻¹ := by positivity + rw [abs_inv, abs_of_pos (hpos.trans_le hh)] + simpa only [inv_inv] using inv_anti₀ hpos hh + · exact rhoJet_bound_computable _ _ + · rw [abs_of_pos (Real.exp_pos _), Nat.cast_pow, Nat.cast_ofNat] + exact (Real.exp_le_exp.mpr (le_abs_self _ |>.trans hA)).trans (exp_nat_bound _) + · split_ifs with hr + · exact log_abs_bound hr + · simpa only [abs_zero] using (Nat.cast_nonneg (r.num.natAbs + r⁻¹.num.natAbs) (α := ℝ)) + +end BalancedTransport.Effectivity.NumericOp +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericProgram +variable {d : ℕ} [NeZero d] + +def realFrom (p : NumericProgram) (x : Fin d → ℝ) (s : List ℝ) : List ℝ := + p.foldl (fun s o => o.real d x s :: s) s + +def rationalFrom (p : NumericProgram) (x : Fin d → ℚ) (n : ℕ) (s : List ℚ) : List ℚ := + p.foldl (fun s o => o.rational d x n s :: s) s + +def boundFrom (p : NumericProgram) (C : ℕ) (s : List (ℕ × ℕ)) : List (ℕ × ℕ) := + p.foldl (fun s o => o.bound C s :: s) s + +def ValidFrom (x : Fin d → ℝ) : NumericProgram → List ℝ → Prop + | [], _ => True + | o :: p, s => o.Valid s ∧ ValidFrom x p (o.real d x s :: s) + +def Valid (p : NumericProgram) (x : Fin d → ℝ) : Prop := ValidFrom x p [] + +def real (p : NumericProgram) (x : Fin d → ℝ) : ℝ := (p.realFrom x []).getD 0 0 + +def bound (p : NumericProgram) (C : ℕ) : ℕ × ℕ := (p.boundFrom C []).getD 0 (0,0) + +def approximation (p : NumericProgram) (C : ℕ) (x : Fin d → ℚ) (n : ℕ) : ℚ := + (p.rationalFrom x (n + (p.bound C).2) []).getD 0 0 + +lemma boundFrom_estimate (p : NumericProgram) (x : Fin d → ℚ) (s : List ℝ) + (q : List ℚ) (b : List (ℕ × ℕ)) (n C : ℕ) (hi : ∀ i, |(x i : ℝ)| ≤ C) + (hh : RegisterEstimate n s q b) (hv : p.ValidFrom (fun i => (x i : ℝ)) s) : + RegisterEstimate n (p.realFrom (fun i => (x i : ℝ)) s) (p.rationalFrom x n q) + (p.boundFrom C b) := by + induction p generalizing s q b with + | nil => exact hh + | cons o p ih => + apply ih _ _ _ ?_ hv.2 + have hb := o.estimate d x n C s q b hi hh hv.1 + constructor + · intro j + cases j with + | zero => exact hb.1 + | succ j => exact hh.magnitude j + · intro j + cases j with + | zero => exact hb.2 + | succ j => exact hh.accuracy j + +lemma boundFrom_magnitude (p : NumericProgram) (x : Fin d → ℝ) (s : List ℝ) + (b : List (ℕ × ℕ)) (C : ℕ) (hi : ∀ i, |x i| ≤ C) + (hh : ∀ j, |s.getD j 0| ≤ ((b.getD j (0,0)).1 : ℝ)) + (hv : p.ValidFrom x s) : + ∀ j, |(p.realFrom x s).getD j 0| ≤ (((p.boundFrom C b).getD j (0,0)).1 : ℝ) := by + induction p generalizing s b with + | nil => exact hh + | cons o p ih => + apply ih _ _ ?_ hv.2 + intro j + cases j with + | zero => exact o.magnitude d x C s b hi hh hv.1 + | succ j => exact hh j + +lemma approximation_spec (p : NumericProgram) (C : ℕ) (x : Fin d → ℚ) (n : ℕ) + (hi : ∀ i, |(x i : ℝ)| ≤ C) (hv : p.Valid (fun i => (x i : ℝ))) : + |(p.approximation C x n : ℝ) - p.real (fun i => (x i : ℝ))| ≤ error n := by + have hb := p.boundFrom_estimate x [] [] [] (n + (p.bound C).2) C hi + ⟨by simp, by simp⟩ hv + exact (hb.accuracy 0).trans (nat_mul_error_shift _ _) + +lemma magnitude (p : NumericProgram) (C : ℕ) (x : Fin d → ℝ) + (hi : ∀ i, |x i| ≤ C) (hv : p.Valid x) : |p.real x| ≤ ((p.bound C).1 : ℝ) := + p.boundFrom_magnitude x [] [] C hi (by simp) hv 0 + +lemma computable_rationalStep (d : ℕ) [NeZero d] : + Computable (fun z : (NumericProgram × (Fin d → ℚ) × ℕ × List ℚ) × (List ℚ × NumericOp) => + z.2.2.rational d z.1.2.1 z.1.2.2.1 z.2.1 :: z.2.1) := by + let A := NumericProgram × (Fin d → ℚ) × ℕ × List ℚ + have ho : Computable (fun z : A × (List ℚ × NumericOp) => z.2.2) := + Computable.snd.comp Computable.snd + have hx : Computable (fun z : A × (List ℚ × NumericOp) => z.1.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.fst) + have hp : Computable (fun z : A × (List ℚ × NumericOp) => z.1.2.2.1) := + Computable.fst.comp (Computable.snd.comp (Computable.snd.comp Computable.fst)) + have hs : Computable (fun z : A × (List ℚ × NumericOp) => z.2.1) := + Computable.fst.comp Computable.snd + have hh := (NumericOp.computable_rational d).comp (ho.pair (hx.pair (hp.pair hs))) + exact Primrec.list_cons.to_comp.comp hh hs + +lemma computable_rationalFrom (d : ℕ) [NeZero d] : + Computable (fun z : NumericProgram × (Fin d → ℚ) × ℕ × List ℚ => + rationalFrom z.1 z.2.1 z.2.2.1 z.2.2.2) := by + let A := NumericProgram × (Fin d → ℚ) × ℕ × List ℚ + have hf : Computable (fun z : A => z.1) := Computable.fst + have hg : Computable (fun z : A => z.2.2.2) := + Computable.snd.comp (Computable.snd.comp Computable.snd) + exact computable_foldl hf hg (computable_rationalStep d).to₂ + +lemma computable_boundStep : Computable + (fun z : (NumericProgram × ℕ × List (ℕ × ℕ)) × (List (ℕ × ℕ) × NumericOp) => + z.2.2.bound z.1.2.1 z.2.1 :: z.2.1) := by + let A := NumericProgram × ℕ × List (ℕ × ℕ) + have ho : Computable (fun z : A × (List (ℕ × ℕ) × NumericOp) => z.2.2) := + Computable.snd.comp Computable.snd + have hC : Computable (fun z : A × (List (ℕ × ℕ) × NumericOp) => z.1.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.fst) + have hs : Computable (fun z : A × (List (ℕ × ℕ) × NumericOp) => z.2.1) := + Computable.fst.comp Computable.snd + have hh := NumericOp.computable_bound.comp (ho.pair (hC.pair hs)) + exact Primrec.list_cons.to_comp.comp hh hs + +lemma computable_boundFrom : Computable + (fun z : NumericProgram × ℕ × List (ℕ × ℕ) => boundFrom z.1 z.2.1 z.2.2) := by + let A := NumericProgram × ℕ × List (ℕ × ℕ) + have hf : Computable (fun z : A => z.1) := Computable.fst + have hg : Computable (fun z : A => z.2.2) := Computable.snd.comp Computable.snd + exact computable_foldl hf hg computable_boundStep.to₂ + +lemma computable_bound : Computable₂ bound := by + exact ((Primrec.list_getD (0,0)).to_comp.comp + (computable_boundFrom.comp (Computable.fst.pair (Computable.snd.pair (Computable.const [])))) + (Computable.const 0)) + +lemma computable_approximation (d : ℕ) [NeZero d] : Computable + (fun z : NumericProgram × ℕ × (Fin d → ℚ) × ℕ => + approximation z.1 z.2.1 z.2.2.1 z.2.2.2) := by + have herr : Computable (fun z : NumericProgram × ℕ × (Fin d → ℚ) × ℕ => (z.1.bound z.2.1).2) := Computable.snd.comp (computable_bound.comp Computable.fst (Computable.fst.comp Computable.snd)) + exact (Primrec.list_getD (0 : ℚ)).to_comp.comp + ((computable_rationalFrom d).comp (Computable.fst.pair + ((Computable.fst.comp (Computable.snd.comp Computable.snd)).pair + ((Primrec.nat_add.to_comp.comp (Computable.snd.comp (Computable.snd.comp Computable.snd)) herr).pair + (Computable.const []))))) (Computable.const 0) + +end BalancedTransport.Effectivity.NumericProgram +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca2ef30c13c8a30378df711bf2687e7a23cc6191 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericJets.lean @@ -0,0 +1,146 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericDifferentiation +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericScopes + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp +variable (d : ℕ) [NeZero d] + +lemma dual_register (k : Fin d) (o : NumericOp) (x : Fin d → ℝ) (s : List ℝ) (a : ℕ) : + ((o.dual d k).realFrom x s).getD (5+a) 0 = s.getD a 0 := by + have h := congrArg (fun l : List ℝ => l.getD a 0) (o.dual_drop d k x s) + simpa [List.getD, List.getElem?_drop] using h + +lemma dual_length (k : Fin d) (o : NumericOp) : (o.dual d k).length = 5 := by + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> rfl + +lemma dual_scoped (k : Fin d) (o : NumericOp) {n : ℕ} (h : o.Scoped n) : + (o.dual d k).ScopedFrom (5*n) := by + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> + simp [dual, dualCase, NumericProgram.ScopedFrom, Scoped, tag, left, right] at h ⊢ + all_goals omega + +end BalancedTransport.Effectivity.NumericOp +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericProgram +variable {d : ℕ} [NeZero d] + +def jetStep (k : Fin d) (p : NumericProgram) : NumericProgram := + p.flatMap (NumericOp.dual d k) + +lemma jetStep_length (k : Fin d) (p : NumericProgram) : (p.jetStep k).length = 5*p.length := by + induction p with + | nil => rfl + | cons o p ih => simp only [jetStep, List.flatMap_cons, List.length_append, + NumericOp.dual_length, List.length_cons] at ih ⊢; omega + +lemma jetStep_scoped (k : Fin d) (p : NumericProgram) {n : ℕ} (h : p.ScopedFrom n) : + (p.jetStep k).ScopedFrom (5*n) := by + induction p generalizing n with + | nil => trivial + | cons o p ih => + rw [jetStep, List.flatMap_cons, scopedFrom_concat, NumericOp.dual_length] + exact ⟨o.dual_scoped d k h.1, by simpa [jetStep, Nat.mul_add] using ih h.2⟩ + +lemma jetStep_closed (k : Fin d) (p : NumericProgram) (h : p.Closed) : + (p.jetStep k).Closed := p.jetStep_scoped k h + +lemma jetStep_validFrom (k : Fin d) (p : NumericProgram) (x : Fin d → ℝ) + (s q : List ℝ) (h : ∀ a, q.getD (5*a+4) 0 = s.getD a 0) (hv : p.ValidFrom x s) : + (p.jetStep k).ValidFrom x q ∧ + ∀ a, ((p.jetStep k).realFrom x q).getD (5*a+4) 0 = (p.realFrom x s).getD a 0 := by + induction p generalizing s q with + | nil => exact ⟨trivial, h⟩ + | cons o p ih => + have ho := o.dual_valid d k x s q h hv.1 + have hh (a : ℕ) : ((o.dual d k).realFrom x q).getD (5*a+4) 0 = + (o.real d x s :: s).getD a 0 := by + cases a with + | zero => exact o.dual_value d k x s q h + | succ a => + simpa only [Nat.mul_add, Nat.mul_one, Nat.add_assoc, Nat.add_comm 5, + List.getD_cons_succ] using (o.dual_register d k x q (5*a+4)).trans (h a) + have hi := ih _ _ hh hv.2 + refine ⟨?_, ?_⟩ + · exact (validFrom_concat _ _ x q).mpr ⟨ho, hi.1⟩ + · simpa only [jetStep, List.flatMap_cons, realFrom_concat, realFrom, + List.foldl_cons, List.foldl_append] using hi.2 + +lemma jetStep_valid (k : Fin d) (p : NumericProgram) {x : Fin d → ℝ} (hv : p.Valid x) : + (p.jetStep k).Valid x := (p.jetStep_validFrom k x [] [] (by simp) hv).1 + +lemma jetStep_hasDerivAtFrom (k : Fin d) (p : NumericProgram) + (x : ℝ → Fin d → ℝ) (s : ℝ → List ℝ) (q : List ℝ) (t : ℝ) + (hx : ∀ i, HasDerivAt (fun t => x t i) (if i = k then 1 else 0) t) + (h : ∀ a, q.getD (5*a+4) 0 = (s t).getD a 0) + (hs : ∀ a, HasDerivAt (fun t => (s t).getD a 0) (q.getD (5*a) 0) t) + (hv : p.ValidFrom (x t) (s t)) : + ∀ a, HasDerivAt (fun t => (p.realFrom (x t) (s t)).getD a 0) + (((p.jetStep k).realFrom (x t) q).getD (5*a) 0) t := by + induction p generalizing s q with + | nil => exact hs + | cons o p ih => + let s' : ℝ → List ℝ := fun v => o.real d (x v) (s v) :: s v + let q' : List ℝ := (o.dual d k).realFrom (x t) q + have hh (a : ℕ) : q'.getD (5*a+4) 0 = (s' t).getD a 0 := by + cases a with + | zero => exact o.dual_value d k (x t) (s t) q h + | succ a => + simpa only [Nat.mul_add, Nat.mul_one, Nat.add_assoc, Nat.add_comm 5, s', q', + List.getD_cons_succ] using (o.dual_register d k (x t) q (5*a+4)).trans (h a) + have hd (a : ℕ) : HasDerivAt (fun v => (s' v).getD a 0) (q'.getD (5*a) 0) t := by + cases a with + | zero => + change HasDerivAt (fun v => o.real d (x v) (s v)) + (((o.dual d k).realFrom (x t) q).getD 0 0) t + rw [o.dual_differential d k (x t) (s t) q h] + exact o.hasDerivAt d k x s _ t hx hs hv.1 + | succ a => + change HasDerivAt (fun v => (s v).getD a 0) + (((o.dual d k).realFrom (x t) q).getD (5*(a+1)) 0) t + rw [show 5*(a+1)=5+5*a by omega, o.dual_register d k] + exact hs a + have hi := ih s' q' hh hd hv.2 + simpa only [jetStep, List.flatMap_cons, realFrom_concat, realFrom, + List.foldl_cons, List.foldl_append, s', q'] using hi + +lemma differentiableAtFrom (p : NumericProgram) (x : Fin d → ℝ) + (s : (Fin d → ℝ) → List ℝ) + (hs : ∀ a, DifferentiableAt ℝ (fun y => (s y).getD a 0) x) + (hv : p.ValidFrom x (s x)) : + ∀ a, DifferentiableAt ℝ (fun y => (p.realFrom y (s y)).getD a 0) x := by + induction p generalizing s with + | nil => exact hs + | cons o p ih => + apply ih (fun y => o.real d y (s y) :: s y) ?_ hv.2 + intro a + cases a with + | zero => exact o.differentiableAt d x s hs hv.1 + | succ a => exact hs a + +lemma differentiableAt (p : NumericProgram) (x : Fin d → ℝ) (hv : p.Valid x) : + DifferentiableAt ℝ p.real x := + p.differentiableAtFrom x (fun _ => []) (fun _ => differentiableAt_const _) hv 0 + +lemma jetStep_real (k : Fin d) (p : NumericProgram) (x : Fin d → ℝ) (hv : p.Valid x) : + (p.jetStep k).real x = fderiv ℝ p.real x (Pi.single k 1) := by + let y : ℝ → Fin d → ℝ := fun t => x + t • Pi.single k 1 + have hy (i : Fin d) : HasDerivAt (fun t => y t i) (if i=k then 1 else 0) 0 := by + have h := (hasDerivAt_const (0:ℝ) (x i)).add ((hasDerivAt_id (0:ℝ)).mul_const ((Pi.single k (1:ℝ) : Fin d → ℝ) i)) + simpa only [y, Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.single_apply, + Function.const_apply, Pi.mul_apply, id_eq, mul_ite, mul_one, mul_zero, eq_comm, Pi.add_def, zero_add] using h + have he : y 0 = x := by simp [y] + have hh := p.jetStep_hasDerivAtFrom k y (fun _ => []) [] 0 hy (by simp) + (by intro a; simpa using hasDerivAt_const (0:ℝ) (0:ℝ)) (by change p.Valid (y 0); rw [he]; exact hv) 0 + have hf := (p.differentiableAt x hv).hasFDerivAt.hasLineDerivAt (Pi.single k 1) + exact HasDerivAt.unique (by simpa only [real, he, Nat.mul_zero] using hh) hf + +end BalancedTransport.Effectivity.NumericProgram +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericPrograms.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericPrograms.lean new file mode 100644 index 0000000000000000000000000000000000000000..99e20b71fd7a17faf61c6fd3c69982a4cce94241 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericPrograms.lean @@ -0,0 +1,206 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveLog + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity + +lemma computable_foldl {α β σ : Type*} [Primcodable α] [Primcodable β] [Primcodable σ] + [Inhabited β] {f : α → List β} {g : α → σ} {h : α → σ × β → σ} + (hf : Computable f) (hg : Computable g) (hh : Computable₂ h) : + Computable (fun a => (f a).foldl (fun s b => h a (s,b)) (g a)) := by + have hc : Computable (fun a => Nat.rec (motive := fun _ => σ) (g a) + (fun j v => h a (v, (f a).getD j default)) (f a).length) := + Computable.nat_rec (Computable.list_length.comp hf) hg + (hh.comp Computable.fst ((Computable.snd.comp Computable.snd).pair + ((Primrec.list_getD default).to_comp.comp (hf.comp Computable.fst) + (Computable.fst.comp Computable.snd)))).to₂ + apply hc.of_eq + intro a + have he (n : ℕ) (hn : n ≤ (f a).length) : Nat.rec (motive := fun _ => σ) (g a) + (fun j v => h a (v, (f a).getD j default)) n = + ((f a).take n).foldl (fun s b => h a (s,b)) (g a) := by + induction n with + | zero => simp + | succ n ih => + have hl : n < (f a).length := by omega + change h a (Nat.rec (motive := fun _ => σ) (g a) + (fun j v => h a (v, (f a).getD j default)) n, (f a).getD n default) = _ + rw [ih (by omega), List.take_succ_eq_append_getElem hl, + List.foldl_concat] + rw [List.getD_eq_getElem _ _ hl] + simpa using he (f a).length le_rfl + +lemma computable_fin_cases {α β : Type*} [Primcodable α] [Primcodable β] + [Inhabited β] {n : ℕ} {i : α → Fin n} {f : Fin n → α → β} + (hi : Computable i) (hf : ∀ j, Computable (f j)) : + Computable (fun a => f (i a) a) := by + have hl : Computable (fun a => List.ofFn (fun j => f j a)) := + Computable.list_ofFn hf + exact ((Primrec.list_getD default).to_comp.comp hl (Primrec.fin_val.to_comp.comp hi)).of_eq + (fun a => by simp) + +abbrev NumericOp := Fin 9 × ℚ × ℕ × ℕ + +abbrev NumericProgram := List NumericOp + +end BalancedTransport.Effectivity +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp + +def tag (o : NumericOp) : Fin 9 := o.1 + +def rat (o : NumericOp) : ℚ := o.2.1 + +def left (o : NumericOp) : ℕ := o.2.2.1 + +def right (o : NumericOp) : ℕ := o.2.2.2 + +noncomputable def real (d : ℕ) [NeZero d] (o : NumericOp) (x : Fin d → ℝ) + (s : List ℝ) : ℝ := + let a := o.left + let b := o.right + let q := o.rat + match o.tag with + | 0 => q + | 1 => x (Fin.ofNat d a) + | 2 => s.getD a 0 + s.getD b 0 + | 3 => s.getD a 0 * s.getD b 0 + | 4 => -s.getD a 0 + | 5 => (s.getD a 0)⁻¹ + | 6 => rhoJet a (s.getD b 0) + | 7 => Real.exp (s.getD a 0) + | 8 => if 0 < q then Real.log (q : ℝ) else 0 + +noncomputable def rationalCase (d : ℕ) [NeZero d] (j : Fin 9) (o : NumericOp) (x : Fin d → ℚ) + (p : ℕ) (s : List ℚ) : ℚ := + let a := o.left + let b := o.right + let q := o.rat + match j with + | 0 => q + | 1 => x (Fin.ofNat d a) + | 2 => s.getD a 0 + s.getD b 0 + | 3 => s.getD a 0 * s.getD b 0 + | 4 => -s.getD a 0 + | 5 => (max ((b + 1 : ℕ) : ℚ)⁻¹ (s.getD a 0))⁻¹ + | 6 => rhoApprox a (s.getD b 0) p + | 7 => expApprox (s.getD a 0) p + | 8 => logApprox q p + +noncomputable def rational (d : ℕ) [NeZero d] (o : NumericOp) (x : Fin d → ℚ) + (p : ℕ) (s : List ℚ) : ℚ := rationalCase d o.tag o x p s + +def boundCase (j : Fin 9) (o : NumericOp) (C : ℕ) (s : List (ℕ × ℕ)) : ℕ × ℕ := + let a := o.left + let b := o.right + let q := o.rat + let A := (s.getD a (0,0)).1 + let E := (s.getD a (0,0)).2 + let B := (s.getD b (0,0)).1 + let F := (s.getD b (0,0)).2 + match j with + | 0 => (q.num.natAbs, 0) + | 1 => (C, 0) + | 2 => (A + B, E + F) + | 3 => (A * B, (A + E) * F + B * E) + | 4 => (A, E) + | 5 => (b + 1, (b + 1)^2 * E) + | 6 => (rhoBound a 0, 1 + rhoBound (a+1) 0 * F) + | 7 => (3^A, 1 + 3^(A+E) * E) + | 8 => (q.num.natAbs + q⁻¹.num.natAbs, 1) + +def bound (o : NumericOp) (C : ℕ) (s : List (ℕ × ℕ)) : ℕ × ℕ := + boundCase o.tag o C s + +def Valid (o : NumericOp) (s : List ℝ) : Prop := + o.tag = 5 → ((o.right + 1 : ℕ) : ℝ)⁻¹ ≤ s.getD o.left 0 + +lemma computable_rational (d : ℕ) [NeZero d] : + Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => + rational d z.1 z.2.1 z.2.2.1 z.2.2.2) := by + have ha : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => z.1.left) := + Computable.fst.comp (Computable.snd.comp (Computable.snd.comp Computable.fst)) + have hb : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => z.1.right) := + Computable.snd.comp (Computable.snd.comp (Computable.snd.comp Computable.fst)) + have hq : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => z.1.rat) := + Computable.fst.comp (Computable.snd.comp Computable.fst) + have hs : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => z.2.2.2) := + Computable.snd.comp (Computable.snd.comp Computable.snd) + have hp : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => z.2.2.1) := + Computable.fst.comp (Computable.snd.comp Computable.snd) + have hva := (Primrec.list_getD (0 : ℚ)).to_comp.comp hs ha + have hvb := (Primrec.list_getD (0 : ℚ)).to_comp.comp hs hb + have hi : Primrec (fun a : ℕ => Fin.ofNat d a) := + Primrec.fin_val_iff.mp (Primrec.nat_mod.comp Primrec.id (Primrec.const d)) + have hmax : Computable₂ (fun a b : ℚ => max a b) := by + exact (computable_ite computable_rat_le Computable.snd Computable.fst).of_eq + (fun p => by split_ifs with h <;> simp [max_def, h]) + have hc (j : Fin 9) : Computable (fun z : NumericOp × (Fin d → ℚ) × ℕ × List ℚ => + rationalCase d j z.1 z.2.1 z.2.2.1 z.2.2.2) := by + fin_cases j <;> dsimp only [rationalCase, rat, left, right] + · simpa only [left, right, rat] using hq + · simpa only [left, right, rat, id_eq] using Computable.fin_app.comp (Computable.fst.comp Computable.snd) (hi.to_comp.comp ha) + · simpa only [left, right, rat] using computable_rat_add.comp hva hvb + · simpa only [left, right, rat] using computable_rat_mul.comp hva hvb + · simpa only [left, right, rat] using computable_rat_neg.comp hva + · simpa only [left, right, rat] using computable_rat_inv.comp (hmax.comp + (computable_rat_inv.comp (computable_rat_natCast.comp (Computable.succ.comp hb))) hva) + · simpa only [left, right, rat] using computable_rhoApprox.comp (ha.pair (hvb.pair hp)) + · simpa only [left, right, rat] using computable_expApprox.comp hva hp + · simpa only [left, right, rat] using computable_logApprox.comp hq hp + have H := computable_fin_cases (i := fun z => z.1.tag) + (Computable.fst.comp Computable.fst) hc + simpa only [rational] using H + +lemma computable_bound : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => + bound z.1 z.2.1 z.2.2) := by + have ha : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => z.1.left) := + Computable.fst.comp (Computable.snd.comp (Computable.snd.comp Computable.fst)) + have hb : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => z.1.right) := + Computable.snd.comp (Computable.snd.comp (Computable.snd.comp Computable.fst)) + have hq : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => z.1.rat) := + Computable.fst.comp (Computable.snd.comp Computable.fst) + have hs : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => z.2.2) := + Computable.snd.comp Computable.snd + have hva := (Primrec.list_getD (0,0)).to_comp.comp hs ha + have hvb := (Primrec.list_getD (0,0)).to_comp.comp hs hb + have hA := Computable.fst.comp hva + have hE := Computable.snd.comp hva + have hB := Computable.fst.comp hvb + have hF := Computable.snd.comp hvb + have hadd := Primrec.nat_add.to_comp + have hmul := Primrec.nat_mul.to_comp + have hpow : Computable₂ (fun a b : ℕ => a ^ b) := by + exact (((Primrec.nat_iff.mpr Nat.Primrec.pow).comp Primrec.encode).of_eq + (fun p => by rcases p with ⟨a,b⟩; change (Nat.unpair (Nat.pair a b)).1 ^ (Nat.unpair (Nat.pair a b)).2 = a ^ b; rw [Nat.unpair_pair])).to_comp + have hn := primrec_int_natAbs.to_comp.comp (computable_rat_num.comp hq) + have hc (j : Fin 9) : Computable (fun z : NumericOp × ℕ × List (ℕ × ℕ) => + boundCase j z.1 z.2.1 z.2.2) := by + fin_cases j <;> dsimp only [boundCase, rat, left, right] + · simpa only [left, right, rat] using hn.pair (Computable.const 0) + · simpa only [left, right, rat] using (Computable.fst.comp Computable.snd).pair (Computable.const 0) + · simpa only [left, right, rat] using (hadd.comp hA hB).pair (hadd.comp hE hF) + · simpa only [left, right, rat] using (hmul.comp hA hB).pair + (hadd.comp (hmul.comp (hadd.comp hA hE) hF) (hmul.comp hB hE)) + · simpa only [left, right, rat] using hva + · simpa only [left, right, rat] using (Computable.succ.comp hb).pair + (hmul.comp (hpow.comp (Computable.succ.comp hb) (Computable.const 2)) hE) + · simpa only [left, right, rat] using (primrec_rhoBound.to_comp.comp ha (Computable.const 0)).pair + (hadd.comp (Computable.const 1) (hmul.comp + (primrec_rhoBound.to_comp.comp (Computable.succ.comp ha) (Computable.const 0)) hF)) + · simpa only [left, right, rat] using (hpow.comp (Computable.const 3) hA).pair + (hadd.comp (Computable.const 1) (hmul.comp + (hpow.comp (Computable.const 3) (hadd.comp hA hE)) hE)) + · simpa only [left, right, rat] using (hadd.comp hn (primrec_int_natAbs.to_comp.comp + (computable_rat_num.comp (computable_rat_inv.comp hq)))).pair (Computable.const 1) + have H := computable_fin_cases (i := fun z => z.1.tag) + (Computable.fst.comp Computable.fst) hc + simpa only [bound] using H + +end BalancedTransport.Effectivity.NumericOp +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericScopes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericScopes.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ce637e0a7d42e5d2a81c387f1452b27efad56bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/NumericScopes.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.NumericEvaluation + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity.NumericOp + +def Scoped (o : NumericOp) (n : ℕ) : Prop := + let a := o.left + let b := o.right + match o.tag with + | 0 => True + | 1 => True + | 2 => a < n ∧ b < n + | 3 => a < n ∧ b < n + | 4 => a < n + | 5 => a < n + | 6 => b < n + | 7 => a < n + | 8 => True + +lemma real_append (d : ℕ) [NeZero d] (o : NumericOp) (x : Fin d → ℝ) + (s q : List ℝ) (hs : o.Scoped s.length) : o.real d x (s ++ q) = o.real d x s := by + have he (i : ℕ) (hi : i < s.length) : (s ++ q).getD i 0 = s.getD i 0 := by + simp [List.getD, List.getElem?_append_left hi] + rcases o with ⟨j,r,a,b⟩ + fin_cases j <;> simp only [Scoped, real, tag, rat, left, right] at hs ⊢ + all_goals first | rfl | exact he _ hs | simp only [he _ hs] | simp only [he _ hs.1, he _ hs.2] + +lemma valid_append (o : NumericOp) (s q : List ℝ) (hs : o.Scoped s.length) : + o.Valid (s ++ q) ↔ o.Valid s := by + by_cases ht : o.tag = 5 + · have hh : o.left < s.length := by unfold Scoped at hs; rw [ht] at hs; exact hs + simp only [Valid, ht, forall_const] + simp only [List.getD, List.getElem?_append_left hh] + · simp [Valid, ht] + +end BalancedTransport.Effectivity.NumericOp +end + +noncomputable section +namespace BalancedTransport.Effectivity.NumericProgram +variable {d : ℕ} [NeZero d] + +def ScopedFrom : NumericProgram → ℕ → Prop + | [], _ => True + | o::p, n => o.Scoped n ∧ ScopedFrom p (n+1) + +def Closed (p : NumericProgram) : Prop := p.ScopedFrom 0 + +lemma realFrom_length (p : NumericProgram) (x : Fin d → ℝ) (s : List ℝ) : + (realFrom p x s).length = p.length + s.length := by + induction p generalizing s with + | nil => simp [realFrom] + | cons o p ih => simpa [realFrom, Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (o.real d x s :: s) + +lemma realFrom_append (p : NumericProgram) (x : Fin d → ℝ) (s q : List ℝ) + (hs : p.ScopedFrom s.length) : realFrom p x (s ++ q) = realFrom p x s ++ q := by + induction p generalizing s with + | nil => rfl + | cons o p ih => + change realFrom p x (o.real d x (s ++ q) :: (s ++ q)) = + realFrom p x (o.real d x s :: s) ++ q + rw [o.real_append d x s q hs.1] + exact ih (o.real d x s :: s) hs.2 + +lemma validFrom_append (p : NumericProgram) (x : Fin d → ℝ) (s q : List ℝ) + (hs : p.ScopedFrom s.length) : ValidFrom x p (s ++ q) ↔ ValidFrom x p s := by + induction p generalizing s with + | nil => rfl + | cons o p ih => + change o.Valid (s ++ q) ∧ ValidFrom x p (o.real d x (s ++ q) :: (s ++ q)) ↔ + o.Valid s ∧ ValidFrom x p (o.real d x s :: s) + rw [o.valid_append s q hs.1, o.real_append d x s q hs.1] + exact and_congr_right (fun _ => ih (o.real d x s :: s) hs.2) + +lemma realFrom_empty_append (p : NumericProgram) (hp : p.Closed) (x : Fin d → ℝ) (s : List ℝ) : + realFrom p x s = realFrom p x [] ++ s := + realFrom_append p x [] s hp + +lemma validFrom_of_closed (p : NumericProgram) (hp : p.Closed) (x : Fin d → ℝ) (s : List ℝ) : + ValidFrom x p s ↔ p.Valid x := p.validFrom_append x [] s hp + +lemma realFrom_concat (p q : NumericProgram) (x : Fin d → ℝ) (s : List ℝ) : + (p ++ q).realFrom x s = q.realFrom x (realFrom p x s) := List.foldl_append + +lemma validFrom_concat (p q : NumericProgram) (x : Fin d → ℝ) (s : List ℝ) : + (p ++ q).ValidFrom x s ↔ ValidFrom x p s ∧ q.ValidFrom x (realFrom p x s) := by + induction p generalizing s with + | nil => simp [ValidFrom, realFrom] + | cons o p ih => simpa only [List.cons_append, ValidFrom, realFrom, + List.foldl_cons, and_assoc] using and_congr_right (fun _ => ih _) + +lemma scopedFrom_mono (p : NumericProgram) {n m : ℕ} (hnm : n ≤ m) : + p.ScopedFrom n → p.ScopedFrom m := by + intro h + induction p generalizing n m with + | nil => trivial + | cons o p ih => + refine ⟨?_, ih (Nat.add_le_add_right hnm 1) h.2⟩ + rcases o with ⟨j,r,a,b⟩ + have ho := h.1 + fin_cases j <;> dsimp only [NumericOp.Scoped, NumericOp.tag, NumericOp.rat, + NumericOp.left, NumericOp.right] at ho ⊢ + all_goals first | trivial | exact ho.trans_le hnm | exact ⟨ho.1.trans_le hnm,ho.2.trans_le hnm⟩ + +lemma scopedFrom_concat (p q : NumericProgram) (n : ℕ) : + (p ++ q).ScopedFrom n ↔ p.ScopedFrom n ∧ q.ScopedFrom (n+p.length) := by + induction p generalizing n with + | nil => simp [ScopedFrom] + | cons o p ih => + simp only [List.cons_append, ScopedFrom, List.length_cons] + rw [ih] + simp only [Nat.add_assoc, Nat.add_comm 1, and_assoc] + +end BalancedTransport.Effectivity.NumericProgram +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/OracleComputability.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/OracleComputability.lean new file mode 100644 index 0000000000000000000000000000000000000000..c22fcbb2115b94267134118d970c0fbc22b55f1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/OracleComputability.lean @@ -0,0 +1,53 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Encodable +variable {α β γ : Type*} [Primcodable α] [Primcodable β] [Primcodable γ] +variable {O : Set (ℕ →. ℕ)} + +lemma computableIn_of_eq {f g : α → β} (hf : ComputableIn O f) + (h : ∀ a, f a = g a) : ComputableIn O g := (funext h) ▸ hf + +lemma computableIn_pair {f : α → β} {g : α → γ} (hf : ComputableIn O f) + (hg : ComputableIn O g) : ComputableIn O (fun a => (f a, g a)) := by + apply Nat.RecursiveIn.of_eq (Nat.RecursiveIn.pair hf hg) + intro n + cases decode (α := α) n <;> simp [Seq.seq] + +lemma computableIn_comp {f : β → γ} {g : α → β} (hf : ComputableIn O f) + (hg : ComputableIn O g) : ComputableIn O (fun a => f (g a)) := by + apply Nat.RecursiveIn.of_eq (Nat.RecursiveIn.comp hf hg) + intro n + cases decode (α := α) n <;> simp + +lemma computableIn_comp₂ {δ : Type*} [Primcodable δ] {f : β → γ → δ} + {g : α → β} {h : α → γ} (hf : ComputableIn₂ O f) + (hg : ComputableIn O g) (hh : ComputableIn O h) : + ComputableIn O (fun a => f (g a) (h a)) := + computableIn_comp hf (computableIn_pair hg hh) + +lemma computableIn_fin_triple (f g h : α → β) (hf : ComputableIn O f) + (hg : ComputableIn O g) (hh : ComputableIn O h) : + ComputableIn O (fun a => ![f a, g a, h a]) := by + have hv : Primrec₂ (fun i : Fin 3 => fun p : β × β × β => (![p.1, p.2.1, p.2.2] : Fin 3 → β) i) := by + apply Primrec.fin_curry₁.mpr + intro i + fin_cases i + · exact Primrec.fst + · exact Primrec.fst.comp Primrec.snd + · exact Primrec.snd.comp Primrec.snd + have hc : Primrec (fun p : β × β × β => ![p.1, p.2.1, p.2.2]) := + Primrec.fin_curry.mpr (hv.comp Primrec.snd Primrec.fst) + exact computableIn_comp hc.computableIn (computableIn_pair hf (computableIn_pair hg hh)) + +lemma computableIn_fin_eval {n : ℕ} {f : α → (Fin n → β)} (hf : ComputableIn O f) + (i : Fin n) : ComputableIn O (fun a => f a i) := + computableIn_comp (Primrec.fin_app.comp Primrec.id (Primrec.const i)).computableIn hf + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Parking.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Parking.lean new file mode 100644 index 0000000000000000000000000000000000000000..b192fcc0029f4d5cb27ca6747aa21568143f2d36 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Parking.lean @@ -0,0 +1,238 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Motion + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Set +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def CenterSeparated (a : ι → Space) (D : ℝ) : Prop := + ∀ i j, i ≠ j → ∃ k, D < |a i k - a j k| + +omit [Fintype ι] in +lemma CenterSeparated.update {a : ι → Space} {D : ℝ} (ha : CenterSeparated a D) + (i : ι) (b : Space) (hb : ∀ j, j ≠ i → ∃ k, D < |b k - a j k|) : + CenterSeparated (Function.update a i b) D := by + intro j k hjk + by_cases hji : j = i + · subst j + simpa [Function.update_of_ne (Ne.symm hjk)] using hb k (Ne.symm hjk) + · by_cases hki : k = i + · subst k + obtain ⟨l, hl⟩ := hb j hji + exact ⟨l, by simpa [Function.update_of_ne hji, abs_sub_comm] using hl⟩ + · simpa [Function.update_of_ne hji, Function.update_of_ne hki] using ha j k hjk + +omit [Fintype ι] [DecidableEq ι] in +lemma separated_of_centerSeparated {a w : ι → Space} {D η : ℝ} + (ha : CenterSeparated a D) (hw : ∀ i j k, w i k + w j k + 4 * η ≤ D) : + (BoxLayout.mk a w).Separated η := by + intro i j hij + obtain ⟨k, hk⟩ := ha i j hij + exact ⟨k, lt_of_le_of_lt (hw i j k) hk⟩ + +omit [Fintype ι] in +lemma segment_center_eq {a : ι → Space} (i : ι) (b _w : Space) (r : ℝ) : + (fun j k => (1 - r) * a j k + r * (Function.update a i b) j k) = + Function.update a i (fun k => (1 - r) * a i k + r * b k) := by + ext j k + by_cases hji : j = i + · subst j; simp + · simp only [Function.update_of_ne hji] + ring + +def singleSegmentMotion {a w : ι → Space} {D η : ℝ} {safe : Set ι} + (i : ι) (b : Space) (hp : ∀ j k, 0 < w j k) + (hw : ∀ j l k, w j k + w l k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hb : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * a i k + r * b k - a j k|) + (hga : (BoxLayout.mk a w).Guarded safe) + (hgb : (BoxLayout.mk (Function.update a i b) w).Guarded safe) : + BoxMotion ⟨a, w⟩ ⟨Function.update a i b, w⟩ safe η := + segmentMotion hp (by + intro r hr + apply separated_of_centerSeparated _ hw + change CenterSeparated (fun j k => (1 - r) * a j k + r * (Function.update a i b) j k) D + rw [segment_center_eq i b (0 : Space) r] + exact ha.update i _ (hb r hr)) + (fun _ hr => segment_guard hga hgb hr) + +omit [Fintype ι] in +lemma guarded_update {a w : ι → Space} {safe : Set ι} + (ha : (BoxLayout.mk a w).Guarded safe) (i : ι) (b : Space) + (hb : i ∈ safe → 2 < b 0 - w i 0) : + (BoxLayout.mk (Function.update a i b) w).Guarded safe := by + intro j hj + by_cases hji : j = i + · subst j; simpa using hb hj + · simpa [Function.update_of_ne hji] using ha j hj + +lemma raising_gap {p q : Space} {H r D : ℝ} (hq : q 1 ≤ p 1) (hH : p 1 ≤ H) + (hr : r ∈ Icc (0 : ℝ) 1) (hgap : ∃ k, D < |p k - q k|) : + ∃ k, D < |(1 - r) * p k + r * (Function.update p 1 H) k - q k| := by + obtain ⟨k, hk⟩ := hgap + by_cases hk₁ : k = 1 + · subst k + refine ⟨1, ?_⟩ + rw [abs_of_nonneg (sub_nonneg.mpr hq)] at hk + have hh : 0 ≤ (1 - r) * p 1 + r * H - q 1 := by + nlinarith [mul_nonneg hr.1 (sub_nonneg.mpr hH)] + simp only [Function.update_self, abs_of_nonneg hh] + nlinarith [mul_nonneg hr.1 (sub_nonneg.mpr hH)] + · refine ⟨k, ?_⟩ + rw [Function.update_of_ne hk₁] + convert hk using 1; congr 1; ring + +lemma high_plane_gap {p q z : Space} {H r D : ℝ} (hp : p 1 = H) (hq : q 1 = H) + (hz : D < H - z 1) : + ∃ k, D < |(1 - r) * p k + r * q k - z k| := by + refine ⟨1, hz.trans_le ?_⟩ + rw [hp, hq] + calc + H - z 1 = (1 - r) * H + r * H - z 1 := by ring + _ ≤ |(1 - r) * H + r * H - z 1| := le_abs_self _ + +lemma fixed_first_gap {p q z : Space} {r D : ℝ} (hpq : p 0 = q 0) + (hz : D < |q 0 - z 0|) : + ∃ k, D < |(1 - r) * p k + r * q k - z k| := by + refine ⟨0, ?_⟩ + rw [hpq] + convert hz using 1; congr 1; ring + +def remainingCenters (a p : ι → Space) (S : Finset ι) (i : ι) : Space := + if i ∈ S then a i else p i + +omit [Fintype ι] in +lemma remainingCenters_separated {a p : ι → Space} {D : ℝ} + (ha : CenterSeparated a D) + (hcross : ∀ i j, D < |a i 0 - p j 0|) + (hp : ∀ i j, i ≠ j → D < |p i 0 - p j 0|) (S : Finset ι) : + CenterSeparated (remainingCenters a p S) D := by + intro i j hij + by_cases hi : i ∈ S <;> by_cases hj : j ∈ S + · simpa [remainingCenters, hi, hj] using ha i j hij + · exact ⟨0, by simpa [remainingCenters, hi, hj] using hcross i j⟩ + · exact ⟨0, by simpa [remainingCenters, hi, hj, abs_sub_comm] using hcross j i⟩ + · exact ⟨0, by simpa [remainingCenters, hi, hj] using hp i j hij⟩ + +omit [Fintype ι] in +lemma remainingCenters_guarded {a p w : ι → Space} {safe : Set ι} + (ha : (BoxLayout.mk a w).Guarded safe) (hp : (BoxLayout.mk p w).Guarded safe) + (S : Finset ι) : (BoxLayout.mk (remainingCenters a p S) w).Guarded safe := by + intro i hi + by_cases h : i ∈ S + · simpa [remainingCenters, h] using ha i hi + · simpa [remainingCenters, h] using hp i hi + +omit [Fintype ι] in +lemma remainingCenters_erase {a p : ι → Space} {S : Finset ι} {i : ι} (_hi : i ∈ S) : + remainingCenters a p (S.erase i) = Function.update (remainingCenters a p S) i (p i) := by + ext j k + by_cases hji : j = i + · subst j; simp [remainingCenters] + · simp [remainingCenters, hji] + +def evacuateHighest {a p w : ι → Space} {D η H : ℝ} {safe : Set ι} + (hwidth : ∀ i k, 0 < w i k) + (hsize : ∀ i j k, w i k + w j k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hcross : ∀ i j, D < |a i 0 - p j 0|) + (hp : ∀ i j, i ≠ j → D < |p i 0 - p j 0|) + (hhigha : ∀ i, D < H - a i 1) (hhighp : ∀ i, D < H - p i 1) + (hD : 0 ≤ D) + (hga : (BoxLayout.mk a w).Guarded safe) (hgp : (BoxLayout.mk p w).Guarded safe) + (S : Finset ι) (i : ι) (hi : i ∈ S) (hmax : ∀ j ∈ S, a j 1 ≤ a i 1) : + BoxMotion ⟨remainingCenters a p S, w⟩ ⟨remainingCenters a p (S.erase i), w⟩ safe η := by + let u := remainingCenters a p S + let v₁ := Function.update (a i) 1 H + let v₂ := Function.update (p i) 1 H + have hui : u i = a i := by simp [u, remainingCenters, hi] + have hu := remainingCenters_separated ha hcross hp S + have hgu := remainingCenters_guarded hga hgp S + have hv₁ : (BoxLayout.mk (Function.update u i v₁) w).Guarded safe := + guarded_update hgu i v₁ (by intro his; simpa [v₁] using hga i his) + have hv₂ : (BoxLayout.mk (Function.update u i v₂) w).Guarded safe := + guarded_update hgu i v₂ (by intro his; simpa [v₂] using hgp i his) + have hp₃ : (BoxLayout.mk (Function.update u i (p i)) w).Guarded safe := + guarded_update hgu i (p i) (fun his => hgp i his) + have hfirst : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * u i k + r * v₁ k - u j k| := by + intro r hr j hji + rw [hui] + by_cases hj : j ∈ S + · have huj : u j = a j := by simp [u, remainingCenters, hj] + rw [huj] + exact raising_gap (hmax j hj) (by linarith [hhigha i]) hr (ha i j (Ne.symm hji)) + · have huj : u j = p j := by simp [u, remainingCenters, hj] + rw [huj] + exact fixed_first_gap (by simp [v₁]) (by simpa [v₁] using hcross i j) + have hsecond : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * (Function.update u i v₁) i k + + r * v₂ k - (Function.update u i v₁) j k| := by + intro r _ j hji + simp only [Function.update_self, Function.update_of_ne hji] + apply high_plane_gap (H := H) (by simp [v₁]) (by simp [v₂]) + by_cases hj : j ∈ S + · simpa [u, remainingCenters, hj] using hhigha j + · simpa [u, remainingCenters, hj] using hhighp j + have hthird : ∀ r ∈ Icc (0 : ℝ) 1, ∀ j, j ≠ i → + ∃ k, D < |(1 - r) * (Function.update u i v₂) i k + + r * p i k - (Function.update u i v₂) j k| := by + intro r _ j hji + simp only [Function.update_self, Function.update_of_ne hji] + apply fixed_first_gap (by simp [v₂]) + by_cases hj : j ∈ S + · simpa [u, remainingCenters, hj, abs_sub_comm] using hcross j i + · simpa [u, remainingCenters, hj] using hp i j (Ne.symm hji) + have hsep₁ := hu.update i v₁ (fun j hji => by simpa using hfirst 1 ⟨by norm_num, le_rfl⟩ j hji) + have hsep₂ : CenterSeparated (Function.update u i v₂) D := by + have hh := hsep₁.update i v₂ (fun j hji => by simpa using hsecond 1 ⟨by norm_num, le_rfl⟩ j hji) + simpa [Function.update_idem] using hh + let m₁ := singleSegmentMotion i v₁ hwidth hsize hu hfirst hgu hv₁ + let m₂ := singleSegmentMotion i v₂ hwidth hsize hsep₁ hsecond hv₁ + (by simpa [Function.update_idem] using hv₂) + let m₃ := singleSegmentMotion i (p i) hwidth hsize hsep₂ hthird hv₂ + (by simpa [Function.update_idem] using hp₃) + have m₂' : BoxMotion ⟨Function.update u i v₁, w⟩ ⟨Function.update u i v₂, w⟩ safe η := + by simpa [Function.update_idem] using m₂ + have m₃' : BoxMotion ⟨Function.update u i v₂, w⟩ ⟨Function.update u i (p i), w⟩ safe η := + by simpa [Function.update_idem] using m₃ + simpa [remainingCenters_erase hi] using (m₁.trans m₂').trans m₃' + +def evacuateToParking {a p w : ι → Space} {D η H : ℝ} {safe : Set ι} + (hwidth : ∀ i k, 0 < w i k) + (hsize : ∀ i j k, w i k + w j k + 4 * η ≤ D) + (ha : CenterSeparated a D) + (hcross : ∀ i j, D < |a i 0 - p j 0|) + (hp : ∀ i j, i ≠ j → D < |p i 0 - p j 0|) + (hhigha : ∀ i, D < H - a i 1) (hhighp : ∀ i, D < H - p i 1) + (hD : 0 ≤ D) + (hga : (BoxLayout.mk a w).Guarded safe) (hgp : (BoxLayout.mk p w).Guarded safe) : + BoxMotion ⟨a, w⟩ ⟨p, w⟩ safe η := by + have h : ∀ S : Finset ι, Nonempty + (BoxMotion ⟨remainingCenters a p S, w⟩ ⟨p, w⟩ safe η) := by + intro S + refine Finset.strongInductionOn S ?_ + intro S ih + by_cases hS : S.Nonempty + · obtain ⟨i, hi, hmax⟩ := S.exists_max_image (fun i => a i 1) hS + obtain ⟨m⟩ := ih (S.erase i) (Finset.erase_ssubset hi) + exact ⟨(evacuateHighest hwidth hsize ha hcross hp hhigha hhighp hD + hga hgp S i hi hmax).trans m⟩ + · have he : S = ∅ := Finset.not_nonempty_iff_eq_empty.mp hS + subst S + have hempty : remainingCenters a p ∅ = p := by ext i k; simp [remainingCenters] + rw [hempty] + exact ⟨BoxMotion.stationary (A := ⟨p, w⟩) hwidth + (separated_of_centerSeparated (fun i j hij => ⟨0, hp i j hij⟩) hsize) hgp⟩ + have hh := h Finset.univ + have he : remainingCenters a p Finset.univ = a := by ext i k; simp [remainingCenters] + rw [he] at hh + exact Classical.choice hh + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Periodic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Periodic.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9ab798de805cf45de12334841b0763ecdacf5cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Periodic.lean @@ -0,0 +1,179 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Loading +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Material + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology NNReal +open Filter Set + +def TimeCollars {F : Type*} [Zero F] (v : Field F) : Prop := + ∀ t, t < 1 / 4 ∨ 3 / 4 < t → v t = 0 + +def repeatTemplate (v : Velocity) : Velocity := + fun t x => ∑' n : ℤ, v (t - n) x + +lemma repeatTemplate_eq {v : Velocity} (hc : TimeCollars v) {t : ℝ} {n : ℤ} + (ht : t - n ∈ Ioo (-1 / 4 : ℝ) (5 / 4)) (x : Space) : + repeatTemplate v t x = v (t - n) x := by + apply tsum_eq_single n + intro m hmn + have hzero : v (t - m) = 0 := by + apply hc + rcases lt_or_gt_of_ne hmn with hm | hm + · right + have hh : (m : ℝ) + 1 ≤ n := by exact_mod_cast Int.add_one_le_iff.mpr hm + linarith [ht.1] + · left + have hh : (n : ℝ) + 1 ≤ m := by exact_mod_cast Int.add_one_le_iff.mpr hm + linarith [ht.2] + rw [hzero] + rfl + +lemma repeatTemplate_zero_period (v : Velocity) : Function.Periodic (repeatTemplate v) 1 := by + intro t + funext x + change (∑' n : ℤ, v (t + 1 - n) x) = ∑' n : ℤ, v (t - n) x + have hh := (Equiv.addRight (1 : ℤ)).tsum_eq (fun n : ℤ => v (t + 1 - n) x) + simpa only [Equiv.coe_addRight, Int.cast_add, Int.cast_one, add_sub_add_right_eq_sub] using hh.symm + +lemma repeatTemplate_on_unit {v : Velocity} (hc : TimeCollars v) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) : repeatTemplate v t = v t := by + funext x + simpa using repeatTemplate_eq hc (n := 0) (by norm_num; constructor <;> linarith [ht.1, ht.2]) x + +lemma repeatTemplate_jointSmooth {v : Velocity} (hv : JointSmooth v) (hc : TimeCollars v) : + JointSmooth (repeatTemplate v) := by + apply contDiff_iff_contDiffAt.mpr + intro z + let n : ℤ := ⌊z.1⌋ + have ht : z.1 - n ∈ Ioo (-1 / 4 : ℝ) (5 / 4) := by + have h₁ := Int.floor_le z.1 + have h₂ := Int.lt_floor_add_one z.1 + change -1 / 4 < z.1 - (⌊z.1⌋ : ℤ) ∧ z.1 - (⌊z.1⌋ : ℤ) < 5 / 4 + constructor <;> linarith + have hg : ContDiff ℝ (⊤ : ℕ∞) (fun y : ℝ × Space => v (y.1 - n) y.2) := + hv.comp ((contDiff_fst.sub contDiff_const).prodMk contDiff_snd) + apply hg.contDiffAt.congr_of_eventuallyEq + have hnn : ∀ᶠ y : ℝ × Space in 𝓝 z, y.1 - n ∈ Ioo (-1 / 4 : ℝ) (5 / 4) := + ((continuous_fst.sub continuous_const).continuousAt).eventually (isOpen_Ioo.mem_nhds ht) + exact hnn.mono (fun y hy => repeatTemplate_eq hc hy y.2) + +lemma repeatTemplate_supported {K : Set Space} {v : Velocity} (hs : SpatiallySupported K v) : + SpatiallySupported K (repeatTemplate v) := by + intro t x hx + simp only [repeatTemplate, hs _ x hx, tsum_zero] + +lemma repeatTemplate_divergence {v : Velocity} (hc : TimeCollars v) + (hd : ∀ t x, div v t x = 0) (t : ℝ) (x : Space) : + div (repeatTemplate v) t x = 0 := by + have he : repeatTemplate v t = v (t - (⌊t⌋ : ℤ)) := by + funext y + apply repeatTemplate_eq hc + have h₁ := Int.floor_le t + have h₂ := Int.lt_floor_add_one t + constructor <;> linarith + simpa only [div, spaceD, he] using hd (t - (⌊t⌋ : ℤ)) x + +def afterLoadingGate (t : ℝ) : ℝ := Real.smoothTransition (4 * t - 3) + +def loadedRepeat (load template : Velocity) : Velocity := + fun t x => load t x + afterLoadingGate t • repeatTemplate template t x + +lemma loadedRepeat_jointSmooth {load v : Velocity} (hl : JointSmooth load) + (hv : JointSmooth v) (hc : TimeCollars v) : JointSmooth (loadedRepeat load v) := by + have hg : JointSmooth (fun t (_ : Space) => afterLoadingGate t) := by + dsimp [JointSmooth, afterLoadingGate] + fun_prop + exact hl.add (hg.smul (repeatTemplate_jointSmooth hv hc)) + +lemma loadedRepeat_before {load v : Velocity} (hc : TimeCollars v) + {t : ℝ} (ht₀ : 0 ≤ t) (ht₁ : t ≤ 1) : loadedRepeat load v t = load t := by + have hs : afterLoadingGate t • repeatTemplate v t = (0 : Space → Space) := by + by_cases ht : t ≤ 3 / 4 + · have he : afterLoadingGate t = 0 := Real.smoothTransition.zero_of_nonpos (by linarith) + rw [he, zero_smul] + · rw [repeatTemplate_on_unit hc ⟨ht₀, ht₁⟩, hc t (Or.inr (lt_of_not_ge ht)), smul_zero] + ext x i + change (load t x + (afterLoadingGate t • repeatTemplate v t) x) i = load t x i + rw [hs] + simp + +lemma loadedRepeat_after {load v : Velocity} (hl : TimeCollars load) + {t : ℝ} (ht : 1 ≤ t) : loadedRepeat load v t = repeatTemplate v t := by + have he : afterLoadingGate t = 1 := Real.smoothTransition.one_of_one_le (by linarith) + ext x i + simp [loadedRepeat, he, hl t (Or.inr (by linarith))] + +lemma loadedRepeat_support {K L : Set Space} {load v : Velocity} + (hl : SpatiallySupported L load) (hv : SpatiallySupported K v) : + SpatiallySupported (L ∪ K) (loadedRepeat load v) := by + intro t x hx + have hn := not_or.mp hx + dsimp [loadedRepeat] + rw [hl t x hn.1, repeatTemplate_supported hv t x hn.2, smul_zero, add_zero] + +lemma loadedRepeat_repeats {load v : Velocity} (hl : TimeCollars load) : + RepeatsAfter 1 (loadedRepeat load v) := by + intro t ht + rw [loadedRepeat_after hl (by linarith), loadedRepeat_after hl ht] + exact repeatTemplate_zero_period v t + +lemma div_add {u v : Velocity} (hu : JointSmooth u) (hv : JointSmooth v) (t : ℝ) (x : Space) : + div (fun t x => u t x + v t x) t x = div u t x + div v t x := by + simp only [div, spaceD, + fderiv_fun_add ((hu.slice t).differentiable (by simp) x) + ((hv.slice t).differentiable (by simp) x), add_apply, Pi.add_apply, Finset.sum_add_distrib] + +lemma div_time_smul {u : Velocity} (hu : JointSmooth u) (a : ℝ → ℝ) (t : ℝ) (x : Space) : + div (fun t x => a t • u t x) t x = a t * div u t x := by + simp only [div, spaceD, fderiv_fun_const_smul ((hu.slice t).differentiable (by simp) x), + smul_apply, Pi.smul_apply, smul_eq_mul, Finset.mul_sum] + +lemma loadedRepeat_divergence {load v : Velocity} (hl : JointSmooth load) + (hv : JointSmooth v) (hc : TimeCollars v) + (hld : ∀ t x, div load t x = 0) (hvd : ∀ t x, div v t x = 0) (t : ℝ) (x : Space) : + div (loadedRepeat load v) t x = 0 := by + have hr := repeatTemplate_jointSmooth hv hc + have hg : JointSmooth (fun t (_ : Space) => afterLoadingGate t) := by + dsimp [JointSmooth, afterLoadingGate] + fun_prop + change div (fun t x => load t x + afterLoadingGate t • repeatTemplate v t x) t x = 0 + have hgr : JointSmooth (fun t x => afterLoadingGate t • repeatTemplate v t x) := hg.smul hr + rw [div_add hl hgr, div_time_smul hr, hld t x, repeatTemplate_divergence hc hvd] + ring + +theorem loaded_template_realization (z : Space) {η : ℝ} (hη : 0 < η) + {K : Set Space} (hK : IsCompact K) {v : Velocity} + (hv : JointSmooth v) (hc : TimeCollars v) (hs : SpatiallySupported K v) + (hd : ∀ t x, div v t x = 0) : + let U := loadedRepeat (loadingVelocity z η) v + JointSmooth U ∧ SpatiallySupported (loadingSupport z η ∪ K) U ∧ + BoundedMixed U ∧ (∀ x, U 0 x = 0) ∧ + Function.Periodic (repeatTemplate v) 1 ∧ + (∀ t, 1 ≤ t → U t = repeatTemplate v t) ∧ + (∃ X, IsMaterialFlow U X) ∧ + ∀ ν : ℝ, ZeroDataSolution ν + (affineForce (inertialCoefficient U) (viscousCoefficient U) ν) U (fun _ _ => 0) := by + let load := loadingVelocity z η + have hl : JointSmooth load := loadingVelocity_jointSmooth z η + have hlc : TimeCollars load := fun _ ht => loadingVelocity_zero ht + have hU := loadedRepeat_jointSmooth hl hv hc + have hUs := loadedRepeat_support (loadingVelocity_supported z hη) hs + have hUp := loadedRepeat_repeats (v := v) hlc + have hUc := (loadingSupport_compact z η).union hK + have hzero : ∀ x, loadedRepeat load v 0 x = 0 := by + intro x + rw [loadedRepeat_before hc le_rfl (by norm_num), hlc 0 (Or.inl (by norm_num))] + rfl + exact ⟨hU, hUs, boundedMixed_of_compact_repeating hUc hU hUs hUp, hzero, + repeatTemplate_zero_period v, fun _ ht => loadedRepeat_after hlc ht, + exists_materialFlow_of_compact_repeating hUc hU hUs hUp, + fun ν => residual_zero_pressure_solution ν _ hU.smooth hzero + (fun t _ x => loadedRepeat_divergence hl hv hc (loadingVelocity_divergence z η) hd t x)⟩ + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/PrefixCoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/PrefixCoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..a25a5a3d0443a88ce9de9bc024f65eb4b413f82c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/PrefixCoding.lean @@ -0,0 +1,340 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.RecorderRules + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' +variable {Q Γ : Type*} + +namespace Exec + +variable {M : Machine Q Γ} + +theorem single {source target : Configuration Q Γ} (step : Step M source target) : + Exec M 1 source target := + .cons step (.refl target) + +theorem trans {firstLength secondLength : ℕ} {source middle target : Configuration Q Γ} + (first : Exec M firstLength source middle) (second : Exec M secondLength middle target) : + Exec M (firstLength + secondLength) source target := by + induction first with + | refl => simpa using second + | cons step _ inductionHypothesis => + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using + (Exec.cons step (inductionHypothesis second)) + +end Exec + +variable (M : Machine Q Γ) +open Letter Control + +theorem preparation (q : Q) (hq : q ≠ M.halt) (a : Γ) (w : List Γ) + (L B J : Stream' (Letter Q Γ)) : + Exec M (2 * w.length + 3) + ⟨ready q, L, work a :: (w.map work ++ₛ (boundary :: work M.blank :: B)), J⟩ + ⟨execute q, L, work a :: (w.map work ++ₛ (boundary :: B)), work M.blank :: J⟩ := by + have h₁ := row_step M (.enter q a) hq + ⟨L, w.map work ++ₛ (boundary :: work M.blank :: B), J⟩ + have h₂ := outward_scan M q hq w (marked a :: L) (boundary :: work M.blank :: B) J + have h₃ := row_step M (.supply q) hq + ⟨w.reverse.map work ++ₛ (marked a :: L), B, J⟩ + have h₄ := returning_scan M q hq w.reverse (marked a :: L) + (boundary :: B) (work M.blank :: J) + have h₅ := row_step M (.restore q a) hq + ⟨L, w.map work ++ₛ (boundary :: B), work M.blank :: J⟩ + simp only [List.reverse_reverse, List.length_reverse] at h₄ + have h₁' := Exec.single h₁ + have h₃' := Exec.single h₃ + have h₅' := Exec.single h₅ + simp only [Row.instruction, Instruction.source, Instruction.target, + Stream'.appendStream'] at h₁' h₃' h₅' + have hh := (((h₁'.trans h₂).trans h₃').trans h₄).trans h₅' + convert hh using 1 + omega + +theorem preparation_blank_tail (q : Q) (hq : q ≠ M.halt) (a : Γ) (w : List Γ) + (L J : Stream' (Letter Q Γ)) : + Exec M (2 * w.length + 3) + ⟨ready q, L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), J⟩ + ⟨execute q, L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + work M.blank :: J⟩ := by + have hh := preparation M q hq a w L (Stream'.const (work M.blank)) J + have hb : (work M.blank :: Stream'.const (work M.blank) : Stream' (Letter Q Γ)) = + Stream'.const (work M.blank) := by + ext n + cases n <;> rfl + simpa only [hb] using hh + +theorem checkpoint_length (q : Q) (hq : q ≠ M.halt) (a : Γ) (w : List Γ) + (L J : Stream' (Letter Q Γ)) (d : Configuration Q Γ) + (hd : Step M + ⟨execute q, L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + work M.blank :: J⟩ d) : + Exec M (2 * (w.length + 1) + 2) + ⟨ready q, L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), J⟩ d := by + have hh := (preparation_blank_tail M q hq a w L J).trans (Exec.single hd) + convert hh using 1 + +theorem checkpoint_stay (q : Q) (hq : q ≠ M.halt) (a : Γ) + (hm : (M.transition q a).move = .stay) (w : List Γ) + (L J : Stream' (Letter Q Γ)) : + Exec M (2 * (w.length + 1) + 2) + ⟨ready q, L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), J⟩ + ⟨ready (M.transition q a).state, L, + work (M.transition q a).write :: + (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + record (.stay q a) :: J⟩ := by + apply checkpoint_length M q hq a w L J + exact row_step M (.stay q a) ⟨hq, hm⟩ + ⟨L, w.map work ++ₛ (boundary :: Stream'.const (work M.blank)), J⟩ + +theorem checkpoint_left (q : Q) (hq : q ≠ M.halt) (a c : Γ) + (hm : (M.transition q a).move = .left) (w : List Γ) + (L J : Stream' (Letter Q Γ)) : + Exec M (2 * (w.length + 1) + 2) + ⟨ready q, work c :: L, + work a :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), J⟩ + ⟨ready (M.transition q a).state, L, + work c :: work (M.transition q a).write :: + (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + record (.left q a c) :: J⟩ := by + apply checkpoint_length M q hq a w (work c :: L) J + exact row_step M (.left q a c) ⟨hq, hm⟩ + ⟨L, w.map work ++ₛ (boundary :: Stream'.const (work M.blank)), J⟩ + +theorem checkpoint_right (q : Q) (hq : q ≠ M.halt) (a c : Γ) + (hm : (M.transition q a).move = .right) (w : List Γ) + (L J : Stream' (Letter Q Γ)) : + Exec M (2 * (w.length + 2) + 2) + ⟨ready q, L, + work a :: work c :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), J⟩ + ⟨ready (M.transition q a).state, work (M.transition q a).write :: L, + work c :: (w.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + record (.right q a c) :: J⟩ := by + have hh := checkpoint_length M q hq a (c :: w) L J _ + (row_step M (.right q a c) ⟨hq, hm⟩ + ⟨L, w.map work ++ₛ (boundary :: Stream'.const (work M.blank)), J⟩) + simpa [Nat.add_assoc, Row.instruction, Instruction.target, Stream'.appendStream'] using hh + +theorem checkpoint_extend (q : Q) (hq : q ≠ M.halt) (a : Γ) + (hm : (M.transition q a).move = .right) (L J : Stream' (Letter Q Γ)) : + Exec M 4 + ⟨ready q, L, work a :: boundary :: Stream'.const (work M.blank), J⟩ + ⟨ready (M.transition q a).state, work (M.transition q a).write :: L, + work M.blank :: boundary :: Stream'.const (work M.blank), + record (.extend q a) :: J⟩ := by + apply checkpoint_length M q hq a [] L J + have hh := row_step M (.extend q a) ⟨hq, hm⟩ + ⟨L, Stream'.const (work M.blank), J⟩ + have hb : (work M.blank :: Stream'.const (work M.blank) : Stream' (Letter Q Γ)) = + Stream'.const (work M.blank) := by + ext n + cases n <;> rfl + simpa [Row.instruction, Instruction.source, Instruction.target, + Stream'.appendStream', hb] using hh + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} + +def word (r : ℝ) (digit : S → ℝ) : List S → ℝ + | [] => 0 + | a :: w => r * (digit a + word r digit w) + +def prefixPoint (r : ℝ) (digit : S → ℝ) (w : List S) (z : ℝ) : ℝ := + word r digit w + r ^ w.length * z + +def interval (r : ℝ) (digit : S → ℝ) (w : List S) : Set ℝ := + Set.Icc (word r digit w) (word r digit w + r ^ w.length) + +@[simp] theorem word_nil (r : ℝ) (digit : S → ℝ) : word r digit [] = 0 := rfl + +@[simp] theorem prefix_nil (r : ℝ) (digit : S → ℝ) (z : ℝ) : + prefixPoint r digit [] z = z := by simp [prefixPoint] + +@[simp] theorem prefix_cons (r : ℝ) (digit : S → ℝ) (a : S) + (w : List S) (z : ℝ) : + prefixPoint r digit (a :: w) z = r * (digit a + prefixPoint r digit w z) := by + simp only [prefixPoint, word, List.length_cons, pow_succ] + ring + +theorem word_append (r : ℝ) (digit : S → ℝ) (u v : List S) : + word r digit (u ++ v) = word r digit u + r ^ u.length * word r digit v := by + induction u with + | nil => simp + | cons a u ih => + simp only [List.cons_append, word, List.length_cons, pow_succ, ih] + ring + +theorem prefix_append (r : ℝ) (digit : S → ℝ) (u v : List S) (z : ℝ) : + prefixPoint r digit (u ++ v) z = prefixPoint r digit u (prefixPoint r digit v z) := by + simp only [prefixPoint, word_append, List.length_append, pow_add] + ring + +theorem prefix_mem_interval {r : ℝ} (hr : 0 ≤ r) (digit : S → ℝ) + (w : List S) {z : ℝ} (hz : z ∈ Set.Icc (0 : ℝ) 1) : + prefixPoint r digit w z ∈ interval r digit w := by + have hpow := pow_nonneg hr w.length + dsimp [prefixPoint, interval] + constructor + · linarith [mul_nonneg hpow hz.1] + · nlinarith [hz.2] + +theorem interval_eq_image {r : ℝ} (hr : 0 < r) (digit : S → ℝ) (w : List S) : + interval r digit w = prefixPoint r digit w '' Set.Icc (0 : ℝ) 1 := by + ext y + constructor + · intro hy + have hp : 0 < r ^ w.length := pow_pos hr _ + refine ⟨(y - word r digit w) / r ^ w.length, ?_, ?_⟩ + · constructor + · exact div_nonneg (sub_nonneg.mpr hy.1) hp.le + · apply (div_le_one hp).mpr + exact sub_le_iff_le_add.mpr (by simpa [add_comm] using hy.2) + · dsimp [prefixPoint] + field_simp + ring + · rintro ⟨z, hz, rfl⟩ + exact prefix_mem_interval hr.le digit w hz + +def replacement (r : ℝ) (digit : S → ℝ) (u v : List S) (x : ℝ) : ℝ := + word r digit v + (r ^ v.length / r ^ u.length) * (x - word r digit u) + +theorem replacement_prefix {r : ℝ} (hr : r ≠ 0) (digit : S → ℝ) + (u v : List S) (z : ℝ) : + replacement r digit u v (prefixPoint r digit u z) = prefixPoint r digit v z := by + dsimp [replacement, prefixPoint] + field_simp + ring + +theorem replacement_interval {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (u v : List S) : + replacement r digit u v '' interval r digit u = interval r digit v := by + rw [interval_eq_image hr digit u, interval_eq_image hr digit v, Set.image_image] + congr 1 + funext z + exact replacement_prefix hr.ne' digit u v z + +def scales (r : ℝ) (u v : Fin 3 → List S) : Fin 3 → ℝ := + fun i => r ^ (v i).length / r ^ (u i).length + +theorem determinant_one {r : ℝ} (hr : r ≠ 0) (u v : Fin 3 → List S) + (h : ∑ i, (u i).length = ∑ i, (v i).length) : + Matrix.det (Matrix.diagonal (scales r u v)) = 1 := by + rw [Matrix.det_diagonal] + simp only [scales, Finset.prod_div_distrib, Finset.prod_pow_eq_pow_sum] + rw [h] + exact div_self (pow_ne_zero _ hr) + +theorem scales_positive {r : ℝ} (hr : 0 < r) (u v : Fin 3 → List S) (i : Fin 3) : + 0 < scales r u v i := div_pos (pow_pos hr _) (pow_pos hr _) + +def stream {B : ℕ} (digit : S → Fin B) (s : Stream' S) : ℝ := + Real.ofDigits (fun n => digit (s n)) + +theorem stream_mem_unit {B : ℕ} (digit : S → Fin B) (s : Stream' S) : + stream digit s ∈ Set.Icc (0 : ℝ) 1 := + ⟨Real.ofDigits_nonneg _, Real.ofDigits_le_one _⟩ + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} +open Stream' + +theorem stream_cons {B : ℕ} (digit : S → Fin B) (a : S) (s : Stream' S) : + stream digit (a :: s) = (B : ℝ)⁻¹ * ((digit a : ℝ) + stream digit s) := by + have hh := Real.ofDigits_eq_sum_add_ofDigits (fun n => digit ((a :: s) n)) 1 + simpa [stream, Real.ofDigitsTerm, Stream'.cons, mul_add, mul_comm] using hh + +theorem stream_append {B : ℕ} (digit : S → Fin B) (w : List S) (s : Stream' S) : + stream digit (w ++ₛ s) = + prefixPoint (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) w (stream digit s) := by + induction w with + | nil => simp + | cons a w ih => + rw [Stream'.appendStream', stream_cons, ih, prefix_cons] + +theorem stream_append_mem_interval {B : ℕ} (digit : S → Fin B) + (w : List S) (s : Stream' S) : + stream digit (w ++ₛ s) ∈ interval (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) w := by + rw [stream_append] + exact prefix_mem_interval (inv_nonneg.mpr (Nat.cast_nonneg _)) _ _ (stream_mem_unit _ _) + +theorem replacement_stream {B : ℕ} (hB : B ≠ 0) (digit : S → Fin B) + (u v : List S) (s : Stream' S) : + replacement (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) u v (stream digit (u ++ₛ s)) = + stream digit (v ++ₛ s) := by + rw [stream_append, stream_append] + exact replacement_prefix (inv_ne_zero (Nat.cast_ne_zero.mpr hB)) _ _ _ _ + +theorem stream_mem_interior {B : ℕ} (hB : 0 < B) (digit : S → Fin B) + (hlo : ∀ a, 0 < (digit a : ℝ)) (hhi : ∀ a, (digit a : ℝ) + 1 < B) + (s : Stream' S) : stream digit s ∈ Set.Ioo (0 : ℝ) 1 := by + have hb : 0 < (B : ℝ) := Nat.cast_pos.mpr hB + have hs : s = s.head :: s.tail := by + funext n + cases n <;> rfl + rw [hs, stream_cons] + have htail := stream_mem_unit digit s.tail + constructor + · exact mul_pos (inv_pos.mpr hb) (by linarith [hlo s.head, htail.1]) + · rw [mul_comm, ← div_eq_mul_inv] + apply (div_lt_one hb).mpr + linarith [hhi s.head, htail.2] + +theorem prefix_mem_unit {r : ℝ} (hr : 0 ≤ r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (w : List S) {z : ℝ} (hz : z ∈ Set.Icc (0 : ℝ) 1) : + prefixPoint r digit w z ∈ Set.Icc (0 : ℝ) 1 := by + induction w with + | nil => simpa using hz + | cons a w ih => + rw [prefix_cons] + exact ⟨mul_nonneg hr (add_nonneg (hd₀ a) ih.1), + (mul_le_mul_of_nonneg_left (show digit a + prefixPoint r digit w z ≤ + digit a + 1 by linarith [ih.2]) hr).trans (hd₁ a)⟩ + +theorem interval_subset_unit {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (w : List S) : interval r digit w ⊆ Set.Icc (0 : ℝ) 1 := by + rw [interval_eq_image hr] + rintro _ ⟨z, hz, rfl⟩ + exact prefix_mem_unit hr.le digit hd₀ hd₁ w hz + +theorem prefix_gap {r : ℝ} (hr : 0 < r) (digit : S → ℝ) + (hd₀ : ∀ a, 0 ≤ digit a) (hd₁ : ∀ a, r * (digit a + 1) ≤ 1) + (p u v : List S) (a b : S) {x y : ℝ} + (hx : x ∈ interval r digit (p ++ a :: u)) + (hy : y ∈ interval r digit (p ++ b :: v)) : + r ^ (p.length + 1) * (digit b - digit a - 1) ≤ y - x := by + rw [interval_eq_image hr] at hx hy + obtain ⟨s, hs, rfl⟩ := hx + obtain ⟨t, ht, rfl⟩ := hy + have hs' := prefix_mem_unit hr.le digit hd₀ hd₁ u hs + have ht' := prefix_mem_unit hr.le digit hd₀ hd₁ v ht + rw [prefix_append, prefix_append, prefix_cons, prefix_cons] + dsimp [prefixPoint] + have hn : 0 ≤ r ^ p.length * r := mul_nonneg (pow_nonneg hr.le _) hr.le + have hh : 0 ≤ r ^ p.length * r * + (prefixPoint r digit v t - prefixPoint r digit u s + 1) := + mul_nonneg hn (by linarith [hs'.2, ht'.1]) + dsimp [prefixPoint] at hh + rw [pow_succ] + nlinarith only [hh] + +end BalancedTransport.Coding +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RationalAlgorithms.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RationalAlgorithms.lean new file mode 100644 index 0000000000000000000000000000000000000000..4467c31709bdb6690fd13fd8d5d99958ec17c934 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RationalAlgorithms.lean @@ -0,0 +1,131 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveArithmetic + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity + +lemma computable_ite {α β : Type*} [Primcodable α] [Primcodable β] + {p : α → Prop} [DecidablePred p] {f g : α → β} + (hp : Computable (fun a => decide (p a))) (hf : Computable f) (hg : Computable g) : + Computable (fun a => if p a then f a else g a) := by + exact (Computable.cond hp hf hg).of_eq (fun a => by + by_cases h : p a <;> simp [h]) + +lemma primrec_int_nonneg : PrimrecPred (fun z : ℤ => 0 ≤ z) := by + refine ⟨inferInstance, (primrec_int_cases Primrec.id (Primrec.const true).to₂ + (Primrec.const false).to₂).of_eq ?_⟩ + intro z + cases z with + | ofNat n => cases n <;> rfl + | negSucc n => rfl + +lemma primrec_int_le : PrimrecRel ((· ≤ ·) : ℤ → ℤ → Prop) := by + exact (primrec_int_nonneg.comp + (primrec_int_add.comp Primrec.snd (primrec_int_neg.comp Primrec.fst))).of_eq + (fun p => by simp only [← sub_eq_add_neg, sub_nonneg]) + +lemma computable_rat_le : Computable₂ (fun a b : ℚ => decide (a ≤ b)) := by + have ha : Computable (fun p : ℚ × ℚ => p.1.num * (p.2.den : ℤ)) := + primrec_int_mul.to_comp.comp (computable_rat_num.comp Computable.fst) + ((primrec_int_ofNat.to_comp.comp computable_rat_den).comp Computable.snd) + have hb : Computable (fun p : ℚ × ℚ => p.2.num * (p.1.den : ℤ)) := + primrec_int_mul.to_comp.comp (computable_rat_num.comp Computable.snd) + ((primrec_int_ofNat.to_comp.comp computable_rat_den).comp Computable.fst) + refine ((primrec_int_le.decide.to_comp).comp ha hb).of_eq ?_ + intro ⟨a,b⟩ + have he : a.num * (b.den : ℤ) ≤ b.num * (a.den : ℤ) ↔ a ≤ b := by + simpa only [Rat.num_divInt_den] using + (Rat.divInt_le_divInt (a := a.num) (c := b.num) (by exact_mod_cast a.pos : (0 : ℤ) < a.den) + (by exact_mod_cast b.pos : (0 : ℤ) < b.den)).symm + simp only [he] + +lemma computable_rat_abs : Computable (fun q : ℚ => |q|) := by + exact (computable_ite (computable_rat_le.comp (Computable.const 0) Computable.id) + Computable.id computable_rat_neg).of_eq (fun q => by + split_ifs with h + · exact (abs_of_nonneg h).symm + · exact (abs_of_neg (lt_of_not_ge h)).symm) + +lemma computable_rat_sub : Computable₂ ((· - ·) : ℚ → ℚ → ℚ) := by + exact (computable_rat_add.comp Computable.fst (computable_rat_neg.comp Computable.snd)).of_eq + (fun _ => (sub_eq_add_neg _ _).symm) + +lemma computable_rat_natCast : Computable (fun n : ℕ => (n : ℚ)) := by + exact (computable_rat_of_parts primrec_int_ofNat.to_comp (Computable.const 1) + (fun _ => by decide)).of_eq (fun n => by norm_cast; simp) + +lemma computable_rat_intCast : Computable (fun n : ℤ => (n : ℚ)) := by + exact (computable_rat_of_parts Computable.id (Computable.const 1) + (fun _ => by decide)).of_eq (fun n => by norm_num) + +lemma primrec_int_sign : Primrec Int.sign := by + have h : Primrec (fun n : ℕ => if n = 0 then (0 : ℤ) else 1) := + Primrec.ite (Primrec.eq.comp Primrec.id (Primrec.const 0)) (Primrec.const 0) (Primrec.const 1) + refine (primrec_int_cases Primrec.id (h.comp Primrec.snd).to₂ + (Primrec.const (-1 : ℤ)).to₂).of_eq ?_ + intro z + cases z with + | ofNat n => cases n <;> rfl + | negSucc n => rfl + +lemma computable_rat_inv : Computable (fun q : ℚ => q⁻¹) := by + have hn : Computable (fun q : ℚ => q.num.sign * (q.den : ℤ)) := + primrec_int_mul.to_comp.comp (primrec_int_sign.to_comp.comp computable_rat_num) + (primrec_int_ofNat.to_comp.comp computable_rat_den) + have hnum : Computable (fun q : ℚ => q⁻¹.num) := hn.of_eq (fun q => (Rat.num_inv q).symm) + have hd : Computable (fun q : ℚ => q⁻¹.den) := by + refine (computable_ite (Primrec.eq.decide.to_comp.comp computable_rat_num (Computable.const 0)) + (Computable.const 1) (primrec_int_natAbs.to_comp.comp computable_rat_num)).of_eq ?_ + intro q + exact (Rat.den_inv q).symm + exact (computable_rat_of_parts hnum hd (fun q => q⁻¹.den_ne_zero)).of_eq + (fun q => Rat.num_div_den q⁻¹) + +lemma computable_rat_div : Computable₂ ((· / ·) : ℚ → ℚ → ℚ) := by + exact (computable_rat_mul.comp Computable.fst (computable_rat_inv.comp Computable.snd)).of_eq + (fun _ => (div_eq_mul_inv _ _).symm) + +lemma primrec_nat_factorial : Primrec Nat.factorial := by + have h : Primrec₂ (fun (_ : Unit) n => Nat.rec (motive := fun _ => ℕ) 1 (fun n r => (n + 1) * r) n) := + Primrec.nat_rec (Primrec.const 1) + (Primrec.nat_mul.comp (Primrec.succ.comp (Primrec.fst.comp Primrec.snd)) + (Primrec.snd.comp Primrec.snd)).to₂ + refine (h.comp (Primrec.const ()) Primrec.id).of_eq ?_ + intro n + induction n with + | zero => rfl + | succ n ih => simpa [Nat.factorial_succ] using congrArg (fun k => (n + 1) * k) ih + +lemma computable_rat_pow : Computable₂ ((· ^ ·) : ℚ → ℕ → ℚ) := by + have h : Computable (fun p : ℚ × ℕ => + Nat.rec (motive := fun _ => ℚ) (1 : ℚ) (fun _ r => r * p.1) p.2) := + Computable.nat_rec Computable.snd (Computable.const 1) + (computable_rat_mul.comp (Computable.snd.comp Computable.snd) + (Computable.fst.comp Computable.fst)).to₂ + refine h.of_eq ?_ + intro ⟨q,n⟩ + dsimp + induction n with + | zero => simp + | succ n ih => simpa [pow_succ] using congrArg (fun r => r * q) ih + +lemma computable_sum_range {α : Type*} [Primcodable α] + {f : α → ℕ → ℚ} (hf : Computable₂ f) : + Computable₂ (fun a n => ∑ i ∈ Finset.range n, f a i) := by + have hh : Computable (fun p : α × ℕ => + Nat.rec (motive := fun _ => ℚ) (0 : ℚ) (fun n r => r + f p.1 n) p.2) := + Computable.nat_rec Computable.snd (Computable.const 0) + (computable_rat_add.comp (Computable.snd.comp Computable.snd) + (hf.comp (Computable.fst.comp Computable.fst) (Computable.fst.comp Computable.snd))).to₂ + refine hh.of_eq ?_ + intro ⟨a,n⟩ + dsimp + induction n with + | zero => simp + | succ n ih => simpa [Finset.sum_range_succ] using congrArg (fun r => r + f a n) ih + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Realization.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Realization.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cc980805fc817c1332ff453ee1018a8ef4f31e1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Realization.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Comparison +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Periodic + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry + +theorem prescribed_residual_realization {K : Set Space} (hK : IsCompact K) + {U : Velocity} (hU : JointSmooth U) (hs : SpatiallySupported K U) + (hp : RepeatsAfter 1 U) (hzero : ∀ x, U 0 x = 0) + (hdiv : ∀ t, 0 ≤ t → ∀ x, div U t x = 0) : + Smooth U ∧ Smooth (inertialCoefficient U) ∧ Smooth (viscousCoefficient U) ∧ + CommonCompactSupport U (inertialCoefficient U) (viscousCoefficient U) ∧ + BoundedMixed U ∧ BoundedMixed (inertialCoefficient U) ∧ BoundedMixed (viscousCoefficient U) ∧ + PeriodicAfterOne U ∧ ComparisonClass U (fun _ _ => 0) ∧ + (∃ X, IsMaterialFlow U X ∧ ∀ Y, IsMaterialFlow U Y → + ∀ t, 0 ≤ t → ∀ x, X t x = Y t x) ∧ + ∀ ν : ℝ, 0 < ν → let f := affineForce (inertialCoefficient U) (viscousCoefficient U) ν + ZeroDataSolution ν f U (fun _ _ => 0) ∧ + Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f ∧ UniqueInComparison ν f U := by + obtain ⟨hf₀, hf₁, hsupport, hbound, hb₀, hb₁, hperiod, hres⟩ := + prescribed_residual_regularity hK hU hs hp hzero hdiv + have hclass := comparisonClass_of_compact_boundedMixed hK hU hs hbound + obtain ⟨X, hX⟩ := exists_materialFlow_of_boundedMixed hU hbound + obtain ⟨K', hK'⟩ := spatial_lipschitz_of_boundedMixed hU hbound + refine ⟨hU.smooth, hf₀, hf₁, hsupport, hbound, hb₀, hb₁, hperiod, hclass, + ⟨X, hX, fun Y hY t ht x => materialFlow_unique hK' hX hY ht x⟩, ?_⟩ + intro ν hν + obtain ⟨hsol, hsm, hb, hp'⟩ := hres ν + exact ⟨hsol, hsm, hb, hp', Analysis.unique_in_comparison hν.le hsol hclass⟩ + +theorem loaded_template_analytic_realization (z : Space) {η : ℝ} (hη : 0 < η) + {K : Set Space} (hK : IsCompact K) {v : Velocity} + (hv : JointSmooth v) (hc : TimeCollars v) (hs : SpatiallySupported K v) + (hd : ∀ t x, div v t x = 0) : + let U := loadedRepeat (loadingVelocity z η) v + Smooth U ∧ CommonCompactSupport U (inertialCoefficient U) (viscousCoefficient U) ∧ + BoundedMixed U ∧ ComparisonClass U (fun _ _ => 0) ∧ + Function.Periodic (repeatTemplate v) 1 ∧ + (∀ t, 1 ≤ t → U t = repeatTemplate v t) ∧ + (∃ X, IsMaterialFlow U X) ∧ + ∀ ν : ℝ, 0 < ν → let f := affineForce (inertialCoefficient U) (viscousCoefficient U) ν + ZeroDataSolution ν f U (fun _ _ => 0) ∧ + Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f ∧ UniqueInComparison ν f U := by + obtain ⟨hU, hUs, _, hzero, hrep, heq, hflow, _⟩ := + loaded_template_realization z hη hK hv hc hs hd + have hlc : TimeCollars (loadingVelocity z η) := fun _ ht => loadingVelocity_zero ht + have hdiv := fun t (_ : 0 ≤ t) x => + loadedRepeat_divergence (loadingVelocity_jointSmooth z η) hv hc + (loadingVelocity_divergence z η) hd t x + have hr := prescribed_residual_realization ((loadingSupport_compact z η).union hK) + hU hUs (loadedRepeat_repeats (v := v) hlc) hzero hdiv + exact ⟨hr.1, hr.2.2.2.1, hr.2.2.2.2.1, hr.2.2.2.2.2.2.2.2.1, + hrep, heq, hflow, hr.2.2.2.2.2.2.2.2.2.2⟩ + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderRules.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderRules.lean new file mode 100644 index 0000000000000000000000000000000000000000..acdf46c59a565f4bacba2411b73d0cd8884f1dc4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderRules.lean @@ -0,0 +1,367 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Model + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder + +structure Machine (Q Γ : Type*) where + halt : Q + blank : Γ + transition : Q → Γ → Transition Q Γ + +inductive Record (Q Γ : Type*) where + | stay (q : Q) (a : Γ) + | left (q : Q) (a c : Γ) + | right (q : Q) (a c : Γ) + | extend (q : Q) (a : Γ) + deriving DecidableEq, Fintype + +inductive Letter (Q Γ : Type*) where + | work (a : Γ) + | marked (a : Γ) + | boundary + | record (r : Record Q Γ) + deriving DecidableEq, Fintype + +inductive Control (Q : Type*) where + | ready (q : Q) + | outward (q : Q) + | returning (q : Q) + | execute (q : Q) + deriving DecidableEq, Fintype + +structure Configuration (Q Γ : Type*) where + control : Control Q + left : Stream' (Letter Q Γ) + right : Stream' (Letter Q Γ) + history : Stream' (Letter Q Γ) + +structure Tails (Q Γ : Type*) where + left : Stream' (Letter Q Γ) + right : Stream' (Letter Q Γ) + history : Stream' (Letter Q Γ) + +structure Instruction (Q Γ : Type*) where + sourceControl : Control Q + targetControl : Control Q + sourceLeft : List (Letter Q Γ) + sourceRight : List (Letter Q Γ) + sourceHistory : List (Letter Q Γ) + targetLeft : List (Letter Q Γ) + targetRight : List (Letter Q Γ) + targetHistory : List (Letter Q Γ) + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder.Instruction +open Stream' +variable {Q Γ : Type*} + +def source (r : Instruction Q Γ) (t : Tails Q Γ) : Configuration Q Γ := + ⟨r.sourceControl, r.sourceLeft ++ₛ t.left, + r.sourceRight ++ₛ t.right, r.sourceHistory ++ₛ t.history⟩ + +def target (r : Instruction Q Γ) (t : Tails Q Γ) : Configuration Q Γ := + ⟨r.targetControl, r.targetLeft ++ₛ t.left, + r.targetRight ++ₛ t.right, r.targetHistory ++ₛ t.history⟩ + +def sourceTails (r : Instruction Q Γ) (c : Configuration Q Γ) : Tails Q Γ := + ⟨Stream'.drop r.sourceLeft.length c.left, + Stream'.drop r.sourceRight.length c.right, + Stream'.drop r.sourceHistory.length c.history⟩ + +def targetTails (r : Instruction Q Γ) (c : Configuration Q Γ) : Tails Q Γ := + ⟨Stream'.drop r.targetLeft.length c.left, + Stream'.drop r.targetRight.length c.right, + Stream'.drop r.targetHistory.length c.history⟩ + +@[simp] theorem sourceTails_source (r : Instruction Q Γ) (t : Tails Q Γ) : + r.sourceTails (r.source t) = t := by + cases t + simp [sourceTails, source, Stream'.drop_append_stream] + +@[simp] theorem targetTails_target (r : Instruction Q Γ) (t : Tails Q Γ) : + r.targetTails (r.target t) = t := by + cases t + simp [targetTails, target, Stream'.drop_append_stream] + +def Balanced (r : Instruction Q Γ) : Prop := + r.sourceLeft.length + r.sourceRight.length + r.sourceHistory.length = + r.targetLeft.length + r.targetRight.length + r.targetHistory.length + +end BalancedTransport.Recorder.Instruction +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' + +inductive Row (Q Γ : Type*) where + | enter (q : Q) (a : Γ) + | outward (q : Q) (c : Γ) + | supply (q : Q) + | backward (q : Q) (c : Γ) + | restore (q : Q) (a : Γ) + | stay (q : Q) (a : Γ) + | left (q : Q) (a c : Γ) + | right (q : Q) (a c : Γ) + | extend (q : Q) (a : Γ) + deriving DecidableEq, Fintype + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder.Row +open Stream' +variable {Q Γ : Type*} +open Control Letter + +def valid (M : Machine Q Γ) : Row Q Γ → Prop + | enter q _ | outward q _ | supply q | backward q _ | restore q _ => q ≠ M.halt + | stay q a => q ≠ M.halt ∧ (M.transition q a).move = .stay + | left q a _ => q ≠ M.halt ∧ (M.transition q a).move = .left + | right q a _ | extend q a => q ≠ M.halt ∧ (M.transition q a).move = .right + +def instruction (M : Machine Q Γ) : Row Q Γ → Instruction Q Γ + | enter q a => + ⟨ready q, Control.outward q, [], [work a], [], [marked a], [], []⟩ + | outward q c => + ⟨Control.outward q, Control.outward q, [], [work c], [], [work c], [], []⟩ + | supply q => + ⟨Control.outward q, returning q, [], [boundary, work M.blank], [], + [], [boundary], [work M.blank]⟩ + | backward q c => + ⟨returning q, returning q, [work c], [], [], [], [work c], []⟩ + | restore q a => + ⟨returning q, execute q, [marked a], [], [], [], [work a], []⟩ + | stay q a => + ⟨execute q, ready (M.transition q a).state, [], [work a], [work M.blank], + [], [work (M.transition q a).write], [record (.stay q a)]⟩ + | left q a c => + ⟨execute q, ready (M.transition q a).state, [work c], [work a], [work M.blank], + [], [work c, work (M.transition q a).write], [record (.left q a c)]⟩ + | right q a c => + ⟨execute q, ready (M.transition q a).state, [], [work a, work c], [work M.blank], + [work (M.transition q a).write], [work c], [record (.right q a c)]⟩ + | extend q a => + ⟨execute q, ready (M.transition q a).state, + [], [work a, boundary, work M.blank], [work M.blank], + [work (M.transition q a).write], [work M.blank, boundary], [record (.extend q a)]⟩ + +theorem balanced (M : Machine Q Γ) (r : Row Q Γ) : + (r.instruction M).Balanced := by + cases r <;> simp [instruction, Instruction.Balanced] + +end BalancedTransport.Recorder.Row +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' +variable {Q Γ : Type*} [DecidableEq Q] [DecidableEq Γ] +open Letter Control + +def sourceRow (M : Machine Q Γ) (c : Configuration Q Γ) : Option (Row Q Γ) := + match c.control with + | ready q => + if q = M.halt then none else + match c.right.head with + | work a => some (.enter q a) + | _ => none + | outward q => + if q = M.halt then none else + match c.right.head with + | work a => some (.outward q a) + | boundary => if c.right.tail.head = work M.blank then some (.supply q) else none + | _ => none + | returning q => + if q = M.halt then none else + match c.left.head with + | work a => some (.backward q a) + | marked a => some (.restore q a) + | _ => none + | execute q => + if q = M.halt then none else + if c.history.head = work M.blank then + match c.right.head with + | work a => + match (M.transition q a).move with + | .stay => some (.stay q a) + | .left => + match c.left.head with + | work v => some (.left q a v) + | _ => none + | .right => + match c.right.tail.head with + | work v => some (.right q a v) + | boundary => + if c.right.tail.tail.head = work M.blank then some (.extend q a) else none + | _ => none + | _ => none + else none + +def targetRow (c : Configuration Q Γ) : Option (Row Q Γ) := + match c.control with + | ready _ => + match c.history.head with + | record (.stay q a) => some (.stay q a) + | record (.left q a v) => some (.left q a v) + | record (.right q a v) => some (.right q a v) + | record (.extend q a) => some (.extend q a) + | _ => none + | outward q => + match c.left.head with + | marked a => some (.enter q a) + | work a => some (.outward q a) + | _ => none + | returning q => + match c.right.head with + | boundary => some (.supply q) + | work a => some (.backward q a) + | _ => none + | execute q => + match c.right.head with + | work a => some (.restore q a) + | _ => none + +@[simp] theorem sourceRow_source (M : Machine Q Γ) (r : Row Q Γ) + (hr : r.valid M) (t : Tails Q Γ) : + sourceRow M ((r.instruction M).source t) = some r := by + cases r <;> + simp_all [Row.valid, Row.instruction, Instruction.source, sourceRow, + Stream'.appendStream', Stream'.head] + +omit [DecidableEq Q] [DecidableEq Γ] in + +@[simp] theorem targetRow_target (M : Machine Q Γ) (r : Row Q Γ) (t : Tails Q Γ) : + targetRow ((r.instruction M).target t) = some r := by + cases r <;> + simp [Row.instruction, Instruction.target, targetRow, + Stream'.appendStream', Stream'.head] + +theorem source_separation (M : Machine Q Γ) {r s : Row Q Γ} + (hr : r.valid M) (hs : s.valid M) {t u : Tails Q Γ} + (he : (r.instruction M).source t = (s.instruction M).source u) : r = s ∧ t = u := by + have hrs : r = s := by + have hh := congrArg (sourceRow M) he + simpa [sourceRow_source M r hr, sourceRow_source M s hs] using hh + subst s + exact ⟨rfl, by simpa using congrArg (Instruction.sourceTails (r.instruction M)) he⟩ + +omit [DecidableEq Q] [DecidableEq Γ] in + +theorem target_separation (M : Machine Q Γ) {r s : Row Q Γ} {t u : Tails Q Γ} + (he : (r.instruction M).target t = (s.instruction M).target u) : r = s ∧ t = u := by + have hrs : r = s := by + have hh := congrArg targetRow he + simpa using hh + subst s + exact ⟨rfl, by simpa using congrArg (Instruction.targetTails (r.instruction M)) he⟩ + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' + +def Step {Q Γ : Type*} (M : Machine Q Γ) (c d : Configuration Q Γ) : Prop := + ∃ r : Row Q Γ, r.valid M ∧ ∃ t : Tails Q Γ, + c = (r.instruction M).source t ∧ d = (r.instruction M).target t + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' +variable {Q Γ : Type*} [DecidableEq Q] [DecidableEq Γ] + +theorem step_deterministic (M : Machine Q Γ) {c d e : Configuration Q Γ} + (hd : Step M c d) (he : Step M c e) : d = e := by + obtain ⟨r, hr, t, hrt, hrd⟩ := hd + obtain ⟨s, hs, u, hsu, hse⟩ := he + obtain ⟨rfl, rfl⟩ := source_separation M hr hs (hrt.symm.trans hsu) + exact hrd.trans hse.symm + +omit [DecidableEq Q] [DecidableEq Γ] in + +theorem step_injective (M : Machine Q Γ) {c d e : Configuration Q Γ} + (hc : Step M c e) (hd : Step M d e) : c = d := by + obtain ⟨r, hr, t, hrt, hre⟩ := hc + obtain ⟨s, hs, u, hsu, hse⟩ := hd + obtain ⟨rfl, rfl⟩ := target_separation M (hre.symm.trans hse) + exact hrt.trans hsu.symm + +instance (M : Machine Q Γ) : DecidablePred (Row.valid M) := by + intro r + cases r <;> simp only [Row.valid] <;> infer_instance + +def table [Fintype Q] [Fintype Γ] (M : Machine Q Γ) : Finset (Row Q Γ) := + Finset.univ.filter (Row.valid M) + +omit [DecidableEq Γ] in + +@[simp] theorem mem_table [Fintype Q] [Fintype Γ] (M : Machine Q Γ) (r : Row Q Γ) : + r ∈ table M ↔ r.valid M := by + simp [table] + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' + +inductive Exec {Q Γ : Type*} (M : Machine Q Γ) : + ℕ → Configuration Q Γ → Configuration Q Γ → Prop + | refl (c) : Exec M 0 c c + | cons {n c d e} : Step M c d → Exec M n d e → Exec M (n + 1) c e + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +open Stream' +variable {Q Γ : Type*} (M : Machine Q Γ) +open Letter Control + +theorem row_step (r : Row Q Γ) (hr : r.valid M) (t : Tails Q Γ) : + Step M ((r.instruction M).source t) ((r.instruction M).target t) := + ⟨r, hr, t, rfl, rfl⟩ + +theorem outward_scan (q : Q) (hq : q ≠ M.halt) (w : List Γ) + (L R J : Stream' (Letter Q Γ)) : + Exec M w.length + ⟨outward q, L, w.map work ++ₛ R, J⟩ + ⟨outward q, w.reverse.map work ++ₛ L, R, J⟩ := by + induction w generalizing L with + | nil => simpa using Exec.refl (M := M) (⟨outward q, L, R, J⟩ : Configuration Q Γ) + | cons a as ih => + have h := row_step M (.outward q a) hq ⟨L, as.map work ++ₛ R, J⟩ + have hh := Exec.cons h (ih (work a :: L)) + simpa [Row.instruction, Instruction.source, Instruction.target, + Stream'.appendStream', List.reverse_cons, List.map_append] using hh + +theorem returning_scan (q : Q) (hq : q ≠ M.halt) (w : List Γ) + (L R J : Stream' (Letter Q Γ)) : + Exec M w.length + ⟨returning q, w.map work ++ₛ L, R, J⟩ + ⟨returning q, L, w.reverse.map work ++ₛ R, J⟩ := by + induction w generalizing R with + | nil => simpa using Exec.refl (M := M) (⟨returning q, L, R, J⟩ : Configuration Q Γ) + | cons a as ih => + have h := row_step M (.backward q a) hq ⟨as.map work ++ₛ L, R, J⟩ + have hh := Exec.cons h (ih (work a :: R)) + simpa [Row.instruction, Instruction.source, Instruction.target, + Stream'.appendStream', List.reverse_cons, List.map_append] using hh + +end BalancedTransport.Recorder +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderSimulation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderSimulation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad7a72653489fd087e1f575a25829ac54912015d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RecorderSimulation.lean @@ -0,0 +1,398 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.BoxCoding + +namespace OAI + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] + +theorem inverse_base_pos : 0 < (base Q Γ : ℝ)⁻¹ := + inv_pos.mpr (Nat.cast_pos.mpr base_pos) + +theorem inverse_base_le_one : (base Q Γ : ℝ)⁻¹ ≤ 1 := by + have h : (1 : ℝ) ≤ base Q Γ := by exact_mod_cast base_pos (Q := Q) (Γ := Γ) + exact inv_le_one_of_one_le₀ h + +theorem digit_unit_bound (a : Letter Q Γ) : + (base Q Γ : ℝ)⁻¹ * ((digit a : ℝ) + 1) ≤ 1 := by + rw [mul_comm, ← div_eq_mul_inv] + exact (div_le_one (Nat.cast_pos.mpr base_pos)).mpr (digit_upper a).le + +def Configuration.stacks (c : Configuration Q Γ) : Fin 3 → Stream' (Letter Q Γ) := + ![c.left, c.right, c.history] + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} [Fintype Q] [Fintype Γ] +variable [DecidableEq Q] + +def Configuration.code (M : Machine Q Γ) (c : Configuration Q Γ) : Space := + Coding.codedPoint digit (Coding.origin (placement M c.control)) c.stacks + +def Instruction.fullMap (M : Machine Q Γ) (inst : Instruction Q Γ) : Space → Space := + Coding.boxMap (base Q Γ : ℝ)⁻¹ (fun a => (digit a : ℝ)) + (Coding.origin (placement M inst.sourceControl)) + (Coding.origin (placement M inst.targetControl)) inst.sourcePrefixes inst.targetPrefixes + +theorem Instruction.fullMap_code (M : Machine Q Γ) (inst : Instruction Q Γ) + (t : Tails Q Γ) : + inst.fullMap M ((inst.source t).code M) = (inst.target t).code M := by + let tails : Fin 3 → Stream' (Letter Q Γ) := ![t.left, t.right, t.history] + have hs : (inst.source t).stacks = fun i => inst.sourcePrefixes i ++ₛ tails i := by + funext i + fin_cases i <;> rfl + have ht : (inst.target t).stacks = fun i => inst.targetPrefixes i ++ₛ tails i := by + funext i + fin_cases i <;> rfl + unfold fullMap Configuration.code + rw [hs, ht] + exact Coding.boxMap_codedPoint (Nat.ne_of_gt base_pos) _ _ _ _ _ _ + +theorem Instruction.source_code_mem (M : Machine Q Γ) (inst : Instruction Q Γ) + (t : Tails Q Γ) : + (inst.source t).code M ∈ + inst.sourceBox (base Q Γ : ℝ)⁻¹ (fun a => (digit a : ℝ)) (placement M) := by + let tails : Fin 3 → Stream' (Letter Q Γ) := ![t.left, t.right, t.history] + have hs : (inst.source t).stacks = fun i => inst.sourcePrefixes i ++ₛ tails i := by + funext i + fin_cases i <;> rfl + change Coding.codedPoint digit _ (inst.source t).stacks ∈ _ + rw [hs] + exact Coding.codedPoint_mem_box _ _ _ _ + +theorem compiled_boxes_disjoint [DecidableEq Γ] (M : Machine Q Γ) : + ((table M : Set (Row Q Γ)).Pairwise fun a b => + Disjoint ((a.instruction M).sourceBox (base Q Γ : ℝ)⁻¹ + (fun c => (digit c : ℝ)) (placement M)) + ((b.instruction M).sourceBox (base Q Γ : ℝ)⁻¹ + (fun c => (digit c : ℝ)) (placement M))) ∧ + ((table M : Set (Row Q Γ)).Pairwise fun a b => + Disjoint ((a.instruction M).targetBox (base Q Γ : ℝ)⁻¹ + (fun c => (digit c : ℝ)) (placement M)) + ((b.instruction M).targetBox (base Q Γ : ℝ)⁻¹ + (fun c => (digit c : ℝ)) (placement M))) := by + constructor + · intro a ha b hb hab + exact source_boxes_disjoint M inverse_base_pos _ (fun a => (digit_pos a).le) + digit_unit_bound digit_gap (placement M) (placement_injective M) + ((mem_table M a).mp ha) ((mem_table M b).mp hb) hab + · intro a _ b _ hab + exact target_boxes_disjoint M inverse_base_pos _ (fun a => (digit_pos a).le) + digit_unit_bound digit_gap (placement M) (placement_injective M) hab + +omit [DecidableEq Q] in + +theorem prefix_halfWidth (w : List (Letter Q Γ)) : + 0 < (base Q Γ : ℝ)⁻¹ ^ w.length / 2 ∧ + (base Q Γ : ℝ)⁻¹ ^ w.length / 2 ≤ 1 / 2 := by + have hp := pow_pos (inverse_base_pos (Q := Q) (Γ := Γ)) w.length + have hle := pow_le_one₀ (inverse_base_pos (Q := Q) (Γ := Γ)).le + (inverse_base_le_one (Q := Q) (Γ := Γ)) (n := w.length) + constructor <;> linarith + +theorem nonhalt_box_guard (M : Machine Q Γ) (s : Control Q) (hs : s ≠ .ready M.halt) + (u : Fin 3 → List (Letter Q Γ)) {x : Space} + (hx : x ∈ Coding.box (base Q Γ : ℝ)⁻¹ (fun a => (digit a : ℝ)) + (Coding.origin (placement M s)) u) : 4 ≤ x 0 := by + have hl := (Coding.interval_subset_unit inverse_base_pos _ (fun a => (digit_pos a).le) + digit_unit_bound (u 0) (hx 0)).1 + have hp : (1 : ℝ) ≤ placement M s := by exact_mod_cast placement_positive M s hs + simp only [Coding.origin, Matrix.cons_val_zero] at hl + linarith + +omit [Fintype Q] [Fintype Γ] [DecidableEq Q] in + +theorem Row.sourceControl_ne_halt (M : Machine Q Γ) (a : Row Q Γ) (ha : a.valid M) : + (a.instruction M).sourceControl ≠ .ready M.halt := by + cases a <;> simp_all [Row.valid, Row.instruction] + +theorem source_box_guard (M : Machine Q Γ) (a : Row Q Γ) (ha : a.valid M) {x : Space} + (hx : x ∈ (a.instruction M).sourceBox (base Q Γ : ℝ)⁻¹ + (fun c => (digit c : ℝ)) (placement M)) : 4 ≤ x 0 := + nonhalt_box_guard M _ (a.sourceControl_ne_halt M ha) _ hx + +theorem code_mem_observer_iff (M : Machine Q Γ) (c : Configuration Q Γ) : + c.code M ∈ observer ↔ c.control = .ready M.halt := by + have hi : ∀ i : Fin 3, Coding.stream digit (c.stacks i) ∈ Set.Ioo (0 : ℝ) 1 := by + intro i + exact Coding.stream_mem_interior base_pos digit digit_pos digit_upper _ + constructor + · intro h + by_contra hc + have hp : (1 : ℝ) ≤ placement M c.control := by + exact_mod_cast placement_positive M c.control hc + have hi₀ := hi 0 + have hh : c.code M 0 < 2 := (h 0 (Set.mem_univ _)).2 + simp only [Configuration.code, Coding.codedPoint, Coding.origin, Matrix.cons_val_zero] at hh + linarith [hi₀.1] + · intro hc i _ + have ho : Coding.origin (placement M c.control) i = 0 := by + rw [hc, placement_halt] + fin_cases i <;> simp [Coding.origin] + change -1 < Coding.origin (placement M c.control) i + Coding.stream digit (c.stacks i) ∧ + Coding.origin (placement M c.control) i + Coding.stream digit (c.stacks i) < 2 + rw [ho, zero_add] + constructor <;> linarith [(hi i).1, (hi i).2] + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} +open Stream' Letter Control + +structure Checkpoint (Q Γ : Type*) where + state : Q + left : Stream' Γ + current : Γ + right : List Γ + history : Stream' (Letter Q Γ) + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint +variable {Q Γ : Type*} +open Stream' Letter Control + +def expand (M : Machine Q Γ) (c : Checkpoint Q Γ) : Configuration Q Γ := + ⟨ready c.state, Stream'.map work c.left, + work c.current :: (c.right.map work ++ₛ (boundary :: Stream'.const (work M.blank))), + c.history⟩ + +def next (M : Machine Q Γ) (c : Checkpoint Q Γ) : Checkpoint Q Γ := + let v := M.transition c.state c.current + match v.move with + | .stay => ⟨v.state, c.left, v.write, c.right, record (.stay c.state c.current) :: c.history⟩ + | .left => ⟨v.state, c.left.tail, c.left.head, v.write :: c.right, + record (.left c.state c.current c.left.head) :: c.history⟩ + | .right => + match c.right with + | [] => ⟨v.state, v.write :: c.left, M.blank, [], + record (.extend c.state c.current) :: c.history⟩ + | List.cons a w => ⟨v.state, v.write :: c.left, a, w, + record (.right c.state c.current a) :: c.history⟩ + +def WorkStep (M : Machine Q Γ) (c d : Checkpoint Q Γ) : Prop := + c.state ≠ M.halt ∧ d = c.next M + +theorem next_exec (M : Machine Q Γ) (c : Checkpoint Q Γ) (hc : c.state ≠ M.halt) : + Exec M (2 * (c.right.length + 1) + 2) (c.expand M) ((c.next M).expand M) := by + cases hm : (M.transition c.state c.current).move with + | stay => + simpa [next, hm, expand] using + checkpoint_stay M c.state hc c.current hm c.right (Stream'.map work c.left) c.history + | left => + have h := checkpoint_left M c.state hc c.current c.left.head hm c.right + (Stream'.map work c.left.tail) c.history + have hl : (work c.left.head :: Stream'.map work c.left.tail : Stream' (Letter Q Γ)) = + Stream'.map work c.left := by + funext n + cases n <;> rfl + simpa only [next, hm, expand, List.map_cons, Stream'.appendStream', hl] using h + | right => + cases hw : c.right with + | nil => + simpa [next, hm, expand, hw, Stream'.map_cons] using + checkpoint_extend M c.state hc c.current hm (Stream'.map work c.left) c.history + | cons a w => + simpa [next, hm, expand, hw, Stream'.map_cons, Stream'.appendStream', Nat.add_assoc] using + checkpoint_right M c.state hc c.current a hm w (Stream'.map work c.left) c.history + +theorem work_execution (M : Machine Q Γ) {c d : Checkpoint Q Γ} + (h : Relation.ReflTransGen (WorkStep M) c d) : + ∃ n, Exec M n (c.expand M) (d.expand M) := by + induction h with + | refl => exact ⟨0, .refl _⟩ + | @tail d e hd hstep ih => + obtain ⟨n, hn⟩ := ih + obtain ⟨hnh, rfl⟩ := hstep + exact ⟨_, hn.trans (next_exec M d hnh)⟩ + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.Recorder +variable {Q Γ : Type*} +open Stream' Letter Control + +theorem no_step_from_halt (M : Machine Q Γ) {c d : Configuration Q Γ} + (hc : c.control = .ready M.halt) : ¬Step M c d := by + rintro ⟨r, hr, t, rfl, _⟩ + exact r.sourceControl_ne_halt M hr hc + +end BalancedTransport.Recorder +end + +noncomputable section +namespace BalancedTransport.Recorder.Exec +variable {Q Γ : Type*} +open Stream' Letter Control +variable [DecidableEq Q] [DecidableEq Γ] {M : Machine Q Γ} + +theorem cancel_to_terminal {n m : ℕ} {c d e : Configuration Q Γ} + (h : Exec M n c d) (g : Exec M m c e) (hd : ∀ f, ¬Step M d f) : + ∃ k, n = m + k ∧ Exec M k e d := by + induction g generalizing n with + | refl => exact ⟨n, by omega, h⟩ + | @cons m c b e hcb hbe ih => + cases h with + | refl => exact False.elim (hd b hcb) + | @cons n c a d hca had => + have he := step_deterministic M hca hcb + subst a + obtain ⟨k, hk, he⟩ := ih had + exact ⟨k, by omega, he⟩ + +end BalancedTransport.Recorder.Exec +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint +variable {Q Γ : Type*} +open Stream' Letter Control +variable [DecidableEq Q] [DecidableEq Γ] + +theorem halt_reflection (M : Machine Q Γ) {n : ℕ} {c : Checkpoint Q Γ} + {d : Configuration Q Γ} (h : Exec M n (c.expand M) d) + (hd : d.control = .ready M.halt) : + ∃ e, Relation.ReflTransGen (WorkStep M) c e ∧ e.state = M.halt := by + induction n using Nat.strong_induction_on generalizing c d with + | h n ih => + by_cases hc : c.state = M.halt + · exact ⟨c, .refl, hc⟩ + · obtain ⟨k, hk, hkd⟩ := h.cancel_to_terminal (next_exec M c hc) + (fun f => no_step_from_halt M hd) + have hkn : k < n := by omega + obtain ⟨e, he, hehalt⟩ := ih k hkn hkd hd + exact ⟨e, (Relation.ReflTransGen.single (show WorkStep M c (c.next M) from + ⟨hc, rfl⟩)).trans he, hehalt⟩ + +theorem halting_iff (M : Machine Q Γ) (c : Checkpoint Q Γ) : + (∃ n d, Exec M n (c.expand M) d ∧ d.control = .ready M.halt) ↔ + ∃ e, Relation.ReflTransGen (WorkStep M) c e ∧ e.state = M.halt := by + constructor + · rintro ⟨n, d, h, hd⟩ + exact halt_reflection M h hd + · rintro ⟨e, h, he⟩ + obtain ⟨n, hn⟩ := work_execution M h + exact ⟨n, e.expand M, hn, by simpa [expand] using he⟩ + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} + +def rationalWord {B : ℕ} (digit : S → Fin B) : List S → ℚ + | [] => 0 + | a :: w => (B : ℚ)⁻¹ * ((digit a : ℚ) + rationalWord digit w) + +theorem rationalWord_cast {B : ℕ} (digit : S → Fin B) (w : List S) : + (rationalWord digit w : ℝ) = word (B : ℝ)⁻¹ (fun a => (digit a : ℝ)) w := by + induction w with + | nil => simp [rationalWord] + | cons a w ih => simp [rationalWord, word, ih] + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Coding +variable {S : Type*} +open Stream' + +theorem stream_const {B : ℕ} (hB : 1 < B) (digit : S → Fin B) (a : S) : + stream digit (Stream'.const a) = (digit a : ℝ) / ((B : ℝ) - 1) := by + have hs : (a :: Stream'.const a : Stream' S) = Stream'.const a := by + funext n + cases n <;> rfl + have he := stream_cons digit a (Stream'.const a) + rw [hs, mul_comm, ← div_eq_mul_inv] at he + have hB' : (1 : ℝ) < B := by exact_mod_cast hB + have hn : (B : ℝ) ≠ 0 := by linarith + have hsub : (B : ℝ) - 1 ≠ 0 := by linarith + apply (eq_div_iff hsub).mpr + have he' := (eq_div_iff hn).mp he + nlinarith only [he'] + +def rationalTailCode {B : ℕ} (digit : S → Fin B) (w : List S) (a : S) : ℚ := + rationalWord digit w + (B : ℚ)⁻¹ ^ w.length * ((digit a : ℚ) / ((B : ℚ) - 1)) + +theorem rationalTailCode_cast {B : ℕ} (hB : 1 < B) (digit : S → Fin B) + (w : List S) (a : S) : + (rationalTailCode digit w a : ℝ) = stream digit (w ++ₛ Stream'.const a) := by + rw [stream_append, stream_const hB] + simp [rationalTailCode, prefixPoint, rationalWord_cast] + +end BalancedTransport.Coding +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint +variable {Q Γ : Type*} +open Stream' Letter + +def initial (M : Machine Q Γ) (q₀ : Q) (w : List Γ) : Checkpoint Q Γ := + ⟨q₀, Stream'.const M.blank, w.headD M.blank, w.tail, Stream'.const (work M.blank)⟩ + +theorem initial_work_block (M : Machine Q Γ) (q₀ : Q) (w : List Γ) : + (initial M q₀ w).current :: (initial M q₀ w).right = + if w = [] then [M.blank] else w := by + cases w <;> simp [initial] + +end BalancedTransport.Recorder.Checkpoint +end + +noncomputable section +namespace BalancedTransport.Recorder.Checkpoint +variable {Q Γ : Type*} +open Stream' Letter +variable [Fintype Q] [Fintype Γ] [DecidableEq Q] + +omit [DecidableEq Q] in + +theorem base_gt_one : 1 < base Q Γ := by + have hh : 0 < Fintype.card (Letter Q Γ) := Fintype.card_pos_iff.mpr ⟨.boundary⟩ + dsimp [base] + omega + +def rationalInitial (M : Machine Q Γ) (q₀ : Q) (w : List Γ) : Fin 3 → ℚ := + let b := Coding.rationalTailCode (digit (Q := Q) (Γ := Γ)) [] (work M.blank : Letter Q Γ) + let v : List (Letter Q Γ) := work (w.headD M.blank) :: (w.tail.map work ++ [boundary]) + ![4 * (placement M (.ready q₀) : ℚ) + b, + Coding.rationalTailCode (digit (Q := Q) (Γ := Γ)) v (work M.blank), b] + +theorem rationalInitial_cast (M : Machine Q Γ) (q₀ : Q) (w : List Γ) : + rationalSpace (rationalInitial M q₀ w) = ((initial M q₀ w).expand M).code M := by + have hb := Coding.rationalTailCode_cast (base_gt_one (Q := Q) (Γ := Γ)) + digit [] (work M.blank : Letter Q Γ) + have hr := Coding.rationalTailCode_cast (base_gt_one (Q := Q) (Γ := Γ)) + digit (work (w.headD M.blank) :: (w.tail.map work ++ [boundary])) + (work M.blank : Letter Q Γ) + have hr' : (Coding.rationalTailCode (digit (Q := Q) (Γ := Γ)) + (work (w.headD M.blank) :: (w.tail.map work ++ [boundary])) (work M.blank) : ℝ) = + Coding.stream (digit (Q := Q) (Γ := Γ)) (work (w.headD M.blank) :: + (w.tail.map work ++ₛ (boundary :: Stream'.const (work M.blank)))) := by + simpa only [Stream'.appendStream', Stream'.append_append_stream] using hr + simp only [Stream'.nil_append_stream] at hb + funext i + fin_cases i + · simp [rationalSpace, rationalInitial, Configuration.code, Configuration.stacks, + Coding.codedPoint, Coding.origin, expand, initial, Stream'.map_const, hb] + · simpa [rationalSpace, rationalInitial, Configuration.code, Configuration.stacks, + Coding.codedPoint, Coding.origin, expand, initial] using hr' + · simpa [rationalSpace, rationalInitial, Configuration.code, Configuration.stacks, + Coding.codedPoint, Coding.origin, expand, initial] using hb + +end BalancedTransport.Recorder.Checkpoint +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RelativeForce.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RelativeForce.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b5109cd8e65fa0c5af4aab13ce323b1bb6652c6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RelativeForce.lean @@ -0,0 +1,256 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveArithmetic +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ResidualRegularity +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.OracleComputability + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry + +lemma fullMixedD_add {v w : Velocity} (hv : JointSmooth v) (hw : JointSmooth w) + (a : MultiIndex) : fullMixedD a (fun t x => v t x + w t x) = + fun t x => fullMixedD a v t x + fullMixedD a w t x := by + induction a with + | nil => rfl + | cons i a ih => + cases i with + | none => + simp only [fullMixedD, ih] + ext t x k + rw [fullTimeD, deriv_fun_add (((hv.fullMixedD a).timeSlice x).differentiable (by simp) t) + (((hw.fullMixedD a).timeSlice x).differentiable (by simp) t)] + rfl + | some i => + simp only [fullMixedD, ih] + ext t x k + rw [spaceD, fderiv_fun_add (((hv.fullMixedD a).slice t).differentiable (by simp) x) + (((hw.fullMixedD a).slice t).differentiable (by simp) x)] + rfl + +lemma fullMixedD_smul (v : Velocity) (c : ℝ) (a : MultiIndex) : + fullMixedD a (fun t x => c • v t x) = fun t x => c • fullMixedD a v t x := by + induction a with + | nil => rfl + | cons i a ih => + cases i with + | none => + simp only [fullMixedD, ih] + ext t x k + rw [fullTimeD, deriv_fun_const_smul_field] + rfl + | some i => + simp only [fullMixedD, ih] + ext t x k + change fderiv ℝ (c • fullMixedD a v t) x _ k = _ + rw [fderiv_const_smul_field] + rfl + +lemma mixedD_affineForce_of_extensions {v w V W : Velocity} + (hv : JointSmooth V) (hw : JointSmooth W) (hev : ForwardEq V v) (hew : ForwardEq W w) + (c : ℝ) (a : MultiIndex) (t : ℝ) (ht : 0 ≤ t) (x : Space) : + mixedD a (affineForce v w c) t x = mixedD a v t x + c • mixedD a w t x := by + have hcw : JointSmooth (fun t x => c • W t x) := by + change ContDiff ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => c • W z.1 z.2) + exact (contDiff_const (c := c)).smul hw + have hadd : JointSmooth (fun t x => V t x + c • W t x) := by + change ContDiff ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => V z.1 z.2 + c • W z.1 z.2) + exact hv.add hcw + have he : ForwardEq (fun t x => V t x + c • W t x) (affineForce v w c) := by + intro t ht + funext x + change V t x + c • W t x = v t x + c • w t x + rw [hev t ht, hew t ht] + rw [← congrFun ((he.mixedD a) t ht) x, + ← fullMixedD_eq_mixedD hadd a t ht x, fullMixedD_add hv hcw, + fullMixedD_smul] + dsimp only + rw [fullMixedD_eq_mixedD hv a t ht x, + fullMixedD_eq_mixedD hw a t ht x, + congrFun ((hev.mixedD a) t ht) x, congrFun ((hew.mixedD a) t ht) x] + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Effectivity + +lemma error_nonneg (n : ℕ) : 0 ≤ error n := by unfold error; positivity + +lemma error_le_one (n : ℕ) : error n ≤ 1 := by + exact pow_le_one₀ (by norm_num : (0 : ℝ) ≤ 2⁻¹) (by norm_num) + +lemma error_add (n k : ℕ) : error (n + k) = error n * error k := pow_add _ _ _ + +lemma nat_mul_error_shift (n k : ℕ) : (k : ℝ) * error (n + k) ≤ error n := by + have hk : (k : ℝ) ≤ (2 : ℝ) ^ k := by + induction k with + | zero => norm_num + | succ k ih => + rw [Nat.cast_succ, pow_succ] + have hp : (1 : ℝ) ≤ 2 ^ k := one_le_pow₀ (by norm_num) + linarith + have he : (k : ℝ) * error k ≤ 1 := by + unfold error + rw [inv_pow, ← div_eq_mul_inv] + exact (div_le_one (by positivity)).mpr hk + rw [error_add] + nlinarith [mul_le_mul_of_nonneg_left he (error_nonneg n)] + +lemma family_effective_field {v : Family Velocity} (hv : EffectiveFamily v) + (M : FiniteMachine) (w : Input M) (O : Set (ℕ →. ℕ)) : EffectiveFieldIn O (v M w) := by + obtain ⟨E, b, R, hE, hb, _, heval, hbound, _⟩ := hv + refine ⟨(fun s => E (inputCode M w, s)), (fun a => b (inputCode M w, a)), + (hE.comp ((Computable.const _).pair Computable.id)).computableIn, + (hb.comp ((Computable.const _).pair Computable.id)).computableIn, ?_, ?_⟩ + · intro a z n hz i + exact heval M w a z n hz i + · intro a t ht x + exact hbound M w a t ht x + +lemma realName_oracle_computable (name : ℕ → ℚ) : + ComputableIn {nameOracle name} name := by + have h := Nat.RecursiveIn.oracle (O := {nameOracle name}) (nameOracle name) (Set.mem_singleton _) + change Nat.RecursiveIn {nameOracle name} (fun n => Part.some (Encodable.encode (name n))) at h + have hr := Nat.RecursiveIn.comp (Primrec.nat_iff.mp primrec_ratRank).recursiveIn h + apply Nat.RecursiveIn.of_eq hr + intro n + simp only [Part.bind_some, Encodable.decode_nat, + Part.coe_some, Part.map_some] + change (Part.some (rawRatCode (name n))).bind (fun k => Part.some (ratRank k)) = _ + rw [Part.bind_some] + exact congrArg Part.some (ratRank_code (name n)) + +lemma computableIn_rat_add {α : Type*} [Primcodable α] {O : Set (ℕ →. ℕ)} + {f g : α → ℚ} (hf : ComputableIn O f) (hg : ComputableIn O g) : + ComputableIn O (fun a => f a + g a) := + computableIn_comp (O := O) (f := fun p : ℚ × ℚ => p.1 + p.2) (g := fun a => (f a, g a)) + (Computable.computableIn computable_rat_add) (computableIn_pair hf hg) + +lemma computableIn_rat_mul {α : Type*} [Primcodable α] {O : Set (ℕ →. ℕ)} + {f g : α → ℚ} (hf : ComputableIn O f) (hg : ComputableIn O g) : + ComputableIn O (fun a => f a * g a) := + computableIn_comp (O := O) (f := fun p : ℚ × ℚ => p.1 * p.2) (g := fun a => (f a, g a)) + (Computable.computableIn computable_rat_mul) (computableIn_pair hf hg) + +theorem effective_affine_force {O : Set (ℕ →. ℕ)} {v w : Velocity} {ν : ℝ} + (hv : EffectiveFieldIn O v) (hw : EffectiveFieldIn O w) + {name : ℕ → ℚ} (hc : ComputableIn O name) (hn : RealName name ν) + (hlin : ∀ a t, 0 ≤ t → ∀ x, + mixedD a (affineForce v w ν) t x = mixedD a v t x + ν • mixedD a w t x) : + EffectiveFieldIn O (affineForce v w ν) := by + obtain ⟨E₀, b₀, hE₀, hb₀, he₀, hbound₀⟩ := hv + obtain ⟨E₁, b₁, hE₁, hb₁, he₁, hbound₁⟩ := hw + obtain ⟨C, hC⟩ := exists_nat_ge |ν| + let prec : MultiIndex × RationalPoint × ℕ → ℕ := fun s => s.2.2 + (C + b₁ s.1 + 2) + have hb₁' : ComputableIn O (fun s : MultiIndex × RationalPoint × ℕ => b₁ s.1) := + computableIn_comp hb₁ ComputableIn.fst + have hprec : ComputableIn O prec := by + exact computableIn_comp₂ Primrec.nat_add.computableIn₂ + (computableIn_comp ComputableIn.snd ComputableIn.snd) + (computableIn_comp₂ Primrec.nat_add.computableIn₂ + (computableIn_comp₂ Primrec.nat_add.computableIn₂ (ComputableIn.const C) hb₁') + (ComputableIn.const 2)) + let arg : MultiIndex × RationalPoint × ℕ → MultiIndex × RationalPoint × ℕ := + fun s => (s.1, s.2.1, prec s) + have harg : ComputableIn O arg := computableIn_pair ComputableIn.fst + (computableIn_pair (computableIn_comp ComputableIn.fst ComputableIn.snd) hprec) + let E : MultiIndex × RationalPoint × ℕ → Fin 3 → ℚ := + fun s i => E₀ (arg s) i + name (prec s) * E₁ (arg s) i + have hi (i : Fin 3) : ComputableIn O (fun s => E s i) := by + have h₀ : ComputableIn O (fun s => E₀ (arg s) i) := + computableIn_fin_eval (computableIn_comp hE₀ harg) i + have h₁ : ComputableIn O (fun s => E₁ (arg s) i) := + computableIn_fin_eval (computableIn_comp hE₁ harg) i + have hn' : ComputableIn O (fun s => name (prec s)) := computableIn_comp hc hprec + exact computableIn_rat_add h₀ (computableIn_rat_mul hn' h₁) + have hE : ComputableIn O E := by + refine computableIn_of_eq (computableIn_fin_triple _ _ _ (hi 0) (hi 1) (hi 2)) ?_ + intro s + ext i + fin_cases i <;> rfl + let b : MultiIndex → ℕ := fun a => b₀ a + C * b₁ a + have hb : ComputableIn O b := computableIn_comp₂ Primrec.nat_add.computableIn₂ hb₀ + (computableIn_comp₂ Primrec.nat_mul.computableIn₂ (ComputableIn.const C) hb₁) + refine ⟨E, b, hE, hb, ?_, ?_⟩ + · intro a z n hz i + let k := prec (a,z,n) + have h₀ := he₀ a z k hz i + have h₁ := he₁ a z k hz i + have hν := hn k + have hνb : |(name k : ℝ)| ≤ C + 1 := by + have htriangle : |(name k : ℝ)| ≤ |(name k : ℝ) - ν| + |ν| := by + simpa only [sub_add_cancel] using abs_add_le ((name k : ℝ) - ν) ν + linarith [error_le_one k] + have hwval : |mixedD a w (z.1 : ℝ) (rationalSpace z.2) i| ≤ b₁ a := + (norm_le_pi_norm _ i).trans (hbound₁ a _ (by exact_mod_cast hz) _) + have hid : (E (a,z,n) i : ℝ) - + mixedD a (affineForce v w ν) (z.1 : ℝ) (rationalSpace z.2) i = + ((E₀ (a,z,k) i : ℝ) - mixedD a v (z.1 : ℝ) (rationalSpace z.2) i) + + (name k : ℝ) * ((E₁ (a,z,k) i : ℝ) - mixedD a w (z.1 : ℝ) (rationalSpace z.2) i) + + ((name k : ℝ) - ν) * mixedD a w (z.1 : ℝ) (rationalSpace z.2) i := by + rw [hlin a _ (by exact_mod_cast hz)] + dsimp [E, arg, k] + push_cast + ring + rw [hid] + calc + _ ≤ (error k + (C + 1) * error k) + error k * (b₁ a : ℝ) := by + refine (abs_add_le _ _).trans (add_le_add ?_ ?_) + · refine (abs_add_le _ _).trans (add_le_add h₀ ?_) + rw [abs_mul] + exact mul_le_mul hνb h₁ (abs_nonneg _) (by positivity) + · rw [abs_mul] + exact mul_le_mul hν hwval (abs_nonneg _) (error_nonneg k) + _ = (C + b₁ a + 2 : ℕ) * error (n + (C + b₁ a + 2)) := by + dsimp [k, prec] + push_cast + ring + _ ≤ error n := nat_mul_error_shift n _ + · intro a t ht x + rw [hlin a t ht x] + calc + _ ≤ ‖mixedD a v t x‖ + ‖ν • mixedD a w t x‖ := norm_add_le _ _ + _ ≤ (b₀ a : ℝ) + C * (b₁ a : ℝ) := by + apply add_le_add (hbound₀ a t ht x) + rw [norm_smul, Real.norm_eq_abs] + exact mul_le_mul hC (hbound₁ a t ht x) (norm_nonneg _) (Nat.cast_nonneg _) + _ = (b a : ℝ) := by simp [b] + +theorem effective_viscosity_clauses {v w V W : Velocity} + (hv : Geometry.JointSmooth V) (hw : Geometry.JointSmooth W) + (hev : Geometry.ForwardEq V v) (hew : Geometry.ForwardEq W w) + (ev : EffectiveFieldIn ∅ v) (ew : EffectiveFieldIn ∅ w) (ν : ℝ) : + (ComputableReal ν → EffectiveFieldIn ∅ (affineForce v w ν)) ∧ + (∀ name : ℕ → ℚ, RealName name ν → + EffectiveFieldIn {nameOracle name} (affineForce v w ν)) := by + have hlin := Geometry.mixedD_affineForce_of_extensions hv hw hev hew ν + constructor + · rintro ⟨name, hc, hn⟩ + exact effective_affine_force ev ew hc.computableIn hn hlin + · intro name hn + have lift {f : Velocity} (hf : EffectiveFieldIn ∅ f) (O : Set (ℕ →. ℕ)) : + EffectiveFieldIn O f := by + obtain ⟨E,b,hE,hb,heval,hbound⟩ := hf + refine ⟨E,b,?_,?_,heval,hbound⟩ + · exact hE.mono (Set.empty_subset O) + · exact hb.mono (Set.empty_subset O) + exact effective_affine_force (lift ev _) (lift ew _) + (realName_oracle_computable name) hn hlin + +theorem residual_effective_viscosity {U : Family Velocity} + (hU : ∀ M w, Geometry.JointSmooth (U M w)) + (ef₀ : EffectiveFamily (fun M w => inertialCoefficient (U M w))) + (ef₁ : EffectiveFamily (fun M w => viscousCoefficient (U M w))) + (M : FiniteMachine) (w : Input M) (ν : ℝ) : + (ComputableReal ν → EffectiveFieldIn ∅ + (affineForce (inertialCoefficient (U M w)) (viscousCoefficient (U M w)) ν)) ∧ + (∀ name : ℕ → ℚ, RealName name ν → EffectiveFieldIn {nameOracle name} + (affineForce (inertialCoefficient (U M w)) (viscousCoefficient (U M w)) ν)) := + effective_viscosity_clauses (hU M w).fullInertial (hU M w).viscousCoefficient + (Geometry.fullInertial_forwardEq (hU M w)) (fun _ _ => rfl) + (family_effective_field ef₀ M w ∅) (family_effective_field ef₁ M w ∅) ν + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ResidualRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ResidualRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b90e32d652bc1d587875bd1a802be10360bdffe1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/ResidualRegularity.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.BoxCoding +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.FieldBounds +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.CompactFamilies + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def ForwardEq (v w : Field F) : Prop := ∀ t, 0 ≤ t → v t = w t + +lemma ForwardEq.mixedD {v w : Field F} (h : ForwardEq v w) (a : MultiIndex) : + ForwardEq (BalancedTransport.mixedD a v) (BalancedTransport.mixedD a w) := by + induction a with + | nil => exact h + | cons i a ha => + intro t ht + funext x + cases i with + | none => + change derivWithin (fun s => BalancedTransport.mixedD a v s x) (Ici 0) t = + derivWithin (fun s => BalancedTransport.mixedD a w s x) (Ici 0) t + exact derivWithin_congr (s := Ici (0 : ℝ)) + (fun s hs => congrFun (ha s hs) x) (congrFun (ha t ht) x) + | some i => + change fderiv ℝ (BalancedTransport.mixedD a v t) x _ = fderiv ℝ (BalancedTransport.mixedD a w t) x _ + rw [ha t ht] + +lemma ForwardEq.smooth {v w : Field F} (h : ForwardEq v w) (hv : Smooth v) : Smooth w := by + apply hv.congr + intro z hz + exact congrFun (h z.1 hz.1).symm z.2 + +lemma JointSmooth.smooth {v : Field F} (hv : JointSmooth v) : Smooth v := hv.contDiffOn + +lemma ForwardEq.boundedMixed {v w : Field F} (h : ForwardEq v w) + (hv : BoundedMixed v) : BoundedMixed w := by + intro a + obtain ⟨C, hC, hbound⟩ := hv a + refine ⟨C, hC, fun t ht x => ?_⟩ + rw [← (h.mixedD a) t ht] + exact hbound t ht x + +omit [NormedAddCommGroup F] [NormedSpace ℝ F] in +lemma ForwardEq.repeatsAfter {v w : Field F} (h : ForwardEq v w) + (hp : RepeatsAfter 1 v) : RepeatsAfter 1 w := by + intro t ht + rw [← h t (by linarith), ← h (t+1) (by linarith)] + exact hp t ht + +lemma JointSmooth.laplacian {v : Velocity} (hv : JointSmooth v) : + JointSmooth (BalancedTransport.laplacian v) := JointSmooth.sum (fun i => (hv.spaceD i).spaceD i) + +lemma JointSmooth.convection {v : Velocity} (hv : JointSmooth v) : + JointSmooth (BalancedTransport.convection v) := by + apply JointSmooth.sum + intro i + exact (contDiff_pi.mp hv i).smul (hv.spaceD i) + +def fullInertial (v : Velocity) : Velocity := fun t x => BalancedTransport.Geometry.fullTimeD v t x + BalancedTransport.convection v t x + +lemma JointSmooth.fullInertial {v : Velocity} (hv : JointSmooth v) : + JointSmooth (fullInertial v) := hv.fullTimeD.add hv.convection + +lemma JointSmooth.viscousCoefficient {v : Velocity} (hv : JointSmooth v) : + JointSmooth (viscousCoefficient v) := hv.laplacian.neg + +lemma fullInertial_forwardEq {v : Velocity} (hv : JointSmooth v) : + ForwardEq (fullInertial v) (inertialCoefficient v) := by + intro t ht + funext x + change BalancedTransport.Geometry.fullTimeD v t x + BalancedTransport.convection v t x = timeD v t x + BalancedTransport.convection v t x + rw [show BalancedTransport.Geometry.fullTimeD v t x = timeD v t x from fullMixedD_eq_mixedD hv [none] t ht x] + +lemma SpatiallySupported.laplacian {K : Set Space} {v : Velocity} + (h : SpatiallySupported K v) (hK : IsClosed K) : SpatiallySupported K (BalancedTransport.laplacian v) := by + intro t x hx + exact Finset.sum_eq_zero (fun i _ => ((h.spaceD hK i).spaceD hK i) t x hx) + +lemma SpatiallySupported.convection {K : Set Space} {v : Velocity} + (h : SpatiallySupported K v) : SpatiallySupported K (BalancedTransport.convection v) := by + intro t x hx + change ∑ i, (v t x i) • BalancedTransport.spaceD i v t x = 0 + simp [h t x hx] + +lemma SpatiallySupported.fullInertial {K : Set Space} {v : Velocity} + (h : SpatiallySupported K v) : SpatiallySupported K (fullInertial v) := by + intro t x hx + change BalancedTransport.Geometry.fullTimeD v t x + BalancedTransport.convection v t x = 0 + rw [h.fullTimeD t x hx, h.convection t x hx, add_zero] + +lemma SpatiallySupported.viscousCoefficient {K : Set Space} {v : Velocity} + (h : SpatiallySupported K v) (hK : IsClosed K) : + SpatiallySupported K (viscousCoefficient v) := by + intro t x hx + change -BalancedTransport.laplacian v t x = 0 + rw [h.laplacian hK t x hx, neg_zero] + +lemma RepeatsAfter.laplacian {T : ℝ} {v : Velocity} (h : RepeatsAfter T v) : + RepeatsAfter T (BalancedTransport.laplacian v) := by + intro t ht + funext x + change (∑ i, BalancedTransport.spaceD i (BalancedTransport.spaceD i v) (t + 1) x) = ∑ i, BalancedTransport.spaceD i (BalancedTransport.spaceD i v) t x + apply Finset.sum_congr rfl + intro i _ + exact congrFun (((h.spaceD i).spaceD i) t ht) x + +lemma RepeatsAfter.convection {T : ℝ} {v : Velocity} (h : RepeatsAfter T v) : + RepeatsAfter T (BalancedTransport.convection v) := by + intro t ht + funext x + change (∑ i, v (t + 1) x i • BalancedTransport.spaceD i v (t + 1) x) = ∑ i, v t x i • BalancedTransport.spaceD i v t x + simp only [h t ht, (h.spaceD _) t ht] + +lemma RepeatsAfter.fullInertial {T : ℝ} {v : Velocity} (h : RepeatsAfter T v) + (hv : JointSmooth v) : RepeatsAfter T (fullInertial v) := by + intro t ht + funext x + change BalancedTransport.Geometry.fullTimeD v (t+1) x + BalancedTransport.convection v (t+1) x = BalancedTransport.Geometry.fullTimeD v t x + BalancedTransport.convection v t x + rw [h.fullTimeD hv t ht, h.convection t ht] + +lemma RepeatsAfter.viscousCoefficient {T : ℝ} {v : Velocity} (h : RepeatsAfter T v) : + RepeatsAfter T (viscousCoefficient v) := by + intro t ht + funext x + change -BalancedTransport.laplacian v (t+1) x = -BalancedTransport.laplacian v t x + rw [h.laplacian t ht] + +theorem prescribed_residual_regularity {K : Set Space} (hK : IsCompact K) {U : Velocity} + (hU : JointSmooth U) (hs : SpatiallySupported K U) (hp : RepeatsAfter 1 U) + (hzero : ∀ x, U 0 x = 0) (hdiv : ∀ t, 0 ≤ t → ∀ x, div U t x = 0) : + Smooth (inertialCoefficient U) ∧ Smooth (viscousCoefficient U) ∧ + CommonCompactSupport U (inertialCoefficient U) (viscousCoefficient U) ∧ + BoundedMixed U ∧ BoundedMixed (inertialCoefficient U) ∧ BoundedMixed (viscousCoefficient U) ∧ + PeriodicAfterOne U ∧ + ∀ ν : ℝ, let f := affineForce (inertialCoefficient U) (viscousCoefficient U) ν + ZeroDataSolution ν f U (fun _ _ => 0) ∧ + Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f := by + have hf₀ := hU.fullInertial + have hf₁ := hU.viscousCoefficient + have he := fullInertial_forwardEq hU + have hs₀ := hs.fullInertial + have hs₁ := hs.viscousCoefficient hK.isClosed + have hp₀ := hp.fullInertial hU + have hp₁ := hp.viscousCoefficient + refine ⟨he.smooth hf₀.smooth, hf₁.smooth, ⟨K, hK, ?_⟩, + boundedMixed_of_compact_repeating hK hU hs hp, + he.boundedMixed (boundedMixed_of_compact_repeating hK hf₀ hs₀ hp₀), + boundedMixed_of_compact_repeating hK hf₁ hs₁ hp₁, ?_, ?_⟩ + · intro t ht x hx + exact ⟨hs t x hx, (congrFun (he t ht) x).symm.trans (hs₀ t x hx), hs₁ t x hx⟩ + · intro t ht x + exact congrFun (hp t ht) x + · intro ν + dsimp only + let g : Velocity := fun t x => fullInertial U t x + ν • viscousCoefficient U t x + have hg : JointSmooth g := hf₀.add (ContDiff.smul (f := fun _ : ℝ × Space => ν) contDiff_const hf₁) + have hgs : SpatiallySupported K g := by + intro t x hx + dsimp [g] + rw [hs₀ t x hx, hs₁ t x hx, smul_zero, add_zero] + have hgp : RepeatsAfter 1 g := by + intro t ht + ext x i + dsimp [g] + rw [hp₀ t ht, hp₁ t ht] + have hge : ForwardEq g (affineForce (inertialCoefficient U) (viscousCoefficient U) ν) := by + intro t ht + ext x i + dsimp [g, affineForce] + rw [he t ht] + refine ⟨residual_zero_pressure_solution ν U hU.smooth hzero hdiv, + hge.smooth hg.smooth, + hge.boundedMixed (boundedMixed_of_compact_repeating hK hg hgs hgp), ?_⟩ + intro t ht x + exact congrFun (hge.repeatsAfter hgp t ht) x + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RhoAlgorithms.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RhoAlgorithms.lean new file mode 100644 index 0000000000000000000000000000000000000000..c038bab4cdaaa60b1a4e30c9bd36a7fe1ad7347e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/RhoAlgorithms.lean @@ -0,0 +1,207 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.FlatBounds +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.EffectiveExp +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.RelativeForce + +namespace OAI + +noncomputable section +namespace BalancedTransport.Effectivity +open Polynomial +open scoped NNReal + +def rhoCoeffStep (cs : List ℤ) : List ℤ := + 0 :: 0 :: (List.range cs.length).map (fun j => + cs.getD j 0 - (j + 1 : ℤ) * cs.getD (j + 1) 0) + +def rhoCoeffs : ℕ → List ℤ + | 0 => [1] + | n + 1 => rhoCoeffStep (rhoCoeffs n) + +lemma primrec_rhoCoeffStep : Primrec rhoCoeffStep := by + have h : Primrec₂ (fun cs : List ℤ => fun j : ℕ => + cs.getD j 0 - (j + 1 : ℤ) * cs.getD (j + 1) 0) := by + have h₁ : Primrec (fun p : List ℤ × ℕ => (p.2 + 1 : ℤ)) := by + exact (primrec_int_ofNat.comp (Primrec.succ.comp Primrec.snd)).of_eq + (fun _ => by simp) + exact (primrec_int_add.comp (Primrec.list_getD 0) + (primrec_int_neg.comp (primrec_int_mul.comp h₁ + ((Primrec.list_getD 0).comp Primrec.fst (Primrec.succ.comp Primrec.snd))))).of_eq + (fun _ => (sub_eq_add_neg _ _).symm) + exact Primrec.list_cons.comp (Primrec.const 0) (Primrec.list_cons.comp + (Primrec.const 0) (Primrec.list_map (Primrec.list_range.comp Primrec.list_length) h)) + +lemma primrec_rhoCoeffs : Primrec rhoCoeffs := by + have h : Primrec₂ (fun (_ : Unit) n => Nat.rec (motive := fun _ => List ℤ) + [1] (fun _ cs => rhoCoeffStep cs) n) := + Primrec.nat_rec (Primrec.const [1]) + (primrec_rhoCoeffStep.comp (Primrec.snd.comp Primrec.snd)).to₂ + refine (h.comp (Primrec.const ()) Primrec.id).of_eq ?_ + intro n + induction n with + | zero => rfl + | succ n ih => exact congrArg rhoCoeffStep ih + +lemma getD_zero_of_length_le {cs : List ℤ} {j : ℕ} (h : cs.length ≤ j) : + cs.getD j 0 = 0 := by + rw [List.getD_eq_getElem?_getD, List.getElem?_eq_none h] + rfl + +lemma rhoCoeffStep_getD (cs : List ℤ) (j : ℕ) : + (rhoCoeffStep cs).getD (j + 2) 0 = + cs.getD j 0 - (j + 1 : ℤ) * cs.getD (j + 1) 0 := by + simp only [rhoCoeffStep, List.getD_cons_succ] + by_cases hj : j < cs.length + · simp [List.getD_eq_getElem?_getD, List.getElem?_map, List.getElem?_range hj] + · have hj' : cs.length ≤ j := le_of_not_gt hj + rw [getD_zero_of_length_le (by simpa using hj'), getD_zero_of_length_le hj', + getD_zero_of_length_le (by omega)] + simp + +lemma rhoCoeffs_spec (n j : ℕ) : (rhoCoeffs n).getD j 0 = (rhoPolynomial n).coeff j := by + induction n generalizing j with + | zero => + cases j <;> simp [rhoCoeffs, rhoPolynomial, List.getD_eq_getElem?_getD, coeff_one] + | succ n ih => + cases j with + | zero => simp [rhoCoeffs, rhoCoeffStep, rhoPolynomial] + | succ j => + cases j with + | zero => simp [rhoCoeffs, rhoCoeffStep, rhoPolynomial, coeff_X_pow_mul'] + | succ j => + rw [show j + 1 + 1 = j + 2 by omega, rhoCoeffs, rhoCoeffStep_getD, + rhoPolynomial, coeff_X_pow_mul, coeff_sub, coeff_derivative, ← ih, ← ih] + ring + +lemma rhoCoeffs_length (n : ℕ) : (rhoCoeffs n).length = 2 * n + 1 := by + induction n with + | zero => rfl + | succ n ih => simp only [rhoCoeffs, rhoCoeffStep, List.length_cons, List.length_map, + List.length_range, ih]; omega + +lemma rhoPolynomial_coeff_zero (n j : ℕ) (h : (rhoCoeffs n).length ≤ j) : + (rhoPolynomial n).coeff j = 0 := by + rw [← rhoCoeffs_spec, getD_zero_of_length_le h] + +lemma rhoPolynomial_support_subset (n : ℕ) : + (rhoPolynomial n).support ⊆ Finset.range (rhoCoeffs n).length := by + intro j hj + rw [Finset.mem_range] + by_contra h + exact (mem_support_iff.mp hj) (rhoPolynomial_coeff_zero _ _ (le_of_not_gt h)) + +def rhoBound (n k : ℕ) : ℕ := + ∑ j ∈ Finset.range (rhoCoeffs n).length, + ((rhoCoeffs n).getD j 0).natAbs * (j + k).factorial + +lemma primrec_sum_range_nat {α : Type*} [Primcodable α] + {f : α → ℕ → ℕ} (hf : Primrec₂ f) : + Primrec₂ (fun a n => ∑ i ∈ Finset.range n, f a i) := by + have hh : Primrec₂ (fun a n => Nat.rec (motive := fun _ => ℕ) 0 + (fun j r => r + f a j) n) := + Primrec.nat_rec (Primrec.const 0) + (Primrec.nat_add.comp (Primrec.snd.comp Primrec.snd) + (hf.comp Primrec.fst (Primrec.fst.comp Primrec.snd))).to₂ + refine hh.of_eq ?_ + intro a n + induction n with + | zero => simp + | succ n ih => simpa [Finset.sum_range_succ] using congrArg (fun r => r + f a n) ih + +lemma primrec_rhoBound : Primrec₂ rhoBound := by + have hh : Primrec₂ (fun p : ℕ × ℕ => fun j => + ((rhoCoeffs p.1).getD j 0).natAbs * (j + p.2).factorial) := + Primrec.nat_mul.comp + (primrec_int_natAbs.comp ((Primrec.list_getD 0).comp + (primrec_rhoCoeffs.comp (Primrec.fst.comp Primrec.fst)) Primrec.snd)) + (primrec_nat_factorial.comp (Primrec.nat_add.comp Primrec.snd + (Primrec.snd.comp Primrec.fst))) + exact (primrec_sum_range_nat hh).comp Primrec.id + (Primrec.list_length.comp (primrec_rhoCoeffs.comp Primrec.fst)) + +lemma rhoBound_eq (n k : ℕ) : rhoBound n k = rhoWeight (rhoPolynomial n) k := by + unfold rhoBound rhoWeight + simp only [rhoCoeffs_spec] + exact (Finset.sum_subset (rhoPolynomial_support_subset n) (by + intro j _ hj + have hz : (rhoPolynomial n).coeff j = 0 := notMem_support_iff.mp hj + simp [hz])).symm + +lemma rhoJet_bound_computable (n : ℕ) (x : ℝ) : |rhoJet n x| ≤ (rhoBound n 0 : ℝ) := by + rw [rhoBound_eq] + exact rhoJet_bound n x + +def rhoPolyValue (n : ℕ) (q : ℚ) : ℚ := + ∑ j ∈ Finset.range (rhoCoeffs n).length, ((rhoCoeffs n).getD j 0 : ℚ) * q ^ j + +lemma computable_rhoPolyValue : Computable₂ rhoPolyValue := by + have hh : Computable₂ (fun p : ℕ × ℚ => fun j => + ((rhoCoeffs p.1).getD j 0 : ℚ) * p.2 ^ j) := + computable_rat_mul.comp + (computable_rat_intCast.comp ((Primrec.list_getD 0).to_comp.comp + (primrec_rhoCoeffs.to_comp.comp (Computable.fst.comp Computable.fst)) Computable.snd)) + (computable_rat_pow.comp (Computable.snd.comp Computable.fst) Computable.snd) + exact (computable_sum_range hh).comp Computable.id + (Primrec.list_length.to_comp.comp (primrec_rhoCoeffs.to_comp.comp Computable.fst)) + +lemma rhoPolyValue_cast (n : ℕ) (q : ℚ) : + (rhoPolyValue n q : ℝ) = (rhoPolynomial n).eval₂ (Int.castRingHom ℝ) (q : ℝ) := by + rw [Polynomial.eval₂_eq_sum, Polynomial.sum_def] + simp only [rhoPolyValue, Rat.cast_sum, Rat.cast_mul, Rat.cast_intCast, Rat.cast_pow, + rhoCoeffs_spec] + change (∑ j ∈ Finset.range (rhoCoeffs n).length, ((rhoPolynomial n).coeff j : ℝ) * (q : ℝ) ^ j) = _ + exact (Finset.sum_subset (rhoPolynomial_support_subset n) (by + intro j _ hj + have hz : (rhoPolynomial n).coeff j = 0 := notMem_support_iff.mp hj + simp [hz])).symm + +lemma rat_abs_le_num (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 + rw [he, abs_div, abs_of_pos (by positivity : (0 : ℝ) < q.den)] + have ha : ((q.num.natAbs : ℕ) : ℝ) = |(q.num : ℝ)| := by + simpa only [Int.cast_natCast, Int.cast_abs] using + congrArg (fun a : ℤ => (a : ℝ)) (Int.natCast_natAbs q.num) + rw [← ha] + exact (div_le_iff₀ (by positivity : (0 : ℝ) < q.den)).mpr + (le_mul_of_one_le_right (by positivity) hden) + +noncomputable def rhoApprox (n : ℕ) (q : ℚ) (p : ℕ) : ℚ := + if q ≤ 0 then 0 else + rhoPolyValue n q⁻¹ * expApprox (-q⁻¹) (p + (rhoPolyValue n q⁻¹).num.natAbs) + +lemma computable_rhoApprox : Computable (fun s : ℕ × ℚ × ℕ => rhoApprox s.1 s.2.1 s.2.2) := by + have hq : Computable (fun s : ℕ × ℚ × ℕ => s.2.1⁻¹) := + computable_rat_inv.comp (Computable.fst.comp Computable.snd) + have hv : Computable (fun s : ℕ × ℚ × ℕ => rhoPolyValue s.1 s.2.1⁻¹) := + computable_rhoPolyValue.comp Computable.fst hq + exact computable_ite (computable_rat_le.comp (Computable.fst.comp Computable.snd) + (Computable.const 0)) (Computable.const 0) + (computable_rat_mul.comp hv (computable_expApprox.comp (computable_rat_neg.comp hq) + (Primrec.nat_add.to_comp.comp (Computable.snd.comp Computable.snd) + (primrec_int_natAbs.to_comp.comp (computable_rat_num.comp hv))))) + +lemma rhoApprox_spec (n : ℕ) (q : ℚ) (p : ℕ) : + |(rhoApprox n q p : ℝ) - rhoJet n (q : ℝ)| ≤ error p := by + by_cases hq : q ≤ 0 + · simp [rhoApprox, hq, rhoJet_zero_of_nonpos n (Rat.cast_nonpos.mpr hq), error_nonneg] + · have hqp : (0 : ℝ) < q := Rat.cast_pos.mpr (lt_of_not_ge hq) + rw [rhoApprox, ite_eq_right hq, Rat.cast_mul] + have hid : rhoJet n (q : ℝ) = (rhoPolyValue n q⁻¹ : ℝ) * Real.exp (-((q : ℝ)⁻¹)) := by + rw [rhoJet, expNegInvGlue, ite_eq_right hqp.not_ge, rhoPolyValue_cast, Rat.cast_inv] + rw [hid, ← mul_sub, abs_mul] + have he := expApprox_spec (-q⁻¹) (p + (rhoPolyValue n q⁻¹).num.natAbs) + simp only [Rat.cast_neg, Rat.cast_inv] at he + exact (mul_le_mul (rat_abs_le_num _) he (abs_nonneg _) (by positivity)).trans + (nat_mul_error_shift _ _) + +lemma rhoJet_lipschitz (n : ℕ) : LipschitzWith (rhoBound (n + 1) 0 : ℝ≥0) (rhoJet n) := by + apply lipschitzWith_of_nnnorm_deriv_le (fun x => (rhoJet_hasDerivAt n x).differentiableAt) + intro x + rw [(rhoJet_hasDerivAt n x).deriv] + exact_mod_cast rhoJet_bound_computable (n + 1) x + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Routing.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Routing.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6813e2fe97089797c8855b773a8a08598708de4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Routing.lean @@ -0,0 +1,245 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Deformation + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Set +variable {ι : Type*} [Fintype ι] + +lemma finite_upper_bound {α : Type*} [Finite α] (f : α → ℝ) : + ∃ R : ℝ, ∀ i, f i < R := by + obtain ⟨R, hR⟩ := (Set.finite_range f).bddAbove + exact ⟨R + 1, fun i => (hR (mem_range_self i)).trans_lt (lt_add_one _)⟩ + +lemma finite_positive_lower_bound {α : Type*} [Fintype α] (f : α → ℝ) + (hf : ∀ i, 0 < f i) : ∃ r : ℝ, 0 < r ∧ ∀ i, r ≤ f i := by + classical + have hh : ∀ s : Finset α, ∃ r : ℝ, 0 < r ∧ ∀ i ∈ s, r ≤ f i := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨1, by norm_num, by simp⟩ + | @insert a s ha ih => + obtain ⟨r, hr, h⟩ := ih + refine ⟨min r (f a), lt_min hr (hf a), ?_⟩ + intro i hi + rcases Finset.mem_insert.mp hi with rfl | hi + · exact min_le_right _ _ + · exact (min_le_left _ _).trans (h i hi) + simpa using hh Finset.univ + +omit [Fintype ι] in +lemma BoxLayout.Separated.mono {A : BoxLayout ι} {η δ : ℝ} + (h : A.Separated δ) (hle : η ≤ δ) : A.Separated η := by + intro i j hij + obtain ⟨k, hk⟩ := h i j hij + exact ⟨k, by linarith⟩ + +lemma BoxLayout.Separated.positive_margin {A : BoxLayout ι} + (h : A.Separated 0) : ∃ η : ℝ, 0 < η ∧ A.Separated η := by + classical + let J := {p : ι × ι // p.1 ≠ p.2} + have hs (p : J) : ∃ k, 0 < |A.center p.1.1 k - A.center p.1.2 k| - + (A.width p.1.1 k + A.width p.1.2 k) := by + obtain ⟨k, hk⟩ := h _ _ p.2 + exact ⟨k, by linarith⟩ + choose κ hκ using hs + obtain ⟨δ, hδ, hm⟩ := finite_positive_lower_bound + (fun p : J => |A.center p.1.1 (κ p) - A.center p.1.2 (κ p)| - + (A.width p.1.1 (κ p) + A.width p.1.2 (κ p))) hκ + refine ⟨δ / 8, by positivity, ?_⟩ + intro i j hij + let p : J := ⟨(i, j), hij⟩ + refine ⟨κ p, ?_⟩ + have hh := hm p + dsimp [p] at hh ⊢ + linarith + +omit [Fintype ι] in +lemma BoxLayout.center_injective {A : BoxLayout ι} + (hp : A.Positive) (hs : A.Separated 0) : Function.Injective A.center := by + intro i j hij + by_contra hne + obtain ⟨k, hk⟩ := hs i j hne + rw [hij, sub_self, abs_zero] at hk + linarith [hp i k, hp j k] + +omit [Fintype ι] in +lemma centerSeparated_of_norm {a : ι → Space} {D : ℝ} + (hD : 0 ≤ D) (ha : ∀ i j, i ≠ j → D < ‖a i - a j‖) : CenterSeparated a D := by + intro i j hij + by_contra! h + have hh : ‖a i - a j‖ ≤ D := (pi_norm_le_iff_of_nonneg hD).mpr (by + intro k + simpa only [Pi.sub_apply, Real.norm_eq_abs] using h k) + exact (ha i j hij).not_ge hh + +lemma exists_expansion {a b : ι → Space} (ha : Function.Injective a) + (hb : Function.Injective b) {D R : ℝ} (hD : 0 ≤ D) : + ∃ Λ : ℝ, 1 ≤ Λ ∧ R + 2 ≤ Λ ∧ + CenterSeparated (fun i k => Λ * a i k) D ∧ + CenterSeparated (fun i k => Λ * b i k) D := by + obtain ⟨La, hLa⟩ := finite_upper_bound (fun p : ι × ι => D / ‖a p.1 - a p.2‖) + obtain ⟨Lb, hLb⟩ := finite_upper_bound (fun p : ι × ι => D / ‖b p.1 - b p.2‖) + let Λ := max 1 (max (R + 2) (max La Lb)) + have hΛ : 1 ≤ Λ := le_max_left _ _ + have hΛR : R + 2 ≤ Λ := (le_max_left _ _).trans (le_max_right _ _) + have hΛa : La ≤ Λ := (le_max_left _ _).trans ((le_max_right _ _).trans (le_max_right _ _)) + have hΛb : Lb ≤ Λ := (le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _)) + have hh (c : ι → Space) (hc : Function.Injective c) + (hLc : ∀ i j, D / ‖c i - c j‖ < Λ) : + CenterSeparated (fun i k => Λ * c i k) D := by + apply centerSeparated_of_norm hD + intro i j hij + have hpos : 0 < ‖c i - c j‖ := norm_pos_iff.mpr (sub_ne_zero.mpr (hc.ne hij)) + have he : (fun k => Λ * c i k) - (fun k => Λ * c j k) = Λ • (c i - c j) := by + ext k + simp only [Pi.sub_apply, Pi.smul_apply, smul_eq_mul] + ring + rw [he, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by linarith : 0 ≤ Λ)] + exact (div_lt_iff₀ hpos).mp (hLc i j) + exact ⟨Λ, hΛ, hΛR, hh a ha (fun i j => (hLa (i,j)).trans_le hΛa), + hh b hb (fun i j => (hLb (i,j)).trans_le hΛb)⟩ + +lemma exists_parking (a b : ι → Space) {D R : ℝ} (hD : 0 ≤ D) : + ∃ p : ι → Space, + (∀ i j, D < |a i 0 - p j 0|) ∧ + (∀ i j, D < |b i 0 - p j 0|) ∧ + (∀ i j, i ≠ j → D < |p i 0 - p j 0|) ∧ + (∀ i, 2 + R < p i 0) := by + classical + obtain ⟨La, hLa⟩ := finite_upper_bound (fun i => a i 0) + obtain ⟨Lb, hLb⟩ := finite_upper_bound (fun i => b i 0) + let K := max (3 + R) (max La Lb) + D + 1 + let e := Fintype.equivFin ι + let p : ι → Space := fun i => ![K + (D + 1) * (e i).val, 0, 0] + have hKs : 2 + R < K := by dsimp [K]; have := le_max_left (3 + R) (max La Lb); linarith + have hKa : ∀ i, D < K - a i 0 := by + intro i + have := (le_max_left La Lb).trans (le_max_right (3 + R) (max La Lb)) + have := hLa i + dsimp [K] + linarith + have hKb : ∀ i, D < K - b i 0 := by + intro i + have := (le_max_right La Lb).trans (le_max_right (3 + R) (max La Lb)) + have := hLb i + dsimp [K] + linarith + have hpn : ∀ i, K ≤ p i 0 := by + intro i + dsimp [p] + exact le_add_of_nonneg_right (mul_nonneg (by linarith) (Nat.cast_nonneg _)) + refine ⟨p, ?_, ?_, ?_, fun i => hKs.trans_le (hpn i)⟩ + · intro i j + have := hKa i + have := hpn j + rw [abs_sub_comm] + exact lt_of_lt_of_le (by linarith : D < p j 0 - a i 0) (le_abs_self _) + · intro i j + have := hKb i + have := hpn j + rw [abs_sub_comm] + exact lt_of_lt_of_le (by linarith : D < p j 0 - b i 0) (le_abs_self _) + · intro i j hij + have hv : (e i).val ≠ (e j).val := by intro h; exact hij (e.injective (Fin.ext h)) + have hh : (1 : ℝ) ≤ |(e i).val - ((e j).val : ℝ)| := by + rcases lt_or_gt_of_ne hv with hl | hl + · have hcast : ((e i).val : ℝ) + 1 ≤ (e j).val := by exact_mod_cast hl + rw [abs_of_nonpos (by linarith : ((e i).val : ℝ) - (e j).val ≤ 0)] + linarith + · have hcast : ((e j).val : ℝ) + 1 ≤ (e i).val := by exact_mod_cast hl + rw [abs_of_nonneg (by linarith : 0 ≤ ((e i).val : ℝ) - (e j).val)] + linarith + have he : p i 0 - p j 0 = (D + 1) * (((e i).val : ℝ) - (e j).val) := by dsimp [p]; ring + rw [he, abs_mul, abs_of_nonneg (by linarith : 0 ≤ D + 1)] + nlinarith + +theorem guarded_solid_box_motion (A B : BoxLayout ι) (safe : Set ι) + (hA : A.Positive) (hB : B.Positive) + (hsA : A.Separated 0) (hsB : B.Separated 0) + (hvol : ∀ i, ∏ k, A.width i k = ∏ k, B.width i k) + (hgA : A.Guarded safe) (hgB : B.Guarded safe) : + ∃ η : ℝ, 0 < η ∧ Nonempty (BoxMotion A B safe η) := by + classical + obtain ⟨ηA, hηA, hmA⟩ := hsA.positive_margin + obtain ⟨ηB, hηB, hmB⟩ := hsB.positive_margin + let η := min ηA ηB + have hη : 0 < η := lt_min hηA hηB + have hmA' := hmA.mono (min_le_left ηA ηB) + have hmB' := hmB.mono (min_le_right ηA ηB) + obtain ⟨RA, hRA⟩ := finite_upper_bound (fun p : ι × Fin 3 => A.width p.1 p.2) + obtain ⟨RB, hRB⟩ := finite_upper_bound (fun p : ι × Fin 3 => B.width p.1 p.2) + let R := max 1 (max RA RB) + have hR : 1 ≤ R := le_max_left _ _ + have hAR : ∀ i k, A.width i k ≤ R := fun i k => (hRA (i,k)).le.trans + ((le_max_left _ _).trans (le_max_right _ _)) + have hBR : ∀ i k, B.width i k ≤ R := fun i k => (hRB (i,k)).le.trans + ((le_max_right _ _).trans (le_max_right _ _)) + let D := 2 * R + 4 * η + have hD : 0 ≤ D := by dsimp [D]; linarith + obtain ⟨Λ, hΛ, hΛR, hΛA, hΛB⟩ := exists_expansion + (BoxLayout.center_injective hA hsA) (BoxLayout.center_injective hB hsB) (R := R) hD + let a : ι → Space := fun i k => Λ * A.center i k + let b : ι → Space := fun i k => Λ * B.center i k + obtain ⟨p, hpa, hpb, hpp, hpg⟩ := exists_parking a b (R := R) hD + have hag : ∀ i ∈ safe, 2 + R < a i 0 := by + intro i hi + have hh : 2 < A.center i 0 := by have := hgA i hi; linarith [hA i 0] + have hΛp : 0 < Λ := by linarith + have hh' := mul_lt_mul_of_pos_left hh hΛp + dsimp [a] + nlinarith + have hbg : ∀ i ∈ safe, 2 + R < b i 0 := by + intro i hi + have hh : 2 < B.center i 0 := by have := hgB i hi; linarith [hB i 0] + have hΛp : 0 < Λ := by linarith + have hh' := mul_lt_mul_of_pos_left hh hΛp + dsimp [b] + nlinarith + have hga : (BoxLayout.mk a B.width).Guarded safe := by + intro i hi + change 2 < a i 0 - B.width i 0 + linarith [hag i hi, hBR i 0] + have hgb : (BoxLayout.mk b B.width).Guarded safe := by + intro i hi + change 2 < b i 0 - B.width i 0 + linarith [hbg i hi, hBR i 0] + have hgp : (BoxLayout.mk p B.width).Guarded safe := by + intro i _ + change 2 < p i 0 - B.width i 0 + linarith [hpg i, hBR i 0] + have hsize : ∀ i j k, B.width i k + B.width j k + 4 * η ≤ D := by + intro i j k + dsimp [D] + linarith [hBR i k, hBR j k] + obtain ⟨HA, hHA⟩ := finite_upper_bound (fun i => a i 1) + obtain ⟨HB, hHB⟩ := finite_upper_bound (fun i => b i 1) + obtain ⟨HP, hHP⟩ := finite_upper_bound (fun i => p i 1) + let H := max HA (max HB HP) + D + 1 + have hhA : ∀ i, D < H - a i 1 := by + intro i + have := le_max_left HA (max HB HP) + have := hHA i + dsimp [H]; linarith + have hhB : ∀ i, D < H - b i 1 := by + intro i + have := (le_max_left HB HP).trans (le_max_right HA (max HB HP)) + have := hHB i + dsimp [H]; linarith + have hhP : ∀ i, D < H - p i 1 := by + intro i + have := (le_max_right HB HP).trans (le_max_right HA (max HB HP)) + have := hHP i + dsimp [H]; linarith + let m₁ := expandCenters hA hmA' hgA hΛ + let m₂ := reshapeMotion hA hB hAR hBR hvol (le_refl D) hΛA hag + let m₃ := evacuateToParking hB hsize hΛA hpa hpp hhA hhP hD hga hgp + let m₄ := evacuateToParking hB hsize hΛB hpb hpp hhB hhP hD hgb hgp + let m₅ := expandCenters hB hmB' hgB hΛ + exact ⟨η, hη, ⟨(((m₁.trans m₂).trans m₃).trans m₄.reverse).trans m₅.reverse⟩⟩ + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Sobolev.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Sobolev.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7a3e2e7203cbaab9ddcf80c91fc923cda82bba3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Sobolev.lean @@ -0,0 +1,225 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Elementary + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open MeasureTheory Filter Set +open scoped Topology ENNReal NNReal +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +omit [NormedSpace ℝ F] in +lemma SpatiallySupported.hasCompactSupport {K : Set Space} (hK : IsCompact K) + {v : Field F} (hs : SpatiallySupported K v) (t : ℝ) : HasCompactSupport (v t) := by + apply hK.of_isClosed_subset (isClosed_tsupport _) + exact closure_minimal (fun x hx => by + by_contra hn + exact hx (hs t x hn)) hK.isClosed + +lemma JointSmooth.memLp {K : Set Space} (hK : IsCompact K) {v : Field F} + (hv : JointSmooth v) (hs : SpatiallySupported K v) (t : ℝ) : + MemLp (v t) 2 (volume : Measure Space) := + (hv.slice t).continuous.memLp_of_hasCompactSupport (hs.hasCompactSupport hK t) + +def supportedL2Curve {K : Set Space} (hK : IsCompact K) {v : Field F} + (hv : JointSmooth v) (hs : SpatiallySupported K v) : ℝ → Lp F 2 (volume : Measure Space) := + fun t => (hv.memLp hK hs t).toLp (v t) + +lemma supportedL2Curve_coe {K : Set Space} (hK : IsCompact K) {v : Field F} + (hv : JointSmooth v) (hs : SpatiallySupported K v) (t : ℝ) : + (supportedL2Curve hK hv hs t : Space → F) =ᵐ[volume] v t := MemLp.coeFn_toLp _ + +def supportL2Size (K : Set Space) (hK : IsCompact K) : ℝ := + ‖indicatorConstLp (μ := (volume : Measure Space)) 2 hK.measurableSet hK.measure_lt_top.ne (1 : ℝ)‖ + +lemma supportL2Size_nonneg (K : Set Space) (hK : IsCompact K) : 0 ≤ supportL2Size K hK := + norm_nonneg _ + +omit [NormedSpace ℝ F] in +lemma lp_norm_bound_of_support {K : Set Space} (hK : IsCompact K) + {f : Lp F 2 (volume : Measure Space)} {g : Space → F} {C : ℝ} + (he : (f : Space → F) =ᵐ[volume] g) (hs : ∀ x, x ∉ K → g x = 0) + (hb : ∀ x, ‖g x‖ ≤ C) : ‖f‖ ≤ C * supportL2Size K hK := by + apply Lp.norm_le_mul_norm_of_ae_le_mul + filter_upwards [he, indicatorConstLp_coeFn (p := 2) (μ := (volume : Measure Space)) + (hs := hK.measurableSet) (hμs := hK.measure_lt_top.ne) (c := (1 : ℝ))] with x hfx hix + rw [hfx, hix] + by_cases hx : x ∈ K + · simpa only [indicator_of_mem hx, norm_one, mul_one] using hb x + · simp only [indicator_of_notMem hx, hs x hx, norm_zero, mul_zero, le_refl] + +lemma time_difference_bound {v : Field F} (hv : JointSmooth v) {C : ℝ} + (hb : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD v t x‖ ≤ C) + {s t : ℝ} (hs : 0 ≤ s) (ht : 0 ≤ t) (x : Space) : + ‖v s x - v t x‖ ≤ C * ‖s - t‖ := + (convex_Ici (0 : ℝ)).norm_image_sub_le_of_norm_deriv_le + (fun r _ => (hv.timeSlice x).differentiable (by simp) r) + (fun r hr => hb r hr x) ht hs + +lemma time_remainder_bound {v : Field F} (hv : JointSmooth v) {B : ℝ} (hB : 0 ≤ B) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD (fullTimeD v) t x‖ ≤ B) + {s t : ℝ} (hs : 0 ≤ s) (ht : 0 ≤ t) (x : Space) : + ‖v s x - v t x - (s - t) • fullTimeD v t x‖ ≤ B * ‖s - t‖ * ‖s - t‖ := by + let r : ℝ → F := fun q => v q x - v t x - (q - t) • fullTimeD v t x + have hdr (q : ℝ) : HasDerivAt r (fullTimeD v q x - fullTimeD v t x) q := by + convert (((hv.timeSlice x).differentiable (by simp) q).hasDerivAt.sub_const (v t x)).sub + (((hasDerivAt_id q).sub_const t).smul_const (fullTimeD v t x)) using 1 <;> + simp only [r, fullTimeD, id_eq, one_smul] + rfl + have hbound (q : ℝ) (hq : q ∈ uIcc t s) : + ‖deriv r q‖ ≤ B * ‖s - t‖ := by + rw [(hdr q).deriv] + have hq₀ : 0 ≤ q := (le_min ht hs).trans hq.1 + refine (time_difference_bound hv.fullTimeD hb hq₀ ht x).trans ?_ + apply mul_le_mul_of_nonneg_left _ hB + simpa only [Real.dist_eq, ← Real.norm_eq_abs, norm_sub_rev] using + Real.dist_left_le_of_mem_uIcc hq + have h := (convex_uIcc t s).norm_image_sub_le_of_norm_deriv_le + (fun q _ => (hdr q).differentiableAt) hbound (left_mem_uIcc) (right_mem_uIcc) + simpa only [r, sub_self, zero_smul, sub_zero] using h + +lemma supportedL2Curve_difference_bound {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) {C : ℝ} + (hb : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD v t x‖ ≤ C) + {s t : ℝ} (hs₀ : 0 ≤ s) (ht₀ : 0 ≤ t) : + ‖supportedL2Curve hK hv hs s - supportedL2Curve hK hv hs t‖ ≤ + C * ‖s - t‖ * supportL2Size K hK := by + apply lp_norm_bound_of_support hK + · exact (Lp.coeFn_sub _ _).trans ((supportedL2Curve_coe hK hv hs s).sub + (supportedL2Curve_coe hK hv hs t)) + · intro x hx + change v s x - v t x = 0 + simp only [hs s x hx, hs t x hx, sub_self] + · exact fun x => time_difference_bound hv hb hs₀ ht₀ x + +lemma supportedL2Curve_continuousOn {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) {C : ℝ} (hC : 0 ≤ C) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD v t x‖ ≤ C) : + ContinuousOn (supportedL2Curve hK hv hs) (Ici 0) := by + let L : ℝ≥0 := ⟨C * supportL2Size K hK, mul_nonneg hC (supportL2Size_nonneg K hK)⟩ + apply LipschitzOnWith.continuousOn (K := L) + apply LipschitzOnWith.of_dist_le_mul + intro s hs₀ t ht₀ + simp only [dist_eq_norm] + change ‖supportedL2Curve hK hv hs s - supportedL2Curve hK hv hs t‖ ≤ + C * supportL2Size K hK * ‖s - t‖ + convert supportedL2Curve_difference_bound hK hv hs hb hs₀ ht₀ using 1 + ring + +lemma supportedL2Curve_hasDerivWithinAt {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) {B : ℝ} (hB : 0 ≤ B) + (hb : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD (fullTimeD v) t x‖ ≤ B) + {t : ℝ} (ht : 0 ≤ t) : + HasDerivWithinAt (supportedL2Curve hK hv hs) + (supportedL2Curve hK hv.fullTimeD hs.fullTimeD t) (Ici 0) t := by + let V := supportedL2Curve hK hv hs + let W := supportedL2Curve hK hv.fullTimeD hs.fullTimeD + have hrem (s : ℝ) (hs₀ : 0 ≤ s) : + ‖V s - V t - (s-t) • W t‖ ≤ B * ‖s-t‖ * ‖s-t‖ * supportL2Size K hK := by + apply lp_norm_bound_of_support hK + · exact (Lp.coeFn_sub _ _).trans (((Lp.coeFn_sub _ _).trans + ((supportedL2Curve_coe hK hv hs s).sub (supportedL2Curve_coe hK hv hs t))).sub + ((Lp.coeFn_smul _ _).trans ((supportedL2Curve_coe hK hv.fullTimeD hs.fullTimeD t).const_smul _))) + · intro x hx + change v s x - v t x - (s-t) • fullTimeD v t x = 0 + simp only [hs s x hx, hs t x hx, hs.fullTimeD t x hx, sub_self, smul_zero] + · exact fun x => time_remainder_bound hv hB hb hs₀ ht x + apply HasDerivWithinAt.of_isLittleO + apply Asymptotics.IsLittleO.of_bound + intro ε hε + have hc : ContinuousAt (fun s : ℝ => B * supportL2Size K hK * ‖s-t‖) t := by fun_prop + have hn : ∀ᶠ s in 𝓝[Ici 0] t, B * supportL2Size K hK * ‖s-t‖ < ε := + mem_nhdsWithin_of_mem_nhds (hc.eventually (gt_mem_nhds (by simpa using hε))) + filter_upwards [self_mem_nhdsWithin, hn] with s hs₀ hsε + exact (hrem s hs₀).trans (by nlinarith [norm_nonneg (s-t)]) + +lemma spatialD_eq_fullMixedD (a : List (Fin 3)) (v : Field F) : + spatialD a v = fullMixedD (a.map some) v := by + induction a with + | nil => rfl + | cons i a ha => simp only [spatialD, List.map_cons, fullMixedD, ha] + +theorem CH_of_compact_boundedMixed {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) (hb : BoundedMixed v) + (k : ℕ) : CH k v := by + intro a _ + let d := fullMixedD (a.map some) v + have hd : JointSmooth d := hv.fullMixedD _ + have hds : SpatiallySupported K d := hs.fullMixedD hK.isClosed _ + obtain ⟨C, hC, hbound⟩ := hb (none :: a.map some) + have he (t : ℝ) (ht : 0 ≤ t) (x : Space) : + fullTimeD d t x = mixedD (none :: a.map some) v t x := + fullMixedD_eq_mixedD hv (none :: a.map some) t ht x + have hb' : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD d t x‖ ≤ C := by + intro t ht x + rw [he t ht x] + exact hbound t ht x + refine ⟨supportedL2Curve hK hd hds, + supportedL2Curve_continuousOn hK hd hds hC hb', fun t _ => ?_⟩ + simpa only [spatialD_eq_fullMixedD] using supportedL2Curve_coe hK hd hds t + +theorem C1L2_of_compact_boundedMixed {K : Set Space} (hK : IsCompact K) + {v : Field F} (hv : JointSmooth v) (hs : SpatiallySupported K v) (hb : BoundedMixed v) : + C1L2 v := by + obtain ⟨C, hC, hc⟩ := hb [none] + obtain ⟨B, hB, hb'⟩ := hb [none, none] + have hc' : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD v t x‖ ≤ C := by + intro t ht x + rw [show fullTimeD v t x = mixedD [none] v t x from fullMixedD_eq_mixedD hv [none] t ht x] + exact hc t ht x + have hb'' : ∀ t, 0 ≤ t → ∀ x, ‖fullTimeD (fullTimeD v) t x‖ ≤ B := by + intro t ht x + rw [show fullTimeD (fullTimeD v) t x = mixedD [none,none] v t x from + fullMixedD_eq_mixedD hv [none, none] t ht x] + exact hb' t ht x + refine ⟨supportedL2Curve hK hv hs, supportedL2Curve hK hv.fullTimeD hs.fullTimeD, + supportedL2Curve_continuousOn hK hv hs hC hc', + supportedL2Curve_continuousOn hK hv.fullTimeD hs.fullTimeD hB hb'', fun t ht => ?_⟩ + refine ⟨supportedL2Curve_coe hK hv hs t, ?_, + supportedL2Curve_hasDerivWithinAt hK hv hs hB hb'' ht⟩ + apply (supportedL2Curve_coe hK hv.fullTimeD hs.fullTimeD t).trans + exact Eventually.of_forall (fun x => fullMixedD_eq_mixedD hv [none] t ht x) + +lemma boundedOnFiniteSlabs_of_boundedMixed {v : Velocity} (hv : BoundedMixed v) : + BoundedOnFiniteSlabs v := by + obtain ⟨C, hC, hb⟩ := hv [] + have hd : ∀ i : Fin 3, ∃ D : ℝ, 0 ≤ D ∧ ∀ t, 0 ≤ t → ∀ x, ‖spaceD i v t x‖ ≤ D := + fun i => hv [some i] + choose D hD hd using hd + intro T _ + refine ⟨C + ∑ i, D i, add_nonneg hC (Finset.sum_nonneg (fun i _ => hD i)), ?_⟩ + intro t ht x + constructor + · exact (hb t ht.1 x).trans (le_add_of_nonneg_right (Finset.sum_nonneg (fun i _ => hD i))) + · intro i + exact (hd i t ht.1 x).trans + ((Finset.single_le_sum (fun j _ => hD j) (Finset.mem_univ i)).trans (le_add_of_nonneg_left hC)) + +lemma spatialD_zero (a : List (Fin 3)) : spatialD a (0 : Field F) = 0 := by + induction a with + | nil => rfl + | cons i a ha => + simp only [spatialD, ha] + ext t x + simp [spaceD] + +lemma CH_zero (k : ℕ) : CH k (0 : Field F) := by + intro a _ + refine ⟨0, continuousOn_const, fun t _ => ?_⟩ + rw [spatialD_zero] + exact Lp.coeFn_zero F 2 (volume : Measure Space) + +theorem comparisonClass_of_compact_boundedMixed {K : Set Space} (hK : IsCompact K) + {v : Velocity} (hv : JointSmooth v) (hs : SpatiallySupported K v) (hb : BoundedMixed v) : + ComparisonClass v (fun _ _ => 0) := by + refine ⟨CH_of_compact_boundedMixed hK hv hs hb 2, + C1L2_of_compact_boundedMixed hK hv hs hb, + boundedOnFiniteSlabs_of_boundedMixed hb, fun _ => 0, ?_⟩ + convert CH_zero (F := ℝ) 1 using 1 + ext t x + exact sub_zero 0 + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TemporalJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TemporalJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..17a0fc3808e4877fee67f8765ad40634e7e1a9d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TemporalJets.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Periodic +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Routing +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.ElementaryFields + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open Filter Set +open scoped Topology +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +lemma timeGerm_fullTimeD {v w : Field F} {t : ℝ} (h : v =ᶠ[𝓝 t] w) : + fullTimeD v =ᶠ[𝓝 t] fullTimeD w := by + filter_upwards [h.eventually_nhds] with s hs + funext x + have he : (fun r => v r x) =ᶠ[𝓝 s] (fun r => w r x) := hs.mono (fun _ he => congrFun he x) + exact he.deriv_eq + +lemma timeGerm_spaceD {v w : Field F} {t : ℝ} (h : v =ᶠ[𝓝 t] w) (i : Fin 3) : + spaceD i v =ᶠ[𝓝 t] spaceD i w := by + filter_upwards [h] with s hs + funext x + change fderiv ℝ (v s) x _ = fderiv ℝ (w s) x _ + rw [hs] + +lemma timeGerm_fullMixedD {v w : Velocity} {t : ℝ} (h : v =ᶠ[𝓝 t] w) (a : MultiIndex) : + fullMixedD a v =ᶠ[𝓝 t] fullMixedD a w := by + induction a with + | nil => exact h + | cons i a ih => cases i with + | none => exact timeGerm_fullTimeD ih + | some i => exact timeGerm_spaceD ih i + +lemma timeGerm_fullInertial {v w : Velocity} {t : ℝ} (h : v =ᶠ[𝓝 t] w) : + fullInertial v =ᶠ[𝓝 t] fullInertial w := by + have hd : ∀ᶠ s in 𝓝 t, ∀ i : Fin 3, spaceD i v s = spaceD i w s := + (Filter.eventually_all).mpr (fun i => timeGerm_spaceD h i) + filter_upwards [h, timeGerm_fullTimeD h, hd] with s hs ht hd + funext x + change fullTimeD v s x + BalancedTransport.convection v s x = fullTimeD w s x + BalancedTransport.convection w s x + simp only [BalancedTransport.convection, hs, ht, hd] + +lemma timeGerm_viscous {v w : Velocity} {t : ℝ} (h : v =ᶠ[𝓝 t] w) : + viscousCoefficient v =ᶠ[𝓝 t] viscousCoefficient w := by + have hd : ∀ᶠ s in 𝓝 t, ∀ i : Fin 3, spaceD i (spaceD i v) s = spaceD i (spaceD i w) s := + (Filter.eventually_all).mpr (fun i => timeGerm_spaceD (timeGerm_spaceD h i) i) + filter_upwards [hd] with s hd + funext x + change -(∑ i, spaceD i (spaceD i v) s x) = -(∑ i, spaceD i (spaceD i w) s x) + simp only [hd] + +lemma fullTimeD_translate (v : Field F) (b : ℝ) : + fullTimeD (fun t => v (t-b)) = fun t => fullTimeD v (t-b) := by + funext t x + exact deriv_comp_sub_const (fun s => v s x) b t + +lemma fullMixedD_translate (v : Velocity) (a : MultiIndex) (b : ℝ) : + fullMixedD a (fun t => v (t-b)) = fun t => fullMixedD a v (t-b) := by + induction a with + | nil => rfl + | cons i a ih => cases i with + | none => simp only [fullMixedD, ih, fullTimeD_translate] + | some i => simp only [fullMixedD, ih]; rfl + +lemma fullInertial_translate (v : Velocity) (b : ℝ) : + fullInertial (fun t => v (t-b)) = fun t => fullInertial v (t-b) := by + ext t x i + simp only [fullInertial, fullTimeD_translate, convection, spaceD] + +lemma viscous_translate (v : Velocity) (b : ℝ) : + viscousCoefficient (fun t => v (t-b)) = fun t => viscousCoefficient v (t-b) := rfl + +lemma loadedRepeat_before_open {load v : Velocity} (hc : TimeCollars v) + {t : ℝ} (ht : t < 5/4) : loadedRepeat load v t = load t := by + by_cases hh : t ≤ 3/4 + · have he : afterLoadingGate t = 0 := Real.smoothTransition.zero_of_nonpos (by linarith) + ext x i + simp [loadedRepeat, he] + · have he : repeatTemplate v t = 0 := by + ext x i + rw [repeatTemplate_eq hc (n := 0) (by simp only [Int.cast_zero, sub_zero]; constructor <;> linarith), + Int.cast_zero, sub_zero, hc t (Or.inr (lt_of_not_ge hh))] + ext x i + simp [loadedRepeat, he] + +lemma loadedRepeat_after_open {load v : Velocity} (hl : TimeCollars load) (hc : TimeCollars v) + {t : ℝ} (ht : 3/4 < t) : loadedRepeat load v t = repeatTemplate v t := by + by_cases hh : 1 ≤ t + · exact loadedRepeat_after hl hh + · have he : repeatTemplate v t = 0 := by + ext x i + rw [repeatTemplate_eq hc (n := 0) (by simp only [Int.cast_zero, sub_zero]; constructor <;> linarith), + Int.cast_zero, sub_zero, hc t (Or.inr ht)] + ext x i + simp [loadedRepeat, he, hl t (Or.inr ht)] + +lemma loadedRepeat_germ_before {load v : Velocity} (hc : TimeCollars v) + {t : ℝ} (ht : t < 1) : loadedRepeat load v =ᶠ[𝓝 t] load := by + filter_upwards [eventually_lt_nhds (show t < 5/4 by linarith)] with s hs + exact loadedRepeat_before_open hc hs + +lemma loadedRepeat_germ_after {load v : Velocity} (hl : TimeCollars load) (hc : TimeCollars v) + {t : ℝ} (ht : 1 ≤ t) : + loadedRepeat load v =ᶠ[𝓝 t] (fun s => v (s-(⌊t⌋ : ℤ))) := by + have hi : t - (⌊t⌋ : ℤ) ∈ Ioo (-1/4 : ℝ) (5/4) := by + have := Int.floor_le t + have := Int.lt_floor_add_one t + constructor <;> linarith + have hn : ∀ᶠ s : ℝ in 𝓝 t, s - (⌊t⌋ : ℤ) ∈ Ioo (-1/4 : ℝ) (5/4) := + (continuous_id.sub continuous_const).continuousAt.eventually (isOpen_Ioo.mem_nhds hi) + filter_upwards [hn, eventually_gt_nhds (show (3 : ℝ)/4 < t by linarith)] with s hs hst + rw [loadedRepeat_after_open hl hc hst] + exact funext (repeatTemplate_eq hc hs) + +end BalancedTransport.Geometry +end + +noncomputable section +namespace BalancedTransport.Effectivity +open BalancedTransport.Geometry + +lemma ElementaryField.convection {d : ℕ} {v : (Fin d → ℝ) → Velocity} + (hv : ElementaryField v) : ElementaryField (fun p => convection (v p)) := by + intro k + simp only [BalancedTransport.convection, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + apply ElementaryScalar.sum Finset.univ + intro i _ + exact (hv i).mul ((hv.spaceD i) k) + +lemma ElementaryField.fullInertial {d : ℕ} {v : (Fin d → ℝ) → Velocity} + (hv : ElementaryField v) : ElementaryField (fun p => fullInertial (v p)) := + fun i => ((hv.fullTimeD) i).add (hv.convection i) + +lemma ElementaryField.viscous {d : ℕ} {v : (Fin d → ℝ) → Velocity} + (hv : ElementaryField v) : ElementaryField (fun p => viscousCoefficient (v p)) := by + intro k + simp only [viscousCoefficient, laplacian, Pi.neg_apply, Finset.sum_apply] + apply ElementaryScalar.neg + apply ElementaryScalar.sum Finset.univ + intro i _ + exact ((hv.spaceD i).spaceD i) k + +end BalancedTransport.Effectivity +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TimeRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TimeRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..cfe2cea2bb927bd796aa1c67a8e9410532d19609 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/TimeRegularity.lean @@ -0,0 +1,213 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Work + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def JointSmooth (f : Field F) : Prop := + ContDiff ℝ (⊤ : ℕ∞) (Function.uncurry f) + +theorem JointSmooth.slice {f : Field F} (hf : JointSmooth f) (t : ℝ) : + ContDiff ℝ (⊤ : ℕ∞) (f t) := hf.comp (contDiff_const.prodMk contDiff_id) + +theorem JointSmooth.spaceD {f : Field F} (hf : JointSmooth f) (i : Fin 3) : + JointSmooth (spaceD i f) := by + have hh : ContDiff ℝ (⊤ : ℕ∞) + (fun z : (ℝ × Space) × Space => f z.1.1 z.2) := + hf.comp (contDiff_fst.fst.prodMk contDiff_snd) + exact hh.fderiv_apply contDiff_snd contDiff_const (by simp) + +theorem JointSmooth.curl {A : Velocity} (hA : JointSmooth A) : + JointSmooth (fun t => curl (A t)) := by + have he (i : Fin 3) : JointSmooth (fun t x => A t x i) := contDiff_pi.mp hA i + have hd (i j : Fin 3) := (he j).spaceD i + apply contDiff_pi.mpr + intro i + fin_cases i + · exact (hd 1 2).sub (hd 2 1) + · exact (hd 2 0).sub (hd 0 2) + · exact (hd 0 1).sub (hd 1 0) + +theorem divergence_eq_div {A : Velocity} (hA : JointSmooth A) (t : ℝ) (x : Space) : + divergence (A t) x = div A t x := by + apply Finset.sum_congr rfl + intro i _ + exact pd_apply i i ((hA.slice t).differentiable (by simp) x) + +theorem JointSmooth.solenoidal_curl {A : Velocity} (hA : JointSmooth A) + (t : ℝ) (x : Space) : div (fun s => Geometry.curl (A s)) t x = 0 := by + rw [← divergence_eq_div hA.curl] + exact divergence_curl (hA.slice t) x + +def fullTimeD (f : Field F) : Field F := fun t x => deriv (fun s => f s x) t + +theorem JointSmooth.fullTimeD {f : Field F} (hf : JointSmooth f) : + JointSmooth (fullTimeD f) := by + have hh : ContDiff ℝ (⊤ : ℕ∞) + (fun z : (ℝ × Space) × ℝ => f z.2 z.1.2) := + hf.comp (contDiff_snd.prodMk contDiff_fst.snd) + exact ContDiff.fderiv_apply (f := fun z : ℝ × Space => fun s => f s z.2) + hh contDiff_fst contDiff_const (by simp) + +def lowerEndpoint (a : Space) (c d : ℝ → Space) (t : ℝ) : Space := + fun i => c t i + d t i * a i + +def logarithmicRate (d : ℝ → Space) (t : ℝ) : Space := + fun i => deriv (fun s => d s i) t / d t i + +def movingBoxVelocity (a b : Space) (c d : ℝ → Space) (η : ℝ) : Velocity := + fun t => localizedAffine (lowerEndpoint a c d t) (lowerEndpoint b c d t) + (c t) (deriv c t) (logarithmicRate d t) η + +lemma logarithmicRate_trace_zero {d : ℝ → Space} (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hn : ∀ t i, d t i ≠ 0) (hdet : ∀ t, ∏ i, d t i = 1) (t : ℝ) : + ∑ i, logarithmicRate d t i = 0 := by + have dh (i : Fin 3) := ((contDiff_pi.mp hd i).differentiable (by simp) t).hasDerivAt + have hconst : (fun s => d s 0 * d s 1 * d s 2) = fun _ => (1 : ℝ) := by + funext s + simpa [Fin.prod_univ_succ, mul_assoc] using hdet s + have hh := ((dh 0).fun_mul (dh 1)).fun_mul (dh 2) + rw [hconst] at hh + have hz := hh.unique (hasDerivAt_const t (1 : ℝ)) + simp only [logarithmicRate, Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] + change deriv (fun s => d s 0) t / d t 0 + + (deriv (fun s => d s 1) t / d t 1 + deriv (fun s => d s 2) t / d t 2) = 0 + field_simp [hn t 0, hn t 1, hn t 2] + nlinarith + +lemma logarithmicRate_contDiff {d : ℝ → Space} (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hn : ∀ t i, d t i ≠ 0) : ContDiff ℝ (⊤ : ℕ∞) (logarithmicRate d) := by + apply contDiff_pi.mpr + intro i + exact (contDiff_infty_iff_deriv.mp (contDiff_pi.mp hd i)).2.div + (contDiff_pi.mp hd i) (fun t => hn t i) + +theorem movingBoxVelocity_jointSmooth {c d : ℝ → Space} + (hc : ContDiff ℝ (⊤ : ℕ∞) c) (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hn : ∀ t i, d t i ≠ 0) (a b : Space) (η : ℝ) : + JointSmooth (movingBoxVelocity a b c d η) := by + apply JointSmooth.curl + have hcd := (contDiff_infty_iff_deriv.mp hc).2 + have hl := logarithmicRate_contDiff hd hn + change ContDiff ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => + boxCutoff (lowerEndpoint a c d z.1) (lowerEndpoint b c d z.1) η z.2 • + affinePotential (c z.1) (deriv c z.1) (logarithmicRate d z.1) z.2) + refine ContDiff.smul (f := fun z : ℝ × Space => + boxCutoff (lowerEndpoint a c d z.1) (lowerEndpoint b c d z.1) η z.2) + (g := fun z : ℝ × Space => + affinePotential (c z.1) (deriv c z.1) (logarithmicRate d z.1) z.2) ?_ ?_ + · unfold boxCutoff lowerEndpoint + fun_prop + · apply contDiff_pi.mpr + intro i + fin_cases i <;> dsimp [affinePotential] <;> fun_prop + +theorem movingBoxVelocity_divergence {c d : ℝ → Space} + (hc : ContDiff ℝ (⊤ : ℕ∞) c) (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hn : ∀ t i, d t i ≠ 0) (a b : Space) (η t : ℝ) (x : Space) : + div (movingBoxVelocity a b c d η) t x = 0 := by + rw [← divergence_eq_div (movingBoxVelocity_jointSmooth hc hd hn a b η)] + exact localizedAffine_divergence _ _ _ _ _ _ _ + +def affinePath (c d : ℝ → Space) (z : Space) (t : ℝ) : Space := + fun i => c t i + d t i * z i + +lemma affinePath_mem_plateau {a b : Space} {c d : ℝ → Space} {η : ℝ} + (hη : 0 < η) {z : Space} (hz : z ∈ Set.Icc a b) {t : ℝ} + (hd : ∀ i, 0 < d t i) : + affinePath c d z t ∈ openEnlargement (lowerEndpoint a c d t) + (lowerEndpoint b c d t) η := by + rw [mem_openEnlargement] + intro i + have hz₁ := hz.1 i + have hz₂ := hz.2 i + dsimp [lowerEndpoint, affinePath] + constructor <;> nlinarith [hd i] + +theorem affinePath_hasDerivAt_of_mem_plateau {a b : Space} {c d : ℝ → Space} {η : ℝ} + (hη : 0 < η) (hc : ContDiff ℝ (⊤ : ℕ∞) c) (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hp : ∀ t i, 0 < d t i) (hdet : ∀ t, ∏ i, d t i = 1) + {z : Space} (t : ℝ) + (hx : affinePath c d z t ∈ openEnlargement + (lowerEndpoint a c d t) (lowerEndpoint b c d t) η) : + HasDerivAt (affinePath c d z) + (movingBoxVelocity a b c d η t (affinePath c d z t)) t := by + have hn (s : ℝ) (i : Fin 3) := (hp s i).ne' + rw [movingBoxVelocity, localizedAffine_eq hη (logarithmicRate_trace_zero hd hn hdet t) + hx] + apply hasDerivAt_pi.mpr + intro i + have hci := (hasDerivAt_pi.mp ((hc.differentiable (by simp) t).hasDerivAt) i) + have hdi := ((contDiff_pi.mp hd i).differentiable (by simp) t).hasDerivAt + have he : deriv c t i + logarithmicRate d t i * (affinePath c d z t i - c t i) = + deriv c t i + deriv (fun s => d s i) t * z i := by + dsimp [logarithmicRate, affinePath] + field_simp [hn t i] + ring + rw [he] + exact hci.fun_add (hdi.mul_const (z i)) + +theorem affinePath_hasDerivAt {a b : Space} {c d : ℝ → Space} {η : ℝ} + (hη : 0 < η) (hc : ContDiff ℝ (⊤ : ℕ∞) c) (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hp : ∀ t i, 0 < d t i) (hdet : ∀ t, ∏ i, d t i = 1) + {z : Space} (hz : z ∈ Set.Icc a b) (t : ℝ) : + HasDerivAt (affinePath c d z) + (movingBoxVelocity a b c d η t (affinePath c d z t)) t := + affinePath_hasDerivAt_of_mem_plateau hη hc hd hp hdet t + (affinePath_mem_plateau hη hz (hp t)) + +lemma affinePath_mem_plateau_of_scaled_bound {a b : Space} {c d : ℝ → Space} + {η δ : ℝ} {z : Space} (hz : z ∈ openEnlargement a b δ) {t : ℝ} + (hp : ∀ i, 0 < d t i) (hscale : ∀ i, d t i * δ ≤ η) : + affinePath c d z t ∈ openEnlargement (lowerEndpoint a c d t) + (lowerEndpoint b c d t) η := by + rw [mem_openEnlargement] at hz ⊢ + intro i + have hlo := mul_lt_mul_of_pos_left (hz i).1 (hp i) + have hhi := mul_lt_mul_of_pos_left (hz i).2 (hp i) + dsimp [affinePath, lowerEndpoint] + constructor <;> nlinarith [hscale i] + +theorem affinePath_neighborhood {a b : Space} {c d : ℝ → Space} {η δ : ℝ} + (hη : 0 < η) (hc : ContDiff ℝ (⊤ : ℕ∞) c) (hd : ContDiff ℝ (⊤ : ℕ∞) d) + (hp : ∀ t i, 0 < d t i) (hdet : ∀ t, ∏ i, d t i = 1) + {z : Space} (hz : z ∈ openEnlargement a b δ) (t : ℝ) + (hscale : ∀ i, d t i * δ ≤ η) : + HasDerivAt (affinePath c d z) + (movingBoxVelocity a b c d η t (affinePath c d z t)) t := + affinePath_hasDerivAt_of_mem_plateau hη hc hd hp hdet t + (affinePath_mem_plateau_of_scaled_bound hz (hp t) hscale) + +@[simp] lemma affinePotential_zero (c : Space) : affinePotential c 0 0 = 0 := by + ext x i + fin_cases i <;> simp [affinePotential] + +@[simp] lemma localizedAffine_zero (a b c : Space) (η : ℝ) : + localizedAffine a b c 0 0 η = 0 := by + unfold localizedAffine + have he : (fun x => boxCutoff a b η x • affinePotential c 0 0 x) = 0 := by + ext x i + fin_cases i <;> simp [affinePotential] + rw [he] + exact curl_zero + +theorem movingBoxVelocity_zero {a b : Space} {c d : ℝ → Space} {η t : ℝ} + (hc : deriv c t = 0) (hd : ∀ i, deriv (fun s => d s i) t = 0) : + movingBoxVelocity a b c d η t = 0 := by + have hl : logarithmicRate d t = 0 := by ext i; simp [logarithmicRate, hd] + simp [movingBoxVelocity, hc, hl] + +lemma tsupport_movingBoxVelocity_subset (a b : Space) (c d : ℝ → Space) {η : ℝ} + (hη : 0 < η) (t : ℝ) : + tsupport (movingBoxVelocity a b c d η t) ⊆ + closedEnlargement (lowerEndpoint a c d t) (lowerEndpoint b c d t) (2 * η) := + tsupport_localizedAffine_subset _ _ _ _ _ hη + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bc4f4eda86da4dd62266a91d652ac6c9cd9564e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalInput.lean @@ -0,0 +1,105 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.FiniteSimulator + +namespace OAI + +noncomputable section +namespace BalancedTransport.Universal +open Turing PartrecToTM2 +open scoped Classical + +instance : Fintype K' := ⟨{.main,.rev,.aux,.stack}, by intro k; cases k <;> simp⟩ + +instance : Primcodable Γ' := Primcodable.ofEquiv (Fin (Fintype.card Γ')) (Fintype.equivFin Γ') + +lemma trNat_rec (n : ℕ) : trNat n = + if n = 0 then [] else (if n % 2 = 0 then Γ'.bit0 else Γ'.bit1) :: trNat (n / 2) := by + have h (p : Num) : trNat (p : ℕ) = + if (p : ℕ) = 0 then [] else + (if (p : ℕ) % 2 = 0 then Γ'.bit0 else Γ'.bit1) :: trNat ((p : ℕ) / 2) := by + cases p with + | zero => simp [trNat,trNum] + | pos p => + have hp := PosNum.to_nat_pos p + cases p with + | one => norm_num [trNat,trNum,trPosNum] + | bit0 p => + have hp := PosNum.to_nat_pos p + have he : ((Num.pos (PosNum.bit0 p) : Num) : ℕ) = (p : ℕ) + (p : ℕ) := rfl + rw [he] + have hdiv : ((p : ℕ) + (p : ℕ)) / 2 = (p : ℕ) := by omega + have hmod : ((p : ℕ) + (p : ℕ)) % 2 = 0 := by omega + rw [ite_eq_right (by omega),ite_eq_left hmod,hdiv] + change trNum (((Num.pos (PosNum.bit0 p) : Num) : ℕ) : Num) = + Γ'.bit0 :: trNum (((Num.pos p : Num) : ℕ) : Num) + rw [Num.of_to_nat, Num.of_to_nat] + rfl + | bit1 p => + have hp := PosNum.to_nat_pos p + have he : ((Num.pos (PosNum.bit1 p) : Num) : ℕ) = (p : ℕ) + (p : ℕ) + 1 := rfl + rw [he] + have hdiv : ((p : ℕ) + (p : ℕ) + 1) / 2 = (p : ℕ) := by omega + have hmod : ((p : ℕ) + (p : ℕ) + 1) % 2 ≠ 0 := by omega + rw [ite_eq_right (by omega),ite_eq_right hmod,hdiv] + change trNum (((Num.pos (PosNum.bit1 p) : Num) : ℕ) : Num) = + Γ'.bit1 :: trNum (((Num.pos p : Num) : ℕ) : Num) + rw [Num.of_to_nat, Num.of_to_nat] + rfl + simpa using h (n : Num) + +lemma computable_trNat : Computable trNat := by + let g : Unit → List (List Γ') → Option (List Γ') := fun _ l => + some (if l.length = 0 then [] else + (if l.length % 2 = 0 then Γ'.bit0 else Γ'.bit1) :: (l.getD (l.length / 2) [])) + have hg : Primrec₂ g := by + change Primrec (fun z : Unit × List (List Γ') => g z.1 z.2) + dsimp only [g] + apply Primrec.option_some.comp + apply Primrec.ite (Primrec.eq.comp (Primrec.list_length.comp Primrec.snd) (Primrec.const 0)) + (Primrec.const []) + apply Primrec.list_cons.comp + · exact Primrec.ite (Primrec.eq.comp + (Primrec.nat_mod.comp (Primrec.list_length.comp Primrec.snd) (Primrec.const 2)) + (Primrec.const 0)) (Primrec.const Γ'.bit0) (Primrec.const Γ'.bit1) + · exact (Primrec.list_getD ([] : List Γ')).comp Primrec.snd + (Primrec.nat_div.comp (Primrec.list_length.comp Primrec.snd) (Primrec.const 2)) + have hh := Primrec.nat_strong_rec (fun (_ : Unit) => trNat) hg (by + intro u n + dsimp [g] + simp only [List.length_map,List.length_range] + by_cases hn : n = 0 + · subst n; simp + · rw [ite_eq_right hn, List.getD_eq_getElem?_getD, + List.getElem?_map, List.getElem?_range (by omega : n / 2 < n)] + simp only [Option.map_some,Option.getD_some] + rw [trNat_rec n,ite_eq_right hn]) + exact hh.to_comp.comp (Computable.const ()) Computable.id + +abbrev StackAlphabet := TM2to1.Γ' K' (fun _ => Γ') + +instance : Primcodable (Bool × (K' → Option Γ')) := + Primcodable.ofEquiv (Fin (Fintype.card StackAlphabet)) (Fintype.equivFin StackAlphabet) + +instance : Primcodable StackAlphabet := + (inferInstance : Primcodable (Bool × (K' → Option Γ'))) + +lemma computable_trInit : Computable (TM2to1.trInit (Γ := fun _ : K' => Γ') K'.main) := by + have hm : Computable (fun L : List Γ' => L.reverse.map + (fun a => ((false, Function.update (fun _ : K' => (none : Option Γ')) K'.main (some a)) : StackAlphabet))) := + (Primrec.list_map Primrec.list_reverse ((Primrec.dom_finite + (fun a : Γ' => ((false, Function.update (fun _ : K' => (none : Option Γ')) K'.main (some a)) : StackAlphabet))).comp Primrec.snd).to₂).to_comp + exact Primrec.list_cons.to_comp.comp + ((Primrec.dom_finite (fun a : StackAlphabet => ((true,a.2) : StackAlphabet))).to_comp.comp + (Primrec.list_headI.to_comp.comp hm)) + (Primrec.list_tail.to_comp.comp hm) + +lemma computable_translatedInput : Computable (fun n : ℕ => + (TM2to1.trInit (Γ := fun _ : K' => Γ') K'.main (trList [n])).map finiteIndex) := by + have ht : Computable (fun n : ℕ => trList [n]) := + Primrec.list_append.to_comp.comp computable_trNat (Computable.const [Γ'.cons]) + exact (Primrec.list_map Primrec.id ((Primrec.dom_finite finiteIndex).comp Primrec.snd).to₂).to_comp.comp + (computable_trInit.comp ht) + +end BalancedTransport.Universal +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalMachine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalMachine.lean new file mode 100644 index 0000000000000000000000000000000000000000..d23235941d758d5cbf94accd36850e724bf8221e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/UniversalMachine.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.UniversalInput + +namespace OAI + +noncomputable section +namespace BalancedTransport.Universal +open Turing PartrecToTM2 StateTransition +open scoped Classical + +theorem finite_machine_of_code (c : ToPartrec.Code) : + ∃ M : FiniteMachine, ∃ δ : ℕ → Input M, + Computable δ ∧ ∀ n, Halts M (δ n) ↔ (c.eval [n]).Dom := by + let : Inhabited PartrecToTM2.Λ' := ⟨trNormal c Cont'.halt⟩ + let P₁ := TM2to1.tr PartrecToTM2.tr + let S₁ := TM2to1.trSupp PartrecToTM2.tr (codeSupp c Cont'.halt) + have ss₁ : TM1.Supports P₁ S₁ := TM2to1.tr_supports PartrecToTM2.tr (PartrecToTM2.tr_supports c Cont'.halt) + let P₀ := TM1to0.tr P₁ + let S₀ := TM1to0.trStmts P₁ S₁ + have ss₀ : TM0.Supports P₀ S₀ := TM1to0.tr_supports P₁ ss₁ + let δ : ℕ → List (Fin (Fintype.card StackAlphabet + 1)) := fun n => + (TM2to1.trInit (Γ := fun _ : K' => Γ') K'.main (trList [n])).map + (finiteIndex (α := StackAlphabet)) + refine ⟨finitePostMachine P₀ S₀ ss₀, δ, computable_translatedInput, ?_⟩ + intro n + rw [halts_finitePostMachine, TM1to0.tr_eval] + refine (TM2to1.tr_eval_dom PartrecToTM2.tr K'.main (trList [n])).trans ?_ + have hi : (TM2.init K'.main (trList [n]) : TM2.Cfg (fun _ : K' => Γ') PartrecToTM2.Λ' (Option Γ')) = + PartrecToTM2.init c [n] := by + unfold TM2.init PartrecToTM2.init + congr 1 + funext k + cases k <;> simp [K'.elim,Function.update] + change (eval (TM2.step PartrecToTM2.tr) (TM2.init K'.main (trList [n]))).Dom ↔ _ + rw [hi, PartrecToTM2.tr_eval] + rfl + +theorem exists_universal_machine : + ∃ N : FiniteMachine, ∃ δ : ℕ → Input N, + Computable δ ∧ ∀ M w, Halts N (δ (inputCode M w)) ↔ Halts M w := by + obtain ⟨c,hc⟩ := exists_universal_code + obtain ⟨N,δ,hδ,hh⟩ := finite_machine_of_code c + exact ⟨N,δ,hδ, fun M w => (hh _).trans ((hc _).trans (universalPartial_dom M w))⟩ + +end BalancedTransport.Universal +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Work.lean b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Work.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8a759e4543eb968113dc2f3d665acaa765ce6d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/BalancedTransport/Work.lean @@ -0,0 +1,255 @@ +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.Model + +namespace OAI + +noncomputable section +namespace BalancedTransport.Geometry +open scoped Topology +open Filter Set +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def pd (i : Fin 3) (f : Space → F) (x : Space) : F := + fderiv ℝ f x (Pi.single i 1) + +@[simp] theorem pd_const (i : Fin 3) (a : F) (x : Space) : + pd i (fun _ => a) x = 0 := by simp [pd] + +@[simp] theorem pd_coord (i j : Fin 3) (x : Space) : + pd i (fun y : Space => y j) x = (Pi.single i (1 : ℝ) : Space) j := by + rw [pd, (hasFDerivAt_apply j x).fderiv] + rfl + +@[simp] theorem pd_sub_const (i : Fin 3) (f : Space → F) (a : F) (x : Space) : + pd i (fun y => f y - a) x = pd i f x := by + simp only [pd, fderiv_sub_const] + +theorem pd_add (i : Fin 3) {f g : Space → F} {x : Space} + (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : + pd i (fun y => f y + g y) x = pd i f x + pd i g x := by + simp only [pd, fderiv_fun_add hf hg, add_apply] + +theorem pd_sub (i : Fin 3) {f g : Space → F} {x : Space} + (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : + pd i (fun y => f y - g y) x = pd i f x - pd i g x := by + simp only [pd, fderiv_fun_sub hf hg, sub_apply] + +theorem pd_mul (i : Fin 3) {f g : Space → ℝ} {x : Space} + (hf : DifferentiableAt ℝ f x) (hg : DifferentiableAt ℝ g x) : + pd i (fun y => f y * g y) x = f x * pd i g x + g x * pd i f x := by + simp only [pd, fderiv_fun_mul hf hg, add_apply, + smul_apply, smul_eq_mul] + +theorem pd_apply (i j : Fin 3) {f : Space → Space} {x : Space} + (hf : DifferentiableAt ℝ f x) : + pd i (fun y => f y j) x = pd i f x j := by + simp only [pd, fderiv_apply hf, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.proj_apply] + +theorem pd_contDiff (i : Fin 3) {f : Space → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) : + ContDiff ℝ (⊤ : ℕ∞) (pd i f) := + (hf.fderiv_right (by simp)).clm_apply contDiff_const + +theorem pd_comm (i j : Fin 3) {f : Space → F} (hf : ContDiff ℝ (⊤ : ℕ∞) f) (x : Space) : + pd i (pd j f) x = pd j (pd i f) x := by + have hd : DifferentiableAt ℝ (fderiv ℝ f) x := + (hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)).differentiable (by simp) x + have he (v : Space) : fderiv ℝ (fun y => fderiv ℝ f y v) x = + (ContinuousLinearMap.apply ℝ F v) ∘L fderiv ℝ (fderiv ℝ f) x := + ((ContinuousLinearMap.apply ℝ F v).hasFDerivAt.comp x hd.hasFDerivAt).fderiv + change fderiv ℝ (fun y => fderiv ℝ f y (Pi.single j 1)) x (Pi.single i 1) = + fderiv ℝ (fun y => fderiv ℝ f y (Pi.single i 1)) x (Pi.single j 1) + simp only [he, ContinuousLinearMap.comp_apply, ContinuousLinearMap.apply_apply] + exact hf.contDiffAt.isSymmSndFDerivAt (by rw [minSmoothness_of_isRCLikeNormedField]; exact WithTop.coe_le_coe.mpr (show (2 : ℕ∞) ≤ ⊤ from le_top)) _ _ + +def curl (A : Space → Space) (x : Space) : Space := + ![pd 1 (fun y => A y 2) x - pd 2 (fun y => A y 1) x, + pd 2 (fun y => A y 0) x - pd 0 (fun y => A y 2) x, + pd 0 (fun y => A y 1) x - pd 1 (fun y => A y 0) x] + +def divergence (A : Space → Space) (x : Space) : ℝ := + ∑ i, pd i (fun y => A y i) x + +theorem curl_contDiff {A : Space → Space} (hA : ContDiff ℝ (⊤ : ℕ∞) A) : + ContDiff ℝ (⊤ : ℕ∞) (curl A) := by + have he := contDiff_pi.mp hA + apply contDiff_pi.mpr + intro i + fin_cases i + · exact (pd_contDiff 1 (he 2)).sub (pd_contDiff 2 (he 1)) + · exact (pd_contDiff 2 (he 0)).sub (pd_contDiff 0 (he 2)) + · exact (pd_contDiff 0 (he 1)).sub (pd_contDiff 1 (he 0)) + +theorem divergence_curl {A : Space → Space} (hA : ContDiff ℝ (⊤ : ℕ∞) A) (x : Space) : + divergence (curl A) x = 0 := by + have he := contDiff_pi.mp hA + have hd (i j : Fin 3) : DifferentiableAt ℝ (pd i (fun y => A y j)) x := + (pd_contDiff i (he j)).differentiable (by simp) x + simp only [divergence, Fin.sum_univ_succ, curl, Matrix.cons_val_zero, + Matrix.cons_val_succ, + Fin.sum_univ_zero, add_zero] + change (pd 0 (fun y => pd 1 (fun z => A z 2) y - pd 2 (fun z => A z 1) y) x) + + ((pd 1 (fun y => pd 2 (fun z => A z 0) y - pd 0 (fun z => A z 2) y) x) + + (pd 2 (fun y => pd 0 (fun z => A z 1) y - pd 1 (fun z => A z 0) y) x)) = 0 + rw [pd_sub _ (hd 1 2) (hd 2 1), pd_sub _ (hd 2 0) (hd 0 2), + pd_sub _ (hd 0 1) (hd 1 0)] + rw [pd_comm 0 1 (he 2), pd_comm 0 2 (he 1), pd_comm 1 2 (he 0)] + ring + +theorem curl_congr {A B : Space → Space} {x : Space} + (h : A =ᶠ[𝓝 x] B) : curl A x = curl B x := by + have he (j : Fin 3) : (fun y => A y j) =ᶠ[𝓝 x] (fun y => B y j) := + h.mono (fun _ hh => congrFun hh j) + simp only [curl, pd, (he 0).fderiv_eq, (he 1).fderiv_eq, (he 2).fderiv_eq] + +@[simp] theorem curl_zero : curl (0 : Space → Space) = 0 := by + funext x + simp [curl] + +theorem tsupport_curl_subset (A : Space → Space) : + tsupport (curl A) ⊆ tsupport A := by + apply closure_minimal _ (isClosed_tsupport A) + intro x hx + by_contra hxA + have hh : A =ᶠ[𝓝 x] 0 := notMem_tsupport_iff_eventuallyEq.mp hxA + have hz := curl_congr hh + exact hx (by simpa using hz) + +theorem curl_hasCompactSupport {A : Space → Space} (hA : HasCompactSupport A) : + HasCompactSupport (curl A) := + hA.of_isClosed_subset (isClosed_tsupport _) (tsupport_curl_subset A) + +def affinePotential (c v l : Space) (x : Space) : Space := + ![(1 / 2 : ℝ) * (v 1 * (x 2 - c 2) - v 2 * (x 1 - c 1)) + + (1 / 3 : ℝ) * (l 1 - l 2) * (x 1 - c 1) * (x 2 - c 2), + (1 / 2 : ℝ) * (v 2 * (x 0 - c 0) - v 0 * (x 2 - c 2)) + + (1 / 3 : ℝ) * (l 2 - l 0) * (x 2 - c 2) * (x 0 - c 0), + (1 / 2 : ℝ) * (v 0 * (x 1 - c 1) - v 1 * (x 0 - c 0)) + + (1 / 3 : ℝ) * (l 0 - l 1) * (x 0 - c 0) * (x 1 - c 1)] + +theorem affinePotential_contDiff (c v l : Space) : + ContDiff ℝ (⊤ : ℕ∞) (affinePotential c v l) := by + apply contDiff_pi.mpr + intro i + fin_cases i <;> dsimp [affinePotential] <;> fun_prop + +theorem curl_affinePotential (c v l : Space) (hl : ∑ i, l i = 0) (x : Space) : + curl (affinePotential c v l) x = fun i => v i + l i * (x i - c i) := by + have hl' : l 0 + l 1 + l 2 = 0 := by + simpa [Fin.sum_univ_succ, add_assoc] using hl + funext i + fin_cases i <;> + simp (disch := fun_prop) [curl, affinePotential, pd_add, pd_sub, pd_mul, Pi.single_apply] <;> + nlinarith [mul_eq_zero_of_left hl' (x 0 - c 0), + mul_eq_zero_of_left hl' (x 1 - c 1), mul_eq_zero_of_left hl' (x 2 - c 2)] + +def boxCutoff (a b : Space) (η : ℝ) (x : Space) : ℝ := + ∏ i : Fin 3, Real.smoothTransition ((x i - a i + 2 * η) / η) * + Real.smoothTransition ((b i + 2 * η - x i) / η) + +def openEnlargement (a b : Space) (η : ℝ) : Set Space := + Set.pi Set.univ (fun i => Set.Ioo (a i - η) (b i + η)) + +def closedEnlargement (a b : Space) (η : ℝ) : Set Space := + Set.Icc (fun i => a i - η) (fun i => b i + η) + +@[simp] theorem mem_openEnlargement (a b : Space) (η : ℝ) (x : Space) : + x ∈ openEnlargement a b η ↔ ∀ i, a i - η < x i ∧ x i < b i + η := by + simp [openEnlargement] + +@[simp] theorem mem_closedEnlargement (a b : Space) (η : ℝ) (x : Space) : + x ∈ closedEnlargement a b η ↔ ∀ i, a i - η ≤ x i ∧ x i ≤ b i + η := by + simp only [closedEnlargement, mem_Icc, Pi.le_def, forall_and] + +theorem openEnlargement_isOpen (a b : Space) (η : ℝ) : + IsOpen (openEnlargement a b η) := by + exact isOpen_set_pi finite_univ (fun _ _ => isOpen_Ioo) + +theorem closedEnlargement_isCompact (a b : Space) (η : ℝ) : + IsCompact (closedEnlargement a b η) := isCompact_Icc + +theorem boxCutoff_contDiff (a b : Space) (η : ℝ) : + ContDiff ℝ (⊤ : ℕ∞) (boxCutoff a b η) := by + unfold boxCutoff + fun_prop + +theorem boxCutoff_eq_one {a b : Space} {η : ℝ} (hη : 0 < η) {x : Space} + (hx : x ∈ closedEnlargement a b η) : boxCutoff a b η x = 1 := by + apply Finset.prod_eq_one + intro i _ + obtain ⟨hl, hr⟩ := (mem_closedEnlargement _ _ _ _).mp hx i + rw [Real.smoothTransition.one_of_one_le ((le_div_iff₀ hη).mpr (by linarith)), + Real.smoothTransition.one_of_one_le ((le_div_iff₀ hη).mpr (by linarith)), one_mul] + +theorem boxCutoff_eventually_one {a b : Space} {η : ℝ} (hη : 0 < η) + {x : Space} (hx : x ∈ openEnlargement a b η) : + boxCutoff a b η =ᶠ[𝓝 x] 1 := by + filter_upwards [(openEnlargement_isOpen a b η).mem_nhds hx] with y hy + apply boxCutoff_eq_one hη + exact (mem_closedEnlargement _ _ _ _).mpr fun i => + ⟨((mem_openEnlargement _ _ _ _).mp hy i).1.le, + ((mem_openEnlargement _ _ _ _).mp hy i).2.le⟩ + +theorem boxCutoff_eq_zero {a b : Space} {η : ℝ} (hη : 0 < η) {x : Space} + (hx : x ∉ closedEnlargement a b (2 * η)) : boxCutoff a b η x = 0 := by + rw [mem_closedEnlargement] at hx + push Not at hx + obtain ⟨i, hi⟩ := hx + apply Finset.prod_eq_zero (Finset.mem_univ i) + by_cases hl : a i - 2 * η ≤ x i + · have he : Real.smoothTransition ((b i + 2 * η - x i) / η) = 0 := + Real.smoothTransition.zero_of_nonpos (div_nonpos_of_nonpos_of_nonneg + (by linarith [hi hl]) hη.le) + rw [he, mul_zero] + · have he : Real.smoothTransition ((x i - a i + 2 * η) / η) = 0 := + Real.smoothTransition.zero_of_nonpos (div_nonpos_of_nonpos_of_nonneg + (by linarith) hη.le) + rw [he, zero_mul] + +theorem tsupport_boxCutoff_subset (a b : Space) {η : ℝ} (hη : 0 < η) : + tsupport (boxCutoff a b η) ⊆ closedEnlargement a b (2 * η) := by + apply closure_minimal _ (closedEnlargement_isCompact _ _ _).isClosed + intro x hx + by_contra hn + exact hx (boxCutoff_eq_zero hη hn) + +theorem boxCutoff_hasCompactSupport (a b : Space) {η : ℝ} (hη : 0 < η) : + HasCompactSupport (boxCutoff a b η) := + (closedEnlargement_isCompact _ _ _).of_isClosed_subset (isClosed_tsupport _) + (tsupport_boxCutoff_subset a b hη) + +def localizedAffine (a b c v l : Space) (η : ℝ) : Space → Space := + curl (fun x => boxCutoff a b η x • affinePotential c v l x) + +theorem localizedAffine_contDiff (a b c v l : Space) (η : ℝ) : + ContDiff ℝ (⊤ : ℕ∞) (localizedAffine a b c v l η) := + curl_contDiff ((boxCutoff_contDiff a b η).smul (affinePotential_contDiff c v l)) + +theorem localizedAffine_divergence (a b c v l : Space) (η : ℝ) (x : Space) : + divergence (localizedAffine a b c v l η) x = 0 := + divergence_curl ((boxCutoff_contDiff a b η).smul (affinePotential_contDiff c v l)) x + +theorem localizedAffine_eq {a b c v l : Space} {η : ℝ} (hη : 0 < η) + (hl : ∑ i, l i = 0) {x : Space} (hx : x ∈ openEnlargement a b η) : + localizedAffine a b c v l η x = fun i => v i + l i * (x i - c i) := by + unfold localizedAffine + rw [curl_congr (show (fun y => boxCutoff a b η y • affinePotential c v l y) =ᶠ[𝓝 x] + affinePotential c v l from (boxCutoff_eventually_one hη hx).mono + (fun y hy => by simp only [hy, Pi.one_apply, one_smul])), curl_affinePotential c v l hl] + +theorem tsupport_localizedAffine_subset (a b c v l : Space) {η : ℝ} (hη : 0 < η) : + tsupport (localizedAffine a b c v l η) ⊆ closedEnlargement a b (2 * η) := by + refine (tsupport_curl_subset _).trans ?_ + apply closure_minimal _ (closedEnlargement_isCompact _ _ _).isClosed + intro x hx + by_contra hn + exact hx (by simp [boxCutoff_eq_zero hη hn]) + +theorem localizedAffine_hasCompactSupport (a b c v l : Space) {η : ℝ} (hη : 0 < η) : + HasCompactSupport (localizedAffine a b c v l η) := + (closedEnlargement_isCompact _ _ _).of_isClosed_subset (isClosed_tsupport _) + (tsupport_localizedAffine_subset a b c v l hη) + +end BalancedTransport.Geometry +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/FiniteRankGap.lean b/lean/OAI/MathematicalPhysics/NavierStokes/FiniteRankGap.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1ebe2af6bb031e2a524b613f8f07d2033072c83 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/FiniteRankGap.lean @@ -0,0 +1,143 @@ +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Topology.Order.IntermediateValue +import Mathlib.Tactic.Abel +import Mathlib.Tactic.GCongr +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Positivity + +namespace OAI + +/-! +# Finite-rank gap and determinant perturbations + +The coercivity argument for the moment matrix in *Stationary instability and nonuniqueness +for axisymmetric swirl-free Navier–Stokes*, Section 2, gives a lower norm bound in terms of +the residual map. Perturbations smaller than this bound preserve injectivity and, in finite +dimensions over the reals, the sign of the determinant. +-/ + +noncomputable section + +namespace StationaryNS + +variable {E F : Type*} +variable [NormedAddCommGroup E] [NormedSpace ℝ E] +variable [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- The moment matrix `I + BC`, expressed without choosing coordinates. -/ +def momentMatrix (B : E →L[ℝ] F) (C : F →L[ℝ] E) : F →L[ℝ] F := + ContinuousLinearMap.id ℝ F + B.comp C + +/-- The algebraic least-singular-value estimate for the moment matrix. The residual map `R` +and the coercivity hypothesis give a lower norm bound without a finite-dimensional assumption. -/ +theorem finite_rank_gap (B : E →L[ℝ] F) (C : F →L[ℝ] E) + (R : F →L[ℝ] E →L[ℝ] ℝ) {ε β δ : ℝ} + (hε : 0 < ε) (hB : ‖B‖ ≤ β) (hR : ‖R‖ ≤ δ) + (hcoercive : ∀ y, ε * ‖C y‖ ^ 2 ≤ R (momentMatrix B C y) (C y)) (y : F) : + ε / (ε + β * δ) * ‖y‖ ≤ ‖momentMatrix B C y‖ := by + have hβ : 0 ≤ β := (norm_nonneg B).trans hB + have hδ : 0 ≤ δ := (norm_nonneg R).trans hR + have hpair : R (momentMatrix B C y) (C y) ≤ + δ * ‖momentMatrix B C y‖ * ‖C y‖ := by + calc + R (momentMatrix B C y) (C y) ≤ |R (momentMatrix B C y) (C y)| := le_abs_self _ + _ = ‖R (momentMatrix B C y) (C y)‖ := (Real.norm_eq_abs _).symm + _ ≤ ‖R (momentMatrix B C y)‖ * ‖C y‖ := (R _).le_opNorm _ + _ ≤ (‖R‖ * ‖momentMatrix B C y‖) * ‖C y‖ := by + gcongr + exact R.le_opNorm _ + _ ≤ δ * ‖momentMatrix B C y‖ * ‖C y‖ := by gcongr + have hC : ε * ‖C y‖ ≤ δ * ‖momentMatrix B C y‖ := by + by_cases hz : ‖C y‖ = 0 + · simp only [hz, mul_zero] + positivity + · have hp : 0 < ‖C y‖ := lt_of_le_of_ne (norm_nonneg _) (Ne.symm hz) + apply (mul_le_mul_iff_of_pos_right hp).mp + nlinarith [hcoercive y] + have htriangle : ‖y‖ ≤ ‖momentMatrix B C y‖ + β * ‖C y‖ := by + have hid : y = momentMatrix B C y - B (C y) := by + simp [momentMatrix] + calc + ‖y‖ = ‖momentMatrix B C y - B (C y)‖ := congrArg norm hid + _ ≤ ‖momentMatrix B C y‖ + ‖B (C y)‖ := norm_sub_le _ _ + _ ≤ ‖momentMatrix B C y‖ + β * ‖C y‖ := + add_le_add_right ((B.le_opNorm _).trans + (mul_le_mul_of_nonneg_right hB (norm_nonneg _))) _ + have hden : 0 < ε + β * δ := add_pos_of_pos_of_nonneg hε (mul_nonneg hβ hδ) + rw [div_mul_eq_mul_div] + apply (div_le_iff₀ hden).mpr + nlinarith [mul_le_mul_of_nonneg_left htriangle hε.le, + mul_le_mul_of_nonneg_left hC hβ] + +/-- A perturbation smaller than a lower norm bound is injective, in any dimension. -/ +theorem injective_of_perturbation (J P : E →L[ℝ] E) {γ : ℝ} + (hgap : ∀ x, γ * ‖x‖ ≤ ‖J x‖) (hpert : ‖P - J‖ < γ) : + Function.Injective P := by + intro x y hxy + have hz : P (x - y) = 0 := by simp only [map_sub, hxy, sub_self] + have hdiff : ‖(P - J) (x - y)‖ = ‖J (x - y)‖ := by + simp only [sub_apply, hz, zero_sub, norm_neg] + have hupper : ‖J (x - y)‖ ≤ ‖P - J‖ * ‖x - y‖ := by + simpa only [hdiff] using (P - J).le_opNorm (x - y) + have hnorm : ‖x - y‖ = 0 := by + nlinarith [hgap (x - y), norm_nonneg (x - y)] + exact sub_eq_zero.mp (norm_eq_zero.mp hnorm) + +/-- The straight segment to a perturbation smaller than a lower norm bound remains injective. -/ +theorem injective_segment (J P : E →L[ℝ] E) {γ : ℝ} + (hgap : ∀ x, γ * ‖x‖ ≤ ‖J x‖) (hpert : ‖P - J‖ < γ) + {t : ℝ} (ht : t ∈ Set.Icc (0 : ℝ) 1) : + Function.Injective (J + t • (P - J)) := by + apply injective_of_perturbation J _ hgap + calc + ‖J + t • (P - J) - J‖ = ‖t • (P - J)‖ := by congr 1; abel + _ = t * ‖P - J‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht.1] + _ ≤ ‖P - J‖ := by nlinarith [norm_nonneg (P - J), ht.2] + _ < γ := hpert + +/-- A continuous real function that never vanishes on the unit interval has the same strict +sign at its endpoints. -/ +theorem same_sign_endpoints {f : ℝ → ℝ} + (hcont : ContinuousOn f (Set.Icc 0 1)) + (hne : ∀ t ∈ Set.Icc (0 : ℝ) 1, f t ≠ 0) : 0 < f 0 * f 1 := by + have hzero : f 0 ≠ 0 := hne 0 (by norm_num) + rcases lt_or_gt_of_ne hzero with hneg | hpos + · have hneg1 : f 1 < 0 := by + by_contra hn + have hnonneg : 0 ≤ f 1 := le_of_not_gt hn + obtain ⟨t, ht, hft⟩ := intermediate_value_Icc (by norm_num : (0 : ℝ) ≤ 1) + hcont (show 0 ∈ Set.Icc (f 0) (f 1) from ⟨hneg.le, hnonneg⟩) + exact hne t ht hft + exact mul_pos_of_neg_of_neg hneg hneg1 + · have hpos1 : 0 < f 1 := by + by_contra hn + have hnonpos : f 1 ≤ 0 := le_of_not_gt hn + obtain ⟨t, ht, hft⟩ := intermediate_value_Icc' (by norm_num : (0 : ℝ) ≤ 1) + hcont (show 0 ∈ Set.Icc (f 1) (f 0) from ⟨hnonpos, hpos.le⟩) + exact hne t ht hft + exact mul_pos hpos hpos1 + +/-- Finite-dimensional real determinant signs are preserved by perturbations smaller than +a lower norm bound. -/ +theorem determinant_sign_of_perturbation [FiniteDimensional ℝ E] + (J P : E →L[ℝ] E) {γ : ℝ} + (hgap : ∀ x, γ * ‖x‖ ≤ ‖J x‖) (hpert : ‖P - J‖ < γ) : + 0 < J.det * P.det := by + let f : ℝ → ℝ := fun t => (J + t • (P - J)).det + have hcont : Continuous f := + ContinuousLinearMap.continuous_det.comp (continuous_const.add + (continuous_id.smul continuous_const)) + have hne : ∀ t ∈ Set.Icc (0 : ℝ) 1, f t ≠ 0 := by + intro t ht hzero + have hker : (J + t • (P - J)).toLinearMap.ker = ⊥ := + LinearMap.ker_eq_bot.mpr (injective_segment J P hgap hpert ht) + exact (LinearMap.det_eq_zero_iff_ker_ne_bot.mp hzero) hker + have hsign := same_sign_endpoints hcont.continuousOn hne + simpa [f] using hsign + +end StationaryNS + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCenter.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc989388e33c561b2ec7a7eb5c3586d84024da17 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCenter.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorCore + +namespace OAI + +/-! Translation to an arbitrary detector center. These identities preserve +the actual transition map and both variational equations. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows Set PlanarHamiltonian +open scoped ContDiff BigOperators + +def translateField {A : Type*} (δ : Plane) (F : ℝ → Plane → A) : ℝ → Plane → A := + fun t x => F t (x + δ) + +def translateTransition (δ : Plane) (Ψ : ℝ → ℝ → Plane → Plane) : + ℝ → ℝ → Plane → Plane := fun a t x => Ψ a t (x + δ) - δ + +theorem translated_smooth {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + (δ : Plane) {F : ℝ → Plane → A} (hF : ContDiff ℝ ∞ (Function.uncurry F)) : + ContDiff ℝ ∞ (Function.uncurry (translateField δ F)) := by + exact hF.comp (contDiff_fst.prodMk (contDiff_snd.add contDiff_const)) + +theorem translated_periodic {A : Type*} (δ : Plane) {F : ℝ → Plane → A} + (hp : ∀ t, PlanePeriodic (F t)) (t : ℝ) : PlanePeriodic (translateField δ F t) := by + intro x k + change F t ((x + fun j => (k j : ℝ)) + δ) = F t (x + δ) + rw [add_right_comm, hp t] + +theorem translated_fderiv {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + (δ : Plane) (F : ℝ → Plane → A) (t : ℝ) (x : Plane) : + fderiv ℝ (translateField δ F t) x = fderiv ℝ (F t) (x + δ) := + fderiv_comp_add_right δ + +theorem translated_second {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + (δ : Plane) (F : ℝ → Plane → A) (t : ℝ) (x : Plane) : + fderiv ℝ (fderiv ℝ (translateField δ F t)) x = + fderiv ℝ (fderiv ℝ (F t)) (x + δ) := by + have he : fderiv ℝ (translateField δ F t) = fun y => fderiv ℝ (F t) (y + δ) := + funext (translated_fderiv δ F t) + rw [he, fderiv_comp_add_right] + +theorem translated_divergence (δ : Plane) (V : ℝ → Plane → Plane) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (translateField δ V t) x = + PlanarHamiltonian.divergence (V t) (x + δ) := by + unfold PlanarHamiltonian.divergence spatialD + apply Finset.sum_congr rfl + intro j _ + exact congrArg (fun A : Plane →L[ℝ] ℝ => A (basis j)) + (fderiv_comp_add_right δ (f := fun y => V t y j) (x := x)) + +theorem transition_fderiv (δ : Plane) (Ψ : ℝ → ℝ → Plane → Plane) + (a t : ℝ) (x : Plane) : + fderiv ℝ (translateTransition δ Ψ a t) x = fderiv ℝ (Ψ a t) (x + δ) := by + change fderiv ℝ (fun y => Ψ a t (y + δ) - δ) x = _ + rw [fderiv_sub_const, fderiv_comp_add_right] + +theorem transition_second (δ : Plane) (Ψ : ℝ → ℝ → Plane → Plane) + (a t : ℝ) (x : Plane) : + fderiv ℝ (fderiv ℝ (translateTransition δ Ψ a t)) x = + fderiv ℝ (fderiv ℝ (Ψ a t)) (x + δ) := by + have he : fderiv ℝ (translateTransition δ Ψ a t) = + fun y => fderiv ℝ (Ψ a t) (y + δ) := funext (transition_fderiv δ Ψ a t) + rw [he, fderiv_comp_add_right] + +theorem transition_translated {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) (δ : Plane) : + IsPlanarTransition (translateField δ V) (translateTransition δ Ψ) := by + refine ⟨?_, ?_, ?_⟩ + · intro a x + simp only [translateTransition, hΨ.initial, add_sub_cancel_right] + · intro a t x + have hd := (hΨ.ode a t (x + δ)).sub_const δ + simpa only [translateTransition, translateField, sub_add_cancel] using hd + · intro a x γ hγ hγ' t + have hi : (γ 0 + δ) = x + δ := congrArg (fun y => y + δ) hγ + have he := hΨ.unique a (x + δ) (fun s => γ s + δ) hi + (fun s => (hγ' s).add_const δ) t + simpa only [add_sub_cancel_right, translateTransition] using + congrArg (fun y => y - δ) he + +theorem variations_translated {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) (δ : Plane) : + PlanarVariations (translateField δ V) (translateTransition δ Ψ) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro a + funext x + simp only [translateTransition, hv.initial, id_eq, add_sub_cancel_right] + · intro a t + exact ((hv.smooth a t).comp (contDiff_id.add contDiff_const)).sub contDiff_const + · intro a x v t + simpa only [transition_fderiv, translated_fderiv, translateTransition, + sub_add_cancel] using hv.first a (x + δ) v t + · intro a x v w t + simpa only [transition_fderiv, transition_second, translated_fderiv, + translated_second, translateTransition, sub_add_cancel] using + hv.second a (x + δ) v w t + +theorem backward_translated {Ψ : ℝ → ℝ → Plane → Plane} + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) (δ : Plane) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => translateTransition δ Ψ y.1 (-y.1) y.2) := by + exact (hback.comp (contDiff_fst.prodMk (contDiff_snd.add contDiff_const))).sub contDiff_const + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCore.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9a041e5d083993720e748bf40937db1de4232d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorCore.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosityObservation + +namespace OAI + +/-! The injection, stirring and waiting argument for an arbitrary planar +processor at a fixed reference center. Both numerical pairs use the same +prescribed program. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def DetectorPair (d H : ℝ) : Prop := + (d = 1 / 32 ∧ H = 1000000000) ∨ (d = 1 / 16 ∧ H = 100000000) + +theorem DetectorPair.clearance {d H : ℝ} (h : DetectorPair d H) : 1 / 16 ≤ 2 * d := by + rcases h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> norm_num + +/-- The scalar construction and its two observation implications do not +depend on a machine encoding or on the geometry of a particular target. -/ +theorem fixed_center_compact_detector (hE : TorusScalarExistence) (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hΨ : IsPlanarTransition V Ψ) (hv : PlanarVariations V Ψ) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) : + ∃ w : ℝ → Plane → ℝ, + GlobalTorusScalarSolution 1 (detectorDrift V detectorBumpDerivativeBound L) + (detectorSource detectorBumpDerivativeBound L) w (fun _ => 0) ∧ + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + (massBound L : ℝ) < 1 / 100000000000 ∧ + ∀ ν : ℝ, 0 < ν → + IsClassicalSolution 1 ν (detectorViscosityForce V detectorBumpDerivativeBound L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V detectorBumpDerivativeBound L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν + (detectorViscosityForce V detectorBumpDerivativeBound L ν) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = + triangularVelocity (viscosityDrift ν (detectorDrift V detectorBumpDerivativeBound L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ∀ (E : Set Plane) (d H : ℝ), DetectorPair d H → + ((∃ k : ℕ, Ψ 0 k ![1 / 4, 1 / 4] ∈ E) → + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, 1 / 2 < viscosityScalar ν w t x) ∧ + ((∀ s, 0 ≤ s → ∀ x ∈ E, + 2 * d ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) → + ∀ t, 0 ≤ t → ∀ x ∈ E, viscosityScalar ν w t x < 1 / 2) := by + obtain ⟨w, hs, hw, hwp, hn, _⟩ := detectorScalar_exists hE hV hp detectorBumpDerivativeBound L + have hVs (s : ℝ) : ContDiff ℝ ∞ (V s) := + hV.comp (show ContDiff ℝ ∞ (fun x : Plane => (s, x)) from + contDiff_const.prodMk contDiff_id) + have hlap (n : ℕ) (t : ℝ) + (_ht : t ∈ Icc (0 : ℝ) (2 * (duration detectorBumpDerivativeBound L n : ℝ))) + (x : Plane) : + |scalarLaplacian (detectorReference Ψ detectorBumpDerivativeBound L n + (2 * ((n : ℝ) + 1) + t)) x| ≤ + (laplacianBound detectorBumpDerivativeBound L n : ℝ) := + detectorReference_laplacian_bound hv hVs hback L hL h₁ h₂ n _ x + refine ⟨w, hs, hw, hn, + fun t ht => detector_scalar_mass_bound hV hp hdiv detectorBumpDerivativeBound L hs hw ht, + (massBound_real_small L).2, fun ν hν => ?_⟩ + have hu := detectorViscosity_solution hV hp hdiv detectorBumpDerivativeBound L hs hw hwp hν + refine ⟨hu, finite_time_classical_unique (by norm_num) hν.le hu, fun E d H hpair => ?_⟩ + constructor + · rintro ⟨k, hk⟩ + obtain ⟨t, ht, hobs⟩ := detectorBurst_detects hΨ hp hback detectorBumpDerivativeBound L k + hs hw (hlap k) (detector_old_mass_margin L).le + (detector_scalar_at_start_bound hK hV hp hdiv detectorBumpDerivativeBound L hs hw k) + (Nat.cast_nonneg k) (by linarith : (k : ℝ) ≤ (k : ℝ) + 1) + have he : ν * (t / ν) = t := by field_simp [hν.ne'] + exact ⟨t / ν, div_nonneg ht hν.le, Ψ 0 k ![1 / 4, 1 / 4], hk, + by simpa only [viscosityScalar, he] using hobs⟩ + · intro hfar t ht x hx + exact detector_negative_all_time hK hΨ hv hV hp hdiv hback detectorBumpDerivativeBound L h₁ + hs hw hlap (fun s hs' y hy => hpair.clearance.trans (hfar s hs' y hy)) + (mul_nonneg hν.le ht) hx + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3773682111ce605d68050c1c882f263281823840 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorEvaluation.lean @@ -0,0 +1,145 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorOracle + +namespace OAI + +/-! A terminating evaluator for the finite relative detector expressions. +It works at arbitrary fast-named spacetime points and for all ordered mixed +derivatives. The only oracle calls evaluate derivatives of the input V. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.DetectorExpr +open ShearFlows Filter +open scoped ContDiff Topology BigOperators + +variable {F : PlanarComponents} + +def Ready (o : PlanarJetOracle F) (e : DetectorExpr) (he : e.Valid) + (q : RationalSpaceTime) (ε : ℚ) (n : ℕ) : Prop := + (e.enclose o he q n).radius ≤ ε + +instance readyDecidable (o : PlanarJetOracle F) (e : DetectorExpr) (he : e.Valid) + (q : RationalSpaceTime) (ε : ℚ) (n : ℕ) : Decidable (Ready o e he q ε n) := + inferInstanceAs (Decidable ((e.enclose o he q n).radius ≤ ε)) + +theorem ready_exists (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (q : RationalSpaceTime) + {ε : ℚ} (hε : 0 < ε) : ∃ n, Ready o e he q ε n := by + have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := ((e.enclose_converges o hF he q).2.eventually_lt_const hε').exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +def evaluateRational (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + (e : DetectorExpr) (he : e.Valid) (q : RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : ℚ := + (e.enclose o he q (Nat.find (ready_exists o hF he q hε))).center + +theorem evaluateRational_spec (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (q : RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : + |e.val F (rationalPoint q) - (evaluateRational o hF e he q ε hε : ℝ)| ≤ (ε : ℝ) := by + exact (e.enclose_contains o hF he q (Nat.find (ready_exists o hF he q hε))).trans + (by exact_mod_cast Nat.find_spec (ready_exists o hF he q hε)) + +def derivativeBound (o : PlanarJetOracle F) (e : DetectorExpr) (M : ℚ) : ℚ := + ∑ k : Fin 4, (e.diff k).bound o M + +theorem derivativeBound_nonneg (o : PlanarJetOracle F) (e : DetectorExpr) (M : ℚ) : + 0 ≤ derivativeBound o e M := + Finset.sum_nonneg (fun k _ => (e.diff k).bound_nonneg o M) + +theorem fderiv_bound (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (M : ℚ) (y : SpaceTime) + (hy : |y.1| ≤ |(M : ℝ)|) : ‖fderiv ℝ (e.val F) y‖ ≤ (derivativeBound o e M : ℝ) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Rat.cast_nonneg.mpr (derivativeBound_nonneg o e M)) + intro v + conv_lhs => rw [← spaceTimeDirections_sum v] + rw [map_sum] + calc + _ ≤ ∑ k : Fin 4, ‖fderiv ℝ (e.val F) y + (timeSpaceCoord k v • spaceTimeDirection k)‖ := norm_sum_le _ _ + _ ≤ ∑ k : Fin 4, ‖v‖ * ((e.diff k).bound o M : ℝ) := by + apply Finset.sum_le_sum + intro k _ + rw [map_smul, norm_smul] + have hk : ‖fderiv ℝ (e.val F) y (spaceTimeDirection k)‖ ≤ + ((e.diff k).bound o M : ℝ) := by + rw [← e.val_diff hF he k y, Real.norm_eq_abs] + exact val_bound o (valid_diff he k) M y hy + exact mul_le_mul (timeSpaceCoord_norm k v) hk (norm_nonneg _) (norm_nonneg _) + _ = _ := by + rw [derivativeBound, Rat.cast_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro k _ + ring + +theorem lipschitz_bound (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (M : ℚ) (x y : SpaceTime) + (hx : |x.1| ≤ |(M : ℝ)|) (hy : |y.1| ≤ |(M : ℝ)|) : + |e.val F x - e.val F y| ≤ (derivativeBound o e M : ℝ) * ‖x - y‖ := by + let S : Set SpaceTime := Set.Icc (-|(M : ℝ)|) |(M : ℝ)| ×ˢ Set.univ + have hc : Convex ℝ S := (convex_Icc _ _).prod convex_univ + have h := Convex.norm_image_sub_le_of_norm_fderiv_le + (fun z (_ : z ∈ S) => (e.smooth hF he).differentiable (by simp) z) + (fun z hz => fderiv_bound o hF he M z (abs_le.mpr hz.1)) hc + (show y ∈ S from ⟨abs_le.mp hy, Set.mem_univ _⟩) + (show x ∈ S from ⟨abs_le.mp hx, Set.mem_univ _⟩) + simpa only [Real.norm_eq_abs] using h + +def inputPrecision (o : PlanarJetOracle F) (e : DetectorExpr) (M ε : ℚ) : ℕ := + ⌈2 * derivativeBound o e M / ε⌉₊ + 1 + +theorem inputPrecision_spec (o : PlanarJetOracle F) (e : DetectorExpr) + (M : ℚ) {ε : ℚ} (hε : 0 < ε) : + (derivativeBound o e M : ℝ) * errorTolerance (inputPrecision o e M ε) ≤ (ε : ℝ) / 2 := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + have hn : 2 * (derivativeBound o e M : ℝ) / ε ≤ (inputPrecision o e M ε : ℝ) := by + have h : 2 * derivativeBound o e M / ε ≤ (inputPrecision o e M ε : ℚ) := + (Nat.le_ceil _).trans (by simp [inputPrecision]) + exact_mod_cast h + have hp : (inputPrecision o e M ε : ℝ) ≤ (2 : ℝ) ^ inputPrecision o e M ε := by + exact_mod_cast (Nat.lt_two_pow_self (n := inputPrecision o e M ε)).le + have hle := hn.trans hp + have hpow : (0 : ℝ) < 2 ^ inputPrecision o e M ε := by positivity + rw [errorTolerance, ← div_eq_mul_inv] + apply (div_le_iff₀ hpow).mpr + have h := (div_le_iff₀ he).mp hle + linarith + +def evaluate (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + (e : DetectorExpr) (he : e.Valid) (a : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : ℚ := + evaluateRational o hF e he + (a (inputPrecision o e (ClockedExpr.nameRadius a) ε)) (ε / 2) (by positivity) + +theorem evaluate_spec (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (a : ℕ → RationalSpaceTime) + {y : SpaceTime} (ha : IsFastName a y) (ε : ℚ) (hε : 0 < ε) : + |e.val F y - (evaluate o hF e he a ε hε : ℝ)| ≤ (ε : ℝ) := by + let n := inputPrecision o e (ClockedExpr.nameRadius a) ε + let q := a n + obtain ⟨hy, hq⟩ := ClockedExpr.nameRadius_bounds ha n + calc + _ ≤ |e.val F y - e.val F (rationalPoint q)| + + |e.val F (rationalPoint q) - (evaluate o hF e he a ε hε : ℝ)| := abs_sub_le _ _ _ + _ ≤ (ε : ℝ) / 2 + (ε : ℝ) / 2 := by + apply add_le_add + · exact (lipschitz_bound o hF he (ClockedExpr.nameRadius a) y (rationalPoint q) hy hq).trans + ((mul_le_mul_of_nonneg_left (ha n) + (Rat.cast_nonneg.mpr (derivativeBound_nonneg o e _))).trans + (inputPrecision_spec o e _ hε)) + · simpa only [evaluate, Rat.cast_div, Rat.cast_ofNat] using + evaluateRational_spec o hF he q (ε / 2) (by positivity) + _ = _ := by ring + +theorem evaluate_mixed_spec (o : PlanarJetOracle F) (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (α : List (Fin 4)) (a : ℕ → RationalSpaceTime) + {y : SpaceTime} (ha : IsFastName a y) (ε : ℚ) (hε : 0 < ε) : + |ClockedExpr.scalarMixed (e.val F) α y - + (evaluate o hF (e.diffWord α) (valid_diffWord he α) a ε hε : ℝ)| ≤ (ε : ℝ) := by + rw [← e.val_diffWord hF he α] + exact evaluate_spec o hF (valid_diffWord he α) a ha ε hε + +end ForcedComputation.VelocityDetector.DetectorExpr + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..77162971fcc58a18e05b74b2c7087eea65cd3be6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorExpressions.lean @@ -0,0 +1,166 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedVector + +namespace OAI + +/-! Finite clocked expressions relative to the given planar-field evaluator. +Input atoms are derivatives of the input field, not derivatives of the +constructed force. Product and chain rules remain part of the compiler. -/ + +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff BigOperators + +abbrev PlanarComponents := Fin 2 → SpaceTime → ℝ + +noncomputable def componentJet (F : PlanarComponents) (α : List (Fin 4)) (j : Fin 2) := + ClockedExpr.scalarMixed (F j) α + +theorem componentJet_smooth {F : PlanarComponents} + (hF : ∀ j, ContDiff ℝ ∞ (F j)) (α : List (Fin 4)) (j : Fin 2) : + ContDiff ℝ ∞ (componentJet F α j) := by + induction α with + | nil => exact hF j + | cons k α ih => + exact (ih.fderiv_right (m := ∞) (by simp)).clm_apply contDiff_const + +/-- The numerical information supplied with the effectively specified +input planar field. All bounds are global input-derivative bounds. -/ +structure PlanarJetOracle (F : PlanarComponents) where + bound : List (Fin 4) → Fin 2 → ℚ + bound_nonneg : ∀ α j, 0 ≤ bound α j + jet_bound : ∀ α j y, |componentJet F α j y| ≤ (bound α j : ℝ) + enclose : List (Fin 4) → Fin 2 → RationalSpaceTime → ℕ → QBall + enclose_contains : ∀ α j q n, (enclose α j q n).Contains + (componentJet F α j (rationalPoint q)) + enclose_converges : ∀ α j q, QBall.Converges (enclose α j q) + (componentJet F α j (rationalPoint q)) + +inductive DetectorExpr + | known (e : ClockedExpr) + | input (q : ProfileExpr) (α : List (Fin 4)) (j : Fin 2) + | add (e f : DetectorExpr) + | mul (e f : DetectorExpr) + deriving DecidableEq + +namespace DetectorExpr + +noncomputable def val (F : PlanarComponents) : DetectorExpr → SpaceTime → ℝ + | .known e, y => e.val y + | .input q α j, y => componentJet F α j (clockedPoint q y) + | .add e f, y => e.val F y + f.val F y + | .mul e f, y => e.val F y * f.val F y + +def Valid : DetectorExpr → Prop + | .known e => e.Valid + | .input _ _ _ => True + | .add e f => e.Valid ∧ f.Valid + | .mul e f => e.Valid ∧ f.Valid + +def diff (k : Fin 4) : DetectorExpr → DetectorExpr + | .known e => .known (e.diff k) + | .input q α j => if k = 0 then + .mul (.known (.profile q.diff)) (.input q (0 :: α) j) + else .input q (k :: α) j + | .add e f => .add (e.diff k) (f.diff k) + | .mul e f => .add (.mul (e.diff k) f) (.mul e (f.diff k)) + +theorem valid_diff {e : DetectorExpr} (he : e.Valid) (k : Fin 4) : + (e.diff k).Valid := by + induction e with + | known e => exact e.valid_diff he k + | input q α j => simp only [diff]; split_ifs <;> trivial + | add e f ihe ihf => exact ⟨ihe he.1, ihf he.2⟩ + | mul e f ihe ihf => exact ⟨⟨ihe he.1, he.2⟩, ⟨he.1, ihf he.2⟩⟩ + +theorem smooth {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) : ContDiff ℝ ∞ (e.val F) := by + induction e with + | known e => exact e.smooth he + | input q α j => exact (componentJet_smooth hF α j).comp (clockedPoint_smooth q) + | add e f ihe ihf => exact (ihe he.1).add (ihf he.2) + | mul e f ihe ihf => exact (ihe he.1).mul (ihf he.2) + +theorem val_diff {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (k : Fin 4) (y : SpaceTime) : + (e.diff k).val F y = fderiv ℝ (e.val F) y (spaceTimeDirection k) := by + induction e with + | known e => exact e.val_diff he k y + | input q α j => + have hd := ((componentJet_smooth hF α j).differentiable (by simp) + (clockedPoint q y)).hasFDerivAt.comp y + ((clockedPoint_smooth q).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (componentJet F α j ∘ clockedPoint q) y (spaceTimeDirection k) + rw [hd.fderiv, ContinuousLinearMap.comp_apply, clockedPoint_direction] + by_cases hk : k = 0 + · subst k + simp only [diff, ite_true, val, ClockedExpr.val, map_smul, smul_eq_mul] + rfl + · simp only [diff, hk, ite_false, val] + rfl + | add e f ihe ihf => + rw [show val F (.add e f) = e.val F + f.val F from rfl, + fderiv_add ((smooth hF he.1).differentiable (by simp) y) + ((smooth hF he.2).differentiable (by simp) y)] + exact congrArg₂ (· + ·) (ihe he.1) (ihf he.2) + | mul e f ihe ihf => + have hd := ((smooth hF he.1).differentiable (by simp) y).hasFDerivAt.mul + ((smooth hF he.2).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (e.val F * f.val F) y (spaceTimeDirection k) + rw [hd.fderiv] + simp only [diff, val, add_apply, smul_apply, smul_eq_mul] + rw [ihe he.1, ihf he.2] + ring + +def diffWord (e : DetectorExpr) : List (Fin 4) → DetectorExpr + | [] => e + | k :: α => (e.diffWord α).diff k + +theorem valid_diffWord {e : DetectorExpr} (he : e.Valid) (α : List (Fin 4)) : + (e.diffWord α).Valid := by + induction α with + | nil => exact he + | cons k α ih => exact valid_diff ih k + +theorem val_diffWord {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {e : DetectorExpr} (he : e.Valid) (α : List (Fin 4)) : + (e.diffWord α).val F = ClockedExpr.scalarMixed (e.val F) α := by + induction α with + | nil => rfl + | cons k α ih => + funext y + change ((e.diffWord α).diff k).val F y = _ + rw [val_diff hF (valid_diffWord he α), ih] + rfl + +def bound {F : PlanarComponents} (o : PlanarJetOracle F) (M : ℚ) : DetectorExpr → ℚ + | .known e => e.bound M + | .input _ α j => o.bound α j + | .add e f => e.bound o M + f.bound o M + | .mul e f => e.bound o M * f.bound o M + +theorem bound_nonneg {F : PlanarComponents} (o : PlanarJetOracle F) + (M : ℚ) (e : DetectorExpr) : 0 ≤ e.bound o M := by + induction e with + | known e => exact e.bound_nonneg M + | input q α j => exact o.bound_nonneg α j + | add e f ihe ihf => exact add_nonneg ihe ihf + | mul e f ihe ihf => exact mul_nonneg ihe ihf + +theorem val_bound {F : PlanarComponents} (o : PlanarJetOracle F) + {e : DetectorExpr} (he : e.Valid) (M : ℚ) (y : SpaceTime) + (hy : |y.1| ≤ |(M : ℝ)|) : |e.val F y| ≤ (e.bound o M : ℝ) := by + induction e with + | known e => exact e.val_bound he M y hy + | input q α j => exact o.jet_bound α j _ + | add e f ihe ihf => + simpa only [val, bound, Rat.cast_add] using + (abs_add_le _ _).trans (add_le_add (ihe he.1) (ihf he.2)) + | mul e f ihe ihf => + simpa only [val, bound, Rat.cast_mul, abs_mul] using + mul_le_mul (ihe he.1) (ihf he.2) (abs_nonneg _) + (Rat.cast_nonneg.mpr (e.bound_nonneg o M)) + +end DetectorExpr +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorForceTranslation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorForceTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..16c7af308d66351f429d870951259178e039ac79 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorForceTranslation.lean @@ -0,0 +1,179 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorGeneral +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorNames +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorViscosity + +namespace OAI + +/-! Translation of the prescribed full force. The coordinate formulas +also give a finite evaluator for every effective center, by translating +the input oracle and the evaluation point in opposite directions. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows +open scoped ContDiff BigOperators + +def shiftVector (δ : Plane) : Space := atHeight δ 0 +def shiftSpaceTime (δ : Plane) : SpaceTime := (0, shiftVector δ) +def translateVelocity (δ : Plane) (U : Velocity) : Velocity := + fun y => U (y + shiftSpaceTime δ) + +theorem horizontal_shift (δ : Plane) (x : Space) : + horizontalLinear (x + shiftVector δ) = horizontalLinear x + δ := by + ext j + fin_cases j <;> rfl + +theorem components_translated (δ : Plane) (V : ℝ → Plane → Plane) : + CompactProgram.components (translateField δ V) = + CompactNames.inputShift (CompactProgram.components V) (shiftSpaceTime δ) := by + funext j y + change V y.1 (horizontal y.2 + δ) j = + V (y.1 + 0) (horizontal (y.2 + shiftVector δ)) j + rw [add_zero, ← horizontalLinear_eq y.2, + ← horizontalLinear_eq (y.2 + shiftVector δ), horizontal_shift] + +theorem mixedDerivative_translated (δ : Plane) (U : Velocity) (α : List (Fin 4)) : + mixedDerivative (translateVelocity δ U) α = translateVelocity δ (mixedDerivative U α) := by + induction α with + | nil => rfl + | cons j α ih => + funext y + change fderiv ℝ (mixedDerivative (translateVelocity δ U) α) y (spaceTimeDirection j) = _ + rw [ih] + change fderiv ℝ (fun z => mixedDerivative U α (z + shiftSpaceTime δ)) y + (spaceTimeDirection j) = _ + rw [fderiv_comp_add_right] + rfl + +theorem vectorLaplacian_translated (δ : Plane) (a : Plane → Plane) (x : Plane) : + planarVectorLaplacian (fun y => a (y + δ)) x = planarVectorLaplacian a (x + δ) := by + unfold planarVectorLaplacian + apply Finset.sum_congr rfl + intro j _ + have he : (fun z => fderiv ℝ (fun y => a (y + δ)) z (PlanarHamiltonian.basis j)) = + (fun z => fderiv ℝ a (z + δ) (PlanarHamiltonian.basis j)) := by + funext z + rw [fderiv_comp_add_right] + rw [he] + have hf := fderiv_comp_add_right (𝕜 := ℝ) + (f := fun z => fderiv ℝ a z (PlanarHamiltonian.basis j)) (x := x) δ + exact congrArg (fun D : Plane →L[ℝ] Plane => D (PlanarHamiltonian.basis j)) hf + +theorem planarResidual_translated (δ : Plane) (a : ℝ → Plane → Plane) + (ν t : ℝ) (x : Plane) : + planarResidual ν (translateField δ a) t x = planarResidual ν a t (x + δ) := by + unfold planarResidual + rw [translated_fderiv] + have hlap : planarVectorLaplacian (translateField δ a t) x = + planarVectorLaplacian (a t) (x + δ) := by + change planarVectorLaplacian (fun y => a t (y + δ)) x = _ + exact vectorLaplacian_translated δ (a t) x + rw [hlap] + rfl + +theorem triangularForce_translated (δ : Plane) (a : ℝ → Plane → Plane) + (h : ℝ → Plane → ℝ) (ν : ℝ) : + triangularForce ν (translateField δ a) (translateField δ h) = + translateVelocity δ (triangularForce ν a h) := by + funext y + simp only [triangularForce, triangularLift, planarResidual_translated, translateField, + translateVelocity, shiftSpaceTime, Prod.fst_add, Prod.snd_add, add_zero, horizontal_shift] + +theorem centeredForce_translated (V : ℝ → Plane → Plane) (p : Plane) (C L : ℕ) (ν : ℝ) : + centeredForce V p C L ν = + translateVelocity (-centerShift p) + (detectorViscosityForce (translateField (centerShift p) V) C L ν) := by + unfold centeredForce centeredDrift centeredSource detectorViscosityForce + have ha : viscosityDrift ν + (translateField (-centerShift p) (detectorDrift (translateField (centerShift p) V) C L)) = + translateField (-centerShift p) + (viscosityDrift ν (detectorDrift (translateField (centerShift p) V) C L)) := rfl + have hh : viscositySource ν (translateField (-centerShift p) (detectorSource C L)) = + translateField (-centerShift p) (viscositySource ν (detectorSource C L)) := rfl + rw [ha, hh] + exact triangularForce_translated (-centerShift p) + (viscosityDrift ν (detectorDrift (translateField (centerShift p) V) C L)) + (viscositySource ν (detectorSource C L)) ν + +theorem centeredForce_mixed (V : ℝ → Plane → Plane) (p : Plane) (C L : ℕ) (ν : ℝ) + (α : List (Fin 4)) : mixedDerivative (centeredForce V p C L ν) α = + translateVelocity (-centerShift p) + (mixedDerivative (detectorViscosityForce (translateField (centerShift p) V) C L ν) α) := by + rw [centeredForce_translated, mixedDerivative_translated] + +def negatePoint (q : RationalSpaceTime) : RationalSpaceTime := (-q.1, fun j => -q.2 j) +def negateName (b : ℕ → RationalSpaceTime) : ℕ → RationalSpaceTime := fun n => negatePoint (b n) + +theorem rationalPoint_negate (q : RationalSpaceTime) : rationalPoint (negatePoint q) = -rationalPoint q := by + apply Prod.ext + · exact Rat.cast_neg _ + · ext j + exact Rat.cast_neg _ + +theorem negateName_spec {b : ℕ → RationalSpaceTime} {z : SpaceTime} (hb : IsFastName b z) : + IsFastName (negateName b) (-z) := by + intro n + rw [negateName, rationalPoint_negate, neg_sub_neg, norm_sub_rev] + exact hb n + +theorem shiftSpaceTime_neg (δ : Plane) : shiftSpaceTime (-δ) = -shiftSpaceTime δ := by + apply Prod.ext + · simp [shiftSpaceTime] + · ext j + fin_cases j <;> simp [shiftSpaceTime, shiftVector, atHeight] + +def translatedInputOracle {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (CompactProgram.components V)) + (p : Plane) (b : ℕ → RationalSpaceTime) (hb : IsFastName b (shiftSpaceTime (centerShift p))) : + PlanarJetOracle (CompactProgram.components (translateField (centerShift p) V)) := + (components_translated (centerShift p) V).symm ▸ + CompactNames.shiftedOracle o (CompactProgram.components_smooth hV) hb + +def evaluateCenteredForce {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (CompactProgram.components V)) + (p : Plane) (b : ℕ → RationalSpaceTime) (hb : IsFastName b (shiftSpaceTime (centerShift p))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (c : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hc : IsFastName c y) (ε : ℚ) (hε : 0 < ε) : RationalVector := + CompactProgram.evaluateViscosityForce (translated_smooth (centerShift p) hV) + (translatedInputOracle hV o p b hb) C L α a (CompactNames.addName c (negateName b)) ha + (CompactNames.addName_spec hc (negateName_spec hb)) ε hε + +theorem evaluateCenteredForce_spec {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (CompactProgram.components V)) + (p : Plane) (b : ℕ → RationalSpaceTime) (hb : IsFastName b (shiftSpaceTime (centerShift p))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (c : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hc : IsFastName c y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (centeredForce V p C L ν) α y - + rationalVector (evaluateCenteredForce hV o p b hb C L α a c ha hc ε hε)‖ ≤ (ε : ℝ) := by + rw [centeredForce_mixed] + change ‖mixedDerivative (detectorViscosityForce (translateField (centerShift p) V) C L ν) α + (y + shiftSpaceTime (-centerShift p)) - _‖ ≤ _ + rw [shiftSpaceTime_neg] + exact CompactProgram.evaluateViscosityForce_spec (translated_smooth (centerShift p) hV) + (translatedInputOracle hV o p b hb) C L α a _ ha + (CompactNames.addName_spec hc (negateName_spec hb)) ε hε + +def centeredForceBound {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (CompactProgram.components V)) + (p : Plane) (b : ℕ → RationalSpaceTime) (hb : IsFastName b (shiftSpaceTime (centerShift p))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (T : ℚ) : ℚ := + CompactProgram.viscosityForceBound (translatedInputOracle hV o p b hb) C L α a T + +theorem centeredForceBound_spec {V : ℝ → Plane → Plane} {ν : ℝ} (hν : 0 < ν) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (CompactProgram.components V)) + (p : Plane) (b : ℕ → RationalSpaceTime) (hb : IsFastName b (shiftSpaceTime (centerShift p))) + (C L : ℕ) (α : List (Fin 4)) {a : ℕ → ℚ} (ha : IsFastRealName a ν) + (T : ℚ) {y : SpaceTime} (ht : 0 ≤ y.1) (hT : y.1 ≤ (T : ℝ)) : + ‖mixedDerivative (centeredForce V p C L ν) α y‖ ≤ + (centeredForceBound hV o p b hb C L α a T : ℝ) := by + rw [centeredForce_mixed] + apply CompactProgram.viscosityForceBound_spec hν (translated_smooth (centerShift p) hV) + (translatedInputOracle hV o p b hb) C L α ha T + · simpa only [shiftSpaceTime, Prod.fst_add, add_zero] using ht + · simpa only [shiftSpaceTime, Prod.fst_add, add_zero] using hT + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorGeneral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorGeneral.lean new file mode 100644 index 0000000000000000000000000000000000000000..65bd6bd56189f0f86911fb15885b6cd82b2e0397 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorGeneral.lean @@ -0,0 +1,174 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorScalarTranslation + +namespace OAI + +/-! The analytic detector at an arbitrary center. Its prescribed drift +and source are translations of the fixed-center program. The two numerical +choices use the same force. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows Set +open scoped ContDiff + +def centerShift (p : Plane) : Plane := + letI := ShearFlows.fourAtLeastTwo + p - ![1 / 4, 1 / 4] + +theorem reference_add_shift (p : Plane) : ![1 / 4, 1 / 4] + centerShift p = p := by + unfold centerShift + abel + +theorem euclidean_translated (δ : Plane) (f : Plane → Plane) : + euclideanMap (fun x => f (x + δ)) = + fun x => euclideanMap f (x + planeCoordinates.symm δ) := by + funext x + simp only [euclideanMap, map_add, ContinuousLinearEquiv.apply_symm_apply] + +theorem euclidean_translated_first (δ : Plane) (f : Plane → Plane) (x : EuclideanPlane) : + fderiv ℝ (euclideanMap (fun y => f (y + δ))) x = + fderiv ℝ (euclideanMap f) (x + planeCoordinates.symm δ) := by + rw [euclidean_translated, fderiv_comp_add_right] + +theorem euclidean_translated_second (δ : Plane) (f : Plane → Plane) (x : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (euclideanMap (fun y => f (y + δ)))) x = + fderiv ℝ (fderiv ℝ (euclideanMap f)) (x + planeCoordinates.symm δ) := by + have he : fderiv ℝ (euclideanMap (fun y => f (y + δ))) = + fun y => fderiv ℝ (euclideanMap f) (y + planeCoordinates.symm δ) := + funext (euclidean_translated_first δ f) + rw [he, fderiv_comp_add_right] + +def centeredDrift (V : ℝ → Plane → Plane) (p : Plane) (C L : ℕ) : ℝ → Plane → Plane := + translateField (-centerShift p) (detectorDrift (translateField (centerShift p) V) C L) + +def centeredSource (p : Plane) (C L : ℕ) : ℝ → Plane → ℝ := + translateField (-centerShift p) (detectorSource C L) + +theorem centeredDrift_eq (V : ℝ → Plane → Plane) (p : Plane) (C L : ℕ) : + centeredDrift V p C L = detectorDrift V C L := by + funext t x + unfold centeredDrift translateField detectorDrift detectorBlockSum + apply tsum_congr + intro n + simp only [detectorDriftTerm, neg_add_cancel_right] + +def centeredForce (V : ℝ → Plane → Plane) (p : Plane) (C L : ℕ) (ν : ℝ) : Velocity := + triangularForce ν (viscosityDrift ν (centeredDrift V p C L)) + (viscositySource ν (centeredSource p C L)) + +theorem general_center_compact_detector (hE : TorusScalarExistence) (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hΨ : IsPlanarTransition V Ψ) (hv : PlanarVariations V Ψ) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) + (p : Plane) : + ∃ w : ℝ → Plane → ℝ, + GlobalTorusScalarSolution 1 (centeredDrift V p detectorBumpDerivativeBound L) + (centeredSource p detectorBumpDerivativeBound L) w (fun _ => 0) ∧ + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + (massBound L : ℝ) < 1 / 100000000000 ∧ + ∀ ν : ℝ, 0 < ν → + IsClassicalSolution 1 ν (centeredForce V p detectorBumpDerivativeBound L ν) + (triangularVelocity + (viscosityDrift ν (centeredDrift V p detectorBumpDerivativeBound L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u q, IsClassicalSolution 1 ν (centeredForce V p detectorBumpDerivativeBound L ν) u q → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = + triangularVelocity (viscosityDrift ν (centeredDrift V p detectorBumpDerivativeBound L)) + (viscosityScalar ν w) (t, x) ∧ q (t, x) = 0) ∧ + ∀ (E : Set Plane) (d H : ℝ), DetectorPair d H → + ((∃ k : ℕ, Ψ 0 k p ∈ E) → + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, 1 / 2 < viscosityScalar ν w t x) ∧ + ((∀ s, 0 ≤ s → ∀ x ∈ E, 2 * d ≤ torusNorm (Ψ 0 s p - x)) → + ∀ t, 0 ≤ t → ∀ x ∈ E, viscosityScalar ν w t x < 1 / 2) := by + let δ := centerShift p + let V' := translateField δ V + let Ψ' := translateTransition δ Ψ + have hV' : ContDiff ℝ ∞ (Function.uncurry V') := translated_smooth δ hV + have hp' : ∀ s, PlanePeriodic (V' s) := translated_periodic δ hp + have hd' : ∀ s x, PlanarHamiltonian.divergence (V' s) x = 0 := by + intro s x + rw [translated_divergence, hdiv] + have h₁' : ∀ s x, ‖fderiv ℝ (euclideanMap (V' s)) x‖ ≤ (L : ℝ) := by + intro s x + rw [show V' s = (fun y => V s (y + δ)) from rfl, euclidean_translated_first] + exact h₁ _ _ + have h₂' : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V' s))) x‖ ≤ (L : ℝ) := by + intro s x + rw [show V' s = (fun y => V s (y + δ)) from rfl, euclidean_translated_second] + exact h₂ _ _ + obtain ⟨w₀, hs₀, _, _, hm₀, hsmall, hall⟩ := fixed_center_compact_detector hE hK hV' hp' hd' + (transition_translated hΨ δ) (variations_translated hv δ) (backward_translated hback δ) + L hL h₁' h₂' + obtain ⟨v, hsv, hv', hvp, hnv, _⟩ := detectorScalar_exists hE hV' hp' detectorBumpDerivativeBound L + have he (t : ℝ) (ht : 0 ≤ t) : v t = w₀ t := hsv.unique hs₀ (by norm_num) t ht + let w := translateField (-δ) v + have hw : ContDiff ℝ ∞ (Function.uncurry w) := translated_smooth (-δ) hv' + have hwp : ∀ t, PlanePeriodic (w t) := translated_periodic (-δ) hvp + have hs : GlobalTorusScalarSolution 1 (centeredDrift V p detectorBumpDerivativeBound L) + (centeredSource p detectorBumpDerivativeBound L) w (fun _ => 0) := + global_scalar_solution_translated hsv (-δ) + have ha := translated_smooth (-δ) (detectorDrift_smooth hV' detectorBumpDerivativeBound L) + have hap := translated_periodic (-δ) (detectorDrift_periodic hp' detectorBumpDerivativeBound L) + have had : ∀ t x, PlanarHamiltonian.divergence + (centeredDrift V p detectorBumpDerivativeBound L t) x = 0 := by + intro t x + rw [centeredDrift_eq] + exact detectorDrift_divergence hV hdiv detectorBumpDerivativeBound L t x + refine ⟨w, hs, hw, fun t x => hnv t (x + -δ), ?_, hsmall, ?_⟩ + · intro t ht + rw [scalarMass_translated hv' hvp (-δ) t] + change (∫ x in Icc (0 : Plane) (fun _ => 1), v t x) ≤ _ + rw [he t ht] + exact hm₀ t ht + · intro ν hν + have hsol := triangularVelocity_solution (viscosityDrift_smooth ha ν) + (viscosityScalar_smooth hw ν) (hs.viscosity hw hν.le) + (viscosityDrift_periodic hap ν) (fun t => hwp (ν * t)) + (viscosityDrift_divergence ha had ν) + (fun x => by + change ν • detectorDrift V' detectorBumpDerivativeBound L (ν * 0) (x + -δ) = 0 + rw [mul_zero, detectorDrift_before V' detectorBumpDerivativeBound L le_rfl, smul_zero]) + refine ⟨hsol, finite_time_classical_unique (by norm_num) hν.le hsol, ?_⟩ + intro E d H hpair + let E' : Set Plane := {x | x + δ ∈ E} + have hobs := (hall ν hν).2.2 E' d H hpair + have horbit (s : ℝ) : Ψ' 0 s ![1 / 4, 1 / 4] = Ψ 0 s p - δ := by + simp only [Ψ', translateTransition, δ, reference_add_shift] + constructor + · rintro ⟨k, hk⟩ + have hk' : Ψ' 0 k ![1 / 4, 1 / 4] ∈ E' := by + change Ψ' 0 k ![1 / 4, 1 / 4] + δ ∈ E + rw [horbit, sub_add_cancel] + exact hk + obtain ⟨t, ht, x, hx, hh⟩ := hobs.1 ⟨k, hk'⟩ + refine ⟨t, ht, x + δ, hx, ?_⟩ + change 1 / 2 < v (ν * t) (x + δ + -δ) + rw [add_neg_cancel_right, he _ (mul_nonneg hν.le ht)] + exact hh + · intro hfar t ht x hx + have hf : ∀ s, 0 ≤ s → ∀ y ∈ E', + 2 * d ≤ torusNorm (Ψ' 0 s ![1 / 4, 1 / 4] - y) := by + intro s hs' y hy + rw [horbit] + have hh := hfar s hs' (y + δ) hy + convert hh using 2 + abel + have hx' : x + -δ ∈ E' := by + change x + -δ + δ ∈ E + simpa only [neg_add_cancel_right] using hx + have hh := hobs.2 hf t ht (x + -δ) hx' + change v (ν * t) (x + -δ) < 1 / 2 + rw [he _ (mul_nonneg hν.le ht)] + exact hh + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2d2d25aede53bd8fe346084b6daeefffd464448 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorMain.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorForceTranslation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorSupport + +namespace OAI + +/-! The general-center injection, stirring and waiting theorem, including +both numerical pairs and the input-relative effective force. The scalar +existence, heat estimate and smooth-dependence inputs remain explicit. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows Set +open scoped ContDiff + +/-- The prescribed periodic planar processor and its effective derivative +data. The force compiler invokes only this input oracle. -/ +structure ProcessorInput (V : ℝ → Plane → Plane) where + smooth : ContDiff ℝ ∞ (Function.uncurry V) + spatial_periodic : ∀ s, PlanePeriodic (V s) + divergence_zero : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0 + time_periodic : ∀ s x, V (s + 1) x = V s x + phase_collar : ∃ ε : ℝ, 0 < ε ∧ ∀ s, |s| < ε → ∀ x, V s x = 0 + oracle : PlanarJetOracle (CompactProgram.components V) + +theorem third_component (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) + (t : ℝ) (x : Plane) (z : ℝ) : + triangularVelocity a w (t, atHeight x z) 2 = w t x := by + rw [triangularVelocity, triangularLift_eq, atHeight_horizontal] + rfl + +/-- Injection, stirring and waiting. The same prescribed force works for +either quantitative `(d,H)` pair. -/ +theorem compact_detector (hE : TorusScalarExistence) (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + (Ψ : ℝ → ℝ → Plane → Plane) (hΨ : IsPlanarTransition V Ψ) + (hv : PlanarVariations V Ψ) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) + (p : Plane) (b : ℕ → RationalSpaceTime) + (hb : IsFastName b (shiftSpaceTime (centerShift p))) : + let C := detectorBumpDerivativeBound + let K := processorSupport V ∪ injectionNeighborhood p + IsClosed K ∧ p ∈ injectionNeighborhood p ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + (massBound L : ℝ) < 1 / 100000000000 ∧ + ∀ ν : ℝ, 0 < ν → + let u := triangularVelocity (viscosityDrift ν (centeredDrift V p C L)) (viscosityScalar ν w) + ContDiff ℝ ∞ (centeredForce V p C L ν) ∧ SpatiallyPeriodic 1 (centeredForce V p C L ν) ∧ + ContDiff ℝ ∞ u ∧ IsClassicalSolution 1 ν (centeredForce V p C L ν) u (fun _ => 0) ∧ + (∀ u' q, IsClassicalSolution 1 ν (centeredForce V p C L ν) u' q → + ∀ t, 0 ≤ t → ∀ x, u' (t, x) = u (t, x) ∧ q (t, x) = 0) ∧ + (∀ t x z, 0 ≤ u (t, atHeight x z) 2) ∧ + (∀ (E : Set Plane) (_hopen : IsOpen E) (d H : ℝ), DetectorPair d H → + ((∃ k : ℕ, Ψ 0 k p ∈ E) → + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, ∀ z, 1 / 2 < u (t, atHeight x z) 2) ∧ + ((∀ s, 0 ≤ s → ∀ x ∈ E, 2 * d ≤ torusNorm (Ψ 0 s p - x)) → + ∀ t, 0 ≤ t → ∀ x ∈ E, ∀ z, u (t, atHeight x z) 2 < 1 / 2)) ∧ + (∀ t x, x ∉ K → ∀ z, centeredForce V p C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (c : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hc : IsFastName c y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (centeredForce V p C L ν) α y - + rationalVector (evaluateCenteredForce hV.smooth hV.oracle p b hb C L + α a c ha hc ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (centeredForce V p C L ν) α y‖ ≤ + (centeredForceBound hV.smooth hV.oracle p b hb C L α a T : ℝ)) := by + dsimp only + obtain ⟨w, _, hw, hn, hm, hsmall, hνs⟩ := general_center_compact_detector hE hK + hV.smooth hV.spatial_periodic hV.divergence_zero hΨ hv hback L hL h₁ h₂ p + refine ⟨isClosed_closure.union (injectionNeighborhood_closed p), + injectionNeighborhood_contains p, w, hw, hn, hm, hsmall, ?_⟩ + intro ν hν + obtain ⟨hu, huniq, hobs⟩ := hνs ν hν + have hA : ContDiff ℝ ∞ (Function.uncurry (centeredDrift V p detectorBumpDerivativeBound L)) := by + rw [centeredDrift_eq] + exact detectorDrift_smooth hV.smooth _ _ + have hAp : ∀ t, PlanePeriodic (centeredDrift V p detectorBumpDerivativeBound L t) := by + rw [centeredDrift_eq] + exact detectorDrift_periodic hV.spatial_periodic _ _ + have hH := translated_smooth (-centerShift p) + (detectorSource_smooth detectorBumpDerivativeBound L) + have hHp := translated_periodic (-centerShift p) + (detectorSource_periodic detectorBumpDerivativeBound L) + refine ⟨triangularForce_smooth (viscosityDrift_smooth hA ν) (viscositySource_smooth hH ν) ν, + triangularForce_periodic (viscosityDrift_smooth hA ν) + (viscosityDrift_periodic hAp ν) (viscositySource_periodic hHp ν) ν, + triangularVelocity_smooth (viscosityDrift_smooth hA ν) (viscosityScalar_smooth hw ν), + hu, huniq, ?_, ?_, ?_, ?_, ?_⟩ + · intro t x z + rw [third_component] + exact hn _ _ + · intro E _ d H hpair + obtain ⟨hpos, hneg⟩ := hobs E d H hpair + constructor + · intro he + obtain ⟨t, ht, x, hx, hh⟩ := hpos he + exact ⟨t, ht, x, hx, fun z => by simpa only [third_component] using hh⟩ + · intro he t ht x hx z + simpa only [third_component] using hneg he t ht x hx + · intro t x hx z + exact centeredForce_supported hV.smooth p detectorBumpDerivativeBound L ν t hx z + · intro α a c y ha hc ε hε + exact evaluateCenteredForce_spec hV.smooth hV.oracle p b hb _ _ α a c ha hc ε hε + · intro α a ha T y ht hT + exact centeredForceBound_spec hν hV.smooth hV.oracle p b hb _ _ α ha T ht hT + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorNames.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorNames.lean new file mode 100644 index 0000000000000000000000000000000000000000..731d13458ab122c115af5661eac0f5280e33e2c4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorNames.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorEvaluation + +namespace OAI + +/-! Arbitrary effective centers are handled by fast names. A translated +input oracle is compiled from the original oracle and the center name; +translation does not change its global derivative bounds. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactNames +open ShearFlows Filter +open scoped ContDiff Topology + +def addPoint (q r : RationalSpaceTime) : RationalSpaceTime := + (q.1 + r.1, fun j => q.2 j + r.2 j) + +theorem rationalPoint_add (q r : RationalSpaceTime) : + rationalPoint (addPoint q r) = rationalPoint q + rationalPoint r := by + apply Prod.ext + · exact Rat.cast_add _ _ + · ext j + exact Rat.cast_add _ _ + +def addName (a b : ℕ → RationalSpaceTime) : ℕ → RationalSpaceTime := + fun n => addPoint (a (n + 1)) (b (n + 1)) + +theorem addName_spec {a b : ℕ → RationalSpaceTime} {x y : SpaceTime} + (ha : IsFastName a x) (hb : IsFastName b y) : IsFastName (addName a b) (x + y) := by + intro n + rw [addName, rationalPoint_add] + have he : x + y - (rationalPoint (a (n + 1)) + rationalPoint (b (n + 1))) = + (x - rationalPoint (a (n + 1))) + (y - rationalPoint (b (n + 1))) := by abel + rw [he] + calc + _ ≤ ‖x - rationalPoint (a (n + 1))‖ + ‖y - rationalPoint (b (n + 1))‖ := norm_add_le _ _ + _ ≤ errorTolerance (n + 1) + errorTolerance (n + 1) := add_le_add (ha _) (hb _) + _ = errorTolerance n := by + unfold errorTolerance + rw [pow_succ] + have hp : (2 : ℝ) ^ n ≠ 0 := pow_ne_zero _ (by norm_num) + field_simp + ring + +def rationalShiftName (q : RationalSpaceTime) (b : ℕ → RationalSpaceTime) : + ℕ → RationalSpaceTime := fun n => addPoint q (b n) + +theorem rationalShiftName_spec (q : RationalSpaceTime) {b : ℕ → RationalSpaceTime} + {z : SpaceTime} (hb : IsFastName b z) : + IsFastName (rationalShiftName q b) (rationalPoint q + z) := by + intro n + rw [rationalShiftName, rationalPoint_add] + simpa only [add_sub_add_left_eq_sub] using hb n + +def inputShift (F : PlanarComponents) (z : SpaceTime) : PlanarComponents := + fun j y => F j (y + z) + +theorem inputShift_smooth {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + (z : SpaceTime) (j : Fin 2) : ContDiff ℝ ∞ (inputShift F z j) := + (hF j).comp (contDiff_id.add contDiff_const) + +theorem componentJet_shift (F : PlanarComponents) (z : SpaceTime) + (α : List (Fin 4)) (j : Fin 2) : + componentJet (inputShift F z) α j = fun y => componentJet F α j (y + z) := by + induction α with + | nil => rfl + | cons k α ih => + funext y + change fderiv ℝ (componentJet (inputShift F z) α j) y (spaceTimeDirection k) = _ + rw [ih, fderiv_comp_add_right] + rfl + +theorem coordinate_clock (y : SpaceTime) : clockedPoint .coord y = y := by + exact Prod.ext rfl rfl + +def shiftedEnclosure {F : PlanarComponents} (o : PlanarJetOracle F) + (hF : ∀ j, ContDiff ℝ ∞ (F j)) (b : ℕ → RationalSpaceTime) + (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) (n : ℕ) : QBall := + ⟨DetectorExpr.evaluate o hF (.input .coord α j) trivial + (rationalShiftName q b) (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n), + ClockedExpr.dyadic n⟩ + +theorem shiftedEnclosure_contains {F : PlanarComponents} (o : PlanarJetOracle F) + (hF : ∀ j, ContDiff ℝ ∞ (F j)) {b : ℕ → RationalSpaceTime} {z : SpaceTime} + (hb : IsFastName b z) (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) (n : ℕ) : + (shiftedEnclosure o hF b α j q n).Contains + (componentJet (inputShift F z) α j (rationalPoint q)) := by + rw [componentJet_shift] + have h := DetectorExpr.evaluate_spec o hF (e := .input .coord α j) trivial + (rationalShiftName q b) (rationalShiftName_spec q hb) + (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) + simpa only [shiftedEnclosure, QBall.Contains, DetectorExpr.val, coordinate_clock] using h + +def shiftedOracle {F : PlanarComponents} (o : PlanarJetOracle F) + (hF : ∀ j, ContDiff ℝ ∞ (F j)) {b : ℕ → RationalSpaceTime} {z : SpaceTime} + (hb : IsFastName b z) : PlanarJetOracle (inputShift F z) where + bound := o.bound + bound_nonneg := o.bound_nonneg + jet_bound := by + intro α j y + rw [componentJet_shift] + exact o.jet_bound α j (y + z) + enclose := shiftedEnclosure o hF b + enclose_contains := shiftedEnclosure_contains o hF hb + enclose_converges := by + intro α j q + apply QBall.converges_of_contains (shiftedEnclosure_contains o hF hb α j q) + exact ClockedExpr.dyadic_tendsto + +end ForcedComputation.VelocityDetector.CompactNames + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorOracle.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorOracle.lean new file mode 100644 index 0000000000000000000000000000000000000000..60677f79f24ce72eb65be408d8c94f52abccd39b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorOracle.lean @@ -0,0 +1,154 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorExpressions + +namespace OAI + +/-! Certified calls to the input-field oracle at clocked points. The +adaptive searches below stop because the input's rational enclosures +converge. No evaluator for the output force is assumed. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Filter +open scoped ContDiff Topology BigOperators + +namespace PlanarJetOracle + +variable {F : PlanarComponents} (o : PlanarJetOracle F) + +def modulus (α : List (Fin 4)) (j : Fin 2) : ℚ := + ∑ k : Fin 4, o.bound (k :: α) j + +theorem modulus_nonneg (α : List (Fin 4)) (j : Fin 2) : 0 ≤ o.modulus α j := + Finset.sum_nonneg (fun _ _ => o.bound_nonneg _ _) + +theorem fderiv_bound (α : List (Fin 4)) (j : Fin 2) (y : SpaceTime) : + ‖fderiv ℝ (componentJet F α j) y‖ ≤ (o.modulus α j : ℝ) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Rat.cast_nonneg.mpr (o.modulus_nonneg α j)) + intro v + conv_lhs => rw [← spaceTimeDirections_sum v] + rw [map_sum] + calc + _ ≤ ∑ k : Fin 4, ‖fderiv ℝ (componentJet F α j) y + (timeSpaceCoord k v • spaceTimeDirection k)‖ := norm_sum_le _ _ + _ ≤ ∑ k : Fin 4, ‖v‖ * (o.bound (k :: α) j : ℝ) := by + apply Finset.sum_le_sum + intro k _ + rw [map_smul, norm_smul] + have hk : ‖fderiv ℝ (componentJet F α j) y (spaceTimeDirection k)‖ ≤ + (o.bound (k :: α) j : ℝ) := o.jet_bound (k :: α) j y + exact mul_le_mul (timeSpaceCoord_norm k v) hk (norm_nonneg _) (norm_nonneg _) + _ = _ := by + rw [modulus, Rat.cast_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro k _ + ring + +theorem lipschitz (hF : ∀ j, ContDiff ℝ ∞ (F j)) (α : List (Fin 4)) + (j : Fin 2) (x y : SpaceTime) : + |componentJet F α j x - componentJet F α j y| ≤ + (o.modulus α j : ℝ) * ‖x - y‖ := by + have h := Convex.norm_image_sub_le_of_norm_fderiv_le + (fun z (_ : z ∈ (Set.univ : Set SpaceTime)) => + (componentJet_smooth hF α j).differentiable (by simp) z) + (fun z _ => o.fderiv_bound α j z) convex_univ (Set.mem_univ y) (Set.mem_univ x) + simpa only [Real.norm_eq_abs] using h + +def Ready (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) (ε : ℚ) (n : ℕ) : Prop := + (o.enclose α j q n).radius ≤ ε + +instance readyDecidable (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) + (ε : ℚ) (n : ℕ) : Decidable (o.Ready α j q ε n) := + inferInstanceAs (Decidable ((o.enclose α j q n).radius ≤ ε)) + +theorem ready_exists (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) + {ε : ℚ} (hε : 0 < ε) : ∃ n, o.Ready α j q ε n := by + have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := ((o.enclose_converges α j q).2.eventually_lt_const hε').exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +def evaluate (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : ℚ := + (o.enclose α j q (Nat.find (o.ready_exists α j q hε))).center + +theorem evaluate_spec (α : List (Fin 4)) (j : Fin 2) (q : RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : + |componentJet F α j (rationalPoint q) - (o.evaluate α j q ε hε : ℝ)| ≤ (ε : ℝ) := by + exact (o.enclose_contains α j q (Nat.find (o.ready_exists α j q hε))).trans + (by exact_mod_cast Nat.find_spec (o.ready_exists α j q hε)) + +def clockBall (p : ProfileExpr) (α : List (Fin 4)) (j : Fin 2) + (y : RationalSpaceTime) (n : ℕ) : QBall := + let b := p.enclose y.1 n + ⟨o.evaluate α j (b.center, y.2) (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n), + ClockedExpr.dyadic n + o.modulus α j * b.radius⟩ + +theorem clockBall_contains (hF : ∀ j, ContDiff ℝ ∞ (F j)) + (p : ProfileExpr) (α : List (Fin 4)) (j : Fin 2) (y : RationalSpaceTime) (n : ℕ) : + (o.clockBall p α j y n).Contains (componentJet F α j (clockedPoint p (rationalPoint y))) := by + let b := p.enclose y.1 n + let z : RationalSpaceTime := (b.center, y.2) + have hd : ‖clockedPoint p (rationalPoint y) - rationalPoint z‖ ≤ (b.radius : ℝ) := by + apply norm_prod_le_iff.mpr + constructor + · exact p.enclose_contains y.1 n + · change ‖(fun k => (y.2 k : ℝ)) - (fun k => (y.2 k : ℝ))‖ ≤ (b.radius : ℝ) + rw [sub_self, norm_zero] + exact_mod_cast QBall.radius_nonneg (p.enclose_contains y.1 n) + have h₁ := (o.lipschitz hF α j (clockedPoint p (rationalPoint y)) (rationalPoint z)).trans + (mul_le_mul_of_nonneg_left hd (Rat.cast_nonneg.mpr (o.modulus_nonneg α j))) + have h₂ := o.evaluate_spec α j z (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) + change |componentJet F α j (clockedPoint p (rationalPoint y)) - + (o.evaluate α j z (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) : ℝ)| ≤ _ + calc + _ ≤ |componentJet F α j (clockedPoint p (rationalPoint y)) - componentJet F α j (rationalPoint z)| + + |componentJet F α j (rationalPoint z) - + (o.evaluate α j z (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) : ℝ)| := abs_sub_le _ _ _ + _ ≤ (o.modulus α j : ℝ) * (b.radius : ℝ) + (ClockedExpr.dyadic n : ℝ) := add_le_add h₁ h₂ + _ = _ := by + change _ = ((ClockedExpr.dyadic n + o.modulus α j * b.radius : ℚ) : ℝ) + push_cast + ring + +theorem clockBall_converges (hF : ∀ j, ContDiff ℝ ∞ (F j)) + (p : ProfileExpr) (α : List (Fin 4)) (j : Fin 2) (y : RationalSpaceTime) : + QBall.Converges (o.clockBall p α j y) (componentJet F α j (clockedPoint p (rationalPoint y))) := by + apply QBall.converges_of_contains (o.clockBall_contains hF p α j y) + have h := ClockedExpr.dyadic_tendsto.add + ((p.enclose_converges y.1).2.const_mul (o.modulus α j : ℝ)) + simpa only [clockBall, Rat.cast_add, Rat.cast_mul, mul_zero, add_zero] using h + +end PlanarJetOracle + +namespace DetectorExpr + +def enclose {F : PlanarComponents} (o : PlanarJetOracle F) : + (e : DetectorExpr) → e.Valid → RationalSpaceTime → ℕ → QBall + | .known e, he, y, n => e.enclose he y n + | .input p α j, _, y, n => o.clockBall p α j y n + | .add e f, he, y, n => (e.enclose o he.1 y n).add (f.enclose o he.2 y n) + | .mul e f, he, y, n => (e.enclose o he.1 y n).mul (f.enclose o he.2 y n) + +theorem enclose_contains {F : PlanarComponents} (o : PlanarJetOracle F) + (hF : ∀ j, ContDiff ℝ ∞ (F j)) {e : DetectorExpr} (he : e.Valid) + (y : RationalSpaceTime) (n : ℕ) : (e.enclose o he y n).Contains (e.val F (rationalPoint y)) := by + induction e with + | known e => exact e.enclose_contains he y n + | input p α j => exact o.clockBall_contains hF p α j y n + | add e f ihe ihf => exact QBall.contains_add (ihe he.1) (ihf he.2) + | mul e f ihe ihf => exact QBall.contains_mul (ihe he.1) (ihf he.2) + +theorem enclose_converges {F : PlanarComponents} (o : PlanarJetOracle F) + (hF : ∀ j, ContDiff ℝ ∞ (F j)) {e : DetectorExpr} (he : e.Valid) + (y : RationalSpaceTime) : QBall.Converges (e.enclose o he y) (e.val F (rationalPoint y)) := by + induction e with + | known e => exact e.enclose_converges he y + | input p α j => exact o.clockBall_converges hF p α j y + | add e f ihe ihf => exact (ihe he.1).add (ihf he.2) + | mul e f ihe ihf => exact (ihe he.1).mul (ihf he.2) + +end DetectorExpr +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..df2d2d9e359ceb62eb227d1660267534975d0047 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorProgram.lean @@ -0,0 +1,249 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceProgram + +namespace OAI + +/-! A finite force program relative to an arbitrary effectively supplied +planar field. The rational time prefix is selected before any evaluation; +all spatial and time derivatives are compiled by the local chain rule. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactProgram +open ShearFlows Filter +open scoped ContDiff Topology BigOperators + +def components (V : ℝ → Plane → Plane) : PlanarComponents := + fun j y => V y.1 (horizontal y.2) j + +theorem components_smooth {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (j : Fin 2) : + ContDiff ℝ ∞ (components V j) := by + have hi : ContDiff ℝ ∞ (fun y : SpaceTime => (y.1, horizontal y.2)) := by + simpa only [Function.comp_def, horizontalLinear_eq] using + contDiff_fst.prodMk (horizontalLinear.contDiff.comp contDiff_snd) + exact (contDiff_apply ℝ ℝ j).comp (hV.comp hi) + +def sum (l : List DetectorExpr) : DetectorExpr := + l.foldr .add (.known (.const 0)) + +theorem sum_valid {l : List DetectorExpr} (hl : ∀ e ∈ l, e.Valid) : (sum l).Valid := by + induction l with + | nil => trivial + | cons e l ih => exact ⟨hl e (by simp), ih (fun f hf => hl f (by simp [hf]))⟩ + +theorem sum_value (F : PlanarComponents) (l : List DetectorExpr) (y : SpaceTime) : + (sum l).val F y = (l.map (fun e => e.val F y)).sum := by + induction l with + | nil => simp only [sum, List.foldr_nil, DetectorExpr.val, ClockedExpr.val, + List.map_nil, List.sum_nil, Rat.cast_zero] + | cons e l ih => + change e.val F y + (sum l).val F y = _ + simp only [List.map_cons, List.sum_cons, ih] + +theorem sum_ofFn_valid {n : ℕ} (e : Fin n → DetectorExpr) (he : ∀ j, (e j).Valid) : + (sum (List.ofFn e)).Valid := + sum_valid (fun f hf => by obtain ⟨j, rfl⟩ := List.mem_ofFn.mp hf; exact he j) + +theorem sum_ofFn_value (F : PlanarComponents) {n : ℕ} (e : Fin n → DetectorExpr) + (y : SpaceTime) : (sum (List.ofFn e)).val F y = ∑ j, (e j).val F y := by + rw [sum_value, List.map_ofFn, List.sum_ofFn] + rfl + +abbrev Vector := Fin 3 → DetectorExpr + +def Valid (c : Vector) : Prop := ∀ j, (c j).Valid +def value (F : PlanarComponents) (c : Vector) : Velocity := fun y j => (c j).val F y +def diffWord (c : Vector) (α : List (Fin 4)) : Vector := fun j => (c j).diffWord α + +theorem value_smooth {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {c : Vector} (hc : Valid c) : ContDiff ℝ ∞ (value F c) := + contDiff_pi.mpr (fun j => (c j).smooth hF (hc j)) + +theorem value_diffWord {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {c : Vector} (hc : Valid c) (α : List (Fin 4)) : + value F (diffWord c α) = mixedDerivative (value F c) α := by + induction α with + | nil => rfl + | cons k α ih => + funext y j + rw [mixedDerivative, ← ih] + have hd := fderiv_pi (fun i => + (((c i).diffWord α).smooth hF ((c i).valid_diffWord (hc i) α)).differentiable (by simp) y) + change ((c j).diffWord (k :: α)).val F y = + (fderiv ℝ (value F (diffWord c α)) y (spaceTimeDirection k)) j + change fderiv ℝ (value F (diffWord c α)) y = _ at hd + rw [hd] + exact ((c j).diffWord α).val_diff hF ((c j).valid_diffWord (hc j) α) k y + +def residualCode (c : Vector) : Vector := fun k => + .add (.add ((c k).diff 0) + (.mul (.known (.const (-1))) + (sum (List.ofFn (fun j : Fin 3 => (c k).diffWord [j.succ, j.succ]))))) + (sum (List.ofFn (fun j : Fin 3 => .mul (c j) ((c k).diff j.succ)))) + +theorem residualCode_valid {c : Vector} (hc : Valid c) : Valid (residualCode c) := by + intro k + exact ⟨⟨(c k).valid_diff (hc k) 0, trivial, + sum_ofFn_valid _ (fun _ => (c k).valid_diffWord (hc k) _)⟩, + sum_ofFn_valid _ (fun j => ⟨hc j, (c k).valid_diff (hc k) j.succ⟩)⟩ + +theorem residualCode_value {F : PlanarComponents} (hF : ∀ j, ContDiff ℝ ∞ (F j)) + {c : Vector} (hc : Valid c) : value F (residualCode c) = residual 1 (value F c) := by + funext y k + rw [residual_eq_force_add] + change value F (residualCode c) y k = force 1 (value F c) y k + convectiveField (value F c) y k + rw [force_eq_mixed (value_smooth hF hc), + convectiveField_eq_mixed (value_smooth hF hc)] + simp_rw [← value_diffWord hF hc] + simp only [residualCode, value, DetectorExpr.val, ClockedExpr.val, sum_ofFn_value, + diffWord, DetectorExpr.diffWord, Finset.sum_apply, Pi.sub_apply, + Pi.smul_apply, smul_eq_mul, Rat.cast_neg, Rat.cast_one, one_mul] + ring + +def driftTerm (C L n : ℕ) : Vector := + ![.mul (.known (.profile (phaseExpression C L n).diff)) (.input (phaseExpression C L n) [] 0), + .mul (.known (.profile (phaseExpression C L n).diff)) (.input (phaseExpression C L n) [] 1), + .known (.const 0)] + +theorem driftTerm_valid (C L n : ℕ) : Valid (driftTerm C L n) := by + intro j + fin_cases j <;> trivial + +theorem driftTerm_value (V : ℝ → Plane → Plane) (C L n : ℕ) (y : SpaceTime) : + value (components V) (driftTerm C L n) y = + triangularLift (fun x => detectorDriftTerm V C L n (y.1, x)) (fun _ => 0) y.2 := by + rw [triangularLift_eq] + ext j + fin_cases j <;> + simp [value, driftTerm, DetectorExpr.val, ClockedExpr.val, componentJet, + ClockedExpr.scalarMixed, components, clockedPoint, phaseExpression_diff_val, + phaseExpression_val, detectorDriftTerm, atHeight] + +def driftPrefix (C L N : ℕ) : Vector := fun j => + sum (List.ofFn (fun n : Fin N => driftTerm C L n j)) + +theorem driftPrefix_valid (C L N : ℕ) : Valid (driftPrefix C L N) := + fun j => sum_ofFn_valid _ (fun n => driftTerm_valid C L n j) + +theorem driftPrefix_value (V : ℝ → Plane → Plane) (C L N : ℕ) : + value (components V) (driftPrefix C L N) = + triangularVelocity (prefixDrift V C L N) (fun _ _ => 0) := by + funext y + have he : value (components V) (driftPrefix C L N) y = + ∑ n : Fin N, value (components V) (driftTerm C L n) y := by + ext j + simpa only [value, driftPrefix, Finset.sum_apply] using + sum_ofFn_value (components V) (fun n : Fin N => driftTerm C L n j) y + rw [he] + simp_rw [driftTerm_value] + simp only [triangularVelocity, triangularLift, prefixDrift, map_sum, zero_smul, add_zero] + +def sourcePrefix (C L N : ℕ) : Vector := fun j => + .known (verticalSourceExpression C L N j) + +theorem sourcePrefix_valid (C L N : ℕ) : Valid (sourcePrefix C L N) := + verticalSourceExpression_valid C L N + +theorem sourcePrefix_value (F : PlanarComponents) (C L N : ℕ) : + value F (sourcePrefix C L N) = triangularVelocity (fun _ _ => 0) (prefixSource C L N) := + verticalSourceExpression_value C L N + +def forcePrefix (C L N : ℕ) : Vector := fun j => + .add (residualCode (driftPrefix C L N) j) (sourcePrefix C L N j) + +theorem forcePrefix_valid (C L N : ℕ) : Valid (forcePrefix C L N) := + fun j => ⟨residualCode_valid (driftPrefix_valid C L N) j, sourcePrefix_valid C L N j⟩ + +theorem forcePrefix_value {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L N : ℕ) : + value (components V) (forcePrefix C L N) = + residual 1 (triangularVelocity (prefixDrift V C L N) (fun _ _ => 0)) + + triangularVelocity (fun _ _ => 0) (prefixSource C L N) := by + have he : value (components V) (forcePrefix C L N) = + value (components V) (residualCode (driftPrefix C L N)) + + value (components V) (sourcePrefix C L N) := rfl + rw [he, residualCode_value (components_smooth hV) (driftPrefix_valid C L N), + driftPrefix_value, sourcePrefix_value] + +theorem forcePrefix_germ {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L N : ℕ) (y : SpaceTime) + (hN : y.1 + 1 ≤ (N : ℝ)) : + detectorForce V C L =ᶠ[𝓝 y] value (components V) (forcePrefix C L N) := by + have ha := detectorDrift_prefix_germ V C L N (y.1, horizontalLinear y.2) hN + have hh := detectorSource_prefix_germ C L N (y.1, horizontalLinear y.2) hN + have hz : Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : ℝ)) =ᶠ[ + 𝓝 (y.1, horizontalLinear y.2)] Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : ℝ)) := + Filter.EventuallyEq.rfl + have hav : Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : Plane)) =ᶠ[ + 𝓝 (y.1, horizontalLinear y.2)] Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : Plane)) := + Filter.EventuallyEq.rfl + rw [forcePrefix_value hV, detectorForce, triangularForce_eq_residual (detectorDrift_smooth hV C L)] + exact (residual_eventuallyEq (triangularVelocity_congr_germ ha hz) 1).add + (triangularVelocity_congr_germ hav hh) + +def evaluateUnitForce {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : RationalVector := fun j => + let N := forcePrefixLength (a 0).1 + DetectorExpr.evaluate o (components_smooth hV) ((forcePrefix C L N j).diffWord α) + ((forcePrefix C L N j).valid_diffWord (forcePrefix_valid C L N j) α) a ε hε + +theorem evaluateUnitForce_spec {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → RationalSpaceTime) {y : SpaceTime} + (ha : IsFastName a y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (detectorForce V C L) α y - + rationalVector (evaluateUnitForce hV o C L α a ε hε)‖ ≤ (ε : ℝ) := by + have ht : |y.1 - ((a 0).1 : ℝ)| ≤ 1 := by + have h := (norm_fst_le (y - rationalPoint (a 0))).trans (ha 0) + simpa only [Prod.fst_sub, rationalPoint, errorTolerance, pow_zero, inv_one, + Real.norm_eq_abs] using h + have hg := forcePrefix_germ hV C L (forcePrefixLength (a 0).1) y (forcePrefixLength_bound _ ht) + rw [(mixedDerivative_eventuallyEq hg α).self_of_nhds, + ← value_diffWord (components_smooth hV) (forcePrefix_valid C L _)] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr hε.le)).mpr + intro j + exact DetectorExpr.evaluate_spec o (components_smooth hV) + ((forcePrefix C L _ j).valid_diffWord (forcePrefix_valid C L _ j) α) a ha ε hε + +def unitForceBound {V : ℝ → Plane → Plane} (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (T : ℚ) : ℚ := + ∑ j : Fin 3, ((forcePrefix C L (forcePrefixLength T) j).diffWord α).bound o (|T| + 2) + +theorem unitForceBound_nonneg {V : ℝ → Plane → Plane} (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (T : ℚ) : 0 ≤ unitForceBound o C L α T := + Finset.sum_nonneg (fun _ _ => DetectorExpr.bound_nonneg o _ _) + +theorem unitForceBound_spec {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (T : ℚ) {y : SpaceTime} + (ht : 0 ≤ y.1) (hT : y.1 ≤ (T : ℝ)) : + ‖mixedDerivative (detectorForce V C L) α y‖ ≤ (unitForceBound o C L α T : ℝ) := by + have hN : y.1 + 1 ≤ (forcePrefixLength T : ℝ) := by + have hc : (T : ℝ) + 2 ≤ (forcePrefixLength T : ℝ) := by + exact_mod_cast Nat.le_ceil (T + 2) + linarith + have hg := forcePrefix_germ hV C L (forcePrefixLength T) y hN + rw [(mixedDerivative_eventuallyEq hg α).self_of_nhds, + ← value_diffWord (components_smooth hV) (forcePrefix_valid C L _)] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr (unitForceBound_nonneg o C L α T))).mpr + intro j + have ht' : |y.1| ≤ |((|T| + 2 : ℚ) : ℝ)| := by + rw [abs_of_nonneg ht, Rat.cast_add, Rat.cast_abs, Rat.cast_ofNat, + abs_of_nonneg (by positivity)] + exact hT.trans ((le_abs_self _).trans (by linarith)) + have hj := DetectorExpr.val_bound o + ((forcePrefix C L (forcePrefixLength T) j).valid_diffWord + (forcePrefix_valid C L (forcePrefixLength T) j) α) (|T| + 2) y ht' + apply hj.trans + exact_mod_cast Finset.single_le_sum + (fun k _ => DetectorExpr.bound_nonneg o (|T| + 2) + ((forcePrefix C L (forcePrefixLength T) k).diffWord α)) + (Finset.mem_univ j) + +end ForcedComputation.VelocityDetector.CompactProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorScalarTranslation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorScalarTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6981b09e79892e8ef3faf7f6ff4f0896e1adb56b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorScalarTranslation.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorCenter + +namespace OAI + +/-! Spatial translation of the scalar equation and its torus mass. The +center is an arbitrary real point; no rationality restriction is imposed. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff BigOperators + +theorem spatialD_translated (δ : Plane) (f : Plane → ℝ) (j : Fin 2) (x : Plane) : + spatialD j (fun y => f (y + δ)) x = spatialD j f (x + δ) := by + unfold spatialD + rw [fderiv_comp_add_right] + +theorem scalarLaplacian_translated (δ : Plane) (f : Plane → ℝ) (x : Plane) : + scalarLaplacian (fun y => f (y + δ)) x = scalarLaplacian f (x + δ) := by + unfold scalarLaplacian + apply Finset.sum_congr rfl + intro j _ + have he : spatialD j (fun y => f (y + δ)) = fun y => spatialD j f (y + δ) := + funext (spatialD_translated δ f j) + rw [he, spatialD_translated] + +theorem scalarGenerator_translated (δ : Plane) (ν : ℝ) (a : Plane → Plane) + (f : Plane → ℝ) (x : Plane) : + scalarGenerator ν (fun y => a (y + δ)) (fun y => f (y + δ)) x = + scalarGenerator ν a f (x + δ) := by + simp only [scalarGenerator, scalarLaplacian_translated, fderiv_comp_add_right] + +theorem scalar_solution_translated {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (δ : Plane) : + TorusScalarSolution T ν (translateField δ a) (translateField δ h) + (translateField δ w) (fun x => w₀ (x + δ)) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · have hg : ContDiff ℝ ∞ (fun y : ℝ × Plane => (y.1, y.2 + δ)) := + contDiff_fst.prodMk (contDiff_snd.add contDiff_const) + exact hw.smooth.comp hg.contDiffOn (fun y hy => ⟨hy.1, mem_univ _⟩) + · intro t ht + exact translated_periodic δ (fun _ => hw.periodic t ht) t + · funext x + exact congrFun hw.initial (x + δ) + · intro t ht x + change HasDerivWithinAt (fun s => w s (x + δ)) + (scalarGenerator ν (fun y => a t (y + δ)) (fun y => w t (y + δ)) x + h t (x + δ)) + (Icc 0 T) t + rw [scalarGenerator_translated] + exact hw.equation t ht (x + δ) + +theorem global_scalar_solution_translated {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w w₀) (δ : Plane) : + GlobalTorusScalarSolution ν (translateField δ a) (translateField δ h) + (translateField δ w) (fun x => w₀ (x + δ)) := + fun T hT => scalar_solution_translated (hw T hT) δ + +/-- Translation preserves the integral over the torus. The proof uses +the zero integral of each periodic derivative along the translation path. -/ +theorem integral_translated {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hp : PlanePeriodic f) (δ : Plane) : + (∫ x in Icc (0 : Plane) (fun _ => 1), f (x + δ)) = + ∫ x in Icc (0 : Plane) (fun _ => 1), f x := by + let W : ℝ → Plane → ℝ := fun s x => f (x + s • δ) + let D : ℝ → Plane → ℝ := fun s x => fderiv ℝ f (x + s • δ) δ + have hW : ContDiff ℝ ∞ (Function.uncurry W) := + hf.comp (contDiff_snd.add (contDiff_fst.smul contDiff_const)) + have hD : Continuous (Function.uncurry D) := + ((hf.fderiv_right (m := ∞) (by simp)).comp + (contDiff_snd.add (contDiff_fst.smul contDiff_const))).continuous.clm_apply + continuous_const + have hderiv (s : ℝ) (x : Plane) : HasDerivAt (fun r => W r x) (D s x) s := by + have hi := ((hasDerivAt_id s).smul_const δ).const_add x + have hd := ((hf.differentiable (by simp) (x + s • δ)).hasFDerivAt).comp_hasDerivAt s hi + simpa only [Function.comp_def, id_eq, one_smul] using hd + have hzero (s : ℝ) : scalarMass D s = 0 := by + let g : Plane → ℝ := fun x => f (x + s • δ) + have hg : ContDiff ℝ ∞ g := hf.comp (contDiff_id.add contDiff_const) + have hpg : PlanePeriodic g := translated_periodic (s • δ) (fun _ => hp) 0 + have he (x : Plane) : D s x = ∑ j : Fin 2, δ j * spatialD j g x := by + rw [← scalar_directional_basis] + exact congrArg (fun A : Plane →L[ℝ] ℝ => A δ) (fderiv_comp_add_right (s • δ)).symm + unfold scalarMass + simp_rw [he] + rw [integral_finsetSum] + · apply Finset.sum_eq_zero + intro j _ + rw [integral_const_mul] + change δ j * (∫ x in Icc (0 : Plane) (fun _ => 1), + fderiv ℝ g x (PlanarHamiltonian.basis j)) = 0 + rw [integral_planar_periodic_derivative hg hpg j, mul_zero] + · intro j _ + exact ((spatialD_smooth j hg).continuous.const_mul _).integrableOn_Icc + have hm (s : ℝ) : HasDerivAt (scalarMass W) 0 s := by + simpa only [hzero] using scalarMass_hasDerivAt hW.continuous hD hderiv s + have he := is_const_of_deriv_eq_zero (fun s => (hm s).differentiableAt) + (fun s => (hm s).deriv) (1 : ℝ) 0 + simpa only [scalarMass, W, one_smul, zero_smul, add_zero] using he + +theorem scalarMass_translated {w : ℝ → Plane → ℝ} + (hw : ContDiff ℝ ∞ (Function.uncurry w)) (hp : ∀ t, PlanePeriodic (w t)) + (δ : Plane) (t : ℝ) : scalarMass (translateField δ w) t = scalarMass w t := + integral_translated (hw.comp (contDiff_const.prodMk contDiff_id)) (hp t) δ + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..67ac63f1da0778456e786134adbdeab4d756ab15 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorSupport.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorGeneral +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorSupport + +namespace OAI + +/-! The arbitrary-center force is supported in the spatial support of +the input processor together with one fixed small torus neighborhood. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows Set +open scoped ContDiff Topology + +theorem torusNorm_lipschitz : LipschitzWith 2 torusNorm := by + apply LipschitzWith.of_dist_le_mul + intro x y + have hxy : torusNorm x ≤ torusNorm (x - y) + torusNorm y := by + simpa only [sub_add_cancel] using torusNorm_add_le (x - y) y + have hyx : torusNorm y ≤ torusNorm (x - y) + torusNorm x := by + have he : y - x = -(x - y) := by abel + calc + _ = torusNorm ((y - x) + x) := by rw [sub_add_cancel] + _ ≤ torusNorm (y - x) + torusNorm x := torusNorm_add_le _ _ + _ = _ := by rw [he, torusNorm_neg] + have ht : |torusNorm x - torusNorm y| ≤ torusNorm (x - y) := + abs_le.mpr ⟨by linarith, by linarith⟩ + simpa only [Real.dist_eq, dist_eq_norm, Real.norm_eq_abs, NNReal.coe_ofNat] using + ht.trans ((torusNorm_le_norm (x - y)).trans (planeCoordinates_symm_norm_le (x - y))) + +def processorSupport (V : ℝ → Plane → Plane) : Set Plane := + closure {x | ∃ s, V s x ≠ 0} + +def injectionNeighborhood (p : Plane) : Set Plane := + {x | torusNorm (x - p) ≤ 1 / 16} + +theorem injectionNeighborhood_closed (p : Plane) : IsClosed (injectionNeighborhood p) := + isClosed_le (torusNorm_lipschitz.continuous.comp (continuous_id.sub continuous_const)) + continuous_const + +theorem injectionNeighborhood_contains (p : Plane) : p ∈ injectionNeighborhood p := by + change torusNorm (p - p) ≤ 1 / 16 + have hz : torusNorm (0 : Plane) = 0 := by + apply le_antisymm + · simpa only [map_zero, norm_zero] using torusNorm_le_norm (0 : Plane) + · exact torusNorm_nonneg _ + rw [sub_self, hz] + norm_num + +theorem processor_zero_outside {V : ℝ → Plane → Plane} {x : Plane} + (hx : x ∉ processorSupport V) (s : ℝ) : V s x = 0 := by + by_contra hn + exact hx (subset_closure (show x ∈ {y | ∃ s, V s y ≠ 0} from ⟨s, hn⟩)) + +theorem centered_bump_zero_outside (p : Plane) (L n : ℕ) {x : Plane} + (hx : x ∉ injectionNeighborhood p) : + detectorBump (width L n : ℝ) (x + -centerShift p) = 0 := by + by_contra hn + obtain ⟨k, hk⟩ := detectorBump_near_lift (by exact_mod_cast width_pos L n) + (detector_width_small L n) hn + have ht : torusNorm (x - p) ≤ 2 * (width L n : ℝ) := by + have he : x - p = x + -centerShift p - ![1 / 4, 1 / 4] := by + unfold centerShift + abel + rw [he] + apply (torusNorm_le_lattice _ k).trans + have hr : x + -centerShift p - ![1 / 4, 1 / 4] - (fun j => (k j : ℝ)) = + x + -centerShift p - (fun j => (k j : ℝ)) - ![1 / 4, 1 / 4] := by abel + rw [hr] + exact hk + apply hx + change torusNorm (x - p) ≤ 1 / 16 + exact ht.trans (by + have hq : width L n ≤ (1 / 1000000 : ℚ) := + (width_le L n).trans (mul_le_of_le_one_right (by norm_num) + (pow_le_one₀ (by norm_num) (by norm_num))) + have h : (width L n : ℝ) ≤ 1 / 1000000 := by + have hh := (Rat.cast_le (K := ℝ)).mpr hq + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hh + exact hh + linarith) + +theorem centeredSource_zero_outside (p : Plane) (C L : ℕ) {x : Plane} + (hx : x ∉ injectionNeighborhood p) (t : ℝ) : centeredSource p C L t x = 0 := by + change (∑' n, detectorSourceTerm C L n (t, x + -centerShift p)) = 0 + trans ∑' _ : ℕ, (0 : ℝ) + · apply tsum_congr + intro n + simp only [detectorSourceTerm, centered_bump_zero_outside p L n hx, mul_zero] + · exact tsum_zero + +theorem centeredForce_supported {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (p : Plane) (C L : ℕ) + (ν t : ℝ) {x : Plane} + (hx : x ∉ processorSupport V ∪ injectionNeighborhood p) (z : ℝ) : + centeredForce V p C L ν (t, atHeight x z) = 0 := by + let U : Set Plane := (processorSupport V ∪ injectionNeighborhood p)ᶜ + have hU : IsOpen U := (isClosed_closure.union (injectionNeighborhood_closed p)).isOpen_compl + have ha := viscosityDrift_smooth (detectorDrift_smooth hV C L) ν + have hz (s : ℝ) (y : Plane) (hy : y ∈ U) : + viscosityDrift ν (detectorDrift V C L) s y = 0 ∧ + viscositySource ν (centeredSource p C L) s y = 0 := by + constructor + · have hproc : ∀ τ, V τ y = 0 := + processor_zero_outside (fun h => hy (Or.inl h)) + have hd : detectorDrift V C L (ν * s) y = 0 := by + change (∑' n, detectorDriftTerm V C L n (ν * s, y)) = 0 + trans ∑' _ : ℕ, (0 : Plane) + · apply tsum_congr + intro n + simp only [detectorDriftTerm, hproc, smul_zero] + · exact tsum_zero + simp only [viscosityDrift, hd, smul_zero] + · simp only [viscositySource, + centeredSource_zero_outside p C L (fun h => hy (Or.inr h)), mul_zero] + rw [centeredForce, centeredDrift_eq] + apply triangularForce_zero_of_neighborhood ha hU hz ν t + simpa only [horizontalLinear_eq, atHeight_horizontal, U, mem_compl_iff] using hx + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorViscosity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorViscosity.lean new file mode 100644 index 0000000000000000000000000000000000000000..73c72289f67994011a83f5419e2ddd812c83632a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CompactDetectorViscosity.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosityProgram + +namespace OAI + +/-! The general input-oracle detector at a named positive viscosity. +The spatial force has two viscosity factors, while its scalar source has +one; each additional time derivative contributes one further factor. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CompactProgram +open ShearFlows +open scoped ContDiff + +def unitForceName {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) : ℕ → RationalVector := + fun n => evaluateUnitForce hV o C L α b (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) + +theorem unitForceName_spec {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hb : IsFastName b y) : + IsFastVectorName (unitForceName hV o C L α b) (mixedDerivative (detectorForce V C L) α y) := by + intro n + simpa only [unitForceName, ClockedExpr.dyadic_cast] using + evaluateUnitForce_spec hV o C L α b hb (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) + +def viscosityBalls {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (n : ℕ) (j : Fin 3) : QBall := + ((realNameBall a n).pow (α.count 0 + if j = 2 then 1 else 2)).mul + (vectorNameBall (unitForceName hV o C L α (scaleTimeName a b ha hb)) n j) + +theorem viscosityBalls_contains {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (n : ℕ) (j : Fin 3) : + (viscosityBalls hV o C L α a b ha hb n j).Contains + (mixedDerivative (detectorViscosityForce V C L ν) α y j) := by + rw [mixedDerivative_detectorViscosityForce V hV] + exact QBall.contains_mul (QBall.contains_pow (realNameBall_contains ha n) _) + (vectorNameBall_contains (unitForceName_spec hV o C L α + (scaleTimeName_spec a b ha hb)) n j) + +theorem viscosityBalls_converges {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (j : Fin 3) : + QBall.Converges (fun n => viscosityBalls hV o C L α a b ha hb n j) + (mixedDerivative (detectorViscosityForce V C L ν) α y j) := by + rw [mixedDerivative_detectorViscosityForce V hV] + exact ((realNameBall_converges ha).pow _).mul + (vectorNameBall_converges (unitForceName_spec hV o C L α + (scaleTimeName_spec a b ha hb)) j) + +def evaluateViscosityForce {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : RationalVector := + evaluateVectorBalls (viscosityBalls hV o C L α a b ha hb) ε + (vectorBallReady_exists (viscosityBalls_converges hV o C L α a b ha hb) hε) + +theorem evaluateViscosityForce_spec {V : ℝ → Plane → Plane} {ν : ℝ} {y : SpaceTime} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (detectorViscosityForce V C L ν) α y - + rationalVector (evaluateViscosityForce hV o C L α a b ha hb ε hε)‖ ≤ (ε : ℝ) := + evaluateVectorBalls_spec _ (viscosityBalls_converges hV o C L α a b ha hb) + (viscosityBalls_contains hV o C L α a b ha hb) ε hε + +def viscosityForceBound {V : ℝ → Plane → Plane} (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (T : ℚ) : ℚ := + viscosityBound a ^ (α.count 0 + 2) * unitForceBound o C L α (viscosityBound a * |T|) + +theorem viscosityForceBound_spec {V : ℝ → Plane → Plane} {ν : ℝ} (hν : 0 < ν) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (o : PlanarJetOracle (components V)) + (C L : ℕ) (α : List (Fin 4)) {a : ℕ → ℚ} (ha : IsFastRealName a ν) + (T : ℚ) {y : SpaceTime} (ht : 0 ≤ y.1) (htT : y.1 ≤ (T : ℝ)) : + ‖mixedDerivative (detectorViscosityForce V C L ν) α y‖ ≤ + (viscosityForceBound o C L α a T : ℝ) := by + have hB : (1 : ℝ) ≤ (viscosityBound a : ℝ) := by exact_mod_cast viscosityBound_ge_one a + have hn : ν ≤ (viscosityBound a : ℝ) := (le_abs_self ν).trans (viscosityBound_spec ha) + have ht' : ν * y.1 ≤ (viscosityBound a * |T| : ℚ) := by + push_cast + exact mul_le_mul hn (htT.trans (le_abs_self _)) ht (by linarith) + have hf := unitForceBound_spec hV o C L α (viscosityBound a * |T|) + (y := (ν * y.1, y.2)) (mul_nonneg hν.le ht) ht' + have hfn : (0 : ℝ) ≤ unitForceBound o C L α (viscosityBound a * |T|) := by + exact_mod_cast unitForceBound_nonneg o C L α (viscosityBound a * |T|) + apply (pi_norm_le_iff_of_nonneg (by + dsimp only [viscosityForceBound] + push_cast + exact mul_nonneg (pow_nonneg (by linarith) _) hfn)).mpr + intro j + rw [mixedDerivative_detectorViscosityForce V hV, Real.norm_eq_abs, abs_mul, + abs_of_nonneg (pow_nonneg hν.le _)] + have hk : α.count 0 + (if j = 2 then 1 else 2) ≤ α.count 0 + 2 := by + split_ifs <;> omega + have hp : ν ^ (α.count 0 + if j = 2 then 1 else 2) ≤ + (viscosityBound a : ℝ) ^ (α.count 0 + 2) := + (pow_le_pow_left₀ hν.le hn _).trans (pow_le_pow_right₀ hB hk) + have hh := (norm_le_pi_norm + (mixedDerivative (detectorForce V C L) α (ν * y.1, y.2)) j).trans hf + simpa only [viscosityForceBound, Rat.cast_mul, Rat.cast_pow, Real.norm_eq_abs] using + mul_le_mul hp hh (abs_nonneg _) (pow_nonneg (by linarith) _) + +end ForcedComputation.VelocityDetector.CompactProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCompactCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCompactCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1e2a7eedae8e5e9f0203dc098600d7f38c98470 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCompactCalculus.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderLocalEnergyInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTestIntegral + +namespace OAI + +/-! Compact horizontal localization of integrals over one vertical period. +These lemmas are the measure-theoretic part of the localized energy identity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory Filter +open scoped Topology + +local instance : IsLocallyFiniteMeasure cylinderMeasure := by + unfold cylinderMeasure verticalPeriodMeasure + infer_instance + +theorem ae_vertical_period : ∀ᵐ y ∂cylinderMeasure, y.2 ∈ Icc (0 : ℝ) 1 := by + apply (Measure.ae_prod_iff_ae_ae + (measurableSet_Icc.preimage measurable_snd)).2 + exact Eventually.of_forall (fun _ => ae_restrict_mem measurableSet_Icc) + +theorem integrable_horizontal_compact {f : Plane × ℝ → ℝ} + (hf : Continuous f) {K : Set Plane} (hK : IsCompact K) + (hs : ∀ y, y.1 ∉ K → f y = 0) : Integrable f cylinderMeasure := by + have hi : IntegrableOn f (K ×ˢ Icc (0 : ℝ) 1) cylinderMeasure := + hf.continuousOn.integrableOn_compact (hK.prod isCompact_Icc) + apply hi.integrable_of_ae_notMem_eq_zero + filter_upwards [ae_vertical_period] with y hy + intro hn + exact hs y (fun hx => hn ⟨hx, hy⟩) + +private theorem slice_continuous {g : ℝ × (Plane × ℝ) → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) (ht : t ∈ Icc a b) : + Continuous (fun y => g (t, y)) := + hg.comp_continuous (continuous_const.prodMk continuous_id) + (fun _ => ⟨ht, mem_univ _⟩) + +theorem compact_integral_hasDerivAt {g d : ℝ × (Plane × ℝ) → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) + (hd : ContinuousOn d (Icc a b ×ˢ univ)) + (he : ∀ s ∈ Ioo a b, ∀ y, HasDerivAt (fun r => g (r, y)) (d (s, y)) s) + {K : Set Plane} (hK : IsCompact K) (ht : t ∈ Ioo a b) : + HasDerivAt (fun r => ∫ y in K ×ˢ Icc (0 : ℝ) 1, g (r, y) ∂cylinderMeasure) + (∫ y in K ×ˢ Icc (0 : ℝ) 1, d (t, y) ∂cylinderMeasure) t := by + let S := K ×ˢ Icc (0 : ℝ) 1 + have hS : IsCompact S := hK.prod isCompact_Icc + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hS).bddAbove_image + (hd.norm.mono (fun _ hp => ⟨hp.1, mem_univ _⟩)) + have hb : ∀ᵐ y ∂(cylinderMeasure.restrict S), + ∀ s ∈ Ioo a b, ‖d (s, y)‖ ≤ B := by + filter_upwards [ae_restrict_mem hS.measurableSet] with y hy + intro s hs + exact hB (mem_image_of_mem _ ⟨Ioo_subset_Icc_self hs, hy⟩) + have hm : ∀ᶠ s in 𝓝 t, + AEStronglyMeasurable (fun y => g (s, y)) (cylinderMeasure.restrict S) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs + exact (slice_continuous hg (Ioo_subset_Icc_self hs)).aestronglyMeasurable + have hi : IntegrableOn (fun y => g (t, y)) S cylinderMeasure := + (slice_continuous hg (Ioo_subset_Icc_self ht)).continuousOn.integrableOn_compact hS + have hdm : AEStronglyMeasurable (fun y => d (t, y)) (cylinderMeasure.restrict S) := + (slice_continuous hd (Ioo_subset_Icc_self ht)).aestronglyMeasurable + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le (Ioo_mem_nhds ht.1 ht.2) + hm hi hdm hb (integrableOn_const hS.measure_ne_top) + (Eventually.of_forall (fun y s hs => he s hs y))).2 + +theorem integral_restrict_eq_of_horizontal_support {f : Plane × ℝ → ℝ} {K : Set Plane} + (hs : ∀ y, y.1 ∉ K → f y = 0) : + (∫ y in K ×ˢ Icc (0 : ℝ) 1, f y ∂cylinderMeasure) = ∫ y, f y ∂cylinderMeasure := by + apply setIntegral_eq_integral_of_ae_compl_eq_zero + filter_upwards [ae_vertical_period] with y hy + intro hn + exact hs y (fun hx => hn ⟨hx, hy⟩) + +theorem supported_integral_hasDerivAt {g d : ℝ × (Plane × ℝ) → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) + (hd : ContinuousOn d (Icc a b ×ˢ univ)) + (he : ∀ s ∈ Ioo a b, ∀ y, HasDerivAt (fun r => g (r, y)) (d (s, y)) s) + {K : Set Plane} (hK : IsCompact K) + (hs : ∀ r y, y.1 ∉ K → g (r, y) = 0) + (hds : ∀ y, y.1 ∉ K → d (t, y) = 0) (ht : t ∈ Ioo a b) : + HasDerivAt (fun r => ∫ y, g (r, y) ∂cylinderMeasure) + (∫ y, d (t, y) ∂cylinderMeasure) t := by + have h := compact_integral_hasDerivAt hg hd he hK ht + have hi : (fun r => ∫ y in K ×ˢ Icc (0 : ℝ) 1, g (r, y) ∂cylinderMeasure) = + (fun r => ∫ y, g (r, y) ∂cylinderMeasure) := + funext (fun r => integral_restrict_eq_of_horizontal_support (hs r)) + rw [hi, integral_restrict_eq_of_horizontal_support hds] at h + exact h + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6cdc014716eaba4b99108c562af6f9f26f1752c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffBounds.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderCutoffLimit + +namespace OAI + +/-! A common constant for the first and second derivatives of the +horizontal energy cutoffs. Their boundary terms decay as the radius grows. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector PlanarHamiltonian Set Filter +open scoped ContDiff Topology + +private def baseEnergyCutoff (x : Plane) : ℝ := massCutoff x ^ 2 + +private theorem baseEnergyCutoff_smooth : ContDiff ℝ ∞ baseEnergyCutoff := + massCutoff_smooth.pow 2 + +private theorem baseEnergyCutoff_support : HasCompactSupport baseEnergyCutoff := by + have he : baseEnergyCutoff = massCutoff * massCutoff := by + funext x + simp only [baseEnergyCutoff, pow_two, Pi.mul_apply] + rw [he] + exact massCutoff_compactSupport.mul_right + +theorem cylinderWeight_smooth (n : ℕ) : ContDiff ℝ ∞ (cylinderWeight n) := + (concentrationCutoff_smooth ((n : ℝ) + 1) 0).pow 2 + +theorem cylinderWeight_derivative_bounds : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (n : ℕ) (x : Plane), + ‖fderiv ℝ (cylinderWeight n) x‖ ≤ C * ((n : ℝ) + 1)⁻¹ ∧ + |scalarLaplacian (cylinderWeight n) x| ≤ C * ((n : ℝ) + 1)⁻¹ ^ 2 := by + have hdc := (baseEnergyCutoff_smooth.fderiv_right (m := ∞) (by simp)).continuous + obtain ⟨A, hA⟩ := hdc.bounded_above_of_compact_support (baseEnergyCutoff_support.fderiv ℝ) + have hlc := (ExpandingDetector.scalarLaplacian_smooth baseEnergyCutoff_smooth).continuous + obtain ⟨B, hB⟩ := hlc.bounded_above_of_compact_support + (scalarLaplacian_compactSupport baseEnergyCutoff_support) + let C := max 0 (max A B) + have hAC : A ≤ C := (le_max_left A B).trans (le_max_right _ _) + have hBC : B ≤ C := (le_max_right A B).trans (le_max_right _ _) + refine ⟨C, le_max_left _ _, ?_⟩ + intro n x + have hμ : 0 ≤ ((n : ℝ) + 1)⁻¹ := by positivity + have he : cylinderWeight n = fun y => + baseEnergyCutoff (scalarAffineScale ((n : ℝ) + 1)⁻¹ 0 y) := rfl + constructor + · rw [he] + have hd := (baseEnergyCutoff_smooth.differentiable (by simp) _).hasFDerivAt.comp x + (scalarAffineScale_hasFDerivAt ((n : ℝ) + 1)⁻¹ 0 x) + change HasFDerivAt (fun y => baseEnergyCutoff (scalarAffineScale ((n : ℝ)+1)⁻¹ 0 y)) _ x + at hd + rw [hd.fderiv] + apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg (le_max_left _ _) hμ) + intro v + rw [ContinuousLinearMap.comp_apply, smul_apply, + ContinuousLinearMap.id_apply, map_smul, norm_smul, Real.norm_eq_abs, + abs_of_nonneg hμ] + calc + ((n : ℝ) + 1)⁻¹ * ‖fderiv ℝ baseEnergyCutoff + (scalarAffineScale ((n : ℝ) + 1)⁻¹ 0 x) v‖ + ≤ ((n : ℝ) + 1)⁻¹ * (C * ‖v‖) := by + apply mul_le_mul_of_nonneg_left _ hμ + exact ((fderiv ℝ baseEnergyCutoff _).le_opNorm v).trans + (mul_le_mul_of_nonneg_right ((hA _).trans hAC) (norm_nonneg v)) + _ = _ := by ring + · rw [he, scalarLaplacian_affine_scale baseEnergyCutoff_smooth, + abs_mul, abs_of_nonneg (sq_nonneg _)] + calc + ((n : ℝ) + 1)⁻¹ ^ 2 * |scalarLaplacian baseEnergyCutoff + (scalarAffineScale ((n : ℝ) + 1)⁻¹ 0 x)| + ≤ ((n : ℝ) + 1)⁻¹ ^ 2 * C := by + apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) + simpa only [Real.norm_eq_abs] using (hB _).trans hBC + _ = _ := mul_comm _ _ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffLimit.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d8adb10bd167dc9f7baa72758e97c80e7841f00 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderCutoffLimit.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderLocalEnergyInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCutoffLimit + +namespace OAI + +/-! Squared compact cutoffs recover every integrable quantity on the +mixed domain by dominated convergence. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector MeasureTheory Set Filter +open scoped Topology + +theorem cylinderWeight_range (n : ℕ) (x : Plane) : cylinderWeight n x ∈ Icc (0 : ℝ) 1 := by + have h := concentrationCutoff_range ((n : ℝ)+1) (0 : Plane) x + unfold cylinderWeight + constructor + · positivity + · nlinarith [h.1, h.2, sq_nonneg (1-concentrationCutoff ((n : ℝ)+1) 0 x)] + +theorem cylinderWeight_continuous (n : ℕ) : Continuous (cylinderWeight n) := + ((concentrationCutoff_smooth ((n : ℝ)+1) (0 : Plane)).pow 2).continuous + +theorem cylinderWeight_tendsto_one (x : Plane) : + Tendsto (fun n : ℕ => cylinderWeight n x) atTop (𝓝 1) := by + simpa only [cylinderWeight, one_pow] using (concentrationCutoff_tendsto_one 0 x).pow 2 + +theorem cylinderWeight_integrable_mul {f : Plane × ℝ → ℝ} + (hf : Integrable f cylinderMeasure) (n : ℕ) : + Integrable (fun y => cylinderWeight n y.1 * f y) cylinderMeasure := by + apply hf.bdd_mul ((cylinderWeight_continuous n).comp continuous_fst).aestronglyMeasurable + filter_upwards [] with y + change |cylinderWeight n y.1| ≤ 1 + rw [abs_of_nonneg (cylinderWeight_range n y.1).1] + exact (cylinderWeight_range n y.1).2 + +theorem cylinderWeight_integral_limit {f : Plane × ℝ → ℝ} + (hf : Integrable f cylinderMeasure) : + Tendsto (fun n : ℕ => ∫ y, cylinderWeight n y.1 * f y ∂cylinderMeasure) + atTop (𝓝 (∫ y, f y ∂cylinderMeasure)) := by + apply tendsto_integral_of_dominated_convergence (fun y => |f y|) + · intro n + exact ((cylinderWeight_continuous n).comp continuous_fst).aestronglyMeasurable.mul + hf.aestronglyMeasurable + · simpa only [Real.norm_eq_abs] using hf.norm + · intro n + filter_upwards [] with y + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (cylinderWeight_range n y.1).1] + exact (mul_le_mul_of_nonneg_right (cylinderWeight_range n y.1).2 (abs_nonneg _)).trans_eq + (one_mul _) + · filter_upwards [] with y + simpa only [one_mul] using (cylinderWeight_tendsto_one y.1).mul_const (f y) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderDivergence.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderDivergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfb0a1dcf842bab347588f66077af3bbcc5eb2b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderDivergence.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderLocalIntegration + +namespace OAI + +/-! The divergence theorem for a horizontally compact vector field over +one vertical period. No spatial decay hypothesis is imposed in the periodic direction. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem integral_scalarSpatialD_zero {g : Space → ℝ} (hg : ContDiff ℝ 1 g) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → g x = 0) + (hp : VerticallyPeriodic g) (j : Fin 3) : + (∫ y, scalarSpatialD j g (atHeight y.1 y.2) ∂cylinderMeasure) = 0 := by + fin_cases j + · exact integral_horizontal_scalarD_zero hg hK hs 0 + · exact integral_horizontal_scalarD_zero hg hK hs 1 + · exact integral_vertical_scalarD_zero hg hK hs hp + +theorem integral_divergence_zero {U : Space → Space} (hU : ContDiff ℝ 1 U) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → U x = 0) + (hp : VerticallyPeriodic U) : + (∫ y, divergence U (atHeight y.1 y.2) ∂cylinderMeasure) = 0 := by + have hc (j : Fin 3) : ContDiff ℝ 1 (fun x => U x j) := + (contDiff_apply ℝ ℝ j).comp hU + have hz (j : Fin 3) (x : Space) (hx : horizontal x ∉ K) : U x j = 0 := by + rw [hs x hx] + rfl + have hi (j : Fin 3) : Integrable + (fun y => scalarSpatialD j (fun x => U x j) (atHeight y.1 y.2)) cylinderMeasure := + scalarSpatialD_cylinder_integrable (hc j) hK (hz j) j + have he (x : Space) : divergence U x = ∑ j, scalarSpatialD j (fun x => U x j) x := by + apply Finset.sum_congr rfl + intro j _ + exact (fderiv_coordinate (hU.differentiable (by norm_num)) x (basis j) j).symm + simp_rw [he] + rw [integral_finsetSum Finset.univ (fun j _ => hi j)] + apply Finset.sum_eq_zero + intro j _ + exact integral_scalarSpatialD_zero (hc j) hK (hz j) + (fun x n => congrFun (hp x n) j) j + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..837809c5a6221c157c6180f4c6db1e6736df822a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyDerivative.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderCompactCalculus +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderCutoffBounds +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ClassicalUniqueness + +namespace OAI + +/-! Differentiation of the actual localized difference energy. This uses +only classical regularity, before invoking the equations of motion. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector Set MeasureTheory +open scoped Topology + +theorem cylinderWeight_compactSupport (n : ℕ) : HasCompactSupport (cylinderWeight n) := by + have h := concentrationCutoff_compactSupport (by positivity : 0 < (n : ℝ) + 1) + (0 : Plane) + have hm : HasCompactSupport + (concentrationCutoff ((n : ℝ) + 1) 0 * concentrationCutoff ((n : ℝ) + 1) 0) := + h.mul_right + have he : cylinderWeight n = + concentrationCutoff ((n : ℝ) + 1) 0 * concentrationCutoff ((n : ℝ) + 1) 0 := by + funext x + exact pow_two _ + rw [he] + exact hm + +theorem localizedDifferenceEnergy_hasDerivAt {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + (n : ℕ) {t : ℝ} (ht : 0 < t) : + HasDerivAt (localizedDifferenceEnergy u v n) + (2 * ∫ y, cylinderWeight n y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (initialTimeDerivative u t (atHeight y.1 y.2) - + initialTimeDerivative v t (atHeight y.1 y.2)) ∂cylinderMeasure) t := by + let W : ℝ × (Plane × ℝ) → Space := + fun y => cylinderDifference u v y.1 (atHeight y.2.1 y.2.2) + let G : ℝ × (Plane × ℝ) → Space := fun y => + initialTimeDerivative u y.1 (atHeight y.2.1 y.2.2) - + initialTimeDerivative v y.1 (atHeight y.2.1 y.2.2) + let φ : Plane → ℝ := cylinderWeight n + have hmap : Continuous (fun y : ℝ × (Plane × ℝ) => + (y.1, atHeight y.2.1 y.2.2)) := by + apply Continuous.prodMk continuous_fst + apply continuous_pi + intro j + fin_cases j <;> dsimp [atHeight] <;> fun_prop + have hW : ContinuousOn W (Icc 0 (t + 1) ×ˢ univ) := by + apply ((hu.regularity.continuous_u (t + 1) (by linarith)).sub + (hv.regularity.continuous_u (t + 1) (by linarith))).comp hmap.continuousOn + intro y hy + exact ⟨hy.1, mem_univ _⟩ + have hG : ContinuousOn G (Icc 0 (t + 1) ×ˢ univ) := by + apply ((hu.regularity.continuous_ut (t + 1) (by linarith)).sub + (hv.regularity.continuous_ut (t + 1) (by linarith))).comp hmap.continuousOn + intro y hy + exact ⟨hy.1, mem_univ _⟩ + have hφ : Continuous (fun y : ℝ × (Plane × ℝ) => φ y.2.1) := + (cylinderWeight_smooth n).continuous.comp (continuous_fst.comp continuous_snd) + have hd (s : ℝ) (hs : s ∈ Ioo 0 (t + 1)) (y : Plane × ℝ) : + HasDerivAt (fun r => φ y.1 * dot (W (r, y)) (W (r, y))) + (φ y.1 * (2 * dot (W (s, y)) (G (s, y)))) s := by + apply HasDerivAt.const_mul + apply hasDerivAt_dot_self + change HasDerivAt (fun r => u (r, atHeight y.1 y.2) - v (r, atHeight y.1 y.2)) + (initialTimeDerivative u s (atHeight y.1 y.2) - + initialTimeDerivative v s (atHeight y.1 y.2)) s + exact ((hu.regularity.temporal_u s hs.1.le (atHeight y.1 y.2)).hasDerivWithinAt.hasDerivAt + (Ici_mem_nhds hs.1)).sub + ((hv.regularity.temporal_u s hs.1.le (atHeight y.1 y.2)).hasDerivWithinAt.hasDerivAt + (Ici_mem_nhds hs.1)) + have hzero (x : Plane) (hx : x ∉ tsupport φ) : φ x = 0 := + image_eq_zero_of_notMem_tsupport hx + have h := CylinderLocalCalculus.supported_integral_hasDerivAt + (g := fun y => φ y.2.1 * dot (W y) (W y)) + (d := fun y => φ y.2.1 * (2 * dot (W y) (G y))) + (hφ.continuousOn.mul (dot_continuousOn hW hW)) + (hφ.continuousOn.mul (continuousOn_const.mul (dot_continuousOn hW hG))) hd + (cylinderWeight_compactSupport n) + (fun r y hy => by simp only [hzero y.1 hy, zero_mul]) + (fun y hy => by simp only [hzero y.1 hy, zero_mul]) + (show t ∈ Ioo 0 (t + 1) from ⟨ht, by linarith⟩) + have he : (fun y : Plane × ℝ => φ y.1 * (2 * dot (W (t, y)) (G (t, y)))) = + (fun y => 2 * (φ y.1 * dot (W (t, y)) (G (t, y)))) := by + funext y + ring + change HasDerivAt (localizedDifferenceEnergy u v n) + (∫ y, φ y.1 * (2 * dot (W (t, y)) (G (t, y))) ∂cylinderMeasure) t at h + rw [he, integral_const_mul] at h + exact h + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f3f11c663c2e21033adaa685c42e4205d129e27 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEquation.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyDerivative +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderViscosity + +namespace OAI + +/-! Subtraction of the two classical Navier–Stokes equations, in the +ordering used by the localized difference-energy identity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem gradient_sub {p q : Space → ℝ} (hp : Differentiable ℝ p) + (hq : Differentiable ℝ q) (x : Space) : + ShearFlows.gradient (fun y => p y - q y) x = + ShearFlows.gradient p x - ShearFlows.gradient q x := by + ext j + simp only [ShearFlows.gradient, fderiv_fun_sub (hp x) (hq x), + sub_apply, Pi.sub_apply] + +theorem advection_difference {U V : Space → Space} + (hU : Differentiable ℝ U) (hV : Differentiable ℝ V) (x : Space) : + advection U x - advection V x = + fderiv ℝ U x (U x - V x) + fderiv ℝ (fun y => U y - V y) x (V x) := by + simp only [advection, fderiv_fun_sub (hU x) (hV x), + sub_apply, map_sub] + abel + +theorem cylinder_difference_equation {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (x : Space) : + initialTimeDerivative u t x - initialTimeDerivative v t x = + -ShearFlows.gradient (fun y => p (t,y) - q (t,y)) x + + ν • laplacian (cylinderDifference u v t) x - + fderiv ℝ (fun y => u (t,y)) x (cylinderDifference u v t x) - + fderiv ℝ (cylinderDifference u v t) x (v (t,x)) := by + have hU := hu.regularity.spatial_u t ht + have hV := hv.regularity.spatial_u t ht + have hP := (hu.regularity.spatial_p t ht).differentiable (by norm_num) + have hQ := (hv.regularity.spatial_p t ht).differentiable (by norm_num) + have hd := congrArg₂ (· - ·) (hu.equation t ht x) (hv.equation t ht x) + have ha := advection_difference (hU.differentiable (by norm_num)) + (hV.differentiable (by norm_num)) x + unfold cylinderDifference + rw [gradient_sub hP hQ, laplacian_sub hU hV, smul_sub] + linear_combination hd - ha + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEstimates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEstimates.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2f7ff05d2e7fd821e7a2856165689c40fff322a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyEstimates.lean @@ -0,0 +1,186 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergySpace +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderCutoffBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EnergyCalculus + +namespace OAI + +/-! Energy and boundary estimates in the full cylinder comparison class. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +theorem localizedDifferenceEnergy_nonneg (u v : Velocity) (n : ℕ) (t : ℝ) : + 0 ≤ localizedDifferenceEnergy u v n t := + integral_nonneg (fun y => mul_nonneg (cylinderWeight_range n y.1).1 (dot_self_nonneg _)) + +theorem localizedDifferenceEnergy_initial {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + (n : ℕ) : localizedDifferenceEnergy u v n 0 = 0 := by + simp [localizedDifferenceEnergy, cylinderDifference, hu.initial, hv.initial, dot] + +theorem localizedDifferenceEnergy_le {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (n : ℕ) : + localizedDifferenceEnergy u v n t ≤ differenceEnergy u v t := by + unfold localizedDifferenceEnergy differenceEnergy cylinderDifference + apply integral_mono_of_nonneg + (Eventually.of_forall (fun y : Plane × ℝ => + mul_nonneg (cylinderWeight_range n y.1).1 + (dot_self_nonneg (u (t, atHeight y.1 y.2) - v (t, atHeight y.1 y.2))))) + (hu.difference_energy_integrable hv ht) + filter_upwards [] with y + exact (mul_le_mul_of_nonneg_right (cylinderWeight_range n y.1).2 + (dot_self_nonneg _)).trans_eq (one_mul _) + +theorem localizedDifferenceEnergy_limit {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) : + Tendsto (fun n => localizedDifferenceEnergy u v n t) atTop + (𝓝 (differenceEnergy u v t)) := + cylinderWeight_integral_limit (hu.difference_energy_integrable hv ht) + +theorem localizedDifferenceEnergy_continuous (hI : CylinderLocalEnergyIdentity) + {ν : ℝ} (hν : 0 < ν) {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {T : ℝ} (hT : 0 ≤ T) (n : ℕ) : + ContinuousOn (localizedDifferenceEnergy u v n) (Icc 0 T) := by + intro t ht + by_cases h0 : t = 0 + · subst t + change Tendsto _ _ _ + rw [localizedDifferenceEnergy_initial hu hv] + have hlim := (hu.difference_energy_continuous hv hT) 0 ⟨le_rfl, hT⟩ + have hE0 : differenceEnergy u v 0 = 0 := by + simp [differenceEnergy, hu.initial, hv.initial, dot] + rw [ContinuousWithinAt, hE0] at hlim + apply squeeze_zero' (Eventually.of_forall (localizedDifferenceEnergy_nonneg u v n)) + _ hlim + filter_upwards [self_mem_nhdsWithin] with s hs + exact localizedDifferenceEnergy_le hu hv hs.1 n + · have hd := hI ν hν f u v p q hu hv n t (lt_of_le_of_ne ht.1 (Ne.symm h0)) + exact hd.continuousAt.continuousWithinAt + +theorem localizedDifferenceDissipation_nonneg (u v : Velocity) (n : ℕ) (t : ℝ) : + 0 ≤ localizedDifferenceDissipation u v n t := by + apply integral_nonneg + intro y + exact mul_nonneg (cylinderWeight_range n y.1).1 + (Finset.sum_nonneg (fun _ _ => dot_self_nonneg _)) + +theorem localizedDifferenceInteraction_bound {ν B : ℝ} + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (n : ℕ) + (hB : ∀ x, ‖fderiv ℝ (fun y => u (t,y)) x‖ ≤ B) : + |localizedDifferenceInteraction u v n t| ≤ + (3 * B) * localizedDifferenceEnergy u v n t := by + have hi := + (cylinderWeight_integrable_mul (hu.difference_energy_integrable hv ht) n).const_mul (3 * B) + have hb := norm_integral_le_of_norm_le + (f := fun y => cylinderWeight n y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (fderiv ℝ (fun x => u (t,x)) (atHeight y.1 y.2) + (cylinderDifference u v t (atHeight y.1 y.2)))) + hi (Eventually.of_forall (fun y => by + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (cylinderWeight_range n y.1).1] + calc + cylinderWeight n y.1 * |dot (cylinderDifference u v t (atHeight y.1 y.2)) + (fderiv ℝ (fun x => u (t,x)) (atHeight y.1 y.2) + (cylinderDifference u v t (atHeight y.1 y.2)))| + ≤ cylinderWeight n y.1 * ((3 * B) * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2))) := by + apply mul_le_mul_of_nonneg_left _ (cylinderWeight_range n y.1).1 + exact (dot_linear_bound _ _).trans + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (hB _) (by norm_num)) + (dot_self_nonneg _)) + _ = _ := by simp only [cylinderDifference]; ring)) + simpa only [Real.norm_eq_abs, integral_const_mul, localizedDifferenceEnergy, + localizedDifferenceInteraction, cylinderDifference] using hb + +theorem localizedDiffusionError_bound {ν L : ℝ} + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (n : ℕ) + (hL : ∀ x, |scalarLaplacian (cylinderWeight n) x| ≤ L) : + |localizedDiffusionError u v n t| ≤ L * differenceEnergy u v t := by + have hb := norm_integral_le_of_norm_le + (f := fun y => scalarLaplacian (cylinderWeight n) y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2))) + ((hu.difference_energy_integrable hv ht).const_mul L) + (Eventually.of_forall (fun y => by + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (dot_self_nonneg _)] + exact mul_le_mul_of_nonneg_right (hL y.1) (dot_self_nonneg _))) + simpa only [Real.norm_eq_abs, integral_const_mul, localizedDiffusionError, + differenceEnergy, cylinderDifference] using hb + +theorem localizedTransportError_bound {ν G B : ℝ} (hG : 0 ≤ G) + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (n : ℕ) + (hg : ∀ x, ‖fderiv ℝ (cylinderWeight n) x‖ ≤ G) + (hB : ∀ x, ‖v (t,x)‖ ≤ B) : + |localizedTransportError u v n t| ≤ (G * B) * differenceEnergy u v t := by + have hd (x : Space) : |fderiv ℝ (cylinderWeight n) (horizontal x) + (horizontalLinear (v (t,x)))| ≤ G * B := by + calc + _ ≤ ‖fderiv ℝ (cylinderWeight n) (horizontal x)‖ * + ‖horizontalLinear (v (t,x))‖ := ContinuousLinearMap.le_opNorm _ _ + _ ≤ G * B := mul_le_mul (hg _) ((horizontal_norm_le _).trans (hB x)) + (norm_nonneg _) hG + have hb := norm_integral_le_of_norm_le + (f := fun y => fderiv ℝ (cylinderWeight n) y.1 + (horizontalLinear (v (t,atHeight y.1 y.2))) * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2))) + ((hu.difference_energy_integrable hv ht).const_mul (G * B)) + (Eventually.of_forall (fun y => by + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (dot_self_nonneg _)] + apply mul_le_mul_of_nonneg_right _ (dot_self_nonneg _) + simpa only [atHeight_horizontal] using hd (atHeight y.1 y.2))) + simpa only [Real.norm_eq_abs, integral_const_mul, localizedTransportError, + differenceEnergy, cylinderDifference] using hb + +theorem localizedPressureError_bound {ν G : ℝ} (hG : 0 ≤ G) + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (n : ℕ) + (hg : ∀ x, ‖fderiv ℝ (cylinderWeight n) x‖ ≤ G) : + |localizedPressureError u v p q n t| ≤ + G * (pressureDifferenceEnergy p q t + differenceEnergy u v t) := by + have hi := ((hu.pressure_difference_integrable hv ht).add + (hu.difference_energy_integrable hv ht)).const_mul G + have hb := norm_integral_le_of_norm_le + (f := fun y => (p (t,atHeight y.1 y.2) - q (t,atHeight y.1 y.2)) * + fderiv ℝ (cylinderWeight n) y.1 + (horizontalLinear (cylinderDifference u v t (atHeight y.1 y.2)))) + hi (Eventually.of_forall (fun y => by + let W := cylinderDifference u v t (atHeight y.1 y.2) + let P := p (t, atHeight y.1 y.2) - q (t, atHeight y.1 y.2) + have hd : |fderiv ℝ (cylinderWeight n) y.1 (horizontalLinear W)| ≤ G * ‖W‖ := by + simpa only [Real.norm_eq_abs, horizontalLinear_eq] using + ((fderiv ℝ (cylinderWeight n) y.1).le_opNorm (horizontal W)).trans + (mul_le_mul (hg _) (horizontal_norm_le W) (norm_nonneg _) hG) + have hy : |P| * ‖W‖ ≤ P ^ 2 + dot W W := by + nlinarith [sq_nonneg (|P| - ‖W‖), sq_abs P, norm_sq_le_dot_self W, + sq_nonneg P, sq_nonneg ‖W‖] + rw [Real.norm_eq_abs, abs_mul] + calc + |P| * |fderiv ℝ (cylinderWeight n) y.1 (horizontalLinear W)| + ≤ |P| * (G * ‖W‖) := mul_le_mul_of_nonneg_left hd (abs_nonneg P) + _ = G * (|P| * ‖W‖) := by ring + _ ≤ G * (P ^ 2 + dot W W) := mul_le_mul_of_nonneg_left hy hG)) + simpa only [Real.norm_eq_abs, integral_const_mul, Pi.add_apply, + integral_add (hu.pressure_difference_integrable hv ht) + (hu.difference_energy_integrable hv ht), pressureDifferenceEnergy, + localizedPressureError, differenceEnergy, cylinderDifference] using hb + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyIdentity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..996baaaf8a9b32927c637f1ace54028190264023 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyIdentity.lean @@ -0,0 +1,131 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyEquation + +namespace OAI + +/-! Discharge of the published localized energy identity in the strong +classical cylinder class used by the whole-plane detector. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory CylinderLocalCalculus +open scoped ContDiff BigOperators + +theorem cylinder_energy_rate {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + (n : ℕ) {t : ℝ} (ht : 0 ≤ t) : + (2 * ∫ y, cylinderWeight n y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (initialTimeDerivative u t (atHeight y.1 y.2) - + initialTimeDerivative v t (atHeight y.1 y.2)) ∂cylinderMeasure) = + -2 * ν * localizedDifferenceDissipation u v n t + - 2 * localizedDifferenceInteraction u v n t + + ν * localizedDiffusionError u v n t + + localizedTransportError u v n t + + 2 * localizedPressureError u v p q n t := by + let W : Space → Space := cylinderDifference u v t + let U : Space → Space := fun x => u (t,x) + let V : Space → Space := fun x => v (t,x) + let P : Space → ℝ := fun x => p (t,x) - q (t,x) + let G : Space → Space := fun x => initialTimeDerivative u t x - initialTimeDerivative v t x + let φ := cylinderWeight n + have hU : ContDiff ℝ 2 U := hu.regularity.spatial_u t ht + have hV : ContDiff ℝ 2 V := hv.regularity.spatial_u t ht + have hW : ContDiff ℝ 2 W := hU.sub hV + have hP : ContDiff ℝ 1 P := (hu.regularity.spatial_p t ht).sub (hv.regularity.spatial_p t ht) + have hWp : VerticallyPeriodic W := by + intro x k + exact congrArg₂ (fun a b : Space => a - b) + (hu.periodic_u t ht x k) (hv.periodic_u t ht x k) + have hPp : VerticallyPeriodic P := by + intro x k + exact congrArg₂ (fun a b : ℝ => a - b) + (hu.periodic_p t ht x k) (hv.periodic_p t ht x k) + have hWdiv (x : Space) : divergence W x = 0 := by + change divergence (fun y => U y - V y) x = 0 + rw [divergence_sub (hU.differentiable (by norm_num)) (hV.differentiable (by norm_num)), + hu.divergence_zero t ht, hv.divergence_zero t ht, sub_self] + have hφ := cylinderWeight_smooth n + have hc := cylinderWeight_compactSupport n + have hp := pressure_pairing (hφ.of_le (by simp)) hc (hW.of_le (by norm_num)) hP + hWp hPp hWdiv + have hν := viscosity_pairing hφ hc hW hWp + have ha := transport_pairing (hφ.of_le (by simp)) hc (hW.of_le (by norm_num)) + (hV.of_le (by norm_num)) hWp (hv.periodic_u t ht) (hv.divergence_zero t ht) + have hiP := weighted_integrable hφ.continuous hc + (dot_continuous hW.continuous (gradient_continuous hP)) + have hiL := weighted_integrable hφ.continuous hc + (dot_continuous hW.continuous (laplacian_continuous hW)) + have hiI := weighted_integrable hφ.continuous hc + (dot_continuous hW.continuous + ((hU.continuous_fderiv (by norm_num)).clm_apply hW.continuous)) + have hiA := weighted_integrable hφ.continuous hc + (dot_continuous hW.continuous + ((hW.continuous_fderiv (by norm_num)).clm_apply hV.continuous)) + have he (x : Space) : G x = -ShearFlows.gradient P x + ν • laplacian W x - + fderiv ℝ U x (W x) - fderiv ℝ W x (V x) := + cylinder_difference_equation hu hv ht x + have heInt : (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (G (atHeight y.1 y.2)) + ∂cylinderMeasure) = + -(∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (ShearFlows.gradient P (atHeight y.1 y.2)) + ∂cylinderMeasure) + + ν * (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (laplacian W (atHeight y.1 y.2)) + ∂cylinderMeasure) - + (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ U (atHeight y.1 y.2) (W (atHeight y.1 y.2))) ∂cylinderMeasure) - + (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2))) ∂cylinderMeasure) := by + have heq : (fun y : Plane × ℝ => φ y.1 * dot (W (atHeight y.1 y.2)) + (G (atHeight y.1 y.2))) = (fun y => + -(φ y.1 * dot (W (atHeight y.1 y.2)) (ShearFlows.gradient P (atHeight y.1 y.2))) + + ν * (φ y.1 * dot (W (atHeight y.1 y.2)) (laplacian W (atHeight y.1 y.2))) - + φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ U (atHeight y.1 y.2) (W (atHeight y.1 y.2))) - + φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2)))) := by + funext y + rw [he, dot_sub_right, dot_sub_right, dot_add_right, dot_neg_right, dot_smul_right] + ring + rw [heq] + let A := fun y : Plane × ℝ => φ y.1 * + dot (W (atHeight y.1 y.2)) (ShearFlows.gradient P (atHeight y.1 y.2)) + let B := fun y : Plane × ℝ => φ y.1 * + dot (W (atHeight y.1 y.2)) (laplacian W (atHeight y.1 y.2)) + let C := fun y : Plane × ℝ => φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ U (atHeight y.1 y.2) (W (atHeight y.1 y.2))) + let D := fun y : Plane × ℝ => φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2))) + change (∫ y, -A y + ν * B y - C y - D y ∂cylinderMeasure) = + -(∫ y, A y ∂cylinderMeasure) + ν * (∫ y, B y ∂cylinderMeasure) - + (∫ y, C y ∂cylinderMeasure) - (∫ y, D y ∂cylinderMeasure) + rw [integral_sub (f := fun y => -A y + ν * B y - C y) (g := D) + ((hiP.neg.add (hiL.const_mul ν)).sub hiI) hiA, + integral_sub (f := fun y => -A y + ν * B y) (g := C) + (hiP.neg.add (hiL.const_mul ν)) hiI, + integral_add (f := fun y => -A y) (g := fun y => ν * B y) + hiP.neg (hiL.const_mul ν), integral_neg, integral_const_mul] + change 2 * (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (G (atHeight y.1 y.2)) + ∂cylinderMeasure) = _ + rw [heInt] + change _ = -2 * ν * (∫ y, φ y.1 * ∑ j, dot (derivative W j (atHeight y.1 y.2)) + (derivative W j (atHeight y.1 y.2)) ∂cylinderMeasure) - + 2 * (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ U (atHeight y.1 y.2) (W (atHeight y.1 y.2))) ∂cylinderMeasure) + + ν * (∫ y, scalarLaplacian φ y.1 * dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) + ∂cylinderMeasure) + + (∫ y, fderiv ℝ φ y.1 (horizontalLinear (V (atHeight y.1 y.2))) * + dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) ∂cylinderMeasure) + + 2 * (∫ y, P (atHeight y.1 y.2) * + fderiv ℝ φ y.1 (horizontalLinear (W (atHeight y.1 y.2))) ∂cylinderMeasure) + linear_combination ν * hν - 2 * hp - ha + +theorem cylinder_local_energy_identity : CylinderLocalEnergyIdentity := by + intro ν _hν f u v p q hu hv n t ht + have h := localizedDifferenceEnergy_hasDerivAt hu hv n ht + rw [cylinder_energy_rate hu hv n ht.le] at h + exact h + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergySpace.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergySpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..41ac772950d4f1cddd65375a6227c0ca2e2954bb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergySpace.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderSolution +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EnergyCalculus +import Mathlib.MeasureTheory.Function.L2Space + +namespace OAI + +/-! Scalar L2 representatives give integrable energy densities and finite +energy bounds on every closed time interval. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set + +theorem CylinderContinuousL2.sub {F G : ℝ → Plane × ℝ → ℝ} {S : Set ℝ} + (hF : CylinderContinuousL2 F S) (hG : CylinderContinuousL2 G S) : + CylinderContinuousL2 (fun t y => F t y - G t y) S := by + obtain ⟨U, hU, hUF⟩ := hF + obtain ⟨V, hV, hVG⟩ := hG + refine ⟨fun t => U t - V t, hU.sub hV, ?_⟩ + intro t ht + filter_upwards [Lp.coeFn_sub (U t) (V t), hUF t ht, hVG t ht] with y hsub hu hv + simp only [hsub, hu, hv, Pi.sub_apply] + +theorem cylinderL2_norm_sq (u : CylinderL2) {f : Plane × ℝ → ℝ} + (hf : (fun x => u x) =ᵐ[cylinderMeasure] f) : + ‖u‖ ^ 2 = ∫ x, f x ^ 2 ∂cylinderMeasure := by + rw [← real_inner_self_eq_norm_sq, L2.inner_def] + apply integral_congr_ae + filter_upwards [hf] with x hx + change u x * u x = f x ^ 2 + rw [hx, pow_two] + +theorem CylinderContinuousL2.memLp {F : ℝ → Plane × ℝ → ℝ} {S : Set ℝ} + (hF : CylinderContinuousL2 F S) {t : ℝ} (ht : t ∈ S) : + MemLp (F t) 2 cylinderMeasure := by + obtain ⟨U, _, hUF⟩ := hF + exact (memLp_congr_ae (hUF t ht)).mp (Lp.memLp (U t)) + +theorem CylinderContinuousL2.square_integrable {F : ℝ → Plane × ℝ → ℝ} {S : Set ℝ} + (hF : CylinderContinuousL2 F S) {t : ℝ} (ht : t ∈ S) : + Integrable (fun y => F t y ^ 2) cylinderMeasure := by + have hm := hF.memLp ht + exact (memLp_two_iff_integrable_sq hm.aestronglyMeasurable).mp hm + +theorem CylinderContinuousL2.square_integral_continuous {F : ℝ → Plane × ℝ → ℝ} + {S : Set ℝ} (hF : CylinderContinuousL2 F S) : + ContinuousOn (fun t => ∫ y, F t y ^ 2 ∂cylinderMeasure) S := by + obtain ⟨U, hU, hUF⟩ := hF + exact (hU.norm.pow 2).congr (fun t ht => (cylinderL2_norm_sq (U t) (hUF t ht)).symm) + +theorem CylinderContinuousL2.uniform_square_integral {F : ℝ → Plane × ℝ → ℝ} + {S : Set ℝ} (hF : CylinderContinuousL2 F S) (hS : IsCompact S) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ S, (∫ y, F t y ^ 2 ∂cylinderMeasure) ≤ B := by + obtain ⟨B, hB⟩ := hS.bddAbove_image hF.square_integral_continuous + exact ⟨max 0 B, le_max_left _ _, fun t ht => + (hB (mem_image_of_mem _ ht)).trans (le_max_right _ _)⟩ + +def differenceEnergy (u v : Velocity) (t : ℝ) : ℝ := + ∫ y, dot (u (t, atHeight y.1 y.2) - v (t, atHeight y.1 y.2)) + (u (t, atHeight y.1 y.2) - v (t, atHeight y.1 y.2)) ∂cylinderMeasure + +def pressureDifferenceEnergy (p q : Pressure) (t : ℝ) : ℝ := + ∫ y, (p (t, atHeight y.1 y.2) - q (t, atHeight y.1 y.2)) ^ 2 ∂cylinderMeasure + +theorem IsCylinderClassicalSolution.pressure_difference_integrable + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) : + Integrable (fun y => (p (t, atHeight y.1 y.2) - q (t, atHeight y.1 y.2)) ^ 2) + cylinderMeasure := + ((hu.pressure_h1 t ht).1.sub (hv.pressure_h1 t ht).1).square_integrable ⟨ht, le_rfl⟩ + +theorem IsCylinderClassicalSolution.pressure_difference_uniform + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {T : ℝ} (hT : 0 ≤ T) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc 0 T, pressureDifferenceEnergy p q t ≤ B := + ((hu.pressure_h1 T hT).1.sub (hv.pressure_h1 T hT).1).uniform_square_integral + isCompact_Icc + +theorem IsCylinderClassicalSolution.difference_square_integrable + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) (j : Fin 3) : + Integrable (fun y => + (u (t, atHeight y.1 y.2) j - v (t, atHeight y.1 y.2) j) ^ 2) cylinderMeasure := by + have hum := (hu.velocity_h2 t ht j).1.memLp ⟨ht, le_rfl⟩ + have hvm := (hv.velocity_h2 t ht j).1.memLp ⟨ht, le_rfl⟩ + have hm := hum.sub hvm + exact (memLp_two_iff_integrable_sq hm.aestronglyMeasurable).mp hm + +theorem IsCylinderClassicalSolution.difference_energy_integrable + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 ≤ t) : + Integrable (fun y => dot (u (t, atHeight y.1 y.2) - v (t, atHeight y.1 y.2)) + (u (t, atHeight y.1 y.2) - v (t, atHeight y.1 y.2))) cylinderMeasure := by + simpa only [dot, Pi.sub_apply, pow_two] using + (integrable_finsetSum Finset.univ (fun j _ => + hu.difference_square_integrable hv ht j)) + +theorem IsCylinderClassicalSolution.difference_energy_continuous + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {T : ℝ} (hT : 0 ≤ T) : ContinuousOn (differenceEnergy u v) (Icc 0 T) := by + have hc (j : Fin 3) := + ((hu.velocity_h2 T hT j).1.sub (hv.velocity_h2 T hT j).1).square_integral_continuous + have he (t : ℝ) (ht : t ∈ Icc 0 T) : differenceEnergy u v t = ∑ j : Fin 3, + ∫ y, (u (t, atHeight y.1 y.2) j - v (t, atHeight y.1 y.2) j) ^ 2 + ∂cylinderMeasure := by + simp only [differenceEnergy, dot, Pi.sub_apply, ← pow_two] + exact integral_finsetSum _ (fun j _ => hu.difference_square_integrable hv ht.1 j) + exact (continuousOn_finsetSum _ (fun j _ => hc j)).congr he + +theorem IsCylinderClassicalSolution.difference_energy_uniform + {ν : ℝ} {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {T : ℝ} (hT : 0 ≤ T) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc 0 T, differenceEnergy u v t ≤ B := by + obtain ⟨B, hB⟩ := isCompact_Icc.bddAbove_image (hu.difference_energy_continuous hv hT) + exact ⟨max 0 B, le_max_left _ _, fun t ht => + (hB (mem_image_of_mem _ ht)).trans (le_max_right _ _)⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyUniqueness.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyUniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..989f6b0cd8d45585a1fa70ea663dcf21a06a7fe3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderEnergyUniqueness.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyEstimates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneEnergyLimit + +namespace OAI + +/-! The localized identity implies zero difference energy in the full +strong cylinder class. Every cutoff error is estimated here. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +theorem localized_energy_derivative_upper (hI : CylinderLocalEnergyIdentity) + {ν C BU BV BE BP : ℝ} (hν : 0 < ν) (hC : 0 ≤ C) + (_hBU : 0 ≤ BU) (hBV : 0 ≤ BV) (hBE : 0 ≤ BE) (_hBP : 0 ≤ BP) + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {t : ℝ} (ht : 0 < t) (n : ℕ) + (hcut : ∀ x, ‖fderiv ℝ (cylinderWeight n) x‖ ≤ C * ((n : ℝ)+1)⁻¹ ∧ + |scalarLaplacian (cylinderWeight n) x| ≤ C * ((n : ℝ)+1)⁻¹ ^ 2) + (huB : ∀ x, ‖fderiv ℝ (fun y => u (t,y)) x‖ ≤ BU) + (hvB : ∀ x, ‖v (t,x)‖ ≤ BV) + (hE : differenceEnergy u v t ≤ BE) (hP : pressureDifferenceEnergy p q t ≤ BP) : + ∃ e, HasDerivAt (localizedDifferenceEnergy u v n) e t ∧ + e ≤ (6 * BU) * localizedDifferenceEnergy u v n t + + (ν * C * BE + C * BV * BE + 2 * C * (BP + BE)) * ((n : ℝ)+1)⁻¹ := by + let μ := ((n : ℝ)+1)⁻¹ + have hμ : 0 ≤ μ := by dsimp [μ]; positivity + have hμ1 : μ ≤ 1 := by + change ((n : ℝ) + 1)⁻¹ ≤ 1 + apply (inv_le_one₀ (by positivity : 0 < (n : ℝ) + 1)).mpr + exact le_add_of_nonneg_left (Nat.cast_nonneg n) + have hμ2 : μ ^ 2 ≤ μ := by nlinarith + have hInt := localizedDifferenceInteraction_bound hu hv ht.le n huB + have hDiff := localizedDiffusionError_bound hu hv ht.le n (fun x => (hcut x).2) + have hTr := localizedTransportError_bound (mul_nonneg hC hμ) hu hv ht.le n + (fun x => (hcut x).1) hvB + have hPr := localizedPressureError_bound (mul_nonneg hC hμ) hu hv ht.le n + (fun x => (hcut x).1) + have hDiff' : localizedDiffusionError u v n t ≤ C * μ * BE := by + calc + _ ≤ |localizedDiffusionError u v n t| := le_abs_self _ + _ ≤ (C * μ ^ 2) * differenceEnergy u v t := hDiff + _ ≤ (C * μ ^ 2) * BE := mul_le_mul_of_nonneg_left hE (by positivity) + _ ≤ C * μ * BE := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hμ2 hC) hBE + have hTr' : localizedTransportError u v n t ≤ C * μ * BV * BE := by + exact (le_abs_self _).trans (hTr.trans (mul_le_mul_of_nonneg_left hE (by positivity))) + have hPr' : localizedPressureError u v p q n t ≤ C * μ * (BP + BE) := + (le_abs_self _).trans (hPr.trans + (mul_le_mul_of_nonneg_left (add_le_add hP hE) (mul_nonneg hC hμ))) + have hInt' : -localizedDifferenceInteraction u v n t ≤ + (3 * BU) * localizedDifferenceEnergy u v n t := + (neg_le_abs _).trans hInt + refine ⟨_, hI ν hν f u v p q hu hv n t ht, ?_⟩ + have hD := localizedDifferenceDissipation_nonneg u v n t + have hDis := mul_nonneg hν.le hD + have hd := mul_le_mul_of_nonneg_left hDiff' hν.le + nlinarith + +theorem IsCylinderClassicalSolution.difference_energy_zero + (hI : CylinderLocalEnergyIdentity) {ν : ℝ} (hν : 0 < ν) + {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) + {T : ℝ} (hT : 0 ≤ T) : differenceEnergy u v T = 0 := by + obtain ⟨C, hC, hcut⟩ := cylinderWeight_derivative_bounds + obtain ⟨AU, hAU⟩ := hu.bounded T hT + obtain ⟨AV, hAV⟩ := hv.bounded T hT + let BU := max 0 AU + let BV := max 0 AV + have hBU : 0 ≤ BU := le_max_left _ _ + have hBV : 0 ≤ BV := le_max_left _ _ + have huB (t : ℝ) (ht : t ∈ Icc 0 T) (x : Space) : + ‖fderiv ℝ (fun y => u (t,y)) x‖ ≤ BU := by + have hb := hAU t ht x + exact (le_add_of_nonneg_left (norm_nonneg _)).trans (hb.trans (le_max_right _ _)) + have hvB (t : ℝ) (ht : t ∈ Icc 0 T) (x : Space) : ‖v (t,x)‖ ≤ BV := by + have hb := hAV t ht x + exact (le_add_of_nonneg_right (norm_nonneg _)).trans (hb.trans (le_max_right _ _)) + obtain ⟨BE, hBE, hE⟩ := hu.difference_energy_uniform hv hT + obtain ⟨BP, hBP, hP⟩ := hu.pressure_difference_uniform hv hT + let A := ν * C * BE + C * BV * BE + 2 * C * (BP + BE) + have hA : 0 ≤ A := by dsimp [A]; positivity + apply zero_of_localized_energy_limit (C := 6 * BU) + (E := localizedDifferenceEnergy u v) (ε := fun n => A * ((n : ℝ)+1)⁻¹) hT + · intro n + positivity + · simpa only [one_div, mul_zero] using + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_mul A + · exact fun n => localizedDifferenceEnergy_continuous hI hν hu hv hT n + · exact localizedDifferenceEnergy_initial hu hv + · exact fun n t _ => localizedDifferenceEnergy_nonneg u v n t + · intro n t ht + exact localized_energy_derivative_upper hI hν hC hBU hBV hBE hBP hu hv ht.1 n + (hcut n) (huB t ⟨ht.1.le, ht.2.le⟩) (hvB t ⟨ht.1.le, ht.2.le⟩) + (hE t ⟨ht.1.le, ht.2.le⟩) (hP t ⟨ht.1.le, ht.2.le⟩) + · exact localizedDifferenceEnergy_limit hu hv hT + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLiftH2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLiftH2.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8fa559021f6ee2d0e77321b598b526de6bb9763 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLiftH2.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderSolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactH2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCylinderL2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift + +namespace OAI + +/-! Horizontal scalar lifts preserve the strong Sobolev conditions. Their +vertical derivatives vanish, and their horizontal derivatives are the +ordinary derivatives of the planar scalar. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set +open scoped ContDiff + +def scalarPlaneLift (f : Plane → ℝ) : Space → ℝ := f ∘ horizontalLinear + +theorem scalarPlaneLift_pullback (f : Plane → ℝ) : + cylinderPullback (scalarPlaneLift f) = fun y => f y.1 := by + funext y + simp only [cylinderPullback, scalarPlaneLift, Function.comp_apply, + horizontalLinear_eq, atHeight_horizontal] + +theorem scalarPlaneLift_spatialD {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) (j : Fin 2) : + scalarSpatialD j.castSucc (scalarPlaneLift f) = + scalarPlaneLift (PlanarHamiltonian.spatialD j f) := by + funext x + have hd := (hf.differentiable (by simp) (horizontalLinear x)).hasFDerivAt.comp x + horizontalLinear.hasFDerivAt + change fderiv ℝ (f ∘ horizontalLinear) x (basis j.castSucc) = _ + rw [hd.fderiv, ContinuousLinearMap.comp_apply, horizontalLinear_basis] + rfl + +theorem scalarPlaneLift_verticalD {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) : + scalarSpatialD 2 (scalarPlaneLift f) = fun _ => 0 := by + funext x + have hd := (hf.differentiable (by simp) (horizontalLinear x)).hasFDerivAt.comp x + horizontalLinear.hasFDerivAt + change fderiv ℝ (f ∘ horizontalLinear) x (basis 2) = 0 + rw [hd.fderiv, ContinuousLinearMap.comp_apply, horizontalLinear_basis_two, map_zero] + +theorem CylinderContinuousL2.congr_slices {F G : ℝ → Plane × ℝ → ℝ} {S : Set ℝ} + (hF : CylinderContinuousL2 F S) (hFG : ∀ t ∈ S, F t = G t) : + CylinderContinuousL2 G S := by + obtain ⟨U, hU, hUF⟩ := hF + exact ⟨U, hU, fun t ht => by rw [← hFG t ht]; exact hUF t ht⟩ + +theorem CylinderC1L2.congr_slices {F G F' G' : ℝ → Plane × ℝ → ℝ} {S : Set ℝ} + (hF : CylinderC1L2 F G S) (hFF : ∀ t ∈ S, F t = F' t) + (hGG : ∀ t ∈ S, G t = G' t) : CylinderC1L2 F' G' S := by + obtain ⟨U, V, hU, hV, hUV⟩ := hF + refine ⟨U, V, hU, hV, ?_⟩ + intro t ht + rw [← hFF t ht, ← hGG t ht] + exact hUV t ht + +theorem cylinderContinuousL2_zero (S : Set ℝ) : + CylinderContinuousL2 (fun _ _ => 0) S := + ⟨fun _ => 0, continuousOn_const, fun _ _ => Lp.coeFn_zero ℝ 2 cylinderMeasure⟩ + +theorem PlaneContinuousL2.scalarPlaneLift {F : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneContinuousL2 F S) : + CylinderContinuousL2 (fun t => cylinderPullback (scalarPlaneLift (F t))) S := by + simpa only [scalarPlaneLift_pullback] using hF.cylinder + +theorem PlaneCInH2.scalarPlaneLift {F : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneCInH2 F S) (hs : ∀ t ∈ S, ContDiff ℝ ∞ (F t)) : + CylinderCInH2 (fun t => scalarPlaneLift (F t)) S := by + refine ⟨hF.1.scalarPlaneLift, ?_, ?_⟩ + · intro j + refine Fin.lastCases ?_ (fun k => ?_) j + · apply (cylinderContinuousL2_zero S).congr_slices + intro t ht + change (fun _ : Plane × ℝ => (0 : ℝ)) = + cylinderPullback (scalarSpatialD 2 (VelocityDetector.scalarPlaneLift (F t))) + rw [scalarPlaneLift_verticalD (hs t ht)] + rfl + · apply (hF.2.1 k).scalarPlaneLift.congr_slices + intro t ht + rw [scalarPlaneLift_spatialD (hs t ht)] + · intro j k + refine Fin.lastCases ?_ (fun k' => ?_) k + · apply (cylinderContinuousL2_zero S).congr_slices + intro t ht + change (fun _ : Plane × ℝ => (0 : ℝ)) = + cylinderPullback (scalarSpatialD j (scalarSpatialD 2 (VelocityDetector.scalarPlaneLift (F t)))) + rw [scalarPlaneLift_verticalD (hs t ht)] + funext y + change (0 : ℝ) = fderiv ℝ (fun _ : Space => (0 : ℝ)) + (atHeight y.1 y.2) (basis j) + rw [fderiv_const_apply] + rfl + · refine Fin.lastCases ?_ (fun j' => ?_) j + · apply (cylinderContinuousL2_zero S).congr_slices + intro t ht + change (fun _ : Plane × ℝ => (0 : ℝ)) = + cylinderPullback (scalarSpatialD 2 + (scalarSpatialD k'.castSucc (VelocityDetector.scalarPlaneLift (F t)))) + rw [scalarPlaneLift_spatialD (hs t ht), + scalarPlaneLift_verticalD (PlanarHamiltonian.spatialD_smooth k' (hs t ht))] + rfl + · apply (hF.2.2 j' k').scalarPlaneLift.congr_slices + intro t ht + rw [scalarPlaneLift_spatialD (hs t ht), + scalarPlaneLift_spatialD (PlanarHamiltonian.spatialD_smooth k' (hs t ht))] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalEnergyInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalEnergyInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..4787bebce6640a24df7e1de1e534ee143e319f16 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalEnergyInput.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderSolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff + +namespace OAI + +/-! Published local energy identity, restricted to the exact cylinder and +the expanding compact cutoffs used here. + +F. Gancedo and A. Hidalgo-Torné, On the Cauchy problem for 3D Navier–Stokes +helical vortex filament, Advances in Mathematics 471 (2025), 110268, +proof of Theorem 5.6, equation (5.4), printed p.23 (arXiv:2311.15413). +Only its integration-by-parts identity is retained. The helical uniqueness +theorem is not used. The identity below assumes the strong classical class +and does not assert uniqueness, a cutoff limit, or any detector property. +-/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector MeasureTheory + +def cylinderWeight (n : ℕ) (x : Plane) : ℝ := + concentrationCutoff ((n : ℝ) + 1) 0 x ^ 2 + +def cylinderDifference (u v : Velocity) (t : ℝ) (x : Space) : Space := u (t,x) - v (t,x) + +def localizedDifferenceEnergy (u v : Velocity) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, cylinderWeight n y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2)) ∂cylinderMeasure + +def localizedDifferenceDissipation (u v : Velocity) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, cylinderWeight n y.1 * ∑ j : Fin 3, + dot (derivative (cylinderDifference u v t) j (atHeight y.1 y.2)) + (derivative (cylinderDifference u v t) j (atHeight y.1 y.2)) ∂cylinderMeasure + +def localizedDifferenceInteraction (u v : Velocity) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, cylinderWeight n y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (fderiv ℝ (fun x => u (t,x)) (atHeight y.1 y.2) + (cylinderDifference u v t (atHeight y.1 y.2))) ∂cylinderMeasure + +def localizedDiffusionError (u v : Velocity) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, scalarLaplacian (cylinderWeight n) y.1 * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2)) ∂cylinderMeasure + +def localizedTransportError (u v : Velocity) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, fderiv ℝ (cylinderWeight n) y.1 + (horizontalLinear (v (t, atHeight y.1 y.2))) * + dot (cylinderDifference u v t (atHeight y.1 y.2)) + (cylinderDifference u v t (atHeight y.1 y.2)) ∂cylinderMeasure + +def localizedPressureError (u v : Velocity) (p q : Pressure) (n : ℕ) (t : ℝ) : ℝ := + ∫ y, (p (t, atHeight y.1 y.2) - q (t, atHeight y.1 y.2)) * + fderiv ℝ (cylinderWeight n) y.1 + (horizontalLinear (cylinderDifference u v t (atHeight y.1 y.2))) ∂cylinderMeasure + +def CylinderLocalEnergyIdentity : Prop := + ∀ (ν : ℝ), 0 < ν → ∀ (f u v : Velocity) (p q : Pressure), + IsCylinderClassicalSolution ν f u p → IsCylinderClassicalSolution ν f v q → + ∀ (n : ℕ) (t : ℝ), 0 < t → + HasDerivAt (localizedDifferenceEnergy u v n) + (-2 * ν * localizedDifferenceDissipation u v n t + - 2 * localizedDifferenceInteraction u v n t + + ν * localizedDiffusionError u v n t + + localizedTransportError u v n t + + 2 * localizedPressureError u v p q n t) t + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalIntegration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..6330034c90e11b7d85da9ffed8bf82b19576dd17 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderLocalIntegration.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderCompactCalculus +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! Integration of first derivatives in the horizontal directions and +over one vertical period. Only C¹ regularity is needed. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory Filter +open scoped ContDiff Topology + +theorem plane_integral_derivative_zero {g : Plane → ℝ} (hg : ContDiff ℝ 1 g) + (hc : HasCompactSupport g) (j : Fin 2) : + (∫ x, fderiv ℝ g x (PlanarHamiltonian.basis j)) = 0 := by + have hD : Integrable (fun x => fderiv ℝ g x (PlanarHamiltonian.basis j)) := + ((hg.continuous_fderiv (by norm_num)).clm_apply continuous_const).integrable_of_hasCompactSupport + (hc.fderiv_apply ℝ (PlanarHamiltonian.basis j)) + have hI : Integrable g := hg.continuous.integrable_of_hasCompactSupport hc + have h := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + (μ := (volume : Measure Plane)) (f := fun _ : Plane => (1 : ℝ)) (g := g) + (v := PlanarHamiltonian.basis j) (by simp) + (by simpa only [one_mul] using hD) (by simpa only [one_mul] using hI) + (fun _ _ => differentiableAt_const 1) + (fun x _ => hg.differentiable (by norm_num) x) + simpa only [one_mul, fderiv_const_apply, zero_apply, zero_mul, integral_zero, + neg_zero] using h + +theorem vertical_integral_derivative_zero {g : ℝ → ℝ} (hg : ContDiff ℝ 1 g) + (hp : g 1 = g 0) : (∫ z, deriv g z ∂verticalPeriodMeasure) = 0 := by + have h := intervalIntegral.integral_eq_sub_of_hasDerivAt + (a := (0 : ℝ)) (b := 1) + (fun z _ => (hg.differentiable (by norm_num) z).hasDerivAt) + ((hg.continuous_deriv (by norm_num)).intervalIntegrable 0 1) + rw [hp, sub_self] at h + simpa only [verticalPeriodMeasure, intervalIntegral.integral_of_le zero_le_one, + integral_Icc_eq_integral_Ioc] using h + +theorem atHeight_smooth : ContDiff ℝ ∞ (fun y : Plane × ℝ => atHeight y.1 y.2) := by + apply contDiff_pi.mpr + intro j + fin_cases j <;> dsimp [atHeight] <;> fun_prop + +theorem scalarSpatialD_horizontal_support {g : Space → ℝ} {K : Set Plane} + (hK : IsClosed K) (hs : ∀ x, horizontal x ∉ K → g x = 0) + (j : Fin 3) (x : Space) (hx : horizontal x ∉ K) : scalarSpatialD j g x = 0 := by + have hn : ∀ᶠ y in 𝓝 x, horizontal y ∉ K := + (hK.isOpen_compl.preimage (show Continuous horizontal from by + apply continuous_pi + intro j + fin_cases j <;> dsimp [horizontal] <;> fun_prop)).mem_nhds hx + have he : g =ᶠ[𝓝 x] (fun _ => 0) := hn.mono (fun y hy => hs y hy) + simp only [scalarSpatialD, he.fderiv_eq, fderiv_const_apply] + rfl + +theorem scalarSpatialD_cylinder_integrable {g : Space → ℝ} (hg : ContDiff ℝ 1 g) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → g x = 0) + (j : Fin 3) : + Integrable (fun y => scalarSpatialD j g (atHeight y.1 y.2)) cylinderMeasure := by + apply integrable_horizontal_compact + (((hg.continuous_fderiv (by norm_num)).clm_apply continuous_const).comp + atHeight_smooth.continuous) hK + intro y hy + apply scalarSpatialD_horizontal_support hK.isClosed hs + simpa only [atHeight_horizontal] using hy + +theorem integral_horizontal_scalarD_zero {g : Space → ℝ} (hg : ContDiff ℝ 1 g) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → g x = 0) + (j : Fin 2) : + (∫ y, scalarSpatialD j.castSucc g (atHeight y.1 y.2) ∂cylinderMeasure) = 0 := by + rw [cylinderMeasure, integral_prod_symm _ (scalarSpatialD_cylinder_integrable hg hK hs _)] + have hz (z : ℝ) : (∫ x : Plane, scalarSpatialD j.castSucc g (atHeight x z)) = 0 := by + have hi : ContDiff ℝ 1 (fun x : Plane => atHeight x z) := by + apply contDiff_pi.mpr + intro i + fin_cases i <;> dsimp [atHeight] <;> fun_prop + have hcs : HasCompactSupport (fun x : Plane => g (atHeight x z)) := by + apply HasCompactSupport.intro hK + intro x hx + apply hs + simpa only [atHeight_horizontal] using hx + have he (x : Plane) : scalarSpatialD j.castSucc g (atHeight x z) = + fderiv ℝ (fun X : Plane => g (atHeight X z)) x (PlanarHamiltonian.basis j) := by + have hd := (hg.differentiable (by norm_num) (atHeight x z)).hasFDerivAt.comp x + (atHeight_hasFDerivAt x z) + change HasFDerivAt (fun X : Plane => g (atHeight X z)) _ x at hd + rw [hd.fderiv] + simp only [ContinuousLinearMap.comp_apply, planeInclusion_basis, scalarSpatialD] + simp_rw [he] + exact plane_integral_derivative_zero (hg.comp hi) hcs j + simp only [hz, integral_zero] + +theorem integral_vertical_scalarD_zero {g : Space → ℝ} (hg : ContDiff ℝ 1 g) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → g x = 0) + (hp : VerticallyPeriodic g) : + (∫ y, scalarSpatialD 2 g (atHeight y.1 y.2) ∂cylinderMeasure) = 0 := by + rw [cylinderMeasure, integral_prod _ (scalarSpatialD_cylinder_integrable hg hK hs _)] + have hz (x : Plane) : + (∫ z, scalarSpatialD 2 g (atHeight x z) ∂verticalPeriodMeasure) = 0 := by + have hi : ContDiff ℝ 1 (fun z : ℝ => atHeight x z) := by + apply contDiff_pi.mpr + intro i + fin_cases i <;> dsimp [atHeight] <;> fun_prop + have he (z : ℝ) : scalarSpatialD 2 g (atHeight x z) = + deriv (fun Z : ℝ => g (atHeight x Z)) z := by + have hmap : HasDerivAt (fun Z : ℝ => atHeight x Z) (basis 2) z := by + apply hasDerivAt_pi.mpr + intro i + fin_cases i + · simpa [atHeight, basis] using hasDerivAt_const z (x 0) + · simpa [atHeight, basis] using hasDerivAt_const z (x 1) + · change HasDerivAt (fun z : ℝ => z) 1 z + exact (hasFDerivAt_id (𝕜 := ℝ) z).hasDerivAt + exact ((hg.differentiable (by norm_num) _).hasFDerivAt.comp_hasDerivAt z hmap).deriv.symm + have heq : atHeight x 1 = atHeight x 0 + (1 : ℝ) • basis 2 := by + ext i + fin_cases i <;> simp [atHeight, basis] + have hperiod : g (atHeight x 1) = g (atHeight x 0) := by + rw [heq] + simpa only [Int.cast_one] using hp (atHeight x 0) 1 + simp_rw [he] + exact vertical_integral_derivative_zero (hg.comp hi) hperiod + simp only [hz, integral_zero] + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderMeasure.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..04b829ac7f7685df07b97c94b07e89c6da8e2312 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderMeasure.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model +import Mathlib.MeasureTheory.Function.L2Space +import Mathlib.MeasureTheory.Measure.Prod + +namespace OAI + +/-! The product of planar volume and one unit of vertical period. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set + +def verticalPeriodMeasure : Measure ℝ := volume.restrict (Icc 0 1) + +instance : IsProbabilityMeasure verticalPeriodMeasure := by + constructor + simp [verticalPeriodMeasure, Real.volume_Icc] + +def cylinderMeasure : Measure (Plane × ℝ) := + (volume : Measure Plane).prod verticalPeriodMeasure + +abbrev CylinderL2 := Lp ℝ 2 cylinderMeasure + +def CylinderContinuousL2 (F : ℝ → Plane × ℝ → ℝ) (S : Set ℝ) : Prop := + ∃ U : ℝ → CylinderL2, ContinuousOn U S ∧ + ∀ t ∈ S, (fun x => U t x) =ᵐ[cylinderMeasure] F t + +def CylinderC1L2 (F G : ℝ → Plane × ℝ → ℝ) (S : Set ℝ) : Prop := + ∃ U V : ℝ → CylinderL2, ContinuousOn U S ∧ ContinuousOn V S ∧ + ∀ t ∈ S, ((fun x => U t x) =ᵐ[cylinderMeasure] F t) ∧ + ((fun x => V t x) =ᵐ[cylinderMeasure] G t) ∧ HasDerivWithinAt U (V t) S t + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPointwiseUniqueness.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPointwiseUniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ee6fd000547bad3a1bbc2d47137a4c130fcea63 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPointwiseUniqueness.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyUniqueness + +namespace OAI + +/-! Zero energy on one vertical period determines a continuous periodic +field everywhere, including the boundary of the chosen period. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set + +theorem cylinderMeasure_eq_restrict : cylinderMeasure = + volume.restrict ((univ : Set Plane) ×ˢ Icc (0 : ℝ) 1) := by + rw [Measure.volume_eq_prod] + simpa only [cylinderMeasure, verticalPeriodMeasure, Measure.restrict_univ] using + (Measure.prod_restrict (μ := (volume : Measure Plane)) (ν := (volume : Measure ℝ)) + univ (Icc (0 : ℝ) 1)) + +theorem cylinder_slab_closure_interior : + closure (interior ((univ : Set Plane) ×ˢ Icc (0 : ℝ) 1)) = + (univ : Set Plane) ×ˢ Icc (0 : ℝ) 1 := by + rw [interior_prod_eq, interior_univ, interior_Icc, closure_prod_eq, + closure_univ, closure_Ioo (by norm_num : (0 : ℝ) ≠ 1)] + +theorem continuous_atHeight : Continuous (fun y : Plane × ℝ => atHeight y.1 y.2) := by + apply continuous_pi + intro j + fin_cases j <;> dsimp [atHeight] <;> fun_prop + +theorem cylinder_periodic_field_zero_of_energy_zero {W : Space → Space} + (hW : Continuous W) (hp : VerticallyPeriodic W) + (hi : Integrable (fun y => dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2))) + cylinderMeasure) + (hE : (∫ y, dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) + ∂cylinderMeasure) = 0) : ∀ x, W x = 0 := by + have hae := (integral_eq_zero_iff_of_nonneg_ae + (Filter.Eventually.of_forall (fun y : Plane × ℝ => dot_self_nonneg (W (atHeight y.1 y.2)))) + hi).mp hE + rw [cylinderMeasure_eq_restrict] at hae + have hcont := dot_continuous (hW.comp continuous_atHeight) (hW.comp continuous_atHeight) + have he := Measure.eqOn_of_ae_eq hae hcont.continuousOn continuousOn_const + (by rw [cylinder_slab_closure_interior]) + have hz (X : Plane) (z : ℝ) (hz : z ∈ Icc (0 : ℝ) 1) : W (atHeight X z) = 0 := by + have hh : dot (W (atHeight X z)) (W (atHeight X z)) = 0 := he (show (X,z) ∈ (univ : Set Plane) ×ˢ Icc (0 : ℝ) 1 from ⟨mem_univ X, hz⟩) + have hn := norm_sq_le_dot_self (W (atHeight X z)) + exact norm_eq_zero.mp (by nlinarith [norm_nonneg (W (atHeight X z))]) + intro x + have hx : x = atHeight (horizontal x) (Int.fract (x 2)) + + (⌊x 2⌋ : ℝ) • basis 2 := by + ext j + fin_cases j <;> + simp [atHeight, horizontal, basis, Int.fract_add_floor] + calc + W x = W (atHeight (horizontal x) (Int.fract (x 2)) + (⌊x 2⌋ : ℝ) • basis 2) := + congrArg W hx + _ = W (atHeight (horizontal x) (Int.fract (x 2))) := hp _ _ + _ = 0 := hz _ _ ⟨Int.fract_nonneg _, (Int.fract_lt_one _).le⟩ + +theorem cylinder_classical_velocity_unique (hI : CylinderLocalEnergyIdentity) + {ν : ℝ} (hν : 0 < ν) {f u v : Velocity} {p q : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) (hv : IsCylinderClassicalSolution ν f v q) : + ∀ t, 0 ≤ t → ∀ x, u (t,x) = v (t,x) := by + intro t ht x + have hs : Continuous (fun x => u (t,x) - v (t,x)) := + (hu.regularity.spatial_u t ht).continuous.sub (hv.regularity.spatial_u t ht).continuous + have hp : VerticallyPeriodic (fun x => u (t,x) - v (t,x)) := by + intro y n + exact congrArg₂ (· - ·) (hu.periodic_u t ht y n) (hv.periodic_u t ht y n) + exact sub_eq_zero.mp (cylinder_periodic_field_zero_of_energy_zero hs hp + (hu.difference_energy_integrable hv ht) (hu.difference_energy_zero hI hν hv ht) x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureTransport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..71cdc997f762899335653ec713b6fc35613a259d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureTransport.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderWeightedIntegration + +namespace OAI + +/-! The pressure and incompressible-transport terms in the localized +difference-energy identity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem pressure_pairing {φ : Plane → ℝ} (hφ : ContDiff ℝ 1 φ) + (hc : HasCompactSupport φ) {W : Space → Space} {p : Space → ℝ} + (hW : ContDiff ℝ 1 W) (hp : ContDiff ℝ 1 p) + (hWp : VerticallyPeriodic W) (hpp : VerticallyPeriodic p) + (hdiv : ∀ x, divergence W x = 0) : + (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (gradient p (atHeight y.1 y.2)) + ∂cylinderMeasure) = + -(∫ y, p (atHeight y.1 y.2) * + fderiv ℝ φ y.1 (horizontalLinear (W (atHeight y.1 y.2))) ∂cylinderMeasure) := by + have he (x : Space) : divergence (fun y => p y • W y) x = + dot (W x) (gradient p x) := by + rw [divergence_scalar_mul (hp.differentiable (by norm_num)) + (hW.differentiable (by norm_num)), hdiv, mul_zero, zero_add] + exact (coordinate_trace (fderiv ℝ p x) (W x)).symm.trans + (by simp only [dot, ShearFlows.gradient, mul_comm]) + have h := integral_weighted_divergence (U := fun x => p x • W x) hφ hc (hp.smul hW) + (fun x n => by + change p (x + (n : ℝ) • basis 2) • W (x + (n : ℝ) • basis 2) = p x • W x + rw [hpp, hWp]) + simpa only [he, map_smul, smul_eq_mul] using h + +theorem transport_pairing {φ : Plane → ℝ} (hφ : ContDiff ℝ 1 φ) + (hc : HasCompactSupport φ) {W V : Space → Space} + (hW : ContDiff ℝ 1 W) (hV : ContDiff ℝ 1 V) + (hWp : VerticallyPeriodic W) (hVp : VerticallyPeriodic V) + (hdiv : ∀ x, divergence V x = 0) : + 2 * (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2))) ∂cylinderMeasure) = + -(∫ y, fderiv ℝ φ y.1 (horizontalLinear (V (atHeight y.1 y.2))) * + dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) ∂cylinderMeasure) := by + have he (x : Space) : divergence (fun y => dot (W y) (W y) • V y) x = + 2 * dot (W x) (fderiv ℝ W x (V x)) := by + rw [divergence_scalar_mul ((dot_contDiff hW hW).differentiable (by norm_num)) + (hV.differentiable (by norm_num)), hdiv, mul_zero, zero_add, + fderiv_dot_self (hW.differentiable (by norm_num))] + have h := integral_weighted_divergence (U := fun x => dot (W x) (W x) • V x) + hφ hc ((dot_contDiff hW hW).smul hV) + (fun x n => by + change dot (W (x + (n : ℝ) • basis 2)) (W (x + (n : ℝ) • basis 2)) • + V (x + (n : ℝ) • basis 2) = dot (W x) (W x) • V x + rw [hWp, hVp]) + simp only [he, map_smul, smul_eq_mul] at h + have hi : (fun y : Plane × ℝ => φ y.1 * + (2 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2))))) = + (fun y => 2 * (φ y.1 * dot (W (atHeight y.1 y.2)) + (fderiv ℝ W (atHeight y.1 y.2) (V (atHeight y.1 y.2))))) := by + funext y + ring + rw [hi, integral_const_mul] at h + simpa only [mul_comm] using h + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureUniqueness.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureUniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7ca04344e87da8bdb601d6a92c2e0d9cc81ee44 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderPressureUniqueness.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderPointwiseUniqueness + +namespace OAI + +/-! The L2 condition removes the spatially constant pressure ambiguity on +the infinite cylinder. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set +open scoped ENNReal + +theorem cylinderMeasure_univ : cylinderMeasure univ = ∞ := by + unfold cylinderMeasure + rw [← univ_prod_univ, Measure.prod_prod, + (measure_univ : verticalPeriodMeasure univ = 1), mul_one] + exact measure_univ_of_isAddLeftInvariant (volume : Measure Plane) + +theorem cylinder_classical_pressure_unique {ν : ℝ} {f u v : Velocity} {p : Pressure} + (hu : IsCylinderClassicalSolution ν f u p) + (hv : IsCylinderClassicalSolution ν f v (fun _ => 0)) + (heq : ∀ t, 0 ≤ t → ∀ x, u (t,x) = v (t,x)) : + ∀ t, 0 ≤ t → ∀ x, p (t,x) = 0 := by + intro t ht + have htime (x : Space) : initialTimeDerivative u t x = initialTimeDerivative v t x := + derivWithin_congr (fun s hs => heq s hs x) (heq t ht x) + have hspace : (fun x => u (t,x)) = fun x => v (t,x) := funext (heq t ht) + have hgrad (x : Space) : gradient (fun y => p (t,y)) x = 0 := by + have h1 := hu.equation t ht x + have h2 := hv.equation t ht x + rw [htime, hspace] at h1 + rw [gradient_constant, neg_zero, zero_add] at h2 + linear_combination h1 - h2 + have hder (x : Space) : fderiv ℝ (fun y => p (t,y)) x = 0 := by + ext w + rw [← coordinate_trace] + have hz (j : Fin 3) : fderiv ℝ (fun y => p (t,y)) x (basis j) = 0 := + congrFun (hgrad x) j + simp [hz] + have hconst (x : Space) : p (t,x) = p (t,0) := + is_const_of_fderiv_eq_zero ((hu.regularity.spatial_p t ht).differentiable (by norm_num)) + hder x 0 + have hi := (hu.pressure_h1 t ht).1.square_integrable ⟨ht, le_rfl⟩ + have hic : Integrable (fun _ : Plane × ℝ => p (t,0) ^ 2) cylinderMeasure := by + simpa only [cylinderPullback, hconst] using hi + have hp : p (t,0) ^ 2 = 0 := by + rcases integrable_const_iff.mp hic with hh | hh + · exact hh + · have hfin := hh.measure_univ_lt_top + rw [cylinderMeasure_univ] at hfin + exact False.elim (lt_irrefl _ hfin) + intro x + rw [hconst] + nlinarith [sq_nonneg (p (t,0))] + +theorem cylinder_classical_unique (hI : CylinderLocalEnergyIdentity) + {ν : ℝ} (hν : 0 < ν) {f v : Velocity} + (hv : IsCylinderClassicalSolution ν f v (fun _ => 0)) : + ∀ u p, IsCylinderClassicalSolution ν f u p → + ∀ t, 0 ≤ t → ∀ x, u (t,x) = v (t,x) ∧ p (t,x) = 0 := by + intro u p hu + have heq := cylinder_classical_velocity_unique hI hν hu hv + have hp := cylinder_classical_pressure_unique hu hv heq + exact fun t ht x => ⟨heq t ht x, hp t ht x⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..b85cca7539055bf18c445f277f7794783c1b56ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSolution.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderMeasure +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! The classical comparison class on R² times the unit circle. The +Sobolev conditions use actual L2 representatives of the classical spatial +derivatives. No spatial decay of a competing solution is assumed. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +def cylinderPullback (f : Space → ℝ) (y : Plane × ℝ) : ℝ := f (atHeight y.1 y.2) + +def scalarSpatialD (j : Fin 3) (f : Space → ℝ) (x : Space) : ℝ := + fderiv ℝ f x (basis j) + +def CylinderCInH2 (f : ℝ → Space → ℝ) (S : Set ℝ) : Prop := + CylinderContinuousL2 (fun t => cylinderPullback (f t)) S ∧ + (∀ j, CylinderContinuousL2 (fun t => cylinderPullback (scalarSpatialD j (f t))) S) ∧ + (∀ j k, CylinderContinuousL2 + (fun t => cylinderPullback (scalarSpatialD j (scalarSpatialD k (f t)))) S) + +def CylinderCInH1 (f : ℝ → Space → ℝ) (S : Set ℝ) : Prop := + CylinderContinuousL2 (fun t => cylinderPullback (f t)) S ∧ + (∀ j, CylinderContinuousL2 (fun t => cylinderPullback (scalarSpatialD j (f t))) S) + +def VerticallyPeriodic {A : Type*} (f : Space → A) : Prop := + ∀ (x : Space) (n : ℤ), f (x + (n : ℝ) • basis 2) = f x + +structure IsCylinderClassicalSolution (ν : ℝ) (f u : Velocity) (p : Pressure) : Prop where + regularity : ClassicalRegularity u p + periodic_u : ∀ t, 0 ≤ t → VerticallyPeriodic (fun x => u (t, x)) + periodic_p : ∀ t, 0 ≤ t → VerticallyPeriodic (fun x => p (t, x)) + initial : ∀ x, u (0, x) = 0 + divergence_zero : ∀ t, 0 ≤ t → ∀ x, divergence (fun y => u (t, y)) x = 0 + equation : ∀ t, 0 ≤ t → ∀ x, + initialTimeDerivative u t x + advection (fun y => u (t, y)) x = + -gradient (fun y => p (t, y)) x + + ν • laplacian (fun y => u (t, y)) x + f (t, x) + velocity_h2 : ∀ T, 0 ≤ T → ∀ i, + CylinderCInH2 (fun t x => u (t, x) i) (Icc 0 T) + velocity_c1 : ∀ T, 0 ≤ T → ∀ i, + CylinderC1L2 (fun t => cylinderPullback (fun x => u (t, x) i)) + (fun t => cylinderPullback (fun x => initialTimeDerivative u t x i)) (Icc 0 T) + pressure_h1 : ∀ T, 0 ≤ T → CylinderCInH1 (fun t x => p (t, x)) (Icc 0 T) + bounded : ∀ T, 0 ≤ T → ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x, + ‖u (t, x)‖ + ‖fderiv ℝ (fun y => u (t, y)) x‖ ≤ B + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSpatialCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSpatialCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..2eb55b0c85f4eeb58ac12849d59f13f3c5767b98 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderSpatialCalculus.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCylinderCalculus + +namespace OAI + +/-! Spatial derivatives on a closed time slab agree with ordinary +derivatives of each full-space slice, including at time zero. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open Set +open scoped ContDiff + +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem cylinder_spatial_fderiv_eq {T : ℝ} {U : ℝ × E → F} + (hU : ContDiffOn ℝ ∞ U (Icc 0 T ×ˢ univ)) + {t : ℝ} (ht : t ∈ Icc 0 T) (x : E) : + fderiv ℝ (fun z => U (t, z)) x = + (fderivWithin ℝ U (Icc 0 T ×ˢ univ) (t, x)).comp + (ContinuousLinearMap.inr ℝ ℝ E) := by + have hd := (hU.differentiableOn (by simp) (t, x) ⟨ht, mem_univ x⟩).hasFDerivWithinAt + have hi := (hasFDerivAt_const (𝕜 := ℝ) t x).prodMk (hasFDerivAt_id (𝕜 := ℝ) x) + have hc := hd.comp_hasFDerivAt x hi + (Filter.Eventually.of_forall (fun z => ⟨ht, mem_univ z⟩)) + convert hc.fderiv using 1 + · rfl + · ext z + rfl + +theorem cylinder_spatial_fderiv_smooth {T : ℝ} (hT : 0 < T) {U : ℝ × E → F} + (hU : ContDiffOn ℝ ∞ U (Icc 0 T ×ˢ univ)) : + ContDiffOn ℝ ∞ (fun y : ℝ × E => fderiv ℝ (fun z => U (y.1, z)) y.2) + (Icc 0 T ×ˢ univ) := by + have hS : UniqueDiffOn ℝ (Icc 0 T ×ˢ (univ : Set E)) := + (uniqueDiffOn_Icc hT).prod uniqueDiffOn_univ + have hf : ContDiffOn ℝ ∞ (fderivWithin ℝ U (Icc 0 T ×ˢ univ)) + (Icc 0 T ×ˢ univ) := hU.fderivWithin hS (by simp) + have hh := hf.clm_comp + (contDiffOn_const (c := ContinuousLinearMap.inr ℝ ℝ E)) + apply hh.congr + rintro ⟨t, x⟩ hx + exact cylinder_spatial_fderiv_eq hU hx.1 x + +theorem cylinder_second_spatial_fderiv_smooth {T : ℝ} (hT : 0 < T) + {U : ℝ × E → F} (hU : ContDiffOn ℝ ∞ U (Icc 0 T ×ˢ univ)) : + ContDiffOn ℝ ∞ + (fun y : ℝ × E => fderiv ℝ (fderiv ℝ (fun z => U (y.1, z))) y.2) + (Icc 0 T ×ˢ univ) := + cylinder_spatial_fderiv_smooth hT (cylinder_spatial_fderiv_smooth hT hU) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderViscosity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderViscosity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0ec2d439d39f394ca2320f90527ff7cc019c68c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderViscosity.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderWeightCalculus +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderPressureTransport +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EnergyComparison + +namespace OAI + +/-! The two divergence computations used for the viscous part of the +localized cylinder energy identity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +def diffusionFlux (W : Space → Space) (x : Space) : Space := + fun j => dot (W x) (derivative W j x) + +theorem diffusionFlux_regular {W : Space → Space} (hW : ContDiff ℝ 2 W) : + ContDiff ℝ 1 (diffusionFlux W) := by + apply contDiff_pi.mpr + intro j + exact dot_contDiff (hW.of_le (by norm_num)) (derivative_contDiff hW j) + +theorem diffusionFlux_continuous {W : Space → Space} (hW : ContDiff ℝ 1 W) : + Continuous (diffusionFlux W) := by + apply continuous_pi + intro j + exact dot_continuous hW.continuous + ((hW.continuous_fderiv (by norm_num)).clm_apply continuous_const) + +theorem diffusionFlux_periodic {W : Space → Space} (hW : ContDiff ℝ 2 W) + (hp : VerticallyPeriodic W) : VerticallyPeriodic (diffusionFlux W) := by + have hd := verticallyPeriodic_fderiv hp (hW.differentiable (by norm_num)) + intro x n + ext j + simp only [diffusionFlux, derivative, hp x n, hd x n] + +theorem density_gradient_pairing {W : Space → Space} (hW : ContDiff ℝ 1 W) + (ψ : Space → ℝ) (x : Space) : + fderiv ℝ (fun y => dot (W y) (W y)) x (ShearFlows.gradient ψ x) = + 2 * fderiv ℝ ψ x (diffusionFlux W x) := by + rw [← coordinate_trace (fderiv ℝ (fun y => dot (W y) (W y)) x) + (ShearFlows.gradient ψ x), ← coordinate_trace (fderiv ℝ ψ x) (diffusionFlux W x)] + simp only [ShearFlows.gradient, fderiv_dot_self (hW.differentiable (by norm_num)), + diffusionFlux, derivative, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem diffusionFlux_divergence {W : Space → Space} (hW : ContDiff ℝ 2 W) (x : Space) : + divergence (diffusionFlux W) x = + (∑ j, dot (derivative W j x) (derivative W j x)) + dot (W x) (laplacian W x) := + divergence_dot_derivative hW x + +theorem diffusion_boundary_pairing {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hc : HasCompactSupport φ) {W : Space → Space} (hW : ContDiff ℝ 1 W) + (hp : VerticallyPeriodic W) : + 2 * (∫ y, fderiv ℝ φ y.1 (horizontalLinear (diffusionFlux W (atHeight y.1 y.2))) + ∂cylinderMeasure) = + -(∫ y, VelocityDetector.scalarLaplacian φ y.1 * + dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) ∂cylinderMeasure) := by + let ψ := scalarPlaneLift φ + let G : Space → Space := fun x => dot (W x) (W x) • ShearFlows.gradient ψ x + have hG : ContDiff ℝ 1 G := + (dot_contDiff hW hW).smul ((lifted_gradient_smooth hφ).of_le (by simp)) + have hGp : VerticallyPeriodic G := by + intro x n + dsimp only [G] + rw [hp, lifted_gradient_periodic hφ] + have hz := integral_divergence_zero hG hc + (fun x hx => by + change dot (W x) (W x) • ShearFlows.gradient (scalarPlaneLift φ) x = 0 + rw [lifted_gradient_support x hx, smul_zero]) hGp + have he (x : Space) : divergence G x = + VelocityDetector.scalarLaplacian φ (horizontalLinear x) * dot (W x) (W x) + + 2 * fderiv ℝ φ (horizontalLinear x) (horizontalLinear (diffusionFlux W x)) := by + rw [show G = (fun x => dot (W x) (W x) • ShearFlows.gradient ψ x) from rfl, + divergence_scalar_mul ((dot_contDiff hW hW).differentiable (by norm_num)) + ((lifted_gradient_smooth hφ).differentiable (by simp))] + rw [lifted_gradient_divergence hφ, density_gradient_pairing hW] + have hd := (hφ.differentiable (by simp) (horizontalLinear x)).hasFDerivAt.comp x + horizontalLinear.hasFDerivAt + change HasFDerivAt ψ _ x at hd + rw [hd.fderiv] + simp only [ContinuousLinearMap.comp_apply] + ring + have hi := weighted_integrable (ExpandingDetector.scalarLaplacian_smooth hφ).continuous + (ExpandingDetector.scalarLaplacian_compactSupport hc) (dot_continuous hW.continuous hW.continuous) + have hj := weight_derivative_integrable (hφ.of_le (by simp)) hc + (diffusionFlux_continuous hW) + have hl (a : Plane) (b : ℝ) : horizontalLinear (atHeight a b) = a := by + rw [horizontalLinear_eq, atHeight_horizontal] + simp_rw [he, hl] at hz + rw [integral_add hi (hj.const_mul 2), integral_const_mul] at hz + linarith + +theorem viscosity_pairing {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hc : HasCompactSupport φ) {W : Space → Space} (hW : ContDiff ℝ 2 W) + (hp : VerticallyPeriodic W) : + 2 * (∫ y, φ y.1 * dot (W (atHeight y.1 y.2)) (laplacian W (atHeight y.1 y.2)) + ∂cylinderMeasure) = + -2 * (∫ y, φ y.1 * ∑ j, dot (derivative W j (atHeight y.1 y.2)) + (derivative W j (atHeight y.1 y.2)) ∂cylinderMeasure) + + (∫ y, VelocityDetector.scalarLaplacian φ y.1 * + dot (W (atHeight y.1 y.2)) (W (atHeight y.1 y.2)) ∂cylinderMeasure) := by + have hA := weighted_integrable hφ.continuous hc + (continuous_finsetSum Finset.univ (fun j _ => dot_continuous + (derivative_contDiff hW j).continuous (derivative_contDiff hW j).continuous)) + have hB := weighted_integrable hφ.continuous hc + (dot_continuous hW.continuous (laplacian_continuous hW)) + have h := integral_weighted_divergence (hφ.of_le (by simp)) hc + (diffusionFlux_regular hW) (diffusionFlux_periodic hW hp) + simp_rw [diffusionFlux_divergence hW, mul_add] at h + rw [integral_add hA hB] at h + have hboundary := diffusion_boundary_pairing hφ hc (hW.of_le (by norm_num)) hp + linarith + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..828a246730b239088bc3f3dce5afc939fae03810 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightCalculus.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderWeightedIntegration +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderLiftH2 + +namespace OAI + +/-! The gradient and Laplacian of a cutoff lifted from the horizontal plane. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem verticallyPeriodic_fderiv {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {g : Space → E} (hp : VerticallyPeriodic g) (hg : Differentiable ℝ g) : + VerticallyPeriodic (fderiv ℝ g) := by + intro x n + exact fderiv_translation hg (fun y => hp y n) x + +theorem scalarPlaneLift_periodic (φ : Plane → ℝ) : + VerticallyPeriodic (scalarPlaneLift φ) := by + intro x n + simp only [scalarPlaneLift, Function.comp_apply, map_add, map_smul, + horizontalLinear_basis_two, smul_zero, add_zero] + +theorem lifted_gradient_smooth {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) : + ContDiff ℝ ∞ (gradient (scalarPlaneLift φ)) := by + have hs : ContDiff ℝ ∞ (scalarPlaneLift φ) := hφ.comp horizontalLinear.contDiff + apply contDiff_pi.mpr + intro j + exact (hs.fderiv_right (m := ∞) (by simp)).clm_apply contDiff_const + +theorem lifted_gradient_periodic {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) : + VerticallyPeriodic (gradient (scalarPlaneLift φ)) := by + have hs : Differentiable ℝ (scalarPlaneLift φ) := + (hφ.comp horizontalLinear.contDiff).differentiable (by simp) + intro x n + ext j + exact congrArg (fun A : Space →L[ℝ] ℝ => A (basis j)) + (verticallyPeriodic_fderiv (scalarPlaneLift_periodic φ) hs x n) + +theorem lifted_gradient_support {φ : Plane → ℝ} (x : Space) + (hx : horizontal x ∉ tsupport φ) : gradient (scalarPlaneLift φ) x = 0 := by + ext j + apply scalarSpatialD_horizontal_support (isClosed_tsupport φ) + (fun y hy => by + simp only [scalarPlaneLift, Function.comp_apply, horizontalLinear_eq] + exact image_eq_zero_of_notMem_tsupport hy) j x hx + +theorem lifted_gradient_divergence {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) (x : Space) : + divergence (gradient (scalarPlaneLift φ)) x = + VelocityDetector.scalarLaplacian φ (horizontalLinear x) := by + have hg : Differentiable ℝ (gradient (scalarPlaneLift φ)) := + (lifted_gradient_smooth hφ).differentiable (by simp) + have he (j : Fin 3) : derivative (gradient (scalarPlaneLift φ)) j x j = + scalarSpatialD j (scalarSpatialD j (scalarPlaneLift φ)) x := by + unfold derivative + rw [← fderiv_coordinate hg] + rfl + have hh (j : Fin 2) : + scalarSpatialD j.castSucc (scalarSpatialD j.castSucc (scalarPlaneLift φ)) x = + PlanarHamiltonian.spatialD j (PlanarHamiltonian.spatialD j φ) (horizontalLinear x) := by + rw [scalarPlaneLift_spatialD hφ, + scalarPlaneLift_spatialD (PlanarHamiltonian.spatialD_smooth j hφ)] + rfl + have hv : scalarSpatialD 2 (scalarSpatialD 2 (scalarPlaneLift φ)) x = 0 := by + rw [scalarPlaneLift_verticalD hφ] + simp only [scalarSpatialD, fderiv_const_apply, zero_apply] + simp only [divergence, he, Fin.sum_univ_three] + change _ + _ + _ = _ + rw [show (0 : Fin 3) = (0 : Fin 2).castSucc from rfl, hh, + show (1 : Fin 3) = (1 : Fin 2).castSucc from rfl, hh, hv] + simp only [VelocityDetector.scalarLaplacian, Fin.sum_univ_two, add_zero] + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightedIntegration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightedIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..32003bf6cced8dd201e311b7282dd6113c2b93b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/CylinderWeightedIntegration.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderDivergence +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift + +namespace OAI + +/-! Weighted divergence identity for the horizontal cutoffs in the +cylinder energy calculation. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector.CylinderLocalCalculus +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem integrable_space_function {g : Space → ℝ} (hg : Continuous g) + {K : Set Plane} (hK : IsCompact K) (hs : ∀ x, horizontal x ∉ K → g x = 0) : + Integrable (fun y => g (atHeight y.1 y.2)) cylinderMeasure := by + apply integrable_horizontal_compact (hg.comp atHeight_smooth.continuous) hK + intro y hy + apply hs + simpa only [atHeight_horizontal] using hy + +theorem divergence_continuous {U : Space → Space} (hU : ContDiff ℝ 1 U) : + Continuous (divergence U) := by + apply continuous_finsetSum + intro j _ + exact (continuous_apply j).comp + ((hU.continuous_fderiv (by norm_num)).clm_apply continuous_const) + +theorem weighted_integrable {φ : Plane → ℝ} (hφ : Continuous φ) + (hc : HasCompactSupport φ) {g : Space → ℝ} (hg : Continuous g) : + Integrable (fun y => φ y.1 * g (atHeight y.1 y.2)) cylinderMeasure := by + have hi := integrable_space_function (g := fun x => φ (horizontalLinear x) * g x) + ((hφ.comp horizontalLinear.continuous).mul hg) hc + (fun x hx => by rw [horizontalLinear_eq, image_eq_zero_of_notMem_tsupport hx, zero_mul]) + simpa only [horizontalLinear_eq, atHeight_horizontal] using hi + +theorem weight_derivative_integrable {φ : Plane → ℝ} (hφ : ContDiff ℝ 1 φ) + (hc : HasCompactSupport φ) {U : Space → Space} (hU : Continuous U) : + Integrable (fun y => fderiv ℝ φ y.1 (horizontalLinear (U (atHeight y.1 y.2)))) + cylinderMeasure := by + have hi := integrable_space_function + (g := fun x => fderiv ℝ φ (horizontalLinear x) (horizontalLinear (U x))) + (((hφ.continuous_fderiv (by norm_num)).comp horizontalLinear.continuous).clm_apply + (horizontalLinear.continuous.comp hU)) hc (fun x hx => by + rw [horizontalLinear_eq, fderiv_of_notMem_tsupport ℝ hx] + rfl) + simpa only [horizontalLinear_eq, atHeight_horizontal] using hi + +theorem integral_weighted_divergence {φ : Plane → ℝ} (hφ : ContDiff ℝ 1 φ) + (hc : HasCompactSupport φ) {U : Space → Space} (hU : ContDiff ℝ 1 U) + (hp : VerticallyPeriodic U) : + (∫ y, φ y.1 * divergence U (atHeight y.1 y.2) ∂cylinderMeasure) = + -(∫ y, fderiv ℝ φ y.1 (horizontalLinear (U (atHeight y.1 y.2))) + ∂cylinderMeasure) := by + let ψ : Space → ℝ := fun x => φ (horizontalLinear x) + have hψ : ContDiff ℝ 1 ψ := hφ.comp horizontalLinear.contDiff + have hψ0 (x : Space) (hx : horizontal x ∉ tsupport φ) : ψ x = 0 := by + dsimp only [ψ] + rw [horizontalLinear_eq] + exact image_eq_zero_of_notMem_tsupport hx + have hz := integral_divergence_zero (U := fun x => ψ x • U x) (hψ.smul hU) hc + (fun x hx => by simp only [hψ0 x hx, zero_smul]) + (fun x n => by + change φ (horizontalLinear (x + (n : ℝ) • basis 2)) • U (x + (n : ℝ) • basis 2) = _ + rw [map_add, map_smul, horizontalLinear_basis_two, smul_zero, add_zero, hp]) + have he (x : Space) : divergence (fun y => ψ y • U y) x = + ψ x * divergence U x + fderiv ℝ φ (horizontalLinear x) (horizontalLinear (U x)) := by + rw [divergence_scalar_mul (hψ.differentiable (by norm_num)) + (hU.differentiable (by norm_num))] + have hd := (hφ.differentiable (by norm_num) (horizontalLinear x)).hasFDerivAt.comp x + horizontalLinear.hasFDerivAt + change HasFDerivAt ψ _ x at hd + rw [hd.fderiv] + rfl + have hi : Integrable (fun y => ψ (atHeight y.1 y.2) * + divergence U (atHeight y.1 y.2)) cylinderMeasure := + integrable_space_function (g := fun x => ψ x * divergence U x) + (hψ.continuous.mul (divergence_continuous hU)) hc + (fun x hx => by rw [hψ0 x hx, zero_mul]) + have hj : Integrable (fun y => fderiv ℝ φ (horizontalLinear (atHeight y.1 y.2)) + (horizontalLinear (U (atHeight y.1 y.2)))) cylinderMeasure := by + apply integrable_space_function + (g := fun x => fderiv ℝ φ (horizontalLinear x) (horizontalLinear (U x))) + (((hφ.continuous_fderiv (by norm_num)).comp horizontalLinear.continuous).clm_apply + (horizontalLinear.continuous.comp hU.continuous)) hc + intro x hx + rw [horizontalLinear_eq, fderiv_of_notMem_tsupport ℝ hx] + rfl + simp_rw [he] at hz + rw [integral_add hi hj] at hz + simp only [ψ, horizontalLinear_eq, atHeight_horizontal] at hz + simp only [horizontalLinear_eq] + linarith + +end ForcedComputation.VelocityDetector.CylinderLocalCalculus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBlockSum.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBlockSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..3860683823991a5954810ffd0e5bdc8fb8066d1b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBlockSum.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! A detector's countably many bursts form a smooth field: only finitely +many bursts have begun in a neighborhood of any physical time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +section +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def detectorBlockSum (F : ℕ → ℝ × Plane → E) (y : ℝ × Plane) : E := ∑' n, F n y + +omit [NormedSpace ℝ E] in +theorem detectorBlockSum_local_of_time_bound (F : ℕ → ℝ × Plane → E) + (hbefore : ∀ (n : ℕ) y, y.1 < 2 * ((n : ℝ) + 1) → F n y = 0) + (y : ℝ × Plane) (N : ℕ) (hN : y.1 + 1 ≤ (N : ℝ)) : + detectorBlockSum F =ᶠ[𝓝 y] fun z => ∑ n ∈ Finset.range N, F n z := by + have hn : ∀ᶠ z : ℝ × Plane in 𝓝 y, z.1 < y.1 + 1 := + (continuous_fst.tendsto y).eventually (eventually_lt_nhds (by linarith)) + filter_upwards [hn] with z hz + apply tsum_eq_sum + intro n hnot + have hnN : N ≤ n := Nat.le_of_not_gt (by simpa only [Finset.mem_range] using hnot) + have hc : (N : ℝ) ≤ n := by exact_mod_cast hnN + have hn₀ : (0 : ℝ) ≤ n := Nat.cast_nonneg n + exact hbefore n z (by linarith) + +omit [NormedSpace ℝ E] in +theorem detectorBlockSum_local (F : ℕ → ℝ × Plane → E) + (hbefore : ∀ (n : ℕ) y, y.1 < 2 * ((n : ℝ) + 1) → F n y = 0) (y : ℝ × Plane) : + ∃ N : ℕ, detectorBlockSum F =ᶠ[𝓝 y] fun z => ∑ n ∈ Finset.range N, F n z := by + let N := ⌈y.1 + 1⌉₊ + have hN : y.1 + 1 ≤ (N : ℝ) := Nat.le_ceil _ + exact ⟨N, detectorBlockSum_local_of_time_bound F hbefore y N hN⟩ + +omit [NormedSpace ℝ E] in +/-- A coarse rational approximation to physical time gives a finite prefix +valid throughout a neighborhood, hence for every derivative there as well. -/ +theorem detectorBlockSum_local_of_approximation (F : ℕ → ℝ × Plane → E) + (hbefore : ∀ (n : ℕ) y, y.1 < 2 * ((n : ℝ) + 1) → F n y = 0) + (y : ℝ × Plane) (q : ℚ) (hq : |y.1 - (q : ℝ)| ≤ 1) : + detectorBlockSum F =ᶠ[𝓝 y] + fun z => ∑ n ∈ Finset.range ⌈q + 2⌉₊, F n z := by + apply detectorBlockSum_local_of_time_bound F hbefore y + have hc : (q : ℝ) + 2 ≤ (⌈q + 2⌉₊ : ℝ) := by + exact_mod_cast (Nat.le_ceil (q + 2)) + have hy := (abs_le.mp hq).2 + linarith + +theorem detectorBlockSum_smooth (F : ℕ → ℝ × Plane → E) + (hF : ∀ n, ContDiff ℝ ∞ (F n)) + (hbefore : ∀ (n : ℕ) y, y.1 < 2 * ((n : ℝ) + 1) → F n y = 0) : + ContDiff ℝ ∞ (detectorBlockSum F) := by + apply contDiff_iff_contDiffAt.mpr + intro y + obtain ⟨N, hN⟩ := detectorBlockSum_local F hbefore y + have hs : ContDiff ℝ ∞ (fun z => ∑ n ∈ Finset.range N, F n z) := by + apply ContDiff.sum + intro n _ + exact hF n + exact hs.contDiffAt.congr_of_eventuallyEq hN + +end +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBump.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBump.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2a9d5d6e767f37b55f07c635ce54209f2c796f6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBump.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! The nonnegative height-one periodic bump injected by a detector block. +Its center is the fixed planar processor point (1/4,1/4). -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def detectorProfile (b : ℝ) : ℝ → ℝ := + circleCutoff 1 (1 / 4 - b) (1 / 4 - b / 2) (1 / 4 + b / 2) (1 / 4 + b) + +def detectorBump (b : ℝ) (x : Plane) : ℝ := + detectorProfile b (x 0) * detectorProfile b (x 1) + +theorem detectorProfile_smooth {b : ℝ} (hb : 0 < b) : + ContDiff ℝ ∞ (detectorProfile b) := + circleCutoff_smooth (by norm_num) (by linarith) (by linarith) + +theorem detectorProfile_periodic (b : ℝ) : Function.Periodic (detectorProfile b) 1 := + circleCutoff_periodic _ _ _ _ _ + +theorem detectorProfile_in_chart {b x : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) + (hx : x ∈ Icc 0 1) : + detectorProfile b x = + closedCutoff (1 / 4 - b) (1 / 4 - b / 2) (1 / 4 + b / 2) (1 / 4 + b) x := by + exact circleCutoff_eq_in_chart (A := 0) (B := 1) (by norm_num) (by norm_num) + (by linarith) (by linarith) (by linarith) (by linarith) hx + +theorem detectorProfile_range {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) (x : ℝ) : + detectorProfile b x ∈ Icc (0 : ℝ) 1 := by + have he : detectorProfile b (Int.fract x) = detectorProfile b x := by + simpa only [Int.fract, mul_one] using + (detectorProfile_periodic b).sub_int_mul_eq (x := x) ⌊x⌋ + rw [← he, detectorProfile_in_chart hb hb₁ ⟨Int.fract_nonneg x, (Int.fract_lt_one x).le⟩] + exact closedCutoff_range _ _ _ _ _ + +theorem detectorProfile_center {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) : + detectorProfile b (1 / 4) = 1 := by + rw [detectorProfile_in_chart hb hb₁ (by norm_num)] + exact closedCutoff_plateau (by linarith) (by linarith) ⟨by linarith, by linarith⟩ + +theorem detectorBump_smooth {b : ℝ} (hb : 0 < b) : + ContDiff ℝ ∞ (detectorBump b) := + ((detectorProfile_smooth hb).comp (contDiff_apply ℝ ℝ 0)).mul + ((detectorProfile_smooth hb).comp (contDiff_apply ℝ ℝ 1)) + +theorem detectorBump_periodic (b : ℝ) : PlanePeriodic (detectorBump b) := by + intro x n + have h₀ := (detectorProfile_periodic b).int_mul (n 0) (x 0) + have h₁ := (detectorProfile_periodic b).int_mul (n 1) (x 1) + simpa only [detectorBump, Pi.add_apply, mul_one] using congrArg₂ (· * ·) h₀ h₁ + +theorem detectorBump_range {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) (x : Plane) : + detectorBump b x ∈ Icc (0 : ℝ) 1 := by + have h₀ := detectorProfile_range hb hb₁ (x 0) + have h₁ := detectorProfile_range hb hb₁ (x 1) + exact ⟨mul_nonneg h₀.1 h₁.1, (mul_le_mul h₀.2 h₁.2 h₁.1 (by norm_num)).trans_eq (mul_one 1)⟩ + +theorem detectorBump_center {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) : + detectorBump b ![1 / 4, 1 / 4] = 1 := by + change detectorProfile b (1 / 4) * detectorProfile b (1 / 4) = 1 + rw [detectorProfile_center hb hb₁, mul_one] + +theorem detectorBump_support_in_chart {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) + {x : Plane} (hx : ∀ j, x j ∈ Icc (0 : ℝ) 1) (hn : detectorBump b x ≠ 0) : + ∀ j, |x j - 1 / 4| < b := by + have hprod : detectorProfile b (x 0) ≠ 0 ∧ detectorProfile b (x 1) ≠ 0 := + mul_ne_zero_iff.mp hn + intro j + have hj : detectorProfile b (x j) ≠ 0 := by + fin_cases j + · exact hprod.1 + · exact hprod.2 + rw [detectorProfile_in_chart hb hb₁ (hx j)] at hj + have hs := closedCutoff_support (a := 1 / 4 - b) (b := 1 / 4 - b / 2) + (c := 1 / 4 + b / 2) (d := 1 / 4 + b) (by linarith) (by linarith) hj + exact abs_lt.mpr ⟨by linarith [hs.1], by linarith [hs.2]⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpDerivatives.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..beae4cc837d7a7e46d721a9f302e93861d3693d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpDerivatives.lean @@ -0,0 +1,181 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ScaledDetectorProfile +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanDerivativeBounds + +namespace OAI + +/-! Euclidean first and second derivative bounds for the injected bump. +The constant is a fixed, computed natural number, independent of its width. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def euclideanCoordinate (i : Fin 2) : EuclideanPlane →L[ℝ] ℝ := + (ContinuousLinearMap.proj i).comp planeCoordinates.toContinuousLinearMap + +theorem euclideanCoordinate_apply (i : Fin 2) (x : EuclideanPlane) : + euclideanCoordinate i x = x i := rfl + +theorem euclideanCoordinate_norm (i : Fin 2) : ‖euclideanCoordinate i‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ (by norm_num) + intro x + simpa only [euclideanCoordinate_apply, one_mul] using PiLp.norm_apply_le x i + +theorem coordinateProfile_fderiv {g : ℝ → ℝ} (hg : ContDiff ℝ ∞ g) + (i : Fin 2) (x : EuclideanPlane) : + fderiv ℝ (fun y : EuclideanPlane => g (y i)) x = + deriv g (x i) • euclideanCoordinate i := by + have hd := ((hg.differentiable (by simp) (x i)).hasDerivAt).comp_hasFDerivAt x + (euclideanCoordinate i).hasFDerivAt + exact hd.fderiv + +theorem coordinateProfile_second_fderiv {g : ℝ → ℝ} (hg : ContDiff ℝ ∞ g) + (i : Fin 2) (x : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (fun y : EuclideanPlane => g (y i))) x = + (deriv (deriv g) (x i) • euclideanCoordinate i).smulRight + (euclideanCoordinate i) := by + have he : fderiv ℝ (fun y : EuclideanPlane => g (y i)) = + fun y => deriv g (y i) • euclideanCoordinate i := by + funext y + exact coordinateProfile_fderiv hg i y + rw [he] + have hg' : ContDiff ℝ ∞ (deriv g) := (contDiff_infty_iff_deriv.mp hg).2 + have hd := (((hg'.differentiable (by simp) (x i)).hasDerivAt).comp_hasFDerivAt x + (euclideanCoordinate i).hasFDerivAt).smul_const (euclideanCoordinate i) + exact hd.fderiv + +theorem scalarProduct_second_fderiv {f g : EuclideanPlane → ℝ} + (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) (x : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (fun y => f y * g y)) x = + (f x • fderiv ℝ (fderiv ℝ g) x + + (fderiv ℝ f x).smulRight (fderiv ℝ g x)) + + (g x • fderiv ℝ (fderiv ℝ f) x + + (fderiv ℝ g x).smulRight (fderiv ℝ f x)) := by + have he : fderiv ℝ (fun y => f y * g y) = + fun y => f y • fderiv ℝ g y + g y • fderiv ℝ f y := by + funext y + exact fderiv_fun_mul (hf.differentiable (by simp) y) (hg.differentiable (by simp) y) + rw [he] + exact (((hf.differentiable (by simp) x).hasFDerivAt.smul + (((hg.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x).hasFDerivAt)).add + ((hg.differentiable (by simp) x).hasFDerivAt.smul + (((hf.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x).hasFDerivAt))).fderiv + +def detectorBumpDerivativeBound : ℕ := + 1 + 2 * detectorProfileDerivativeBound 1 + 2 * detectorProfileDerivativeBound 2 + + 2 * detectorProfileDerivativeBound 1 ^ 2 + +theorem coordinateProfile_derivative_bounds {b : ℝ} + (hb : 0 < b) (hb₁ : b ≤ 1 / 16) (i : Fin 2) (x : EuclideanPlane) : + ‖fderiv ℝ (fun y : EuclideanPlane => detectorProfile b (y i)) x‖ ≤ + b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (fun y : EuclideanPlane => detectorProfile b (y i))) x‖ ≤ + b⁻¹ ^ 2 * (detectorProfileDerivativeBound 2 : ℝ) := by + have h₁ : |deriv (detectorProfile b) (x i)| ≤ + b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ) := by + simpa only [iteratedDeriv_succ, iteratedDeriv_zero, pow_one] using + detectorProfile_iteratedDeriv_bound hb hb₁ 1 (x i) + have h₂ : |deriv (deriv (detectorProfile b)) (x i)| ≤ + b⁻¹ ^ 2 * (detectorProfileDerivativeBound 2 : ℝ) := by + simpa only [iteratedDeriv_succ, iteratedDeriv_zero] using + detectorProfile_iteratedDeriv_bound hb hb₁ 2 (x i) + constructor + · rw [coordinateProfile_fderiv (detectorProfile_smooth hb), norm_smul, Real.norm_eq_abs] + exact (mul_le_mul_of_nonneg_left (euclideanCoordinate_norm i) (abs_nonneg _)).trans + (by simpa only [mul_one] using h₁) + · rw [coordinateProfile_second_fderiv (detectorProfile_smooth hb), + ContinuousLinearMap.norm_smulRight_apply, norm_smul, Real.norm_eq_abs] + calc + _ ≤ |deriv (deriv (detectorProfile b)) (x i)| * 1 * 1 := by + gcongr <;> exact euclideanCoordinate_norm i + _ ≤ _ := by simpa only [mul_one] using h₂ + +theorem detectorBump_euclidean_derivative_bounds {b : ℝ} + (hb : 0 < b) (hb₁ : b ≤ 1 / 16) (x : EuclideanPlane) : + ‖fderiv ℝ (fun y : EuclideanPlane => detectorBump b (planeCoordinates y)) x‖ ≤ + (detectorBumpDerivativeBound : ℝ) * b⁻¹ ∧ + ‖fderiv ℝ (fderiv ℝ + (fun y : EuclideanPlane => detectorBump b (planeCoordinates y))) x‖ ≤ + (detectorBumpDerivativeBound : ℝ) * b⁻¹ ^ 2 := by + let f : EuclideanPlane → ℝ := fun y => detectorProfile b (y 0) + let g : EuclideanPlane → ℝ := fun y => detectorProfile b (y 1) + have hf : ContDiff ℝ ∞ f := + (detectorProfile_smooth hb).comp (euclideanCoordinate 0).contDiff + have hg : ContDiff ℝ ∞ g := + (detectorProfile_smooth hb).comp (euclideanCoordinate 1).contDiff + have hf₀ : ‖f x‖ ≤ 1 := by + rw [Real.norm_eq_abs, abs_of_nonneg (detectorProfile_range hb hb₁ (x 0)).1] + exact (detectorProfile_range hb hb₁ (x 0)).2 + have hg₀ : ‖g x‖ ≤ 1 := by + rw [Real.norm_eq_abs, abs_of_nonneg (detectorProfile_range hb hb₁ (x 1)).1] + exact (detectorProfile_range hb hb₁ (x 1)).2 + obtain ⟨hf₁, hf₂⟩ := coordinateProfile_derivative_bounds hb hb₁ 0 x + obtain ⟨hg₁, hg₂⟩ := coordinateProfile_derivative_bounds hb hb₁ 1 x + have hB₁ : (0 : ℝ) ≤ (detectorProfileDerivativeBound 1 : ℝ) := Nat.cast_nonneg _ + have hB₂ : (0 : ℝ) ≤ (detectorProfileDerivativeBound 2 : ℝ) := Nat.cast_nonneg _ + have hC₁ : 2 * (detectorProfileDerivativeBound 1 : ℝ) ≤ + (detectorBumpDerivativeBound : ℝ) := by + unfold detectorBumpDerivativeBound + push_cast + nlinarith [hB₂, + sq_nonneg (detectorProfileDerivativeBound 1 : ℝ)] + have hC₂ : 2 * (detectorProfileDerivativeBound 2 : ℝ) + + 2 * (detectorProfileDerivativeBound 1 : ℝ) ^ 2 ≤ + (detectorBumpDerivativeBound : ℝ) := by + unfold detectorBumpDerivativeBound + push_cast + linarith [hB₁] + change ‖fderiv ℝ (fun y => f y * g y) x‖ ≤ _ ∧ + ‖fderiv ℝ (fderiv ℝ (fun y => f y * g y)) x‖ ≤ _ + constructor + · rw [fderiv_fun_mul (hf.differentiable (by simp) x) (hg.differentiable (by simp) x)] + calc + _ ≤ ‖f x • fderiv ℝ g x‖ + ‖g x • fderiv ℝ f x‖ := norm_add_le _ _ + _ = ‖f x‖ * ‖fderiv ℝ g x‖ + ‖g x‖ * ‖fderiv ℝ f x‖ := by + rw [norm_smul, norm_smul] + _ ≤ 1 * (b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ)) + + 1 * (b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ)) := by + gcongr + _ = (2 * (detectorProfileDerivativeBound 1 : ℝ)) * b⁻¹ := by ring + _ ≤ _ := mul_le_mul_of_nonneg_right hC₁ (inv_nonneg.mpr hb.le) + · rw [scalarProduct_second_fderiv hf hg] + calc + _ ≤ (‖f x‖ * ‖fderiv ℝ (fderiv ℝ g) x‖ + + ‖fderiv ℝ f x‖ * ‖fderiv ℝ g x‖) + + (‖g x‖ * ‖fderiv ℝ (fderiv ℝ f) x‖ + + ‖fderiv ℝ g x‖ * ‖fderiv ℝ f x‖) := by + have h := (norm_add_le + (f x • fderiv ℝ (fderiv ℝ g) x + + (fderiv ℝ f x).smulRight (fderiv ℝ g x)) + (g x • fderiv ℝ (fderiv ℝ f) x + + (fderiv ℝ g x).smulRight (fderiv ℝ f x))).trans + (add_le_add + (norm_add_le (f x • fderiv ℝ (fderiv ℝ g) x) + ((fderiv ℝ f x).smulRight (fderiv ℝ g x))) + (norm_add_le (g x • fderiv ℝ (fderiv ℝ f) x) + ((fderiv ℝ g x).smulRight (fderiv ℝ f x)))) + exact h.trans (add_le_add + (add_le_add + (ContinuousLinearMap.opNorm_smul_le (f x) (fderiv ℝ (fderiv ℝ g) x)) + (ContinuousLinearMap.norm_smulRight_apply _ _).le) + (add_le_add + (ContinuousLinearMap.opNorm_smul_le (g x) (fderiv ℝ (fderiv ℝ f) x)) + (ContinuousLinearMap.norm_smulRight_apply _ _).le)) + _ ≤ (1 * (b⁻¹ ^ 2 * (detectorProfileDerivativeBound 2 : ℝ)) + + (b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ)) ^ 2) + + (1 * (b⁻¹ ^ 2 * (detectorProfileDerivativeBound 2 : ℝ)) + + (b⁻¹ * (detectorProfileDerivativeBound 1 : ℝ)) ^ 2) := by + simp only [pow_two] + gcongr + · simpa only [pow_two] using hg₂ + · simpa only [pow_two] using hf₂ + _ = (2 * (detectorProfileDerivativeBound 2 : ℝ) + + 2 * (detectorProfileDerivativeBound 1 : ℝ) ^ 2) * b⁻¹ ^ 2 := by ring + _ ≤ _ := mul_le_mul_of_nonneg_right hC₂ (sq_nonneg _) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..54e4eda10a8ac9049a9d1d19d35e5c32e19a8506 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBumpMass.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBump + +namespace OAI + +/-! A height-one injection has mass at most the area of its support square. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory + +theorem detectorBump_mass {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) : + 0 ≤ (∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump b x) ∧ + (∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump b x) ≤ 4 * b ^ 2 := by + let K : Set Plane := Icc 0 (fun _ => 1) + let S : Set Plane := Icc (fun _ => 1 / 4 - b) (fun _ => 1 / 4 + b) + have hsub : S ⊆ K := by + intro x hx + constructor <;> intro j + · have hj := hx.1 j + dsimp at hj ⊢ + linarith + · have hj := hx.2 j + dsimp at hj ⊢ + linarith + have hpoint (x : Plane) (hx : x ∈ K) : + detectorBump b x ≤ S.indicator (fun _ => (1 : ℝ)) x := by + by_cases hs : x ∈ S + · rw [indicator_of_mem hs] + exact (detectorBump_range hb hb₁ x).2 + · rw [indicator_of_notMem hs] + have hz : detectorBump b x = 0 := by + by_contra hn + have hc := detectorBump_support_in_chart hb hb₁ + (fun j => ⟨hx.1 j, hx.2 j⟩) hn + apply hs + constructor <;> intro j + · have hh := (abs_lt.mp (hc j)).1 + dsimp + linarith + · have hh := (abs_lt.mp (hc j)).2 + dsimp + linarith + exact hz.le + constructor + · exact integral_nonneg (fun x => (detectorBump_range hb hb₁ x).1) + · have hi : IntegrableOn (detectorBump b) K := + (detectorBump_smooth hb).continuous.integrableOn_Icc + have hconst : IntegrableOn (fun _ : Plane => (1 : ℝ)) K := + integrableOn_const isCompact_Icc.measure_lt_top.ne + calc + _ ≤ ∫ x in K, S.indicator (fun _ => (1 : ℝ)) x := + setIntegral_mono_on hi (hconst.indicator measurableSet_Icc) + measurableSet_Icc hpoint + _ = ∫ _x in S, (1 : ℝ) := by + rw [setIntegral_indicator measurableSet_Icc, inter_eq_right.mpr hsub] + _ = 4 * b ^ 2 := by + rw [setIntegral_const] + simp only [Measure.real, smul_eq_mul, mul_one] + rw [Real.volume_Icc_pi_toReal (fun _ => by dsimp; linarith)] + simp only [Fin.prod_univ_two] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBurst.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBurst.lean new file mode 100644 index 0000000000000000000000000000000000000000..21004c85613ebf6d9ddb86243b616f279d7a2281 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorBurst.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorReferenceBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorSchedule +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarTimeWindow +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarBurstError + +namespace OAI + +/-! The prescribed burst is compared directly with its inviscid reference. +Previously injected scalar enters only through its bound at the start. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detectorReference_periodic {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) (C L n : ℕ) (t : ℝ) : + PlanePeriodic (detectorReference Ψ C L n t) := by + intro x k + unfold detectorReference + rw [pullbackScalar_periodic hΨ hp (detectorBump_periodic _) _ x k] + +theorem detectorReference_initial (Ψ : ℝ → ℝ → Plane → Plane) (C L n : ℕ) (x : Plane) : + detectorReference Ψ C L n (2 * ((n : ℝ) + 1)) x = 0 := by + simp only [detectorReference, detectorInjectionFraction, sub_self, zero_div] + rw [smoothRamp_before (by norm_num : (0 : ℝ) < 1) le_rfl, zero_mul] + +theorem detectorReference_solution {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) (C L n : ℕ) : + TorusScalarSolution (2 * (duration C L n : ℝ)) 1 + (fun t => detectorDrift V C L (2 * ((n : ℝ) + 1) + t)) + (fun t x => detectorSource C L (2 * ((n : ℝ) + 1) + t) x - + scalarLaplacian (detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t)) x) + (fun t => detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t)) (fun _ => 0) := by + let S := 2 * ((n : ℝ) + 1) + refine ⟨((detectorReference_smooth hback C L n).comp + ((contDiff_const.add contDiff_fst).prodMk contDiff_snd)).contDiffOn, ?_, ?_, ?_⟩ + · intro t _ + exact detectorReference_periodic hΨ hp C L n _ + · funext x + simpa only [add_zero] using detectorReference_initial Ψ C L n x + · intro t ht x + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hδ := detector_duration_real_le C L n + have hi : S + t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2)) := by + dsimp only [S] + constructor <;> linarith [ht.1, ht.2] + have he := (detectorReference_equation hΨ hback C L n (S + t) x).comp t + ((hasDerivAt_id t).const_add S) + rw [← detectorDrift_eq_term V C L n hi x, ← detectorSource_eq_term C L n hi x] at he + convert he.hasDerivWithinAt (s := Icc (0 : ℝ) (2 * (duration C L n : ℝ))) using 1 + · rfl + · simp only [scalarGenerator, one_mul, mul_one] + ring + +theorem detectorBurst_comparison {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hlap : ∀ t ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)), ∀ x, + |scalarLaplacian (detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t)) x| ≤ + (laplacianBound C L n : ℝ)) + {E : ℝ} (hinit : ∀ x, |w (2 * ((n : ℝ) + 1)) x| ≤ E) : + ∀ t ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)), ∀ x, + |w (2 * ((n : ℝ) + 1) + t) x - + detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t) x| < E + 1 / 16 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + exact scalar_burst_error_initial C L n + (hs.window hw (by positivity) (by positivity)) + (detectorReference_solution hΨ hp hback C L n) hlap + (fun x => by simpa only [sub_zero] using hinit x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorClockExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorClockExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..88ad160df10b3f73fd2eecb3b4035c0c103f6d5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorClockExpressions.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorReference +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EffectiveProfiles + +namespace OAI + +/-! The injection and stirring clocks are finite rational profile +expressions. Their symbolic derivatives give the prescribed rates. -/ + +namespace ForcedComputation.VelocityDetector +open ShearFlows + +def blockStart (n : ℕ) : ℚ := 2 * ((n : ℚ) + 1) + +def injectionExpression (C L n : ℕ) : ProfileExpr := + .ramp (blockStart n) (blockStart n + duration C L n) + +def phaseExpression (C L n : ℕ) : ProfileExpr := + .mul (.const ((n : ℚ) + 1)) + (.ramp (blockStart n + duration C L n) + (blockStart n + 2 * duration C L n)) + +theorem smoothRamp_window (a δ t : ℝ) : + smoothRamp a (a + δ) t = smoothRamp 0 1 ((t - a) / δ) := by + simp only [smoothRamp] + rw [show a + δ - a = δ by ring] + norm_num + +theorem injectionExpression_val (C L n : ℕ) : + (injectionExpression C L n).val = detectorInjectionFraction C L n := by + funext t + rw [injectionExpression, ProfileExpr.val_ramp] + simp only [Rat.cast_add] + rw [smoothRamp_window] + simp only [blockStart, Rat.cast_mul, Rat.cast_add, Rat.cast_natCast, + Rat.cast_ofNat, Rat.cast_one, detectorInjectionFraction] + +theorem phaseExpression_val (C L n : ℕ) : + (phaseExpression C L n).val = detectorPhase C L n := by + funext t + simp only [phaseExpression, ProfileExpr.val, ProfileExpr.val_ramp, + Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, Rat.cast_ofNat, Rat.cast_one] + have he : (blockStart n : ℝ) + 2 * (duration C L n : ℝ) = + ((blockStart n : ℝ) + (duration C L n : ℝ)) + (duration C L n : ℝ) := by ring + rw [he, smoothRamp_window] + unfold detectorPhase + congr 2 + simp only [blockStart, Rat.cast_mul, Rat.cast_add, Rat.cast_natCast, + Rat.cast_ofNat, Rat.cast_one] + ring + +theorem injectionExpression_diff_val (C L n : ℕ) (t : ℝ) : + (injectionExpression C L n).diff.val t = detectorInjectionRate C L n t := by + have hd := (injectionExpression C L n).hasDerivAt t + rw [injectionExpression_val] at hd + exact hd.unique (detectorInjectionFraction_hasDerivAt C L n t) + +theorem phaseExpression_diff_val (C L n : ℕ) (t : ℝ) : + (phaseExpression C L n).diff.val t = detectorSpeed C L n t := by + have hd := (phaseExpression C L n).hasDerivAt t + rw [phaseExpression_val] at hd + exact hd.unique (detectorPhase_hasDerivAt C L n t) + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorDivergence.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorDivergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ef96b3cb57212e60443878623bb5640a6ba6a25 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorDivergence.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorStirring +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus + +namespace OAI + +/-! The explicitly scheduled detector drift is incompressible. Local finite +summation permits differentiation of the full schedule at every time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Filter +open scoped ContDiff Topology BigOperators + +theorem planar_divergence_trace {a : Plane → Plane} (ha : ContDiff ℝ ∞ a) (x : Plane) : + PlanarHamiltonian.divergence a x = + ∑ j : Fin 2, fderiv ℝ a x (PlanarHamiltonian.basis j) j := by + apply Finset.sum_congr rfl + intro j _ + unfold PlanarHamiltonian.spatialD + rw [fderiv_apply (ha.differentiable (by simp) x) j] + rfl + +theorem planar_divergence_congr {a b : Plane → Plane} + (ha : ContDiff ℝ ∞ a) (hb : ContDiff ℝ ∞ b) {x : Plane} (he : a =ᶠ[𝓝 x] b) : + PlanarHamiltonian.divergence a x = PlanarHamiltonian.divergence b x := by + rw [planar_divergence_trace ha, planar_divergence_trace hb, he.fderiv_eq] + +theorem planar_divergence_sum (N : ℕ) (F : ℕ → Plane → Plane) + (hF : ∀ n, ContDiff ℝ ∞ (F n)) (x : Plane) : + PlanarHamiltonian.divergence (fun y => ∑ n ∈ Finset.range N, F n y) x = + ∑ n ∈ Finset.range N, PlanarHamiltonian.divergence (F n) x := by + rw [planar_divergence_trace (ContDiff.sum (fun n _ => hF n))] + rw [fderiv_fun_sum (fun n _ => (hF n).differentiable (by simp) x)] + simp only [sum_apply, Finset.sum_apply] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro n _ + exact (planar_divergence_trace (hF n) x).symm + +theorem detectorDriftTerm_divergence {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (C L n : ℕ) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (fun y => detectorDriftTerm V C L n (t, y)) x = 0 := by + have hs : ContDiff ℝ ∞ (V (detectorPhase C L n t)) := + hV.comp (contDiff_const.prodMk contDiff_id) + have h := divergence_scalar_product hs + (contDiff_const (c := detectorSpeed C L n t)) x + simpa only [detectorDriftTerm, hdiv, mul_zero, fderiv_const_apply, zero_apply, + add_zero] using h + +theorem detectorDrift_divergence {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (C L : ℕ) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (detectorDrift V C L t) x = 0 := by + obtain ⟨N, hN⟩ := detectorBlockSum_local (detectorDriftTerm V C L) + (detectorDriftTerm_before V C L) (t, x) + have he : detectorDrift V C L t =ᶠ[𝓝 x] + fun y => ∑ n ∈ Finset.range N, detectorDriftTerm V C L n (t, y) := + hN.comp_tendsto ((continuous_const.prodMk continuous_id).tendsto x) + have hF (n : ℕ) : ContDiff ℝ ∞ (fun y => detectorDriftTerm V C L n (t, y)) := + (detectorDriftTerm_smooth hV C L n).comp (contDiff_const.prodMk contDiff_id) + have hdt : ContDiff ℝ ∞ (detectorDrift V C L t) := + (detectorDrift_smooth hV C L).comp (contDiff_const.prodMk contDiff_id) + rw [planar_divergence_congr hdt + (ContDiff.sum (fun n _ => hF n)) he, planar_divergence_sum N _ hF] + exact Finset.sum_eq_zero (fun n _ => detectorDriftTerm_divergence hV hdiv C L n t x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d89454266d3a9fe31907f25adc8f13152f32cc3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorExpressions.lean @@ -0,0 +1,126 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedResidual +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorClockExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FieldReindex +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPerturbations +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid + +namespace OAI + +/-! Finite expressions for an individual prescribed detector block. +The processor and bump are sampled by explicit rational clock profiles. -/ + +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped BigOperators + +def bumpExpression (b : ℚ) : FieldExpr := + .mul (.atom 1 (.cutoff 1 (1 / 4 - b) (1 / 4 - b / 2) (1 / 4 + b / 2) (1 / 4 + b))) + (.atom 2 (.cutoff 1 (1 / 4 - b) (1 / 4 - b / 2) (1 / 4 + b / 2) (1 / 4 + b))) + +theorem bumpExpression_valid {b : ℚ} (hb : 0 < b) : (bumpExpression b).Valid := by + constructor <;> exact PeriodicExpr.cutoff_valid (by norm_num) (by linarith) (by linarith) + +theorem bumpExpression_val (b : ℚ) (y : SpaceTime) : + (bumpExpression b).val y = detectorBump b (horizontal y.2) := by + simp only [bumpExpression, FieldExpr.val, PeriodicExpr.cutoff_val, + Rat.cast_sub, Rat.cast_add, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + rfl + +def processorComponent (H : FieldExpr) (j : Fin 2) : FieldExpr := + ((SpatialExpression.suspensionCode H) j.castSucc).reindex timeHeightSwap + +theorem processorComponent_valid {H : FieldExpr} (hH : H.Valid) (j : Fin 2) : + (processorComponent H j).Valid := + FieldExpr.valid_reindex (SpatialExpression.suspensionCode_valid hH j.castSucc) _ + +theorem processorComponent_val {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (j : Fin 2) (y : SpaceTime) : + (processorComponent H j).val y = planarSlice H y.1 (horizontal y.2) j := by + rw [processorComponent, FieldExpr.val_timeHeightSwap, planarSlice_eq_horizontal hH] + have h := congrFun (congrFun (SpatialExpression.suspensionCode_val hH hT) + (y.2 2, atHeight (horizontal y.2) y.1)) j.castSucc + fin_cases j <;> exact h + +def sourceTermExpression (C L n : ℕ) : ClockedExpr := + .mul (.profile (injectionExpression C L n).diff) + (.field (.const 0) (bumpExpression (width L n))) + +theorem sourceTermExpression_valid (C L n : ℕ) : + (sourceTermExpression C L n).Valid := + ⟨trivial, bumpExpression_valid (width_pos L n)⟩ + +theorem sourceTermExpression_val (C L n : ℕ) (y : SpaceTime) : + (sourceTermExpression C L n).val y = detectorSourceTerm C L n (y.1, horizontal y.2) := by + simp only [sourceTermExpression, ClockedExpr.val, injectionExpression_diff_val, + bumpExpression_val, clockedPoint] + rfl + +def driftComponentExpression (H : FieldExpr) (C L n : ℕ) (j : Fin 2) : ClockedExpr := + .mul (.profile (phaseExpression C L n).diff) + (.field (phaseExpression C L n) (processorComponent H j)) + +theorem driftComponentExpression_valid {H : FieldExpr} (hH : H.Valid) + (C L n : ℕ) (j : Fin 2) : (driftComponentExpression H C L n j).Valid := + ⟨trivial, processorComponent_valid hH j⟩ + +theorem driftComponentExpression_val {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (C L n : ℕ) (j : Fin 2) (y : SpaceTime) : + (driftComponentExpression H C L n j).val y = + detectorDriftTerm (planarSlice H) C L n (y.1, horizontal y.2) j := by + simp only [driftComponentExpression, ClockedExpr.val, phaseExpression_diff_val, + processorComponent_val hH hT, clockedPoint, phaseExpression_val] + rfl + +def driftTermExpression (H : FieldExpr) (C L n : ℕ) : ClockedVector := + ![driftComponentExpression H C L n 0, driftComponentExpression H C L n 1, .const 0] + +theorem driftTermExpression_valid {H : FieldExpr} (hH : H.Valid) (C L n : ℕ) : + (driftTermExpression H C L n).Valid := by + intro j + fin_cases j + · exact driftComponentExpression_valid hH C L n 0 + · exact driftComponentExpression_valid hH C L n 1 + · trivial + +theorem driftTermExpression_val {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (C L n : ℕ) (y : SpaceTime) : + (driftTermExpression H C L n).val y = + triangularLift (fun x => detectorDriftTerm (planarSlice H) C L n (y.1, x)) + (fun _ => 0) y.2 := by + rw [triangularLift_eq] + ext j + fin_cases j + · exact driftComponentExpression_val hH hT C L n 0 y + · exact driftComponentExpression_val hH hT C L n 1 y + · change (ClockedExpr.const 0).val y = 0 + simp only [ClockedExpr.val, Rat.cast_zero] + +def sourcePrefixExpression (C L N : ℕ) : ClockedExpr := + ClockedExpr.sum (List.ofFn (fun n : Fin N => sourceTermExpression C L n)) + +def driftPrefixExpression (H : FieldExpr) (C L N : ℕ) : ClockedVector := fun j => + ClockedExpr.sum (List.ofFn (fun n : Fin N => driftTermExpression H C L n j)) + +theorem sourcePrefixExpression_valid (C L N : ℕ) : (sourcePrefixExpression C L N).Valid := + ClockedExpr.sum_ofFn_valid _ (fun _ => sourceTermExpression_valid C L _) + +theorem driftPrefixExpression_valid {H : FieldExpr} (hH : H.Valid) (C L N : ℕ) : + (driftPrefixExpression H C L N).Valid := + fun j => ClockedExpr.sum_ofFn_valid _ (fun _ => driftTermExpression_valid hH C L _ j) + +theorem sourcePrefixExpression_val (C L N : ℕ) (y : SpaceTime) : + (sourcePrefixExpression C L N).val y = + ∑ n : Fin N, detectorSourceTerm C L n (y.1, horizontal y.2) := by + rw [sourcePrefixExpression, ClockedExpr.sum_ofFn_val] + simp only [sourceTermExpression_val] + +theorem driftPrefixExpression_val (H : FieldExpr) (C L N : ℕ) (y : SpaceTime) : + (driftPrefixExpression H C L N).val y = + ∑ n : Fin N, (driftTermExpression H C L n).val y := by + ext j + simp only [driftPrefixExpression, ClockedVector.val, ClockedExpr.sum_ofFn_val, + Finset.sum_apply] + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad782c9e4eaed6415d549474f4e3f50e0555edc9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorFluid.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorScalar +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorDivergence +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteTimeUniqueness + +namespace OAI + +/-! The explicit source program has a unique classical fluid realization. +The force is fixed before choosing the scalar solution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def detectorForce (V : ℝ → Plane → Plane) (C L : ℕ) : Velocity := + triangularForce 1 (detectorDrift V C L) (detectorSource C L) + +theorem detectorFluid_exists (hE : TorusScalarExistence) + {V : ℝ → Plane → Plane} (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ t, PlanePeriodic (V t)) + (hd : ∀ t x, PlanarHamiltonian.divergence (V t) x = 0) (C L : ℕ) : + ∃ w : ℝ → Plane → ℝ, + GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) w (fun _ => 0) ∧ + ContDiff ℝ ∞ (Function.uncurry w) ∧ + (∀ t x, 0 ≤ w t x) ∧ + IsClassicalSolution 1 1 (detectorForce V C L) + (triangularVelocity (detectorDrift V C L) w) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 1 (detectorForce V C L) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (detectorDrift V C L) w (t, x) ∧ p (t, x) = 0) := by + obtain ⟨w, hs, hw, hwp, hw₀, _⟩ := detectorScalar_exists hE hV hp C L + have hu := triangularVelocity_solution (detectorDrift_smooth hV C L) hw hs + (detectorDrift_periodic hp C L) hwp (detectorDrift_divergence hV hd C L) + (detectorDrift_before V C L le_rfl) + exact ⟨w, hs, hw, hw₀, hu, + finite_time_classical_unique (by norm_num) (by norm_num) hu⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b28c2475ee9327a32be2c8ec42332e398356419 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceProgram.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorPrefixExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce + +namespace OAI + +/-! The evaluator selects a finite clocked program from the zeroth time +approximation. Locality of the residual certifies every mixed derivative. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem triangularVelocity_congr_germ {a b : ℝ → Plane → Plane} + {g h : ℝ → Plane → ℝ} {y : SpaceTime} + (ha : Function.uncurry a =ᶠ[𝓝 (y.1, horizontalLinear y.2)] Function.uncurry b) + (hg : Function.uncurry g =ᶠ[𝓝 (y.1, horizontalLinear y.2)] Function.uncurry h) : + triangularVelocity a g =ᶠ[𝓝 y] triangularVelocity b h := by + have hc : Continuous (fun z : SpaceTime => (z.1, horizontalLinear z.2)) := + continuous_fst.prodMk (horizontalLinear.continuous.comp continuous_snd) + have ha' := ha.comp_tendsto hc.continuousAt + have hg' := hg.comp_tendsto hc.continuousAt + filter_upwards [ha', hg'] with z hz₁ hz₂ + change a z.1 (horizontalLinear z.2) = b z.1 (horizontalLinear z.2) at hz₁ + change g z.1 (horizontalLinear z.2) = h z.1 (horizontalLinear z.2) at hz₂ + simp only [triangularVelocity, triangularLift, hz₁, hz₂] + +theorem detectorForce_prefix_germ {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L N : ℕ) (y : SpaceTime) (hN : y.1 + 1 ≤ (N : ℝ)) : + detectorForce (planarSlice H) C L =ᶠ[𝓝 y] (forcePrefixExpression H C L N).val := by + have ha := detectorDrift_prefix_germ (planarSlice H) C L N + (y.1, horizontalLinear y.2) hN + have hh := detectorSource_prefix_germ C L N (y.1, horizontalLinear y.2) hN + have hzero : Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : ℝ)) =ᶠ[ + 𝓝 (y.1, horizontalLinear y.2)] Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : ℝ)) := + Filter.EventuallyEq.rfl + have hazero : Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : Plane)) =ᶠ[ + 𝓝 (y.1, horizontalLinear y.2)] Function.uncurry (fun _ : ℝ => fun _ : Plane => (0 : Plane)) := + Filter.EventuallyEq.rfl + rw [forcePrefixExpression_value hH hT, detectorForce, + triangularForce_eq_residual (detectorDrift_smooth hV C L)] + exact (residual_eventuallyEq (triangularVelocity_congr_germ ha hzero) 1).add + (triangularVelocity_congr_germ hazero hh) + +def forcePrefixLength (q : ℚ) : ℕ := ⌈q + 2⌉₊ + +theorem forcePrefixLength_bound {t : ℝ} (q : ℚ) (hq : |t - (q : ℝ)| ≤ 1) : + t + 1 ≤ (forcePrefixLength q : ℝ) := by + have hc : (q : ℝ) + 2 ≤ (forcePrefixLength q : ℝ) := by + exact_mod_cast (Nat.le_ceil (q + 2)) + linarith [(abs_le.mp hq).2] + +def evaluateDetectorForce (H : FieldExpr) (hH : H.Valid) (C L : ℕ) + (α : List (Fin 4)) (a : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + let N := forcePrefixLength (a 0).1 + (forcePrefixExpression H C L N).evaluate (forcePrefixExpression_valid hH C L N) + α a ε hε + +theorem evaluateDetectorForce_spec {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → RationalSpaceTime) + {y : SpaceTime} (ha : IsFastName a y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (detectorForce (planarSlice H) C L) α y - + rationalVector (evaluateDetectorForce H hH C L α a ε hε)‖ ≤ (ε : ℝ) := by + have ht : |y.1 - ((a 0).1 : ℝ)| ≤ 1 := by + have h := (norm_fst_le (y - rationalPoint (a 0))).trans (ha 0) + simpa only [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, + errorTolerance, pow_zero, inv_one] using h + have hg := detectorForce_prefix_germ hH hT hV C L (forcePrefixLength (a 0).1) y + (forcePrefixLength_bound _ ht) + rw [(mixedDerivative_eventuallyEq hg α).self_of_nhds] + exact ClockedVector.evaluate_spec (forcePrefixExpression_valid hH C L _) α a ha ε hε + +def detectorForceBound (H : FieldExpr) (C L : ℕ) (α : List (Fin 4)) (T : ℚ) : ℚ := + (forcePrefixExpression H C L (forcePrefixLength T)).bound α (|T| + 2) + +theorem detectorForceBound_nonneg (H : FieldExpr) (C L : ℕ) + (α : List (Fin 4)) (T : ℚ) : 0 ≤ detectorForceBound H C L α T := + ClockedVector.bound_nonneg _ _ _ + +theorem detectorForceBound_spec {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (T : ℚ) {y : SpaceTime} + (ht : 0 ≤ y.1) (hT' : y.1 ≤ (T : ℝ)) : + ‖mixedDerivative (detectorForce (planarSlice H) C L) α y‖ ≤ + (detectorForceBound H C L α T : ℝ) := by + have hc : (T : ℝ) + 2 ≤ (forcePrefixLength T : ℝ) := by + exact_mod_cast (Nat.le_ceil (T + 2)) + have hN : y.1 + 1 ≤ (forcePrefixLength T : ℝ) := by linarith + have hg := detectorForce_prefix_germ hH hT hV C L (forcePrefixLength T) y hN + rw [(mixedDerivative_eventuallyEq hg α).self_of_nhds] + apply ClockedVector.val_bound (forcePrefixExpression_valid hH C L _) α (|T| + 2) + rw [abs_of_nonneg ht, Rat.cast_add, Rat.cast_abs, Rat.cast_ofNat, + abs_of_nonneg (by positivity)] + exact hT'.trans ((le_abs_self (T : ℝ)).trans (by linarith)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceScaling.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae3f02774081ea0e9a383de7b5be1fd07d71aeb3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceScaling.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.VelocityTimeScale + +namespace OAI + +/-! Exact anisotropic scaling of the prescribed force. The horizontal +equation has two powers of viscosity and the scalar source has one. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +theorem residual_viscosity_timeScale {V : Velocity} (hV : ContDiff ℝ ∞ V) (ν : ℝ) : + residual ν (ν • velocityTimeScale ν V) = + ν ^ 2 • velocityTimeScale ν (residual 1 V) := by + funext y + have hτ : HasDerivAt (fun s : ℝ => ν * s) ν y.1 := by + simpa only [mul_one, id_eq] using (hasDerivAt_id y.1).const_mul ν + have ht : DifferentiableAt ℝ (fun s => V (s, y.2)) (ν * y.1) := + (hV.comp (contDiff_id.prodMk contDiff_const)).differentiable (by simp) _ + have hr := residual_reparametrization ν hτ (hasDerivAt_const y.1 ν) y.2 ht + change residual ν (reparametrizedVelocity (fun s => ν * s) (fun _ => ν) V) y = _ + rw [hr] + simp only [zero_smul, zero_sub, residual, velocityTimeScale, Function.comp_apply, + scaledTimeLinear_apply, Pi.smul_apply, one_smul, smul_sub, smul_add, smul_smul, pow_two] + module + +namespace VelocityDetector + +theorem viscositySource_smooth {h : ℝ → Plane → ℝ} + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (ν : ℝ) : + ContDiff ℝ ∞ (Function.uncurry (viscositySource ν h)) := + contDiff_const.mul (viscosityScalar_smooth hh ν) + +theorem viscositySource_periodic {h : ℝ → Plane → ℝ} + (hp : ∀ t, PlanePeriodic (h t)) (ν : ℝ) : + ∀ t, PlanePeriodic (viscositySource ν h t) := by + intro t x k + simp only [viscositySource, hp (ν * t) x k] + +def forceViscosityLinear (ν : ℝ) : Space →L[ℝ] Space := + ContinuousLinearMap.pi (fun j => + (ν ^ (if j = 2 then 1 else 2)) • ContinuousLinearMap.proj j) + +theorem forceViscosityLinear_apply (ν : ℝ) (v : Space) (j : Fin 3) : + forceViscosityLinear ν v j = ν ^ (if j = 2 then 1 else 2) * v j := rfl + +theorem triangularForce_viscosity {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (h : ℝ → Plane → ℝ) (ν : ℝ) : + triangularForce ν (viscosityDrift ν a) (viscositySource ν h) = + forceViscosityLinear ν ∘ velocityTimeScale ν (triangularForce 1 a h) := by + have hv : ContDiff ℝ ∞ (triangularVelocity a (fun _ _ => 0)) := + triangularVelocity_smooth ha contDiff_const + have he : triangularVelocity (viscosityDrift ν a) (fun _ _ => 0) = + ν • velocityTimeScale ν (triangularVelocity a (fun _ _ => 0)) := by + funext y + simp only [triangularVelocity, triangularLift, viscosityDrift, velocityTimeScale, + Function.comp_apply, scaledTimeLinear_apply, zero_smul, add_zero, + Pi.smul_apply, map_smul] + rw [triangularForce_eq_residual (viscosityDrift_smooth ha ν), he, + residual_viscosity_timeScale hv ν] + funext y + have hh (j : Fin 3) : + residual 1 (triangularVelocity a (fun _ _ => 0)) (ν * y.1, y.2) j = + planeInclusion (planarResidual 1 a (ν * y.1) (horizontalLinear y.2)) j := by + have heq := congrFun (congrFun + (triangularForce_eq_residual ha (fun _ _ => 0) 1) (ν * y.1, y.2)) j + simpa only [triangularForce, triangularVelocity, triangularLift, + zero_smul, add_zero, map_zero, zero_add, Pi.add_apply, Pi.zero_apply] using heq.symm + ext j + simp only [Pi.add_apply, Pi.smul_apply, velocityTimeScale, Function.comp_apply, + scaledTimeLinear_apply, forceViscosityLinear_apply, triangularForce, + triangularVelocity, triangularLift, viscositySource, smul_eq_mul] + rw [hh] + fin_cases j <;> simp [planeInclusion, basis] + +theorem detectorViscosityForce_eq (V : ℝ → Plane → Plane) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L : ℕ) (ν : ℝ) : + detectorViscosityForce V C L ν = + forceViscosityLinear ν ∘ velocityTimeScale ν (detectorForce V C L) := + triangularForce_viscosity (detectorDrift_smooth hV C L) (detectorSource C L) ν + +theorem mixedDerivative_detectorViscosityForce (V : ℝ → Plane → Plane) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L : ℕ) (ν : ℝ) + (α : List (Fin 4)) (y : SpaceTime) (j : Fin 3) : + mixedDerivative (detectorViscosityForce V C L ν) α y j = + ν ^ (α.count 0 + if j = 2 then 1 else 2) * + mixedDerivative (detectorForce V C L) α (ν * y.1, y.2) j := by + have hF : ContDiff ℝ ∞ (detectorForce V C L) := + triangularForce_smooth (detectorDrift_smooth hV C L) (detectorSource_smooth C L) 1 + rw [detectorViscosityForce_eq V hV C L ν, + mixedDerivative_clm (velocityTimeScale_smooth hF ν), + mixedDerivative_velocityTimeScale hF] + simp only [Function.comp_apply, forceViscosityLinear_apply, Pi.smul_apply, + smul_eq_mul, velocityTimeScale, scaledTimeLinear_apply, pow_add] + ring + +end VelocityDetector +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6183d042a4ee001092d0c86f10936d0c6a6f93f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorForceSupport.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupEffective + +namespace OAI + +/-! Locality of the prescribed force: where the planar processor and every +injection vanish on a spatial neighborhood, all terms of the force vanish. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem triangularForce_zero_of_neighborhood {a : ℝ → Plane → Plane} + {h : ℝ → Plane → ℝ} (ha : ContDiff ℝ ∞ (Function.uncurry a)) + {U : Set Plane} (hU : IsOpen U) + (hz : ∀ t x, x ∈ U → a t x = 0 ∧ h t x = 0) + (ν t : ℝ) {x : Space} (hx : horizontalLinear x ∈ U) : + triangularForce ν a h (t, x) = 0 := by + have hn : ∀ᶠ y : SpaceTime in 𝓝 (t, x), horizontalLinear y.2 ∈ U := + (hU.preimage (horizontalLinear.continuous.comp continuous_snd)).mem_nhds hx + have he : triangularVelocity a (fun _ _ => 0) =ᶠ[𝓝 (t, x)] + (fun _ : SpaceTime => (0 : Space)) := by + filter_upwards [hn] with y hy + simp only [triangularVelocity, triangularLift, (hz y.1 _ hy).1, + map_zero, zero_smul, add_zero] + rw [triangularForce_eq_residual ha] + change residual ν (triangularVelocity a (fun _ _ => 0)) (t, x) + + triangularVelocity (fun _ _ => 0) h (t, x) = 0 + rw [residual_congr_germ he ν, residual_eq_force_add] + simp only [Pi.add_apply] + rw [force_eq_mixed contDiff_const, convectiveField_eq_mixed contDiff_const] + simp only [mixedDerivative_zero, Finset.sum_const_zero, smul_zero, + sub_zero, add_zero, triangularVelocity, triangularLift, map_zero, + (hz t _ hx).2, zero_smul] + +theorem detector_coefficients_zero_of_neighborhood {V : ℝ → Plane → Plane} + (C L : ℕ) {U : Set Plane} + (hV : ∀ s x, x ∈ U → V s x = 0) + (hb : ∀ n x, x ∈ U → detectorBump (width L n : ℝ) x = 0) + (t : ℝ) {x : Plane} (hx : x ∈ U) : + detectorDrift V C L t x = 0 ∧ detectorSource C L t x = 0 := by + constructor + · change (∑' n, detectorDriftTerm V C L n (t, x)) = 0 + have he (n : ℕ) : detectorDriftTerm V C L n (t, x) = 0 := by + simp only [detectorDriftTerm, hV _ x hx, smul_zero] + simp only [he, tsum_zero] + · change (∑' n, detectorSourceTerm C L n (t, x)) = 0 + have he (n : ℕ) : detectorSourceTerm C L n (t, x) = 0 := by + simp only [detectorSourceTerm, hb n x hx, mul_zero] + simp only [he, tsum_zero] + +theorem detectorForce_zero_of_neighborhood {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L : ℕ) + {U : Set Plane} (hU : IsOpen U) + (hVz : ∀ s x, x ∈ U → V s x = 0) + (hb : ∀ n x, x ∈ U → detectorBump (width L n : ℝ) x = 0) + (t : ℝ) {x : Space} (hx : horizontalLinear x ∈ U) : + detectorForce V C L (t, x) = 0 := + triangularForce_zero_of_neighborhood (detectorDrift_smooth hV C L) hU + (fun s _ hy => detector_coefficients_zero_of_neighborhood C L hVz hb s hy) 1 t hx + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorInjection.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorInjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..d76ef0e8173588d923331834e3c4db2a763b3c82 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorInjection.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBump +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBlockSum +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorScales + +namespace OAI + +/-! The scalar source installs every test block without simulating the +machine. Its locally finite sum is smooth, periodic, and nonnegative. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +theorem detector_width_small (L n : ℕ) : (width L n : ℝ) ≤ 1 / 16 := by + have hw := width_le L n + have hp : (1 / 2 : ℚ) ^ (n + 1) ≤ 1 := + pow_le_one₀ (by norm_num) (by norm_num) + have h : width L n ≤ 1 / 16 := by nlinarith + have hh := (Rat.cast_le (K := ℝ)).mpr h + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hh + exact hh + +def detectorSourceTerm (C L n : ℕ) (y : ℝ × Plane) : ℝ := + (duration C L n : ℝ)⁻¹ * + smoothPulse 0 1 ((y.1 - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) * + detectorBump (width L n : ℝ) y.2 + +def detectorSource (C L : ℕ) (t : ℝ) (x : Plane) : ℝ := + detectorBlockSum (detectorSourceTerm C L) (t, x) + +theorem detectorSourceTerm_smooth (C L n : ℕ) : + ContDiff ℝ ∞ (detectorSourceTerm C L n) := by + have hb : (0 : ℝ) < width L n := by exact_mod_cast width_pos L n + exact (contDiff_const.mul ((smoothPulse_smooth 0 1).comp + ((contDiff_fst.sub contDiff_const).div_const _))).mul + ((detectorBump_smooth hb).comp contDiff_snd) + +theorem detectorSourceTerm_before (C L n : ℕ) (y : ℝ × Plane) + (hy : y.1 < 2 * ((n : ℝ) + 1)) : detectorSourceTerm C L n y = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have harg : (y.1 - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ) ≤ 0 := by + exact div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + simp only [detectorSourceTerm, smoothPulse_before (by norm_num : (0 : ℝ) < 1) harg, + mul_zero, zero_mul] + +theorem detectorSourceTerm_nonnegative (C L n : ℕ) (y : ℝ × Plane) : + 0 ≤ detectorSourceTerm C L n y := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hb : (0 : ℝ) < width L n := by exact_mod_cast width_pos L n + exact mul_nonneg (mul_nonneg (inv_nonneg.mpr hd.le) + (smoothPulse_nonneg (by norm_num : (0 : ℝ) < 1) _)) + (detectorBump_range hb (detector_width_small L n) y.2).1 + +theorem detectorSource_smooth (C L : ℕ) : + ContDiff ℝ ∞ (Function.uncurry (detectorSource C L)) := + detectorBlockSum_smooth _ (detectorSourceTerm_smooth C L) (detectorSourceTerm_before C L) + +theorem detectorSource_nonnegative (C L : ℕ) (t : ℝ) (x : Plane) : + 0 ≤ detectorSource C L t x := + tsum_nonneg (fun n => detectorSourceTerm_nonnegative C L n (t, x)) + +theorem detectorSource_periodic (C L : ℕ) (t : ℝ) : PlanePeriodic (detectorSource C L t) := by + intro x k + unfold detectorSource detectorBlockSum + apply tsum_congr + intro n + simp only [detectorSourceTerm, detectorBump_periodic (width L n : ℝ) x k] + +theorem detectorSource_before (C L : ℕ) {t : ℝ} (ht : t ≤ 0) (x : Plane) : + detectorSource C L t x = 0 := by + change (∑' n, detectorSourceTerm C L n (t, x)) = 0 + trans (∑' _ : ℕ, (0 : ℝ)) + swap + · exact tsum_zero + apply tsum_congr + intro n + apply detectorSourceTerm_before + change t < 2 * ((n : ℝ) + 1) + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + +theorem detectorSource_before_one (C L : ℕ) {t : ℝ} (ht : t ≤ 1) (x : Plane) : + detectorSource C L t x = 0 := by + change (∑' n, detectorSourceTerm C L n (t, x)) = 0 + trans (∑' _ : ℕ, (0 : ℝ)) + swap + · exact tsum_zero + apply tsum_congr + intro n + apply detectorSourceTerm_before + change t < 2 * ((n : ℝ) + 1) + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMargins.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMargins.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc89b4588fb97ae794a445e14b6e6295e4f6edbd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMargins.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorScales + +namespace OAI + +/-! Numerical margins shared by the two published detector clearances. -/ + +namespace ForcedComputation.VelocityDetector + +theorem massBound_real_small (L : ℕ) : + 0 ≤ (massBound L : ℝ) ∧ (massBound L : ℝ) < 1 / 100000000000 := by + constructor + · exact_mod_cast (massBound_small L).1 + · have h := (Rat.cast_lt (K := ℝ)).mpr (massBound_small L).2 + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at h + exact h + +theorem detector_old_mass_margin (L : ℕ) : + (16 : ℝ) * (massBound L : ℝ) < 1 / 16 := by + have h := (massBound_real_small L).2 + linarith + +theorem detector_wait_margin (L : ℕ) {H : ℝ} (hH : H ≤ 1000000000) : + H * (massBound L : ℝ) + (16 * (massBound L : ℝ) + 1 / 16) < 1 / 2 := by + have hm := massBound_real_small L + have hh := mul_le_mul_of_nonneg_right hH hm.1 + nlinarith + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..077e291818afa677602356b550024df358b55089 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorMass.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorReference +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorDivergence +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassSolution + +namespace OAI + +/-! The detector's actual scalar has the small total mass of the injected +bumps. Incompressible stirring and diffusion make no contribution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +def detectorPartialMass (C L N : ℕ) (t : ℝ) : ℝ := + ∑ n ∈ Finset.range N, detectorInjectionFraction C L n t * + ∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump (width L n : ℝ) x + +theorem detectorPartialMass_continuous (C L N : ℕ) : + Continuous (detectorPartialMass C L N) := by + apply continuous_finsetSum + intro n _ + exact (detectorInjectionFraction_smooth C L n).continuous.mul continuous_const + +theorem detectorPartialMass_hasDerivAt (C L N : ℕ) (t : ℝ) : + HasDerivAt (detectorPartialMass C L N) + (∑ n ∈ Finset.range N, detectorInjectionRate C L n t * + ∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump (width L n : ℝ) x) t := by + have hd := HasDerivAt.sum (u := Finset.range N) (fun n _ => + (detectorInjectionFraction_hasDerivAt C L n t).mul_const + (∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump (width L n : ℝ) x)) + convert hd using 1 + funext s + simp only [Finset.sum_apply, detectorPartialMass] + +theorem detectorPartialMass_zero (C L N : ℕ) : detectorPartialMass C L N 0 = 0 := by + apply Finset.sum_eq_zero + intro n _ + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + have hh : (0 - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + simp only [detectorInjectionFraction, + smoothRamp_before (by norm_num : (0 : ℝ) < 1) hh, zero_mul] + +theorem detectorSource_mass (C L N : ℕ) {t : ℝ} (hN : t + 1 ≤ (N : ℝ)) : + scalarMass (detectorSource C L) t = + ∑ n ∈ Finset.range N, detectorInjectionRate C L n t * + ∫ x in Icc (0 : Plane) (fun _ => 1), detectorBump (width L n : ℝ) x := by + have he (x : Plane) : detectorSource C L t x = + ∑ n ∈ Finset.range N, detectorSourceTerm C L n (t, x) := + (detectorBlockSum_local_of_time_bound _ (detectorSourceTerm_before C L) + (t, x) N hN).eq_of_nhds + unfold scalarMass + simp_rw [he] + rw [integral_finsetSum] + · apply Finset.sum_congr rfl + intro n _ + change (∫ x in Icc (0 : Plane) (fun _ => 1), + detectorInjectionRate C L n t * detectorBump (width L n : ℝ) x) = _ + exact integral_const_mul _ _ + · intro n _ + exact ((detectorSourceTerm_smooth C L n).continuous.comp + (continuous_const.prodMk continuous_id)).integrableOn_Icc + +theorem detectorPartialMass_bound (C L N : ℕ) (t : ℝ) : + detectorPartialMass C L N t ≤ (massBound L : ℝ) := by + calc + _ ≤ ∑ n ∈ Finset.range N, (4 : ℝ) * (width L n : ℝ) ^ 2 := by + apply Finset.sum_le_sum + intro n _ + have hm := detectorBump_mass (by exact_mod_cast width_pos L n) + (detector_width_small L n) + have hθ := smoothRamp_range 0 1 + ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + exact (mul_le_mul_of_nonneg_right hθ.2 hm.1).trans (by simpa using hm.2) + _ ≤ ∑' n : ℕ, (4 : ℝ) * (width L n : ℝ) ^ 2 := + (total_injected_mass L).summable.sum_le_tsum _ (fun _ _ => by positivity) + _ = (massBound L : ℝ) := (total_injected_mass L).tsum_eq + +theorem detector_scalar_mass_bound + {V : ℝ → Plane → Plane} (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (C L : ℕ) {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + {t : ℝ} (ht : 0 ≤ t) : scalarMass w t ≤ (massBound L : ℝ) := by + let N := ⌈t + 1⌉₊ + have hN : t + 1 ≤ (N : ℝ) := Nat.le_ceil _ + have hd (s : ℝ) (hs' : s ∈ Ico (0 : ℝ) t) : + HasDerivAt (scalarMass w) (scalarMass (detectorSource C L) s) s := + hs.mass_hasDerivAt hw + (fun s => (detectorDrift_smooth hV C L).comp (contDiff_const.prodMk contDiff_id)) + (detectorDrift_periodic hp C L) (detectorDrift_divergence hV hdiv C L) + (fun s => (detectorSource_smooth C L).continuous.comp + (continuous_const.prodMk continuous_id)) hs'.1 + have hg (s : ℝ) (hs' : s ∈ Ico (0 : ℝ) t) : + HasDerivAt (detectorPartialMass C L N) (scalarMass (detectorSource C L) s) s := by + rw [detectorSource_mass C L N (by linarith [hs'.2])] + exact detectorPartialMass_hasDerivAt C L N s + have hi : scalarMass w 0 = detectorPartialMass C L N 0 := by + rw [detectorPartialMass_zero] + simp only [scalarMass, (hs 0 le_rfl).initial, integral_zero] + have he := eq_of_has_deriv_right_eq + (fun s hs' => (hd s hs').hasDerivWithinAt) + (fun s hs' => (hg s hs').hasDerivWithinAt) + (scalarMass_continuous hw.continuous).continuousOn + (detectorPartialMass_continuous C L N).continuousOn hi t ⟨ht, le_rfl⟩ + rw [he] + exact detectorPartialMass_bound C L N t + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorNegative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorNegative.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2f8664233b87a36854d9e941dd9a78039d79cca --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorNegative.lean @@ -0,0 +1,186 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorPositive +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorSeparation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorOldMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.HeatComparison + +namespace OAI + +/-! The full-orbit clearance excludes detection on both the stirring +interval and the heat-only interval, hence at every nonnegative time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +attribute [local irreducible] detectorReference + +theorem scalar_slice_smooth {f : ℝ → Plane → ℝ} + (hf : ContDiff ℝ ∞ (Function.uncurry f)) (S : ℝ) : ContDiff ℝ ∞ (f S) := by + exact hf.comp (show ContDiff ℝ ∞ (fun y : Plane => (S, y)) from + contDiff_const.prodMk contDiff_id) + +theorem scalar_heat_wait_comparison (hK : TorusHeatInput) + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 a h w (fun _ => 0)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + {S T : ℝ} (hS : 0 ≤ S) (hT : 0 ≤ T) + (hz : ∀ r ∈ Icc (0 : ℝ) T, ∀ y, a (S + r) y = 0 ∧ h (S + r) y = 0) + {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) (hgp : PlanePeriodic g) + {E : ℝ} (he : ∀ y, |w S y - g y| ≤ E) + {t : ℝ} (ht : t - S ∈ Icc (0 : ℝ) T) (x : Plane) : + |w t x - torusHeatEvolution g (t - S) x| ≤ E := by + have hheat := hs.heat_window hK hw hS hT + (fun r hr => funext (fun y => (hz r hr y).1)) + (fun r hr => funext (fun y => (hz r hr y).2)) (t - S) ht + rw [show S + (t - S) = t by ring] at hheat + have hws : ContDiff ℝ ∞ (w S) := hw.comp (contDiff_const.prodMk contDiff_id) + have hc := torusHeatEvolution_stability hK hws hg + ((hs S hS).periodic S ⟨hS, le_rfl⟩) hgp he ht.1 x + rw [congrFun hheat x] + exact hc + +section Observation +variable {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hK : TorusHeatInput) (hΨ : IsPlanarTransition V Ψ) (hv : PlanarVariations V Ψ) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L : ℕ) (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hlap : ∀ n t, t ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)) → ∀ x, + |scalarLaplacian (detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t)) x| ≤ + (laplacianBound C L n : ℝ)) + {E : Set Plane} + (hfar : ∀ s, 0 ≤ s → ∀ x ∈ E, + 1 / 16 ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) + +include hK hΨ hv hV hp hdiv hback h₁ hs hw hlap hfar + +theorem detector_negative_burst (n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1)) + (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ))) {x : Plane} (hx : x ∈ E) : + w t x < 1 / 2 := by + have hi := detector_scalar_at_start_bound hK hV hp hdiv C L hs hw n + have hτ : t - 2 * ((n : ℝ) + 1) ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)) := + ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have he := detectorBurst_comparison hΨ hp hback C L n hs hw (hlap n) hi + (t - 2 * ((n : ℝ) + 1)) hτ x + rw [show 2 * ((n : ℝ) + 1) + (t - 2 * ((n : ℝ) + 1)) = t by ring] at he + have hz := detectorReference_zero_on_target hΨ hv + (fun s => hV.comp (contDiff_const.prodMk contDiff_id)) hp C L n h₁ hfar t hx + rw [hz, sub_zero] at he + have hm := detector_old_mass_margin L + have hu := (abs_lt.mp he).2 + linarith + +omit hv h₁ hfar in +theorem detector_error_at_burst_end (n : ℕ) (y : Plane) : + |w (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) y - + detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) y| ≤ + 16 * (massBound L : ℝ) + 1 / 16 := by + have hi := detector_scalar_at_start_bound hK hV hp hdiv C L hs hw n + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + exact (detectorBurst_comparison hΨ hp hback C L n hs hw (hlap n) hi + (2 * (duration C L n : ℝ)) ⟨by positivity, le_rfl⟩ y).le + +omit hv h₁ hfar in +theorem detector_wait_error (n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) + (2 * ((n : ℝ) + 2))) (x : Plane) : + |w t x - torusHeatEvolution + (detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ))) + (t - (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ))) x| ≤ + 16 * (massBound L : ℝ) + 1 / 16 := by + let S : ℝ := 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) + let T : ℝ := 2 - 2 * (duration C L n : ℝ) + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hδ := detector_duration_real_le C L n + have hS : 0 ≤ S := by dsimp only [S]; positivity + have hT : 0 ≤ T := by dsimp only [T]; linarith only [hδ] + have hτ : t - S ∈ Icc (0 : ℝ) T := by + constructor + · dsimp only [S]; linarith only [ht.1] + · dsimp only [S, T]; linarith only [ht.2] + have hz (r : ℝ) (hr : r ∈ Icc (0 : ℝ) T) (y : Plane) : + detectorDrift V C L (S + r) y = 0 ∧ detectorSource C L (S + r) y = 0 := by + apply detector_wait_coefficients_zero V C L n + constructor + · dsimp only [S]; linarith only [hr.1] + · dsimp only [S, T] at hr ⊢; linarith only [hr.2] + have he (y : Plane) : |w S y - detectorReference Ψ C L n S y| ≤ + 16 * (massBound L : ℝ) + 1 / 16 := + detector_error_at_burst_end hK hΨ hV hp hdiv hback C L hs hw hlap n y + have hgs : ContDiff ℝ ∞ (detectorReference Ψ C L n S) := + scalar_slice_smooth (detectorReference_smooth hback C L n) S + exact scalar_heat_wait_comparison hK + (a := detectorDrift V C L) (h := detectorSource C L) (w := w) + hs hw (S := S) (T := T) hS hT hz + (g := detectorReference Ψ C L n S) hgs + (detectorReference_periodic hΨ hp C L n S) he hτ x + +omit hs hw hlap in +theorem detector_reference_heat_small (n : ℕ) (S : ℝ) {τ : ℝ} (hτ : 0 < τ) + {x : Plane} (hx : x ∈ E) : + torusHeatEvolution (detectorReference Ψ C L n S) τ x ≤ + 1000000000 * (massBound L : ℝ) := by + have hr := detectorReference_heat_bound hK hΨ hv hV hp hdiv hback C L n h₁ hfar S hτ hx + have hm : 4 * (width L n : ℝ) ^ 2 ≤ (massBound L : ℝ) := by + have hsum := (total_injected_mass L).summable.sum_le_tsum {n} (fun _ _ => by positivity) + simp only [Finset.sum_singleton] at hsum + exact hsum.trans_eq (total_injected_mass L).tsum_eq + exact hr.trans (mul_le_mul_of_nonneg_left hm (by norm_num : (0 : ℝ) ≤ 1000000000)) + +theorem detector_negative_wait (n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) + (2 * ((n : ℝ) + 2))) {x : Plane} (hx : x ∈ E) : w t x < 1 / 2 := by + let S : ℝ := 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) + by_cases heq : t = S + · subst t + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + exact detector_negative_burst hK hΨ hv hV hp hdiv hback C L h₁ hs hw hlap hfar n + ⟨by change 2 * ((n : ℝ) + 1) ≤ 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) + linarith only [hd], le_rfl⟩ hx + have hτ : 0 < t - S := sub_pos.mpr (lt_of_le_of_ne ht.1 (Ne.symm heq)) + have hc := detector_wait_error hK hΨ hV hp hdiv hback C L hs hw hlap n ht x + have hr := detector_reference_heat_small hK hΨ hv hV hp hdiv hback C L h₁ hfar n S hτ hx + have hu := (abs_le.mp hc).2 + have hmarg := detector_wait_margin L (H := (1000000000 : ℝ)) le_rfl + change torusHeatEvolution (detectorReference Ψ C L n S) (t - S) x ≤ _ at hr + change w t x - torusHeatEvolution (detectorReference Ψ C L n S) (t - S) x ≤ _ at hu + linarith only [hu, hr, hmarg] + +theorem detector_negative_all_time {t : ℝ} (ht : 0 ≤ t) {x : Plane} (hx : x ∈ E) : + w t x < 1 / 2 := by + by_cases hsmall : t ≤ 2 + · rw [detector_scalar_before_two C L hs ⟨ht, hsmall⟩ x] + norm_num + have htwo : 2 ≤ t := (lt_of_not_ge hsmall).le + let k : ℕ := ⌊t / 2⌋₊ + have hk : 1 ≤ k := by + apply Nat.le_floor + norm_num only [Nat.cast_one] + linarith + let n := k - 1 + have hnk : n + 1 = k := Nat.sub_add_cancel hk + have hncast : (n : ℝ) + 1 = (k : ℝ) := by exact_mod_cast hnk + have hlo := Nat.floor_le (by positivity : 0 ≤ t / 2) + have hhi := Nat.lt_floor_add_one (t / 2) + have hblock : t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2)) := by + change (k : ℝ) ≤ t / 2 at hlo + change t / 2 < (k : ℝ) + 1 at hhi + constructor <;> linarith + by_cases hb : t ≤ 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) + · exact detector_negative_burst hK hΨ hv hV hp hdiv hback C L h₁ hs hw hlap hfar n + ⟨hblock.1, hb⟩ hx + · exact detector_negative_wait hK hΨ hv hV hp hdiv hback C L h₁ hs hw hlap hfar n + ⟨(lt_of_not_ge hb).le, hblock.2⟩ hx + +end Observation +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad61022e1911c40a01c20ca25cd66122cf763dea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorObservation.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorNegative +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce + +namespace OAI + +/-! The analytic detector assembly. Published scalar existence and heat +inputs are explicit, as are the smooth-dependence inputs for the given +planar flow. The quantitative comparison and observation are proved here. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detector_observation (hE : TorusScalarExistence) (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (hv : PlanarVariations V Ψ) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) + (E : Set Plane) : + ∃ w : ℝ → Plane → ℝ, + GlobalTorusScalarSolution 1 (detectorDrift V detectorBumpDerivativeBound L) + (detectorSource detectorBumpDerivativeBound L) w (fun _ => 0) ∧ + ContDiff ℝ ∞ (Function.uncurry w) ∧ + (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + IsClassicalSolution 1 1 (detectorForce V detectorBumpDerivativeBound L) + (triangularVelocity (detectorDrift V detectorBumpDerivativeBound L) w) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 1 (detectorForce V detectorBumpDerivativeBound L) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (detectorDrift V detectorBumpDerivativeBound L) + w (t, x) ∧ p (t, x) = 0) ∧ + (∀ k : ℕ, Ψ 0 k ![1 / 4, 1 / 4] ∈ E → + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, 1 / 2 < w t x) ∧ + ((∀ s, 0 ≤ s → ∀ x ∈ E, 1 / 16 ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) → + ∀ t, 0 ≤ t → ∀ x ∈ E, w t x < 1 / 2) := by + obtain ⟨w, hs, hw, hn, hfluid, huniq⟩ := + detectorFluid_exists hE hV hp hdiv detectorBumpDerivativeBound L + have hlap (n : ℕ) (t : ℝ) (_ht : t ∈ Icc (0 : ℝ) + (2 * (duration detectorBumpDerivativeBound L n : ℝ))) (x : Plane) : + |scalarLaplacian (detectorReference Ψ detectorBumpDerivativeBound L n + (2 * ((n : ℝ) + 1) + t)) x| ≤ + (laplacianBound detectorBumpDerivativeBound L n : ℝ) := + detectorReference_laplacian_bound hv + (fun s => hV.comp (contDiff_const.prodMk contDiff_id)) hback L hL h₁ h₂ n _ x + refine ⟨w, hs, hw, hn, ?_, hfluid, huniq, ?_, ?_⟩ + · intro t ht + exact detector_scalar_mass_bound hV hp hdiv detectorBumpDerivativeBound L hs hw ht + · intro k hk + obtain ⟨t, ht, hh⟩ := detectorBurst_detects hΨ hp hback detectorBumpDerivativeBound L k + hs hw (hlap k) (detector_old_mass_margin L).le + (detector_scalar_at_start_bound hK hV hp hdiv detectorBumpDerivativeBound L hs hw k) + (Nat.cast_nonneg k) (by linarith : (k : ℝ) ≤ (k : ℝ) + 1) + exact ⟨t, ht, _, hk, hh⟩ + · intro hfar t ht x hx + exact detector_negative_all_time hK hΨ hv hV hp hdiv hback detectorBumpDerivativeBound L + h₁ hs hw hlap hfar ht hx + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorOldMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorOldMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..bed34fd645e387451b29f7e2eea99ec7fc26322b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorOldMass.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorSchedule +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarTimeWindow +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorMargins + +namespace OAI + +/-! The heat-only wait bounds all older injections uniformly before the +next burst. The first burst starts with the scalar identically zero. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detectorSource_before_two (C L : ℕ) {t : ℝ} (ht : t ≤ 2) (x : Plane) : + detectorSource C L t x = 0 := by + change (∑' n, detectorSourceTerm C L n (t, x)) = 0 + trans (∑' _ : ℕ, (0 : ℝ)) + swap + · exact tsum_zero + apply tsum_congr + intro n + apply detectorSourceTerm_before_closed + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + change t ≤ 2 * ((n : ℝ) + 1) + linarith + +theorem detector_scalar_before_two {V : ℝ → Plane → Plane} (C L : ℕ) + {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 2) (x : Plane) : w t x = 0 := by + have hb := (hs 2 (by norm_num)).absolute_bound (by norm_num) (by norm_num) + (M := 0) (A := 0) + (fun s hs' y => by simp only [detectorSource_before_two C L hs'.2 y, abs_zero, le_refl]) + (fun _ => by simp) t ht x + have hz : |w t x| ≤ 0 := by simpa only [zero_mul, zero_add] using hb + exact abs_eq_zero.mp (le_antisymm hz (abs_nonneg _)) + +theorem detector_scalar_at_start_bound (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (C L : ℕ) {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (n : ℕ) (x : Plane) : + |w (2 * ((n : ℝ) + 1)) x| ≤ 16 * (massBound L : ℝ) := by + have hn := hs.nonnegative (by norm_num : (0 : ℝ) ≤ 1) + (fun t _ y => detectorSource_nonnegative C L t y) (fun _ => le_rfl) + cases n with + | zero => + have hz := (hs 2 (by norm_num)).absolute_bound (by norm_num) (by norm_num) + (M := 0) (A := 0) + (fun t ht y => by simp only [detectorSource_before_two C L ht.2 y, abs_zero, le_refl]) + (fun _ => by simp) 2 (by norm_num) x + have hm := (massBound_real_small L).1 + norm_num only [Nat.cast_zero, zero_add, mul_one, zero_mul, add_zero] at hz ⊢ + linarith + | succ m => + let S : ℝ := 2 * ((m : ℝ) + 1) + 2 * (duration C L m : ℝ) + let T : ℝ := 2 - 2 * (duration C L m : ℝ) + have hd : (0 : ℝ) < duration C L m := by exact_mod_cast duration_pos C L m + have hT : 1 < T := by + have hδ := detector_duration_real_le C L m + dsimp only [T] + linarith + have hS : 0 ≤ S := by dsimp only [S]; positivity + have he : S + T = 2 * (((m + 1 : ℕ) : ℝ) + 1) := by + dsimp only [S, T] + push_cast + ring + have hz (r : ℝ) (hr : r ∈ Icc (0 : ℝ) T) (y : Plane) : + detectorDrift V C L (S + r) y = 0 ∧ detectorSource C L (S + r) y = 0 := by + apply detector_wait_coefficients_zero V C L m + dsimp only [S, T] at * + constructor <;> linarith [hr.1, hr.2] + have hheat := hs.heat_window hK hw hS (by linarith : 0 ≤ T) + (fun r hr => funext (fun y => (hz r hr y).1)) + (fun r hr => funext (fun y => (hz r hr y).2)) T ⟨by linarith, le_rfl⟩ + rw [← he, abs_of_nonneg (hn (S + T) (add_nonneg hS (by linarith)) x), hheat] + have hb := torusHeatEvolution_after_one hK + (hw.comp (contDiff_const.prodMk contDiff_id)).continuous + (hn S hS) hT.le x + exact hb.trans (mul_le_mul_of_nonneg_left + (detector_scalar_mass_bound hV hp hdiv C L hs hw hS) (by norm_num)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPositive.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPositive.lean new file mode 100644 index 0000000000000000000000000000000000000000..642502dc27c9b5e3e48d41f651179230b6b8ff3a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPositive.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBurst + +namespace OAI + +/-! Each smooth stirring clock visits every phase of its finite prefix. +The characteristic carrying the bump center then gives a velocity above +the fixed detection threshold. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detectorPhase_hits (C L n : ℕ) {s : ℝ} (hs : 0 ≤ s) + (hsn : s ≤ (n : ℝ) + 1) : + ∃ t ∈ Icc (2 * ((n : ℝ) + 1) + (duration C L n : ℝ)) + (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)), detectorPhase C L n t = s := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + apply intermediate_value_Icc (by linarith) + (detectorPhase_smooth C L n).continuous.continuousOn + rw [detectorPhase_before C L n le_rfl, detectorPhase_after C L n le_rfl] + exact ⟨hs, hsn⟩ + +theorem detectorBurst_detects {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) {w : ℝ → Plane → ℝ} + (hwsol : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hlap : ∀ t ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)), ∀ x, + |scalarLaplacian (detectorReference Ψ C L n (2 * ((n : ℝ) + 1) + t)) x| ≤ + (laplacianBound C L n : ℝ)) + {E : ℝ} (hE : E ≤ 1 / 16) + (hinit : ∀ x, |w (2 * ((n : ℝ) + 1)) x| ≤ E) + {s : ℝ} (hs : 0 ≤ s) (hsn : s ≤ (n : ℝ) + 1) : + ∃ t, 0 ≤ t ∧ 1 / 2 < w t (Ψ 0 s ![1 / 4, 1 / 4]) := by + obtain ⟨t, ht, he⟩ := detectorPhase_hits C L n hs hsn + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + let S := 2 * ((n : ℝ) + 1) + have hτ : t - S ∈ Icc (0 : ℝ) (2 * (duration C L n : ℝ)) := by + dsimp only [S] + constructor <;> linarith [ht.1, ht.2] + have herror := detectorBurst_comparison hΨ hp hback C L n hwsol hw hlap hinit + (t - S) hτ (Ψ 0 s ![1 / 4, 1 / 4]) + have hcancel : 2 * ((n : ℝ) + 1) + (t - S) = t := by dsimp only [S]; ring + rw [hcancel] at herror + have href := detectorReference_at_characteristic hΨ C L n ht.1 + rw [he] at href + rw [href] at herror + refine ⟨t, ?_, ?_⟩ + · have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith [ht.1] + · have hh := (abs_lt.mp herror).1 + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPrefixExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPrefixExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8154d00fb0d48f09ac36f19e5bdbac63d480ee3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorPrefixExpressions.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupEffective + +namespace OAI + +/-! Each local detector force is represented by a finite prefix of the +clocked program. The prefix is chosen from a coarse time bound. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped BigOperators ContDiff Topology + +def prefixDrift (V : ℝ → Plane → Plane) (C L N : ℕ) (t : ℝ) (x : Plane) : Plane := + ∑ n : Fin N, detectorDriftTerm V C L n (t, x) + +def prefixSource (C L N : ℕ) (t : ℝ) (x : Plane) : ℝ := + ∑ n : Fin N, detectorSourceTerm C L n (t, x) + +theorem driftPrefixExpression_value {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (C L N : ℕ) : + (driftPrefixExpression H C L N).val = + triangularVelocity (prefixDrift (planarSlice H) C L N) (fun _ _ => 0) := by + funext y + rw [driftPrefixExpression_val] + simp_rw [driftTermExpression_val hH hT] + simp only [triangularVelocity, triangularLift, prefixDrift, map_sum, + zero_smul, add_zero] + +theorem sourcePrefixExpression_value (C L N : ℕ) (y : SpaceTime) : + (sourcePrefixExpression C L N).val y = prefixSource C L N y.1 (horizontal y.2) := + sourcePrefixExpression_val C L N y + +def verticalSourceExpression (C L N : ℕ) : ClockedVector := + ![.const 0, .const 0, sourcePrefixExpression C L N] + +theorem verticalSourceExpression_valid (C L N : ℕ) : + (verticalSourceExpression C L N).Valid := by + intro j + fin_cases j + · trivial + · trivial + · exact sourcePrefixExpression_valid C L N + +theorem verticalSourceExpression_value (C L N : ℕ) : + (verticalSourceExpression C L N).val = + triangularVelocity (fun _ _ => 0) (prefixSource C L N) := by + funext y + rw [triangularVelocity, triangularLift_eq] + ext j + fin_cases j + · change (ClockedExpr.const 0).val y = 0 + simp only [ClockedExpr.val, Rat.cast_zero] + · change (ClockedExpr.const 0).val y = 0 + simp only [ClockedExpr.val, Rat.cast_zero] + · exact sourcePrefixExpression_value C L N y + +def forcePrefixExpression (H : FieldExpr) (C L N : ℕ) : ClockedVector := fun j => + .add (ClockedResidual.code (driftPrefixExpression H C L N) 1 j) + (verticalSourceExpression C L N j) + +theorem forcePrefixExpression_valid {H : FieldExpr} (hH : H.Valid) (C L N : ℕ) : + (forcePrefixExpression H C L N).Valid := + fun j => ⟨ClockedResidual.valid (driftPrefixExpression_valid hH C L N) 1 j, + verticalSourceExpression_valid C L N j⟩ + +theorem forcePrefixExpression_value {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (C L N : ℕ) : + (forcePrefixExpression H C L N).val = + residual 1 (triangularVelocity (prefixDrift (planarSlice H) C L N) (fun _ _ => 0)) + + triangularVelocity (fun _ _ => 0) (prefixSource C L N) := by + have he : (forcePrefixExpression H C L N).val = + (ClockedResidual.code (driftPrefixExpression H C L N) 1).val + + (verticalSourceExpression C L N).val := rfl + rw [he, ClockedResidual.val (driftPrefixExpression_valid hH C L N), + driftPrefixExpression_value hH hT, verticalSourceExpression_value] + norm_num only [Rat.cast_one] + +theorem detectorDrift_prefix_germ (V : ℝ → Plane → Plane) (C L N : ℕ) + (y : ℝ × Plane) (hN : y.1 + 1 ≤ (N : ℝ)) : + Function.uncurry (detectorDrift V C L) =ᶠ[𝓝 y] + Function.uncurry (prefixDrift V C L N) := by + have h := detectorBlockSum_local_of_time_bound (detectorDriftTerm V C L) + (detectorDriftTerm_before V C L) y N hN + filter_upwards [h] with z hz + change detectorBlockSum (detectorDriftTerm V C L) z = + ∑ n : Fin N, detectorDriftTerm V C L n z + exact hz.trans (Fin.sum_univ_eq_sum_range + (fun n : ℕ => detectorDriftTerm V C L n z) N).symm + +theorem detectorSource_prefix_germ (C L N : ℕ) + (y : ℝ × Plane) (hN : y.1 + 1 ≤ (N : ℝ)) : + Function.uncurry (detectorSource C L) =ᶠ[𝓝 y] + Function.uncurry (prefixSource C L N) := by + have h := detectorBlockSum_local_of_time_bound (detectorSourceTerm C L) + (detectorSourceTerm_before C L) y N hN + filter_upwards [h] with z hz + change detectorBlockSum (detectorSourceTerm C L) z = + ∑ n : Fin N, detectorSourceTerm C L n z + exact hz.trans (Fin.sum_univ_eq_sum_range + (fun n : ℕ => detectorSourceTerm C L n z) N).symm + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..29070fffc2a07a56b94323025b583d98fad3a881 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorGeometry.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusGeometry + +namespace OAI + +/-! The planar processor's full nonhalting corridor supplies the detector's +torus clearance, including across the boundary of a fundamental square. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +theorem vertical_corridor_torus_separation {p x : Plane} + (hp₀ : (3 / 16 : ℝ) ≤ p 1) (hp₁ : p 1 ≤ (7 / 8 : ℝ)) + (hx₀ : (1 / 32 : ℝ) < x 1) (hx₁ : x 1 < (1 / 8 : ℝ)) : + 1 / 16 ≤ torusNorm (p - x) := by + let r := p 1 - x 1 + have hlo : (1 / 16 : ℝ) ≤ r := by dsimp only [r]; linarith + have hhi : r ≤ (27 / 32 : ℝ) := by dsimp only [r]; linarith + have habs : (1 / 16 : ℝ) ≤ |r - (⌊r + 1 / 2⌋ : ℤ)| := by + by_cases hr : r + 1 / 2 < 1 + · have hf : ⌊r + 1 / 2⌋ = (0 : ℤ) := Int.floor_eq_iff.mpr ⟨by linarith, by simpa using hr⟩ + rw [hf, Int.cast_zero, sub_zero, abs_of_nonneg (by linarith)] + exact hlo + · have hf : ⌊r + 1 / 2⌋ = (1 : ℤ) := + Int.floor_eq_iff.mpr ⟨by norm_num; linarith, by norm_num; linarith⟩ + rw [hf, Int.cast_one, abs_of_nonpos (by linarith)] + linarith + calc + _ ≤ |centeredRepresentative (p - x) 1| := habs + _ ≤ torusNorm (p - x) := by + simpa only [torusNorm, Real.norm_eq_abs, planeCoordinates, + PiLp.coe_symm_continuousLinearEquiv, WithLp.ofLp_toLp] using + PiLp.norm_apply_le (planeCoordinates.symm (centeredRepresentative (p - x))) (1 : Fin 2) + +theorem processor_nonhalting_clearance + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ω Ψ : ℝ → ℝ → Plane → Plane} + (h : Recorder.Planar.ProcessorProperties I hI Ω Ψ) + (hno : ¬ Alternating.Halts I) (s : ℝ) (hs : 0 ≤ s) + (x : Plane) (hx : x ∈ Recorder.Planar.observer) : + 1 / 16 ≤ torusNorm (Ω 0 s ![1 / 4, 1 / 4] - x) := by + have hc := (h.nonhalting hno s hs).1 + have hhi := (hc.1 1).2 + norm_num [clockRectangle] at hhi + exact vertical_corridor_torus_separation hc.2 hhi hx.1 hx.2 + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..11503ec32d5b7bdd59a81ac81672eebe06ba4878 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorObservation.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorProcessorGeometry + +namespace OAI + +/-! The scalar threshold for the compiled planar processor is exactly +halting, using integer-phase entry and all-phase nonhalting clearance. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +attribute [local irreducible] Recorder.Planar.normalizedHamiltonian planarSlice + euclideanFlowBound detectorDrift detectorSource detectorReference + +theorem detector_processor_observation (hK : TorusHeatInput) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ω Ψ : ℝ → ℝ → Plane → Plane} + (hP : Recorder.Planar.ProcessorProperties I hI Ω Ψ) + (hv : PlanarVariations (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ω y.1 (-y.1) y.2)) + {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 + (detectorDrift (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) + detectorBumpDerivativeBound (euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI))) + (detectorSource detectorBumpDerivativeBound + (euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI))) w (fun _ => 0)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) : + (∃ t, 0 ≤ t ∧ ∃ x ∈ Recorder.Planar.observer, 1 / 2 < w t x) ↔ Alternating.Halts I := by + let V := planarSlice (Recorder.Planar.normalizedHamiltonian I hI) + let L := euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI) + have hL : 0 < L := Nat.lt_of_lt_of_le (by norm_num) hP.euclidean_bounds.1.1 + have h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ) := + fun s x => (hP.euclidean_bounds.1.2.1 s x).1 + have h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ) := + fun s x => (hP.euclidean_bounds.1.2.1 s x).2 + have hVs (s : ℝ) : ContDiff ℝ ∞ (V s) := + hP.torus_smooth.comp (show ContDiff ℝ ∞ (fun x : Plane => (s, x)) from + contDiff_const.prodMk contDiff_id) + have hlap (n : ℕ) (t : ℝ) (_ht : t ∈ Icc (0 : ℝ) + (2 * (duration detectorBumpDerivativeBound L n : ℝ))) (x : Plane) : + |scalarLaplacian (detectorReference Ω detectorBumpDerivativeBound L n + (2 * ((n : ℝ) + 1) + t)) x| ≤ (laplacianBound detectorBumpDerivativeBound L n : ℝ) := + detectorReference_laplacian_bound hv + hVs hback L hL h₁ h₂ n _ x + constructor + · rintro ⟨t, ht, x, hx, hobs⟩ + by_contra hno + have hlow := detector_negative_all_time hK hP.torus_transition hv hP.torus_smooth + hP.torus_spatial_periodic hP.torus_solenoidal hback detectorBumpDerivativeBound L h₁ + hs hw hlap (fun s hs' y hy => processor_nonhalting_clearance I hI hP hno s hs' y hy) + ht hx + exact (not_lt_of_ge hobs.le) hlow + · intro hhalt + obtain ⟨n, hlo, hhi, _, _⟩ := hP.halt_clearance hhalt + have hx : Ω 0 n ![1 / 4, 1 / 4] ∈ Recorder.Planar.observer := by + change (1 / 32 : ℝ) < _ ∧ _ < (1 / 8 : ℝ) + constructor <;> linarith + obtain ⟨t, ht, hh⟩ := detectorBurst_detects hP.torus_transition hP.torus_spatial_periodic + hback detectorBumpDerivativeBound L n hs hw (hlap n) (detector_old_mass_margin L).le + (detector_scalar_at_start_bound hK hP.torus_smooth hP.torus_spatial_periodic + hP.torus_solenoidal detectorBumpDerivativeBound L hs hw n) + (Nat.cast_nonneg n) (by linarith : (n : ℝ) ≤ (n : ℝ) + 1) + exact ⟨t, ht, _, hx, hh⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..07ca434ba1e627889dc6773d061b55b2d9f33e7e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProcessorSupport.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorMain + +namespace OAI + +/-! The detector force stays in one compact horizontal subset of the +processor chart. Continuity supplies the boundary faces of the unit cell. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +def openUnitPlane : Set Plane := Set.pi univ (fun _ => Ioo (0 : ℝ) 1) + +theorem mem_openUnitPlane {x : Plane} : + x ∈ openUnitPlane ↔ ∀ j, 0 < x j ∧ x j < 1 := by + simp only [openUnitPlane, Set.mem_pi, mem_univ, true_implies, mem_Ioo] + +theorem openUnitPlane_open : IsOpen openUnitPlane := + isOpen_set_pi finite_univ (fun _ _ => isOpen_Ioo) + +theorem threeAtLeastTwo : Nat.AtLeastTwo 3 := ⟨Nat.le_succ 2⟩ + +def injectionSupport : Set Plane := + letI := ShearFlows.sixteenAtLeastTwo + letI := ShearFlows.fiveAtLeastTwo + letI := threeAtLeastTwo + Icc (fun _ => (3 / 16 : ℝ)) (fun _ => (5 / 16 : ℝ)) + +theorem injectionSupport_inside : injectionSupport ⊆ openUnitPlane := by + intro x hx + apply mem_openUnitPlane.mpr + intro j + have hj : (3 / 16 : ℝ) ≤ x j ∧ x j ≤ 5 / 16 := ⟨hx.1 j, hx.2 j⟩ + constructor <;> linarith only [hj.1, hj.2] + +theorem continuous_zero_on_unit_faces {f : Plane → Space} (hf : Continuous f) + {K : Set Plane} (hK : IsClosed K) + (hz : ∀ x ∈ openUnitPlane, x ∉ K → f x = 0) + {x : Plane} (hx : ∀ j, x j ∈ Icc (0 : ℝ) 1) (hxK : x ∉ K) : f x = 0 := by + have hxcl : x ∈ closure openUnitPlane := by + apply mem_closure_pi.mpr + intro j _ + rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1)] + exact hx j + have hxc : x ∈ closure (openUnitPlane ∩ Kᶜ) := hK.isOpen_compl.closure_inter ⟨hxcl, hxK⟩ + have he : EqOn f (fun _ => 0) (openUnitPlane ∩ Kᶜ) := fun y hy => hz y hy.1 hy.2 + exact he.closure hf continuous_const hxc + +theorem detectorForce_fixed_horizontal_support {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) {K : Set Plane} + (hK : IsCompact K) (hKi : K ⊆ openUnitPlane) + (hVz : ∀ s x, x ∈ openUnitPlane → x ∉ K → V s x = 0) + (C L : ℕ) : + IsCompact (K ∪ injectionSupport) ∧ (K ∪ injectionSupport) ⊆ openUnitPlane ∧ + ∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K ∪ injectionSupport → + ∀ z, detectorForce V C L (t, atHeight x z) = 0 := by + have hK' : IsCompact (K ∪ injectionSupport) := hK.union isCompact_Icc + refine ⟨hK', union_subset hKi injectionSupport_inside, ?_⟩ + intro t x hx hxK z + have hi : Continuous (fun y : Plane => atHeight y z) := by + apply continuous_pi + intro j + fin_cases j + · exact continuous_apply 0 + · exact continuous_apply 1 + · exact continuous_const + have hf : Continuous (fun y : Plane => detectorForce V C L (t, atHeight y z)) := + (triangularForce_smooth (detectorDrift_smooth hV C L) (detectorSource_smooth C L) 1).continuous.comp + (continuous_const.prodMk hi) + apply continuous_zero_on_unit_faces hf hK'.isClosed _ hx hxK + intro y hy hyK + let U := openUnitPlane ∩ (K ∪ injectionSupport)ᶜ + have hU : IsOpen U := openUnitPlane_open.inter hK'.isClosed.isOpen_compl + have hproc (s : ℝ) (q : Plane) (hq : q ∈ U) : V s q = 0 := + hVz s q hq.1 (fun h => hq.2 (Or.inl h)) + have hb (n : ℕ) (q : Plane) (hq : q ∈ U) : detectorBump (width L n : ℝ) q = 0 := by + by_contra hn + have hw : (0 : ℝ) < width L n := by exact_mod_cast width_pos L n + have hq₁ : ∀ j, q j ∈ Icc (0 : ℝ) 1 := fun j => + ⟨(mem_openUnitPlane.mp hq.1 j).1.le, (mem_openUnitPlane.mp hq.1 j).2.le⟩ + have hb := detectorBump_support_in_chart hw (detector_width_small L n) hq₁ hn + have hD : q ∈ injectionSupport := by + constructor <;> intro j + · have hh := (abs_lt.mp (hb j)).1 + have hs := detector_width_small L n + linarith only [hh, hs] + · have hh := (abs_lt.mp (hb j)).2 + have hs := detector_width_small L n + linarith only [hh, hs] + exact hq.2 (Or.inr hD) + apply detectorForce_zero_of_neighborhood hV C L hU hproc hb t + simpa only [U, horizontalLinear_eq, atHeight_horizontal, mem_inter_iff, mem_compl_iff] + using And.intro hy hyK + +theorem processor_detector_force_support (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ω Ψ : ℝ → ℝ → Plane → Plane} + (hP : Recorder.Planar.ProcessorProperties I hI Ω Ψ) (C L : ℕ) : + let K := PlanarHamiltonian.commonSupport (Recorder.Planar.normalizedPulse I hI) ∪ injectionSupport + IsCompact K ∧ K ⊆ openUnitPlane ∧ + ∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K → ∀ z, + detectorForce (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) C L + (t, atHeight x z) = 0 := by + apply detectorForce_fixed_horizontal_support + (V := planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) + hP.torus_smooth hP.compact_support.1 + (fun x hx => mem_openUnitPlane.mpr (hP.compact_support.2.1 hx)) _ C L + intro s x hx hxK + rw [← hP.chart_agreement s x (mem_openUnitPlane.mp hx)] + exact image_eq_zero_of_notMem_tsupport (fun h => hxK ((hP.compact_support.2.2 s).1 h)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProfileBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProfileBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcbf7f6bed883ad2dd5bae8e2feeef0a1e394413 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorProfileBounds.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EffectiveProfiles +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Extension +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.PeriodicExpressions +import Mathlib.Analysis.Calculus.Deriv.Support + +namespace OAI + +/-! Computed natural-number bounds for the fixed bump profile. These give +the width-independent constants used before rescaling detector injections. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +def baseDetectorProfile : ProfileExpr := ProfileExpr.cutoff (-1) (-1 / 2) (1 / 2) 1 + +def detectorProfileDerivativeBound (n : ℕ) : ℕ := + ⌈(baseDetectorProfile.diffN n).bound 1⌉₊ + 1 + +theorem baseDetectorProfile_support (n : ℕ) : + tsupport (iteratedDeriv n baseDetectorProfile.val) ⊆ Icc (-1 : ℝ) 1 := by + induction n with + | zero => + apply closure_minimal _ isClosed_Icc + intro x hx + have he : baseDetectorProfile.val = closedCutoff (-1) (-1 / 2) (1 / 2) 1 := by + simpa only [baseDetectorProfile, Rat.cast_neg, Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using + ProfileExpr.val_cutoff (-1) (-1 / 2) (1 / 2) 1 + change baseDetectorProfile.val x ≠ 0 at hx + rw [he] at hx + exact Ioo_subset_Icc_self (closedCutoff_support (by norm_num : (-1 : ℝ) < -1 / 2) + (by norm_num : (1 / 2 : ℝ) < 1) hx) + | succ n ih => + rw [iteratedDeriv_succ] + exact tsupport_deriv_subset.trans ih + +theorem baseDetectorProfile_derivative_bound (n : ℕ) (x : ℝ) : + |iteratedDeriv n baseDetectorProfile.val x| ≤ (detectorProfileDerivativeBound n : ℝ) := by + by_cases hx : |x| ≤ 1 + · rw [← ProfileExpr.val_diffN] + have hb := (baseDetectorProfile.diffN n).val_bound (M := 1) (by simpa using hx) + apply hb.trans + have hc : ((baseDetectorProfile.diffN n).bound 1 : ℝ) ≤ + (⌈(baseDetectorProfile.diffN n).bound 1⌉₊ : ℝ) := by + exact_mod_cast Nat.le_ceil ((baseDetectorProfile.diffN n).bound 1) + simp only [detectorProfileDerivativeBound, Nat.cast_add, Nat.cast_one] + linarith + · have hnot : x ∉ Icc (-1 : ℝ) 1 := by + intro h + exact hx (abs_le.mpr h) + have hz : iteratedDeriv n baseDetectorProfile.val x = 0 := by + by_contra hn + exact hnot (baseDetectorProfile_support n (subset_closure hn)) + rw [hz, abs_zero] + exact Nat.cast_nonneg _ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReference.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..07dd86c915644c96485759c335388fc9fa5b72fe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReference.lean @@ -0,0 +1,179 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorTiming +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarCharacteristics +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PullbackMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBumpMass + +namespace OAI + +/-! One smooth formula for the inviscid injection-and-stirring reference. +Its equation is proved for the prescribed block drift and source. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def detectorInjectionFraction (C L n : ℕ) (t : ℝ) : ℝ := + smoothRamp 0 1 ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + +def detectorInjectionRate (C L n : ℕ) (t : ℝ) : ℝ := + (duration C L n : ℝ)⁻¹ * + smoothPulse 0 1 ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + +def detectorReference (Ψ : ℝ → ℝ → Plane → Plane) (C L n : ℕ) + (t : ℝ) (x : Plane) : ℝ := + detectorInjectionFraction C L n t * + pullbackScalar Ψ (detectorBump (width L n : ℝ)) (detectorPhase C L n t) x + +theorem detectorInjectionFraction_smooth (C L n : ℕ) : + ContDiff ℝ ∞ (detectorInjectionFraction C L n) := + (smoothRamp_smooth 0 1).comp ((contDiff_id.sub contDiff_const).div_const _) + +theorem detectorInjectionFraction_hasDerivAt (C L n : ℕ) (t : ℝ) : + HasDerivAt (detectorInjectionFraction C L n) (detectorInjectionRate C L n t) t := by + change HasDerivAt (fun r => smoothRamp 0 1 + ((r - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ))) _ t + have hr := ((smoothRamp_smooth 0 1).differentiable (by simp) + ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ))).hasDerivAt + have ha := ((hasDerivAt_id t).sub_const (2 * ((n : ℝ) + 1))).div_const + (duration C L n : ℝ) + convert hr.comp t ha using 1 <;> + simp only [detectorInjectionRate, smoothPulse, Function.comp_def, id_eq, + div_eq_mul_inv, one_mul, mul_comm] + +theorem detectorInjectionFraction_after (C L n : ℕ) {t : ℝ} + (ht : 2 * ((n : ℝ) + 1) + (duration C L n : ℝ) ≤ t) : + detectorInjectionFraction C L n t = 1 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + apply smoothRamp_after (by norm_num : (0 : ℝ) < 1) + apply (le_div_iff₀ hd).mpr + linarith + +theorem detectorReference_range (Ψ : ℝ → ℝ → Plane → Plane) + (C L n : ℕ) (t : ℝ) (x : Plane) : + detectorReference Ψ C L n t x ∈ Set.Icc (0 : ℝ) 1 := by + have hθ := smoothRamp_range 0 1 + ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + have hg := detectorBump_range (by exact_mod_cast width_pos L n) + (detector_width_small L n) (Ψ (detectorPhase C L n t) (-(detectorPhase C L n t)) x) + exact ⟨mul_nonneg hθ.1 hg.1, + (mul_le_mul hθ.2 hg.2 hg.1 (by norm_num : (0 : ℝ) ≤ 1)).trans_eq (mul_one 1)⟩ + +theorem detectorReference_at_characteristic {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (C L n : ℕ) {t : ℝ} + (ht : 2 * ((n : ℝ) + 1) + (duration C L n : ℝ) ≤ t) : + detectorReference Ψ C L n t + (Ψ 0 (detectorPhase C L n t) ![1 / 4, 1 / 4]) = 1 := by + have hi : Ψ (detectorPhase C L n t) (-(detectorPhase C L n t)) + (Ψ 0 (detectorPhase C L n t) ![1 / 4, 1 / 4]) = ![1 / 4, 1 / 4] := by + simpa only [zero_add] using hΨ.inverse_left 0 (detectorPhase C L n t) ![1 / 4, 1 / 4] + rw [detectorReference, detectorInjectionFraction_after C L n ht, one_mul, + pullbackScalar, hi] + exact detectorBump_center (by exact_mod_cast width_pos L n) (detector_width_small L n) + +theorem detectorRate_or_phase_zero (C L n : ℕ) (t : ℝ) : + detectorInjectionRate C L n t = 0 ∨ detectorPhase C L n t = 0 := by + by_cases ht : t ≤ 2 * ((n : ℝ) + 1) + (duration C L n : ℝ) + · exact Or.inr (detectorPhase_before C L n ht) + · left + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have ha : 1 ≤ (t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ) := by + apply (le_div_iff₀ hd).mpr + linarith + simp only [detectorInjectionRate, + smoothPulse_after (by norm_num : (0 : ℝ) < 1) ha, mul_zero] + +theorem detectorReference_smooth {Ψ : ℝ → ℝ → Plane → Plane} + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) : ContDiff ℝ ∞ (Function.uncurry (detectorReference Ψ C L n)) := by + have hg : ContDiff ℝ ∞ (detectorBump (width L n : ℝ)) := + detectorBump_smooth (by exact_mod_cast width_pos L n) + have hθ : ContDiff ℝ ∞ (fun y : ℝ × Plane => detectorInjectionFraction C L n y.1) := + (detectorInjectionFraction_smooth C L n).comp contDiff_fst + have hclock : ContDiff ℝ ∞ (fun y : ℝ × Plane => (detectorPhase C L n y.1, y.2)) := + ((detectorPhase_smooth C L n).comp contDiff_fst).prodMk contDiff_snd + have hflow : ContDiff ℝ ∞ (fun y : ℝ × Plane => + Ψ (detectorPhase C L n y.1) (-(detectorPhase C L n y.1)) y.2) := + hback.comp hclock + have hbump : ContDiff ℝ ∞ (fun y : ℝ × Plane => + detectorBump (width L n : ℝ) + (Ψ (detectorPhase C L n y.1) (-(detectorPhase C L n y.1)) y.2)) := + hg.comp hflow + exact hθ.mul hbump + +theorem detectorReference_equation {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => detectorReference Ψ C L n s x) + (-fderiv ℝ (detectorReference Ψ C L n t) x + (detectorDriftTerm V C L n (t, x)) + detectorSourceTerm C L n (t, x)) t := by + let g := detectorBump (width L n : ℝ) + let σ := detectorPhase C L n t + let θ := detectorInjectionFraction C L n t + have hg : ContDiff ℝ ∞ g := detectorBump_smooth (by exact_mod_cast width_pos L n) + have hflow : ContDiff ℝ ∞ (fun y : Plane => Ψ σ (-σ) y) := + hback.comp (contDiff_const.prodMk contDiff_id) + have hgs : ContDiff ℝ ∞ (pullbackScalar Ψ g σ) := hg.comp hflow + have htrans : HasDerivAt (fun s => pullbackScalar Ψ g (detectorPhase C L n s) x) + ((-fderiv ℝ (pullbackScalar Ψ g σ) x (V σ x)) * detectorSpeed C L n t) t := by + have hd := pullbackScalar_transport hΨ hback hg (detectorPhase C L n t) x + simpa only [Function.comp_def, σ] using + HasDerivAt.comp (h := detectorPhase C L n) t hd (detectorPhase_hasDerivAt C L n t) + have href := (detectorInjectionFraction_hasDerivAt C L n t).mul htrans + have hspace := (hgs.differentiable (by simp) x).hasFDerivAt.const_mul θ + have hD : fderiv ℝ (detectorReference Ψ C L n t) x + (detectorDriftTerm V C L n (t, x)) = + θ * (detectorSpeed C L n t * fderiv ℝ (pullbackScalar Ψ g σ) x (V σ x)) := by + change fderiv ℝ (fun y => θ * pullbackScalar Ψ g σ y) x + (detectorSpeed C L n t • V σ x) = _ + rw [hspace.fderiv] + simp only [smul_apply, map_smul, smul_eq_mul] + ring + have hsource : detectorInjectionRate C L n t * pullbackScalar Ψ g σ x = + detectorSourceTerm C L n (t, x) := by + rcases detectorRate_or_phase_zero C L n t with hr | hp + · simp only [hr, zero_mul] + change 0 = detectorInjectionRate C L n t * g x + rw [hr, zero_mul] + · have he : pullbackScalar Ψ g σ x = g x := by + simp only [σ, hp, pullbackScalar, neg_zero, hΨ.initial] + rw [he] + rfl + convert href using 1 + · rfl + · rw [hD, ← hsource] + dsimp only [θ, σ] + ring + +theorem detectorReference_mass {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) (t : ℝ) : + 0 ≤ (∫ x in Set.Icc (0 : Plane) (fun _ => 1), detectorReference Ψ C L n t x) ∧ + (∫ x in Set.Icc (0 : Plane) (fun _ => 1), detectorReference Ψ C L n t x) ≤ + 4 * (width L n : ℝ) ^ 2 := by + have hb : (0 : ℝ) < width L n := by exact_mod_cast width_pos L n + have hmass := detectorBump_mass hb (detector_width_small L n) + have he : (∫ x in Set.Icc (0 : Plane) (fun _ => 1), detectorReference Ψ C L n t x) = + detectorInjectionFraction C L n t * + ∫ x in Set.Icc (0 : Plane) (fun _ => 1), detectorBump (width L n : ℝ) x := by + unfold detectorReference + rw [MeasureTheory.integral_const_mul] + rw [pullbackScalar_mass hΨ hV hp hdiv hback (detectorBump_smooth hb) + (detectorBump_periodic (width L n : ℝ))] + rw [he] + have hθ := smoothRamp_range 0 1 + ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + exact ⟨mul_nonneg hθ.1 hmass.1, + (mul_le_mul_of_nonneg_right hθ.2 hmass.1).trans (by simpa using hmass.2)⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReferenceBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReferenceBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0163cc862d79d6f08eae47981eec5324cbafc01f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorReferenceBounds.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorReference +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBumpDerivatives +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarEuclideanLaplacian +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanConjugacy + +namespace OAI + +/-! The fixed rational burst duration controls the actual Laplacian of +the inviscid reference, uniformly over its entire computational prefix. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +theorem scalar_second_const_mul {f : EuclideanPlane → ℝ} + (hf : ContDiff ℝ ∞ f) (a : ℝ) (x : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (fun y => a * f y)) x = + a • fderiv ℝ (fderiv ℝ f) x := by + have he : fderiv ℝ (fun y => a * f y) = fun y => a • fderiv ℝ f y := by + funext y + exact ((hf.differentiable (by simp) y).hasFDerivAt.const_mul a).fderiv + rw [he] + exact (((hf.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x).hasFDerivAt.const_smul a).fderiv + +theorem detectorPhase_range (C L n : ℕ) (t : ℝ) : + 0 ≤ detectorPhase C L n t ∧ detectorPhase C L n t ≤ (n : ℝ) + 1 := by + have h := smoothRamp_range 0 1 + ((t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / (duration C L n : ℝ)) + unfold detectorPhase + constructor + · exact mul_nonneg (by positivity) h.1 + · simpa only [mul_one] using + mul_le_mul_of_nonneg_left h.2 (by positivity : (0 : ℝ) ≤ (n : ℝ) + 1) + +theorem detectorReference_laplacian_bound {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + (hV : ∀ s, ContDiff ℝ ∞ (V s)) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) + (n : ℕ) (t : ℝ) (x : Plane) : + |scalarLaplacian (detectorReference Ψ detectorBumpDerivativeBound L n t) x| ≤ + (laplacianBound detectorBumpDerivativeBound L n : ℝ) := by + let C := detectorBumpDerivativeBound + let b : ℝ := width L n + let σ := detectorPhase C L n t + let g : EuclideanPlane → ℝ := fun y => detectorBump b (planeCoordinates y) + let φ := euclideanMap (Ψ σ (-σ)) + let θ := detectorInjectionFraction C L n t + have hb : 0 < b := by + dsimp only [b] + exact_mod_cast width_pos L n + have hb₁ : b ≤ 1 / 16 := detector_width_small L n + have hg : ContDiff ℝ ∞ g := scalarEuclidean_smooth (detectorBump_smooth hb) + have hφ : ContDiff ℝ ∞ φ := euclideanMap_smooth (hv.smooth σ (-σ)) + have hσ := detectorPhase_range C L n t + have hσn : σ ≤ ((n + 1 : ℕ) : ℝ) := by simpa only [Nat.cast_add, Nat.cast_one] using hσ.2 + have hflow := inverse_flow_block_bounds (hv.euclidean hV) L (n + 1) hL h₁ h₂ + σ (planeCoordinates.symm x) hσ.1 hσn + have hbound := transported_hessian_bound hg hφ (planeCoordinates.symm x) C L (n + 1) + hb (by linarith) (detectorBump_euclidean_derivative_bounds hb hb₁ (φ (planeCoordinates.symm x))).1 + (detectorBump_euclidean_derivative_bounds hb hb₁ (φ (planeCoordinates.symm x))).2 + hflow.1 hflow.2 + have he : scalarEuclidean (detectorReference Ψ C L n t) = + fun y => θ * (g ∘ φ) y := by + funext y + simp only [scalarEuclidean, detectorReference, pullbackScalar, g, φ, θ, σ, b, + euclideanMap, Function.comp_apply, ContinuousLinearEquiv.apply_symm_apply] + have hθ := smoothRamp_range 0 1 + ((t - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ)) + change θ ∈ Set.Icc (0 : ℝ) 1 at hθ + have hnorm : ‖fderiv ℝ (fderiv ℝ + (scalarEuclidean (detectorReference Ψ C L n t))) (planeCoordinates.symm x)‖ ≤ + (C : ℝ) * b⁻¹ ^ 2 * (1 + ((n + 1 : ℕ) : ℝ) * L) * + (expansion L : ℝ) ^ (3 * (n + 1)) := by + rw [he, scalar_second_const_mul (hg.comp hφ)] + apply (ContinuousLinearMap.opNorm_smul_le θ _).trans + rw [Real.norm_eq_abs, abs_of_nonneg hθ.1] + exact (mul_le_of_le_one_left (norm_nonneg _) hθ.2).trans hbound + have hlap := scalarLaplacian_bound_of_euclidean_hessian + ((detectorReference_smooth hback C L n).comp (contDiff_const.prodMk contDiff_id)) x hnorm + apply hlap.trans_eq + dsimp only [C, b] + simp only [laplacianBound, Rat.cast_mul, Rat.cast_inv, Rat.cast_pow, + Rat.cast_add, Rat.cast_natCast, Rat.cast_ofNat, Nat.cast_add, Nat.cast_one] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorScalar.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2f2e4c969d327f7d68a064efabc4b4e0d8f0ddd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorScalar.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorStirring +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarZeroExtension + +namespace OAI + +/-! The explicit detector source and drift have one global smooth, +nonnegative scalar evolution, conditional only on the published existence +input. The drift and source never depend on this unknown scalar. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detectorScalar_exists (hE : TorusScalarExistence) + {V : ℝ → Plane → Plane} (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hVp : ∀ t, PlanePeriodic (V t)) (C L : ℕ) : + ∃ w : ℝ → Plane → ℝ, + GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) w (fun _ => 0) ∧ + ContDiff ℝ ∞ (Function.uncurry w) ∧ + (∀ t, PlanePeriodic (w t)) ∧ + (∀ t x, 0 ≤ w t x) ∧ + (∀ t, t ≤ 1 → ∀ x, w t x = 0) := by + obtain ⟨w, hw⟩ := hE.global 1 (by norm_num) (detectorDrift V C L) + (detectorSource C L) (fun _ => 0) (detectorDrift_smooth hV C L) + (detectorSource_smooth C L) contDiff_const (detectorDrift_periodic hVp C L) + (detectorSource_periodic C L) (fun _ _ => rfl) + have hsol := hw.zeroExtension + have hzero (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) : + detectorSource C L t x = 0 := detectorSource_before_one C L ht.2 x + have hnonneg := hsol.nonnegative (by norm_num : (0 : ℝ) ≤ 1) + (fun t _ x => detectorSource_nonnegative C L t x) (fun _ => le_rfl) + refine ⟨scalarZeroExtension w, hsol, + hw.zeroExtension_smooth (by norm_num) hzero, ?_, ?_, ?_⟩ + · intro t + by_cases ht : 0 ≤ t + · exact (hsol t ht).periodic t ⟨ht, le_rfl⟩ + · intro x k + simp only [scalarZeroExtension, ite_eq_right ht] + · intro t x + by_cases ht : 0 ≤ t + · exact hnonneg t ht x + · simp only [scalarZeroExtension, ite_eq_right ht, le_refl] + · intro t ht x + by_cases ht₀ : 0 ≤ t + · simp only [scalarZeroExtension, ite_eq_left ht₀] + exact hw.zero_before_one (by norm_num) hzero t ⟨ht₀, ht⟩ x + · simp only [scalarZeroExtension, ite_eq_right ht₀] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSchedule.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..297e8eb4e55f66bcf0ad34575be9876553bbf270 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSchedule.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorTiming + +namespace OAI + +/-! Exact isolation of each burst and the following heat-only waiting +interval. The endpoints are included because the smooth pulses vanish there. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +theorem detectorSourceTerm_before_closed (C L n : ℕ) (y : ℝ × Plane) + (hy : y.1 ≤ 2 * ((n : ℝ) + 1)) : detectorSourceTerm C L n y = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hh : (y.1 - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + simp only [detectorSourceTerm, smoothPulse_before (by norm_num : (0 : ℝ) < 1) hh, + mul_zero, zero_mul] + +theorem detectorDriftTerm_before_closed (V : ℝ → Plane → Plane) (C L n : ℕ) + (y : ℝ × Plane) (hy : y.1 ≤ 2 * ((n : ℝ) + 1)) : + detectorDriftTerm V C L n y = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + rw [detectorDriftTerm, detectorSpeed_before C L n (by linarith), zero_smul] + +theorem detectorDriftTerm_after (V : ℝ → Plane → Plane) (C L n : ℕ) + (y : ℝ × Plane) + (hy : 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) ≤ y.1) : + detectorDriftTerm V C L n y = 0 := by + rw [detectorDriftTerm, detectorSpeed_after C L n hy, zero_smul] + +theorem detector_duration_real_le (C L n : ℕ) : (duration C L n : ℝ) ≤ 1 / 100 := by + have h := (Rat.cast_le (K := ℝ)).mpr (duration_le C L n) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at h + exact h + +theorem detector_other_block_inactive (C L n m : ℕ) (hm : m ≠ n) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2))) : + t ≤ 2 * ((m : ℝ) + 1) ∨ + 2 * ((m : ℝ) + 1) + 2 * (duration C L m : ℝ) ≤ t := by + rcases lt_or_gt_of_ne hm with hm | hm + · right + have hmn : (m : ℝ) + 1 ≤ n := by exact_mod_cast (Nat.add_one_le_iff.mpr hm) + have hd := detector_duration_real_le C L m + linarith [ht.1] + · left + have hnm : (n : ℝ) + 1 ≤ m := by exact_mod_cast (Nat.add_one_le_iff.mpr hm) + linarith [ht.2] + +theorem detectorDrift_eq_term (V : ℝ → Plane → Plane) (C L n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2))) (x : Plane) : + detectorDrift V C L t x = detectorDriftTerm V C L n (t, x) := by + unfold detectorDrift detectorBlockSum + apply tsum_eq_single n + intro m hm + rcases detector_other_block_inactive C L n m hm ht with hb | ha + · exact detectorDriftTerm_before_closed V C L m (t, x) hb + · exact detectorDriftTerm_after V C L m (t, x) ha + +theorem detectorSource_eq_term (C L n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2))) (x : Plane) : + detectorSource C L t x = detectorSourceTerm C L n (t, x) := by + unfold detectorSource detectorBlockSum + apply tsum_eq_single n + intro m hm + rcases detector_other_block_inactive C L n m hm ht with hb | ha + · exact detectorSourceTerm_before_closed C L m (t, x) hb + · have hd : (0 : ℝ) < duration C L m := by exact_mod_cast duration_pos C L m + exact detectorSourceTerm_after C L m (t, x) (by linarith) + +theorem detector_wait_coefficients_zero (V : ℝ → Plane → Plane) (C L n : ℕ) {t : ℝ} + (ht : t ∈ Icc (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) + (2 * ((n : ℝ) + 2))) (x : Plane) : + detectorDrift V C L t x = 0 ∧ detectorSource C L t x = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hi : t ∈ Icc (2 * ((n : ℝ) + 1)) (2 * ((n : ℝ) + 2)) := + ⟨by linarith [ht.1], ht.2⟩ + constructor + · rw [detectorDrift_eq_term V C L n hi] + exact detectorDriftTerm_after V C L n (t, x) ht.1 + · rw [detectorSource_eq_term C L n hi] + exact detectorSourceTerm_after C L n (t, x) (by linarith [ht.1]) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSeparation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..93d437f8a740b2382761ee8f8c6b50df2ef29b84 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSeparation.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatEvolution + +namespace OAI + +/-! Full-orbit separation excludes a false observation both during a +burst and during its subsequent heat evolution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem torusNorm_zero : torusNorm (0 : Plane) = 0 := by + have he : centeredRepresentative (0 : Plane) = 0 := by + ext j + norm_num [centeredRepresentative] + rw [torusNorm, he, map_zero, norm_zero] + +theorem detectorReference_separated {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hv : PlanarVariations V Ψ) (hV : ∀ s, ContDiff ℝ ∞ (V s)) + (hp : ∀ s, PlanePeriodic (V s)) (C L n : ℕ) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {E : Set Plane} + (hfar : ∀ s, 0 ≤ s → ∀ x ∈ E, + 1 / 16 ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) + (t : ℝ) {x y : Plane} (hx : x ∈ E) + (hy : detectorReference Ψ C L n t y ≠ 0) : + (1 / 32 : ℝ) ^ 2 ≤ torusDistanceSq (x - y) := by + have hn := detectorReference_support_near hΨ hv hV hp C L n h₁ hy + have hs := detectorPhase_range C L n t + have hf := hfar (detectorPhase C L n t) hs.1 x hx + have hd : (1 / 32 : ℝ) ≤ torusNorm (x - y) := + torus_separation hn (by norm_num at hf ⊢; exact hf) le_rfl + rw [← torusNorm_sq] + nlinarith [torusNorm_nonneg (x - y)] + +theorem detectorReference_zero_on_target {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hv : PlanarVariations V Ψ) (hV : ∀ s, ContDiff ℝ ∞ (V s)) + (hp : ∀ s, PlanePeriodic (V s)) (C L n : ℕ) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {E : Set Plane} + (hfar : ∀ s, 0 ≤ s → ∀ x ∈ E, + 1 / 16 ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) + (t : ℝ) {x : Plane} (hx : x ∈ E) : detectorReference Ψ C L n t x = 0 := by + by_contra hn + have h := detectorReference_separated hΨ hv hV hp C L n h₁ hfar t hx hn + rw [sub_self, ← torusNorm_sq, torusNorm_zero] at h + norm_num at h + +theorem detectorReference_heat_bound (hK : TorusHeatInput) + {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (hv : PlanarVariations V Ψ) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + (C L n : ℕ) (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {E : Set Plane} + (hfar : ∀ s, 0 ≤ s → ∀ x ∈ E, + 1 / 16 ≤ torusNorm (Ψ 0 s ![1 / 4, 1 / 4] - x)) + (t : ℝ) {τ : ℝ} (hτ : 0 < τ) {x : Plane} (hx : x ∈ E) : + torusHeatEvolution (detectorReference Ψ C L n t) τ x ≤ + 1000000000 * (4 * (width L n : ℝ) ^ 2) := by + have hVs : ∀ s, ContDiff ℝ ∞ (V s) := + fun s => hV.comp (contDiff_const.prodMk contDiff_id) + have hbound := torusHeatEvolution_mass_bound hK + ((detectorReference_smooth hback C L n).comp + (contDiff_const.prodMk contDiff_id)).continuous + (fun y => (detectorReference_range Ψ C L n t y).1) hτ x + (fun y _ hy => ((torusHeatKernel_detector_bounds hK hτ (x - y)).1 + (Or.inr (detectorReference_separated hΨ hv hVs hp C L n h₁ hfar t hx hy))).le) + exact hbound.trans (mul_le_mul_of_nonneg_left + (detectorReference_mass hΨ hV hp hdiv hback C L n t).2 (by norm_num)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorStirring.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorStirring.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9fa01e66d170fcc7c59c3860915de47c2261433 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorStirring.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorInjection + +namespace OAI + +/-! The prescribed stirring schedule replays the same smooth processor for +successively longer computational times. All coefficients are explicit. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def detectorPhase (C L n : ℕ) (t : ℝ) : ℝ := + letI := ShearFlows.twoAtLeastTwo + ((n : ℝ) + 1) * smoothRamp 0 1 + ((t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / (duration C L n : ℝ)) + +def detectorSpeed (C L n : ℕ) (t : ℝ) : ℝ := + letI := ShearFlows.twoAtLeastTwo + (((n : ℝ) + 1) / (duration C L n : ℝ)) * smoothPulse 0 1 + ((t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / (duration C L n : ℝ)) + +def detectorDriftTerm (V : ℝ → Plane → Plane) (C L n : ℕ) (y : ℝ × Plane) : Plane := + detectorSpeed C L n y.1 • V (detectorPhase C L n y.1) y.2 + +def detectorDrift (V : ℝ → Plane → Plane) (C L : ℕ) (t : ℝ) (x : Plane) : Plane := + detectorBlockSum (detectorDriftTerm V C L) (t, x) + +theorem detectorPhase_smooth (C L n : ℕ) : ContDiff ℝ ∞ (detectorPhase C L n) := + contDiff_const.mul ((smoothRamp_smooth 0 1).comp + (((contDiff_id.sub contDiff_const).sub contDiff_const).div_const _)) + +theorem detectorSpeed_smooth (C L n : ℕ) : ContDiff ℝ ∞ (detectorSpeed C L n) := + contDiff_const.mul ((smoothPulse_smooth 0 1).comp + (((contDiff_id.sub contDiff_const).sub contDiff_const).div_const _)) + +theorem detectorSpeed_before (C L n : ℕ) {t : ℝ} + (ht : t ≤ 2 * ((n : ℝ) + 1) + (duration C L n : ℝ)) : + detectorSpeed C L n t = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have harg : (t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / + (duration C L n : ℝ) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + simp only [detectorSpeed, smoothPulse_before (by norm_num : (0 : ℝ) < 1) harg, + mul_zero] + +theorem detectorSpeed_after (C L n : ℕ) {t : ℝ} + (ht : 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) ≤ t) : + detectorSpeed C L n t = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have harg : 1 ≤ (t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / + (duration C L n : ℝ) := by + apply (le_div_iff₀ hd).mpr + linarith + simp only [detectorSpeed, smoothPulse_after (by norm_num : (0 : ℝ) < 1) harg, + mul_zero] + +theorem detectorDriftTerm_smooth {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L n : ℕ) : + ContDiff ℝ ∞ (detectorDriftTerm V C L n) := + ((detectorSpeed_smooth C L n).comp contDiff_fst).smul + (hV.comp (((detectorPhase_smooth C L n).comp contDiff_fst).prodMk contDiff_snd)) + +theorem detectorDriftTerm_before (V : ℝ → Plane → Plane) (C L n : ℕ) + (y : ℝ × Plane) (hy : y.1 < 2 * ((n : ℝ) + 1)) : + detectorDriftTerm V C L n y = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + rw [detectorDriftTerm, detectorSpeed_before C L n (by linarith), zero_smul] + +theorem detectorDrift_smooth {V : ℝ → Plane → Plane} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (C L : ℕ) : + ContDiff ℝ ∞ (Function.uncurry (detectorDrift V C L)) := + detectorBlockSum_smooth _ (detectorDriftTerm_smooth hV C L) + (detectorDriftTerm_before V C L) + +theorem detectorDrift_periodic {V : ℝ → Plane → Plane} + (hV : ∀ s, PlanePeriodic (V s)) (C L : ℕ) (t : ℝ) : + PlanePeriodic (detectorDrift V C L t) := by + intro x k + unfold detectorDrift detectorBlockSum + apply tsum_congr + intro n + simp only [detectorDriftTerm, hV _ x k] + +theorem detectorDrift_before (V : ℝ → Plane → Plane) (C L : ℕ) + {t : ℝ} (ht : t ≤ 0) (x : Plane) : detectorDrift V C L t x = 0 := by + change (∑' n, detectorDriftTerm V C L n (t, x)) = 0 + trans (∑' _ : ℕ, (0 : Plane)) + swap + · exact tsum_zero + apply tsum_congr + intro n + apply detectorDriftTerm_before + change t < 2 * ((n : ℝ) + 1) + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..812d2e610e4598acf59a770df1a7d74d599eaeb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorSupport.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorReferenceBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusGeometry + +namespace OAI + +/-! Every nonzero point of the transported bump stays within the fixed +torus clearance of its central characteristic. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem detectorBump_near_lift {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) + {q : Plane} (hn : detectorBump b q ≠ 0) : + ∃ k : Fin 2 → ℤ, + ‖planeCoordinates.symm (q - (fun j => (k j : ℝ)) - ![1 / 4, 1 / 4])‖ ≤ 2 * b := by + let k : Fin 2 → ℤ := fun j => ⌊q j⌋ + let q₀ : Plane := q - fun j => (k j : ℝ) + have hq : q₀ + (fun j => (k j : ℝ)) = q := by dsimp only [q₀]; abel + have hp := detectorBump_periodic b q₀ k + rw [hq] at hp + have hn₀ : detectorBump b q₀ ≠ 0 := fun hz => hn (hp.trans hz) + have hc : ∀ j, q₀ j ∈ Icc (0 : ℝ) 1 := by + intro j + change q j - (⌊q j⌋ : ℤ) ∈ Icc (0 : ℝ) 1 + exact ⟨Int.fract_nonneg _, (Int.fract_lt_one _).le⟩ + have hclose := detectorBump_support_in_chart hb hb₁ hc hn₀ + have hpi : ‖q₀ - ![1 / 4, 1 / 4]‖ ≤ b := by + apply (pi_norm_le_iff_of_nonneg hb.le).mpr + intro j + have hj : (![1 / 4, 1 / 4] : Plane) j = 1 / 4 := by fin_cases j <;> rfl + simpa only [Pi.sub_apply, hj, Real.norm_eq_abs] using (hclose j).le + exact ⟨k, (planeCoordinates_symm_norm_le _).trans + (mul_le_mul_of_nonneg_left hpi (by norm_num))⟩ + +theorem detector_transport_radius (L n : ℕ) : + (expansion L : ℝ) ^ (n + 1) * (2 * (width L n : ℝ)) ≤ 1 / 32 := by + have he : (width L n : ℝ) * (expansion L : ℝ) ^ (n + 1) = + (1 / 1000000 : ℝ) * (1 / 2 : ℝ) ^ (n + 1) := by + have h := congrArg (fun r : ℚ => (r : ℝ)) (transported_width L n) + simpa only [Rat.cast_mul, Rat.cast_pow, Rat.cast_natCast, Rat.cast_div, + Rat.cast_one, Rat.cast_ofNat, Nat.cast_pow] using h + have hp : (1 / 2 : ℝ) ^ (n + 1) ≤ 1 := + pow_le_one₀ (by norm_num) (by norm_num) + nlinarith + +theorem planar_flow_distance_bound {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + (hV : ∀ s, ContDiff ℝ ∞ (V s)) (L N : ℕ) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {s : ℝ} (hs : 0 ≤ s) (hsN : s ≤ N) (x y : Plane) : + ‖planeCoordinates.symm (Ψ 0 s x - Ψ 0 s y)‖ ≤ + (expansion L : ℝ) ^ N * ‖planeCoordinates.symm (x - y)‖ := by + have hE := hv.euclidean hV + have h := Convex.norm_image_sub_le_of_norm_fderiv_le (s := (univ : Set EuclideanPlane)) + (fun z _ => (hE.smooth 0 s).differentiable (by simp) z) + (fun z _ => (euclidean_first_variation_operator hE h₁ 0 z hs).trans + (exp_time_le_expansion_pow L N hsN)) + (convex_univ : Convex ℝ (univ : Set EuclideanPlane)) + (mem_univ (planeCoordinates.symm y)) (mem_univ (planeCoordinates.symm x)) + simpa only [euclideanMap, ContinuousLinearEquiv.apply_symm_apply, ← map_sub] using h + +theorem detectorReference_support_near {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hv : PlanarVariations V Ψ) (hV : ∀ s, ContDiff ℝ ∞ (V s)) + (hp : ∀ s, PlanePeriodic (V s)) (C L n : ℕ) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + {t : ℝ} {y : Plane} (hn : detectorReference Ψ C L n t y ≠ 0) : + torusNorm (y - Ψ 0 (detectorPhase C L n t) ![1 / 4, 1 / 4]) ≤ 1 / 32 := by + let σ := detectorPhase C L n t + let q := Ψ σ (-σ) y + have hnq : detectorBump (width L n : ℝ) q ≠ 0 := (mul_ne_zero_iff.mp hn).2 + obtain ⟨k, hk⟩ := detectorBump_near_lift (by exact_mod_cast width_pos L n) + (detector_width_small L n) hnq + let q₀ : Plane := q - fun j => (k j : ℝ) + have hq : q₀ + (fun j => (k j : ℝ)) = q := by dsimp only [q₀]; abel + have hy : y = Ψ 0 σ q₀ + (fun j => (k j : ℝ)) := by + calc + y = Ψ 0 σ q := by simpa only [zero_add] using (hΨ.inverse_right 0 σ y).symm + _ = Ψ 0 σ (q₀ + fun j => (k j : ℝ)) := by rw [hq] + _ = _ := planar_transition_equivariant hΨ hp 0 σ q₀ k + have hσ := detectorPhase_range C L n t + have hdist := planar_flow_distance_bound hv hV L (n + 1) h₁ hσ.1 + (by simpa only [Nat.cast_add, Nat.cast_one] using hσ.2) q₀ ![1 / 4, 1 / 4] + calc + _ ≤ ‖planeCoordinates.symm + ((y - Ψ 0 σ ![1 / 4, 1 / 4]) - fun j => (k j : ℝ))‖ := torusNorm_le_lattice _ k + _ = ‖planeCoordinates.symm (Ψ 0 σ q₀ - Ψ 0 σ ![1 / 4, 1 / 4])‖ := by + rw [hy] + congr 2 + abel + _ ≤ (expansion L : ℝ) ^ (n + 1) * (2 * (width L n : ℝ)) := + hdist.trans (mul_le_mul_of_nonneg_left hk (by positivity)) + _ ≤ 1 / 32 := detector_transport_radius L n + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorTiming.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorTiming.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb9106c53561c89540ccd094c9a092d2e31064e0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorTiming.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorStirring + +namespace OAI + +/-! Exact endpoints of the scheduled injection and stirring clocks. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows + +theorem detectorPhase_before (C L n : ℕ) {t : ℝ} + (ht : t ≤ 2 * ((n : ℝ) + 1) + (duration C L n : ℝ)) : + detectorPhase C L n t = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hh : (t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / + (duration C L n : ℝ) ≤ 0 := + div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + simp only [detectorPhase, smoothRamp_before (by norm_num : (0 : ℝ) < 1) hh, mul_zero] + +theorem detectorPhase_after (C L n : ℕ) {t : ℝ} + (ht : 2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ) ≤ t) : + detectorPhase C L n t = (n : ℝ) + 1 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hh : 1 ≤ (t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / + (duration C L n : ℝ) := by + apply (le_div_iff₀ hd).mpr + linarith + simp only [detectorPhase, smoothRamp_after (by norm_num : (0 : ℝ) < 1) hh, mul_one] + +theorem detectorPhase_hasDerivAt (C L n : ℕ) (t : ℝ) : + HasDerivAt (detectorPhase C L n) (detectorSpeed C L n t) t := by + change HasDerivAt (fun r => ((n : ℝ) + 1) * smoothRamp 0 1 + ((r - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / (duration C L n : ℝ))) _ t + have hr := ((smoothRamp_smooth 0 1).differentiable (by simp) + ((t - 2 * ((n : ℝ) + 1) - (duration C L n : ℝ)) / + (duration C L n : ℝ))).hasDerivAt + have ha := (((hasDerivAt_id t).sub_const (2 * ((n : ℝ) + 1))).sub_const + (duration C L n : ℝ)).div_const (duration C L n : ℝ) + convert (hr.comp t ha).const_mul ((n : ℝ) + 1) using 1 <;> + simp only [detectorSpeed, smoothPulse, Function.comp_def, id_eq, + div_eq_mul_inv, one_mul, mul_assoc, mul_comm] + +theorem detectorSourceTerm_after (C L n : ℕ) (y : ℝ × Plane) + (hy : 2 * ((n : ℝ) + 1) + (duration C L n : ℝ) ≤ y.1) : + detectorSourceTerm C L n y = 0 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hh : 1 ≤ (y.1 - 2 * ((n : ℝ) + 1)) / (duration C L n : ℝ) := by + apply (le_div_iff₀ hd).mpr + linarith + simp only [detectorSourceTerm, smoothPulse_after (by norm_num : (0 : ℝ) < 1) hh, + mul_zero, zero_mul] + +theorem detector_wait_length (C L n : ℕ) : + 1 < 2 * (((n + 1 : ℕ) : ℝ) + 1) - + (2 * ((n : ℝ) + 1) + 2 * (duration C L n : ℝ)) := by + have h : (1 : ℝ) < 2 - 2 * (duration C L n : ℝ) := by + have hh := (Rat.cast_lt (K := ℝ)).mpr (heat_wait_long C L n) + norm_num only [Rat.cast_sub, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_one] at hh + exact hh + push_cast + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff15ba130213d577130423be3a7c3564302ba2f6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosity.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ViscosityScaling +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce + +namespace OAI + +/-! Rescaling physical time and only the horizontal velocity gives the +same scalar observation threshold at every positive viscosity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem viscosityDrift_periodic {a : ℝ → Plane → Plane} + (ha : ∀ t, PlanePeriodic (a t)) (ν : ℝ) : + ∀ t, PlanePeriodic (viscosityDrift ν a t) := by + intro t x k + simp only [viscosityDrift, ha (ν * t) x k] + +theorem viscosityDrift_divergence {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hd : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) (ν : ℝ) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (viscosityDrift ν a t) x = 0 := by + have hs : ContDiff ℝ ∞ (a (ν * t)) := ha.comp (contDiff_const.prodMk contDiff_id) + have h := divergence_scalar_product hs (contDiff_const (c := ν)) x + change PlanarHamiltonian.divergence (fun y => ν • a (ν * t) y) x = 0 + simpa only [hd, mul_zero, fderiv_const_apply, zero_apply, add_zero] using h + +def detectorViscosityForce (V : ℝ → Plane → Plane) (C L : ℕ) (ν : ℝ) : Velocity := + triangularForce ν (viscosityDrift ν (detectorDrift V C L)) + (viscositySource ν (detectorSource C L)) + +theorem detectorViscosity_solution + {V : ℝ → Plane → Plane} (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ t, PlanePeriodic (V t)) + (hd : ∀ t x, PlanarHamiltonian.divergence (V t) x = 0) + (C L : ℕ) {w : ℝ → Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 (detectorDrift V C L) (detectorSource C L) + w (fun _ => 0)) (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hwp : ∀ t, PlanePeriodic (w t)) {ν : ℝ} (hν : 0 < ν) : + IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) (viscosityScalar ν w)) + (fun _ => 0) := by + exact triangularVelocity_solution (viscosityDrift_smooth (detectorDrift_smooth hV C L) ν) + (viscosityScalar_smooth hw ν) (hs.viscosity hw hν.le) + (viscosityDrift_periodic (detectorDrift_periodic hp C L) ν) + (fun t => hwp (ν * t)) + (viscosityDrift_divergence (detectorDrift_smooth hV C L) + (detectorDrift_divergence hV hd C L) ν) + (fun x => by simp only [viscosityDrift, mul_zero, + detectorDrift_before V C L le_rfl x, smul_zero]) + +theorem viscosityScalar_observation {w : ℝ → Plane → ℝ} {ν : ℝ} (hν : 0 < ν) + (E : Set Plane) : + (∃ t, 0 ≤ t ∧ ∃ x ∈ E, 1 / 2 < viscosityScalar ν w t x) ↔ + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, 1 / 2 < w t x := by + constructor + · rintro ⟨t, ht, x, hx, hh⟩ + exact ⟨ν * t, mul_nonneg hν.le ht, x, hx, hh⟩ + · rintro ⟨t, ht, x, hx, hh⟩ + refine ⟨t / ν, div_nonneg ht hν.le, x, hx, ?_⟩ + have he : ν * (t / ν) = t := by field_simp [hν.ne'] + simpa only [viscosityScalar, he] using hh + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..26f32372a4e6bafcf26e7e99b9084d70d062bfbe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityObservation.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorProcessorObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosity + +namespace OAI + +/-! One scalar construction gives the halting observation and unique +classical fluid at every positive viscosity. The force is prescribed from +the processor and source, before the scalar solution is chosen. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +attribute [local irreducible] Recorder.Planar.normalizedHamiltonian planarSlice + euclideanFlowBound detectorDrift detectorSource + +theorem processor_detector_all_viscosities (hE : TorusScalarExistence) + (hK : TorusHeatInput) (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ω Ψ : ℝ → ℝ → Plane → Plane} + (hP : Recorder.Planar.ProcessorProperties I hI Ω Ψ) + (hv : PlanarVariations (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ω y.1 (-y.1) y.2)) : + let V := planarSlice (Recorder.Planar.normalizedHamiltonian I hI) + let L := euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI) + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + ∀ ν : ℝ, 0 < ν → + IsClassicalSolution 1 ν (detectorViscosityForce V detectorBumpDerivativeBound L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V detectorBumpDerivativeBound L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν + (detectorViscosityForce V detectorBumpDerivativeBound L ν) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = + triangularVelocity (viscosityDrift ν (detectorDrift V detectorBumpDerivativeBound L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ((∃ t, 0 ≤ t ∧ ∃ x ∈ Recorder.Planar.observer, + 1 / 2 < viscosityScalar ν w t x) ↔ Alternating.Halts I) := by + dsimp only + let V := planarSlice (Recorder.Planar.normalizedHamiltonian I hI) + let L := euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI) + have hV : ContDiff ℝ ∞ (Function.uncurry V) := hP.torus_smooth + obtain ⟨w, hs, hw, hwp, hn, _⟩ := detectorScalar_exists (V := V) hE + hV hP.torus_spatial_periodic detectorBumpDerivativeBound L + refine ⟨w, hw, hn, ?_, ?_⟩ + · intro t ht + exact detector_scalar_mass_bound (V := V) hV hP.torus_spatial_periodic + hP.torus_solenoidal detectorBumpDerivativeBound L hs hw ht + · intro ν hν + have hu := detectorViscosity_solution (V := V) hV hP.torus_spatial_periodic + hP.torus_solenoidal detectorBumpDerivativeBound L hs hw hwp hν + refine ⟨hu, finite_time_classical_unique (by norm_num) hν.le hu, ?_⟩ + rw [viscosityScalar_observation hν] + exact detector_processor_observation hK I hI hP hv hback hs hw + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..37c18af1e0a80dc9616b9877e26233cefeb1ab22 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/DetectorViscosityProgram.lean @@ -0,0 +1,141 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceScaling +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ProductNames + +namespace OAI + +/-! The finite detector program at a named viscosity. Rational interval +products certify every output component, including all time derivatives. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def detectorForceName (H : FieldExpr) (hH : H.Valid) (C L : ℕ) + (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) : ℕ → RationalVector := fun n => + evaluateDetectorForce H hH C L α b ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + +theorem detectorForceName_spec {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hb : IsFastName b y) : + IsFastVectorName (detectorForceName H hH C L α b) + (mixedDerivative (detectorForce (planarSlice H) C L) α y) := by + intro n + have he := evaluateDetectorForce_spec hH hT hV C L α b hb + ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + simpa [detectorForceName, errorTolerance] using he + +def viscosityForceBalls {ν : ℝ} {y : SpaceTime} (H : FieldExpr) (hH : H.Valid) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (n : ℕ) (j : Fin 3) : QBall := + ((realNameBall a n).pow (α.count 0 + if j = 2 then 1 else 2)).mul + (vectorNameBall (detectorForceName H hH C L α (scaleTimeName a b ha hb)) n j) + +theorem viscosityForceBalls_contains {ν : ℝ} {y : SpaceTime} + {H : FieldExpr} (hH : H.Valid) (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (n : ℕ) (j : Fin 3) : + (viscosityForceBalls H hH C L α a b ha hb n j).Contains + (mixedDerivative (detectorViscosityForce (planarSlice H) C L ν) α y j) := by + rw [mixedDerivative_detectorViscosityForce _ hV] + exact QBall.contains_mul (QBall.contains_pow (realNameBall_contains ha n) _) + (vectorNameBall_contains (detectorForceName_spec hH hT hV C L α + (scaleTimeName_spec a b ha hb)) n j) + +theorem viscosityForceBalls_converges {ν : ℝ} {y : SpaceTime} + {H : FieldExpr} (hH : H.Valid) (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (j : Fin 3) : + QBall.Converges (fun n => viscosityForceBalls H hH C L α a b ha hb n j) + (mixedDerivative (detectorViscosityForce (planarSlice H) C L ν) α y j) := by + rw [mixedDerivative_detectorViscosityForce _ hV] + exact ((realNameBall_converges ha).pow _).mul + (vectorNameBall_converges (detectorForceName_spec hH hT hV C L α + (scaleTimeName_spec a b ha hb)) j) + +def evaluateDetectorViscosityForce {ν : ℝ} {y : SpaceTime} + (H : FieldExpr) (hH : H.Valid) (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : RationalVector := + evaluateVectorBalls (viscosityForceBalls H hH C L α a b ha hb) ε + (vectorBallReady_exists (viscosityForceBalls_converges hH hT hV C L α a b ha hb) hε) + +theorem evaluateDetectorViscosityForce_spec {ν : ℝ} {y : SpaceTime} + {H : FieldExpr} (hH : H.Valid) (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (detectorViscosityForce (planarSlice H) C L ν) α y - + rationalVector (evaluateDetectorViscosityForce H hH hT hV C L α a b ha hb ε hε)‖ ≤ + (ε : ℝ) := + evaluateVectorBalls_spec _ (viscosityForceBalls_converges hH hT hV C L α a b ha hb) + (viscosityForceBalls_contains hH hT hV C L α a b ha hb) ε hε + +def viscosityBound (a : ℕ → ℚ) : ℚ := |a 0| + 1 + +theorem viscosityBound_ge_one (a : ℕ → ℚ) : 1 ≤ viscosityBound a := by + dsimp [viscosityBound] + linarith [abs_nonneg (a 0)] + +theorem viscosityBound_spec {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) : + |ν| ≤ (viscosityBound a : ℝ) := by + have he := ha 0 + simp only [errorTolerance, pow_zero, inv_one] at he + have h := abs_add_le (ν - (a 0 : ℝ)) (a 0) + rw [sub_add_cancel] at h + simp only [viscosityBound, Rat.cast_add, Rat.cast_abs, Rat.cast_one] + linarith + +def detectorViscosityBound (H : FieldExpr) (C L : ℕ) (α : List (Fin 4)) + (a : ℕ → ℚ) (T : ℚ) : ℚ := + viscosityBound a ^ (α.count 0 + 2) * + detectorForceBound H C L α (viscosityBound a * |T|) + +theorem detectorViscosityBound_spec {ν : ℝ} (hν : 0 < ν) {H : FieldExpr} + (hH : H.Valid) (hT : SpatialExpression.NoTime H) + (hV : ContDiff ℝ ∞ (Function.uncurry (planarSlice H))) + (C L : ℕ) (α : List (Fin 4)) {a : ℕ → ℚ} (ha : IsFastRealName a ν) + (T : ℚ) {y : SpaceTime} (ht : 0 ≤ y.1) (htT : y.1 ≤ (T : ℝ)) : + ‖mixedDerivative (detectorViscosityForce (planarSlice H) C L ν) α y‖ ≤ + (detectorViscosityBound H C L α a T : ℝ) := by + have hB : (1 : ℝ) ≤ (viscosityBound a : ℝ) := by + exact_mod_cast viscosityBound_ge_one a + have hn : ν ≤ (viscosityBound a : ℝ) := + (le_abs_self ν).trans (viscosityBound_spec ha) + have ht' : ν * y.1 ≤ (viscosityBound a * |T| : ℚ) := by + push_cast + exact mul_le_mul hn (htT.trans (le_abs_self _)) ht (by linarith) + have hf := detectorForceBound_spec hH hT hV C L α (viscosityBound a * |T|) + (y := (ν * y.1, y.2)) + (mul_nonneg hν.le ht) ht' + have hfn : (0 : ℝ) ≤ detectorForceBound H C L α (viscosityBound a * |T|) := by + exact_mod_cast detectorForceBound_nonneg H C L α (viscosityBound a * |T|) + apply (pi_norm_le_iff_of_nonneg (by + dsimp only [detectorViscosityBound] + push_cast + exact mul_nonneg (pow_nonneg (by linarith) _) hfn)).mpr + intro j + rw [mixedDerivative_detectorViscosityForce _ hV, Real.norm_eq_abs, abs_mul, + abs_of_nonneg (pow_nonneg hν.le _)] + have hk : α.count 0 + (if j = 2 then 1 else 2) ≤ α.count 0 + 2 := by + split_ifs <;> omega + have hp : ν ^ (α.count 0 + if j = 2 then 1 else 2) ≤ + (viscosityBound a : ℝ) ^ (α.count 0 + 2) := + (pow_le_pow_left₀ hν.le hn _).trans (pow_le_pow_right₀ hB hk) + have hv : |mixedDerivative (detectorForce (planarSlice H) C L) α + (ν * y.1, y.2) j| ≤ (detectorForceBound H C L α (viscosityBound a * |T|) : ℝ) := + (norm_le_pi_norm _ j).trans hf + simpa only [detectorViscosityBound, Rat.cast_mul, Rat.cast_pow] using + mul_le_mul hp hv (abs_nonneg _) (pow_nonneg (by linarith) _) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddressGrowth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddressGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..2edc4d547295bcc62af0979f90a6361117b4b9cd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddressGrowth.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteGraph + +namespace OAI + +/-! Explicit exponential address bounds supply the two computable +parameters in the expanding schedule. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +def addressGrowth (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : ℕ := alphabetBase M blank ^ 2 + +def addressFactor (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : ℕ := + (allControls M).length * addressGrowth M blank ^ m + +theorem addressGrowth_ge_one (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : 1 ≤ addressGrowth M blank := by + have hb := alphabetBase_two_le M blank + unfold addressGrowth + nlinarith + +theorem address_number_growth (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) + (a : RecorderAddress M blank (m + n)) : + a.number ≤ addressFactor M blank m * addressGrowth M blank ^ n := by + calc + a.number ≤ (allControls M).length * (alphabetBase M blank ^ (m + n)) ^ 2 := + a.number_bounds.2 + _ = _ := by + unfold addressFactor addressGrowth + have hm : (alphabetBase M blank ^ m) ^ 2 = (alphabetBase M blank ^ 2) ^ m := by + rw [← pow_mul, ← pow_mul, Nat.mul_comm m 2] + have hn : (alphabetBase M blank ^ n) ^ 2 = (alphabetBase M blank ^ 2) ^ n := by + rw [← pow_mul, ← pow_mul, Nat.mul_comm n 2] + simp only [pow_add, mul_pow, hm, hn] + ring + +theorem address_number_growth_real (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) + (a : RecorderAddress M blank (m + n)) : + (a.number : ℝ) ≤ (addressFactor M blank m : ℝ) * (addressGrowth M blank : ℝ) ^ n := by + exact_mod_cast address_number_growth M blank m n a + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddresses.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddresses.lean new file mode 100644 index 0000000000000000000000000000000000000000..4884a1d48aa2cded8211bc413eff1c5ed6c650d7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAddresses.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LatticeArithmetic + +namespace OAI + +/-! Finite planar addresses for the expanding velocity detector. The +index is computed from a state and two bounded stacks; it never requires +executing the selected run. The next layer can enumerate every address. -/ + +namespace ForcedComputation.ExpandingDetector + +structure Address (N B : ℕ) where + state : Fin N + left : Fin B + right : Fin B + deriving DecidableEq, Fintype + +def Address.index {N B : ℕ} (a : Address N B) : ℕ := + 1 + Lattice.pack B 1 a.left a.right a.state + +theorem Address.index_positive {N B : ℕ} (a : Address N B) : 0 < a.index := by + unfold index + omega + +theorem Address.index_le {N B : ℕ} (a : Address N B) : a.index ≤ N * B ^ 2 := by + have hin : a.right.val + B * a.state.val < B * N := + Lattice.prepend_lt a.right.isLt a.state.isLt + have hout := Lattice.prepend_lt a.left.isLt hin + have he : a.index = 1 + (a.left.val + B * (a.right.val + B * a.state.val)) := by + simp only [index, Lattice.pack, Lattice.stackBase, pow_one] + rw [he] + have he' : B * (B * N) = N * B ^ 2 := by ring + rw [he'] at hout + omega + +theorem Address.index_injective (N B : ℕ) : Function.Injective (@Address.index N B) := by + intro a b hab + have hB : 0 < B := lt_of_le_of_lt (Nat.zero_le _) a.left.isLt + have hp : Lattice.pack B 1 a.left a.right a.state = + Lattice.pack B 1 b.left b.right b.state := by + unfold Address.index at hab + omega + have hl := congrArg (Lattice.leftStack B 1) hp + have hr := congrArg (Lattice.rightStack B 1) hp + have hq := congrArg (Lattice.stateDigit B 1) hp + have haL : a.left.val < Lattice.stackBase B 1 := by simpa only [Lattice.stackBase, pow_one] using a.left.isLt + have hbL : b.left.val < Lattice.stackBase B 1 := by simpa only [Lattice.stackBase, pow_one] using b.left.isLt + have haR : a.right.val < Lattice.stackBase B 1 := by simpa only [Lattice.stackBase, pow_one] using a.right.isLt + have hbR : b.right.val < Lattice.stackBase B 1 := by simpa only [Lattice.stackBase, pow_one] using b.right.isLt + rw [Lattice.pack_left haL, Lattice.pack_left hbL] at hl + rw [Lattice.pack_right hB haL haR, Lattice.pack_right hB hbL hbR] at hr + rw [Lattice.pack_state hB haL haR, Lattice.pack_state hB hbL hbR] at hq + cases a + cases b + simp only [Address.mk.injEq] + exact ⟨Fin.ext hq, Fin.ext hl, Fin.ext hr⟩ + +def Address.finIndex {N B : ℕ} (a : Address N B) : Fin (N * B ^ 2) := + ⟨a.index - 1, by have := a.index_positive; have := a.index_le; omega⟩ + +theorem Address.finIndex_injective (N B : ℕ) : + Function.Injective (@Address.finIndex N B) := by + intro a b hab + apply Address.index_injective N B + have he := congrArg Fin.val hab + have ha := a.index_positive + have hb := b.index_positive + change a.index - 1 = b.index - 1 at he + omega + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAmplitude.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..480562d70c50d00ad7e0e004f7c438ed9e70ddac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingAmplitude.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingWorkBudget + +namespace OAI + +/-! One amplitude budget controls each gate and the sum of all gates in a +stage. The latter decays geometrically despite the growing address set. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open Recorder + +def stageAmplitude (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : ℝ := + ((addressFactor M blank m : ℝ) * (addressGrowth M blank : ℝ)^(n+1) + 2) / + (workFactor M blank m * workGrowth M blank ^ (n+1) + 2) + +theorem workGrowth_ge_addressGrowth (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : + (addressGrowth M blank : ℝ) ≤ workGrowth M blank := by + have hA : (1 : ℝ) ≤ addressGrowth M blank := by exact_mod_cast addressGrowth_ge_one M blank + unfold workGrowth + nlinarith + +theorem workFactor_ge_addressFactor (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : + (addressFactor M blank m : ℝ) ≤ workFactor M blank m := by + have hF : (0 : ℝ) ≤ addressFactor M blank m := Nat.cast_nonneg _ + unfold workFactor + nlinarith [sq_nonneg (addressFactor M blank m : ℝ)] + +theorem stageAmplitude_nonneg (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : + 0 ≤ stageAmplitude M blank m n := by + unfold stageAmplitude + apply div_nonneg + · positivity + · have hK := workFactor_nonneg M blank m + have hD := workGrowth_ge_one M blank + positivity + +theorem stageAmplitude_le_one (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : + stageAmplitude M blank m n ≤ 1 := by + have hK := workFactor_nonneg M blank m + have hD := workGrowth_ge_one M blank + have hF : (0 : ℝ) ≤ addressFactor M blank m := Nat.cast_nonneg _ + have hA : (0 : ℝ) ≤ addressGrowth M blank := Nat.cast_nonneg _ + have hp := pow_le_pow_left₀ hA (workGrowth_ge_addressGrowth M blank) (n+1) + unfold stageAmplitude + apply (div_le_one (by positivity)).mpr + linarith [mul_le_mul (workFactor_ge_addressFactor M blank m) hp (pow_nonneg hA _) hK] + +theorem stageAmplitude_total_bound (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : + (Fintype.card (StageWire M hM blank (m+n)) : ℝ) * stageAmplitude M blank m n ≤ + (1/2 : ℝ)^n := by + apply (mul_le_mul_of_nonneg_right (stageWire_card_growth_real M hM blank m n) + (stageAmplitude_nonneg M blank m n)).trans + have hF : (0 : ℝ) ≤ addressFactor M blank m := Nat.cast_nonneg _ + have hA : (1 : ℝ) ≤ addressGrowth M blank := by exact_mod_cast addressGrowth_ge_one M blank + simpa only [stageAmplitude, workFactor, workGrowth, mul_div_assoc] using + geometric_work_bound hF hA n + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e6025f33120fdaaf7d0cf23ad0460061aa3e40b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterBounds.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingClockBounds + +namespace OAI + +/-! Positive derivatives of the gate centers. The constant starting +position disappears, so the estimate retains the reciprocal time scale. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +theorem weight_derivative_bounds {C : ℝ} {m n : ℕ} + (hC : ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (hn : n ≤ m) (a T t : ℝ) : + |iteratedDeriv n (firstWeight a T) t| ≤ |(T / 6)⁻¹| ^ n * C ∧ + |iteratedDeriv n (secondWeight a T) t| ≤ |(T / 6)⁻¹| ^ n * C ∧ + |iteratedDeriv n (thirdWeight a T) t| ≤ |(T / 6)⁻¹| ^ n * C := by + have h₁ : a + T / 4 - (a + T / 12) = T / 6 := by ring + have h₂ : a + 7 * T / 12 - (a + 5 * T / 12) = T / 6 := by ring + have h₃ : a + 11 * T / 12 - (a + 3 * T / 4) = T / 6 := by ring + refine ⟨?_, ?_, ?_⟩ + · simpa only [firstWeight, h₁] using + smoothRamp_derivative_bound hC (a + T / 12) (a + T / 4) t hn + · simpa only [secondWeight, h₂] using + smoothRamp_derivative_bound hC (a + 5 * T / 12) (a + 7 * T / 12) t hn + · simpa only [thirdWeight, h₃] using + smoothRamp_derivative_bound hC (a + 3 * T / 4) (a + 11 * T / 12) t hn + +theorem affine_clock_derivative_bound {f g : ℝ → ℝ} + (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + {n : ℕ} (hn : 0 < n) (c a b t δ : ℝ) + (hfa : |iteratedDeriv n f t| ≤ δ) (hga : |iteratedDeriv n g t| ≤ δ) : + |iteratedDeriv n (fun s => c + a * f s + b * g s) t| ≤ + (|a| + |b|) * δ := by + have hfn : ContDiffAt ℝ n (fun s => a * f s) t := + (contDiff_const.mul hf).contDiffAt.of_le (by simp) + have hgn : ContDiffAt ℝ n (fun s => b * g s) t := + (contDiff_const.mul hg).contDiffAt.of_le (by simp) + have he : (fun s => c + a * f s + b * g s) = + fun s => c + (a * f s + b * g s) := by funext s; ring + rw [he, iteratedDeriv_const_add hn] + change |iteratedDeriv n ((fun s => a * f s) + (fun s => b * g s)) t| ≤ _ + rw [iteratedDeriv_add hfn hgn, iteratedDeriv_const_mul_field, + iteratedDeriv_const_mul_field] + calc + _ ≤ |a * iteratedDeriv n f t| + |b * iteratedDeriv n g t| := abs_add_le _ _ + _ = |a| * |iteratedDeriv n f t| + |b| * |iteratedDeriv n g t| := by + rw [abs_mul, abs_mul] + _ ≤ |a| * δ + |b| * δ := add_le_add + (mul_le_mul_of_nonneg_left hfa (abs_nonneg _)) + (mul_le_mul_of_nonneg_left hga (abs_nonneg _)) + _ = _ := by ring + +theorem scheduledCenter_horizontal_jet {C : ℝ} {m n : ℕ} + (hC : ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (hn : 0 < n) (hnm : n ≤ m) (a T S S' t : ℝ) + (k target : ℕ) (terminal : Bool) : + |iteratedDeriv n (fun s => scheduledCenter a T S S' k target terminal s 0) t| ≤ + |S' * target - S * k| * (|(T / 6)⁻¹| ^ n * C) := by + have he : (fun s => scheduledCenter a T S S' k target terminal s 0) = + fun s => S * k + (S' * target - S * k) * secondWeight a T s := by + funext s + simp only [scheduledCenter, gateCenter, Matrix.cons_val_zero] + ring + rw [he, iteratedDeriv_const_add hn, iteratedDeriv_const_mul_field, abs_mul] + exact mul_le_mul_of_nonneg_left + (weight_derivative_bounds hC hnm a T t).2.1 (abs_nonneg _) + +theorem scheduledCenter_vertical_jet {C : ℝ} {m n : ℕ} + (hC : ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (hn : 0 < n) (hnm : n ≤ m) (a T S S' t : ℝ) + (k target : ℕ) (terminal : Bool) : + |iteratedDeriv n (fun s => scheduledCenter a T S S' k target terminal s 1) t| ≤ + (|-((k : ℝ) + 1) * S| + |((k : ℝ) + 2) * S + (if terminal then S' else -S')|) * + (|(T / 6)⁻¹| ^ n * C) := by + have he : (fun s => scheduledCenter a T S S' k target terminal s 1) = + fun s => -S + (-((k : ℝ) + 1) * S) * firstWeight a T s + + (((k : ℝ) + 2) * S + (if terminal then S' else -S')) * thirdWeight a T s := by + funext s + simp only [scheduledCenter, gateCenter, Matrix.cons_val_one, Matrix.cons_val_zero] + ring + rw [he] + exact affine_clock_derivative_bound (weights_smooth a T).1 (weights_smooth a T).2.2 + hn _ _ _ _ _ (weight_derivative_bounds hC hnm a T t).1 + (weight_derivative_bounds hC hnm a T t).2.2 + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2a3e070dd03366dc103f50c074c347ebfc5e30e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterExpressions.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicResidual +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateClock + +namespace OAI + +/-! The scheduled centers have finite rational expression codes. Their +formal time derivatives are the actual gate velocities. -/ + +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +def rampCode (a b : ℚ) : NonperiodicExpr := + NonperiodicExpr.composeProfile (ProfileExpr.ramp a b) (.coord 0) + +theorem rampCode_val (a b : ℚ) (y : SpaceTime) : + (rampCode a b).val y = smoothRamp a b y.1 := by + rw [rampCode, NonperiodicExpr.val_composeProfile, ProfileExpr.val_ramp] + rfl + +def firstWeightCode (a T : ℚ) : NonperiodicExpr := rampCode (a + T / 12) (a + T / 4) +def secondWeightCode (a T : ℚ) : NonperiodicExpr := rampCode (a + 5 * T / 12) (a + 7 * T / 12) +def thirdWeightCode (a T : ℚ) : NonperiodicExpr := rampCode (a + 3 * T / 4) (a + 11 * T / 12) + +theorem weightCodes_val (a T : ℚ) (y : SpaceTime) : + (firstWeightCode a T).val y = firstWeight a T y.1 ∧ + (secondWeightCode a T).val y = secondWeight a T y.1 ∧ + (thirdWeightCode a T).val y = thirdWeight a T y.1 := by + simp [firstWeightCode, secondWeightCode, thirdWeightCode, rampCode_val, + firstWeight, secondWeight, thirdWeight] + +def centerCode (a T S S' : ℚ) (k target : ℕ) (terminal : Bool) (j : Fin 2) : NonperiodicExpr := + if j = 0 then + .add (.mul (.sub (.const 1) (secondWeightCode a T)) (.const (S * k))) + (.mul (secondWeightCode a T) (.const (S' * target))) + else + .add (.add (.mul (.sub (.const 1) (firstWeightCode a T)) (.const (-S))) + (.mul (.sub (firstWeightCode a T) (thirdWeightCode a T)) (.const (-((k : ℚ) + 2) * S)))) + (.mul (thirdWeightCode a T) (.const (if terminal then S' else -S'))) + +theorem centerCode_val (a T S S' : ℚ) (k target : ℕ) (terminal : Bool) + (j : Fin 2) (y : SpaceTime) : + (centerCode a T S S' k target terminal j).val y = + scheduledCenter a T S S' k target terminal y.1 j := by + obtain ⟨h₁, h₂, h₃⟩ := weightCodes_val a T y + fin_cases j + · simp [centerCode, NonperiodicExpr.val, NonperiodicExpr.sub, h₂, + scheduledCenter, gateCenter] + ring + · cases terminal <;> simp [centerCode, NonperiodicExpr.val, NonperiodicExpr.sub, h₁, h₃, + scheduledCenter, gateCenter] <;> ring + +theorem centerCode_derivative (a T S S' : ℚ) (k target : ℕ) (terminal : Bool) + (j : Fin 2) (t : ℝ) (x : Space) : + ((centerCode a T S S' k target terminal j).diff 0).val (t,x) = + deriv (scheduledCenter a T S S' k target terminal) t j := by + let e := centerCode a T S S' k target terminal j + have hd := (e.smooth.differentiable (by simp) (t,x)).hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + have hde : HasDerivAt (fun s => (centerCode a T S S' k target terminal j).val (s,x)) + ((e.diff 0).val (t,x)) t := by + rw [NonperiodicExpr.val_diff] + exact hd + have he : (fun s => (centerCode a T S S' k target terminal j).val (s,x)) = + fun s => scheduledCenter a T S S' k target terminal s j := + funext (fun s => centerCode_val a T S S' k target terminal j (s,x)) + rw [he] at hde + have hc := ((scheduledCenter_smooth (a : ℝ) T S S' k target terminal).differentiable + (by simp) t).hasDerivAt + have hdj := (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).hasFDerivAt.comp_hasDerivAt t hc + exact hde.unique hdj + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterSize.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..e847e81110e81ed403d729499c53d4572bde77a6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterSize.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingTimeJetBounds + +namespace OAI + +/-! Uniform address dependence of the center jets. Only a linear factor in +the largest address remains after differentiating the constant positions. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +theorem schedule_coefficient_bounds {S S' B : ℝ} (hS : 0 ≤ S) (hSS : S ≤ S') + (_hB : 0 ≤ B) (k target : ℕ) (hk : (k : ℝ) ≤ B) (ht : (target : ℝ) ≤ B) + (terminal : Bool) : + |S' * target - S * k| ≤ 4 * S' * (B + 2) ∧ + (|-((k : ℝ) + 1) * S| + |((k : ℝ) + 2) * S + + (if terminal then S' else -S')|) ≤ 4 * S' * (B + 2) := by + have hSp : 0 ≤ S' := hS.trans hSS + have hk0 : (0 : ℝ) ≤ k := Nat.cast_nonneg k + have ht0 : (0 : ℝ) ≤ target := Nat.cast_nonneg target + constructor + · apply (abs_sub _ _).trans + rw [abs_of_nonneg (mul_nonneg hSp ht0), abs_of_nonneg (mul_nonneg hS hk0)] + have h₁ := mul_le_mul_of_nonneg_left ht hSp + have h₂ := mul_le_mul hSS hk hk0 hSp + nlinarith + · have he : |(if terminal then S' else -S')| = S' := by + cases terminal <;> simp [abs_of_nonneg hSp] + have h₁ : |-((k : ℝ) + 1) * S| = ((k : ℝ) + 1) * S := by + rw [abs_mul, abs_neg, abs_of_nonneg (by positivity), abs_of_nonneg hS] + have h₂ := abs_add_le (((k : ℝ)+2)*S) (if terminal then S' else -S') + rw [he, abs_of_nonneg (by positivity : 0 ≤ ((k : ℝ)+2)*S)] at h₂ + rw [h₁] + have h₃ := mul_le_mul hSS (by linarith : (k : ℝ)+1 ≤ B+1) + (by positivity : 0 ≤ (k : ℝ)+1) hSp + have h₄ := mul_le_mul hSS (by linarith : (k : ℝ)+2 ≤ B+2) + (by positivity : 0 ≤ (k : ℝ)+2) hSp + nlinarith + +theorem scheduledCenter_coordinate_jet_bound {C B S S' T : ℝ} {m n : ℕ} + (hC0 : 0 ≤ C) + (hC : ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (hS : 0 ≤ S) (hSS : S ≤ S') (hB : 0 ≤ B) (hT : 1 ≤ T) + (hn : 1 ≤ n) (hnm : n ≤ m) (a : ℝ) (k target : ℕ) + (hk : (k : ℝ) ≤ B) (ht : (target : ℝ) ≤ B) + (terminal : Bool) (j : Fin 2) (t : ℝ) : + |iteratedDeriv n (fun s => scheduledCenter a T S S' k target terminal s j) t| ≤ + (4 * S' * (B + 2)) * ((6 : ℝ)^m / T * C) := by + have hs := schedule_coefficient_bounds hS hSS hB k target hk ht terminal + have hscale : |(T/6)⁻¹|^n * C ≤ (6 : ℝ)^m / T * C := + mul_le_mul_of_nonneg_right (clock_inverse_power_bound hT hn hnm) hC0 + have hcoeff : 0 ≤ 4*S'*(B+2) := by have := hS.trans hSS; positivity + fin_cases j + · exact (scheduledCenter_horizontal_jet hC (by omega) hnm a T S S' t k target terminal).trans + (mul_le_mul hs.1 hscale (by positivity) hcoeff) + · exact (scheduledCenter_vertical_jet hC (by omega) hnm a T S S' t k target terminal).trans + (mul_le_mul hs.2 hscale (by positivity) hcoeff) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterVelocity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterVelocity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d7d1dd1b4afe8e72932d5efc857f26329b8b2ff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCenterVelocity.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCenterSize + +namespace OAI + +/-! Uniform bounds for every time derivative of the gate velocity retain +one reciprocal duration factor, including the zeroth velocity derivative. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +theorem deriv_component {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) (j : Fin 2) (t : ℝ) : + deriv (fun s => c s j) t = deriv c t j := by + have hd := (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).hasFDerivAt.comp_hasDerivAt t + ((hc.differentiable (by simp) t).hasDerivAt) + exact hd.deriv + +theorem iteratedDeriv_velocity_component {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) + (j : Fin 2) (i : ℕ) (t : ℝ) : + iteratedDeriv i (fun s => deriv c s j) t = + iteratedDeriv (i+1) (fun s => c s j) t := by + have he : (fun s => deriv c s j) = deriv (fun s => c s j) := + funext (fun s => (deriv_component hc j s).symm) + rw [he, iteratedDeriv_succ'] + +theorem scheduledVelocity_joint_jet {C B S S' T : ℝ} {m i : ℕ} + (hC0 : 0 ≤ C) + (hC : ∀ q ≤ m+1, ∀ t, |iteratedDeriv q (smoothRamp 0 1) t| ≤ C) + (hS : 0 ≤ S) (hSS : S ≤ S') (hB : 0 ≤ B) (hT : 1 ≤ T) + (hi : i ≤ m) (a : ℝ) (k target : ℕ) + (hk : (k : ℝ) ≤ B) (ht : (target : ℝ) ≤ B) + (terminal : Bool) (j : Fin 2) (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ i + (fun p : ℝ × Plane => deriv (scheduledCenter a T S S' k target terminal) p.1 j) y‖ ≤ + (4*S'*(B+2)) * ((6 : ℝ)^(m+1)/T*C) := by + have hc := scheduledCenter_smooth a T S S' k target terminal + have hv : ContDiff ℝ ∞ (fun s => deriv (scheduledCenter a T S S' k target terminal) s j) := + (contDiff_apply ℝ ℝ j).comp ((contDiff_infty_iff_deriv.mp hc).2) + apply (time_comp_jet_bound hv i y).trans + rw [Real.norm_eq_abs, iteratedDeriv_velocity_component hc] + exact scheduledCenter_coordinate_jet_bound hC0 hC hS hSS hB hT + (by omega) (by omega) a k target hk ht terminal j y.1 + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingClockBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingClockBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3cb39c6426b6010d75fa21ee7f4e7ab84bc36fd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingClockBounds.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateClock +import Mathlib.Analysis.Calculus.ContDiff.Bounds +import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas + +namespace OAI + +/-! All clock derivatives have bounds independent of their starting time. +The only scaling factor is the reciprocal transition duration. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set +open scoped ContDiff Topology + +theorem unitPulse_compact : HasCompactSupport (smoothPulse 0 1) := by + apply HasCompactSupport.intro (K := Icc (0 : ℝ) 1) isCompact_Icc + intro t ht + by_cases h : t ≤ 0 + · exact smoothPulse_before (by norm_num) h + · exact smoothPulse_after (by norm_num) (by + have := not_and_or.mp ht + rcases this with h0 | h1 + · exact False.elim (h0 (le_of_lt (lt_of_not_ge h))) + · exact le_of_lt (lt_of_not_ge h1)) + +theorem unitRamp_jet_bound (m : ℕ) : ∃ C : ℝ, 1 ≤ C ∧ + ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C := by + obtain ⟨B, _, hB⟩ := unitPulse_compact.exists_bound_iteratedFDeriv + (smoothPulse_smooth 0 1) m + refine ⟨max 1 B, le_max_left _ _, ?_⟩ + intro i hi t + cases i with + | zero => + simpa only [iteratedDeriv_zero, abs_of_nonneg (smoothRamp_range 0 1 t).1] using + (smoothRamp_range 0 1 t).2.trans (le_max_left 1 B) + | succ i => + rw [iteratedDeriv_succ'] + have hb := hB i (by omega) t + rw [norm_iteratedFDeriv_eq_norm_iteratedDeriv, Real.norm_eq_abs] at hb + exact hb.trans (le_max_right _ _) + +theorem smoothRamp_iteratedDeriv_scale (a b t : ℝ) (n : ℕ) : + iteratedDeriv n (smoothRamp a b) t = + (b - a)⁻¹ ^ n * iteratedDeriv n (smoothRamp 0 1) ((b - a)⁻¹ * (t - a)) := by + have he : smoothRamp a b = + fun t => smoothRamp 0 1 ((b - a)⁻¹ * (t - a)) := by + funext t + simp only [smoothRamp, sub_zero, div_eq_mul_inv, inv_one, mul_one] + rw [mul_comm] + rw [he] + have hshift := congrFun (iteratedDeriv_comp_sub_const (n := n) + (f := fun u => smoothRamp 0 1 ((b - a)⁻¹ * u)) (s := a)) t + have hscale := congrFun (iteratedDeriv_comp_const_mul (n := n) + ((smoothRamp_smooth 0 1).of_le (by simp)) ((b - a)⁻¹)) (t - a) + exact hshift.trans hscale + +theorem smoothRamp_derivative_bound {C : ℝ} {m : ℕ} + (hC : ∀ i ≤ m, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (a b t : ℝ) {n : ℕ} (hn : n ≤ m) : + |iteratedDeriv n (smoothRamp a b) t| ≤ |(b - a)⁻¹| ^ n * C := by + rw [smoothRamp_iteratedDeriv_scale, abs_mul, abs_pow] + exact mul_le_mul_of_nonneg_left (hC n hn _) (pow_nonneg (abs_nonneg _) n) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingConcentrationFamily.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingConcentrationFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..926de6e37e7d7a13aa97f799d7d185d48d560204 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingConcentrationFamily.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCutoffTransport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateCollars + +namespace OAI + +/-! Each individual gate carries a uniformly compact family of tests, +including the time derivative, over its whole scheduled motion. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set +open scoped ContDiff + +theorem scheduledCenter_bounded (a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t, ‖scheduledCenter a T S S' k target terminal t‖ ≤ B := by + let c := scheduledCenter a T S S' k target terminal + obtain ⟨B, hB⟩ := isCompact_Icc.bddAbove_image + ((scheduledCenter_smooth a T S S' k target terminal).continuous.norm.continuousOn : + ContinuousOn (fun t => ‖c t‖) (Icc a (a + T))) + have hb (t : ℝ) (ht : t ∈ Icc a (a + T)) : ‖c t‖ ≤ B := + hB (mem_image_of_mem _ ht) + refine ⟨max 0 B, le_max_left _ _, ?_⟩ + intro t + change ‖c t‖ ≤ max 0 B + by_cases hleft : t < a + · have he : c t = c a := by + rw [show c t = ![S * k, -S] from scheduledCenter_before a hT S S' k target terminal (by linarith), + show c a = ![S * k, -S] from scheduledCenter_initial a hT S S' k target terminal] + rw [he] + exact (hb a ⟨le_rfl, by linarith⟩).trans (le_max_right _ _) + · by_cases hright : a + T < t + · have he : c t = c (a + T) := by + rw [show c t = ![S' * target, if terminal then S' else -S'] from + scheduledCenter_after a hT S S' k target terminal (by linarith), + show c (a + T) = ![S' * target, if terminal then S' else -S'] from + scheduledCenter_final a hT S S' k target terminal] + rw [he] + exact (hb (a + T) ⟨by linarith, le_rfl⟩).trans (le_max_right _ _) + · exact (hb t ⟨le_of_not_gt hleft, le_of_not_gt hright⟩).trans (le_max_right _ _) + +theorem concentrationFamily_compact {R : ℝ} (hR : 0 < R) + {c : ℝ → Plane} {B : ℝ} (hB : ∀ t, ‖c t‖ ≤ B) : + ∃ K : Set Plane, IsCompact K ∧ + (∀ t, Function.support (concentrationCutoff R (c t)) ⊆ K) ∧ + (∀ t, Function.support (concentrationDerivative R c t) ⊆ K) := by + let K : Set Plane := Icc (fun _ => -B - R) (fun _ => B + R) + have hb (t : ℝ) (x : Plane) (hx : ∀ j, |x j - c t j| ≤ R) : x ∈ K := by + constructor <;> intro j + · have hc : |c t j| ≤ B := + (show |c t j| ≤ ‖c t‖ from by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (c t) j).trans (hB t) + have hj := (abs_le.mp (hx j)).1 + have hjc := (abs_le.mp hc).1 + dsimp [K] + linarith + · have hc : |c t j| ≤ B := + (show |c t j| ≤ ‖c t‖ from by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (c t) j).trans (hB t) + have hj := (abs_le.mp (hx j)).2 + have hjc := (abs_le.mp hc).2 + dsimp [K] + linarith + refine ⟨K, isCompact_Icc, ?_, ?_⟩ + · exact fun t x hx => hb t x (concentrationCutoff_support hR (c t) hx) + · exact fun t x hx => hb t x (concentrationDerivative_support hR c t hx) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..883b78df12bd15bea11dff7d6b7b2f6e1ac8b723 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffObservation.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingObservation + +namespace OAI + +/-! The concrete concentration cutoffs retain their mass when the radius +doubles, and place that mass on the required side of the fixed observer. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set MeasureTheory + +theorem concentrationCutoff_le_doubled {R R' : ℝ} (hR : 0 < R) (hRR : 2 * R ≤ R') + (c x : Plane) : concentrationCutoff R c x ≤ concentrationCutoff R' c x := by + by_cases hx : concentrationCutoff R c x = 0 + · rw [hx] + exact (concentrationCutoff_range R' c x).1 + · have hR' : 0 < R' := by linarith + have hb := concentrationCutoff_support hR c hx + have he : concentrationCutoff R' c x = 1 := concentrationCutoff_one hR' (fun j => by + have hj := hb j + linarith) + rw [he] + exact (concentrationCutoff_range R c x).2 + +theorem concentrationCutoff_integrable {ρ : Plane → ℝ} (hρ : Integrable ρ) + (R : ℝ) (c : Plane) : Integrable (fun x => concentrationCutoff R c x * ρ x) := by + apply hρ.bdd_mul (concentrationCutoff_smooth R c).continuous.aestronglyMeasurable + filter_upwards [] with x + rw [Real.norm_eq_abs, abs_of_nonneg (concentrationCutoff_range R c x).1] + exact (concentrationCutoff_range R c x).2 + +theorem concentration_mass_le_doubled {ρ : Plane → ℝ} (hρ : Integrable ρ) + (hn : ∀ x, 0 ≤ ρ x) {R R' : ℝ} (hR : 0 < R) (hRR : 2 * R ≤ R') (c : Plane) : + (∫ x, concentrationCutoff R c x * ρ x) ≤ + ∫ x, concentrationCutoff R' c x * ρ x := by + apply integral_mono (concentrationCutoff_integrable hρ R c) + (concentrationCutoff_integrable hρ R' c) + intro x + exact mul_le_mul_of_nonneg_right (concentrationCutoff_le_doubled hR hRR c x) (hn x) + +theorem concentrationCutoff_zero_on_upper {R : ℝ} (hR : 0 < R) {c : Plane} + (hc : c 1 ≤ -R) {x : Plane} (hx : x ∈ upperHalfPlane) : + concentrationCutoff R c x = 0 := by + by_contra hn + have hb := concentrationCutoff_support hR c hn 1 + have hxu : 0 < x 1 := hx + linarith [(le_abs_self (x 1 - c 1)).trans hb] + +theorem concentrationCutoff_zero_off_upper {R : ℝ} (hR : 0 < R) {c : Plane} + (hc : R < c 1) {x : Plane} (hx : x ∉ upperHalfPlane) : + concentrationCutoff R c x = 0 := by + by_contra hn + have hb := concentrationCutoff_support hR c hn 1 + have hxu : x 1 ≤ 0 := le_of_not_gt hx + linarith [neg_le_abs (x 1 - c 1)] + +theorem concentration_nonterminal_observer {ρ : Plane → ℝ} (hρ : Integrable ρ) + (hn : ∀ x, 0 ≤ ρ x) {R δ : ℝ} (hR : 0 < R) {c : Plane} (hc : c 1 ≤ -R) + (hr : (∫ x, ρ x) - δ ≤ ∫ x, concentrationCutoff R c x * ρ x) : + (∫ x in upperHalfPlane, ρ x) ≤ δ := + nonterminal_observer_bound hρ (concentrationCutoff_integrable hρ R c) hn + (fun x => (concentrationCutoff_range R c x).2) + (fun _ hx => concentrationCutoff_zero_on_upper hR hc hx) hr + +theorem concentration_terminal_observer {ρ : Plane → ℝ} (hρ : Integrable ρ) + (hn : ∀ x, 0 ≤ ρ x) {R δ : ℝ} (hR : 0 < R) {c : Plane} (hc : R < c 1) + (hm : (∫ x, ρ x) = 1) (hδ : δ < 1 / 2) + (hr : (∫ x, ρ x) - δ ≤ ∫ x, concentrationCutoff R c x * ρ x) : + 1 / 2 < ∫ x in upperHalfPlane, ρ x := + terminal_observer_detects hρ (concentrationCutoff_integrable hρ R c) hn + (fun x => (concentrationCutoff_range R c x).2) + (fun _ hx => concentrationCutoff_zero_off_upper hR hc hx) hm hδ hr + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffTransport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e958096a563386c2cae93a420041afaffc79d46 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingCutoffTransport.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateMotion + +namespace OAI + +/-! The concentration test is constant wherever a moving gate can fail +to be a rigid translation. This gives exact transport cancellation. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows VelocityDetector Set Filter +open scoped ContDiff Topology + +theorem concentrationCutoff_joint_smooth (R : ℝ) {c : ℝ → Plane} + (hc : ContDiff ℝ ∞ c) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => concentrationCutoff R (c p.1) p.2) := by + change ContDiff ℝ ∞ (fun p : ℝ × Plane => massCutoff (R⁻¹ • (p.2 - c p.1))) + exact massCutoff_smooth.comp + ((contDiff_const : ContDiff ℝ ∞ (fun _ : ℝ × Plane => R⁻¹)).smul + (contDiff_snd.sub (hc.comp contDiff_fst))) + +theorem concentrationCutoff_fderiv_zero {R : ℝ} (hR : 0 < R) {c x : Plane} + (hx : ∃ j, R < |x j - c j|) : + fderiv ℝ (concentrationCutoff R c) x = 0 := by + obtain ⟨j, hj⟩ := hx + have hn : ∀ᶠ y : Plane in 𝓝 x, R < |y j - c j| := + (isOpen_lt continuous_const (((continuous_apply j).sub continuous_const).abs)).mem_nhds hj + have he : concentrationCutoff R c =ᶠ[𝓝 x] fun _ => 0 := by + filter_upwards [hn] with y hy + by_contra hz + exact (not_le_of_gt hy) (concentrationCutoff_support hR c hz j) + rw [he.fderiv_eq, fderiv_const_apply] + +theorem concentrationCutoff_transport_cancel {R : ℝ} (hR : 0 < R) + {c : ℝ → Plane} (v : Plane → Plane) (t : ℝ) + (hv : ∀ x, (∀ j, |x j - c t j| < 2 * R) → v x = deriv c t) (x : Plane) : + -fderiv ℝ (concentrationCutoff R (c t)) x (deriv c t) + + fderiv ℝ (concentrationCutoff R (c t)) x (v x) = 0 := by + by_cases hx : ∀ j, |x j - c t j| < 2 * R + · rw [hv x hx, neg_add_cancel] + · push Not at hx + obtain ⟨j, hj⟩ := hx + have hz := concentrationCutoff_fderiv_zero hR + (c := c t) (x := x) ⟨j, by linarith⟩ + rw [hz] + simp only [zero_apply, neg_zero, add_zero] + +def concentrationDerivative (R : ℝ) (c : ℝ → Plane) (t : ℝ) (x : Plane) : ℝ := + -fderiv ℝ (concentrationCutoff R (c t)) x (deriv c t) + +theorem concentrationDerivative_smooth (R : ℝ) {c : ℝ → Plane} + (hc : ContDiff ℝ ∞ c) : + ContDiff ℝ ∞ (Function.uncurry (concentrationDerivative R c)) := by + have hφ : ContDiff ℝ ∞ (Function.uncurry (fun t x => concentrationCutoff R (c t) x)) := + concentrationCutoff_joint_smooth R hc + have hv : ContDiff ℝ ∞ (deriv c) := (contDiff_infty_iff_deriv.mp hc).2 + exact ((scalar_spatial_fderiv_smooth hφ).clm_apply (hv.comp contDiff_fst)).neg + +theorem concentrationDerivative_support {R : ℝ} (hR : 0 < R) (c : ℝ → Plane) + (t : ℝ) : Function.support (concentrationDerivative R c t) ⊆ + {x | ∀ j, |x j - c t j| ≤ R} := by + intro x hx j + by_contra hn + have hz := concentrationCutoff_fderiv_zero hR + (c := c t) (x := x) ⟨j, lt_of_not_ge hn⟩ + apply hx + simp only [concentrationDerivative, hz, zero_apply, neg_zero] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDetectorScales.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDetectorScales.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce13e668b6e445f7ee16918a8366e90cedccb5c9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDetectorScales.lean @@ -0,0 +1,158 @@ +import Mathlib.Analysis.SpecificLimits.Normed +import Mathlib.Topology.Algebra.InfiniteSum.Real +import Mathlib.Tactic + +namespace OAI + +/-! The explicit expanding-array scales in the bounded velocity detector. +The diffusion loss is summable even though the number of addresses grows. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector + +def expansion (D : ℝ) : ℝ := 4 * D + +def initialRadius (ν D K : ℝ) : ℝ := + 1024 * 3000 * (1 + ν) * expansion D * (K * D + 2) + +def radius (ν D K : ℝ) (n : ℕ) : ℝ := initialRadius ν D K * expansion D ^ n + +def duration (ν D K : ℝ) (n : ℕ) : ℝ := + 16 * radius ν D K (n + 1) * (K * D ^ (n + 1) + 2) + +theorem initialRadius_pos {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + 0 < initialRadius ν D K := by + have hD' : 0 < D := by linarith + unfold initialRadius expansion + positivity + +theorem expansion_ge_four {D : ℝ} (hD : 1 ≤ D) : 4 ≤ expansion D := by + unfold expansion + linarith + +theorem radius_pos {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + 0 < radius ν D K n := by + unfold radius + exact mul_pos (initialRadius_pos hν hD hK) + (pow_pos (lt_of_lt_of_le (by norm_num) (expansion_ge_four hD)) n) + +theorem radius_grows {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + 2 * radius ν D K n ≤ radius ν D K (n + 1) := by + have he := expansion_ge_four hD + have hr := (radius_pos hν hD hK n).le + have hid : radius ν D K (n + 1) = expansion D * radius ν D K n := by + simp only [radius, pow_succ] + ring + rw [hid] + exact mul_le_mul_of_nonneg_right (by linarith) hr + +theorem duration_ratio {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + duration ν D K n / radius ν D K n ^ 2 = + (16 * expansion D / initialRadius ν D K) * + (K * D * (1 / 4 : ℝ) ^ n + 2 * (expansion D)⁻¹ ^ n) := by + have hr := (initialRadius_pos hν hD hK).ne' + have he : expansion D ≠ 0 := ne_of_gt (by linarith [expansion_ge_four hD]) + have hpow : (D / expansion D) ^ n = (1 / 4 : ℝ) ^ n := by + congr 1 + unfold expansion + field_simp [ne_of_gt (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hD)] + rw [← hpow, div_pow, inv_pow] + unfold duration radius + rw [pow_succ, pow_succ] + field_simp [hr, he] + +theorem duration_ratio_le {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + duration ν D K n / radius ν D K n ^ 2 ≤ + (16 * expansion D / initialRadius ν D K) * (K * D + 2) * (1 / 4 : ℝ) ^ n := by + rw [duration_ratio hν hD hK] + have he : 0 < expansion D := by linarith [expansion_ge_four hD] + have hi : (expansion D)⁻¹ ≤ (1 / 4 : ℝ) := by + simpa only [one_div] using + (inv_le_inv₀ he (by norm_num)).mpr (expansion_ge_four hD) + have hp := pow_le_pow_left₀ (inv_nonneg.mpr he.le) hi n + have hc : 0 ≤ 16 * expansion D / initialRadius ν D K := by + exact div_nonneg (by positivity) (initialRadius_pos hν hD hK).le + have htwo : 2 * (expansion D)⁻¹ ^ n ≤ 2 * (1 / 4 : ℝ) ^ n := + mul_le_mul_of_nonneg_left hp (by norm_num : (0 : ℝ) ≤ 2) + have hsum : K * D * (1 / 4 : ℝ) ^ n + 2 * (expansion D)⁻¹ ^ n ≤ + K * D * (1 / 4 : ℝ) ^ n + 2 * (1 / 4 : ℝ) ^ n := by linarith + calc + _ ≤ (16 * expansion D / initialRadius ν D K) * + (K * D * (1 / 4 : ℝ) ^ n + 2 * (1 / 4 : ℝ) ^ n) := + mul_le_mul_of_nonneg_left hsum hc + _ = _ := by ring + +theorem diffusion_loss_term_bound {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + ν * 3000 * (duration ν D K n / radius ν D K n ^ 2) ≤ + (ν / (1 + ν) / 64) * (1 / 4 : ℝ) ^ n := by + have he : expansion D ≠ 0 := ne_of_gt (by linarith [expansion_ge_four hD]) + have hD' : 0 < D := by linarith + have hk : K * D + 2 ≠ 0 := by positivity + have hn : 1 + ν ≠ 0 := by positivity + calc + _ ≤ ν * 3000 * ((16 * expansion D / initialRadius ν D K) * + (K * D + 2) * (1 / 4 : ℝ) ^ n) := + mul_le_mul_of_nonneg_left (duration_ratio_le hν hD hK n) (by positivity) + _ = _ := by + unfold initialRadius + field_simp [he, hk, hn] + ring + +theorem diffusion_loss_summable {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + Summable (fun n => ν * 3000 * (duration ν D K n / radius ν D K n ^ 2)) := by + have hg : Summable (fun n : ℕ => (ν / (1 + ν) / 64) * (1 / 4 : ℝ) ^ n) := + (summable_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 4) + (by norm_num)).mul_left _ + apply hg.of_nonneg_of_le + · intro n + unfold duration + have hr := radius_pos hν hD hK (n + 1) + have hD' : 0 < D := by linarith + positivity + · exact diffusion_loss_term_bound hν hD hK + +theorem total_stage_loss_le {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + (∑' n, ν * 3000 * (duration ν D K n / radius ν D K n ^ 2)) ≤ + ν / (1 + ν) / 48 := by + have hg : Summable (fun n : ℕ => (ν / (1 + ν) / 64) * (1 / 4 : ℝ) ^ n) := + (summable_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 4) + (by norm_num)).mul_left _ + calc + _ ≤ ∑' n : ℕ, (ν / (1 + ν) / 64) * (1 / 4 : ℝ) ^ n := + (diffusion_loss_summable hν hD hK).tsum_le_tsum + (diffusion_loss_term_bound hν hD hK) hg + _ = _ := by + rw [tsum_mul_left, tsum_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 4) + (by norm_num)] + ring + +theorem initial_loss_lt {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + ν * 3000 / initialRadius ν D K ^ 2 < 1 / 48 := by + have he := expansion_ge_four hD + have hk : 2 ≤ K * D + 2 := by nlinarith + have hR : 1024 * 3000 * (1 + ν) ≤ initialRadius ν D K := by + unfold initialRadius + nlinarith [mul_nonneg (show 0 ≤ 1024 * 3000 * (1 + ν) by positivity) + (show 0 ≤ expansion D * (K * D + 2) - 1 by nlinarith)] + have hr := initialRadius_pos hν hD hK + apply (div_lt_iff₀ (sq_pos_of_pos hr)).mpr + nlinarith [sq_nonneg (ν - 1), sq_nonneg (initialRadius ν D K - 1024 * 3000 * (1 + ν))] + +theorem total_diffusion_loss_lt {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + ν * 3000 / initialRadius ν D K ^ 2 + + (∑' n, ν * 3000 * (duration ν D K n / radius ν D K n ^ 2)) < 1 / 24 := by + have hi := initial_loss_lt hν hD hK + have hs := total_stage_loss_le hν hD hK + have hr : ν / (1 + ν) < 1 := (div_lt_one (by positivity)).mpr (by linarith) + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDiffusionBudget.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDiffusionBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..43bf3dc56f3b754d6f5dc76763b91530e1b5e054 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDiffusionBudget.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDetectorScales + +namespace OAI + +/-! The expanding schedule starts at time two. The initial waiting loss +and all later gate losses still fit the same fixed mass margin. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector + +theorem initial_two_time_loss_lt {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + 2 * ν * 3000 / initialRadius ν D K ^ 2 < 1 / 48 := by + have he := expansion_ge_four hD + have hk : 2 ≤ K * D + 2 := by nlinarith + have hR : 1024 * 3000 * (1 + ν) ≤ initialRadius ν D K := by + unfold initialRadius + nlinarith [mul_nonneg (show 0 ≤ 1024 * 3000 * (1 + ν) by positivity) + (show 0 ≤ expansion D * (K * D + 2) - 1 by nlinarith)] + have hr := initialRadius_pos hν hD hK + apply (div_lt_iff₀ (sq_pos_of_pos hr)).mpr + nlinarith [sq_nonneg (ν - 1), sq_nonneg (initialRadius ν D K - 1024 * 3000 * (1 + ν))] + +theorem total_two_time_diffusion_loss_lt {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + 2 * ν * 3000 / initialRadius ν D K ^ 2 + + (∑' n, ν * 3000 * (duration ν D K n / radius ν D K n ^ 2)) < 1 / 24 := by + have hi := initial_two_time_loss_lt hν hD hK + have hs := total_stage_loss_le hν hD hK + have hr : ν / (1 + ν) < 1 := (div_lt_one (by positivity)).mpr (by linarith) + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDrift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDrift.lean new file mode 100644 index 0000000000000000000000000000000000000000..8aead11ad1b7a122c9042e65e8d14cc9011a5e36 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDrift.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderDynamics +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingStageTimes +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneFiniteDivergence + +namespace OAI + +/-! The prescribed expanding-array drift is a locally finite smooth sum. +Every stage is determined from the full finite recorder table. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector MeasureTheory +open scoped ContDiff BigOperators + +def stageDrift (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (ν D K : ℝ) (n : ℕ) : ℝ → Plane → Plane := + recorderStageField M hM blank (m + n) (stageStart ν D K n) (duration ν D K n) + (radius ν D K n) (radius ν D K (n + 1)) + +def expandingDrift (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (ν D K : ℝ) (t : ℝ) (x : Plane) : Plane := + detectorBlockSum (fun n y => stageDrift M hM blank m ν D K n y.1 y.2) (t, x) + +theorem stageDrift_smooth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (ν D K : ℝ) (n : ℕ) : + ContDiff ℝ ∞ (Function.uncurry (stageDrift M hM blank m ν D K n)) := + recorderStageField_smooth M hM blank (m + n) _ _ _ _ + +theorem stageDrift_zero_before (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (n : ℕ) {t : ℝ} (ht : t ≤ stageStart ν D K n) (x : Plane) : + stageDrift M hM blank m ν D K n t x = 0 := + recorderStageField_zero_before M hM blank (m + n) _ + (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hν hD hK n)) ht x + +theorem stageDrift_zero_after (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (n : ℕ) {t : ℝ} (ht : stageStart ν D K (n + 1) ≤ t) (x : Plane) : + stageDrift M hM blank m ν D K n t x = 0 := by + apply recorderStageField_zero_after M hM blank (m + n) _ + (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hν hD hK n)) + simpa only [stageStart_succ] using ht + +theorem expandingDrift_smooth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + ContDiff ℝ ∞ (Function.uncurry (expandingDrift M hM blank m ν D K)) := by + apply detectorBlockSum_smooth + · exact fun n => stageDrift_smooth M hM blank m ν D K n + · intro n y hy + exact stageDrift_zero_before M hM blank m hν hD hK n + (hy.le.trans (stageStart_ge hν hD hK n)) y.2 + +theorem expandingDrift_initial (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + {t : ℝ} (ht : t ≤ 2) (x : Plane) : + expandingDrift M hM blank m ν D K t x = 0 := by + have hz (n : ℕ) : stageDrift M hM blank m ν D K n t x = 0 := by + apply stageDrift_zero_before M hM blank m hν hD hK n + have hn := stageStart_ge hν hD hK n + have hn0 : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + simp only [expandingDrift, detectorBlockSum, hz, tsum_zero] + +theorem expandingDrift_eq_prefix (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (T : ℝ) (N : ℕ) (hN : T + 1 ≤ (N : ℝ)) {t : ℝ} (ht : t ≤ T) : + expandingDrift M hM blank m ν D K t = + fun x => ∑ n ∈ Finset.range N, stageDrift M hM blank m ν D K n t x := by + funext x + apply tsum_eq_sum + intro n hn + have hnN : N ≤ n := Nat.le_of_not_gt (by simpa only [Finset.mem_range] using hn) + have hnN' : (N : ℝ) ≤ n := by exact_mod_cast hnN + have htime := stageStart_ge hν hD hK n + have hn0 : (0 : ℝ) ≤ n := Nat.cast_nonneg n + apply stageDrift_zero_before M hM blank m hν hD hK n + linarith + +theorem stageDrift_properties (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) (t : ℝ) : + HasCompactSupport (stageDrift M hM blank m ν D K n t) ∧ + (∀ x, PlanarHamiltonian.divergence (stageDrift M hM blank m ν D K n t) x = 0) ∧ + (∫ x, stageDrift M hM blank m ν D K n t x) = 0 := + recorderStageField_properties M hM blank (m + n) _ _ (radius_pos hν hD hK n) _ t + +theorem expandingDrift_divergence (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (expandingDrift M hM blank m ν D K t) x = 0 := by + rw [expandingDrift_eq_prefix M hM blank m hν hD hK t ⌈t + 1⌉₊ (Nat.le_ceil _) le_rfl] + have hs (n : ℕ) (_ : n ∈ Finset.range ⌈t + 1⌉₊) : + ContDiff ℝ ∞ (fun y => stageDrift M hM blank m ν D K n t y) := by + have hi : ContDiff ℝ ∞ (fun y : Plane => (t, y)) := contDiff_const.prodMk contDiff_id + have hh := (stageDrift_smooth M hM blank m ν D K n).comp hi + simpa only [Function.comp_def, Function.uncurry_apply_pair] using hh + rw [PlanarHamiltonian.divergence_finite_sum _ _ hs] + apply Finset.sum_eq_zero + intro n _ + exact (stageDrift_properties M hM blank m hν hD hK n t).2.1 x + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftL2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5c778490faf942131c902ee38e1d94c4a8fb32a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftL2.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingForceSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactH2 + +namespace OAI + +/-! Finite-time strong regularity of the actual expanding drift. A finite +prefix agrees on an open time neighborhood, including at the endpoints. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set Filter +open scoped ContDiff Topology + +theorem expandingDrift_eq_finite_near + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (T : ℝ) (N : ℕ) (hN : T + 2 ≤ (N : ℝ)) {t : ℝ} (ht : t ≤ T) (x : Plane) : + Function.uncurry (expandingDrift M hM blank m σ D K) =ᶠ[𝓝 (t,x)] + Function.uncurry (finiteDrift M hM blank m σ D K N) := by + have htime : ∀ᶠ y : ℝ × Plane in 𝓝 (t,x), y.1 < T + 1 := + (isOpen_lt continuous_fst continuous_const).mem_nhds (by change t < T + 1; linarith) + filter_upwards [htime] with y hy + exact congrFun (expandingDrift_eq_prefix M hM blank m hσ hD hK (T+1) N + (by linarith) hy.le) y.2 + +theorem expandingDrift_component_regularity + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (T : ℝ) (j : Fin 2) : + let F := fun t x => expandingDrift M hM blank m σ D K t x j + PlaneCInH2 F (Icc 0 T) ∧ PlaneC1L2 F (planeTemporalDerivative F) (Icc 0 T) := by + let N : ℕ := ⌈T + 2⌉₊ + let F := fun t x => expandingDrift M hM blank m σ D K t x j + let G := fun t x => finiteDrift M hM blank m σ D K N t x j + have hG : ContDiff ℝ ∞ (Function.uncurry G) := + (contDiff_apply ℝ ℝ j).comp (finiteDrift_smooth M hM blank m σ D K N) + obtain ⟨L, hL, hz⟩ := finiteDrift_compact_family M hM blank m hσ hD hK N + have hzG : ∀ t x, x ∉ L → G t x = 0 := by + intro t x hx + change finiteDrift M hM blank m σ D K N t x j = 0 + rw [hz t x hx] + rfl + have hFG : ∀ t ∈ Icc (0 : ℝ) T, F t = G t := by + intro t ht + funext x + exact congrArg (fun v : Plane => v j) + ((expandingDrift_eq_finite_near M hM blank m hσ hD hK T N + (Nat.le_ceil _) ht.2 x).self_of_nhds) + have hdFG : ∀ t ∈ Icc (0 : ℝ) T, + planeTemporalDerivative F t = planeTemporalDerivative G t := by + intro t ht + funext x + have he : Function.uncurry F =ᶠ[𝓝 (t,x)] Function.uncurry G := by + filter_upwards [expandingDrift_eq_finite_near M hM blank m hσ hD hK T N + (Nat.le_ceil _) ht.2 x] with y hy + exact congrArg (fun v : Plane => v j) hy + exact congrArg (fun A : (ℝ × Plane) →L[ℝ] ℝ => A (1,0)) + (he.fderiv_eq (𝕜 := ℝ)) + exact ⟨(compact_family_cInH2 hG hL hzG T).congr_slices (fun t ht => (hFG t ht).symm), + (compact_family_c1L2 hG hL hzG T).congr_slices + (fun t ht => (hFG t ht).symm) (fun t ht => (hdFG t ht).symm)⟩ + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftStage.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f14e6cdd477f21a8daa868105744932590e394f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftStage.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDrift + +namespace OAI + +/-! During each closed stage the locally finite prescribed drift is the +single finite array for that stage. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder + + theorem expandingDrift_eq_stage (M : Alternating.Machine) + (hM : M.WellFormed) (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (n : ℕ) {t : ℝ} (ht : stageStart ν D K n ≤ t) + (ht' : t ≤ stageStart ν D K (n + 1)) (x : Plane) : + expandingDrift M hM blank m ν D K t x = stageDrift M hM blank m ν D K n t x := by + apply tsum_eq_single n + intro j hj + by_cases hjn : j < n + · apply stageDrift_zero_after M hM blank m hν hD hK + exact ((stageStart_strictMono hν hD hK).monotone (by omega : j + 1 ≤ n)).trans ht + · apply stageDrift_zero_before M hM blank m hν hD hK + exact ht'.trans ((stageStart_strictMono hν hD hK).monotone (by omega : n + 1 ≤ j)) + +theorem expandingDrift_rigid (M : Alternating.Machine) + (hM : M.WellFormed) (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (n : ℕ) (w : StageWire M hM blank (m + n)) {t : ℝ} + (ht : stageStart ν D K n ≤ t) (ht' : t ≤ stageStart ν D K (n + 1)) + (x : Plane) (hx : ∀ j, |x j - wireCurve M hM blank (m + n) + (stageStart ν D K n) (duration ν D K n) (radius ν D K n) + (radius ν D K (n + 1)) w t j| < 2 * radius ν D K n) : + expandingDrift M hM blank m ν D K t x = + deriv (wireCurve M hM blank (m + n) (stageStart ν D K n) + (duration ν D K n) (radius ν D K n) (radius ν D K (n + 1)) w) t := by + rw [expandingDrift_eq_stage M hM blank m hν hD hK n ht ht'] + apply recorderStageField_rigid M hM blank (m + n) _ + (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hν hD hK n)) + (radius_pos hν hD hK n) _ w t x hx + have hr := radius_grows hν hD hK n + have hp := radius_pos hν hD hK n + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9db5a8f233a00b9c1a7714815a000629ac83fe13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingDriftSupport.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDrift +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingConcentrationFamily + +namespace OAI + +/-! Compact horizontal support on every finite time interval follows +from the finite number of stages that have begun. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder Set + +private theorem movingGate_compact_family {R : ℝ} (hR : 0 < R) + {c : ℝ → Plane} {B : ℝ} (hB : ∀ t, ‖c t‖ ≤ B) : + ∃ K : Set Plane, IsCompact K ∧ ∀ t x, x ∉ K → movingGate R c t x = 0 := by + let K : Set Plane := Icc (fun _ => -B - 3 * R) (fun _ => B + 3 * R) + refine ⟨K, isCompact_Icc, ?_⟩ + intro t x hx + apply translationGate_eq_zero + intro hz + have hb := gateCutoff_tsupport hR hz + apply hx + constructor <;> intro j + · have hc : |c t j| ≤ B := + (show |c t j| ≤ ‖c t‖ from by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (c t) j).trans (hB t) + have hj := (abs_le.mp (hb j)).1 + have hjc := (abs_le.mp hc).1 + change -B - 3 * R ≤ x j + change -(3 * R) ≤ x j - c t j at hj + linarith + · have hc : |c t j| ≤ B := + (show |c t j| ≤ ‖c t‖ from by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (c t) j).trans (hB t) + have hj := (abs_le.mp (hb j)).2 + have hjc := (abs_le.mp hc).2 + change x j ≤ B + 3 * R + change x j - c t j ≤ 3 * R at hj + linarith + +theorem recorderStageField_compact_family (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) (hR : 0 < R) : + ∃ K : Set Plane, IsCompact K ∧ + ∀ t x, x ∉ K → recorderStageField M hM blank d a T R R' t x = 0 := by + classical + have hi (w : StageWire M hM blank d) : ∃ K : Set Plane, IsCompact K ∧ + ∀ t x, x ∉ K → movingGate R (wireCurve M hM blank d a T R R' w) t x = 0 := by + obtain ⟨B, _, hB⟩ := scheduledCenter_bounded a hT (16 * R) (16 * R') + w.val.1.number w.val.2.number (haltingControl (finiteMachine M hM) w.val.2.control) + exact movingGate_compact_family hR hB + choose K hK hzero using hi + refine ⟨⋃ w, K w, isCompact_iUnion hK, ?_⟩ + intro t x hx + apply Finset.sum_eq_zero + intro w _ + exact hzero w t x (fun hw => hx (mem_iUnion.mpr ⟨w, hw⟩)) + +theorem expandingDrift_compact_on_finite_intervals (M : Alternating.Machine) + (hM : M.WellFormed) (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (T : ℝ) : + ∃ L : Set Plane, IsCompact L ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x, x ∉ L → expandingDrift M hM blank m ν D K t x = 0 := by + classical + let N : ℕ := ⌈T + 1⌉₊ + have hi (n : Fin N) : ∃ L : Set Plane, IsCompact L ∧ + ∀ t x, x ∉ L → stageDrift M hM blank m ν D K n.val t x = 0 := + recorderStageField_compact_family M hM blank (m + n.val) _ + (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hν hD hK n.val)) + (radius_pos hν hD hK n.val) + choose L hL hzero using hi + refine ⟨⋃ n : Fin N, L n, isCompact_iUnion hL, ?_⟩ + intro t ht x hx + rw [expandingDrift_eq_prefix M hM blank m hν hD hK T N (Nat.le_ceil _) ht.2] + apply Finset.sum_eq_zero + intro n hn + have hnN : n < N := Finset.mem_range.mp hn + exact hzero ⟨n, hnN⟩ t x (fun hxn => hx (mem_iUnion.mpr ⟨⟨n, hnN⟩, hxn⟩)) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingEnergyDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingEnergyDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fbfcbb769bc7b5c70487df2f99f99b2a7644080 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingEnergyDischarge.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyIdentity + +namespace OAI + +/-! The whole-plane main result with its localized energy input discharged. +Only the published scalar existence input remains explicit. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set +open scoped ContDiff + +theorem whole_plane_velocity_detection_energy_discharged (hE : PlaneScalarExistence) + : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + let f := compiledExpandingForce C I hI a ν + ContDiff ℝ ∞ f ∧ + (∀ α : List (Fin 4), ∃ B : ℝ, 0 ≤ B ∧ ∀ y, ‖mixedDerivative f α y‖ ≤ B) ∧ + (∀ T : ℝ, ∃ K : Set Plane, IsCompact K ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x : Space, horizontalLinear x ∉ K → f (t,x) = 0) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative f α y - + rationalVector (evaluateCompiledExpandingForce C I hI a α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (R : ℚ) (y : SpaceTime), + (∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) → + ‖mixedDerivative f α y‖ ≤ (compiledExpandingForceBound C I hI a α R : ℝ)) ∧ + WholePlaneDetection ν f I := by + exact whole_plane_velocity_detection hE cylinder_local_energy_identity + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteBudget.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5fc4d509bbe906bde6c6acfb8c981e7dc819e14 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteBudget.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDiffusionBudget +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingStageTimes + +namespace OAI + +/-! The fixed Laplacian constant is absorbed into the chosen spatial +scale. Every finite execution uses less than the fixed observation margin. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open scoped BigOperators + +theorem concrete_stage_loss_le {ν C σ D K : ℝ} + (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (hc : ν * C ≤ σ * 3000) (n : ℕ) : + ν * ((radius σ D K n)⁻¹ ^ 2 * C) * duration σ D K n ≤ + σ * 3000 * (duration σ D K n / radius σ D K n ^ 2) := by + have ht : 0 ≤ duration σ D K n := le_trans (by norm_num) (duration_ge_two hσ hD hK n) + have hh := mul_le_mul_of_nonneg_right hc (div_nonneg ht (sq_nonneg (radius σ D K n))) + convert hh using 1 + simp only [div_eq_mul_inv, inv_pow] + ring + +theorem finite_diffusion_loss_lt {ν C σ D K : ℝ} + (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (hc : ν * C ≤ σ * 3000) (n : ℕ) : + ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * 2 + + (∑ i ∈ Finset.range n, ν * ((radius σ D K i)⁻¹ ^ 2 * C) * duration σ D K i) < 1 / 24 := by + have hinit : ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * 2 ≤ + 2 * σ * 3000 / initialRadius σ D K ^ 2 := by + have hi := mul_le_mul_of_nonneg_right hc + (show 0 ≤ 2 / initialRadius σ D K ^ 2 by positivity) + convert hi using 1 <;> simp [radius, div_eq_mul_inv, inv_pow] <;> ring + have hsum : (∑ i ∈ Finset.range n, ν * ((radius σ D K i)⁻¹ ^ 2 * C) * duration σ D K i) ≤ + ∑' i, σ * 3000 * (duration σ D K i / radius σ D K i ^ 2) := by + calc + _ ≤ ∑ i ∈ Finset.range n, σ * 3000 * (duration σ D K i / radius σ D K i ^ 2) := + Finset.sum_le_sum (fun i _ => concrete_stage_loss_le hσ hD hK hc i) + _ ≤ _ := (diffusion_loss_summable hσ hD hK).sum_le_tsum _ (fun i _ => by + apply mul_nonneg (by positivity) + exact div_nonneg (le_trans (by norm_num) (duration_ge_two hσ hD hK i)) (sq_nonneg _)) + exact lt_of_le_of_lt (add_le_add hinit hsum) (total_two_time_diffusion_loss_lt hσ hD hK) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..273a19ee711b8bce2e76d468be9982f57591259d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteExpressions.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDrift +import Mathlib.Data.Finset.Sort + +namespace OAI + +/-! A terminating finite compiler for every prefix of the full address +array. It enumerates all guarded wires, independently of the chosen run. -/ + +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder +open scoped BigOperators + +private theorem list_sum_range_eq {A : Type*} [AddCommMonoid A] (f : ℕ → A) (n : ℕ) : + ((List.range n).map f).sum = ∑ i ∈ Finset.range n, f i := by + induction n with + | zero => simp + | succ n ih => rw [List.sum_range_succ, Finset.sum_range_succ, ih] + +def rationalRadius (σ D K : ℚ) (n : ℕ) : ℚ := + (1024 * 3000 * (1 + σ) * (4 * D) * (K * D + 2)) * (4 * D) ^ n + +def rationalDuration (σ D K : ℚ) (n : ℕ) : ℚ := + 16 * rationalRadius σ D K (n + 1) * (K * D ^ (n + 1) + 2) + +def rationalStageStart (σ D K : ℚ) (n : ℕ) : ℚ := + 2 + (List.range n).foldr (fun i q => rationalDuration σ D K i + q) 0 + +theorem rationalRadius_val (σ D K : ℚ) (n : ℕ) : + (rationalRadius σ D K n : ℝ) = radius σ D K n := by + simp [rationalRadius, radius, initialRadius, expansion] + +theorem rationalDuration_val (σ D K : ℚ) (n : ℕ) : + (rationalDuration σ D K n : ℝ) = duration σ D K n := by + simp [rationalDuration, rationalRadius_val, duration] + +theorem rationalStageStart_val (σ D K : ℚ) (n : ℕ) : + (rationalStageStart σ D K n : ℝ) = stageStart σ D K n := by + unfold rationalStageStart stageStart + have he : (List.range n).foldr (fun i q => rationalDuration σ D K i + q) 0 = + ((List.range n).map (rationalDuration σ D K)).sum := by + induction List.range n with + | nil => rfl + | cons i l ih => simp only [List.foldr_cons, List.map_cons, List.sum_cons, ih] + rw [he, list_sum_range_eq] + simp only [Rat.cast_add, Rat.cast_ofNat, Rat.cast_sum, rationalDuration_val] + +@[instance_reducible] +def stageWireOrder (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + LinearOrder (StageWire M hM blank d) := + LinearOrder.lift' (fun w => w.val.1.number) (by + intro w z h + apply StageWire.source_injective M hM blank d + exact RecorderAddress.number_injective M blank d h) + +def orderedStageWires (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : List (StageWire M hM blank d) := + letI := stageWireOrder M hM blank d + Finset.univ.sort (· ≤ ·) + +theorem sum_orderedStageWires {A : Type*} [AddCommMonoid A] + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (f : StageWire M hM blank d → A) : + ((orderedStageWires M hM blank d).map f).sum = ∑ w, f w := by + let := stageWireOrder M hM blank d + change ((Finset.univ.sort (· ≤ ·)).map f).sum = _ + rw [← List.sum_toFinset f (Finset.sort_nodup _ _), Finset.sort_toFinset] + +def stageCode (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℚ) (n : ℕ) : NonperiodicVector := fun j => + NonperiodicExpr.sum ((orderedStageWires M hM blank (m+n)).map + (fun w => movingGateCode (rationalStageStart σ D K n) (rationalDuration σ D K n) + (16 * rationalRadius σ D K n) (16 * rationalRadius σ D K (n + 1)) + (rationalRadius σ D K n) w.val.1.number w.val.2.number + (haltingControl (finiteMachine M hM) w.val.2.control) j)) + +theorem stageCode_val (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℚ) (n : ℕ) (y : SpaceTime) : + (stageCode M hM blank m σ D K n).val y = + planeInclusion (stageDrift M hM blank m σ D K n y.1 (horizontalLinear y.2)) := by + funext j + simp only [NonperiodicVector.val, stageCode, NonperiodicExpr.sum_val, + List.map_map, Function.comp_def, sum_orderedStageWires] + change (∑ w : StageWire M hM blank (m+n), + (movingGateCode _ _ _ _ _ w.val.1.number w.val.2.number + (haltingControl (finiteMachine M hM) w.val.2.control)).val y j) = _ + simp only [movingGateCode_val, rationalStageStart_val, rationalDuration_val, + Rat.cast_mul, Rat.cast_ofNat, rationalRadius_val] + rw [← Finset.sum_apply, ← map_sum] + rfl + +def prefixCode (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℚ) (N : ℕ) : NonperiodicVector := fun j => + NonperiodicExpr.sum ((List.range N).map (fun n => stageCode M hM blank m σ D K n j)) + +theorem prefixCode_val (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℚ) (N : ℕ) (y : SpaceTime) : + (prefixCode M hM blank m σ D K N).val y = + planeInclusion (∑ n ∈ Finset.range N, + stageDrift M hM blank m σ D K n y.1 (horizontalLinear y.2)) := by + funext j + simp only [NonperiodicVector.val, prefixCode, NonperiodicExpr.sum_val, + List.map_map, Function.comp_def, list_sum_range_eq] + change (∑ n ∈ Finset.range N, (stageCode M hM blank m σ D K n).val y j) = _ + simp only [stageCode_val] + rw [← Finset.sum_apply, ← map_sum] + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGates.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c8c620b9f449aa8fd86b3ddee04bd2fb92904d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGates.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateProfile +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulse + +namespace OAI + +/-! Finite parallel translation gates. Separation is required for the +whole address table, so the selected computation is never used to define +which gates are present. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set Filter MeasureTheory +open scoped ContDiff Topology BigOperators + +theorem translationGate_eq_zero {χ : Plane → ℝ} {c v x : Plane} + (hx : x - c ∉ tsupport χ) : translationGate χ c v x = 0 := by + have hs := (translationGate_support χ c v).trans + (tsupport_comp_subset_preimage χ (continuous_id.sub continuous_const)) + exact image_eq_zero_of_notMem_tsupport (fun h => hx (hs h)) + +theorem other_gate_eq_zero {R : ℝ} (hR : 0 < R) {c d v x : Plane} + (hnear : ∀ j, |x j - c j| ≤ 2 * R) + (hsep : ∃ j, 16 * R ≤ |c j - d j|) : + translationGate (gateCutoff R) d v x = 0 := by + apply translationGate_eq_zero + intro hx + obtain ⟨j, hj⟩ := hsep + have hb := gateCutoff_tsupport hR hx j + change |x j - d j| ≤ 3 * R at hb + have ht : |c j - d j| ≤ |x j - c j| + |x j - d j| := by + have hh := abs_add_le (c j - x j) (x j - d j) + have he : (c j - x j) + (x j - d j) = c j - d j := by ring + rw [he, abs_sub_comm (c j) (x j)] at hh + exact hh + linarith [hnear j] + +def parallelGate {ι : Type*} [Fintype ι] (R : ℝ) + (c v : ι → Plane) (x : Plane) : Plane := + ∑ i, translationGate (gateCutoff R) (c i) (v i) x + +theorem parallelGate_smooth {ι : Type*} [Fintype ι] + (R : ℝ) (c v : ι → Plane) : ContDiff ℝ ∞ (parallelGate R c v) := + ContDiff.sum (fun i _ => translationGate_smooth (gateCutoff_smooth R) (c i) (v i)) + +theorem parallelGate_properties {ι : Type*} [Fintype ι] + {R : ℝ} (hR : 0 < R) (c v : ι → Plane) : + HasCompactSupport (parallelGate R c v) ∧ + (∀ x, PlanarHamiltonian.divergence (parallelGate R c v) x = 0) ∧ + (∫ x, parallelGate R c v x) = 0 := by + let H : ι → Plane → ℝ := fun i x => gateCutoff R (x - c i) * + PlanarHamiltonian.translationPotential (v i) (x - c i) + have hH (i : ι) : ContDiff ℝ ∞ (H i) := + ((gateCutoff_smooth R).comp (contDiff_id.sub contDiff_const)).mul + ((PlanarHamiltonian.translationPotential_smooth (v i)).comp + (contDiff_id.sub contDiff_const)) + have hc (i : ι) : HasCompactSupport (H i) := by + have hχ : HasCompactSupport (fun x => gateCutoff R (x - c i)) := by + simpa only [Function.comp_def, Homeomorph.coe_addRight, sub_eq_add_neg] using + (gateCutoff_compactSupport hR).comp_homeomorph (Homeomorph.addRight (-c i)) + exact hχ.mul_right + have hcompact : IsCompact (⋃ i, tsupport (H i)) := + isCompact_iUnion (fun i => (hc i).isCompact) + have hs : ContDiff ℝ ∞ (fun x => ∑ i, H i x) := ContDiff.sum (fun i _ => hH i) + have hsum : HasCompactSupport (fun x => ∑ i, H i x) := by + apply HasCompactSupport.intro hcompact + intro x hx + apply Finset.sum_eq_zero + intro i _ + exact image_eq_zero_of_notMem_tsupport (fun hi => hx (mem_iUnion.mpr ⟨i, hi⟩)) + have he : parallelGate R c v = PlanarHamiltonian.field (fun x => ∑ i, H i x) := by + funext x + exact (PlanarHamiltonian.field_sum Finset.univ H (fun i _ => hH i) x).symm + rw [he] + exact ⟨PlanarHamiltonian.field_compactSupport hsum, + PlanarHamiltonian.field_divergence hs, PlanarHamiltonian.field_integral_eq_zero hs hsum⟩ + +theorem parallelGate_plateau {ι : Type*} [Fintype ι] [DecidableEq ι] + {R : ℝ} (hR : 0 < R) (c v : ι → Plane) (i : ι) (x : Plane) + (hnear : ∀ j, |x j - c i j| < 2 * R) + (hsep : ∀ k, k ≠ i → ∃ j, 16 * R ≤ |c i j - c k j|) : + parallelGate R c v x = v i := by + unfold parallelGate + rw [Finset.sum_eq_single i] + · apply translationGate_plateau + apply gateCutoff_one_near hR + exact hnear + · intro k _ hki + exact other_gate_eq_zero hR (fun j => (hnear j).le) (hsep k hki) + · intro hi + exact False.elim (hi (Finset.mem_univ i)) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGraph.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d08bd81b1d8df569543b18d84b5ffd1e101f7f6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteGraph.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderRun +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingAddresses + +namespace OAI + +/-! A finite, decidable graph for one expanding-array stage. Its lookup +examines the guarded local table and bounded integer stacks only. The +injectivity theorem applies to every defined address, including addresses +outside the initialized computation. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +def localDisplacement (m : Fin 3) : ℤ := (m.val : ℤ) - 1 + +theorem moveCode_localDisplacement (m : Fin 3) : + moveCode (localDisplacement m) = m := by + fin_cases m <;> decide + +def BoundedIntegerStep (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + (q : Control (State M) (Alphabet M)) (L R : ℕ) + (q' : Control (State M) (Alphabet M)) (L' R' : ℕ) : Prop := + ∃ (a b : Recorder.Symbol (State M) (Alphabet M)) (m : Fin 3), + evalLocal (finiteMachine M hM) q a = some (q', b, localDisplacement m) ∧ + symbolCode M blank a = R % alphabetBase M blank ∧ + Lattice.nextLeft (alphabetBase M blank) L (symbolCode M blank b) m = L' ∧ + Lattice.nextRight (alphabetBase M blank) L R (symbolCode M blank b) m = R' + +instance (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + (q : Control (State M) (Alphabet M)) (L R : ℕ) + (q' : Control (State M) (Alphabet M)) (L' R' : ℕ) : + Decidable (BoundedIntegerStep M hM blank q L R q' L' R') := +by + let P (a b : Recorder.Symbol (State M) (Alphabet M)) (m : Fin 3) : Prop := + evalLocal (finiteMachine M hM) q a = some (q', b, localDisplacement m) ∧ + symbolCode M blank a = R % alphabetBase M blank ∧ + Lattice.nextLeft (alphabetBase M blank) L (symbolCode M blank b) m = L' ∧ + Lattice.nextRight (alphabetBase M blank) L R (symbolCode M blank b) m = R' + letI (a b : Recorder.Symbol (State M) (Alphabet M)) (m : Fin 3) : Decidable (P a b m) := by + dsimp only [P] + infer_instance + letI (a b : Recorder.Symbol (State M) (Alphabet M)) : Decidable (∃ m, P a b m) := + Fintype.decidableExistsFintype + letI (a : Recorder.Symbol (State M) (Alphabet M)) : Decidable (∃ b m, P a b m) := + Fintype.decidableExistsFintype + exact Fintype.decidableExistsFintype + +theorem boundedIntegerStep_iff (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + (q : Control (State M) (Alphabet M)) (L R : ℕ) + (q' : Control (State M) (Alphabet M)) (L' R' : ℕ) : + BoundedIntegerStep M hM blank q L R q' L' R' ↔ + IntegerStep M hM blank q L R q' L' R' := by + constructor + · rintro ⟨a, b, m, he, ha, hL, hR⟩ + refine ⟨a, b, localDisplacement m, evalLocal_sound he, ha, ?_, ?_⟩ + · simpa only [moveCode_localDisplacement] using hL + · simpa only [moveCode_localDisplacement] using hR + · rintro ⟨a, b, d, hs, ha, hL, hR⟩ + have hd := hs.displacement_bounds + let m : Fin 3 := ⟨(d + 1).toNat, by omega⟩ + have hm : localDisplacement m = d := by dsimp [localDisplacement, m]; omega + have hc : moveCode d = m := by rw [← hm, moveCode_localDisplacement] + exact ⟨a, b, m, by simpa only [hm] using hs.eval, ha, by simpa only [hc] using hL, + by simpa only [hc] using hR⟩ + +@[ext] structure RecorderAddress (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) where + control : Control (State M) (Alphabet M) + left : Fin (alphabetBase M blank ^ d) + right : Fin (alphabetBase M blank ^ d) + deriving DecidableEq, Fintype + +def RecorderAddress.toAddress {M : Alternating.Machine} + {blank : Recorder.Symbol (State M) (Alphabet M)} {d : ℕ} + (a : RecorderAddress M blank d) : + Address (allControls M).length (alphabetBase M blank ^ d) := + ⟨⟨controlCode M a.control, controlCode_lt M a.control⟩, a.left, a.right⟩ + +def RecorderAddress.number {M : Alternating.Machine} + {blank : Recorder.Symbol (State M) (Alphabet M)} {d : ℕ} + (a : RecorderAddress M blank d) : ℕ := a.toAddress.index + +theorem RecorderAddress.number_bounds {M : Alternating.Machine} + {blank : Recorder.Symbol (State M) (Alphabet M)} {d : ℕ} + (a : RecorderAddress M blank d) : + 0 < a.number ∧ a.number ≤ (allControls M).length * (alphabetBase M blank ^ d) ^ 2 := + ⟨a.toAddress.index_positive, a.toAddress.index_le⟩ + +theorem RecorderAddress.number_injective (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + Function.Injective (@RecorderAddress.number M blank d) := by + intro a b hab + have h := Address.index_injective _ _ hab + apply RecorderAddress.ext + · exact controlCode_injective M (congrArg (fun c => c.state.val) h) + · exact congrArg Address.left h + · exact congrArg Address.right h + +def stageEdge (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : RecorderAddress M blank d) (b : RecorderAddress M blank (d + 1)) : Prop := + BoundedIntegerStep M hM blank a.control a.left a.right b.control b.left b.right + +instance (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : RecorderAddress M blank d) (b : RecorderAddress M blank (d + 1)) : + Decidable (stageEdge M hM blank d a b) := inferInstanceAs + (Decidable (BoundedIntegerStep M hM blank a.control a.left a.right + b.control b.left b.right)) + +theorem stageEdge_integer (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + {a : RecorderAddress M blank d} {b : RecorderAddress M blank (d + 1)} + (h : stageEdge M hM blank d a b) : + IntegerStep M hM blank a.control a.left a.right b.control b.left b.right := + (boundedIntegerStep_iff M hM blank _ _ _ _ _ _).mp h + +theorem stageEdge_source_unique (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + {a c : RecorderAddress M blank d} {b : RecorderAddress M blank (d + 1)} + (ha : stageEdge M hM blank d a b) (hc : stageEdge M hM blank d c b) : a = c := by + obtain ⟨hq, hL, hR⟩ := IntegerStep.predecessor_unique M hM blank + (stageEdge_integer M hM blank d ha) (stageEdge_integer M hM blank d hc) + exact RecorderAddress.ext hq (Fin.ext hL) (Fin.ext hR) + +theorem stageEdge_target_unique (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + {a : RecorderAddress M blank d} {b c : RecorderAddress M blank (d + 1)} + (hb : stageEdge M hM blank d a b) (hc : stageEdge M hM blank d a c) : b = c := by + obtain ⟨hq, hL, hR⟩ := IntegerStep.successor_unique M hM blank + (stageEdge_integer M hM blank d hb) (stageEdge_integer M hM blank d hc) + exact RecorderAddress.ext hq (Fin.ext hL) (Fin.ext hR) + +def recorderAddresses (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + List (RecorderAddress M blank d) := + (allControls M).flatMap fun q => (List.finRange (alphabetBase M blank ^ d)).flatMap + fun L => (List.finRange (alphabetBase M blank ^ d)).map fun R => ⟨q, L, R⟩ + +theorem mem_recorderAddresses (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : RecorderAddress M blank d) : a ∈ recorderAddresses M blank d := by + rcases a with ⟨q, L, R⟩ + simp only [recorderAddresses, List.mem_flatMap, List.mem_map] + exact ⟨q, mem_allControls M q, L, by simp, R, by simp, rfl⟩ + +def lookupTarget (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : RecorderAddress M blank d) : Option (RecorderAddress M blank (d + 1)) := + (recorderAddresses M blank (d + 1)).find? (fun b => decide (stageEdge M hM blank d a b)) + +theorem lookupTarget_eq_some_iff (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : RecorderAddress M blank d) (b : RecorderAddress M blank (d + 1)) : + lookupTarget M hM blank d a = some b ↔ stageEdge M hM blank d a b := by + constructor + · intro h + exact of_decide_eq_true (List.find?_some (p := fun b => decide (stageEdge M hM blank d a b)) h) + · intro hb + cases he : lookupTarget M hM blank d a with + | none => + have hnone := List.find?_eq_none.mp he b (mem_recorderAddresses M blank (d + 1) b) + exact False.elim (hnone (by simpa only [decide_eq_true_eq] using hb)) + | some c => + have hc : stageEdge M hM blank d a c := + of_decide_eq_true (List.find?_some (p := fun b => decide (stageEdge M hM blank d a b)) he) + have hcb := stageEdge_target_unique M hM blank d hc hb + simp only [hcb] + +theorem lookupTarget_injective (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + {a c : RecorderAddress M blank d} {b : RecorderAddress M blank (d + 1)} + (ha : lookupTarget M hM blank d a = some b) + (hc : lookupTarget M hM blank d c = some b) : a = c := + stageEdge_source_unique M hM blank d + ((lookupTarget_eq_some_iff M hM blank d a b).mp ha) + ((lookupTarget_eq_some_iff M hM blank d c b).mp hc) + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteRetention.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteRetention.lean new file mode 100644 index 0000000000000000000000000000000000000000..feae7684a2ae81425958e735e7044e81e516622d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFiniteRetention.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderMass + +namespace OAI + +/-! Successive concentration estimates compose along every finite +recorder execution. Only the proved per-stage diffusion losses accumulate. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory +open scoped BigOperators + +theorem recorder_steps_mass_retention + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {m : ℕ} (hm : 0 < m) + {σ D K ν C q : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (hν : 0 ≤ ν) (hC : 0 ≤ C) (p : Plane) + {w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν (expandingDrift M hM blank m σ D K) (unitImpulse p) w) + (hwi : ∀ t, 0 ≤ t → Integrable (w t)) + (hwn : ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) + (hwm : ∀ t, 0 ≤ t → (∫ x, w t x) ≤ 1) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + {U₀ : Configuration (State M) (Alphabet M)} (h₀ : CenteredBlank blank m U₀) + (hq : q ≤ ∫ x, concentrationCutoff (radius σ D K 0) + (configurationCenter M hM blank m σ D K 0 U₀) x * w 2 x) + {n : ℕ} {U : Configuration (State M) (Alphabet M)} + (hrun : Steps (finiteMachine M hM) n U₀ U) : + q - (∑ i ∈ Finset.range n, ν * ((radius σ D K i)⁻¹ ^ 2 * C) * duration σ D K i) ≤ + ∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter M hM blank m σ D K n U) x * w (stageStart σ D K n) x := by + induction hrun with + | zero => simpa only [Finset.range_zero, Finset.sum_empty, sub_zero, stageStart_zero] using hq + | @next n U₀ U V hrun hstep ih => + have ih := ih h₀ hq + have hU : CenteredBlank blank (m + n) U := h₀.steps hm hrun + have hs := recorder_step_mass_retention M hM blank hm hσ hD hK hν hC p + hw hwi hwn hwm hΔ hU hstep + rw [Finset.sum_range_succ] + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFluidDetector.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFluidDetector.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8511260652961da499f3343ff35af1aaca82d1d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingFluidDetector.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingScalarDetector +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDriftL2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCylinderSolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderPressureUniqueness + +namespace OAI + +/-! The scalar computation detector is a full classical Navier–Stokes +solution, unique in the cylinder comparison class. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory +open scoped ContDiff + +/-- The observed mass integrates over the entire unit vertical period. -/ +def upperCylinderMass (u : Velocity) (t : ℝ) : ℝ := + ∫ x in upperHalfPlane, ∫ z, u (t, atHeight x z) 2 ∂verticalPeriodMeasure + +theorem upperCylinderMass_triangular (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) + (t : ℝ) : upperCylinderMass (triangularVelocity a w) t = + ∫ x in upperHalfPlane, w t x := by + simp only [upperCylinderMass, triangularVelocity_third, horizontalLinear_eq, + atHeight_horizontal, integral_const, probReal_univ, one_smul] + +def WholePlaneDetection (ν : ℝ) (f : Velocity) (I : Alternating.MachineInput) : Prop := + ∃ u : Velocity, + (∀ T, 0 ≤ T → ContDiffOn ℝ ∞ u (timeCylinder T)) ∧ + IsCylinderClassicalSolution ν f u (fun _ => 0) ∧ + (∀ v q, IsCylinderClassicalSolution ν f v q → + ∀ t, 0 ≤ t → ∀ x, v (t,x) = u (t,x) ∧ q (t,x) = 0) ∧ + (∀ t, 0 ≤ t → ∀ x, 0 ≤ u (t,atHeight x 0) 2) ∧ + (∀ t, 0 ≤ t → Integrable (fun x => u (t,atHeight x 0) 2)) ∧ + (∀ t, 0 ≤ t → (∫ x, u (t,atHeight x 0) 2) = smoothRamp 0 1 t) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < upperCylinderMass u t) ↔ + Alternating.Halts I) + +theorem expanding_fluid_detection (hE : PlaneScalarExistence) + (hEnergy : CylinderLocalEnergyIdentity) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {ν C σ D K : ℝ} (hν : 0 < ν) (hC : 0 ≤ C) + (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (hcoef : ν * C ≤ σ * 3000) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) : + let m := initialWordLength I + let blank := recorderBlank I.1 + let p := configurationCenter I.1 hI.1 blank m σ D K 0 (finiteInitializedRecorder I hI) + let a := expandingDrift I.1 hI.1 blank m σ D K + let f := triangularForce ν a (unitImpulse p) + WholePlaneDetection ν f I := by + dsimp only [WholePlaneDetection] + let m := initialWordLength I + let blank := recorderBlank I.1 + let p := configurationCenter I.1 hI.1 blank m σ D K 0 (finiteInitializedRecorder I hI) + let a := expandingDrift I.1 hI.1 blank m σ D K + obtain ⟨w, hw, hn, hi, hm, hdetect⟩ := expanding_scalar_detection hE I hI hν hC + hσ hD hK hcoef hΔ + have ha := expandingDrift_smooth I.1 hI.1 blank m hσ hD hK + have hc := expandingDrift_compact_coefficients I.1 hI.1 blank m hσ hD hK p + have hsol : IsCylinderClassicalSolution ν (triangularForce ν a (unitImpulse p)) + (triangularVelocity a w) (fun _ => 0) := + hw.cylinder_solution hE hν ha (unitImpulse_smooth p) hc + (fun t _ x => unitImpulse_nonneg p t x) + (expandingDrift_divergence I.1 hI.1 blank m hσ hD hK) + (fun x => expandingDrift_initial I.1 hI.1 blank m hσ hD hK (by norm_num) x) + (fun T _ j => expandingDrift_component_regularity I.1 hI.1 blank m hσ hD hK T j) + refine ⟨triangularVelocity a w, ?_, hsol, cylinder_classical_unique hEnergy hν hsol, + ?_, ?_, ?_, ?_⟩ + · intro T hT + exact (hw T hT).triangularVelocity_plane_smoothOn ha + · simpa only [triangularVelocity_third, horizontalLinear_eq, atHeight_horizontal] using hn + · simpa only [triangularVelocity_third, horizontalLinear_eq, atHeight_horizontal] using hi + · simpa only [triangularVelocity_third, horizontalLinear_eq, atHeight_horizontal] using hm + · simpa only [upperCylinderMass_triangular] using hdetect + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..701040c9d7c0c05c0f03519e21899699ea166c9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceBounds.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingForceEvaluation + +namespace OAI + +/-! Terminating rational bounds for the force on any supplied space-time box. +Only the initial viscosity approximation and a finite instruction prefix enter. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Filter +open scoped Topology + +def residualBoxBound (c : NonperiodicVector) (α : List (Fin 4)) + (a : ℕ → ℚ) (R : ℚ) : ℚ := + (NonperiodicResidual.code c (a 0)).bound α R + NonperiodicResidual.laplaceBound c α R + +theorem residualBoxBound_spec (c : NonperiodicVector) (α : List (Fin 4)) + {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) (R : ℚ) + (y : SpaceTime) (hy : ∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) : + ‖mixedDerivative (residual ν c.val) α y‖ ≤ (residualBoxBound c α a R : ℝ) := by + have hν : |ν - (a 0 : ℝ)| ≤ 1 := by + simpa only [errorTolerance, pow_zero, inv_one] using ha 0 + have hd := NonperiodicResidual.coefficient_error c α R y hy ν (a 0) + have hb : ‖mixedDerivative (residual (a 0) c.val) α y‖ ≤ + ((NonperiodicResidual.code c (a 0)).bound α R : ℝ) := by + simpa only [NonperiodicResidual.val] using + (NonperiodicResidual.code c (a 0)).val_bound α R y hy + have he : ‖mixedDerivative (residual ν c.val) α y - + mixedDerivative (residual (a 0) c.val) α y‖ ≤ + (NonperiodicResidual.laplaceBound c α R : ℝ) := + hd.trans ((mul_le_mul_of_nonneg_right hν + (Rat.cast_nonneg.mpr (NonperiodicResidual.laplaceBound_nonneg c α R))).trans_eq + (one_mul _)) + calc + _ ≤ ‖mixedDerivative (residual ν c.val) α y - + mixedDerivative (residual (a 0) c.val) α y‖ + + ‖mixedDerivative (residual (a 0) c.val) α y‖ := by + simpa only [sub_add_cancel] using norm_add_le + (mixedDerivative (residual ν c.val) α y - mixedDerivative (residual (a 0) c.val) α y) + (mixedDerivative (residual (a 0) c.val) α y) + _ ≤ _ := by + simpa only [residualBoxBound, Rat.cast_add, add_comm] using add_le_add he hb + +def expandingForceBoxBound (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) (σ D K : ℚ) + (p : Fin 2 → ℚ) (α : List (Fin 4)) (a : ℕ → ℚ) (R : ℚ) : ℚ := + residualBoxBound (prefixCode M hM blank m σ D K (expandingPrefixLength |R|)) α a R + + (verticalSourceCode p).bound α R + +theorem expandingForceBoxBound_spec (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℚ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (p : Fin 2 → ℚ) (α : List (Fin 4)) {ν : ℝ} {a : ℕ → ℚ} + (ha : IsFastRealName a ν) (R : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) : + ‖mixedDerivative (triangularForce ν (expandingDrift M hM blank m σ D K) + (unitImpulse (fun j => (p j : ℝ)))) α y‖ ≤ + (expandingForceBoxBound M hM blank m σ D K p α a R : ℝ) := by + let c := prefixCode M hM blank m σ D K (expandingPrefixLength |R|) + have ht : y.1 ≤ |(R : ℝ)| := (le_abs_self _).trans (hy 0) + have hN : y.1 + 2 ≤ (expandingPrefixLength |R| : ℝ) := by + have hc : |(R : ℝ)| + 3 ≤ (expandingPrefixLength |R| : ℝ) := by + exact_mod_cast (Nat.le_ceil (|R| + 3)) + linarith + have hg := prefixCode_germ M hM blank m hσ hD hK _ y hN + have hs : (0 : ℝ) < σ := by exact_mod_cast hσ + have hd : (1 : ℝ) ≤ D := by exact_mod_cast hD + have hk : (0 : ℝ) ≤ K := by exact_mod_cast hK + have hsource : (verticalSourceCode p).val = + triangularVelocity (fun _ _ => 0) (unitImpulse (fun j => (p j : ℝ))) := by + funext z + rw [verticalSourceCode_val] + simp only [triangularVelocity, triangularLift, map_zero, zero_add] + rw [triangularForce_eq_residual (expandingDrift_smooth M hM blank m hs hd hk), + ← hsource, mixedDerivative_add + (residual_smooth (triangularVelocity_smooth + (expandingDrift_smooth M hM blank m hs hd hk) contDiff_const) ν) + (verticalSourceCode p).smooth] + change ‖mixedDerivative (residual ν (triangularVelocity + (expandingDrift M hM blank m σ D K) (fun _ _ => 0))) α y + + mixedDerivative (verticalSourceCode p).val α y‖ ≤ _ + rw [(mixedDerivative_eventuallyEq (residual_eventuallyEq hg ν) α).self_of_nhds] + exact (norm_add_le _ _).trans (by + simpa only [expandingForceBoxBound, Rat.cast_add] using + add_le_add (residualBoxBound_spec c α ha R y hy) + ((verticalSourceCode p).val_bound α R y hy)) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..56c367e8101069b0d096e6d1431d9ba847e0068b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceEvaluation.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingSourceExpression +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicForceEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupEffective + +namespace OAI + +/-! Evaluation of the prescribed whole-plane force from finite names. Only +a finite initial segment of the complete guarded graph is inspected. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set Filter +open scoped ContDiff Topology + +theorem prefixCode_germ (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℚ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (N : ℕ) (y : SpaceTime) (hN : y.1 + 2 ≤ (N : ℝ)) : + triangularVelocity (expandingDrift M hM blank m σ D K) (fun _ _ => 0) =ᶠ[𝓝 y] + (prefixCode M hM blank m σ D K N).val := by + have hs : (0 : ℝ) < σ := by exact_mod_cast hσ + have hd : (1 : ℝ) ≤ D := by exact_mod_cast hD + have hk : (0 : ℝ) ≤ K := by exact_mod_cast hK + have htime : ∀ᶠ z : SpaceTime in 𝓝 y, z.1 < y.1 + 1 := + (isOpen_lt continuous_fst continuous_const).mem_nhds (by simp) + filter_upwards [htime] with z hz + rw [prefixCode_val] + have he := expandingDrift_eq_prefix M hM blank m hs hd hk (y.1+1) N + (by linarith) hz.le + simp only [triangularVelocity, triangularLift, zero_smul, add_zero, he] + +def expandingPrefixLength (q : ℚ) : ℕ := ⌈q + 3⌉₊ + +theorem expandingPrefixLength_bound {t : ℝ} (q : ℚ) (hq : |t - (q : ℝ)| ≤ 1) : + t + 2 ≤ (expandingPrefixLength q : ℝ) := by + have hc : (q : ℝ) + 3 ≤ (expandingPrefixLength q : ℝ) := by + exact_mod_cast (Nat.le_ceil (q + 3)) + linarith [(abs_le.mp hq).2] + +def evaluateExpandingForce (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) (σ D K : ℚ) + (p : Fin 2 → ℚ) (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : RationalVector := + let c := prefixCode M hM blank m σ D K (expandingPrefixLength (b 0).1) + NonperiodicResidual.evaluate c α a b (ε/2) (by positivity) + + (verticalSourceCode p).evaluate α b (ε/2) (by positivity) + +theorem evaluateExpandingForce_spec (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℚ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (p : Fin 2 → ℚ) (α : List (Fin 4)) {ν : ℝ} {a : ℕ → ℚ} + (ha : IsFastRealName a ν) {y : SpaceTime} {b : ℕ → RationalSpaceTime} + (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (triangularForce ν (expandingDrift M hM blank m σ D K) + (unitImpulse (fun j => (p j : ℝ)))) α y - + rationalVector (evaluateExpandingForce M hM blank m σ D K p α a b ε hε)‖ ≤ + (ε : ℝ) := by + let c := prefixCode M hM blank m σ D K (expandingPrefixLength (b 0).1) + have ht : |y.1 - ((b 0).1 : ℝ)| ≤ 1 := by + have h := (norm_fst_le (y - rationalPoint (b 0))).trans (hb 0) + simpa only [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, + errorTolerance, pow_zero, inv_one] using h + have hg := prefixCode_germ M hM blank m hσ hD hK _ y + (expandingPrefixLength_bound _ ht) + have hs : (0 : ℝ) < σ := by exact_mod_cast hσ + have hd : (1 : ℝ) ≤ D := by exact_mod_cast hD + have hk : (0 : ℝ) ≤ K := by exact_mod_cast hK + have hsource : (verticalSourceCode p).val = + triangularVelocity (fun _ _ => 0) (unitImpulse (fun j => (p j : ℝ))) := by + funext z + rw [verticalSourceCode_val] + simp only [triangularVelocity, triangularLift, map_zero, zero_add] + rw [triangularForce_eq_residual (expandingDrift_smooth M hM blank m hs hd hk), + ← hsource, mixedDerivative_add + (residual_smooth (triangularVelocity_smooth + (expandingDrift_smooth M hM blank m hs hd hk) contDiff_const) ν) + (verticalSourceCode p).smooth] + have he := (mixedDerivative_eventuallyEq (residual_eventuallyEq hg ν) α).self_of_nhds + change ‖mixedDerivative (residual ν (triangularVelocity + (expandingDrift M hM blank m σ D K) (fun _ _ => 0))) α y + + mixedDerivative (verticalSourceCode p).val α y - + rationalVector (evaluateExpandingForce M hM blank m σ D K p α a b ε hε)‖ ≤ (ε : ℝ) + rw [he] + let q := NonperiodicResidual.evaluate c α a b (ε/2) (by positivity) + let r := (verticalSourceCode p).evaluate α b (ε/2) (by positivity) + have hq := NonperiodicResidual.evaluate_spec c α ha hb (ε/2) (by positivity) + have hr := (verticalSourceCode p).evaluate_spec α b hb (ε/2) (by positivity) + have hcast : rationalVector (q + r) = rationalVector q + rationalVector r := by + ext j + simp [rationalVector] + change ‖mixedDerivative (residual ν c.val) α y + + mixedDerivative (verticalSourceCode p).val α y - rationalVector (q+r)‖ ≤ _ + rw [hcast] + calc + _ = ‖(mixedDerivative (residual ν c.val) α y - rationalVector q) + + (mixedDerivative (verticalSourceCode p).val α y - rationalVector r)‖ := by + congr 1 + abel + _ ≤ ‖mixedDerivative (residual ν c.val) α y - rationalVector q‖ + + ‖mixedDerivative (verticalSourceCode p).val α y - rationalVector r‖ := norm_add_le _ _ + _ ≤ (ε : ℝ)/2 + (ε : ℝ)/2 := by + simpa only [Rat.cast_div, Rat.cast_ofNat] using add_le_add hq hr + _ = (ε : ℝ) := by ring + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..82676da305658a505f77f605aa7d4c2f2c496a5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingForceSupport.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingScalar +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorForceSupport + +namespace OAI + +/-! The actual Navier–Stokes force has compact horizontal support on each +finite time interval, including all time derivatives of the prescribed drift. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set Filter +open scoped ContDiff Topology + +def finiteDrift (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℝ) (N : ℕ) (t : ℝ) (x : Plane) : Plane := + ∑ n ∈ Finset.range N, stageDrift M hM blank m σ D K n t x + +theorem finiteDrift_smooth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℝ) (N : ℕ) : + ContDiff ℝ ∞ (Function.uncurry (finiteDrift M hM blank m σ D K N)) := by + change ContDiff ℝ ∞ (fun y : ℝ × Plane => + ∑ n ∈ Finset.range N, stageDrift M hM blank m σ D K n y.1 y.2) + exact ContDiff.sum (fun n _ => stageDrift_smooth M hM blank m σ D K n) + +theorem finiteDrift_compact_family (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (N : ℕ) : + ∃ L : Set Plane, IsCompact L ∧ + ∀ t x, x ∉ L → finiteDrift M hM blank m σ D K N t x = 0 := by + classical + have hi (n : Fin N) : ∃ L : Set Plane, IsCompact L ∧ + ∀ t x, x ∉ L → stageDrift M hM blank m σ D K n.val t x = 0 := + recorderStageField_compact_family M hM blank (m + n.val) _ + (lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hσ hD hK n.val)) + (radius_pos hσ hD hK n.val) + choose L hL hz using hi + refine ⟨⋃ n : Fin N, L n, isCompact_iUnion hL, ?_⟩ + intro t x hx + apply Finset.sum_eq_zero + intro n hn + exact hz ⟨n, Finset.mem_range.mp hn⟩ t x + (fun hh => hx (mem_iUnion.mpr ⟨⟨n, Finset.mem_range.mp hn⟩, hh⟩)) + +theorem expandingForce_compact_on_finite_intervals + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (ν : ℝ) (p : Plane) (T : ℝ) : + ∃ L : Set Plane, IsCompact L ∧ ∀ t ∈ Icc (0 : ℝ) T, ∀ x : Space, + horizontalLinear x ∉ L → + triangularForce ν (expandingDrift M hM blank m σ D K) (unitImpulse p) (t, x) = 0 := by + let N : ℕ := ⌈T + 2⌉₊ + let a := finiteDrift M hM blank m σ D K N + have ha : ContDiff ℝ ∞ (Function.uncurry a) := finiteDrift_smooth M hM blank m σ D K N + have hfull := expandingDrift_smooth M hM blank m hσ hD hK + obtain ⟨L, hL, hz⟩ := finiteDrift_compact_family M hM blank m hσ hD hK N + let L' := L ∪ tsupport (spatialImpulse p) + have hL' : IsCompact L' := hL.union (spatialImpulse_compactSupport p).isCompact + refine ⟨L', hL', ?_⟩ + intro t ht x hx + have hzero : triangularForce ν a (unitImpulse p) (t, x) = 0 := by + apply triangularForce_zero_of_neighborhood ha hL'.isClosed.isOpen_compl _ ν t hx + intro s y hy + refine ⟨hz s y (fun h => hy (Or.inl h)), ?_⟩ + change smoothPulse 0 1 s * spatialImpulse p y = 0 + rw [image_eq_zero_of_notMem_tsupport (fun h => hy (Or.inr h)), mul_zero] + have he : triangularVelocity (expandingDrift M hM blank m σ D K) (fun _ _ => 0) =ᶠ[𝓝 (t,x)] + triangularVelocity a (fun _ _ => 0) := by + have htime : ∀ᶠ y : SpaceTime in 𝓝 (t,x), y.1 < T + 1 := + (isOpen_lt continuous_fst continuous_const).mem_nhds (by change t < T + 1; linarith [ht.2]) + filter_upwards [htime] with y hy + have hp := expandingDrift_eq_prefix M hM blank m hσ hD hK (T + 1) N + (by have hN : T + 2 ≤ (N : ℝ) := Nat.le_ceil _; linarith) hy.le + simp only [triangularVelocity, triangularLift, hp] + rfl + rw [triangularForce_eq_residual hfull, Pi.add_apply, residual_congr_germ he ν] + rw [triangularForce_eq_residual ha, Pi.add_apply] at hzero + exact hzero + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateClock.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3b42f6e6b9abd4f3132fc29b137bb2b9b4e6ff0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateClock.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateGeometry +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Profiles + +namespace OAI + +/-! Three explicit smooth transition clocks leave collars between the +vertical, horizontal, and final vertical motions of each address gate. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +def firstWeight (a T : ℝ) : ℝ → ℝ := smoothRamp (a + T / 12) (a + T / 4) +def secondWeight (a T : ℝ) : ℝ → ℝ := smoothRamp (a + 5 * T / 12) (a + 7 * T / 12) +def thirdWeight (a T : ℝ) : ℝ → ℝ := smoothRamp (a + 3 * T / 4) (a + 11 * T / 12) + +theorem weights_smooth (a T : ℝ) : + ContDiff ℝ ∞ (firstWeight a T) ∧ ContDiff ℝ ∞ (secondWeight a T) ∧ + ContDiff ℝ ∞ (thirdWeight a T) := + ⟨smoothRamp_smooth _ _, smoothRamp_smooth _ _, smoothRamp_smooth _ _⟩ + +theorem weights_slots (a : ℝ) {T : ℝ} (hT : 0 < T) (t : ℝ) : + (secondWeight a T t = 0 ∧ thirdWeight a T t = 0) ∨ + (firstWeight a T t = 1 ∧ thirdWeight a T t = 0) ∨ + (firstWeight a T t = 1 ∧ secondWeight a T t = 1) := by + unfold firstWeight secondWeight thirdWeight + by_cases h₂ : t ≤ a + 5 * T / 12 + · left + exact ⟨smoothRamp_before (by linarith) h₂, + smoothRamp_before (by linarith) (by linarith)⟩ + · right + by_cases h₃ : t ≤ a + 3 * T / 4 + · left + exact ⟨smoothRamp_after (by linarith) (by linarith), + smoothRamp_before (by linarith) h₃⟩ + · right + exact ⟨smoothRamp_after (by linarith) (by linarith), + smoothRamp_after (by linarith) (by linarith)⟩ + +theorem thirdWeight_le_firstWeight (a : ℝ) {T : ℝ} (hT : 0 < T) (t : ℝ) : + thirdWeight a T t ≤ firstWeight a T t := by + rcases weights_slots a hT t with h | h | h + · rw [h.2] + exact (smoothRamp_range _ _ _).1 + · rw [h.1] + exact (smoothRamp_range _ _ _).2 + · rw [h.1] + exact (smoothRamp_range _ _ _).2 + +def scheduledCenter (a T S S' : ℝ) (k target : ℕ) (terminal : Bool) (t : ℝ) : Plane := + gateCenter S S' k target terminal (firstWeight a T t) (secondWeight a T t) + (thirdWeight a T t) + +theorem scheduledCenter_smooth (a T S S' : ℝ) (k target : ℕ) (terminal : Bool) : + ContDiff ℝ ∞ (scheduledCenter a T S S' k target terminal) := by + obtain ⟨h₁, h₂, h₃⟩ := weights_smooth a T + apply contDiff_pi.mpr + intro j + fin_cases j + · change ContDiff ℝ ∞ (fun t => (1 - secondWeight a T t) * S * k + + secondWeight a T t * S' * target) + fun_prop + · change ContDiff ℝ ∞ (fun t => -(1 - firstWeight a T t) * S + + (firstWeight a T t - thirdWeight a T t) * (-((k : ℝ) + 2) * S) + + thirdWeight a T t * (if terminal then S' else -S')) + fun_prop + +theorem scheduledCenter_initial (a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) : + scheduledCenter a T S S' k target terminal a = ![S * k, -S] := by + have h₁ : firstWeight a T a = 0 := smoothRamp_before (by linarith) (by linarith) + have h₂ : secondWeight a T a = 0 := smoothRamp_before (by linarith) (by linarith) + have h₃ : thirdWeight a T a = 0 := smoothRamp_before (by linarith) (by linarith) + rw [scheduledCenter, h₁, h₂, h₃, gateCenter_initial] + +theorem scheduledCenter_final (a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) : + scheduledCenter a T S S' k target terminal (a + T) = + ![S' * target, if terminal then S' else -S'] := by + have h₁ : firstWeight a T (a + T) = 1 := smoothRamp_after (by linarith) (by linarith) + have h₂ : secondWeight a T (a + T) = 1 := smoothRamp_after (by linarith) (by linarith) + have h₃ : thirdWeight a T (a + T) = 1 := smoothRamp_after (by linarith) (by linarith) + rw [scheduledCenter, h₁, h₂, h₃, gateCenter_final] + +theorem scheduledCenter_separated (a : ℝ) {T S S' : ℝ} (hT : 0 < T) + (hS : 0 ≤ S) (hSS' : S ≤ S') {k l k' l' : ℕ} + (hkl : k ≠ l) (htarget : k' ≠ l') (hk hl : Bool) (t : ℝ) : + ∃ j : Fin 2, S ≤ |scheduledCenter a T S S' k k' hk t j - + scheduledCenter a T S S' l l' hl t j| := + gateCenter_separated hS hSS' hkl htarget hk hl _ _ _ (weights_slots a hT t) + +theorem scheduledCenter_nonterminal (a : ℝ) {T S S' : ℝ} (hT : 0 < T) + (hS : 0 ≤ S) (hSS' : S ≤ S') (k target : ℕ) (t : ℝ) : + scheduledCenter a T S S' k target false t 1 ≤ -S := + nonterminal_gate_below hS hSS' k target (smoothRamp_range _ _ _).1 + (thirdWeight_le_firstWeight a hT t) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCollars.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCollars.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a5b88ac5b6febba03190a8ebbb9625a7030e1b8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCollars.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateMotion + +namespace OAI + +/-! Every scheduled gate vanishes on time collars at both ends of its +stage. Consecutive finite arrays therefore join smoothly. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set Filter +open scoped Topology + +theorem scheduledCenter_before (a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) {t : ℝ} (ht : t ≤ a + T / 12) : + scheduledCenter a T S S' k target terminal t = ![S * k, -S] := by + have h₁ : firstWeight a T t = 0 := smoothRamp_before (by linarith) ht + have h₂ : secondWeight a T t = 0 := smoothRamp_before (by linarith) (by linarith) + have h₃ : thirdWeight a T t = 0 := smoothRamp_before (by linarith) (by linarith) + rw [scheduledCenter, h₁, h₂, h₃, gateCenter_initial] + +theorem scheduledCenter_after (a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) {t : ℝ} (ht : a + 11 * T / 12 ≤ t) : + scheduledCenter a T S S' k target terminal t = + ![S' * target, if terminal then S' else -S'] := by + have h₁ : firstWeight a T t = 1 := smoothRamp_after (by linarith) (by linarith) + have h₂ : secondWeight a T t = 1 := smoothRamp_after (by linarith) (by linarith) + have h₃ : thirdWeight a T t = 1 := smoothRamp_after (by linarith) ht + rw [scheduledCenter, h₁, h₂, h₃, gateCenter_final] + +theorem scheduledGate_zero_before (R a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) {t : ℝ} (ht : t ≤ a) (x : Plane) : + movingGate R (scheduledCenter a T S S' k target terminal) t x = 0 := by + apply movingGate_zero_of_constant_near R (p := ![S * k, -S]) + have hn : Iio (a + T / 12) ∈ 𝓝 t := Iio_mem_nhds (by linarith) + filter_upwards [hn] with s hs + exact scheduledCenter_before a hT S S' k target terminal hs.le + +theorem scheduledGate_zero_after (R a : ℝ) {T : ℝ} (hT : 0 < T) + (S S' : ℝ) (k target : ℕ) (terminal : Bool) {t : ℝ} (ht : a + T ≤ t) (x : Plane) : + movingGate R (scheduledCenter a T S S' k target terminal) t x = 0 := by + apply movingGate_zero_of_constant_near R + (p := ![S' * target, if terminal then S' else -S']) + have hn : Ioi (a + 11 * T / 12) ∈ 𝓝 t := Ioi_mem_nhds (by linarith) + filter_upwards [hn] with s hs + exact scheduledCenter_after a hT S S' k target terminal hs.le + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCount.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..1510c4d4c004bda8df592a06c59409b827d371e2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateCount.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderGates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingAddressGrowth + +namespace OAI + +/-! The complete instruction array has at most one gate per source address. +This exponential bound will pay for summing all gate derivatives. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +theorem stageWire_card_le (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + Fintype.card (StageWire M hM blank d) ≤ + (allControls M).length * (alphabetBase M blank ^ d) ^ 2 := by + let f : StageWire M hM blank d → + Fin ((allControls M).length * (alphabetBase M blank ^ d) ^ 2) := + fun w => w.val.1.toAddress.finIndex + have hf : Function.Injective f := by + intro w z hwz + apply StageWire.source_injective M hM blank d + apply RecorderAddress.number_injective M blank d + exact congrArg Address.index (Address.finIndex_injective _ _ hwz) + simpa only [Fintype.card_fin] using Fintype.card_le_of_injective f hf + +theorem stageWire_card_growth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : + Fintype.card (StageWire M hM blank (m + n)) ≤ + addressFactor M blank m * addressGrowth M blank ^ n := by + apply (stageWire_card_le M hM blank (m + n)).trans_eq + unfold addressFactor addressGrowth + rw [pow_add, mul_pow] + simp only [← pow_mul] + rw [Nat.mul_comm m 2, Nat.mul_comm n 2] + ring + +theorem stageWire_card_growth_real (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) : + (Fintype.card (StageWire M hM blank (m + n)) : ℝ) ≤ + (addressFactor M blank m : ℝ) * (addressGrowth M blank : ℝ) ^ n := by + exact_mod_cast stageWire_card_growth M hM blank m n + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..d536e222f86a07c42716b8a29a48d47655bdc37e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateExpressions.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCenterExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateMotion +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift + +namespace OAI + +/-! Finite expressions for the actual moving Hamiltonian gates, including +all collar terms. The center velocity is differentiated from its code. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +def displacementCode (a T S S' : ℚ) (k target : ℕ) (terminal : Bool) + (j : Fin 2) : NonperiodicExpr := + .sub (.coord j.castSucc.succ) (centerCode a T S S' k target terminal j) + +theorem displacementCode_val (a T S S' : ℚ) (k target : ℕ) (terminal : Bool) + (j : Fin 2) (y : SpaceTime) : + (displacementCode a T S S' k target terminal j).val y = + (horizontalLinear y.2 - scheduledCenter a T S S' k target terminal y.1) j := by + simp only [displacementCode, NonperiodicExpr.sub, NonperiodicExpr.val, + centerCode_val, Pi.sub_apply] + have hc : timeSpaceCoord j.castSucc.succ y = horizontalLinear y.2 j := by + simp only [timeSpaceCoord, Fin.cases_succ] + rfl + rw [hc] + simp only [Rat.cast_neg, Rat.cast_one, neg_one_mul, sub_eq_add_neg] + +def gateCutoffCode (R : ℚ) (z : Fin 2 → NonperiodicExpr) : NonperiodicExpr := + .mul (NonperiodicExpr.composeProfile (.cutoff (-3) (-2) 2 3) (.mul (.const R⁻¹) (z 0))) + (NonperiodicExpr.composeProfile (.cutoff (-3) (-2) 2 3) (.mul (.const R⁻¹) (z 1))) + +theorem gateCutoffCode_val (R : ℚ) (z : Fin 2 → NonperiodicExpr) (y : SpaceTime) : + (gateCutoffCode R z).val y = gateCutoff R (fun j => (z j).val y) := by + have he : gateCutoff R (fun j => (z j).val y) = + closedCutoff (-3) (-2) 2 3 ((z 0).val y / R) * + closedCutoff (-3) (-2) 2 3 ((z 1).val y / R) := by + exact gateCutoff_eq_profiles R (fun j => (z j).val y) + rw [he] + simp only [gateCutoffCode, NonperiodicExpr.val, NonperiodicExpr.val_composeProfile, + ProfileExpr.val_cutoff, Rat.cast_inv, div_eq_mul_inv] + congr 1 <;> congr 1 <;> ring + +def gatePotentialCode (a T S S' R : ℚ) (k target : ℕ) (terminal : Bool) : NonperiodicExpr := + let z := displacementCode a T S S' k target terminal + .mul (gateCutoffCode R z) + (.sub (.mul ((centerCode a T S S' k target terminal 0).diff 0) (z 1)) + (.mul ((centerCode a T S S' k target terminal 1).diff 0) (z 0))) + +def movingGatePotential (R : ℝ) (c : ℝ → Plane) (t : ℝ) (x : Plane) : ℝ := + gateCutoff R (x - c t) * PlanarHamiltonian.translationPotential (deriv c t) (x - c t) + +theorem gatePotentialCode_val (a T S S' R : ℚ) (k target : ℕ) (terminal : Bool) + (y : SpaceTime) : + (gatePotentialCode a T S S' R k target terminal).val y = + movingGatePotential R (scheduledCenter a T S S' k target terminal) y.1 + (horizontalLinear y.2) := by + rcases y with ⟨t, x⟩ + simp only [gatePotentialCode, NonperiodicExpr.val, gateCutoffCode_val, + displacementCode_val, NonperiodicExpr.sub, centerCode_derivative, + movingGatePotential, PlanarHamiltonian.translationPotential, Pi.sub_apply, Pi.sub_def] + ring + +theorem movingGatePotential_smooth (R : ℝ) {c : ℝ → Plane} + (hc : ContDiff ℝ ∞ c) : ContDiff ℝ ∞ (Function.uncurry (movingGatePotential R c)) := by + have hv : ContDiff ℝ ∞ (deriv c) := (contDiff_infty_iff_deriv.mp hc).2 + have hz : ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 - c y.1) := + contDiff_snd.sub (hc.comp contDiff_fst) + exact ((gateCutoff_smooth R).comp hz).mul + ((((contDiff_apply ℝ ℝ 0).comp hv).comp contDiff_fst).mul + ((contDiff_apply ℝ ℝ 1).comp hz) |>.sub + ((((contDiff_apply ℝ ℝ 1).comp hv).comp contDiff_fst).mul + ((contDiff_apply ℝ ℝ 0).comp hz))) + +private def horizontalSpaceTime : SpaceTime →L[ℝ] (ℝ × Plane) := + (ContinuousLinearMap.fst ℝ ℝ Space).prod + (horizontalLinear.comp (ContinuousLinearMap.snd ℝ ℝ Space)) + +theorem expression_spatial_lift {e : NonperiodicExpr} {H : ℝ → Plane → ℝ} + (hH : ContDiff ℝ ∞ (Function.uncurry H)) + (he : ∀ y, e.val y = H y.1 (horizontalLinear y.2)) + (j : Fin 2) (y : SpaceTime) : + (e.diff j.castSucc.succ).val y = + PlanarHamiltonian.spatialD j (H y.1) (horizontalLinear y.2) := by + have heq : e.val = (Function.uncurry H) ∘ horizontalSpaceTime := funext he + rw [e.val_diff, heq, + fderiv_comp y (hH.differentiable (by simp) _) horizontalSpaceTime.differentiableAt, + horizontalSpaceTime.fderiv] + have hd : horizontalSpaceTime (spaceTimeDirection j.castSucc.succ) = + (0, PlanarHamiltonian.basis j) := by + rw [spaceTimeDirection, Fin.cases_succ] + change ((0 : ℝ), horizontalLinear (ShearFlows.basis j.castSucc)) = + (0, PlanarHamiltonian.basis j) + rw [VelocityDetector.horizontalLinear_basis] + change fderiv ℝ (Function.uncurry H) _ + (horizontalSpaceTime (spaceTimeDirection j.castSucc.succ)) = _ + rw [hd] + have hs := (hH.differentiable (by simp) (y.1, horizontalLinear y.2)).hasFDerivAt.comp + (horizontalLinear y.2) + ((hasFDerivAt_const (𝕜 := ℝ) y.1 (horizontalLinear y.2)).prodMk (hasFDerivAt_id _)) + change _ = fderiv ℝ (H y.1) (horizontalLinear y.2) (PlanarHamiltonian.basis j) + have hsf : fderiv ℝ (H y.1) (horizontalLinear y.2) = + (fderiv ℝ (Function.uncurry H) (y.1, horizontalLinear y.2)).comp + ((0 : Plane →L[ℝ] ℝ).prod (ContinuousLinearMap.id ℝ Plane)) := hs.fderiv + rw [hsf] + rfl + +def movingGateCode (a T S S' R : ℚ) (k target : ℕ) (terminal : Bool) : NonperiodicVector := + let H := gatePotentialCode a T S S' R k target terminal + fun j => if j = 0 then H.diff 2 else if j = 1 then .mul (.const (-1)) (H.diff 1) + else .const 0 + +theorem movingGateCode_val (a T S S' R : ℚ) (k target : ℕ) (terminal : Bool) + (y : SpaceTime) : + (movingGateCode a T S S' R k target terminal).val y = + planeInclusion (movingGate R (scheduledCenter a T S S' k target terminal) + y.1 (horizontalLinear y.2)) := by + have he (j : Fin 2) := expression_spatial_lift + (movingGatePotential_smooth R (scheduledCenter_smooth _ _ _ _ _ _ _)) + (gatePotentialCode_val a T S S' R k target terminal) j y + have he0 := he 0 + have he1 := he 1 + change ((gatePotentialCode a T S S' R k target terminal).diff 1).val y = _ at he0 + change ((gatePotentialCode a T S S' R k target terminal).diff 2).val y = _ at he1 + funext j + fin_cases j <;> simp [movingGateCode, NonperiodicVector.val, NonperiodicExpr.val, + he0, he1, movingGate, translationGate, PlanarHamiltonian.field, + planeInclusion] <;> rfl + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..272584a3945a863e8d7c6782f7c3158908e0c5cf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateGeometry.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingAddresses +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! The three motions of the expanding address array are separated by +source columns, private rows, then target columns. Nonterminal transport +stays below the observation half-plane throughout every motion. -/ + +namespace ForcedComputation.ExpandingDetector +open ShearFlows + +def gateCenter (S T : ℝ) (k target : ℕ) (terminal : Bool) + (θ₁ θ₂ θ₃ : ℝ) : Plane := + ![(1 - θ₂) * S * k + θ₂ * T * target, + -(1 - θ₁) * S + (θ₁ - θ₃) * (-((k : ℝ) + 2) * S) + + θ₃ * (if terminal then T else -T)] + +theorem natural_spacing {a b : ℕ} (hab : a ≠ b) : + 1 ≤ |(a : ℝ) - b| := by + rcases lt_or_gt_of_ne hab with h | h + · have hs : (a : ℝ) + 1 ≤ b := by exact_mod_cast Nat.add_one_le_iff.mpr h + rw [abs_of_nonpos (by linarith)] + linarith + · have hs : (b : ℝ) + 1 ≤ a := by exact_mod_cast Nat.add_one_le_iff.mpr h + rw [abs_of_nonneg (by linarith)] + linarith + +theorem gateCenter_initial (S T : ℝ) (k target : ℕ) (terminal : Bool) : + gateCenter S T k target terminal 0 0 0 = ![S * k, -S] := by + simp [gateCenter] + +theorem gateCenter_final (S T : ℝ) (k target : ℕ) (terminal : Bool) : + gateCenter S T k target terminal 1 1 1 = + ![T * target, if terminal then T else -T] := by + simp [gateCenter] + +theorem gateCenter_separated {S T : ℝ} (hS : 0 ≤ S) (hST : S ≤ T) + {a b a' b' : ℕ} (hab : a ≠ b) (htarget : a' ≠ b') + (ha hb : Bool) (θ₁ θ₂ θ₃ : ℝ) + (hslot : (θ₂ = 0 ∧ θ₃ = 0) ∨ (θ₁ = 1 ∧ θ₃ = 0) ∨ + (θ₁ = 1 ∧ θ₂ = 1)) : + ∃ j : Fin 2, S ≤ |gateCenter S T a a' ha θ₁ θ₂ θ₃ j - + gateCenter S T b b' hb θ₁ θ₂ θ₃ j| := by + have hs := natural_spacing hab + have ht := natural_spacing htarget + rcases hslot with h | h | h + · refine ⟨0, ?_⟩ + simp only [gateCenter, Matrix.cons_val_zero, h.1, sub_zero, zero_mul, add_zero, + one_mul] + rw [← mul_sub, abs_mul, abs_of_nonneg hS] + simpa only [mul_one] using mul_le_mul_of_nonneg_left hs hS + · refine ⟨1, ?_⟩ + simp only [gateCenter, Matrix.cons_val_one, Matrix.cons_val_zero, h.1, h.2, + sub_self, sub_zero, neg_zero, zero_mul, one_mul, zero_add, add_zero] + have he : -((a : ℝ) + 2) * S - -((b : ℝ) + 2) * S = -((a : ℝ) - b) * S := by + ring + rw [he, abs_mul, abs_neg, abs_of_nonneg hS] + simpa only [one_mul] using mul_le_mul_of_nonneg_right hs hS + · refine ⟨0, ?_⟩ + simp only [gateCenter, Matrix.cons_val_zero, h.2, sub_self, zero_mul, zero_add, + one_mul] + rw [← mul_sub, abs_mul, abs_of_nonneg (hS.trans hST)] + exact hST.trans (by simpa only [mul_one] using + mul_le_mul_of_nonneg_left ht (hS.trans hST)) + +theorem nonterminal_gate_below {S T : ℝ} (hS : 0 ≤ S) (hST : S ≤ T) + (k target : ℕ) {θ₁ θ₂ θ₃ : ℝ} + (h₃ : 0 ≤ θ₃) (h₃₁ : θ₃ ≤ θ₁) : + gateCenter S T k target false θ₁ θ₂ θ₃ 1 ≤ -S := by + have hk : 0 ≤ (k : ℝ) := Nat.cast_nonneg k + have hc₂ := mul_le_mul_of_nonneg_left + (show -((k : ℝ) + 2) * S ≤ -S by nlinarith [mul_nonneg hk hS]) + (sub_nonneg.mpr h₃₁) + have hc₃ := mul_le_mul_of_nonneg_left (neg_le_neg hST) h₃ + simp only [gateCenter, Matrix.cons_val_one, Matrix.cons_val_zero, Bool.false_eq_true, + ite_false] + nlinarith + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateJetBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateJetBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd049c7aaf08d960c00de5844a797a253306c15d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateJetBounds.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateKernels +import Mathlib.Analysis.Calculus.ContDiff.Bounds + +namespace OAI + +/-! Derivative bounds for one moving gate, expressed through the velocity +and the rescaled center. Only positive derivatives of the center enter. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff BigOperators + +def gatePacket (v z : ℝ × Plane → Plane) (y : ℝ × Plane) : Plane := + ∑ j : Fin 2, v y j • gateKernel j (z y) + +theorem gatePacket_jet_bound {v z : ℝ × Plane → Plane} + (hv : ContDiff ℝ ∞ v) (hz : ContDiff ℝ ∞ z) + (n : ℕ) (y : ℝ × Plane) {C D ε : ℝ} + (_hC : 0 ≤ C) (_hD : 0 ≤ D) (hε : 0 ≤ ε) + (hk : ∀ j : Fin 2, ∀ i ≤ n, ∀ x, ‖iteratedFDeriv ℝ i (gateKernel j) x‖ ≤ C) + (hvel : ∀ j : Fin 2, ∀ i ≤ n, + ‖iteratedFDeriv ℝ i (fun p => v p j) y‖ ≤ ε) + (hcenter : ∀ i, 1 ≤ i → i ≤ n → ‖iteratedFDeriv ℝ i z y‖ ≤ D ^ i) : + ‖iteratedFDeriv ℝ n (gatePacket v z) y‖ ≤ + 2 * ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ε * ((n - i).factorial * C * D ^ (n - i)) := by + have hs (j : Fin 2) : ContDiff ℝ ∞ + (fun p : ℝ × Plane => v p j • gateKernel j (z p)) := + ((contDiff_apply ℝ ℝ j).comp hv).smul ((gateKernel_smooth j).comp hz) + unfold gatePacket + rw [iteratedFDeriv_fun_sum_apply + (fun j _ => ((hs j).of_le (by simp)).contDiffAt)] + apply (norm_sum_le _ _).trans + have hb (j : Fin 2) : + ‖iteratedFDeriv ℝ n (fun p => v p j • gateKernel j (z p)) y‖ ≤ + ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ε * ((n - i).factorial * C * D ^ (n - i)) := by + apply (norm_iteratedFDeriv_smul_le ((contDiff_apply ℝ ℝ j).comp hv) + ((gateKernel_smooth j).comp hz) y (by simp : (n : ℕ∞ω) ≤ ∞)).trans + apply Finset.sum_le_sum + intro i hi + have hin : i ≤ n := by have := Finset.mem_range.mp hi; omega + have hcomp : ‖iteratedFDeriv ℝ (n - i) (fun p => gateKernel j (z p)) y‖ ≤ + (n - i).factorial * C * D ^ (n - i) := + norm_iteratedFDeriv_comp_le (gateKernel_smooth j) hz (by simp) y + (fun k hk' => hk j k (hk'.trans (Nat.sub_le n i)) _) + (fun k hk' hkn => hcenter k hk' (hkn.trans (Nat.sub_le n i))) + exact mul_le_mul + (mul_le_mul_of_nonneg_left (hvel j i hin) (Nat.cast_nonneg _)) hcomp + (norm_nonneg _) (mul_nonneg (Nat.cast_nonneg _) hε) + calc + _ ≤ ∑ _j : Fin 2, ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ε * ((n - i).factorial * C * D ^ (n - i)) := + Finset.sum_le_sum (fun j _ => hb j) + _ = _ := by simp [two_mul] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateKernels.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateKernels.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b1d3f54f38cffbb5647fad6b73b0d2e7bdc90a4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateKernels.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateMotion +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarScaling +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulse + +namespace OAI + +/-! Every scaled translation gate is a linear combination of two fixed +compact smooth kernels. The scaling cancels between potential and gradient. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows PlanarHamiltonian VelocityDetector +open scoped ContDiff BigOperators + +def gateKernel (j : Fin 2) : Plane → Plane := + translationGate (gateCutoff 1) 0 (PlanarHamiltonian.basis j) + +theorem gateKernel_smooth (j : Fin 2) : ContDiff ℝ ∞ (gateKernel j) := + translationGate_smooth (gateCutoff_smooth 1) _ _ + +theorem gateKernel_compact (j : Fin 2) : HasCompactSupport (gateKernel j) := + translationGate_compactSupport (gateCutoff_compactSupport (by norm_num : (0 : ℝ) < 1)) _ _ + +theorem gateKernel_jet_bound (m : ℕ) : ∃ C : ℝ, 0 ≤ C ∧ + ∀ j : Fin 2, ∀ i ≤ m, ∀ x, ‖iteratedFDeriv ℝ i (gateKernel j) x‖ ≤ C := by + obtain ⟨C₀, h₀, hb₀⟩ := (gateKernel_compact 0).exists_bound_iteratedFDeriv (gateKernel_smooth 0) m + obtain ⟨C₁, h₁, hb₁⟩ := (gateKernel_compact 1).exists_bound_iteratedFDeriv (gateKernel_smooth 1) m + refine ⟨max C₀ C₁, h₀.trans (le_max_left _ _), ?_⟩ + intro j i hi x + fin_cases j + · exact (hb₀ i hi x).trans (le_max_left _ _) + · exact (hb₁ i hi x).trans (le_max_right _ _) + +theorem field_affine_scale {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) + (r : ℝ) (c x : Plane) : + field (fun y => H (scalarAffineScale r c y)) x = r • field H (scalarAffineScale r c x) := by + unfold field + rw [spatialD_affine_scale hH, spatialD_affine_scale hH] + module + +theorem translationGate_unit_kernel (v x : Plane) : + translationGate (gateCutoff 1) 0 v x = ∑ j : Fin 2, v j • gateKernel j x := by + have hs (j : Fin 2) : ContDiff ℝ ∞ + (fun y => gateCutoff 1 y * translationPotential (PlanarHamiltonian.basis j) y) := + (gateCutoff_smooth 1).mul (translationPotential_smooth _) + have he : (fun y => gateCutoff 1 y * translationPotential v y) = + fun y => ∑ j : Fin 2, v j * (gateCutoff 1 y * + translationPotential (PlanarHamiltonian.basis j) y) := by + funext y + simp only [Fin.sum_univ_two, translationPotential, basis_apply, Fin.reduceEq, + ite_true, ite_false, one_mul, zero_mul, sub_zero, zero_sub] + ring + simp only [translationGate, sub_zero] + rw [he, field_sum] + · apply Finset.sum_congr rfl + intro j _ + rw [field_const_mul (hs j)] + simp only [gateKernel, translationGate, sub_zero] + · exact fun j _ => contDiff_const.mul (hs j) + +theorem translationGate_scaled_kernel {R : ℝ} (hR : R ≠ 0) (c v x : Plane) : + translationGate (gateCutoff R) c v x = + ∑ j : Fin 2, v j • gateKernel j (scalarAffineScale R⁻¹ c x) := by + let H := fun y => gateCutoff 1 y * translationPotential v y + have hH : ContDiff ℝ ∞ H := (gateCutoff_smooth 1).mul (translationPotential_smooth v) + have he : (fun y => gateCutoff R (y - c) * translationPotential v (y - c)) = + fun y => R * H (scalarAffineScale R⁻¹ c y) := by + funext y + have hg : gateCutoff R (y - c) = gateCutoff 1 (scalarAffineScale R⁻¹ c y) := by + unfold gateCutoff scalarAffineScale + congr 1 + funext j + simp [div_eq_mul_inv, mul_comm] + rw [hg] + dsimp [H, scalarAffineScale, translationPotential] + field_simp [hR] + have hs : ContDiff ℝ ∞ (fun y => H (scalarAffineScale R⁻¹ c y)) := + hH.comp (scalarAffineScale_smooth _ _) + rw [translationGate, he, field_const_mul hs, field_affine_scale hH] + rw [smul_smul, mul_inv_cancel₀ hR, one_smul] + simpa only [translationGate, sub_zero, H] using + translationGate_unit_kernel v (scalarAffineScale R⁻¹ c x) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateMotion.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateMotion.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4102e81933e4c5e9c1f1f2efb1d35c730c72bd4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateMotion.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteGates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateClock +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PullbackMass + +namespace OAI + +/-! Joint smoothness of the moving Hamiltonian translation gates, including +their motion through the cutoff collars. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem timeHamiltonianField_smooth {H : ℝ → Plane → ℝ} + (hH : ContDiff ℝ ∞ (Function.uncurry H)) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => PlanarHamiltonian.field (H y.1) y.2) := by + have hd := VelocityDetector.scalar_spatial_fderiv_smooth hH + exact ((hd.clm_apply contDiff_const).smul contDiff_const).sub + ((hd.clm_apply contDiff_const).smul contDiff_const) + +theorem translationGate_zero_velocity (χ : Plane → ℝ) (c x : Plane) : + translationGate χ c 0 x = 0 := by + simp [translationGate, PlanarHamiltonian.translationPotential, + PlanarHamiltonian.field, PlanarHamiltonian.spatialD] + +def movingGate (R : ℝ) (c : ℝ → Plane) (t : ℝ) (x : Plane) : Plane := + translationGate (gateCutoff R) (c t) (deriv c t) x + +theorem movingGate_smooth (R : ℝ) {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) : + ContDiff ℝ ∞ (Function.uncurry (movingGate R c)) := by + have hv : ContDiff ℝ ∞ (deriv c) := (contDiff_infty_iff_deriv.mp hc).2 + have hz : ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 - c y.1) := + contDiff_snd.sub (hc.comp contDiff_fst) + change ContDiff ℝ ∞ (fun y : ℝ × Plane => PlanarHamiltonian.field + (fun x => gateCutoff R (x - c y.1) * + PlanarHamiltonian.translationPotential (deriv c y.1) (x - c y.1)) y.2) + apply timeHamiltonianField_smooth (H := fun s x => gateCutoff R (x - c s) * + PlanarHamiltonian.translationPotential (deriv c s) (x - c s)) + exact ((gateCutoff_smooth R).comp hz).mul + ((((contDiff_apply ℝ ℝ 0).comp hv).comp contDiff_fst).mul + ((contDiff_apply ℝ ℝ 1).comp hz) |>.sub + ((((contDiff_apply ℝ ℝ 1).comp hv).comp contDiff_fst).mul + ((contDiff_apply ℝ ℝ 0).comp hz))) + +theorem movingGate_zero_of_constant_near (R : ℝ) {c : ℝ → Plane} {t : ℝ} {p : Plane} + (hc : c =ᶠ[𝓝 t] fun _ => p) (x : Plane) : movingGate R c t x = 0 := by + have hd : HasDerivAt c 0 t := (hasDerivAt_const t p).congr_of_eventuallyEq hc + rw [movingGate, hd.deriv, translationGate_zero_velocity] + +theorem movingGate_tracks {R : ℝ} (hR : 0 < R) {c : ℝ → Plane} + (hc : ContDiff ℝ ∞ c) (z : Plane) (hz : ∀ j, |z j| < 2 * R) (t : ℝ) : + HasDerivAt (fun s => c s + z) (movingGate R c t (c t + z)) t := by + have hv : movingGate R c t (c t + z) = deriv c t := by + apply translationGate_plateau + apply gateCutoff_one_near hR + intro j + simpa only [Pi.add_apply, Pi.sub_apply, add_sub_cancel_left] using hz j + rw [hv] + exact ((hc.differentiable (by simp) t).hasDerivAt).add_const z + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateProfile.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a806a6315f5373779c78181f7199d9c1bd0e003 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGateProfile.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCutoff + +namespace OAI + +/-! A fixed compact cutoff, rescaled to each expanding gate. Its exact +plateau has radius twice the gate radius, with support of radius three. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +private def unitGateBox : RationalBox 2 := ⟨fun _ => -1, fun _ => 1⟩ + +def gateCutoff (R : ℝ) (x : Plane) : ℝ := + PlanarHamiltonian.rectangleCutoff unitGateBox 1 (fun j => x j / R) + +theorem gateCutoff_eq_profiles (R : ℝ) (x : Plane) : + gateCutoff R x = closedCutoff (-3) (-2) 2 3 (x 0 / R) * + closedCutoff (-3) (-2) 2 3 (x 1 / R) := by + norm_num [gateCutoff, PlanarHamiltonian.rectangleCutoff, unitGateBox] + +theorem gateCutoff_smooth (R : ℝ) : ContDiff ℝ ∞ (gateCutoff R) := by + apply (PlanarHamiltonian.rectangleCutoff_smooth unitGateBox 1).comp + apply contDiff_pi.mpr + intro j + exact (contDiff_apply ℝ ℝ j).div_const R + +theorem gateCutoff_range (R : ℝ) (x : Plane) : gateCutoff R x ∈ Icc (0 : ℝ) 1 := by + have h₀ := closedCutoff_range (-3) (-2) 2 3 (x 0 / R) + have h₁ := closedCutoff_range (-3) (-2) 2 3 (x 1 / R) + change 0 ≤ _ ∧ _ ≤ 1 + have he : gateCutoff R x = closedCutoff (-3) (-2) 2 3 (x 0 / R) * + closedCutoff (-3) (-2) 2 3 (x 1 / R) := by + norm_num [gateCutoff, PlanarHamiltonian.rectangleCutoff, unitGateBox] + rw [he] + refine ⟨mul_nonneg h₀.1 h₁.1, ?_⟩ + calc + _ ≤ 1 * closedCutoff (-3) (-2) 2 3 (x 1 / R) := mul_le_mul_of_nonneg_right h₀.2 h₁.1 + _ ≤ 1 := by simpa only [one_mul] using h₁.2 + +theorem gateCutoff_one_near {R : ℝ} (hR : 0 < R) {x : Plane} + (hx : ∀ j, |x j| < 2 * R) : gateCutoff R =ᶠ[𝓝 x] fun _ => 1 := by + have hi : (fun j => x j / R) ∈ PlanarHamiltonian.rectanglePlateau unitGateBox 1 := by + intro j + have hl := (abs_lt.mp (hx j)).1 + have hu := (abs_lt.mp (hx j)).2 + dsimp [unitGateBox] + norm_num only [Rat.cast_neg, Rat.cast_one] + constructor + · apply (lt_div_iff₀ hR).mpr + linarith + · apply (div_lt_iff₀ hR).mpr + linarith + have he : PlanarHamiltonian.rectangleCutoff unitGateBox 1 =ᶠ[𝓝 (fun j => x j / R)] + fun _ => 1 := + Filter.eventually_of_mem ((PlanarHamiltonian.rectanglePlateau_open unitGateBox 1).mem_nhds hi) + (fun _ hy => PlanarHamiltonian.rectangleCutoff_one (by norm_num) hy) + have hc : Continuous (fun y : Plane => fun j => y j / R) := + by + have hs := ((R⁻¹) • ContinuousLinearMap.id ℝ Plane).continuous + convert hs using 1 + funext y j + simp [div_eq_mul_inv, mul_comm] + exact he.comp_tendsto hc.continuousAt + +theorem gateCutoff_support {R : ℝ} (hR : 0 < R) : + Function.support (gateCutoff R) ⊆ {x | ∀ j, |x j| ≤ 3 * R} := by + intro x hx j + have hs := PlanarHamiltonian.rectangleCutoff_support (R := unitGateBox) + (by norm_num : (0 : ℚ) < 1) hx + have hl := (hs j).1 + have hu := (hs j).2 + change ((-1 : ℚ) - 2 * 1 : ℚ) ≤ x j / R at hl + change x j / R ≤ ((1 : ℚ) + 2 * 1 : ℚ) at hu + norm_num at hl hu + apply abs_le.mpr + exact ⟨by have := (le_div_iff₀ hR).mp hl; linarith, + by have := (div_le_iff₀ hR).mp hu; linarith⟩ + +theorem gateCutoff_tsupport {R : ℝ} (hR : 0 < R) : + tsupport (gateCutoff R) ⊆ {x | ∀ j, |x j| ≤ 3 * R} := by + apply closure_minimal (gateCutoff_support hR) + have hc (j : Fin 2) : Continuous (fun x : Plane => |x j|) := + continuous_abs.comp + (show ContDiff ℝ ∞ (fun x : Plane => x j) from contDiff_apply ℝ ℝ j).continuous + have hs (j : Fin 2) : IsClosed {x : Plane | |x j| ≤ 3 * R} := + isClosed_le (hc j) continuous_const + simpa only [ofPred_forall] using isClosed_iInter hs + +theorem gateCutoff_compactSupport {R : ℝ} (hR : 0 < R) : + HasCompactSupport (gateCutoff R) := by + have he : {x : Plane | ∀ j, |x j| ≤ 3 * R} = + Icc (fun _ => -(3 * R)) (fun _ => 3 * R) := by + ext x + simp only [mem_ofPred_eq, abs_le, mem_Icc, Pi.le_def, forall_and] + apply HasCompactSupport.intro (K := Icc (fun _ : Fin 2 => -(3 * R)) (fun _ => 3 * R)) + isCompact_Icc + intro x hx + by_contra hn + exact hx (he ▸ gateCutoff_support hR hn) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bcb632c7690bfaca222b9a395179e6ac83cc131 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGates.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarHamiltonian + +namespace OAI + +/-! The local Hamiltonian translation gate used at each finite address. +Its plateau is exact and its support is inherited from the cutoff. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem field_translate (H : Plane → ℝ) (c x : Plane) : + PlanarHamiltonian.field (fun y => H (y - c)) x = + PlanarHamiltonian.field H (x - c) := by + unfold PlanarHamiltonian.field PlanarHamiltonian.spatialD + simp only [fderiv_comp_sub] + +def translationGate (χ : Plane → ℝ) (c v : Plane) : Plane → Plane := + PlanarHamiltonian.field + (fun x => χ (x - c) * PlanarHamiltonian.translationPotential v (x - c)) + +theorem translationGate_smooth {χ : Plane → ℝ} (hχ : ContDiff ℝ ∞ χ) + (c v : Plane) : ContDiff ℝ ∞ (translationGate χ c v) := + PlanarHamiltonian.field_smooth + ((hχ.comp (contDiff_id.sub contDiff_const)).mul + ((PlanarHamiltonian.translationPotential_smooth v).comp + (contDiff_id.sub contDiff_const))) + +theorem translationGate_solenoidal {χ : Plane → ℝ} (hχ : ContDiff ℝ ∞ χ) + (c v x : Plane) : PlanarHamiltonian.divergence (translationGate χ c v) x = 0 := + PlanarHamiltonian.field_divergence + ((hχ.comp (contDiff_id.sub contDiff_const)).mul + ((PlanarHamiltonian.translationPotential_smooth v).comp + (contDiff_id.sub contDiff_const))) x + +theorem translationGate_plateau {χ : Plane → ℝ} (c v x : Plane) + (hχ : χ =ᶠ[𝓝 (x - c)] fun _ => 1) : translationGate χ c v x = v := by + unfold translationGate + have hc : (fun y => χ (y - c)) =ᶠ[𝓝 x] fun _ => 1 := + hχ.comp_tendsto (continuous_id.sub continuous_const).continuousAt + rw [PlanarHamiltonian.field_cutoff_plateau _ _ hc, field_translate, + PlanarHamiltonian.field_translation] + +theorem translationGate_support (χ : Plane → ℝ) (c v : Plane) : + tsupport (translationGate χ c v) ⊆ tsupport (fun x => χ (x - c)) := + (PlanarHamiltonian.field_tsupport _).trans (tsupport_mul_subset_left) + +theorem translationGate_compactSupport {χ : Plane → ℝ} (hχ : HasCompactSupport χ) + (c v : Plane) : HasCompactSupport (translationGate χ c v) := by + have hc : HasCompactSupport (fun x => χ (x - c)) := by + simpa only [Function.comp_def, Homeomorph.coe_addRight, sub_eq_add_neg] using + hχ.comp_homeomorph (Homeomorph.addRight (-c)) + apply hc.of_isClosed_subset (isClosed_tsupport _) + exact translationGate_support χ c v + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGlobalBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGlobalBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cf9b2de833213692e109fdc70cd40bc3d02854b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingGlobalBounds.lean @@ -0,0 +1,145 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingWireRates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingNormalizedCenter +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingSeriesBounds + +namespace OAI + +/-! Uniform bounds for the complete expanding-array drift. The velocity +of each gate pays for the growing finite address table at every stage. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder +open scoped ContDiff BigOperators + +private theorem finite_jet_sum_bound {ι : Type*} [Fintype ι] + (f : ι → (ℝ × Plane) → Plane) (hf : ∀ i, ContDiff ℝ ∞ (f i)) + (k : ℕ) (y : ℝ × Plane) (A : ℝ) + (hA : ∀ i, ‖iteratedFDeriv ℝ k (f i) y‖ ≤ A) : + ‖iteratedFDeriv ℝ k (fun x => ∑ i, f i x) y‖ ≤ (Fintype.card ι : ℝ) * A := by + classical + rw [iteratedFDeriv_fun_sum_apply (f := f) (fun i _ => + ((hf i).of_le (by simp)).contDiffAt)] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ _i : ι, A := Finset.sum_le_sum (fun i _ => hA i) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + +private theorem stage_gate_jet_bound (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ : ℝ} (hσ : 0 < σ) (k : ℕ) {C A : ℝ} (hC1 : 1 ≤ C) + (hC : ∀ i ≤ k+1, ∀ t, |iteratedDeriv i (smoothRamp 0 1) t| ≤ C) + (hA : 0 ≤ A) + (hkernel : ∀ j : Fin 2, ∀ i ≤ k, ∀ x, ‖iteratedFDeriv ℝ i (gateKernel j) x‖ ≤ A) + (n : ℕ) (w : StageWire M hM blank (m+n)) (y : ℝ × Plane) : + let D := workGrowth M blank + let K := workFactor M blank m + let V := 4 * (6 : ℝ)^(k+1) * C + let Z := 1+V + let B := 2 * ∑ i ∈ Finset.range (k+1), + (k.choose i : ℝ)*V*((k-i).factorial*A*Z^(k-i)) + ‖iteratedFDeriv ℝ k (Function.uncurry (movingGate (radius σ D K n) + (wireCurve M hM blank (m+n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n+1)) w))) y‖ ≤ + B * stageAmplitude M blank m n := by + dsimp only + let D := workGrowth M blank + let K := workFactor M blank m + have hD : 1 ≤ D := workGrowth_ge_one M blank + have hK : 0 ≤ K := workFactor_nonneg M blank m + let V := 4 * (6 : ℝ)^(k+1) * C + have hV : 0 ≤ V := by dsimp [V]; positivity + let Z := 1+V + have hZ : 0 ≤ Z := by dsimp [Z]; positivity + let B := 2 * ∑ i ∈ Finset.range (k+1), + (k.choose i : ℝ)*V*((k-i).factorial*A*Z^(k-i)) + let c := wireCurve M hM blank (m+n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n+1)) w + have hc : ContDiff ℝ ∞ c := wireCurve_smooth M hM blank (m+n) _ _ _ _ w + have hvc : ContDiff ℝ ∞ (fun p : ℝ × Plane => deriv c p.1) := + ((contDiff_infty_iff_deriv.mp hc).2).comp contDiff_fst + have hcenter (i : ℕ) (hi : 1 ≤ i) (hik : i ≤ k) : + ‖iteratedFDeriv ℝ i (normalizedCenter (radius σ D K n) c) y‖ ≤ Z^i := by + apply normalizedCenter_positive_jet (radius_ge_one hσ hD hK n) hV hc i hi + apply (wireCurve_positive_jet_bound M hM blank m hσ (by linarith : 0 ≤ C) + (k+1) hC n w i hi (by omega) y.1).trans + exact (mul_le_mul_of_nonneg_left (stageAmplitude_le_one M blank m n) hV).trans_eq + (mul_one V) + have hvel (j : Fin 2) (i : ℕ) (hik : i ≤ k) : + ‖iteratedFDeriv ℝ i (fun p : ℝ × Plane => deriv c p.1 j) y‖ ≤ + V*stageAmplitude M blank m n := by + have hs : ContDiff ℝ ∞ (fun s => deriv c s j) := + (contDiff_apply ℝ ℝ j).comp ((contDiff_infty_iff_deriv.mp hc).2) + apply (time_comp_jet_bound hs i y).trans + rw [Real.norm_eq_abs, iteratedDeriv_velocity_component hc, + iteratedDeriv_component hc] + apply (show |iteratedDeriv (i+1) c y.1 j| ≤ ‖iteratedDeriv (i+1) c y.1‖ from by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (iteratedDeriv (i+1) c y.1) j).trans + exact wireCurve_positive_jet_bound M hM blank m hσ (by linarith : 0 ≤ C) + (k+1) hC n w (i+1) (by omega) (by omega) y.1 + rw [movingGate_eq_packet (radius_pos hσ hD hK n).ne'] + apply (gatePacket_jet_bound hvc (normalizedCenter_smooth _ hc) k y hA hZ + (mul_nonneg hV (stageAmplitude_nonneg M blank m n)) hkernel hvel hcenter).trans_eq + have he : (∑ i ∈ Finset.range (k+1), (k.choose i : ℝ)*(V*stageAmplitude M blank m n)* + ((k-i).factorial*A*Z^(k-i))) = + (∑ i ∈ Finset.range (k+1), (k.choose i : ℝ)*V*((k-i).factorial*A*Z^(k-i))) * + stageAmplitude M blank m n := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + ring + rw [he] + ring + +theorem expandingDrift_all_jets_bounded (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ : ℝ} (hσ : 0 < σ) (k : ℕ) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ y : ℝ × Plane, + ‖iteratedFDeriv ℝ k (Function.uncurry (expandingDrift M hM blank m σ + (workGrowth M blank) (workFactor M blank m))) y‖ ≤ B := by + let D := workGrowth M blank + let K := workFactor M blank m + have hD : 1 ≤ D := workGrowth_ge_one M blank + have hK : 0 ≤ K := workFactor_nonneg M blank m + obtain ⟨C, hC1, hC⟩ := unitRamp_jet_bound (k+1) + obtain ⟨A, hA, hkernel⟩ := gateKernel_jet_bound k + let V := 4 * (6 : ℝ)^(k+1) * C + have hV : 0 ≤ V := by dsimp [V]; positivity + let Z := 1+V + have hZ : 0 ≤ Z := by dsimp [Z]; positivity + let B := 2 * ∑ i ∈ Finset.range (k+1), + (k.choose i : ℝ)*V*((k-i).factorial*A*Z^(k-i)) + have hB : 0 ≤ B := by dsimp [B]; positivity + have hgate (n : ℕ) (w : StageWire M hM blank (m+n)) (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ k (Function.uncurry (movingGate (radius σ D K n) + (wireCurve M hM blank (m+n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n+1)) w))) y‖ ≤ + B * stageAmplitude M blank m n := by + exact stage_gate_jet_bound M hM blank m hσ k hC1 hC hA hkernel n w y + have hstage (n : ℕ) (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ k (Function.uncurry (stageDrift M hM blank m σ D K n)) y‖ ≤ + B*(1/2 : ℝ)^n := by + change ‖iteratedFDeriv ℝ k (fun p : ℝ × Plane => + ∑ w : StageWire M hM blank (m+n), movingGate (radius σ D K n) + (wireCurve M hM blank (m+n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n+1)) w) p.1 p.2) y‖ ≤ _ + have hb := finite_jet_sum_bound + (fun w : StageWire M hM blank (m+n) => + Function.uncurry (movingGate (radius σ D K n) + (wireCurve M hM blank (m+n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n+1)) w))) + (fun w => movingGate_smooth _ (wireCurve_smooth M hM blank (m+n) _ _ _ _ w)) + k y (B * stageAmplitude M blank m n) (fun w => hgate n w y) + apply hb.trans + calc + (Fintype.card (StageWire M hM blank (m+n)) : ℝ) * (B * stageAmplitude M blank m n) = + B * ((Fintype.card (StageWire M hM blank (m+n)) : ℝ) * stageAmplitude M blank m n) := by ring + _ ≤ B*(1/2 : ℝ)^n := mul_le_mul_of_nonneg_left + (stageAmplitude_total_bound M hM blank m n) hB + exact ⟨2*B, by positivity, expandingDrift_jet_bound M hM blank m hσ hD hK k hB hstage⟩ + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingInitialCapture.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingInitialCapture.lean new file mode 100644 index 0000000000000000000000000000000000000000..8337555bb9c57b54bc4f335931a4fb4e11f67632 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingInitialCapture.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneUnitImpulse +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneWeightedEvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneIntegralBounds + +namespace OAI + +/-! The injection is captured before the first moving stage. Testing the +actual scalar equation gives the initial mass minus its diffusion loss. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows VelocityDetector Set MeasureTheory +open scoped ContDiff + +theorem concentrationCutoff_mul_unitImpulse {R : ℝ} (hR : 1 ≤ R) + (p : Plane) (t : ℝ) (x : Plane) : + concentrationCutoff R p x * unitImpulse p t x = unitImpulse p t x := by + by_cases hx : spatialImpulse p x = 0 + · simp [unitImpulse, hx] + · have hs := spatialImpulse_support p hx + have he : concentrationCutoff R p x = 1 := by + apply concentrationCutoff_one (by linarith) + intro j + have hl := hs.1 j + have hu := hs.2 j + have hb : |x j - p j| ≤ 1 / 2 := abs_le.mpr ⟨by linarith, by linarith⟩ + linarith + rw [he, one_mul] + +theorem initial_concentration_capture + {T ν R C b : ℝ} {a : ℝ → Plane → Plane} {w : ℝ → Plane → ℝ} + (p : Plane) (hw : PlaneScalarSolution T ν a (unitImpulse p) w) + (hν : 0 ≤ ν) (hR : 1 ≤ R) (hC : 0 ≤ C) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + (hwi : ∀ t ∈ Icc 0 T, Integrable (w t)) + (hwn : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ w t x) + (hwm : ∀ t ∈ Icc 0 T, (∫ x, w t x) ≤ 1) + (hb : 0 ≤ b) (hbT : b ≤ T) + (haz : ∀ t ∈ Ioo 0 b, a t = fun _ => 0) : + smoothRamp 0 1 b - ν * (R⁻¹ ^ 2 * C) * b ≤ + ∫ x, concentrationCutoff R p x * w b x := by + let φ := concentrationCutoff R p + let F : ℝ → ℝ := fun t => (∫ x, φ x * w t x) - smoothRamp 0 1 t + let L := R⁻¹ ^ 2 * C + have hL : 0 ≤ L := mul_nonneg (sq_nonneg _) hC + have hφ := concentrationCutoff_smooth R p + have hc := concentrationCutoff_compactSupport (by linarith : 0 < R) p + have hcont : ContinuousOn F (Icc 0 b) := + ((hw.test_integral_continuousOn hφ hc).sub + (smoothRamp_smooth 0 1).continuous.continuousOn).mono (Icc_subset_Icc le_rfl hbT) + have hder (t : ℝ) (ht : t ∈ Ioo 0 b) : + ∃ d, HasDerivAt F d t ∧ -(ν * L) ≤ d := by + have htT : t ∈ Ioo 0 T := ⟨ht.1, ht.2.trans_le hbT⟩ + have hi := hw.test_integral_derivative ha (unitImpulse_smooth p) hdiv hφ hc htT + have he : (∫ x, φ x * unitImpulse p t x) = smoothPulse 0 1 t := by + simp_rw [show ∀ x, φ x * unitImpulse p t x = unitImpulse p t x from + concentrationCutoff_mul_unitImpulse hR p t] + exact unitImpulse_mass p t + have hg : (∫ x, w t x * (ν * scalarLaplacian φ x + fderiv ℝ φ x (a t x))) = + ν * ∫ x, w t x * scalarLaplacian φ x := by + rw [haz t ht] + simp only [ContinuousLinearMap.map_zero, add_zero] + simp_rw [show ∀ x, w t x * (ν * scalarLaplacian φ x) = + ν * (w t x * scalarLaplacian φ x) from fun x => by ring] + exact integral_const_mul _ _ + rw [he, hg] at hi + have hd := hi.sub ((smoothRamp_smooth 0 1).differentiable (by simp) t).hasDerivAt + have hd' : HasDerivAt F (ν * ∫ x, w t x * scalarLaplacian φ x) t := by + convert hd using 1 + simp [smoothPulse] + refine ⟨_, hd', ?_⟩ + have hlap := concentrationCutoff_laplacian hΔ R p + have heabs : (∫ x, |w t x|) = ∫ x, w t x := by + congr 1 + funext x + exact abs_of_nonneg (hwn t (Ioo_subset_Icc_self htT) x) + have hiabs := abs_integral_mul_le (hwi t (Ioo_subset_Icc_self htT)) + (scalarLaplacian_smooth hφ).continuous.aestronglyMeasurable hlap + rw [heabs] at hiabs + have hiabs' : |∫ x, w t x * scalarLaplacian φ x| ≤ L := + hiabs.trans (by simpa only [mul_one] using + mul_le_mul_of_nonneg_left (hwm t (Ioo_subset_Icc_self htT)) hL) + have hmul := mul_le_mul_of_nonneg_left (abs_le.mp hiabs').1 hν + nlinarith + have hinc : F 0 - (ν * L) * (b - 0) ≤ F b := by + apply lower_increment_of_derivative_bound hb hcont (d := deriv F) + · intro t ht + obtain ⟨d, hd, _⟩ := hder t ht + rw [hd.deriv] + exact hd + · intro t ht + obtain ⟨d, hd, hbound⟩ := hder t ht + rw [hd.deriv] + exact hbound + have hzero : F 0 = 0 := by + dsimp [F] + rw [hw.initial] + simp [smoothRamp_before (by norm_num : (0 : ℝ) < 1) le_rfl] + rw [hzero] at hinc + dsimp [F, L, φ] at hinc + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..37777ed96e5b7a717b963484028716ef7ad681a1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMain.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFluidDetector +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingProgramParameters +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingForceBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.UniformForceBounds + +namespace OAI + +/-! Whole-plane velocity detection from a terminating finite program. +The program uses a single viscosity approximation to choose its schedule; +each query uses a finite prefix of the full guarded instruction graph. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set +open scoped ContDiff + +def compiledExpandingForce (C : ℕ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (a : ℕ → ℚ) (ν : ℝ) : Velocity := + let σ := programSigma C a + let D := programGrowth I.1 (recorderBlank I.1) + let K := programFactor I.1 (recorderBlank I.1) (initialWordLength I) + let p := initialCenterCode I hI σ D K + triangularForce ν + (expandingDrift I.1 hI.1 (recorderBlank I.1) (initialWordLength I) σ D K) + (unitImpulse (fun j => (p j : ℝ))) + +def evaluateCompiledExpandingForce (C : ℕ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (a : ℕ → ℚ) (α : List (Fin 4)) + (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + let σ := programSigma C a + let D := programGrowth I.1 (recorderBlank I.1) + let K := programFactor I.1 (recorderBlank I.1) (initialWordLength I) + evaluateExpandingForce I.1 hI.1 (recorderBlank I.1) (initialWordLength I) + σ D K (initialCenterCode I hI σ D K) α a b ε hε + +def compiledExpandingForceBound (C : ℕ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (a : ℕ → ℚ) (α : List (Fin 4)) (R : ℚ) : ℚ := + let σ := programSigma C a + let D := programGrowth I.1 (recorderBlank I.1) + let K := programFactor I.1 (recorderBlank I.1) (initialWordLength I) + expandingForceBoxBound I.1 hI.1 (recorderBlank I.1) (initialWordLength I) + σ D K (initialCenterCode I hI σ D K) α a R + +theorem compiledExpandingForceBound_spec (C : ℕ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {a : ℕ → ℚ} {ν : ℝ} (ha : IsFastRealName a ν) + (α : List (Fin 4)) (R : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) : + ‖mixedDerivative (compiledExpandingForce C I hI a ν) α y‖ ≤ + (compiledExpandingForceBound C I hI a α R : ℝ) := + expandingForceBoxBound_spec I.1 hI.1 (recorderBlank I.1) (initialWordLength I) + (programSigma_pos C a) (programGrowth_ge_one I.1 (recorderBlank I.1)) + (programFactor_nonneg I.1 (recorderBlank I.1) (initialWordLength I)) _ α ha R y hy + +theorem compiledExpandingForce_effective (C : ℕ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {a : ℕ → ℚ} {ν : ℝ} (ha : IsFastRealName a ν) + (α : List (Fin 4)) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (compiledExpandingForce C I hI a ν) α y - + rationalVector (evaluateCompiledExpandingForce C I hI a α b ε hε)‖ ≤ (ε : ℝ) := + evaluateExpandingForce_spec I.1 hI.1 (recorderBlank I.1) (initialWordLength I) + (programSigma_pos C a) (programGrowth_ge_one I.1 (recorderBlank I.1)) + (programFactor_nonneg I.1 (recorderBlank I.1) (initialWordLength I)) _ α ha hb ε hε + +theorem whole_plane_velocity_detection (hE : PlaneScalarExistence) + (hEnergy : CylinderLocalEnergyIdentity) : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + let f := compiledExpandingForce C I hI a ν + ContDiff ℝ ∞ f ∧ + (∀ α : List (Fin 4), ∃ B : ℝ, 0 ≤ B ∧ ∀ y, ‖mixedDerivative f α y‖ ≤ B) ∧ + (∀ T : ℝ, ∃ K : Set Plane, IsCompact K ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x : Space, horizontalLinear x ∉ K → f (t,x) = 0) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative f α y - + rationalVector (evaluateCompiledExpandingForce C I hI a α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (R : ℚ) (y : SpaceTime), + (∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) → + ‖mixedDerivative f α y‖ ≤ (compiledExpandingForceBound C I hI a α R : ℝ)) ∧ + WholePlaneDetection ν f I := by + obtain ⟨C, hC, hΔ⟩ := massCutoff_laplacian_bound + refine ⟨C, hC, ?_⟩ + intro I hI ν hν a ha + dsimp only + let blank := recorderBlank I.1 + let m := initialWordLength I + let σ := programSigma C a + let D := programGrowth I.1 blank + let K := programFactor I.1 blank m + let p := initialCenterCode I hI σ D K + have hσ : (0 : ℝ) < σ := by exact_mod_cast programSigma_pos C a + have hD : (1 : ℝ) ≤ D := by exact_mod_cast programGrowth_ge_one I.1 blank + have hK : (0 : ℝ) ≤ K := by exact_mod_cast programFactor_nonneg I.1 blank m + have hs := expandingDrift_smooth I.1 hI.1 blank m hσ hD hK + refine ⟨triangularForce_smooth hs (unitImpulse_smooth (fun j => (p j : ℝ))) ν, + ?_, ?_, ?_, ?_, ?_⟩ + · intro α + simpa only [compiledExpandingForce, programGrowth_val, programFactor_val] using + expandingForce_all_mixed_bounded I.1 hI.1 blank m hσ ν (fun j => (p j : ℝ)) α + · intro T + exact expandingForce_compact_on_finite_intervals I.1 hI.1 blank m hσ hD hK + ν (fun j => (p j : ℝ)) T + · intro α b y hb ε hε + exact compiledExpandingForce_effective C I hI ha α hb ε hε + · intro α R y hy + exact compiledExpandingForceBound_spec C I hI ha α R y hy + · have hc : (fun j => (p j : ℝ)) = + configurationCenter I.1 hI.1 blank m σ D K 0 (finiteInitializedRecorder I hI) := + initialCenterCode_val I hI σ D K + have hd := expanding_fluid_detection hE hEnergy I hI hν (Nat.cast_nonneg C) + hσ hD hK (programSigma_budget C ha) hΔ + simpa only [compiledExpandingForce, hc, p, σ, D, K, blank, m] using hd + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassCutoff.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..78b4f07e27dd6652f067f1350f7a53a80a821d2f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassCutoff.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateProfile +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarComparison + +namespace OAI + +/-! A smooth concentration cutoff with one fixed finite integer bound on +its Laplacian. The bound is proved from compact support. It can be baked +into a finite force program and does not depend on a machine or viscosity. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows PlanarHamiltonian VelocityDetector Set +open scoped ContDiff Topology + +def massCutoff : Plane → ℝ := gateCutoff (1 / 3) + +theorem massCutoff_smooth : ContDiff ℝ ∞ massCutoff := gateCutoff_smooth _ + +theorem massCutoff_compactSupport : HasCompactSupport massCutoff := + gateCutoff_compactSupport (by norm_num) + +theorem massCutoff_range (x : Plane) : massCutoff x ∈ Icc (0 : ℝ) 1 := gateCutoff_range _ x + +theorem massCutoff_support : tsupport massCutoff ⊆ {x | ∀ j, |x j| ≤ 1} := by + simpa only [massCutoff, show (3 : ℝ) * (1 / 3) = 1 by norm_num] using + (gateCutoff_tsupport (by norm_num : (0 : ℝ) < 1 / 3)) + +theorem massCutoff_one_near {x : Plane} (hx : ∀ j, |x j| < 2 / 3) : + massCutoff =ᶠ[𝓝 x] fun _ => 1 := by + apply gateCutoff_one_near (by norm_num : (0 : ℝ) < 1 / 3) + intro j + convert hx j using 1 + norm_num + +theorem scalarLaplacian_compactSupport {f : Plane → ℝ} (hf : HasCompactSupport f) : + HasCompactSupport (scalarLaplacian f) := by + have h₀ := (hf.fderiv_apply ℝ (basis 0)).fderiv_apply ℝ (basis 0) + have h₁ := (hf.fderiv_apply ℝ (basis 1)).fderiv_apply ℝ (basis 1) + have he : scalarLaplacian f = (fun x => spatialD 0 (spatialD 0 f) x + + spatialD 1 (spatialD 1 f) x) := by + funext x + simp only [scalarLaplacian, Fin.sum_univ_two] + rw [he] + exact h₀.add h₁ + +theorem scalarLaplacian_smooth {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) : + ContDiff ℝ ∞ (scalarLaplacian f) := by + unfold scalarLaplacian + exact ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hf)) + +theorem massCutoff_laplacian_bound : + ∃ C : ℕ, 1 ≤ C ∧ ∀ x, |scalarLaplacian massCutoff x| ≤ C := by + obtain ⟨B, hB⟩ := (scalarLaplacian_smooth massCutoff_smooth).continuous.bounded_above_of_compact_support (scalarLaplacian_compactSupport massCutoff_compactSupport) + let C : ℕ := ⌈max 1 B⌉₊ + have hC : max 1 B ≤ (C : ℝ) := Nat.le_ceil _ + have h₁ : (1 : ℝ) ≤ C := (le_max_left _ _).trans hC + refine ⟨C, by exact_mod_cast h₁, ?_⟩ + intro x + exact (show |scalarLaplacian massCutoff x| ≤ B by + simpa only [Real.norm_eq_abs] using hB x).trans ((le_max_right _ _).trans hC) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassEvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..d54e72d2da3686c2da770c721510780e7adfaf73 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMassEvolution.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMovingMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingConcentrationFamily + +namespace OAI + +/-! The actual translated concentration cutoffs retain scalar mass, up +to the inverse-square diffusion loss, along a rigid moving gate. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows VelocityDetector Set MeasureTheory +open scoped ContDiff + +theorem concentration_mass_derivative_lower + {T ν R C M : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hν : 0 ≤ ν) (hR : 0 < R) (hC : 0 ≤ C) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) (hb : ∃ B : ℝ, ∀ t, ‖c t‖ ≤ B) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + {t : ℝ} (ht : t ∈ Ioo 0 T) + (hwi : Integrable (w t)) (hwn : ∀ x, 0 ≤ w t x) (hwm : (∫ x, w t x) ≤ M) + (hhn : ∀ x, 0 ≤ h t x) + (hrigid : ∀ x, (∀ j, |x j - c t j| < 2 * R) → a t x = deriv c t) : + ∃ d : ℝ, HasDerivAt (fun s => ∫ x, concentrationCutoff R (c s) x * w s x) d t ∧ + -(ν * (R⁻¹ ^ 2 * C) * M) ≤ d := by + obtain ⟨B, hB⟩ := hb + obtain ⟨K, hK, hs, hds⟩ := concentrationFamily_compact hR hB + exact hw.moving_mass_derivative_lower + (φ := fun s => concentrationCutoff R (c s)) + (φd := concentrationDerivative R c) hν (mul_nonneg (sq_nonneg _) hC) ha hh hdiv + (concentrationCutoff_joint_smooth R hc) (concentrationDerivative_smooth R hc) + (fun s x => concentrationCutoff_timeDerivative R hc s x) hK hs hds ht hwi hwn hwm + (fun x => (concentrationCutoff_range R (c t) x).1) hhn + (concentrationCutoff_laplacian hΔ R (c t)) + (concentrationCutoff_transport_cancel hR (a t) t hrigid) + +theorem concentration_mass_retention + {T ν R C M A B : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hν : 0 ≤ ν) (hR : 0 < R) (hC : 0 ≤ C) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) (hb : ∃ Q : ℝ, ∀ t, ‖c t‖ ≤ Q) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + (hwi : ∀ t ∈ Icc 0 T, Integrable (w t)) + (hwn : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ w t x) + (hwm : ∀ t ∈ Icc 0 T, (∫ x, w t x) ≤ M) + (hhn : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) + (hA : 0 ≤ A) (hAB : A ≤ B) (hBT : B ≤ T) + (hrigid : ∀ t ∈ Ioo A B, ∀ x, + (∀ j, |x j - c t j| < 2 * R) → a t x = deriv c t) : + (∫ x, concentrationCutoff R (c A) x * w A x) - + ν * (R⁻¹ ^ 2 * C) * M * (B - A) ≤ + ∫ x, concentrationCutoff R (c B) x * w B x := by + let F : ℝ → ℝ := fun t => ∫ x, concentrationCutoff R (c t) x * w t x + have hsub : Icc A B ⊆ Icc (0 : ℝ) T := Icc_subset_Icc hA hBT + have hsub' : Ioo A B ⊆ Ioo (0 : ℝ) T := by + intro t ht + exact ⟨lt_of_le_of_lt hA ht.1, lt_of_lt_of_le ht.2 hBT⟩ + obtain ⟨Q, hQ⟩ := hb + obtain ⟨K, hK, hs, _⟩ := concentrationFamily_compact hR hQ + have hcont : ContinuousOn F (Icc 0 T) := by + apply compact_supported_integral_continuousOn + (g := fun p : ℝ × Plane => concentrationCutoff R (c p.1) p.2 * w p.1 p.2) + (((concentrationCutoff_joint_smooth R hc).contDiffOn.mul hw.smooth).continuousOn) hK + intro t x hx + apply hs t + exact fun hz => hx (by change concentrationCutoff R (c t) x * w t x = 0; rw [hz, zero_mul]) + have hd (t : ℝ) (ht : t ∈ Ioo A B) : + ∃ d, HasDerivAt F d t ∧ -(ν * (R⁻¹ ^ 2 * C) * M) ≤ d := + concentration_mass_derivative_lower hw hν hR hC ha hh hdiv hc ⟨Q, hQ⟩ hΔ + (hsub' ht) (hwi t (hsub (Ioo_subset_Icc_self ht))) + (hwn t (hsub (Ioo_subset_Icc_self ht))) + (hwm t (hsub (Ioo_subset_Icc_self ht))) + (hhn t (hsub (Ioo_subset_Icc_self ht))) (hrigid t ht) + apply lower_increment_of_derivative_bound hAB (hcont.mono hsub) + (d := deriv F) + · intro t ht + obtain ⟨d, hd, _⟩ := hd t ht + rw [hd.deriv] + exact hd + · intro t ht + obtain ⟨d, hd, hb⟩ := hd t ht + rw [hd.deriv] + exact hb + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMovingCutoff.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMovingCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..b02c32cd9ebdf4c4d43c0b531b1e35fb93578e10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingMovingCutoff.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMassCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarScaling + +namespace OAI + +/-! Smooth concentration tests following an expanding translation gate. +The Laplacian loss has the required inverse-square scaling. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows VelocityDetector Set Filter +open scoped ContDiff Topology + +def concentrationCutoff (R : ℝ) (c x : Plane) : ℝ := + massCutoff (scalarAffineScale R⁻¹ c x) + +theorem concentrationCutoff_smooth (R : ℝ) (c : Plane) : + ContDiff ℝ ∞ (concentrationCutoff R c) := + massCutoff_smooth.comp (scalarAffineScale_smooth _ _) + +theorem concentrationCutoff_range (R : ℝ) (c x : Plane) : + concentrationCutoff R c x ∈ Icc (0 : ℝ) 1 := massCutoff_range _ + +theorem concentrationCutoff_support {R : ℝ} (hR : 0 < R) (c : Plane) : + Function.support (concentrationCutoff R c) ⊆ {x | ∀ j, |x j - c j| ≤ R} := by + intro x hx j + have hb := massCutoff_support (subset_closure hx) j + change |R⁻¹ * (x j - c j)| ≤ 1 at hb + rw [abs_mul, abs_of_pos (inv_pos.mpr hR), ← div_eq_inv_mul] at hb + simpa only [one_mul] using (div_le_iff₀ hR).mp hb + +theorem concentrationCutoff_compactSupport {R : ℝ} (hR : 0 < R) (c : Plane) : + HasCompactSupport (concentrationCutoff R c) := by + apply HasCompactSupport.intro (K := Icc (fun j => c j - R) (fun j => c j + R)) isCompact_Icc + intro x hx + by_contra hn + have hb := concentrationCutoff_support hR c hn + apply hx + constructor <;> intro j + · linarith [(abs_le.mp (hb j)).1] + · linarith [(abs_le.mp (hb j)).2] + +theorem concentrationCutoff_one_near {R : ℝ} (hR : 0 < R) {c x : Plane} + (hx : ∀ j, |x j - c j| < (2 / 3) * R) : + concentrationCutoff R c =ᶠ[𝓝 x] fun _ => 1 := by + have he : massCutoff =ᶠ[𝓝 (scalarAffineScale R⁻¹ c x)] fun _ => 1 := by + apply massCutoff_one_near + intro j + change |R⁻¹ * (x j - c j)| < 2 / 3 + rw [abs_mul, abs_of_pos (inv_pos.mpr hR), ← div_eq_inv_mul] + exact (div_lt_iff₀ hR).mpr (hx j) + exact he.comp_tendsto (scalarAffineScale_smooth R⁻¹ c).continuous.continuousAt + +theorem concentrationCutoff_one {R : ℝ} (hR : 0 < R) {c x : Plane} + (hx : ∀ j, |x j - c j| < (2 / 3) * R) : concentrationCutoff R c x = 1 := + (concentrationCutoff_one_near hR hx).eq_of_nhds + +theorem concentrationCutoff_laplacian {C : ℝ} + (hC : ∀ x, |scalarLaplacian massCutoff x| ≤ C) (R : ℝ) (c x : Plane) : + |scalarLaplacian (concentrationCutoff R c) x| ≤ R⁻¹ ^ 2 * C := by + change |scalarLaplacian (fun y => massCutoff (scalarAffineScale R⁻¹ c y)) x| ≤ _ + rw [scalarLaplacian_affine_scale massCutoff_smooth, abs_mul, + abs_of_nonneg (sq_nonneg R⁻¹)] + exact mul_le_mul_of_nonneg_left (hC _) (sq_nonneg _) + +theorem concentrationCutoff_timeDerivative (R : ℝ) {c : ℝ → Plane} + (hc : ContDiff ℝ ∞ c) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => concentrationCutoff R (c s) x) + (-fderiv ℝ (concentrationCutoff R (c t)) x (deriv c t)) t := by + have hinner : HasDerivAt (fun s => scalarAffineScale R⁻¹ (c s) x) + (-(R⁻¹ • deriv c t)) t := by + convert (((hc.differentiable (by simp) t).hasDerivAt).const_sub x).const_smul R⁻¹ + using 1 + · rfl + · ext j + simp only [Pi.neg_apply, Pi.smul_apply, smul_eq_mul, mul_neg] + have ht := (massCutoff_smooth.differentiable (by simp) _).hasFDerivAt.comp_hasDerivAt t hinner + have hs := (massCutoff_smooth.differentiable (by simp) _).hasFDerivAt.comp x + (scalarAffineScale_hasFDerivAt R⁻¹ (c t) x) + change HasFDerivAt (concentrationCutoff R (c t)) _ x at hs + rw [hs.fderiv] + convert ht using 1 <;> simp [concentrationCutoff, Function.comp_def] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingNormalizedCenter.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingNormalizedCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6163fbffbd99953a1dea97074012c08295efa68 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingNormalizedCenter.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingTimeJetBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateJetBounds + +namespace OAI + +/-! The rescaled moving coordinate has uniformly bounded positive jets. +No bound for its unbounded zeroth coordinate is needed by composition. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff + +theorem spatial_projection_positive_jet (n : ℕ) (hn : 1 ≤ n) (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ n (fun p : ℝ × Plane => p.2) y‖ ≤ 1 := by + obtain ⟨i, rfl⟩ := Nat.exists_eq_add_of_le hn + rw [Nat.add_comm 1 i, ← norm_iteratedFDeriv_fderiv] + have he : fderiv ℝ (fun p : ℝ × Plane => p.2) = + fun _ => ContinuousLinearMap.snd ℝ ℝ Plane := by + funext p + exact (ContinuousLinearMap.snd ℝ ℝ Plane).fderiv + rw [he] + cases i with + | zero => simpa only [norm_iteratedFDeriv_zero] using + (ContinuousLinearMap.norm_snd_le (𝕜 := ℝ) (E := ℝ) (F := Plane)) + | succ i => rw [iteratedFDeriv_succ_const]; simp + +def normalizedCenter (R : ℝ) (c : ℝ → Plane) (p : ℝ × Plane) : Plane := + R⁻¹ • (p.2 - c p.1) + +theorem normalizedCenter_smooth (R : ℝ) {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) : + ContDiff ℝ ∞ (normalizedCenter R c) := + (contDiff_snd.sub (hc.comp contDiff_fst)).const_smul _ + +theorem normalizedCenter_positive_jet {R B : ℝ} (hR : 1 ≤ R) (hB : 0 ≤ B) + {c : ℝ → Plane} (hc : ContDiff ℝ ∞ c) (n : ℕ) (hn : 1 ≤ n) + (y : ℝ × Plane) + (hb : ‖iteratedDeriv n c y.1‖ ≤ B) : + ‖iteratedFDeriv ℝ n (normalizedCenter R c) y‖ ≤ (1+B)^n := by + have hRp : 0 < R := lt_of_lt_of_le zero_lt_one hR + have hi : |R⁻¹| ≤ 1 := by + rw [abs_of_pos (inv_pos.mpr hRp)] + exact inv_le_one_of_one_le₀ hR + have hs := spatial_projection_positive_jet n hn y + have ht := (time_comp_jet_bound hc n y).trans hb + have hp : ContDiff ℝ ∞ (fun p : ℝ × Plane => p.2) := contDiff_snd + have hcp : ContDiff ℝ ∞ (fun p : ℝ × Plane => c p.1) := hc.comp contDiff_fst + have he : iteratedFDeriv ℝ n (normalizedCenter R c) y = + R⁻¹ • (iteratedFDeriv ℝ n (fun p : ℝ × Plane => p.2) y - + iteratedFDeriv ℝ n (fun p : ℝ × Plane => c p.1) y) := by + unfold normalizedCenter + rw [iteratedFDeriv_const_smul_apply' ((hp.sub hcp).of_le (by simp)).contDiffAt] + change R⁻¹ • iteratedFDeriv ℝ n + ((fun p : ℝ × Plane => p.2) - fun p : ℝ × Plane => c p.1) y = _ + rw [iteratedFDeriv_sub_apply (hp.of_le (by simp)).contDiffAt + (hcp.of_le (by simp)).contDiffAt] + rw [he, norm_smul, Real.norm_eq_abs] + calc + _ ≤ 1 * (‖iteratedFDeriv ℝ n (fun p : ℝ × Plane => p.2) y‖ + + ‖iteratedFDeriv ℝ n (fun p : ℝ × Plane => c p.1) y‖) := + mul_le_mul hi (norm_sub_le _ _) (norm_nonneg _) (by norm_num) + _ ≤ 1+B := by linarith + _ ≤ (1+B)^n := by + obtain ⟨q, rfl⟩ := Nat.exists_eq_add_of_le hn + rw [pow_add, pow_one] + exact le_mul_of_one_le_right (by positivity) (one_le_pow₀ (by linarith)) + +theorem movingGate_eq_packet {R : ℝ} (hR : R ≠ 0) (c : ℝ → Plane) : + Function.uncurry (movingGate R c) = + gatePacket (fun p => deriv c p.1) (normalizedCenter R c) := by + funext p + exact translationGate_scaled_kernel hR (c p.1) (deriv c p.1) p.2 + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5640a9302334b08257227ee1f9d5d12a2eb37f7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingObservation.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model +import Mathlib.MeasureTheory.Integral.Bochner.Set + +namespace OAI + +/-! The moving-cutoff mass estimate yields the fixed half-plane observer. +These are integral comparisons for the actual nonnegative scalar density; +they use neither a maximum of the density nor compact support of the density. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set MeasureTheory + +def upperHalfPlane : Set Plane := {x | 0 < x 1} + +theorem upperHalfPlane_measurable : MeasurableSet upperHalfPlane := + measurableSet_lt measurable_const (measurable_pi_apply 1) + +theorem cutoff_mass_le_observer {ρ φ : Plane → ℝ} + (hρ : Integrable ρ) (hw : Integrable (fun x => φ x * ρ x)) + (hn : ∀ x, 0 ≤ ρ x) (hb : ∀ x, φ x ≤ 1) + (hzero : ∀ x, x ∉ upperHalfPlane → φ x = 0) : + (∫ x, φ x * ρ x) ≤ ∫ x in upperHalfPlane, ρ x := by + rw [← integral_indicator upperHalfPlane_measurable] + apply integral_mono hw (hρ.indicator upperHalfPlane_measurable) + intro x + change φ x * ρ x ≤ upperHalfPlane.indicator ρ x + by_cases hx : x ∈ upperHalfPlane + · rw [indicator_of_mem hx] + exact mul_le_of_le_one_left (hn x) (hb x) + · rw [indicator_of_notMem hx, hzero x hx, zero_mul] + +theorem observer_mass_le_complement_cutoff {ρ φ : Plane → ℝ} + (hρ : Integrable ρ) (hw : Integrable (fun x => φ x * ρ x)) + (hn : ∀ x, 0 ≤ ρ x) (hb : ∀ x, φ x ≤ 1) + (hzero : ∀ x ∈ upperHalfPlane, φ x = 0) : + (∫ x in upperHalfPlane, ρ x) ≤ (∫ x, ρ x) - ∫ x, φ x * ρ x := by + have hi := hρ.indicator upperHalfPlane_measurable + have he : (∫ x, φ x * ρ x) + (∫ x in upperHalfPlane, ρ x) ≤ ∫ x, ρ x := by + rw [← integral_indicator upperHalfPlane_measurable, ← integral_add hw hi] + apply integral_mono (hw.add hi) hρ + intro x + change φ x * ρ x + upperHalfPlane.indicator ρ x ≤ ρ x + by_cases hx : x ∈ upperHalfPlane + · rw [indicator_of_mem hx, hzero x hx, zero_mul, zero_add] + · rw [indicator_of_notMem hx, add_zero] + exact mul_le_of_le_one_left (hn x) (hb x) + linarith + +theorem nonterminal_observer_bound {ρ φ : Plane → ℝ} {δ : ℝ} + (hρ : Integrable ρ) (hw : Integrable (fun x => φ x * ρ x)) + (hn : ∀ x, 0 ≤ ρ x) (hb : ∀ x, φ x ≤ 1) + (hzero : ∀ x ∈ upperHalfPlane, φ x = 0) + (hretain : (∫ x, ρ x) - δ ≤ ∫ x, φ x * ρ x) : + (∫ x in upperHalfPlane, ρ x) ≤ δ := by + have h := observer_mass_le_complement_cutoff hρ hw hn hb hzero + linarith + +theorem terminal_observer_detects {ρ φ : Plane → ℝ} {δ : ℝ} + (hρ : Integrable ρ) (hw : Integrable (fun x => φ x * ρ x)) + (hn : ∀ x, 0 ≤ ρ x) (hb : ∀ x, φ x ≤ 1) + (hzero : ∀ x, x ∉ upperHalfPlane → φ x = 0) + (hm : (∫ x, ρ x) = 1) (hδ : δ < 1 / 2) + (hretain : (∫ x, ρ x) - δ ≤ ∫ x, φ x * ρ x) : + 1 / 2 < ∫ x in upperHalfPlane, ρ x := by + have h := cutoff_mass_le_observer hρ hw hn hb hzero + linarith + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingProgramParameters.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingProgramParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd44810a2a60d4fb9b9f95aba1c03c50062e35f9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingProgramParameters.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingWorkBudget +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicForceEvaluation + +namespace OAI + +/-! Rational program parameters are obtained from a single approximation +to viscosity. The complete address graph, rather than its execution, is +used to compute the source location and the schedule. -/ + +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder + +def programSigma (C : ℕ) (a : ℕ → ℚ) : ℚ := (C + 1) * (|a 0| + 2) + +theorem programSigma_pos (C : ℕ) (a : ℕ → ℚ) : 0 < programSigma C a := by + unfold programSigma + positivity + +theorem programSigma_budget (C : ℕ) {ν : ℝ} {a : ℕ → ℚ} + (ha : IsFastRealName a ν) : ν * C ≤ (programSigma C a : ℝ) * 3000 := by + have happrox : |ν - (a 0 : ℝ)| ≤ 1 := by + simpa only [errorTolerance, pow_zero, inv_one] using ha 0 + have hν : ν ≤ |(a 0 : ℝ)| + 1 := by + linarith [(abs_le.mp happrox).2, le_abs_self (a 0 : ℝ)] + have hC : (0 : ℝ) ≤ C := Nat.cast_nonneg C + have hmul := mul_le_mul_of_nonneg_right hν hC + simp only [programSigma, Rat.cast_mul, Rat.cast_add, Rat.cast_natCast, + Rat.cast_one, Rat.cast_abs, Rat.cast_ofNat] + nlinarith [abs_nonneg (a 0 : ℝ)] + +def programGrowth (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : ℚ := + 2 * (addressGrowth M blank : ℚ) ^ 2 + +def programFactor (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : ℚ := + 9 * ((addressFactor M blank m : ℚ) + 1) ^ 2 + +theorem programGrowth_val (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : + (programGrowth M blank : ℝ) = workGrowth M blank := by + simp [programGrowth, workGrowth] + +theorem programFactor_val (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : + (programFactor M blank m : ℝ) = workFactor M blank m := by + simp [programFactor, workFactor] + +theorem programGrowth_ge_one (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : 1 ≤ programGrowth M blank := by + have h := workGrowth_ge_one M blank + rw [← programGrowth_val] at h + exact_mod_cast h + +theorem programFactor_nonneg (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : + 0 ≤ programFactor M blank m := by + unfold programFactor + positivity + +def initialCenterCode (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (σ D K : ℚ) : Fin 2 → ℚ := + let m := initialWordLength I + let blank := recorderBlank I.1 + let U := finiteInitializedRecorder I hI + ![16 * rationalRadius σ D K 0 * (configurationAddress I.1 blank m U).number, + if haltingControl (finiteMachine I.1 hI.1) U.control then + 16 * rationalRadius σ D K 0 else -(16 * rationalRadius σ D K 0)] + +theorem initialCenterCode_val (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (σ D K : ℚ) : + (fun j => (initialCenterCode I hI σ D K j : ℝ)) = + configurationCenter I.1 hI.1 (recorderBlank I.1) (initialWordLength I) + σ D K 0 (finiteInitializedRecorder I hI) := by + funext j + cases hc : haltingControl (finiteMachine I.1 hI.1) (finiteInitializedRecorder I hI).control <;> + fin_cases j <;> simp [initialCenterCode, configurationCenter, rationalRadius_val, hc] + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderAlphabet.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderAlphabet.lean new file mode 100644 index 0000000000000000000000000000000000000000..e858cf126b9c80512770b930129cd7735a649f41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderAlphabet.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteRecorder + +namespace OAI + +/-! A finite executable alphabet for the reversible recorder. The blank is +assigned digit zero, so finite integer stacks represent infinite blank tails. +All seven guarded instruction rows are retained, including unreachable rows. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +def controlCode (M : Alternating.Machine) + (q : Control (State M) (Alphabet M)) : ℕ := (allControls M).idxOf q + +theorem controlCode_lt (M : Alternating.Machine) + (q : Control (State M) (Alphabet M)) : controlCode M q < (allControls M).length := + List.idxOf_lt_length_of_mem (mem_allControls M q) + +theorem controlCode_injective (M : Alternating.Machine) : + Function.Injective (controlCode M) := by + intro q r h + exact (List.idxOf_inj (mem_allControls M q)).mp h + +def symbolList (M : Alternating.Machine) (blank : Recorder.Symbol (State M) (Alphabet M)) : + List (Recorder.Symbol (State M) (Alphabet M)) := + blank :: (allSymbols M).filter (fun s => s != blank) + +theorem mem_symbolList (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) : s ∈ symbolList M blank := by + by_cases h : s = blank + · simp [symbolList, h] + · simp [symbolList, mem_allSymbols M s, h] + +def symbolCode (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) : ℕ := (symbolList M blank).idxOf s + +theorem symbolCode_lt (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) : + symbolCode M blank s < (symbolList M blank).length := + List.idxOf_lt_length_of_mem (mem_symbolList M blank s) + +theorem symbolCode_blank (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : symbolCode M blank blank = 0 := by + simp [symbolCode, symbolList] + +theorem symbolCode_injective (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : Function.Injective (symbolCode M blank) := by + intro a b h + exact (List.idxOf_inj (mem_symbolList M blank a)).mp h + +theorem symbolCode_eq_zero (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) : symbolCode M blank s = 0 ↔ s = blank := by + rw [← symbolCode_blank M blank] + exact ⟨fun h => symbolCode_injective M blank h, congrArg (symbolCode M blank)⟩ + +def alphabetBase (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : ℕ := max 2 (symbolList M blank).length + +theorem alphabetBase_two_le (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : 2 ≤ alphabetBase M blank := le_max_left _ _ + +theorem symbolCode_lt_base (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) : symbolCode M blank s < alphabetBase M blank := + (symbolCode_lt M blank s).trans_le (le_max_right _ _) + +def encodedLocal (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (q a : ℕ) : Option (ℕ × ℕ × ℤ) := do + let state ← (allControls M)[q]? + let symbol ← (symbolList M blank)[a]? + let out ← evalLocal (finiteMachine M hM) state symbol + pure (controlCode M out.1, symbolCode M blank out.2.1, out.2.2) + +theorem encodedLocal_complete (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q q' : Control (State M) (Alphabet M)} + {s s' : Recorder.Symbol (State M) (Alphabet M)} {d : ℤ} + (h : LocalStep (finiteMachine M hM) q s q' s' d) : + encodedLocal M hM blank (controlCode M q) (symbolCode M blank s) = + some (controlCode M q', symbolCode M blank s', d) := by + simp only [encodedLocal, controlCode, symbolCode, + List.getElem?_idxOf (mem_allControls M q), + List.getElem?_idxOf (mem_symbolList M blank s), Option.bind_eq_bind, + Option.bind_some, Option.pure_def, h.eval] + +theorem encodedLocal_predecessor_unique (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q₁ q₂ q₁' q₂' : Control (State M) (Alphabet M)} + {s₁ s₂ s₁' s₂' : Recorder.Symbol (State M) (Alphabet M)} {d₁ d₂ : ℤ} + (h₁ : LocalStep (finiteMachine M hM) q₁ s₁ q₁' s₁' d₁) + (h₂ : LocalStep (finiteMachine M hM) q₂ s₂ q₂' s₂' d₂) + (hq : controlCode M q₁' = controlCode M q₂') + (hs : symbolCode M blank s₁' = symbolCode M blank s₂') : + controlCode M q₁ = controlCode M q₂ ∧ + symbolCode M blank s₁ = symbolCode M blank s₂ ∧ d₁ = d₂ := by + have hq' := controlCode_injective M hq + have hs' := symbolCode_injective M blank hs + subst q₂' + subst s₂' + obtain ⟨rfl, rfl, hd⟩ := h₁.predecessor_unique h₂ + exact ⟨rfl, rfl, hd⟩ + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderDynamics.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderDynamics.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d9fec1c87988804adbd50705650dc1341ce557a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderDynamics.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderGates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateCollars + +namespace OAI + +/-! Time collars, incompressibility and rigid motion for the entire finite +recorder array. The array includes every defined address transition. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder Set MeasureTheory +open scoped BigOperators + +theorem recorderStageField_zero_before (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) {t : ℝ} (ht : t ≤ a) (x : Plane) : + recorderStageField M hM blank d a T R R' t x = 0 := by + apply Finset.sum_eq_zero + intro w _ + exact scheduledGate_zero_before R a hT (16 * R) (16 * R') + w.val.1.number w.val.2.number (haltingControl (finiteMachine M hM) w.val.2.control) ht x + +theorem recorderStageField_zero_after (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) {t : ℝ} (ht : a + T ≤ t) (x : Plane) : + recorderStageField M hM blank d a T R R' t x = 0 := by + apply Finset.sum_eq_zero + intro w _ + exact scheduledGate_zero_after R a hT (16 * R) (16 * R') + w.val.1.number w.val.2.number (haltingControl (finiteMachine M hM) w.val.2.control) ht x + +theorem recorderStageField_properties (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a T : ℝ) {R : ℝ} (hR : 0 < R) (R' t : ℝ) : + HasCompactSupport (recorderStageField M hM blank d a T R R' t) ∧ + (∀ x, PlanarHamiltonian.divergence (recorderStageField M hM blank d a T R R' t) x = 0) ∧ + (∫ x, recorderStageField M hM blank d a T R R' t x) = 0 := + parallelGate_properties hR + (fun w : StageWire M hM blank d => wireCurve M hM blank d a T R R' w t) + (fun w : StageWire M hM blank d => deriv (wireCurve M hM blank d a T R R' w) t) + +theorem recorderStageField_rigid (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) (hR : 0 < R) (hRR : R ≤ R') + (w : StageWire M hM blank d) (t : ℝ) (x : Plane) + (hx : ∀ j, |x j - wireCurve M hM blank d a T R R' w t j| < 2 * R) : + recorderStageField M hM blank d a T R R' t x = + deriv (wireCurve M hM blank d a T R R' w) t := by + apply parallelGate_plateau hR + (fun w => wireCurve M hM blank d a T R R' w t) + (fun w => deriv (wireCurve M hM blank d a T R R' w) t) w x hx + intro q hqw + exact wireCurve_separated M hM blank d a hT hR hRR (Ne.symm hqw) t + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderGates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderGates.lean new file mode 100644 index 0000000000000000000000000000000000000000..cde2ac5e13c546706b7eb0861fcf69769e66c74a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderGates.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteGraph +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateMotion + +namespace OAI + +/-! The complete finite recorder graph drives one array of disjoint +moving gates. No selected computation is used to choose the gates. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder Set +open scoped ContDiff BigOperators + +abbrev StageWire (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) := + {ab : RecorderAddress M blank d × RecorderAddress M blank (d + 1) // + stageEdge M hM blank d ab.1 ab.2} + +theorem StageWire.source_injective (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + Function.Injective (fun w : StageWire M hM blank d => w.val.1) := by + intro w z hwz + change w.val.1 = z.val.1 at hwz + apply Subtype.ext + apply Prod.ext hwz + exact stageEdge_target_unique M hM blank d + (by rw [← hwz]; exact w.property) z.property + +theorem StageWire.target_injective (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) : + Function.Injective (fun w : StageWire M hM blank d => w.val.2) := by + intro w z hwz + change w.val.2 = z.val.2 at hwz + apply Subtype.ext + apply Prod.ext _ hwz + exact stageEdge_source_unique M hM blank d + (by rw [← hwz]; exact w.property) z.property + +def wireCurve (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a T R R' : ℝ) (w : StageWire M hM blank d) : ℝ → Plane := + scheduledCenter a T (16 * R) (16 * R') w.val.1.number w.val.2.number + (haltingControl (finiteMachine M hM) w.val.2.control) + +theorem wireCurve_smooth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a T R R' : ℝ) (w : StageWire M hM blank d) : + ContDiff ℝ ∞ (wireCurve M hM blank d a T R R' w) := + scheduledCenter_smooth _ _ _ _ _ _ _ + +theorem wireCurve_separated (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) (hR : 0 < R) (hRR : R ≤ R') + {w z : StageWire M hM blank d} (hwz : w ≠ z) (t : ℝ) : + ∃ j, 16 * R ≤ |wireCurve M hM blank d a T R R' w t j - + wireCurve M hM blank d a T R R' z t j| := by + have hs : w.val.1.number ≠ z.val.1.number := fun h => hwz + (StageWire.source_injective M hM blank d (RecorderAddress.number_injective M blank d h)) + have ht : w.val.2.number ≠ z.val.2.number := fun h => hwz + (StageWire.target_injective M hM blank d + (RecorderAddress.number_injective M blank (d + 1) h)) + exact scheduledCenter_separated a hT (by positivity) (by linarith) hs ht _ _ t + +def recorderStageField (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a T R R' : ℝ) (t : ℝ) (x : Plane) : Plane := + ∑ w : StageWire M hM blank d, movingGate R (wireCurve M hM blank d a T R R' w) t x + +theorem recorderStageField_smooth (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) (a T R R' : ℝ) : + ContDiff ℝ ∞ (Function.uncurry (recorderStageField M hM blank d a T R R')) := + ContDiff.sum (fun w _ => movingGate_smooth R (wireCurve_smooth M hM blank d a T R R' w)) + +theorem recorderStageField_tracks (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (a : ℝ) {T R R' : ℝ} (hT : 0 < T) (hR : 0 < R) (hRR : R ≤ R') + (w : StageWire M hM blank d) (z : Plane) (hz : ∀ j, |z j| < 2 * R) (t : ℝ) : + HasDerivAt (fun s => wireCurve M hM blank d a T R R' w s + z) + (recorderStageField M hM blank d a T R R' + t (wireCurve M hM blank d a T R R' w t + z)) t := by + have he : recorderStageField M hM blank d a T R R' t + (wireCurve M hM blank d a T R R' w t + z) = + deriv (wireCurve M hM blank d a T R R' w) t := by + apply parallelGate_plateau hR + (fun w => wireCurve M hM blank d a T R R' w t) + (fun w => deriv (wireCurve M hM blank d a T R R' w) t) w + · intro j + simpa only [Pi.add_apply, add_sub_cancel_left] using hz j + · intro q hqw + exact wireCurve_separated M hM blank d a hT hR hRR (Ne.symm hqw) t + rw [he] + exact ((wireCurve_smooth M hM blank d a T R R' w).differentiable (by simp) t).hasDerivAt.add_const z + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f2066545bc44bdbfada7126ac7cf85b88dfec8a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderMass.lean @@ -0,0 +1,150 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneImpulseScalar +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDriftStage +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMassEvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCutoffObservation + +namespace OAI + +/-! Mass transport along an actual recorder instruction. The prescribed +field still contains every finite address edge; only the test follows the +selected execution. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory + + def configurationCenter (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + (σ D K : ℝ) (n : ℕ) (U : Configuration (State M) (Alphabet M)) : Plane := + ![16 * radius σ D K n * (configurationAddress M blank (m + n) U).number, + if haltingControl (finiteMachine M hM) U.control then + 16 * radius σ D K n else -(16 * radius σ D K n)] + +theorem recorder_step_mass_retention + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {m : ℕ} (hm : 0 < m) + {σ D K ν C : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (hν : 0 ≤ ν) (hC : 0 ≤ C) (p : Plane) + {w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν (expandingDrift M hM blank m σ D K) (unitImpulse p) w) + (hwi : ∀ t, 0 ≤ t → Integrable (w t)) + (hwn : ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) + (hwm : ∀ t, 0 ≤ t → (∫ x, w t x) ≤ 1) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + {n : ℕ} {U V : Configuration (State M) (Alphabet M)} + (hU : CenteredBlank blank (m + n) U) (hstep : Step (finiteMachine M hM) U V) : + (∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter M hM blank m σ D K n U) x * w (stageStart σ D K n) x) - + ν * ((radius σ D K n)⁻¹ ^ 2 * C) * duration σ D K n ≤ + ∫ x, concentrationCutoff (radius σ D K (n + 1)) + (configurationCenter M hM blank m σ D K (n + 1) V) x * w (stageStart σ D K (n + 1)) x := by + let W : StageWire M hM blank (m + n) := + ⟨(configurationAddress M blank (m + n) U, + configurationAddress M blank (m + n + 1) V), + configurationAddress_step M hM blank (by omega) hU hstep⟩ + let c := wireCurve M hM blank (m + n) (stageStart σ D K n) + (duration σ D K n) (radius σ D K n) (radius σ D K (n + 1)) W + have hT : 0 < duration σ D K n := + lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hσ hD hK n) + have ht0 : 0 ≤ stageStart σ D K n := by linarith [stageStart_ge hσ hD hK n] + have htt : stageStart σ D K n ≤ stageStart σ D K (n + 1) := + (stageStart_strictMono hσ hD hK).monotone (by omega) + have ht1 := ht0.trans htt + obtain ⟨B, _, hB⟩ := scheduledCenter_bounded (stageStart σ D K n) hT + (16 * radius σ D K n) (16 * radius σ D K (n + 1)) + W.val.1.number W.val.2.number (haltingControl (finiteMachine M hM) W.val.2.control) + have hret := concentration_mass_retention (hw _ ht1) hν (radius_pos hσ hD hK n) hC + (expandingDrift_smooth M hM blank m hσ hD hK) (unitImpulse_smooth p) + (expandingDrift_divergence M hM blank m hσ hD hK) + (wireCurve_smooth M hM blank (m + n) _ _ _ _ W) ⟨B, hB⟩ hΔ + (fun t ht => hwi t ht.1) (fun t ht => hwn t ht.1) (fun t ht => hwm t ht.1) + (fun t _ x => unitImpulse_nonneg p t x) ht0 htt le_rfl + (fun t ht x hx => expandingDrift_rigid M hM blank m hσ hD hK n W + ht.1.le ht.2.le x hx) + have hnon : haltingControl (finiteMachine M hM) U.control = false := by + obtain ⟨_, _, _, hs, _⟩ := hstep + exact hs.source_nonhalting + have hc0 : c (stageStart σ D K n) = configurationCenter M hM blank m σ D K n U := by + rw [show c (stageStart σ D K n) = _ from scheduledCenter_initial _ hT _ _ _ _ _] + simp only [configurationCenter, hnon, Bool.false_eq_true, ↓reduceIte] + rfl + have hc1 : c (stageStart σ D K (n + 1)) = + configurationCenter M hM blank m σ D K (n + 1) V := by + rw [stageStart_succ] + rw [show c (stageStart σ D K n + duration σ D K n) = _ from + scheduledCenter_final _ hT _ _ _ _ _] + simp only [configurationCenter] + rfl + change (∫ x, concentrationCutoff (radius σ D K n) (c (stageStart σ D K n)) x * + w (stageStart σ D K n) x) - _ ≤ + ∫ x, concentrationCutoff (radius σ D K n) (c (stageStart σ D K (n + 1))) x * + w (stageStart σ D K (n + 1)) x at hret + have htime : stageStart σ D K (n + 1) - stageStart σ D K n = duration σ D K n := by + rw [stageStart_succ, add_sub_cancel_left] + rw [hc0, hc1, htime, mul_one] at hret + exact hret.trans (concentration_mass_le_doubled (hwi _ ht1) (hwn _ ht1) + (radius_pos hσ hD hK n) (radius_grows hσ hD hK n) _) + +theorem recorder_stage_partial_retention + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {m : ℕ} (hm : 0 < m) + {σ D K ν C : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (hν : 0 ≤ ν) (hC : 0 ≤ C) (p : Plane) + {w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν (expandingDrift M hM blank m σ D K) (unitImpulse p) w) + (hwi : ∀ t, 0 ≤ t → Integrable (w t)) + (hwn : ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) + (hwm : ∀ t, 0 ≤ t → (∫ x, w t x) ≤ 1) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) + {n : ℕ} {U V : Configuration (State M) (Alphabet M)} + (hU : CenteredBlank blank (m + n) U) (hstep : Step (finiteMachine M hM) U V) + {b : ℝ} (hb : stageStart σ D K n ≤ b) (hb' : b ≤ stageStart σ D K (n + 1)) : + (∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter M hM blank m σ D K n U) x * w (stageStart σ D K n) x) - + ν * ((radius σ D K n)⁻¹ ^ 2 * C) * (b - stageStart σ D K n) ≤ + ∫ x, concentrationCutoff (radius σ D K n) + (wireCurve M hM blank (m + n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n + 1)) + ⟨(configurationAddress M blank (m + n) U, + configurationAddress M blank (m + n + 1) V), + configurationAddress_step M hM blank (by omega) hU hstep⟩ b) x * w b x := by + let W : StageWire M hM blank (m + n) := + ⟨(configurationAddress M blank (m + n) U, + configurationAddress M blank (m + n + 1) V), + configurationAddress_step M hM blank (by omega) hU hstep⟩ + let c := wireCurve M hM blank (m + n) (stageStart σ D K n) + (duration σ D K n) (radius σ D K n) (radius σ D K (n + 1)) W + have hT : 0 < duration σ D K n := + lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hσ hD hK n) + have ht0 : 0 ≤ stageStart σ D K n := by linarith [stageStart_ge hσ hD hK n] + have ht1 := ht0.trans hb + obtain ⟨B, _, hB⟩ := scheduledCenter_bounded (stageStart σ D K n) hT + (16 * radius σ D K n) (16 * radius σ D K (n + 1)) + W.val.1.number W.val.2.number (haltingControl (finiteMachine M hM) W.val.2.control) + have hret := concentration_mass_retention (hw _ ht1) hν (radius_pos hσ hD hK n) hC + (expandingDrift_smooth M hM blank m hσ hD hK) (unitImpulse_smooth p) + (expandingDrift_divergence M hM blank m hσ hD hK) + (wireCurve_smooth M hM blank (m + n) _ _ _ _ W) ⟨B, hB⟩ hΔ + (fun t ht => hwi t ht.1) (fun t ht => hwn t ht.1) (fun t ht => hwm t ht.1) + (fun t _ x => unitImpulse_nonneg p t x) ht0 hb le_rfl + (fun t ht x hx => expandingDrift_rigid M hM blank m hσ hD hK n W + ht.1.le (ht.2.le.trans hb') x hx) + have hnon : haltingControl (finiteMachine M hM) U.control = false := by + obtain ⟨_, _, _, hs, _⟩ := hstep + exact hs.source_nonhalting + have hc0 : c (stageStart σ D K n) = configurationCenter M hM blank m σ D K n U := by + rw [show c (stageStart σ D K n) = _ from scheduledCenter_initial _ hT _ _ _ _ _] + simp only [configurationCenter, hnon, Bool.false_eq_true, ↓reduceIte] + rfl + change (∫ x, concentrationCutoff (radius σ D K n) (c (stageStart σ D K n)) x * + w (stageStart σ D K n) x) - _ ≤ + ∫ x, concentrationCutoff (radius σ D K n) (c b) x * w b x at hret + rw [hc0, mul_one] at hret + exact hret + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderRun.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderRun.lean new file mode 100644 index 0000000000000000000000000000000000000000..02fca78c50788771da557e0bb2905aa585f0fbb8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderRun.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderTransitions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteStackUpdates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderCoordinates + +namespace OAI + +/-! The integer address of the actual reversible recorder configuration. +The finite prefix is enlarged by one at every local instruction, and its +integer update agrees with the full guarded table. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +def codedTape (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) + (T : Radix.Tape (Recorder.Symbol (State M) (Alphabet M))) : Radix.Tape ℕ := + (fun n => symbolCode M blank (T.1 n), fun n => symbolCode M blank (T.2 n)) + +theorem codedTape_left (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) + (T : Radix.Tape (Recorder.Symbol (State M) (Alphabet M))) : + codedTape M blank (Radix.writeLeft s T) = + Radix.writeLeft (symbolCode M blank s) (codedTape M blank T) := by + apply Prod.ext + · rfl + · funext n + cases n with + | zero => rfl + | succ n => cases n <;> rfl + +theorem codedTape_stay (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) + (T : Radix.Tape (Recorder.Symbol (State M) (Alphabet M))) : + codedTape M blank (Radix.writeStay s T) = + Radix.writeStay (symbolCode M blank s) (codedTape M blank T) := by + apply Prod.ext + · rfl + · funext n + cases n <;> rfl + +theorem codedTape_right (M : Alternating.Machine) + (blank s : Recorder.Symbol (State M) (Alphabet M)) + (T : Radix.Tape (Recorder.Symbol (State M) (Alphabet M))) : + codedTape M blank (Radix.writeRight s T) = + Radix.writeRight (symbolCode M blank s) (codedTape M blank T) := by + apply Prod.ext + · funext n + cases n <;> rfl + · rfl + +def configurationStacks (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (C : Configuration (State M) (Alphabet M)) : ℕ × ℕ := + Lattice.integerTapeCode (alphabetBase M blank) d (codedTape M blank (tapeAt C)) + +theorem configurationStacks_bounds (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (C : Configuration (State M) (Alphabet M)) : + (configurationStacks M blank d C).1 < alphabetBase M blank ^ d ∧ + (configurationStacks M blank d C).2 < alphabetBase M blank ^ d := by + have hb : 0 < alphabetBase M blank := + lt_of_lt_of_le (by decide) (alphabetBase_two_le M blank) + constructor <;> apply Lattice.stackValue_lt hb d <;> + intro i _ <;> exact symbolCode_lt_base M blank _ + +theorem configurationStacks_read (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) {d : ℕ} (hd : 0 < d) + (C : Configuration (State M) (Alphabet M)) : + (configurationStacks M blank d C).2 % alphabetBase M blank = + symbolCode M blank (C.tape C.head) := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hd) + simpa only [configurationStacks, Lattice.integerTapeCode, codedTape, tapeAt, + Nat.cast_zero, add_zero] using + (Lattice.stackValue_head (b := alphabetBase M blank) (d := k) + (a := (codedTape M blank (tapeAt C)).2) (symbolCode_lt_base M blank _)) + +theorem configurationStacks_update (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) {d : ℕ} (hd : 0 < d) + (C : Configuration (State M) (Alphabet M)) + (q' : Control (State M) (Alphabet M)) (s : Recorder.Symbol (State M) (Alphabet M)) + {m : ℤ} (hm : -1 ≤ m ∧ m ≤ 1) + (hL : Lattice.StackTailZero d (codedTape M blank (tapeAt C)).1) + (hR : Lattice.StackTailZero d (codedTape M blank (tapeAt C)).2) : + configurationStacks M blank (d + 1) + ⟨q', C.head + m, Function.update C.tape C.head s⟩ = + (Lattice.nextLeft (alphabetBase M blank) (configurationStacks M blank d C).1 + (symbolCode M blank s) (moveCode m), + Lattice.nextRight (alphabetBase M blank) (configurationStacks M blank d C).1 + (configurationStacks M blank d C).2 (symbolCode M blank s) (moveCode m)) := by + have hb : 0 < alphabetBase M blank := + lt_of_lt_of_le (by decide) (alphabetBase_two_le M blank) + have hu := Lattice.integerTapeCode_move hb hd (symbolCode M blank s) + (codedTape M blank (tapeAt C)) (symbolCode_lt_base M blank _) + (symbolCode_lt_base M blank _) hL hR (moveCode m) + have hcases : m = -1 ∨ m = 0 ∨ m = 1 := by omega + rcases hcases with rfl | rfl | rfl + · simpa [configurationStacks, show C.head + (-1) = C.head - 1 by omega, + tapeAt_left, codedTape_left, moveCode] using hu + · simpa [configurationStacks, tapeAt_stay, codedTape_stay, moveCode] using hu + · simpa [configurationStacks, tapeAt_right, codedTape_right, moveCode] using hu + +theorem recorder_step_integer (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {d : ℕ} (hd : 0 < d) + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + (hL : Lattice.StackTailZero d (codedTape M blank (tapeAt C)).1) + (hR : Lattice.StackTailZero d (codedTape M blank (tapeAt C)).2) : + IntegerStep M hM blank C.control (configurationStacks M blank d C).1 + (configurationStacks M blank d C).2 D.control + (configurationStacks M blank (d + 1) D).1 + (configurationStacks M blank (d + 1) D).2 := by + obtain ⟨q', s, m, hs, rfl⟩ := h + have hu := configurationStacks_update M blank hd C q' s hs.displacement_bounds hL hR + refine ⟨C.tape C.head, s, m, hs, (configurationStacks_read M blank hd C).symm, ?_, ?_⟩ + · exact (congrArg Prod.fst hu).symm + · exact (congrArg Prod.snd hu).symm + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1554254c37b02d99f434408c291090e27592de3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderSupport.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteGraph +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderInputEncoding + +namespace OAI + +/-! Finite tape windows grow by one cell per recorder instruction. The +actual recorder step therefore appears in the finite stage graph. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +variable {Q A : Type*} + +def CenteredBlank (blank : Recorder.Symbol Q A) (d : ℕ) + (C : Configuration Q A) : Prop := + ∀ j : ℤ, j ≤ C.head - (d : ℤ) ∨ C.head + (d : ℤ) ≤ j → C.tape j = blank + +theorem CenteredBlank.step {blank : Recorder.Symbol Q A} {d : ℕ} + {M : Recorder.Machine Q A} {C D : Configuration Q A} + (hC : CenteredBlank blank d C) (hd : 0 < d) (h : Step M C D) : + CenteredBlank blank (d + 1) D := by + obtain ⟨q, s, m, hm, rfl⟩ := h + have hb := hm.displacement_bounds + intro j hj + change j ≤ C.head + m - ((d + 1 : ℕ) : ℤ) ∨ + C.head + m + ((d + 1 : ℕ) : ℤ) ≤ j at hj + have hne : j ≠ C.head := by omega + change Function.update C.tape C.head s j = blank + rw [Function.update_of_ne hne] + apply hC + rcases hj with hj | hj + · left + omega + · right + omega + +theorem CenteredBlank.steps {blank : Recorder.Symbol Q A} {d n : ℕ} + {M : Recorder.Machine Q A} {C D : Configuration Q A} + (hC : CenteredBlank blank d C) (hd : 0 < d) (h : Steps M n C D) : + CenteredBlank blank (d + n) D := by + induction h with + | zero => simpa only [Nat.add_zero] using hC + | @next n C D E hrun hstep ih => + simpa only [Nat.add_assoc] using (ih hC).step (by omega) hstep + +theorem CenteredBlank.coded_tails (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) {d : ℕ} + {C : Configuration (State M) (Alphabet M)} (hC : CenteredBlank blank d C) : + Lattice.StackTailZero d (codedTape M blank (tapeAt C)).1 ∧ + Lattice.StackTailZero d (codedTape M blank (tapeAt C)).2 := by + constructor + · intro i hi + change symbolCode M blank (C.tape (C.head - ((i : ℤ) + 1))) = 0 + rw [hC _ (Or.inl (by omega)), symbolCode_blank] + · intro i hi + change symbolCode M blank (C.tape (C.head + (i : ℤ))) = 0 + rw [hC _ (Or.inr (by omega)), symbolCode_blank] + +def configurationAddress (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (d : ℕ) + (C : Configuration (State M) (Alphabet M)) : RecorderAddress M blank d := + ⟨C.control, ⟨(configurationStacks M blank d C).1, + (configurationStacks_bounds M blank d C).1⟩, + ⟨(configurationStacks M blank d C).2, + (configurationStacks_bounds M blank d C).2⟩⟩ + +theorem configurationAddress_step (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {d : ℕ} (hd : 0 < d) + {C D : Configuration (State M) (Alphabet M)} + (hC : CenteredBlank blank d C) (h : Step (finiteMachine M hM) C D) : + stageEdge M hM blank d (configurationAddress M blank d C) + (configurationAddress M blank (d + 1) D) := by + obtain ⟨hL, hR⟩ := hC.coded_tails M blank + exact (boundedIntegerStep_iff M hM blank _ _ _ _ _ _).mpr + (recorder_step_integer M hM blank hd h hL hR) + +theorem initial_centeredBlank (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + CenteredBlank (recorderBlank I.1) (initialWordLength I) (finiteInitializedRecorder I hI) := by + intro j hj + have hhead : (finiteInitializedRecorder I hI).head = 0 := rfl + rw [hhead] at hj + apply initialTape_blank I hI + have hlen : 3 ≤ initialWordLength I := le_max_right _ _ + rcases hj with hj | hj + · left + omega + · right + omega + +theorem initialized_steps_centeredBlank (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {n : ℕ} + {C : Configuration (State I.1) (Alphabet I.1)} + (h : Steps (finiteMachine I.1 hI.1) n (finiteInitializedRecorder I hI) C) : + CenteredBlank (recorderBlank I.1) (initialWordLength I + n) C := + (initial_centeredBlank I hI).steps + (lt_of_lt_of_le (by decide : 0 < 3) (le_max_right _ _)) h + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderTransitions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderTransitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..59ee63ba5187d011ac63fba3c0c6366af7184d01 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRecorderTransitions.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderAlphabet +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteStackArithmetic + +namespace OAI + +/-! The full guarded recorder is injective on integer-stack configurations. +Incoming direction is recovered from the target control; the new stacks +then reveal the written symbol, and the seven-row inverse reveals the read +symbol. No invariant of the selected computation is assumed. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +def moveCode (d : ℤ) : Fin 3 := if d = -1 then 0 else if d = 0 then 1 else 2 + +def IntegerStep (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + (q : Control (State M) (Alphabet M)) (L R : ℕ) + (q' : Control (State M) (Alphabet M)) (L' R' : ℕ) : Prop := + ∃ (read write : Recorder.Symbol (State M) (Alphabet M)) (d : ℤ), + LocalStep (finiteMachine M hM) q read q' write d ∧ + symbolCode M blank read = R % alphabetBase M blank ∧ + Lattice.nextLeft (alphabetBase M blank) L (symbolCode M blank write) (moveCode d) = L' ∧ + Lattice.nextRight (alphabetBase M blank) L R (symbolCode M blank write) (moveCode d) = R' + +def integerNext (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (q L R : ℕ) : Option (ℕ × ℕ × ℕ) := do + let out ← encodedLocal M hM blank q (R % alphabetBase M blank) + pure (out.1, Lattice.nextLeft (alphabetBase M blank) L out.2.1 (moveCode out.2.2), + Lattice.nextRight (alphabetBase M blank) L R out.2.1 (moveCode out.2.2)) + +theorem IntegerStep.compiled (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q q' : Control (State M) (Alphabet M)} {L R L' R' : ℕ} + (hs : IntegerStep M hM blank q L R q' L' R') : + integerNext M hM blank (controlCode M q) L R = some (controlCode M q', L', R') := by + obtain ⟨a, b, d, hs, hr, hL, hR⟩ := hs + simp only [integerNext, ← hr, encodedLocal_complete M hM blank hs, + Option.bind_eq_bind, Option.bind_some, Option.pure_def] + rw [hL, hR] + +theorem IntegerStep.successor_unique (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q q₁ q₂ : Control (State M) (Alphabet M)} {L R L₁ L₂ R₁ R₂ : ℕ} + (h₁ : IntegerStep M hM blank q L R q₁ L₁ R₁) + (h₂ : IntegerStep M hM blank q L R q₂ L₂ R₂) : + q₁ = q₂ ∧ L₁ = L₂ ∧ R₁ = R₂ := by + have he := Option.some.inj ((IntegerStep.compiled M hM blank h₁).symm.trans + (IntegerStep.compiled M hM blank h₂)) + have hq := controlCode_injective M (congrArg Prod.fst he) + exact ⟨hq, congrArg (fun p : ℕ × ℕ × ℕ => p.2.1) he, + congrArg (fun p : ℕ × ℕ × ℕ => p.2.2) he⟩ + +theorem IntegerStep.predecessor_unique (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q₁ q₂ q' : Control (State M) (Alphabet M)} {L₁ L₂ R₁ R₂ L' R' : ℕ} + (h₁ : IntegerStep M hM blank q₁ L₁ R₁ q' L' R') + (h₂ : IntegerStep M hM blank q₂ L₂ R₂ q' L' R') : + q₁ = q₂ ∧ L₁ = L₂ ∧ R₁ = R₂ := by + obtain ⟨a₁, b₁, d₁, hs₁, hr₁, hL₁, hR₁⟩ := h₁ + obtain ⟨a₂, b₂, d₂, hs₂, hr₂, hL₂, hR₂⟩ := h₂ + have hd : d₁ = d₂ := hs₁.incoming_eq.symm.trans hs₂.incoming_eq + subst d₂ + have hb : 0 < alphabetBase M blank := lt_of_lt_of_le (by decide) (alphabetBase_two_le M blank) + obtain ⟨hL, hR, hw⟩ := Lattice.nextStacks_recover hb + (symbolCode_lt_base M blank b₁) (symbolCode_lt_base M blank b₂) (moveCode d₁) + (hL₁.trans hL₂.symm) (hR₁.trans hR₂.symm) + have hbb : b₁ = b₂ := symbolCode_injective M blank hw + subst b₂ + obtain ⟨hq, ha, _⟩ := hs₁.predecessor_unique hs₂ + have hread : R₁ % alphabetBase M blank = R₂ % alphabetBase M blank := by + rw [← hr₁, ← hr₂, ha] + exact ⟨hq, hL, Lattice.nat_eq_of_mod_div_eq hread hR⟩ + +theorem IntegerStep.target_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) + {q q' : Control (State M) (Alphabet M)} {L R L' R' d : ℕ} + (hs : IntegerStep M hM blank q L R q' L' R') (hd : 0 < d) + (hL : L < (alphabetBase M blank) ^ d) (hR : R < (alphabetBase M blank) ^ d) : + L' < (alphabetBase M blank) ^ (d + 1) ∧ + R' < (alphabetBase M blank) ^ (d + 1) := by + obtain ⟨a, b, m, _, _, rfl, rfl⟩ := hs + exact Lattice.next_stacks_lt (alphabetBase_two_le M blank) hd hL hR + (symbolCode_lt_base M blank b) (moveCode m) + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRetainedObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRetainedObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9a4a5bb3a103744ae78638f79abcae137ecc94f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRetainedObservation.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteRetention +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteBudget + +namespace OAI + +/-! The concrete half-plane observation follows from the proved retained +mass bound and the terminal flag of the actual recorder configuration. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory +open scoped BigOperators + +def accumulatedLoss (ν C σ D K : ℝ) (n : ℕ) : ℝ := + ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * 2 + + ∑ i ∈ Finset.range n, ν * ((radius σ D K i)⁻¹ ^ 2 * C) * duration σ D K i + +theorem accumulatedLoss_lt {ν C σ D K : ℝ} + (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (hc : ν * C ≤ σ * 3000) (n : ℕ) : + accumulatedLoss ν C σ D K n < 1 / 24 := + finite_diffusion_loss_lt hσ hD hK hc n + +theorem configurationCenter_terminal (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) (σ D K : ℝ) (n : ℕ) + (U : Configuration (State M) (Alphabet M)) + (hU : haltingControl (finiteMachine M hM) U.control = true) : + configurationCenter M hM blank m σ D K n U 1 = 16 * radius σ D K n := by + simp only [configurationCenter, hU, ↓reduceIte, Matrix.cons_val_one, Matrix.cons_val_zero] + +theorem configurationCenter_nonterminal (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) (σ D K : ℝ) (n : ℕ) + (U : Configuration (State M) (Alphabet M)) + (hU : haltingControl (finiteMachine M hM) U.control = false) : + configurationCenter M hM blank m σ D K n U 1 = -(16 * radius σ D K n) := by + simp only [configurationCenter, hU, Bool.false_eq_true, ↓reduceIte, + Matrix.cons_val_one, Matrix.cons_val_zero] + +theorem retained_terminal_observation (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν C σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (hc : ν * C ≤ σ * 3000) (n : ℕ) + (U : Configuration (State M) (Alphabet M)) + (hU : haltingControl (finiteMachine M hM) U.control = true) + {ρ : Plane → ℝ} (hi : Integrable ρ) (hn : ∀ x, 0 ≤ ρ x) (hmass : (∫ x, ρ x) = 1) + (hr : 1 - accumulatedLoss ν C σ D K n ≤ + ∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter M hM blank m σ D K n U) x * ρ x) : + 1 / 2 < ∫ x in upperHalfPlane, ρ x := by + have hR := radius_pos hσ hD hK n + apply concentration_terminal_observer hi hn hR + (δ := accumulatedLoss ν C σ D K n) + (c := configurationCenter M hM blank m σ D K n U) + · rw [configurationCenter_terminal M hM blank m σ D K n U hU] + linarith + · exact hmass + · linarith [accumulatedLoss_lt hσ hD hK hc n] + · simpa only [hmass] using hr + + +theorem accumulatedLoss_partial_le {ν C σ D K b : ℝ} + (hν : 0 ≤ ν) (hC : 0 ≤ C) (n : ℕ) + (hb : b ≤ stageStart σ D K (n + 1)) : + accumulatedLoss ν C σ D K n + + ν * ((radius σ D K n)⁻¹ ^ 2 * C) * (b - stageStart σ D K n) ≤ + accumulatedLoss ν C σ D K (n + 1) := by + have hc : 0 ≤ ν * ((radius σ D K n)⁻¹ ^ 2 * C) := by positivity + have ht : b - stageStart σ D K n ≤ duration σ D K n := by + rw [stageStart_succ] at hb + linarith + have he := mul_le_mul_of_nonneg_left ht hc + simp only [accumulatedLoss, Finset.sum_range_succ] + linarith + +theorem initialLoss_partial_le {ν C σ D K b : ℝ} + (hν : 0 ≤ ν) (hC : 0 ≤ C) (hb : b ≤ 2) : + ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * b ≤ accumulatedLoss ν C σ D K 0 := by + have hc : 0 ≤ ν * ((radius σ D K 0)⁻¹ ^ 2 * C) := by positivity + simpa only [accumulatedLoss, Finset.range_zero, Finset.sum_empty, add_zero] using + mul_le_mul_of_nonneg_left hb hc + + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRunPrefixes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRunPrefixes.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d86042af05c9f01dbc21859be8291852a5487ec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingRunPrefixes.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRecorderSupport + +namespace OAI + +/-! A nonhalting input has recorder prefixes of every finite length. +This uses the proved simulation, including its positive macro-step lengths. -/ + +namespace ForcedComputation.ExpandingDetector +open Recorder + +theorem recorderSteps_prefix {Q A : Type*} {M : Recorder.Machine Q A} + {m n : ℕ} {U V : Configuration Q A} (h : Steps M m U V) (hn : n ≤ m) : + ∃ W, Steps M n U W := by + induction h generalizing n with + | zero => + have : n = 0 := by omega + subst n + exact ⟨_, Steps.zero _⟩ + | @next m U V W h hs ih => + by_cases hnm : n ≤ m + · exact ih hnm + · have : n = m + 1 := by omega + subst n + exact ⟨_, Steps.next h hs⟩ + +theorem recorder_nonhalting_control (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (hnot : ¬ Alternating.Halts I) + {n : ℕ} {U : Configuration (State I.1) (Alphabet I.1)} + (hU : Steps (finiteMachine I.1 hI.1) n (finiteInitializedRecorder I hI) U) : + haltingControl (finiteMachine I.1 hI.1) U.control = false := by + cases hq : U.control with + | checkpoint q => + change I.1.isHalting q.val = false + cases hh : I.1.isHalting q.val with + | false => rfl + | true => + exact False.elim (hnot ((finite_recorder_halts_iff I hI).mp ⟨n, U, q, hU, hq, hh⟩)) + | mark r => rfl + | scanRight r => rfl + | advance q => rfl + | scanLeft q => rfl + +theorem nonhalting_recorder_prefix (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (hnot : ¬ Alternating.Halts I) (n : ℕ) : + ∃ U, Steps (finiteMachine I.1 hI.1) n (finiteInitializedRecorder I hI) U ∧ + haltingControl (finiteMachine I.1 hI.1) U.control = false := by + have hn (i : ℕ) : (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) i).state = false := by + have hs := congrArg WorkConfiguration.state (finite_workAt I hI i) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) i).state.val = (Alternating.configurationAt I i).state at hs + change I.1.isHalting _ = false + rw [hs] + cases hh : I.1.isHalting (Alternating.configurationAt I i).state with + | false => rfl + | true => exact False.elim (hnot ⟨i, hh⟩) + obtain ⟨m, hnm, hm⟩ := simulate_prefix_length (finiteMachine I.1 hI.1) + (initialState I.1) (initialAlphabet I hI) 2 (by norm_num) n (fun i _ => hn i) + obtain ⟨U, hU⟩ := recorderSteps_prefix hm hnm + exact ⟨U, hU, recorder_nonhalting_control I hI hnot hU⟩ + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalar.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d56a622d55b87d64de4ff442a34a3f9a9815ae9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalar.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDriftSupport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneImpulseScalar + +namespace OAI + +/-! The prescribed full recorder array satisfies the precise compact +coefficient hypotheses of the published whole-plane scalar input. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory + +theorem expandingDrift_compact_coefficients (M : Alternating.Machine) + (hM : M.WellFormed) (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (p : Plane) : + CompactPlaneCoefficients (expandingDrift M hM blank m ν D K) (unitImpulse p) := by + intro T _ + obtain ⟨L, hL, hz⟩ := expandingDrift_compact_on_finite_intervals M hM blank m hν hD hK T + refine ⟨L ∪ tsupport (spatialImpulse p), hL.union (spatialImpulse_compactSupport p).isCompact, ?_⟩ + intro t ht x hx + have hxl : x ∉ L := fun h => hx (Or.inl h) + have hxp : x ∉ tsupport (spatialImpulse p) := fun h => hx (Or.inr h) + refine ⟨hz t ht x hxl, ?_⟩ + change smoothPulse 0 1 t * spatialImpulse p x = 0 + rw [image_eq_zero_of_notMem_tsupport hxp, mul_zero] + +theorem expanding_scalar_exists (hE : PlaneScalarExistence) + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (p : Plane) : + ∃ w : ℝ → Plane → ℝ, + GlobalPlaneScalarSolution ν (expandingDrift M hM blank m ν D K) (unitImpulse p) w ∧ + (∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → Integrable (w t)) ∧ + (∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) := + unitImpulse_scalar_exists hE ν hν _ p + (expandingDrift_smooth M hM blank m hν hD hK) + (expandingDrift_compact_coefficients M hM blank m hν hD hK p) + (expandingDrift_divergence M hM blank m hν hD hK) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarDetector.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarDetector.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4ef0f2ac2892dc972b1063bb526bc519346e7de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarDetector.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingScalarRetention +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRetainedObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingRunPrefixes +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingTimeCover + +namespace OAI + +/-! The scalar half-plane detector, built from the full prescribed array. +This is the observation component of the whole-plane fluid theorem. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory +open scoped BigOperators + +theorem expanding_scalar_detection (hE : PlaneScalarExistence) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {ν C σ D K : ℝ} (hν : 0 < ν) (hC : 0 ≤ C) + (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) (hcoef : ν * C ≤ σ * 3000) + (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) : + let m := initialWordLength I + let blank := recorderBlank I.1 + let p := configurationCenter I.1 hI.1 blank m σ D K 0 (finiteInitializedRecorder I hI) + ∃ w : ℝ → Plane → ℝ, + GlobalPlaneScalarSolution ν (expandingDrift I.1 hI.1 blank m σ D K) (unitImpulse p) w ∧ + (∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → Integrable (w t)) ∧ + (∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < ∫ x in upperHalfPlane, w t x) ↔ Alternating.Halts I) := by + dsimp only + let m := initialWordLength I + let blank := recorderBlank I.1 + let U₀ := finiteInitializedRecorder I hI + let p := configurationCenter I.1 hI.1 blank m σ D K 0 U₀ + have hm : 0 < m := lt_of_lt_of_le (by decide : 0 < 3) (le_max_right _ _) + obtain ⟨w, hw, hwn, hwi, hmass, hret⟩ := expanding_scalar_retention hE I.1 hI.1 blank hm U₀ + (initial_centeredBlank I hI) hσ hD hK hν hC hΔ + have hwm (t : ℝ) (ht : 0 ≤ t) : (∫ x, w t x) ≤ 1 := unitImpulse_mass_le_one hmass ht + have ha := expandingDrift_smooth I.1 hI.1 blank m hσ hD hK + have hdiv := expandingDrift_divergence I.1 hI.1 blank m hσ hD hK + refine ⟨w, hw, hwn, hwi, hmass, ?_⟩ + constructor + · rintro ⟨t, ht, hevent⟩ + by_contra hnot + by_cases ht2 : t ≤ 2 + · have hpflag := recorder_nonhalting_control I hI hnot (Steps.zero U₀) + have hpbelow : p 1 ≤ -radius σ D K 0 := by + rw [show p 1 = -(16 * radius σ D K 0) from + configurationCenter_nonterminal I.1 hI.1 blank m σ D K 0 U₀ hpflag] + linarith [radius_pos hσ hD hK 0] + have hcapture := initial_concentration_capture p (hw 2 (by norm_num)) hν.le + (radius_ge_one hσ hD hK 0) hC ha hdiv hΔ + (fun s hs => hwi s hs.1) (fun s hs => hwn s hs.1) (fun s hs => hwm s hs.1) + ht ht2 (fun s hs => funext (fun x => + expandingDrift_initial I.1 hI.1 blank m hσ hD hK (hs.2.le.trans ht2) x)) + have hr : (∫ x, w t x) - ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * t ≤ + ∫ x, concentrationCutoff (radius σ D K 0) p x * w t x := by + rw [hmass t ht] + exact hcapture + have hb := concentration_nonterminal_observer (hwi t ht) (hwn t ht) + (radius_pos hσ hD hK 0) hpbelow hr + have hsmall := (initialLoss_partial_le hν.le hC ht2).trans_lt + (accumulatedLoss_lt hσ hD hK hcoef 0) + linarith + · obtain ⟨n, hnt, htn⟩ := exists_stage_at_time hσ hD hK (le_of_lt (lt_of_not_ge ht2)) + obtain ⟨V, hrun, hV⟩ := nonhalting_recorder_prefix I hI hnot (n + 1) + cases hrun with + | @next n U₀ U V hprefix hstep => + let W : StageWire I.1 hI.1 blank (m + n) := + ⟨(configurationAddress I.1 blank (m + n) U, + configurationAddress I.1 blank (m + n + 1) V), + configurationAddress_step I.1 hI.1 blank (by omega) + (initialized_steps_centeredBlank I hI hprefix) hstep⟩ + let c := wireCurve I.1 hI.1 blank (m + n) (stageStart σ D K n) (duration σ D K n) + (radius σ D K n) (radius σ D K (n + 1)) W + have hs := recorder_stage_partial_retention I.1 hI.1 blank hm hσ hD hK hν.le hC p + hw hwi hwn hwm hΔ (initialized_steps_centeredBlank I hI hprefix) hstep hnt htn.le + have hr0 := hret n U hprefix + have hbudget := accumulatedLoss_partial_le hν.le hC n htn.le + have hmass1 := unitImpulse_mass_after hmass (by linarith : 1 ≤ t) + have hr : (∫ x, w t x) - accumulatedLoss ν C σ D K (n + 1) ≤ + ∫ x, concentrationCutoff (radius σ D K n) (c t) x * w t x := by + change _ ≤ ∫ x, concentrationCutoff (radius σ D K n) (c t) x * w t x at hs + rw [hmass1] + dsimp only [accumulatedLoss] at hbudget ⊢ + linarith + have hcbelow : c t 1 ≤ -radius σ D K n := by + have hT : 0 < duration σ D K n := + lt_of_lt_of_le (by norm_num : (0 : ℝ) < 2) (duration_ge_two hσ hD hK n) + have hR := radius_pos hσ hD hK n + have hRR := radius_grows hσ hD hK n + have hcn : c t 1 ≤ -(16 * radius σ D K n) := by + change scheduledCenter _ _ _ _ _ _ (haltingControl (finiteMachine I.1 hI.1) V.control) t 1 ≤ _ + rw [hV] + exact scheduledCenter_nonterminal _ hT (by positivity) (by linarith) _ _ t + linarith + have hb := concentration_nonterminal_observer (hwi t ht) (hwn t ht) + (radius_pos hσ hD hK n) hcbelow hr + linarith [accumulatedLoss_lt hσ hD hK hcoef (n + 1)] + · intro hhalt + obtain ⟨n, U, q, hrun, hq, hh⟩ := (finite_recorder_halts_iff I hI).mpr hhalt + have ht2 : 2 ≤ stageStart σ D K n := by + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith [stageStart_ge hσ hD hK n] + have ht := le_trans (by norm_num : (0 : ℝ) ≤ 2) ht2 + have hflag : haltingControl (finiteMachine I.1 hI.1) U.control = true := by + rw [hq] + exact hh + have hr : 1 - accumulatedLoss ν C σ D K n ≤ + ∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter I.1 hI.1 blank m σ D K n U) x * w (stageStart σ D K n) x := by + have hh := hret n U hrun + dsimp only [accumulatedLoss] + linarith + exact ⟨stageStart σ D K n, ht, + retained_terminal_observation I.1 hI.1 blank m hσ hD hK hcoef n U hflag + (hwi _ ht) (hwn _ ht) (unitImpulse_mass_after hmass (by linarith)) hr⟩ + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarRetention.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarRetention.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b6995e29be4f0c6e27183ce56f22ea6d71fa75e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingScalarRetention.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingScalar +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingInitialCapture +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingFiniteRetention + +namespace OAI + +/-! Conditional scalar construction with a quantitative bound along +every actual recorder prefix. The sole analytic assumption is the stated +published scalar existence input. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set MeasureTheory +open scoped BigOperators + +theorem expanding_scalar_retention (hE : PlaneScalarExistence) + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) {m : ℕ} (hm : 0 < m) + (U₀ : Configuration (State M) (Alphabet M)) (h₀ : CenteredBlank blank m U₀) + {σ D K ν C : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (hν : 0 < ν) (hC : 0 ≤ C) (hΔ : ∀ x, |scalarLaplacian massCutoff x| ≤ C) : + ∃ w : ℝ → Plane → ℝ, + GlobalPlaneScalarSolution ν (expandingDrift M hM blank m σ D K) + (unitImpulse (configurationCenter M hM blank m σ D K 0 U₀)) w ∧ + (∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → Integrable (w t)) ∧ + (∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) ∧ + ∀ n U, Steps (finiteMachine M hM) n U₀ U → + 1 - ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * 2 - + (∑ i ∈ Finset.range n, ν * ((radius σ D K i)⁻¹ ^ 2 * C) * duration σ D K i) ≤ + ∫ x, concentrationCutoff (radius σ D K n) + (configurationCenter M hM blank m σ D K n U) x * w (stageStart σ D K n) x := by + let p := configurationCenter M hM blank m σ D K 0 U₀ + obtain ⟨w, hw, hwn, hwi, hmass⟩ := unitImpulse_scalar_exists hE ν hν + (expandingDrift M hM blank m σ D K) p + (expandingDrift_smooth M hM blank m hσ hD hK) + (expandingDrift_compact_coefficients M hM blank m hσ hD hK p) + (expandingDrift_divergence M hM blank m hσ hD hK) + have hwm (t : ℝ) (ht : 0 ≤ t) : (∫ x, w t x) ≤ 1 := + unitImpulse_mass_le_one hmass ht + have hc := initial_concentration_capture p (hw 2 (by norm_num)) hν.le + (radius_ge_one hσ hD hK 0) hC + (expandingDrift_smooth M hM blank m hσ hD hK) + (expandingDrift_divergence M hM blank m hσ hD hK) hΔ + (fun t ht => hwi t ht.1) (fun t ht => hwn t ht.1) (fun t ht => hwm t ht.1) + (by norm_num : (0 : ℝ) ≤ 2) le_rfl + (fun t ht => funext (fun x => expandingDrift_initial M hM blank m hσ hD hK ht.2.le x)) + have hq : 1 - ν * ((radius σ D K 0)⁻¹ ^ 2 * C) * 2 ≤ + ∫ x, concentrationCutoff (radius σ D K 0) p x * w 2 x := by + simpa only [smoothRamp_after (by norm_num : (0 : ℝ) < 1) (by norm_num : (1 : ℝ) ≤ 2)] using hc + refine ⟨w, hw, hwn, hwi, hmass, ?_⟩ + intro n U hrun + exact recorder_steps_mass_retention M hM blank hm hσ hD hK hν.le hC p + hw hwi hwn hwm hΔ h₀ hq hrun + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSeriesBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSeriesBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..f763d3fb35fc6ec57b2517205ddfe2a83eb6c0c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSeriesBounds.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDrift + +namespace OAI + +/-! Summing the geometric derivative budget of the prescribed stages. +Local finiteness lets the estimate apply to every derivative of the actual +infinite-time field. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder VelocityDetector Set Filter +open scoped ContDiff BigOperators Topology + +theorem half_geometric_sum_le_two (N : ℕ) : + (∑ n ∈ Finset.range N, (1 / 2 : ℝ) ^ n) ≤ 2 := by + have he : (∑ n ∈ Finset.range N, (1 / 2 : ℝ) ^ n) = 2 * (1 - (1 / 2 : ℝ) ^ N) := by + induction N with + | zero => simp + | succ N ih => rw [Finset.sum_range_succ, ih, pow_succ]; ring + rw [he] + linarith [pow_nonneg (by norm_num : (0 : ℝ) ≤ 1 / 2) N] + +theorem expandingDrift_jet_bound + (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ D K : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) (hK : 0 ≤ K) + (k : ℕ) {B : ℝ} (hB : 0 ≤ B) + (hb : ∀ n y, ‖iteratedFDeriv ℝ k + (Function.uncurry (stageDrift M hM blank m σ D K n)) y‖ ≤ B * (1 / 2 : ℝ) ^ n) + (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ k (Function.uncurry (expandingDrift M hM blank m σ D K)) y‖ ≤ 2 * B := by + let F := fun n => Function.uncurry (stageDrift M hM blank m σ D K n) + have hbefore (n : ℕ) (z : ℝ × Plane) (hz : z.1 < 2 * ((n : ℝ) + 1)) : F n z = 0 := + stageDrift_zero_before M hM blank m hσ hD hK n + (hz.le.trans (stageStart_ge hσ hD hK n)) z.2 + obtain ⟨N, hN⟩ := detectorBlockSum_local F hbefore y + change ‖iteratedFDeriv ℝ k (detectorBlockSum F) y‖ ≤ 2 * B + rw [(hN.iteratedFDeriv ℝ k).self_of_nhds, + iteratedFDeriv_fun_sum_apply (fun n _ => + ((stageDrift_smooth M hM blank m σ D K n).of_le (by simp)).contDiffAt)] + calc + _ ≤ ∑ n ∈ Finset.range N, ‖iteratedFDeriv ℝ k (F n) y‖ := norm_sum_le _ _ + _ ≤ ∑ n ∈ Finset.range N, B * (1 / 2 : ℝ) ^ n := + Finset.sum_le_sum (fun n _ => hb n y) + _ = B * ∑ n ∈ Finset.range N, (1 / 2 : ℝ) ^ n := by rw [Finset.mul_sum] + _ ≤ B * 2 := mul_le_mul_of_nonneg_left (half_geometric_sum_le_two N) hB + _ = _ := mul_comm _ _ + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSourceExpression.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSourceExpression.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f78ded1f972b57f05f182db39aa63d123bbeef8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingSourceExpression.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicResidual +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneUnitImpulse +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds + +namespace OAI + +/-! A finite expression for the normalized compact source. Its integral +is already proved to be one; evaluation uses only the explicit pulse. -/ + +namespace ForcedComputation.ExpandingDetector +open ShearFlows + +def pulseCode (e : NonperiodicExpr) : NonperiodicExpr := + NonperiodicExpr.composeProfile (ProfileExpr.ramp 0 1).diff e + +theorem pulseCode_val (e : NonperiodicExpr) (y : SpaceTime) : + (pulseCode e).val y = smoothPulse 0 1 (e.val y) := by + rw [pulseCode, NonperiodicExpr.val_composeProfile, ProfileExpr.val_diff, + ProfileExpr.val_ramp] + simp only [Rat.cast_zero, Rat.cast_one, smoothPulse] + +def impulseAxisCode (c : ℚ) (j : Fin 2) : NonperiodicExpr := + pulseCode (.add (.sub (.coord j.castSucc.succ) (.const c)) (.const (1 / 2))) + +theorem impulseAxisCode_val (c : ℚ) (j : Fin 2) (y : SpaceTime) : + (impulseAxisCode c j).val y = impulseProfile c (horizontalLinear y.2 j) := by + have hc : timeSpaceCoord j.castSucc.succ y = horizontalLinear y.2 j := by + simp only [timeSpaceCoord, Fin.cases_succ] + rfl + rw [impulseAxisCode, pulseCode_val] + change smoothPulse 0 1 (_ + _) = _ + simp only [NonperiodicExpr.val, NonperiodicExpr.sub, impulseProfile, + Rat.cast_neg, Rat.cast_one, Rat.cast_div, Rat.cast_ofNat, hc] + congr 1 + ring + +def unitImpulseCode (p : Fin 2 → ℚ) : NonperiodicExpr := + .mul (pulseCode (.coord 0)) (.mul (impulseAxisCode (p 0) 0) (impulseAxisCode (p 1) 1)) + +theorem unitImpulseCode_val (p : Fin 2 → ℚ) (y : SpaceTime) : + (unitImpulseCode p).val y = unitImpulse (fun j => (p j : ℝ)) y.1 (horizontalLinear y.2) := by + simp only [unitImpulseCode, NonperiodicExpr.val, pulseCode_val, impulseAxisCode_val, + unitImpulse, spatialImpulse, Fin.prod_univ_two] + rfl + +def verticalSourceCode (p : Fin 2 → ℚ) : NonperiodicVector := + fun j => if j = 2 then unitImpulseCode p else .const 0 + +theorem verticalSourceCode_val (p : Fin 2 → ℚ) (y : SpaceTime) : + (verticalSourceCode p).val y = + unitImpulse (fun j => (p j : ℝ)) y.1 (horizontalLinear y.2) • basis 2 := by + funext j + fin_cases j <;> simp [NonperiodicVector.val, verticalSourceCode, NonperiodicExpr.val, + unitImpulseCode_val, + ShearFlows.basis] + +end ForcedComputation.ExpandingDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingStageTimes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingStageTimes.lean new file mode 100644 index 0000000000000000000000000000000000000000..931f2f1851a1bf1e98f369156a59217fa6f68c36 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingStageTimes.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDetectorScales +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBlockSum + +namespace OAI + +/-! Explicit stage times tend to infinity, so the expanding-array bursts +form a locally finite smooth sum. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set +open scoped BigOperators ContDiff + +theorem initialRadius_ge_one {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : + 1 ≤ initialRadius ν D K := by + have he : 1 ≤ expansion D := by linarith [expansion_ge_four hD] + have hk : 1 ≤ K * D + 2 := by + nlinarith [mul_nonneg hK (show 0 ≤ D by linarith)] + have ha : 1 ≤ 1024 * 3000 * (1 + ν) := by linarith + have h₁ : 1 ≤ (1024 * 3000 * (1 + ν)) * expansion D := by + nlinarith [mul_nonneg (sub_nonneg.mpr ha) (sub_nonneg.mpr he)] + unfold initialRadius + nlinarith [mul_nonneg (sub_nonneg.mpr h₁) (sub_nonneg.mpr hk)] + +theorem radius_ge_one {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + 1 ≤ radius ν D K n := by + induction n with + | zero => simpa only [radius, pow_zero, mul_one] using initialRadius_ge_one hν hD hK + | succ n ih => + have hg := radius_grows hν hD hK n + linarith + +theorem duration_ge_two {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + 2 ≤ duration ν D K n := by + have hr := radius_ge_one hν hD hK (n + 1) + have hc : 2 ≤ K * D ^ (n + 1) + 2 := by + have hn := mul_nonneg hK (pow_nonneg (show 0 ≤ D by linarith) (n + 1)) + linarith + unfold duration + nlinarith [mul_nonneg (sub_nonneg.mpr hr) (show 0 ≤ K * D ^ (n + 1) + 2 by linarith)] + +def stageStart (ν D K : ℝ) (n : ℕ) : ℝ := 2 + ∑ i ∈ Finset.range n, duration ν D K i + +@[simp] theorem stageStart_zero (ν D K : ℝ) : stageStart ν D K 0 = 2 := by + simp [stageStart] + +theorem stageStart_succ (ν D K : ℝ) (n : ℕ) : + stageStart ν D K (n + 1) = stageStart ν D K n + duration ν D K n := by + simp only [stageStart, Finset.sum_range_succ] + ring + +theorem stageStart_ge {ν D K : ℝ} (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) (n : ℕ) : + 2 * ((n : ℝ) + 1) ≤ stageStart ν D K n := by + induction n with + | zero => norm_num + | succ n ih => + rw [stageStart_succ] + have ht := duration_ge_two hν hD hK n + push_cast + linarith + +theorem stageStart_strictMono {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) : StrictMono (stageStart ν D K) := by + apply strictMono_nat_of_lt_succ + intro n + rw [stageStart_succ] + linarith [duration_ge_two hν hD hK n] + +theorem expanding_burst_sum_smooth {ν D K : ℝ} + (hν : 0 < ν) (hD : 1 ≤ D) (hK : 0 ≤ K) + (F : ℕ → ℝ × Plane → ℝ) (hF : ∀ n, ContDiff ℝ ∞ (F n)) + (hbefore : ∀ n y, y.1 < stageStart ν D K n → F n y = 0) : + ContDiff ℝ ∞ (VelocityDetector.detectorBlockSum F) := by + apply VelocityDetector.detectorBlockSum_smooth F hF + intro n y hy + exact hbefore n y (hy.trans_le (stageStart_ge hν hD hK n)) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeCover.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cf6fd8af7df3fbe5215f0776024b4038b73e440 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeCover.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingStageTimes + +namespace OAI + +/-! The finite stages cover every time after the initial pulse. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector + +theorem exists_stage_at_time {σ D K t : ℝ} (hσ : 0 < σ) (hD : 1 ≤ D) + (hK : 0 ≤ K) (ht : 2 ≤ t) : + ∃ n : ℕ, stageStart σ D K n ≤ t ∧ t < stageStart σ D K (n + 1) := by + have hex : ∃ n : ℕ, t < stageStart σ D K (n + 1) := by + obtain ⟨n, hn⟩ := exists_nat_gt t + refine ⟨n, ?_⟩ + have hs := stageStart_ge hσ hD hK (n + 1) + push_cast at hs + have hz : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + let n := Nat.find hex + refine ⟨n, ?_, Nat.find_spec hex⟩ + cases hn : n with + | zero => simpa only [hn, stageStart_zero] using ht + | succ k => + have hk : ¬ t < stageStart σ D K (k + 1) := + Nat.find_min hex (by omega : k < Nat.find hex) + simpa only [hn, Nat.succ_eq_add_one] using le_of_not_gt hk + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeJetBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeJetBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d480cb5e9e3063f4b8b36051000e8993185ef1ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingTimeJetBounds.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCenterBounds + +namespace OAI + +/-! Translating the one-dimensional clock estimates to joint derivatives +in time and space does not lose a norm factor. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows +open scoped ContDiff BigOperators + +theorem time_comp_jet_bound {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + {f : ℝ → F} (hf : ContDiff ℝ ∞ f) (n : ℕ) (y : ℝ × Plane) : + ‖iteratedFDeriv ℝ n (fun p : ℝ × Plane => f p.1) y‖ ≤ + ‖iteratedDeriv n f y.1‖ := by + let L := ContinuousLinearMap.fst ℝ ℝ Plane + change ‖iteratedFDeriv ℝ n (f ∘ L) y‖ ≤ _ + rw [L.iteratedFDeriv_comp_right hf y (by simp)] + apply (ContinuousMultilinearMap.norm_compContinuousLinearMap_le _ _).trans + rw [norm_iteratedFDeriv_eq_norm_iteratedDeriv] + have hp : (∏ _i : Fin n, ‖L‖) ≤ 1 := by + simpa only [Finset.prod_const, Finset.card_univ, Fintype.card_fin] using + (pow_le_one₀ (norm_nonneg L) + (show ‖L‖ ≤ 1 from ContinuousLinearMap.norm_fst_le ℝ ℝ Plane) : ‖L‖ ^ n ≤ 1) + change ‖iteratedDeriv n f y.1‖ * (∏ _i : Fin n, ‖L‖) ≤ ‖iteratedDeriv n f y.1‖ + simpa only [mul_one] using mul_le_mul_of_nonneg_left hp (norm_nonneg (iteratedDeriv n f y.1)) + +theorem iteratedDeriv_component {f : ℝ → Plane} (hf : ContDiff ℝ ∞ f) + (n : ℕ) (j : Fin 2) (t : ℝ) : + iteratedDeriv n (fun s => f s j) t = iteratedDeriv n f t j := by + let L : Plane →L[ℝ] ℝ := ContinuousLinearMap.proj j + change iteratedDeriv n (L ∘ f) t = L (iteratedDeriv n f t) + unfold iteratedDeriv + rw [L.iteratedFDeriv_comp_left hf.contDiffAt (by simp)] + rfl + +theorem iteratedDeriv_plane_bound {f : ℝ → Plane} (hf : ContDiff ℝ ∞ f) + (n : ℕ) (t : ℝ) {B : ℝ} (hB : 0 ≤ B) + (hb : ∀ j : Fin 2, |iteratedDeriv n (fun s => f s j) t| ≤ B) : + ‖iteratedDeriv n f t‖ ≤ B := by + apply (pi_norm_le_iff_of_nonneg hB).mpr + intro j + simpa only [iteratedDeriv_component hf, Real.norm_eq_abs] using hb j + +theorem clock_inverse_power_bound {T : ℝ} (hT : 1 ≤ T) {n m : ℕ} + (hn : 1 ≤ n) (hnm : n ≤ m) : |(T/6)⁻¹| ^ n ≤ 6 ^ m / T := by + have hTp : 0 < T := lt_of_lt_of_le zero_lt_one hT + have hpowT : T ≤ T ^ n := by + obtain ⟨q, rfl⟩ := Nat.exists_eq_add_of_le hn + rw [pow_add, pow_one] + exact le_mul_of_one_le_right hTp.le (one_le_pow₀ hT) + have hpow6 : (6 : ℝ) ^ n ≤ 6 ^ m := pow_le_pow_right₀ (by norm_num) hnm + rw [abs_of_pos (inv_pos.mpr (by positivity)), inv_div, div_pow] + apply div_le_div₀ (by positivity) hpow6 hTp hpowT + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWireRates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWireRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..275cfd8f1c78fef0df079eecbd9a858c339816d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWireRates.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingAmplitude +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCenterVelocity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingStageTimes + +namespace OAI + +/-! Actual scheduled wire centers satisfy the geometric amplitude budget. +The spatial radius cancels against the chosen stage duration. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Recorder +open scoped ContDiff + +theorem wire_address_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m n : ℕ) + (w : StageWire M hM blank (m+n)) : + (w.val.1.number : ℝ) ≤ (addressFactor M blank m : ℝ)*(addressGrowth M blank : ℝ)^(n+1) ∧ + (w.val.2.number : ℝ) ≤ (addressFactor M blank m : ℝ)*(addressGrowth M blank : ℝ)^(n+1) := by + constructor + · apply (address_number_growth_real M blank m n w.val.1).trans + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) + rw [pow_succ] + exact le_mul_of_one_le_right (by positivity) (by exact_mod_cast addressGrowth_ge_one M blank) + · simpa only [Nat.add_assoc] using address_number_growth_real M blank m (n+1) w.val.2 + +theorem wireCurve_positive_jet_bound (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ : ℝ} (hσ : 0 < σ) {C : ℝ} (hC0 : 0 ≤ C) (L : ℕ) + (hC : ∀ q ≤ L, ∀ t, |iteratedDeriv q (smoothRamp 0 1) t| ≤ C) + (n : ℕ) (w : StageWire M hM blank (m+n)) (q : ℕ) (hq : 1 ≤ q) (hqL : q ≤ L) + (t : ℝ) : + ‖iteratedDeriv q + (wireCurve M hM blank (m+n) + (stageStart σ (workGrowth M blank) (workFactor M blank m) n) + (duration σ (workGrowth M blank) (workFactor M blank m) n) + (radius σ (workGrowth M blank) (workFactor M blank m) n) + (radius σ (workGrowth M blank) (workFactor M blank m) (n+1)) w) t‖ ≤ + (4 * (6 : ℝ)^L * C) * stageAmplitude M blank m n := by + let D := workGrowth M blank + let K := workFactor M blank m + let R := radius σ D K n + let R' := radius σ D K (n+1) + let T := duration σ D K n + let B := (addressFactor M blank m : ℝ)*(addressGrowth M blank : ℝ)^(n+1) + have hD : 1 ≤ D := workGrowth_ge_one M blank + have hK : 0 ≤ K := workFactor_nonneg M blank m + have hR := radius_pos hσ hD hK n + have hR' := radius_pos hσ hD hK (n+1) + have hRR := radius_grows hσ hD hK n + have hT : 1 ≤ T := le_trans (by norm_num) (duration_ge_two hσ hD hK n) + have hB : 0 ≤ B := by dsimp [B]; positivity + have hw := wire_address_bounds M hM blank m n w + have hq0 : 0 ≤ (4 * (6 : ℝ)^L * C) * stageAmplitude M blank m n := + mul_nonneg (by positivity) (stageAmplitude_nonneg M blank m n) + apply iteratedDeriv_plane_bound (wireCurve_smooth M hM blank (m+n) _ _ _ _ w) q t hq0 + intro j + have hb := scheduledCenter_coordinate_jet_bound hC0 hC (by positivity : 0 ≤ 16*R) + (by dsimp [R,R'] at *; linarith : 16*R ≤ 16*R') hB hT hq hqL + (stageStart σ D K n) w.val.1.number w.val.2.number hw.1 hw.2 + (haltingControl (finiteMachine M hM) w.val.2.control) j t + change |iteratedDeriv q (fun s => scheduledCenter _ T (16*R) (16*R') _ _ _ s j) t| ≤ _ + apply hb.trans_eq + have hQ : K * D^(n+1)+2 ≠ 0 := by have := (show 0 ≤ K*D^(n+1) by positivity); linarith + change (4 * (16 * R') * (B + 2)) * ((6 : ℝ)^L / T * C) = + (4 * (6 : ℝ)^L * C) * ((B+2) / (K * D^(n+1)+2)) + have hTeq : T = 16 * R' * (K * D^(n+1)+2) := rfl + have hRp : R' ≠ 0 := hR'.ne' + rw [hTeq] + field_simp [hRp, hQ] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWorkBudget.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWorkBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..af6a433ae7fef27820038c6d7f88d1d12781d135 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/ExpandingWorkBudget.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateCount +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingDetectorScales + +namespace OAI + +/-! A computable choice of schedule pays for the product of the number +of gates and the largest address. This is the arithmetic part of the +global derivative bound. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open Recorder + +def workGrowth (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : ℝ := + 2 * (addressGrowth M blank : ℝ) ^ 2 + +def workFactor (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : ℝ := + 9 * ((addressFactor M blank m : ℝ) + 1) ^ 2 + +theorem workGrowth_ge_one (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) : 1 ≤ workGrowth M blank := by + have hA : (1 : ℝ) ≤ addressGrowth M blank := by exact_mod_cast addressGrowth_ge_one M blank + unfold workGrowth + nlinarith + +theorem workFactor_nonneg (M : Alternating.Machine) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) : + 0 ≤ workFactor M blank m := by unfold workFactor; positivity + +theorem geometric_work_bound {F A : ℝ} (hF : 0 ≤ F) (hA : 1 ≤ A) (n : ℕ) : + (F * A ^ n) * (F * A ^ (n + 1) + 2) / + (9 * (F + 1) ^ 2 * (2 * A ^ 2) ^ (n + 1) + 2) ≤ (1 / 2 : ℝ) ^ n := by + let b := (F + 1) * A ^ (n + 1) + have hAp : 0 < A := lt_of_lt_of_le zero_lt_one hA + have hpow : 1 ≤ A ^ (n + 1) := one_le_pow₀ hA + have hb : 1 ≤ b := by dsimp [b]; nlinarith + have hb0 : 0 < b := lt_of_lt_of_le zero_lt_one hb + have hgrow : A ^ n ≤ A ^ (n + 1) := by + rw [pow_succ] + exact le_mul_of_one_le_right (pow_nonneg hAp.le n) hA + have hn : F * A ^ n ≤ b := by + dsimp [b] + exact mul_le_mul (by linarith : F ≤ F + 1) hgrow (pow_nonneg hAp.le n) (by linarith) + have ha : F * A ^ (n + 1) + 2 ≤ 3 * b := by dsimp [b] at *; nlinarith + have hnum : (F * A ^ n) * (F * A ^ (n + 1) + 2) ≤ 3 * b ^ 2 := by + have hh := mul_le_mul hn ha (by positivity : 0 ≤ F * A ^ (n + 1) + 2) hb0.le + nlinarith + have he : 9 * (F + 1) ^ 2 * (2 * A ^ 2) ^ (n + 1) = 9 * b ^ 2 * 2 ^ (n + 1) := by + dsimp [b] + simp only [mul_pow, ← pow_mul] + rw [Nat.mul_comm 2 (n + 1)] + ring + rw [he] + apply (div_le_iff₀ (by positivity : 0 < 9 * b ^ 2 * 2 ^ (n + 1) + 2)).mpr + have hp : (1 / 2 : ℝ) ^ n * 2 ^ (n + 1) = 2 := by + rw [pow_succ, ← mul_assoc, ← mul_pow] + norm_num + have hh : (1 / 2 : ℝ) ^ n * (9 * b ^ 2 * 2 ^ (n + 1)) = 18 * b ^ 2 := by + calc + _ = 9 * b ^ 2 * ((1 / 2 : ℝ) ^ n * 2 ^ (n + 1)) := by ring + _ = _ := by rw [hp]; ring + have hpn : 0 ≤ (1 / 2 : ℝ) ^ n := by positivity + nlinarith [sq_nonneg b] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TorusDetectorMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TorusDetectorMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..846b9c1f07a19c9a47dd7364cd835473134006c3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TorusDetectorMain.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosityObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorViscosityProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorProcessorSupport + +namespace OAI + +/-! The compact-chart velocity detector on the unit three-torus. All +analytic existence inputs are explicit. The force is given by finite +expressions and terminating rational arithmetic, before solving the fluid. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem triangularVelocity_vertical (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) + (y : SpaceTime) : triangularVelocity a w y 2 = w y.1 (horizontal y.2) := by + rw [triangularVelocity, triangularLift_eq] + rfl + +theorem triangularVelocity_fixed_observation (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) : + (∃ t, 0 ≤ t ∧ ∃ x : Space, (1 / 32 : ℝ) < x 1 ∧ x 1 < 1 / 8 ∧ + 1 / 2 < triangularVelocity a w (t, x) 2) ↔ + ∃ t, 0 ≤ t ∧ ∃ x ∈ Recorder.Planar.observer, 1 / 2 < w t x := by + simp only [triangularVelocity_vertical] + constructor + · rintro ⟨t, ht, x, hx₁, hx₂, hv⟩ + exact ⟨t, ht, horizontal x, ⟨hx₁, hx₂⟩, hv⟩ + · rintro ⟨t, ht, x, hx, hv⟩ + refine ⟨t, ht, atHeight x 0, hx.1, hx.2, ?_⟩ + simpa only [atHeight_horizontal] using hv + +attribute [local irreducible] Recorder.Planar.normalizedHamiltonian planarSlice + euclideanFlowBound detectorDrift detectorSource + +theorem torus_velocity_detection (hE : TorusScalarExistence) (hK : TorusHeatInput) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ω y.1 (-y.1) y.2)) : + let H := Recorder.Planar.normalizedHamiltonian I hI + let V := planarSlice H + let C := detectorBumpDerivativeBound + let L := euclideanFlowBound H + let K := PlanarHamiltonian.commonSupport (Recorder.Planar.normalizedPulse I hI) ∪ + injectionSupport + IsCompact K ∧ K ⊆ openUnitPlane ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + ∀ ν : ℝ, 0 < ν → + ContDiff ℝ ∞ (detectorViscosityForce V C L ν) ∧ + SpatiallyPeriodic 1 (detectorViscosityForce V C L ν) ∧ + ContDiff ℝ ∞ (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) ∧ + IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ((∃ t, 0 ≤ t ∧ ∃ x : Space, (1 / 32 : ℝ) < x 1 ∧ x 1 < 1 / 8 ∧ + 1 / 2 < triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) 2) ↔ Alternating.Halts I) ∧ + (∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K → ∀ z, + detectorViscosityForce V C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (detectorViscosityForce V C L ν) α y - + rationalVector (evaluateDetectorViscosityForce H + (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) + (Recorder.Planar.processorVelocity_joint_smooth I hI) + C L α a b ha hb ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (detectorViscosityForce V C L ν) α y‖ ≤ + (detectorViscosityBound H C L α a T : ℝ)) := by + dsimp only + obtain ⟨Ψ, hP⟩ := Recorder.Planar.smooth_planar_processor I hI Ω hΩ hv + obtain ⟨hcompact, hinside, hsupp⟩ := processor_detector_force_support I hI hP + detectorBumpDerivativeBound (euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI)) + refine ⟨hcompact, hinside, ?_⟩ + obtain ⟨w, hw, hn, hm, hνs⟩ := processor_detector_all_viscosities hE hK I hI hP hv hback + refine ⟨w, hw, hn, hm, ?_⟩ + intro ν hν + obtain ⟨hu, huniq, hobs⟩ := hνs ν hν + have hvs := viscosityDrift_smooth + (detectorDrift_smooth hP.torus_smooth detectorBumpDerivativeBound + (euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI))) ν + have hhs := viscositySource_smooth + (detectorSource_smooth detectorBumpDerivativeBound + (euclideanFlowBound (Recorder.Planar.normalizedHamiltonian I hI))) ν + refine ⟨triangularForce_smooth hvs hhs ν, + triangularForce_periodic hvs + (viscosityDrift_periodic (detectorDrift_periodic hP.torus_spatial_periodic _ _) ν) + (viscositySource_periodic (detectorSource_periodic _ _) ν) ν, + triangularVelocity_smooth hvs (viscosityScalar_smooth hw ν), + hu, huniq, (triangularVelocity_fixed_observation _ _).trans hobs, ?_, ?_, ?_⟩ + · intro t x hx hxK z + rw [detectorViscosityForce_eq _ hP.torus_smooth] + change forceViscosityLinear ν (detectorForce _ _ _ (ν * t, atHeight x z)) = 0 + rw [hsupp (ν * t) x hx hxK z, map_zero] + · intro α a b y ha hb ε hε + exact evaluateDetectorViscosityForce_spec hP.expression_valid hP.expression_noTime + hP.torus_smooth _ _ α a b ha hb ε hε + · intro α a ha T y ht hT + exact detectorViscosityBound_spec hν hP.expression_valid hP.expression_noTime + hP.torus_smooth _ _ α ha T ht hT + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..749961a6770a1c0e037d21217c3200b5888a6c14 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularFluid.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarGlobalExistence +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.AutonomousStartup + +namespace OAI + +/-! A prescribed planar drift and scalar source determine the full external +force before the transported scalar is solved. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def triangularVelocity (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) : Velocity := + fun y => triangularLift (a y.1) (w y.1) y.2 + +def planarResidual (ν : ℝ) (a : ℝ → Plane → Plane) (t : ℝ) (x : Plane) : Plane := + deriv (fun s => a s x) t + fderiv ℝ (a t) x (a t x) - + ν • planarVectorLaplacian (a t) x + +def triangularForce (ν : ℝ) (a : ℝ → Plane → Plane) (h : ℝ → Plane → ℝ) : Velocity := + fun y => triangularLift (planarResidual ν a y.1) (h y.1) y.2 + +theorem triangularVelocity_smooth {a : ℝ → Plane → Plane} {w : ℝ → Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) : + ContDiff ℝ ∞ (triangularVelocity a w) := by + have hz : ContDiff ℝ ∞ (fun y : SpaceTime => (y.1, horizontalLinear y.2)) := + contDiff_fst.prodMk (horizontalLinear.contDiff.comp contDiff_snd) + exact (planeInclusion.contDiff.comp (ha.comp hz)).add + ((hw.comp hz).smul contDiff_const) + +theorem triangularVelocity_timeDerivative {a : ℝ → Plane → Plane} + {w : ℝ → Plane → ℝ} (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) (t : ℝ) (x : Space) : + timeDerivative (triangularVelocity a w) t x = + triangularLift (fun z => deriv (fun s => a s z) t) + (fun z => deriv (fun s => w s z) t) x := by + have ha' : HasDerivAt (fun s => a s (horizontalLinear x)) + (deriv (fun s => a s (horizontalLinear x)) t) t := + ((ha.comp (contDiff_id.prodMk contDiff_const)).differentiable + (by simp) t).hasDerivAt + have hw' : HasDerivAt (fun s => w s (horizontalLinear x)) + (deriv (fun s => w s (horizontalLinear x)) t) t := + ((hw.comp (contDiff_id.prodMk contDiff_const)).differentiable + (by simp) t).hasDerivAt + exact ((planeInclusion.hasFDerivAt.comp_hasDerivAt t ha').add + (hw'.smul_const (basis 2))).deriv + +theorem triangularVelocity_periodic {a : ℝ → Plane → Plane} {w : ℝ → Plane → ℝ} + (ha : ∀ t, PlanePeriodic (a t)) (hw : ∀ t, PlanePeriodic (w t)) : + SpatiallyPeriodic 1 (triangularVelocity a w) := by + intro t x n + have he : horizontalLinear (x + latticeVector 1 n) = + horizontalLinear x + fun j => (n j.castSucc : ℝ) := by + ext j + fin_cases j <;> simp [horizontalLinear, latticeVector] + simp only [triangularVelocity, triangularLift, he] + rw [ha t (horizontalLinear x) (fun j => n j.castSucc), + hw t (horizontalLinear x) (fun j => n j.castSucc)] + +theorem GlobalTorusScalarSolution.deriv_eq {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hs : GlobalTorusScalarSolution ν a h w w₀) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) {t : ℝ} (ht : 0 ≤ t) (x : Plane) : + deriv (fun s => w s x) t = scalarGenerator ν (a t) (w t) x + h t x := by + have htI : t ∈ Icc (0 : ℝ) (t + 1) := ⟨ht, by linarith⟩ + have hdiff : DifferentiableAt ℝ (fun s => w s x) t := + (hw.comp (contDiff_id.prodMk (contDiff_const (c := x)))).differentiable (by simp) t + have hu := uniqueDiffOn_Icc (by linarith : (0 : ℝ) < t + 1) t htI + rw [← hdiff.derivWithin hu] + exact ((hs (t + 1) (by linarith)).equation t htI x).derivWithin hu + +theorem triangularVelocity_residual {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hs : GlobalTorusScalarSolution ν a h w w₀) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + residual ν (triangularVelocity a w) (t, x) = triangularForce ν a h (t, x) := by + have has : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hws : ContDiff ℝ ∞ (w t) := hw.comp (contDiff_const.prodMk contDiff_id) + unfold residual + rw [triangularVelocity_timeDerivative ha hw, + show (fun y => triangularVelocity a w (t, y)) = triangularLift (a t) (w t) from rfl, + triangularLift_advection has hws, triangularLift_laplacian has hws] + simp only [triangularLift, triangularForce, planarResidual, + map_add, map_sub, map_smul, smul_add, smul_smul] + rw [hs.deriv_eq hw ht] + unfold scalarGenerator + module + +theorem triangularVelocity_solution {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hs : GlobalTorusScalarSolution ν a h w (fun _ => 0)) + (hpa : ∀ t, PlanePeriodic (a t)) (hpw : ∀ t, PlanePeriodic (w t)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (ha₀ : ∀ x, a 0 x = 0) : + IsClassicalSolution 1 ν (triangularForce ν a h) (triangularVelocity a w) (fun _ => 0) := by + have hU := triangularVelocity_smooth ha hw + have hsol := residual_solves_NS hU (triangularVelocity_periodic hpa hpw) + (fun t x => by + rw [show (fun y => triangularVelocity a w (t, y)) = triangularLift (a t) (w t) from rfl, + triangularLift_divergence (a := a t) (w := w t) (ha.comp (contDiff_const.prodMk contDiff_id)) + (hw.comp (contDiff_const.prodMk contDiff_id)), hdiv]) + (fun x => by + have hw₀ := congrFun (hs 0 le_rfl).initial (horizontalLinear x) + simp [triangularVelocity, triangularLift, ha₀, hw₀]) ν + refine { hsol with equation := ?_ } + intro t ht x + rw [← triangularVelocity_residual ha hw hs ht x] + exact hsol.equation t ht x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularForce.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularForce.lean new file mode 100644 index 0000000000000000000000000000000000000000..791f2ec8c4ed5599f116fafa15f0b3634c7011b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularForce.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBounds + +namespace OAI + +/-! Regularity of the force follows from the explicit planar residual. +No regularity of the unknown transported scalar is needed to prescribe it. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +theorem triangularForce_eq_residual {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (h : ℝ → Plane → ℝ) (ν : ℝ) : + triangularForce ν a h = residual ν (triangularVelocity a (fun _ _ => 0)) + + triangularVelocity (fun _ _ => 0) h := by + funext y + have has : ContDiff ℝ ∞ (a y.1) := ha.comp (contDiff_const.prodMk contDiff_id) + change _ = residual ν (triangularVelocity a (fun _ _ => 0)) (y.1, y.2) + _ + unfold residual + rw [triangularVelocity_timeDerivative ha contDiff_const, + show (fun z => triangularVelocity a (fun _ _ => 0) (y.1, z)) = + triangularLift (a y.1) (fun _ => 0) from rfl, + triangularLift_advection has contDiff_const, triangularLift_laplacian has contDiff_const] + simp only [triangularForce, triangularVelocity, triangularLift, planarResidual, + scalarLaplacian_zero, fderiv_const_apply, zero_apply, deriv_const, + map_add, map_sub, map_smul, map_zero, zero_smul, add_zero, zero_add] + +theorem triangularForce_smooth {a : ℝ → Plane → Plane} {h : ℝ → Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (ν : ℝ) : + ContDiff ℝ ∞ (triangularForce ν a h) := by + rw [triangularForce_eq_residual ha] + exact (residual_smooth (triangularVelocity_smooth ha contDiff_const) ν).add + (triangularVelocity_smooth contDiff_const hh) + +theorem triangularForce_periodic {a : ℝ → Plane → Plane} {h : ℝ → Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hpa : ∀ t, PlanePeriodic (a t)) (hph : ∀ t, PlanePeriodic (h t)) (ν : ℝ) : + SpatiallyPeriodic 1 (triangularForce ν a h) := by + rw [triangularForce_eq_residual ha] + have hr := residual_spatially_periodic (triangularVelocity_smooth ha contDiff_const) + (triangularVelocity_periodic hpa + (show ∀ t, PlanePeriodic (fun _ : Plane => (0 : ℝ)) from fun _ _ _ => rfl)) ν + have hh := triangularVelocity_periodic + (show ∀ t, PlanePeriodic (fun _ : Plane => (0 : Plane)) from fun _ _ _ => rfl) hph + intro t x k + simp only [Pi.add_apply, hr t x k, hh t x k] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularLift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f30388a5a221b341784090258bcc44befbc7c79 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/TriangularLift.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds + +namespace OAI + +/-! Spatial calculus for the triangular velocity U(Y,z) = (a(Y), w(Y)). +This is the scalar-to-Navier–Stokes reduction used by both detectors. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff BigOperators + +def triangularLift (a : Plane → Plane) (w : Plane → ℝ) (x : Space) : Space := + letI := ShearFlows.neZeroThree + planeInclusion (a (horizontalLinear x)) + w (horizontalLinear x) • basis 2 + +theorem horizontalLinear_eq (x : Space) : horizontalLinear x = horizontal x := by + ext j + fin_cases j <;> rfl + +theorem triangularLift_eq (a : Plane → Plane) (w : Plane → ℝ) (x : Space) : + triangularLift a w x = atHeight (a (horizontal x)) (w (horizontal x)) := by + unfold triangularLift + rw [horizontalLinear_eq] + ext j + fin_cases j <;> simp [planeInclusion, atHeight, basis] + +theorem triangularLift_smooth {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) : + ContDiff ℝ ∞ (triangularLift a w) := + (planeInclusion.contDiff.comp (ha.comp horizontalLinear.contDiff)).add + ((hw.comp horizontalLinear.contDiff).smul contDiff_const) + +theorem triangularLift_fderiv {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (x v : Space) : + fderiv ℝ (triangularLift a w) x v = + planeInclusion (fderiv ℝ a (horizontalLinear x) (horizontalLinear v)) + + fderiv ℝ w (horizontalLinear x) (horizontalLinear v) • basis 2 := by + have hA := planeInclusion.hasFDerivAt.comp x + (((ha.differentiable (by simp) (horizontalLinear x)).hasFDerivAt).comp x + horizontalLinear.hasFDerivAt) + have hW := (((hw.differentiable (by simp) (horizontalLinear x)).hasFDerivAt).comp x + horizontalLinear.hasFDerivAt).smul_const (basis 2) + have hd := hA.add hW + change HasFDerivAt (triangularLift a w) _ x at hd + rw [hd.fderiv] + rfl + +theorem horizontalLinear_basis (j : Fin 2) : + horizontalLinear (basis j.castSucc) = PlanarHamiltonian.basis j := by + ext k + fin_cases j <;> fin_cases k <;> + simp [horizontalLinear, basis, PlanarHamiltonian.basis] + +theorem horizontalLinear_basis_two : horizontalLinear (basis 2) = 0 := by + ext k + fin_cases k <;> simp [horizontalLinear, basis] + +theorem triangularLift_derivative {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (j : Fin 2) : + derivative (triangularLift a w) j.castSucc = + triangularLift (fun y => fderiv ℝ a y (PlanarHamiltonian.basis j)) + (PlanarHamiltonian.spatialD j w) := by + funext x + rw [derivative, triangularLift_fderiv ha hw, horizontalLinear_basis] + rfl + +theorem triangularLift_vertical_derivative {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) : + derivative (triangularLift a w) 2 = fun _ => 0 := by + funext x + rw [derivative, triangularLift_fderiv ha hw, horizontalLinear_basis_two] + simp + +theorem triangularLift_divergence {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (x : Space) : + divergence (triangularLift a w) x = PlanarHamiltonian.divergence a (horizontal x) := by + have h₀ := triangularLift_derivative ha hw (0 : Fin 2) + have h₁ := triangularLift_derivative ha hw (1 : Fin 2) + change derivative (triangularLift a w) 0 = _ at h₀ + change derivative (triangularLift a w) 1 = _ at h₁ + rw [divergence, Fin.sum_univ_three, h₀, h₁, triangularLift_vertical_derivative ha hw] + simp only [triangularLift_eq, atHeight, Fin.isValue, Matrix.cons_val_zero, + Matrix.cons_val_one, Pi.zero_apply, add_zero] + unfold PlanarHamiltonian.divergence PlanarHamiltonian.spatialD + rw [Fin.sum_univ_two] + congr 1 <;> rw [fderiv_apply (ha.differentiable (by simp) (horizontal x))] + <;> rfl + +theorem horizontal_triangularLift (a : Plane → Plane) (w : Plane → ℝ) (x : Space) : + horizontalLinear (triangularLift a w x) = a (horizontalLinear x) := by + ext j + fin_cases j <;> simp [triangularLift, horizontalLinear, planeInclusion, basis] + +theorem triangularLift_advection {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (x : Space) : + advection (triangularLift a w) x = + triangularLift (fun y => fderiv ℝ a y (a y)) + (fun y => fderiv ℝ w y (a y)) x := by + rw [advection, triangularLift_fderiv ha hw, horizontal_triangularLift] + rfl + +def planarVectorLaplacian (a : Plane → Plane) (y : Plane) : Plane := + ∑ j : Fin 2, fderiv ℝ (fun z => fderiv ℝ a z (PlanarHamiltonian.basis j)) y + (PlanarHamiltonian.basis j) + +theorem triangularLift_laplacian {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (x : Space) : + laplacian (triangularLift a w) x = + triangularLift (planarVectorLaplacian a) (scalarLaplacian w) x := by + have hd (j : Fin 2) : + fderiv ℝ (derivative (triangularLift a w) j.castSucc) x (basis j.castSucc) = + planeInclusion + (fderiv ℝ (fun z => fderiv ℝ a z (PlanarHamiltonian.basis j)) (horizontalLinear x) + (PlanarHamiltonian.basis j)) + + PlanarHamiltonian.spatialD j (PlanarHamiltonian.spatialD j w) (horizontalLinear x) • basis 2 := by + rw [triangularLift_derivative ha hw, + triangularLift_fderiv + ((ha.fderiv_right (m := ∞) (by simp)).clm_apply contDiff_const) + (PlanarHamiltonian.spatialD_smooth j hw), horizontalLinear_basis] + rfl + have hz : fderiv ℝ (derivative (triangularLift a w) 2) x (basis 2) = 0 := by + rw [triangularLift_vertical_derivative ha hw] + simp + change (∑ j : Fin 3, fderiv ℝ (derivative (triangularLift a w) j) x (basis j)) = _ + have hd₀ := hd (0 : Fin 2) + have hd₁ := hd (1 : Fin 2) + change fderiv ℝ (derivative (triangularLift a w) 0) x (basis 0) = _ at hd₀ + change fderiv ℝ (derivative (triangularLift a w) 1) x (basis 1) = _ at hd₁ + rw [Fin.sum_univ_three, hd₀, hd₁, hz] + simp only [triangularLift, planarVectorLaplacian, scalarLaplacian, + Fin.sum_univ_two, map_add, add_smul] + abel + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionCorollaries.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionCorollaries.lean new file mode 100644 index 0000000000000000000000000000000000000000..759a2da2fed9d44711b34a89a4a65172807da105 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionCorollaries.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MachineDecisionInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TorusDetectorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMain + +namespace OAI + +/-! Decision corollaries for the prescribed forces and their actual classical +solutions. The observation predicates mention neither machines nor halting. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory ExpandingDetector +open scoped ContDiff + +def TorusVelocityEvent (ν : ℝ) (f : Velocity) : Prop := + ∃ u p, IsClassicalSolution 1 ν f u p ∧ + ∃ t, 0 ≤ t ∧ ∃ x : Space, 1 / 32 < x 1 ∧ x 1 < 1 / 8 ∧ 1 / 2 < u (t,x) 2 + +def compiledTorusDetectorForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := + let H := Recorder.Planar.normalizedHamiltonian I hI + detectorViscosityForce (planarSlice H) detectorBumpDerivativeBound (euclideanFlowBound H) ν + +theorem torus_velocity_event_iff (hE : TorusScalarExistence) (hK : TorusHeatInput) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ω y.1 (-y.1) y.2)) + {ν : ℝ} (hν : 0 < ν) : + TorusVelocityEvent ν (compiledTorusDetectorForce ν I hI) ↔ Alternating.Halts I := by + obtain ⟨_, _, w, _, _, _, hall⟩ := torus_velocity_detection hE hK I hI Ω hΩ hv hback + obtain ⟨_, _, _, hsol, huniq, hobs, _, _, _⟩ := hall ν hν + constructor + · rintro ⟨u, p, hu, t, ht, x, hx₁, hx₂, hx⟩ + apply hobs.mp + exact ⟨t, ht, x, hx₁, hx₂, by simpa only [(huniq u p hu t ht x).1] using hx⟩ + · intro hh + exact ⟨_, _, hsol, hobs.mpr hh⟩ + +/-- The compact-chart velocity event is undecidable on the finite source inputs. -/ +theorem torus_velocity_undecidable (hT : FiniteMachineHaltingUndecidable) + (hE : TorusScalarExistence) (hK : TorusHeatInput) + (hv : ∀ I hI Ω, + IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω → + PlanarVariations (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + (hback : ∀ I hI Ω, + IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω → + ContDiff ℝ ∞ (fun y : ℝ × Plane => Ω y.1 (-y.1) y.2)) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + TorusVelocityEvent ν (compiledTorusDetectorForce ν I hI)) := by + apply noCompiledInputDecider_of_halting hT + intro I hI + obtain ⟨Ω, hΩ⟩ := exists_planarTransition + (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) + exact torus_velocity_event_iff hE hK I hI Ω hΩ (hv I hI Ω hΩ) (hback I hI Ω hΩ) hν + +def PlaneVelocityEvent (ν : ℝ) (f : Velocity) : Prop := + ∃ u p, IsCylinderClassicalSolution ν f u p ∧ + ∃ t, 0 ≤ t ∧ 1 / 2 < upperCylinderMass u t + +theorem plane_velocity_event_iff {ν : ℝ} {f : Velocity} {I : Alternating.MachineInput} + (hd : ExpandingDetector.WholePlaneDetection ν f I) : + PlaneVelocityEvent ν f ↔ Alternating.Halts I := by + obtain ⟨u, _, hu, huniq, _, _, _, hobs⟩ := hd + constructor + · rintro ⟨v, p, hv, t, ht, hmass⟩ + apply hobs.mp + refine ⟨t, ht, ?_⟩ + have he (x : Space) : v (t,x) = u (t,x) := (huniq v p hv t ht x).1 + simpa only [upperCylinderMass, he] using hmass + · intro hh + exact ⟨u, _, hu, hobs.mpr hh⟩ + +/-- The whole-plane integral event is undecidable for every positive viscosity. -/ +theorem plane_velocity_undecidable (hT : FiniteMachineHaltingUndecidable) + (hE : PlaneScalarExistence) (hEnergy : CylinderLocalEnergyIdentity) : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + NoCompiledInputDecider (fun I hI => + PlaneVelocityEvent ν (ExpandingDetector.compiledExpandingForce C I hI a ν)) := by + obtain ⟨C, hC, hall⟩ := ExpandingDetector.whole_plane_velocity_detection hE hEnergy + refine ⟨C, hC, ?_⟩ + intro ν hν a ha + apply noCompiledInputDecider_of_halting hT + intro I hI + obtain ⟨_, _, _, _, _, hd⟩ := hall I hI ν hν a ha + exact plane_velocity_event_iff hd + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..528f7647881426036dbd26f84147f82b46c66cb1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDecisionDischarge.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteMachineHaltingDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderEnergyIdentity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariationDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatSolution + +namespace OAI + +/-! The velocity-decision main results with machine undecidability, smooth +flow dependence and localized energy identity discharged. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +theorem torus_velocity_undecidable_parabolic + (hE : TorusScalarExistence) (hK : TorusHeatInput) {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + TorusVelocityEvent ν (compiledTorusDetectorForce ν I hI)) := by + apply torus_velocity_undecidable finiteMachineHaltingUndecidable hE hK + · intro I hI Ω hΩ + exact planarTransition_variations (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) hΩ + · intro I hI Ω hΩ + exact planarTransition_backward_smooth (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) hΩ + · exact hν + +/-- Only the scalar advection-diffusion existence input remains. -/ +theorem torus_velocity_undecidable_scalar + (hE : TorusScalarExistence) {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + TorusVelocityEvent ν (compiledTorusDetectorForce ν I hI)) := + torus_velocity_undecidable_parabolic hE torusHeatInput hν + +theorem plane_velocity_undecidable_scalar (hE : PlaneScalarExistence) : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + NoCompiledInputDecider (fun I hI => + PlaneVelocityEvent ν (ExpandingDetector.compiledExpandingForce C I hI a ν)) := + plane_velocity_undecidable finiteMachineHaltingUndecidable hE cylinder_local_energy_identity + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc0dd3d294b52bde52de89810fc0f59af18aa59f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorBounds.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorScales +import Mathlib.Analysis.Complex.ExponentialBounds + +namespace OAI + +/-! Effective exponential and support-width bounds for each detector burst. -/ + +namespace ForcedComputation.VelocityDetector + +theorem exp_coefficient_le_expansion (L : ℕ) : + Real.exp (L : ℝ) ≤ (expansion L : ℝ) := by + have he : Real.exp (1 : ℝ) ≤ 4 := (Real.exp_one_lt_three.trans (by norm_num)).le + have hp := pow_le_pow_left₀ (Real.exp_pos 1).le he L + simpa only [expansion, Nat.cast_pow, Nat.cast_ofNat, ← Real.exp_nat_mul, mul_one] using hp + +theorem exp_time_le_expansion_pow (L n : ℕ) {s : ℝ} (hs : s ≤ n) : + Real.exp ((L : ℝ) * s) ≤ (expansion L : ℝ) ^ n := by + calc + _ ≤ Real.exp ((L : ℝ) * n) := + Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hs (Nat.cast_nonneg L)) + _ = Real.exp (L : ℝ) ^ n := by rw [mul_comm, Real.exp_nat_mul] + _ ≤ _ := pow_le_pow_left₀ (Real.exp_pos _).le (exp_coefficient_le_expansion L) n + +theorem transported_width (L n : ℕ) : + width L n * (expansion L : ℚ) ^ (n + 1) = + (1 / 1000000) * (1 / 2) ^ (n + 1) := by + have hR : (expansion L : ℚ) ≠ 0 := by + exact_mod_cast (expansion_pos L).ne' + have hb : geometricRatio L * (expansion L : ℚ) = 1 / 2 := by + unfold geometricRatio + field_simp [hR] + calc + _ = (1 / 1000000) * (geometricRatio L * (expansion L : ℚ)) ^ (n + 1) := by + rw [mul_pow] + exact mul_assoc _ _ _ + _ = _ := by rw [hb] + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorScales.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorScales.lean new file mode 100644 index 0000000000000000000000000000000000000000..bce3dd3b16e6acdff981829f50c207e7da81c4ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityDetectorScales.lean @@ -0,0 +1,125 @@ +import Mathlib.Analysis.SpecificLimits.Normed +import Mathlib.Tactic + +namespace OAI + +/-! The rational widths and burst durations in the compact velocity +detector. Index `n` below denotes manuscript block `n + 1`. -/ + +namespace ForcedComputation.VelocityDetector +open scoped BigOperators + +def expansion (L : ℕ) : ℕ := 4 ^ L + +def geometricRatio (L : ℕ) : ℚ := 1 / (2 * (expansion L : ℚ)) + +def width (L n : ℕ) : ℚ := (1 / 1000000) * geometricRatio L ^ (n + 1) + +def laplacianBound (C L n : ℕ) : ℚ := + 2 * C * (width L n)⁻¹ ^ 2 * (1 + (n + 1) * L) * (expansion L : ℚ) ^ (3 * (n + 1)) + +def duration (C L n : ℕ) : ℚ := 1 / (100 * (1 + laplacianBound C L n)) + +def massBound (L : ℕ) : ℚ := + 4 * (1 / 1000000) ^ 2 * geometricRatio L ^ 2 / (1 - geometricRatio L ^ 2) + +theorem expansion_pos (L : ℕ) : 0 < expansion L := pow_pos (by norm_num) L + +theorem expansion_one_le (L : ℕ) : 1 ≤ expansion L := expansion_pos L + +theorem geometricRatio_pos (L : ℕ) : 0 < geometricRatio L := by + unfold geometricRatio + have h : (0 : ℚ) < expansion L := by exact_mod_cast expansion_pos L + positivity + +theorem geometricRatio_le_half (L : ℕ) : geometricRatio L ≤ 1 / 2 := by + have h : (1 : ℚ) ≤ expansion L := by exact_mod_cast expansion_one_le L + unfold geometricRatio + apply (div_le_div_iff₀ (by positivity) (by norm_num)).mpr + linarith + +theorem width_pos (L n : ℕ) : 0 < width L n := + mul_pos (by norm_num) (pow_pos (geometricRatio_pos L) _) + +theorem width_le (L n : ℕ) : width L n ≤ (1 / 1000000) * (1 / 2) ^ (n + 1) := by + unfold width + apply mul_le_mul_of_nonneg_left _ (by norm_num) + exact pow_le_pow_left₀ (geometricRatio_pos L).le (geometricRatio_le_half L) _ + +theorem laplacianBound_nonneg (C L n : ℕ) : 0 ≤ laplacianBound C L n := by + unfold laplacianBound + positivity + +theorem duration_pos (C L n : ℕ) : 0 < duration C L n := by + unfold duration + have h := laplacianBound_nonneg C L n + positivity + +theorem duration_le (C L n : ℕ) : duration C L n ≤ 1 / 100 := by + unfold duration + have h := laplacianBound_nonneg C L n + apply (div_le_div_iff₀ (by positivity) (by norm_num)).mpr + linarith + +theorem diffusion_loss_small (C L n : ℕ) : + 2 * duration C L n * laplacianBound C L n < 1 / 16 := by + have hD := laplacianBound_nonneg C L n + have hd : (0 : ℚ) < 100 * (1 + laplacianBound C L n) := by positivity + unfold duration + rw [show 2 * (1 / (100 * (1 + laplacianBound C L n))) * laplacianBound C L n = + (2 * laplacianBound C L n) / (100 * (1 + laplacianBound C L n)) by ring] + apply (div_lt_iff₀ hd).mpr + linarith + +theorem heat_wait_long (C L n : ℕ) : 1 < 2 - 2 * duration C L n := by + have h := duration_le C L n + linarith + +theorem massBound_small (L : ℕ) : 0 ≤ massBound L ∧ massBound L < 1 / 100000000000 := by + have h₀ := geometricRatio_pos L + have h₁ := geometricRatio_le_half L + have hq : 0 ≤ geometricRatio L ^ 2 ∧ geometricRatio L ^ 2 ≤ 1 / 4 := by + constructor + · positivity + · nlinarith + have hd : 0 < 1 - geometricRatio L ^ 2 := by linarith + constructor + · unfold massBound + positivity + · unfold massBound + apply (div_lt_iff₀ hd).mpr + nlinarith [hq.1, hq.2] + +theorem total_injected_mass (L : ℕ) : + HasSum (fun n : ℕ => (4 : ℝ) * (width L n : ℝ) ^ 2) (massBound L : ℝ) := by + let q : ℝ := (geometricRatio L : ℝ) ^ 2 + have hq : 0 ≤ q ∧ q ≤ 1 / 4 := by + have h₀ : (0 : ℝ) < geometricRatio L := by exact_mod_cast geometricRatio_pos L + have h₁ : (geometricRatio L : ℝ) ≤ 1 / 2 := by + have h := (Rat.cast_le (K := ℝ)).mpr (geometricRatio_le_half L) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at h + exact h + dsimp [q] + constructor + · positivity + · nlinarith + have hs := (hasSum_geometric_of_abs_lt_one (show |q| < 1 by + rw [abs_of_nonneg hq.1] + linarith)).mul_left ((4 : ℝ) * (1 / 1000000) ^ 2 * q) + have he (n : ℕ) : (4 : ℝ) * (width L n : ℝ) ^ 2 = + ((4 : ℝ) * (1 / 1000000) ^ 2 * q) * q ^ n := by + have hp : ((geometricRatio L : ℝ) ^ (n + 1)) ^ 2 = + ((geometricRatio L : ℝ) ^ 2) ^ n * (geometricRatio L : ℝ) ^ 2 := by + rw [← pow_mul, Nat.mul_comm (n + 1) 2, pow_mul, pow_succ] + simp only [width, Rat.cast_mul, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat, + Rat.cast_pow, mul_pow, hp, q] + ring + have hv : ((4 : ℝ) * (1 / 1000000) ^ 2 * q) * (1 - q)⁻¹ = (massBound L : ℝ) := by + dsimp only [massBound, q] + push_cast + ring + simpa only [← he, hv] using hs + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityUnconditional.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityUnconditional.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cd8f5c3ed93ffb391de5e73ebbefe069f49e3fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Detector/VelocityUnconditional.lean @@ -0,0 +1,149 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.TorusVariationsDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDecisionDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.ProcessorFlowSmooth + +namespace OAI + +/-! The velocity-detection main results with the scalar existence inputs discharged. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem torus_velocity_detection_unconditional + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + : + let H := Recorder.Planar.normalizedHamiltonian I hI + let V := planarSlice H + let C := detectorBumpDerivativeBound + let L := euclideanFlowBound H + let K := PlanarHamiltonian.commonSupport (Recorder.Planar.normalizedPulse I hI) ∪ + injectionSupport + IsCompact K ∧ K ⊆ openUnitPlane ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + ∀ ν : ℝ, 0 < ν → + ContDiff ℝ ∞ (detectorViscosityForce V C L ν) ∧ + SpatiallyPeriodic 1 (detectorViscosityForce V C L ν) ∧ + ContDiff ℝ ∞ (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) ∧ + IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ((∃ t, 0 ≤ t ∧ ∃ x : Space, (1 / 32 : ℝ) < x 1 ∧ x 1 < 1 / 8 ∧ + 1 / 2 < triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) 2) ↔ Alternating.Halts I) ∧ + (∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K → ∀ z, + detectorViscosityForce V C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (detectorViscosityForce V C L ν) α y - + rationalVector (evaluateDetectorViscosityForce H + (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) + (Recorder.Planar.processorVelocity_joint_smooth I hI) + C L α a b ha hb ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (detectorViscosityForce V C L ν) α y‖ ≤ + (detectorViscosityBound H C L α a T : ℝ)) := by + exact torus_velocity_detection_scalar torusScalarExistence I hI Ω hΩ + +theorem torus_velocity_undecidable_unconditional {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + TorusVelocityEvent ν (compiledTorusDetectorForce ν I hI)) := + torus_velocity_undecidable_scalar torusScalarExistence hν + +theorem plane_velocity_undecidable_unconditional : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + NoCompiledInputDecider (fun I hI => + PlaneVelocityEvent ν (ExpandingDetector.compiledExpandingForce C I hI a ν)) := + plane_velocity_undecidable_scalar planeScalarExistence + +end ForcedComputation.VelocityDetector + +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set VelocityDetector +open scoped ContDiff + +theorem whole_plane_velocity_detection_unconditional : + ∃ C : ℕ, 1 ≤ C ∧ ∀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ), 0 < ν → ∀ (a : ℕ → ℚ), IsFastRealName a ν → + let f := compiledExpandingForce C I hI a ν + ContDiff ℝ ∞ f ∧ + (∀ α : List (Fin 4), ∃ B : ℝ, 0 ≤ B ∧ ∀ y, ‖mixedDerivative f α y‖ ≤ B) ∧ + (∀ T : ℝ, ∃ K : Set Plane, IsCompact K ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x : Space, horizontalLinear x ∉ K → f (t,x) = 0) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative f α y - + rationalVector (evaluateCompiledExpandingForce C I hI a α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (R : ℚ) (y : SpaceTime), + (∀ j, |timeSpaceCoord j y| ≤ |(R : ℝ)|) → + ‖mixedDerivative f α y‖ ≤ (compiledExpandingForceBound C I hI a α R : ℝ)) ∧ + WholePlaneDetection ν f I := + whole_plane_velocity_detection planeScalarExistence cylinder_local_energy_identity + +end ForcedComputation.ExpandingDetector + +namespace ForcedComputation.VelocityDetector.CompactCenter +open ShearFlows Set +open scoped ContDiff + +theorem compact_detector_unconditional + {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + (Ψ : ℝ → ℝ → Plane → Plane) (hΨ : IsPlanarTransition V Ψ) + (L : ℕ) (hL : 0 < L) + (h₁ : ∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ)) + (h₂ : ∀ s x, ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) + (p : Plane) (b : ℕ → RationalSpaceTime) + (hb : IsFastName b (shiftSpaceTime (centerShift p))) : + let C := detectorBumpDerivativeBound + let K := processorSupport V ∪ injectionNeighborhood p + IsClosed K ∧ p ∈ injectionNeighborhood p ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + (massBound L : ℝ) < 1 / 100000000000 ∧ + ∀ ν : ℝ, 0 < ν → + let u := triangularVelocity (viscosityDrift ν (centeredDrift V p C L)) (viscosityScalar ν w) + ContDiff ℝ ∞ (centeredForce V p C L ν) ∧ SpatiallyPeriodic 1 (centeredForce V p C L ν) ∧ + ContDiff ℝ ∞ u ∧ IsClassicalSolution 1 ν (centeredForce V p C L ν) u (fun _ => 0) ∧ + (∀ u' q, IsClassicalSolution 1 ν (centeredForce V p C L ν) u' q → + ∀ t, 0 ≤ t → ∀ x, u' (t, x) = u (t, x) ∧ q (t, x) = 0) ∧ + (∀ t x z, 0 ≤ u (t, atHeight x z) 2) ∧ + (∀ (E : Set Plane) (_hopen : IsOpen E) (d H : ℝ), DetectorPair d H → + ((∃ k : ℕ, Ψ 0 k p ∈ E) → + ∃ t, 0 ≤ t ∧ ∃ x ∈ E, ∀ z, 1 / 2 < u (t, atHeight x z) 2) ∧ + ((∀ s, 0 ≤ s → ∀ x ∈ E, 2 * d ≤ torusNorm (Ψ 0 s p - x)) → + ∀ t, 0 ≤ t → ∀ x ∈ E, ∀ z, u (t, atHeight x z) 2 < 1 / 2)) ∧ + (∀ t x, x ∉ K → ∀ z, centeredForce V p C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (c : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hc : IsFastName c y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (centeredForce V p C L ν) α y - + rationalVector (evaluateCenteredForce hV.smooth hV.oracle p b hb C L + α a c ha hc ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (centeredForce V p C L ν) α y‖ ≤ + (centeredForceBound hV.smooth hV.oracle p b hb C L α a T : ℝ)) := by + exact compact_detector torusScalarExistence torusHeatInput hV Ψ hΨ + (hV.variations hΨ) (hV.backward_smooth hΨ) L hL h₁ h₂ p b hb + +end ForcedComputation.VelocityDetector.CompactCenter + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..529a524daba77f403fc1bbc3b1d77dfcd90e6e0b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanBounds.lean @@ -0,0 +1,150 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarVariations +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanFlowBounds + +namespace OAI + +/-! The Euclidean estimates also hold for the compact extension. In the +chart its transition is locally the periodic transition, and outside the +common support its transition is locally the identity. -/ + +noncomputable section +namespace ForcedComputation + +open ShearFlows PlanarHamiltonian Set Filter +open scoped Topology ContDiff + +theorem euclideanMap_eventuallyEq {f g : Plane → Plane} {x : EuclideanPlane} + (h : f =ᶠ[𝓝 (planeCoordinates x)] g) : + euclideanMap f =ᶠ[𝓝 x] euclideanMap g := by + have hh := h.comp_tendsto (planeCoordinates.continuous.continuousAt.tendsto) + exact hh.mono (fun y hy => congrArg planeCoordinates.symm hy) + +namespace Recorder.Planar + +theorem compact_euclidean_field_bounds (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) (x : EuclideanPlane) : + ‖fderiv ℝ (euclideanMap (compactVelocity I hI s)) x‖ ≤ + (euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (compactVelocity I hI s))) x‖ ≤ + (euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) := by + by_cases hx : (planeCoordinates x) 0 ∈ Ioo (0 : ℝ) 1 ∧ + (planeCoordinates x) 1 ∈ Ioo (0 : ℝ) 1 + · have he := euclideanMap_eventuallyEq (compactVelocity_germ I hI s hx.1 hx.2) + rw [he.fderiv.self_of_nhds, he.fderiv.fderiv.self_of_nhds] + exact euclidean_field_bounds (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) s x + · have hz := compactVelocity_off_chart I hI s hx + rw [notMem_tsupport_iff_eventuallyEq] at hz + have he : euclideanMap (compactVelocity I hI s) =ᶠ[𝓝 x] + (fun _ : EuclideanPlane => (0 : EuclideanPlane)) := by + filter_upwards [hz.comp_tendsto planeCoordinates.continuous.continuousAt.tendsto] + with y hy + change compactVelocity I hI s (planeCoordinates y) = 0 at hy + change planeCoordinates.symm (compactVelocity I hI s (planeCoordinates y)) = 0 + rw [hy] + exact planeCoordinates.symm.map_zero + rw [he.fderiv.self_of_nhds, he.fderiv.fderiv.self_of_nhds] + constructor + · rw [fderiv_const_apply, ContinuousLinearMap.opNorm_zero] + exact Nat.cast_nonneg _ + · have hf : fderiv ℝ (fun _ : EuclideanPlane => (0 : EuclideanPlane)) = + fun _ => (0 : EuclideanPlane →L[ℝ] EuclideanPlane) := by + funext z + exact fderiv_const_apply _ + rw [hf, fderiv_const_apply, ContinuousLinearMap.opNorm_zero] + exact Nat.cast_nonneg _ + +theorem compactTransition_euclidean_germ (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (a t : ℝ) (x : EuclideanPlane) : + (euclideanMap (Ψ a t) =ᶠ[𝓝 x] euclideanMap (Ω a t)) ∨ + (euclideanMap (Ψ a t) =ᶠ[𝓝 x] id) := by + by_cases hx : planeCoordinates x ∈ commonSupport (normalizedPulse I hI) + · exact Or.inl (euclideanMap_eventuallyEq (compactTransition_germ I hI hΨ hΩ + (commonSupport_in_unit (normalizedPulse_inUnit I hI) hx) a t)) + · right + have hh := euclideanMap_eventuallyEq (compactTransition_germ_id I hI hΨ hx a t) + have hid : euclideanMap (id : Plane → Plane) = id := by + funext y + exact planeCoordinates.symm_apply_apply y + rwa [hid] at hh + +theorem compactTransition_euclidean_smooth (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (normalizedHamiltonian I hI)) Ω) + (a t : ℝ) : ContDiff ℝ ∞ (euclideanMap (Ψ a t)) := by + have hs := (hv.euclidean (fun s => planarSlice_smooth (normalizedHamiltonian_valid I hI) s)).smooth a t + apply contDiff_iff_contDiffAt.mpr + intro x + rcases compactTransition_euclidean_germ I hI hΨ hΩ a t x with h | h + · exact hs.contDiffAt.congr_of_eventuallyEq h + · exact contDiff_id.contDiffAt.congr_of_eventuallyEq h + +theorem compactTransition_euclidean_transfer (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (a t : ℝ) {B₁ B₂ : ℝ} (hB₁ : 1 ≤ B₁) (hB₂ : 0 ≤ B₂) + (hb : ∀ x, ‖fderiv ℝ (euclideanMap (Ω a t)) x‖ ≤ B₁ ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ω a t))) x‖ ≤ B₂) (x : EuclideanPlane) : + ‖fderiv ℝ (euclideanMap (Ψ a t)) x‖ ≤ B₁ ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ψ a t))) x‖ ≤ B₂ := by + rcases compactTransition_euclidean_germ I hI hΨ hΩ a t x with h | h + · rw [h.fderiv.self_of_nhds, h.fderiv.fderiv.self_of_nhds] + exact hb x + · have hid : fderiv ℝ (id : EuclideanPlane → EuclideanPlane) = + fun _ => ContinuousLinearMap.id ℝ EuclideanPlane := funext fun _ => fderiv_id + constructor + · rw [h.fderiv.self_of_nhds, fderiv_id] + exact ContinuousLinearMap.norm_id_le.trans hB₁ + · rw [h.fderiv.fderiv.self_of_nhds, hid, fderiv_const_apply] + rw [ContinuousLinearMap.opNorm_zero] + exact hB₂ + +theorem compact_euclidean_flow_estimates (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (normalizedHamiltonian I hI)) Ω) + (a t : ℝ) (ht : 0 ≤ t) : + (∀ x, (‖fderiv ℝ (euclideanMap (Ψ a t)) x‖ ≤ + Real.exp ((euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ψ a t))) x‖ ≤ + Real.exp (2 * (euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t) - + Real.exp ((euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t)) ∧ + (‖fderiv ℝ (euclideanMap (Ψ (a + t) (-t))) x‖ ≤ + Real.exp ((euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ψ (a + t) (-t)))) x‖ ≤ + Real.exp (2 * (euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t) - + Real.exp ((euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t))) ∧ + (∀ x y, dist (euclideanMap (Ψ a t) x) (euclideanMap (Ψ a t) y) ≤ + Real.exp ((euclideanFlowBound (normalizedHamiltonian I hI) : ℝ) * t) * dist x y) := by + let L : ℝ := euclideanFlowBound (normalizedHamiltonian I hI) + have hL : 0 ≤ L := Nat.cast_nonneg _ + have hB₁ : 1 ≤ Real.exp (L * t) := Real.one_le_exp (mul_nonneg hL ht) + have hB₂ : 0 ≤ Real.exp (2 * L * t) - Real.exp (L * t) := by + apply sub_nonneg.mpr + apply Real.exp_le_exp.mpr + nlinarith + have hb := (planar_euclidean_flow_estimates (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) hv).2.2 a t ht + have hf := compactTransition_euclidean_transfer I hI hΨ hΩ a t hB₁ hB₂ (fun x => (hb.1 x).1) + have hi := compactTransition_euclidean_transfer I hI hΨ hΩ (a + t) (-t) hB₁ hB₂ (fun x => (hb.1 x).2) + refine ⟨fun x => ⟨hf x, hi x⟩, ?_⟩ + intro x y + have h := Convex.norm_image_sub_le_of_norm_fderiv_le (s := (univ : Set EuclideanPlane)) + (fun z _ => (compactTransition_euclidean_smooth I hI hΨ hΩ hv a t).differentiable (by simp) z) + (fun z _ => (hf z).1) (convex_univ : Convex ℝ (univ : Set EuclideanPlane)) + (mem_univ y) (mem_univ x) + simpa only [dist_eq_norm] using h + +end Recorder.Planar +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanEnergy.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa67def12588f86184f0f46dc93d70f96094c8a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactEuclideanEnergy.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.AlternatingFlow.EnergyUniqueness +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.CompactRapidCoordinates + +namespace OAI + +/-! Energy regularity of compact smooth fields, transferred to the Euclidean +coordinate convention. Pressure uniqueness is stated modulo time-dependent +spatial constants, as in the balanced-box application. -/ + +noncomputable section +namespace ForcedComputation.CompactEuclidean +open Set +open RapidForcing.CompactEmbedding +open scoped ContDiff + +def velocity (V : ShearFlows.Velocity) : AlternatingNS.Velocity := + fun t x => piCoordinates.symm (V (t, piCoordinates x)) + +theorem velocity_smooth {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (Function.uncurry (velocity V)) := + piCoordinates.symm.contDiff.comp + (hV.comp (contDiff_fst.prodMk (piCoordinates.contDiff.comp contDiff_snd))) + +theorem piField_velocity (V : ShearFlows.Velocity) : + piField (velocity V) = V := by + funext y + simp only [piField, velocity, ContinuousLinearEquiv.apply_symm_apply] + +theorem velocity_divergence (V : ShearFlows.Velocity) (t : ℝ) (x : AlternatingNS.Space) : + AlternatingNS.div (velocity V) t x = + ShearFlows.divergence (fun y => V (t,y)) (piCoordinates x) := by + have h := piField_divergence (velocity V) t (piCoordinates x) + rw [piField_velocity] at h + simpa only [ContinuousLinearEquiv.symm_apply_apply, AlternatingNS.div, + AlternatingNS.dx, AlternatingNS.e, RapidForcing.divergence, + RapidForcing.spatialD, RapidForcing.basis] using h.symm + +theorem velocity_support {V : ShearFlows.Velocity} {K : Set ShearFlows.Space} + (hs : ∀ t, Function.support (fun x => V (t,x)) ⊆ K) (t : ℝ) : + Function.support (velocity V t) ⊆ piCoordinates.symm '' K := by + intro x hx + have hv : V (t, piCoordinates x) ≠ 0 := by + intro hz + exact hx (by simp only [velocity, hz, map_zero]) + exact ⟨piCoordinates x, hs t hv, piCoordinates.symm_apply_apply x⟩ + +theorem velocity_energyClass {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) + {K : Set ShearFlows.Space} (hK : IsCompact K) + (hs : ∀ t, Function.support (fun x => V (t,x)) ⊆ K) : + AlternatingNS.EnergyClass (velocity V) (fun _ _ => 0) := + AlternatingNS.Analytic.smooth_energyClass (velocity V) (velocity_smooth hV) + (piCoordinates.symm '' K) (hK.image piCoordinates.symm.continuous) (velocity_support hs) + +theorem velocity_global_material_flow {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) + {K : Set ShearFlows.Space} (hK : IsCompact K) + (hs : ∀ t, Function.support (fun x => V (t,x)) ⊆ K) : + ∃ X : AlternatingNS.Space → ℝ → AlternatingNS.Space, + (∀ a, AlternatingNS.IsTrajectory (velocity V) a (X a)) ∧ + (∀ a γ, AlternatingNS.IsTrajectory (velocity V) a γ → + ∀ t, 0 ≤ t → γ t = X a t) := + AlternatingNS.Analytic.global_material_flow (velocity V) (velocity_smooth hV) + (piCoordinates.symm '' K) (hK.image piCoordinates.symm.continuous) (velocity_support hs) + +/-- A pressure class has an energy-regular representative satisfying the +equations. Its spatially constant gauge may depend on time. -/ +def IsEnergySolutionModuloConstants (ν : ℝ) (f u : AlternatingNS.Velocity) + (p : AlternatingNS.Pressure) : Prop := + ∃ c : ℝ → ℝ, + AlternatingNS.NavierStokes ν f u (fun t x => p t x - c t) ∧ + AlternatingNS.CompetitorEnergyClass u (fun t x => p t x - c t) + +theorem energy_unique_modulo_constants {ν : ℝ} (hν : 0 ≤ ν) + {f U v : AlternatingNS.Velocity} {p : AlternatingNS.Pressure} + (hU : AlternatingNS.NavierStokes ν f U (fun _ _ => 0)) + (hUE : AlternatingNS.EnergyClass U (fun _ _ => 0)) + (hv : IsEnergySolutionModuloConstants ν f v p) : + ∃ c : ℝ → ℝ, ∀ t, 0 ≤ t → ∀ x, v t x = U t x ∧ p t x = c t := by + obtain ⟨c, hvc, hvE⟩ := hv + have he := AlternatingNS.Analytic.energy_unique ν hν f U v (fun t x => p t x - c t) + hU hvc hUE hvE + exact ⟨c, fun t ht x => ⟨(he t ht x).1, sub_eq_zero.mp (he t ht x).2⟩⟩ + +theorem compact_velocity_solution {ν : ℝ} (hν : 0 < ν) + {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) + {K : Set ShearFlows.Space} (hK : IsCompact K) + (hs : ∀ t, Function.support (fun x => V (t,x)) ⊆ K) + (h0 : ∀ x, V (0,x) = 0) (hd : ShearFlows.Solenoidal V) : + let U := velocity V + AlternatingNS.NavierStokes ν (AlternatingNS.residual ν U) U (fun _ _ => 0) ∧ + AlternatingNS.EnergyClass U (fun _ _ => 0) ∧ + ∀ v p, IsEnergySolutionModuloConstants ν (AlternatingNS.residual ν U) v p → + ∃ c : ℝ → ℝ, ∀ t, 0 ≤ t → ∀ x, v t x = U t x ∧ p t x = c t := by + dsimp only + have hsol := AlternatingNS.Analytic.residual_navierStokes ν (velocity V) (velocity_smooth hV) + (fun x => by simp only [velocity, h0, map_zero]) + (fun t _ x => by rw [velocity_divergence]; exact hd t (piCoordinates x)) + have hE := velocity_energyClass hV hK hs + exact ⟨hsol, hE, fun v p hv => energy_unique_modulo_constants hν.le hsol hE hv⟩ + +end ForcedComputation.CompactEuclidean + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodization.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodization.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d2a453da9d4a6942277bff7a25d55b40d92341c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodization.lean @@ -0,0 +1,125 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.CompactRapidEmbedding + +namespace OAI + +/-! Periodization in a chart strictly separated from every integer face. The +fractional representative is only a definition: smoothness follows from local +translation or local zero, so no differentiability of the fractional part at +an integer is asserted. -/ + +noncomputable section +open Set Filter +open scoped Topology ContDiff +namespace RapidForcing.CompactEmbedding + +def latticeVector (k : Fin 3 → ℤ) : Space := WithLp.toLp 2 (fun i => (k i : ℝ)) + +def representative (x : Space) : Space := WithLp.toLp 2 (fun i => Int.fract (x i)) + +@[simp] theorem representative_apply (x : Space) (i : Fin 3) : + representative x i = Int.fract (x i) := rfl + +@[simp] theorem latticeVector_apply (k : Fin 3 → ℤ) (i : Fin 3) : + latticeVector k i = (k i : ℝ) := rfl + +theorem representative_add_lattice (x : Space) (k : Fin 3 → ℤ) : + representative (x + latticeVector k) = representative x := by + ext i + exact Int.fract_add_intCast (x i) (k i) + +theorem representative_eq {x : Space} (hx : ∀ i, x i ∈ Ico (0 : ℝ) 1) : + representative x = x := by + ext i + exact Int.fract_eq_self.mpr (hx i) + +def periodic {E : Type} (f : Field E) : Field E := fun t x => f t (representative x) + +theorem periodic_add_lattice {E : Type} (f : Field E) (t : ℝ) + (x : Space) (k : Fin 3 → ℤ) : + periodic f t (x + latticeVector k) = periodic f t x := by + simp only [periodic, representative_add_lattice] + +theorem periodic_eq_on_chart {E : Type} (f : Field E) (t : ℝ) {x : Space} + (hx : x ∈ chart) : periodic f t x = f t x := by + rw [periodic, representative_eq] + intro i + exact ⟨(chart_inside_unit hx i).1.le, (chart_inside_unit hx i).2⟩ + +theorem representative_local_translation {x : Space} + (hx : ∀ i, x i ≠ (⌊x i⌋ : ℤ)) : + representative =ᶠ[𝓝 x] (fun y => y - latticeVector (fun i => ⌊x i⌋)) := by + have hlocal : ∀ i : Fin 3, ∀ᶠ y in 𝓝 x, + (⌊x i⌋ : ℝ) < y i ∧ y i < (⌊x i⌋ : ℝ) + 1 := by + intro i + exact ((EuclideanSpace.proj i).continuous.continuousAt).eventually + (Ioo_mem_nhds ((Int.floor_le (x i)).lt_of_ne (Ne.symm (hx i))) + (Int.lt_floor_add_one (x i))) + filter_upwards [Filter.eventually_all.mpr hlocal] with y hy + ext i + have hk : ⌊y i⌋ = ⌊x i⌋ := Int.floor_eq_iff.mpr ⟨(hy i).1.le, (hy i).2⟩ + simp only [representative_apply, PiLp.sub_apply, latticeVector_apply, Int.fract, hk] + +theorem fract_near_integer {x : ℝ} {k : ℤ} + (hx : x ∈ Ioo ((k : ℝ) - 1 / 8) ((k : ℝ) + 1 / 8)) : + Int.fract x < 1 / 4 ∨ 3 / 4 < Int.fract x := by + have hfract : Int.fract (x - (k : ℝ)) = Int.fract x := Int.fract_sub_intCast x k + rw [← hfract] + by_cases hp : 0 ≤ x - (k : ℝ) + · left + rw [Int.fract_eq_self.mpr ⟨hp, by linarith [hx.2]⟩] + linarith [hx.2] + · right + have hk : ⌊x - (k : ℝ)⌋ = (-1 : ℤ) := + Int.floor_eq_iff.mpr ⟨by norm_num; linarith [hx.1], by norm_num; linarith⟩ + rw [Int.fract, hk] + norm_num + linarith [hx.1] + +theorem representative_local_outside {x : Space} {i : Fin 3} + (hx : x i = (⌊x i⌋ : ℤ)) : ∀ᶠ y in 𝓝 x, representative y ∉ chart := by + have hl : (⌊x i⌋ : ℝ) - 1 / 8 < x i := by linarith [hx] + have hr : x i < (⌊x i⌋ : ℝ) + 1 / 8 := by linarith [hx] + filter_upwards [((EuclideanSpace.proj i).continuous.continuousAt).eventually + (Ioo_mem_nhds hl hr)] with y hy + intro hc + rcases fract_near_integer hy with h | h + · exact (not_lt_of_ge (hc.1 i)) h + · exact (not_lt_of_ge (hc.2 i)) h + +theorem periodic_local {E : Type} [Zero E] (f : Field E) + (hf : ∀ t x, x ∉ chart → f t x = 0) (x : Space) : + (∃ k : Fin 3 → ℤ, ∀ᶠ y in 𝓝 x, ∀ t, periodic f t y = f t (y - latticeVector k)) ∨ + (∀ᶠ y in 𝓝 x, ∀ t, periodic f t y = 0) := by + by_cases hx : ∀ i, x i ≠ (⌊x i⌋ : ℤ) + · left + refine ⟨fun i => ⌊x i⌋, ?_⟩ + filter_upwards [representative_local_translation hx] with y hy t + simp only [periodic, hy] + · right + push Not at hx + obtain ⟨i, hi⟩ := hx + filter_upwards [representative_local_outside hi] with y hy t + exact hf t (representative y) hy + +theorem periodic_smooth {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : Field E} (hs : ContDiff ℝ ∞ (Function.uncurry f)) + (hf : ∀ t x, x ∉ chart → f t x = 0) : + ContDiff ℝ ∞ (Function.uncurry (periodic f)) := by + apply contDiff_iff_contDiffAt.mpr + rintro ⟨t, x⟩ + rcases periodic_local f hf x with ⟨k, hk⟩ | hz + · have he : Function.uncurry (periodic f) =ᶠ[𝓝 (t, x)] + (fun p : ℝ × Space => f p.1 (p.2 - latticeVector k)) := by + filter_upwards [continuous_snd.continuousAt.eventually hk] with p hp + exact hp p.1 + exact (hs.comp (contDiff_fst.prodMk (contDiff_snd.sub contDiff_const))).contDiffAt.congr_of_eventuallyEq he + · have he : Function.uncurry (periodic f) =ᶠ[𝓝 (t, x)] (fun _ => (0 : E)) := by + filter_upwards [continuous_snd.continuousAt.eventually hz] with p hp + exact hp p.1 + exact contDiffAt_const.congr_of_eventuallyEq he + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationDerivatives.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..6adc433c6651fcda50dd1f2ea86241e7b56c555d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationDerivatives.lean @@ -0,0 +1,131 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPeriodization + +namespace OAI + +/-! On the support chart, differentiation commutes exactly with periodization. +Consequently every mixed rapid estimate transfers with the same constant. -/ + +noncomputable section +open Set Filter +open scoped Topology +namespace RapidForcing.CompactEmbedding + +theorem chart_closed : IsClosed chart := by + have he : chart = (⋂ i : Fin 3, {x : Space | 1 / 4 ≤ x i}) ∩ + (⋂ i : Fin 3, {x : Space | x i ≤ 3 / 4}) := by + ext x + simp [chart] + rw [he] + exact (isClosed_iInter fun i => isClosed_le continuous_const (EuclideanSpace.proj i).continuous).inter + (isClosed_iInter fun i => isClosed_le (EuclideanSpace.proj i).continuous continuous_const) + +def ChartSupported {E : Type} [Zero E] (f : Field E) : Prop := + ∀ t x, x ∉ chart → f t x = 0 + +namespace ChartSupported +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : Field E} + +omit [NormedSpace ℝ E] in +theorem tsupport (hf : ChartSupported f) (t : ℝ) : tsupport (f t) ⊆ chart := by + apply closure_minimal _ chart_closed + intro x hx + by_contra hn + exact hx (hf t x hn) + +theorem spatialD (hf : ChartSupported f) (i : Fin 3) : + ChartSupported (RapidForcing.spatialD i f) := by + intro t x hx + apply image_eq_zero_of_notMem_tsupport + intro hm + exact hx (hf.tsupport t (tsupport_fderiv_apply_subset ℝ (basis i) hm)) + +theorem timeD (hf : ChartSupported f) : ChartSupported (RapidForcing.timeD f) := by + intro t x hx + change derivWithin (fun s => f s x) (Ici 0) t = 0 + rw [show (fun s => f s x) = (fun _ => (0 : E)) from funext (fun s => hf s x hx)] + simp + +theorem spatialIter (hf : ChartSupported f) (i : Fin 3) (n : ℕ) : + ChartSupported ((RapidForcing.spatialD i)^[n] f) := by + induction n with + | zero => exact hf + | succ n ih => simpa only [Function.iterate_succ_apply'] using ih.spatialD i + +theorem timeIter (hf : ChartSupported f) (n : ℕ) : + ChartSupported (RapidForcing.timeD^[n] f) := by + induction n with + | zero => exact hf + | succ n ih => simpa only [Function.iterate_succ_apply'] using ih.timeD + +theorem mixedD (hf : ChartSupported f) (l : ℕ) (α : MultiIndex) : + ChartSupported (RapidForcing.mixedD l α f) := + (((hf.spatialIter 2 (α 2)).spatialIter 1 (α 1)).spatialIter 0 (α 0)).timeIter l + +end ChartSupported + +section Derivatives +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : Field E} + +theorem periodic_spatialD (hf : ChartSupported f) (i : Fin 3) : + spatialD i (periodic f) = periodic (spatialD i f) := by + funext t x + by_cases hx : ∀ j, x j ≠ (⌊x j⌋ : ℤ) + · have hr := representative_local_translation hx + have he : periodic f t =ᶠ[𝓝 x] + (fun y => f t (y - latticeVector (fun j => ⌊x j⌋))) := + hr.mono (fun y hy => congrArg (f t) hy) + change fderiv ℝ (periodic f t) x (basis i) = + fderiv ℝ (f t) (representative x) (basis i) + rw [he.fderiv_eq, fderiv_comp_sub, hr.eq_of_nhds] + · push Not at hx + obtain ⟨j, hj⟩ := hx + have hr := representative_local_outside hj + have he : periodic f t =ᶠ[𝓝 x] (fun _ => (0 : E)) := + hr.mono (fun y hy => hf t (representative y) hy) + have hd := (hf.spatialD i) t (representative x) hr.self_of_nhds + change fderiv ℝ (periodic f t) x (basis i) = spatialD i f t (representative x) + rw [he.fderiv_eq, hd] + simp + +theorem periodic_timeD : timeD (periodic f) = periodic (timeD f) := rfl + +theorem periodic_spatialIter (hf : ChartSupported f) (i : Fin 3) (n : ℕ) : + (spatialD i)^[n] (periodic f) = periodic ((spatialD i)^[n] f) := by + induction n with + | zero => rfl + | succ n ih => + rw [Function.iterate_succ_apply', ih, + periodic_spatialD (hf.spatialIter i n), Function.iterate_succ_apply'] + +theorem periodic_timeIter (n : ℕ) : timeD^[n] (periodic f) = periodic (timeD^[n] f) := by + induction n with + | zero => rfl + | succ n ih => + rw [Function.iterate_succ_apply', ih, periodic_timeD, Function.iterate_succ_apply'] + +theorem periodic_mixedD (hf : ChartSupported f) (l : ℕ) (α : MultiIndex) : + mixedD l α (periodic f) = periodic (mixedD l α f) := by + unfold mixedD spatialMulti + rw [periodic_spatialIter hf, + periodic_spatialIter (hf.spatialIter 2 (α 2)), + periodic_spatialIter ((hf.spatialIter 2 (α 2)).spatialIter 1 (α 1)), periodic_timeIter] + +theorem periodic_mixed_bound (hf : ChartSupported f) {J l : ℕ} {α : MultiIndex} {C : ℝ} + (hb : ∀ t, 0 ≤ t → ∀ x, (1 + t) ^ J * ‖mixedD l α f t x‖ ≤ C) : + ∀ t, 0 ≤ t → ∀ x, (1 + t) ^ J * ‖mixedD l α (periodic f) t x‖ ≤ C := by + intro t ht x + rw [periodic_mixedD hf] + exact hb t ht (representative x) + +theorem periodic_rapid (hf : ChartSupported f) (hr : Rapid f) : Rapid (periodic f) := by + intro J l α + obtain ⟨C, hC, hb⟩ := hr J l α + exact ⟨C, hC, periodic_mixed_bound hf hb⟩ + +end Derivatives + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationNS.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationNS.lean new file mode 100644 index 0000000000000000000000000000000000000000..a22cb17057aa6d19e486b85709dae9185f3999fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPeriodizationNS.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPeriodizationDerivatives +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.CompactRapidDifferential + +namespace OAI + +/-! Local periodization preserves the full residual equation. A pressure +projection, when supplied by the torus Poisson solver, is a separate algebraic +step and does not change the velocity or its trajectories. -/ + +noncomputable section +open Set +open scoped BigOperators +namespace RapidForcing.CompactEmbedding + +theorem field_chartSupported {u : Field Space} (hu : Supported u) + (hneg : ∀ t, t < 0 → ∀ x, u t x = 0) : ChartSupported (field u) := by + intro t x hx + by_cases ht : 0 ≤ t + · have hu' : unembed x ∉ K := by + intro h + exact hx (by simpa only [embed_unembed] using embed_mem_chart h) + simp [field, hu.zero_off ht hu'] + · simp [field, hneg t (lt_of_not_ge ht)] + +theorem periodic_divergence {u : Field Space} (hu : ChartSupported u) (t : ℝ) (x : Space) : + divergence (periodic u) t x = divergence u t (representative x) := by + unfold divergence + simp_rw [periodic_spatialD hu] + rfl + +theorem periodic_advection {u : Field Space} (hu : ChartSupported u) (t : ℝ) (x : Space) : + advection (periodic u) t x = advection u t (representative x) := by + unfold advection + simp_rw [periodic_spatialD hu] + rfl + +theorem periodic_laplace {u : Field Space} (hu : ChartSupported u) (t : ℝ) (x : Space) : + laplace (periodic u) t x = laplace u t (representative x) := by + unfold laplace + simp_rw [periodic_spatialD hu] + apply Finset.sum_congr rfl + intro i _ + rw [periodic_spatialD (hu.spatialD i)] + rfl + +theorem periodic_residual {u : Field Space} (hu : ChartSupported u) (ν t : ℝ) (x : Space) : + residual ν (periodic u) t x = residual ν u t (representative x) := by + unfold residual + rw [periodic_timeD, periodic_advection hu, periodic_laplace hu] + rfl + +theorem periodic_navierStokes {u f : Field Space} {ν : ℝ} + (hu : ChartSupported u) (hNS : NavierStokes ν f u (fun _ _ => 0)) : + NavierStokes ν (periodic f) (periodic u) (fun _ _ => 0) := by + refine ⟨?_, ?_, ?_⟩ + · intro t ht x + have h := hNS.1 t ht (representative x) + simp only [gradient, spatialD, fderiv_const_apply, zero_apply, + zero_smul, Finset.sum_const_zero, neg_zero, zero_add] at h ⊢ + rw [periodic_timeD, periodic_advection hu, periodic_laplace hu] + exact h + · intro t ht x + rw [periodic_divergence hu] + exact hNS.2.1 t ht (representative x) + · intro x + exact hNS.2.2 (representative x) + +theorem navierStokes_pressure_projection {u g : Field Space} {ν : ℝ} + {φ : Field ℝ} (hNS : NavierStokes ν g u (fun _ _ => 0)) : + NavierStokes ν (fun t x => g t x - gradient φ t x) u (fun t x => -φ t x) := by + refine ⟨?_, hNS.2⟩ + intro t ht x + have h := hNS.1 t ht x + simp only [gradient, spatialD, fderiv_const_apply, zero_apply, + zero_smul, Finset.sum_const_zero, neg_zero, zero_add] at h + have hg : gradient (fun t x => -φ t x) t x = -gradient φ t x := by + unfold gradient spatialD + change (∑ i, fderiv ℝ (-(φ t)) x (basis i) • basis i) = _ + rw [fderiv_neg] + simp only [neg_apply, neg_smul, Finset.sum_neg_distrib] + rw [hg, neg_neg, h] + module + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6b50bc2ab3df24c182cdcf81b08c7a1b3383bae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarBounds.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCompactBridge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition + +namespace OAI + +/-! Bounds and actual global transitions for the compact planar version of +the normalized program. The periodic spatial expression agrees on the +chart; outside the common support all derivatives vanish. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian Set Filter +open scoped Topology ContDiff NNReal + +def compactVelocity (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (s : ℝ) : Plane → Plane := + PlanarHamiltonian.periodicVelocity + (n := (actions (freshMachine I.1) (freshInput_wellFormed hI)).length) + (normalizedPulse I hI) s + +theorem compactVelocity_smooth (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => compactVelocity I hI y.1 y.2) := + periodicVelocity_smooth (normalizedPulse_valid I hI) + +theorem compactVelocity_germ (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) {x : Plane} + (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + compactVelocity I hI s =ᶠ[𝓝 x] planarSlice (normalizedHamiltonian I hI) s := by + have ho : IsOpen {y : Plane | y 0 ∈ Ioo (0 : ℝ) 1 ∧ y 1 ∈ Ioo (0 : ℝ) 1} := + (isOpen_Ioo.preimage (continuous_apply 0)).inter + (isOpen_Ioo.preimage (continuous_apply 1)) + filter_upwards [ho.mem_nhds ⟨hx₀, hx₁⟩] with y hy + exact normalized_planar_field_on_chart I hI s y hy.1 hy.2 + +theorem compactVelocity_support (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) : + tsupport (compactVelocity I hI s) ⊆ commonSupport (normalizedPulse I hI) := + (periodicVelocity_properties (normalizedPulse_valid I hI) s).1 + +theorem compactVelocity_off_chart (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) {x : Plane} + (hx : ¬ (x 0 ∈ Ioo (0 : ℝ) 1 ∧ x 1 ∈ Ioo (0 : ℝ) 1)) : + x ∉ tsupport (compactVelocity I hI s) := by + intro hm + have h := commonSupport_in_unit (normalizedPulse_inUnit I hI) + (compactVelocity_support I hI s hm) + exact hx ⟨h 0, h 1⟩ + +theorem compactVelocity_bound (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) (x : Plane) : + ‖compactVelocity I hI s x‖ ≤ + ((SpatialExpression.suspensionCode (normalizedHamiltonian I hI)).bound [] : ℝ) := by + by_cases hx : x 0 ∈ Ioo (0 : ℝ) 1 ∧ x 1 ∈ Ioo (0 : ℝ) 1 + · rw [(compactVelocity_germ I hI s hx.1 hx.2).eq_of_nhds] + exact planarSlice_bound (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) s x + · rw [image_eq_zero_of_notMem_tsupport (compactVelocity_off_chart I hI s hx), norm_zero] + exact Nat.cast_nonneg _ + +theorem compactVelocity_derivative_bounds (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) (x : Plane) : + ‖fderiv ℝ (compactVelocity I hI s) x‖ ≤ + (planarVariationCoefficient (normalizedHamiltonian I hI) : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (compactVelocity I hI s)) x‖ ≤ + (planarVariationCoefficient (normalizedHamiltonian I hI) : ℝ) := by + by_cases hx : x 0 ∈ Ioo (0 : ℝ) 1 ∧ x 1 ∈ Ioo (0 : ℝ) 1 + · have he := compactVelocity_germ I hI s hx.1 hx.2 + rw [he.fderiv_eq, he.fderiv.fderiv_eq] + exact planar_derivative_bounds (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) s x + · have hn := compactVelocity_off_chart I hI s hx + have hn' : x ∉ tsupport (fderiv ℝ (compactVelocity I hI s)) := + fun h => hn (tsupport_fderiv_subset ℝ h) + constructor + · rw [fderiv_of_notMem_tsupport ℝ hn, norm_zero] + exact Nat.cast_nonneg _ + · have hz := fderiv_of_notMem_tsupport ℝ hn' + exact (congrArg norm hz).le.trans ((ContinuousLinearMap.opNorm_zero : + ‖(0 : Plane →L[ℝ] (Plane →L[ℝ] Plane))‖ = 0).le.trans (Nat.cast_nonneg _)) + +theorem compactVelocity_lipschitz (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) : + LipschitzWith (planarVariationCoefficient (normalizedHamiltonian I hI) : ℝ≥0) + (compactVelocity I hI s) := by + have hi : ContDiff ℝ ∞ (fun x : Plane => (s, x)) := + contDiff_const.prodMk contDiff_id + have hs := (compactVelocity_smooth I hI).comp hi + apply lipschitzWith_of_nnnorm_fderiv_le (hs.differentiable (by simp)) + intro x + exact_mod_cast (compactVelocity_derivative_bounds I hI s x).1 + +theorem compactVelocity_transitions (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ∃ Ψ, IsPlanarTransition (compactVelocity I hI) Ψ := by + apply exists_planarTransition_of_bounds (B := + ((SpatialExpression.suspensionCode (normalizedHamiltonian I hI)).bound [] : ℝ≥0)) + (compactVelocity_lipschitz I hI) + · intro x + have hi : Continuous (fun t : ℝ => (t, x)) := continuous_id.prodMk continuous_const + have h := (compactVelocity_smooth I hI).continuous.comp hi + exact h + · exact compactVelocity_bound I hI + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarFlow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..897c41da2b2c342dd198859960cf29b3b133cf75 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarFlow.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarBounds + +namespace OAI + +/-! The compact planar flow fixes every point off its common support and +preserves that support. In particular, its trajectories cannot leave the +unit-square chart. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian Set + +theorem compactTransition_fixed (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) {x : Plane} + (hx : x ∉ commonSupport (normalizedPulse I hI)) (a t : ℝ) : Ψ a t x = x := by + symm + apply hΨ.unique a x (fun _ => x) rfl + intro s + have hn : x ∉ tsupport (compactVelocity I hI (a + s)) := + fun h => hx (compactVelocity_support I hI (a + s) h) + rw [image_eq_zero_of_notMem_tsupport hn] + exact hasDerivAt_const s x + +theorem compactTransition_support (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) {x : Plane} + (hx : x ∈ commonSupport (normalizedPulse I hI)) (a t : ℝ) : + Ψ a t x ∈ commonSupport (normalizedPulse I hI) := by + by_contra hn + have he := compactTransition_fixed I hI hΨ hn a t + have hxy : x = Ψ a t x := (hΨ.bijective a t).1 he.symm + exact hn (hxy ▸ hx) + +theorem compactTransition_chart (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) {x : Plane} + (hx : ∀ j : Fin 2, 0 < x j ∧ x j < 1) (a t : ℝ) : + ∀ j : Fin 2, 0 < Ψ a t x j ∧ Ψ a t x j < 1 := by + by_cases hm : x ∈ commonSupport (normalizedPulse I hI) + · exact commonSupport_in_unit (normalizedPulse_inUnit I hI) + (compactTransition_support I hI hΨ hm a t) + · rw [compactTransition_fixed I hI hΨ hm a t] + exact hx + +theorem compactTransition_eq_slice (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + {x : Plane} (hx : ∀ j : Fin 2, 0 < x j ∧ x j < 1) (a t : ℝ) : + Ψ a t x = Ω a t x := by + apply hΩ.unique a x (fun s => Ψ a s x) (hΨ.initial a x) + intro s + have hy := compactTransition_chart I hI hΨ hx a s + have he := normalized_planar_field_on_chart I hI (a + s) (Ψ a s x) (hy 0) (hy 1) + exact (hΨ.ode a s x).congr_deriv he + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarProcessor.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarProcessor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2406afcc2fa4298c3673383ecb74d0ed09714e3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarProcessor.lean @@ -0,0 +1,213 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulseExpressions + +namespace OAI + +/-! The compact planar interpretation of the finite scalar program. Its +time-periodic Hamiltonian has one common compact support inside the open +unit square, and generates a smooth divergence-free, zero-mean field. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian +open ShearFlows Set MeasureTheory Filter +open scoped ContDiff BigOperators Topology + +def periodicHamiltonian {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) : ℝ := + ∑ i : Fin n, (PeriodicExpr.intervalPulse (p i).start (p i).finish).val t * + (p i).hamiltonian x + +def periodicVelocity {n : ℕ} (p : Fin n → Pulse) (t : ℝ) : Plane → Plane := + field (periodicHamiltonian p t) + +def commonSupport {n : ℕ} (p : Fin n → Pulse) : Set Plane := + ⋃ i : Fin n, (rectangleCollar (p i).rectangle (p i).collar).carrier + +theorem commonSupport_compact {n : ℕ} (p : Fin n → Pulse) : + IsCompact (commonSupport p) := + isCompact_iUnion (fun i => rectangleCollar_compact (p i).rectangle (p i).collar) + +theorem commonSupport_in_unit {n : ℕ} {p : Fin n → Pulse} + (hu : ∀ i, (p i).InUnit) : + commonSupport p ⊆ {x | ∀ j : Fin 2, 0 < x j ∧ x j < 1} := by + intro x hx j + obtain ⟨i, hi⟩ := Set.mem_iUnion.mp hx + have h := hi j + have hb := (hu i).2.2 j + dsimp [rectangleCollar] at h + push_cast at h + have hl : (0 : ℝ) < ((p i).rectangle.lower j : ℝ) - 2 * (p i).collar := by + exact_mod_cast hb.1 + have hr : ((p i).rectangle.upper j : ℝ) + 2 * (p i).collar < (1 : ℝ) := by + exact_mod_cast hb.2 + exact ⟨hl.trans_le h.1, h.2.trans_lt hr⟩ + +theorem periodicHamiltonian_smooth {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => periodicHamiltonian p y.1 y.2) := by + apply ContDiff.sum + intro i _ + exact ((PeriodicExpr.smooth (PeriodicExpr.intervalPulse_valid (hp i).2)).comp + contDiff_fst).mul ((p i).hamiltonian_smooth.comp contDiff_snd) + +theorem periodicHamiltonian_slice_smooth {n : ℕ} (p : Fin n → Pulse) (t : ℝ) : + ContDiff ℝ ∞ (periodicHamiltonian p t) := by + apply ContDiff.sum + intro i _ + exact contDiff_const.mul (p i).hamiltonian_smooth + +theorem periodicHamiltonian_periodic {n : ℕ} (p : Fin n → Pulse) (x : Plane) : + Function.Periodic (fun t => periodicHamiltonian p t x) 1 := by + intro t + apply Finset.sum_congr rfl + intro i _ + have h := periodize_periodic (1 : ℝ) + (PeriodicExpr.intervalPulse (p i).start (p i).finish).body.val t + change _ * _ = _ * _ + have he : (PeriodicExpr.intervalPulse (p i).start (p i).finish).val (t + 1) = + (PeriodicExpr.intervalPulse (p i).start (p i).finish).val t := by + simpa only [PeriodicExpr.val, PeriodicExpr.intervalPulse, Rat.cast_one] using h + rw [he] + +theorem periodicHamiltonian_support {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (t : ℝ) : + tsupport (periodicHamiltonian p t) ⊆ commonSupport p := by + apply closure_minimal _ (commonSupport_compact p).isClosed + intro x hx + by_contra hn + apply hx + apply Finset.sum_eq_zero + intro i _ + have hn' : x ∉ tsupport (p i).hamiltonian := by + intro hh + apply hn + apply Set.mem_iUnion.mpr + refine ⟨i, ?_⟩ + have hs : tsupport (p i).hamiltonian ⊆ + (rectangleCollar (p i).rectangle (p i).collar).carrier := + tsupport_mul_subset_left.trans (closure_minimal + (rectangleCutoff_support (hp i).1) + (rectangleCollar_compact (p i).rectangle (p i).collar).isClosed) + exact hs hh + rw [image_eq_zero_of_notMem_tsupport hn', mul_zero] + +theorem periodicVelocity_eq_sum {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) : + periodicVelocity p t x = ∑ i : Fin n, + (PeriodicExpr.intervalPulse (p i).start (p i).finish).val t • (p i).spatial x := by + unfold periodicVelocity periodicHamiltonian + rw [field_sum _ _ (fun i _ => contDiff_const.mul (p i).hamiltonian_smooth)] + apply Finset.sum_congr rfl + intro i _ + exact field_const_mul (p i).hamiltonian_smooth _ _ + +theorem periodicVelocity_smooth {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => periodicVelocity p y.1 y.2) := by + have he : (fun y : ℝ × Plane => periodicVelocity p y.1 y.2) = + fun y => ∑ i : Fin n, (PeriodicExpr.intervalPulse (p i).start (p i).finish).val y.1 • + (p i).spatial y.2 := by + funext y + exact periodicVelocity_eq_sum p y.1 y.2 + rw [he] + apply ContDiff.sum + intro i _ + exact ((PeriodicExpr.smooth (PeriodicExpr.intervalPulse_valid (hp i).2)).comp + contDiff_fst).smul ((p i).spatial_smooth.comp contDiff_snd) + +theorem periodicVelocity_periodic {n : ℕ} (p : Fin n → Pulse) (x : Plane) : + Function.Periodic (fun t => periodicVelocity p t x) 1 := by + intro t + have he : periodicHamiltonian p (t + 1) = periodicHamiltonian p t := + funext fun y => periodicHamiltonian_periodic p y t + change field (periodicHamiltonian p (t + 1)) x = field (periodicHamiltonian p t) x + rw [he] + +theorem periodicVelocity_properties {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (t : ℝ) : + tsupport (periodicVelocity p t) ⊆ commonSupport p ∧ + (∀ x, divergence (periodicVelocity p t) x = 0) ∧ + (∫ x, periodicVelocity p t x) = 0 := by + have hs := periodicHamiltonian_slice_smooth p t + have hc : HasCompactSupport (periodicHamiltonian p t) := + (commonSupport_compact p).of_isClosed_subset (isClosed_tsupport _) + (periodicHamiltonian_support hp t) + exact ⟨(field_tsupport _).trans (periodicHamiltonian_support hp t), + field_divergence hs, field_integral_eq_zero hs hc⟩ + +theorem periodicPulse_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + (PeriodicExpr.intervalPulse p.start p.finish).val t = + smoothPulse p.start p.finish t := by + rw [PeriodicExpr.val_on_unit (PeriodicExpr.intervalPulse_valid hp.2) rfl hu.1 hu.2.1 ht] + change (ProfileExpr.ramp p.start p.finish).diff.val t = _ + rw [ProfileExpr.val_diff, ProfileExpr.val_ramp] + rfl + +theorem periodicHamiltonian_on_unit {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) : + periodicHamiltonian p t x = processorHamiltonian p t x := by + apply Finset.sum_congr rfl + intro i _ + rw [periodicPulse_on_unit (hp i) (hu i) ht] + +theorem periodicVelocity_on_unit {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) : + periodicVelocity p t x = processorVelocity p t x := by + have he : periodicHamiltonian p t = processorHamiltonian p t := + funext (periodicHamiltonian_on_unit hp hu ht) + unfold periodicVelocity processorVelocity + rw [he] + +theorem periodicPulse_zero_near_zero {p : Pulse} (hp : p.Valid) (hu : p.InUnit) : + (PeriodicExpr.intervalPulse p.start p.finish).val =ᶠ[𝓝 0] (fun _ => 0) := by + let δ : ℝ := min (1 / 4) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2) + have ha : (0 : ℝ) < p.start := by exact_mod_cast hu.1 + have hb : (p.finish : ℝ) < 1 := by exact_mod_cast hu.2.1 + have hδ : 0 < δ := lt_min (by norm_num) (by positivity) + have hδ₁ : δ ≤ 1 / 4 := min_le_left _ _ + have hδ₂ : 2 * δ ≤ p.start := by + have hm := min_le_right (1 / 4 : ℝ) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2) + have hn := min_le_left (p.start : ℝ) (1 - (p.finish : ℝ)) + change δ ≤ _ at hm + linarith + have hδ₃ : 2 * δ ≤ 1 - (p.finish : ℝ) := by + have hm := min_le_right (1 / 4 : ℝ) (min (p.start : ℝ) (1 - (p.finish : ℝ)) / 2) + have hn := min_le_right (p.start : ℝ) (1 - (p.finish : ℝ)) + change δ ≤ _ at hm + linarith + have hn : Ioo (-δ) δ ∈ 𝓝 (0 : ℝ) := Ioo_mem_nhds (by linarith) hδ + filter_upwards [hn] with t ht + have hs : Function.support (PeriodicExpr.intervalPulse p.start p.finish).body.val ⊆ + Ioo (-δ) (1 - δ) := by + intro x hx + have h := (PeriodicExpr.intervalPulse_valid hp.2).2 hx + change (p.start : ℝ) ≤ x ∧ x ≤ (p.finish : ℝ) at h + constructor <;> linarith [h.1, h.2] + have he := periodize_eq_in_chart (L := (1 : ℝ)) (A := -δ) (B := 1 - δ) + (by norm_num) (by linarith) hs (x := t) ⟨ht.1.le, by linarith [ht.2]⟩ + have he' : (PeriodicExpr.intervalPulse p.start p.finish).val t = + (PeriodicExpr.intervalPulse p.start p.finish).body.val t := by + simpa only [PeriodicExpr.val, PeriodicExpr.intervalPulse, Rat.cast_one] using he + rw [he'] + change (ProfileExpr.ramp p.start p.finish).diff.val t = 0 + rw [ProfileExpr.val_diff, ProfileExpr.val_ramp] + exact smoothPulse_before (by exact_mod_cast hp.2) (by linarith [ht.2]) + +theorem periodicVelocity_zero_near_zero {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) : + ∀ᶠ t in 𝓝 (0 : ℝ), ∀ x, periodicVelocity p t x = 0 := by + have he : ∀ᶠ t in 𝓝 (0 : ℝ), ∀ i : Fin n, + (PeriodicExpr.intervalPulse (p i).start (p i).finish).val t = 0 := + eventually_all.mpr (fun i => periodicPulse_zero_near_zero (hp i) (hu i)) + filter_upwards [he] with t ht + intro x + rw [periodicVelocity_eq_sum] + apply Finset.sum_eq_zero + intro i _ + rw [ht i, zero_smul] + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarVariations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarVariations.lean new file mode 100644 index 0000000000000000000000000000000000000000..a985fb90fce9722fa35cee96250a7d167d6ae039 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactPlanarVariations.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarFlow +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarReverseVariations + +namespace OAI + +/-! Quantitative estimates for the compact planar extension, assuming the +variational equations for the actual periodic transition map. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian Set Filter +open scoped Topology + +theorem compactTransition_germ (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + {x : Plane} (hx : ∀ j : Fin 2, 0 < x j ∧ x j < 1) (a t : ℝ) : + Ψ a t =ᶠ[𝓝 x] Ω a t := by + have ho : IsOpen {y : Plane | ∀ j : Fin 2, 0 < y j ∧ y j < 1} := by + have he : {y : Plane | ∀ j : Fin 2, 0 < y j ∧ y j < 1} = + ⋂ j : Fin 2, (fun y : Plane => y j) ⁻¹' Ioo 0 1 := by + ext y + simp only [mem_ofPred_eq, mem_iInter, mem_preimage, mem_Ioo] + rw [he] + exact isOpen_iInter_of_finite (fun j => isOpen_Ioo.preimage (continuous_apply j)) + filter_upwards [ho.mem_nhds hx] with y hy + exact compactTransition_eq_slice I hI hΨ hΩ hy a t + +theorem compactTransition_germ_id (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + {x : Plane} (hx : x ∉ commonSupport (normalizedPulse I hI)) (a t : ℝ) : + Ψ a t =ᶠ[𝓝 x] id := by + have ho := (commonSupport_compact (normalizedPulse I hI)).isClosed.isOpen_compl + filter_upwards [ho.mem_nhds hx] with y hy + exact compactTransition_fixed I hI hΨ hy a t + +theorem compactTransition_derivative_bounds (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (normalizedHamiltonian I hI)) Ω) + (a : ℝ) (x : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x‖ ≤ Real.exp ((planarFlowBound (normalizedHamiltonian I hI) : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ + Real.exp (2 * (planarFlowBound (normalizedHamiltonian I hI) : ℝ) * t) - + Real.exp ((planarFlowBound (normalizedHamiltonian I hI) : ℝ) * t) := by + by_cases hx : x ∈ commonSupport (normalizedPulse I hI) + · have hg := compactTransition_germ I hI hΨ hΩ + (commonSupport_in_unit (normalizedPulse_inUnit I hI) hx) a t + rw [hg.fderiv.self_of_nhds, hg.fderiv.fderiv.self_of_nhds] + exact planar_quantitative_variations (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) hv a x ht + · have hg := compactTransition_germ_id I hI hΨ hx a t + have hi : fderiv ℝ (id : Plane → Plane) = fun _ => ContinuousLinearMap.id ℝ Plane := + funext fun _ => fderiv_id + have hz : fderiv ℝ (fderiv ℝ (id : Plane → Plane)) x = 0 := by + rw [hi] + exact fderiv_const_apply (ContinuousLinearMap.id ℝ Plane) + have hL : (0 : ℝ) ≤ planarFlowBound (normalizedHamiltonian I hI) := Nat.cast_nonneg _ + constructor + · rw [hg.fderiv.self_of_nhds, fderiv_id] + exact (ContinuousLinearMap.norm_id_le).trans (Real.one_le_exp (mul_nonneg hL ht)) + · rw [hg.fderiv.fderiv.self_of_nhds, hz] + have hn : ‖(0 : Plane →L[ℝ] (Plane →L[ℝ] Plane))‖ = 0 := + ContinuousLinearMap.opNorm_zero + rw [hn] + apply sub_nonneg.mpr + apply Real.exp_le_exp.mpr + nlinarith + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactTimeSupport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactTimeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..16ae4958f67170e6c0e13e1b56eecccf15bbdc73 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/CompactTimeSupport.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBounds + +namespace OAI + +/-! A common compact spatial support controls all derivatives, including time +jets. Periodicity is used only to reduce the time variable to one closed cell. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem mixedDerivative_common_support {V : Velocity} {K : Set Space} + (hK : IsClosed K) (hV : ∀ t, tsupport (fun x => V (t, x)) ⊆ K) + (α : List (Fin 4)) (t : ℝ) : + tsupport (fun x => mixedDerivative V α (t, x)) ⊆ K := by + apply closure_minimal _ hK + intro x hx + by_contra hn + have ho : {y : SpaceTime | y.2 ∉ K} ∈ 𝓝 (t, x) := + (hK.isOpen_compl.preimage continuous_snd).mem_nhds hn + have he : V =ᶠ[𝓝 (t, x)] fun _ => 0 := by + filter_upwards [ho] with y hy + exact image_eq_zero_of_notMem_tsupport (f := fun x : Space => V (y.1, x)) + (fun hm => hy (hV y.1 hm)) + have hz := (mixedDerivative_eventuallyEq he α).self_of_nhds + rw [mixedDerivative_zero] at hz + exact hx hz + +theorem boundedMixed_of_compact_periodic {V : Velocity} {K : Set Space} + (hV : ContDiff ℝ ∞ V) (hK : IsCompact K) + (hs : ∀ t, tsupport (fun x => V (t, x)) ⊆ K) (hp : TimePeriodic V) : + BoundedMixedDerivatives V := by + intro α + obtain ⟨C, hC⟩ := (isCompact_Icc.prod hK).bddAbove_image + (mixedDerivative_smooth hV α).continuous.norm.continuousOn + refine ⟨max C 0, le_max_right _ _, ?_⟩ + rintro ⟨t, x⟩ + by_cases hx : x ∈ K + · have ht : Function.Periodic (fun s => mixedDerivative V α (s, x)) 1 := + fun s => mixedDerivative_time_periodic hV hp α s x + have he : mixedDerivative V α (Int.fract t, x) = mixedDerivative V α (t, x) := by + simpa only [Int.fract, mul_one] using ht.sub_int_mul_eq (x := t) ⌊t⌋ + rw [← he] + exact (hC (mem_image_of_mem _ + (show (Int.fract t, x) ∈ Icc (0 : ℝ) 1 ×ˢ K from + ⟨⟨Int.fract_nonneg t, (Int.fract_lt_one t).le⟩, hx⟩))).trans (le_max_left _ _) + · have hz : mixedDerivative V α (t, x) = 0 := + image_eq_zero_of_notMem_tsupport (f := fun x : Space => mixedDerivative V α (t, x)) + (fun hm => hx (mixedDerivative_common_support hK.isClosed hs α t hm)) + rw [hz, norm_zero] + exact le_max_right _ _ + +theorem boundedMixed_of_compact_tail {F G : Velocity} {K : Set Space} + (hF : ContDiff ℝ ∞ F) (hG : ContDiff ℝ ∞ G) (hK : IsCompact K) + (hsF : ∀ t, tsupport (fun x => F (t, x)) ⊆ K) + (hsG : ∀ t, tsupport (fun x => G (t, x)) ⊆ K) (hpG : TimePeriodic G) + (hleft : ∀ t, t < 0 → ∀ x, F (t, x) = 0) + (hright : ∀ t, 1 < t → ∀ x, F (t, x) = G (t, x)) : + BoundedMixedDerivatives F := by + intro α + obtain ⟨C, hC⟩ := (isCompact_Icc.prod hK).bddAbove_image + (mixedDerivative_smooth hF α).continuous.norm.continuousOn + obtain ⟨D, hD, hbD⟩ := boundedMixed_of_compact_periodic hG hK hsG hpG α + refine ⟨max C D, hD.trans (le_max_right _ _), ?_⟩ + rintro ⟨t, x⟩ + by_cases ht0 : t < 0 + · have he : F =ᶠ[𝓝 (t, x)] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_lt_nhds ht0)] with y hy + exact hleft y.1 hy y.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, mixedDerivative_zero, norm_zero] + exact hD.trans (le_max_right _ _) + by_cases ht1 : 1 < t + · have he : F =ᶠ[𝓝 (t, x)] G := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_gt_nhds ht1)] with y hy + exact hright y.1 hy y.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds] + exact (hbD (t, x)).trans (le_max_right _ _) + by_cases hx : x ∈ K + · exact (hC (mem_image_of_mem _ + (show (t, x) ∈ Icc (0 : ℝ) 1 ×ˢ K from + ⟨⟨le_of_not_gt ht0, le_of_not_gt ht1⟩, hx⟩))).trans (le_max_left _ _) + · have hz : mixedDerivative F α (t, x) = 0 := + image_eq_zero_of_notMem_tsupport (f := fun x : Space => mixedDerivative F α (t, x)) + (fun hm => hx (mixedDerivative_common_support hK.isClosed hsF α t hm)) + rw [hz, norm_zero] + exact hD.trans (le_max_right _ _) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanConjugacy.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanConjugacy.lean new file mode 100644 index 0000000000000000000000000000000000000000..b17c92103e7e459860b98a9e325cd252e0f18c92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanConjugacy.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanReverseVariations +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariations + +namespace OAI + +/-! The Euclidean variational equations are transported from the planar +variational equations by the coordinate isometry. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def euclideanLinearOperator : (Plane →L[ℝ] Plane) →L[ℝ] + (EuclideanPlane →L[ℝ] EuclideanPlane) := + (ContinuousLinearMap.compL ℝ EuclideanPlane Plane EuclideanPlane + planeCoordinates.symm.toContinuousLinearMap).comp + ((ContinuousLinearMap.compL ℝ EuclideanPlane Plane Plane).flip + planeCoordinates.toContinuousLinearMap) + +@[simp] theorem euclideanLinearOperator_apply (A : Plane →L[ℝ] Plane) : + euclideanLinearOperator A = euclideanLinear A := rfl + +theorem euclideanMap_smooth {f : Plane → Plane} (hf : ContDiff ℝ ∞ f) : + ContDiff ℝ ∞ (euclideanMap f) := + planeCoordinates.symm.toContinuousLinearMap.contDiff.comp + (hf.comp planeCoordinates.toContinuousLinearMap.contDiff) + +theorem euclideanMap_second_fderiv {f : Plane → Plane} (hf : ContDiff ℝ ∞ f) + (x v w : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (euclideanMap f)) x v w = + planeCoordinates.symm (fderiv ℝ (fderiv ℝ f) (planeCoordinates x) + (planeCoordinates v) (planeCoordinates w)) := by + have he : fderiv ℝ (euclideanMap f) = + fun y => euclideanLinearOperator (fderiv ℝ f (planeCoordinates y)) := by + funext y + exact euclideanMap_fderiv (hf.differentiable (by simp) _) + rw [he] + have hd := euclideanLinearOperator.hasFDerivAt.comp x + (((hf.fderiv_right (m := ∞) (by simp)).differentiable (by simp) _).hasFDerivAt.comp x + planeCoordinates.toContinuousLinearMap.hasFDerivAt) + simp only [Function.comp_def, ContinuousLinearEquiv.coe_coe] at hd + rw [hd.fderiv] + rfl + +theorem PlanarVariations.euclidean {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + (hV : ∀ t, ContDiff ℝ ∞ (V t)) : + EuclideanVariations (fun t => euclideanMap (V t)) + (fun a t => euclideanMap (Ψ a t)) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro a + funext x + simp only [euclideanMap, hv.initial, id_eq, ContinuousLinearEquiv.symm_apply_apply] + · intro a t + exact euclideanMap_smooth (hv.smooth a t) + · intro a x v t + have hd := planeCoordinates.symm.toContinuousLinearMap.hasFDerivAt.comp_hasDerivAt t + (hv.first a (planeCoordinates x) (planeCoordinates v) t) + have he : (fun s => fderiv ℝ (euclideanMap (Ψ a s)) x v) = + fun s => planeCoordinates.symm + (fderiv ℝ (Ψ a s) (planeCoordinates x) (planeCoordinates v)) := by + funext s + rw [euclideanMap_fderiv ((hv.smooth a s).differentiable (by simp) _)] + rfl + rw [he] + simp only [Function.comp_def, ContinuousLinearEquiv.coe_coe] at hd + convert hd using 1 + rw [euclideanMap_fderiv ((hV (a + t)).differentiable (by simp) _), + euclideanMap_fderiv ((hv.smooth a t).differentiable (by simp) _)] + simp only [euclideanLinear, euclideanMap, ContinuousLinearMap.comp_apply, + ContinuousLinearEquiv.coe_coe, ContinuousLinearEquiv.apply_symm_apply] + · intro a x v w t + have hd := planeCoordinates.symm.toContinuousLinearMap.hasFDerivAt.comp_hasDerivAt t + (hv.second a (planeCoordinates x) (planeCoordinates v) (planeCoordinates w) t) + have he : (fun s => fderiv ℝ (fderiv ℝ (euclideanMap (Ψ a s))) x v w) = + fun s => planeCoordinates.symm (fderiv ℝ (fderiv ℝ (Ψ a s)) + (planeCoordinates x) (planeCoordinates v) (planeCoordinates w)) := by + funext s + exact euclideanMap_second_fderiv (hv.smooth a s) x v w + rw [he] + simp only [Function.comp_def, ContinuousLinearEquiv.coe_coe] at hd + convert hd using 1 + rw [euclideanMap_fderiv ((hV (a + t)).differentiable (by simp) _), + euclideanMap_second_fderiv (hv.smooth a t), + euclideanMap_second_fderiv (hV (a + t))] + simp_rw [euclideanMap_fderiv ((hv.smooth a t).differentiable (by simp) _)] + simp only [euclideanLinear, euclideanMap, ContinuousLinearMap.comp_apply, + ContinuousLinearEquiv.coe_coe, ContinuousLinearEquiv.apply_symm_apply, map_add] + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanDerivativeBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..7832086d65f15abb73783109f3bc0af31cb6c0e9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanDerivativeBounds.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPeriodicProperties +import Mathlib.Analysis.InnerProductSpace.PiL2 + +namespace OAI + +/-! Conversion of the processor's derivative bounds to the Euclidean norms +used in the velocity detector. The factor two is deliberately integral and +is computed from the two-dimensional norm comparison. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped NNReal + +abbrev EuclideanPlane := EuclideanSpace ℝ (Fin 2) + +def planeCoordinates : EuclideanPlane ≃L[ℝ] Plane := + letI := ShearFlows.twoAtLeastTwo + PiLp.continuousLinearEquiv 2 ℝ (fun _ : Fin 2 => ℝ) + +theorem planeCoordinates_norm_le (x : EuclideanPlane) : + ‖planeCoordinates x‖ ≤ ‖x‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro i + exact PiLp.norm_apply_le x i + +theorem planeCoordinates_symm_norm_le (x : Plane) : + ‖planeCoordinates.symm x‖ ≤ 2 * ‖x‖ := by + have h0 := norm_le_pi_norm x 0 + have h1 := norm_le_pi_norm x 1 + have h0sq := pow_le_pow_left₀ (norm_nonneg (x 0)) h0 2 + have h1sq := pow_le_pow_left₀ (norm_nonneg (x 1)) h1 2 + have hs := EuclideanSpace.norm_sq_eq (planeCoordinates.symm x) + simp only [Fin.sum_univ_two, planeCoordinates, + PiLp.coe_symm_continuousLinearEquiv, PiLp.toLp_apply] at hs + change ‖WithLp.toLp 2 x‖ ≤ 2 * ‖x‖ + nlinarith [norm_nonneg x, norm_nonneg (WithLp.toLp 2 x), + norm_nonneg (x 0), norm_nonneg (x 1)] + +def euclideanMap (f : Plane → Plane) : EuclideanPlane → EuclideanPlane := + fun x => planeCoordinates.symm (f (planeCoordinates x)) + +def euclideanLinear (A : Plane →L[ℝ] Plane) : EuclideanPlane →L[ℝ] EuclideanPlane := + planeCoordinates.symm.toContinuousLinearMap.comp + (A.comp planeCoordinates.toContinuousLinearMap) + +theorem euclideanLinear_norm_le (A : Plane →L[ℝ] Plane) : + ‖euclideanLinear A‖ ≤ 2 * ‖A‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro x + calc + ‖euclideanLinear A x‖ ≤ 2 * ‖A (planeCoordinates x)‖ := + planeCoordinates_symm_norm_le _ + _ ≤ 2 * (‖A‖ * ‖planeCoordinates x‖) := by + gcongr + exact A.le_opNorm _ + _ ≤ 2 * (‖A‖ * ‖x‖) := by + gcongr + exact planeCoordinates_norm_le x + _ = _ := by ring + +theorem euclideanMap_fderiv {f : Plane → Plane} {x : EuclideanPlane} + (hf : DifferentiableAt ℝ f (planeCoordinates x)) : + fderiv ℝ (euclideanMap f) x = euclideanLinear (fderiv ℝ f (planeCoordinates x)) := by + exact (planeCoordinates.symm.toContinuousLinearMap.hasFDerivAt.comp x + (hf.hasFDerivAt.comp x planeCoordinates.toContinuousLinearMap.hasFDerivAt)).fderiv + +theorem euclideanLinear_sub (A B : Plane →L[ℝ] Plane) : + euclideanLinear (A - B) = euclideanLinear A - euclideanLinear B := by + ext x + simp [euclideanLinear] + +theorem euclideanLinear_lipschitz : LipschitzWith 2 euclideanLinear := by + apply LipschitzWith.of_dist_le_mul + intro A B + simpa only [dist_eq_norm, ← euclideanLinear_sub, NNReal.coe_ofNat] using + euclideanLinear_norm_le (A - B) + +theorem planeCoordinates_lipschitz : LipschitzWith 1 planeCoordinates := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm, ← map_sub, NNReal.coe_one, one_mul] using + planeCoordinates_norm_le (x - y) + +theorem euclideanMap_second_bound {f : Plane → Plane} {K : ℝ≥0} + (hf : Differentiable ℝ f) (hK : LipschitzWith K (fderiv ℝ f)) + (x : EuclideanPlane) : + ‖fderiv ℝ (fderiv ℝ (euclideanMap f)) x‖ ≤ 2 * (K : ℝ) := by + have he : fderiv ℝ (euclideanMap f) = + fun y => euclideanLinear (fderiv ℝ f (planeCoordinates y)) := + funext fun y => euclideanMap_fderiv (hf _) + rw [he] + have h := euclideanLinear_lipschitz.comp (hK.comp planeCoordinates_lipschitz) + simpa only [Function.comp_def, mul_one, NNReal.coe_mul, NNReal.coe_ofNat] using + norm_fderiv_le_of_lipschitz ℝ h + +def euclideanVariationCoefficient (H : FieldExpr) : ℕ := + 2 * planarVariationCoefficient H + +theorem planar_euclidean_derivative_bounds {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : EuclideanPlane) : + ‖fderiv ℝ (euclideanMap (planarSlice H s)) x‖ ≤ + (euclideanVariationCoefficient H : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (planarSlice H s))) x‖ ≤ + (euclideanVariationCoefficient H : ℝ) := by + have hf := (planarSlice_smooth hH s).differentiable (by simp) + constructor + · rw [euclideanMap_fderiv (hf _)] + apply (euclideanLinear_norm_le _).trans + have hb := (planar_derivative_bounds hH hT s (planeCoordinates x)).1 + simp only [euclideanVariationCoefficient, Nat.cast_mul, Nat.cast_ofNat] + exact mul_le_mul_of_nonneg_left hb (by norm_num) + · have hb := euclideanMap_second_bound hf (planarSlice_fderiv_lipschitz hH hT s) x + simp only [euclideanVariationCoefficient, planarVariationCoefficient, + Nat.cast_mul, Nat.cast_ofNat, Nat.cast_add, Nat.cast_one, NNReal.coe_natCast] at * + have hk : (0 : ℝ) ≤ suspensionLipschitzBound H := Nat.cast_nonneg _ + linarith + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanFlowBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanFlowBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..95db6dff60c138819b0bc1b534ee04e36304026e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanFlowBounds.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanConjugacy + +namespace OAI + +/-! The Euclidean quantitative clause of the planar-processor theorem, with +one computed integer bounding the spatial derivatives. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff + +theorem euclideanFlowBound_one_le (H : FieldExpr) : 1 ≤ euclideanFlowBound H := by + have hp := planarVariationCoefficient_pos H + unfold euclideanFlowBound euclideanVariationCoefficient + omega + +theorem euclidean_field_bounds {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : EuclideanPlane) : + ‖fderiv ℝ (euclideanMap (planarSlice H s)) x‖ ≤ (euclideanFlowBound H : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (planarSlice H s))) x‖ ≤ + (euclideanFlowBound H : ℝ) := by + have hb := planar_euclidean_derivative_bounds hH hT s x + have hle : (euclideanVariationCoefficient H : ℝ) ≤ (euclideanFlowBound H : ℝ) := by + unfold euclideanFlowBound + push_cast + nlinarith [show (0 : ℝ) ≤ euclideanVariationCoefficient H from Nat.cast_nonneg _] + exact ⟨hb.1.trans hle, hb.2.trans hle⟩ + +theorem planar_euclidean_flow_estimates {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ω : ℝ → ℝ → Plane → Plane} + (hv : PlanarVariations (planarSlice H) Ω) : + 1 ≤ euclideanFlowBound H ∧ + (∀ s x, ‖fderiv ℝ (euclideanMap (planarSlice H s)) x‖ ≤ (euclideanFlowBound H : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (planarSlice H s))) x‖ ≤ (euclideanFlowBound H : ℝ)) ∧ + ∀ a t, 0 ≤ t → + (∀ x, (‖fderiv ℝ (euclideanMap (Ω a t)) x‖ ≤ Real.exp ((euclideanFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ω a t))) x‖ ≤ + Real.exp (2 * (euclideanFlowBound H : ℝ) * t) - + Real.exp ((euclideanFlowBound H : ℝ) * t)) ∧ + (‖fderiv ℝ (euclideanMap (Ω (a + t) (-t))) x‖ ≤ Real.exp ((euclideanFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ω (a + t) (-t)))) x‖ ≤ + Real.exp (2 * (euclideanFlowBound H : ℝ) * t) - + Real.exp ((euclideanFlowBound H : ℝ) * t))) ∧ + (∀ x y, dist (euclideanMap (Ω a t) x) (euclideanMap (Ω a t) y) ≤ + Real.exp ((euclideanFlowBound H : ℝ) * t) * dist x y) := by + have he := hv.euclidean (fun s => planarSlice_smooth hH s) + refine ⟨euclideanFlowBound_one_le H, euclidean_field_bounds hH hT, ?_⟩ + intro a t ht + constructor + · intro x + exact ⟨euclidean_quantitative_variations hH hT he a x ht, + euclidean_inverse_estimates hH hT he a x ht⟩ + · intro x y + have h := Convex.norm_image_sub_le_of_norm_fderiv_le (s := (univ : Set EuclideanPlane)) + (fun z _ => (he.smooth a t).differentiable (by simp) z) + (fun z _ => (euclidean_quantitative_variations hH hT he a z ht).1) + (convex_univ : Convex ℝ (univ : Set EuclideanPlane)) (mem_univ y) (mem_univ x) + simpa only [dist_eq_norm] using h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanReverseVariations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanReverseVariations.lean new file mode 100644 index 0000000000000000000000000000000000000000..f838e1d5db9008952920964efe71c26c03c80fd2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanReverseVariations.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanVariations + +namespace OAI + +/-! The same variational input controls reverse transitions. No separate +regularity hypothesis for an inverse map is needed. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows + +theorem euclidean_second_fderiv_fun_neg (f : EuclideanPlane → EuclideanPlane) (x : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (fun y => -f y)) x = -(fderiv ℝ (fderiv ℝ f) x) := by + have he : fderiv ℝ (fun y => -f y) = fun y => -(fderiv ℝ f y) := by + funext y + exact fderiv_fun_neg + rw [he] + exact fderiv_fun_neg + +theorem EuclideanVariations.reverse {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) : + EuclideanVariations (fun s x => -V (-s) x) (fun a t => Ψ (-a) (-t)) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro a + simpa only [neg_zero] using hv.initial (-a) + · intro a t + exact hv.smooth (-a) (-t) + · intro a x v t + have hd := (hv.first (-a) x v (-t)).scomp t (hasDerivAt_id t).neg + simpa only [Function.comp_def, neg_one_smul, fderiv_fun_neg, fderiv_neg, + Pi.neg_apply, neg_apply, neg_add] using hd + · intro a x v w t + have hd := (hv.second (-a) x v w (-t)).scomp t (hasDerivAt_id t).neg + simpa only [Function.comp_def, neg_one_smul, euclidean_second_fderiv_fun_neg, fderiv_fun_neg, fderiv_neg, + Pi.neg_apply, neg_apply, neg_add] using hd + +theorem euclidean_first_variation_reverse {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a (-t)) x‖ ≤ Real.exp (K * t) := by + have h := euclidean_first_variation_operator hv.reverse + (fun s y => by simpa only [fderiv_fun_neg, norm_neg] using hb (-s) y) (-a) x ht + simpa only [neg_neg] using h + +theorem euclidean_second_variation_reverse {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a (-t))) x‖ ≤ + Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + have hb₂' (s : ℝ) (y : EuclideanPlane) : + ‖fderiv ℝ (fderiv ℝ (fun x => -V (-s) x)) y‖ ≤ K := by + have he := euclidean_second_fderiv_fun_neg (V (-s)) y + have hn := norm_neg (fderiv ℝ (fderiv ℝ (V (-s))) y) + exact (congrArg norm he).le.trans (hn.le.trans (hb₂ (-s) y)) + have h := euclidean_second_variation_operator hv.reverse hK + (fun s y => by simpa only [fderiv_fun_neg, norm_neg] using hb₁ (-s) y) + hb₂' (-a) x ht + simpa only [neg_neg] using h + +theorem euclidean_inverse_estimates {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} + (hv : EuclideanVariations (fun s => euclideanMap (planarSlice H s)) Ψ) (a : ℝ) (x : EuclideanPlane) {t : ℝ} + (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ (a + t) (-t)) x‖ ≤ Real.exp ((euclideanFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ (a + t) (-t))) x‖ ≤ + Real.exp (2 * (euclideanFlowBound H : ℝ) * t) - + Real.exp ((euclideanFlowBound H : ℝ) * t) := by + have hK : (0 : ℝ) < euclideanVariationCoefficient H := by + have hp := planarVariationCoefficient_pos H + unfold euclideanVariationCoefficient + exact_mod_cast Nat.mul_pos (by decide : 0 < 2) hp + have hb₁ := fun s y => (planar_euclidean_derivative_bounds hH hT s y).1 + have hb₂ := fun s y => (planar_euclidean_derivative_bounds hH hT s y).2 + constructor + · apply (euclidean_first_variation_reverse hv hb₁ (a + t) x ht).trans + apply Real.exp_le_exp.mpr + simp only [euclideanFlowBound, Nat.cast_mul, Nat.cast_ofNat] + nlinarith + · have h := euclidean_second_variation_reverse hv hK hb₁ hb₂ (a + t) x ht + simp only [euclideanFlowBound, Nat.cast_mul, Nat.cast_ofNat] + rw [show 2 * (2 * (euclideanVariationCoefficient H : ℝ)) * t = + 4 * (euclideanVariationCoefficient H : ℝ) * t by ring] + exact h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanVariations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanVariations.lean new file mode 100644 index 0000000000000000000000000000000000000000..14e64a950b8605f5ce931723276bec19dc1337e7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/EuclideanVariations.lean @@ -0,0 +1,219 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanDerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SecondVariationSharp + +namespace OAI + +/-! The Euclidean specialization of the smooth-dependence equations +(Teschl, Theorem 2.10, equations (2.49)--(2.51)). These equations concern the +actual Euclidean-coordinate transition; the estimates are proved here. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff + +/-- The first two variational equations for a transition map. The second +time argument is elapsed time; the first is its initial phase. -/ +structure EuclideanVariations (V : ℝ → EuclideanPlane → EuclideanPlane) + (Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane) : Prop where + initial : ∀ a, Ψ a 0 = id + smooth : ∀ a t, ContDiff ℝ ∞ (Ψ a t) + first : ∀ a x v t, + HasDerivAt (fun s => fderiv ℝ (Ψ a s) x v) + (fderiv ℝ (V (a + t)) (Ψ a t x) (fderiv ℝ (Ψ a t) x v)) t + second : ∀ a x v w t, + HasDerivAt (fun s => fderiv ℝ (fderiv ℝ (Ψ a s)) x v w) + (fderiv ℝ (V (a + t)) (Ψ a t x) (fderiv ℝ (fderiv ℝ (Ψ a t)) x v w) + + fderiv ℝ (fderiv ℝ (V (a + t))) (Ψ a t x) + (fderiv ℝ (Ψ a t) x v) (fderiv ℝ (Ψ a t) x w)) t + +theorem euclidean_first_variation_vector {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x v : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x v‖ ≤ ‖v‖ * Real.exp (K * t) := by + apply first_variation_bound_mul ht + (fun s _ => (hv.first a x v s).continuousAt.continuousWithinAt) + (fun s _ => hv.first a x v s) + · rw [hv.initial] + simp + · intro s _ + exact ((fderiv ℝ (V (a + s)) (Ψ a s x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (hb _ _) (norm_nonneg _)) + +theorem euclidean_first_variation_operator {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x‖ ≤ Real.exp (K * t) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Real.exp_pos _).le + intro v + simpa only [mul_comm] using euclidean_first_variation_vector hv hb a x v ht + +theorem euclidean_second_variation_vector {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x v w : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x v w‖ ≤ + (‖v‖ * ‖w‖) * (Real.exp (4 * K * t) - Real.exp (2 * K * t)) := by + apply second_variation_bound_mul hK (mul_nonneg (norm_nonneg v) (norm_nonneg w)) ht + (fun s _ => (hv.second a x v w s).continuousAt.continuousWithinAt) + (fun s _ => hv.second a x v w s) + · rw [hv.initial] + have he : fderiv ℝ (id : EuclideanPlane → EuclideanPlane) = + fun _ => ContinuousLinearMap.id ℝ EuclideanPlane := funext fun _ => fderiv_id + rw [he] + simp + · intro s hs + have hjv := euclidean_first_variation_vector hv hb₁ a x v hs.1 + have hjw := euclidean_first_variation_vector hv hb₁ a x w hs.1 + have he : Real.exp (K * s) * Real.exp (K * s) = Real.exp (2 * K * s) := by + rw [← Real.exp_add] + congr 1 + ring + calc + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w) + + fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ ≤ + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w)‖ + + ‖fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ := norm_add_le _ _ + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * ‖fderiv ℝ (Ψ a s) x v‖ * ‖fderiv ℝ (Ψ a s) x w‖ := by + apply add_le_add + · exact ((fderiv ℝ (V (a + s)) (Ψ a s x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (hb₁ _ _) (norm_nonneg _)) + · exact ((fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x)).le_opNorm₂ _ _).trans + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (hb₂ _ _) (norm_nonneg _)) (norm_nonneg _)) + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * (‖v‖ * Real.exp (K * s)) * (‖w‖ * Real.exp (K * s)) := by + gcongr + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * Real.exp (2 * K * s) := by + calc + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * (Real.exp (K * s) * Real.exp (K * s)) := by ring + _ = _ := by rw [he] + +theorem euclidean_second_variation_operator {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ + Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + have hq : 0 ≤ Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + apply sub_nonneg.mpr + apply Real.exp_le_exp.mpr + nlinarith + apply ContinuousLinearMap.opNorm_le_bound _ hq + intro v + apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg hq (norm_nonneg v)) + intro w + calc + _ ≤ (‖v‖ * ‖w‖) * (Real.exp (4 * K * t) - Real.exp (2 * K * t)) := + euclidean_second_variation_vector hv hK hb₁ hb₂ a x v w ht + _ = _ := by ring + +theorem euclidean_second_variation_sharp_vector {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x v w : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x v w‖ ≤ + (‖v‖ * ‖w‖) * K * t * Real.exp (3 * K * t) := by + apply second_variation_bound_sharp_mul hK (mul_nonneg (norm_nonneg v) (norm_nonneg w)) ht + (fun s _ => (hv.second a x v w s).continuousAt.continuousWithinAt) + (fun s _ => hv.second a x v w s) + · rw [hv.initial] + have he : fderiv ℝ (id : EuclideanPlane → EuclideanPlane) = + fun _ => ContinuousLinearMap.id ℝ EuclideanPlane := funext fun _ => fderiv_id + rw [he] + simp + · intro s hs + have hjv := euclidean_first_variation_vector hv hb₁ a x v hs.1 + have hjw := euclidean_first_variation_vector hv hb₁ a x w hs.1 + have he : Real.exp (K * s) * Real.exp (K * s) = Real.exp (2 * K * s) := by + rw [← Real.exp_add] + congr 1 + ring + calc + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w) + + fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ ≤ + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w)‖ + + ‖fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ := norm_add_le _ _ + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * ‖fderiv ℝ (Ψ a s) x v‖ * ‖fderiv ℝ (Ψ a s) x w‖ := by + apply add_le_add + · exact ((fderiv ℝ (V (a + s)) (Ψ a s x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (hb₁ _ _) (norm_nonneg _)) + · exact ((fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x)).le_opNorm₂ _ _).trans + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (hb₂ _ _) (norm_nonneg _)) (norm_nonneg _)) + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * (‖v‖ * Real.exp (K * s)) * (‖w‖ * Real.exp (K * s)) := by + gcongr + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * Real.exp (2 * K * s) := by + calc + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * (Real.exp (K * s) * Real.exp (K * s)) := by ring + _ = _ := by rw [he] + + +theorem euclidean_second_variation_sharp_operator {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ K * t * Real.exp (3 * K * t) := by + have hq : 0 ≤ K * t * Real.exp (3 * K * t) := by positivity + apply ContinuousLinearMap.opNorm_le_bound _ hq + intro v + apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg hq (norm_nonneg v)) + intro w + calc + _ ≤ (‖v‖ * ‖w‖) * K * t * Real.exp (3 * K * t) := + euclidean_second_variation_sharp_vector hv hK hb₁ hb₂ a x v w ht + _ = _ := by ring + +def euclideanFlowBound (H : FieldExpr) : ℕ := 2 * euclideanVariationCoefficient H + +theorem euclidean_quantitative_variations {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} + (hv : EuclideanVariations (fun s => euclideanMap (planarSlice H s)) Ψ) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x‖ ≤ Real.exp ((euclideanFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ + Real.exp (2 * (euclideanFlowBound H : ℝ) * t) - + Real.exp ((euclideanFlowBound H : ℝ) * t) := by + have hK : (0 : ℝ) < euclideanVariationCoefficient H := by + have hp := planarVariationCoefficient_pos H + unfold euclideanVariationCoefficient + exact_mod_cast Nat.mul_pos (by decide : 0 < 2) hp + have hb₁ := fun s y => (planar_euclidean_derivative_bounds hH hT s y).1 + have hb₂ := fun s y => (planar_euclidean_derivative_bounds hH hT s y).2 + constructor + · apply (euclidean_first_variation_operator hv hb₁ a x ht).trans + apply Real.exp_le_exp.mpr + simp only [euclideanFlowBound, Nat.cast_mul, Nat.cast_ofNat] + nlinarith + · have h := euclidean_second_variation_operator hv hK hb₁ hb₂ a x ht + simp only [euclideanFlowBound, Nat.cast_mul, Nat.cast_ofNat] + rw [show 2 * (2 * (euclideanVariationCoefficient H : ℝ)) * t = + 4 * (euclideanVariationCoefficient H : ℝ) * t by ring] + exact h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowMixedPartials.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowMixedPartials.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3f1535971a87fed6ede266fa76245d990ba2462 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowMixedPartials.lean @@ -0,0 +1,76 @@ +import Mathlib.Analysis.Calculus.ContDiff.Comp +import Mathlib.Analysis.Calculus.FDeriv.Symmetric +import Mathlib.Analysis.Calculus.Deriv.Mul +import Mathlib.Analysis.Calculus.Deriv.Prod + +namespace OAI + +/-! Commutation of a time derivative and an initial-point derivative. +These lemmas turn joint smoothness of an actual flow into its variational +equations, without an additional smooth-dependence input. -/ + +noncomputable section +namespace ForcedComputation.Flow +open scoped ContDiff + +variable {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem spaceDerivative_eq {G : ℝ × E → F} (hG : ContDiff ℝ ∞ G) + (t : ℝ) (x v : E) : + fderiv ℝ (fun y => G (t, y)) x v = fderiv ℝ G (t, x) (0, v) := by + have hd := ((hG.differentiable (by simp) (t, x)).hasFDerivAt.comp x + (hasFDerivAt_prodMk_right t x)).fderiv + exact congrArg (fun A : E →L[ℝ] F => A v) hd + +theorem timeDerivative_eq {G : ℝ × E → F} (hG : ContDiff ℝ ∞ G) + (t : ℝ) (x : E) : + deriv (fun s => G (s, x)) t = fderiv ℝ G (t, x) (1, 0) := by + exact ((hG.differentiable (by simp) (t, x)).hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x))).deriv + +theorem spaceDerivative_smooth {G : ℝ × E → F} (hG : ContDiff ℝ ∞ G) (v : E) : + ContDiff ℝ ∞ (fun p : ℝ × E => fderiv ℝ (fun y => G (p.1, y)) p.2 v) := by + have he : (fun p : ℝ × E => fderiv ℝ (fun y => G (p.1, y)) p.2 v) = + fun p => fderiv ℝ G p (0, v) := by + funext p + exact spaceDerivative_eq hG p.1 p.2 v + rw [he] + exact (hG.fderiv_right (by simp)).clm_apply contDiff_const + +theorem time_space_commute {G : ℝ × E → F} (hG : ContDiff ℝ ∞ G) + (t : ℝ) (x v : E) : + HasDerivAt (fun s => fderiv ℝ (fun y => G (s, y)) x v) + (fderiv ℝ (fun y => deriv (fun s => G (s, y)) t) x v) t := by + have hD : ContDiff ℝ ∞ (fderiv ℝ G) := hG.fderiv_right (by simp) + have ht := (hD.differentiable (by simp) (t, x)).hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + have htv := ht.clm_apply (hasDerivAt_const t (0, v)) + simp only [map_zero, add_zero, Function.comp_def, id_eq] at htv + have he : (fun s => fderiv ℝ (fun y => G (s, y)) x v) = + fun s => fderiv ℝ G (s, x) (0, v) := by + funext s + exact spaceDerivative_eq hG s x v + rw [he] + have htime : (fun y => deriv (fun s => G (s, y)) t) = + fun y => fderiv ℝ G (t, y) (1, 0) := by + funext y + exact timeDerivative_eq hG t y + rw [htime] + have hx := (hD.differentiable (by simp) (t, x)).hasFDerivAt.comp x + (hasFDerivAt_prodMk_right t x) + have hxv := congrArg (fun A : E →L[ℝ] F => A v) + (hx.clm_apply (hasFDerivAt_const (1, 0) x)).fderiv + simp only [add_apply, ContinuousLinearMap.comp_apply, + zero_apply, map_zero, zero_add, ContinuousLinearMap.flip_apply, + ContinuousLinearMap.inr_apply, Function.comp_def] at hxv + rw [hxv] + have hs := (hG.contDiffAt (x := (t, x))).isSymmSndFDerivAt (by simp) (1, 0) (0, v) + rw [← hs] + exact htv + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowNonautonomous.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowNonautonomous.lean new file mode 100644 index 0000000000000000000000000000000000000000..60f297431951f9e383b436df50392f52823cd02b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowNonautonomous.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowSmooth + +namespace OAI + +/-! Smooth dependence on the initial phase for a nonautonomous equation, +obtained by adjoining phase as an autonomous coordinate. -/ + +noncomputable section +namespace ForcedComputation.Flow +open scoped ContDiff NNReal + +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [CompleteSpace E] + +theorem transition_contDiff (V : C(ℝ × E, E)) + (hV : ContDiff ℝ ∞ (V : ℝ × E → E)) {L : ℝ≥0} + (hL : LipschitzWith L V) {Ω : ℝ → ℝ → E → E} + (hode : ∀ a t x, HasDerivAt (fun s => Ω a s x) (V (a + t, Ω a t x)) t) + (hzero : ∀ a x, Ω a 0 x = x) : + ContDiff ℝ ∞ (fun p : ℝ × (ℝ × E) => Ω p.1 p.2.1 p.2.2) := by + let Z : C(ℝ × E, ℝ × E) := + ⟨fun p => (1, V p), continuous_const.prodMk V.continuous⟩ + have hZ : ContDiff ℝ ∞ (Z : ℝ × E → ℝ × E) := contDiff_const.prodMk hV + have hZL : LipschitzWith L Z := by + change LipschitzWith L (fun p : ℝ × E => ((1 : ℝ), V p)) + simpa only [max_eq_right (show (0 : ℝ≥0) ≤ L from bot_le)] using + (LipschitzWith.const (1 : ℝ)).prodMk hL + let Ψ : ℝ → (ℝ × E) → ℝ × E := fun t p => (p.1 + t, Ω p.1 t p.2) + have hΨ (t : ℝ) (p : ℝ × E) : + HasDerivAt (fun s => Ψ s p) (Z (Ψ t p)) t := + ((hasDerivAt_id t).const_add p.1).prodMk (hode p.1 t p.2) + have hi (p : ℝ × E) : Ψ 0 p = p := by simp only [Ψ, add_zero, hzero] + have hs := flow_contDiff Z hZ hZL hΨ hi + have hq : ContDiff ℝ ∞ (fun p : ℝ × (ℝ × E) => (p.2.1, (p.1, p.2.2))) := + contDiff_snd.fst.prodMk (contDiff_fst.prodMk contDiff_snd.snd) + exact hs.snd.comp hq + +theorem transition_backward_contDiff (V : C(ℝ × E, E)) + (hV : ContDiff ℝ ∞ (V : ℝ × E → E)) {L : ℝ≥0} + (hL : LipschitzWith L V) {Ω : ℝ → ℝ → E → E} + (hode : ∀ a t x, HasDerivAt (fun s => Ω a s x) (V (a + t, Ω a t x)) t) + (hzero : ∀ a x, Ω a 0 x = x) : + ContDiff ℝ ∞ (fun p : ℝ × E => Ω p.1 (-p.1) p.2) := + (transition_contDiff V hV hL hode hzero).comp + (contDiff_fst.prodMk (contDiff_fst.neg.prodMk contDiff_snd)) + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPathIntegral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPathIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..df86f7177aaf87907b9f60b99ee802437e50dd65 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPathIntegral.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowPointwise +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus +import Mathlib.Topology.Order.ProjIcc + +namespace OAI + +/-! Integration on the fixed unit interval as a bounded linear operator. +This permits elapsed time to be a parameter of the Picard equation. -/ + +noncomputable section +namespace ForcedComputation.Flow +open Set MeasureTheory +open scoped Topology + +abbrev UnitTime := Icc (0 : ℝ) 1 + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] + +def extendPath (u : C(UnitTime, E)) : C(ℝ, E) := + u.comp ⟨projIcc 0 1 zero_le_one, continuous_projIcc⟩ + +omit [NormedSpace ℝ E] [CompleteSpace E] in +@[simp] theorem extendPath_apply (u : C(UnitTime, E)) (t : ℝ) : + extendPath u t = u (projIcc 0 1 zero_le_one t) := rfl + +omit [NormedSpace ℝ E] [CompleteSpace E] in +@[simp] theorem extendPath_coe (u : C(UnitTime, E)) (t : UnitTime) : + extendPath u t = u t := by simp [extendPath] + +def primitivePath (u : C(UnitTime, E)) : C(UnitTime, E) := + ⟨fun t => ∫ s in (0 : ℝ)..t.1, extendPath u s, + (continuous_iff_continuousAt.mpr fun t => + ((extendPath u).continuous.integral_hasStrictDerivAt 0 t).hasDerivAt.continuousAt).comp + continuous_subtype_val⟩ + +@[simp] theorem primitivePath_apply (u : C(UnitTime, E)) (t : UnitTime) : + primitivePath u t = ∫ s in (0 : ℝ)..t.1, extendPath u s := rfl + +theorem primitivePath_norm (u : C(UnitTime, E)) : ‖primitivePath u‖ ≤ ‖u‖ := by + apply (ContinuousMap.norm_le _ (norm_nonneg u)).mpr + intro t + calc + ‖primitivePath u t‖ ≤ ‖u‖ * |t.1 - 0| := + intervalIntegral.norm_integral_le_of_norm_le_const fun s _ => + u.norm_coe_le_norm _ + _ ≤ ‖u‖ := by + rw [sub_zero, abs_of_nonneg t.2.1] + exact mul_le_of_le_one_right (norm_nonneg u) t.2.2 + +def primitivePathL : C(UnitTime, E) →L[ℝ] C(UnitTime, E) := + LinearMap.mkContinuous + { toFun := primitivePath + map_add' := by + intro u v + ext t + change (∫ s in (0 : ℝ)..t.1, extendPath u s + extendPath v s) = _ + exact intervalIntegral.integral_add + ((extendPath u).continuous.intervalIntegrable _ _) + ((extendPath v).continuous.intervalIntegrable _ _) + map_smul' := by + intro c u + ext t + change (∫ s in (0 : ℝ)..t.1, c • extendPath u s) = _ + exact intervalIntegral.integral_smul c (extendPath u) } + 1 (by + intro u + change ‖primitivePath u‖ ≤ (1 : ℝ) * ‖u‖ + rw [one_mul] + exact primitivePath_norm u) + +@[simp] theorem primitivePathL_apply (u : C(UnitTime, E)) : + primitivePathL u = primitivePath u := rfl + +theorem primitivePathL_norm : ‖primitivePathL (E := E)‖ ≤ 1 := + LinearMap.mkContinuous_norm_le _ zero_le_one _ + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..55d68cd736d27952cc1c204cebd4ad188b5270b0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSmooth.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowSuperposition +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowPathIntegral +import Mathlib.Analysis.Calculus.ImplicitContDiff +import Mathlib.Analysis.Normed.Operator.Banach +import Mathlib.Analysis.SpecificLimits.Normed + +namespace OAI + +/-! Smooth Picard residual on a fixed unit interval. The elapsed time is a +parameter, so evaluating the solution at the endpoint is a bounded linear map. -/ + +noncomputable section +namespace ForcedComputation.Flow +open Set +open scoped Topology ContDiff + +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [CompleteSpace E] + +def picardResidual (Z : C(E, E)) (p : (ℝ × E) × C(UnitTime, E)) : C(UnitTime, E) := + p.2 - ContinuousLinearMap.const ℝ UnitTime p.1.2 - + p.1.1 • primitivePathL (postcompose Z p.2) + +theorem picardResidual_smooth (Z : C(E, E)) (hZ : ContDiff ℝ ∞ (Z : E → E)) : + ContDiff ℝ ∞ (picardResidual Z) := by + have ht : ContDiff ℝ ∞ (fun p : (ℝ × E) × C(UnitTime, E) => p.1.1) := + contDiff_fst.fst + have hx : ContDiff ℝ ∞ (fun p : (ℝ × E) × C(UnitTime, E) => p.1.2) := + contDiff_fst.snd + have hγ : ContDiff ℝ ∞ (fun p : (ℝ × E) × C(UnitTime, E) => p.2) := contDiff_snd + exact (hγ.sub ((ContinuousLinearMap.const ℝ UnitTime).contDiff.comp hx)).sub + (ht.smul ((primitivePathL (E := E)).contDiff.comp + ((postcompose_contDiff Z hZ).comp hγ))) + +def picardPathDerivative (Z : C(E, E)) (hZ : ContDiff ℝ ∞ (Z : E → E)) + (τ : ℝ) (γ : C(UnitTime, E)) : C(UnitTime, E) →L[ℝ] C(UnitTime, E) := + 1 - τ • primitivePathL.comp + (applyPath ⟨fun s => fderiv ℝ Z (γ s), + (hZ.continuous_fderiv (by simp)).comp γ.continuous⟩) + +theorem picardResidual_hasFDerivAt_path (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) (τ : ℝ) (x : E) (γ : C(UnitTime, E)) : + HasFDerivAt (fun η => picardResidual Z ((τ, x), η)) + (picardPathDerivative Z hZ τ γ) γ := by + have hs := postcompose_hasFDerivAt Z (hZ.of_le (by simp)) γ + have hp := primitivePathL.hasFDerivAt.comp γ hs + exact ((hasFDerivAt_id γ).sub_const (ContinuousLinearMap.const ℝ UnitTime x)).sub + (hp.const_smul τ) + +omit [FiniteDimensional ℝ E] in +theorem isInvertible_one_sub_of_norm_lt_one + {A : C(UnitTime, E) →L[ℝ] C(UnitTime, E)} (hA : ‖A‖ < 1) : + (1 - A).IsInvertible := by + obtain ⟨u, hu⟩ := isUnit_one_sub_of_norm_lt_one (x := A) hA + refine ⟨ContinuousLinearEquiv.unitsEquiv ℝ _ u, ?_⟩ + exact hu + +omit [FiniteDimensional ℝ E] in +theorem picardPathDerivative_invertible (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) {L τ : ℝ} + (hL : 0 ≤ L) (hbound : ∀ x, ‖fderiv ℝ Z x‖ ≤ L) + (hτ : |τ| * L < 1) (γ : C(UnitTime, E)) : + (picardPathDerivative Z hZ τ γ).IsInvertible := by + apply isInvertible_one_sub_of_norm_lt_one + let A : C(UnitTime, E →L[ℝ] E) := + ⟨fun s => fderiv ℝ Z (γ s), + (hZ.continuous_fderiv (by simp)).comp γ.continuous⟩ + have hA : ‖A‖ ≤ L := (ContinuousMap.norm_le _ hL).mpr fun s => hbound (γ s) + calc + ‖τ • primitivePathL.comp (applyPath A)‖ + ≤ |τ| * ‖primitivePathL.comp (applyPath A)‖ := by + simpa only [Real.norm_eq_abs] using + ContinuousLinearMap.opNorm_smul_le τ (primitivePathL.comp (applyPath A)) + _ ≤ |τ| * (‖primitivePathL (E := E)‖ * ‖applyPath A‖) := + mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le _ _) (abs_nonneg τ) + _ ≤ |τ| * (1 * L) := by + gcongr + · exact primitivePathL_norm + · exact (applyPath_norm A).trans hA + _ < 1 := by simpa only [one_mul] using hτ + +theorem picardResidual_partial (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) (τ : ℝ) (x : E) (γ : C(UnitTime, E)) : + fderiv ℝ (picardResidual Z) ((τ, x), γ) ∘L + ContinuousLinearMap.inr ℝ (ℝ × E) C(UnitTime, E) = + picardPathDerivative Z hZ τ γ := by + have hp : HasFDerivAt (fun η : C(UnitTime, E) => ((τ, x), η)) + (ContinuousLinearMap.inr ℝ (ℝ × E) C(UnitTime, E)) γ := by + simpa only [ContinuousLinearMap.inr_apply, Prod.mk_add_mk, add_zero, zero_add] using + ((ContinuousLinearMap.inr ℝ (ℝ × E) C(UnitTime, E)).hasFDerivAt (x := γ)).const_add + ((τ, x), 0) + have hd := ((picardResidual_smooth Z hZ).differentiable (by simp) ((τ, x), γ)).hasFDerivAt.comp γ hp + exact hd.unique (picardResidual_hasFDerivAt_path Z hZ τ x γ) + +/-- A short Picard solution belongs to a smooth local family of Picard solutions. +The family is obtained from the library implicit-function theorem. -/ +theorem exists_local_picard_family (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) {L τ : ℝ} + (hL : 0 ≤ L) (hbound : ∀ x, ‖fderiv ℝ Z x‖ ≤ L) + (hτ : |τ| * L < 1) (x : E) (γ : C(UnitTime, E)) + (hγ : picardResidual Z ((τ, x), γ) = 0) : + ∃ Γ : (ℝ × E) → C(UnitTime, E), + ContDiffAt ℝ ∞ Γ (τ, x) ∧ Γ (τ, x) = γ ∧ + ∀ᶠ p in 𝓝 (τ, x), picardResidual Z (p, Γ p) = 0 := by + have hc := (picardResidual_smooth Z hZ).contDiffAt (x := ((τ, x), γ)) + have hi : (fderiv ℝ (picardResidual Z) ((τ, x), γ) ∘L + ContinuousLinearMap.inr ℝ (ℝ × E) C(UnitTime, E)).IsInvertible := by + rw [picardResidual_partial Z hZ] + exact picardPathDerivative_invertible Z hZ hL hbound hτ γ + refine ⟨hc.implicitFunction (by simp) hi, + hc.contDiffAt_implicitFunction (by simp) hi, + hc.implicitFunction_apply_self (by simp) hi, ?_⟩ + filter_upwards [hc.eventually_apply_implicitFunction (by simp) hi] with p hp + exact hp.trans hγ + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..6df2f7c58a4ea52afd305f081f15b53796ac1ba5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPicardSolution.lean @@ -0,0 +1,125 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowPicardSmooth + +namespace OAI + +/-! Identification of the local implicit Picard family with an actual flow. +The short-time uniqueness proof is a norm estimate in the compact path space. -/ + +noncomputable section +namespace ForcedComputation.Flow +open Set Filter +open scoped Topology ContDiff NNReal + +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [CompleteSpace E] + +omit [FiniteDimensional ℝ E] [CompleteSpace E] [NormedSpace ℝ E] in +theorem postcompose_norm_sub_le (Z : C(E, E)) {L : ℝ≥0} + (hZ : LipschitzWith L Z) (γ η : C(UnitTime, E)) : + ‖postcompose Z γ - postcompose Z η‖ ≤ (L : ℝ) * ‖γ - η‖ := by + apply (ContinuousMap.norm_le _ (mul_nonneg L.coe_nonneg (norm_nonneg _))).mpr + intro s + exact (hZ.norm_sub_le (γ s) (η s)).trans + (mul_le_mul_of_nonneg_left ((γ - η).norm_coe_le_norm s) L.coe_nonneg) + +omit [FiniteDimensional ℝ E] in +theorem picard_solution_unique (Z : C(E, E)) {L : ℝ≥0} + (hZ : LipschitzWith L Z) {τ : ℝ} (hτ : |τ| * (L : ℝ) < 1) + (x : E) {γ η : C(UnitTime, E)} + (hγ : picardResidual Z ((τ, x), γ) = 0) + (hη : picardResidual Z ((τ, x), η) = 0) : γ = η := by + have hγ' : γ - ContinuousLinearMap.const ℝ UnitTime x = + τ • primitivePathL (postcompose Z γ) := sub_eq_zero.mp hγ + have hη' : η - ContinuousLinearMap.const ℝ UnitTime x = + τ • primitivePathL (postcompose Z η) := sub_eq_zero.mp hη + have he : γ - η = τ • primitivePathL (postcompose Z γ - postcompose Z η) := by + rw [map_sub, smul_sub, ← hγ', ← hη'] + abel + have hb : ‖γ - η‖ ≤ (|τ| * (L : ℝ)) * ‖γ - η‖ := by + calc + ‖γ - η‖ = |τ| * ‖primitivePathL (postcompose Z γ - postcompose Z η)‖ := by + rw [he, norm_smul, Real.norm_eq_abs] + _ ≤ |τ| * ‖postcompose Z γ - postcompose Z η‖ := + mul_le_mul_of_nonneg_left (primitivePath_norm _) (abs_nonneg τ) + _ ≤ |τ| * ((L : ℝ) * ‖γ - η‖) := + mul_le_mul_of_nonneg_left (postcompose_norm_sub_le Z hZ γ η) (abs_nonneg τ) + _ = _ := by ring + apply sub_eq_zero.mp + apply norm_eq_zero.mp + have hn := norm_nonneg (γ - η) + nlinarith + +omit [FiniteDimensional ℝ E] [CompleteSpace E] in +def orbitPath {Z : E → E} {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (τ : ℝ) (x : E) : C(UnitTime, E) := + ⟨fun s => Ψ (τ * s.1) x, + (continuous_iff_continuousAt.mpr fun t => (hΨ t x).continuousAt).comp + (continuous_const.mul continuous_subtype_val)⟩ + +omit [FiniteDimensional ℝ E] [CompleteSpace E] in +@[simp] theorem orbitPath_apply {Z : E → E} {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (τ : ℝ) (x : E) (s : UnitTime) : orbitPath hΨ τ x s = Ψ (τ * s.1) x := rfl + +omit [FiniteDimensional ℝ E] in +theorem orbitPath_picard (Z : C(E, E)) {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) (τ : ℝ) (x : E) : + picardResidual Z ((τ, x), orbitPath hΨ τ x) = 0 := by + let γ := orbitPath hΨ τ x + have hc : Continuous (fun s : ℝ => Ψ (τ * s) x) := + (continuous_iff_continuousAt.mpr fun t => (hΨ t x).continuousAt).comp + (continuous_const.mul continuous_id) + have hd (s : ℝ) : HasDerivAt (fun r => Ψ (τ * r) x) + (τ • Z (Ψ (τ * s) x)) s := by + simpa only [Function.comp_def, mul_one] using + (hΨ (τ * s) x).scomp s ((hasDerivAt_id s).const_mul τ) + ext t + change Ψ (τ * t.1) x - x - τ • + (∫ s in (0 : ℝ)..t.1, extendPath (postcompose Z γ) s) = 0 + have he : (∫ s in (0 : ℝ)..t.1, extendPath (postcompose Z γ) s) = + ∫ s in (0 : ℝ)..t.1, Z (Ψ (τ * s) x) := by + apply intervalIntegral.integral_congr + intro s hs + have hs' : s ∈ Icc (0 : ℝ) 1 := by + rw [uIcc_of_le t.2.1] at hs + exact ⟨hs.1, hs.2.trans t.2.2⟩ + simp only [extendPath_apply, postcompose, ContinuousMap.comp_apply, + projIcc_of_mem zero_le_one hs', γ, orbitPath_apply] + rw [he] + have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt + (fun s _ => hd s) (((Z.continuous.comp hc).const_smul τ).intervalIntegrable 0 t.1) + rw [intervalIntegral.integral_smul, mul_zero, hzero] at hi + exact sub_eq_zero.mpr hi.symm + +/-- Joint smoothness in short elapsed time and the initial point. -/ +theorem flow_contDiffAt_short (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) {L : ℝ≥0} (hL : LipschitzWith L Z) + {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) (τ : ℝ) (x : E) + (hτ : |τ| * (L : ℝ) < 1) : + ContDiffAt ℝ ∞ (fun p : ℝ × E => Ψ p.1 p.2) (τ, x) := by + let γ := orbitPath hΨ τ x + obtain ⟨Γ, hΓ, _, hΓeq⟩ := exists_local_picard_family Z hZ L.coe_nonneg + (fun _ => norm_fderiv_le_of_lipschitz ℝ hL) hτ x γ + (orbitPath_picard Z hΨ hzero τ x) + let e : UnitTime := ⟨1, by norm_num⟩ + have hs : ContDiffAt ℝ ∞ (fun p => Γ p e) (τ, x) := + (ContinuousMap.evalCLM ℝ e : C(UnitTime, E) →L[ℝ] E).contDiff.contDiffAt.comp (τ, x) hΓ + have hn : ∀ᶠ p : ℝ × E in 𝓝 (τ, x), |p.1| * (L : ℝ) < 1 := + (isOpen_lt (continuous_fst.abs.mul continuous_const) continuous_const).mem_nhds hτ + have he : (fun p => Γ p e) =ᶠ[𝓝 (τ, x)] fun p => Ψ p.1 p.2 := by + filter_upwards [hΓeq, hn] with p hp hsmall + have hu := picard_solution_unique Z hL hsmall p.2 hp + (orbitPath_picard Z hΨ hzero p.1 p.2) + have hv := congrArg (fun η : C(UnitTime, E) => η e) hu + simpa only [orbitPath_apply, e, mul_one] using hv + exact hs.congr_of_eventuallyEq he.symm + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPointwise.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPointwise.lean new file mode 100644 index 0000000000000000000000000000000000000000..88189885ca0aebec6f182ffa93b0be7870b60aeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowPointwise.lean @@ -0,0 +1,89 @@ +import Mathlib.Analysis.Calculus.ContDiff.Basic +import Mathlib.Analysis.Calculus.MeanValue +import Mathlib.Topology.ContinuousMap.Compact + +namespace OAI + +/-! Pointwise calculus on the compact path space used in the local flow proof. +The continuous linear map below lifts a continuously varying linear map to +continuous paths. No differential-equation hypothesis is used here. -/ + +noncomputable section +namespace ForcedComputation.Flow + +open Set Filter +open scoped Topology ContDiff + +variable {K E F : Type*} [TopologicalSpace K] [CompactSpace K] + [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Apply a continuous family of linear maps pointwise to a path. -/ +def applyPath (A : C(K, E →L[ℝ] F)) : C(K, E) →L[ℝ] C(K, F) := + LinearMap.mkContinuous + { toFun := fun u => ⟨fun t => A t (u t), A.continuous.clm_apply u.continuous⟩ + map_add' := by + intro u v + ext t + change A t (u t + v t) = A t (u t) + A t (v t) + exact map_add (A t) (u t) (v t) + map_smul' := by + intro c u + ext t + change A t (c • u t) = c • A t (u t) + exact map_smul (A t) c (u t) } + ‖A‖ (by + intro u + apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg A) (norm_nonneg u))).mpr + intro t + exact ((A t).le_opNorm (u t)).trans + (mul_le_mul (A.norm_coe_le_norm t) (u.norm_coe_le_norm t) + (norm_nonneg _) (norm_nonneg _))) + +@[simp] theorem applyPath_apply (A : C(K, E →L[ℝ] F)) (u : C(K, E)) (t : K) : + applyPath A u t = A t (u t) := rfl + +theorem applyPath_norm (A : C(K, E →L[ℝ] F)) : ‖applyPath A‖ ≤ ‖A‖ := + LinearMap.mkContinuous_norm_le _ (norm_nonneg A) _ + +/-- Pointwise application depends continuously and linearly on the family. -/ +def applyPathL : C(K, E →L[ℝ] F) →L[ℝ] (C(K, E) →L[ℝ] C(K, F)) := + LinearMap.mkContinuous + { toFun := fun A : C(K, E →L[ℝ] F) => applyPath A + map_add' := by + intro A B + ext u t + change (A t + B t) (u t) = A t (u t) + B t (u t) + exact add_apply _ _ _ + map_smul' := by + intro c A + ext u t + rfl } + 1 (by + intro A + change ‖applyPath A‖ ≤ (1 : ℝ) * ‖A‖ + rw [one_mul] + exact applyPath_norm A) + +@[simp] theorem applyPathL_apply (A : C(K, E →L[ℝ] F)) : + applyPathL A = applyPath A := rfl + +/-- A uniform derivative modulus bounds the first-order remainder on a segment. -/ +theorem remainder_bound {f : E → F} {df : E → E →L[ℝ] F} + (hf : ∀ z, HasFDerivAt f (df z) z) (x y : E) {ε : ℝ} + (hε : ∀ z ∈ segment ℝ x y, ‖df z - df x‖ ≤ ε) : + ‖f y - f x - df x (y - x)‖ ≤ ε * ‖y - x‖ := by + have h := (convex_segment x y).norm_image_sub_le_of_norm_hasFDerivWithin_le + (f := fun z => f z - df x z) (f' := fun z => df z - df x) + (fun z _ => ((hf z).sub (df x).hasFDerivAt).hasFDerivWithinAt) + hε (left_mem_segment ℝ x y) (right_mem_segment ℝ x y) + have he : (f y - df x y) - (f x - df x x) = f y - f x - df x (y - x) := by + rw [map_sub] + abel + rwa [he] at h + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..c10a154090087b3f7697630a785d349efbd5b276 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSmooth.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowPicardSolution +import Mathlib.Analysis.ODE.ExistUnique + +namespace OAI + +/-! Global smooth dependence for a finite-dimensional autonomous flow. +The proof iterates the short-time implicit-function construction. -/ + +noncomputable section +namespace ForcedComputation.Flow +open Set +open scoped ContDiff NNReal + +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [CompleteSpace E] + +omit [FiniteDimensional ℝ E] [CompleteSpace E] in +theorem flow_add {Z : E → E} {L : ℝ≥0} (hL : LipschitzWith L Z) + {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) (s t : ℝ) (x : E) : + Ψ (s + t) x = Ψ t (Ψ s x) := by + have hd (r : ℝ) : HasDerivAt (fun u => Ψ (s + u) x) + (Z (Ψ (s + r) x)) r := by + simpa only [Function.comp_def, one_smul] using + (hΨ (s + r) x).scomp r ((hasDerivAt_id r).const_add s) + have he := ODE_solution_unique_univ (s := fun _ => univ) + (fun _ => hL.lipschitzOnWith) + (fun r => ⟨hd r, mem_univ _⟩) + (fun r => ⟨hΨ r (Ψ s x), mem_univ _⟩) + (show Ψ (s + 0) x = Ψ 0 (Ψ s x) by rw [add_zero, hzero]) + exact congrFun he t + +def flowSteps (Ψ : ℝ → E → E) : ℕ → ℝ → E → E + | 0, _, x => x + | n + 1, τ, x => Ψ τ (flowSteps Ψ n τ x) + +omit [FiniteDimensional ℝ E] [CompleteSpace E] in +theorem flowSteps_eq {Z : E → E} {L : ℝ≥0} (hL : LipschitzWith L Z) + {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) (n : ℕ) (τ : ℝ) (x : E) : + flowSteps Ψ n τ x = Ψ ((n : ℝ) * τ) x := by + induction n with + | zero => simp only [flowSteps, Nat.cast_zero, zero_mul, hzero] + | succ n ih => + rw [flowSteps, ih, ← flow_add hL hΨ hzero] + congr 2 + push_cast + ring + +theorem flowSteps_contDiffAt (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) {L : ℝ≥0} (hL : LipschitzWith L Z) + {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) (n : ℕ) (τ : ℝ) (x : E) + (hτ : |τ| * (L : ℝ) < 1) : + ContDiffAt ℝ ∞ (fun p : ℝ × E => flowSteps Ψ n p.1 p.2) (τ, x) := by + induction n with + | zero => exact contDiffAt_snd + | succ n ih => + exact (flow_contDiffAt_short Z hZ hL hΨ hzero τ + (flowSteps Ψ n τ x) hτ).comp (τ, x) (contDiffAt_fst.prodMk ih) + +/-- An actual global flow of a smooth globally Lipschitz finite-dimensional +field is jointly smooth in elapsed time and the initial point. -/ +theorem flow_contDiff (Z : C(E, E)) + (hZ : ContDiff ℝ ∞ (Z : E → E)) {L : ℝ≥0} (hL : LipschitzWith L Z) + {Ψ : ℝ → E → E} + (hΨ : ∀ t x, HasDerivAt (fun s => Ψ s x) (Z (Ψ t x)) t) + (hzero : ∀ x, Ψ 0 x = x) : + ContDiff ℝ ∞ (fun p : ℝ × E => Ψ p.1 p.2) := by + apply contDiff_iff_contDiffAt.mpr + rintro ⟨t, x⟩ + obtain ⟨n, hn⟩ := exists_nat_gt (|t| * (L : ℝ) + 1) + have hnpos : (0 : ℝ) < n := by + have hp := mul_nonneg (abs_nonneg t) L.coe_nonneg + linarith + have hsmall : |t / (n : ℝ)| * (L : ℝ) < 1 := by + rw [abs_div, abs_of_pos hnpos, div_mul_eq_mul_div, div_lt_one hnpos] + linarith + have hs := flowSteps_contDiffAt Z hZ hL hΨ hzero n (t / (n : ℝ)) x hsmall + have hc : ContDiffAt ℝ ∞ (fun p : ℝ × E => (p.1 / (n : ℝ), p.2)) (t, x) := + (contDiffAt_fst.div_const _).prodMk contDiffAt_snd + have he : (fun p : ℝ × E => flowSteps Ψ n (p.1 / (n : ℝ)) p.2) = + fun p => Ψ p.1 p.2 := by + funext p + rw [flowSteps_eq hL hΨ hzero] + congr 2 + field_simp [ne_of_gt hnpos] + have hcomp := hs.comp (t, x) hc + simpa only [Function.comp_def, he] using hcomp + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSuperposition.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSuperposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..82d070b173f869a7fd22842b16e30e08c0100071 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowSuperposition.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowPointwise +import Mathlib.Analysis.Calculus.ContDiff.Comp +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Topology.UniformSpace.HeineCantor + +namespace OAI + +/-! Differentiation of a smooth finite-dimensional field on compact path space. +Compactness makes the derivative remainder uniform over the path; this is the +analytic ingredient needed to apply the implicit function theorem to Picard's +integral equation. -/ + +noncomputable section +namespace ForcedComputation.Flow + +open Set Filter Metric +open scoped Topology ContDiff + +variable {K E F : Type} [TopologicalSpace K] [CompactSpace K] + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +def postcompose (f : C(E, F)) (u : C(K, E)) : C(K, F) := f.comp u + +omit [CompactSpace K] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [NormedSpace ℝ F] in +theorem postcompose_continuous (f : C(E, F)) : + Continuous (postcompose (K := K) f) := f.continuous_postcomp + +theorem postcompose_hasFDerivAt (f : C(E, F)) + (hf : ContDiff ℝ 1 (f : E → F)) (u : C(K, E)) : + HasFDerivAt (postcompose f) + (applyPath ⟨fun t => fderiv ℝ f (u t), + (hf.continuous_fderiv (by simp)).comp u.continuous⟩) u := by + rw [hasFDerivAt_iff_isLittleO, Asymptotics.isLittleO_iff] + intro ε hε + have hdf := hf.continuous_fderiv (by simp) + have huc : UniformContinuousOn (fderiv ℝ f) + (closedBall (0 : E) (‖u‖ + 1)) := + (isCompact_closedBall (0 : E) (‖u‖ + 1)).uniformContinuousOn_of_continuous + hdf.continuousOn + obtain ⟨δ, hδ, hcontrol⟩ := Metric.uniformContinuousOn_iff.mp huc ε hε + filter_upwards [Metric.ball_mem_nhds u (lt_min hδ zero_lt_one)] with v hv + have hvnorm : ‖v - u‖ < min δ 1 := by simpa only [mem_ball, dist_eq_norm] using hv + apply (ContinuousMap.norm_le _ + (mul_nonneg hε.le (norm_nonneg (v - u)))).mpr + intro t + change ‖f (v t) - f (u t) - fderiv ℝ f (u t) (v t - u t)‖ ≤ ε * ‖v - u‖ + have hu : u t ∈ closedBall (0 : E) (‖u‖ + 1) := by + rw [mem_closedBall, dist_zero_right] + exact (u.norm_coe_le_norm t).trans (by linarith) + have hdiff : ‖v t - u t‖ ≤ ‖v - u‖ := (v - u).norm_coe_le_norm t + have hv' : v t ∈ closedBall (0 : E) (‖u‖ + 1) := by + rw [mem_closedBall, dist_zero_right] + calc + ‖v t‖ ≤ ‖v t - u t‖ + ‖u t‖ := by + simpa only [sub_add_cancel] using norm_add_le (v t - u t) (u t) + _ ≤ ‖v - u‖ + ‖u‖ := add_le_add hdiff (u.norm_coe_le_norm t) + _ ≤ ‖u‖ + 1 := by linarith [lt_of_lt_of_le hvnorm (min_le_right δ 1)] + have hsegment := (convex_closedBall (0 : E) (‖u‖ + 1)).segment_subset hu hv' + have hr := remainder_bound (fun z => (hf.differentiable (by simp) z).hasFDerivAt) + (u t) (v t) (ε := ε) (by + intro z hz + have hzδ : dist z (u t) < δ := by + rw [dist_eq_norm] + exact (norm_sub_le_of_mem_segment hz).trans_lt + (hdiff.trans_lt (lt_of_lt_of_le hvnorm (min_le_left δ 1))) + simpa only [dist_eq_norm] using (hcontrol z (hsegment hz) (u t) hu hzδ).le) + exact hr.trans (mul_le_mul_of_nonneg_left hdiff hε.le) + +theorem postcompose_contDiff_nat (n : ℕ) (f : C(E, F)) + (hf : ContDiff ℝ n (f : E → F)) : + ContDiff ℝ n (postcompose (K := K) f) := by + induction n generalizing F with + | zero => + exact contDiff_zero.mpr (postcompose_continuous f) + | succ n ih => + have h1 : ContDiff ℝ 1 (f : E → F) := hf.of_le (by norm_cast; omega) + let df : C(E, E →L[ℝ] F) := + ⟨fderiv ℝ f, h1.continuous_fderiv (by simp)⟩ + have hdf : ContDiff ℝ n (df : E → E →L[ℝ] F) := + hf.fderiv_right (m := n) (by simp) + apply contDiff_succ_iff_hasFDerivAt.mpr + refine ⟨fun u => applyPathL (postcompose df u), ?_, ?_⟩ + · exact (applyPathL (K := K) (E := E) (F := F)).contDiff.comp (ih df hdf) + · intro u + exact postcompose_hasFDerivAt f h1 u + +theorem postcompose_contDiff (f : C(E, F)) (hf : ContDiff ℝ ∞ (f : E → F)) : + ContDiff ℝ ∞ (postcompose (K := K) f) := by + rw [contDiff_infty] + intro n + exact postcompose_contDiff_nat n f (hf.of_le (by simp)) + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowVariational.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowVariational.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b07b51892c94d0102c843dfb1775354bec6035f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FlowVariational.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowMixedPartials + +namespace OAI + +/-! The first and second variational equations follow by differentiating +the actual ODE after joint smoothness has been proved. -/ + +noncomputable section +namespace ForcedComputation.Flow +open scoped ContDiff + +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + +theorem first_variation {V Ω : ℝ → E → E} + (hΩ : ContDiff ℝ ∞ (Function.uncurry Ω)) + (hV : ∀ t, ContDiff ℝ ∞ (V t)) + (hode : ∀ t x, HasDerivAt (fun s => Ω s x) (V t (Ω t x)) t) + (t : ℝ) (x v : E) : + HasDerivAt (fun s => fderiv ℝ (Ω s) x v) + (fderiv ℝ (V t) (Ω t x) (fderiv ℝ (Ω t) x v)) t := by + have h := time_space_commute hΩ t x v + have he : (fun y => deriv (fun s => Ω s y) t) = fun y => V t (Ω t y) := + funext fun y => (hode t y).deriv + change HasDerivAt (fun s => fderiv ℝ (Ω s) x v) + (fderiv ℝ (fun y => deriv (fun s => Ω s y) t) x v) t at h + rw [he] at h + have hx : ContDiff ℝ ∞ (Ω t) := + hΩ.comp (contDiff_const.prodMk contDiff_id) + have hd := (hV t).differentiable (by simp) (Ω t x) + have hg := hx.differentiable (by simp) x + have hchain : fderiv ℝ (fun y => V t (Ω t y)) x = + (fderiv ℝ (V t) (Ω t x)).comp (fderiv ℝ (Ω t) x) := + (hd.hasFDerivAt.comp x hg.hasFDerivAt).fderiv + rw [hchain] at h + exact h + +theorem second_variation {V Ω : ℝ → E → E} + (hΩ : ContDiff ℝ ∞ (Function.uncurry Ω)) + (hV : ∀ t, ContDiff ℝ ∞ (V t)) + (hode : ∀ t x, HasDerivAt (fun s => Ω s x) (V t (Ω t x)) t) + (t : ℝ) (x v w : E) : + HasDerivAt (fun s => fderiv ℝ (fderiv ℝ (Ω s)) x v w) + (fderiv ℝ (V t) (Ω t x) (fderiv ℝ (fderiv ℝ (Ω t)) x v w) + + fderiv ℝ (fderiv ℝ (V t)) (Ω t x) + (fderiv ℝ (Ω t) x v) (fderiv ℝ (Ω t) x w)) t := by + let G : ℝ × E → E := fun p => fderiv ℝ (Ω p.1) p.2 w + have hG : ContDiff ℝ ∞ G := spaceDerivative_smooth hΩ w + have h := time_space_commute hG t x v + have he : (fun y => deriv (fun s => G (s, y)) t) = + fun y => fderiv ℝ (V t) (Ω t y) (fderiv ℝ (Ω t) y w) := by + funext y + exact (first_variation hΩ hV hode t y w).deriv + rw [he] at h + have hx : ContDiff ℝ ∞ (Ω t) := + hΩ.comp (contDiff_const.prodMk contDiff_id) + have hDx : ContDiff ℝ ∞ (fderiv ℝ (Ω t)) := hx.fderiv_right (by simp) + have hDV : ContDiff ℝ ∞ (fderiv ℝ (V t)) := (hV t).fderiv_right (by simp) + have ha := (hDV.differentiable (by simp) (Ω t x)).hasFDerivAt.comp x + ((hx.differentiable (by simp) x).hasFDerivAt) + have hb := ((hDx.differentiable (by simp) x).hasFDerivAt).clm_apply + (hasFDerivAt_const w x) + have hab := congrArg (fun A : E →L[ℝ] E => A v) (ha.clm_apply hb).fderiv + simp only [add_apply, ContinuousLinearMap.comp_apply, + zero_apply, map_zero, zero_add, ContinuousLinearMap.flip_apply, Function.comp_def] at hab + rw [hab] at h + have hleft (s : ℝ) : + fderiv ℝ (fun y => G (s, y)) x v = fderiv ℝ (fderiv ℝ (Ω s)) x v w := by + have hs : ContDiff ℝ ∞ (Ω s) := hΩ.comp (contDiff_const.prodMk contDiff_id) + have hds : DifferentiableAt ℝ (fderiv ℝ (Ω s)) x := + (hs.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x + have hh := congrArg (fun A : E →L[ℝ] E => A v) + (hds.hasFDerivAt.clm_apply (hasFDerivAt_const w x)).fderiv + simpa only [G, add_apply, ContinuousLinearMap.comp_apply, + zero_apply, map_zero, zero_add, ContinuousLinearMap.flip_apply, Function.comp_def] using hh + simpa only [hleft] using h + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FourShearSchedule.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FourShearSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc9dc41304bf6b90017ab8a32249c190f12b5b1e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/FourShearSchedule.lean @@ -0,0 +1,253 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarHamiltonian + +namespace OAI + +/-! Four separated rational time slots give an actual smooth planar trajectory +for a reciprocal affine map. The global curve is polynomial in the four smooth +clocks, so no piecewise path or logarithmic coefficient is needed. -/ + +noncomputable section + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +def slotStart (k : Fin 4) : ℚ := (2 * (k.val : ℚ) + 1) / 10 + +def slotFinish (k : Fin 4) : ℚ := (2 * (k.val : ℚ) + 2) / 10 + +theorem slot_order (k : Fin 4) : slotStart k < slotFinish k := by + dsimp [slotStart, slotFinish] + linarith + +def slotClock (k : Fin 4) : ℝ → ℝ := smoothRamp (slotStart k) (slotFinish k) + +def slotPulse (k : Fin 4) : ℝ → ℝ := smoothPulse (slotStart k) (slotFinish k) + +theorem slotClock_smooth (k : Fin 4) : ContDiff ℝ ∞ (slotClock k) := + smoothRamp_smooth _ _ + +theorem slotClock_hasDerivAt (k : Fin 4) (t : ℝ) : + HasDerivAt (slotClock k) (slotPulse k t) t := + ((slotClock_smooth k).differentiable (by simp) t).hasDerivAt + +def slotRegion (k : Fin 4) : Set ℝ := + (if k = 0 then univ else Ioi ((k.val : ℝ) / 5)) ∩ + (if k = 3 then univ else Iio ((2 * (k.val : ℝ) + 3) / 10)) + +theorem slotRegion_open (k : Fin 4) : IsOpen (slotRegion k) := by + unfold slotRegion + apply IsOpen.inter <;> split <;> first | exact isOpen_univ | exact isOpen_Ioi | exact isOpen_Iio + +theorem exists_slotRegion (t : ℝ) : ∃ k : Fin 4, t ∈ slotRegion k := by + by_cases h₀ : t < 3 / 10 + · exact ⟨0, by simpa [slotRegion] using h₀⟩ + by_cases h₁ : t < 5 / 10 + · refine ⟨1, ?_⟩ + norm_num [slotRegion] + constructor <;> linarith + by_cases h₂ : t < 7 / 10 + · refine ⟨2, ?_⟩ + norm_num [slotRegion] + constructor <;> linarith + · refine ⟨3, ?_⟩ + norm_num [slotRegion] + linarith + +theorem previous_finish_lt {j k : Fin 4} {t : ℝ} + (hj : j < k) (ht : t ∈ slotRegion k) : (slotFinish j : ℝ) < t := by + have hk : k ≠ 0 := by intro hk; subst k; exact (not_lt_of_ge (Fin.zero_le j)) hj + have hlo : (k.val : ℝ) / 5 < t := by simpa [slotRegion, hk] using ht.1 + have hj' : (j.val : ℝ) + 1 ≤ (k.val : ℝ) := by exact_mod_cast (show j.val + 1 ≤ k.val from hj) + dsimp [slotFinish] + push_cast + linarith + +theorem lt_future_start {j k : Fin 4} {t : ℝ} + (hj : k < j) (ht : t ∈ slotRegion k) : t < (slotStart j : ℝ) := by + have hk : k ≠ 3 := by + intro hk + subst k + have := j.isLt + omega + have hhi : t < (2 * (k.val : ℝ) + 3) / 10 := by + simpa [slotRegion, hk] using ht.2 + have hj' : (k.val : ℝ) + 1 ≤ (j.val : ℝ) := by exact_mod_cast (show k.val + 1 ≤ j.val from hj) + dsimp [slotStart] + push_cast + linarith + +theorem clock_previous {j k : Fin 4} {t : ℝ} + (hj : j < k) (ht : t ∈ slotRegion k) : + slotClock j t = 1 ∧ slotPulse j t = 0 := by + have hord : (slotStart j : ℝ) < slotFinish j := by exact_mod_cast slot_order j + exact ⟨smoothRamp_after hord (previous_finish_lt hj ht).le, + smoothPulse_after hord (previous_finish_lt hj ht).le⟩ + +theorem clock_future {j k : Fin 4} {t : ℝ} + (hj : k < j) (ht : t ∈ slotRegion k) : + slotClock j t = 0 ∧ slotPulse j t = 0 := by + have hord : (slotStart j : ℝ) < slotFinish j := by exact_mod_cast slot_order j + exact ⟨smoothRamp_before hord (lt_future_start hj ht).le, + smoothPulse_before hord (lt_future_start hj ht).le⟩ + +def route (μ : ℝ) (c w : Plane) (t : ℝ) : Plane := + c + shearX (slotClock 3 t * (μ - 1)) + (shearY (slotClock 2 t) + (shearX (slotClock 1 t * (μ⁻¹ - 1)) + (shearY (slotClock 0 t * (-μ)) (w - c)))) + +theorem route_smooth (μ : ℝ) (c w : Plane) : ContDiff ℝ ∞ (route μ c w) := by + have h₀ := slotClock_smooth 0 + have h₁ := slotClock_smooth 1 + have h₂ := slotClock_smooth 2 + have h₃ := slotClock_smooth 3 + unfold route shearX shearY + apply contDiff_pi.mpr + intro j + fin_cases j <;> dsimp <;> fun_prop + +theorem route_eq_stage {μ : ℝ} (hμ : μ ≠ 0) (c w : Plane) + {k : Fin 4} {t : ℝ} (ht : t ∈ slotRegion k) : + route μ c w t = fourShearPath (slotClock k) μ c w k t := by + have hp (j : Fin 4) (hj : j < k) := (clock_previous hj ht).1 + have hf (j : Fin 4) (hj : k < j) := (clock_future hj ht).1 + fin_cases k + · have h₁ := hf 1 (by decide) + have h₂ := hf 2 (by decide) + have h₃ := hf 3 (by decide) + funext j + fin_cases j <;> simp [route, fourShearPath, partialShear, scalingEndpoints, + shearX, shearY, h₁, h₂, h₃] + · have h₀ := hp 0 (by decide) + have h₂ := hf 2 (by decide) + have h₃ := hf 3 (by decide) + funext j + fin_cases j <;> simp [route, fourShearPath, partialShear, scalingEndpoints, + shearX, shearY, h₀, h₂, h₃, sub_eq_add_neg] + · have h₀ := hp 0 (by decide) + have h₁ := hp 1 (by decide) + have h₃ := hf 3 (by decide) + funext j + fin_cases j <;> simp [route, fourShearPath, partialShear, scalingEndpoints, + shearX, shearY, h₀, h₁, h₃] <;> field_simp <;> ring + · have h₀ := hp 0 (by decide) + have h₁ := hp 1 (by decide) + have h₂ := hp 2 (by decide) + funext j + fin_cases j <;> simp [route, fourShearPath, partialShear, scalingEndpoints, + shearX, shearY, h₀, h₁, h₂] <;> field_simp <;> ring + +theorem route_eq_stage_near {μ : ℝ} (hμ : μ ≠ 0) (c w : Plane) + {k : Fin 4} {t : ℝ} (ht : t ∈ slotRegion k) : + route μ c w =ᶠ[𝓝 t] fourShearPath (slotClock k) μ c w k := + Filter.eventually_of_mem ((slotRegion_open k).mem_nhds ht) + (fun _ hs => route_eq_stage hμ c w hs) + +def scheduledVelocity (μ : ℝ) (c : Plane) (χ : Plane → ℝ) (t : ℝ) (x : Plane) : Plane := + ∑ k : Fin 4, slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x + +theorem scheduledVelocity_smooth (μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hχ : ContDiff ℝ ∞ χ) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => scheduledVelocity μ c χ p.1 p.2) := by + unfold scheduledVelocity + apply ContDiff.sum + intro k _ + exact ((smoothPulse_smooth (slotStart k) (slotFinish k)).comp contDiff_fst).smul + ((field_smooth (hχ.mul (fourShearPotential_smooth μ c k))).comp contDiff_snd) + +theorem scheduledVelocity_compactSupport (μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hc : HasCompactSupport χ) (t : ℝ) : + HasCompactSupport (scheduledVelocity μ c χ t) := by + apply HasCompactSupport.intro hc.isCompact + intro x hx + unfold scheduledVelocity + apply Finset.sum_eq_zero + intro k _ + have hs : tsupport (field (fun y => χ y * fourShearPotential μ c k y)) ⊆ tsupport χ := + (field_tsupport _).trans tsupport_mul_subset_left + rw [image_eq_zero_of_notMem_tsupport (fun h => hx (hs h)), smul_zero] + +theorem scheduledVelocity_integral_eq_zero (μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hχ : ContDiff ℝ ∞ χ) (hc : HasCompactSupport χ) (t : ℝ) : + ∫ x, scheduledVelocity μ c χ t x = 0 := by + have hH (k : Fin 4) : ContDiff ℝ ∞ (fun y => χ y * fourShearPotential μ c k y) := + hχ.mul (fourShearPotential_smooth μ c k) + have hC (k : Fin 4) : HasCompactSupport (fun y => χ y * fourShearPotential μ c k y) := + hc.mul_right + have hI (k : Fin 4) : Integrable (fun x => + slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x) := by + have hs : Continuous (fun x : Plane => + slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x) := + (continuous_const (y := slotPulse k t)).smul (field_smooth (hH k)).continuous + have hc' : HasCompactSupport (fun x : Plane => + slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x) := + (field_compactSupport (hC k)).smul_left (f := fun _ : Plane => slotPulse k t) + exact hs.integrable_of_hasCompactSupport hc' + change (∫ x, ∑ k : Fin 4, + slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x) = 0 + rw [integral_finsetSum _ (fun k _ => hI k)] + apply Finset.sum_eq_zero + intro k _ + rw [integral_smul, field_integral_eq_zero (hH k) (hC k), smul_zero] + +theorem scheduledVelocity_one_slot {μ : ℝ} {c : Plane} {χ : Plane → ℝ} + {k : Fin 4} {t : ℝ} (ht : t ∈ slotRegion k) (x : Plane) : + scheduledVelocity μ c χ t x = + slotPulse k t • field (fun y => χ y * fourShearPotential μ c k y) x := by + unfold scheduledVelocity + apply Finset.sum_eq_single k + · intro j _ hj + rcases lt_or_gt_of_ne hj with hj | hj + · simp only [(clock_previous hj ht).2, zero_smul] + · simp only [(clock_future hj ht).2, zero_smul] + · simp + +theorem route_hasDerivAt {μ : ℝ} (hμ : μ ≠ 0) (c w : Plane) (χ : Plane → ℝ) + (t : ℝ) (hχ : χ =ᶠ[𝓝 (route μ c w t)] fun _ => 1) : + HasDerivAt (route μ c w) (scheduledVelocity μ c χ t (route μ c w t)) t := by + obtain ⟨k, hk⟩ := exists_slotRegion t + have he := route_eq_stage_near hμ c w hk + have hev := he.eq_of_nhds + rw [scheduledVelocity_one_slot hk, hev] + have hd := fourShearPath_cutoff_ode (slotClock_hasDerivAt k t) μ c w k χ + (by simpa only [← hev] using hχ) + exact hd.congr_of_eventuallyEq he + +theorem route_initial (μ : ℝ) (c w : Plane) : route μ c w 0 = w := by + have hz (k : Fin 4) : slotClock k 0 = 0 := by + apply smoothRamp_before + · exact_mod_cast slot_order k + · dsimp [slotStart] + positivity + funext j + fin_cases j <;> simp [route, hz, shearX, shearY] + +theorem route_final {μ : ℝ} (hμ : μ ≠ 0) (c w : Plane) : + route μ c w 1 = ![c 0 + μ * (w 0 - c 0), c 1 + (w 1 - c 1) / μ] := by + have ho (k : Fin 4) : slotClock k 1 = 1 := by + apply smoothRamp_after + · exact_mod_cast slot_order k + · have hk : (k.val : ℚ) < 4 := by exact_mod_cast k.isLt + dsimp [slotFinish] + exact_mod_cast (show (2 * (k.val : ℚ) + 2) / 10 ≤ 1 by linarith) + rw [route, ho, ho, ho, ho] + simp only [one_mul] + rw [four_shears hμ] + funext j + fin_cases j <;> rfl + +theorem route_bound {μ h : ℝ} (hμ : 0 < μ) (hh : 0 ≤ h) (c w : Plane) + (hx : |w 0 - c 0| ≤ h) (hy : |w 1 - c 1| ≤ h) + (hμx : |μ * (w 0 - c 0)| ≤ h) (hyμ : |(w 1 - c 1) / μ| ≤ h) + (t : ℝ) : ‖route μ c w t - c‖ ≤ 2 * h := by + obtain ⟨k, hk⟩ := exists_slotRegion t + rw [route_eq_stage hμ.ne' c w hk] + exact fourShearPath_bound (smoothRamp_range _ _ _) hμ hh c w hx hy hμx hyμ k + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/HamiltonianStartup.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/HamiltonianStartup.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4b5b6da5978af065f8b903ad87fb89c03818e4e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/HamiltonianStartup.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBundle +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupEffective +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionExpressions + +namespace OAI + +/-! Assembly of the analytic and effective parts of the eventually stationary +construction from its finite scalar Hamiltonian. -/ + +namespace ForcedComputation +open ShearFlows + +noncomputable def hamiltonianStartupVelocity (H : FieldExpr) : Velocity := + rampVelocity startupRamp (SpatialExpression.suspensionField H) + +theorem hamiltonian_startup_effective {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) + (hP : CubePeriodic 1 (SpatialExpression.spatialValue H)) + {ν : ℝ} (hν : 0 ≤ ν) : + StationaryFluidProperties 1 ν (hamiltonianStartupVelocity H) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (hamiltonianStartupVelocity H) α y - + rationalVector (evaluateStartupVelocity (SpatialExpression.suspensionCode H) + (SpatialExpression.suspensionCode_valid hH) α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ), IsFastRealName a ν → + ∀ (b : ℕ → RationalSpaceTime) (y : SpaceTime), IsFastName b y → + ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (residual ν (hamiltonianStartupVelocity H)) α y - + rationalVector (evaluateStartupForce (SpatialExpression.suspensionCode H) + (SpatialExpression.suspensionCode_valid hH) α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (y : SpaceTime), + ‖mixedDerivative (hamiltonianStartupVelocity H) α y‖ ≤ + (startupVelocityBound (SpatialExpression.suspensionCode H) α : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ), IsFastRealName a ν → ∀ y, + ‖mixedDerivative (residual ν (hamiltonianStartupVelocity H)) α y‖ ≤ + (startupForceBound (SpatialExpression.suspensionCode H) α a : ℝ)) ∧ + ∃ Φ : ℝ → Space → Space, + IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ ∧ + IsMaterialFlow 1 (hamiltonianStartupVelocity H) + (fun t x => Φ (accumulatedClock startupRamp t) x) ∧ + ∀ x O, Reaches (fun t => Φ (accumulatedClock startupRamp t) x) O ↔ + Reaches (fun t => Φ t x) O := by + have hs := SpatialExpression.suspensionField_smooth hH + have hp := SpatialExpression.suspensionField_periodic hH hP + have hd := SpatialExpression.suspensionField_divergence hH + have hm := SpatialExpression.suspensionField_mean_zero hH hP + have hc := SpatialExpression.suspensionCode_valid hH + have hv := SpatialExpression.suspensionCode_val hH hT + refine ⟨startup_bundle (by norm_num) hν hs hp hd hm, ?_, ?_, ?_, ?_, + startup_materialFlow (by norm_num) hs hp⟩ + · intro α b y hb ε hε + exact evaluateStartupVelocity_spec hc hv α hb ε hε + · intro α a ha b y hb ε hε + exact evaluateStartupForce_spec hc hv α ha hb ε hε + · intro α y + exact startupVelocityBound_spec hc hv α y + · intro α a ha y + exact startupForceBound_spec hc hv α ha y + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/OrderedSweep.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/OrderedSweep.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cb75a54ac2173d97b98ccd548a10041c845aa51 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/OrderedSweep.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RectangleAffine +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Geometry + +namespace OAI + +/-! Quantitative separation during ordered horizontal extraction and insertion. +Only the active rectangle's right endpoint changes during its swept box. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +/-- A rational coordinate gap between two filled rectangles. -/ +def EndpointGap (δ : ℚ) (R S : RationalBox 2) : Prop := + ∃ j : Fin 2, R.upper j + δ ≤ S.lower j ∨ S.upper j + δ ≤ R.lower j + +/-- The existing computable maximum of the four signed endpoint gaps supplies +an actual separating coordinate. -/ +theorem endpointGap_of_le_boxGap {R S : RationalBox 2} {δ : ℚ} + (hδ : δ ≤ boxGap R S) : EndpointGap δ R S := by + simp only [boxGap, le_max_iff] at hδ + rcases hδ with (hδ | hδ) | (hδ | hδ) + · exact ⟨0, Or.inr (by linarith)⟩ + · exact ⟨0, Or.inl (by linarith)⟩ + · exact ⟨1, Or.inr (by linarith)⟩ + · exact ⟨1, Or.inl (by linarith)⟩ + +theorem separated_endpointGap {R S : RationalBox 2} + (hR : R.positive) (hS : S.positive) + (hsep : PositivelySeparated R.carrier S.carrier) : + 0 < boxGap R S ∧ EndpointGap (boxGap R S) R S := + ⟨boxGap_pos_of_separated R S hR hS hsep, endpointGap_of_le_boxGap le_rfl⟩ + +/-- The full bounding box swept when a rectangle is moved horizontally to a +point on its right. `endpoint` is the right edge of the translated rectangle. -/ +def rightSweep (R : RationalBox 2) (endpoint : ℚ) : RationalBox 2 := + ⟨R.lower, ![max (R.upper 0) endpoint, R.upper 1]⟩ + +theorem rightSweep_positive {R : RationalBox 2} (hR : R.positive) (endpoint : ℚ) : + (rightSweep R endpoint).positive := by + intro j + fin_cases j + · exact (hR 0).trans_le (le_max_left _ _) + · exact hR 1 + +/-- Center order rules out a separated obstacle lying to the right. -/ +theorem left_gap_of_center_order {a b c d δ : ℚ} + (hab : a ≤ b) (hcd : c ≤ d) (hδ : 0 < δ) (hcenter : c + d ≤ a + b) + (hgap : b + δ ≤ c ∨ d + δ ≤ a) : d + δ ≤ a := by + rcases hgap with hgap | hgap + · exfalso + linarith + · exact hgap + +/-- A stationary rectangle with no larger horizontal center retains the same +quantitative gap while the active rectangle sweeps to the right. -/ +theorem rightSweep_gap {R S : RationalBox 2} {δ : ℚ} + (hR : R.positive) (hS : S.positive) (hδ : 0 < δ) + (hcenter : S.lower 0 + S.upper 0 ≤ R.lower 0 + R.upper 0) + (hgap : EndpointGap δ R S) (endpoint : ℚ) : + EndpointGap δ (rightSweep R endpoint) S := by + obtain ⟨j, hj⟩ := hgap + fin_cases j + · refine ⟨0, Or.inr ?_⟩ + exact left_gap_of_center_order (hR 0).le (hS 0).le hδ hcenter hj + · exact ⟨1, hj⟩ + +theorem rightSweep_gap_of_centers {R S : RationalBox 2} {δ : ℚ} + (hR : R.positive) (hS : S.positive) (hδ : 0 < δ) + (hcenter : S.center 0 ≤ R.center 0) (hgap : EndpointGap δ R S) (endpoint : ℚ) : + EndpointGap δ (rightSweep R endpoint) S := by + apply rightSweep_gap hR hS hδ ?_ hgap endpoint + have hsum : (S.lower 0 : ℝ) + (S.upper 0 : ℝ) ≤ + (R.lower 0 : ℝ) + (R.upper 0 : ℝ) := by + dsimp [RationalBox.center] at hcenter + linarith + exact_mod_cast hsum + +theorem EndpointGap.separated {δ : ℚ} {R S : RationalBox 2} + (hgap : EndpointGap δ R S) (hδ : 0 < δ) : + PositivelySeparated R.carrier S.carrier := by + have hp : (0 : ℝ) < δ := by exact_mod_cast hδ + refine ⟨δ, hp, ?_⟩ + intro x hx y hy + obtain ⟨j, hj⟩ := hgap + have ha : (δ : ℝ) ≤ |x j - y j| := by + rcases hj with hj | hj + · have hg : (R.upper j : ℝ) + (δ : ℝ) ≤ S.lower j := by exact_mod_cast hj + calc + (δ : ℝ) ≤ y j - x j := by linarith [(hx j).2, (hy j).1] + _ ≤ |y j - x j| := le_abs_self _ + _ = |x j - y j| := abs_sub_comm _ _ + · have hg : (S.upper j : ℝ) + (δ : ℝ) ≤ R.lower j := by exact_mod_cast hj + exact (show (δ : ℝ) ≤ x j - y j by linarith [(hy j).2, (hx j).1]).trans + (le_abs_self _) + exact ha.trans (by simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) j) + +end ForcedComputation.PlanarRouting + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionOrder.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..72dfeba3830970a391756db828e6487b9e742850 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionOrder.lean @@ -0,0 +1,214 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProgramBounds + +namespace OAI + +/-! Explicit indices of each extraction, scaling, and insertion pulse. These +are arithmetic indices into the actual compiled list, not choice functions. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +def blocks {α β : Type*} {k : ℕ} (l : List α) (f : α → Fin k → β) : List β := + l.flatMap (fun a => List.ofFn (f a)) + +theorem blocks_length {α β : Type*} {k : ℕ} (l : List α) (f : α → Fin k → β) : + (blocks l f).length = l.length * k := by + induction l with + | nil => simp [blocks] + | cons a l ih => + change (List.ofFn (f a) ++ blocks l f).length = (a :: l).length * k + rw [List.length_append, List.length_ofFn, ih, List.length_cons] + ring + +theorem block_index_lt {m k i j : ℕ} (hi : i < m) (hj : j < k) : i * k + j < m * k := by + calc + i * k + j < i * k + k := Nat.add_lt_add_left hj _ + _ = (i + 1) * k := by ring + _ ≤ m * k := Nat.mul_le_mul_right k hi + +theorem blocks_get {α β : Type*} {k : ℕ} (l : List α) (f : α → Fin k → β) + (i j : ℕ) (hi : i < l.length) (hj : j < k) : + (blocks l f)[i * k + j]'(by rw [blocks_length]; exact block_index_lt hi hj) = + f (l[i]'hi) ⟨j, hj⟩ := by + induction l generalizing i with + | nil => simp at hi + | cons a l ih => + cases i with + | zero => simp [blocks, List.flatMap_cons, List.getElem_append_left, hj] + | succ i => + have hi' : i < l.length := by simpa using hi + simp only [blocks, List.flatMap_cons] + rw [List.getElem_append_right (by simp; rw [Nat.succ_mul]; omega)] + have he : (i + 1) * k + j - (List.ofFn (f a)).length = i * k + j := by + simp only [List.length_ofFn, Nat.succ_mul] + omega + simp only [he, List.getElem_cons_succ] + exact ih i hi' + +theorem append_three_left {α : Type*} (l₀ l₁ l₂ : List α) (i : ℕ) (hi : i < l₀.length) : + (l₀ ++ l₁ ++ l₂)[i]'(by simp only [List.length_append]; omega) = l₀[i]'hi := by + rw [List.getElem_append_left (as := l₀ ++ l₁) (bs := l₂) (by simp only [List.length_append]; omega)] + rw [List.getElem_append_left hi] + +theorem append_three_middle {α : Type*} (l₀ l₁ l₂ : List α) (i : ℕ) (hi : i < l₁.length) : + (l₀ ++ l₁ ++ l₂)[l₀.length + i]'(by simp only [List.length_append]; omega) = l₁[i]'hi := by + rw [List.getElem_append_left (as := l₀ ++ l₁) (bs := l₂) (by simp only [List.length_append]; omega)] + rw [List.getElem_append_right (by omega)] + simp only [Nat.add_sub_cancel_left] + +theorem append_three_right {α : Type*} (l₀ l₁ l₂ : List α) (i : ℕ) (hi : i < l₂.length) : + (l₀ ++ l₁ ++ l₂)[l₀.length + l₁.length + i]'(by simp only [List.length_append]; omega) = l₂[i]'hi := by + rw [List.getElem_append_right (as := l₀ ++ l₁) (bs := l₂) (by simp only [List.length_append]; omega)] + simp only [List.length_append, Nat.add_sub_cancel_left] + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting + +deriving instance DecidableEq for Phase +instance (M : Alternating.Machine) (hM : M.WellFormed) : DecidableEq (Action M hM) := + fun a b => decidable_of_iff (a.owner = b.owner ∧ a.phase = b.phase) + ⟨fun h => by + cases a + cases b + rcases h with ⟨h₁, h₂⟩ + cases h₁ + cases h₂ + rfl, + fun h => by cases h; exact ⟨rfl, rfl⟩⟩ + +def extractionBlock {M : Alternating.Machine} {hM : M.WellFormed} + (b : Branch (finiteMachine M hM)) : Fin 2 → Action M hM := + ![⟨b, .extractHorizontal⟩, ⟨b, .extractVertical⟩] + +def scalingBlock {M : Alternating.Machine} {hM : M.WellFormed} + (b : Branch (finiteMachine M hM)) (k : Fin 4) : Action M hM := ⟨b, .scale k⟩ + +def insertionBlock {M : Alternating.Machine} {hM : M.WellFormed} + (b : Branch (finiteMachine M hM)) : Fin 2 → Action M hM := + ![⟨b, .insertVertical⟩, ⟨b, .insertHorizontal⟩] + +theorem actions_eq_blocks (M : Alternating.Machine) (hM : M.WellFormed) : + actions M hM = blocks (sourceOrder M hM) extractionBlock ++ + blocks (geometricBranches M hM) scalingBlock ++ blocks (targetOrder M hM) insertionBlock := rfl + +theorem actions_length (M : Alternating.Machine) (hM : M.WellFormed) : + (actions M hM).length = 8 * (geometricBranches M hM).length := by + rw [actions_eq_blocks] + simp only [List.length_append, blocks_length, + (sourceOrder_perm M hM).length_eq, (targetOrder_perm M hM).length_eq] + omega + +def sourceRank (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Fin (sourceOrder M hM).length := + ⟨(sourceOrder M hM).idxOf b, List.idxOf_lt_length_of_mem (sourceOrder_complete M hM b)⟩ + +def targetRank (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Fin (targetOrder M hM).length := + ⟨(targetOrder M hM).idxOf b, List.idxOf_lt_length_of_mem (targetOrder_complete M hM b)⟩ + +theorem sourceRank_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (sourceOrder M hM).get (sourceRank M hM b) = b := + List.idxOf_get _ + +theorem targetRank_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (targetOrder M hM).get (targetRank M hM b) = b := + List.idxOf_get _ + +def Action.index {M : Alternating.Machine} {hM : M.WellFormed} (a : Action M hM) : ℕ := + let n := (geometricBranches M hM).length + match a.phase with + | .extractHorizontal => 2 * (sourceRank M hM a.owner).val + | .extractVertical => 2 * (sourceRank M hM a.owner).val + 1 + | .scale k => 2 * n + 4 * (branchIndex M hM a.owner).val + k.val + | .insertVertical => 6 * n + 2 * (targetRank M hM a.owner).val + | .insertHorizontal => 6 * n + 2 * (targetRank M hM a.owner).val + 1 + +theorem Action.index_lt {M : Alternating.Machine} {hM : M.WellFormed} (a : Action M hM) : + a.index < (actions M hM).length := by + have hs := (sourceRank M hM a.owner).isLt + have ht := (targetRank M hM a.owner).isLt + have hb := (branchIndex M hM a.owner).isLt + have hslen := (sourceOrder_perm M hM).length_eq + have htlen := (targetOrder_perm M hM).length_eq + rw [actions_length] + cases ha : a.phase with + | scale k => have hk := k.isLt; simp only [Action.index, ha]; omega + | _ => simp only [Action.index, ha]; omega + +def extractionIndex (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 2) : Fin (actions M hM).length := + ⟨2 * (sourceRank M hM b).val + k.val, by + have hs := (sourceRank M hM b).isLt + have hk := k.isLt + have hslen := (sourceOrder_perm M hM).length_eq + rw [actions_length] + omega⟩ + +def scalingIndex (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 4) : Fin (actions M hM).length := + ⟨2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + k.val, by + have hb := (branchIndex M hM b).isLt + have hk := k.isLt + rw [actions_length] + omega⟩ + +def insertionIndex (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 2) : Fin (actions M hM).length := + ⟨6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + k.val, by + have hs := (targetRank M hM b).isLt + have hk := k.isLt + have hslen := (targetOrder_perm M hM).length_eq + rw [actions_length] + omega⟩ + +theorem extractionIndex_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 2) : + (actions M hM).get (extractionIndex M hM b k) = extractionBlock b k := by + let s := sourceRank M hM b + have hs : (sourceOrder M hM)[s.val]'s.isLt = b := sourceRank_get M hM b + have hb := blocks_get (sourceOrder M hM) extractionBlock s.val k.val s.isLt k.isLt + rw [hs] at hb + have ht := append_three_left (blocks (sourceOrder M hM) extractionBlock) + (blocks (geometricBranches M hM) scalingBlock) (blocks (targetOrder M hM) insertionBlock) + (s.val * 2 + k.val) (by rw [blocks_length]; exact block_index_lt s.isLt k.isLt) + rw [hb] at ht + simpa only [actions_eq_blocks, extractionIndex, List.get_eq_getElem, Nat.mul_comm] using ht + +theorem scalingIndex_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 4) : + (actions M hM).get (scalingIndex M hM b k) = scalingBlock b k := by + let s := branchIndex M hM b + have hs : (geometricBranches M hM)[s.val]'s.isLt = b := branchAt_index M hM b + have hb := blocks_get (geometricBranches M hM) scalingBlock s.val k.val s.isLt k.isLt + rw [hs] at hb + have ht := append_three_middle (blocks (sourceOrder M hM) extractionBlock) + (blocks (geometricBranches M hM) scalingBlock) (blocks (targetOrder M hM) insertionBlock) + (s.val * 4 + k.val) (by rw [blocks_length]; exact block_index_lt s.isLt k.isLt) + rw [hb] at ht + simpa only [actions_eq_blocks, scalingIndex, List.get_eq_getElem, blocks_length, + (sourceOrder_perm M hM).length_eq, Nat.mul_comm, Nat.add_assoc] using ht + +theorem insertionIndex_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 2) : + (actions M hM).get (insertionIndex M hM b k) = insertionBlock b k := by + let s := targetRank M hM b + have hs : (targetOrder M hM)[s.val]'s.isLt = b := targetRank_get M hM b + have hb := blocks_get (targetOrder M hM) insertionBlock s.val k.val s.isLt k.isLt + rw [hs] at hb + have ht := append_three_right (blocks (sourceOrder M hM) extractionBlock) + (blocks (geometricBranches M hM) scalingBlock) (blocks (targetOrder M hM) insertionBlock) + (s.val * 2 + k.val) (by rw [blocks_length]; exact block_index_lt s.isLt k.isLt) + rw [hb] at ht + have he : (sourceOrder M hM).length * 2 + (geometricBranches M hM).length * 4 + + (s.val * 2 + k.val) = 6 * (geometricBranches M hM).length + 2 * s.val + k.val := by + rw [(sourceOrder_perm M hM).length_eq] + omega + simpa only [actions_eq_blocks, insertionIndex, List.get_eq_getElem, blocks_length, he] using ht + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionUnique.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionUnique.lean new file mode 100644 index 0000000000000000000000000000000000000000..d71ca6931b86f82b604983cd6f21d22b728cd0d8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarActionUnique.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarActionOrder + +namespace OAI + +/-! Every pulse in the compiler has one owner and one phase. Its explicit +index is the inverse of reading the finite action list. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +theorem blocks_nodup {α β : Type*} {k : ℕ} (l : List α) (f : α → Fin k → β) + (hl : l.Nodup) (hf : Function.Injective (fun p : α × Fin k => f p.1 p.2)) : + (blocks l f).Nodup := by + apply List.nodup_flatMap.mpr + constructor + · intro a _ + apply List.nodup_ofFn.mpr + intro i j hij + exact congrArg Prod.snd (@hf (a, i) (a, j) hij) + · apply hl.imp + intro a b hab x hxa hxb + obtain ⟨i, hi⟩ := List.mem_ofFn.mp hxa + obtain ⟨j, hj⟩ := List.mem_ofFn.mp hxb + exact hab (congrArg Prod.fst (@hf (a, i) (b, j) (hi.trans hj.symm))) + +theorem blocks_disjoint {α β γ : Type*} {k m : ℕ} (l : List α) (r : List β) + (f : α → Fin k → γ) (g : β → Fin m → γ) + (hfg : ∀ a b i j, f a i ≠ g b j) : List.Disjoint (blocks l f) (blocks r g) := by + intro x hx hy + obtain ⟨a, _, hx⟩ := List.mem_flatMap.mp hx + obtain ⟨b, _, hy⟩ := List.mem_flatMap.mp hy + obtain ⟨i, hi⟩ := List.mem_ofFn.mp hx + obtain ⟨j, hj⟩ := List.mem_ofFn.mp hy + exact hfg a b i j (hi.trans hj.symm) + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting + +theorem extractionBlock_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (fun p : Branch (finiteMachine M hM) × Fin 2 => extractionBlock p.1 p.2) := by + rintro ⟨b, i⟩ ⟨c, j⟩ h + fin_cases i <;> fin_cases j <;> + simp [extractionBlock] at h + all_goals (cases h; rfl) + +theorem insertionBlock_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (fun p : Branch (finiteMachine M hM) × Fin 2 => insertionBlock p.1 p.2) := by + rintro ⟨b, i⟩ ⟨c, j⟩ h + fin_cases i <;> fin_cases j <;> + simp [insertionBlock] at h + all_goals (cases h; rfl) + +theorem scalingBlock_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (fun p : Branch (finiteMachine M hM) × Fin 4 => scalingBlock p.1 p.2) := by + rintro ⟨b, i⟩ ⟨c, j⟩ h + have hb := congrArg Action.owner h + have hi := congrArg Action.phase h + change Phase.scale i = Phase.scale j at hi + cases hb + cases hi + rfl + +theorem actions_nodup (M : Alternating.Machine) (hM : M.WellFormed) : (actions M hM).Nodup := by + have he := blocks_nodup (sourceOrder M hM) extractionBlock (sourceOrder_nodup M hM) + (extractionBlock_injective M hM) + have hs := blocks_nodup (geometricBranches M hM) scalingBlock (List.nodup_dedup _) + (scalingBlock_injective M hM) + have hi := blocks_nodup (targetOrder M hM) insertionBlock (targetOrder_nodup M hM) + (insertionBlock_injective M hM) + have hes : List.Disjoint (blocks (sourceOrder M hM) extractionBlock) + (blocks (geometricBranches M hM) scalingBlock) := by + apply blocks_disjoint + intro b c i j h + have hp := congrArg Action.phase h + fin_cases i <;> cases hp + have hei : List.Disjoint (blocks (sourceOrder M hM) extractionBlock) + (blocks (targetOrder M hM) insertionBlock) := by + apply blocks_disjoint + intro b c i j h + have hp := congrArg Action.phase h + fin_cases i <;> fin_cases j <;> cases hp + have hsi : List.Disjoint (blocks (geometricBranches M hM) scalingBlock) + (blocks (targetOrder M hM) insertionBlock) := by + apply blocks_disjoint + intro b c i j h + have hp := congrArg Action.phase h + fin_cases j <;> cases hp + rw [actions_eq_blocks] + apply (he.append hs hes).append hi + intro a ha hb + rcases List.mem_append.mp ha with ha | ha + · exact hei ha hb + · exact hsi ha hb + +theorem Action.get_index {M : Alternating.Machine} {hM : M.WellFormed} (a : Action M hM) : + (actions M hM).get ⟨a.index, a.index_lt⟩ = a := by + rcases a with ⟨b, phase⟩ + cases phase with + | extractHorizontal => exact extractionIndex_get M hM b 0 + | extractVertical => exact extractionIndex_get M hM b 1 + | scale k => exact scalingIndex_get M hM b k + | insertVertical => exact insertionIndex_get M hM b 0 + | insertHorizontal => exact insertionIndex_get M hM b 1 + +theorem Action.index_get (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (actions M hM).length) : ((actions M hM).get i).index = i.val := by + have h := (List.nodup_iff_injective_get.mp (actions_nodup M hM)) + (Action.get_index ((actions M hM).get i)) + exact congrArg Fin.val h + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarAnisotropic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarAnisotropic.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4687b2d2a5f153c4a914fffb49536771e2de354 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarAnisotropic.lean @@ -0,0 +1,225 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FourShearSchedule + +namespace OAI + +/-! Anisotropic four-shear routes. Horizontal compression of the recorder +must persist throughout the scaling stage, so the parking columns remain +disjoint even when there are many instructions. All four coefficients are +rational functions of the input data. -/ + +noncomputable section + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +def diagonalScale (a b : ℝ) (x : Plane) : Plane := ![a * x 0, b * x 1] + +def diagonalLinear (a b : ℝ) : Plane →ₗ[ℝ] Plane where + toFun := diagonalScale a b + map_add' x y := by + funext j + fin_cases j <;> simp [diagonalScale, mul_add] + map_smul' r x := by + funext j + fin_cases j <;> dsimp [diagonalScale] <;> ring + +theorem diagonalScale_hasDerivAt {f : ℝ → Plane} {v : Plane} {t : ℝ} + (hf : HasDerivAt f v t) (a b : ℝ) (c : Plane) : + HasDerivAt (fun s => c + diagonalScale a b (f s)) (diagonalScale a b v) t := by + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · change HasDerivAt (fun s => c 0 + a * f s 0) (a * v 0) t + exact (((hasDerivAt_pi.mp hf) 0).const_mul a).const_add (c 0) + · change HasDerivAt (fun s => c 1 + b * f s 1) (b * v 1) t + exact (((hasDerivAt_pi.mp hf) 1).const_mul b).const_add (c 1) + +def anisotropicPotential (a b μ : ℝ) (c : Plane) : Fin 4 → Plane → ℝ := + ![verticalPotential c (-μ * b / a), + horizontalPotential c ((μ⁻¹ - 1) * a / b), + verticalPotential c (b / a), + horizontalPotential c ((μ - 1) * a / b)] + +theorem anisotropicPotential_smooth (a b μ : ℝ) (c : Plane) (k : Fin 4) : + ContDiff ℝ ∞ (anisotropicPotential a b μ c k) := by + fin_cases k <;> + first | exact horizontalPotential_smooth _ _ | exact verticalPotential_smooth _ _ + +theorem field_anisotropicPotential {a b : ℝ} (ha : a ≠ 0) (hb : b ≠ 0) + (μ : ℝ) (c z : Plane) (k : Fin 4) : + field (anisotropicPotential a b μ c k) (c + diagonalScale a b z) = + diagonalScale a b (field (fourShearPotential μ 0 k) z) := by + have hY (q : ℝ) : + field (verticalPotential c (q * b / a)) (c + diagonalScale a b z) = + diagonalScale a b (field (verticalPotential 0 q) z) := by + simp only [field_vertical] + funext j + fin_cases j + · simp [diagonalScale] + · dsimp [diagonalScale] + field_simp + ring + have hX (q : ℝ) : + field (horizontalPotential c (q * a / b)) (c + diagonalScale a b z) = + diagonalScale a b (field (horizontalPotential 0 q) z) := by + simp only [field_horizontal] + funext j + fin_cases j + · dsimp [diagonalScale] + field_simp + ring + · simp [diagonalScale] + fin_cases k + · exact hY (-μ) + · exact hX (μ⁻¹ - 1) + · change field (verticalPotential c (b / a)) (c + diagonalScale a b z) = + diagonalScale a b (field (verticalPotential 0 1) z) + simpa only [one_mul] using hY 1 + · exact hX (μ - 1) + +def normalizedOffset (a b : ℝ) (c w : Plane) : Plane := + ![(w 0 - c 0) / a, (w 1 - c 1) / b] + +def anisotropicRoute (a b μ : ℝ) (c w : Plane) (t : ℝ) : Plane := + c + diagonalScale a b (route μ 0 (normalizedOffset a b c w) t) + +theorem anisotropicRoute_smooth (a b μ : ℝ) (c w : Plane) : + ContDiff ℝ ∞ (anisotropicRoute a b μ c w) := by + have hs := route_smooth μ 0 (normalizedOffset a b c w) + apply contDiff_pi.mpr + intro j + fin_cases j <;> dsimp [anisotropicRoute, diagonalScale] <;> fun_prop + +def anisotropicVelocity (a b μ : ℝ) (c : Plane) (χ : Plane → ℝ) + (t : ℝ) (x : Plane) : Plane := + ∑ k : Fin 4, slotPulse k t • + field (fun y => χ y * anisotropicPotential a b μ c k y) x + +theorem anisotropicVelocity_smooth (a b μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hχ : ContDiff ℝ ∞ χ) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => anisotropicVelocity a b μ c χ p.1 p.2) := by + unfold anisotropicVelocity + apply ContDiff.sum + intro k _ + exact ((smoothPulse_smooth (slotStart k) (slotFinish k)).comp contDiff_fst).smul + ((field_smooth (hχ.mul (anisotropicPotential_smooth a b μ c k))).comp contDiff_snd) + +theorem anisotropicVelocity_compactSupport (a b μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hc : HasCompactSupport χ) (t : ℝ) : + HasCompactSupport (anisotropicVelocity a b μ c χ t) := by + apply HasCompactSupport.intro hc.isCompact + intro x hx + unfold anisotropicVelocity + apply Finset.sum_eq_zero + intro k _ + have hs : tsupport (field (fun y => χ y * anisotropicPotential a b μ c k y)) ⊆ tsupport χ := + (field_tsupport _).trans tsupport_mul_subset_left + rw [image_eq_zero_of_notMem_tsupport (fun h => hx (hs h)), smul_zero] + +theorem anisotropicVelocity_integral_eq_zero (a b μ : ℝ) (c : Plane) {χ : Plane → ℝ} + (hχ : ContDiff ℝ ∞ χ) (hc : HasCompactSupport χ) (t : ℝ) : + ∫ x, anisotropicVelocity a b μ c χ t x = 0 := by + have hH (k : Fin 4) : + ContDiff ℝ ∞ (fun y => χ y * anisotropicPotential a b μ c k y) := + hχ.mul (anisotropicPotential_smooth a b μ c k) + have hC (k : Fin 4) : + HasCompactSupport (fun y => χ y * anisotropicPotential a b μ c k y) := hc.mul_right + have hI (k : Fin 4) : Integrable (fun x => + slotPulse k t • field (fun y => χ y * anisotropicPotential a b μ c k y) x) := by + have hs : Continuous (fun x : Plane => + slotPulse k t • field (fun y => χ y * anisotropicPotential a b μ c k y) x) := + (continuous_const (y := slotPulse k t)).smul (field_smooth (hH k)).continuous + have hc' : HasCompactSupport (fun x : Plane => + slotPulse k t • field (fun y => χ y * anisotropicPotential a b μ c k y) x) := + (field_compactSupport (hC k)).smul_left (f := fun _ : Plane => slotPulse k t) + exact hs.integrable_of_hasCompactSupport hc' + change (∫ x, ∑ k : Fin 4, + slotPulse k t • field (fun y => χ y * anisotropicPotential a b μ c k y) x) = 0 + rw [integral_finsetSum _ (fun k _ => hI k)] + apply Finset.sum_eq_zero + intro k _ + rw [integral_smul, field_integral_eq_zero (hH k) (hC k), smul_zero] + +theorem anisotropicVelocity_scale {a b : ℝ} (ha : a ≠ 0) (hb : b ≠ 0) + (μ : ℝ) (c z : Plane) (t : ℝ) : + anisotropicVelocity a b μ c (fun _ => 1) t (c + diagonalScale a b z) = + diagonalScale a b (scheduledVelocity μ 0 (fun _ => 1) t z) := by + change (∑ k : Fin 4, slotPulse k t • + field (fun y => 1 * anisotropicPotential a b μ c k y) (c + diagonalScale a b z)) = + diagonalLinear a b (∑ k : Fin 4, + slotPulse k t • field (fun y => 1 * fourShearPotential μ 0 k y) z) + simp only [one_mul, map_sum, map_smul] + apply Finset.sum_congr rfl + intro k _ + rw [field_anisotropicPotential ha hb] + rfl + +theorem anisotropicVelocity_plateau (a b μ : ℝ) (c : Plane) {χ : Plane → ℝ} + {x : Plane} (hχ : χ =ᶠ[𝓝 x] fun _ => 1) (t : ℝ) : + anisotropicVelocity a b μ c χ t x = + anisotropicVelocity a b μ c (fun _ => 1) t x := by + apply Finset.sum_congr rfl + intro k _ + rw [field_cutoff_plateau _ _ hχ] + simp only [one_mul] + +theorem anisotropicRoute_hasDerivAt {a b μ : ℝ} (ha : a ≠ 0) (hb : b ≠ 0) + (hμ : μ ≠ 0) (c w : Plane) (χ : Plane → ℝ) (t : ℝ) + (hχ : χ =ᶠ[𝓝 (anisotropicRoute a b μ c w t)] fun _ => 1) : + HasDerivAt (anisotropicRoute a b μ c w) + (anisotropicVelocity a b μ c χ t (anisotropicRoute a b μ c w t)) t := by + rw [anisotropicVelocity_plateau a b μ c hχ] + unfold anisotropicRoute + rw [anisotropicVelocity_scale ha hb] + exact diagonalScale_hasDerivAt + (route_hasDerivAt hμ 0 (normalizedOffset a b c w) (fun _ => 1) t Filter.EventuallyEq.rfl) + a b c + +theorem anisotropicRoute_initial {a b : ℝ} (ha : a ≠ 0) (hb : b ≠ 0) + (μ : ℝ) (c w : Plane) : anisotropicRoute a b μ c w 0 = w := by + rw [anisotropicRoute, route_initial] + funext j + fin_cases j + · change c 0 + a * ((w 0 - c 0) / a) = w 0 + rw [mul_comm a, div_mul_cancel₀ _ ha, add_sub_cancel] + · change c 1 + b * ((w 1 - c 1) / b) = w 1 + rw [mul_comm b, div_mul_cancel₀ _ hb, add_sub_cancel] + +theorem anisotropicRoute_final {a b μ : ℝ} (ha : a ≠ 0) (hb : b ≠ 0) + (hμ : μ ≠ 0) (c w : Plane) : + anisotropicRoute a b μ c w 1 = + ![c 0 + μ * (w 0 - c 0), c 1 + (w 1 - c 1) / μ] := by + rw [anisotropicRoute, route_final hμ] + funext j + fin_cases j <;> simp [diagonalScale, normalizedOffset] <;> field_simp + +theorem anisotropicRoute_bound {a b μ h : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) + (hμ : 0 < μ) (hh : 0 ≤ h) (c w : Plane) + (hx : |(w 0 - c 0) / a| ≤ h) (hy : |(w 1 - c 1) / b| ≤ h) + (hμx : |μ * ((w 0 - c 0) / a)| ≤ h) + (hyμ : |((w 1 - c 1) / b) / μ| ≤ h) (t : ℝ) : + |anisotropicRoute a b μ c w t 0 - c 0| ≤ 2 * a * h ∧ + |anisotropicRoute a b μ c w t 1 - c 1| ≤ 2 * b * h := by + have hr := route_bound hμ hh 0 (normalizedOffset a b c w) + (by simpa [normalizedOffset] using hx) + (by simpa [normalizedOffset] using hy) + (by simpa [normalizedOffset] using hμx) + (by simpa [normalizedOffset] using hyμ) t + have hc (j : Fin 2) : |route μ 0 (normalizedOffset a b c w) t j| ≤ 2 * h := by + have hh : |route μ 0 (normalizedOffset a b c w) t j| ≤ + ‖route μ 0 (normalizedOffset a b c w) t‖ := by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm (route μ 0 (normalizedOffset a b c w) t) j + exact hh.trans (by simpa using hr) + constructor + · simpa [anisotropicRoute, diagonalScale, abs_mul, abs_of_nonneg ha, mul_assoc, + mul_comm, mul_left_comm] using mul_le_mul_of_nonneg_left (hc 0) ha + · simpa [anisotropicRoute, diagonalScale, abs_mul, abs_of_nonneg hb, mul_assoc, + mul_comm, mul_left_comm] using mul_le_mul_of_nonneg_left (hc 1) hb + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchAnchors.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchAnchors.lean new file mode 100644 index 0000000000000000000000000000000000000000..b891b21fd6724c4875fd239a43b786126f7bdb72 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchAnchors.lean @@ -0,0 +1,199 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchStages +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchOrder + +namespace OAI + +/-! The eight local pulse endpoints for one filled source rectangle. -/ + +noncomputable section + +namespace ForcedComputation.PlanarRouting + +open ShearFlows Set + +theorem mem_translationTube_left {R : RationalBox 2} {x : Plane} + (hx : x ∈ R.carrier) (p : Fin 2 → ℚ) : x ∈ (translationTube R p).carrier := by + intro j + have hl : ((translationTube R p).lower j : ℝ) ≤ (R.lower j : ℝ) := by + exact_mod_cast min_le_left (R.lower j) ((recenter R p).lower j) + have hu : (R.upper j : ℝ) ≤ ((translationTube R p).upper j : ℝ) := by + exact_mod_cast le_max_left (R.upper j) ((recenter R p).upper j) + exact ⟨hl.trans (hx j).1, (hx j).2.trans hu⟩ + +theorem mem_translationTube_right {R : RationalBox 2} {x : Plane} + (p : Fin 2 → ℚ) (hx : x ∈ (recenter R p).carrier) : + x ∈ (translationTube R p).carrier := by + intro j + have hl : ((translationTube R p).lower j : ℝ) ≤ ((recenter R p).lower j : ℝ) := by + exact_mod_cast min_le_right (R.lower j) ((recenter R p).lower j) + have hu : ((recenter R p).upper j : ℝ) ≤ ((translationTube R p).upper j : ℝ) := by + exact_mod_cast le_max_right (R.upper j) ((recenter R p).upper j) + exact ⟨hl.trans (hx j).1, (hx j).2.trans hu⟩ + +theorem recenter_mem {R : RationalBox 2} {x : Plane} (hx : x ∈ R.carrier) + (p : Fin 2 → ℚ) : + x + ((fun j => (p j : ℝ)) - R.center) ∈ (recenter R p).carrier := by + rw [← recenter_image] + exact mem_image_of_mem _ hx + +theorem recenter_twice (R : RationalBox 2) (p q : Fin 2 → ℚ) : + recenter (recenter R p) q = recenter R q := by + apply box_ext + · funext j + change q j - halfWidthQ (recenter R p) j = q j - halfWidthQ R j + rw [recenter_halfWidthQ] + · funext j + change q j + halfWidthQ (recenter R p) j = q j + halfWidthQ R j + rw [recenter_halfWidthQ] + +theorem recenter_self (R : RationalBox 2) : recenter R (centerQ R) = R := by + apply box_ext + · funext j + exact centerQ_sub_halfWidthQ R j + · funext j + exact centerQ_add_halfWidthQ R j + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian Set + +def horizontalPoint (R : RationalBox 2) (p : Fin 2 → ℚ) (x : Plane) : Plane := + x + ((fun j => (horizontalCenter R (p 0) j : ℝ)) - R.center) + +def branchAnchors (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) : Fin 9 → Plane := + let r := instruction M hM b + let p := parkingFor M hM b + let ε := parkingScale (geometricBranches M hM).length + ![x, horizontalPoint r.source p x, + scaledStage r ε (3 / 8) p x 0, + scaledStage r ε (3 / 8) p x 1, + scaledStage r ε (3 / 8) p x 2, + scaledStage r ε (3 / 8) p x 3, + scaledStage r ε (3 / 8) p x 4, + horizontalPoint r.target p (r.affine x), r.affine x] + +@[simp] theorem branchAnchors_first (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) : branchAnchors M hM b x 0 = x := rfl + +@[simp] theorem branchAnchors_last (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) : + branchAnchors M hM b x 8 = (instruction M hM b).affine x := rfl + +theorem branchAnchors_endpoint (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) (k : Fin 8) : + (⟨b, ownPhase k⟩ : Action M hM).primitive.endpoint (branchAnchors M hM b x k.castSucc) = + branchAnchors M hM b x k.succ := by + have hε := (parkingScale_pos (geometricBranches M hM).length).ne' + have hμ := (instruction_factor_pos M hM b).ne' + fin_cases k + · ext j + fin_cases j <;> + simp [Action.primitive, ownPhase, branchAnchors, Primitive.endpoint, Primitive.path, + translationPath, horizontalPoint, horizontalCenter] + · change (Primitive.translation ![0, parkingFor M hM b 1 - + centerQ (instruction M hM b).source 1]).endpoint + (horizontalPoint (instruction M hM b).source (parkingFor M hM b) x) = + scaledStage (instruction M hM b) (parkingScale (geometricBranches M hM).length) + (3 / 8) (parkingFor M hM b) x 0 + rw [scaledStage_zero _ hε (by norm_num)] + ext j + fin_cases j <;> + simp [Primitive.endpoint, Primitive.path, + translationPath, horizontalPoint, horizontalCenter, parkedSource] + · exact scaledStage_succ _ hε (by norm_num) hμ _ _ 0 + · exact scaledStage_succ _ hε (by norm_num) hμ _ _ 1 + · exact scaledStage_succ _ hε (by norm_num) hμ _ _ 2 + · exact scaledStage_succ _ hε (by norm_num) hμ _ _ 3 + · change (Primitive.translation ![0, centerQ (instruction M hM b).target 1 - + parkingFor M hM b 1]).endpoint + (scaledStage (instruction M hM b) (parkingScale (geometricBranches M hM).length) + (3 / 8) (parkingFor M hM b) x 4) = + horizontalPoint (instruction M hM b).target (parkingFor M hM b) ((instruction M hM b).affine x) + rw [scaledStage_final _ hε (by norm_num)] + ext j + fin_cases j <;> + simp [Primitive.endpoint, Primitive.path, translationPath, horizontalPoint, horizontalCenter] + ring + · ext j + fin_cases j <;> + simp [Action.primitive, ownPhase, branchAnchors, Primitive.endpoint, Primitive.path, + translationPath, horizontalPoint, horizontalCenter] + ring + +theorem branchAnchors_mem_rectangle (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 8) : + branchAnchors M hM b x k.castSucc ∈ (⟨b, ownPhase k⟩ : Action M hM).rectangle.carrier ∧ + branchAnchors M hM b x k.succ ∈ (⟨b, ownPhase k⟩ : Action M hM).rectangle.carrier := by + let r := instruction M hM b + let p := parkingFor M hM b + have ht : r.affine x ∈ r.target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hsh : horizontalPoint r.source p x ∈ + (recenter r.source (horizontalCenter r.source (p 0))).carrier := recenter_mem hx _ + have hsp : parkedSource r p x ∈ (recenter r.source p).carrier := recenter_mem hx p + have hth : horizontalPoint r.target p (r.affine x) ∈ + (recenter r.target (horizontalCenter r.target (p 0))).carrier := recenter_mem ht _ + have htp : r.affine x + ((fun j => (p j : ℝ)) - r.target.center) ∈ + (recenter r.target p).carrier := recenter_mem ht p + have hε := (parkingScale_pos (geometricBranches M hM).length).ne' + have hw := instruction_halfWidths M hM b + have hp (j : Fin 5) : + scaledStage r (parkingScale (geometricBranches M hM).length) (3 / 8) p x j ∈ + (parkingBox (geometricBranches M hM).length (bandScale M) (branchIndex M hM b)).carrier := + scaledStage_mem_parking (bandScale_pos M).le (branchIndex M hM b) r + (instruction_factor_pos M hM b) (instruction_image M hM b) hw.1 hw.2.1 hw.2.2.1 hw.2.2.2 hx j + fin_cases k + · exact ⟨mem_translationTube_left hx _, mem_translationTube_right _ hsh⟩ + · constructor + · exact mem_translationTube_left hsh _ + · change scaledStage r _ _ p x 0 ∈ (translationTube (recenter r.source _) p).carrier + rw [scaledStage_zero r hε (by norm_num)] + apply mem_translationTube_right + rw [recenter_twice] + exact hsp + · exact ⟨hp 0, hp 1⟩ + · exact ⟨hp 1, hp 2⟩ + · exact ⟨hp 2, hp 3⟩ + · exact ⟨hp 3, hp 4⟩ + · constructor + · change scaledStage r _ _ p x 4 ∈ (translationTube (recenter r.target p) _).carrier + rw [scaledStage_final r hε (by norm_num)] + exact mem_translationTube_left htp _ + · apply mem_translationTube_right + rw [recenter_twice] + exact hth + · constructor + · exact mem_translationTube_left hth _ + · apply mem_translationTube_right + rw [recenter_twice, recenter_self] + exact ht + +theorem branch_curve_mem_rectangle (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 8) (t : ℝ) : + (compiledPulse M hM (branchIndices M hM b k)).curve + (branchAnchors M hM b x k.castSucc) t ∈ + (compiledPulse M hM (branchIndices M hM b k)).rectangle.carrier := by + have hm := branchAnchors_mem_rectangle M hM b hx k + have hθ := smoothRamp_range + ((compiledPulse M hM (branchIndices M hM b k)).start : ℝ) + ((compiledPulse M hM (branchIndices M hM b k)).finish : ℝ) t + change (((actions M hM).get (branchIndices M hM b k)).primitive).path _ _ t ∈ + (((actions M hM).get (branchIndices M hM b k)).rectangle).carrier + rw [branchIndices_get] + apply Primitive.path_mem_box + · exact hm.1 + · rw [branchAnchors_endpoint] + exact hm.2 + · exact hθ + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e9b188269b074039e591aa85cdb952f37df0319 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchBounds.lean @@ -0,0 +1,166 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPrimitiveBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchAnchors + +namespace OAI + +/-! Effective rational bounds for dependence of one entire branch on its +source point. The same bound covers all eight anchors and all partial pulses. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarHamiltonian PlanarRouting Set +open scoped BigOperators + +def branchExpansion (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : ℚ := + ∑ k : Fin 8, (⟨b, ownPhase k⟩ : Action M hM).primitive.growth + +def branchGrowth (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : ℚ := (branchExpansion M hM b) ^ 8 + +def branchRadius (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : ℚ := routingCollar M hM / (2 * branchGrowth M hM b) + +theorem primitive_growth_le_expansion (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 8) : + (⟨b, ownPhase k⟩ : Action M hM).primitive.growth ≤ branchExpansion M hM b := by + unfold branchExpansion + apply Finset.single_le_sum (s := Finset.univ) + (f := fun j : Fin 8 => (⟨b, ownPhase j⟩ : Action M hM).primitive.growth) + · intro j _ + exact (by norm_num : (0 : ℚ) ≤ 1).trans (Primitive.growth_one_le _) + · exact Finset.mem_univ k + +theorem branchExpansion_one_le (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : 1 ≤ branchExpansion M hM b := + (Primitive.growth_one_le _).trans (primitive_growth_le_expansion M hM b 0) + +theorem branchGrowth_one_le (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : 1 ≤ branchGrowth M hM b := by + exact one_le_pow₀ (branchExpansion_one_le M hM b) + +theorem branchRadius_pos (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : 0 < branchRadius M hM b := + div_pos (routingCollar_pos M hM) + (mul_pos (by norm_num) (lt_of_lt_of_le (by norm_num) (branchGrowth_one_le M hM b))) + +theorem branchAnchor_sub_bound (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x y : Plane) (k : Fin 9) : + ‖branchAnchors M hM b x k - branchAnchors M hM b y k‖ ≤ + (branchExpansion M hM b : ℝ) ^ k.val * ‖x - y‖ := by + have hE : (1 : ℝ) ≤ branchExpansion M hM b := by exact_mod_cast branchExpansion_one_le M hM b + have hE₀ : (0 : ℝ) ≤ branchExpansion M hM b := le_trans (by norm_num) hE + refine Fin.induction ?_ ?_ k + · simp only [branchAnchors_first, Fin.val_zero, pow_zero, one_mul, le_refl] + · intro j ih + let p := (⟨b, ownPhase j⟩ : Action M hM).primitive + have hp₀ : (0 : ℝ) ≤ p.growth := by exact_mod_cast + ((by norm_num : (0 : ℚ) ≤ 1).trans p.growth_one_le) + have hp : (p.growth : ℝ) ≤ branchExpansion M hM b := by + exact_mod_cast primitive_growth_le_expansion M hM b j + rw [← branchAnchors_endpoint M hM b x j, ← branchAnchors_endpoint M hM b y j] + calc + ‖p.endpoint (branchAnchors M hM b x j.castSucc) - + p.endpoint (branchAnchors M hM b y j.castSucc)‖ ≤ + (p.growth : ℝ) * ‖branchAnchors M hM b x j.castSucc - + branchAnchors M hM b y j.castSucc‖ := p.endpoint_sub_bound _ _ + _ ≤ (p.growth : ℝ) * ((branchExpansion M hM b : ℝ) ^ j.val * ‖x - y‖) := + mul_le_mul_of_nonneg_left ih hp₀ + _ ≤ (branchExpansion M hM b : ℝ) * ((branchExpansion M hM b : ℝ) ^ j.val * ‖x - y‖) := + mul_le_mul_of_nonneg_right hp (mul_nonneg (pow_nonneg hE₀ _) (norm_nonneg _)) + _ = (branchExpansion M hM b : ℝ) ^ j.succ.val * ‖x - y‖ := by + simp only [Fin.val_succ, pow_succ] + ring + +theorem branchAnchor_sub_uniform (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x y : Plane) (k : Fin 9) : + ‖branchAnchors M hM b x k - branchAnchors M hM b y k‖ ≤ + (branchGrowth M hM b : ℝ) * ‖x - y‖ := by + have hE : (1 : ℝ) ≤ branchExpansion M hM b := by exact_mod_cast branchExpansion_one_le M hM b + have hk : k.val ≤ 8 := by omega + have hg : (branchExpansion M hM b : ℝ) ^ k.val ≤ (branchGrowth M hM b : ℝ) := by + simpa only [branchGrowth, Rat.cast_pow] using pow_le_pow_right₀ hE hk + exact (branchAnchor_sub_bound M hM b x y k).trans + (mul_le_mul_of_nonneg_right hg (norm_nonneg _)) + +theorem branchPath_sub_uniform (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x y : Plane) (k : Fin 8) + (θ : ℝ → ℝ) (t : ℝ) (hθ : θ t ∈ Icc (0 : ℝ) 1) : + ‖(⟨b, ownPhase k⟩ : Action M hM).primitive.path θ (branchAnchors M hM b x k.castSucc) t - + (⟨b, ownPhase k⟩ : Action M hM).primitive.path θ (branchAnchors M hM b y k.castSucc) t‖ ≤ + (branchGrowth M hM b : ℝ) * ‖x - y‖ := by + let p := (⟨b, ownPhase k⟩ : Action M hM).primitive + have hE : (1 : ℝ) ≤ branchExpansion M hM b := by exact_mod_cast branchExpansion_one_le M hM b + have hE₀ : (0 : ℝ) ≤ branchExpansion M hM b := le_trans (by norm_num) hE + have hp₀ : (0 : ℝ) ≤ p.growth := by exact_mod_cast + ((by norm_num : (0 : ℚ) ≤ 1).trans p.growth_one_le) + have hp : (p.growth : ℝ) ≤ branchExpansion M hM b := by + exact_mod_cast primitive_growth_le_expansion M hM b k + have hk : k.val + 1 ≤ 8 := k.isLt + have hg : (branchExpansion M hM b : ℝ) ^ (k.val + 1) ≤ (branchGrowth M hM b : ℝ) := by + simpa only [branchGrowth, Rat.cast_pow] using pow_le_pow_right₀ hE hk + calc + _ ≤ (p.growth : ℝ) * ‖branchAnchors M hM b x k.castSucc - branchAnchors M hM b y k.castSucc‖ := + p.path_sub_bound _ _ θ t hθ + _ ≤ (p.growth : ℝ) * ((branchExpansion M hM b : ℝ) ^ k.val * ‖x - y‖) := + mul_le_mul_of_nonneg_left (branchAnchor_sub_bound M hM b x y k.castSucc) hp₀ + _ ≤ (branchExpansion M hM b : ℝ) * ((branchExpansion M hM b : ℝ) ^ k.val * ‖x - y‖) := + mul_le_mul_of_nonneg_right hp (mul_nonneg (pow_nonneg hE₀ _) (norm_nonneg _)) + _ = (branchExpansion M hM b : ℝ) ^ (k.val + 1) * ‖x - y‖ := by rw [pow_succ]; ring + _ ≤ (branchGrowth M hM b : ℝ) * ‖x - y‖ := mul_le_mul_of_nonneg_right hg (norm_nonneg _) + +theorem growth_mul_radius (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (branchGrowth M hM b : ℝ) * (branchRadius M hM b : ℝ) = (routingCollar M hM : ℝ) / 2 := by + have hg : (branchGrowth M hM b : ℝ) ≠ 0 := by + have h : (1 : ℝ) ≤ branchGrowth M hM b := by exact_mod_cast branchGrowth_one_le M hM b + linarith + simp only [branchRadius, Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat] + field_simp + +theorem branchAnchor_dist_lt_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x y : Plane} + (hxy : dist x y < (branchRadius M hM b : ℝ)) (k : Fin 9) : + dist (branchAnchors M hM b x k) (branchAnchors M hM b y k) < (routingCollar M hM : ℝ) / 2 := by + have hg : (0 : ℝ) < branchGrowth M hM b := by + have h : (1 : ℝ) ≤ branchGrowth M hM b := by exact_mod_cast branchGrowth_one_le M hM b + linarith + calc + _ ≤ (branchGrowth M hM b : ℝ) * dist x y := by + simpa only [dist_eq_norm] using branchAnchor_sub_uniform M hM b x y k + _ < (branchGrowth M hM b : ℝ) * (branchRadius M hM b : ℝ) := mul_lt_mul_of_pos_left hxy hg + _ = _ := growth_mul_radius M hM b + +theorem branchPath_dist_lt_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x y : Plane} + (hxy : dist x y < (branchRadius M hM b : ℝ)) (k : Fin 8) + (θ : ℝ → ℝ) (t : ℝ) (hθ : θ t ∈ Icc (0 : ℝ) 1) : + dist ((⟨b, ownPhase k⟩ : Action M hM).primitive.path θ (branchAnchors M hM b x k.castSucc) t) + ((⟨b, ownPhase k⟩ : Action M hM).primitive.path θ (branchAnchors M hM b y k.castSucc) t) < + (routingCollar M hM : ℝ) / 2 := by + have hg : (0 : ℝ) < branchGrowth M hM b := by + have h : (1 : ℝ) ≤ branchGrowth M hM b := by exact_mod_cast branchGrowth_one_le M hM b + linarith + calc + _ ≤ (branchGrowth M hM b : ℝ) * dist x y := by + simpa only [dist_eq_norm] using branchPath_sub_uniform M hM b x y k θ t hθ + _ < (branchGrowth M hM b : ℝ) * (branchRadius M hM b : ℝ) := mul_lt_mul_of_pos_left hxy hg + _ = _ := growth_mul_radius M hM b + +def branchNeighborhood (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Set Plane := + {y | ∃ x ∈ (instruction M hM b).source.carrier, dist y x < (branchRadius M hM b : ℝ)} + +theorem source_subset_branchNeighborhood (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (instruction M hM b).source.carrier ⊆ branchNeighborhood M hM b := by + intro x hx + refine ⟨x, hx, ?_⟩ + simpa only [dist_self] using (show (0 : ℝ) < branchRadius M hM b by exact_mod_cast branchRadius_pos M hM b) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchOrder.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..aff50f20bd1c04381ab1185d2be374f46ffdc4a0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchOrder.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarActionOrder + +namespace OAI + +/-! The eight pulses belonging to one branch occur in strict chronological +order inside the actual finite instruction list. -/ + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows + +def ownPhase : Fin 8 → Phase := + letI := ShearFlows.neZeroFour + ![.extractHorizontal, .extractVertical, .scale 0, .scale 1, + .scale 2, .scale 3, .insertVertical, .insertHorizontal] + +def branchIndices (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Fin 8 → Fin (actions M hM).length := + ![extractionIndex M hM b 0, extractionIndex M hM b 1, + scalingIndex M hM b 0, scalingIndex M hM b 1, + scalingIndex M hM b 2, scalingIndex M hM b 3, + insertionIndex M hM b 0, insertionIndex M hM b 1] + +theorem branchIndices_get (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (k : Fin 8) : + (actions M hM).get (branchIndices M hM b k) = ⟨b, ownPhase k⟩ := by + fin_cases k + · exact extractionIndex_get M hM b 0 + · exact extractionIndex_get M hM b 1 + · exact scalingIndex_get M hM b 0 + · exact scalingIndex_get M hM b 1 + · exact scalingIndex_get M hM b 2 + · exact scalingIndex_get M hM b 3 + · exact insertionIndex_get M hM b 0 + · exact insertionIndex_get M hM b 1 + +theorem branchIndices_values (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (fun k => (branchIndices M hM b k).val) = + ![2 * (sourceRank M hM b).val, 2 * (sourceRank M hM b).val + 1, + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val, + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 1, + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 2, + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3, + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val, + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1] := by + funext k + fin_cases k <;> rfl + +theorem ordered_indices_strictMono (n s b t : ℕ) (hs : s < n) (hb : b < n) : + StrictMono (![2 * s, 2 * s + 1, 2 * n + 4 * b, 2 * n + 4 * b + 1, + 2 * n + 4 * b + 2, 2 * n + 4 * b + 3, 6 * n + 2 * t, 6 * n + 2 * t + 1] : Fin 8 → ℕ) := by + apply Fin.strictMono_iff_lt_succ.mpr + intro k + fin_cases k + · change 2 * s < 2 * s + 1 + omega + · change 2 * s + 1 < 2 * n + 4 * b + omega + · change 2 * n + 4 * b < 2 * n + 4 * b + 1 + omega + · change 2 * n + 4 * b + 1 < 2 * n + 4 * b + 2 + omega + · change 2 * n + 4 * b + 2 < 2 * n + 4 * b + 3 + omega + · change 2 * n + 4 * b + 3 < 6 * n + 2 * t + omega + · change 6 * n + 2 * t < 6 * n + 2 * t + 1 + omega + +theorem branchIndices_strictMono (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : StrictMono (branchIndices M hM b) := by + have hs := (sourceRank M hM b).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have hnat : StrictMono (fun k => (branchIndices M hM b k).val) := by + rw [branchIndices_values] + exact ordered_indices_strictMono _ _ _ _ (by omega) (branchIndex M hM b).isLt + exact hnat + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchStages.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchStages.lean new file mode 100644 index 0000000000000000000000000000000000000000..c92a1291c23989adadd26fd7484123edd3ab149e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarBranchStages.lean @@ -0,0 +1,141 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSchedule + +namespace OAI + +/-! Eight local stages for one filled instruction rectangle. The four middle +stages use anisotropic shear coordinates, retaining the narrow parking column. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set + +theorem Primitive.path_segment (p : Primitive) (x : Plane) (θ : ℝ → ℝ) (t : ℝ) : + p.path θ x t = x + θ t • (p.endpoint x - x) := by + cases p <;> ext j <;> fin_cases j <;> + simp [Primitive.path, Primitive.endpoint, translationPath, horizontalPath, verticalPath, + shearX, shearY, Matrix.vecHead, Matrix.vecTail] <;> ring + +theorem Primitive.path_mem_box (p : Primitive) (x : Plane) (θ : ℝ → ℝ) (t : ℝ) + {R : RationalBox 2} (hx : x ∈ R.carrier) (hy : p.endpoint x ∈ R.carrier) + (hθ : θ t ∈ Icc (0 : ℝ) 1) : p.path θ x t ∈ R.carrier := by + rw [p.path_segment] + intro j + have hxj := hx j + have hyj := hy j + change (R.lower j : ℝ) ≤ x j + θ t * (p.endpoint x j - x j) ∧ + x j + θ t * (p.endpoint x j - x j) ≤ (R.upper j : ℝ) + constructor <;> nlinarith [hθ.1, hθ.2] + +def anisotropicPrimitive (a b μ : ℚ) (p : Fin 2 → ℚ) : Fin 4 → Primitive := + ![.vertical p (-μ * b / a), .horizontal p ((μ⁻¹ - 1) * a / b), + .vertical p (b / a), .horizontal p ((μ - 1) * a / b)] + +theorem anisotropicPrimitive_endpoint {a b μ : ℚ} (ha : a ≠ 0) (hb : b ≠ 0) (hμ : μ ≠ 0) + (p : Fin 2 → ℚ) (z : Plane) (k : Fin 4) : + (anisotropicPrimitive a b μ p k).endpoint + ((fun j => (p j : ℝ)) + diagonalScale a b z) = + (fun j => (p j : ℝ)) + diagonalScale a b + (partialShear μ k 1 z) := by + have ha' : (a : ℝ) ≠ 0 := by exact_mod_cast ha + have hb' : (b : ℝ) ≠ 0 := by exact_mod_cast hb + have hμ' : (μ : ℝ) ≠ 0 := by exact_mod_cast hμ + fin_cases k <;> ext j <;> fin_cases j <;> + simp [anisotropicPrimitive, Primitive.endpoint, Primitive.path, verticalPath, horizontalPath, + diagonalScale, partialShear, shearX, shearY, Rat.cast_inv, Rat.cast_div, Rat.cast_mul, + Rat.cast_sub, Rat.cast_one, Rat.cast_neg, Matrix.vecHead, Matrix.vecTail] <;> + try field_simp + +def parkedSource (r : Instruction) (p : Fin 2 → ℚ) (x : Plane) : Plane := + x + ((fun j => (p j : ℝ)) - r.source.center) + +def scaledStage (r : Instruction) (a b : ℚ) (p : Fin 2 → ℚ) (x : Plane) (k : Fin 5) : Plane := + (fun j => (p j : ℝ)) + diagonalScale a b + (scalingEndpoints r.factor (normalizedOffset a b 0 (x - r.source.center)) k) + +theorem scaledStage_zero (r : Instruction) {a b : ℚ} (ha : a ≠ 0) (hb : b ≠ 0) + (p : Fin 2 → ℚ) (x : Plane) : scaledStage r a b p x 0 = parkedSource r p x := by + have ha' : (a : ℝ) ≠ 0 := by exact_mod_cast ha + have hb' : (b : ℝ) ≠ 0 := by exact_mod_cast hb + ext j + fin_cases j <;> + simp [scaledStage, parkedSource, scalingEndpoints, normalizedOffset, diagonalScale] <;> + field_simp <;> ring + +theorem scaledStage_final (r : Instruction) {a b : ℚ} (ha : a ≠ 0) (hb : b ≠ 0) + (p : Fin 2 → ℚ) (x : Plane) : scaledStage r a b p x 4 = + r.affine x + ((fun j => (p j : ℝ)) - r.target.center) := by + have ha' : (a : ℝ) ≠ 0 := by exact_mod_cast ha + have hb' : (b : ℝ) ≠ 0 := by exact_mod_cast hb + ext j + fin_cases j <;> + simp [scaledStage, Instruction.affine, scalingEndpoints, normalizedOffset, diagonalScale] <;> + field_simp <;> ring + +theorem scaledStage_succ (r : Instruction) {a b : ℚ} (ha : a ≠ 0) (hb : b ≠ 0) + (hμ : r.factor ≠ 0) (p : Fin 2 → ℚ) (x : Plane) (k : Fin 4) : + (anisotropicPrimitive a b r.factor p k).endpoint (scaledStage r a b p x k.castSucc) = + scaledStage r a b p x k.succ := by + rw [scaledStage, anisotropicPrimitive_endpoint ha hb hμ] + have he := partial_shear_is_segment (show (r.factor : ℝ) ≠ 0 by exact_mod_cast hμ) + (normalizedOffset a b 0 (x - r.source.center)) k (1 : ℝ) + simp only [sub_self, zero_smul, one_smul, zero_add] at he + rw [he] + rfl + +theorem normalizedOffset_parkedSource (r : Instruction) (a b : ℝ) + (p : Fin 2 → ℚ) (x : Plane) : + normalizedOffset a b (fun j => (p j : ℝ)) (parkedSource r p x) = + normalizedOffset a b 0 (x - r.source.center) := by + ext j + fin_cases j <;> simp [normalizedOffset, parkedSource] <;> ring + +theorem scaledStage_eq_route_start (r : Instruction) {a b : ℚ} + (hμ : r.factor ≠ 0) (p : Fin 2 → ℚ) (x : Plane) (k : Fin 4) : + scaledStage r a b p x k.castSucc = + anisotropicRoute a b r.factor (fun j => (p j : ℝ)) (parkedSource r p x) (slotStart k) := by + have hμ' : (r.factor : ℝ) ≠ 0 := by exact_mod_cast hμ + have ht : (slotStart k : ℝ) ∈ slotRegion k := by + fin_cases k <;> norm_num [slotStart, slotRegion] + have hc : slotClock k (slotStart k) = 0 := + smoothRamp_before (by exact_mod_cast slot_order k) le_rfl + rw [anisotropicRoute, normalizedOffset_parkedSource, + route_eq_stage hμ' 0 _ ht] + simp only [fourShearPath, hc, sub_zero, partial_shear_is_segment hμ', + zero_smul, one_smul, zero_add, add_zero] + rfl + +theorem scaledStage_eq_route_final (r : Instruction) {a b : ℚ} + (hμ : r.factor ≠ 0) (p : Fin 2 → ℚ) (x : Plane) : + scaledStage r a b p x 4 = + anisotropicRoute a b r.factor (fun j => (p j : ℝ)) (parkedSource r p x) 1 := by + have hμ' : (r.factor : ℝ) ≠ 0 := by exact_mod_cast hμ + rw [anisotropicRoute, normalizedOffset_parkedSource, route_final hμ'] + simp [scaledStage, scalingEndpoints] + +theorem scaledStage_mem_parking {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) + (i : Fin n) (r : Instruction) (hr : 0 < r.factor) + (himage : r.affine '' r.source.carrier = r.target.carrier) + (hsx : r.source.halfWidth 0 ≤ (PlanarRouting.parkingScale n : ℝ) * (κ : ℝ) / 2) + (htx : r.target.halfWidth 0 ≤ (PlanarRouting.parkingScale n : ℝ) * (κ : ℝ) / 2) + (hsy : r.source.halfWidth 1 ≤ (3 / 8 : ℝ) * (κ : ℝ) / 2) + (hty : r.target.halfWidth 1 ≤ (3 / 8 : ℝ) * (κ : ℝ) / 2) + {x : Plane} (hx : x ∈ r.source.carrier) (k : Fin 5) : + scaledStage r (PlanarRouting.parkingScale n) (3 / 8) (PlanarRouting.parkingCenter n i) x k ∈ + (PlanarRouting.parkingBox n κ i).carrier := by + have hroute := PlanarRouting.instruction_scaling_mem_parking hκ i r hr himage hsx htx hsy hty hx + refine Fin.lastCases ?_ (fun j => ?_) k + · change scaledStage r (PlanarRouting.parkingScale n) (3 / 8) + (PlanarRouting.parkingCenter n i) x 4 ∈ _ + rw [scaledStage_eq_route_final r (a := PlanarRouting.parkingScale n) (b := 3 / 8) + hr.ne' (PlanarRouting.parkingCenter n i) x] + simpa only [parkedSource, Rat.cast_div, Rat.cast_ofNat] using hroute 1 + · rw [scaledStage_eq_route_start r (a := PlanarRouting.parkingScale n) (b := 3 / 8) + hr.ne' (PlanarRouting.parkingCenter n i) x j] + simpa only [parkedSource, Rat.cast_div, Rat.cast_ofNat] using hroute (slotStart j) + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClearance.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClearance.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a2f3d7a1d3d5c00bb7d3bf10b0e44380024c62a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClearance.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProgramBounds + +namespace OAI + +/-! Clearance for the actual extraction and insertion tubes, with the +computed common collar. These inequalities are independent of tape codes. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +theorem recenter_recenter (R : RationalBox 2) (p : Fin 2 → ℚ) : + recenter (recenter R p) (centerQ R) = R := by + apply box_ext + · funext j + change centerQ R j - halfWidthQ (recenter R p) j = R.lower j + rw [recenter_halfWidthQ, centerQ_sub_halfWidthQ] + · funext j + change centerQ R j + halfWidthQ (recenter R p) j = R.upper j + rw [recenter_halfWidthQ, centerQ_add_halfWidthQ] + +theorem translationTube_reverse (R : RationalBox 2) (p : Fin 2 → ℚ) : + translationTube (recenter R p) (centerQ R) = translationTube R p := by + unfold translationTube + rw [recenter_recenter] + apply box_ext <;> funext j + · exact min_comm _ _ + · exact max_comm _ _ + +theorem horizontalTube_upper (R : RationalBox 2) (x : ℚ) : + (translationTube R (horizontalCenter R x)).upper 1 = R.upper 1 := by + change max (R.upper 1) (centerQ R 1 + halfWidthQ R 1) = R.upper 1 + rw [centerQ_add_halfWidthQ, max_self] + +theorem low_tube_parking_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + (R : RationalBox 2) (x : ℚ) (hR : R.upper 1 ≤ 1 / 3) (i : Fin n) : + EndpointGap (1 / 4) (translationTube R (horizontalCenter R x)) (parkingBox n κ i) := by + refine ⟨1, Or.inl ?_⟩ + rw [horizontalTube_upper] + change R.upper 1 + 1 / 4 ≤ 3 / 4 - (3 / 8) * κ + linarith + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian + +theorem branchIndex_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (branchIndex M hM) := by + intro b c he + have h := congrArg (branchAt M hM) he + simpa only [branchAt_index] using h + +theorem source_branch_gap (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + 16 * routingCollar M hM ≤ boxGap (instruction M hM b).source (instruction M hM c).source := by + have hi := routingCollar_source_gap M hM + (show branchIndex M hM b ≠ branchIndex M hM c from fun h => hne (branchIndex_injective M hM h)) + simpa only [sourceFamily, branchAt_index] using hi + +theorem target_branch_gap (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + 16 * routingCollar M hM ≤ boxGap (instruction M hM b).target (instruction M hM c).target := by + have hi := routingCollar_target_gap M hM + (show branchIndex M hM b ≠ branchIndex M hM c from fun h => hne (branchIndex_injective M hM h)) + simpa only [targetFamily, branchAt_index] using hi + +theorem routingCollar_small (M : Alternating.Machine) (hM : M.WellFormed) : + 2 * routingCollar M hM < 1 / 4 ∧ + 2 * routingCollar M hM < 1 / 24 ∧ + 2 * routingCollar M hM < parkingScale (geometricBranches M hM).length := by + have h := routingCollar_parking_bound M hM + have hp := parkingScale_pos (geometricBranches M hM).length + have hu := parkingScale_le (geometricBranches M hM).length + constructor + · linarith + constructor <;> linarith + +theorem source_extraction_clearance (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (sourceOrder M hM).length} (hij : i < j) (endpoint : ℚ) + (hendpoint : centerQ (instruction M hM ((sourceOrder M hM).get i)).source 0 ≤ endpoint) : + let R := (instruction M hM ((sourceOrder M hM).get i)).source + let S := (instruction M hM ((sourceOrder M hM).get j)).source + EndpointGap (boxGap R S) (translationTube R (horizontalCenter R endpoint)) S ∧ + 2 * routingCollar M hM < boxGap R S := by + let b := (sourceOrder M hM).get i + let c := (sourceOrder M hM).get j + have hne : b ≠ c := by + intro he + exact (ne_of_lt hij) ((List.nodup_iff_injective_get.mp (sourceOrder_nodup M hM)) he) + have hg := sourceOrder_sweep_gap M hM hij (endpoint + halfWidthQ (instruction M hM b).source 0) + have hsmall := source_branch_gap M hM hne + have hδ := routingCollar_pos M hM + constructor + · rw [horizontalTube_eq_rightSweep _ hendpoint] + exact hg.2 + · linarith + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClockMargins.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClockMargins.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7b32ecc328ea1515d2e9ed9b5a7e7d831222809 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarClockMargins.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarInitialShift + +namespace OAI + +/-! Height bounds for whole instruction rectangles, rather than just encoded +points. These bounds supply the clock and observer margins of the routing +segments, including their filled interiors. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows Radix + +theorem coordinateMap_nonterminal_vertical (M : Alternating.Machine) (hM : M.WellFormed) + {x : Plane} (hx : 1 / 4 - (bandScale M : ℝ) / 2 ≤ x 0 ∧ + x 0 ≤ 1 / 4 + (bandScale M : ℝ) / 2) : + 1 / 4 - 3 * (bandScale M : ℝ) / 16 ≤ coordinateMap M hM x 1 ∧ + coordinateMap M hM x 1 ≤ 1 / 4 + 3 * (bandScale M : ℝ) / 16 := by + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + change 1 / 4 - 3 * (bandScale M : ℝ) / 16 ≤ + ((43 / 128 : ℚ) : ℝ) - ((11 / 32 : ℚ) : ℝ) * x 0 ∧ + ((43 / 128 : ℚ) : ℝ) - ((11 / 32 : ℚ) : ℝ) * x 0 ≤ + 1 / 4 + 3 * (bandScale M : ℝ) / 16 + norm_num only [Rat.cast_div, Rat.cast_ofNat] + constructor <;> nlinarith [hx.1, hx.2] + +theorem instruction_source_nonhalting (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : recorderHalting M b.source = false := by + have he (q : Control (State M) (Alphabet M)) : + haltingControl (finiteMachine M hM) q = recorderHalting M q := by + cases q <;> rfl + rw [← he] + exact b.rule.source_nonhalting + +theorem instruction_source_vertical (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) : + 1 / 4 - 3 * (bandScale M : ℝ) / 16 ≤ x 1 ∧ + x 1 ≤ 1 / 4 + 3 * (bandScale M : ℝ) / 16 := by + change x ∈ (PlanarConjugacy.box _ _ _ _ _).carrier at hx + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] at hx + obtain ⟨y, hy, rfl⟩ := hx + exact coordinateMap_nonterminal_vertical M hM + (stateBox_nonterminal_x M b.source (instruction_source_nonhalting M hM b) + (geometricInstruction_source_unit M hM b) hy) + +theorem instruction_target_nonterminal_vertical (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (hn : recorderHalting M b.target = false) {x : Plane} + (hx : x ∈ (instruction M hM b).target.carrier) : + 1 / 4 - 3 * (bandScale M : ℝ) / 16 ≤ x 1 ∧ + x 1 ≤ 1 / 4 + 3 * (bandScale M : ℝ) / 16 := by + change x ∈ (PlanarConjugacy.box _ _ _ _ _).carrier at hx + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] at hx + obtain ⟨y, hy, rfl⟩ := hx + exact coordinateMap_nonterminal_vertical M hM + (stateBox_nonterminal_x M b.target hn (geometricInstruction_target_unit M hM b) hy) + +theorem shifted_vertical_band (M : Alternating.Machine) (δ : Fin 2 → ℚ) + (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) {x : Plane} + (hx : 1 / 4 - 3 * (bandScale M : ℝ) / 16 ≤ x 1 ∧ + x 1 ≤ 1 / 4 + 3 * (bandScale M : ℝ) / 16) : + 3 / 16 ≤ shiftPoint δ x 1 ∧ shiftPoint δ x 1 ≤ 5 / 16 := by + have hk := bandScale_le_real M + obtain ⟨hdlo, hdhi⟩ := abs_le.mp hδ + change 3 / 16 ≤ x 1 + (δ 1 : ℝ) ∧ x 1 + (δ 1 : ℝ) ≤ 5 / 16 + constructor <;> linarith [hx.1, hx.2] + +theorem shifted_instruction_source_height (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (δ : Fin 2 → ℚ) + (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) : + 3 / 16 ≤ shiftPoint δ x 1 ∧ shiftPoint δ x 1 ≤ 5 / 16 := + shifted_vertical_band M δ hδ (instruction_source_vertical M hM b hx) + +theorem shifted_instruction_target_nonterminal_height + (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (hn : recorderHalting M b.target = false) + (δ : Fin 2 → ℚ) (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) {x : Plane} + (hx : x ∈ (instruction M hM b).target.carrier) : + 3 / 16 ≤ shiftPoint δ x 1 ∧ shiftPoint δ x 1 ≤ 5 / 16 := + shifted_vertical_band M δ hδ (instruction_target_nonterminal_vertical M hM b hn hx) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactBridge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc1ce7ff7e09e6aee499bfecaab0901727297a92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactBridge.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarProcessor +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedPlanarProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPerturbations + +namespace OAI + +/-! Agreement of the compact planar field with the finite periodic scalar +expression on the open unit-square chart, at every phase. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set + +theorem periodic_eq_of_eqOn_unit {E : Type*} {f g : ℝ → E} + (hf : Function.Periodic f 1) (hg : Function.Periodic g 1) + (he : EqOn f g (Icc (0 : ℝ) 1)) : f = g := by + funext t + have hf' : f (Int.fract t) = f t := by + simpa only [Int.fract, mul_one] using hf.sub_int_mul_eq (x := t) ⌊t⌋ + have hg' : g (Int.fract t) = g t := by + simpa only [Int.fract, mul_one] using hg.sub_int_mul_eq (x := t) ⌊t⌋ + exact hf'.symm.trans ((he ⟨Int.fract_nonneg t, (Int.fract_lt_one t).le⟩).trans hg') + +theorem planarSlice_periodic {H : FieldExpr} + (hP : CubePeriodic 1 (SpatialExpression.spatialValue H)) (x : Plane) : + Function.Periodic (fun s => planarSlice H s x) 1 := by + intro s + have he : (fun Y => SpatialExpression.spatialValue H (atHeight Y (s + 1))) = + (fun Y => SpatialExpression.spatialValue H (atHeight Y s)) := by + funext Y + have hv : atHeight Y (s + 1) = atHeight Y s + latticeVector 1 ![0, 0, 1] := by + ext j + fin_cases j <;> simp [atHeight, latticeVector] + rw [hv] + exact hP _ _ + change PlanarHamiltonian.field _ x = PlanarHamiltonian.field _ x + rw [he] + +namespace Recorder.Planar +open PlanarHamiltonian + +theorem normalized_planar_field_on_chart (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (s : ℝ) (x : Plane) + (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + PlanarHamiltonian.periodicVelocity (normalizedPulse I hI) s x = + planarSlice (normalizedHamiltonian I hI) s x := by + have he : (fun t => PlanarHamiltonian.periodicVelocity (normalizedPulse I hI) t x) = + (fun t => planarSlice (normalizedHamiltonian I hI) t x) := by + apply periodic_eq_of_eqOn_unit (PlanarHamiltonian.periodicVelocity_periodic _ x) + (planarSlice_periodic (normalizedHamiltonian_periodic I hI) x) + intro t ht + exact (PlanarHamiltonian.periodicVelocity_on_unit (normalizedPulse_valid I hI) + (normalizedPulse_inUnit I hI) ht x).trans + (processorExpression_planar_field (normalizedPulse_valid I hI) + (normalizedPulse_inUnit I hI) ht hx₀ hx₁).symm + exact congrFun he s + +end Recorder.Planar +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactLift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..86c4ffc73c5e308d5735db6376ad1bd1cf12e426 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCompactLift.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarFlow + +namespace OAI + +/-! A compact vertical cutoff of a planar incompressible processor. Its +horizontal trajectories at a cutoff plateau remain exact, and the cutoff +introduces no divergence because the lifted field has zero third component. -/ + +noncomputable section +namespace ForcedComputation.CompactLift +open ShearFlows VelocityDetector Set +open scoped ContDiff BigOperators + +def spatial (χ : ℝ → ℝ) (a : Plane → Plane) (x : Space) : Space := + χ (x 2) • triangularLift a (fun _ => 0) x + +def velocity (χ : ℝ → ℝ) (V : ℝ → Plane → Plane) : Velocity := + fun y => spatial χ (V y.1) y.2 + +theorem spatial_smooth {χ : ℝ → ℝ} {a : Plane → Plane} + (hχ : ContDiff ℝ ∞ χ) (ha : ContDiff ℝ ∞ a) : + ContDiff ℝ ∞ (spatial χ a) := + (hχ.comp (contDiff_apply ℝ ℝ (2 : Fin 3))).smul + (triangularLift_smooth ha contDiff_const) + +theorem velocity_smooth {χ : ℝ → ℝ} {V : ℝ → Plane → Plane} + (hχ : ContDiff ℝ ∞ χ) (hV : ContDiff ℝ ∞ (Function.uncurry V)) : + ContDiff ℝ ∞ (velocity χ V) := by + have hi : ContDiff ℝ ∞ (fun y : SpaceTime => (y.1, horizontalLinear y.2)) := + contDiff_fst.prodMk (horizontalLinear.contDiff.comp contDiff_snd) + have hW : ContDiff ℝ ∞ (fun y : SpaceTime => planeInclusion (V y.1 (horizontalLinear y.2))) := + planeInclusion.contDiff.comp (hV.comp hi) + have he : velocity χ V = fun y => χ (y.2 2) • planeInclusion (V y.1 (horizontalLinear y.2)) := by + funext y + simp [velocity, spatial, triangularLift] + rw [he] + exact (hχ.comp ((contDiff_apply ℝ ℝ (2 : Fin 3)).comp contDiff_snd)).smul hW + +theorem spatial_third (χ : ℝ → ℝ) (a : Plane → Plane) (x : Space) : + spatial χ a x 2 = 0 := by + simp [spatial, triangularLift_eq, atHeight] + +theorem spatial_atHeight {χ : ℝ → ℝ} (a : Plane → Plane) {z : ℝ} + (hz : χ z = 1) (x : Plane) : spatial χ a (atHeight x z) = planeInclusion (a x) := by + simp only [spatial, triangularLift, horizontalLinear_eq, atHeight_horizontal, + zero_smul, add_zero] + change χ z • planeInclusion (a x) = _ + rw [hz, one_smul] + +theorem height_fderiv {χ : ℝ → ℝ} (hχ : ContDiff ℝ ∞ χ) (x : Space) (j : Fin 3) : + fderiv ℝ (fun y : Space => χ (y 2)) x (basis j) = deriv χ (x 2) * basis j 2 := by + have hd := ((hχ.differentiable (by simp) (x 2)).hasDerivAt).comp_hasFDerivAt x + (ContinuousLinearMap.proj (2 : Fin 3) : Space →L[ℝ] ℝ).hasFDerivAt + simpa only [Function.comp_def, smul_apply, + ContinuousLinearMap.proj_apply, smul_eq_mul] using + congrArg (fun L => L (basis j)) hd.fderiv + +theorem spatial_divergence {χ : ℝ → ℝ} {a : Plane → Plane} + (hχ : ContDiff ℝ ∞ χ) (ha : ContDiff ℝ ∞ a) (x : Space) : + divergence (spatial χ a) x = χ (x 2) * PlanarHamiltonian.divergence a (horizontal x) := by + let W := triangularLift a (fun _ => 0) + have hw : ContDiff ℝ ∞ W := triangularLift_smooth ha contDiff_const + have hc : ContDiff ℝ ∞ (fun y : Space => χ (y 2)) := hχ.comp (contDiff_apply ℝ ℝ (2 : Fin 3)) + have hd (j : Fin 3) : derivative (spatial χ a) j x j = + χ (x 2) * derivative W j x j + + (deriv χ (x 2) * basis j 2) * W x j := by + unfold derivative + rw [show spatial χ a = (fun y : Space => χ (y 2) • W y) from rfl, + fderiv_fun_smul (hc.differentiable (by simp) x) (hw.differentiable (by simp) x)] + simp only [add_apply, smul_apply, + ContinuousLinearMap.smulRight_apply, Pi.add_apply, Pi.smul_apply, smul_eq_mul, + height_fderiv hχ] + have hz : W x 2 = 0 := by simp [W, triangularLift_eq, atHeight] + have he : divergence (spatial χ a) x = χ (x 2) * divergence W x := by + rw [divergence, divergence, Fin.sum_univ_three, Fin.sum_univ_three] + rw [hd, hd, hd] + simp only [basis, Pi.single_eq_of_ne (by decide : (2 : Fin 3) ≠ 0), + Pi.single_eq_of_ne (by decide : (2 : Fin 3) ≠ 1), Pi.single_eq_same, + hz, mul_zero, add_zero] + ring + rw [he, triangularLift_divergence ha contDiff_const] + +theorem atHeight_hasDerivAt {γ : ℝ → Plane} {v : Plane} {t z : ℝ} + (hγ : HasDerivAt γ v t) : + HasDerivAt (fun s => atHeight (γ s) z) (planeInclusion v) t := by + have hd := (planeInclusion.hasFDerivAt.comp_hasDerivAt t hγ).add_const (z • basis 2) + convert hd using 1 + · funext s + ext j + fin_cases j <;> simp [planeInclusion, atHeight, basis] + +theorem trajectory_atHeight {χ : ℝ → ℝ} {V : ℝ → Plane → Plane} + {γ : ℝ → Plane} {a t z : ℝ} (hz : χ z = 1) + (hγ : HasDerivAt γ (V (a + t) (γ t)) t) : + HasDerivAt (fun s => atHeight (γ s) z) + (velocity χ V (a + t, atHeight (γ t) z)) t := by + simpa only [velocity, spatial_atHeight _ hz] using atHeight_hasDerivAt (z := z) hγ + +end ForcedComputation.CompactLift + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConcatenation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConcatenation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d12a0c12979bac0ac413cc4255221d01d5f9f4f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConcatenation.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SparsePulseCurves + +namespace OAI + +/-! Finite pulse concatenation for the actual planar transition flow. +This gives whole-rectangle routing independently of the autonomous suspension. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped NNReal + +theorem IsPlanarTransition.eqOn_of_candidate {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + {K : ℝ≥0} (hV : ∀ t, LipschitzWith K (V t)) + (a : ℝ) {b c : ℝ} (x : Plane) (γ : ℝ → Plane) + (hc : ContinuousOn γ (Icc b c)) (he : γ b = Ψ a b x) + (hγ : ∀ t ∈ Ico b c, HasDerivAt γ (V (a + t) (γ t)) t) : + EqOn (fun t => Ψ a t x) γ (Icc b c) := by + exact ODE_solution_unique_of_mem_Icc_right (s := fun _ => univ) + (fun t _ => (hV (a + t)).lipschitzOnWith) + ((continuous_iff_continuousAt.mpr (fun t => (hΨ.ode a t x).continuousAt)).continuousOn) + (fun t _ => (hΨ.ode a t x).hasDerivWithinAt) (fun _ _ => mem_univ _) + hc (fun t ht => (hγ t ht).hasDerivWithinAt) (fun _ _ => mem_univ _) he.symm + +theorem planar_transition_chain {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + {K : ℝ≥0} (hV : ∀ t, LipschitzWith K (V t)) (a : ℝ) + {N : ℕ} {cuts : ℕ → ℝ} {γ : ℕ → ℝ → Plane} {p : ℕ → Plane} {x : Plane} + (hzero : cuts 0 = 0) (hx : x = p 0) + (hcuts : ∀ i < N, cuts i ≤ cuts (i + 1)) + (hstart : ∀ i < N, γ i (cuts i) = p i) + (hend : ∀ i < N, γ i (cuts (i + 1)) = p (i + 1)) + (hc : ∀ i < N, ContinuousOn (γ i) (Icc (cuts i) (cuts (i + 1)))) + (hd : ∀ i < N, ∀ s ∈ Ico (cuts i) (cuts (i + 1)), + HasDerivAt (γ i) (V (a + s) (γ i s)) s) : + (∀ i ≤ N, Ψ a (cuts i) x = p i) ∧ + (∀ i < N, EqOn (fun s => Ψ a s x) (γ i) (Icc (cuts i) (cuts (i + 1)))) := by + have ha : ∀ i ≤ N, Ψ a (cuts i) x = p i := by + intro i + induction i with + | zero => + intro _ + rw [hzero, hΨ.initial, hx] + | succ i ih => + intro hi + have hi' : i < N := Nat.lt_of_lt_of_le (Nat.lt_succ_self i) hi + have he := hΨ.eqOn_of_candidate hV a x (γ i) (hc i hi') + ((hstart i hi').trans (ih (Nat.le_of_lt hi')).symm) (hd i hi') + have hh := he ⟨hcuts i hi', le_rfl⟩ + simpa only [hend i hi', Nat.succ_eq_add_one] using hh + refine ⟨ha, ?_⟩ + intro i hi + exact hΨ.eqOn_of_candidate hV a x (γ i) (hc i hi) + ((hstart i hi).trans (ha i (Nat.le_of_lt hi)).symm) (hd i hi) + +namespace PlanarRouting + +theorem sparse_planarTransition {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + {K : ℝ≥0} (hV : ∀ t, LipschitzWith K (V t)) + {m n N : ℕ} (hN : 0 < N) (hn : n ≤ N) + {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + (hzero : cuts 0 = 0) (hone : cuts N = 1) + (hcuts : ∀ i < N, cuts i ≤ cuts (i + 1)) + (hstart : ∀ k, γ k (cuts (J k).val) = p k.castSucc) + (hfinish : ∀ k, γ k (cuts ((J k).val + 1)) = p k.succ) + (hc : ∀ k, ContinuousOn (γ k) (Icc (cuts (J k).val) (cuts ((J k).val + 1)))) + (hd : ∀ k s, s ∈ Ico (cuts (J k).val) (cuts ((J k).val + 1)) → + HasDerivAt (γ k) (V s (γ k s)) s) + (hz : ∀ i < N, (∀ k, (J k).val ≠ i) → + ∀ s ∈ Ico (cuts i) (cuts (i + 1)), V s (sparseAnchor J p i) = 0) + {S : Set Plane} (hp : ∀ k, p k ∈ S) + (hmem : ∀ k s, s ∈ Icc (cuts (J k).val) (cuts ((J k).val + 1)) → γ k s ∈ S) : + Ψ 0 1 (p 0) = p (Fin.last m) ∧ + ∀ s ∈ Icc (0 : ℝ) 1, Ψ 0 s (p 0) ∈ S := by + have h := planar_transition_chain hΨ hV 0 (N := N) (cuts := cuts) + (γ := sparseCurve J p γ) (p := sparseAnchor J p) (x := p 0) hzero + (by rw [sparseAnchor_zero]) hcuts + (fun i _ => (sparseCurve_endpoints hJ p γ cuts hstart hfinish i).1) + (fun i _ => (sparseCurve_endpoints hJ p γ cuts hstart hfinish i).2) + (fun i _ => sparseCurve_continuousOn hJ p γ cuts hc i) + (fun i hi s hs => by + simpa only [zero_add] using sparseCurve_ode hJ p γ cuts V hd i s hs + (fun hne => hz i hi hne s hs)) + constructor + · have he := h.1 N le_rfl + rw [hone, sparseAnchor_after_last J p hn] at he + exact he + · intro s hs + cases N with + | zero => omega + | succ l => + obtain ⟨i, hi, his⟩ := finite_cuts_cover l cuts hcuts + (by simpa only [hzero, hone] using hs) + have he : Ψ 0 s (p 0) = sparseCurve J p γ i s := h.2 i hi his + rw [he] + exact sparseCurve_mem hJ p γ cuts hp hmem i s his + +end PlanarRouting +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConjugacy.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConjugacy.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d954f9091727f97ca45946aebcdf201e47a7271 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarConjugacy.lean @@ -0,0 +1,185 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RectangleAffine + +namespace OAI + +/-! A positive-determinant affine change of planar coordinates which places +halting state bands below nonhalting bands and swaps reciprocal factors. -/ + +noncomputable section + +namespace ForcedComputation.PlanarConjugacy + +open ShearFlows Set + +/-- The determinant of the linear part is `ε * c`. -/ +def map (a b ε c : ℚ) (x : Plane) : Plane := + letI := ShearFlows.neZeroTwo + ![(a : ℝ) + (ε : ℝ) * x 1, (b : ℝ) - (c : ℝ) * x 0] + +def box (a b ε c : ℚ) (R : RationalBox 2) : RationalBox 2 := + letI := ShearFlows.neZeroTwo + ⟨![a + ε * R.lower 1, b - c * R.upper 0], + ![a + ε * R.upper 1, b - c * R.lower 0]⟩ + +theorem box_positive {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) + {R : RationalBox 2} (hR : R.positive) : (box a b ε c R).positive := by + intro j + fin_cases j <;> dsimp [box] + · exact add_lt_add_right (mul_lt_mul_of_pos_left (hR 1) hε) a + · exact sub_lt_sub_left (mul_lt_mul_of_pos_left (hR 0) hc) b + +theorem box_center (a b ε c : ℚ) (R : RationalBox 2) : + (box a b ε c R).center = map a b ε c R.center := by + funext j + fin_cases j <;> simp [box, map, RationalBox.center] <;> ring_nf + +theorem box_halfWidth (a b ε c : ℚ) (R : RationalBox 2) : + (box a b ε c R).halfWidth = + ![(ε : ℝ) * R.halfWidth 1, (c : ℝ) * R.halfWidth 0] := by + funext j + fin_cases j <;> simp [box, RationalBox.halfWidth] <;> ring_nf + +theorem mem_box_of_mem {a b ε c : ℚ} (hε : 0 ≤ ε) (hc : 0 ≤ c) + {R : RationalBox 2} {x : Plane} (hx : x ∈ R.carrier) : + map a b ε c x ∈ (box a b ε c R).carrier := by + have hε' : (0 : ℝ) ≤ ε := by exact_mod_cast hε + have hc' : (0 : ℝ) ≤ c := by exact_mod_cast hc + intro j + fin_cases j <;> dsimp [map, box] <;> push_cast + · constructor <;> nlinarith [(hx 1).1, (hx 1).2] + · constructor <;> nlinarith [(hx 0).1, (hx 0).2] + +theorem map_injective {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) : + Function.Injective (map a b ε c) := by + have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + have hc' : (0 : ℝ) < c := by exact_mod_cast hc + intro x y hxy + have h₀ := congrFun hxy 0 + have h₁ := congrFun hxy 1 + simp only [map, Matrix.cons_val_zero, Matrix.cons_val_one] at h₀ h₁ + funext j + fin_cases j + · change x 0 = y 0 + apply mul_left_cancel₀ hc'.ne' + linarith + · change x 1 = y 1 + apply mul_left_cancel₀ hε'.ne' + linarith + +theorem box_image {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) + (R : RationalBox 2) : + map a b ε c '' R.carrier = (box a b ε c R).carrier := by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + exact mem_box_of_mem hε.le hc.le hx + · have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + have hc' : (0 : ℝ) < c := by exact_mod_cast hc + intro y hy + let x : Plane := ![((b : ℝ) - y 1) / (c : ℝ), + (y 0 - (a : ℝ)) / (ε : ℝ)] + refine ⟨x, ?_, ?_⟩ + · have hy₀ := hy 0 + have hy₁ := hy 1 + simp only [box, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_add, Rat.cast_sub, Rat.cast_mul] at hy₀ hy₁ + intro j + fin_cases j <;> dsimp [x] + · constructor + · apply (le_div_iff₀ hc').mpr + nlinarith [hy₁.2] + · apply (div_le_iff₀ hc').mpr + nlinarith [hy₁.1] + · constructor + · apply (le_div_iff₀ hε').mpr + nlinarith [hy₀.1] + · apply (div_le_iff₀ hε').mpr + nlinarith [hy₀.2] + · funext j + fin_cases j <;> dsimp [map, x] <;> field_simp [hε'.ne', hc'.ne'] <;> ring_nf + +theorem norm_lower_bound {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) (x y : Plane) : + min (ε : ℝ) (c : ℝ) * ‖x - y‖ ≤ ‖map a b ε c x - map a b ε c y‖ := by + have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + have hc' : (0 : ℝ) < c := by exact_mod_cast hc + let m : ℝ := min (ε : ℝ) (c : ℝ) + have hm : 0 < m := lt_min hε' hc' + have h₀ : (ε : ℝ) * |x 1 - y 1| ≤ ‖map a b ε c x - map a b ε c y‖ := by + have h := norm_le_pi_norm (map a b ε c x - map a b ε c y) 0 + have he : (map a b ε c x - map a b ε c y) 0 = (ε : ℝ) * (x 1 - y 1) := by + simp only [map, Pi.sub_apply, Matrix.cons_val_zero] + ring_nf + simpa only [he, Real.norm_eq_abs, abs_mul, abs_of_pos hε'] using h + have h₁ : (c : ℝ) * |x 0 - y 0| ≤ ‖map a b ε c x - map a b ε c y‖ := by + have h := norm_le_pi_norm (map a b ε c x - map a b ε c y) 1 + have he : (map a b ε c x - map a b ε c y) 1 = -(c : ℝ) * (x 0 - y 0) := by + change ((b : ℝ) - (c : ℝ) * x 0) - ((b : ℝ) - (c : ℝ) * y 0) = _ + ring_nf + simpa only [he, Real.norm_eq_abs, abs_mul, abs_neg, abs_of_pos hc'] using h + have hnorm : ‖x - y‖ ≤ ‖map a b ε c x - map a b ε c y‖ / m := by + apply (pi_norm_le_iff_of_nonneg (div_nonneg (norm_nonneg _) hm.le)).mpr + intro j + rw [le_div_iff₀ hm] + fin_cases j + · change |x 0 - y 0| * m ≤ _ + dsimp only [m] + have hb := (mul_le_mul_of_nonneg_right (min_le_right (ε : ℝ) (c : ℝ)) + (abs_nonneg (x 0 - y 0))).trans h₁ + linarith + · change |x 1 - y 1| * m ≤ _ + dsimp only [m] + have hb := (mul_le_mul_of_nonneg_right (min_le_left (ε : ℝ) (c : ℝ)) + (abs_nonneg (x 1 - y 1))).trans h₀ + linarith + simpa only [m, mul_comm] using (le_div_iff₀ hm).mp hnorm + +theorem separated_image {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) + {S T : Set Plane} (hST : PositivelySeparated S T) : + PositivelySeparated (map a b ε c '' S) (map a b ε c '' T) := by + obtain ⟨δ, hδ, hd⟩ := hST + have hm : 0 < min (ε : ℝ) (c : ℝ) := lt_min (by exact_mod_cast hε) (by exact_mod_cast hc) + refine ⟨min (ε : ℝ) (c : ℝ) * δ, mul_pos hm hδ, ?_⟩ + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ + exact (mul_le_mul_of_nonneg_left (hd x hx y hy) hm.le).trans (norm_lower_bound hε hc x y) + +def instruction (a b ε c : ℚ) (r : Instruction) : Instruction := + ⟨box a b ε c r.source, box a b ε c r.target, r.factor⁻¹⟩ + +theorem instruction_factor_pos {a b ε c : ℚ} {r : Instruction} + (hr : 0 < r.factor) : 0 < (instruction a b ε c r).factor := + inv_pos.mpr hr + +theorem instruction_conjugacy (a b ε c : ℚ) (r : Instruction) (hr : r.factor ≠ 0) + (x : Plane) : + (instruction a b ε c r).affine (map a b ε c x) = map a b ε c (r.affine x) := by + have hr' : (r.factor : ℝ) ≠ 0 := by exact_mod_cast hr + have hsource := box_center a b ε c r.source + have htarget := box_center a b ε c r.target + funext j + fin_cases j <;> + simp only [Instruction.affine, instruction, hsource, htarget, map, + Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_inv] + · field_simp + ring_nf + · field_simp + ring_nf + +theorem instruction_image_eq {a b ε c : ℚ} (hε : 0 < ε) (hc : 0 < c) + {r : Instruction} (hr : r.factor ≠ 0) + (himage : r.affine '' r.source.carrier = r.target.carrier) : + (instruction a b ε c r).affine '' (instruction a b ε c r).source.carrier = + (instruction a b ε c r).target.carrier := by + change (instruction a b ε c r).affine '' (box a b ε c r.source).carrier = + (box a b ε c r.target).carrier + rw [← box_image hε hc r.source, ← box_image hε hc r.target, image_image] + have hcomp : (instruction a b ε c r).affine ∘ map a b ε c = + map a b ε c ∘ r.affine := by + funext x + exact instruction_conjugacy a b ε c r hr x + simp only [Function.comp_def] at hcomp + rw [hcomp, ← image_image, himage] + +end ForcedComputation.PlanarConjugacy + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCutoff.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2d5d7b7a42973c14af85b10d5afed31f472ed6c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarCutoff.lean @@ -0,0 +1,131 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarHamiltonian +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Extension + +namespace OAI + +/-! Explicit rational collars for compact planar Hamiltonian pulses. -/ + +noncomputable section + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter +open scoped Topology ContDiff + +def rectangleCutoff (R : RationalBox 2) (δ : ℚ) (x : Plane) : ℝ := + letI := ShearFlows.neZeroTwo + letI := ShearFlows.twoAtLeastTwo + closedCutoff (R.lower 0 - 2 * δ) (R.lower 0 - δ) + (R.upper 0 + δ) (R.upper 0 + 2 * δ) (x 0) * + closedCutoff (R.lower 1 - 2 * δ) (R.lower 1 - δ) + (R.upper 1 + δ) (R.upper 1 + 2 * δ) (x 1) + +def rectangleCollar (R : RationalBox 2) (δ : ℚ) : RationalBox 2 := + ⟨fun j => R.lower j - 2 * δ, fun j => R.upper j + 2 * δ⟩ + +def rectanglePlateau (R : RationalBox 2) (δ : ℚ) : Set Plane := + {x | ∀ j, (R.lower j : ℝ) - δ < x j ∧ x j < (R.upper j : ℝ) + δ} + +theorem rectangleCutoff_smooth (R : RationalBox 2) (δ : ℚ) : + ContDiff ℝ ∞ (rectangleCutoff R δ) := by + exact ((closedCutoff_smooth _ _ _ _).comp (contDiff_apply ℝ ℝ 0)).mul + ((closedCutoff_smooth _ _ _ _).comp (contDiff_apply ℝ ℝ 1)) + +theorem rectanglePlateau_open (R : RationalBox 2) (δ : ℚ) : + IsOpen (rectanglePlateau R δ) := by + have he : rectanglePlateau R δ = + ⋂ j : Fin 2, {x : Plane | (R.lower j : ℝ) - δ < x j ∧ x j < (R.upper j : ℝ) + δ} := by + ext x + simp [rectanglePlateau] + rw [he] + apply isOpen_iInter_of_finite + intro j + exact (isOpen_lt continuous_const (continuous_apply j)).inter + (isOpen_lt (continuous_apply j) continuous_const) + +theorem mem_rectanglePlateau {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) + {x : Plane} (hx : x ∈ R.carrier) : x ∈ rectanglePlateau R δ := by + have hp : (0 : ℝ) < δ := by exact_mod_cast hδ + intro j + constructor <;> linarith [(hx j).1, (hx j).2] + +theorem rectangleCutoff_one {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) + {x : Plane} (hx : x ∈ rectanglePlateau R δ) : rectangleCutoff R δ x = 1 := by + have ho (j : Fin 2) : (R.lower j - 2 * δ : ℚ) < (R.lower j - δ : ℚ) ∧ + (R.upper j + δ : ℚ) < (R.upper j + 2 * δ : ℚ) := by constructor <;> linarith + have he (j : Fin 2) : closedCutoff (R.lower j - 2 * δ) (R.lower j - δ) + (R.upper j + δ) (R.upper j + 2 * δ) (x j) = 1 := by + apply closedCutoff_plateau + · exact_mod_cast (ho j).1 + · exact_mod_cast (ho j).2 + · exact ⟨(hx j).1.le, (hx j).2.le⟩ + exact (show rectangleCutoff R δ x = 1 * 1 from congrArg₂ (· * ·) (he 0) (he 1)).trans + (one_mul 1) + +theorem rectangleCutoff_one_near {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) + {x : Plane} (hx : x ∈ R.carrier) : rectangleCutoff R δ =ᶠ[𝓝 x] fun _ => 1 := + Filter.eventually_of_mem ((rectanglePlateau_open R δ).mem_nhds (mem_rectanglePlateau hδ hx)) + (fun _ hy => rectangleCutoff_one hδ hy) + +theorem rectangleCutoff_support {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) : + Function.support (rectangleCutoff R δ) ⊆ (rectangleCollar R δ).carrier := by + intro x hx + have hn : rectangleCutoff R δ x ≠ 0 := hx + have h₀ : closedCutoff (R.lower 0 - 2 * δ) (R.lower 0 - δ) + (R.upper 0 + δ) (R.upper 0 + 2 * δ) (x 0) ≠ 0 := + left_ne_zero_of_mul hn + have h₁ : closedCutoff (R.lower 1 - 2 * δ) (R.lower 1 - δ) + (R.upper 1 + δ) (R.upper 1 + 2 * δ) (x 1) ≠ 0 := + right_ne_zero_of_mul hn + have ho (j : Fin 2) : (R.lower j - 2 * δ : ℝ) < (R.lower j - δ : ℝ) ∧ + (R.upper j + δ : ℝ) < (R.upper j + 2 * δ : ℝ) := by + have hp : (0 : ℝ) < δ := by exact_mod_cast hδ + constructor <;> linarith + have h₀' := closedCutoff_support (ho 0).1 (ho 0).2 h₀ + have h₁' := closedCutoff_support (ho 1).1 (ho 1).2 h₁ + intro j + fin_cases j + · dsimp [rectangleCollar] + push_cast + constructor <;> linarith [h₀'.1, h₀'.2] + · dsimp [rectangleCollar] + push_cast + constructor <;> linarith [h₁'.1, h₁'.2] + +theorem rectangleCollar_compact (R : RationalBox 2) (δ : ℚ) : + IsCompact (rectangleCollar R δ).carrier := by + have he : (rectangleCollar R δ).carrier = + Icc (fun j => ((rectangleCollar R δ).lower j : ℝ)) + (fun j => ((rectangleCollar R δ).upper j : ℝ)) := by + ext x + simp only [RationalBox.carrier, mem_ofPred_eq, mem_Icc, Pi.le_def, forall_and] + rw [he] + exact isCompact_Icc + +theorem rectangleCutoff_compactSupport {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) : + HasCompactSupport (rectangleCutoff R δ) := by + apply HasCompactSupport.intro (rectangleCollar_compact R δ) + intro x hx + by_contra hn + exact hx (rectangleCutoff_support hδ hn) + +/-- A polynomial Hamiltonian cut off by this explicit collar gives a smooth, +compact, divergence-free, mean-zero planar field with the exact local motion. -/ +theorem rectangle_field_properties {R : RationalBox 2} {δ : ℚ} (hδ : 0 < δ) + {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) : + ContDiff ℝ ∞ (field (fun x => rectangleCutoff R δ x * H x)) ∧ + HasCompactSupport (field (fun x => rectangleCutoff R δ x * H x)) ∧ + (∀ x, divergence (field (fun x => rectangleCutoff R δ x * H x)) x = 0) ∧ + (∫ x, field (fun y => rectangleCutoff R δ y * H y) x) = 0 ∧ + (∀ x ∈ R.carrier, field (fun y => rectangleCutoff R δ y * H y) x = field H x) := by + have hs := (rectangleCutoff_smooth R δ).mul hH + have hc : HasCompactSupport (fun x => rectangleCutoff R δ x * H x) := + (rectangleCutoff_compactSupport hδ).mul_right + exact ⟨field_smooth hs, field_compactSupport hc, field_divergence hs, + field_integral_eq_zero hs hc, fun _ hx => field_cutoff_plateau _ _ (rectangleCutoff_one_near hδ hx)⟩ + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDerivativeBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a94a7a9289682c2ef57d37f782e45436aea7c244 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDerivativeBounds.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPerturbations +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SecondDerivativeBounds + +namespace OAI + +/-! Uniform, explicitly computed bounds for both spatial derivatives of the +planar field. The extra coordinate in the autonomous suspension does not +increase the norm when a planar displacement is included. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped NNReal + +def horizontalLinear : Space →L[ℝ] Plane := + ContinuousLinearMap.pi (fun j : Fin 2 => ContinuousLinearMap.proj j.castSucc) + +def planeSpaceTimeInclusion : Plane →L[ℝ] SpaceTime := + (0 : Plane →L[ℝ] ℝ).prod planeInclusion + +theorem planeSpaceTimeInclusion_norm (v : Plane) : + ‖planeSpaceTimeInclusion v‖ = ‖v‖ := by + change ‖((0 : ℝ), atHeight v 0)‖ = ‖v‖ + simp only [Prod.norm_def, norm_zero, atHeight_zero_norm, max_eq_right (norm_nonneg v)] + +theorem planarSlice_fderiv {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : Plane) : + fderiv ℝ (planarSlice H s) x = horizontalLinear.comp + ((fderiv ℝ (SpatialExpression.suspensionCode H).val (0, atHeight x s)).comp + planeSpaceTimeInclusion) := by + have he : planarSlice H s = fun Y => + horizontalLinear ((SpatialExpression.suspensionCode H).val (0, atHeight Y s)) := by + funext Y + rw [SpatialExpression.suspensionCode_val hH hT, planarSlice_eq_horizontal hH] + funext j + fin_cases j <;> rfl + have hi : HasFDerivAt (fun Y : Plane => ((0 : ℝ), atHeight Y s)) + planeSpaceTimeInclusion x := + (hasFDerivAt_const (0 : ℝ) x).prodMk (atHeight_hasFDerivAt x s) + have hv := ((VelocityExpr.smooth (SpatialExpression.suspensionCode_valid hH)).differentiable + (by simp) (0, atHeight x s)).hasFDerivAt.comp x hi + rw [he] + exact (horizontalLinear.hasFDerivAt.comp x hv).fderiv + +def planarSecondBound (H : FieldExpr) : ℕ := + (SpatialExpression.suspensionCode H).secondModulusBound + +theorem planarSlice_fderiv_lipschitz {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) : + LipschitzWith (planarSecondBound H : ℝ≥0) (fderiv ℝ (planarSlice H s)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm, planarSlice_fderiv hH hT, planarSlice_fderiv hH hT] + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro v + let A := fderiv ℝ (SpatialExpression.suspensionCode H).val (0, atHeight x s) - + fderiv ℝ (SpatialExpression.suspensionCode H).val (0, atHeight y s) + change ‖horizontal (A (planeSpaceTimeInclusion v))‖ ≤ _ + have hb := VelocityExpr.fderiv_lipschitz_bound + (SpatialExpression.suspensionCode_valid hH) (0, atHeight x s) (0, atHeight y s) + have hd : ‖((0 : ℝ), atHeight x s) - (0, atHeight y s)‖ = dist x y := by + rw [← dist_eq_norm, Prod.dist_eq, dist_self, atHeight_dist_same, + max_eq_right dist_nonneg] + calc + ‖horizontal (A (planeSpaceTimeInclusion v))‖ ≤ ‖A (planeSpaceTimeInclusion v)‖ := + horizontal_norm_le _ + _ ≤ ‖A‖ * ‖planeSpaceTimeInclusion v‖ := A.le_opNorm _ + _ ≤ ((planarSecondBound H : ℝ) * dist x y) * ‖v‖ := by + rw [planeSpaceTimeInclusion_norm] + apply mul_le_mul_of_nonneg_right _ (norm_nonneg v) + simpa only [A, planarSecondBound, hd] using hb + _ = _ := rfl + +theorem planarSlice_second_fderiv_bound {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : Plane) : + ‖fderiv ℝ (fderiv ℝ (planarSlice H s)) x‖ ≤ (planarSecondBound H : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (planarSlice_fderiv_lipschitz hH hT s) + +def planarVariationCoefficient (H : FieldExpr) : ℕ := + 1 + suspensionLipschitzBound H + planarSecondBound H + +theorem planarVariationCoefficient_pos (H : FieldExpr) : + 0 < planarVariationCoefficient H := by + unfold planarVariationCoefficient + omega + +theorem planar_derivative_bounds {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : Plane) : + ‖fderiv ℝ (planarSlice H s) x‖ ≤ (planarVariationCoefficient H : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (planarSlice H s)) x‖ ≤ + (planarVariationCoefficient H : ℝ) := by + have h₁ := planarSlice_fderiv_bound hH hT s x + have h₂ := planarSlice_second_fderiv_bound hH hT s x + have hk : (0 : ℝ) ≤ suspensionLipschitzBound H := Nat.cast_nonneg _ + have hb : (0 : ℝ) ≤ planarSecondBound H := Nat.cast_nonneg _ + simp only [planarVariationCoefficient, Nat.cast_add, Nat.cast_one] + constructor <;> linarith + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantAnchors.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantAnchors.lean new file mode 100644 index 0000000000000000000000000000000000000000..99dbc7c5ed3536264807f1bbc1bc7d88db6e5ab4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantAnchors.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchAnchors +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarActionUnique +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SparseStageIntervals +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarInactive + +namespace OAI + +/-! In an unused global slot a branch can only be at its source, at one +of its two parked endpoints, or at its final target. -/ + +noncomputable section + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian + +theorem branchIndices_adjacent (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (branchIndices M hM b 1).val = (branchIndices M hM b 0).val + 1 ∧ + (branchIndices M hM b 3).val = (branchIndices M hM b 2).val + 1 ∧ + (branchIndices M hM b 4).val = (branchIndices M hM b 3).val + 1 ∧ + (branchIndices M hM b 5).val = (branchIndices M hM b 4).val + 1 ∧ + (branchIndices M hM b 7).val = (branchIndices M hM b 6).val + 1 := by + simp only [branchIndices, extractionIndex, scalingIndex, insertionIndex, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val, Fin.val_mk] + omega + +theorem branch_unused_windows (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (i : ℕ) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + i ≤ (branchIndices M hM b 0).val ∨ + ((branchIndices M hM b 1).val + 1 ≤ i ∧ i ≤ (branchIndices M hM b 2).val) ∨ + ((branchIndices M hM b 5).val + 1 ≤ i ∧ i ≤ (branchIndices M hM b 6).val) ∨ + (branchIndices M hM b 7).val + 1 ≤ i := by + have ha := branchIndices_adjacent M hM b + have h₁ := hi 1 + have h₃ := hi 3 + have h₄ := hi 4 + have h₅ := hi 5 + have h₇ := hi 7 + omega + +theorem sparseAnchor_source (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) {i : ℕ} + (hi : i ≤ (branchIndices M hM b 0).val) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i = x := by + have hc := stagesBefore_before (branchIndices_strictMono M hM b) 0 rfl hi + exact sparseAnchor_of_count _ _ _ 0 hc + +theorem sparseAnchor_parkedSource (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) {i : ℕ} + (hlo : (branchIndices M hM b 1).val + 1 ≤ i) + (hhi : i ≤ (branchIndices M hM b 2).val) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i = + parkedSource (instruction M hM b) (parkingFor M hM b) x := by + have hc := stagesBefore_between (branchIndices_strictMono M hM b) 1 2 rfl hlo hhi + rw [sparseAnchor_of_count _ _ _ 2 hc] + exact scaledStage_zero _ (parkingScale_pos _).ne' (by norm_num) _ _ + +theorem sparseAnchor_parkedTarget (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) {i : ℕ} + (hlo : (branchIndices M hM b 5).val + 1 ≤ i) + (hhi : i ≤ (branchIndices M hM b 6).val) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i = + (instruction M hM b).affine x + + ((fun j => (parkingFor M hM b j : ℝ)) - (instruction M hM b).target.center) := by + have hc := stagesBefore_between (branchIndices_strictMono M hM b) 5 6 rfl hlo hhi + rw [sparseAnchor_of_count _ _ _ 6 hc] + exact scaledStage_final _ (parkingScale_pos _).ne' (by norm_num) _ _ + +theorem sparseAnchor_target (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) {i : ℕ} + (hi : (branchIndices M hM b 7).val + 1 ≤ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i = + (instruction M hM b).affine x := by + have hc := stagesBefore_after (branchIndices_strictMono M hM b) 7 rfl hi + exact sparseAnchor_of_count _ _ _ 8 hc + +theorem parkedSource_mem (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) : + parkedSource (instruction M hM b) (parkingFor M hM b) x ∈ (parkingRegion M hM b).carrier := by + have h := (branchAnchors_mem_rectangle M hM b hx 2).1 + change scaledStage _ _ _ _ _ 0 ∈ _ at h + rw [scaledStage_zero _ (parkingScale_pos _).ne' (by norm_num)] at h + exact h + +theorem parkedTarget_mem (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) : + (instruction M hM b).affine x + + ((fun j => (parkingFor M hM b j : ℝ)) - (instruction M hM b).target.center) ∈ + (parkingRegion M hM b).carrier := by + have h := (branchAnchors_mem_rectangle M hM b hx 5).2 + change scaledStage _ _ _ _ _ 4 ∈ _ at h + rw [scaledStage_final _ (parkingScale_pos _).ne' (by norm_num)] at h + exact h + +theorem ownPhase_surjective : Function.Surjective ownPhase := by + intro p + cases p with + | extractHorizontal => exact ⟨0, rfl⟩ + | extractVertical => exact ⟨1, rfl⟩ + | scale k => + fin_cases k + · exact ⟨2, rfl⟩ + · exact ⟨3, rfl⟩ + · exact ⟨4, rfl⟩ + · exact ⟨5, rfl⟩ + | insertVertical => exact ⟨6, rfl⟩ + | insertHorizontal => exact ⟨7, rfl⟩ + +theorem unused_owner_ne (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (i : Fin (actions M hM).length) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i.val) : + ((actions M hM).get i).owner ≠ b := by + intro he + obtain ⟨k, hk⟩ := ownPhase_surjective ((actions M hM).get i).phase + have hg : (actions M hM).get (branchIndices M hM b k) = (actions M hM).get i := by + rw [branchIndices_get, hk] + cases ha : (actions M hM).get i + simp_all + exact hi k (congrArg Fin.val ((List.nodup_iff_injective_get.mp (actions_nodup M hM)) hg)) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantMargin.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantMargin.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c5a80f73a82b7d7a3d98654ee89431e6bdb6696 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantMargin.lean @@ -0,0 +1,393 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDormantZero +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PulsePlateau + +namespace OAI + +/-! Quantitative clearance for unused pulses. The enlarged rational collar +leaves room for perturbing an entire source rectangle by a positive radius. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian Set + +theorem routingCollar_four_small (M : Alternating.Machine) (hM : M.WellFormed) : + 2 * (4 * routingCollar M hM) < 1 / 4 ∧ + 2 * (4 * routingCollar M hM) < 1 / 24 ∧ + 2 * (4 * routingCollar M hM) < parkingScale (geometricBranches M hM).length := by + have h := routingCollar_parking_bound M hM + have hp := parkingScale_pos (geometricBranches M hM).length + have hu := parkingScale_le (geometricBranches M hM).length + constructor + · linarith + constructor <;> linarith + +theorem ordered_source_four_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) + (horder : sourceRank M hM c < sourceRank M hM b) : + ∃ g : ℚ, 2 * (4 * routingCollar M hM) < g ∧ + EndpointGap g (⟨c, .extractHorizontal⟩ : Action M hM).rectangle + (instruction M hM b).source := by + have h := source_extraction_clearance M hM horder (parkingFor M hM c 0) + (by simpa only [sourceRank_get] using (centers_before_parking M hM c).1) + have hne : c ≠ b := fun he => (ne_of_lt horder) (congrArg (sourceRank M hM) he) + have hg := source_branch_gap M hM hne + have hδ := routingCollar_pos M hM + refine ⟨boxGap (instruction M hM c).source (instruction M hM b).source, ?_, ?_⟩ + · linarith + · change EndpointGap _ (translationTube (instruction M hM c).source + (horizontalCenter (instruction M hM c).source (parkingFor M hM c 0))) _ + simpa only [sourceRank_get] using h.1 + +theorem ordered_target_four_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) + (horder : targetRank M hM b < targetRank M hM c) : + ∃ g : ℚ, 2 * (4 * routingCollar M hM) < g ∧ + EndpointGap g (⟨c, .insertHorizontal⟩ : Action M hM).rectangle + (instruction M hM b).target := by + have h := target_insertion_clearance M hM horder (parkingFor M hM c 0) + (by simpa only [targetRank_get] using (centers_before_parking M hM c).2) + have hne : c ≠ b := fun he => (ne_of_gt horder) (congrArg (targetRank M hM) he) + have hg := target_branch_gap M hM hne + have hδ := routingCollar_pos M hM + refine ⟨boxGap (instruction M hM c).target (instruction M hM b).target, ?_, ?_⟩ + · linarith + · change EndpointGap _ + (translationTube (recenter (instruction M hM c).target + (horizontalCenter (instruction M hM c).target (parkingFor M hM c 0))) + (centerQ (instruction M hM c).target)) _ + rw [translationTube_reverse] + simpa only [targetRank_get] using h.1 + +theorem extractHorizontal_sparse_four_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 2 * (sourceRank M hM c).val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .extractHorizontal⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_four_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : sourceRank M hM c ≠ sourceRank M hM b := fun h => hne (sourceRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := extract_before_arithmetic (e := 0) ho (by decide) (by simpa only [Nat.add_zero] using hidx) + have hw : i ≤ (branchIndices M hM b 0).val := by rw [h0]; exact hv + obtain ⟨g, hg, hgap⟩ := ordered_source_four_gap M hM b c ho + apply notMem_collar_of_gap hgap hg + rw [sparseAnchor_source M hM b x hw] + exact hx + · have hc : (sourceRank M hM c).val < (geometricBranches M hM).length := by simpa only [hsl] using hsc + have hv := extract_after_arithmetic (d := (branchIndex M hM b).val) (e := 0) ho hc (by decide) + (by simpa only [Nat.add_zero] using hidx) + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (extractHorizontal_parking_gap M hM c b) hs.1 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + +theorem extractVertical_sparse_four_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 2 * (sourceRank M hM c).val + 1 = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .extractVertical⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_four_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : sourceRank M hM c ≠ sourceRank M hM b := fun h => hne (sourceRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := extract_before_arithmetic ho (by decide : (1 : ℕ) ≤ 1) hidx + have hw : i ≤ (branchIndices M hM b 0).val := by rw [h0]; exact hv + apply notMem_collar_of_gap (extractVertical_source_gap M hM c b) hs.2.1 + rw [sparseAnchor_source M hM b x hw] + exact hx + · have hc : (sourceRank M hM c).val < (geometricBranches M hM).length := by simpa only [hsl] using hsc + have hv := extract_after_arithmetic (d := (branchIndex M hM b).val) ho hc (by decide : (1 : ℕ) ≤ 1) hidx + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (extractVertical_parking_gap M hM hne) hs.2.2 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + +theorem scale_sparse_four_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 4) (i : ℕ) + (hidx : 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM c).val + k.val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .scale k⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_four_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : branchIndex M hM c ≠ branchIndex M hM b := fun h => hne (branchIndex_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hb : (sourceRank M hM b).val < (geometricBranches M hM).length := by simpa only [hsl] using hsb + have hv := scale_before_arithmetic hb ho k.isLt hidx + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (scaling_parking_gap M hM hne k) hs.2.2 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + · have hv := scale_after_arithmetic (t := (targetRank M hM b).val) ho hbc k.isLt hidx + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (scaling_parking_gap M hM hne k) hs.2.2 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + +theorem insertVertical_sparse_four_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 6 * (geometricBranches M hM).length + 2 * (targetRank M hM c).val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .insertVertical⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_four_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : targetRank M hM c ≠ targetRank M hM b := fun h => hne (targetRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := insert_before_arithmetic (e := 0) hbb ho (by decide) (by simpa only [Nat.add_zero] using hidx) + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (insertVertical_parking_gap M hM hne) hs.2.2 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + · have hv := insert_after_arithmetic (e := 0) ho (by simpa only [Nat.add_zero] using hidx) + have hw : (branchIndices M hM b 7).val + 1 ≤ i := by rw [h7]; exact hv + apply notMem_collar_of_gap (insertVertical_target_gap M hM c b) hs.2.1 + rw [sparseAnchor_target M hM b x hw] + exact ht + +theorem insertHorizontal_sparse_four_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 6 * (geometricBranches M hM).length + 2 * (targetRank M hM c).val + 1 = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .insertHorizontal⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_four_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : targetRank M hM c ≠ targetRank M hM b := fun h => hne (targetRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := insert_before_arithmetic hbb ho (by decide : (1 : ℕ) ≤ 1) hidx + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (insertHorizontal_parking_gap M hM c b) hs.1 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + · have hv := insert_after_arithmetic ho hidx + have hw : (branchIndices M hM b 7).val + 1 ≤ i := by rw [h7]; exact hv + obtain ⟨g, hg, hgap⟩ := ordered_target_four_gap M hM b c ho + apply notMem_collar_of_gap hgap hg + rw [sparseAnchor_target M hM b x hw] + exact ht + +theorem action_sparseAnchor_notMem_four_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (phase : Phase) (i : ℕ) + (hidx : (⟨c, phase⟩ : Action M hM).index = i) (hne : c ≠ b) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, phase⟩ : Action M hM).rectangle (4 * routingCollar M hM)).carrier := by + cases phase with + | extractHorizontal => exact extractHorizontal_sparse_four_zero M hM b c hx i hidx hne hi + | extractVertical => exact extractVertical_sparse_four_zero M hM b c hx i hidx hne hi + | scale k => exact scale_sparse_four_zero M hM b c hx k i hidx hne hi + | insertVertical => exact insertVertical_sparse_four_zero M hM b c hx i hidx hne hi + | insertHorizontal => exact insertHorizontal_sparse_four_zero M hM b c hx i hidx hne hi + +theorem sparseAnchor_notMem_four_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) + (i : Fin (actions M hM).length) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i.val) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i.val ∉ + (rectangleCollar (compiledPulse M hM i).rectangle (4 * (compiledPulse M hM i).collar)).carrier := by + exact action_sparseAnchor_notMem_four_collar M hM b ((actions M hM).get i).owner hx + ((actions M hM).get i).phase i.val (Action.index_get M hM i) (unused_owner_ne M hM b i hi) hi + +end ForcedComputation.Recorder.Planar + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set + +/-- Exclusion from the enlarged closed collar persists under a small displacement. -/ +theorem notMem_collar_of_notMem_four {R : RationalBox 2} {δ : ℚ} + (hδ : 0 < δ) {x y : Plane} + (hx : x ∉ (rectangleCollar R (4 * δ)).carrier) + (hxy : dist y x < (δ : ℝ)) : y ∉ (rectangleCollar R δ).carrier := by + intro hy + apply hx + intro j + have hj : |y j - x j| < (δ : ℝ) := + (norm_le_pi_norm (y - x) j).trans_lt (by simpa only [dist_eq_norm] using hxy) + obtain ⟨hj₀, hj₁⟩ := abs_lt.mp hj + have hp : (0 : ℝ) < δ := by exact_mod_cast hδ + have hyj := hy j + dsimp [rectangleCollar] at hyj ⊢ + push_cast at hyj ⊢ + constructor <;> linarith [hyj.1, hyj.2] + +end ForcedComputation.PlanarHamiltonian + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian Set + +/-- An unused pulse remains zero on a full neighborhood of the current anchor. -/ +theorem sparseAnchor_near_notMem_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x y : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) + (i : Fin (actions M hM).length) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i.val) + (hxy : dist y (sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i.val) < + (routingCollar M hM : ℝ)) : + y ∉ (rectangleCollar (compiledPulse M hM i).rectangle (compiledPulse M hM i).collar).carrier := by + exact notMem_collar_of_notMem_four (compiledPulse_valid M hM i).1 + (sparseAnchor_notMem_four_collar M hM b hx i hi) hxy + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantZero.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..114f85d9296590b3538a258dff03776690a3488c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarDormantZero.lean @@ -0,0 +1,391 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDormantAnchors + +namespace OAI + +/-! Every pulse that does not belong to the tracked branch vanishes at its +current sparse anchor. The proof uses the actual order of the compiled list. -/ + +noncomputable section +namespace ForcedComputation.PlanarRouting + +open ShearFlows Set PlanarHamiltonian + +theorem notMem_collar_of_gap {R S : RationalBox 2} {gap δ : ℚ} + (hg : EndpointGap gap R S) (hδ : 2 * δ < gap) {x : Plane} (hx : x ∈ S.carrier) : + x ∉ (rectangleCollar R δ).carrier := + fun h => Set.disjoint_left.mp (collar_disjoint_of_gap hg hδ) h hx + +theorem extract_before_arithmetic {c b e i : ℕ} (hc : c < b) (he : e ≤ 1) + (hi : 2 * c + e = i) : i ≤ 2 * b := by omega + +theorem extract_after_arithmetic {n c b d e i : ℕ} (hb : b < c) (hc : c < n) + (he : e ≤ 1) (hi : 2 * c + e = i) : + 2 * b + 1 + 1 ≤ i ∧ i ≤ 2 * n + 4 * d := by omega + +theorem scale_before_arithmetic {n s c b e i : ℕ} (hs : s < n) (hc : c < b) + (he : e < 4) (hi : 2 * n + 4 * c + e = i) : + 2 * s + 1 + 1 ≤ i ∧ i ≤ 2 * n + 4 * b := by omega + +theorem scale_after_arithmetic {n c b t e i : ℕ} (hb : b < c) (hc : c < n) + (he : e < 4) (hi : 2 * n + 4 * c + e = i) : + 2 * n + 4 * b + 3 + 1 ≤ i ∧ i ≤ 6 * n + 2 * t := by omega + +theorem insert_before_arithmetic {n d c b e i : ℕ} (hd : d < n) (hc : c < b) + (he : e ≤ 1) (hi : 6 * n + 2 * c + e = i) : + 2 * n + 4 * d + 3 + 1 ≤ i ∧ i ≤ 6 * n + 2 * b := by omega + +theorem insert_after_arithmetic {n c b e i : ℕ} (hb : b < c) + (hi : 6 * n + 2 * c + e = i) : 6 * n + 2 * b + 1 + 1 ≤ i := by omega + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian Set + +theorem sourceRank_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (sourceRank M hM) := by + intro b c h + have he := congrArg (fun i => (sourceOrder M hM).get i) h + simpa only [sourceRank_get] using he + +theorem targetRank_injective (M : Alternating.Machine) (hM : M.WellFormed) : + Function.Injective (targetRank M hM) := by + intro b c h + have he := congrArg (fun i => (targetOrder M hM).get i) h + simpa only [targetRank_get] using he + +theorem centers_before_parking (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + centerQ (instruction M hM b).source 0 ≤ parkingFor M hM b 0 ∧ + centerQ (instruction M hM b).target 0 ≤ parkingFor M hM b 0 := by + have hp := (parkingCenter_bounds (geometricBranches M hM).length (branchIndex M hM b)).1 + have hs := centerQ_between (instruction_source_positive M hM b) + (instruction_endpoint_bounds M hM b).1 0 + have ht := centerQ_between (instruction_target_positive M hM b) + (instruction_endpoint_bounds M hM b).2 0 + change (1 / 2 : ℚ) < parkingFor M hM b 0 at hp + constructor <;> linarith + +theorem ordered_source_collar_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) + (horder : sourceRank M hM c < sourceRank M hM b) : + ∃ g : ℚ, 2 * routingCollar M hM < g ∧ + EndpointGap g (⟨c, .extractHorizontal⟩ : Action M hM).rectangle + (instruction M hM b).source := by + have h := source_extraction_clearance M hM horder (parkingFor M hM c 0) + (by simpa only [sourceRank_get] using (centers_before_parking M hM c).1) + refine ⟨boxGap (instruction M hM c).source (instruction M hM b).source, ?_, ?_⟩ + · simpa only [sourceRank_get] using h.2 + · change EndpointGap _ (translationTube (instruction M hM c).source + (horizontalCenter (instruction M hM c).source (parkingFor M hM c 0))) _ + simpa only [sourceRank_get] using h.1 + +theorem ordered_target_collar_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) + (horder : targetRank M hM b < targetRank M hM c) : + ∃ g : ℚ, 2 * routingCollar M hM < g ∧ + EndpointGap g (⟨c, .insertHorizontal⟩ : Action M hM).rectangle + (instruction M hM b).target := by + have h := target_insertion_clearance M hM horder (parkingFor M hM c 0) + (by simpa only [targetRank_get] using (centers_before_parking M hM c).2) + refine ⟨boxGap (instruction M hM c).target (instruction M hM b).target, ?_, ?_⟩ + · simpa only [targetRank_get] using h.2 + · change EndpointGap _ + (translationTube (recenter (instruction M hM c).target + (horizontalCenter (instruction M hM c).target (parkingFor M hM c 0))) + (centerQ (instruction M hM c).target)) _ + rw [translationTube_reverse] + simpa only [targetRank_get] using h.1 + +theorem extractHorizontal_sparse_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 2 * (sourceRank M hM c).val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .extractHorizontal⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : sourceRank M hM c ≠ sourceRank M hM b := fun h => hne (sourceRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := extract_before_arithmetic (e := 0) ho (by decide) (by simpa only [Nat.add_zero] using hidx) + have hw : i ≤ (branchIndices M hM b 0).val := by rw [h0]; exact hv + obtain ⟨g, hg, hgap⟩ := ordered_source_collar_gap M hM b c ho + apply notMem_collar_of_gap hgap hg + rw [sparseAnchor_source M hM b x hw] + exact hx + · have hc : (sourceRank M hM c).val < (geometricBranches M hM).length := by simpa only [hsl] using hsc + have hv := extract_after_arithmetic (d := (branchIndex M hM b).val) (e := 0) ho hc (by decide) + (by simpa only [Nat.add_zero] using hidx) + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (extractHorizontal_parking_gap M hM c b) hs.1 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + +theorem extractVertical_sparse_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 2 * (sourceRank M hM c).val + 1 = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .extractVertical⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : sourceRank M hM c ≠ sourceRank M hM b := fun h => hne (sourceRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := extract_before_arithmetic ho (by decide : (1 : ℕ) ≤ 1) hidx + have hw : i ≤ (branchIndices M hM b 0).val := by rw [h0]; exact hv + apply notMem_collar_of_gap (extractVertical_source_gap M hM c b) hs.2.1 + rw [sparseAnchor_source M hM b x hw] + exact hx + · have hc : (sourceRank M hM c).val < (geometricBranches M hM).length := by simpa only [hsl] using hsc + have hv := extract_after_arithmetic (d := (branchIndex M hM b).val) ho hc (by decide : (1 : ℕ) ≤ 1) hidx + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (extractVertical_parking_gap M hM hne) hs.2.2 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + +theorem scale_sparse_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 4) (i : ℕ) + (hidx : 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM c).val + k.val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .scale k⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : branchIndex M hM c ≠ branchIndex M hM b := fun h => hne (branchIndex_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hb : (sourceRank M hM b).val < (geometricBranches M hM).length := by simpa only [hsl] using hsb + have hv := scale_before_arithmetic hb ho k.isLt hidx + have hlo : (branchIndices M hM b 1).val + 1 ≤ i := by rw [h1]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 2).val := by rw [h2]; exact hv.2 + apply notMem_collar_of_gap (scaling_parking_gap M hM hne k) hs.2.2 + rw [sparseAnchor_parkedSource M hM b x hlo hhi] + exact hps + · have hv := scale_after_arithmetic (t := (targetRank M hM b).val) ho hbc k.isLt hidx + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (scaling_parking_gap M hM hne k) hs.2.2 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + +theorem insertVertical_sparse_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 6 * (geometricBranches M hM).length + 2 * (targetRank M hM c).val = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .insertVertical⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : targetRank M hM c ≠ targetRank M hM b := fun h => hne (targetRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := insert_before_arithmetic (e := 0) hbb ho (by decide) (by simpa only [Nat.add_zero] using hidx) + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (insertVertical_parking_gap M hM hne) hs.2.2 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + · have hv := insert_after_arithmetic (e := 0) ho (by simpa only [Nat.add_zero] using hidx) + have hw : (branchIndices M hM b 7).val + 1 ≤ i := by rw [h7]; exact hv + apply notMem_collar_of_gap (insertVertical_target_gap M hM c b) hs.2.1 + rw [sparseAnchor_target M hM b x hw] + exact ht + +theorem insertHorizontal_sparse_zero (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (i : ℕ) + (hidx : 6 * (geometricBranches M hM).length + 2 * (targetRank M hM c).val + 1 = i) (hne : c ≠ b) + (_hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, .insertHorizontal⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + have h0 : (branchIndices M hM b 0).val = 2 * (sourceRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (0 : Fin 8) + have h1 : (branchIndices M hM b 1).val = 2 * (sourceRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (1 : Fin 8) + have h2 : (branchIndices M hM b 2).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val := by + exact congrFun (branchIndices_values M hM b) (2 : Fin 8) + have h5 : (branchIndices M hM b 5).val = + 2 * (geometricBranches M hM).length + 4 * (branchIndex M hM b).val + 3 := by + exact congrFun (branchIndices_values M hM b) (5 : Fin 8) + have h6 : (branchIndices M hM b 6).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val := by + exact congrFun (branchIndices_values M hM b) (6 : Fin 8) + have h7 : (branchIndices M hM b 7).val = + 6 * (geometricBranches M hM).length + 2 * (targetRank M hM b).val + 1 := by + exact congrFun (branchIndices_values M hM b) (7 : Fin 8) + have hsb := (sourceRank M hM b).isLt + have hsc := (sourceRank M hM c).isLt + have htb := (targetRank M hM b).isLt + have htc := (targetRank M hM c).isLt + have hbb := (branchIndex M hM b).isLt + have hbc := (branchIndex M hM c).isLt + have hsl := (sourceOrder_perm M hM).length_eq + have htl := (targetOrder_perm M hM).length_eq + have hs := routingCollar_small M hM + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hps := parkedSource_mem M hM b hx + have hpt := parkedTarget_mem M hM b hx + have hn : targetRank M hM c ≠ targetRank M hM b := fun h => hne (targetRank_injective M hM h) + rcases lt_or_gt_of_ne hn with ho | ho + · have hv := insert_before_arithmetic hbb ho (by decide : (1 : ℕ) ≤ 1) hidx + have hlo : (branchIndices M hM b 5).val + 1 ≤ i := by rw [h5]; exact hv.1 + have hhi : i ≤ (branchIndices M hM b 6).val := by rw [h6]; exact hv.2 + apply notMem_collar_of_gap (insertHorizontal_parking_gap M hM c b) hs.1 + rw [sparseAnchor_parkedTarget M hM b x hlo hhi] + exact hpt + · have hv := insert_after_arithmetic ho hidx + have hw : (branchIndices M hM b 7).val + 1 ≤ i := by rw [h7]; exact hv + obtain ⟨g, hg, hgap⟩ := ordered_target_collar_gap M hM b c ho + apply notMem_collar_of_gap hgap hg + rw [sparseAnchor_target M hM b x hw] + exact ht + +theorem action_sparseAnchor_notMem_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (phase : Phase) (i : ℕ) + (hidx : (⟨c, phase⟩ : Action M hM).index = i) (hne : c ≠ b) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i ∉ + (rectangleCollar (⟨c, phase⟩ : Action M hM).rectangle (routingCollar M hM)).carrier := by + cases phase with + | extractHorizontal => exact extractHorizontal_sparse_zero M hM b c hx i hidx hne hi + | extractVertical => exact extractVertical_sparse_zero M hM b c hx i hidx hne hi + | scale k => exact scale_sparse_zero M hM b c hx k i hidx hne hi + | insertVertical => exact insertVertical_sparse_zero M hM b c hx i hidx hne hi + | insertHorizontal => exact insertHorizontal_sparse_zero M hM b c hx i hidx hne hi + +theorem sparseAnchor_notMem_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) + (i : Fin (actions M hM).length) + (hi : ∀ k, (branchIndices M hM b k).val ≠ i.val) : + sparseAnchor (branchIndices M hM b) (branchAnchors M hM b x) i.val ∉ + (rectangleCollar (compiledPulse M hM i).rectangle (compiledPulse M hM i).collar).carrier := by + exact action_sparseAnchor_notMem_collar M hM b ((actions M hM).get i).owner hx + ((actions M hM).get i).phase i.val (Action.index_get M hM i) (unused_owner_ne M hM b i hi) hi + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarFlowSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarFlowSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..67362008f5ab22c795b180e7492b80df24b9152b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarFlowSmooth.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowNonautonomous +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition + +namespace OAI + +/-! The time-augmented smooth-flow theorem applied to the actual finite +Hamiltonian expression used by the planar processor. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff NNReal + +def phaseSpacePoint (p : ℝ × Plane) : Space := atHeight p.2 p.1 + +theorem phaseSpacePoint_smooth : ContDiff ℝ ∞ phaseSpacePoint := by + apply contDiff_pi.mpr + intro j + fin_cases j + · change ContDiff ℝ ∞ (fun p : ℝ × Plane => p.2 0) + exact (contDiff_apply ℝ ℝ 0).comp contDiff_snd + · change ContDiff ℝ ∞ (fun p : ℝ × Plane => p.2 1) + exact (contDiff_apply ℝ ℝ 1).comp contDiff_snd + · exact contDiff_fst + +theorem phaseSpacePoint_lipschitz : LipschitzWith 1 phaseSpacePoint := by + apply LipschitzWith.of_dist_le_mul + intro p q + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg (p - q))).mpr + intro j + fin_cases j + · exact (norm_le_pi_norm (p.2 - q.2) 0).trans (norm_snd_le (p - q)) + · exact (norm_le_pi_norm (p.2 - q.2) 1).trans (norm_snd_le (p - q)) + · exact norm_fst_le (p - q) + +theorem horizontal_smooth : ContDiff ℝ ∞ horizontal := by + apply contDiff_pi.mpr + intro j + fin_cases j <;> exact contDiff_apply ℝ ℝ _ + +theorem horizontal_lipschitz : LipschitzWith 1 horizontal := by + apply LipschitzWith.of_dist_le_mul + intro x y + have he : horizontal (x - y) = horizontal x - horizontal y := by + ext j + fin_cases j <;> rfl + simpa only [NNReal.coe_one, one_mul, dist_eq_norm, he] using horizontal_norm_le (x - y) + +theorem planarSlice_joint_smooth {H : FieldExpr} (hH : H.Valid) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => planarSlice H p.1 p.2) := by + have he : (fun p : ℝ × Plane => planarSlice H p.1 p.2) = + horizontal ∘ SpatialExpression.suspensionField H ∘ phaseSpacePoint := by + funext p + exact planarSlice_eq_horizontal hH p.1 p.2 + rw [he] + exact horizontal_smooth.comp + ((SpatialExpression.suspensionField_smooth hH).comp phaseSpacePoint_smooth) + +theorem planarSlice_joint_lipschitz {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) : + LipschitzWith (suspensionLipschitzBound H : ℝ≥0) + (fun p : ℝ × Plane => planarSlice H p.1 p.2) := by + have h := horizontal_lipschitz.comp + ((suspensionField_lipschitz hH hT).comp phaseSpacePoint_lipschitz) + simpa only [one_mul, mul_one, Function.comp_def, phaseSpacePoint, + ← planarSlice_eq_horizontal hH] using h + +theorem planarTransition_joint_smooth {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ω : ℝ → ℝ → Plane → Plane} + (hΩ : IsPlanarTransition (planarSlice H) Ω) : + ContDiff ℝ ∞ (fun p : ℝ × (ℝ × Plane) => Ω p.1 p.2.1 p.2.2) := + Flow.transition_contDiff + ⟨_, (planarSlice_joint_smooth hH).continuous⟩ + (planarSlice_joint_smooth hH) (planarSlice_joint_lipschitz hH hT) + hΩ.ode hΩ.initial + +theorem planarTransition_backward_smooth {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ω : ℝ → ℝ → Plane → Plane} + (hΩ : IsPlanarTransition (planarSlice H) Ω) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => Ω p.1 (-p.1) p.2) := + (planarTransition_joint_smooth hH hT hΩ).comp + (contDiff_fst.prodMk (contDiff_fst.neg.prodMk contDiff_snd)) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarHamiltonian.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarHamiltonian.lean new file mode 100644 index 0000000000000000000000000000000000000000..67a0ef0bde695398861c26b4a337a344d2eb8f28 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarHamiltonian.lean @@ -0,0 +1,290 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Profiles +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Affine + +namespace OAI + +/-! Local two-dimensional Hamiltonian pulses for the stationary-forcing +construction. The fields act on the actual plane, including throughout their +cutoff collars. -/ + +noncomputable section + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +def basis (j : Fin 2) : Plane := Pi.single j 1 + +def spatialD (j : Fin 2) (H : Plane → ℝ) (x : Plane) : ℝ := + fderiv ℝ H x (basis j) + +def field (H : Plane → ℝ) (x : Plane) : Plane := + letI := ShearFlows.neZeroTwo + spatialD 1 H x • basis 0 - spatialD 0 H x • basis 1 + +def divergence (V : Plane → Plane) (x : Plane) : ℝ := + ∑ j : Fin 2, spatialD j (fun y => V y j) x + +@[simp] theorem basis_apply (i j : Fin 2) : basis i j = if j = i then 1 else 0 := by + simp [basis, Pi.single_apply] + +theorem spatialD_smooth (j : Fin 2) {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) : + ContDiff ℝ ∞ (spatialD j H) := + (hH.fderiv_right (by simp)).clm_apply contDiff_const + +theorem spatialD_comm (i j : Fin 2) {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) : + spatialD i (spatialD j H) = spatialD j (spatialD i H) := by + funext x + have hd := (hH.fderiv_right (m := ∞) (by simp)).differentiable (by simp) + have he (a b : Fin 2) : spatialD a (spatialD b H) x = + fderiv ℝ (fderiv ℝ H) x (basis a) (basis b) := by + unfold spatialD + rw [fderiv_clm_apply (hd x) (differentiableAt_const _)] + simp + rw [he, he] + exact hH.contDiffAt.isSymmSndFDerivAt (by norm_num) _ _ + +theorem field_smooth {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) : + ContDiff ℝ ∞ (field H) := + ((spatialD_smooth 1 hH).smul contDiff_const).sub + ((spatialD_smooth 0 hH).smul contDiff_const) + +theorem field_tsupport (H : Plane → ℝ) : tsupport (field H) ⊆ tsupport H := by + apply (tsupport_sub _ _).trans + apply Set.union_subset + · exact (tsupport_smul_subset_left _ _).trans (tsupport_fderiv_apply_subset ℝ (basis 1)) + · exact (tsupport_smul_subset_left _ _).trans (tsupport_fderiv_apply_subset ℝ (basis 0)) + +theorem field_compactSupport {H : Plane → ℝ} (hH : HasCompactSupport H) : + HasCompactSupport (field H) := + hH.of_isClosed_subset (isClosed_tsupport _) (field_tsupport H) + +theorem field_divergence {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) (x : Plane) : + divergence (field H) x = 0 := by + have h₀ : (fun y => field H y 0) = spatialD 1 H := by + funext y + simp [field] + have h₁ : (fun y => field H y 1) = fun y => -spatialD 0 H y := by + funext y + simp [field] + rw [divergence, Fin.sum_univ_two, h₀, h₁] + have hn : spatialD 1 (fun y => -spatialD 0 H y) x = -spatialD 1 (spatialD 0 H) x := by + change (fderiv ℝ (-spatialD 0 H) x) (basis 1) = + -(fderiv ℝ (spatialD 0 H) x) (basis 1) + rw [fderiv_neg] + simp + rw [hn, spatialD_comm 0 1 hH] + ring + +/-- Every compactly supported smooth Hamiltonian has zero average velocity. -/ +theorem spatialD_integral_eq_zero {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) + (hc : HasCompactSupport H) (j : Fin 2) : ∫ x, spatialD j H x = 0 := by + have hD : Integrable (spatialD j H) := + (spatialD_smooth j hH).continuous.integrable_of_hasCompactSupport + (hc.fderiv_apply ℝ (basis j)) + have hI : Integrable H := hH.continuous.integrable_of_hasCompactSupport hc + change Integrable (fun x : Plane => fderiv ℝ H x (basis j)) at hD + have hi := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + (μ := (volume : Measure Plane)) (f := fun _ : Plane => (1 : ℝ)) (g := H) (v := basis j) + (by simp) + (by simpa only [one_mul] using hD) + (by simpa only [one_mul] using hI) + (fun _ _ => differentiableAt_const 1) + (fun x _ => hH.differentiable (by simp) x) + simpa only [one_mul, fderiv_const_apply, zero_apply, zero_mul, + integral_zero, neg_zero, spatialD] using hi + +theorem field_integral_eq_zero {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) + (hc : HasCompactSupport H) : ∫ x, field H x = 0 := by + have hD (j : Fin 2) : Integrable (spatialD j H) := + (spatialD_smooth j hH).continuous.integrable_of_hasCompactSupport + (hc.fderiv_apply ℝ (basis j)) + simp only [field, integral_sub ((hD 1).smul_const _) ((hD 0).smul_const _), + integral_smul_const, spatialD_integral_eq_zero hH hc, zero_smul, sub_self] + +theorem field_congr_of_eventuallyEq {H G : Plane → ℝ} {x : Plane} + (h : H =ᶠ[𝓝 x] G) : field H x = field G x := by + unfold field spatialD + rw [h.fderiv_eq] + +theorem field_cutoff_plateau (G χ : Plane → ℝ) {x : Plane} + (hχ : χ =ᶠ[𝓝 x] fun _ => 1) : + field (fun y => χ y * G y) x = field G x := by + apply field_congr_of_eventuallyEq + filter_upwards [hχ] with y hy + simp [hy] + +def translationPotential (v : Plane) (x : Plane) : ℝ := + letI := ShearFlows.neZeroTwo + v 0 * x 1 - v 1 * x 0 + +theorem translationPotential_smooth (v : Plane) : ContDiff ℝ ∞ (translationPotential v) := by + unfold translationPotential + fun_prop + +theorem field_translation (v : Plane) (x : Plane) : field (translationPotential v) x = v := by + have hd := ((hasFDerivAt_apply (𝕜 := ℝ) 1 x).const_mul (v 0)).sub + ((hasFDerivAt_apply (𝕜 := ℝ) 0 x).const_mul (v 1)) + change HasFDerivAt (translationPotential v) _ x at hd + funext j + fin_cases j <;> simp [field, spatialD, hd.fderiv, basis] + +def translationPath (θ : ℝ → ℝ) (v w : Plane) (t : ℝ) : Plane := w + θ t • v + +theorem translationPath_hasDerivAt {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (v w : Plane) : + HasDerivAt (translationPath θ v w) (θ' • v) t := by + exact (hθ.smul_const v).const_add w + +theorem translationPath_cutoff_ode {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (v w : Plane) (χ : Plane → ℝ) + (hχ : χ =ᶠ[𝓝 (translationPath θ v w t)] fun _ => 1) : + HasDerivAt (translationPath θ v w) + (θ' • field (fun x => χ x * translationPotential v x) (translationPath θ v w t)) t := by + rw [field_cutoff_plateau _ _ hχ, field_translation] + exact translationPath_hasDerivAt hθ v w + +theorem translationPath_endpoints {θ : ℝ → ℝ} {a b : ℝ} + (ha : θ a = 0) (hb : θ b = 1) (v w : Plane) : + translationPath θ v w a = w ∧ translationPath θ v w b = w + v := by + simp [translationPath, ha, hb] + +/-- Polynomial Hamiltonians for the elementary shears. The coefficients are +rational whenever the instruction and parking point are rational. -/ +def horizontalPotential (c : Plane) (a : ℝ) (x : Plane) : ℝ := + letI := ShearFlows.neZeroTwo + letI := ShearFlows.twoAtLeastTwo + (a / 2) * (x 1 - c 1) ^ 2 + +def verticalPotential (c : Plane) (a : ℝ) (x : Plane) : ℝ := + letI := ShearFlows.neZeroTwo + letI := ShearFlows.twoAtLeastTwo + show ℝ from -(a / 2) * (x 0 - c 0) ^ 2 + +theorem horizontalPotential_smooth (c : Plane) (a : ℝ) : + ContDiff ℝ ∞ (horizontalPotential c a) := by + unfold horizontalPotential + fun_prop + +theorem verticalPotential_smooth (c : Plane) (a : ℝ) : + ContDiff ℝ ∞ (verticalPotential c a) := by + unfold verticalPotential + fun_prop + +theorem field_horizontal (c : Plane) (a : ℝ) (x : Plane) : + field (horizontalPotential c a) x = ![a * (x 1 - c 1), 0] := by + have hd := (((hasFDerivAt_apply (𝕜 := ℝ) 1 x).sub_const (c 1)).pow 2).const_mul (a / 2) + change HasFDerivAt (horizontalPotential c a) _ x at hd + funext j + fin_cases j <;> + simp [field, spatialD, hd.fderiv, basis]; ring + +theorem field_vertical (c : Plane) (a : ℝ) (x : Plane) : + field (verticalPotential c a) x = ![0, a * (x 0 - c 0)] := by + have hd := (((hasFDerivAt_apply (𝕜 := ℝ) 0 x).sub_const (c 0)).pow 2).const_mul (-(a / 2)) + change HasFDerivAt (verticalPotential c a) _ x at hd + funext j + fin_cases j <;> + simp [field, spatialD, hd.fderiv, basis]; ring + +def horizontalPath (θ : ℝ → ℝ) (a : ℝ) (c v : Plane) (t : ℝ) : Plane := + c + shearX (θ t * a) v + +def verticalPath (θ : ℝ → ℝ) (a : ℝ) (c v : Plane) (t : ℝ) : Plane := + c + shearY (θ t * a) v + +theorem horizontalPath_hasDerivAt {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (a : ℝ) (c v : Plane) : + HasDerivAt (horizontalPath θ a c v) + (θ' • field (horizontalPotential c a) (horizontalPath θ a c v t)) t := by + rw [field_horizontal] + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · have h := ((hθ.mul_const a).mul_const (v 1)).const_add (v 0) |>.const_add (c 0) + convert h using 1 <;> + simp [horizontalPath, shearX, Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring + · simpa [horizontalPath, shearX] using hasDerivAt_const t (c 1 + v 1) + +theorem verticalPath_hasDerivAt {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (a : ℝ) (c v : Plane) : + HasDerivAt (verticalPath θ a c v) + (θ' • field (verticalPotential c a) (verticalPath θ a c v t)) t := by + rw [field_vertical] + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · simpa [verticalPath, shearY] using hasDerivAt_const t (c 0 + v 0) + · have h := ((hθ.mul_const a).mul_const (v 0)).const_add (v 1) |>.const_add (c 1) + convert h using 1 <;> + simp [verticalPath, shearY, Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring + +/-- The four successive polynomial Hamiltonians have reciprocal-diagonal +composition. This avoids logarithms in a finite effective force program. -/ +def fourShearPotential (μ : ℝ) (c : Plane) : Fin 4 → Plane → ℝ := + ![verticalPotential c (-μ), horizontalPotential c (μ⁻¹ - 1), + verticalPotential c 1, horizontalPotential c (μ - 1)] + +def fourShearPath (θ : ℝ → ℝ) (μ : ℝ) (c w : Plane) (k : Fin 4) (t : ℝ) : Plane := + c + partialShear μ k (θ t) (scalingEndpoints μ (w - c) k.castSucc) + +theorem fourShearPotential_smooth (μ : ℝ) (c : Plane) (k : Fin 4) : + ContDiff ℝ ∞ (fourShearPotential μ c k) := by + fin_cases k <;> + first | exact horizontalPotential_smooth _ _ | exact verticalPotential_smooth _ _ + +theorem fourShearPath_hasDerivAt {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (μ : ℝ) (c w : Plane) (k : Fin 4) : + HasDerivAt (fourShearPath θ μ c w k) + (θ' • field (fourShearPotential μ c k) (fourShearPath θ μ c w k t)) t := by + fin_cases k + · exact verticalPath_hasDerivAt hθ (-μ) c (scalingEndpoints μ (w - c) 0) + · exact horizontalPath_hasDerivAt hθ (μ⁻¹ - 1) c (scalingEndpoints μ (w - c) 1) + · let v := scalingEndpoints μ (w - c) 2 + change HasDerivAt (fun s => c + shearY (θ s) v) + (θ' • field (verticalPotential c 1) (c + shearY (θ t) v)) t + have h := verticalPath_hasDerivAt hθ 1 c v + unfold verticalPath at h + simpa only [mul_one] using h + · exact horizontalPath_hasDerivAt hθ (μ - 1) c (scalingEndpoints μ (w - c) 3) + +theorem fourShearPath_cutoff_ode {θ : ℝ → ℝ} {t θ' : ℝ} + (hθ : HasDerivAt θ θ' t) (μ : ℝ) (c w : Plane) (k : Fin 4) (χ : Plane → ℝ) + (hχ : χ =ᶠ[𝓝 (fourShearPath θ μ c w k t)] fun _ => 1) : + HasDerivAt (fourShearPath θ μ c w k) + (θ' • field (fun x => χ x * fourShearPotential μ c k x) + (fourShearPath θ μ c w k t)) t := by + rw [field_cutoff_plateau _ _ hχ] + exact fourShearPath_hasDerivAt hθ μ c w k + +theorem fourShearPath_endpoints {θ : ℝ → ℝ} {a b μ : ℝ} + (ha : θ a = 0) (hb : θ b = 1) (hμ : μ ≠ 0) (c w : Plane) (k : Fin 4) : + fourShearPath θ μ c w k a = c + scalingEndpoints μ (w - c) k.castSucc ∧ + fourShearPath θ μ c w k b = c + scalingEndpoints μ (w - c) k.succ := by + simp only [fourShearPath, ha, hb, partial_shear_is_segment hμ, sub_zero, + one_smul, zero_smul, add_zero, sub_self, zero_add, and_self] + +theorem fourShearPath_final {θ : ℝ → ℝ} {b μ : ℝ} + (hb : θ b = 1) (hμ : μ ≠ 0) (c w : Plane) : + fourShearPath θ μ c w 3 b = + ![c 0 + μ * (w 0 - c 0), c 1 + (w 1 - c 1) / μ] := by + simp only [fourShearPath, hb, partial_shear_is_segment hμ, sub_self, zero_smul, + one_smul, zero_add] + funext j + fin_cases j <;> simp [scalingEndpoints] + +theorem fourShearPath_bound {θ : ℝ → ℝ} {t μ h : ℝ} + (hθ : θ t ∈ Icc (0 : ℝ) 1) (hμ : 0 < μ) (hh : 0 ≤ h) (c w : Plane) + (hx : |w 0 - c 0| ≤ h) (hy : |w 1 - c 1| ≤ h) + (hμx : |μ * (w 0 - c 0)| ≤ h) (hyμ : |(w 1 - c 1) / μ| ≤ h) (k : Fin 4) : + ‖fourShearPath θ μ c w k t - c‖ ≤ 2 * h := by + have hbound := scaling_endpoints_bound hμ hh (w - c) hx hy hμx hyμ + simp only [fourShearPath, add_sub_cancel_left, partial_shear_is_segment hμ.ne'] + exact norm_segment_le (hbound _) (hbound _) hθ + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInactive.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInactive.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9b3e51298f87c9ae95205f363b74ea083af6ac4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInactive.lean @@ -0,0 +1,197 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarClearance + +namespace OAI + +/-! Quantitative collar separation for the pulses that leave another branch +at rest. Horizontal sweeps avoid parking boxes; vertical sweeps stay inside +their own narrow parking columns. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +theorem verticalFrom_lower (R : RationalBox 2) (p : Fin 2 → ℚ) : + (translationTube (recenter R (horizontalCenter R (p 0))) p).lower 0 = + p 0 - halfWidthQ R 0 := by + change min (p 0 - halfWidthQ R 0) + (p 0 - halfWidthQ (recenter R (horizontalCenter R (p 0))) 0) = _ + rw [recenter_halfWidthQ, min_self] + +theorem verticalFrom_upper (R : RationalBox 2) (p : Fin 2 → ℚ) : + (translationTube (recenter R (horizontalCenter R (p 0))) p).upper 0 = + p 0 + halfWidthQ R 0 := by + change max (p 0 + halfWidthQ R 0) + (p 0 + halfWidthQ (recenter R (horizontalCenter R (p 0))) 0) = _ + rw [recenter_halfWidthQ, max_self] + +theorem verticalTo_lower (R : RationalBox 2) (p : Fin 2 → ℚ) : + (translationTube (recenter R p) (horizontalCenter R (p 0))).lower 0 = + p 0 - halfWidthQ R 0 := by + change min (p 0 - halfWidthQ R 0) (p 0 - halfWidthQ (recenter R p) 0) = _ + rw [recenter_halfWidthQ, min_self] + +theorem verticalTo_upper (R : RationalBox 2) (p : Fin 2 → ℚ) : + (translationTube (recenter R p) (horizontalCenter R (p 0))).upper 0 = + p 0 + halfWidthQ R 0 := by + change max (p 0 + halfWidthQ R 0) (p 0 + halfWidthQ (recenter R p) 0) = _ + rw [recenter_halfWidthQ, max_self] + +theorem column_gap_of_horizontal_bounds {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i ≠ j) {R : RationalBox 2} + (hl : (parkingBox n κ i).lower 0 ≤ R.lower 0) + (hu : R.upper 0 ≤ (parkingBox n κ i).upper 0) : + EndpointGap (parkingScale n) R (parkingBox n κ j) := by + rcases lt_or_gt_of_ne hij with h | h + · refine ⟨0, Or.inl ?_⟩ + have hg := parkingBox_gap hκ h + linarith + · refine ⟨0, Or.inr ?_⟩ + exact (parkingBox_gap hκ h).trans hl + +theorem verticalFrom_parking_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i ≠ j) (R : RationalBox 2) + (hw : halfWidthQ R 0 ≤ parkingScale n * κ) : + EndpointGap (parkingScale n) + (translationTube (recenter R (horizontalCenter R (parkingCenter n i 0))) + (parkingCenter n i)) (parkingBox n κ j) := by + apply column_gap_of_horizontal_bounds hκ hij + · rw [verticalFrom_lower] + exact sub_le_sub_left hw _ + · rw [verticalFrom_upper] + exact add_le_add_right hw _ + +theorem verticalTo_parking_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i ≠ j) (R : RationalBox 2) + (hw : halfWidthQ R 0 ≤ parkingScale n * κ) : + EndpointGap (parkingScale n) + (translationTube (recenter R (parkingCenter n i)) + (horizontalCenter R (parkingCenter n i 0))) (parkingBox n κ j) := by + apply column_gap_of_horizontal_bounds hκ hij + · rw [verticalTo_lower] + exact sub_le_sub_left hw _ + · rw [verticalTo_upper] + exact add_le_add_right hw _ + +theorem verticalFrom_low_gap {n : ℕ} (i : Fin n) (R S : RationalBox 2) + (hw : halfWidthQ R 0 ≤ 1 / 128) (hS : S.upper 0 ≤ 1 / 3) : + EndpointGap (1 / 24) + (translationTube (recenter R (horizontalCenter R (parkingCenter n i 0))) + (parkingCenter n i)) S := by + refine ⟨0, Or.inr ?_⟩ + rw [verticalFrom_lower] + have hp := (parkingCenter_bounds n i).1 + linarith + +theorem verticalTo_low_gap {n : ℕ} (i : Fin n) (R S : RationalBox 2) + (hw : halfWidthQ R 0 ≤ 1 / 128) (hS : S.upper 0 ≤ 1 / 3) : + EndpointGap (1 / 24) + (translationTube (recenter R (parkingCenter n i)) + (horizontalCenter R (parkingCenter n i 0))) S := by + refine ⟨0, Or.inr ?_⟩ + rw [verticalTo_lower] + have hp := (parkingCenter_bounds n i).1 + linarith + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting + +theorem target_insertion_clearance (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (targetOrder M hM).length} (hij : i < j) (endpoint : ℚ) + (hendpoint : centerQ (instruction M hM ((targetOrder M hM).get j)).target 0 ≤ endpoint) : + let R := (instruction M hM ((targetOrder M hM).get j)).target + let S := (instruction M hM ((targetOrder M hM).get i)).target + EndpointGap (boxGap R S) (translationTube R (horizontalCenter R endpoint)) S ∧ + 2 * routingCollar M hM < boxGap R S := by + let b := (targetOrder M hM).get j + let c := (targetOrder M hM).get i + have hne : b ≠ c := by + intro he + exact (ne_of_lt hij) ((List.nodup_iff_injective_get.mp (targetOrder_nodup M hM)) he.symm) + have hg := targetOrder_sweep_gap M hM hij (endpoint + halfWidthQ (instruction M hM b).target 0) + have hsmall := target_branch_gap M hM hne + have hδ := routingCollar_pos M hM + constructor + · rw [horizontalTube_eq_rightSweep _ hendpoint] + exact hg.2 + · linarith + +theorem instruction_narrow_widths (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + halfWidthQ (instruction M hM b).source 0 ≤ + parkingScale (geometricBranches M hM).length * bandScale M ∧ + halfWidthQ (instruction M hM b).target 0 ≤ + parkingScale (geometricBranches M hM).length * bandScale M := by + have hw := instruction_halfWidths M hM b + have hε : (0 : ℝ) ≤ compression M hM := by exact_mod_cast (compression_pos M hM).le + have hκ : (0 : ℝ) ≤ bandScale M := by exact_mod_cast (bandScale_pos M).le + constructor + all_goals + apply (Rat.cast_le (K := ℝ)).mp + simp only [halfWidthQ_cast, Rat.cast_mul] + change _ ≤ (compression M hM : ℝ) * (bandScale M : ℝ) + nlinarith [mul_nonneg hε hκ] + +def parkingRegion (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : RationalBox 2 := + parkingBox (geometricBranches M hM).length (bandScale M) (branchIndex M hM b) + +theorem extractHorizontal_parking_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) : + EndpointGap (1 / 4) (⟨b, .extractHorizontal⟩ : Action M hM).rectangle (parkingRegion M hM c) := by + exact low_tube_parking_gap (bandScale_le M) (instruction M hM b).source _ + (((instruction_endpoint_bounds M hM b).1 1).2) (branchIndex M hM c) + +theorem insertHorizontal_parking_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) : + EndpointGap (1 / 4) (⟨b, .insertHorizontal⟩ : Action M hM).rectangle (parkingRegion M hM c) := by + change EndpointGap (1 / 4) + (translationTube (recenter (instruction M hM b).target + (horizontalCenter (instruction M hM b).target (parkingFor M hM b 0))) + (centerQ (instruction M hM b).target)) _ + rw [translationTube_reverse] + exact low_tube_parking_gap (bandScale_le M) (instruction M hM b).target _ + (((instruction_endpoint_bounds M hM b).2 1).2) (branchIndex M hM c) + +theorem extractVertical_parking_gap (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + EndpointGap (parkingScale (geometricBranches M hM).length) + (⟨b, .extractVertical⟩ : Action M hM).rectangle (parkingRegion M hM c) := by + exact verticalFrom_parking_gap (bandScale_le M) + (fun h => hne (branchIndex_injective M hM h)) (instruction M hM b).source + (instruction_narrow_widths M hM b).1 + +theorem insertVertical_parking_gap (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + EndpointGap (parkingScale (geometricBranches M hM).length) + (⟨b, .insertVertical⟩ : Action M hM).rectangle (parkingRegion M hM c) := by + exact verticalTo_parking_gap (bandScale_le M) + (fun h => hne (branchIndex_injective M hM h)) (instruction M hM b).target + (instruction_narrow_widths M hM b).2 + +theorem scaling_parking_gap (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) (k : Fin 4) : + EndpointGap (parkingScale (geometricBranches M hM).length) + (⟨b, .scale k⟩ : Action M hM).rectangle (parkingRegion M hM c) := by + exact column_gap_of_horizontal_bounds (bandScale_le M) + (fun h => hne (branchIndex_injective M hM h)) le_rfl le_rfl + +theorem extractVertical_source_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) : + EndpointGap (1 / 24) (⟨b, .extractVertical⟩ : Action M hM).rectangle + (instruction M hM c).source := by + exact verticalFrom_low_gap (branchIndex M hM b) (instruction M hM b).source _ + ((instruction_halfWidthQ_bound M hM b).1 0) (((instruction_endpoint_bounds M hM c).1 0).2) + +theorem insertVertical_target_gap (M : Alternating.Machine) (hM : M.WellFormed) + (b c : Branch (finiteMachine M hM)) : + EndpointGap (1 / 24) (⟨b, .insertVertical⟩ : Action M hM).rectangle + (instruction M hM c).target := by + exact verticalTo_low_gap (branchIndex M hM b) (instruction M hM b).target _ + ((instruction_halfWidthQ_bound M hM b).2 0) (((instruction_endpoint_bounds M hM c).2 0).2) + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInitialShift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInitialShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5535db08d639c76e5b4ff19667745e3d0d5c33e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarInitialShift.lean @@ -0,0 +1,219 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarRecorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLoaderGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.UnitSpatialClock + +namespace OAI + +/-! The rational normalization of the planar initial condition. The fresh +machine starts in a nonhalting band, so the normalization preserves the fixed +halting strip and the unit-speed spatial clock on all coding rectangles. -/ + +noncomputable section + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows Radix Set + +theorem compression_le_real (M : Alternating.Machine) (hM : M.WellFormed) : + (compression M hM : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (compression_le M hM) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + +theorem point_horizontal_bound (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : + |point M hM C 0 - 1 / 4| ≤ (compression M hM : ℝ) / 8 := by + have hy := codedPoint_second_bounds M C + have hc := centerY_bounds_real M C.control + have hk := bandScale_le_real M + have hlo : (1 / 4 : ℝ) ≤ codedPoint M C 1 := by linarith [hy.1, hc.1] + have hhi : codedPoint M C 1 ≤ (1 / 2 : ℝ) := by linarith [hy.2, hc.2] + have hε : (0 : ℝ) < compression M hM := by exact_mod_cast compression_pos M hM + change |(shift M hM : ℝ) + (compression M hM : ℝ) * codedPoint M C 1 - 1 / 4| ≤ _ + simp only [shift, Rat.cast_sub, Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_one] + apply abs_le.mpr + constructor <;> nlinarith + +theorem point_vertical_bound (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : + |point M hM C 1 - (if recorderHalting M C.control then (5 / 64 : ℝ) else 1 / 4)| ≤ + 3 * (bandScale M : ℝ) / 16 := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hd : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have he := encode_mem_unit hB hd (tapeAt C).1 + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + rw [point_second] + apply abs_le.mpr + constructor <;> nlinarith [he.1, he.2] + +def initialShift (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Fin 2 → ℚ := + fun j => 1 / 4 - initialPoint I hI j + +def shiftPoint (δ : Fin 2 → ℚ) (x : Plane) : Plane := fun j => x j + (δ j : ℝ) + +theorem initialShift_spec (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + shiftPoint (initialShift I hI) (point I.1 hI.1 (finiteInitializedRecorder I hI)) = + ![1 / 4, 1 / 4] := by + rw [← initialPoint_spec I hI] + funext j + fin_cases j <;> simp [shiftPoint, initialShift] + +theorem initialShift_small (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (hn : recorderHalting I.1 (finiteInitializedRecorder I hI).control = false) : + |(initialShift I hI 0 : ℝ)| ≤ 1 / 512 ∧ + |(initialShift I hI 1 : ℝ)| ≤ 3 / 1024 := by + have hx := point_horizontal_bound I.1 hI.1 (finiteInitializedRecorder I hI) + have hy := point_vertical_bound I.1 hI.1 (finiteInitializedRecorder I hI) + rw [hn] at hy + simp only [Bool.false_eq_true, ite_false] at hy + rw [← initialPoint_spec I hI] at hx hy + have hε := compression_le_real I.1 hI.1 + have hk := bandScale_le_real I.1 + have h₀ : |(initialShift I hI 0 : ℝ)| = |(initialPoint I hI 0 : ℝ) - 1 / 4| := by + simp only [initialShift, Rat.cast_sub, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + exact abs_sub_comm _ _ + have h₁ : |(initialShift I hI 1 : ℝ)| = |(initialPoint I hI 1 : ℝ) - 1 / 4| := by + simp only [initialShift, Rat.cast_sub, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + exact abs_sub_comm _ _ + rw [h₀, h₁] + constructor <;> linarith + +theorem fresh_initial_nonhalting (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + recorderHalting (freshMachine I.1) + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)).control = false := by + change (freshMachine I.1).isHalting 0 = false + exact freshMachine_not_halting_zero I.1 + +theorem initialShift_small_rat (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (hn : recorderHalting I.1 (finiteInitializedRecorder I hI).control = false) : + |initialShift I hI 0| ≤ 1 / 512 ∧ |initialShift I hI 1| ≤ 3 / 1024 := by + have hb := initialShift_small I hI hn + constructor + · apply (Rat.cast_le (K := ℝ)).mp + simpa only [Rat.cast_abs, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hb.1 + · apply (Rat.cast_le (K := ℝ)).mp + simpa only [Rat.cast_abs, Rat.cast_div, Rat.cast_ofNat] using hb.2 + +theorem shifted_nonhalting_height (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) (δ : Fin 2 → ℚ) + (hn : recorderHalting M C.control = false) (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) : + 3 / 16 ≤ shiftPoint δ (point M hM C) 1 ∧ + shiftPoint δ (point M hM C) 1 ≤ 7 / 8 := by + have hy := point_vertical_bound M hM C + rw [hn] at hy + simp only [Bool.false_eq_true, ite_false] at hy + have hk := bandScale_le_real M + obtain ⟨hylo, hyhi⟩ := abs_le.mp hy + obtain ⟨hdlo, hdhi⟩ := abs_le.mp hδ + change 3 / 16 ≤ point M hM C 1 + (δ 1 : ℝ) ∧ + point M hM C 1 + (δ 1 : ℝ) ≤ 7 / 8 + constructor <;> linarith + +/-- Halting points have the paper's fixed clearance from both edges of the +observer, including the rational initial normalization. -/ +theorem shifted_halting_clearance (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) (δ : Fin 2 → ℚ) + (hh : recorderHalting M C.control = true) (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) : + 1 / 16 ≤ shiftPoint δ (point M hM C) 1 ∧ + shiftPoint δ (point M hM C) 1 ≤ 3 / 32 := by + have hy := point_vertical_bound M hM C + rw [hh] at hy + simp only [ite_true] at hy + have hk := bandScale_le_real M + obtain ⟨hylo, hyhi⟩ := abs_le.mp hy + obtain ⟨hdlo, hdhi⟩ := abs_le.mp hδ + change 1 / 16 ≤ point M hM C 1 + (δ 1 : ℝ) ∧ + point M hM C 1 + (δ 1 : ℝ) ≤ 3 / 32 + constructor <;> linarith + +theorem shifted_point_observer_iff (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) (δ : Fin 2 → ℚ) + (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) : + shiftPoint δ (point M hM C) ∈ observer ↔ recorderHalting M C.control = true := by + have hy := point_vertical_bound M hM C + have hk := bandScale_le_real M + obtain ⟨hdlo, hdhi⟩ := abs_le.mp hδ + obtain ⟨hylo, hyhi⟩ := abs_le.mp hy + change (1 / 32 < point M hM C 1 + (δ 1 : ℝ) ∧ + point M hM C 1 + (δ 1 : ℝ) < 1 / 8) ↔ _ + cases hh : recorderHalting M C.control <;> + simp only [hh, Bool.false_eq_true, ite_false, ite_true] at hylo hyhi ⊢ + · constructor + · intro h + linarith [h.2] + · exact False.elim + · constructor + · intro _ + trivial + · intro _ + constructor <;> linarith + +theorem shifted_coding_rectangle_clock (M : Alternating.Machine) (hM : M.WellFormed) + (δ : Fin 2 → ℚ) (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) + (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) {x : Plane} + (hx : |x 0 - 1 / 4| ≤ (compression M hM : ℝ) / 8 ∧ + (5 / 128 : ℝ) ≤ x 1 ∧ x 1 ≤ 19 / 64) : + shiftPoint δ x ∈ clockRectangle.carrier := by + obtain ⟨hd₀lo, hd₀hi⟩ := abs_le.mp hδ₀ + obtain ⟨hd₁lo, hd₁hi⟩ := abs_le.mp hδ₁ + obtain ⟨hxlo, hxhi⟩ := abs_le.mp hx.1 + have hε := compression_le_real M hM + intro j + fin_cases j + · change ((1 / 8 : ℚ) : ℝ) ≤ x 0 + (δ 0 : ℝ) ∧ + x 0 + (δ 0 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith + · change ((1 / 32 : ℚ) : ℝ) ≤ x 1 + (δ 1 : ℝ) ∧ + x 1 + (δ 1 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith [hx.2.1, hx.2.2] + +theorem shifted_instruction_source_clock (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (δ : Fin 2 → ℚ) + (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ (instruction M hM b).source.carrier) : + unitSpatialClock (shiftPoint δ x) = 1 := + unitSpatialClock_one (shifted_coding_rectangle_clock M hM δ hδ₀ hδ₁ + (instruction_source_bounds M hM b hx)) + +theorem shifted_instruction_target_clock (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (δ : Fin 2 → ℚ) + (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ (instruction M hM b).target.carrier) : + unitSpatialClock (shiftPoint δ x) = 1 := + unitSpatialClock_one (shifted_coding_rectangle_clock M hM δ hδ₀ hδ₁ + (instruction_target_bounds M hM b hx)) + +theorem shifted_run_observer_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (δ : Fin 2 → ℚ) + (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) : + (∃ n, shiftPoint δ (point I.1 hI.1 + (run (finiteMachine I.1 hI.1) (finiteInitializedRecorder I hI) n)) ∈ observer) ↔ + Alternating.Halts I := by + have he (C : Configuration (State I.1) (Alphabet I.1)) : + shiftPoint δ (point I.1 hI.1 C) ∈ observer ↔ point I.1 hI.1 C ∈ observer := + (shifted_point_observer_iff I.1 hI.1 C δ hδ).trans (point_observer_iff I.1 hI.1 C).symm + simp_rw [he] + exact run_observer_iff I hI + +theorem normalized_run_observer_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + (∃ n, shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 + (run (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)) n)) ∈ observer) ↔ + Alternating.Halts I := by + have hb := initialShift_small (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI) + exact (shifted_run_observer_iff (freshInput I) (freshInput_valid hI) _ hb.2).trans + (freshInput_halts_iff hI) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarIteration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd5d520a803904568b88b3e17c8e21f23e0a0c1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarIteration.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderRun + +namespace OAI + +/-! Integer-phase iteration of a periodic planar processor. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows + +theorem IsPlanarTransition.phase_nat {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hV : ∀ y, Function.Periodic (fun t => V t y) 1) + (a : ℝ) (n : ℕ) (t : ℝ) (x : Plane) : Ψ (a + n) t x = Ψ a t x := by + apply hΨ.unique a x (fun s => Ψ (a + n) s x) (hΨ.initial (a + n) x) + intro s + have he : V ((a + n) + s) (Ψ (a + n) s x) = V (a + s) (Ψ (a + n) s x) := by + have h := (hV (Ψ (a + n) s x)).nat_mul n (a + s) + convert h using 1 + congr 1 + ring + exact (hΨ.ode (a + n) s x).congr_deriv he + +theorem IsPlanarTransition.nat_shift {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hV : ∀ y, Function.Periodic (fun t => V t y) 1) + (n : ℕ) (s : ℝ) (x : Plane) : Ψ 0 ((n : ℝ) + s) x = Ψ 0 s (Ψ 0 n x) := by + rw [hΨ.compose] + simpa only [zero_add] using hΨ.phase_nat hV 0 n s (Ψ 0 n x) + +theorem planar_recorder_steps {Q A : Type*} [DecidableEq Q] [DecidableEq A] + {M : Recorder.Machine Q A} {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (hV : ∀ y, Function.Periodic (fun t => V t y) 1) + (code : Recorder.Configuration Q A → Plane) + (hone : ∀ {C D}, Recorder.Step M C D → Ψ 0 1 (code C) = code D) + {C D : Recorder.Configuration Q A} {n : ℕ} (h : Recorder.Steps M n C D) : + Ψ 0 n (code C) = code D := by + induction h with + | zero C => simpa only [Nat.cast_zero] using hΨ.initial 0 (code C) + | @next n C D E h hs ih => + rw [Nat.cast_add, Nat.cast_one, hΨ.nat_shift hV, ih] + exact hone hs + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarMixedBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarMixedBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..469633b11d5b014f777ce7b5c7cc12777345a5f2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarMixedBounds.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarBounds + +namespace OAI + +/-! Effective bounds for every mixed derivative of the compact planar +processor, with phase represented by the third coordinate. -/ + +noncomputable section +namespace ForcedComputation + +open ShearFlows PlanarHamiltonian Set Filter +open scoped Topology ContDiff + +def planeProjection : Space →L[ℝ] Plane := + ContinuousLinearMap.pi (fun j : Fin 2 => ContinuousLinearMap.proj j.castSucc) + +@[simp] theorem planeProjection_apply (x : Space) : planeProjection x = horizontal x := by + ext j + fin_cases j <;> rfl + +def planarMixed (f : Space → Plane) : List (Fin 3) → Space → Plane + | [] => f + | j :: α => fun x => fderiv ℝ (planarMixed f α) x (ShearFlows.basis j) + +theorem planarMixed_eventuallyEq {f g : Space → Plane} {x : Space} + (h : f =ᶠ[𝓝 x] g) (α : List (Fin 3)) : + planarMixed f α =ᶠ[𝓝 x] planarMixed g α := by + induction α with + | nil => exact h + | cons j α ih => + exact (ih.fderiv (𝕜 := ℝ)).mono + (fun y hy => congrArg (fun A => A (ShearFlows.basis j)) hy) + +theorem planarMixed_zero (α : List (Fin 3)) : + planarMixed (fun _ : Space => (0 : Plane)) α = fun _ => 0 := by + induction α with + | nil => rfl + | cons j α ih => + simp only [planarMixed, ih, fderiv_fun_const] + rfl + +theorem planeProjection_mixed {V : Velocity} (hV : ContDiff ℝ ∞ V) + (α : List (Fin 3)) (x : Space) : + planarMixed (fun y => horizontal (V (0, y))) α x = + horizontal (mixedDerivative V (α.map Fin.succ) (0, x)) := by + induction α generalizing x with + | nil => rfl + | cons j α ih => + have he : planarMixed (fun y => horizontal (V (0, y))) α = + fun y => planeProjection (mixedDerivative V (α.map Fin.succ) (0, y)) := + funext fun y => (ih y).trans (planeProjection_apply _).symm + rw [planarMixed, he] + have hd := planeProjection.hasFDerivAt.comp x + (((mixedDerivative_smooth hV (α.map Fin.succ)).differentiable (by simp) + (0, x)).hasFDerivAt.comp x (ContinuousLinearMap.inr ℝ ℝ Space).hasFDerivAt) + simp only [Function.comp_def] at hd + change fderiv ℝ (fun y => planeProjection (mixedDerivative V (α.map Fin.succ) (0, y))) + x (ShearFlows.basis j) = _ + rw [hd.fderiv] + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.inr_apply, + planeProjection_apply, List.map_cons, mixedDerivative] + rfl + +def planarField (V : ℝ → Plane → Plane) : Space → Plane := + letI := ShearFlows.neZeroThree + fun x => V (x 2) (horizontal x) + +theorem planarField_slice {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) : + planarField (planarSlice H) = + fun x => horizontal ((SpatialExpression.suspensionCode H).val (0, x)) := by + funext x + unfold planarField + rw [planarSlice_eq_horizontal hH, SpatialExpression.suspensionCode_val hH hT] + congr 2 + ext j + fin_cases j <;> rfl + +def planarMixedBound (H : FieldExpr) (α : List (Fin 3)) : ℕ := + (SpatialExpression.suspensionCode H).bound (α.map Fin.succ) + +theorem planarMixed_slice_bound {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (α : List (Fin 3)) (x : Space) : + ‖planarMixed (planarField (planarSlice H)) α x‖ ≤ (planarMixedBound H α : ℝ) := by + rw [planarField_slice hH hT, planeProjection_mixed + (VelocityExpr.smooth (SpatialExpression.suspensionCode_valid hH))] + exact (horizontal_norm_le _).trans + (VelocityExpr.val_bound (SpatialExpression.suspensionCode_valid hH) _ _) + +namespace Recorder.Planar + +theorem compactPlanarField_germ (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {x : Space} + (hx : (horizontal x) 0 ∈ Ioo (0 : ℝ) 1 ∧ + (horizontal x) 1 ∈ Ioo (0 : ℝ) 1) : + planarField (compactVelocity I hI) =ᶠ[𝓝 x] + planarField (planarSlice (normalizedHamiltonian I hI)) := by + have h₀ : {y : Space | y 0 ∈ Ioo (0 : ℝ) 1} ∈ 𝓝 x := + (isOpen_Ioo.preimage (continuous_apply 0)).mem_nhds hx.1 + have h₁ : {y : Space | y 1 ∈ Ioo (0 : ℝ) 1} ∈ 𝓝 x := + (isOpen_Ioo.preimage (continuous_apply 1)).mem_nhds hx.2 + filter_upwards [h₀, h₁] with y hy₀ hy₁ + exact normalized_planar_field_on_chart I hI (y 2) (horizontal y) hy₀ hy₁ + +theorem compactPlanarField_zero_germ (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {x : Space} + (hx : horizontal x ∉ commonSupport (normalizedPulse I hI)) : + planarField (compactVelocity I hI) =ᶠ[𝓝 x] fun _ => 0 := by + have hc : Continuous (horizontal : Space → Plane) := by + rw [← show (planeProjection : Space → Plane) = horizontal from funext planeProjection_apply] + exact planeProjection.continuous + have hn : {y : Space | horizontal y ∉ commonSupport (normalizedPulse I hI)} ∈ 𝓝 x := + ((commonSupport_compact (normalizedPulse I hI)).isClosed.isOpen_compl.preimage hc).mem_nhds hx + filter_upwards [hn] with y hy + change compactVelocity I hI (y 2) (horizontal y) = 0 + exact image_eq_zero_of_notMem_tsupport (f := compactVelocity I hI (y 2)) + (fun hh => hy (compactVelocity_support I hI (y 2) hh)) + +theorem compactPlanar_mixed_bound (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (α : List (Fin 3)) (x : Space) : + ‖planarMixed (planarField (compactVelocity I hI)) α x‖ ≤ + (planarMixedBound (normalizedHamiltonian I hI) α : ℝ) := by + by_cases hx : horizontal x ∈ commonSupport (normalizedPulse I hI) + · have hc := commonSupport_in_unit (normalizedPulse_inUnit I hI) hx + rw [(planarMixed_eventuallyEq (compactPlanarField_germ I hI ⟨hc 0, hc 1⟩) α).self_of_nhds] + exact planarMixed_slice_bound (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) α x + · rw [(planarMixed_eventuallyEq (compactPlanarField_zero_germ I hI hx) α).self_of_nhds, + planarMixed_zero, norm_zero] + exact Nat.cast_nonneg _ + +end Recorder.Planar +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhood.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhood.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e044fd3a4e9d7bf2b273e8dfaee00a847cbddb6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhood.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarNeighborhoodMotion +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarConcatenation + +namespace OAI + +/-! The computed period map agrees with each branch's affine map on an +explicit positive open neighborhood of its entire closed source rectangle. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian PlanarTiming Set + +theorem branchNeighborhood_open (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : IsOpen (branchNeighborhood M hM b) := by + have he : branchNeighborhood M hM b = + ⋃ x ∈ (instruction M hM b).source.carrier, Metric.ball x (branchRadius M hM b : ℝ) := by + ext y + simp only [branchNeighborhood, mem_ofPred_eq, mem_iUnion, Metric.mem_ball, exists_prop] + rw [he] + exact isOpen_iUnion fun _ => isOpen_iUnion fun _ => Metric.isOpen_ball + +theorem normalized_branch_near_period (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} + (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) : + Ψ 0 1 (normalizedAnchors I hI b y 0) = normalizedAnchors I hI b y 8 := by + let n := (actions (freshMachine I.1) (freshInput_valid hI).1).length + have h := sparse_planarTransition hΨ + (planarSlice_lipschitz (normalizedHamiltonian_valid I hI) (normalizedHamiltonian_noTime I hI)) + (N := n + 1) (by omega) (by omega) + (branchIndices_strictMono _ _ b) (normalizedAnchors I hI b y) (normalizedCurve I hI b y) + (cut n) (cut_zero n) (cut_last n) (fun i _ => cut_mono n (by omega)) + (normalizedCurve_start I hI b y) (normalizedCurve_finish I hI b y) + (fun k => (normalizedCurve_smooth I hI b y k).continuous.continuousOn) + (fun k s hs => normalizedCurve_ode_near I hI b hx hxy k s ⟨hs.1, hs.2.le⟩) + (normalized_sparseAnchor_zero_near I hI b hx hxy) + (S := univ) (fun _ => mem_univ _) (fun _ _ _ => mem_univ _) + exact h.1 + +theorem normalized_branch_neighborhood_period (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {y : Plane} + (hy : y ∈ branchNeighborhood (freshMachine I.1) (freshInput_valid hI).1 b) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) : + Ψ 0 1 (translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) y) = + translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) + ((instruction (freshMachine I.1) (freshInput_valid hI).1 b).affine y) := by + obtain ⟨x, hx, hxy⟩ := hy + have h := normalized_branch_near_period I hI b hx hxy hΨ + simpa only [normalizedAnchors, branchAnchors_first, branchAnchors_last] using h + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhoodMotion.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhoodMotion.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5fb7767815557d2bed069f47f431fbc92898e58 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarNeighborhoodMotion.lean @@ -0,0 +1,212 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDormantMargin +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedDormantVelocity + +namespace OAI + +/-! Exact pulse equations on positive neighborhoods of the source boxes. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows PlanarRouting Set + +theorem mem_translatedPlateau (v : Fin 2 → ℚ) (R : RationalBox 2) (δ : ℚ) (x : Plane) : + translatedPoint v x ∈ rectanglePlateau (translatedBox v R) δ ↔ + x ∈ rectanglePlateau R δ := by + constructor <;> intro h j + · have hj := h j + change (R.lower j : ℝ) - δ < x j ∧ x j < (R.upper j : ℝ) + δ + change ((R.lower j + v j : ℚ) : ℝ) - δ < x j + (v j : ℝ) ∧ + x j + (v j : ℝ) < ((R.upper j + v j : ℚ) : ℝ) + δ at hj + push_cast at hj + constructor <;> linarith [hj.1, hj.2] + · have hj := h j + change ((R.lower j + v j : ℚ) : ℝ) - δ < x j + (v j : ℝ) ∧ + x j + (v j : ℝ) < ((R.upper j + v j : ℚ) : ℝ) + δ + push_cast + constructor <;> linarith [hj.1, hj.2] + +theorem Pulse.translated_velocity_plateau (v : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) + {x : Plane} (hx : x ∈ rectanglePlateau p.rectangle p.collar) (t : ℝ) : + (p.translated v).velocity t (translatedPoint v x) = p.velocity t x := by + have ht : translatedPoint v x ∈ + rectanglePlateau (p.translated v).rectangle (p.translated v).collar := + (mem_translatedPlateau v p.rectangle p.collar x).mpr hx + change smoothPulse p.start p.finish t • (p.translated v).spatial (translatedPoint v x) = _ + rw [Pulse.spatial_on_plateau (p.translated_valid v hp) ht] + change smoothPulse p.start p.finish t • field (p.primitive.translated v).potential (translatedPoint v x) = + smoothPulse p.start p.finish t • p.spatial x + rw [p.primitive.translated_field v x, p.spatial_on_plateau hp hx] + +theorem Pulse.translated_hasDerivAt_plateau (v : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) + {γ : ℝ → Plane} {t : ℝ} (hx : γ t ∈ rectanglePlateau p.rectangle p.collar) + (hγ : HasDerivAt γ (p.velocity t (γ t)) t) : + HasDerivAt (fun s => translatedPoint v (γ s)) + ((p.translated v).velocity t (translatedPoint v (γ t))) t := by + rw [p.translated_velocity_plateau v hp hx] + exact hγ.add_const (fun j => (v j : ℝ)) + +theorem Pulse.plateau_in_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) + {x : Plane} (hx : x ∈ rectanglePlateau p.rectangle p.collar) (j : Fin 2) : + x j ∈ Ioo (0 : ℝ) 1 := by + have hb := hu.2.2 j + have hb' : (0 : ℝ) < (p.rectangle.lower j : ℝ) - 2 * p.collar ∧ + (p.rectangle.upper j : ℝ) + 2 * p.collar < 1 := by exact_mod_cast hb + have hδ : (0 : ℝ) < p.collar := by exact_mod_cast hp.1 + constructor <;> linarith [(hx j).1, (hx j).2, hb'.1, hb'.2] + +end ForcedComputation.PlanarHamiltonian + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian PlanarTiming Set + +theorem branchCurve_dist_lt_collar (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x y : Plane} + (hxy : dist y x < (branchRadius M hM b : ℝ)) (k : Fin 8) (t : ℝ) : + dist (branchCurve M hM b y k t) (branchCurve M hM b x k t) < + (routingCollar M hM : ℝ) / 2 := by + have h := branchPath_dist_lt_collar M hM b hxy k + (smoothRamp (start (branchIndices M hM b k)) (finish (branchIndices M hM b k))) t + (smoothRamp_range _ _ _) + change dist (((actions M hM).get (branchIndices M hM b k)).primitive.path _ _ t) + (((actions M hM).get (branchIndices M hM b k)).primitive.path _ _ t) < _ + rw [branchIndices_get] + exact h + +theorem branchCurve_near_plateau (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x y : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) + (hxy : dist y x < (branchRadius M hM b : ℝ)) (k : Fin 8) (t : ℝ) : + branchCurve M hM b y k t ∈ rectanglePlateau + (compiledPulse M hM (branchIndices M hM b k)).rectangle + (compiledPulse M hM (branchIndices M hM b k)).collar := by + apply rectanglePlateau_of_dist_lt (branch_curve_mem_rectangle M hM b hx k t) + have hd := branchCurve_dist_lt_collar M hM b hxy k t + have hδ : (0 : ℝ) < routingCollar M hM := by exact_mod_cast routingCollar_pos M hM + exact hd.trans (by change (routingCollar M hM : ℝ) / 2 < routingCollar M hM; linarith) + +theorem normalizedCurve_ode_near (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} + (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) + (k : Fin 8) (t : ℝ) + (ht : t ∈ Icc + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + ((branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val + 1))) : + HasDerivAt (normalizedCurve I hI b y k) + (planarSlice (normalizedHamiltonian I hI) t (normalizedCurve I hI b y k t)) t := by + have hm := branchCurve_near_plateau _ _ b hx hxy k t + have hp := compiledPulse_valid (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k) + have hd := Pulse.translated_hasDerivAt_plateau + (initialShift (freshInput I) (freshInput_valid hI)) hp hm + (Pulse.curve_ode_plateau hp _ t hm) + have hm' : normalizedCurve I hI b y k t ∈ rectanglePlateau + (normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).rectangle + (normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).collar := + (mem_translatedPlateau _ _ _ _).mpr hm + have hunit := Pulse.plateau_in_unit + (normalizedPulse_valid I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)) + (normalizedPulse_inUnit I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)) hm' + have he := normalizedSlice_on_cell I hI + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k) ht + (normalizedCurve I hI b y k t) (hunit 0) (hunit 1) + exact hd.congr_deriv he.symm + +theorem translatedPoint_dist (v : Fin 2 → ℚ) (x y : Plane) : + dist (translatedPoint v x) (translatedPoint v y) = dist x y := by + simp only [dist_eq_norm] + congr 1 + funext j + simp only [translatedPoint, Pi.sub_apply] + ring + +theorem normalizedAnchors_dist_lt_collar (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) + (k : Fin 9) : + dist (normalizedAnchors I hI b y k) (normalizedAnchors I hI b x k) < + (routingCollar (freshMachine I.1) (freshInput_valid hI).1 : ℝ) / 2 := by + unfold normalizedAnchors + rw [translatedPoint_dist] + exact branchAnchor_dist_lt_collar _ _ b hxy k + +theorem routingCollar_half_lt (M : Alternating.Machine) (hM : M.WellFormed) : + (routingCollar M hM : ℝ) / 2 < 1 / 64 := by + have h := routingCollar_parking_bound M hM + have hu := parkingScale_le (geometricBranches M hM).length + have hb : routingCollar M hM / 2 < (1 / 64 : ℚ) := by linarith + simpa only [Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using (Rat.cast_lt (K := ℝ)).mpr hb + +theorem near_clock_in_unit {x y : Plane} (hx : x ∈ clockRectangle.carrier) + (hxy : dist y x < (1 / 64 : ℝ)) (j : Fin 2) : y j ∈ Ioo (0 : ℝ) 1 := by + have hj : |y j - x j| < (1 / 64 : ℝ) := + (norm_le_pi_norm (y - x) j).trans_lt (by simpa only [dist_eq_norm] using hxy) + obtain ⟨hl, hu⟩ := abs_lt.mp hj + have hb := hx j + fin_cases j <;> norm_num [clockRectangle] at hb hl hu ⊢ <;> + constructor <;> linarith [hb.1, hb.2] + +theorem normalizedAnchors_near_unit (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} + (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) + (k : Fin 9) (j : Fin 2) : normalizedAnchors I hI b y k j ∈ Ioo (0 : ℝ) 1 := + near_clock_in_unit (normalizedAnchors_clock I hI b hx k) + ((normalizedAnchors_dist_lt_collar I hI b hxy k).trans (routingCollar_half_lt _ _)) j + +theorem normalized_sparseAnchor_zero_near (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} + (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) + (i : ℕ) (hi : i < (actions (freshMachine I.1) (freshInput_valid hI).1).length + 1) + (hne : ∀ k, (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val ≠ i) + (s : ℝ) (hs : s ∈ Ico + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length i) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length (i + 1))) : + planarSlice (normalizedHamiltonian I hI) s + (sparseAnchor (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b) + (normalizedAnchors I hI b y) i) = 0 := by + let n := (actions (freshMachine I.1) (freshInput_valid hI).1).length + let J := branchIndices (freshMachine I.1) (freshInput_valid hI).1 b + have hunit : ∀ j, sparseAnchor J (normalizedAnchors I hI b y) i j ∈ Ioo (0 : ℝ) 1 := + normalizedAnchors_near_unit I hI b hx hxy _ + by_cases hin : i < n + · let ii : Fin n := ⟨i, hin⟩ + have hd : dist + (sparseAnchor J (branchAnchors (freshMachine I.1) (freshInput_valid hI).1 b y) i) + (sparseAnchor J (branchAnchors (freshMachine I.1) (freshInput_valid hI).1 b x) i) < + (routingCollar (freshMachine I.1) (freshInput_valid hI).1 : ℝ) := by + have hb := branchAnchor_dist_lt_collar (freshMachine I.1) (freshInput_valid hI).1 b hxy + (⟨stagesBefore J i, lt_of_le_of_lt (stagesBefore_le J i) (by decide)⟩ : Fin 9) + have hp : (0 : ℝ) < routingCollar (freshMachine I.1) (freshInput_valid hI).1 := by + exact_mod_cast routingCollar_pos (freshMachine I.1) (freshInput_valid hI).1 + exact hb.trans (by linarith) + have hm := sparseAnchor_near_notMem_collar _ _ b hx ii hne hd + have hm' : sparseAnchor J (normalizedAnchors I hI b y) i ∉ + (rectangleCollar (normalizedPulse I hI ii).rectangle (normalizedPulse I hI ii).collar).carrier := by + intro he + exact hm ((mem_translated_collar _ _ _ _).mp he) + rw [normalizedSlice_on_cell I hI ii ⟨hs.1, hs.2.le⟩ _ (hunit 0) (hunit 1)] + exact Pulse.velocity_zero_of_notMem (normalizedPulse_valid I hI ii) hm' s + · have he : i = n := by omega + subst i + apply normalizedSlice_on_tail I hI _ _ (hunit 0) (hunit 1) + exact ⟨hs.1, (hs.2.trans_le (by rw [cut_last])).le⟩ + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe7c60847404e0d8da1b6f582f7f4a9b73ad8bd3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarObservation.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedPlanarRouting +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarIteration + +namespace OAI + +/-! All-time observation of the actual planar processor. Nonhalting excludes +the entire continuous trajectory, while a halt is witnessed at an integer. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows Set Radix + +theorem shifted_planar_observation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (δ : Fin 2 → ℚ) (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (hV : ∀ y, Function.Periodic (fun t => V t y) 1) + (hone : ∀ {C D : Configuration (State I.1) (Alphabet I.1)}, + Step (finiteMachine I.1 hI.1) C D → + Ψ 0 1 (shiftPoint δ (point I.1 hI.1 C)) = shiftPoint δ (point I.1 hI.1 D)) + (hsafe : ∀ {C D : Configuration (State I.1) (Alphabet I.1)}, + Step (finiteMachine I.1 hI.1) C D → + recorderHalting I.1 C.control = false → recorderHalting I.1 D.control = false → + ∀ s ∈ Icc (0 : ℝ) 1, + 3 / 16 ≤ Ψ 0 s (shiftPoint δ (point I.1 hI.1 C)) 1) : + (∃ t : ℝ, 0 ≤ t ∧ Ψ 0 t + (shiftPoint δ (point I.1 hI.1 (finiteInitializedRecorder I hI))) ∈ observer) ↔ + Alternating.Halts I := by + let C₀ := finiteInitializedRecorder I hI + let code : Configuration (State I.1) (Alphabet I.1) → Plane := + fun C => shiftPoint δ (point I.1 hI.1 C) + constructor + · rintro ⟨t, ht, hobs⟩ + by_contra hno + have hn (n : ℕ) : (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt I hI n) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) n).state.val = (Alternating.configurationAt I n).state at he + change I.1.isHalting _ = false + rw [he] + cases hh : I.1.isHalting (Alternating.configurationAt I n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + have hs (n : ℕ) : Steps (finiteMachine I.1 hI.1) n C₀ + (run (finiteMachine I.1 hI.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine I.1 hI.1) + (run (finiteMachine I.1 hI.1) C₀ n) (run (finiteMachine I.1 hI.1) C₀ (n + 1)) := + run_step_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting I.1 + (run (finiteMachine I.1 hI.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State I.1) (Alphabet I.1)) : + haltingControl (finiteMachine I.1 hI.1) q = recorderHalting I.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hseg := hsafe (hnext n) (hcontrol n) (hcontrol (n + 1)) + (t - (n : ℝ)) (show t - (n : ℝ) ∈ Icc (0 : ℝ) 1 by constructor <;> linarith) + have he := planar_recorder_steps hΨ hV code hone (hs n) + have htime : t = (n : ℝ) + (t - (n : ℝ)) := by ring + change 1 / 32 < Ψ 0 t (code C₀) 1 ∧ Ψ 0 t (code C₀) 1 < 1 / 8 at hobs + rw [htime, hΨ.nat_shift hV, he] at hobs + linarith [hobs.2] + · intro hhalt + obtain ⟨n, C, q, hs, hc, hh⟩ := (finite_recorder_halts_iff I hI).mpr hhalt + have he := planar_recorder_steps hΨ hV code hone hs + have hob := (shifted_point_observer_iff I.1 hI.1 C δ hδ).mpr + (by simpa only [hc, recorderHalting] using hh) + refine ⟨n, Nat.cast_nonneg _, ?_⟩ + change Ψ 0 n (code C₀) ∈ observer + rw [he] + exact hob + +theorem normalized_planar_observation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) : + (∃ t : ℝ, 0 ≤ t ∧ Ψ 0 t ![1 / 4, 1 / 4] ∈ observer) ↔ Alternating.Halts I := by + have hb := initialShift_small (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI) + have h := (shifted_planar_observation (freshInput I) (freshInput_valid hI) + (initialShift (freshInput I) (freshInput_valid hI)) hb.2 hΨ + (planarSlice_periodic (normalizedHamiltonian_periodic I hI)) + (normalized_planar_step I hI hΨ) (fun {C D} hstep _ hD s hs => by + obtain ⟨b, _, ht, hx, _⟩ := step_branch hstep + have hn : recorderHalting (freshMachine I.1) b.target = false := by rw [ht]; exact hD + have hh := ((normalized_branch_planar_safe I hI b hn hx hΨ).2 s hs).2 + simpa [normalizedAnchors, branchAnchors_first, translatedPoint_eq_shiftPoint, horizontal] using hh)).trans + (freshInput_halts_iff hI) + rw [initialShift_spec] at h + exact h + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarOrdering.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarOrdering.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bee82743bdd052b4853ebed8413ec625bb46ac0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarOrdering.lean @@ -0,0 +1,151 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarParking + +namespace OAI + +/-! Effective source and target orders for the finite planar processor. +Extraction goes from right to left; insertion goes from left to right. The +orders are stable merge sorts of rational centers, including tied centers. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +def sortBy {α : Type*} (key : α → ℚ) (xs : List α) : List α := + xs.mergeSort (fun a b => decide (key a ≤ key b)) + +theorem sortBy_perm {α : Type*} (key : α → ℚ) (xs : List α) : + List.Perm (sortBy key xs) xs := List.mergeSort_perm _ _ + +theorem sortBy_length {α : Type*} (key : α → ℚ) (xs : List α) : + (sortBy key xs).length = xs.length := (sortBy_perm key xs).length_eq + +theorem mem_sortBy {α : Type*} (key : α → ℚ) (xs : List α) (x : α) : + x ∈ sortBy key xs ↔ x ∈ xs := (sortBy_perm key xs).mem_iff + +theorem sortBy_pairwise {α : Type*} (key : α → ℚ) (xs : List α) : + (sortBy key xs).Pairwise (fun a b => key a ≤ key b) := by + let r : α → α → Prop := fun a b => key a ≤ key b + let : Std.Total r := ⟨fun a b => le_total (key a) (key b)⟩ + let : IsTrans α r := ⟨fun _ _ _ h₁ h₂ => le_trans h₁ h₂⟩ + exact List.pairwise_mergeSort' r xs + +theorem sortBy_get_le {α : Type*} (key : α → ℚ) (xs : List α) + {i j : Fin (sortBy key xs).length} (hij : i < j) : + key ((sortBy key xs).get i) ≤ key ((sortBy key xs).get j) := + (sortBy_pairwise key xs).rel_get_of_lt hij + +theorem sortBy_nodup {α : Type*} (key : α → ℚ) {xs : List α} (h : xs.Nodup) : + (sortBy key xs).Nodup := (sortBy_perm key xs).nodup_iff.mpr h + +def rank {α : Type*} [DecidableEq α] (key : α → ℚ) (xs : List α) (x : α) + (hx : x ∈ xs) : Fin (sortBy key xs).length := + ⟨(sortBy key xs).idxOf x, List.idxOf_lt_length_of_mem ((mem_sortBy key xs x).mpr hx)⟩ + +theorem get_rank {α : Type*} [DecidableEq α] (key : α → ℚ) (xs : List α) (x : α) + (hx : x ∈ xs) : (sortBy key xs).get (rank key xs x hx) = x := + List.idxOf_get _ + +theorem rank_injective {α : Type*} [DecidableEq α] (key : α → ℚ) (xs : List α) + {x y : α} (hx : x ∈ xs) (hy : y ∈ xs) + (hxy : rank key xs x hx = rank key xs y hy) : x = y := by + have h := congrArg (sortBy key xs).get hxy + simpa only [get_rank] using h + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting + +def sourceOrder (M : Alternating.Machine) (hM : M.WellFormed) : + List (Branch (finiteMachine M hM)) := + letI := ShearFlows.neZeroTwo + sortBy (fun b => -centerQ (instruction M hM b).source 0) (geometricBranches M hM) + +def targetOrder (M : Alternating.Machine) (hM : M.WellFormed) : + List (Branch (finiteMachine M hM)) := + letI := ShearFlows.neZeroTwo + sortBy (fun b => centerQ (instruction M hM b).target 0) (geometricBranches M hM) + +theorem sourceOrder_perm (M : Alternating.Machine) (hM : M.WellFormed) : + List.Perm (sourceOrder M hM) (geometricBranches M hM) := sortBy_perm _ _ + +theorem targetOrder_perm (M : Alternating.Machine) (hM : M.WellFormed) : + List.Perm (targetOrder M hM) (geometricBranches M hM) := sortBy_perm _ _ + +theorem sourceOrder_nodup (M : Alternating.Machine) (hM : M.WellFormed) : + (sourceOrder M hM).Nodup := + (sourceOrder_perm M hM).nodup_iff.mpr (List.nodup_dedup _) + +theorem targetOrder_nodup (M : Alternating.Machine) (hM : M.WellFormed) : + (targetOrder M hM).Nodup := + (targetOrder_perm M hM).nodup_iff.mpr (List.nodup_dedup _) + +theorem sourceOrder_complete (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : b ∈ sourceOrder M hM := by + apply (sourceOrder_perm M hM).mem_iff.mpr + simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches M hM b + +theorem targetOrder_complete (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : b ∈ targetOrder M hM := by + apply (targetOrder_perm M hM).mem_iff.mpr + simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches M hM b + +theorem sourceOrder_centers (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (sourceOrder M hM).length} (hij : i < j) : + (instruction M hM ((sourceOrder M hM).get j)).source.center 0 ≤ + (instruction M hM ((sourceOrder M hM).get i)).source.center 0 := by + have h := sortBy_get_le (fun b => -centerQ (instruction M hM b).source 0) + (geometricBranches M hM) hij + have hq := neg_le_neg_iff.mp h + have hr : (centerQ (instruction M hM ((sourceOrder M hM).get j)).source 0 : ℝ) ≤ + (centerQ (instruction M hM ((sourceOrder M hM).get i)).source 0 : ℝ) := by + exact_mod_cast hq + simpa only [centerQ_cast] using hr + +theorem targetOrder_centers (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (targetOrder M hM).length} (hij : i < j) : + (instruction M hM ((targetOrder M hM).get i)).target.center 0 ≤ + (instruction M hM ((targetOrder M hM).get j)).target.center 0 := by + have h := sortBy_get_le (fun b => centerQ (instruction M hM b).target 0) + (geometricBranches M hM) hij + have hr : (centerQ (instruction M hM ((targetOrder M hM).get i)).target 0 : ℝ) ≤ + (centerQ (instruction M hM ((targetOrder M hM).get j)).target 0 : ℝ) := by + exact_mod_cast h + simpa only [centerQ_cast] using hr + +/-- Later source rows do not intersect the active extraction tube. -/ +theorem sourceOrder_sweep_gap (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (sourceOrder M hM).length} (hij : i < j) (endpoint : ℚ) : + let R := (instruction M hM ((sourceOrder M hM).get i)).source + let S := (instruction M hM ((sourceOrder M hM).get j)).source + 0 < boxGap R S ∧ EndpointGap (boxGap R S) (rightSweep R endpoint) S := by + let bi := (sourceOrder M hM).get i + let bj := (sourceOrder M hM).get j + have hne : bi ≠ bj := by + intro he + exact (ne_of_lt hij) ((List.nodup_iff_injective_get.mp (sourceOrder_nodup M hM)) he) + have hp := separated_endpointGap (instruction_source_positive M hM bi) + (instruction_source_positive M hM bj) (instruction_source_separation M hM hne) + refine ⟨hp.1, rightSweep_gap_of_centers (instruction_source_positive M hM bi) + (instruction_source_positive M hM bj) hp.1 (sourceOrder_centers M hM hij) hp.2 endpoint⟩ + +/-- Earlier inserted targets do not intersect the active insertion tube. -/ +theorem targetOrder_sweep_gap (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (targetOrder M hM).length} (hij : i < j) (endpoint : ℚ) : + let R := (instruction M hM ((targetOrder M hM).get j)).target + let S := (instruction M hM ((targetOrder M hM).get i)).target + 0 < boxGap R S ∧ EndpointGap (boxGap R S) (rightSweep R endpoint) S := by + let bi := (targetOrder M hM).get i + let bj := (targetOrder M hM).get j + have hne : bj ≠ bi := by + intro he + exact (ne_of_lt hij) ((List.nodup_iff_injective_get.mp (targetOrder_nodup M hM)) he.symm) + have hp := separated_endpointGap (instruction_target_positive M hM bj) + (instruction_target_positive M hM bi) (instruction_target_separation M hM hne) + refine ⟨hp.1, rightSweep_gap_of_centers (instruction_target_positive M hM bj) + (instruction_target_positive M hM bi) hp.1 (targetOrder_centers M hM hij) hp.2 endpoint⟩ + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarParking.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarParking.lean new file mode 100644 index 0000000000000000000000000000000000000000..21e8aeedd29e1ffe550f446baf5f1188e4664a59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarParking.lean @@ -0,0 +1,311 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarRecorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarAnisotropic +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.OrderedSweep + +namespace OAI + +/-! Rational parking columns and filled translation tubes for the planar +processor. The same horizontal compression used by the recorder leaves a +quantitative gap between every two parking columns. -/ + +noncomputable section + +namespace ForcedComputation.PlanarRouting + +open ShearFlows Set +open scoped BigOperators + +def centerQ (R : RationalBox 2) (j : Fin 2) : ℚ := (R.lower j + R.upper j) / 2 + +def halfWidthQ (R : RationalBox 2) (j : Fin 2) : ℚ := (R.upper j - R.lower j) / 2 + +@[simp] theorem centerQ_cast (R : RationalBox 2) (j : Fin 2) : + (centerQ R j : ℝ) = R.center j := by simp [centerQ, RationalBox.center] + +@[simp] theorem halfWidthQ_cast (R : RationalBox 2) (j : Fin 2) : + (halfWidthQ R j : ℝ) = R.halfWidth j := by simp [halfWidthQ, RationalBox.halfWidth] + +def recenter (R : RationalBox 2) (p : Fin 2 → ℚ) : RationalBox 2 := + ⟨fun j => p j - halfWidthQ R j, fun j => p j + halfWidthQ R j⟩ + +theorem recenter_center (R : RationalBox 2) (p : Fin 2 → ℚ) : + (recenter R p).center = fun j => (p j : ℝ) := by + funext j + dsimp [recenter, RationalBox.center] + push_cast + ring + +theorem recenter_halfWidth (R : RationalBox 2) (p : Fin 2 → ℚ) (j : Fin 2) : + (recenter R p).halfWidth j = R.halfWidth j := by + dsimp [recenter, RationalBox.halfWidth, halfWidthQ] + push_cast + ring + +theorem recenter_positive {R : RationalBox 2} (hR : R.positive) (p : Fin 2 → ℚ) : + (recenter R p).positive := by + intro j + have := hR j + dsimp [recenter, halfWidthQ] + linarith + +theorem recenter_image (R : RationalBox 2) (p : Fin 2 → ℚ) : + (fun x : Plane => x + ((fun j => (p j : ℝ)) - R.center)) '' R.carrier = + (recenter R p).carrier := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + apply RationalBox.mem_carrier_iff.mpr + intro j + rw [recenter_center, recenter_halfWidth] + have he : (x + ((fun j => (p j : ℝ)) - R.center)) j - (p j : ℝ) = + x j - R.center j := by simp only [Pi.add_apply, Pi.sub_apply]; ring + rw [he] + exact RationalBox.mem_carrier_iff.mp hx j + · intro hy + let x : Plane := y - ((fun j => (p j : ℝ)) - R.center) + refine ⟨x, RationalBox.mem_carrier_iff.mpr ?_, ?_⟩ + · intro j + have hj := RationalBox.mem_carrier_iff.mp hy j + rw [recenter_center, recenter_halfWidth] at hj + have he : x j - R.center j = y j - (p j : ℝ) := by + dsimp [x] + ring + rw [he] + exact hj + · exact sub_add_cancel _ _ + +/-- A filled tube containing every intermediate translated rectangle. -/ +def translationTube (R : RationalBox 2) (p : Fin 2 → ℚ) : RationalBox 2 := + ⟨fun j => min (R.lower j) ((recenter R p).lower j), + fun j => max (R.upper j) ((recenter R p).upper j)⟩ + +theorem translationTube_positive {R : RationalBox 2} (hR : R.positive) (p : Fin 2 → ℚ) : + (translationTube R p).positive := by + intro j + exact (min_le_left _ _).trans_lt ((hR j).trans_le (le_max_left _ _)) + +theorem translationPath_mem_tube {R : RationalBox 2} {x : Plane} (hx : x ∈ R.carrier) + (p : Fin 2 → ℚ) {θ : ℝ} (hθ : θ ∈ Icc (0 : ℝ) 1) : + x + θ • ((fun j => (p j : ℝ)) - R.center) ∈ (translationTube R p).carrier := by + have hy : x + ((fun j => (p j : ℝ)) - R.center) ∈ (recenter R p).carrier := by + rw [← recenter_image] + exact mem_image_of_mem _ hx + intro j + have hlo₀ : ((translationTube R p).lower j : ℝ) ≤ x j := by + calc + ((translationTube R p).lower j : ℝ) ≤ (R.lower j : ℝ) := by + exact_mod_cast (min_le_left (R.lower j) ((recenter R p).lower j)) + _ ≤ x j := (hx j).1 + have hhi₀ : x j ≤ ((translationTube R p).upper j : ℝ) := + (hx j).2.trans (by exact_mod_cast (le_max_left (R.upper j) ((recenter R p).upper j))) + have hlo₁ : ((translationTube R p).lower j : ℝ) ≤ + x j + ((p j : ℝ) - R.center j) := by + calc + ((translationTube R p).lower j : ℝ) ≤ ((recenter R p).lower j : ℝ) := by + exact_mod_cast (min_le_right (R.lower j) ((recenter R p).lower j)) + _ ≤ x j + ((p j : ℝ) - R.center j) := (hy j).1 + have hhi₁ : x j + ((p j : ℝ) - R.center j) ≤ ((translationTube R p).upper j : ℝ) := + (hy j).2.trans (by exact_mod_cast (le_max_right (R.upper j) ((recenter R p).upper j))) + change ((translationTube R p).lower j : ℝ) ≤ x j + θ * ((p j : ℝ) - R.center j) ∧ + x j + θ * ((p j : ℝ) - R.center j) ≤ ((translationTube R p).upper j : ℝ) + constructor <;> nlinarith [hθ.1, hθ.2] + +def parkingScale (n : ℕ) : ℚ := 1 / (64 * (n + 1)) + +def parkingCenter (n : ℕ) (i : Fin n) : Fin 2 → ℚ := + ![1 / 2 + ((i.val : ℚ) + 1) / (4 * ((n : ℚ) + 1)), 3 / 4] + +/-- This contains the whole four-shear trajectory, not only its endpoints. -/ +def parkingBox (n : ℕ) (κ : ℚ) (i : Fin n) : RationalBox 2 := + letI := ShearFlows.neZeroTwo + ⟨![parkingCenter n i 0 - parkingScale n * κ, 3 / 4 - (3 / 8) * κ], + ![parkingCenter n i 0 + parkingScale n * κ, 3 / 4 + (3 / 8) * κ]⟩ + +theorem parkingScale_pos (n : ℕ) : 0 < parkingScale n := by + unfold parkingScale + positivity + +theorem parkingScale_le (n : ℕ) : parkingScale n ≤ 1 / 64 := by + unfold parkingScale + apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) + have : (0 : ℚ) ≤ n := by positivity + nlinarith + +theorem parkingCenter_bounds (n : ℕ) (i : Fin n) : + (1 / 2 : ℚ) < parkingCenter n i 0 ∧ parkingCenter n i 0 < 3 / 4 := by + have hn : (0 : ℚ) < n + 1 := by positivity + have hi : (i.val : ℚ) < n := by exact_mod_cast i.isLt + change 1 / 2 < 1 / 2 + ((i.val : ℚ) + 1) / (4 * (n + 1)) ∧ + 1 / 2 + ((i.val : ℚ) + 1) / (4 * (n + 1)) < 3 / 4 + constructor + · have hp : (0 : ℚ) < ((i.val : ℚ) + 1) / (4 * (n + 1)) := by positivity + linarith + · have hp : ((i.val : ℚ) + 1) / (4 * (n + 1)) < 1 / 4 := by + apply (div_lt_iff₀ (by positivity : (0 : ℚ) < 4 * (n + 1))).mpr + linarith + linarith + +theorem parkingCenter_gap {n : ℕ} {i j : Fin n} (hij : i < j) : + 16 * parkingScale n ≤ parkingCenter n j 0 - parkingCenter n i 0 := by + have hden : (0 : ℚ) < 4 * (n + 1) := by positivity + have hij' : (i.val : ℚ) + 1 ≤ j.val := by exact_mod_cast hij + have he : parkingCenter n j 0 - parkingCenter n i 0 = + ((j.val : ℚ) - i.val) / (4 * (n + 1)) := by + dsimp [parkingCenter] + ring + have hs : 16 * parkingScale n = 1 / (4 * (n + 1)) := by + dsimp [parkingScale] + field_simp + ring + rw [he, hs] + exact (div_le_div_iff_of_pos_right hden).mpr (by linarith) + +theorem parkingBox_positive {n : ℕ} {κ : ℚ} (hκ : 0 < κ) (i : Fin n) : + (parkingBox n κ i).positive := by + have hp := mul_pos (parkingScale_pos n) hκ + intro j + fin_cases j <;> dsimp [parkingBox] <;> linarith + +theorem parkingBox_bounds {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) (hκ' : κ ≤ 1 / 64) + (i : Fin n) {x : Plane} (hx : x ∈ (parkingBox n κ i).carrier) : + (3 / 8 : ℝ) < x 0 ∧ x 0 < 7 / 8 ∧ 2 / 3 < x 1 ∧ x 1 < 4 / 5 := by + have hs : (0 : ℝ) < parkingScale n := by exact_mod_cast parkingScale_pos n + have hs' : (parkingScale n : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (parkingScale_le n) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hk : (0 : ℝ) ≤ κ := by exact_mod_cast hκ + have hk' : (κ : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr hκ' + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hc := parkingCenter_bounds n i + have hc₀ : (1 / 2 : ℝ) < parkingCenter n i 0 := by + have h := (Rat.cast_lt (K := ℝ)).mpr hc.1 + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hc₁ : (parkingCenter n i 0 : ℝ) < 3 / 4 := by + have h := (Rat.cast_lt (K := ℝ)).mpr hc.2 + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hx₀ := hx 0 + have hx₁ := hx 1 + dsimp [parkingBox] at hx₀ hx₁ + push_cast at hx₀ hx₁ + refine ⟨?_, ?_, ?_, ?_⟩ <;> + nlinarith [mul_le_mul hs' hk' hk (by norm_num : (0 : ℝ) ≤ 1 / 64)] + +theorem parkingBox_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i < j) : + (parkingBox n κ i).upper 0 + parkingScale n ≤ (parkingBox n κ j).lower 0 := by + have hs := parkingScale_pos n + have hg := parkingCenter_gap hij + have hk : parkingScale n * κ ≤ parkingScale n * (1 / 64) := + mul_le_mul_of_nonneg_left hκ hs.le + dsimp [parkingBox] + nlinarith + +theorem parkingBox_separation {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i ≠ j) : + PositivelySeparated (parkingBox n κ i).carrier (parkingBox n κ j).carrier := by + apply EndpointGap.separated (δ := parkingScale n) ?_ (parkingScale_pos n) + rcases lt_or_gt_of_ne hij with h | h + · exact ⟨0, Or.inl (parkingBox_gap hκ h)⟩ + · exact ⟨0, Or.inr (parkingBox_gap hκ h)⟩ + +theorem recenter_subset_parking {n : ℕ} {κ : ℚ} + (R : RationalBox 2) (i : Fin n) + (hx : R.halfWidth 0 ≤ (parkingScale n : ℝ) * κ) + (hy : R.halfWidth 1 ≤ (3 / 8 : ℝ) * κ) : + (recenter R (parkingCenter n i)).carrier ⊆ (parkingBox n κ i).carrier := by + intro x hxR + have hm := RationalBox.mem_carrier_iff.mp hxR + rw [recenter_center] at hm + have h₀ := abs_le.mp ((hm 0).trans (by simpa only [recenter_halfWidth] using hx)) + have h₁ := abs_le.mp ((hm 1).trans (by simpa only [recenter_halfWidth] using hy)) + intro j + fin_cases j + · dsimp [parkingBox] + push_cast + constructor <;> linarith + · dsimp [parkingBox, parkingCenter] at h₁ ⊢ + push_cast at h₁ ⊢ + constructor <;> linarith + +theorem low_rectangle_parking_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {R : RationalBox 2} (hR : R.upper 1 ≤ 19 / 64) (i : Fin n) : + EndpointGap (1 / 4) R (parkingBox n κ i) := by + refine ⟨1, Or.inl ?_⟩ + dsimp [parkingBox] + linarith + +/-- The actual anisotropic scaling path of an instruction stays in its parking +box. Both input and output widths are used, since either reciprocal factor +may be large. -/ +theorem instruction_scaling_mem_parking {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) + (i : Fin n) (r : Instruction) (hr : 0 < r.factor) + (himage : r.affine '' r.source.carrier = r.target.carrier) + (hsx : r.source.halfWidth 0 ≤ (parkingScale n : ℝ) * (κ : ℝ) / 2) + (htx : r.target.halfWidth 0 ≤ (parkingScale n : ℝ) * (κ : ℝ) / 2) + (hsy : r.source.halfWidth 1 ≤ (3 / 8 : ℝ) * (κ : ℝ) / 2) + (hty : r.target.halfWidth 1 ≤ (3 / 8 : ℝ) * (κ : ℝ) / 2) + {x : Plane} (hx : x ∈ r.source.carrier) (t : ℝ) : + PlanarHamiltonian.anisotropicRoute (parkingScale n) (3 / 8) r.factor + (fun j => (parkingCenter n i j : ℝ)) + (x + ((fun j => (parkingCenter n i j : ℝ)) - r.source.center)) t ∈ + (parkingBox n κ i).carrier := by + let p : Plane := fun j => (parkingCenter n i j : ℝ) + let w : Plane := x + (p - r.source.center) + have ha : (0 : ℝ) < parkingScale n := by exact_mod_cast parkingScale_pos n + have hμ : (0 : ℝ) < r.factor := by exact_mod_cast hr + have hk : (0 : ℝ) ≤ (κ : ℝ) / 2 := + div_nonneg (by exact_mod_cast hκ) (by norm_num) + have hy : r.affine x ∈ r.target.carrier := by + rw [← himage] + exact mem_image_of_mem _ hx + have hx' := RationalBox.mem_carrier_iff.mp hx + have hy' := RationalBox.mem_carrier_iff.mp hy + have h₀ : |(w 0 - p 0) / (parkingScale n : ℝ)| ≤ (κ : ℝ) / 2 := by + have he : w 0 - p 0 = x 0 - r.source.center 0 := by dsimp [w]; ring + rw [he, abs_div, abs_of_pos ha] + exact (div_le_iff₀ ha).mpr (by nlinarith [(hx' 0).trans hsx]) + have h₁ : |(w 1 - p 1) / (3 / 8 : ℝ)| ≤ (κ : ℝ) / 2 := by + have he : w 1 - p 1 = x 1 - r.source.center 1 := by dsimp [w]; ring + rw [he, abs_div] + norm_num + nlinarith [(hx' 1).trans hsy] + have h₂ : |(r.factor : ℝ) * ((w 0 - p 0) / (parkingScale n : ℝ))| ≤ + (κ : ℝ) / 2 := by + have he : (r.factor : ℝ) * ((w 0 - p 0) / (parkingScale n : ℝ)) = + (r.affine x 0 - r.target.center 0) / (parkingScale n : ℝ) := by + dsimp [w, Instruction.affine] + ring + rw [he, abs_div, abs_of_pos ha] + exact (div_le_iff₀ ha).mpr (by nlinarith [(hy' 0).trans htx]) + have h₃ : |((w 1 - p 1) / (3 / 8 : ℝ)) / (r.factor : ℝ)| ≤ (κ : ℝ) / 2 := by + have he : ((w 1 - p 1) / (3 / 8 : ℝ)) / (r.factor : ℝ) = + (r.affine x 1 - r.target.center 1) / (3 / 8 : ℝ) := by + dsimp [w, Instruction.affine] + ring + rw [he, abs_div] + norm_num + nlinarith [(hy' 1).trans hty] + have hb := PlanarHamiltonian.anisotropicRoute_bound ha.le (by norm_num) hμ hk p w + h₀ h₁ h₂ h₃ t + change PlanarHamiltonian.anisotropicRoute (parkingScale n) (3 / 8) r.factor p w t ∈ _ + intro j + fin_cases j + · have hh := abs_le.mp hb.1 + dsimp [parkingBox] + push_cast + have hp₀ : p 0 = (parkingCenter n i 0 : ℝ) := rfl + rw [hp₀] at hh + constructor <;> nlinarith + · have hh := abs_le.mp hb.2 + dsimp [parkingBox] + push_cast + have hp₁ : p 1 = (3 / 4 : ℝ) := by norm_num [p, parkingCenter] + rw [hp₁] at hh + constructor <;> nlinarith + +end ForcedComputation.PlanarRouting + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPeriodicProperties.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPeriodicProperties.lean new file mode 100644 index 0000000000000000000000000000000000000000..1742ce14e4c9b8293ab21b62cda84fbb94dd79b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPeriodicProperties.lean @@ -0,0 +1,174 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCompactBridge + +namespace OAI + +/-! Periodicity and zero mean for the planar torus interpretation of the +Hamiltonian, with integration over its unit-square fundamental domain. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows PlanarHamiltonian Set MeasureTheory Filter +open scoped BigOperators ContDiff Topology + +def PlanePeriodic {E : Type*} (f : Plane → E) : Prop := + ∀ (x : Plane) (n : Fin 2 → ℤ), f (x + fun j => (n j : ℝ)) = f x + +theorem plane_opposite_faces (j : Fin 2) (x : Fin 1 → ℝ) : + j.insertNth 1 x = j.insertNth 0 x + fun k => ((Pi.single j 1 : Fin 2 → ℤ) k : ℝ) := by + ext k + rcases Fin.eq_self_or_eq_succAbove j k with rfl | ⟨k, rfl⟩ + · simp + · simp [Fin.succAbove_ne] + +theorem integral_planar_periodic_derivative {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) (j : Fin 2) : + (∫ x in Icc (0 : Plane) (fun _ => 1), fderiv ℝ g x (PlanarHamiltonian.basis j)) = 0 := by + let F : Fin 2 → Plane → ℝ := fun k => if k = j then g else fun _ => 0 + let F' : Fin 2 → Plane → Plane →L[ℝ] ℝ := fun k x => if k = j then fderiv ℝ g x else 0 + have he (x : Plane) : (∑ k, F' k x (Pi.single k 1)) = + fderiv ℝ g x (PlanarHamiltonian.basis j) := by + simp [F', PlanarHamiltonian.basis, apply_ite, ite_apply] + have hc : ∀ k, ContinuousOn (F k) (Icc (0 : Plane) (fun _ => 1)) := by + intro k + by_cases hk : k = j <;> simp only [F, hk, ite_true, ite_false] + · exact hg.continuous.continuousOn + · exact continuousOn_const + have hd : ∀ x : Plane, ∀ k, HasFDerivAt (F k) (F' k x) x := by + intro x k + by_cases hk : k = j <;> simp only [F, F', hk, ite_true, ite_false] + · exact (hg.differentiable (by simp) x).hasFDerivAt + · exact hasFDerivAt_const _ _ + have hi : IntegrableOn (fun x => ∑ k, F' k x (Pi.single k 1)) + (Icc (0 : Plane) (fun _ => 1)) := by + simp_rw [he] + exact ((hg.continuous_fderiv (by simp)).clm_apply continuous_const).integrableOn_Icc + have ht := integral_divergence_of_hasFDerivAt_off_countable' + (0 : Plane) (fun _ => 1) (fun _ => by norm_num) F F' ∅ countable_empty hc + (fun x _ k => hd x k) hi + simp only [he] at ht + rw [ht] + apply Finset.sum_eq_zero + intro k _ + have hf (x : Fin 1 → ℝ) : F k (k.insertNth 1 x) = F k (k.insertNth 0 x) := by + by_cases hk : k = j + · simp only [F, hk, ite_true] + rw [plane_opposite_faces] + exact hp _ _ + · simp [F, hk] + simp only [Pi.zero_apply, hf, sub_self] + +theorem planar_field_mean_zero {H : Plane → ℝ} + (hH : ContDiff ℝ ∞ H) (hp : PlanePeriodic H) : + (∫ x in Icc (0 : Plane) (fun _ => 1), field H x) = 0 := by + have hi : IntegrableOn (field H) (Icc (0 : Plane) (fun _ => 1)) := + (field_smooth hH).continuous.integrableOn_Icc + ext j + change (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ) + (∫ x in Icc (0 : Plane) (fun _ => 1), field H x) = 0 + rw [← (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).integral_comp_comm hi] + fin_cases j + · have he : (fun x => field H x 0) = spatialD 1 H := by + funext x + simp [field] + change (∫ x in Icc (0 : Plane) (fun _ => 1), field H x 0) = 0 + rw [he] + exact integral_planar_periodic_derivative hH hp 1 + · have he : (fun x => field H x 1) = fun x => -spatialD 0 H x := by + funext x + simp [field] + change (∫ x in Icc (0 : Plane) (fun _ => 1), field H x 1) = 0 + rw [he] + rw [integral_neg] + change -(∫ x in Icc (0 : Plane) (fun _ => 1), fderiv ℝ H x (PlanarHamiltonian.basis 0)) = 0 + rw [integral_planar_periodic_derivative hH hp 0, neg_zero] + +theorem planar_field_periodic {H : Plane → ℝ} + (hH : ContDiff ℝ ∞ H) (hp : PlanePeriodic H) : PlanePeriodic (field H) := by + intro x n + have he := fderiv_translation (hH.differentiable (by simp)) (fun y => hp y n) x + simp only [field, spatialD, he] + +theorem planar_slice_potential_smooth {H : FieldExpr} (hH : H.Valid) (s : ℝ) : + ContDiff ℝ ∞ (fun x : Plane => SpatialExpression.spatialValue H (atHeight x s)) := by + have hi : ContDiff ℝ ∞ (fun x : Plane => atHeight x s) := by + apply contDiff_pi.mpr + intro j + fin_cases j + · change ContDiff ℝ ∞ (fun x : Plane => x 0) + exact contDiff_apply ℝ ℝ 0 + · change ContDiff ℝ ∞ (fun x : Plane => x 1) + exact contDiff_apply ℝ ℝ 1 + · change ContDiff ℝ ∞ (fun _ : Plane => s) + exact contDiff_const + have h := (SpatialExpression.spatialValue_smooth hH).comp hi + exact h + +theorem planar_slice_potential_periodic {H : FieldExpr} + (hp : CubePeriodic 1 (SpatialExpression.spatialValue H)) (s : ℝ) : + PlanePeriodic (fun x => SpatialExpression.spatialValue H (atHeight x s)) := by + intro x n + have he : atHeight (x + fun j => (n j : ℝ)) s = + atHeight x s + latticeVector 1 ![n 0, n 1, 0] := by + ext j + fin_cases j <;> simp [atHeight, latticeVector] + change SpatialExpression.spatialValue H (atHeight (x + fun j => (n j : ℝ)) s) = + SpatialExpression.spatialValue H (atHeight x s) + rw [he] + exact hp _ _ + +theorem planarSlice_mean_zero {H : FieldExpr} (hH : H.Valid) + (hp : CubePeriodic 1 (SpatialExpression.spatialValue H)) (s : ℝ) : + (∫ x in Icc (0 : Plane) (fun _ => 1), planarSlice H s x) = 0 := by + exact planar_field_mean_zero (planar_slice_potential_smooth hH s) + (planar_slice_potential_periodic hp s) + +theorem planarSlice_smooth {H : FieldExpr} (hH : H.Valid) (s : ℝ) : + ContDiff ℝ ∞ (planarSlice H s) := + field_smooth (planar_slice_potential_smooth hH s) + +theorem planarSlice_divergence {H : FieldExpr} (hH : H.Valid) (s : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (planarSlice H s) x = 0 := + field_divergence (planar_slice_potential_smooth hH s) x + +theorem planarSlice_spatial_periodic {H : FieldExpr} (hH : H.Valid) + (hp : CubePeriodic 1 (SpatialExpression.spatialValue H)) (s : ℝ) : + PlanePeriodic (planarSlice H s) := + planar_field_periodic (planar_slice_potential_smooth hH s) + (planar_slice_potential_periodic hp s) + +theorem processor_slice_zero {n : ℕ} (p : Fin n → Pulse) (s : ℝ) + (hp : ∀ i, (PeriodicExpr.intervalPulse (p i).start (p i).finish).val s = 0) : + planarSlice (processorExpression p) s = 0 := by + have he : (fun x => SpatialExpression.spatialValue (processorExpression p) (atHeight x s)) = + (fun _ : Plane => (0 : ℝ)) := by + funext x + unfold SpatialExpression.spatialValue processorExpression + rw [FieldExpr.val_sum] + simp only [List.map_ofFn, List.sum_ofFn] + apply Finset.sum_eq_zero + intro i _ + change (PeriodicExpr.intervalPulse (p i).start (p i).finish).val s * + (p i).spatialExpression.val (0, atHeight x s) = 0 + rw [hp i, zero_mul] + unfold planarSlice + rw [he] + ext j + simp [field, spatialD] + +theorem normalized_planar_zero_near_zero (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ∀ᶠ s in 𝓝 (0 : ℝ), ∀ x, planarSlice (Recorder.Planar.normalizedHamiltonian I hI) s x = 0 := by + have he : ∀ᶠ s in 𝓝 (0 : ℝ), ∀ i, + (PeriodicExpr.intervalPulse (Recorder.Planar.normalizedPulse I hI i).start + (Recorder.Planar.normalizedPulse I hI i).finish).val s = 0 := + eventually_all.mpr (fun i => periodicPulse_zero_near_zero + (Recorder.Planar.normalizedPulse_valid I hI i) (Recorder.Planar.normalizedPulse_inUnit I hI i)) + filter_upwards [he] with s hs + intro x + exact congrFun (processor_slice_zero (Recorder.Planar.normalizedPulse I hI) s hs) x + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPerturbations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPerturbations.lean new file mode 100644 index 0000000000000000000000000000000000000000..616e8598b31e28fe164c427721ded08867952277 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPerturbations.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionPerturbations + +namespace OAI + +/-! Quantitative stability of the planar Hamiltonian slices, using the +integer derivative bound computed from their finite expression. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped NNReal + +theorem horizontal_norm_le (v : Space) : ‖horizontal v‖ ≤ ‖v‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg v)).mpr + intro j + fin_cases j + · exact norm_le_pi_norm v 0 + · exact norm_le_pi_norm v 1 + +theorem atHeight_zero_norm (x : Plane) : ‖atHeight x 0‖ = ‖x‖ := by + apply le_antisymm + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro j + fin_cases j + · exact norm_le_pi_norm x 0 + · exact norm_le_pi_norm x 1 + · change ‖(0 : ℝ)‖ ≤ ‖x‖ + simpa only [norm_zero] using norm_nonneg x + · simpa only [atHeight_horizontal] using horizontal_norm_le (atHeight x 0) + +theorem atHeight_dist_same (x y : Plane) (z : ℝ) : + dist (atHeight x z) (atHeight y z) = dist x y := by + have he : atHeight x z - atHeight y z = atHeight (x - y) 0 := by + funext j + fin_cases j <;> simp [atHeight] + rw [dist_eq_norm, he, atHeight_zero_norm, dist_eq_norm] + +def planarSlice (H : FieldExpr) (s : ℝ) (x : Plane) : Plane := + PlanarHamiltonian.field (fun Y => SpatialExpression.spatialValue H (atHeight Y s)) x + +theorem planarSlice_eq_horizontal {H : FieldExpr} (hH : H.Valid) (s : ℝ) (x : Plane) : + planarSlice H s x = horizontal (SpatialExpression.suspensionField H (atHeight x s)) := by + rw [suspensionField_atHeight hH, atHeight_horizontal] + rfl + +theorem planarSlice_lipschitz {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) : + LipschitzWith (suspensionLipschitzBound H : ℝ≥0) (planarSlice H s) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [planarSlice_eq_horizontal hH, planarSlice_eq_horizontal hH] + have hp : dist (horizontal (SpatialExpression.suspensionField H (atHeight x s))) + (horizontal (SpatialExpression.suspensionField H (atHeight y s))) ≤ + dist (SpatialExpression.suspensionField H (atHeight x s)) + (SpatialExpression.suspensionField H (atHeight y s)) := by + have he : horizontal (SpatialExpression.suspensionField H (atHeight x s) - + SpatialExpression.suspensionField H (atHeight y s)) = + horizontal (SpatialExpression.suspensionField H (atHeight x s)) - + horizontal (SpatialExpression.suspensionField H (atHeight y s)) := by + funext j + fin_cases j <;> rfl + simpa only [he, dist_eq_norm] using horizontal_norm_le + (SpatialExpression.suspensionField H (atHeight x s) - + SpatialExpression.suspensionField H (atHeight y s)) + exact hp.trans (by simpa only [atHeight_dist_same] using + (suspensionField_lipschitz hH hT).dist_le_mul (atHeight x s) (atHeight y s)) + +theorem planarSlice_fderiv_bound {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : Plane) : + ‖fderiv ℝ (planarSlice H s) x‖ ≤ (suspensionLipschitzBound H : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (planarSlice_lipschitz hH hT s) + +theorem planar_trajectory_perturbation {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {ψ χ : ℝ → Plane} {a b : ℝ} + (hψ : ∀ s ∈ Icc a b, HasDerivAt ψ (planarSlice H s (ψ s)) s) + (hχ : ∀ s ∈ Icc a b, HasDerivAt χ (planarSlice H s (χ s)) s) + {t : ℝ} (ht : t ∈ Icc a b) : + dist (ψ t) (χ t) ≤ dist (ψ a) (χ a) * + Real.exp ((suspensionLipschitzBound H : ℝ) * (t - a)) := by + have hcψ : ContinuousOn ψ (Icc a b) := + fun s hs => (hψ s hs).continuousAt.continuousWithinAt + have hcχ : ContinuousOn χ (Icc a b) := + fun s hs => (hχ s hs).continuousAt.continuousWithinAt + exact dist_le_of_trajectories_ODE (planarSlice_lipschitz hH hT) hcψ + (fun s hs => (hψ s ⟨hs.1, hs.2.le⟩).hasDerivWithinAt) hcχ + (fun s hs => (hχ s ⟨hs.1, hs.2.le⟩).hasDerivWithinAt) le_rfl t ht + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPrimitiveBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPrimitiveBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5bf02de9bc1db1a6f368fa872426f3e5021ccef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPrimitiveBounds.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchStages + +namespace OAI + +/-! Rational Lipschitz bounds for the elementary planar motions. These +bounds control a whole source neighborhood through the finite schedule. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set + +def Primitive.growth (p : Primitive) : ℚ := + Primitive.casesOn p (fun _ => 1) (fun _ a => 1 + |a|) (fun _ a => 1 + |a|) + +theorem Primitive.growth_one_le (p : Primitive) : 1 ≤ p.growth := by + cases p <;> simp [Primitive.growth] + +theorem shearX_sub_bound (a : ℝ) (x y : Plane) : + ‖shearX a x - shearX a y‖ ≤ (1 + |a|) * ‖x - y‖ := by + have hx : |x 0 - y 0| ≤ ‖x - y‖ := by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) 0 + have hy : |x 1 - y 1| ≤ ‖x - y‖ := by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) 1 + apply (pi_norm_le_iff_of_nonneg (mul_nonneg (by positivity) (norm_nonneg _))).mpr + intro j + fin_cases j + · change |(x 0 + a * x 1) - (y 0 + a * y 1)| ≤ _ + rw [show (x 0 + a * x 1) - (y 0 + a * y 1) = (x 0 - y 0) + a * (x 1 - y 1) by ring] + calc + |(x 0 - y 0) + a * (x 1 - y 1)| ≤ |x 0 - y 0| + |a * (x 1 - y 1)| := abs_add_le _ _ + _ = |x 0 - y 0| + |a| * |x 1 - y 1| := by rw [abs_mul] + _ ≤ ‖x - y‖ + |a| * ‖x - y‖ := add_le_add hx (mul_le_mul_of_nonneg_left hy (abs_nonneg _)) + _ = (1 + |a|) * ‖x - y‖ := by ring + · change |x 1 - y 1| ≤ _ + nlinarith [norm_nonneg (x - y), abs_nonneg a] + +theorem shearY_sub_bound (a : ℝ) (x y : Plane) : + ‖shearY a x - shearY a y‖ ≤ (1 + |a|) * ‖x - y‖ := by + have hx : |x 0 - y 0| ≤ ‖x - y‖ := by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) 0 + have hy : |x 1 - y 1| ≤ ‖x - y‖ := by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) 1 + apply (pi_norm_le_iff_of_nonneg (mul_nonneg (by positivity) (norm_nonneg _))).mpr + intro j + fin_cases j + · change |x 0 - y 0| ≤ _ + nlinarith [norm_nonneg (x - y), abs_nonneg a] + · change |(x 1 + a * x 0) - (y 1 + a * y 0)| ≤ _ + rw [show (x 1 + a * x 0) - (y 1 + a * y 0) = (x 1 - y 1) + a * (x 0 - y 0) by ring] + calc + |(x 1 - y 1) + a * (x 0 - y 0)| ≤ |x 1 - y 1| + |a * (x 0 - y 0)| := abs_add_le _ _ + _ = |x 1 - y 1| + |a| * |x 0 - y 0| := by rw [abs_mul] + _ ≤ ‖x - y‖ + |a| * ‖x - y‖ := add_le_add hy (mul_le_mul_of_nonneg_left hx (abs_nonneg _)) + _ = (1 + |a|) * ‖x - y‖ := by ring + +theorem Primitive.endpoint_sub_bound (p : Primitive) (x y : Plane) : + ‖p.endpoint x - p.endpoint y‖ ≤ (p.growth : ℝ) * ‖x - y‖ := by + cases p with + | translation v => + simp [Primitive.endpoint, Primitive.path, translationPath, Primitive.growth] + | horizontal c a => + let c' : Plane := fun j => (c j : ℝ) + have hd : (x - c') - (y - c') = x - y := by abel + have h := shearX_sub_bound a (x - c') (y - c') + rw [hd] at h + change ‖(c' + shearX (1 * (a : ℝ)) (x - c')) - (c' + shearX (1 * (a : ℝ)) (y - c'))‖ ≤ _ + simp only [one_mul] + rw [add_sub_add_left_eq_sub] + simpa only [Primitive.growth, Rat.cast_add, Rat.cast_one, Rat.cast_abs] using h + | vertical c a => + let c' : Plane := fun j => (c j : ℝ) + have hd : (x - c') - (y - c') = x - y := by abel + have h := shearY_sub_bound a (x - c') (y - c') + rw [hd] at h + change ‖(c' + shearY (1 * (a : ℝ)) (x - c')) - (c' + shearY (1 * (a : ℝ)) (y - c'))‖ ≤ _ + simp only [one_mul] + rw [add_sub_add_left_eq_sub] + simpa only [Primitive.growth, Rat.cast_add, Rat.cast_one, Rat.cast_abs] using h + +theorem Primitive.path_sub_bound (p : Primitive) (x y : Plane) (θ : ℝ → ℝ) (t : ℝ) + (hθ : θ t ∈ Icc (0 : ℝ) 1) : + ‖p.path θ x t - p.path θ y t‖ ≤ (p.growth : ℝ) * ‖x - y‖ := by + rw [p.path_segment, p.path_segment] + have he : (x + θ t • (p.endpoint x - x)) - (y + θ t • (p.endpoint y - y)) = + (1 - θ t) • (x - y) + θ t • (p.endpoint x - p.endpoint y) := by module + rw [he] + apply norm_segment_le _ (p.endpoint_sub_bound x y) hθ + have hg : (1 : ℝ) ≤ p.growth := by exact_mod_cast p.growth_one_le + nlinarith [norm_nonneg (x - y)] + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorData.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorData.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad4813593d073be6cb290ca5eb9482456363a6e8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorData.lean @@ -0,0 +1,162 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarNeighborhood +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorOrbit + +namespace OAI + +/-! The explicitly translated finite rational rectangle table used by the +normalized planar processor. -/ + +noncomputable section +namespace ForcedComputation.PlanarRouting + +open ShearFlows Set + +def translatedInstruction (v : Fin 2 → ℚ) (r : Instruction) : Instruction := + ⟨translatedBox v r.source, translatedBox v r.target, r.factor⟩ + +theorem translatedBox_image (v : Fin 2 → ℚ) (R : RationalBox 2) : + translatedPoint v '' R.carrier = (translatedBox v R).carrier := by + apply Set.Subset.antisymm + · rintro y ⟨x, hx, rfl⟩ + exact (mem_translatedBox v R x).mpr hx + · intro y hy + let x : Plane := fun j => y j - (v j : ℝ) + have he : translatedPoint v x = y := by + funext j + simp only [translatedPoint, x, sub_add_cancel] + exact ⟨x, (mem_translatedBox v R x).mp (he.symm ▸ hy), he⟩ + +theorem translatedInstruction_affine (v : Fin 2 → ℚ) (r : Instruction) (x : Plane) : + (translatedInstruction v r).affine (translatedPoint v x) = + translatedPoint v (r.affine x) := by + ext j + fin_cases j <;> + simp [translatedInstruction, Instruction.affine, translatedPoint, translatedBox, + RationalBox.center] <;> ring + +theorem translatedInstruction_image (v : Fin 2 → ℚ) (r : Instruction) + (hr : r.affine '' r.source.carrier = r.target.carrier) : + (translatedInstruction v r).affine '' (translatedInstruction v r).source.carrier = + (translatedInstruction v r).target.carrier := by + change (translatedInstruction v r).affine '' (translatedBox v r.source).carrier = + (translatedBox v r.target).carrier + calc + _ = (translatedInstruction v r).affine '' (translatedPoint v '' r.source.carrier) := by + rw [translatedBox_image] + _ = (fun x => (translatedInstruction v r).affine (translatedPoint v x)) '' r.source.carrier := + Set.image_image _ _ _ + _ = (fun x => translatedPoint v (r.affine x)) '' r.source.carrier := by + congr 1 + funext x + exact translatedInstruction_affine v r x + _ = translatedPoint v '' (r.affine '' r.source.carrier) := (Set.image_image _ _ _).symm + _ = _ := by rw [hr, translatedBox_image] + +theorem translatedBox_separation (v : Fin 2 → ℚ) {R S : RationalBox 2} + (h : PositivelySeparated R.carrier S.carrier) : + PositivelySeparated (translatedBox v R).carrier (translatedBox v S).carrier := by + obtain ⟨ε, hε, hsep⟩ := h + refine ⟨ε, hε, ?_⟩ + rw [← translatedBox_image, ← translatedBox_image] + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ + have he : ‖translatedPoint v x - translatedPoint v y‖ = ‖x - y‖ := by + simpa only [dist_eq_norm] using Recorder.Planar.translatedPoint_dist v x y + rw [he] + exact hsep x hx y hy + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting Set + +def normalizedInstruction (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_wellFormed hI))) : Instruction := + translatedInstruction (initialShift (freshInput I) (freshInput_valid hI)) + (instruction (freshMachine I.1) (freshInput_wellFormed hI) b) + +def normalizedProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : List Instruction := + (geometricBranches (freshMachine I.1) (freshInput_wellFormed hI)).map (normalizedInstruction I hI) + +def normalizedNeighborhood (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_wellFormed hI))) : Set Plane := + translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) '' + branchNeighborhood (freshMachine I.1) (freshInput_wellFormed hI) b + +theorem normalizedInstruction_mem (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) : + normalizedInstruction I hI b ∈ normalizedProgram I hI := by + apply List.mem_map.mpr + refine ⟨b, ?_, rfl⟩ + simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches _ _ b + +theorem normalizedInstruction_properties (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) : + (normalizedInstruction I hI b).source.positive ∧ + (normalizedInstruction I hI b).target.positive ∧ + 0 < (normalizedInstruction I hI b).factor ∧ + (normalizedInstruction I hI b).affine '' (normalizedInstruction I hI b).source.carrier = + (normalizedInstruction I hI b).target.carrier := by + exact ⟨translatedBox_positive _ (instruction_source_positive _ _ b), + translatedBox_positive _ (instruction_target_positive _ _ b), + instruction_factor_pos _ _ b, translatedInstruction_image _ _ (instruction_image _ _ b)⟩ + +theorem normalizedInstruction_separation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + {b c : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)} (hne : b ≠ c) : + PositivelySeparated (normalizedInstruction I hI b).source.carrier + (normalizedInstruction I hI c).source.carrier ∧ + PositivelySeparated (normalizedInstruction I hI b).target.carrier + (normalizedInstruction I hI c).target.carrier := + ⟨translatedBox_separation _ (instruction_source_separation _ _ hne), + translatedBox_separation _ (instruction_target_separation _ _ hne)⟩ + +theorem normalizedInstruction_neighborhood (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) : + IsOpen (normalizedNeighborhood I hI b) ∧ + (normalizedInstruction I hI b).source.carrier ⊆ normalizedNeighborhood I hI b := by + have he : normalizedNeighborhood I hI b = + (Homeomorph.addRight (fun j => (initialShift (freshInput I) (freshInput_valid hI) j : ℝ))) '' + branchNeighborhood (freshMachine I.1) (freshInput_valid hI).1 b := rfl + constructor + · rw [he] + exact (Homeomorph.addRight _).isOpenMap _ (branchNeighborhood_open _ _ b) + · change (translatedBox _ _).carrier ⊆ _ + rw [← translatedBox_image] + exact Set.image_mono (source_subset_branchNeighborhood _ _ b) + +theorem normalizedInstruction_period (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {y : Plane} (hy : y ∈ normalizedNeighborhood I hI b) : + Ψ 0 1 y = (normalizedInstruction I hI b).affine y := by + obtain ⟨x, hx, rfl⟩ := hy + rw [normalized_branch_neighborhood_period I hI b hx hΨ] + exact (translatedInstruction_affine _ _ x).symm + +theorem normalizedInstruction_encodes (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hs : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) : + ∃ b, normalizedInstruction I hI b ∈ normalizedProgram I hI ∧ + normalizedPoint I hI C ∈ (normalizedInstruction I hI b).source.carrier ∧ + (normalizedInstruction I hI b).affine (normalizedPoint I hI C) = normalizedPoint I hI D := by + obtain ⟨b, _, _, hx, he⟩ := step_branch hs + refine ⟨b, normalizedInstruction_mem I hI b, (mem_translatedBox _ _ _).mpr hx, ?_⟩ + change (translatedInstruction (initialShift (freshInput I) (freshInput_valid hI)) + (instruction (freshMachine I.1) (freshInput_valid hI).1 b)).affine + (translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) = + translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 D) + rw [translatedInstruction_affine, he] + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc49e0162e025fb297f7fff5ec7d0aa8293d7e16 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorMain.lean @@ -0,0 +1,286 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarMixedBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorData +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactEuclideanBounds + +namespace OAI + +/-! The smooth planar processor theorem, assuming smooth dependence and the +first two variational equations for the actual transition, expressed by +PlanarVariations. -/ + +noncomputable section +namespace ForcedComputation + +open ShearFlows PlanarHamiltonian PlanarRouting Set Filter +open scoped Topology ContDiff + +/-- Euclidean, rather than coordinate-maximum, norms are used in this clause. -/ +def ProcessorFlowBounds (V : ℝ → Plane → Plane) (Ψ : ℝ → ℝ → Plane → Plane) + (L : ℕ) : Prop := + 1 ≤ L ∧ + (∀ s x, ‖fderiv ℝ (euclideanMap (V s)) x‖ ≤ (L : ℝ) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (V s))) x‖ ≤ (L : ℝ)) ∧ + ∀ a t, 0 ≤ t → + (∀ x, (‖fderiv ℝ (euclideanMap (Ψ a t)) x‖ ≤ Real.exp ((L : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ψ a t))) x‖ ≤ + Real.exp (2 * (L : ℝ) * t) - Real.exp ((L : ℝ) * t)) ∧ + (‖fderiv ℝ (euclideanMap (Ψ (a + t) (-t))) x‖ ≤ Real.exp ((L : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (euclideanMap (Ψ (a + t) (-t)))) x‖ ≤ + Real.exp (2 * (L : ℝ) * t) - Real.exp ((L : ℝ) * t))) ∧ + (∀ x y, dist (euclideanMap (Ψ a t) x) (euclideanMap (Ψ a t) y) ≤ + Real.exp ((L : ℝ) * t) * dist x y) + +theorem periodic_zero_near_integers {V : ℝ → Plane → Plane} + (hperiod : ∀ x, Function.Periodic (fun s => V s x) 1) + (hzero : ∀ᶠ s in 𝓝 (0 : ℝ), ∀ x, V s x = 0) (n : ℤ) : + ∀ᶠ s in 𝓝 (n : ℝ), ∀ x, V s x = 0 := by + have ht : Tendsto (fun s : ℝ => s - (n : ℝ)) (𝓝 (n : ℝ)) (𝓝 (0 : ℝ)) := by + have hc : Continuous (fun s : ℝ => s - (n : ℝ)) := continuous_id.sub continuous_const + simpa only [sub_self] using hc.tendsto (n : ℝ) + filter_upwards [ht.eventually hzero] with s hs + intro x + have he := (hperiod x).sub_int_mul_eq (x := s) n + have he' : V s x = V (s - (n : ℝ)) x := by simpa only [mul_one] using he.symm + exact he'.trans (hs x) + +namespace Recorder.Planar + +def processorHamiltonian (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (s : ℝ) (x : Plane) : ℝ := + SpatialExpression.spatialValue (normalizedHamiltonian I hI) (atHeight x s) + +theorem processorHamiltonian_joint_smooth (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => processorHamiltonian I hI y.1 y.2) := by + have he : ContDiff ℝ ∞ (fun y : ℝ × Plane => atHeight y.2 y.1) := by + apply contDiff_pi.mpr + intro j + fin_cases j + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 0) + exact (contDiff_apply ℝ ℝ 0).comp contDiff_snd + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 1) + exact (contDiff_apply ℝ ℝ 1).comp contDiff_snd + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.1) + exact contDiff_fst + exact (SpatialExpression.spatialValue_smooth (normalizedHamiltonian_valid I hI)).comp he + +theorem processorVelocity_joint_smooth (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => planarSlice (normalizedHamiltonian I hI) y.1 y.2) := by + have he : ContDiff ℝ ∞ (fun y : ℝ × Plane => atHeight y.2 y.1) := by + apply contDiff_pi.mpr + intro j + fin_cases j + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 0) + exact (contDiff_apply ℝ ℝ 0).comp contDiff_snd + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.2 1) + exact (contDiff_apply ℝ ℝ 1).comp contDiff_snd + · change ContDiff ℝ ∞ (fun y : ℝ × Plane => y.1) + exact contDiff_fst + have hf := planeProjection.contDiff.comp + ((SpatialExpression.suspensionField_smooth (normalizedHamiltonian_valid I hI)).comp he) + convert hf using 1 + funext y + simpa only [Function.comp_apply, planeProjection_apply] using + planarSlice_eq_horizontal (normalizedHamiltonian_valid I hI) y.1 y.2 + +theorem compact_normalizedInstruction_period (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (compactVelocity I hI) Ψ) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + {y : Plane} (hy : y ∈ normalizedNeighborhood I hI b) : + Ψ 0 1 y = (normalizedInstruction I hI b).affine y := by + obtain ⟨z, ⟨x, hx, hzx⟩, rfl⟩ := hy + have hc (j : Fin 2) : 0 < (translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) z) j ∧ + (translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) z) j < 1 := by + simpa only [normalizedAnchors, branchAnchors_first, mem_Ioo] using + normalizedAnchors_near_unit I hI b hx hzx 0 j + rw [compactTransition_eq_slice I hI hΨ hΩ hc] + exact normalizedInstruction_period I hI b hΩ ⟨z, ⟨x, hx, hzx⟩, rfl⟩ + +theorem normalizedNeighborhood_ball (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x y : Plane} (hx : x ∈ (normalizedInstruction I hI b).source.carrier) + (hxy : dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ)) : + y ∈ normalizedNeighborhood I hI b := by + let v := initialShift (freshInput I) (freshInput_valid hI) + change x ∈ (translatedBox v (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source).carrier at hx + rw [← translatedBox_image] at hx + obtain ⟨x₀, hx₀, he⟩ := hx + let y₀ : Plane := fun j => y j - (v j : ℝ) + have hy : translatedPoint v y₀ = y := by + funext j + simp only [translatedPoint, y₀, sub_add_cancel] + refine ⟨y₀, ⟨x₀, hx₀, ?_⟩, hy⟩ + have hd := translatedPoint_dist v y₀ x₀ + rw [hy, he] at hd + rw [← hd] + exact hxy + +theorem clockRectangle_in_unit {x : Plane} (hx : x ∈ clockRectangle.carrier) (j : Fin 2) : + 0 < x j ∧ x j < 1 := by + have h := hx j + fin_cases j <;> norm_num [clockRectangle] at h ⊢ <;> constructor <;> linarith [h.1, h.2] + +/-- All clauses of Theorem 3.1, with the two equivalent chart interpretations +and the finite compiler data kept explicit. -/ +structure ProcessorProperties (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω Ψ : ℝ → ℝ → Plane → Plane) : Prop where + expression_valid : (normalizedHamiltonian I hI).Valid + expression_noTime : SpatialExpression.NoTime (normalizedHamiltonian I hI) + expression_periods : SpatialExpression.UnitPeriods (normalizedHamiltonian I hI) + torus_smooth : ContDiff ℝ ∞ (fun y : ℝ × Plane => planarSlice (normalizedHamiltonian I hI) y.1 y.2) + compact_smooth : ContDiff ℝ ∞ (fun y : ℝ × Plane => compactVelocity I hI y.1 y.2) + torus_periodic : ∀ x, Function.Periodic (fun s => planarSlice (normalizedHamiltonian I hI) s x) 1 + torus_spatial_periodic : ∀ s, PlanePeriodic (planarSlice (normalizedHamiltonian I hI) s) + compact_periodic : ∀ x, Function.Periodic (fun s => compactVelocity I hI s x) 1 + integer_collars : ∀ n : ℤ, ∀ᶠ s in 𝓝 (n : ℝ), + ∀ x, planarSlice (normalizedHamiltonian I hI) s x = 0 ∧ compactVelocity I hI s x = 0 + torus_solenoidal : ∀ s x, PlanarHamiltonian.divergence (planarSlice (normalizedHamiltonian I hI) s) x = 0 + torus_mean : ∀ s, (∫ x in Icc (0 : Plane) (fun _ => 1), planarSlice (normalizedHamiltonian I hI) s x) = 0 + compact_solenoidal : ∀ s x, PlanarHamiltonian.divergence (compactVelocity I hI s) x = 0 + compact_mean : ∀ s, (∫ x, compactVelocity I hI s x) = 0 + compact_support : IsCompact (commonSupport (normalizedPulse I hI)) ∧ + commonSupport (normalizedPulse I hI) ⊆ {x | ∀ j : Fin 2, 0 < x j ∧ x j < 1} ∧ + ∀ s, tsupport (compactVelocity I hI s) ⊆ commonSupport (normalizedPulse I hI) ∧ + tsupport (periodicHamiltonian (normalizedPulse I hI) s) ⊆ commonSupport (normalizedPulse I hI) + hamiltonian : (∀ s, compactVelocity I hI s = field (periodicHamiltonian (normalizedPulse I hI) s)) ∧ + ContDiff ℝ ∞ (fun y : ℝ × Plane => periodicHamiltonian (normalizedPulse I hI) y.1 y.2) ∧ + (∀ x, Function.Periodic (fun s => periodicHamiltonian (normalizedPulse I hI) s x) 1) ∧ + ContDiff ℝ ∞ (fun y : ℝ × Plane => processorHamiltonian I hI y.1 y.2) + chart_agreement : ∀ s x, (∀ j : Fin 2, 0 < x j ∧ x j < 1) → + compactVelocity I hI s x = planarSlice (normalizedHamiltonian I hI) s x + all_derivatives : ∀ α x, + ‖planarMixed (planarField (planarSlice (normalizedHamiltonian I hI))) α x‖ ≤ + (planarMixedBound (normalizedHamiltonian I hI) α : ℝ) ∧ + ‖planarMixed (planarField (compactVelocity I hI)) α x‖ ≤ + (planarMixedBound (normalizedHamiltonian I hI) α : ℝ) + finite_table : ∀ b, normalizedInstruction I hI b ∈ normalizedProgram I hI ∧ + (normalizedInstruction I hI b).source.positive ∧ (normalizedInstruction I hI b).target.positive ∧ + 0 < (normalizedInstruction I hI b).factor ∧ + (normalizedInstruction I hI b).affine '' (normalizedInstruction I hI b).source.carrier = + (normalizedInstruction I hI b).target.carrier + separation : ∀ b c, b ≠ c → + PositivelySeparated (normalizedInstruction I hI b).source.carrier (normalizedInstruction I hI c).source.carrier ∧ + PositivelySeparated (normalizedInstruction I hI b).target.carrier (normalizedInstruction I hI c).target.carrier + neighborhoods : ∀ b, 0 < branchRadius (freshMachine I.1) (freshInput_valid hI).1 b ∧ + IsOpen (normalizedNeighborhood I hI b) ∧ + (normalizedInstruction I hI b).source.carrier ⊆ normalizedNeighborhood I hI b ∧ + ∀ y ∈ normalizedNeighborhood I hI b, + Ω 0 1 y = (normalizedInstruction I hI b).affine y ∧ + Ψ 0 1 y = (normalizedInstruction I hI b).affine y + neighborhood_radius : ∀ b x, x ∈ (normalizedInstruction I hI b).source.carrier → + ∀ y, dist y x < (branchRadius (freshMachine I.1) (freshInput_valid hI).1 b : ℝ) → + y ∈ normalizedNeighborhood I hI b + encoded_branches : ∀ {C D}, Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D → + ∃ b, normalizedInstruction I hI b ∈ normalizedProgram I hI ∧ + normalizedPoint I hI C ∈ (normalizedInstruction I hI b).source.carrier ∧ + (normalizedInstruction I hI b).affine (normalizedPoint I hI C) = normalizedPoint I hI D + torus_transition : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω + compact_transition : IsPlanarTransition (compactVelocity I hI) Ψ + integer_encoding : ∀ {n C}, + Steps (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) n (normalizedInitial I hI) C → + Ω 0 n ![1 / 4, 1 / 4] = normalizedPoint I hI C ∧ + Ψ 0 n ![1 / 4, 1 / 4] = normalizedPoint I hI C + step_corridor : ∀ {C D}, Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D → + ∀ s ∈ Icc (0 : ℝ) 1, + Ω 0 s (normalizedPoint I hI C) ∈ clockRectangle.carrier ∧ + Ψ 0 s (normalizedPoint I hI C) ∈ clockRectangle.carrier + observation : ((∃ t : ℝ, 0 ≤ t ∧ Ω 0 t ![1 / 4, 1 / 4] ∈ observer) ↔ Alternating.Halts I) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ Ψ 0 t ![1 / 4, 1 / 4] ∈ observer) ↔ Alternating.Halts I) + nonhalting : ¬ Alternating.Halts I → ∀ t : ℝ, 0 ≤ t → + (Ω 0 t ![1 / 4, 1 / 4] ∈ clockRectangle.carrier ∧ 3 / 16 ≤ Ω 0 t ![1 / 4, 1 / 4] 1) ∧ + (Ψ 0 t ![1 / 4, 1 / 4] ∈ clockRectangle.carrier ∧ 3 / 16 ≤ Ψ 0 t ![1 / 4, 1 / 4] 1) + halt_clearance : Alternating.Halts I → ∃ n : ℕ, + 1 / 16 ≤ Ω 0 n ![1 / 4, 1 / 4] 1 ∧ Ω 0 n ![1 / 4, 1 / 4] 1 ≤ 3 / 32 ∧ + 1 / 16 ≤ Ψ 0 n ![1 / 4, 1 / 4] 1 ∧ Ψ 0 n ![1 / 4, 1 / 4] 1 ≤ 3 / 32 + euclidean_bounds : ProcessorFlowBounds (planarSlice (normalizedHamiltonian I hI)) Ω + (euclideanFlowBound (normalizedHamiltonian I hI)) ∧ + ProcessorFlowBounds (compactVelocity I hI) Ψ (euclideanFlowBound (normalizedHamiltonian I hI)) + +theorem smooth_planar_processor (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) + (hv : PlanarVariations (planarSlice (normalizedHamiltonian I hI)) Ω) : + ∃ Ψ, ProcessorProperties I hI Ω Ψ := by + obtain ⟨Ψ, hΨ⟩ := compactVelocity_transitions I hI + have he (a t : ℝ) : Ψ a t ![1 / 4, 1 / 4] = Ω a t ![1 / 4, 1 / 4] := + compactTransition_eq_slice I hI hΨ hΩ (by intro j; fin_cases j <;> norm_num) a t + refine ⟨Ψ, { + expression_valid := normalizedHamiltonian_valid I hI + expression_noTime := normalizedHamiltonian_noTime I hI + expression_periods := normalizedHamiltonian_unitPeriods I hI + torus_smooth := processorVelocity_joint_smooth I hI + compact_smooth := compactVelocity_smooth I hI + torus_periodic := planarSlice_periodic (normalizedHamiltonian_periodic I hI) + torus_spatial_periodic := fun s => planarSlice_spatial_periodic (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_periodic I hI) s + compact_periodic := periodicVelocity_periodic (normalizedPulse I hI) + integer_collars := ?_ + torus_solenoidal := planarSlice_divergence (normalizedHamiltonian_valid I hI) + torus_mean := planarSlice_mean_zero (normalizedHamiltonian_valid I hI) (normalizedHamiltonian_periodic I hI) + compact_solenoidal := fun s => (periodicVelocity_properties (normalizedPulse_valid I hI) s).2.1 + compact_mean := fun s => (periodicVelocity_properties (normalizedPulse_valid I hI) s).2.2 + compact_support := ⟨commonSupport_compact _, commonSupport_in_unit (normalizedPulse_inUnit I hI), + fun s => ⟨compactVelocity_support I hI s, periodicHamiltonian_support (normalizedPulse_valid I hI) s⟩⟩ + hamiltonian := ⟨fun _ => rfl, periodicHamiltonian_smooth (normalizedPulse_valid I hI), + periodicHamiltonian_periodic _, processorHamiltonian_joint_smooth I hI⟩ + chart_agreement := fun s x hx => normalized_planar_field_on_chart I hI s x (hx 0) (hx 1) + all_derivatives := fun α x => ⟨planarMixed_slice_bound (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) α x, compactPlanar_mixed_bound I hI α x⟩ + finite_table := fun b => ⟨normalizedInstruction_mem I hI b, normalizedInstruction_properties I hI b⟩ + separation := fun _ _ hne => normalizedInstruction_separation I hI hne + neighborhoods := ?_ + neighborhood_radius := fun _ _ hx _ hxy => normalizedNeighborhood_ball I hI _ hx hxy + encoded_branches := normalizedInstruction_encodes I hI + torus_transition := hΩ + compact_transition := hΨ + integer_encoding := ?_ + step_corridor := ?_ + observation := ?_ + nonhalting := ?_ + halt_clearance := ?_ + euclidean_bounds := ?_ }⟩ + · intro n + have h₁ := periodic_zero_near_integers (planarSlice_periodic (normalizedHamiltonian_periodic I hI)) + (normalized_planar_zero_near_zero I hI) n + have h₂ := periodic_zero_near_integers (periodicVelocity_periodic (normalizedPulse I hI)) + (periodicVelocity_zero_near_zero (normalizedPulse_valid I hI) (normalizedPulse_inUnit I hI)) n + filter_upwards [h₁, h₂] with s hs₁ hs₂ + exact fun x => ⟨hs₁ x, hs₂ x⟩ + · intro b + exact ⟨branchRadius_pos _ _ b, (normalizedInstruction_neighborhood I hI b).1, + (normalizedInstruction_neighborhood I hI b).2, fun y hy => + ⟨normalizedInstruction_period I hI b hΩ hy, compact_normalizedInstruction_period I hI b hΨ hΩ hy⟩⟩ + · intro n C hs + have hc := normalized_steps_realized I hI hΩ hs + rw [normalizedPoint_initial] at hc + exact ⟨hc, (he 0 n).trans hc⟩ + · intro C D hs s ht + have hc := normalized_step_corridor I hI hΩ hs ht + have h₀ := normalized_step_corridor I hI hΩ hs (s := 0) (by norm_num) + rw [hΩ.initial] at h₀ + have hcmp := compactTransition_eq_slice I hI hΨ hΩ (clockRectangle_in_unit h₀) 0 s + exact ⟨hc, hcmp.symm ▸ hc⟩ + · exact ⟨normalized_planar_observation I hI hΩ, by + simpa only [he] using normalized_planar_observation I hI hΩ⟩ + · intro hno t ht + have hc := normalized_nonhalting_corridor I hI hΩ hno ht + exact ⟨hc, by simpa only [he] using hc⟩ + · intro hh + obtain ⟨n, hn⟩ := normalized_halting_clearance I hI hΩ hh + exact ⟨n, hn.1, hn.2, by simpa only [he] using hn.1, by simpa only [he] using hn.2⟩ + · exact ⟨planar_euclidean_flow_estimates (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) hv, + ⟨euclideanFlowBound_one_le _, compact_euclidean_field_bounds I hI, + compact_euclidean_flow_estimates I hI hΨ hΩ hv⟩⟩ + +end Recorder.Planar +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorOrbit.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d296d1127cc1096c8d1961fdede1e5ac12e3cee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorOrbit.lean @@ -0,0 +1,134 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarObservation + +namespace OAI + +/-! The full orbit clauses for the planar processor: every simulated step, +the common corridor, nonhalting safety, and an integer-time halting margin. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar + +open ShearFlows Set Radix + +def normalizedPoint (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (C : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))) : Plane := + shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_wellFormed hI) C) + +def normalizedInitial (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) := + finiteInitializedRecorder (freshInput I) (freshInput_valid hI) + +theorem normalizedPoint_initial (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + normalizedPoint I hI (normalizedInitial I hI) = ![1 / 4, 1 / 4] := + initialShift_spec (freshInput I) (freshInput_valid hI) + +theorem normalized_steps_realized (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {n : ℕ} {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hs : Steps (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) n C D) : + Ψ 0 n (normalizedPoint I hI C) = normalizedPoint I hI D := + planar_recorder_steps hΨ (planarSlice_periodic (normalizedHamiltonian_periodic I hI)) + (normalizedPoint I hI) (normalized_planar_step I hI hΨ) hs + +theorem normalized_step_corridor (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hs : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) + {s : ℝ} (hs' : s ∈ Icc (0 : ℝ) 1) : + Ψ 0 s (normalizedPoint I hI C) ∈ clockRectangle.carrier := by + obtain ⟨b, _, _, hx, _⟩ := step_branch hs + have h := (normalized_branch_planar I hI b hx hΨ).2 s hs' + simpa only [normalizedAnchors, branchAnchors_first, normalizedPoint, + translatedPoint_eq_shiftPoint] using h + +theorem normalized_step_safe (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hs : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) + (hD : recorderHalting (freshMachine I.1) D.control = false) + {s : ℝ} (hs' : s ∈ Icc (0 : ℝ) 1) : + 3 / 16 ≤ Ψ 0 s (normalizedPoint I hI C) 1 := by + obtain ⟨b, _, ht, hx, _⟩ := step_branch hs + have hn : recorderHalting (freshMachine I.1) b.target = false := by rw [ht]; exact hD + have h := ((normalized_branch_planar_safe I hI b hn hx hΨ).2 s hs').2 + simpa only [normalizedAnchors, branchAnchors_first, normalizedPoint, + translatedPoint_eq_shiftPoint] using h + +theorem finite_work_nonhalting (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (hno : ¬ Alternating.Halts I) (n : ℕ) : + (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt I hI n) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) n).state.val = (Alternating.configurationAt I n).state at he + change I.1.isHalting _ = false + rw [he] + cases hh : I.1.isHalting (Alternating.configurationAt I n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + +theorem normalized_nonhalting_corridor (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + (hno : ¬ Alternating.Halts I) {t : ℝ} (ht : 0 ≤ t) : + Ψ 0 t ![1 / 4, 1 / 4] ∈ clockRectangle.carrier ∧ + 3 / 16 ≤ Ψ 0 t ![1 / 4, 1 / 4] 1 := by + let J := freshInput I + have hJ : Alternating.ValidInput J := freshInput_valid hI + have hnoJ : ¬ Alternating.Halts J := fun hh => hno ((freshInput_halts_iff hI).mp hh) + let C₀ := normalizedInitial I hI + have hn := finite_work_nonhalting J hJ hnoJ + have hsteps (n : ℕ) : Steps (finiteMachine J.1 hJ.1) n C₀ + (run (finiteMachine J.1 hJ.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine J.1 hJ.1) + (run (finiteMachine J.1 hJ.1) C₀ n) (run (finiteMachine J.1 hJ.1) C₀ (n + 1)) := + run_step_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting J.1 + (run (finiteMachine J.1 hJ.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State J.1) (Alphabet J.1)) : + haltingControl (finiteMachine J.1 hJ.1) q = recorderHalting J.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hs : t - (n : ℝ) ∈ Icc (0 : ℝ) 1 := by constructor <;> linarith + have htime : t = (n : ℝ) + (t - (n : ℝ)) := by ring + rw [htime, hΨ.nat_shift (planarSlice_periodic (normalizedHamiltonian_periodic I hI)), + ← normalizedPoint_initial I hI, normalized_steps_realized I hI hΨ (hsteps n)] + exact ⟨normalized_step_corridor I hI hΨ (hnext n) hs, + normalized_step_safe I hI hΨ (hnext n) (hcontrol (n + 1)) hs⟩ + +theorem normalized_halting_clearance (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + (hh : Alternating.Halts I) : + ∃ n : ℕ, 1 / 16 ≤ Ψ 0 n ![1 / 4, 1 / 4] 1 ∧ + Ψ 0 n ![1 / 4, 1 / 4] 1 ≤ 3 / 32 := by + have hhJ := (freshInput_halts_iff hI).mpr hh + obtain ⟨n, C, q, hs, hc, hhalt⟩ := + (finite_recorder_halts_iff (freshInput I) (freshInput_valid hI)).mpr hhJ + have he := normalized_steps_realized I hI hΨ hs + change Ψ 0 (n : ℝ) (normalizedPoint I hI (normalizedInitial I hI)) = + normalizedPoint I hI C at he + rw [normalizedPoint_initial I hI] at he + have hq : recorderHalting (freshMachine I.1) C.control = true := by + rw [hc] + exact hhalt + have hd := (initialShift_small (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI)).2 + refine ⟨n, ?_⟩ + rw [he] + exact shifted_halting_clearance _ _ C _ hq hd + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorUnconditional.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorUnconditional.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae6b159f3cf39e05da5d9eeb0f075271d5e675b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProcessorUnconditional.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariationDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorMain + +namespace OAI + +/-! The complete planar processor theorem with the smooth-dependence +input discharged for the actual compiled finite Hamiltonian. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows + +theorem smooth_planar_processor_unconditional (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ω) : + ∃ Ψ, ProcessorProperties I hI Ω Ψ := + smooth_planar_processor I hI Ω hΩ + (planarTransition_variations (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) hΩ) + +theorem exists_smooth_planar_processor (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ∃ Ω Ψ, ProcessorProperties I hI Ω Ψ := by + obtain ⟨Ω, hΩ⟩ := exists_planarTransition (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) + obtain ⟨Ψ, hΨ⟩ := smooth_planar_processor_unconditional I hI Ω hΩ + exact ⟨Ω, Ψ, hΨ⟩ + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd2a0496de9aebf318cd6d63e2a3b77a7d64fdeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgram.lean @@ -0,0 +1,204 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTubes +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTiming +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulseExpressions + +namespace OAI + +/-! The actual finite rational pulse compiler: ordered extraction, four +anisotropic shears in each isolated parking column, and ordered insertion. -/ + +noncomputable section + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +def separationMinimum {n : ℕ} (R : Fin n → RationalBox 2) : ℚ := + positiveMinimum (List.ofFn fun i => positiveMinimum + (List.ofFn fun j => if i = j then 1 else boxGap (R i) (R j))) + +theorem separationMinimum_pos {n : ℕ} {R : Fin n → RationalBox 2} + (hR : ∀ i, (R i).positive) + (hsep : ∀ i j, i ≠ j → PositivelySeparated (R i).carrier (R j).carrier) : + 0 < separationMinimum R := by + apply positiveMinimum_pos + intro x hx + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hx + apply positiveMinimum_pos + intro x hx + obtain ⟨j, rfl⟩ := List.mem_ofFn.mp hx + by_cases hij : i = j + · simp [hij] + · simpa only [hij, ite_false] using boxGap_pos_of_separated (R i) (R j) (hR i) (hR j) (hsep i j hij) + +theorem separationMinimum_le {n : ℕ} (R : Fin n → RationalBox 2) + {i j : Fin n} (hij : i ≠ j) : separationMinimum R ≤ boxGap (R i) (R j) := by + have hr := positiveMinimum_le_of_mem (List.mem_ofFn.mpr ⟨i, rfl⟩ : + positiveMinimum (List.ofFn fun j => if i = j then 1 else boxGap (R i) (R j)) ∈ + List.ofFn (fun k => positiveMinimum + (List.ofFn fun j => if k = j then 1 else boxGap (R k) (R j)))) + have hc := positiveMinimum_le_of_mem (List.mem_ofFn.mpr ⟨j, by simp [hij]⟩ : + boxGap (R i) (R j) ∈ List.ofFn fun j => if i = j then 1 else boxGap (R i) (R j)) + exact hr.trans hc + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian + +def branchAt (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (geometricBranches M hM).length) : Branch (finiteMachine M hM) := + (geometricBranches M hM).get i + +def branchIndex (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Fin (geometricBranches M hM).length := + ⟨(geometricBranches M hM).idxOf b, List.idxOf_lt_length_of_mem + (by simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches M hM b)⟩ + +theorem branchAt_index (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : branchAt M hM (branchIndex M hM b) = b := + List.idxOf_get _ + +def sourceFamily (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (geometricBranches M hM).length) : RationalBox 2 := + (instruction M hM (branchAt M hM i)).source + +def targetFamily (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (geometricBranches M hM).length) : RationalBox 2 := + (instruction M hM (branchAt M hM i)).target + +theorem sourceFamily_separation (M : Alternating.Machine) (hM : M.WellFormed) + (i j : Fin (geometricBranches M hM).length) (hij : i ≠ j) : + PositivelySeparated (sourceFamily M hM i).carrier (sourceFamily M hM j).carrier := by + apply instruction_source_separation + intro he + exact hij ((List.nodup_iff_injective_get.mp (List.nodup_dedup _)) he) + +theorem targetFamily_separation (M : Alternating.Machine) (hM : M.WellFormed) + (i j : Fin (geometricBranches M hM).length) (hij : i ≠ j) : + PositivelySeparated (targetFamily M hM i).carrier (targetFamily M hM j).carrier := by + apply instruction_target_separation + intro he + exact hij ((List.nodup_iff_injective_get.mp (List.nodup_dedup _)) he) + +def routingCollar (M : Alternating.Machine) (hM : M.WellFormed) : ℚ := + min (parkingScale (geometricBranches M hM).length / 1024) + (min (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) / 16) + +theorem routingCollar_pos (M : Alternating.Machine) (hM : M.WellFormed) : + 0 < routingCollar M hM := by + have hs := separationMinimum_pos (R := sourceFamily M hM) + (fun i => instruction_source_positive M hM (branchAt M hM i)) (sourceFamily_separation M hM) + have ht := separationMinimum_pos (R := targetFamily M hM) + (fun i => instruction_target_positive M hM (branchAt M hM i)) (targetFamily_separation M hM) + exact lt_min (div_pos (parkingScale_pos _) (by norm_num)) + (div_pos (lt_min hs ht) (by norm_num)) + +theorem routingCollar_parking_bound (M : Alternating.Machine) (hM : M.WellFormed) : + 1024 * routingCollar M hM ≤ parkingScale (geometricBranches M hM).length := by + have h := min_le_left (parkingScale (geometricBranches M hM).length / 1024) + (min (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) / 16) + change routingCollar M hM ≤ _ at h + linarith + +theorem routingCollar_source_gap (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (geometricBranches M hM).length} (hij : i ≠ j) : + 16 * routingCollar M hM ≤ boxGap (sourceFamily M hM i) (sourceFamily M hM j) := by + have h₀ := min_le_right (parkingScale (geometricBranches M hM).length / 1024) + (min (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) / 16) + have h₁ := min_le_left (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) + have h₂ := separationMinimum_le (sourceFamily M hM) hij + change routingCollar M hM ≤ _ at h₀ + linarith + +theorem routingCollar_target_gap (M : Alternating.Machine) (hM : M.WellFormed) + {i j : Fin (geometricBranches M hM).length} (hij : i ≠ j) : + 16 * routingCollar M hM ≤ boxGap (targetFamily M hM i) (targetFamily M hM j) := by + have h₀ := min_le_right (parkingScale (geometricBranches M hM).length / 1024) + (min (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) / 16) + have h₁ := min_le_right (separationMinimum (sourceFamily M hM)) (separationMinimum (targetFamily M hM)) + have h₂ := separationMinimum_le (targetFamily M hM) hij + change routingCollar M hM ≤ _ at h₀ + linarith + +inductive Phase + | extractHorizontal + | extractVertical + | scale (k : Fin 4) + | insertVertical + | insertHorizontal + +structure Action (M : Alternating.Machine) (hM : M.WellFormed) where + owner : Branch (finiteMachine M hM) + phase : Phase + +def actions (M : Alternating.Machine) (hM : M.WellFormed) : List (Action M hM) := + (sourceOrder M hM).flatMap (fun b => [⟨b, .extractHorizontal⟩, ⟨b, .extractVertical⟩]) ++ + (geometricBranches M hM).flatMap (fun b => List.ofFn fun k => ⟨b, .scale k⟩) ++ + (targetOrder M hM).flatMap (fun b => [⟨b, .insertVertical⟩, ⟨b, .insertHorizontal⟩]) + +def parkingFor (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Fin 2 → ℚ := + parkingCenter (geometricBranches M hM).length (branchIndex M hM b) + +def Action.primitive {M : Alternating.Machine} {hM : M.WellFormed} (a : Action M hM) : Primitive := + letI := ShearFlows.neZeroTwo + let r := instruction M hM a.owner + let p := parkingFor M hM a.owner + let ε := parkingScale (geometricBranches M hM).length + match a.phase with + | .extractHorizontal => .translation ![p 0 - centerQ r.source 0, 0] + | .extractVertical => .translation ![0, p 1 - centerQ r.source 1] + | .scale 0 => .vertical p (-r.factor * (3 / 8) / ε) + | .scale 1 => .horizontal p ((r.factor⁻¹ - 1) * ε / (3 / 8)) + | .scale 2 => .vertical p ((3 / 8) / ε) + | .scale _ => .horizontal p ((r.factor - 1) * ε / (3 / 8)) + | .insertVertical => .translation ![0, centerQ r.target 1 - p 1] + | .insertHorizontal => .translation ![centerQ r.target 0 - p 0, 0] + +def phaseRectangle (R S : RationalBox 2) (p : Fin 2 → ℚ) + (P : RationalBox 2) : Phase → RationalBox 2 := + letI := ShearFlows.neZeroTwo + fun + | .extractHorizontal => translationTube R (horizontalCenter R (p 0)) + | .extractVertical => translationTube (recenter R (horizontalCenter R (p 0))) p + | .scale _ => P + | .insertVertical => translationTube (recenter S p) (horizontalCenter S (p 0)) + | .insertHorizontal => translationTube (recenter S (horizontalCenter S (p 0))) (centerQ S) + +def Action.rectangle {M : Alternating.Machine} {hM : M.WellFormed} (a : Action M hM) : RationalBox 2 := + let r := instruction M hM a.owner + let p := parkingFor M hM a.owner + phaseRectangle r.source r.target p + (parkingBox (geometricBranches M hM).length (bandScale M) (branchIndex M hM a.owner)) a.phase + +def compiledPulse (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (actions M hM).length) : Pulse where + primitive := ((actions M hM).get i).primitive + rectangle := ((actions M hM).get i).rectangle + collar := routingCollar M hM + start := PlanarTiming.start i + finish := PlanarTiming.finish i + +theorem compiledPulse_valid (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (actions M hM).length) : (compiledPulse M hM i).Valid := + ⟨routingCollar_pos M hM, (PlanarTiming.intervals i).2.1⟩ + +def compiledHamiltonian (M : Alternating.Machine) (hM : M.WellFormed) : FieldExpr := + processorExpression (compiledPulse M hM) + +theorem compiledHamiltonian_valid (M : Alternating.Machine) (hM : M.WellFormed) : + (compiledHamiltonian M hM).Valid := processorExpression_valid (compiledPulse_valid M hM) + +theorem compiledHamiltonian_noTime (M : Alternating.Machine) (hM : M.WellFormed) : + SpatialExpression.NoTime (compiledHamiltonian M hM) := processorExpression_noTime _ + +theorem compiledHamiltonian_unitPeriods (M : Alternating.Machine) (hM : M.WellFormed) : + SpatialExpression.UnitPeriods (compiledHamiltonian M hM) := processorExpression_unitPeriods _ + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgramBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgramBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d728afd3bdc5767dc809a3baff6d6466014e6f7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarProgramBounds.lean @@ -0,0 +1,210 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProgram + +namespace OAI + +/-! Uniform chart margins for every filled tube and parking box in the finite +planar compiler. These bounds concern the whole rectangles, including points +which do not encode tapes. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +def Between (R : RationalBox 2) (l u : ℚ) : Prop := + ∀ j, l ≤ R.lower j ∧ R.upper j ≤ u + +theorem endpoints_of_carrier {R : RationalBox 2} (hR : R.positive) + {l u : ℚ} (h : ∀ x ∈ R.carrier, ∀ j, (l : ℝ) ≤ x j ∧ x j ≤ u) : + Between R l u := by + have hl : (fun j => (R.lower j : ℝ)) ∈ R.carrier := by + intro j + exact ⟨le_rfl, (Rat.cast_le (K := ℝ)).mpr (hR j).le⟩ + have hu : (fun j => (R.upper j : ℝ)) ∈ R.carrier := by + intro j + exact ⟨(Rat.cast_le (K := ℝ)).mpr (hR j).le, le_rfl⟩ + intro j + exact ⟨(Rat.cast_le (K := ℝ)).mp (h _ hl j).1, + (Rat.cast_le (K := ℝ)).mp (h _ hu j).2⟩ + +theorem centerQ_between {R : RationalBox 2} (hR : R.positive) + {l u : ℚ} (h : Between R l u) (j : Fin 2) : + l ≤ centerQ R j ∧ centerQ R j ≤ u := by + have hp := hR j + have hb := h j + dsimp [centerQ] + constructor <;> linarith + +theorem recenter_between {R : RationalBox 2} {p : Fin 2 → ℚ} + (hp : ∀ j, (1 / 32 : ℚ) ≤ p j ∧ p j ≤ 3 / 4) + (hw : ∀ j, halfWidthQ R j ≤ 1 / 128) : + Between (recenter R p) (1 / 64) (7 / 8) := by + intro j + have h := hp j + have h' := hw j + change 1 / 64 ≤ p j - halfWidthQ R j ∧ p j + halfWidthQ R j ≤ 7 / 8 + constructor <;> linarith + +@[simp] theorem recenter_halfWidthQ (R : RationalBox 2) (p : Fin 2 → ℚ) (j : Fin 2) : + halfWidthQ (recenter R p) j = halfWidthQ R j := by + dsimp [halfWidthQ, recenter] + ring + +theorem translationTube_between {R : RationalBox 2} {p : Fin 2 → ℚ} + {l u : ℚ} (hR : Between R l u) (hp : Between (recenter R p) l u) : + Between (translationTube R p) l u := by + intro j + exact ⟨le_min (hR j).1 (hp j).1, max_le (hR j).2 (hp j).2⟩ + +theorem between_mono {R : RationalBox 2} {l l' u u' : ℚ} + (h : Between R l u) (hl : l' ≤ l) (hu : u ≤ u') : Between R l' u' := by + intro j + exact ⟨hl.trans (h j).1, (h j).2.trans hu⟩ + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarRouting PlanarHamiltonian + +theorem instruction_endpoint_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + Between (instruction M hM b).source (1 / 32) (1 / 3) ∧ + Between (instruction M hM b).target (1 / 32) (1 / 3) := by + have he : (compression M hM : ℝ) ≤ 1 / 64 := by + have hc := (Rat.cast_le (K := ℝ)).mpr (compression_le M hM) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hc + constructor + · apply endpoints_of_carrier (instruction_source_positive M hM b) + intro x hx j + obtain ⟨hx₀, hx₁, hx₂⟩ := instruction_source_bounds M hM b hx + obtain ⟨hl, hu⟩ := abs_le.mp hx₀ + fin_cases j <;> norm_num <;> constructor <;> linarith + · apply endpoints_of_carrier (instruction_target_positive M hM b) + intro x hx j + obtain ⟨hx₀, hx₁, hx₂⟩ := instruction_target_bounds M hM b hx + obtain ⟨hl, hu⟩ := abs_le.mp hx₀ + fin_cases j <;> norm_num <;> constructor <;> linarith + +theorem instruction_halfWidthQ_bound (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (∀ j, halfWidthQ (instruction M hM b).source j ≤ 1 / 128) ∧ + (∀ j, halfWidthQ (instruction M hM b).target j ≤ 1 / 128) := by + have he : (compression M hM : ℝ) ≤ 1 / 64 := by + have hc := (Rat.cast_le (K := ℝ)).mpr (compression_le M hM) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hc + have hk : (bandScale M : ℝ) ≤ 1 / 64 := by + have hc := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hc + have hk₀ : (0 : ℝ) ≤ bandScale M := by exact_mod_cast (bandScale_pos M).le + have hh := instruction_halfWidths M hM b + have hm := mul_le_mul he hk hk₀ (by norm_num : (0 : ℝ) ≤ 1 / 64) + have hs₀ : (instruction M hM b).source.halfWidth 0 ≤ 1 / 128 := by linarith [hh.1] + have hs₁ : (instruction M hM b).source.halfWidth 1 ≤ 1 / 128 := by linarith [hh.2.2.1] + have ht₀ : (instruction M hM b).target.halfWidth 0 ≤ 1 / 128 := by linarith [hh.2.1] + have ht₁ : (instruction M hM b).target.halfWidth 1 ≤ 1 / 128 := by linarith [hh.2.2.2] + constructor <;> intro j + · apply (Rat.cast_le (K := ℝ)).mp + rw [halfWidthQ_cast] + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + fin_cases j + · change (instruction M hM b).source.halfWidth 0 ≤ _ + exact hs₀ + · change (instruction M hM b).source.halfWidth 1 ≤ _ + exact hs₁ + · apply (Rat.cast_le (K := ℝ)).mp + rw [halfWidthQ_cast] + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + fin_cases j + · change (instruction M hM b).target.halfWidth 0 ≤ _ + exact ht₀ + · change (instruction M hM b).target.halfWidth 1 ≤ _ + exact ht₁ + +theorem parkingFor_between (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (j : Fin 2) : + (1 / 32 : ℚ) ≤ parkingFor M hM b j ∧ parkingFor M hM b j ≤ 3 / 4 := by + have h := parkingCenter_bounds (geometricBranches M hM).length (branchIndex M hM b) + fin_cases j + · exact ⟨by change 1 / 32 ≤ parkingCenter _ _ 0; linarith [h.1], h.2.le⟩ + · change 1 / 32 ≤ 3 / 4 ∧ (3 / 4 : ℚ) ≤ 3 / 4 + norm_num + +theorem horizontalCenter_between (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {R : RationalBox 2} + (hR : R.positive) (hB : Between R (1 / 32) (1 / 3)) (j : Fin 2) : + (1 / 32 : ℚ) ≤ horizontalCenter R (parkingFor M hM b 0) j ∧ + horizontalCenter R (parkingFor M hM b 0) j ≤ 3 / 4 := by + fin_cases j + · exact parkingFor_between M hM b 0 + · have h := centerQ_between hR hB 1 + change 1 / 32 ≤ centerQ R 1 ∧ centerQ R 1 ≤ 3 / 4 + exact ⟨h.1, h.2.trans (by norm_num)⟩ + +theorem phaseRectangle_between {R S P : RationalBox 2} {p : Fin 2 → ℚ} + (hR : R.positive) (hS : S.positive) + (hs : Between R (1 / 32) (1 / 3)) (ht : Between S (1 / 32) (1 / 3)) + (hws : ∀ j, halfWidthQ R j ≤ 1 / 128) (hwt : ∀ j, halfWidthQ S j ≤ 1 / 128) + (hp : ∀ j, (1 / 32 : ℚ) ≤ p j ∧ p j ≤ 3 / 4) + (hP : Between P (1 / 64) (7 / 8)) (phase : Phase) : + Between (phaseRectangle R S p P phase) (1 / 64) (7 / 8) := by + have hc {T : RationalBox 2} (hT : T.positive) (hB : Between T (1 / 32) (1 / 3)) : + ∀ j, (1 / 32 : ℚ) ≤ horizontalCenter T (p 0) j ∧ + horizontalCenter T (p 0) j ≤ 3 / 4 := by + intro j + fin_cases j + · exact hp 0 + · have h := centerQ_between hT hB 1 + change 1 / 32 ≤ centerQ T 1 ∧ centerQ T 1 ≤ 3 / 4 + exact ⟨h.1, h.2.trans (by norm_num)⟩ + have hcs := hc hR hs + have hct := hc hS ht + cases phase with + | extractHorizontal => + exact translationTube_between (between_mono hs (by norm_num) (by norm_num)) (recenter_between hcs hws) + | extractVertical => + apply translationTube_between (recenter_between hcs hws) + exact recenter_between hp (by simpa only [recenter_halfWidthQ] using hws) + | scale k => exact hP + | insertVertical => + apply translationTube_between (recenter_between hp hwt) + exact recenter_between hct (by simpa only [recenter_halfWidthQ] using hwt) + | insertHorizontal => + apply translationTube_between (recenter_between hct hwt) + have he : recenter (recenter S (horizontalCenter S (p 0))) (centerQ S) = S := by + apply box_ext + · funext j + change centerQ S j - halfWidthQ (recenter S (horizontalCenter S (p 0))) j = S.lower j + rw [recenter_halfWidthQ, centerQ_sub_halfWidthQ] + · funext j + change centerQ S j + halfWidthQ (recenter S (horizontalCenter S (p 0))) j = S.upper j + rw [recenter_halfWidthQ, centerQ_add_halfWidthQ] + rw [he] + exact between_mono ht (by norm_num) (by norm_num) + +theorem Action.rectangle_between {M : Alternating.Machine} {hM : M.WellFormed} + (a : Action M hM) : Between a.rectangle (1 / 64) (7 / 8) := by + apply phaseRectangle_between (instruction_source_positive M hM a.owner) + (instruction_target_positive M hM a.owner) + (instruction_endpoint_bounds M hM a.owner).1 (instruction_endpoint_bounds M hM a.owner).2 + (instruction_halfWidthQ_bound M hM a.owner).1 (instruction_halfWidthQ_bound M hM a.owner).2 + (parkingFor_between M hM a.owner) + apply endpoints_of_carrier (parkingBox_positive (bandScale_pos M) _) + intro x hx j + have h := parkingBox_bounds (bandScale_pos M).le (bandScale_le M) (branchIndex M hM a.owner) hx + fin_cases j <;> norm_num <;> constructor <;> linarith [h.1, h.2.1, h.2.2.1, h.2.2.2] + +theorem compiledPulse_inUnit (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (actions M hM).length) : (compiledPulse M hM i).InUnit := by + have hδ := routingCollar_parking_bound M hM + have hε := parkingScale_le (geometricBranches M hM).length + have hR := Action.rectangle_between ((actions M hM).get i) + refine ⟨(PlanarTiming.intervals i).1, (PlanarTiming.intervals i).2.2, ?_⟩ + intro j + have hj := hR j + change 0 < ((actions M hM).get i).rectangle.lower j - 2 * routingCollar M hM ∧ + ((actions M hM).get i).rectangle.upper j + 2 * routingCollar M hM < 1 + constructor <;> linarith + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulse.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulse.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f82de83c148aea08f58c97d197e380213755c1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulse.lean @@ -0,0 +1,255 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarParking + +namespace OAI + +/-! A finite rational syntax for the planar Hamiltonian processor. Each pulse +has one polynomial potential, one rational rectangle cutoff, and one rational +time interval. Its analytic interpretation is the actual compact Hamiltonian +field, including the cutoff collar. -/ + +noncomputable section + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +theorem field_const_mul {H : Plane → ℝ} (hH : ContDiff ℝ ∞ H) (a : ℝ) (x : Plane) : + field (fun y => a * H y) x = a • field H x := by + unfold field spatialD + rw [fderiv_const_mul (hH.differentiable (by simp) x) a] + funext j + fin_cases j <;> simp [basis] + +theorem field_sum {ι : Type*} (s : Finset ι) (H : ι → Plane → ℝ) + (hH : ∀ i ∈ s, ContDiff ℝ ∞ (H i)) (x : Plane) : + field (fun y => ∑ i ∈ s, H i y) x = ∑ i ∈ s, field (H i) x := by + unfold field spatialD + rw [fderiv_fun_sum (fun i hi => (hH i hi).differentiable (by simp) x)] + simp only [sum_apply, Finset.sum_smul, Finset.sum_sub_distrib] + +inductive Primitive + | translation (v : Fin 2 → ℚ) + | horizontal (center : Fin 2 → ℚ) (coefficient : ℚ) + | vertical (center : Fin 2 → ℚ) (coefficient : ℚ) + +def Primitive.encoding : Primitive ≃ + ((Fin 2 → ℚ) ⊕ ((Fin 2 → ℚ) × ℚ) ⊕ ((Fin 2 → ℚ) × ℚ)) where + toFun + | .translation v => .inl v + | .horizontal c a => .inr (.inl (c, a)) + | .vertical c a => .inr (.inr (c, a)) + invFun + | .inl v => .translation v + | .inr (.inl (c, a)) => .horizontal c a + | .inr (.inr (c, a)) => .vertical c a + left_inv p := by cases p <;> rfl + right_inv p := by rcases p with v | (c | c) <;> rfl + +instance : Primcodable Primitive := Primcodable.ofEquiv _ Primitive.encoding + +def Primitive.potential : Primitive → Plane → ℝ + | .translation v => translationPotential (fun j => (v j : ℝ)) + | .horizontal c a => horizontalPotential (fun j => (c j : ℝ)) a + | .vertical c a => verticalPotential (fun j => (c j : ℝ)) a + +theorem Primitive.potential_smooth (p : Primitive) : ContDiff ℝ ∞ p.potential := by + cases p with + | translation v => + change ContDiff ℝ ∞ (translationPotential (fun j => (v j : ℝ))) + exact translationPotential_smooth _ + | horizontal c a => + change ContDiff ℝ ∞ (horizontalPotential (fun j => (c j : ℝ)) a) + exact horizontalPotential_smooth _ _ + | vertical c a => + change ContDiff ℝ ∞ (verticalPotential (fun j => (c j : ℝ)) a) + exact verticalPotential_smooth _ _ + +structure Pulse where + primitive : Primitive + rectangle : RationalBox 2 + collar : ℚ + start : ℚ + finish : ℚ + +def Pulse.encoding : Pulse ≃ (Primitive × RationalBox 2 × ℚ × ℚ × ℚ) where + toFun p := (p.primitive, p.rectangle, p.collar, p.start, p.finish) + invFun p := ⟨p.1, p.2.1, p.2.2.1, p.2.2.2.1, p.2.2.2.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +instance : Primcodable Pulse := Primcodable.ofEquiv _ Pulse.encoding + +def Pulse.Valid (p : Pulse) : Prop := 0 < p.collar ∧ p.start < p.finish + +def Pulse.hamiltonian (p : Pulse) (x : Plane) : ℝ := + rectangleCutoff p.rectangle p.collar x * p.primitive.potential x + +def Pulse.spatial (p : Pulse) : Plane → Plane := field p.hamiltonian + +def Pulse.velocity (p : Pulse) (t : ℝ) (x : Plane) : Plane := + smoothPulse p.start p.finish t • p.spatial x + +theorem Pulse.hamiltonian_smooth (p : Pulse) : ContDiff ℝ ∞ p.hamiltonian := + (rectangleCutoff_smooth p.rectangle p.collar).mul p.primitive.potential_smooth + +theorem Pulse.hamiltonian_compactSupport {p : Pulse} (hp : p.Valid) : + HasCompactSupport p.hamiltonian := + (rectangleCutoff_compactSupport hp.1).mul_right + +theorem Pulse.spatial_smooth (p : Pulse) : ContDiff ℝ ∞ p.spatial := + field_smooth p.hamiltonian_smooth + +theorem Pulse.spatial_compactSupport {p : Pulse} (hp : p.Valid) : + HasCompactSupport p.spatial := field_compactSupport (p.hamiltonian_compactSupport hp) + +theorem Pulse.spatial_tsupport {p : Pulse} (hp : p.Valid) : + tsupport p.spatial ⊆ (rectangleCollar p.rectangle p.collar).carrier := by + apply (field_tsupport p.hamiltonian).trans + apply tsupport_mul_subset_left.trans + exact closure_minimal (rectangleCutoff_support hp.1) + (rectangleCollar_compact p.rectangle p.collar).isClosed + +theorem Pulse.velocity_zero_of_notMem {p : Pulse} (hp : p.Valid) {x : Plane} + (hx : x ∉ (rectangleCollar p.rectangle p.collar).carrier) (t : ℝ) : + p.velocity t x = 0 := by + have hs : x ∉ tsupport p.spatial := fun h => hx (p.spatial_tsupport hp h) + simp only [Pulse.velocity, image_eq_zero_of_notMem_tsupport hs, smul_zero] + +theorem Pulse.velocity_zero_on_disjoint {p : Pulse} (hp : p.Valid) {S : Set Plane} + (hS : Disjoint (rectangleCollar p.rectangle p.collar).carrier S) + {x : Plane} (hx : x ∈ S) (t : ℝ) : p.velocity t x = 0 := by + apply p.velocity_zero_of_notMem hp (t := t) + intro hc + exact Set.disjoint_left.mp hS hc hx + +theorem collar_disjoint_of_gap {R S : RationalBox 2} {gap δ : ℚ} + (hgap : PlanarRouting.EndpointGap gap R S) (hδ : 2 * δ < gap) : + Disjoint (rectangleCollar R δ).carrier S.carrier := by + apply Set.disjoint_left.mpr + intro x hx hy + obtain ⟨j, hj⟩ := hgap + have hr := hx j + have hs := hy j + have hd : (2 : ℝ) * δ < gap := by exact_mod_cast hδ + dsimp [rectangleCollar] at hr + push_cast at hr + rcases hj with hj | hj + · have hg : (R.upper j : ℝ) + gap ≤ S.lower j := by exact_mod_cast hj + linarith [hr.2, hs.1] + · have hg : (S.upper j : ℝ) + gap ≤ R.lower j := by exact_mod_cast hj + linarith [hs.2, hr.1] + +theorem Pulse.velocity_zero_of_gap {p : Pulse} (hp : p.Valid) {S : RationalBox 2} + {gap : ℚ} (hgap : PlanarRouting.EndpointGap gap p.rectangle S) + (hδ : 2 * p.collar < gap) {x : Plane} (hx : x ∈ S.carrier) (t : ℝ) : + p.velocity t x = 0 := + p.velocity_zero_on_disjoint hp (collar_disjoint_of_gap hgap hδ) hx t + +theorem Pulse.velocity_smooth (p : Pulse) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => p.velocity y.1 y.2) := + ((smoothPulse_smooth p.start p.finish).comp contDiff_fst).smul + (p.spatial_smooth.comp contDiff_snd) + +theorem Pulse.velocity_hamiltonian (p : Pulse) (t : ℝ) (x : Plane) : + p.velocity t x = field (fun y => smoothPulse p.start p.finish t * p.hamiltonian y) x := + (field_const_mul p.hamiltonian_smooth _ _).symm + +theorem Pulse.velocity_divergence (p : Pulse) (t : ℝ) (x : Plane) : + divergence (p.velocity t) x = 0 := by + have he : p.velocity t = field (fun y => smoothPulse p.start p.finish t * p.hamiltonian y) := by + funext y + exact p.velocity_hamiltonian t y + rw [he] + exact field_divergence (contDiff_const.mul p.hamiltonian_smooth) x + +theorem Pulse.velocity_integral {p : Pulse} (hp : p.Valid) (t : ℝ) : + (∫ x, p.velocity t x) = 0 := by + simp_rw [p.velocity_hamiltonian] + exact field_integral_eq_zero (contDiff_const.mul p.hamiltonian_smooth) + ((p.hamiltonian_compactSupport hp).mul_left) + +def processorHamiltonian {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) : ℝ := + ∑ i : Fin n, smoothPulse (p i).start (p i).finish t * (p i).hamiltonian x + +def processorVelocity {n : ℕ} (p : Fin n → Pulse) (t : ℝ) : Plane → Plane := + field (processorHamiltonian p t) + +theorem processorHamiltonian_smooth {n : ℕ} (p : Fin n → Pulse) (t : ℝ) : + ContDiff ℝ ∞ (processorHamiltonian p t) := by + apply ContDiff.sum + intro i _ + exact contDiff_const.mul (p i).hamiltonian_smooth + +theorem processorHamiltonian_compactSupport {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (t : ℝ) : HasCompactSupport (processorHamiltonian p t) := by + have hK : IsCompact (⋃ i : Fin n, tsupport (p i).hamiltonian) := + isCompact_iUnion (fun i => ((p i).hamiltonian_compactSupport (hp i)).isCompact) + apply HasCompactSupport.intro hK + intro x hx + apply Finset.sum_eq_zero + intro i _ + have hi : x ∉ tsupport (p i).hamiltonian := fun h => hx (Set.mem_iUnion.mpr ⟨i, h⟩) + rw [image_eq_zero_of_notMem_tsupport hi, mul_zero] + +theorem processorVelocity_eq_sum {n : ℕ} (p : Fin n → Pulse) (t : ℝ) (x : Plane) : + processorVelocity p t x = ∑ i : Fin n, (p i).velocity t x := by + change field (fun y => ∑ i : Fin n, + smoothPulse (p i).start (p i).finish t * (p i).hamiltonian y) x = _ + rw [field_sum _ _ (fun i _ => contDiff_const.mul (p i).hamiltonian_smooth)] + apply Finset.sum_congr rfl + intro i _ + exact ((p i).velocity_hamiltonian t x).symm + +theorem processorVelocity_smooth {n : ℕ} (p : Fin n → Pulse) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => processorVelocity p y.1 y.2) := by + have he : (fun y : ℝ × Plane => processorVelocity p y.1 y.2) = + fun y => ∑ i : Fin n, (p i).velocity y.1 y.2 := by + funext y + exact processorVelocity_eq_sum p y.1 y.2 + rw [he] + exact ContDiff.sum (fun i _ => (p i).velocity_smooth) + +theorem processorVelocity_properties {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (t : ℝ) : + HasCompactSupport (processorVelocity p t) ∧ + (∀ x, divergence (processorVelocity p t) x = 0) ∧ + (∫ x, processorVelocity p t x) = 0 := by + have hs := processorHamiltonian_smooth p t + have hc := processorHamiltonian_compactSupport hp t + exact ⟨field_compactSupport hc, field_divergence hs, field_integral_eq_zero hs hc⟩ + +/-- The translation pulse used for both extraction and insertion. -/ +def translationPulse (R : RationalBox 2) (p : Fin 2 → ℚ) (δ a b : ℚ) : Pulse where + primitive := .translation (fun j => p j - PlanarRouting.centerQ R j) + rectangle := PlanarRouting.translationTube R p + collar := δ + start := a + finish := b + +theorem translationPulse_realizes {R : RationalBox 2} {p : Fin 2 → ℚ} {δ a b : ℚ} + (hδ : 0 < δ) {x : Plane} (hx : x ∈ R.carrier) (t : ℝ) : + HasDerivAt + (translationPath (smoothRamp a b) ((fun j => (p j : ℝ)) - R.center) x) + ((translationPulse R p δ a b).velocity t + (translationPath (smoothRamp a b) ((fun j => (p j : ℝ)) - R.center) x t)) t := by + have hcurve := PlanarRouting.translationPath_mem_tube hx p (smoothRamp_range a b t) + have hcut := rectangleCutoff_one_near hδ hcurve + have hθ : HasDerivAt (smoothRamp a b) (smoothPulse a b t) t := + ((smoothRamp_smooth a b).differentiable (by simp) t).hasDerivAt + have hp : (fun j => ((p j - PlanarRouting.centerQ R j : ℚ) : ℝ)) = + (fun j => (p j : ℝ)) - R.center := by + funext j + simp + change HasDerivAt _ (smoothPulse a b t • + field (fun y => rectangleCutoff (PlanarRouting.translationTube R p) δ y * + translationPotential (fun j => ((p j - PlanarRouting.centerQ R j : ℚ) : ℝ)) y) _) t + rw [hp] + exact translationPath_cutoff_ode hθ _ x _ hcut + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulseExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulseExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8343d3ba6ba091c31137b0e1ada1ca258aad368 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarPulseExpressions.lean @@ -0,0 +1,296 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulse +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionExpressions +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ExpressionCompiler + +namespace OAI + +/-! Scalar expressions for the planar processor after its phase is installed +as the third spatial coordinate. The expression contains only finite rational +data and the existing certified smooth profile syntax. -/ + +noncomputable section + +namespace ShearFlows.PeriodicExpr + +def quadratic (L a b c d p : ℚ) : PeriodicExpr := + ⟨L, a, d, .mul (.add .coord (.const (-p))) (ProfileExpr.potential a b c d p)⟩ + +theorem quadratic_valid {L a b c d p : ℚ} (hL : 0 < L) (hab : a < b) (hcd : c < d) : + (quadratic L a b c d p).Valid := by + refine ⟨hL, ?_⟩ + have hp := (potential_valid (p := p) hL hab hcd).2 + dsimp [quadratic] + intro x hx + apply hp + change (x + ((-p : ℚ) : ℝ)) * (ProfileExpr.potential a b c d p).val x ≠ 0 at hx + exact right_ne_zero_of_mul hx + +theorem quadratic_body (L a b c d p : ℚ) (x : ℝ) : + (quadratic L a b c d p).body.val x = + (x - p) ^ 2 * closedCutoff a b c d x := by + simp only [quadratic, ProfileExpr.val, ProfileExpr.val_potential, Rat.cast_neg] + ring + +def intervalPulse (a b : ℚ) : PeriodicExpr := + ⟨1, a, b, (ProfileExpr.ramp a b).diff⟩ + +theorem intervalPulse_valid {a b : ℚ} (hab : a < b) : (intervalPulse a b).Valid := by + refine ⟨by norm_num [intervalPulse], ?_⟩ + dsimp [intervalPulse] + rw [ProfileExpr.val_diff, ProfileExpr.val_ramp] + exact (smoothPulse_support (by exact_mod_cast hab)).trans Set.Ioo_subset_Icc_self + +theorem val_on_unit {p : PeriodicExpr} (hp : p.Valid) (hperiod : p.period = 1) + (hl : 0 < p.lower) (hu : p.upper < 1) {x : ℝ} (hx : x ∈ Set.Icc (0 : ℝ) 1) : + p.val x = p.body.val x := by + apply periodize_eq_in_chart (A := 0) (B := 1) (by exact_mod_cast hp.1) + · rw [hperiod] + norm_num + · intro y hy + have h := hp.2 hy + have h₀ : (0 : ℝ) < p.lower := by exact_mod_cast hl + have h₁ : (p.upper : ℝ) < 1 := by exact_mod_cast hu + exact ⟨h₀.trans_le h.1, h.2.trans_lt h₁⟩ + · exact hx + +end ShearFlows.PeriodicExpr + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows Set Filter +open scoped Topology + +def Pulse.axisCutoff (p : Pulse) (j : Fin 2) : PeriodicExpr := + .cutoff 1 (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) + +def Pulse.axisLinear (p : Pulse) (j : Fin 2) (c : ℚ) : PeriodicExpr := + .potential 1 (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) c + +def Pulse.axisQuadratic (p : Pulse) (j : Fin 2) (c : ℚ) : PeriodicExpr := + .quadratic 1 (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) c + +theorem Pulse.axisCutoff_valid {p : Pulse} (hp : p.Valid) (j : Fin 2) : + (p.axisCutoff j).Valid := + PeriodicExpr.cutoff_valid (by norm_num) (by linarith [hp.1]) (by linarith [hp.1]) + +theorem Pulse.axisLinear_valid {p : Pulse} (hp : p.Valid) (j : Fin 2) (c : ℚ) : + (p.axisLinear j c).Valid := + PeriodicExpr.potential_valid (by norm_num) (by linarith [hp.1]) (by linarith [hp.1]) + +theorem Pulse.axisQuadratic_valid {p : Pulse} (hp : p.Valid) (j : Fin 2) (c : ℚ) : + (p.axisQuadratic j c).Valid := + PeriodicExpr.quadratic_valid (by norm_num) (by linarith [hp.1]) (by linarith [hp.1]) + +def Pulse.spatialExpression (p : Pulse) : FieldExpr := + letI := ShearFlows.neZeroTwo + letI := ShearFlows.neZeroFour + Primitive.casesOn p.primitive + (fun v => + .add (.mul (.const (v 0)) (.mul (.atom 1 (p.axisCutoff 0)) (.atom 2 (p.axisLinear 1 0)))) + (.mul (.const (-v 1)) (.mul (.atom 1 (p.axisLinear 0 0)) (.atom 2 (p.axisCutoff 1))))) + (fun c a => + .mul (.const (a / 2)) (.mul (.atom 1 (p.axisCutoff 0)) (.atom 2 (p.axisQuadratic 1 (c 1))))) + (fun c a => + .mul (.const (-a / 2)) (.mul (.atom 1 (p.axisQuadratic 0 (c 0))) (.atom 2 (p.axisCutoff 1)))) + +def Pulse.expression (p : Pulse) : FieldExpr := + letI := ShearFlows.neZeroFour + .mul (.atom 3 (PeriodicExpr.intervalPulse p.start p.finish)) p.spatialExpression + +theorem Pulse.spatialExpression_valid {p : Pulse} (hp : p.Valid) : p.spatialExpression.Valid := by + unfold Pulse.spatialExpression + cases p.primitive with + | translation v => + exact ⟨⟨trivial, p.axisCutoff_valid hp 0, p.axisLinear_valid hp 1 0⟩, + trivial, p.axisLinear_valid hp 0 0, p.axisCutoff_valid hp 1⟩ + | horizontal c a => exact ⟨trivial, p.axisCutoff_valid hp 0, p.axisQuadratic_valid hp 1 (c 1)⟩ + | vertical c a => exact ⟨trivial, p.axisQuadratic_valid hp 0 (c 0), p.axisCutoff_valid hp 1⟩ + +theorem Pulse.expression_valid {p : Pulse} (hp : p.Valid) : p.expression.Valid := + ⟨PeriodicExpr.intervalPulse_valid hp.2, p.spatialExpression_valid hp⟩ + +theorem Pulse.spatialExpression_noTime (p : Pulse) : SpatialExpression.NoTime p.spatialExpression := by + unfold Pulse.spatialExpression + cases p.primitive <;> simp [SpatialExpression.NoTime] + +theorem Pulse.expression_noTime (p : Pulse) : SpatialExpression.NoTime p.expression := + ⟨by change (3 : Fin 4) ≠ 0; decide, p.spatialExpression_noTime⟩ + +theorem Pulse.spatialExpression_unitPeriods (p : Pulse) : + SpatialExpression.UnitPeriods p.spatialExpression := by + unfold Pulse.spatialExpression + cases p.primitive <;> + simp [SpatialExpression.UnitPeriods, Pulse.axisCutoff, Pulse.axisLinear, Pulse.axisQuadratic, + PeriodicExpr.cutoff, PeriodicExpr.potential, PeriodicExpr.quadratic] + +theorem Pulse.expression_unitPeriods (p : Pulse) : SpatialExpression.UnitPeriods p.expression := + ⟨rfl, p.spatialExpression_unitPeriods⟩ + +def Pulse.InUnit (p : Pulse) : Prop := + 0 < p.start ∧ p.finish < 1 ∧ ∀ j, + 0 < p.rectangle.lower j - 2 * p.collar ∧ p.rectangle.upper j + 2 * p.collar < 1 + +def Pulse.axisMask (p : Pulse) (j : Fin 2) (x : ℝ) : ℝ := + closedCutoff (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) x + +theorem Pulse.axisCutoff_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) (j : Fin 2) + {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : (p.axisCutoff j).val x = p.axisMask j x := by + rw [PeriodicExpr.val_on_unit (p.axisCutoff_valid hp j) rfl (hu.2.2 j).1 (hu.2.2 j).2 hx] + change (ProfileExpr.cutoff _ _ _ _).val x = _ + simpa only [Pulse.axisMask, Rat.cast_sub, Rat.cast_add, Rat.cast_mul, Rat.cast_ofNat] using + congrFun (ProfileExpr.val_cutoff + (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar)) x + +theorem Pulse.axisLinear_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) (j : Fin 2) (c : ℚ) + {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : + (p.axisLinear j c).val x = (x - c) * p.axisMask j x := by + rw [PeriodicExpr.val_on_unit (p.axisLinear_valid hp j c) rfl (hu.2.2 j).1 (hu.2.2 j).2 hx] + change (ProfileExpr.potential _ _ _ _ _).val x = _ + simpa only [Pulse.axisMask, Rat.cast_sub, Rat.cast_add, Rat.cast_mul, Rat.cast_ofNat] using + congrFun (ProfileExpr.val_potential + (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) c) x + +theorem Pulse.axisQuadratic_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) (j : Fin 2) (c : ℚ) + {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : + (p.axisQuadratic j c).val x = (x - c) ^ 2 * p.axisMask j x := by + rw [PeriodicExpr.val_on_unit (p.axisQuadratic_valid hp j c) rfl (hu.2.2 j).1 (hu.2.2 j).2 hx] + simpa only [Pulse.axisQuadratic, Pulse.axisMask, Rat.cast_sub, Rat.cast_add, Rat.cast_mul, Rat.cast_ofNat] using + PeriodicExpr.quadratic_body 1 + (p.rectangle.lower j - 2 * p.collar) (p.rectangle.lower j - p.collar) + (p.rectangle.upper j + p.collar) (p.rectangle.upper j + 2 * p.collar) c x + +theorem Pulse.spatialExpression_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) + (y : SpaceTime) (hx : y.2 0 ∈ Icc (0 : ℝ) 1) (hy : y.2 1 ∈ Icc (0 : ℝ) 1) : + p.spatialExpression.val y = p.hamiltonian (horizontal y.2) := by + have hc₀ := p.axisCutoff_on_unit hp hu 0 hx + have hc₁ := p.axisCutoff_on_unit hp hu 1 hy + have hl₀ (c : ℚ) := p.axisLinear_on_unit hp hu 0 c hx + have hl₁ (c : ℚ) := p.axisLinear_on_unit hp hu 1 c hy + have hq₀ (c : ℚ) := p.axisQuadratic_on_unit hp hu 0 c hx + have hq₁ (c : ℚ) := p.axisQuadratic_on_unit hp hu 1 c hy + have hm : rectangleCutoff p.rectangle p.collar (horizontal y.2) = + p.axisMask 0 (y.2 0) * p.axisMask 1 (y.2 1) := rfl + cases h : p.primitive with + | translation v => + simp only [Pulse.spatialExpression, h, FieldExpr.val] + change (v 0 : ℝ) * ((p.axisCutoff 0).val (y.2 0) * (p.axisLinear 1 0).val (y.2 1)) + + ((-v 1 : ℚ) : ℝ) * ((p.axisLinear 0 0).val (y.2 0) * (p.axisCutoff 1).val (y.2 1)) = _ + rw [hc₀, hc₁, hl₀, hl₁] + unfold Pulse.hamiltonian + rw [hm, h] + simp only [Primitive.potential, translationPotential, + horizontal, Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_zero, sub_zero, + Rat.cast_neg] + ring + | horizontal c a => + simp only [Pulse.spatialExpression, h, FieldExpr.val] + change ((a / 2 : ℚ) : ℝ) * + ((p.axisCutoff 0).val (y.2 0) * (p.axisQuadratic 1 (c 1)).val (y.2 1)) = _ + rw [hc₀, hq₁] + unfold Pulse.hamiltonian + rw [hm, h] + simp only [Primitive.potential, horizontalPotential, + horizontal, Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_div, Rat.cast_ofNat] + ring + | vertical c a => + simp only [Pulse.spatialExpression, h, FieldExpr.val] + change ((-a / 2 : ℚ) : ℝ) * + ((p.axisQuadratic 0 (c 0)).val (y.2 0) * (p.axisCutoff 1).val (y.2 1)) = _ + rw [hq₀, hc₁] + unfold Pulse.hamiltonian + rw [hm, h] + simp only [Primitive.potential, verticalPotential, + horizontal, Matrix.cons_val_zero, Rat.cast_div, Rat.cast_neg, Rat.cast_ofNat] + ring + +theorem Pulse.expression_on_unit {p : Pulse} (hp : p.Valid) (hu : p.InUnit) + (y : SpaceTime) (hx : y.2 0 ∈ Icc (0 : ℝ) 1) (hy : y.2 1 ∈ Icc (0 : ℝ) 1) + (hz : y.2 2 ∈ Icc (0 : ℝ) 1) : + p.expression.val y = smoothPulse p.start p.finish (y.2 2) * p.hamiltonian (horizontal y.2) := by + have ht := PeriodicExpr.val_on_unit (PeriodicExpr.intervalPulse_valid hp.2) rfl hu.1 hu.2.1 hz + change (PeriodicExpr.intervalPulse p.start p.finish).val (y.2 2) * p.spatialExpression.val y = _ + rw [ht, p.spatialExpression_on_unit hp hu y hx hy] + rw [PeriodicExpr.intervalPulse, ProfileExpr.val_diff, ProfileExpr.val_ramp] + rfl + +def processorExpression {n : ℕ} (p : Fin n → Pulse) : FieldExpr := + FieldExpr.sum (List.ofFn (fun i => (p i).expression)) + +theorem processorExpression_valid {n : ℕ} {p : Fin n → Pulse} (hp : ∀ i, (p i).Valid) : + (processorExpression p).Valid := by + apply FieldExpr.valid_sum + intro e he + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp he + exact (p i).expression_valid (hp i) + +theorem sum_noTime {l : List FieldExpr} (hl : ∀ e ∈ l, SpatialExpression.NoTime e) : + SpatialExpression.NoTime (FieldExpr.sum l) := by + induction l with + | nil => trivial + | cons e l ih => exact ⟨hl e (by simp), ih (fun f hf => hl f (by simp [hf]))⟩ + +theorem sum_unitPeriods {l : List FieldExpr} (hl : ∀ e ∈ l, SpatialExpression.UnitPeriods e) : + SpatialExpression.UnitPeriods (FieldExpr.sum l) := by + induction l with + | nil => trivial + | cons e l ih => exact ⟨hl e (by simp), ih (fun f hf => hl f (by simp [hf]))⟩ + +theorem processorExpression_noTime {n : ℕ} (p : Fin n → Pulse) : + SpatialExpression.NoTime (processorExpression p) := by + apply sum_noTime + intro e he + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp he + exact (p i).expression_noTime + +theorem processorExpression_unitPeriods {n : ℕ} (p : Fin n → Pulse) : + SpatialExpression.UnitPeriods (processorExpression p) := by + apply sum_unitPeriods + intro e he + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp he + exact (p i).expression_unitPeriods + +theorem processorExpression_on_unit {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) (y : SpaceTime) + (hx : y.2 0 ∈ Icc (0 : ℝ) 1) (hy : y.2 1 ∈ Icc (0 : ℝ) 1) + (hz : y.2 2 ∈ Icc (0 : ℝ) 1) : + (processorExpression p).val y = processorHamiltonian p (y.2 2) (horizontal y.2) := by + rw [processorExpression, FieldExpr.val_sum] + simp only [List.map_ofFn, List.sum_ofFn] + apply Finset.sum_congr rfl + intro i _ + exact (p i).expression_on_unit (hp i) (hu i) y hx hy hz + +theorem processorExpression_planar_germ {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) {x : Plane} + (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + (fun z : Plane => (processorExpression p).val (0, atHeight z t)) =ᶠ[𝓝 x] + processorHamiltonian p t := by + have h₀ : {z : Plane | z 0 ∈ Ioo (0 : ℝ) 1} ∈ 𝓝 x := + (isOpen_Ioo.preimage (continuous_apply 0)).mem_nhds hx₀ + have h₁ : {z : Plane | z 1 ∈ Ioo (0 : ℝ) 1} ∈ 𝓝 x := + (isOpen_Ioo.preimage (continuous_apply 1)).mem_nhds hx₁ + filter_upwards [h₀, h₁] with z hz₀ hz₁ + have he := processorExpression_on_unit hp hu (0, atHeight z t) + ⟨hz₀.1.le, hz₀.2.le⟩ ⟨hz₁.1.le, hz₁.2.le⟩ ht + simpa only [atHeight_horizontal, show atHeight z t 2 = t from rfl] using he + +theorem processorExpression_planar_field {n : ℕ} {p : Fin n → Pulse} + (hp : ∀ i, (p i).Valid) (hu : ∀ i, (p i).InUnit) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) {x : Plane} + (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + field (fun z : Plane => (processorExpression p).val (0, atHeight z t)) x = + processorVelocity p t x := + field_congr_of_eventuallyEq (processorExpression_planar_germ hp hu ht hx₀ hx₁) + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarRecorder.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarRecorder.lean new file mode 100644 index 0000000000000000000000000000000000000000..f790c0fd9a074e33a67e816fe57e8e01d5340433 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarRecorder.lean @@ -0,0 +1,250 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarConjugacy +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderLoader + +namespace OAI + +/-! A finite rational planar recorder program with the stationary-suspension +paper's horizontal initial corridor and low vertical halting observer. -/ + +noncomputable section + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows Radix + +/-- Horizontal compression accounts for the number of parking columns. -/ +def compression (M : Alternating.Machine) (hM : M.WellFormed) : ℚ := + 1 / (64 * ((geometricBranches M hM).length + 1)) + +theorem compression_pos (M : Alternating.Machine) (hM : M.WellFormed) : + 0 < compression M hM := by unfold compression; positivity + +theorem compression_le (M : Alternating.Machine) (hM : M.WellFormed) : + compression M hM ≤ 1 / 64 := by + unfold compression + apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) + have h : (0 : ℚ) ≤ (geometricBranches M hM).length := by positivity + nlinarith + +def shift (M : Alternating.Machine) (hM : M.WellFormed) : ℚ := + 1 / 4 - 3 * compression M hM / 8 + +def coordinateMap (M : Alternating.Machine) (hM : M.WellFormed) : Plane → Plane := + PlanarConjugacy.map (shift M hM) (43 / 128) (compression M hM) (11 / 32) + +def instruction (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Instruction := + PlanarConjugacy.instruction (shift M hM) (43 / 128) (compression M hM) (11 / 32) + (geometricInstruction M hM b) + +def program (M : Alternating.Machine) (hM : M.WellFormed) : List Instruction := + (geometricBranches M hM).map (instruction M hM) + +def point (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : Plane := + coordinateMap M hM (codedPoint M C) + +def observer : Set Plane := + letI := ShearFlows.neZeroTwo + letI := ShearFlows.thirtyTwoAtLeastTwo + letI := ShearFlows.eightAtLeastTwo + {x | 1 / 32 < x 1 ∧ x 1 < 1 / 8} + +/-- The input-dependent loading endpoint is a finite rational expression. -/ +def initialPoint (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Fin 2 → ℚ := + letI := ShearFlows.neZeroTwo + ![shift I.1 (Alternating.ValidInput.machine_wellFormed hI) + compression I.1 (Alternating.ValidInput.machine_wellFormed hI) * initialPointQ I hI 1, + 43 / 128 - (11 / 32) * initialPointQ I hI 0] + +theorem initialPoint_spec (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (fun j => (initialPoint I hI j : ℝ)) = point I.1 hI.1 (finiteInitializedRecorder I hI) := by + rw [point, coordinateMap, ← initialPointQ_spec I hI] + funext j + fin_cases j <;> simp [initialPoint, PlanarConjugacy.map] + +theorem instruction_mem (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : instruction M hM b ∈ program M hM := by + apply List.mem_map.mpr + exact ⟨b, by simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches M hM b, rfl⟩ + +theorem instruction_source_positive (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (instruction M hM b).source.positive := + PlanarConjugacy.box_positive (compression_pos M hM) (by norm_num) + (geometricInstruction_source_positive M hM b) + +theorem instruction_target_positive (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (instruction M hM b).target.positive := + PlanarConjugacy.box_positive (compression_pos M hM) (by norm_num) + (geometricInstruction_target_positive M hM b) + +theorem instruction_factor_pos (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : 0 < (instruction M hM b).factor := + PlanarConjugacy.instruction_factor_pos (geometricInstruction_factor_pos M hM b) + +theorem instruction_image (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (instruction M hM b).affine '' (instruction M hM b).source.carrier = + (instruction M hM b).target.carrier := + PlanarConjugacy.instruction_image_eq (compression_pos M hM) (by norm_num) + (geometricInstruction_factor_pos M hM b).ne' (geometricInstruction_image M hM b) + +theorem instruction_source_separation (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + PositivelySeparated (instruction M hM b).source.carrier (instruction M hM c).source.carrier := by + change PositivelySeparated (PlanarConjugacy.box _ _ _ _ _).carrier + (PlanarConjugacy.box _ _ _ _ _).carrier + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num), + ← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] + exact PlanarConjugacy.separated_image (compression_pos M hM) (by norm_num) + (geometricInstruction_source_separation M hM hne) + +theorem instruction_target_separation (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + PositivelySeparated (instruction M hM b).target.carrier (instruction M hM c).target.carrier := by + change PositivelySeparated (PlanarConjugacy.box _ _ _ _ _).carrier + (PlanarConjugacy.box _ _ _ _ _).carrier + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num), + ← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] + exact PlanarConjugacy.separated_image (compression_pos M hM) (by norm_num) + (geometricInstruction_target_separation M hM hne) + +theorem instruction_halfWidths (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (instruction M hM b).source.halfWidth 0 ≤ (compression M hM : ℝ) * (bandScale M : ℝ) / 2 ∧ + (instruction M hM b).target.halfWidth 0 ≤ (compression M hM : ℝ) * (bandScale M : ℝ) / 2 ∧ + (instruction M hM b).source.halfWidth 1 ≤ (3 / 8 : ℝ) * (bandScale M : ℝ) / 2 ∧ + (instruction M hM b).target.halfWidth 1 ≤ (3 / 8 : ℝ) * (bandScale M : ℝ) / 2 := by + have hε : (0 : ℝ) ≤ compression M hM := by exact_mod_cast (compression_pos M hM).le + have hs := PlanarConjugacy.box_halfWidth (shift M hM) (43 / 128) (compression M hM) (11 / 32) + (geometricInstruction M hM b).source + have ht := PlanarConjugacy.box_halfWidth (shift M hM) (43 / 128) (compression M hM) (11 / 32) + (geometricInstruction M hM b).target + simp only [instruction, PlanarConjugacy.instruction, hs, ht, Matrix.cons_val_zero, + Matrix.cons_val_one, Rat.cast_div, Rat.cast_ofNat] + have hκ : (0 : ℝ) ≤ bandScale M := by exact_mod_cast (bandScale_pos M).le + have hx := geometricInstruction_halfWidths M hM b 1 + have hy := geometricInstruction_halfWidths M hM b 0 + refine ⟨?_, ?_, ?_, ?_⟩ + · nlinarith [mul_le_mul_of_nonneg_left hx.1 hε] + · nlinarith [mul_le_mul_of_nonneg_left hx.2 hε] + · nlinarith [hy.1] + · nlinarith [hy.2] + +theorem coordinateMap_bounds (M : Alternating.Machine) (hM : M.WellFormed) {x : Plane} + (hx : (1 / 8 : ℝ) ≤ x 0 ∧ x 0 ≤ 13 / 16 ∧ 1 / 4 ≤ x 1 ∧ x 1 ≤ 1 / 2) : + |coordinateMap M hM x 0 - 1 / 4| ≤ (compression M hM : ℝ) / 8 ∧ + (5 / 128 : ℝ) ≤ coordinateMap M hM x 1 ∧ coordinateMap M hM x 1 ≤ 19 / 64 := by + have hε : (0 : ℝ) < compression M hM := by exact_mod_cast compression_pos M hM + simp only [coordinateMap, PlanarConjugacy.map, shift, Matrix.cons_val_zero, + Matrix.cons_val_one, Rat.cast_sub, Rat.cast_mul, Rat.cast_div, Rat.cast_ofNat] + refine ⟨abs_le.mpr ⟨?_, ?_⟩, ?_, ?_⟩ <;> nlinarith [hx.1, hx.2.1, hx.2.2.1, hx.2.2.2] + +theorem instruction_source_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} (hx : x ∈ (instruction M hM b).source.carrier) : + |x 0 - 1 / 4| ≤ (compression M hM : ℝ) / 8 ∧ + (5 / 128 : ℝ) ≤ x 1 ∧ x 1 ≤ 19 / 64 := by + change x ∈ (PlanarConjugacy.box _ _ _ _ _).carrier at hx + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] at hx + obtain ⟨y, hy, rfl⟩ := hx + exact coordinateMap_bounds M hM (geometricInstruction_source_bounds M hM b hy) + +theorem instruction_target_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} (hx : x ∈ (instruction M hM b).target.carrier) : + |x 0 - 1 / 4| ≤ (compression M hM : ℝ) / 8 ∧ + (5 / 128 : ℝ) ≤ x 1 ∧ x 1 ≤ 19 / 64 := by + change x ∈ (PlanarConjugacy.box _ _ _ _ _).carrier at hx + rw [← PlanarConjugacy.box_image (compression_pos M hM) (by norm_num)] at hx + obtain ⟨y, hy, rfl⟩ := hx + exact coordinateMap_bounds M hM (geometricInstruction_target_bounds M hM b hy) + +theorem step_realized {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} (h : Step (finiteMachine M hM) C D) : + ∃ b ∈ program M hM, point M hM C ∈ b.source.carrier ∧ + b.affine (point M hM C) = point M hM D := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hx : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains (radixBase_gt_one M) hdigits (bandScale_pos M).le + (stateOffset M) b C rfl rfl rfl + have ha : (geometricInstruction M hM b).affine (codedPoint M C) = + codedPoint M ⟨q, C.head + d, Function.update C.tape C.head a⟩ := + branchInstruction_step (radixBase_gt_one M) hdigits (bandScale M) (stateOffset M) b C rfl rfl rfl + refine ⟨instruction M hM b, instruction_mem M hM b, ?_, ?_⟩ + · exact PlanarConjugacy.mem_box_of_mem (compression_pos M hM).le (by norm_num) hx + · change (PlanarConjugacy.instruction _ _ _ _ _).affine + (PlanarConjugacy.map _ _ _ _ (codedPoint M C)) = _ + rw [PlanarConjugacy.instruction_conjugacy _ _ _ _ _ + (geometricInstruction_factor_pos M hM b).ne', ha] + rfl + +theorem point_second (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : + point M hM C 1 = (if recorderHalting M C.control then (5 / 64 : ℝ) else 1 / 4) - + (11 / 32) * (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) := by + change ((43 / 128 : ℚ) : ℝ) - ((11 / 32 : ℚ) : ℝ) * codedPoint M C 0 = _ + norm_num only [Rat.cast_div, Rat.cast_ofNat] + rw [codedPoint_first] + cases hh : recorderHalting M C.control <;> + simp only [Bool.false_eq_true, ite_false, ite_true] + all_goals ring + +theorem point_observer_iff (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : + point M hM C ∈ observer ↔ recorderHalting M C.control = true := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hdigits : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have he := encode_mem_unit hB hdigits (tapeAt C).1 + have hκ : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hκ' : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hl : -(bandScale M : ℝ) / 2 ≤ (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) := by + nlinarith [he.1] + have hu : (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) ≤ + (bandScale M : ℝ) / 2 := by nlinarith [he.2] + change (1 / 32 < point M hM C 1 ∧ point M hM C 1 < 1 / 8) ↔ _ + rw [point_second] + cases hh : recorderHalting M C.control <;> simp only [Bool.false_eq_true, ite_false, ite_true] + · constructor + · intro h + nlinarith [h.2] + · exact False.elim + · constructor + · intro _ + trivial + · intro _ + constructor <;> nlinarith + +theorem run_observer_iff (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (∃ n, point I.1 hI.1 (run (finiteMachine I.1 hI.1) (finiteInitializedRecorder I hI) n) + ∈ observer) ↔ Alternating.Halts I := by + simp_rw [point_observer_iff] + have hh (q : Control (State I.1) (Alphabet I.1)) : + recorderHalting I.1 q = haltingControl (finiteMachine I.1 hI.1) q := by cases q <;> rfl + simp_rw [hh] + change (∃ n, haltingControl (finiteMachine I.1 hI.1) + (run (finiteMachine I.1 hI.1) + (checkpointAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) 2 0) n).control = true) ↔ _ + rw [run_halting_iff _ _ _ _ (by norm_num)] + have hs (n : ℕ) := congrArg WorkConfiguration.state (finite_workAt I hI n) + simp only [forgetWork, originalConfiguration] at hs + change (∃ n, I.1.isHalting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state.val = true) ↔ _ + simp only [hs, Alternating.Halts] + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarReverseVariations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarReverseVariations.lean new file mode 100644 index 0000000000000000000000000000000000000000..1facb0166876f2621f7e288c20a412fdadd95afd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarReverseVariations.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition + +namespace OAI + +/-! The same variational input controls reverse transitions. No separate +regularity hypothesis for an inverse map is needed. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows + +theorem second_fderiv_fun_neg (f : Plane → Plane) (x : Plane) : + fderiv ℝ (fderiv ℝ (fun y => -f y)) x = -(fderiv ℝ (fderiv ℝ f) x) := by + have he : fderiv ℝ (fun y => -f y) = fun y => -(fderiv ℝ f y) := by + funext y + exact fderiv_fun_neg + rw [he] + exact fderiv_fun_neg + +theorem PlanarVariations.reverse {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) : + PlanarVariations (fun s x => -V (-s) x) (fun a t => Ψ (-a) (-t)) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro a + simpa only [neg_zero] using hv.initial (-a) + · intro a t + exact hv.smooth (-a) (-t) + · intro a x v t + have hd := (hv.first (-a) x v (-t)).scomp t (hasDerivAt_id t).neg + simpa only [Function.comp_def, neg_one_smul, fderiv_fun_neg, fderiv_neg, + Pi.neg_apply, neg_apply, neg_add] using hd + · intro a x v w t + have hd := (hv.second (-a) x v w (-t)).scomp t (hasDerivAt_id t).neg + simpa only [Function.comp_def, neg_one_smul, second_fderiv_fun_neg, fderiv_fun_neg, fderiv_neg, + Pi.neg_apply, neg_apply, neg_add] using hd + +theorem planar_first_variation_reverse {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a (-t)) x‖ ≤ Real.exp (K * t) := by + have h := planar_first_variation_operator hv.reverse + (fun s y => by simpa only [fderiv_fun_neg, norm_neg] using hb (-s) y) (-a) x ht + simpa only [neg_neg] using h + +theorem planar_second_variation_reverse {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a (-t))) x‖ ≤ + Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + have hb₂' (s : ℝ) (y : Plane) : + ‖fderiv ℝ (fderiv ℝ (fun x => -V (-s) x)) y‖ ≤ K := by + have he := second_fderiv_fun_neg (V (-s)) y + have hn := norm_neg (fderiv ℝ (fderiv ℝ (V (-s))) y) + exact (congrArg norm he).le.trans (hn.le.trans (hb₂ (-s) y)) + have h := planar_second_variation_operator hv.reverse hK + (fun s y => by simpa only [fderiv_fun_neg, norm_neg] using hb₁ (-s) y) + hb₂' (-a) x ht + simpa only [neg_neg] using h + +theorem planar_inverse_estimates {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ψ : ℝ → ℝ → Plane → Plane} + (hv : PlanarVariations (planarSlice H) Ψ) (a : ℝ) (x : Plane) {t : ℝ} + (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ (a + t) (-t)) x‖ ≤ Real.exp ((planarFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ (a + t) (-t))) x‖ ≤ + Real.exp (2 * (planarFlowBound H : ℝ) * t) - + Real.exp ((planarFlowBound H : ℝ) * t) := by + have hK : (0 : ℝ) < planarVariationCoefficient H := by + exact_mod_cast planarVariationCoefficient_pos H + have hb₁ := fun s y => (planar_derivative_bounds hH hT s y).1 + have hb₂ := fun s y => (planar_derivative_bounds hH hT s y).2 + constructor + · apply (planar_first_variation_reverse hv hb₁ (a + t) x ht).trans + apply Real.exp_le_exp.mpr + simp only [planarFlowBound, Nat.cast_mul, Nat.cast_ofNat] + nlinarith + · have h := planar_second_variation_reverse hv hK hb₁ hb₂ (a + t) x ht + simp only [planarFlowBound, Nat.cast_mul, Nat.cast_ofNat] + rw [show 2 * (2 * (planarVariationCoefficient H : ℝ)) * t = + 4 * (planarVariationCoefficient H : ℝ) * t by ring] + exact h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSchedule.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..d50a5ef8d27293c2a24ea02b5972b3f5e73d5607 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSchedule.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSegments +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarActionOrder + +namespace OAI + +/-! The finite pulse slots occupy successive closed cells. The unused half +of each cell and the final cell are stationary. -/ + +noncomputable section + +namespace ForcedComputation.PlanarTiming + +open ShearFlows Set + +def cut (n i : ℕ) : ℝ := (i : ℝ) / (n + 1) + +@[simp] theorem cut_zero (n : ℕ) : cut n 0 = 0 := by simp [cut] + +@[simp] theorem cut_last (n : ℕ) : cut n (n + 1) = 1 := by + have h : (n : ℝ) + 1 ≠ 0 := by positivity + simp [cut, Nat.cast_add, Nat.cast_one, h] + +theorem cut_mono (n : ℕ) {i j : ℕ} (h : i ≤ j) : cut n i ≤ cut n j := + div_le_div_of_nonneg_right (by exact_mod_cast h) (by positivity) + +theorem finish_eq_cut {n : ℕ} (i : Fin n) : (finish i : ℝ) = cut n (i.val + 1) := by + simp only [finish, cut, Rat.cast_div, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_ofNat, Rat.cast_one, Nat.cast_add, Nat.cast_one] + field_simp + +theorem cut_le_start {n : ℕ} (i : Fin n) : cut n i.val ≤ (start i : ℝ) := by + have hn : (0 : ℝ) < (n : ℝ) + 1 := by positivity + simp only [cut, start, Rat.cast_div, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_ofNat, Rat.cast_one] + apply (div_le_div_iff₀ hn (by positivity)).mpr + nlinarith + +theorem pulse_other_on_cell {n : ℕ} {i j : Fin n} (hne : i ≠ j) {t : ℝ} + (ht : t ∈ Icc (cut n i.val) (cut n (i.val + 1))) : pulse j t = 0 := by + have ho : (start j : ℝ) < finish j := by exact_mod_cast (intervals j).2.1 + rcases lt_or_gt_of_ne hne with h | h + · apply smoothPulse_before ho + have hh : (finish i : ℝ) < start j := by exact_mod_cast ordered h + rw [finish_eq_cut] at hh + exact ht.2.trans hh.le + · apply smoothPulse_after ho + rw [finish_eq_cut] + exact (cut_mono n (show j.val + 1 ≤ i.val from h)).trans ht.1 + +theorem pulse_on_tail {n : ℕ} (i : Fin n) {t : ℝ} (ht : cut n n ≤ t) : pulse i t = 0 := by + apply smoothPulse_after (by exact_mod_cast (intervals i).2.1) + rw [finish_eq_cut] + exact (cut_mono n i.isLt).trans ht + +end ForcedComputation.PlanarTiming + +namespace ForcedComputation.Recorder.Planar + +open ShearFlows PlanarHamiltonian PlanarTiming Set + +theorem compiledVelocity_on_cell (M : Alternating.Machine) (hM : M.WellFormed) + (i : Fin (actions M hM).length) {t : ℝ} + (ht : t ∈ Icc (cut (actions M hM).length i.val) (cut (actions M hM).length (i.val + 1))) + (x : Plane) : + processorVelocity (compiledPulse M hM) t x = (compiledPulse M hM i).velocity t x := by + rw [processorVelocity_eq_sum] + apply Finset.sum_eq_single i + · intro j _ hji + change pulse j t • (compiledPulse M hM j).spatial x = 0 + rw [pulse_other_on_cell hji.symm ht, zero_smul] + · intro hi + exact False.elim (hi (Finset.mem_univ i)) + +theorem compiledVelocity_on_tail (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ} + (ht : cut (actions M hM).length (actions M hM).length ≤ t) (x : Plane) : + processorVelocity (compiledPulse M hM) t x = 0 := by + rw [processorVelocity_eq_sum] + apply Finset.sum_eq_zero + intro i _ + change pulse i t • (compiledPulse M hM i).spatial x = 0 + rw [pulse_on_tail i ht, zero_smul] + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSegments.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSegments.lean new file mode 100644 index 0000000000000000000000000000000000000000..c17ecbc406d5538687e36cc2b8abd067cb6e9d7d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSegments.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTranslation + +namespace OAI + +/-! The actual elementary trajectories used by the finite processor. Each +curve is polynomial in one smooth clock and satisfies the cutoff equation +whenever it lies in its assigned filled rectangle. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows PlanarRouting Set +open scoped ContDiff + +def Primitive.path (p : Primitive) (θ : ℝ → ℝ) (x : Plane) : ℝ → Plane := + match p with + | .translation v => translationPath θ (fun j => (v j : ℝ)) x + | .horizontal c a => horizontalPath θ a (fun j => (c j : ℝ)) (x - fun j => (c j : ℝ)) + | .vertical c a => verticalPath θ a (fun j => (c j : ℝ)) (x - fun j => (c j : ℝ)) + +def Primitive.endpoint (p : Primitive) (x : Plane) : Plane := p.path (fun _ => 1) x 0 + +theorem Primitive.path_hasDerivAt (p : Primitive) (x : Plane) {θ : ℝ → ℝ} {θ' t : ℝ} + (hθ : HasDerivAt θ θ' t) : + HasDerivAt (p.path θ x) (θ' • field p.potential (p.path θ x t)) t := by + cases p with + | translation v => + change HasDerivAt (translationPath θ (fun j => (v j : ℝ)) x) + (θ' • field (translationPotential (fun j => (v j : ℝ))) _) t + rw [field_translation] + exact translationPath_hasDerivAt hθ _ _ + | horizontal c a => exact horizontalPath_hasDerivAt hθ _ _ _ + | vertical c a => exact verticalPath_hasDerivAt hθ _ _ _ + +theorem Primitive.path_smooth (p : Primitive) (x : Plane) {θ : ℝ → ℝ} + (hθ : ContDiff ℝ ∞ θ) : ContDiff ℝ ∞ (p.path θ x) := by + cases p <;> dsimp only [Primitive.path, translationPath, horizontalPath, verticalPath] + all_goals + apply contDiff_pi.mpr + intro j + fin_cases j <;> dsimp [translationPath, horizontalPath, verticalPath, shearX, shearY] <;> fun_prop + +theorem Primitive.path_start (p : Primitive) (x : Plane) {θ : ℝ → ℝ} {t : ℝ} + (hθ : θ t = 0) : p.path θ x t = x := by + cases p <;> ext j <;> fin_cases j <;> + simp [Primitive.path, translationPath, horizontalPath, verticalPath, shearX, shearY, hθ] + +theorem Primitive.path_end (p : Primitive) (x : Plane) {θ : ℝ → ℝ} {t : ℝ} + (hθ : θ t = 1) : p.path θ x t = p.endpoint x := by + cases p <;> simp [Primitive.path, Primitive.endpoint, translationPath, + horizontalPath, verticalPath, hθ] + +def Pulse.curve (p : Pulse) (x : Plane) : ℝ → Plane := + p.primitive.path (smoothRamp p.start p.finish) x + +theorem Pulse.curve_smooth (p : Pulse) (x : Plane) : ContDiff ℝ ∞ (p.curve x) := + p.primitive.path_smooth x (smoothRamp_smooth _ _) + +theorem Pulse.curve_ode {p : Pulse} (hp : p.Valid) (x : Plane) (t : ℝ) + (hx : p.curve x t ∈ p.rectangle.carrier) : + HasDerivAt (p.curve x) (p.velocity t (p.curve x t)) t := by + rw [Pulse.velocity, p.spatial_on_rectangle hp hx] + exact p.primitive.path_hasDerivAt x + (((smoothRamp_smooth p.start p.finish).differentiable (by simp) t).hasDerivAt) + +theorem Pulse.curve_before {p : Pulse} (hp : p.Valid) (x : Plane) {t : ℝ} + (ht : t ≤ (p.start : ℝ)) : p.curve x t = x := by + apply p.primitive.path_start + exact smoothRamp_before (by exact_mod_cast hp.2) ht + +theorem Pulse.curve_after {p : Pulse} (hp : p.Valid) (x : Plane) {t : ℝ} + (ht : (p.finish : ℝ) ≤ t) : p.curve x t = p.primitive.endpoint x := by + apply p.primitive.path_end + exact smoothRamp_after (by exact_mod_cast hp.2) ht + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSparseStages.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSparseStages.lean new file mode 100644 index 0000000000000000000000000000000000000000..be200ae24127b9cd871e1f4efa244383319fe56f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSparseStages.lean @@ -0,0 +1,118 @@ +import Mathlib.Order.Interval.Finset.Fin +import Mathlib.Tactic + +namespace OAI + +/-! Embedding a branch's local stages into the complete pulse schedule. +The anchor changes exactly at a selected pulse and remains fixed in all +other slots. -/ + +namespace ForcedComputation.PlanarRouting +open Finset + +def stagesBefore {m n : ℕ} (J : Fin m → Fin n) (i : ℕ) : ℕ := + (Finset.univ.filter (fun k => (J k).val < i)).card + +theorem stagesBefore_le {m n : ℕ} (J : Fin m → Fin n) (i : ℕ) : + stagesBefore J i ≤ m := by + have h := Finset.card_le_card (Finset.filter_subset + (fun k : Fin m => (J k).val < i) Finset.univ) + simpa only [stagesBefore, Finset.card_univ, Fintype.card_fin] using h + +@[simp] theorem stagesBefore_zero {m n : ℕ} (J : Fin m → Fin n) : + stagesBefore J 0 = 0 := by simp [stagesBefore] + +@[simp] theorem stagesBefore_last {m n : ℕ} (J : Fin m → Fin n) : + stagesBefore J n = m := by + have he : Finset.univ.filter (fun k : Fin m => (J k).val < n) = Finset.univ := by + apply Finset.filter_eq_self.mpr + intro k _ + exact (J k).isLt + simp only [stagesBefore, he, Finset.card_univ, Fintype.card_fin] + +theorem stagesBefore_selected {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (k : Fin m) : stagesBefore J (J k).val = k.val := by + have he : Finset.univ.filter (fun l : Fin m => (J l).val < (J k).val) = + Finset.Iio k := by + ext l + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_Iio] + exact hJ.lt_iff_lt + rw [stagesBefore, he, Fin.card_Iio] + +theorem stagesBefore_selected_succ {m n : ℕ} {J : Fin m → Fin n} + (hJ : StrictMono J) (k : Fin m) : stagesBefore J ((J k).val + 1) = k.val + 1 := by + have he : Finset.univ.filter (fun l : Fin m => (J l).val < (J k).val + 1) = + Finset.Iic k := by + ext l + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_Iic] + change (J l).val < (J k).val + 1 ↔ l ≤ k + rw [Nat.lt_succ_iff] + exact hJ.le_iff_le + rw [stagesBefore, he, Fin.card_Iic] + +theorem stagesBefore_unused {m n : ℕ} (J : Fin m → Fin n) (i : ℕ) + (hi : ∀ k, (J k).val ≠ i) : stagesBefore J (i + 1) = stagesBefore J i := by + unfold stagesBefore + congr 1 + ext k + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + have hk := hi k + omega + +def sparseAnchor {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) (i : ℕ) : E := + p ⟨stagesBefore J i, lt_of_le_of_lt (stagesBefore_le J i) (Nat.lt_succ_self m)⟩ + +@[simp] theorem sparseAnchor_zero {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) : sparseAnchor J p 0 = p 0 := by + unfold sparseAnchor + apply congrArg p + apply Fin.ext + exact stagesBefore_zero J + +@[simp] theorem sparseAnchor_last {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) : sparseAnchor J p n = p (Fin.last m) := by + unfold sparseAnchor + apply congrArg p + apply Fin.ext + exact stagesBefore_last J + +theorem sparseAnchor_after_last {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) {i : ℕ} (hi : n ≤ i) : + sparseAnchor J p i = p (Fin.last m) := by + have he : Finset.univ.filter (fun k : Fin m => (J k).val < i) = Finset.univ := by + apply Finset.filter_eq_self.mpr + intro k _ + exact (J k).isLt.trans_le hi + unfold sparseAnchor + apply congrArg p + apply Fin.ext + simp only [stagesBefore, he, Finset.card_univ, Fintype.card_fin, Fin.val_last] + +theorem sparseAnchor_selected {E : Type*} {m n : ℕ} {J : Fin m → Fin n} + (hJ : StrictMono J) (p : Fin (m + 1) → E) (k : Fin m) : + sparseAnchor J p (J k).val = p k.castSucc := by + unfold sparseAnchor + apply congrArg p + apply Fin.ext + exact stagesBefore_selected hJ k + +theorem sparseAnchor_selected_succ {E : Type*} {m n : ℕ} {J : Fin m → Fin n} + (hJ : StrictMono J) (p : Fin (m + 1) → E) (k : Fin m) : + sparseAnchor J p ((J k).val + 1) = p k.succ := by + unfold sparseAnchor + apply congrArg p + apply Fin.ext + exact stagesBefore_selected_succ hJ k + +theorem sparseAnchor_unused {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) (i : ℕ) (hi : ∀ k, (J k).val ≠ i) : + sparseAnchor J p (i + 1) = sparseAnchor J p i := by + unfold sparseAnchor + apply congrArg p + apply Fin.ext + exact stagesBefore_unused J i hi + +end ForcedComputation.PlanarRouting + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarStepBranch.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarStepBranch.lean new file mode 100644 index 0000000000000000000000000000000000000000..8caf02c0cc583aa20bb32b68ad0729401d26558b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarStepBranch.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarRecorder + +namespace OAI + +/-! The geometric branch implementing a machine step retains its source and +target control states. These identities supply the all-time observer guard. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows Radix + +theorem step_branch {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} (h : Step (finiteMachine M hM) C D) : + ∃ b : Branch (finiteMachine M hM), b.source = C.control ∧ b.target = D.control ∧ + point M hM C ∈ (instruction M hM b).source.carrier ∧ + (instruction M hM b).affine (point M hM C) = point M hM D := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hx : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains (radixBase_gt_one M) hdigits (bandScale_pos M).le + (stateOffset M) b C rfl rfl rfl + have ha : (geometricInstruction M hM b).affine (codedPoint M C) = + codedPoint M ⟨q, C.head + d, Function.update C.tape C.head a⟩ := + branchInstruction_step (radixBase_gt_one M) hdigits (bandScale M) (stateOffset M) b C rfl rfl rfl + refine ⟨b, rfl, rfl, ?_, ?_⟩ + · exact PlanarConjugacy.mem_box_of_mem (compression_pos M hM).le (by norm_num) hx + · change (PlanarConjugacy.instruction _ _ _ _ _).affine + (PlanarConjugacy.map _ _ _ _ (codedPoint M C)) = _ + rw [PlanarConjugacy.instruction_conjugacy _ _ _ _ _ + (geometricInstruction_factor_pos M hM b).ne', ha] + rfl + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSuspensionBridge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSuspensionBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..88586d96ae5fb38425c82c9f35c16350e4dc143d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarSuspensionBridge.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarHamiltonian + +namespace OAI + +/-! The horizontal part of the autonomous suspension is the Hamiltonian +field of the planar slice at its current spatial phase. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff + +def planeInclusion : Plane →L[ℝ] Space := + letI := ShearFlows.neZeroTwo + ContinuousLinearMap.pi ![ContinuousLinearMap.proj 0, ContinuousLinearMap.proj 1, 0] + +theorem planeInclusion_basis (j : Fin 2) : + planeInclusion (PlanarHamiltonian.basis j) = basis j.castSucc := by + ext k + fin_cases j <;> fin_cases k <;> simp [planeInclusion, PlanarHamiltonian.basis, basis] + +theorem atHeight_hasFDerivAt (X : Plane) (z : ℝ) : + HasFDerivAt (fun Y : Plane => atHeight Y z) planeInclusion X := by + have he : (fun Y : Plane => atHeight Y z) = fun Y => planeInclusion Y + z • basis 2 := by + funext Y k + fin_cases k <;> simp [planeInclusion, atHeight, basis] + rw [he] + exact planeInclusion.hasFDerivAt.add_const (z • basis 2) + +theorem spatialD_slice {H : Space → ℝ} (hH : ContDiff ℝ ∞ H) + (X : Plane) (z : ℝ) (j : Fin 2) : + PlanarHamiltonian.spatialD j (fun Y => H (atHeight Y z)) X = + scalarD j.castSucc H (atHeight X z) := by + have hd := (hH.differentiable (by simp) (atHeight X z)).hasFDerivAt.comp X + (atHeight_hasFDerivAt X z) + unfold PlanarHamiltonian.spatialD scalarD + change fderiv ℝ (H ∘ fun Y => atHeight Y z) X (PlanarHamiltonian.basis j) = _ + rw [hd.fderiv] + change fderiv ℝ H (atHeight X z) (planeInclusion (PlanarHamiltonian.basis j)) = _ + rw [planeInclusion_basis] + +theorem suspensionField_atHeight {H : FieldExpr} (hH : H.Valid) + (X : Plane) (z : ℝ) : + SpatialExpression.suspensionField H (atHeight X z) = + atHeight (PlanarHamiltonian.field + (fun Y => SpatialExpression.spatialValue H (atHeight Y z)) X) + (unitSpatialClock X) := by + have hd := spatialD_slice (SpatialExpression.spatialValue_smooth hH) X z + funext j + fin_cases j + · change scalarD 1 (SpatialExpression.spatialValue H) (atHeight X z) = _ + simpa [atHeight, PlanarHamiltonian.field] using (hd 1).symm + · change -scalarD 0 (SpatialExpression.spatialValue H) (atHeight X z) = _ + simpa [atHeight, PlanarHamiltonian.field] using congrArg Neg.neg (hd 0).symm + · change unitSpatialClock (horizontal (atHeight X z)) = unitSpatialClock X + congr 1 + ext k + fin_cases k <;> rfl + +/-- The exact planar slice equation determines each finite interval of the +actual autonomous material flow. -/ +theorem suspensionField_tracks_interval {H : FieldExpr} (hH : H.Valid) + (hP : CubePeriodic 1 (SpatialExpression.spatialValue H)) + {ψ : ℝ → Plane} {Φ : ℝ → Space → Space} {a b : ℝ} (x : Space) + (hc : ContinuousOn (suspensionPath ψ) (Icc a b)) + (hp : suspensionPath ψ a = Φ a x) + (hψ : ∀ s ∈ Ico a b, HasDerivAt ψ + (PlanarHamiltonian.field (fun Y => SpatialExpression.spatialValue H (atHeight Y s)) + (ψ s)) s) + (hg : ∀ s ∈ Ico a b, unitSpatialClock (ψ s) = 1) + (hΦ : IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ) : + EqOn (fun s => Φ s x) (suspensionPath ψ) (Icc a b) := by + obtain ⟨K, hK⟩ := periodic_spatial_lipschitz (by norm_num : (0 : ℝ) < 1) + (SpatialExpression.suspensionField_smooth hH) + (SpatialExpression.suspensionField_periodic hH hP) + apply hΦ.eqOn_of_candidate (fun _ => hK) x (suspensionPath ψ) hc hp + intro s hs + have hd := suspensionPath_hasDerivAt + (V := fun t X => PlanarHamiltonian.field + (fun Y => SpatialExpression.spatialValue H (atHeight Y t)) X) + (g := unitSpatialClock) (hψ s hs) (hg s hs) + have he : spatialSuspension + (fun t X => PlanarHamiltonian.field + (fun Y => SpatialExpression.spatialValue H (atHeight Y t)) X) + unitSpatialClock (suspensionPath ψ s) = + SpatialExpression.suspensionField H (suspensionPath ψ s) := by + rw [suspensionPath, suspensionField_atHeight hH] + simp only [spatialSuspension, atHeight_horizontal] + rfl + rwa [he] at hd + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTiming.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTiming.lean new file mode 100644 index 0000000000000000000000000000000000000000..27607d4ce374799eecf39f971ac46a817890d8b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTiming.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Profiles + +namespace OAI + +/-! Rational disjoint pulse slots for a finite planar instruction list. -/ + +noncomputable section + +namespace ForcedComputation.PlanarTiming + +open ShearFlows Set +open scoped ContDiff + +def start {n : ℕ} (k : Fin n) : ℚ := (2 * (k.val : ℚ) + 1) / (2 * ((n : ℚ) + 1)) + +def finish {n : ℕ} (k : Fin n) : ℚ := (2 * (k.val : ℚ) + 2) / (2 * ((n : ℚ) + 1)) + +theorem intervals {n : ℕ} (k : Fin n) : + 0 < start k ∧ start k < finish k ∧ finish k < 1 := by + have hn : (0 : ℚ) < 2 * (n + 1) := by positivity + have hk : (k.val : ℚ) < n := by exact_mod_cast k.isLt + refine ⟨by unfold start; positivity, ?_, ?_⟩ + · unfold start finish + exact (div_lt_div_iff_of_pos_right hn).mpr (by linarith) + · unfold finish + exact (div_lt_one hn).mpr (by linarith) + +theorem ordered {n : ℕ} {i j : Fin n} (hij : i < j) : finish i < start j := by + have hn : (0 : ℚ) < 2 * (n + 1) := by positivity + have hi : (i.val : ℚ) + 1 ≤ j.val := by exact_mod_cast hij + unfold start finish + exact (div_lt_div_iff_of_pos_right hn).mpr (by linarith) + +def clock {n : ℕ} (k : Fin n) : ℝ → ℝ := smoothRamp (start k) (finish k) + +def pulse {n : ℕ} (k : Fin n) : ℝ → ℝ := smoothPulse (start k) (finish k) + +theorem clock_smooth {n : ℕ} (k : Fin n) : ContDiff ℝ ∞ (clock k) := smoothRamp_smooth _ _ + +theorem pulse_smooth {n : ℕ} (k : Fin n) : ContDiff ℝ ∞ (pulse k) := smoothPulse_smooth _ _ + +theorem clock_derivative {n : ℕ} (k : Fin n) (t : ℝ) : HasDerivAt (clock k) (pulse k t) t := + ((clock_smooth k).differentiable (by simp) t).hasDerivAt + +theorem clock_range {n : ℕ} (k : Fin n) (t : ℝ) : clock k t ∈ Icc (0 : ℝ) 1 := + smoothRamp_range _ _ _ + +theorem clock_at_zero {n : ℕ} (k : Fin n) : clock k 0 = 0 := + smoothRamp_before (by exact_mod_cast (intervals k).2.1) + (by exact_mod_cast (intervals k).1.le) + +theorem clock_at_one {n : ℕ} (k : Fin n) : clock k 1 = 1 := + smoothRamp_after (by exact_mod_cast (intervals k).2.1) + (by exact_mod_cast (intervals k).2.2.le) + +theorem pulse_active {n : ℕ} {k : Fin n} {t : ℝ} (ht : pulse k t ≠ 0) : + (start k : ℝ) < t ∧ t < finish k := by + have ho : (start k : ℝ) < finish k := by exact_mod_cast (intervals k).2.1 + exact ⟨lt_of_not_ge (fun h => ht (smoothPulse_before ho h)), + lt_of_not_ge (fun h => ht (smoothPulse_after ho h))⟩ + +theorem active_previous {n : ℕ} {i j : Fin n} {t : ℝ} + (hij : i < j) (ht : pulse j t ≠ 0) : clock i t = 1 ∧ pulse i t = 0 := by + have ho : (start i : ℝ) < finish i := by exact_mod_cast (intervals i).2.1 + have hg : (finish i : ℝ) < start j := by exact_mod_cast ordered hij + have hi : (finish i : ℝ) ≤ t := (hg.trans (pulse_active ht).1).le + exact ⟨smoothRamp_after ho hi, smoothPulse_after ho hi⟩ + +theorem active_future {n : ℕ} {i j : Fin n} {t : ℝ} + (hij : i < j) (ht : pulse i t ≠ 0) : clock j t = 0 ∧ pulse j t = 0 := by + have ho : (start j : ℝ) < finish j := by exact_mod_cast (intervals j).2.1 + have hg : (finish i : ℝ) < start j := by exact_mod_cast ordered hij + have hj : t ≤ (start j : ℝ) := ((pulse_active ht).2.trans hg).le + exact ⟨smoothRamp_before ho hj, smoothPulse_before ho hj⟩ + +theorem pulse_unique {n : ℕ} {i j : Fin n} {t : ℝ} + (hi : pulse i t ≠ 0) (hj : pulse j t ≠ 0) : i = j := by + rcases lt_trichotomy i j with h | h | h + · exact False.elim (hj (active_future h hi).2) + · exact h + · exact False.elim (hi (active_future h hj).2) + +end ForcedComputation.PlanarTiming + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTransition.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTransition.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3b60912a8ef3983ed133f3debd93dbeff32fb55 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTransition.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariations +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.MaterialFlow + +namespace OAI + +/-! Global transition maps for the actual planar differential equation. +Existence and the inverse identities below use the bounded, globally +Lipschitz finite expression, with no smooth-dependence assumption. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff NNReal + +structure IsPlanarTransition (V : ℝ → Plane → Plane) + (Ψ : ℝ → ℝ → Plane → Plane) : Prop where + initial : ∀ a x, Ψ a 0 x = x + ode : ∀ a t x, HasDerivAt (fun s => Ψ a s x) (V (a + t) (Ψ a t x)) t + unique : ∀ a x (γ : ℝ → Plane), γ 0 = x → + (∀ t, HasDerivAt γ (V (a + t) (γ t)) t) → ∀ t, γ t = Ψ a t x + +theorem exists_planarTransition_of_bounds {V : ℝ → Plane → Plane} {K B : ℝ≥0} + (hv : ∀ s, LipschitzWith K (V s)) + (hc : ∀ x, Continuous (fun s => V s x)) (hb : ∀ s x, ‖V s x‖ ≤ B) : + ∃ Ψ, IsPlanarTransition V Ψ := by + have hc' (a : ℝ) (x : Plane) : Continuous (fun t => V (a + t) x) := by + have h := (hc x).comp (continuous_const.add continuous_id : + Continuous (fun t : ℝ => a + t)) + exact h + have hex (a : ℝ) (x : Plane) : ∃ γ : ℝ → Plane, γ 0 = x ∧ + ∀ t, HasDerivAt γ (V (a + t) (γ t)) t := + bounded_lipschitz_global_solution (fun t => hv (a + t)) (hc' a) + (fun t y => hb (a + t) y) x + choose γ hi hd using hex + refine ⟨fun a t x => γ a x t, ⟨hi, fun a t x => hd a x t, ?_⟩⟩ + intro a x η hη hode t + have he := ODE_solution_unique_univ (s := fun _ => univ) + (fun s => (hv (a + s)).lipschitzOnWith) + (fun s => ⟨hode s, mem_univ _⟩) (fun s => ⟨hd a x s, mem_univ _⟩) + (hη.trans (hi a x).symm) + exact congrFun he t + +theorem planarSlice_continuous {H : FieldExpr} (hH : H.Valid) : + Continuous (fun y : ℝ × Plane => planarSlice H y.1 y.2) := by + have hi : Continuous (fun y : ℝ × Plane => atHeight y.2 y.1) := by + apply continuous_pi + intro j + fin_cases j + · change Continuous (fun y : ℝ × Plane => y.2 0) + exact (continuous_apply 0).comp continuous_snd + · change Continuous (fun y : ℝ × Plane => y.2 1) + exact (continuous_apply 1).comp continuous_snd + · change Continuous (fun y : ℝ × Plane => y.1) + exact continuous_fst + have hh : Continuous horizontal := by + apply continuous_pi + intro j + fin_cases j <;> exact continuous_apply _ + have he : (fun y : ℝ × Plane => planarSlice H y.1 y.2) = + fun y => horizontal (SpatialExpression.suspensionField H (atHeight y.2 y.1)) := + funext fun y => planarSlice_eq_horizontal hH y.1 y.2 + rw [he] + exact hh.comp ((SpatialExpression.suspensionField_smooth hH).continuous.comp hi) + +theorem planarSlice_bound {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) (s : ℝ) (x : Plane) : + ‖planarSlice H s x‖ ≤ ((SpatialExpression.suspensionCode H).bound [] : ℝ) := by + rw [planarSlice_eq_horizontal hH] + apply (horizontal_norm_le _).trans + have h := VelocityExpr.val_bound (SpatialExpression.suspensionCode_valid hH) + [] (0, atHeight x s) + rw [SpatialExpression.suspensionCode_val hH hT] at h + exact h + +theorem exists_planarTransition {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) : + ∃ Ψ, IsPlanarTransition (planarSlice H) Ψ := by + apply exists_planarTransition_of_bounds (B := + ((SpatialExpression.suspensionCode H).bound [] : ℝ≥0)) + (fun s => planarSlice_lipschitz hH hT s) + · intro x + have hi : Continuous (fun t : ℝ => (t, x)) := continuous_id.prodMk continuous_const + have h := (planarSlice_continuous hH).comp hi + exact h + · exact fun s x => planarSlice_bound hH hT s x + +namespace IsPlanarTransition + +theorem compose {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (a s t : ℝ) (x : Plane) : + Ψ a (s + t) x = Ψ (a + s) t (Ψ a s x) := by + apply hΨ.unique (a + s) (Ψ a s x) (fun r => Ψ a (s + r) x) + (by rw [add_zero]) + intro r + have hd := (hΨ.ode a (s + r) x).scomp r ((hasDerivAt_id r).const_add s) + simpa only [one_smul, add_assoc, Function.comp_def] using hd + +theorem inverse_left {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (a t : ℝ) (x : Plane) : + Ψ (a + t) (-t) (Ψ a t x) = x := by + rw [← hΨ.compose, add_neg_cancel, hΨ.initial] + +theorem inverse_right {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (a t : ℝ) (x : Plane) : + Ψ a t (Ψ (a + t) (-t) x) = x := by + have h := hΨ.inverse_left (a + t) (-t) x + simpa only [add_neg_cancel_right, neg_neg] using h + +theorem bijective {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) (a t : ℝ) : Function.Bijective (Ψ a t) := + ⟨Function.LeftInverse.injective (hΨ.inverse_left a t), + Function.RightInverse.surjective (hΨ.inverse_right a t)⟩ + +theorem perturbation {V : ℝ → Plane → Plane} {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition V Ψ) {K : ℝ≥0} + (hV : ∀ s, LipschitzWith K (V s)) (a : ℝ) (x y : Plane) + {t : ℝ} (ht : 0 ≤ t) : + dist (Ψ a t x) (Ψ a t y) ≤ dist x y * Real.exp ((K : ℝ) * t) := by + have hx : Continuous (fun s => Ψ a s x) := + continuous_iff_continuousAt.mpr (fun s => (hΨ.ode a s x).continuousAt) + have hy : Continuous (fun s => Ψ a s y) := + continuous_iff_continuousAt.mpr (fun s => (hΨ.ode a s y).continuousAt) + have h := dist_le_of_trajectories_ODE (fun s => hV (a + s)) hx.continuousOn + (fun s _ => (hΨ.ode a s x).hasDerivWithinAt) hy.continuousOn + (fun s _ => (hΨ.ode a s y).hasDerivWithinAt) le_rfl t ⟨ht, le_rfl⟩ + simpa only [hΨ.initial, sub_zero] using h + +end IsPlanarTransition +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTranslation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..32b193b7f2d721f9ea8170b7112e479fc590475d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTranslation.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProgramBounds + +namespace OAI + +/-! Rational translation of the finite pulse data. The cutoff support and its +positive separation are translated together. Local field covariance is all +that is needed by the tracked paths. -/ + +noncomputable section + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +def translatedPoint (δ : Fin 2 → ℚ) (x : Plane) : Plane := fun j => x j + (δ j : ℝ) + +def translatedBox (δ : Fin 2 → ℚ) (R : RationalBox 2) : RationalBox 2 := + ⟨fun j => R.lower j + δ j, fun j => R.upper j + δ j⟩ + +theorem translatedBox_positive (δ : Fin 2 → ℚ) {R : RationalBox 2} + (hR : R.positive) : (translatedBox δ R).positive := by + intro j + change R.lower j + δ j < R.upper j + δ j + linarith [hR j] + +theorem mem_translatedBox (δ : Fin 2 → ℚ) (R : RationalBox 2) (x : Plane) : + translatedPoint δ x ∈ (translatedBox δ R).carrier ↔ x ∈ R.carrier := by + simp only [RationalBox.carrier, Set.mem_ofPred_eq, translatedPoint, translatedBox, Rat.cast_add, + add_le_add_iff_right] + +theorem translatedBox_gap (δ : Fin 2 → ℚ) {R S : RationalBox 2} {g : ℚ} + (h : EndpointGap g R S) : EndpointGap g (translatedBox δ R) (translatedBox δ S) := by + obtain ⟨j, h | h⟩ := h + · refine ⟨j, Or.inl ?_⟩ + change R.upper j + δ j + g ≤ S.lower j + δ j + linarith + · refine ⟨j, Or.inr ?_⟩ + change S.upper j + δ j + g ≤ R.lower j + δ j + linarith + +end ForcedComputation.PlanarRouting + +namespace ForcedComputation.PlanarHamiltonian + +open ShearFlows PlanarRouting + +def Primitive.translated (δ : Fin 2 → ℚ) (p : Primitive) : Primitive := + Primitive.casesOn p Primitive.translation + (fun c a => .horizontal (c + δ) a) (fun c a => .vertical (c + δ) a) + +theorem Primitive.translated_field (δ : Fin 2 → ℚ) (p : Primitive) (x : Plane) : + field (p.translated δ).potential (translatedPoint δ x) = field p.potential x := by + cases p with + | translation v => + change field (translationPotential (fun j => (v j : ℝ))) (translatedPoint δ x) = + field (translationPotential (fun j => (v j : ℝ))) x + rw [field_translation, field_translation] + | horizontal c a => + simp only [Primitive.translated, Primitive.potential, field_horizontal] + funext j + fin_cases j <;> simp [translatedPoint, Pi.add_apply, Rat.cast_add] + | vertical c a => + simp only [Primitive.translated, Primitive.potential, field_vertical] + funext j + fin_cases j <;> simp [translatedPoint, Pi.add_apply, Rat.cast_add] + +def Pulse.translated (δ : Fin 2 → ℚ) (p : Pulse) : Pulse where + primitive := p.primitive.translated δ + rectangle := translatedBox δ p.rectangle + collar := p.collar + start := p.start + finish := p.finish + +theorem Pulse.translated_valid (δ : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) : + (p.translated δ).Valid := hp + +theorem Pulse.spatial_on_rectangle {p : Pulse} (hp : p.Valid) {x : Plane} + (hx : x ∈ p.rectangle.carrier) : p.spatial x = field p.primitive.potential x := + field_cutoff_plateau _ _ (rectangleCutoff_one_near hp.1 hx) + +theorem Pulse.translated_spatial (δ : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) + {x : Plane} (hx : x ∈ p.rectangle.carrier) : + (p.translated δ).spatial (translatedPoint δ x) = p.spatial x := by + rw [(p.translated δ).spatial_on_rectangle (p.translated_valid δ hp) + ((mem_translatedBox δ p.rectangle x).mpr hx), p.spatial_on_rectangle hp hx] + exact p.primitive.translated_field δ x + +theorem Pulse.translated_velocity (δ : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) + {x : Plane} (hx : x ∈ p.rectangle.carrier) (t : ℝ) : + (p.translated δ).velocity t (translatedPoint δ x) = p.velocity t x := by + change smoothPulse p.start p.finish t • (p.translated δ).spatial (translatedPoint δ x) = _ + rw [p.translated_spatial δ hp hx] + rfl + +theorem Pulse.translated_inUnit (δ : Fin 2 → ℚ) {p : Pulse} (hp : p.InUnit) + (hR : Between p.rectangle (1 / 64) (7 / 8)) + (hc : p.collar ≤ 1 / 65536) + (hδ : ∀ j, -(1 / 128 : ℚ) ≤ δ j ∧ δ j ≤ 1 / 128) : + (p.translated δ).InUnit := by + refine ⟨hp.1, hp.2.1, ?_⟩ + intro j + have h := hR j + have h' := hδ j + change 0 < p.rectangle.lower j + δ j - 2 * p.collar ∧ + p.rectangle.upper j + δ j + 2 * p.collar < 1 + constructor <;> linarith + +theorem Pulse.translated_hasDerivAt (δ : Fin 2 → ℚ) {p : Pulse} (hp : p.Valid) + {γ : ℝ → Plane} {t : ℝ} (hx : γ t ∈ p.rectangle.carrier) + (hγ : HasDerivAt γ (p.velocity t (γ t)) t) : + HasDerivAt (fun s => translatedPoint δ (γ s)) + ((p.translated δ).velocity t (translatedPoint δ (γ t))) t := by + rw [p.translated_velocity δ hp hx] + exact hγ.add_const (fun j => (δ j : ℝ)) + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTubes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTubes.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef914c9e6e51ac6ae6d498feb9fe9933097bd77b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarTubes.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarOrdering +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulse + +namespace OAI + +/-! Clearance for the actual filled extraction and insertion tubes. -/ + +namespace ForcedComputation.PlanarRouting + +open ShearFlows + +theorem box_ext {R S : RationalBox 2} (hl : R.lower = S.lower) (hu : R.upper = S.upper) : R = S := by + cases R + cases S + cases hl + cases hu + rfl + +@[simp] theorem centerQ_sub_halfWidthQ (R : RationalBox 2) (j : Fin 2) : + centerQ R j - halfWidthQ R j = R.lower j := by + dsimp [centerQ, halfWidthQ] + ring + +@[simp] theorem centerQ_add_halfWidthQ (R : RationalBox 2) (j : Fin 2) : + centerQ R j + halfWidthQ R j = R.upper j := by + dsimp [centerQ, halfWidthQ] + ring + +def horizontalCenter (R : RationalBox 2) (x : ℚ) : Fin 2 → ℚ := + letI := ShearFlows.neZeroTwo + ![x, centerQ R 1] + +theorem horizontalTube_eq_rightSweep (R : RationalBox 2) {x : ℚ} + (hx : centerQ R 0 ≤ x) : + translationTube R (horizontalCenter R x) = rightSweep R (x + halfWidthQ R 0) := by + have hl : R.lower 0 ≤ x - halfWidthQ R 0 := by + rw [← centerQ_sub_halfWidthQ R 0] + linarith + apply box_ext + · funext j + fin_cases j + · exact min_eq_left hl + · simp [translationTube, recenter, horizontalCenter, rightSweep] + · funext j + fin_cases j + · rfl + · simp [translationTube, recenter, horizontalCenter, rightSweep] + +def parkingColumn (n : ℕ) (κ : ℚ) (i : Fin n) : RationalBox 2 := + ⟨![(parkingBox n κ i).lower 0, 0], ![(parkingBox n κ i).upper 0, 7 / 8]⟩ + +theorem parkingColumn_gap {n : ℕ} {κ : ℚ} (hκ : κ ≤ 1 / 64) + {i j : Fin n} (hij : i ≠ j) : EndpointGap (parkingScale n) (parkingColumn n κ i) (parkingColumn n κ j) := by + rcases lt_or_gt_of_ne hij with h | h + · exact ⟨0, Or.inl (parkingBox_gap hκ h)⟩ + · exact ⟨0, Or.inr (parkingBox_gap hκ h)⟩ + +theorem parkingColumn_left {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) (hκ' : κ ≤ 1 / 64) + (i : Fin n) : (3 / 8 : ℚ) < (parkingColumn n κ i).lower 0 := by + have hp := (parkingCenter_bounds n i).1 + have hs := parkingScale_pos n + have hs' := parkingScale_le n + have hm := mul_le_mul hs' hκ' hκ (by norm_num : (0 : ℚ) ≤ 1 / 64) + change 3 / 8 < parkingCenter n i 0 - parkingScale n * κ + nlinarith + +theorem low_horizontal_gap_column {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) (hκ' : κ ≤ 1 / 64) + {R : RationalBox 2} (hR : R.upper 0 ≤ 1 / 3) (i : Fin n) : + EndpointGap (1 / 24) R (parkingColumn n κ i) := by + refine ⟨0, Or.inl ?_⟩ + have h := parkingColumn_left hκ hκ' i + linarith + +theorem parkingBox_subset_column {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) (hκ' : κ ≤ 1 / 64) + (i : Fin n) : (parkingBox n κ i).carrier ⊆ (parkingColumn n κ i).carrier := by + intro x hx j + fin_cases j + · exact hx 0 + · have hy := parkingBox_bounds hκ hκ' i hx + have h : (0 : ℝ) ≤ x 1 ∧ x 1 ≤ 7 / 8 := by + constructor <;> linarith [hy.2.2.1, hy.2.2.2] + simpa [parkingColumn] using h + +theorem verticalTube_subset_column {n : ℕ} {κ : ℚ} + (R : RationalBox 2) (i : Fin n) + (hx : centerQ R 0 = parkingCenter n i 0) + (hw : halfWidthQ R 0 ≤ parkingScale n * κ) + (hlo : (0 : ℚ) ≤ R.lower 1) (hhi : R.upper 1 ≤ 7 / 8) + (hheight : halfWidthQ R 1 ≤ 1 / 8) : + (translationTube R (parkingCenter n i)).carrier ⊆ (parkingColumn n κ i).carrier := by + have hl₀ : (parkingBox n κ i).lower 0 ≤ R.lower 0 := by + rw [← centerQ_sub_halfWidthQ R 0, hx] + exact sub_le_sub_left hw _ + have hu₀ : R.upper 0 ≤ (parkingBox n κ i).upper 0 := by + rw [← centerQ_add_halfWidthQ R 0, hx] + change parkingCenter n i 0 + halfWidthQ R 0 ≤ parkingCenter n i 0 + parkingScale n * κ + exact add_le_add_right hw _ + have hl₁ : (0 : ℚ) ≤ (recenter R (parkingCenter n i)).lower 1 := by + change 0 ≤ 3 / 4 - halfWidthQ R 1 + linarith + have hu₁ : (recenter R (parkingCenter n i)).upper 1 ≤ (7 / 8 : ℚ) := by + change 3 / 4 + halfWidthQ R 1 ≤ 7 / 8 + linarith + intro x hxR j + have hb := hxR j + fin_cases j + · have hl : (parkingColumn n κ i).lower 0 ≤ (translationTube R (parkingCenter n i)).lower 0 := by + apply le_min hl₀ + exact sub_le_sub_left hw _ + have hu : (translationTube R (parkingCenter n i)).upper 0 ≤ (parkingColumn n κ i).upper 0 := by + apply max_le hu₀ + change parkingCenter n i 0 + halfWidthQ R 0 ≤ parkingCenter n i 0 + parkingScale n * κ + exact add_le_add_right hw _ + have hl' : ((parkingColumn n κ i).lower 0 : ℝ) ≤ + (translationTube R (parkingCenter n i)).lower 0 := by exact_mod_cast hl + have hu' : ((translationTube R (parkingCenter n i)).upper 0 : ℝ) ≤ + (parkingColumn n κ i).upper 0 := by exact_mod_cast hu + exact ⟨hl'.trans hb.1, hb.2.trans hu'⟩ + · have hl : (0 : ℚ) ≤ (translationTube R (parkingCenter n i)).lower 1 := le_min hlo hl₁ + have hu : (translationTube R (parkingCenter n i)).upper 1 ≤ (7 / 8 : ℚ) := max_le hhi hu₁ + have hl' : (0 : ℝ) ≤ (translationTube R (parkingCenter n i)).lower 1 := by exact_mod_cast hl + have hu' : ((translationTube R (parkingCenter n i)).upper 1 : ℝ) ≤ 7 / 8 := by + have he := (Rat.cast_le (K := ℝ)).mpr hu + simpa only [Rat.cast_div, Rat.cast_ofNat] using he + simpa [parkingColumn] using (show (0 : ℝ) ≤ x 1 ∧ x 1 ≤ 7 / 8 from + ⟨hl'.trans hb.1, hb.2.trans hu'⟩) + +end ForcedComputation.PlanarRouting + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariationDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariationDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2c254ecef39b35d69ebe7178e3dc5dfe69bc66f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariationDischarge.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarFlowSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowVariational + +namespace OAI + +/-! Discharge of the smooth-dependence and variational-equation input for +the actual finite-expression planar transition. All analytic ingredients +are proved from the library implicit-function theorem and ODE uniqueness. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +theorem variations_of_joint_smooth (V : ℝ → Plane → Plane) + (Ω : ℝ → ℝ → Plane → Plane) + (hVjoint : ContDiff ℝ ∞ (Function.uncurry V)) + (hs : ContDiff ℝ ∞ (fun p : ℝ × (ℝ × Plane) => Ω p.1 p.2.1 p.2.2)) + (hΩ : IsPlanarTransition V Ω) : PlanarVariations V Ω := by + have ha (a : ℝ) : ContDiff ℝ ∞ (Function.uncurry (Ω a)) := + hs.comp (contDiff_const.prodMk contDiff_id) + have hV (a t : ℝ) : ContDiff ℝ ∞ (V (a + t)) := + hVjoint.comp (contDiff_const.prodMk contDiff_id) + refine ⟨fun a => funext (hΩ.initial a), ?_, ?_, ?_⟩ + · intro a t + exact (ha a).comp (contDiff_const.prodMk contDiff_id) + · intro a x v t + exact Flow.first_variation (ha a) (hV a) (hΩ.ode a) t x v + · intro a x v w t + exact Flow.second_variation (ha a) (hV a) (hΩ.ode a) t x v w + +theorem planarTransition_variations {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ω : ℝ → ℝ → Plane → Plane} + (hΩ : IsPlanarTransition (planarSlice H) Ω) : + PlanarVariations (planarSlice H) Ω := + variations_of_joint_smooth (planarSlice H) Ω (planarSlice_joint_smooth hH) + (planarTransition_joint_smooth hH hT hΩ) hΩ + +theorem exists_planarTransition_with_variations {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) : + ∃ Ω, IsPlanarTransition (planarSlice H) Ω ∧ + PlanarVariations (planarSlice H) Ω ∧ + ContDiff ℝ ∞ (fun p : ℝ × Plane => Ω p.1 (-p.1) p.2) := by + obtain ⟨Ω, hΩ⟩ := exists_planarTransition hH hT + exact ⟨Ω, hΩ, planarTransition_variations hH hT hΩ, + planarTransition_backward_smooth hH hT hΩ⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariations.lean new file mode 100644 index 0000000000000000000000000000000000000000..87cbe7e42e58ea9af75ab0e2de2265850329944b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/PlanarVariations.lean @@ -0,0 +1,153 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.VariationBounds + +namespace OAI + +/-! The variational equations used for the planar quantitative estimates. +The regularity input is the finite-dimensional smooth-dependence theorem: +Teschl, Ordinary Differential Equations and Dynamical Systems (2012), +Theorem 2.10, equations (2.49)--(2.51). The quantitative estimates follow +from these equations by Gronwall inequalities. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff + +/-- The first two variational equations for a transition map. The second +time argument is elapsed time; the first is its initial phase. -/ +structure PlanarVariations (V : ℝ → Plane → Plane) + (Ψ : ℝ → ℝ → Plane → Plane) : Prop where + initial : ∀ a, Ψ a 0 = id + smooth : ∀ a t, ContDiff ℝ ∞ (Ψ a t) + first : ∀ a x v t, + HasDerivAt (fun s => fderiv ℝ (Ψ a s) x v) + (fderiv ℝ (V (a + t)) (Ψ a t x) (fderiv ℝ (Ψ a t) x v)) t + second : ∀ a x v w t, + HasDerivAt (fun s => fderiv ℝ (fderiv ℝ (Ψ a s)) x v w) + (fderiv ℝ (V (a + t)) (Ψ a t x) (fderiv ℝ (fderiv ℝ (Ψ a t)) x v w) + + fderiv ℝ (fderiv ℝ (V (a + t))) (Ψ a t x) + (fderiv ℝ (Ψ a t) x v) (fderiv ℝ (Ψ a t) x w)) t + +theorem planar_first_variation_vector {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x v : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x v‖ ≤ ‖v‖ * Real.exp (K * t) := by + apply first_variation_bound_mul ht + (fun s _ => (hv.first a x v s).continuousAt.continuousWithinAt) + (fun s _ => hv.first a x v s) + · rw [hv.initial] + simp + · intro s _ + exact ((fderiv ℝ (V (a + s)) (Ψ a s x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (hb _ _) (norm_nonneg _)) + +theorem planar_first_variation_operator {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hb : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (a : ℝ) (x : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x‖ ≤ Real.exp (K * t) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Real.exp_pos _).le + intro v + simpa only [mul_comm] using planar_first_variation_vector hv hb a x v ht + +theorem planar_second_variation_vector {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x v w : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x v w‖ ≤ + (‖v‖ * ‖w‖) * (Real.exp (4 * K * t) - Real.exp (2 * K * t)) := by + apply second_variation_bound_mul hK (mul_nonneg (norm_nonneg v) (norm_nonneg w)) ht + (fun s _ => (hv.second a x v w s).continuousAt.continuousWithinAt) + (fun s _ => hv.second a x v w s) + · rw [hv.initial] + have he : fderiv ℝ (id : Plane → Plane) = + fun _ => ContinuousLinearMap.id ℝ Plane := funext fun _ => fderiv_id + rw [he] + simp + · intro s hs + have hjv := planar_first_variation_vector hv hb₁ a x v hs.1 + have hjw := planar_first_variation_vector hv hb₁ a x w hs.1 + have he : Real.exp (K * s) * Real.exp (K * s) = Real.exp (2 * K * s) := by + rw [← Real.exp_add] + congr 1 + ring + calc + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w) + + fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ ≤ + ‖fderiv ℝ (V (a + s)) (Ψ a s x) (fderiv ℝ (fderiv ℝ (Ψ a s)) x v w)‖ + + ‖fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x) + (fderiv ℝ (Ψ a s) x v) (fderiv ℝ (Ψ a s) x w)‖ := norm_add_le _ _ + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * ‖fderiv ℝ (Ψ a s) x v‖ * ‖fderiv ℝ (Ψ a s) x w‖ := by + apply add_le_add + · exact ((fderiv ℝ (V (a + s)) (Ψ a s x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (hb₁ _ _) (norm_nonneg _)) + · exact ((fderiv ℝ (fderiv ℝ (V (a + s))) (Ψ a s x)).le_opNorm₂ _ _).trans + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (hb₂ _ _) (norm_nonneg _)) (norm_nonneg _)) + _ ≤ K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + K * (‖v‖ * Real.exp (K * s)) * (‖w‖ * Real.exp (K * s)) := by + gcongr + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * Real.exp (2 * K * s) := by + calc + _ = K * ‖fderiv ℝ (fderiv ℝ (Ψ a s)) x v w‖ + + (‖v‖ * ‖w‖) * K * (Real.exp (K * s) * Real.exp (K * s)) := by ring + _ = _ := by rw [he] + +theorem planar_second_variation_operator {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hv : PlanarVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : Plane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ + Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + have hq : 0 ≤ Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + apply sub_nonneg.mpr + apply Real.exp_le_exp.mpr + nlinarith + apply ContinuousLinearMap.opNorm_le_bound _ hq + intro v + apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg hq (norm_nonneg v)) + intro w + calc + _ ≤ (‖v‖ * ‖w‖) * (Real.exp (4 * K * t) - Real.exp (2 * K * t)) := + planar_second_variation_vector hv hK hb₁ hb₂ a x v w ht + _ = _ := by ring + +def planarFlowBound (H : FieldExpr) : ℕ := 2 * planarVariationCoefficient H + +theorem planar_quantitative_variations {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Ψ : ℝ → ℝ → Plane → Plane} + (hv : PlanarVariations (planarSlice H) Ψ) (a : ℝ) (x : Plane) {t : ℝ} + (ht : 0 ≤ t) : + ‖fderiv ℝ (Ψ a t) x‖ ≤ Real.exp ((planarFlowBound H : ℝ) * t) ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ a t)) x‖ ≤ + Real.exp (2 * (planarFlowBound H : ℝ) * t) - + Real.exp ((planarFlowBound H : ℝ) * t) := by + have hK : (0 : ℝ) < planarVariationCoefficient H := by + exact_mod_cast planarVariationCoefficient_pos H + have hb₁ := fun s y => (planar_derivative_bounds hH hT s y).1 + have hb₂ := fun s y => (planar_derivative_bounds hH hT s y).2 + constructor + · apply (planar_first_variation_operator hv hb₁ a x ht).trans + apply Real.exp_le_exp.mpr + simp only [planarFlowBound, Nat.cast_mul, Nat.cast_ofNat] + nlinarith + · have h := planar_second_variation_operator hv hK hb₁ hb₂ a x ht + simp only [planarFlowBound, Nat.cast_mul, Nat.cast_ofNat] + rw [show 2 * (2 * (planarVariationCoefficient H : ℝ)) * t = + 4 * (planarVariationCoefficient H : ℝ) * t by ring] + exact h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/ProcessorFlowSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/ProcessorFlowSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebd18a9261a88664f59df6f76fe2a3fcc91cad62 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/ProcessorFlowSmooth.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariationDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientBounds +import Mathlib.Algebra.Field.Periodic + +namespace OAI + +/-! Smooth dependence for an arbitrary smooth periodic processor input. +The compact-detector input is not restricted to finite Hamiltonian expressions. -/ + +noncomputable section +namespace ForcedComputation + +open Set ShearFlows +open scoped ContDiff NNReal + +private theorem periodic_joint_bound {F : Type*} [NormedAddCommGroup F] + {f : ℝ × Plane → F} (hc : Continuous f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) + (ht : ∀ x, Function.Periodic (fun t => f (t,x)) 1) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t x, ‖f (t,x)‖ ≤ C := by + obtain ⟨C,hC,hb⟩ := planePeriodic_bound_on hc.continuousOn + (fun t _ => hp t) (a := 0) (b := 1) + refine ⟨C,hC,?_⟩ + intro t x + have he : f (t,x) = f (Int.fract t,x) := by + have h := (ht x).int_mul (⌊t⌋ : ℤ) (Int.fract t) + simpa only [mul_one, Int.fract_add_floor] using h + rw [he] + exact hb (Int.fract t) ⟨Int.fract_nonneg t, (Int.fract_lt_one t).le⟩ x + +namespace VelocityDetector.CompactCenter.ProcessorInput + +/-- Time periodicity passes to the total space-time derivative. -/ +theorem derivative_time_periodic {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + (x : Plane) : Function.Periodic (fun t => fderiv ℝ (Function.uncurry V) (t,x)) 1 := by + have ht : ∀ p : ℝ × Plane, Function.uncurry V (p+(1,0)) = Function.uncurry V p := by + rintro ⟨t,y⟩ + change V (t+1) (y+0) = V t y + simpa only [add_zero] using hV.time_periodic t y + intro t + have hd := fderiv_translation (hV.smooth.differentiable (by simp)) ht (t,x) + simpa only [Prod.mk_add_mk, add_zero] using hd + +/-- Smooth periodicity supplies the qualitative joint derivative bound needed for the flow. -/ +theorem joint_derivative_bound {V : ℝ → Plane → Plane} (hV : ProcessorInput V) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ p, ‖fderiv ℝ (Function.uncurry V) p‖ ≤ C := by + obtain ⟨C,hC,hb⟩ := periodic_joint_bound + (hV.smooth.continuous_fderiv (by simp)) + (planePeriodic_totalDerivative hV.smooth hV.spatial_periodic) + hV.derivative_time_periodic + exact ⟨C,hC,fun p => hb p.1 p.2⟩ + +theorem joint_lipschitz {V : ℝ → Plane → Plane} (hV : ProcessorInput V) : + ∃ L : ℝ≥0, LipschitzWith L (Function.uncurry V) := by + obtain ⟨C,hC,hb⟩ := hV.joint_derivative_bound + refine ⟨⟨C,hC⟩, lipschitzWith_of_nnnorm_fderiv_le (hV.smooth.differentiable (by simp)) ?_⟩ + intro p + exact_mod_cast hb p + +/-- Every actual transition of the supplied processor is jointly smooth. -/ +theorem transition_joint_smooth {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) : + ContDiff ℝ ∞ (fun p : ℝ × (ℝ × Plane) => Ψ p.1 p.2.1 p.2.2) := by + obtain ⟨L,hL⟩ := hV.joint_lipschitz + exact Flow.transition_contDiff ⟨Function.uncurry V,hV.smooth.continuous⟩ + hV.smooth hL hΨ.ode hΨ.initial + +/-- The first and second variational equations are consequences of the input data. -/ +theorem variations {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) : PlanarVariations V Ψ := + variations_of_joint_smooth V Ψ hV.smooth (hV.transition_joint_smooth hΨ) hΨ + +/-- The backward map used by the detector has the same joint smoothness. -/ +theorem backward_smooth {V : ℝ → Plane → Plane} (hV : ProcessorInput V) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => Ψ p.1 (-p.1) p.2) := + (hV.transition_joint_smooth hΨ).comp + (contDiff_fst.prodMk (contDiff_fst.neg.prodMk contDiff_snd)) + +end VelocityDetector.CompactCenter.ProcessorInput +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondDerivativeBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a81be1e124e9416b63cbc4e9cdba3102bd53c831 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondDerivativeBounds.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EffectiveInterface + +namespace OAI + +/-! A computable operator bound for the second derivative of a finite +velocity expression. This is the coefficient needed in the planar second +variational equation. -/ + +noncomputable section +namespace ShearFlows.VelocityExpr +open scoped BigOperators NNReal + +def secondModulusBound (c : VelocityExpr) : ℕ := + ∑ j : Fin 4, c.modulusBound [j] + +theorem fderiv_lipschitz_bound {c : VelocityExpr} (hc : c.Valid) + (x y : SpaceTime) : + ‖fderiv ℝ c.val x - fderiv ℝ c.val y‖ ≤ + (c.secondModulusBound : ℝ) * ‖x - y‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro v + conv_lhs => rw [← spaceTimeDirections_sum v] + rw [map_sum] + apply (norm_sum_le _ _).trans + calc + (∑ j : Fin 4, ‖(fderiv ℝ c.val x - fderiv ℝ c.val y) + (timeSpaceCoord j v • spaceTimeDirection j)‖) ≤ + ∑ j : Fin 4, ‖v‖ * ((c.modulusBound [j] : ℝ) * ‖x - y‖) := by + apply Finset.sum_le_sum + intro j _ + rw [map_smul, norm_smul] + exact mul_le_mul (timeSpaceCoord_norm j v) (lipschitz_bound hc [j] x y) + (norm_nonneg _) (norm_nonneg _) + _ = ((c.secondModulusBound : ℝ) * ‖x - y‖) * ‖v‖ := by + simp only [secondModulusBound, Nat.cast_sum] + rw [← Finset.mul_sum, ← Finset.sum_mul] + ring + +theorem fderiv_lipschitz {c : VelocityExpr} (hc : c.Valid) : + LipschitzWith (c.secondModulusBound : ℝ≥0) (fderiv ℝ c.val) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm, NNReal.coe_natCast] using fderiv_lipschitz_bound hc x y + +theorem second_fderiv_bound {c : VelocityExpr} (hc : c.Valid) (x : SpaceTime) : + ‖fderiv ℝ (fderiv ℝ c.val) x‖ ≤ (c.secondModulusBound : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (fderiv_lipschitz hc) + +end ShearFlows.VelocityExpr + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondVariationSharp.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondVariationSharp.lean new file mode 100644 index 0000000000000000000000000000000000000000..bac9a96b4bad84a867966f09a5797c482e5b6a6e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SecondVariationSharp.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.VariationBounds + +namespace OAI + +/-! The time factor in the second-variation bound needed by the velocity +detector. This estimate applies in particular to the Euclidean plane. -/ + +namespace ForcedComputation +open Set + +theorem exp_sub_one_le_mul_exp (r : ℝ) : + Real.exp r - 1 ≤ r * Real.exp r := by + have h := mul_le_mul_of_nonneg_right (Real.add_one_le_exp (-r)) (Real.exp_pos r).le + rw [← Real.exp_add, neg_add_cancel, Real.exp_zero] at h + nlinarith + +theorem second_variation_bound_sharp_mul + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {B B' : ℝ → E} {K C t : ℝ} + (hK : 0 < K) (hC : 0 ≤ C) (ht : 0 ≤ t) (hc : ContinuousOn B (Icc 0 t)) + (hd : ∀ s ∈ Ico 0 t, HasDerivAt B (B' s) s) (h₀ : B 0 = 0) + (hb : ∀ s ∈ Ico 0 t, + ‖B' s‖ ≤ K * ‖B s‖ + C * K * Real.exp (2 * K * s)) : + ‖B t‖ ≤ C * K * t * Real.exp (3 * K * t) := by + have hbound (s : ℝ) (hs : s ∈ Ico 0 t) : + ‖B' s‖ ≤ K * ‖B s‖ + C * K * Real.exp (2 * K * t) := by + apply (hb s hs).trans + apply add_le_add le_rfl + apply mul_le_mul_of_nonneg_left _ (mul_nonneg hC hK.le) + apply Real.exp_le_exp.mpr + nlinarith [hs.2.le] + have h := norm_le_gronwallBound_of_norm_deriv_right_le + (K := K) (ε := C * K * Real.exp (2 * K * t)) hc + (fun s hs => (hd s hs).hasDerivWithinAt) + (show ‖B 0‖ ≤ 0 by simp [h₀]) hbound t ⟨ht, le_rfl⟩ + rw [gronwallBound_of_K_ne_0 hK.ne'] at h + simp only [sub_zero, zero_mul, zero_add] at h + have hcancel : (C * K * Real.exp (2 * K * t)) / K = C * Real.exp (2 * K * t) := by + field_simp [hK.ne'] + rw [hcancel] at h + calc + ‖B t‖ ≤ C * Real.exp (2 * K * t) * (Real.exp (K * t) - 1) := h + _ ≤ C * Real.exp (2 * K * t) * (K * t * Real.exp (K * t)) := + mul_le_mul_of_nonneg_left (exp_sub_one_le_mul_exp _) + (mul_nonneg hC (Real.exp_pos _).le) + _ = C * K * t * (Real.exp (2 * K * t) * Real.exp (K * t)) := by ring + _ = C * K * t * Real.exp (3 * K * t) := by + rw [← Real.exp_add] + congr 2 + ring + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparsePulseCurves.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparsePulseCurves.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1329eec4fc4a06058c044f31370e706a664e685 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparsePulseCurves.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSparseStages +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionConcatenation + +namespace OAI + +/-! Inserting the stationary cells between a branch's selected pulse curves. +This supplies the complete family of curves needed by `suspension_chain`. -/ + +noncomputable section +namespace ForcedComputation.PlanarRouting +open ShearFlows Set + +def sparseCurve {m n : ℕ} (J : Fin m → Fin n) (p : Fin (m + 1) → Plane) + (γ : Fin m → ℝ → Plane) (i : ℕ) : ℝ → Plane := + if h : ∃ k, (J k).val = i then γ h.choose else fun _ => sparseAnchor J p i + +theorem sparseCurve_selected {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (k : Fin m) : + sparseCurve J p γ (J k).val = γ k := by + have h : ∃ l, (J l).val = (J k).val := ⟨k, rfl⟩ + have hk : h.choose = k := hJ.injective (Fin.ext h.choose_spec) + simp only [sparseCurve, dite_eq_left h, hk] + +theorem sparseCurve_unused {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (i : ℕ) + (hi : ∀ k, (J k).val ≠ i) : sparseCurve J p γ i = fun _ => sparseAnchor J p i := by + have hn : ¬ ∃ k, (J k).val = i := by simpa only [not_exists] using hi + simp only [sparseCurve, dite_eq_right hn] + +theorem sparseCurve_endpoints {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + (hstart : ∀ k, γ k (cuts (J k).val) = p k.castSucc) + (hfinish : ∀ k, γ k (cuts ((J k).val + 1)) = p k.succ) (i : ℕ) : + sparseCurve J p γ i (cuts i) = sparseAnchor J p i ∧ + sparseCurve J p γ i (cuts (i + 1)) = sparseAnchor J p (i + 1) := by + by_cases hi : ∃ k, (J k).val = i + · obtain ⟨k, rfl⟩ := hi + rw [sparseCurve_selected hJ, sparseAnchor_selected hJ, sparseAnchor_selected_succ hJ] + exact ⟨hstart k, hfinish k⟩ + · have hn : ∀ k, (J k).val ≠ i := by simpa only [not_exists] using hi + rw [sparseCurve_unused J p γ i hn, sparseAnchor_unused J p i hn] + exact ⟨rfl, rfl⟩ + +theorem sparseCurve_continuousOn {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + (hγ : ∀ k, ContinuousOn (γ k) (Icc (cuts (J k).val) (cuts ((J k).val + 1)))) + (i : ℕ) : ContinuousOn (sparseCurve J p γ i) (Icc (cuts i) (cuts (i + 1))) := by + by_cases hi : ∃ k, (J k).val = i + · obtain ⟨k, rfl⟩ := hi + rw [sparseCurve_selected hJ] + exact hγ k + · have hn : ∀ k, (J k).val ≠ i := by simpa only [not_exists] using hi + rw [sparseCurve_unused J p γ i hn] + exact continuousOn_const + +theorem sparseCurve_ode {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + (V : ℝ → Plane → Plane) + (hγ : ∀ k s, s ∈ Ico (cuts (J k).val) (cuts ((J k).val + 1)) → + HasDerivAt (γ k) (V s (γ k s)) s) + (i : ℕ) (s : ℝ) (hs : s ∈ Ico (cuts i) (cuts (i + 1))) + (hz : (∀ k, (J k).val ≠ i) → V s (sparseAnchor J p i) = 0) : + HasDerivAt (sparseCurve J p γ i) (V s (sparseCurve J p γ i s)) s := by + by_cases hi : ∃ k, (J k).val = i + · obtain ⟨k, rfl⟩ := hi + rw [sparseCurve_selected hJ] + exact hγ k s hs + · have hn : ∀ k, (J k).val ≠ i := by simpa only [not_exists] using hi + rw [sparseCurve_unused J p γ i hn] + change HasDerivAt (fun _ => sparseAnchor J p i) (V s (sparseAnchor J p i)) s + rw [hz hn] + exact hasDerivAt_const s _ + +theorem sparseCurve_mem {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + {S : Set Plane} (hp : ∀ k, p k ∈ S) + (hγ : ∀ k s, s ∈ Icc (cuts (J k).val) (cuts ((J k).val + 1)) → γ k s ∈ S) + (i : ℕ) (s : ℝ) (hs : s ∈ Icc (cuts i) (cuts (i + 1))) : + sparseCurve J p γ i s ∈ S := by + by_cases hi : ∃ k, (J k).val = i + · obtain ⟨k, rfl⟩ := hi + rw [sparseCurve_selected hJ] + exact hγ k s hs + · have hn : ∀ k, (J k).val ≠ i := by simpa only [not_exists] using hi + rw [sparseCurve_unused J p γ i hn] + exact hp _ + +end ForcedComputation.PlanarRouting + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseStageIntervals.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseStageIntervals.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ec011a2404540d20dee0d8ce158aa9db68c7c0c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseStageIntervals.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSparseStages + +namespace OAI + +/-! The sparse anchor is constant between consecutive selected slots. -/ + +namespace ForcedComputation.PlanarRouting + +open Finset + +theorem stagesBefore_mono {m n : ℕ} (J : Fin m → Fin n) : Monotone (stagesBefore J) := by + intro i j hij + apply Finset.card_le_card + intro k hk + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hk ⊢ + exact hk.trans_le hij + +theorem stagesBefore_between {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (k l : Fin m) (hkl : k.val + 1 = l.val) {i : ℕ} + (hlo : (J k).val + 1 ≤ i) (hhi : i ≤ (J l).val) : + stagesBefore J i = l.val := by + have hlo' := stagesBefore_mono J hlo + have hhi' := stagesBefore_mono J hhi + rw [stagesBefore_selected_succ hJ k] at hlo' + rw [stagesBefore_selected hJ l] at hhi' + omega + +theorem stagesBefore_before {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (k : Fin m) (hk : k.val = 0) {i : ℕ} (hi : i ≤ (J k).val) : + stagesBefore J i = 0 := by + have h := stagesBefore_mono J hi + rw [stagesBefore_selected hJ k, hk] at h + omega + +theorem stagesBefore_after {m n : ℕ} {J : Fin m → Fin n} (hJ : StrictMono J) + (k : Fin m) (hk : k.val + 1 = m) {i : ℕ} (hi : (J k).val + 1 ≤ i) : + stagesBefore J i = m := by + have h := stagesBefore_mono J hi + rw [stagesBefore_selected_succ hJ k, hk] at h + exact le_antisymm (stagesBefore_le J i) h + +theorem sparseAnchor_of_count {E : Type*} {m n : ℕ} (J : Fin m → Fin n) + (p : Fin (m + 1) → E) (i : ℕ) (k : Fin (m + 1)) + (hk : stagesBefore J i = k.val) : sparseAnchor J p i = p k := by + unfold sparseAnchor + apply congrArg p + exact Fin.ext hk + +end ForcedComputation.PlanarRouting + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseSuspension.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseSuspension.lean new file mode 100644 index 0000000000000000000000000000000000000000..87d4461db7bef2dd6c809205541e3f254742e315 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SparseSuspension.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SparsePulseCurves +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPerturbations + +namespace OAI + +/-! A branch's sparse local pulse curves determine the actual autonomous +material flow, including its complete intervening stationary cells. -/ + +noncomputable section +namespace ForcedComputation.PlanarRouting +open ShearFlows Set + +theorem sparse_suspension {H : FieldExpr} (hH : H.Valid) + (hP : CubePeriodic 1 (SpatialExpression.spatialValue H)) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ) + {m n N : ℕ} (hN : 0 < N) (hn : n ≤ N) + {J : Fin m → Fin n} (hJ : StrictMono J) + (p : Fin (m + 1) → Plane) (γ : Fin m → ℝ → Plane) (cuts : ℕ → ℝ) + (hzero : cuts 0 = 0) (hone : cuts N = 1) + (hcuts : ∀ i < N, cuts i ≤ cuts (i + 1)) + (hstart : ∀ k, γ k (cuts (J k).val) = p k.castSucc) + (hfinish : ∀ k, γ k (cuts ((J k).val + 1)) = p k.succ) + (hc : ∀ k, ContinuousOn (γ k) (Icc (cuts (J k).val) (cuts ((J k).val + 1)))) + (hd : ∀ k s, s ∈ Ico (cuts (J k).val) (cuts ((J k).val + 1)) → + HasDerivAt (γ k) (planarSlice H s (γ k s)) s) + (hz : ∀ i < N, (∀ k, (J k).val ≠ i) → + ∀ s ∈ Ico (cuts i) (cuts (i + 1)), planarSlice H s (sparseAnchor J p i) = 0) + {S : Set Plane} (hS : S ⊆ clockRectangle.carrier) (hp : ∀ k, p k ∈ S) + (hmem : ∀ k s, s ∈ Icc (cuts (J k).val) (cuts ((J k).val + 1)) → γ k s ∈ S) : + Φ 1 (atHeight (p 0) 0) = atHeight (p (Fin.last m)) 1 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, horizontal (Φ s (atHeight (p 0) 0)) ∈ S := by + have hcurve (i : ℕ) (s : ℝ) (hs : s ∈ Icc (cuts i) (cuts (i + 1))) : + sparseCurve J p γ i s ∈ S := sparseCurve_mem hJ p γ cuts hp hmem i s hs + have h := suspension_chain hH hP hΦ (N := N) (cuts := cuts) + (γ := sparseCurve J p γ) (p := sparseAnchor J p) (x := atHeight (p 0) 0) hzero + (by rw [sparseAnchor_zero]) hcuts + (fun i _ => (sparseCurve_endpoints hJ p γ cuts hstart hfinish i).1) + (fun i _ => (sparseCurve_endpoints hJ p γ cuts hstart hfinish i).2) + (fun i _ => sparseCurve_continuousOn hJ p γ cuts hc i) + (fun i hi s hs => sparseCurve_ode hJ p γ cuts (planarSlice H) hd i s hs + (fun hne => hz i hi hne s hs)) + (fun i _ s hs => unitSpatialClock_one (hS (hcurve i s ⟨hs.1, hs.2.le⟩))) + constructor + · have he := h.1 N le_rfl + rw [hone, sparseAnchor_after_last J p hn] at he + exact he + · exact suspension_chain_mem hN hzero hone hcuts h.2 (fun i _ s hs => hcurve i s hs) + +end ForcedComputation.PlanarRouting + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SpatialSuspension.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SpatialSuspension.lean new file mode 100644 index 0000000000000000000000000000000000000000..5434dde6edf0b84a613e2bf61da99743be636527 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SpatialSuspension.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.AutonomousStartup +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.StageFlow + +namespace OAI + +/-! The spatial-clock part of the eventually stationary construction. The +clock needs unit speed only along the selected planar trajectory. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff NNReal + +def spatialSuspension (V : ℝ → Plane → Plane) (g : Plane → ℝ) (x : Space) : Space := + atHeight (V (x 2) (horizontal x)) (g (horizontal x)) + +theorem spatialSuspension_smooth {V : ℝ → Plane → Plane} {g : Plane → ℝ} + (hV : ContDiff ℝ ∞ (Function.uncurry V)) (hg : ContDiff ℝ ∞ g) : + ContDiff ℝ ∞ (spatialSuspension V g) := by + have hh : ContDiff ℝ ∞ horizontal := by + have he : (selectTwo 0 1 : Space → Plane) = horizontal := funext selectTwo_zero_one + rw [← he] + exact (selectTwo 0 1).contDiff + have hv : ContDiff ℝ ∞ (fun x : Space => V (x 2) (horizontal x)) := + hV.comp ((contDiff_apply ℝ ℝ (2 : Fin 3)).prodMk hh) + apply contDiff_pi.mpr + intro j + fin_cases j + · exact (contDiff_apply ℝ ℝ (0 : Fin 2)).comp hv + · exact (contDiff_apply ℝ ℝ (1 : Fin 2)).comp hv + · exact hg.comp hh + +theorem spatialSuspension_periodic {V : ℝ → Plane → Plane} {g : Plane → ℝ} + (hVt : ∀ (t : ℝ) (x : Plane) (n : ℤ), V (t + n) x = V t x) + (hVx : ∀ t x (n : Fin 2 → ℤ), V t (x + fun j => (n j : ℝ)) = V t x) + (hg : ∀ x (n : Fin 2 → ℤ), g (x + fun j => (n j : ℝ)) = g x) : + ∀ x n, spatialSuspension V g (x + latticeVector 1 n) = spatialSuspension V g x := by + intro x n + have hh : horizontal (x + latticeVector 1 n) = + horizontal x + fun j => (n j.castSucc : ℝ) := by + ext j + fin_cases j <;> simp [horizontal, latticeVector] + have hz : (x + latticeVector 1 n) 2 = x 2 + (n 2 : ℝ) := by + simp [latticeVector] + simp only [spatialSuspension, hh, hz, hVt, hVx, hg] + +def suspensionPath (ψ : ℝ → Plane) (s : ℝ) : Space := atHeight (ψ s) s + +theorem suspensionPath_hasDerivAt {ψ : ℝ → Plane} {V : ℝ → Plane → Plane} + {g : Plane → ℝ} {s : ℝ} + (hψ : HasDerivAt ψ (V s (ψ s)) s) (hg : g (ψ s) = 1) : + HasDerivAt (suspensionPath ψ) + (spatialSuspension V g (suspensionPath ψ s)) s := by + have he : spatialSuspension V g (suspensionPath ψ s) = atHeight (V s (ψ s)) 1 := by + have hh (X : Plane) (z : ℝ) : horizontal (atHeight X z) = X := by + funext j + fin_cases j <;> rfl + simp only [spatialSuspension, suspensionPath, hh] + change atHeight (V s (ψ s)) (g (ψ s)) = _ + rw [hg] + rw [he] + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · exact (hasDerivAt_pi.mp hψ) 0 + · exact (hasDerivAt_pi.mp hψ) 1 + · exact hasDerivAt_id s + +theorem spatialSuspension_tracks {V : ℝ → Plane → Plane} {g : Plane → ℝ} + {ψ : ℝ → Plane} {p : Plane} {Φ : ℝ → Space → Space} {K : ℝ≥0} + (hψ : ∀ s, HasDerivAt ψ (V s (ψ s)) s) (hp : ψ 0 = p) + (hg : ∀ s, 0 ≤ s → g (ψ s) = 1) + (hK : LipschitzWith K (spatialSuspension V g)) + (hΦ : IsMaterialFlow 1 (fun y => spatialSuspension V g y.2) Φ) + {s : ℝ} (hs : 0 ≤ s) : Φ s (atHeight p 0) = suspensionPath ψ s := by + have hc : Continuous (suspensionPath ψ) := by + have hcψ : Continuous ψ := continuous_iff_continuousAt.mpr (fun t => (hψ t).continuousAt) + apply continuous_pi + intro j + fin_cases j + · change Continuous (fun s => ψ s 0) + exact (continuous_apply 0).comp hcψ + · change Continuous (fun s => ψ s 1) + exact (continuous_apply 1).comp hcψ + · exact continuous_id + have he : suspensionPath ψ 0 = Φ 0 (atHeight p 0) := by + simp [suspensionPath, hp, hΦ.initial] + exact hΦ.eqOn_of_candidate (fun _ => hK) (atHeight p 0) (suspensionPath ψ) + hc.continuousOn he + (fun t ht => suspensionPath_hasDerivAt (hψ t) (hg t ht.1)) ⟨hs, le_rfl⟩ + +theorem spatialSuspension_observation {V : ℝ → Plane → Plane} {g : Plane → ℝ} + {ψ : ℝ → Plane} {p : Plane} {Φ : ℝ → Space → Space} {K : ℝ≥0} + (hψ : ∀ s, HasDerivAt ψ (V s (ψ s)) s) (hp : ψ 0 = p) + (hg : ∀ s, 0 ≤ s → g (ψ s) = 1) + (hK : LipschitzWith K (spatialSuspension V g)) + (hΦ : IsMaterialFlow 1 (fun y => spatialSuspension V g y.2) Φ) + (a b : ℝ) : + (∃ s : ℝ, 0 ≤ s ∧ a < Φ s (atHeight p 0) 1 ∧ Φ s (atHeight p 0) 1 < b) ↔ + ∃ s : ℝ, 0 ≤ s ∧ a < ψ s 1 ∧ ψ s 1 < b := by + have he (s : ℝ) (hs : 0 ≤ s) : Φ s (atHeight p 0) 1 = ψ s 1 := by + rw [spatialSuspension_tracks hψ hp hg hK hΦ hs] + rfl + constructor <;> rintro ⟨s, hs, hlow, hupp⟩ + · exact ⟨s, hs, by simpa only [he s hs] using hlow, + by simpa only [he s hs] using hupp⟩ + · exact ⟨s, hs, by simpa only [he s hs] using hlow, + by simpa only [he s hs] using hupp⟩ + +/-- An individual finite processor segment can be lifted without making any +claim about the planar trajectory after that segment. -/ +theorem spatialSuspension_tracks_interval {V : ℝ → Plane → Plane} {g : Plane → ℝ} + {ψ : ℝ → Plane} {Φ : ℝ → Space → Space} {K : ℝ≥0} {a b : ℝ} (x : Space) + (hc : ContinuousOn (suspensionPath ψ) (Icc a b)) + (hp : suspensionPath ψ a = Φ a x) + (hψ : ∀ s ∈ Ico a b, HasDerivAt ψ (V s (ψ s)) s) + (hg : ∀ s ∈ Ico a b, g (ψ s) = 1) + (hK : LipschitzWith K (spatialSuspension V g)) + (hΦ : IsMaterialFlow 1 (fun y => spatialSuspension V g y.2) Φ) : + EqOn (fun s => Φ s x) (suspensionPath ψ) (Icc a b) := by + apply hΦ.eqOn_of_candidate (fun _ => hK) x (suspensionPath ψ) hc hp + intro s hs + exact suspensionPath_hasDerivAt (hψ s hs) (hg s hs) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionConcatenation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionConcatenation.lean new file mode 100644 index 0000000000000000000000000000000000000000..05de6ba896c18f0e24a9a3edfc20bdc23a8bb0b1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionConcatenation.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSuspensionBridge + +namespace OAI + +/-! Finite concatenation of exact planar pulse curves. Local ODE identities +and matching endpoints determine the actual autonomous fluid trajectory. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set + +theorem continuousOn_suspensionPath {γ : ℝ → Plane} {S : Set ℝ} + (hγ : ContinuousOn γ S) : ContinuousOn (suspensionPath γ) S := by + apply continuousOn_pi.mpr + intro j + fin_cases j + · change ContinuousOn (fun t => γ t 0) S + exact (continuous_apply 0).comp_continuousOn hγ + · change ContinuousOn (fun t => γ t 1) S + exact (continuous_apply 1).comp_continuousOn hγ + · change ContinuousOn (fun t : ℝ => t) S + exact continuousOn_id + +theorem suspension_chain {H : FieldExpr} (hH : H.Valid) + (hP : CubePeriodic 1 (SpatialExpression.spatialValue H)) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ) + {N : ℕ} {cuts : ℕ → ℝ} {γ : ℕ → ℝ → Plane} {p : ℕ → Plane} {x : Space} + (hzero : cuts 0 = 0) (hx : x = atHeight (p 0) 0) + (hcuts : ∀ i < N, cuts i ≤ cuts (i + 1)) + (hstart : ∀ i < N, γ i (cuts i) = p i) + (hend : ∀ i < N, γ i (cuts (i + 1)) = p (i + 1)) + (hc : ∀ i < N, ContinuousOn (γ i) (Icc (cuts i) (cuts (i + 1)))) + (hd : ∀ i < N, ∀ s ∈ Ico (cuts i) (cuts (i + 1)), + HasDerivAt (γ i) (PlanarHamiltonian.field + (fun Y => SpatialExpression.spatialValue H (atHeight Y s)) (γ i s)) s) + (hg : ∀ i < N, ∀ s ∈ Ico (cuts i) (cuts (i + 1)), unitSpatialClock (γ i s) = 1) : + (∀ i ≤ N, Φ (cuts i) x = atHeight (p i) (cuts i)) ∧ + (∀ i < N, EqOn (fun s => Φ s x) (suspensionPath (γ i)) + (Icc (cuts i) (cuts (i + 1)))) := by + have ha : ∀ i ≤ N, Φ (cuts i) x = atHeight (p i) (cuts i) := by + intro i + induction i with + | zero => + intro _ + rw [hzero, hΦ.initial, hx] + | succ i ih => + intro hi + have hi' : i < N := Nat.lt_of_lt_of_le (Nat.lt_succ_self i) hi + have he := suspensionField_tracks_interval hH hP x + (continuousOn_suspensionPath (hc i hi')) + (by change atHeight (γ i (cuts i)) (cuts i) = Φ (cuts i) x + rw [hstart i hi', ih (Nat.le_of_lt hi')]) + (hd i hi') (hg i hi') hΦ + have hh := he ⟨hcuts i hi', le_rfl⟩ + simpa only [suspensionPath, hend i hi', Nat.succ_eq_add_one] using hh + refine ⟨ha, ?_⟩ + intro i hi + exact suspensionField_tracks_interval hH hP x + (continuousOn_suspensionPath (hc i hi)) + (by change atHeight (γ i (cuts i)) (cuts i) = Φ (cuts i) x + rw [hstart i hi, ha i (Nat.le_of_lt hi)]) (hd i hi) (hg i hi) hΦ + +theorem finite_cuts_cover (n : ℕ) (cuts : ℕ → ℝ) + (hcuts : ∀ i < n + 1, cuts i ≤ cuts (i + 1)) {s : ℝ} + (hs : s ∈ Icc (cuts 0) (cuts (n + 1))) : + ∃ i < n + 1, s ∈ Icc (cuts i) (cuts (i + 1)) := by + induction n with + | zero => exact ⟨0, by omega, hs⟩ + | succ n ih => + by_cases hsn : s ≤ cuts (n + 1) + · obtain ⟨i, hi, his⟩ := ih (fun i hi => hcuts i (by omega)) ⟨hs.1, hsn⟩ + exact ⟨i, by omega, his⟩ + · exact ⟨n + 1, by omega, ⟨(lt_of_not_ge hsn).le, hs.2⟩⟩ + +theorem suspension_chain_mem {N : ℕ} (hN : 0 < N) {cuts : ℕ → ℝ} + (hzero : cuts 0 = 0) (hone : cuts N = 1) + (hcuts : ∀ i < N, cuts i ≤ cuts (i + 1)) + {γ : ℕ → ℝ → Plane} {Φ : ℝ → Space → Space} {x : Space} {S : Set Plane} + (he : ∀ i < N, EqOn (fun s => Φ s x) (suspensionPath (γ i)) + (Icc (cuts i) (cuts (i + 1)))) + (hmem : ∀ i < N, ∀ s ∈ Icc (cuts i) (cuts (i + 1)), γ i s ∈ S) : + ∀ s ∈ Icc (0 : ℝ) 1, horizontal (Φ s x) ∈ S := by + intro s hs + cases N with + | zero => omega + | succ n => + obtain ⟨i, hi, his⟩ := finite_cuts_cover n cuts hcuts + (by simpa only [hzero, hone] using hs) + have hes : Φ s x = suspensionPath (γ i) s := he i hi his + rw [hes] + simpa only [suspensionPath, atHeight_horizontal] using hmem i hi s his + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..32c59125e3f80d8b41ed85b21fdcd100eb3565aa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionExpressions.lean @@ -0,0 +1,178 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionPotentials +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.UnitSpatialClock + +namespace OAI + +/-! A finite Hamiltonian expression gives an autonomous finite velocity +expression after adding the fixed spatial clock. -/ + +namespace ForcedComputation +open ShearFlows MeasureTheory +open scoped ContDiff BigOperators + +namespace SpatialExpression + +def NoTime : FieldExpr → Prop := + letI := ShearFlows.neZeroFour + FieldExpr.rec (fun _ => True) (fun j _ => j ≠ 0) + (fun _ _ hf hg => hf ∧ hg) (fun _ _ hf hg => hf ∧ hg) + +def UnitPeriods : FieldExpr → Prop := + FieldExpr.rec (fun _ => True) (fun _ p => p.period = 1) + (fun _ _ hf hg => hf ∧ hg) (fun _ _ hf hg => hf ∧ hg) + +theorem noTime_diff {e : FieldExpr} (he : NoTime e) (j : Fin 4) : NoTime (e.diff j) := by + induction e with + | const _ => trivial + | atom i p => + by_cases hij : i = j + · simpa only [FieldExpr.diff, hij, ite_true, NoTime] using he + · simp only [FieldExpr.diff, hij, ite_false, NoTime] + | add f g hf hg => exact ⟨hf he.1, hg he.2⟩ + | mul f g hf hg => exact ⟨⟨hf he.1, he.2⟩, ⟨he.1, hg he.2⟩⟩ + +noncomputable def spatialValue (e : FieldExpr) (x : Space) : ℝ := e.val (0, x) + +theorem unitPeriods_periodic {e : FieldExpr} (he : UnitPeriods e) : + CubePeriodic 1 (spatialValue e) := by + intro x n + induction e with + | const _ => rfl + | atom j p => + change p.period = 1 at he + have hp (s : ℝ) (k : ℤ) : p.val (s + k) = p.val s := by + have h := (periodize_periodic (1 : ℝ) p.body.val).int_mul k s + simpa only [PeriodicExpr.val, he, Rat.cast_one, mul_one] using h + fin_cases j + · rfl + · change p.val ((x + latticeVector 1 n) 0) = p.val (x 0) + simpa only [latticeVector, Pi.add_apply, one_mul] using hp (x 0) (n 0) + · change p.val ((x + latticeVector 1 n) 1) = p.val (x 1) + simpa only [latticeVector, Pi.add_apply, one_mul] using hp (x 1) (n 1) + · change p.val ((x + latticeVector 1 n) 2) = p.val (x 2) + simpa only [latticeVector, Pi.add_apply, one_mul] using hp (x 2) (n 2) + | add f g hf hg => exact congrArg₂ (· + ·) (hf he.1) (hg he.2) + | mul f g hf hg => exact congrArg₂ (· * ·) (hf he.1) (hg he.2) + +theorem noTime_val {e : FieldExpr} (he : NoTime e) (y : SpaceTime) : + e.val y = spatialValue e y.2 := by + induction e with + | const _ => rfl + | atom j p => + obtain ⟨j, rfl⟩ := Fin.eq_succ_of_ne_zero he + rfl + | add f g hf hg => exact congrArg₂ (· + ·) (hf he.1) (hg he.2) + | mul f g hf hg => exact congrArg₂ (· * ·) (hf he.1) (hg he.2) + +theorem spatialValue_smooth {e : FieldExpr} (he : e.Valid) : + ContDiff ℝ ∞ (spatialValue e) := + (FieldExpr.smooth he).comp (contDiff_const.prodMk contDiff_id) + +theorem spatialValue_diff {e : FieldExpr} (he : e.Valid) (ht : NoTime e) + (j : Fin 3) (y : SpaceTime) : + (e.diff j.succ).val y = scalarD j (spatialValue e) y.2 := by + rw [FieldExpr.val_diff he] + have hv : e.val = fun z => spatialValue e z.2 := funext (noTime_val ht) + have hd := ((spatialValue_smooth he).differentiable (by simp) y.2).hasFDerivAt.comp y + (ContinuousLinearMap.snd ℝ ℝ Space).hasFDerivAt + rw [hv] + change fderiv ℝ (spatialValue e ∘ Prod.snd) y (spaceTimeDirection j.succ) = _ + rw [hd.fderiv] + rfl + +def suspensionCode (e : FieldExpr) : VelocityExpr := + letI := ShearFlows.neZeroFour + ![e.diff 2, .mul (.const (-1)) (e.diff 1), unitSpatialClockExpr] + +theorem suspensionCode_valid {e : FieldExpr} (he : e.Valid) : (suspensionCode e).Valid := by + intro j + fin_cases j + · exact FieldExpr.valid_diff he 2 + · exact ⟨trivial, FieldExpr.valid_diff he 1⟩ + · exact unitSpatialClockExpr_valid + +theorem suspensionCode_noTime {e : FieldExpr} (ht : NoTime e) (j : Fin 3) : + NoTime (suspensionCode e j) := by + fin_cases j + · exact noTime_diff ht 2 + · exact ⟨trivial, noTime_diff ht 1⟩ + · change (1 : Fin 4) ≠ 0 ∧ (2 : Fin 4) ≠ 0 + decide + +noncomputable def suspensionField (e : FieldExpr) (x : Space) : Space := + letI := ShearFlows.neZeroThree + ![scalarD 1 (spatialValue e) x, -scalarD 0 (spatialValue e) x, + unitSpatialClock (horizontal x)] + +theorem suspensionCode_val {e : FieldExpr} (he : e.Valid) (ht : NoTime e) : + (suspensionCode e).val = fun y => suspensionField e y.2 := by + funext y j + fin_cases j + · exact spatialValue_diff he ht 1 y + · change ((-1 : ℚ) : ℝ) * (e.diff 1).val y = -scalarD 0 (spatialValue e) y.2 + norm_num only [Rat.cast_neg, Rat.cast_one, neg_one_mul] + exact congrArg Neg.neg (spatialValue_diff he ht 0 y) + · exact unitSpatialClockExpr_val y + +theorem suspensionField_eq (e : FieldExpr) : + suspensionField e = potentialSuspension (spatialValue e) (fun _ => 0) + verticalClock := by + funext x j + fin_cases j <;> simp [suspensionField, potentialSuspension, verticalClock, scalarD, basis] + +theorem suspensionField_smooth {e : FieldExpr} (he : e.Valid) : + ContDiff ℝ ∞ (suspensionField e) := by + rw [suspensionField_eq] + exact (potentialSuspension_smooth (spatialValue_smooth he) contDiff_const).add verticalClock_smooth + +theorem suspensionField_divergence {e : FieldExpr} (he : e.Valid) (x : Space) : + divergence (suspensionField e) x = 0 := by + have hs := potentialSuspension_smooth (spatialValue_smooth he) + (show ContDiff ℝ ∞ (fun _ : Space => (0 : ℝ)) from contDiff_const) + have hz : scalarD 2 (fun _ : Space => (0 : ℝ)) = 0 := by + funext y + simp [scalarD] + have hd := potentialSuspension_divergence (spatialValue_smooth he) contDiff_const hz x + rw [suspensionField_eq] + unfold divergence derivative + simp_rw [fderiv_add (hs.differentiable (by simp) x) + (verticalClock_smooth.differentiable (by simp) x), add_apply, Pi.add_apply] + rw [Finset.sum_add_distrib] + change divergence (potentialSuspension (spatialValue e) (fun _ => 0)) x + + divergence verticalClock x = 0 + rw [hd, verticalClock_divergence, add_zero] + +theorem suspensionField_mean_zero {e : FieldExpr} (he : e.Valid) + (hp : CubePeriodic 1 (spatialValue e)) : + (∫ x in fundamentalCube 1, suspensionField e x) = 0 := by + have hs := potentialSuspension_smooth (spatialValue_smooth he) + (show ContDiff ℝ ∞ (fun _ : Space => (0 : ℝ)) from contDiff_const) + rw [suspensionField_eq] + change (∫ x in fundamentalCube 1, + potentialSuspension (spatialValue e) (fun _ => 0) x + verticalClock x) = 0 + have hi : IntegrableOn (potentialSuspension (spatialValue e) (fun _ => 0)) (fundamentalCube 1) := + hs.continuous.integrableOn_Icc + have hj : IntegrableOn verticalClock (fundamentalCube 1) := verticalClock_smooth.continuous.integrableOn_Icc + rw [integral_add hi hj, + potentialSuspension_mean_zero (by norm_num : (0 : ℝ) ≤ 1) + (spatialValue_smooth he) contDiff_const hp (fun _ _ => rfl), + verticalClock_mean_zero, add_zero] + +theorem suspensionField_periodic {e : FieldExpr} (he : e.Valid) + (hp : CubePeriodic 1 (spatialValue e)) : CubePeriodic 1 (suspensionField e) := by + have hH := potentialSuspension_periodic (spatialValue_smooth he) + (show ContDiff ℝ ∞ (fun _ : Space => (0 : ℝ)) from contDiff_const) hp (fun _ _ => rfl) + have hV : CubePeriodic 1 verticalClock := by + intro x n + have hh : horizontal (x + latticeVector 1 n) = + horizontal x + fun j => (n j.castSucc : ℝ) := by + ext j + fin_cases j <;> simp [horizontal, latticeVector] + simp only [verticalClock, hh, unitSpatialClock_periodic] + intro x n + rw [suspensionField_eq] + exact congrArg₂ (· + ·) (hH x n) (hV x n) + +end SpatialExpression +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionIteration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..0096d46ce7c2d8d4e54261f2dd4eeda1f4df20b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionIteration.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderFlow +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionExpressions + +namespace OAI + +/-! Iterating a spatial suspension: a completed processor period advances +the vertical lift by one while implementing the next recorder step. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows + +def verticalInteger (n : ℤ) : Fin 3 → ℤ := ![0, 0, n] + +theorem atHeight_add_verticalInteger (p : Plane) (z : ℝ) (n : ℤ) : + atHeight p (z + n) = atHeight p z + latticeVector 1 (verticalInteger n) := by + funext j + fin_cases j <;> simp [atHeight, latticeVector, verticalInteger] + +theorem suspension_one_at_integer {W : Space → Space} {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => W y.2) Φ) {p q : Plane} + (hstep : Φ 1 (atHeight p 0) = atHeight q 1) (n : ℕ) : + Φ 1 (atHeight p (n : ℝ)) = atHeight q ((n : ℝ) + 1) := by + have hp : atHeight p (n : ℝ) = + atHeight p 0 + latticeVector 1 (verticalInteger (n : ℤ)) := by + simpa only [Int.cast_natCast, zero_add] using atHeight_add_verticalInteger p 0 (n : ℤ) + have hq : atHeight q ((n : ℝ) + 1) = + atHeight q 1 + latticeVector 1 (verticalInteger (n : ℤ)) := by + simpa only [Int.cast_natCast, add_comm] using atHeight_add_verticalInteger q 1 (n : ℤ) + rw [hp, hΦ.equivariant, hstep, hq] + +theorem suspension_recorder_steps {Q A : Type*} [DecidableEq Q] [DecidableEq A] + {M : Recorder.Machine Q A} {W : Space → Space} {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => W y.2) Φ) + (code : Recorder.Configuration Q A → Plane) + (hone : ∀ {C D}, Recorder.Step M C D → + Φ 1 (atHeight (code C) 0) = atHeight (code D) 1) + {C D : Recorder.Configuration Q A} {n : ℕ} (h : Recorder.Steps M n C D) : + Φ n (atHeight (code C) 0) = atHeight (code D) n := by + induction h with + | zero C => simpa only [Nat.cast_zero] using hΦ.initial (atHeight (code C) 0) + | @next n C D E h hs ih => + rw [Nat.cast_add, Nat.cast_one, add_comm, + hΦ.nat_shift (show TimePeriodic (fun y => W y.2) from fun _ _ => rfl) n 1, ih] + simpa only [add_comm] using suspension_one_at_integer hΦ (hone hs) n + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3aaabcc6f5d045746e34a294d6a0048719d2516a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionObservation.lean @@ -0,0 +1,131 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionIteration +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarInitialShift + +namespace OAI + +/-! The observation argument for the autonomous suspension. The finite +processor supplies one-period branch trajectories, whose all-time +consequence is proved for the actual material flow. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set Radix + +def stationaryObserver : Set Space := + letI := ShearFlows.neZeroThree + letI := ShearFlows.thirtyTwoAtLeastTwo + letI := ShearFlows.eightAtLeastTwo + {x | 1 / 32 < x 1 ∧ x 1 < 1 / 8} + +def stationaryStartingPoint : Space := + letI := ShearFlows.fourAtLeastTwo + ![1 / 4, 1 / 4, 0] + +namespace Recorder.Planar + +theorem shifted_suspension_observation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (δ : Fin 2 → ℚ) (hδ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {W : Space → Space} {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => W y.2) Φ) + (hone : ∀ {C D : Configuration (State I.1) (Alphabet I.1)}, + Step (finiteMachine I.1 hI.1) C D → + Φ 1 (atHeight (shiftPoint δ (point I.1 hI.1 C)) 0) = + atHeight (shiftPoint δ (point I.1 hI.1 D)) 1) + (hsafe : ∀ {C D : Configuration (State I.1) (Alphabet I.1)}, + Step (finiteMachine I.1 hI.1) C D → + recorderHalting I.1 C.control = false → recorderHalting I.1 D.control = false → + ∀ s ∈ Icc (0 : ℝ) 1, + 3 / 16 ≤ Φ s (atHeight (shiftPoint δ (point I.1 hI.1 C)) 0) 1) : + Reaches (fun t => Φ t + (atHeight (shiftPoint δ (point I.1 hI.1 (finiteInitializedRecorder I hI))) 0)) + stationaryObserver ↔ Alternating.Halts I := by + let C₀ := finiteInitializedRecorder I hI + let code : Configuration (State I.1) (Alphabet I.1) → Plane := + fun C => shiftPoint δ (point I.1 hI.1 C) + have hperiod : TimePeriodic (fun y => W y.2) := fun _ _ => rfl + constructor + · rintro ⟨t, ht, hobs⟩ + by_contra hno + have hn (n : ℕ) : (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt I hI n) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) n).state.val = (Alternating.configurationAt I n).state at he + change I.1.isHalting _ = false + rw [he] + cases hh : I.1.isHalting (Alternating.configurationAt I n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + have hs (n : ℕ) : Steps (finiteMachine I.1 hI.1) n C₀ + (run (finiteMachine I.1 hI.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine I.1 hI.1) + (run (finiteMachine I.1 hI.1) C₀ n) (run (finiteMachine I.1 hI.1) C₀ (n + 1)) := + run_step_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting I.1 + (run (finiteMachine I.1 hI.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State I.1) (Alphabet I.1)) : + haltingControl (finiteMachine I.1 hI.1) q = recorderHalting I.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hseg := hsafe (hnext n) (hcontrol n) (hcontrol (n + 1)) + (t - (n : ℝ)) (show t - (n : ℝ) ∈ Icc (0 : ℝ) 1 by constructor <;> linarith) + have he := suspension_recorder_steps hΦ code hone (hs n) + have hlift : atHeight (code (run (finiteMachine I.1 hI.1) C₀ n)) (n : ℝ) = + atHeight (code (run (finiteMachine I.1 hI.1) C₀ n)) 0 + + latticeVector 1 (verticalInteger (n : ℤ)) := by + simpa only [Int.cast_natCast, zero_add] using + atHeight_add_verticalInteger (code (run (finiteMachine I.1 hI.1) C₀ n)) 0 (n : ℤ) + have htime : t = (t - (n : ℝ)) + (n : ℝ) := by ring + change 1 / 32 < Φ t (atHeight (code C₀) 0) 1 ∧ + Φ t (atHeight (code C₀) 0) 1 < 1 / 8 at hobs + rw [htime, hΦ.nat_shift hperiod n, he, hlift, hΦ.equivariant] at hobs + have hv : latticeVector 1 (verticalInteger (n : ℤ)) 1 = 0 := by + simp [latticeVector, verticalInteger] + simp only [Pi.add_apply, hv, add_zero] at hobs + linarith [hobs.2] + · intro hhalt + obtain ⟨n, C, q, hs, hc, hh⟩ := (finite_recorder_halts_iff I hI).mpr hhalt + have he := suspension_recorder_steps hΦ code hone hs + have hob := (shifted_point_observer_iff I.1 hI.1 C δ hδ).mpr + (by simpa only [hc, recorderHalting] using hh) + refine ⟨n, Nat.cast_nonneg _, ?_⟩ + change Φ n (atHeight (code C₀) 0) ∈ stationaryObserver + rw [he] + exact hob + +theorem normalized_suspension_observation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {W : Space → Space} {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => W y.2) Φ) + (hone : ∀ {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))}, + Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D → + Φ 1 (atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) 0) = + atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 D)) 1) + (hsafe : ∀ {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))}, + Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D → + recorderHalting (freshMachine I.1) C.control = false → + recorderHalting (freshMachine I.1) D.control = false → ∀ s ∈ Icc (0 : ℝ) 1, + 3 / 16 ≤ Φ s (atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) 0) 1) : + Reaches (fun t => Φ t stationaryStartingPoint) stationaryObserver ↔ Alternating.Halts I := by + have hb := initialShift_small (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI) + have h := (shifted_suspension_observation (freshInput I) (freshInput_valid hI) + (initialShift (freshInput I) (freshInput_valid hI)) hb.2 hΦ hone hsafe).trans + (freshInput_halts_iff hI) + rw [initialShift_spec] at h + exact h + +end Recorder.Planar +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPerturbations.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPerturbations.lean new file mode 100644 index 0000000000000000000000000000000000000000..37cb6ee9a9526410ba4b4540f3a25ca5b484c8e2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPerturbations.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSuspensionBridge +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EffectiveInterface + +namespace OAI + +/-! An explicit integer Lipschitz bound for the finite suspension formula and +the resulting quantitative stability of its actual material trajectories. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped NNReal + +def suspensionLipschitzBound (H : FieldExpr) : ℕ := + (SpatialExpression.suspensionCode H).modulusBound [] + +theorem suspensionField_lipschitz {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) : + LipschitzWith (suspensionLipschitzBound H : ℝ≥0) + (SpatialExpression.suspensionField H) := by + apply LipschitzWith.of_dist_le_mul + intro x y + have hb := VelocityExpr.lipschitz_bound (SpatialExpression.suspensionCode_valid hH) + [] (0, x) (0, y) + rw [SpatialExpression.suspensionCode_val hH hT] at hb + simpa only [mixedDerivative, suspensionLipschitzBound, Prod.mk_sub_mk, sub_self, + Prod.norm_mk, norm_zero, max_eq_right (norm_nonneg _), dist_eq_norm, + NNReal.coe_natCast] using hb + +theorem suspension_flow_perturbation {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ) + (x y : Space) {a t : ℝ} (hat : a ≤ t) : + dist (Φ t x) (Φ t y) ≤ dist (Φ a x) (Φ a y) * + Real.exp ((suspensionLipschitzBound H : ℝ) * (t - a)) := by + have hx : Continuous (fun s => Φ s x) := + continuous_iff_continuousAt.mpr (fun s => (hΦ.ode s x).continuousAt) + have hy : Continuous (fun s => Φ s y) := + continuous_iff_continuousAt.mpr (fun s => (hΦ.ode s y).continuousAt) + exact dist_le_of_trajectories_ODE (fun _ => suspensionField_lipschitz hH hT) + hx.continuousOn (fun s _ => (hΦ.ode s x).hasDerivWithinAt) + hy.continuousOn (fun s _ => (hΦ.ode s y).hasDerivWithinAt) + le_rfl t ⟨hat, le_rfl⟩ + +theorem suspension_flow_from_zero {H : FieldExpr} (hH : H.Valid) + (hT : SpatialExpression.NoTime H) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => SpatialExpression.suspensionField H y.2) Φ) + (x y : Space) {t : ℝ} (ht : 0 ≤ t) : + dist (Φ t x) (Φ t y) ≤ dist x y * + Real.exp ((suspensionLipschitzBound H : ℝ) * t) := by + simpa only [hΦ.initial, sub_zero] using suspension_flow_perturbation hH hT hΦ x y ht + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPotentials.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPotentials.lean new file mode 100644 index 0000000000000000000000000000000000000000..837433da461e0c45e09a91ff77c1b7ce7af2dcdb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/SuspensionPotentials.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ForceMean + +namespace OAI + +/-! Derivative potentials for the autonomous spatial clock. The horizontal +Hamiltonian and the vertical clock have zero spatial average separately. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set MeasureTheory Filter +open scoped ContDiff Topology + +def scalarD (j : Fin 3) (H : Space → ℝ) (x : Space) : ℝ := + fderiv ℝ H x (basis j) + +theorem scalarD_smooth (j : Fin 3) {H : Space → ℝ} (hH : ContDiff ℝ ∞ H) : + ContDiff ℝ ∞ (scalarD j H) := + (hH.fderiv_right (by simp)).clm_apply contDiff_const + +theorem scalarD_comm (i j : Fin 3) {H : Space → ℝ} (hH : ContDiff ℝ ∞ H) : + scalarD i (scalarD j H) = scalarD j (scalarD i H) := by + funext x + unfold scalarD + rw [fderiv_eval_direction hH, fderiv_eval_direction hH] + exact hH.contDiffAt.isSymmSndFDerivAt (by simp) _ _ + +def potentialSuspension (H G : Space → ℝ) (x : Space) : Space := + letI := ShearFlows.neZeroThree + ![scalarD 1 H x, -scalarD 0 H x, scalarD 0 G x] + +theorem potentialSuspension_smooth {H G : Space → ℝ} + (hH : ContDiff ℝ ∞ H) (hG : ContDiff ℝ ∞ G) : + ContDiff ℝ ∞ (potentialSuspension H G) := by + apply contDiff_pi.mpr + intro j + fin_cases j + · exact scalarD_smooth 1 hH + · exact (scalarD_smooth 0 hH).neg + · exact scalarD_smooth 0 hG + +theorem potentialSuspension_divergence {H G : Space → ℝ} + (hH : ContDiff ℝ ∞ H) (hG : ContDiff ℝ ∞ G) + (hGz : scalarD 2 G = 0) (x : Space) : + divergence (potentialSuspension H G) x = 0 := by + have hs := (potentialSuspension_smooth hH hG).differentiable (by simp) + have hc (j : Fin 3) : derivative (potentialSuspension H G) j x j = + fderiv ℝ (fun y => potentialSuspension H G y j) x (basis j) := + (fderiv_coordinate hs x (basis j) j).symm + simp only [divergence, Fin.sum_univ_three, hc, potentialSuspension, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two] + change scalarD 0 (scalarD 1 H) x + + fderiv ℝ (-scalarD 0 H) x (basis 1) + + scalarD 2 (scalarD 0 G) x = 0 + rw [fderiv_neg] + change scalarD 0 (scalarD 1 H) x - scalarD 1 (scalarD 0 H) x + + scalarD 2 (scalarD 0 G) x = 0 + rw [scalarD_comm 0 1 hH, scalarD_comm 2 0 hG, hGz] + simp [scalarD] + +theorem potentialSuspension_periodic {L : ℝ} {H G : Space → ℝ} + (hH : ContDiff ℝ ∞ H) (hG : ContDiff ℝ ∞ G) + (hpH : CubePeriodic L H) (hpG : CubePeriodic L G) : + CubePeriodic L (potentialSuspension H G) := by + have hh := hpH.fderiv (hH.differentiable (by simp)) + have hg := hpG.fderiv (hG.differentiable (by simp)) + intro x n + simp only [potentialSuspension, scalarD, hh x n, hg x n] + +theorem potentialSuspension_mean_zero {L : ℝ} (hL : 0 ≤ L) {H G : Space → ℝ} + (hH : ContDiff ℝ ∞ H) (hG : ContDiff ℝ ∞ G) + (hpH : CubePeriodic L H) (hpG : CubePeriodic L G) : + (∫ x in fundamentalCube L, potentialSuspension H G x) = 0 := by + have hi : IntegrableOn (potentialSuspension H G) (fundamentalCube L) := + (potentialSuspension_smooth hH hG).continuous.integrableOn_Icc + ext j + change (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ) + (∫ x in fundamentalCube L, potentialSuspension H G x) = 0 + rw [← (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ).integral_comp_comm hi] + change (∫ x in fundamentalCube L, potentialSuspension H G x j) = 0 + fin_cases j + · exact integral_periodic_derivative hL hH hpH 1 + · change (∫ x in fundamentalCube L, -fderiv ℝ H x (basis 0)) = 0 + rw [integral_neg, integral_periodic_derivative hL hH hpH, neg_zero] + · exact integral_periodic_derivative hL hG hpG 0 + +theorem scalarD_clock_one {G : Space → ℝ} {x : Space} + (hG : G =ᶠ[𝓝 x] fun y => y 0) : scalarD 0 G x = 1 := by + unfold scalarD + rw [hG.fderiv_eq] + rw [(hasFDerivAt_apply (𝕜 := ℝ) 0 x).fderiv] + simp [basis] + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/TorusVariationsDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/TorusVariationsDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..d94a648568f5d3b8ca66078d69bff8ca3c104a26 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/TorusVariationsDischarge.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TorusDetectorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarVariationDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatSolution + +namespace OAI + +/-! The torus velocity main result with both smooth-flow inputs discharged. +The scalar existence and heat-kernel inputs remain explicit. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem torus_velocity_detection_variations_discharged (hE : TorusScalarExistence) (hK : TorusHeatInput) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + : + let H := Recorder.Planar.normalizedHamiltonian I hI + let V := planarSlice H + let C := detectorBumpDerivativeBound + let L := euclideanFlowBound H + let K := PlanarHamiltonian.commonSupport (Recorder.Planar.normalizedPulse I hI) ∪ + injectionSupport + IsCompact K ∧ K ⊆ openUnitPlane ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + ∀ ν : ℝ, 0 < ν → + ContDiff ℝ ∞ (detectorViscosityForce V C L ν) ∧ + SpatiallyPeriodic 1 (detectorViscosityForce V C L ν) ∧ + ContDiff ℝ ∞ (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) ∧ + IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ((∃ t, 0 ≤ t ∧ ∃ x : Space, (1 / 32 : ℝ) < x 1 ∧ x 1 < 1 / 8 ∧ + 1 / 2 < triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) 2) ↔ Alternating.Halts I) ∧ + (∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K → ∀ z, + detectorViscosityForce V C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (detectorViscosityForce V C L ν) α y - + rationalVector (evaluateDetectorViscosityForce H + (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) + (Recorder.Planar.processorVelocity_joint_smooth I hI) + C L α a b ha hb ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (detectorViscosityForce V C L ν) α y‖ ≤ + (detectorViscosityBound H C L α a T : ℝ)) := by + exact torus_velocity_detection hE hK I hI Ω hΩ + (planarTransition_variations (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) hΩ) + (planarTransition_backward_smooth (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) hΩ) + +theorem torus_velocity_detection_scalar (hE : TorusScalarExistence) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ω : ℝ → ℝ → Plane → Plane) + (hΩ : IsPlanarTransition (planarSlice (Recorder.Planar.normalizedHamiltonian I hI)) Ω) + : + let H := Recorder.Planar.normalizedHamiltonian I hI + let V := planarSlice H + let C := detectorBumpDerivativeBound + let L := euclideanFlowBound H + let K := PlanarHamiltonian.commonSupport (Recorder.Planar.normalizedPulse I hI) ∪ + injectionSupport + IsCompact K ∧ K ⊆ openUnitPlane ∧ + ∃ w : ℝ → Plane → ℝ, + ContDiff ℝ ∞ (Function.uncurry w) ∧ (∀ t x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → scalarMass w t ≤ (massBound L : ℝ)) ∧ + ∀ ν : ℝ, 0 < ν → + ContDiff ℝ ∞ (detectorViscosityForce V C L ν) ∧ + SpatiallyPeriodic 1 (detectorViscosityForce V C L ν) ∧ + ContDiff ℝ ∞ (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) ∧ + IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) + (triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w)) (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution 1 ν (detectorViscosityForce V C L ν) u p → + ∀ t, 0 ≤ t → ∀ x, + u (t, x) = triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) ∧ p (t, x) = 0) ∧ + ((∃ t, 0 ≤ t ∧ ∃ x : Space, (1 / 32 : ℝ) < x 1 ∧ x 1 < 1 / 8 ∧ + 1 / 2 < triangularVelocity (viscosityDrift ν (detectorDrift V C L)) + (viscosityScalar ν w) (t, x) 2) ↔ Alternating.Halts I) ∧ + (∀ t x, (∀ j, x j ∈ Icc (0 : ℝ) 1) → x ∉ K → ∀ z, + detectorViscosityForce V C L ν (t, atHeight x z) = 0) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (detectorViscosityForce V C L ν) α y - + rationalVector (evaluateDetectorViscosityForce H + (Recorder.Planar.normalizedHamiltonian_valid I hI) + (Recorder.Planar.normalizedHamiltonian_noTime I hI) + (Recorder.Planar.processorVelocity_joint_smooth I hI) + C L α a b ha hb ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (T : ℚ) (y : SpaceTime), 0 ≤ y.1 → y.1 ≤ (T : ℝ) → + ‖mixedDerivative (detectorViscosityForce V C L ν) α y‖ ≤ + (detectorViscosityBound H C L α a T : ℝ)) := by + exact torus_velocity_detection_variations_discharged hE torusHeatInput I hI Ω hΩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformForceBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformForceBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..84db3b18a4a5dd530a8b822eb8a485d3af6feb1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformForceBounds.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.UniformJetBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGlobalBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneUnitImpulse + +namespace OAI + +/-! Every mixed derivative of the actual whole-plane force is bounded +for all time. The source and the complete drift are prescribed first. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector Recorder Set +open scoped ContDiff BigOperators + +theorem UniformJets.mixed {U : Velocity} (hU : ContDiff ℝ ∞ U) + (hb : UniformJets U) (α : List (Fin 4)) : UniformJets (mixedDerivative U α) := by + induction α with + | nil => exact hb + | cons j α ih => exact ih.directional (mixedDerivative_smooth hU α) (spaceTimeDirection j) + +theorem UniformJets.mixed_bound {U : Velocity} (hU : ContDiff ℝ ∞ U) + (hb : UniformJets U) (α : List (Fin 4)) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ y, ‖mixedDerivative U α y‖ ≤ B := by + obtain ⟨B,hB,hbound⟩ := (hb.mixed hU α) 0 + exact ⟨B,hB,fun y => by simpa only [norm_iteratedFDeriv_zero] using hbound y⟩ + +theorem UniformJets.force {U : Velocity} (hU : ContDiff ℝ ∞ U) + (hb : UniformJets U) (ν : ℝ) : UniformJets (force ν U) := by + have hl : UniformJets (fun y => ∑ j : Fin 3, mixedDerivative U [j.succ,j.succ] y) := + UniformJets.sum (fun j => mixedDerivative_smooth hU _) (fun j => hb.mixed hU _) + have hls : ContDiff ℝ ∞ (fun y => ∑ j : Fin 3, mixedDerivative U [j.succ,j.succ] y) := + ContDiff.sum (fun j _ => mixedDerivative_smooth hU _) + have he : ShearFlows.force ν U = mixedDerivative U [0] - + ν • (fun y => ∑ j : Fin 3, mixedDerivative U [j.succ,j.succ] y) := by + funext y + exact force_eq_mixed hU ν y + rw [he] + exact (hb.mixed hU [0]).sub (mixedDerivative_smooth hU [0]) (hls.const_smul ν) + (hl.const_smul hls ν) + +theorem UniformJets.convection {U : Velocity} (hU : ContDiff ℝ ∞ U) + (hb : UniformJets U) : UniformJets (convectiveField U) := by + have hcoord (j : Fin 3) : UniformJets (fun y => U y j) := + hb.linear_left hU (ContinuousLinearMap.proj j) + have hcoords (j : Fin 3) : ContDiff ℝ ∞ (fun y => U y j) := + (contDiff_apply ℝ ℝ j).comp hU + have he : convectiveField U = fun y => ∑ j : Fin 3, U y j • mixedDerivative U [j.succ] y := + funext (convectiveField_eq_mixed hU) + rw [he] + exact UniformJets.sum + (fun j => (hcoords j).smul (mixedDerivative_smooth hU [j.succ])) + (fun j => (hcoord j).smul (hcoords j) (mixedDerivative_smooth hU [j.succ]) (hb.mixed hU _)) + +theorem UniformJets.residual {U : Velocity} (hU : ContDiff ℝ ∞ U) + (hb : UniformJets U) (ν : ℝ) : UniformJets (residual ν U) := by + rw [residual_eq_force_add] + exact (hb.force hU ν).add (force_smooth hU ν) (convectiveField_smooth hU) (hb.convection hU) + +private def horizontalTimeProjection : SpaceTime →L[ℝ] (ℝ × Plane) := + (ContinuousLinearMap.fst ℝ ℝ Space).prod + (horizontalLinear.comp (ContinuousLinearMap.snd ℝ ℝ Space)) + +theorem unitImpulse_compactSupport (p : Plane) : + HasCompactSupport (Function.uncurry (unitImpulse p)) := by + let K : Set (ℝ × Plane) := Icc 0 1 ×ˢ tsupport (spatialImpulse p) + apply HasCompactSupport.intro (K := K) + ((isCompact_Icc : IsCompact (Icc (0 : ℝ) 1)).prod (spatialImpulse_compactSupport p).isCompact) + rintro ⟨t,x⟩ hx + by_cases ht : t ∈ Icc (0 : ℝ) 1 + · have hz : spatialImpulse p x = 0 := image_eq_zero_of_notMem_tsupport (fun h => hx ⟨ht,h⟩) + simp only [Function.uncurry_apply_pair, unitImpulse, hz, mul_zero] + · have hz : smoothPulse 0 1 t = 0 := by + by_cases ht0 : t ≤ 0 + · exact smoothPulse_before (by norm_num) ht0 + · exact smoothPulse_after (by norm_num) (by + have ht0' : 0 ≤ t := le_of_lt (lt_of_not_ge ht0) + by_contra hn + exact ht ⟨ht0',le_of_lt (lt_of_not_ge hn)⟩) + simp only [Function.uncurry_apply_pair, unitImpulse, hz, zero_mul] + +theorem expandingForce_all_mixed_bounded (M : Alternating.Machine) (hM : M.WellFormed) + (blank : Recorder.Symbol (State M) (Alphabet M)) (m : ℕ) + {σ : ℝ} (hσ : 0 < σ) (ν : ℝ) (p : Plane) (α : List (Fin 4)) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ y, + ‖mixedDerivative (triangularForce ν (expandingDrift M hM blank m σ + (workGrowth M blank) (workFactor M blank m)) (unitImpulse p)) α y‖ ≤ B := by + let a := expandingDrift M hM blank m σ (workGrowth M blank) (workFactor M blank m) + have ha := expandingDrift_smooth M hM blank m hσ (workGrowth_ge_one M blank) + (workFactor_nonneg M blank m) + have hab : UniformJets (Function.uncurry a) := + expandingDrift_all_jets_bounded M hM blank m hσ + have hb : UniformJets (triangularVelocity a (fun _ _ => 0)) := by + have hcomp := hab.linear_right ha horizontalTimeProjection + have hcompS := ha.comp horizontalTimeProjection.contDiff + have h := hcomp.linear_left hcompS planeInclusion + have he : triangularVelocity a (fun _ _ => 0) = + planeInclusion ∘ (Function.uncurry a ∘ horizontalTimeProjection) := by + funext y + simp [Function.comp_def, horizontalTimeProjection, triangularVelocity, triangularLift] + rw [he] + exact h + have hs : UniformJets (Function.uncurry (unitImpulse p)) := by + intro n + obtain ⟨C,hC,hbound⟩ := (unitImpulse_compactSupport p).exists_bound_iteratedFDeriv + (unitImpulse_smooth p) n + exact ⟨C,hC,fun y => hbound n le_rfl y⟩ + have hsource : UniformJets (triangularVelocity (fun _ _ => 0) (unitImpulse p)) := by + have hb := hs.linear_right (unitImpulse_smooth p) horizontalTimeProjection + have hbS := (unitImpulse_smooth p).comp horizontalTimeProjection.contDiff + let L : ℝ →L[ℝ] Space := (1 : ℝ →L[ℝ] ℝ).smulRight (basis 2) + have h := hb.linear_left hbS L + have he : triangularVelocity (fun _ _ => 0) (unitImpulse p) = + L ∘ (Function.uncurry (unitImpulse p) ∘ horizontalTimeProjection) := by + funext y + simp [Function.comp_def, horizontalTimeProjection, triangularVelocity, triangularLift, L] + rw [he] + exact h + have hforce : UniformJets (triangularForce ν a (unitImpulse p)) := by + rw [triangularForce_eq_residual ha] + exact (hb.residual (triangularVelocity_smooth ha contDiff_const) ν).add + (residual_smooth (triangularVelocity_smooth ha contDiff_const) ν) + (triangularVelocity_smooth contDiff_const (unitImpulse_smooth p)) hsource + exact hforce.mixed_bound (triangularForce_smooth ha (unitImpulse_smooth p) ν) α + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformJetBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformJetBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c24a1973179db09280beb76f360949d59b20eb3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UniformJetBounds.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingGateJetBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualExpressions + +namespace OAI + +/-! Elementary closure rules for globally bounded smooth jets. These +transfer the stage estimates to the actual Navier–Stokes force. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff BigOperators + +variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] + +def UniformJets (f : E → F) : Prop := + ∀ n : ℕ, ∃ B : ℝ, 0 ≤ B ∧ ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ B + +theorem UniformJets.add {f g : E → F} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (hfb : UniformJets f) (hgb : UniformJets g) : UniformJets (f+g) := by + intro n + obtain ⟨A,hA,hAf⟩ := hfb n + obtain ⟨B,hB,hBg⟩ := hgb n + refine ⟨A+B, add_nonneg hA hB, fun x => ?_⟩ + rw [iteratedFDeriv_add_apply (hf.contDiffAt.of_le (by simp)) (hg.contDiffAt.of_le (by simp))] + exact (norm_add_le _ _).trans (add_le_add (hAf x) (hBg x)) + +theorem UniformJets.const_smul {f : E → F} (hf : ContDiff ℝ ∞ f) + (hb : UniformJets f) (r : ℝ) : UniformJets (r • f) := by + intro n + obtain ⟨A,hA,hAf⟩ := hb n + refine ⟨|r| * A, mul_nonneg (abs_nonneg _) hA, fun x => ?_⟩ + rw [iteratedFDeriv_const_smul_apply (hf.contDiffAt.of_le (by simp)), norm_smul, Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (hAf x) (abs_nonneg _) + +theorem UniformJets.sub {f g : E → F} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (hfb : UniformJets f) (hgb : UniformJets g) : UniformJets (f-g) := by + have he : f-g = f + (-1 : ℝ) • g := by ext x; simp [sub_eq_add_neg] + rw [he] + exact hfb.add hf (hg.const_smul _) (hgb.const_smul hg (-1)) + +theorem UniformJets.linear_left {f : E → F} (hf : ContDiff ℝ ∞ f) + (hb : UniformJets f) (L : F →L[ℝ] G) : UniformJets (L ∘ f) := by + intro n + obtain ⟨A,hA,hAf⟩ := hb n + refine ⟨‖L‖*A, mul_nonneg (norm_nonneg _) hA, fun x => ?_⟩ + exact (L.norm_iteratedFDeriv_comp_left (hf.contDiffAt) (by simp)).trans + (mul_le_mul_of_nonneg_left (hAf x) (norm_nonneg _)) + +theorem UniformJets.linear_right {f : F → G} (hf : ContDiff ℝ ∞ f) + (hb : UniformJets f) (L : E →L[ℝ] F) : UniformJets (f ∘ L) := by + intro n + obtain ⟨A,hA,hAf⟩ := hb n + refine ⟨A*‖L‖^n, by positivity, fun x => ?_⟩ + rw [L.iteratedFDeriv_comp_right hf x (by simp)] + apply (ContinuousMultilinearMap.norm_compContinuousLinearMap_le _ _).trans + simpa using mul_le_mul_of_nonneg_right (hAf (L x)) (pow_nonneg (norm_nonneg L) n) + +theorem UniformJets.derivative {f : E → F} (hb : UniformJets f) : UniformJets (fderiv ℝ f) := by + intro n + obtain ⟨A,hA,hAf⟩ := hb (n+1) + exact ⟨A,hA, fun x => by simpa only [norm_iteratedFDeriv_fderiv] using hAf x⟩ + +theorem UniformJets.directional {f : E → F} (hf : ContDiff ℝ ∞ f) + (hb : UniformJets f) (v : E) : UniformJets (fun x => fderiv ℝ f x v) := by + intro n + obtain ⟨A,hA,hAf⟩ := hb.derivative n + refine ⟨‖v‖*A, mul_nonneg (norm_nonneg _) hA, fun x => ?_⟩ + exact (norm_iteratedFDeriv_clm_apply_const (hf.fderiv_right (m := ∞) (by simp)).contDiffAt + (by simp)).trans (mul_le_mul_of_nonneg_left (hAf x) (norm_nonneg _)) + +theorem UniformJets.smul {f : E → ℝ} {g : E → F} + (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (hfb : UniformJets f) (hgb : UniformJets g) : UniformJets (fun x => f x • g x) := by + choose A hA hAf using hfb + choose B hB hBg using hgb + intro n + refine ⟨∑ i ∈ Finset.range (n+1), (n.choose i : ℝ)*A i*B (n-i), + Finset.sum_nonneg (fun i _ => mul_nonneg + (mul_nonneg (Nat.cast_nonneg _) (hA i)) (hB (n-i))), fun x => ?_⟩ + apply (norm_iteratedFDeriv_smul_le hf hg x (by simp : (n : ℕ∞ω) ≤ ∞)).trans + apply Finset.sum_le_sum + intro i _ + exact mul_le_mul (mul_le_mul_of_nonneg_left (hAf i x) (Nat.cast_nonneg _)) + (hBg (n-i) x) (norm_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (hA i)) + +theorem UniformJets.sum {ι : Type*} [Fintype ι] {f : ι → E → F} + (hf : ∀ i, ContDiff ℝ ∞ (f i)) (hb : ∀ i, UniformJets (f i)) : + UniformJets (fun x => ∑ i, f i x) := by + intro n + choose B hB hBf using fun i => hb i n + refine ⟨∑ i, B i, Finset.sum_nonneg (fun i _ => hB i), fun x => ?_⟩ + rw [iteratedFDeriv_fun_sum_apply (fun i _ => (hf i).contDiffAt.of_le (by simp))] + exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun i _ => hBf i x)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UnitSpatialClock.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UnitSpatialClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..b404b9c090a5645e5833c4a77a54c3ad1c46530b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/UnitSpatialClock.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SpatialSuspension +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ExpressionCompiler + +namespace OAI + +/-! The fixed, mean-zero spatial clock. It runs at unit speed throughout the +planar computational corridor and is a finite periodic cutoff expression. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set MeasureTheory +open scoped ContDiff + +def clockRectangle : RationalBox 2 := + ⟨![1 / 8, 1 / 32], ![7 / 8, 7 / 8]⟩ + +def unitSpatialClock : Plane → ℝ := planarMask 1 clockRectangle (1 / 128) + +theorem unitSpatialClock_smooth : ContDiff ℝ ∞ unitSpatialClock := + planarMask_smooth (by norm_num) _ (by norm_num) + +theorem unitSpatialClock_periodic (x : Plane) (n : Fin 2 → ℤ) : + unitSpatialClock (x + fun j => (n j : ℝ)) = unitSpatialClock x := by + simpa only [unitSpatialClock, one_mul] using planarMask_periodic 1 clockRectangle (1 / 128) x n + +theorem unitSpatialClock_one {x : Plane} (hx : x ∈ clockRectangle.carrier) : + unitSpatialClock x = 1 := by + apply planarMask_plateau (A := fun _ => 0) (B := fun _ => 1) (by norm_num) + (by intro j; norm_num) clockRectangle (by norm_num) + · intro j + fin_cases j <;> norm_num [clockRectangle] + · have hr : (0 : ℝ) < (1 / 128 : ℚ) := by norm_num + intro j + exact ⟨by linarith [(hx j).1], by linarith [(hx j).2]⟩ + +def verticalClock (x : Space) : Space := + letI := ShearFlows.neZeroThree + unitSpatialClock (horizontal x) • basis 2 + +theorem verticalClock_smooth : ContDiff ℝ ∞ verticalClock := by + have he : verticalClock = fun x => unitSpatialClock (selectTwo 0 1 x) • basis 2 := by + funext x + rw [selectTwo_zero_one] + rfl + rw [he] + exact (unitSpatialClock_smooth.comp (selectTwo 0 1).contDiff).smul contDiff_const + +theorem verticalClock_divergence (x : Space) : divergence verticalClock x = 0 := by + have he : verticalClock = transverseSum (ι := Unit) (selectTwo 0 1) + (fun _ => unitSpatialClock) (fun _ => basis 2) := by + funext y + simp only [verticalClock, transverseSum, Finset.univ_unique, + Finset.sum_singleton, selectTwo_zero_one] + rw [he] + exact transverseSum_divergence _ _ _ + (fun _ => selectTwo_basis (by decide) (by decide)) x + (fun _ => unitSpatialClock_smooth.differentiable (by simp) _) + +theorem verticalClock_mean_zero : (∫ x in fundamentalCube 1, verticalClock x) = 0 := by + change (∫ x in fundamentalCube 1, unitSpatialClock (horizontal x) • basis 2) = 0 + rw [integral_smul_const] + have hz : (∫ x in fundamentalCube 1, unitSpatialClock (horizontal x)) = 0 := + planarMask_cube_mean_zero (by norm_num) _ (by norm_num) + rw [hz, zero_smul] + +def unitSpatialClockExpr : FieldExpr := FieldExpr.planeMask 1 clockRectangle (1 / 128) + +theorem unitSpatialClockExpr_valid : unitSpatialClockExpr.Valid := + FieldExpr.planeMask_valid (by norm_num) (by norm_num) _ + +theorem unitSpatialClockExpr_val (y : SpaceTime) : + unitSpatialClockExpr.val y = unitSpatialClock (horizontal y.2) := by + simpa only [unitSpatialClockExpr, unitSpatialClock, Rat.cast_one] using + FieldExpr.planeMask_val (L := 1) (r := 1 / 128) (by norm_num) (by norm_num) clockRectangle y + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/VariationBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/VariationBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..839a17bbb68bdc128f9b789f095026f0094313bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Flow/VariationBounds.lean @@ -0,0 +1,80 @@ +import Mathlib.Analysis.ODE.Gronwall + +namespace OAI + +/-! The quantitative inequalities needed for the first two variational +equations of the planar processor. Doubling the computed coefficient bound +puts both estimates in the form used in the manuscript. -/ + +namespace ForcedComputation +open Set + +section +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +theorem first_variation_bound_mul {J J' : ℝ → E} {K C t : ℝ} (ht : 0 ≤ t) + (hc : ContinuousOn J (Icc 0 t)) + (hd : ∀ s ∈ Ico 0 t, HasDerivAt J (J' s) s) + (h₀ : ‖J 0‖ ≤ C) (hb : ∀ s ∈ Ico 0 t, ‖J' s‖ ≤ K * ‖J s‖) : + ‖J t‖ ≤ C * Real.exp (K * t) := by + have h := norm_le_gronwallBound_of_norm_deriv_right_le (K := K) (ε := 0) hc + (fun s hs => (hd s hs).hasDerivWithinAt) h₀ + (fun s hs => by simpa only [add_zero] using hb s hs) t ⟨ht, le_rfl⟩ + simpa only [gronwallBound_ε0, sub_zero] using h + +theorem first_variation_bound {J J' : ℝ → E} {K t : ℝ} (ht : 0 ≤ t) + (hc : ContinuousOn J (Icc 0 t)) + (hd : ∀ s ∈ Ico 0 t, HasDerivAt J (J' s) s) + (h₀ : ‖J 0‖ ≤ 1) (hb : ∀ s ∈ Ico 0 t, ‖J' s‖ ≤ K * ‖J s‖) : + ‖J t‖ ≤ Real.exp (K * t) := by + simpa only [one_mul] using first_variation_bound_mul ht hc hd h₀ hb + +theorem second_variation_bound_mul {B B' : ℝ → E} {K C t : ℝ} + (hK : 0 < K) (hC : 0 ≤ C) (ht : 0 ≤ t) (hc : ContinuousOn B (Icc 0 t)) + (hd : ∀ s ∈ Ico 0 t, HasDerivAt B (B' s) s) + (h₀ : B 0 = 0) + (hb : ∀ s ∈ Ico 0 t, + ‖B' s‖ ≤ K * ‖B s‖ + C * K * Real.exp (2 * K * s)) : + ‖B t‖ ≤ C * (Real.exp (4 * K * t) - Real.exp (2 * K * t)) := by + have hbound (s : ℝ) (hs : s ∈ Ico 0 t) : + ‖B' s‖ ≤ K * ‖B s‖ + C * K * Real.exp (2 * K * t) := by + apply (hb s hs).trans + apply add_le_add le_rfl + apply mul_le_mul_of_nonneg_left _ (mul_nonneg hC hK.le) + apply Real.exp_le_exp.mpr + nlinarith [hs.2.le] + have h := norm_le_gronwallBound_of_norm_deriv_right_le + (K := K) (ε := C * K * Real.exp (2 * K * t)) hc + (fun s hs => (hd s hs).hasDerivWithinAt) + (show ‖B 0‖ ≤ 0 by simp [h₀]) hbound t ⟨ht, le_rfl⟩ + rw [gronwallBound_of_K_ne_0 hK.ne'] at h + dsimp only at h + simp only [sub_zero, zero_mul, zero_add] at h + have hcancel : (C * K * Real.exp (2 * K * t)) / K = C * Real.exp (2 * K * t) := by + field_simp [hK.ne'] + rw [hcancel] at h + have heq : Real.exp (2 * K * t) * (Real.exp (K * t) - 1) = + Real.exp (3 * K * t) - Real.exp (2 * K * t) := by + have he : 2 * K * t + K * t = 3 * K * t := by ring + rw [mul_sub, ← Real.exp_add, mul_one, he] + rw [mul_assoc, heq] at h + apply h.trans + apply mul_le_mul_of_nonneg_left _ hC + apply sub_le_sub_right + apply Real.exp_le_exp.mpr + nlinarith + +theorem second_variation_bound {B B' : ℝ → E} {K t : ℝ} + (hK : 0 < K) (ht : 0 ≤ t) (hc : ContinuousOn B (Icc 0 t)) + (hd : ∀ s ∈ Ico 0 t, HasDerivAt B (B' s) s) + (h₀ : B 0 = 0) + (hb : ∀ s ∈ Ico 0 t, + ‖B' s‖ ≤ K * ‖B s‖ + K * Real.exp (2 * K * s)) : + ‖B t‖ ≤ Real.exp (4 * K * t) - Real.exp (2 * K * t) := by + simpa only [one_mul] using second_variation_bound_mul (C := 1) hK + (by norm_num) ht hc hd h₀ (by simpa only [one_mul] using hb) + +end +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Main.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..eebd9a7eaba9bd395f1fc1f81eb2184071b0b5ba --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Main.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Main +import OAI.Analysis.BoxTransport.Routing +import OAI.MathematicalPhysics.SheetFlows.SheetProgram +import OAI.MathematicalPhysics.RapidForcing.Main +import OAI.MathematicalPhysics.AlternatingFlow.Development +import OAI.Analysis.PeriodicLattice.Main +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FixedParticleMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PrefixMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarDecayMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusSlowMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeCorollaryMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TorusDetectorMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ParticleDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedCycle +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedMain + +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorUnconditional +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ParticleDecisionUnconditional +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidDecisionUnconditional +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingEnergyDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.TorusVariationsDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDecisionDischarge +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityUnconditional + +/-! Universal computation, material observations, and velocity detection in forced incompressible Navier–Stokes flows. -/ diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/AutonomousStartup.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/AutonomousStartup.lean new file mode 100644 index 0000000000000000000000000000000000000000..2899541b3d121643c90ae0dca76b9eae49fed578 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/AutonomousStartup.lean @@ -0,0 +1,174 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupClock +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualScaling +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ClassicalUniqueness + +namespace OAI + +/-! +# Starting an autonomous periodic field from rest + +The startup step in §6 of *Universal Computation with Eventually Stationary +Navier–Stokes Forcing*. This proves the analytic transfer for an actual smooth +field, including its material flow. The computational planar processor is a +separate construction, not an assumption hidden in this transfer. +-/ + +noncomputable section + +open Set MeasureTheory +open scoped ContDiff Topology NNReal +open ShearFlows + +namespace ForcedComputation + +theorem residual_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) (ν : ℝ) : + ContDiff ℝ ∞ (residual ν V) := + ((timeDerivative_smooth hV).add ((spatial_fderiv_smooth hV).clm_apply hV)).sub + ((laplacian_smooth hV).const_smul ν) + +theorem residual_solves_NS {V : Velocity} {L : ℝ} + (hV : ContDiff ℝ ∞ V) (hp : SpatiallyPeriodic L V) + (hd : Solenoidal V) (h₀ : ∀ x, V (0, x) = 0) (ν : ℝ) : + IsClassicalSolution L ν (residual ν V) V (fun _ => 0) where + regularity := smooth_classicalRegularity hV + periodic_u t _ := hp t + periodic_p _ _ _ _ := rfl + pressure_mean _ _ := by simp + initial := h₀ + divergence_zero t _ := hd t + equation t ht x := by + rw [initialTimeDerivative_eq hV ht x, gradient_constant] + simp only [residual, neg_zero, zero_add] + abel + +theorem ramp_smooth {α : ℝ → ℝ} {W : Space → Space} + (hα : ContDiff ℝ ∞ α) (hW : ContDiff ℝ ∞ W) : + ContDiff ℝ ∞ (rampVelocity α W) := + (hα.comp contDiff_fst).smul (hW.comp contDiff_snd) + +theorem ramp_periodic (α : ℝ → ℝ) {W : Space → Space} {L : ℝ} + (hp : ∀ x n, W (x + latticeVector L n) = W x) : + SpatiallyPeriodic L (rampVelocity α W) := by + intro t x n + simp only [rampVelocity, hp] + +theorem ramp_lipschitz {α : ℝ → ℝ} {W : Space → Space} {K : ℝ≥0} + (hα : ∀ t, |α t| ≤ 1) (hW : LipschitzWith K W) (t : ℝ) : + LipschitzWith K (fun x => rampVelocity α W (t, x)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + calc + dist (rampVelocity α W (t, x)) (rampVelocity α W (t, y)) = + |α t| * dist (W x) (W y) := by + simp [rampVelocity, dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs] + _ ≤ 1 * dist (W x) (W y) := mul_le_mul_of_nonneg_right (hα t) dist_nonneg + _ ≤ (K : ℝ) * dist x y := by simpa only [one_mul] using hW.dist_le_mul x y + +theorem ramp_materialFlow {L : ℝ} {α : ℝ → ℝ} {W : Space → Space} + {Φ : ℝ → Space → Space} {K : ℝ≥0} + (hα : Continuous α) (hαbound : ∀ t, |α t| ≤ 1) + (hW : LipschitzWith K W) + (hΦ : IsMaterialFlow L (fun y => W y.2) Φ) : + IsMaterialFlow L (rampVelocity α W) + (fun t x => Φ (accumulatedClock α t) x) where + initial x := by rw [accumulatedClock_zero, hΦ.initial] + ode t x := (hΦ.ode (accumulatedClock α t) x).scomp t + (accumulatedClock_hasDerivAt hα t) + equivariant t x n := hΦ.equivariant _ x n + unique x γ hγ₀ hγ t := by + have he : γ = fun t => Φ (accumulatedClock α t) x := + ODE_solution_unique_univ (t₀ := 0) (s := fun _ => univ) + (fun t => (ramp_lipschitz hαbound hW t).lipschitzOnWith) + (fun t => ⟨hγ t, mem_univ _⟩) + (fun t => ⟨(hΦ.ode (accumulatedClock α t) x).scomp t + (accumulatedClock_hasDerivAt hα t), mem_univ _⟩) + (by simpa only [accumulatedClock_zero, hΦ.initial] using hγ₀) + exact congrFun he t + +theorem startupRamp_abs_le_one (t : ℝ) : |startupRamp t| ≤ 1 := by + rw [abs_of_nonneg (startupRamp_nonneg t)] + exact Real.smoothTransition.le_one _ + +theorem periodic_spatial_lipschitz {L : ℝ} (hL : 0 < L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : ∀ x n, W (x + latticeVector L n) = W x) : + ∃ K : ℝ≥0, LipschitzWith K W := by + obtain ⟨K, hK⟩ := smooth_periodic_lipschitz hL (hW.comp contDiff_snd) + (show SpatiallyPeriodic L (fun y : SpaceTime => W y.2) from fun _ => hp) + (show TimePeriodic (fun y : SpaceTime => W y.2) from fun _ _ => rfl) + refine ⟨K, LipschitzWith.of_dist_le_mul (fun x y => ?_)⟩ + simpa using hK.dist_le_mul ((0 : ℝ), x) ((0 : ℝ), y) + +/-- The fixed startup preserves every nonnegative-time observation event. -/ +theorem startup_materialFlow {L : ℝ} (hL : 0 < L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : ∀ x n, W (x + latticeVector L n) = W x) : + ∃ Φ : ℝ → Space → Space, + IsMaterialFlow L (fun y => W y.2) Φ ∧ + IsMaterialFlow L (rampVelocity startupRamp W) + (fun t x => Φ (accumulatedClock startupRamp t) x) ∧ + ∀ x O, Reaches (fun t => Φ (accumulatedClock startupRamp t) x) O ↔ + Reaches (fun t => Φ t x) O := by + have hs : ContDiff ℝ ∞ (fun y : SpaceTime => W y.2) := hW.comp contDiff_snd + have hsp : SpatiallyPeriodic L (fun y : SpaceTime => W y.2) := fun _ => hp + have htp : TimePeriodic (fun y : SpaceTime => W y.2) := fun _ _ => rfl + obtain ⟨Φ, hΦ⟩ := smooth_periodic_materialFlow hL hs hsp htp + obtain ⟨K, hKW⟩ := periodic_spatial_lipschitz hL hW hp + refine ⟨Φ, hΦ, ramp_materialFlow startupRamp_smooth.continuous + startupRamp_abs_le_one hKW hΦ, ?_⟩ + intro x O + exact reaches_comp_iff startupClock_onto (fun t => Φ t x) O + +/-- The startup field is a classical forced solution from rest, with a force +which is exactly stationary on the closed interval `[1,∞)`. -/ +theorem startup_solution {L : ℝ} {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : ∀ x n, W (x + latticeVector L n) = W x) + (hd : ∀ x, divergence W x = 0) (ν : ℝ) : + ContDiff ℝ ∞ (rampVelocity startupRamp W) ∧ + ContDiff ℝ ∞ (residual ν (rampVelocity startupRamp W)) ∧ + IsClassicalSolution L ν (residual ν (rampVelocity startupRamp W)) + (rampVelocity startupRamp W) (fun _ => 0) ∧ + ∀ t, 1 ≤ t → ∀ x, + residual ν (rampVelocity startupRamp W) (t, x) = + advection W x - ν • laplacian W x := by + have hs := ramp_smooth startupRamp_smooth hW + exact ⟨hs, residual_smooth hs ν, + residual_solves_NS hs (ramp_periodic startupRamp hp) + (ramp_solenoidal startupRamp hd) (ramp_initial_zero startupRamp_zero W) ν, + fun t ht x => residual_ramp_on_tail ν W (fun _ hs => startupRamp_tail hs) ht + (startupRamp_smooth.differentiable (by simp) t) x⟩ + +theorem startup_solution_unique {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {W : Space → Space} (hW : ContDiff ℝ ∞ W) + (hp : ∀ x n, W (x + latticeVector L n) = W x) + (hd : ∀ x, divergence W x = 0) : + ∀ u p, IsClassicalSolution L ν (residual ν (rampVelocity startupRamp W)) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = rampVelocity startupRamp W (t, x) ∧ p (t, x) = 0 := by + have hsol := (startup_solution hW hp hd ν).2.2.1 + obtain ⟨K, hK⟩ := periodic_spatial_lipschitz hL hW hp + have hb (t : ℝ) (_ : 0 ≤ t) (x : Space) : + ‖fderiv ℝ (fun y => rampVelocity startupRamp W (t, y)) x‖ ≤ (K : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (ramp_lipschitz startupRamp_abs_le_one hK t) + intro u p hu + have he := classical_velocity_unique hL hν hu hsol hb + have hpressure := classical_pressure_unique hL hu hsol he + exact fun t ht x => ⟨he t ht x, hpressure t ht x⟩ + +theorem startup_energy_bounded {L : ℝ} (hL : 0 < L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : ∀ x n, W (x + latticeVector L n) = W x) : + ∃ E : ℝ, ∀ t, kineticEnergy L (rampVelocity startupRamp W) t ≤ E := by + obtain ⟨B, hB, hb⟩ := periodic_uniform_bound hL (hW.comp contDiff_snd).continuous + (show SpatiallyPeriodic L (fun y : SpaceTime => W y.2) from fun _ => hp) + (show TimePeriodic (fun y : SpaceTime => W y.2) from fun _ _ => rfl) + have hbound (y : SpaceTime) : ‖rampVelocity startupRamp W y‖ ≤ B := by + calc + ‖rampVelocity startupRamp W y‖ = |startupRamp y.1| * ‖W y.2‖ := by + simp only [rampVelocity, norm_smul, Real.norm_eq_abs] + _ ≤ 1 * ‖W y.2‖ := mul_le_mul_of_nonneg_right (startupRamp_abs_le_one _) (norm_nonneg _) + _ ≤ B := by simpa only [one_mul, Function.comp_apply] using hb y + exact ⟨(1 / 2 : ℝ) * volume.real (fundamentalCube L) * (3 * B ^ 2), + fun t => kineticEnergy_bound (ramp_smooth startupRamp_smooth hW).continuous L hB hbound t⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean new file mode 100644 index 0000000000000000000000000000000000000000..daa5cc33485745e32016c2623d8807a533dfdf92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedActivation.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedBody + +namespace OAI + +/-! A computable time cutoff starts the machine-only periodic body. It changes +only during the final empty part of the preceding period, so the body is +exactly zero before one and exactly periodic from one onward. -/ + +noncomputable section +namespace ForcedComputation.BalancedBody +open ShearFlows Recorder.Planar PlanarHamiltonian Set +open scoped ContDiff + +def activationStart (n : ℕ) : ℚ := 1 - 1 / (4 * ((n : ℚ) + 1)) +def activationFinish (n : ℕ) : ℚ := 1 - 1 / (8 * ((n : ℚ) + 1)) + +theorem activation_intervals (n : ℕ) : + 0 < activationStart n ∧ activationStart n < activationFinish n ∧ activationFinish n < 1 := by + have hn : (0 : ℚ) < n + 1 := by positivity + have h₄ : (0 : ℚ) < 4 * (n + 1) := by positivity + have h₈ : (0 : ℚ) < 8 * (n + 1) := by positivity + refine ⟨?_, ?_, ?_⟩ + · unfold activationStart + have h : 1 / (4 * ((n : ℚ) + 1)) < 1 := (div_lt_one h₄).mpr (by nlinarith [Nat.cast_nonneg (α := ℚ) n]) + linarith + · unfold activationStart activationFinish + have h : 1 / (8 * ((n : ℚ) + 1)) < 1 / (4 * ((n : ℚ) + 1)) := + one_div_lt_one_div_of_lt h₄ (by nlinarith) + linarith + · unfold activationFinish + have h : (0 : ℚ) < 1 / (8 * (n + 1)) := by positivity + linarith + +theorem finish_le_activationStart {n : ℕ} (i : Fin n) : + PlanarTiming.finish i ≤ activationStart n := by + have hn : (0 : ℚ) < (n : ℚ) + 1 := by positivity + have hi : (i.val : ℚ) + 1 ≤ n := by exact_mod_cast i.isLt + unfold PlanarTiming.finish activationStart + apply (le_sub_iff_add_le).mpr + apply (mul_le_mul_iff_left₀ (by positivity : (0 : ℚ) < 4 * (n + 1))).mp + field_simp + nlinarith + +def bodyLength (M : Alternating.Machine) (hM : M.WellFormed) : ℕ := + (actions (freshMachine M) (freshInput_valid (BalancedPlanar.referenceValid hM)).1).length + +def activation (M : Alternating.Machine) (hM : M.WellFormed) : ℝ → ℝ := + smoothRamp (activationStart (bodyLength M hM)) (activationFinish (bodyLength M hM)) + +def activated (M : Alternating.Machine) (hM : M.WellFormed) : Velocity := + fun y => activation M hM y.1 • velocity M hM y + +theorem raw_late_zero (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ} + (ht : t ∈ Icc (activationStart (bodyLength M hM) : ℝ) 1) (x : Space) : + raw M hM (t, x) = 0 := by + have hn := activation_intervals (bodyLength M hM) + have ht0 : 0 ≤ t := (Rat.cast_nonneg.mpr hn.1.le).trans ht.1 + have hp : BalancedPlanar.bodyVelocity M hM t (horizontal x) = 0 := by + rw [show BalancedPlanar.bodyVelocity M hM = + PlanarHamiltonian.periodicVelocity + (normalizedPulse (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) from rfl] + rw [periodicVelocity_on_unit + (normalizedPulse_valid (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) + (normalizedPulse_inUnit (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) ⟨ht0, ht.2⟩, + processorVelocity_eq_sum] + apply Finset.sum_eq_zero + intro i _ + have hfi : ((normalizedPulse (BalancedPlanar.referenceInput M) + (BalancedPlanar.referenceValid hM) i).finish : ℝ) ≤ t := by + exact (Rat.cast_le.mpr (finish_le_activationStart i)).trans ht.1 + have hab := (normalizedPulse_valid (BalancedPlanar.referenceInput M) + (BalancedPlanar.referenceValid hM) i).2 + rw [Pulse.velocity, smoothPulse_after (by exact_mod_cast hab) hfi, zero_smul] + simp only [raw, CompactLift.velocity, CompactLift.spatial, VelocityDetector.triangularLift, + VelocityDetector.horizontalLinear_eq, hp, map_zero, zero_smul, add_zero, smul_zero] + +theorem velocity_late_zero (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ} + (ht : t ∈ Icc (activationStart (bodyLength M hM) : ℝ) 1) (x : Space) : + velocity M hM (t, x) = 0 := by + change BalancedStretch.stretch (raw M hM (t, BalancedStretch.stretch.symm x)) = 0 + rw [raw_late_zero M hM ht, map_zero] + +theorem activated_before (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ} + (ht : t ≤ 1) (x : Space) : activated M hM (t, x) = 0 := by + by_cases ha : t ≤ (activationStart (bodyLength M hM) : ℝ) + · rw [activated, activation, smoothRamp_before + (by exact_mod_cast (activation_intervals (bodyLength M hM)).2.1) ha, zero_smul] + · rw [activated, velocity_late_zero M hM ⟨(lt_of_not_ge ha).le, ht⟩, smul_zero] + +theorem activated_tail (M : Alternating.Machine) (hM : M.WellFormed) {t : ℝ} + (ht : 1 ≤ t) (x : Space) : activated M hM (t, x) = velocity M hM (t, x) := by + rw [activated, activation, smoothRamp_after + (by exact_mod_cast (activation_intervals (bodyLength M hM)).2.1), one_smul] + have hfinish : (activationFinish (bodyLength M hM) : ℝ) ≤ 1 := by + exact_mod_cast (activation_intervals (bodyLength M hM)).2.2.le + exact hfinish.trans ht + +theorem activated_smooth (M : Alternating.Machine) (hM : M.WellFormed) : + ContDiff ℝ ∞ (activated M hM) := + ((smoothRamp_smooth _ _).comp contDiff_fst).smul (velocity_smooth M hM) + +theorem activated_support (M : Alternating.Machine) (hM : M.WellFormed) (t : ℝ) : + tsupport (fun x => activated M hM (t, x)) ⊆ support := + (tsupport_smul_subset_right _ _).trans (velocity_support M hM t) + +theorem activated_bounded (M : Alternating.Machine) (hM : M.WellFormed) : + BoundedMixedDerivatives (activated M hM) := + boundedMixed_of_compact_tail (activated_smooth M hM) (velocity_smooth M hM) + support_compact (activated_support M hM) (velocity_support M hM) (velocity_periodic M hM) + (fun _ ht x => activated_before M hM (by linarith) x) + (fun _ ht x => activated_tail M hM ht.le x) + +end ForcedComputation.BalancedBody + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedBody.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedBody.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4ca639886662d8cbf64fcf905bc5bfdb6e168d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedBody.lean @@ -0,0 +1,121 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedStretch +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedPlanarProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactTimeSupport + +namespace OAI + +/-! The repeated compact Euclidean field depends only on the machine. Its +fixed vertical cutoff leaves the planar computation on height zero exact. -/ + +noncomputable section +namespace ForcedComputation.BalancedBody +open ShearFlows Set PlanarHamiltonian Recorder.Planar +open scoped ContDiff + +def verticalCutoff : ℝ → ℝ := closedCutoff (-2) (-1) 1 2 + +theorem verticalCutoff_smooth : ContDiff ℝ ∞ verticalCutoff := + closedCutoff_smooth _ _ _ _ + +theorem verticalCutoff_zero : verticalCutoff 0 = 1 := + closedCutoff_plateau (by norm_num) (by norm_num) (by constructor <;> norm_num) + +def raw (M : Alternating.Machine) (hM : M.WellFormed) : Velocity := + CompactLift.velocity verticalCutoff (BalancedPlanar.bodyVelocity M hM) + +def velocity (M : Alternating.Machine) (hM : M.WellFormed) : Velocity := + BalancedStretch.velocity (raw M hM) + +def rawSupport : Set Space := Icc ![0, 0, -2] ![1, 1, 2] + +def support : Set Space := BalancedStretch.stretch '' rawSupport + +theorem rawSupport_compact : IsCompact rawSupport := isCompact_Icc + +theorem support_compact : IsCompact support := + rawSupport_compact.image BalancedStretch.stretch.continuous + +theorem raw_smooth (M : Alternating.Machine) (hM : M.WellFormed) : + ContDiff ℝ ∞ (raw M hM) := + CompactLift.velocity_smooth verticalCutoff_smooth + (compactVelocity_smooth (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) + +theorem velocity_smooth (M : Alternating.Machine) (hM : M.WellFormed) : + ContDiff ℝ ∞ (velocity M hM) := BalancedStretch.velocity_smooth (raw_smooth M hM) + +theorem raw_support (M : Alternating.Machine) (hM : M.WellFormed) (t : ℝ) : + tsupport (fun x => raw M hM (t, x)) ⊆ rawSupport := by + apply closure_minimal _ rawSupport_compact.isClosed + intro x hx + have hχ : verticalCutoff (x 2) ≠ 0 := by + intro hz + apply hx + simp only [raw, CompactLift.velocity, CompactLift.spatial, hz, zero_smul] + have hV : BalancedPlanar.bodyVelocity M hM t (horizontal x) ≠ 0 := by + intro hz + apply hx + simp only [raw, CompactLift.velocity, CompactLift.spatial, VelocityDetector.triangularLift, + VelocityDetector.horizontalLinear_eq, hz, map_zero, zero_smul, add_zero, smul_zero] + have hp := commonSupport_in_unit + (normalizedPulse_inUnit (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) + (compactVelocity_support (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM) + t (subset_tsupport _ hV)) + have hz := closedCutoff_support (by norm_num : (-2 : ℝ) < -1) + (by norm_num : (1 : ℝ) < 2) hχ + constructor <;> intro j <;> fin_cases j + · exact (hp 0).1.le + · exact (hp 1).1.le + · exact hz.1.le + · exact (hp 0).2.le + · exact (hp 1).2.le + · exact hz.2.le + +theorem velocity_support (M : Alternating.Machine) (hM : M.WellFormed) (t : ℝ) : + tsupport (fun x => velocity M hM (t, x)) ⊆ support := by + change tsupport (BalancedStretch.push (fun x => raw M hM (t,x))) ⊆ + BalancedStretch.stretch '' rawSupport + exact BalancedStretch.push_support (a := fun x => raw M hM (t,x)) + (K := rawSupport) rawSupport_compact.isClosed (raw_support M hM t) + +theorem raw_divergence (M : Alternating.Machine) (hM : M.WellFormed) (t : ℝ) (x : Space) : + divergence (fun y => raw M hM (t, y)) x = 0 := by + have hs := field_smooth (periodicHamiltonian_slice_smooth + (normalizedPulse (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) t) + change ContDiff ℝ ∞ (BalancedPlanar.bodyVelocity M hM t) at hs + rw [show (fun y => raw M hM (t, y)) = + CompactLift.spatial verticalCutoff (BalancedPlanar.bodyVelocity M hM t) from rfl, + CompactLift.spatial_divergence verticalCutoff_smooth hs] + have hz : PlanarHamiltonian.divergence (BalancedPlanar.bodyVelocity M hM t) + (horizontal x) = 0 := + (periodicVelocity_properties + (normalizedPulse_valid (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) t).2.1 _ + rw [hz, mul_zero] + +theorem velocity_divergence (M : Alternating.Machine) (hM : M.WellFormed) : + Solenoidal (velocity M hM) := + BalancedStretch.velocity_divergence (raw_divergence M hM) + +theorem raw_periodic (M : Alternating.Machine) (hM : M.WellFormed) : + TimePeriodic (raw M hM) := by + intro t x + have he : BalancedPlanar.bodyVelocity M hM (t + 1) = BalancedPlanar.bodyVelocity M hM t := + funext (fun y => periodicVelocity_periodic _ y t) + simp only [raw, CompactLift.velocity, he] + +theorem velocity_periodic (M : Alternating.Machine) (hM : M.WellFormed) : + TimePeriodic (velocity M hM) := by + intro t x + change BalancedStretch.stretch (raw M hM (t + 1, BalancedStretch.stretch.symm x)) = + BalancedStretch.stretch (raw M hM (t, BalancedStretch.stretch.symm x)) + rw [raw_periodic M hM] + +theorem velocity_bounded (M : Alternating.Machine) (hM : M.WellFormed) : + BoundedMixedDerivatives (velocity M hM) := + boundedMixed_of_compact_periodic (velocity_smooth M hM) support_compact + (velocity_support M hM) (velocity_periodic M hM) + +end ForcedComputation.BalancedBody + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCoefficientEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCoefficientEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1eed2ddff9dda0e7614ffbf1cccdf01dd610e65 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCoefficientEvaluation.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedEvaluation + +namespace OAI + +/-! Explicit terminating evaluators for the two viscosity-independent force coefficients. -/ + +noncomputable section +namespace ForcedComputation.BalancedExpressions +open ShearFlows + +def evaluateCoefficient₀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + evaluate I hI α (fun _ => 0) b ε hε + +def evaluateCoefficient₁ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + evaluate I hI α (fun _ => 1) b (ε/2) (by positivity) - + evaluate I hI α (fun _ => 0) b (ε/2) (by positivity) + +private theorem constantName (r : ℚ) : IsFastRealName (fun _ => r) (r : ℝ) := by + intro n + simp only [sub_self, abs_zero] + unfold errorTolerance + positivity + +theorem evaluateCoefficient₀_spec (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (α : List (Fin 4)) + {y : SpaceTime} {b : ℕ → RationalSpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (BalancedVelocity.force₀ I hI) α y - + rationalVector (evaluateCoefficient₀ I hI α b ε hε)‖ ≤ (ε : ℝ) := by + simpa only [BalancedVelocity.force₀, evaluateCoefficient₀, Rat.cast_zero] using + evaluate_spec I hI α (constantName 0) hb ε hε + +theorem evaluateCoefficient₁_spec (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (α : List (Fin 4)) + {y : SpaceTime} {b : ℕ → RationalSpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (BalancedVelocity.force₁ I hI) α y - + rationalVector (evaluateCoefficient₁ I hI α b ε hε)‖ ≤ (ε : ℝ) := by + have hf : BalancedVelocity.force₁ I hI = residual 1 (BalancedVelocity.velocity I hI) - + residual 0 (BalancedVelocity.velocity I hI) := by + have h := BalancedVelocity.force_affine I hI 1 + rw [one_smul] at h + funext z + have hz := congrFun h z + change residual 1 (BalancedVelocity.velocity I hI) z = + residual 0 (BalancedVelocity.velocity I hI) z + BalancedVelocity.force₁ I hI z at hz + exact eq_sub_of_add_eq' hz.symm + have h₁ := evaluate_spec I hI α (constantName 1) hb (ε/2) (by positivity) + have h₀ := evaluate_spec I hI α (constantName 0) hb (ε/2) (by positivity) + simp only [Rat.cast_one] at h₁ + simp only [Rat.cast_zero] at h₀ + rw [hf, mixedDerivative_sub + (residual_smooth (BalancedVelocity.smooth I hI) 1) + (residual_smooth (BalancedVelocity.smooth I hI) 0)] + have hq : rationalVector (evaluateCoefficient₁ I hI α b ε hε) = + rationalVector (evaluate I hI α (fun _ => 1) b (ε/2) (by positivity)) - + rationalVector (evaluate I hI α (fun _ => 0) b (ε/2) (by positivity)) := by + ext j + exact Rat.cast_sub _ _ + rw [hq] + simp only [Pi.sub_apply] + calc + _ = ‖(mixedDerivative (residual 1 (BalancedVelocity.velocity I hI)) α y - + rationalVector (evaluate I hI α (fun _ => 1) b (ε/2) (by positivity))) - + (mixedDerivative (residual 0 (BalancedVelocity.velocity I hI)) α y - + rationalVector (evaluate I hI α (fun _ => 0) b (ε/2) (by positivity)))‖ := by + congr 1 + abel + _ ≤ _ := (norm_sub_le _ _).trans (add_le_add h₁ h₀) |>.trans (by + norm_num only [Rat.cast_div, Rat.cast_ofNat] + linarith) + + +end ForcedComputation.BalancedExpressions + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCycle.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCycle.lean new file mode 100644 index 0000000000000000000000000000000000000000..78feebbe48d906b0c4e60c7db7155ac99515d645 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedCycle.lean @@ -0,0 +1,241 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedRules + +namespace OAI + +/-! Finite sweeps in the balanced recorder. The preparatory cycle restores +both work tapes and moves exactly one blank onto the history stack. -/ + +namespace ForcedComputation.Balanced + +variable {Q A : Type*} +open ForcedComputation.Balanced.Symbol + +abbrev push := @Radix.prepend (Symbol Q A) +abbrev word := @Radix.prependWord (Symbol Q A) + +def triple (q : Control Q) (l r h : Stack Q A) : Configuration Q A := + ⟨q, ![l, r, h]⟩ + +theorem prefixConfiguration_three (q : Control Q) + (a b c : List (Symbol Q A)) (l r h : Stack Q A) : + prefixConfiguration q ![a, b, c] ![l, r, h] = + triple q (word a l) (word b r) (word c h) := by + change Configuration.mk q _ = Configuration.mk q _ + apply congrArg (Configuration.mk q) + funext j + fin_cases j <;> rfl + +inductive Steps (M : Recorder.Machine Q A) (blank : A) : + ℕ → Configuration Q A → Configuration Q A → Prop + | refl (x) : Steps M blank 0 x x + | next {n x y z} : Step M blank x y → Steps M blank n y z → Steps M blank (n + 1) x z + +theorem Step.steps {M : Recorder.Machine Q A} {blank : A} {x y : Configuration Q A} + (h : Step M blank x y) : Steps M blank 1 x y := + .next h (.refl y) + +theorem Steps.trans {M : Recorder.Machine Q A} {blank : A} + {n m : ℕ} {x y z : Configuration Q A} + (hxy : Steps M blank n x y) (hyz : Steps M blank m y z) : Steps M blank (n + m) x z := by + induction hxy with + | refl => simpa only [Nat.zero_add] using hyz + | next hxy hrest ih => + simpa only [Nat.add_assoc, Nat.add_comm 1 m] using Steps.next hxy (ih hyz) + +theorem enter_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hq : M.halting q = false) (l r h : Stack Q A) : + Step M blank (triple (.checkpoint q) l (push (work a) r) h) + (triple (.outward q) (push (marked a) l) r h) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.enter q a).step hq ![l, r, h] + +theorem outward_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (c : A) + (l r h : Stack Q A) : + Step M blank (triple (.outward q) l (push (work c) r) h) + (triple (.outward q) (push (work c) l) r h) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.outward q c).step (M := M) (blank := blank) trivial ![l, r, h] + +theorem supply_step (M : Recorder.Machine Q A) (blank : A) (q : Q) + (l r h : Stack Q A) : + Step M blank (triple (.outward q) l (push .boundary (push (work blank) r)) h) + (triple (.inward q) l (push .boundary r) (push (work blank) h)) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.supply q).step (M := M) (blank := blank) trivial ![l, r, h] + +theorem inward_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (c : A) + (l r h : Stack Q A) : + Step M blank (triple (.inward q) (push (work c) l) r h) + (triple (.inward q) l (push (work c) r) h) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.inward q c).step (M := M) (blank := blank) trivial ![l, r, h] + +theorem restore_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (l r h : Stack Q A) : + Step M blank (triple (.inward q) (push (marked a) l) r h) + (triple (.dispatch q) l (push (work a) r) h) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.restore q a).step (M := M) (blank := blank) trivial ![l, r, h] + +theorem word_append (a b : List (Symbol Q A)) (u : Stack Q A) : + word (a ++ b) u = word a (word b u) := by + induction a with + | nil => rfl + | cons c a ih => simp only [List.cons_append, Radix.prependWord, ih] + +abbrev workWord (w : List A) : List (Symbol Q A) := w.map work + +theorem outward_sweep (M : Recorder.Machine Q A) (blank : A) (q : Q) + (w : List A) (l r h : Stack Q A) : + Steps M blank w.length (triple (.outward q) l (word (workWord w) r) h) + (triple (.outward q) (word (workWord w.reverse) l) r h) := by + induction w generalizing l with + | nil => exact .refl _ + | cons c w ih => + have hh := Steps.next (outward_step M blank q c l (word (workWord w) r) h) + (ih (push (work c) l)) + simpa only [List.length_cons, workWord, List.map_cons, List.reverse_cons, + List.map_append, List.map_singleton, List.map_nil, word_append, Radix.prependWord] using hh + +theorem inward_sweep (M : Recorder.Machine Q A) (blank : A) (q : Q) + (w : List A) (l r h : Stack Q A) : + Steps M blank w.length (triple (.inward q) (word (workWord w) l) r h) + (triple (.inward q) l (word (workWord w.reverse) r) h) := by + induction w generalizing r with + | nil => exact .refl _ + | cons c w ih => + have hh := Steps.next (inward_step M blank q c (word (workWord w) l) r h) + (ih (push (work c) r)) + simpa only [List.length_cons, workWord, List.map_cons, List.reverse_cons, + List.map_append, List.map_singleton, List.map_nil, word_append, Radix.prependWord] using hh + +/-- On arbitrary independent tails, preparation removes one right-tail blank +and adds that same blank to history, leaving the finite work window unchanged. -/ +theorem preparation (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hq : M.halting q = false) (w : List A) (l r h : Stack Q A) : + Steps M blank (2 * w.length + 3) + (triple (.checkpoint q) l + (push (work a) (word (workWord w) (push .boundary (push (work blank) r)))) h) + (triple (.dispatch q) l + (push (work a) (word (workWord w) (push .boundary r))) (push (work blank) h)) := by + have h₁ := (enter_step M blank q a hq l + (word (workWord w) (push .boundary (push (work blank) r))) h).steps + have h₂ := outward_sweep M blank q w (push (marked a) l) + (push .boundary (push (work blank) r)) h + have h₃ := (supply_step M blank q (word (workWord w.reverse) (push (marked a) l)) r h).steps + have h₄ := inward_sweep M blank q w.reverse (push (marked a) l) + (push .boundary r) (push (work blank) h) + have h₅ := (restore_step M blank q a l (word (workWord w) (push .boundary r)) + (push (work blank) h)).steps + simp only [List.reverse_reverse, List.length_reverse] at h₄ + have hh := (((h₁.trans h₂).trans h₃).trans h₄).trans h₅ + convert hh using 1 + omega + +theorem stay_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hm : M.move q a = 0) (l r h : Stack Q A) : + Step M blank (triple (.dispatch q) l (push (work a) r) (push (work blank) h)) + (triple (.checkpoint (M.next q a)) l (push (work (M.write q a)) r) + (push (record (.stay q a)) h)) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.stay q a).step hm ![l, r, h] + +theorem left_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a c : A) + (hm : M.move q a = -1) (l r h : Stack Q A) : + Step M blank + (triple (.dispatch q) (push (work c) l) (push (work a) r) (push (work blank) h)) + (triple (.checkpoint (M.next q a)) l (push (work c) (push (work (M.write q a)) r)) + (push (record (.left q a c)) h)) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.left q a c).step hm ![l, r, h] + +theorem right_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a c : A) + (hm : M.move q a = 1) (l r h : Stack Q A) : + Step M blank + (triple (.dispatch q) l (push (work a) (push (work c) r)) (push (work blank) h)) + (triple (.checkpoint (M.next q a)) (push (work (M.write q a)) l) (push (work c) r) + (push (record (.right q a c)) h)) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.right q a c).step hm ![l, r, h] + +theorem boundary_step (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hm : M.move q a = 1) (l r h : Stack Q A) : + Step M blank (triple (.dispatch q) l + (push (work a) (push .boundary (push (work blank) r))) (push (work blank) h)) + (triple (.checkpoint (M.next q a)) (push (work (M.write q a)) l) + (push (work blank) (push .boundary r)) (push (record (.boundary q a)) h)) := by + simpa only [Row.source, Row.target, Row.sourceControl, Row.targetControl, + Row.sourcePrefixes, Row.targetPrefixes, prefixConfiguration_three, + Radix.prependWord] using (Row.boundary q a).step hm ![l, r, h] + +theorem stay_cycle (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hq : M.halting q = false) (hm : M.move q a = 0) (w : List A) (l r h : Stack Q A) : + Steps M blank (2 * (w.length + 1) + 2) + (triple (.checkpoint q) l + (push (work a) (word (workWord w) (push .boundary (push (work blank) r)))) h) + (triple (.checkpoint (M.next q a)) l + (push (work (M.write q a)) (word (workWord w) (push .boundary r))) + (push (record (.stay q a)) h)) := by + have hp := preparation M blank q a hq w l r h + have hh := hp.trans (stay_step M blank q a hm l (word (workWord w) (push .boundary r)) h).steps + convert hh using 1 + +theorem left_cycle (M : Recorder.Machine Q A) (blank : A) (q : Q) (a c : A) + (hq : M.halting q = false) (hm : M.move q a = -1) (w : List A) (l r h : Stack Q A) : + Steps M blank (2 * (w.length + 1) + 2) + (triple (.checkpoint q) (push (work c) l) + (push (work a) (word (workWord w) (push .boundary (push (work blank) r)))) h) + (triple (.checkpoint (M.next q a)) l + (push (work c) (push (work (M.write q a)) (word (workWord w) (push .boundary r)))) + (push (record (.left q a c)) h)) := by + have hp := preparation M blank q a hq w (push (work c) l) r h + have hh := hp.trans (left_step M blank q a c hm l (word (workWord w) (push .boundary r)) h).steps + convert hh using 1 + +theorem right_cycle (M : Recorder.Machine Q A) (blank : A) (q : Q) (a c : A) + (hq : M.halting q = false) (hm : M.move q a = 1) (w : List A) (l r h : Stack Q A) : + Steps M blank (2 * (w.length + 2) + 2) + (triple (.checkpoint q) l + (push (work a) (push (work c) + (word (workWord w) (push .boundary (push (work blank) r))))) h) + (triple (.checkpoint (M.next q a)) (push (work (M.write q a)) l) + (push (work c) (word (workWord w) (push .boundary r))) + (push (record (.right q a c)) h)) := by + have hp := preparation M blank q a hq (c :: w) l r h + simp only [workWord, List.map_cons, Radix.prependWord] at hp + have hh := hp.trans (right_step M blank q a c hm l + (word (workWord w) (push .boundary r)) h).steps + convert hh using 1 + +/-- A right move at the boundary creates a new blank work cell while retaining +one boundary and the same infinite blank filler. -/ +theorem boundary_cycle (M : Recorder.Machine Q A) (blank : A) (q : Q) (a : A) + (hq : M.halting q = false) (hm : M.move q a = 1) (l h : Stack Q A) : + Steps M blank 4 + (triple (.checkpoint q) l + (push (work a) (push .boundary (fun _ => work blank))) h) + (triple (.checkpoint (M.next q a)) (push (work (M.write q a)) l) + (push (work blank) (push .boundary (fun _ => work blank))) + (push (record (.boundary q a)) h)) := by + have hz : push (work blank) (fun _ : ℕ => work blank : Stack Q A) = + (fun _ => work blank) := by + funext n + cases n <;> rfl + have hp := preparation M blank q a hq [] l (fun _ => work blank) h + simp only [workWord, List.map_nil, Radix.prependWord, List.length_nil, + Nat.mul_zero, Nat.zero_add, hz] at hp + have ht := boundary_step M blank q a hm l (fun _ => work blank) h + rw [hz] at ht + simpa only [Nat.reduceAdd] using hp.trans ht.steps + +end ForcedComputation.Balanced + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEuclidean.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEuclidean.lean new file mode 100644 index 0000000000000000000000000000000000000000..28cfc8a8f0ae6169885c155f03867c51b7424223 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEuclidean.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactEuclideanEnergy +import OAI.MathematicalPhysics.AlternatingFlow.DerivativeBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualScaling + +namespace OAI + +/-! The compact Euclidean solution uses the prescribed coordinate residual. +The coordinate change commutes with all spatial derivatives and with the +right time derivative on the nonnegative time axis. -/ + +noncomputable section +namespace ForcedComputation.CompactEuclidean +open ShearFlows Set RapidForcing.CompactEmbedding +open scoped ContDiff + +theorem velocity_residual {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) + (ν : ℝ) {t : ℝ} (ht : 0 ≤ t) (x : AlternatingNS.Space) : + velocity (ForcedComputation.residual ν V) t x = + AlternatingNS.residual ν (velocity V) t x := by + let U := velocity V + have hU := velocity_smooth hV + have ht' := piField_timeDerivative hU ht (piCoordinates x) + have ha := piField_advection U t (piCoordinates x) + have hl := piField_laplacian U t (piCoordinates x) + rw [piField_velocity] at ht' ha hl + simp only [ContinuousLinearEquiv.symm_apply_apply] at ht' ha hl + have ha' : ShearFlows.advection (fun y => V (t,y)) (piCoordinates x) = + piCoordinates (AlternatingNS.advection U t x) := by + rw [AlternatingNS.Bounds.advection_eq_sum] + simpa only [RapidForcing.advection, RapidForcing.spatialD, RapidForcing.basis, + AlternatingNS.dx, AlternatingNS.e] using ha + apply piCoordinates.injective + change ForcedComputation.residual ν V (t,piCoordinates x) = + piCoordinates (AlternatingNS.residual ν U t x) + rw [ForcedComputation.residual, AlternatingNS.residual, map_sub, map_add, map_smul, + ht', ha'] + congr 2 + +theorem compact_prescribed_solution {ν : ℝ} (hν : 0 < ν) + {V : ShearFlows.Velocity} (hV : ContDiff ℝ ∞ V) + {K : Set ShearFlows.Space} (hK : IsCompact K) + (hs : ∀ t, Function.support (fun x => V (t,x)) ⊆ K) + (h0 : ∀ x, V (0,x) = 0) (hd : Solenoidal V) : + let U := velocity V + let f := velocity (ForcedComputation.residual ν V) + AlternatingNS.NavierStokes ν f U (fun _ _ => 0) ∧ + AlternatingNS.EnergyClass U (fun _ _ => 0) ∧ + ∀ v p, IsEnergySolutionModuloConstants ν f v p → + ∃ c : ℝ → ℝ, ∀ t, 0 ≤ t → ∀ x, v t x = U t x ∧ p t x = c t := by + dsimp only + obtain ⟨hsol,hE,_⟩ := compact_velocity_solution hν hV hK hs h0 hd + have hsol' : AlternatingNS.NavierStokes ν (velocity (ForcedComputation.residual ν V)) + (velocity V) (fun _ _ => 0) := by + refine ⟨hsol.1,hsol.2.1,?_⟩ + intro t ht x + simpa only [velocity_residual hV ν ht x] using hsol.2.2 t ht x + exact ⟨hsol',hE,fun v p hv => energy_unique_modulo_constants hν.le hsol' hE hv⟩ + +end ForcedComputation.CompactEuclidean + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3924811780d12bfb21f95553b9de0730556f1a1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedEvaluation.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedFiniteCode + +namespace OAI + +/-! The zeroth time approximation selects a finite translate window with +one unit of spare width. Evaluation of every residual jet is then the +existing terminating finite-expression evaluator, including a viscosity +name when viscosity is not rational. -/ + +noncomputable section +namespace ForcedComputation.BalancedExpressions +open ShearFlows Set Filter +open scoped Topology + +def windowLower (b : ℕ → RationalSpaceTime) : ℚ := (b 0).1 - 2 +def windowUpper (b : ℕ → RationalSpaceTime) : ℚ := (b 0).1 + 2 + +theorem named_window {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hb : IsFastName b y) : y.1 ∈ Ioo (windowLower b : ℝ) (windowUpper b) := by + have h := (norm_fst_le (y-rationalPoint (b 0))).trans (hb 0) + change |y.1 - ((b 0).1 : ℝ)| ≤ errorTolerance 0 at h + norm_num [errorTolerance] at h + obtain ⟨hl,hu⟩ := abs_le.mp h + simp only [windowLower, windowUpper, Rat.cast_sub, Rat.cast_add, Rat.cast_ofNat] + constructor <;> linarith + +def evaluate (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : RationalVector := + NonperiodicResidual.evaluate (code I hI (windowLower b) (windowUpper b)) α a b ε hε + +theorem evaluate_spec (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + {y : SpaceTime} {b : ℕ → RationalSpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (residual ν (BalancedVelocity.velocity I hI)) α y - + rationalVector (evaluate I hI α a b ε hε)‖ ≤ (ε : ℝ) := by + have hg := code_germ I hI (windowLower b) (windowUpper b) (named_window hb) + have hj := (mixedDerivative_eventuallyEq (residual_eventuallyEq hg ν) α).self_of_nhds + rw [← hj] + exact NonperiodicResidual.evaluate_spec _ α ha hb ε hε + +def boxForceBound (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) (u v M : ℚ) (a : ℕ → ℚ) : ℕ := + let c := code I hI u v + ⌈(NonperiodicResidual.code c 0).bound α M + + (|a 0|+1) * NonperiodicResidual.laplaceBound c α M⌉₊ + +theorem boxForceBound_spec (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (α : List (Fin 4)) (u v M : ℚ) {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + (y : SpaceTime) (ht : y.1 ∈ Ioo (u : ℝ) v) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + ‖mixedDerivative (residual ν (BalancedVelocity.velocity I hI)) α y‖ ≤ + (boxForceBound I hI α u v M a : ℝ) := by + let c := code I hI u v + have hg := code_germ I hI u v ht + have hj := (mixedDerivative_eventuallyEq (residual_eventuallyEq hg ν) α).self_of_nhds + have hν : |ν| ≤ |((a 0) : ℝ)|+1 := by + have ha0 := ha 0 + norm_num [errorTolerance] at ha0 + linarith [abs_sub_abs_le_abs_sub ν (a 0)] + rw [← hj] + calc + _ ≤ ‖mixedDerivative (residual 0 c.val) α y‖ + + ‖mixedDerivative (residual ν c.val) α y - mixedDerivative (residual 0 c.val) α y‖ := by + simpa only [norm_sub_rev] using norm_le_norm_add_norm_sub + (mixedDerivative (residual 0 c.val) α y) (mixedDerivative (residual ν c.val) α y) + _ ≤ ((NonperiodicResidual.code c 0).bound α M : ℝ) + + (|((a 0) : ℝ)|+1) * (NonperiodicResidual.laplaceBound c α M : ℝ) := by + apply add_le_add + · simpa only [NonperiodicResidual.val, Rat.cast_zero] using + (NonperiodicResidual.code c 0).val_bound α M y hy + · exact (NonperiodicResidual.coefficient_error c α M y hy ν 0).trans + (by simpa only [sub_zero] using (mul_le_mul_of_nonneg_right hν + (Rat.cast_nonneg.mpr (NonperiodicResidual.laplaceBound_nonneg c α M)))) + _ ≤ _ := by + exact_mod_cast Nat.le_ceil ((NonperiodicResidual.code c 0).bound α M + + (|a 0|+1) * NonperiodicResidual.laplaceBound c α M) + +end ForcedComputation.BalancedExpressions + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef213aab7d15e6cebf59ccafea8f65c94d003588 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedExpressions.lean @@ -0,0 +1,145 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicForceEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulseExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularLift + +namespace OAI + +/-! The balanced compiler uses the existing nonperiodic finite syntax. +Periodic time pulses are replaced, on a rational time window, by the finite +set of translates which can meet that window. Spatial cutoffs remain exact +on the whole plane, including their collars. -/ + +noncomputable section +namespace ForcedComputation.BalancedExpressions +open ShearFlows PlanarHamiltonian VelocityDetector Set +open scoped ContDiff BigOperators + +def coordinate (j : Fin 2) : NonperiodicExpr := .coord j.castSucc.succ + +theorem coordinate_val (j : Fin 2) (y : SpaceTime) : + (coordinate j).val y = horizontal y.2 j := by + fin_cases j <;> rfl + +def cutoffCode (R : RationalBox 2) (δ : ℚ) : NonperiodicExpr := + .mul (NonperiodicExpr.composeProfile (.cutoff (R.lower 0-2*δ) (R.lower 0-δ) + (R.upper 0+δ) (R.upper 0+2*δ)) (coordinate 0)) + (NonperiodicExpr.composeProfile (.cutoff (R.lower 1-2*δ) (R.lower 1-δ) + (R.upper 1+δ) (R.upper 1+2*δ)) (coordinate 1)) + +theorem cutoffCode_val (R : RationalBox 2) (δ : ℚ) (y : SpaceTime) : + (cutoffCode R δ).val y = rectangleCutoff R δ (horizontal y.2) := by + simp only [cutoffCode, NonperiodicExpr.val, NonperiodicExpr.val_composeProfile, + ProfileExpr.val_cutoff, coordinate_val, rectangleCutoff, Rat.cast_sub, + Rat.cast_add, Rat.cast_mul, Rat.cast_ofNat] + +def primitiveCode : Primitive → NonperiodicExpr + | .translation v => .sub (.mul (.const (v 0)) (coordinate 1)) + (.mul (.const (v 1)) (coordinate 0)) + | .horizontal c a => .mul (.const (a/2)) + (.mul (.sub (coordinate 1) (.const (c 1))) (.sub (coordinate 1) (.const (c 1)))) + | .vertical c a => .mul (.const (-a/2)) + (.mul (.sub (coordinate 0) (.const (c 0))) (.sub (coordinate 0) (.const (c 0)))) + +theorem primitiveCode_val (p : Primitive) (y : SpaceTime) : + (primitiveCode p).val y = p.potential (horizontal y.2) := by + cases p <;> simp only [primitiveCode, Primitive.potential, NonperiodicExpr.sub, + NonperiodicExpr.val, coordinate_val, translationPotential, horizontalPotential, + verticalPotential, Rat.cast_div, Rat.cast_neg, Rat.cast_ofNat] <;> ring + +def potentialCode (p : Pulse) : NonperiodicExpr := + .mul (cutoffCode p.rectangle p.collar) (primitiveCode p.primitive) + +theorem potentialCode_val (p : Pulse) (y : SpaceTime) : + (potentialCode p).val y = p.hamiltonian (horizontal y.2) := by + rw [potentialCode, NonperiodicExpr.val, cutoffCode_val, primitiveCode_val] + rfl + +def translateIndices (p : Pulse) (u v : ℚ) : Finset ℤ := + Finset.Icc ⌊u-p.finish⌋ ⌈v-p.start⌉ + +def translatePulse (p : Pulse) (k : ℤ) : NonperiodicExpr := + NonperiodicExpr.composeProfile (ProfileExpr.ramp p.start p.finish).diff + (.sub (.coord 0) (.const k)) + +theorem translatePulse_val (p : Pulse) (k : ℤ) (y : SpaceTime) : + (translatePulse p k).val y = smoothPulse p.start p.finish (y.1-k) := by + simp only [translatePulse, NonperiodicExpr.val_composeProfile, NonperiodicExpr.sub, + NonperiodicExpr.val, ProfileExpr.val_diff, ProfileExpr.val_ramp, + timeSpaceCoord, Rat.cast_intCast, Rat.cast_neg, Rat.cast_one, neg_one_mul] + rfl + +def pulseCode (p : Pulse) (u v : ℚ) : NonperiodicExpr := + NonperiodicExpr.sum ((translateIndices p u v).sort (· ≤ ·) |>.map (translatePulse p)) + +theorem pulseCode_val {p : Pulse} (hp : p.Valid) (u v : ℚ) {y : SpaceTime} + (hy : y.1 ∈ Icc (u : ℝ) v) : + (pulseCode p u v).val y = (PeriodicExpr.intervalPulse p.start p.finish).val y.1 := by + rw [pulseCode, NonperiodicExpr.sum_val, List.map_map] + change (((translateIndices p u v).sort (· ≤ ·)).map + (fun k => (translatePulse p k).val y)).sum = _ + rw [((Finset.sort_perm_toList (translateIndices p u v) (· ≤ ·)).map + (fun k => (translatePulse p k).val y)).sum_eq, Finset.sum_map_toList] + have hs : Function.support (smoothPulse (p.start : ℝ) p.finish) ⊆ + Icc (p.start : ℝ) p.finish := + (smoothPulse_support (by exact_mod_cast hp.2)).trans Ioo_subset_Icc_self + have h := periodize_eq_finite (by norm_num : (0 : ℝ) < 1) hs hy + simpa only [translatePulse_val, PeriodicExpr.val, PeriodicExpr.intervalPulse, Rat.cast_one, + ProfileExpr.val_diff, ProfileExpr.val_ramp, smoothPulse, one_mul, div_one, translateIndices, + ← Rat.cast_sub, Rat.floor_cast, Rat.ceil_cast] using h.symm + +def hamiltonianCode {n : ℕ} (p : Fin n → Pulse) (u v : ℚ) : NonperiodicExpr := + NonperiodicExpr.sum (List.ofFn fun i => .mul (pulseCode (p i) u v) (potentialCode (p i))) + +theorem hamiltonianCode_val {n : ℕ} {p : Fin n → Pulse} (hp : ∀ i, (p i).Valid) + (u v : ℚ) {y : SpaceTime} (hy : y.1 ∈ Icc (u : ℝ) v) : + (hamiltonianCode p u v).val y = periodicHamiltonian p y.1 (horizontal y.2) := by + rw [hamiltonianCode, NonperiodicExpr.sum_ofFn_val] + apply Finset.sum_congr rfl + intro i _ + exact congrArg₂ (· * ·) (pulseCode_val (hp i) u v hy) (potentialCode_val (p i) y) + +def hamiltonianField (e : NonperiodicExpr) : NonperiodicVector := + ![e.diff 2, .mul (.const (-1)) (e.diff 1), .const 0] + +private theorem horizontal_derivative {e : NonperiodicExpr} {H : Plane → ℝ} + {t : ℝ} (hH : ContDiff ℝ ∞ H) + (he : ∀ x : Space, e.val (t,x) = H (horizontal x)) (j : Fin 2) (x : Space) : + (e.diff j.castSucc.succ).val (t,x) = spatialD j H (horizontal x) := by + have hs : (fun z : Space => e.val (t,z)) = H ∘ horizontalLinear := by + funext z + simpa only [Function.comp_apply, horizontalLinear_eq] using he z + have heq : fderiv ℝ (fun z : Space => e.val (t,z)) x (ShearFlows.basis j.castSucc) = + fderiv ℝ e.val (t,x) (spaceTimeDirection j.castSucc.succ) := by + have hf := (e.smooth.differentiable (by simp) (t,x)).hasFDerivAt.comp x + ((hasFDerivAt_const (c := t) x).prodMk (hasFDerivAt_id x)) + have hff : fderiv ℝ (fun z : Space => e.val (t,z)) x = + (fderiv ℝ e.val (t,x)).comp + ((0 : Space →L[ℝ] ℝ).prod (ContinuousLinearMap.id ℝ Space)) := hf.fderiv + rw [hff] + rfl + rw [e.val_diff, ← heq, hs] + rw [fderiv_comp x (hH.differentiable (by simp) _) horizontalLinear.differentiableAt, + horizontalLinear.fderiv] + change fderiv ℝ H (horizontalLinear x) (horizontalLinear (ShearFlows.basis j.castSucc)) = _ + rw [VelocityDetector.horizontalLinear_basis, horizontalLinear_eq] + rfl + +theorem hamiltonianField_val {e : NonperiodicExpr} {H : Plane → ℝ} {t : ℝ} + (hH : ContDiff ℝ ∞ H) (he : ∀ x : Space, e.val (t,x) = H (horizontal x)) (x : Space) : + (hamiltonianField e).val (t,x) = planeInclusion (field H (horizontal x)) := by + have h₀ := horizontal_derivative hH he 0 x + have h₁ := horizontal_derivative hH he 1 x + ext j + fin_cases j + · simpa [hamiltonianField, NonperiodicVector.val, planeInclusion, field, + PlanarHamiltonian.basis] using h₁ + · simpa [hamiltonianField, NonperiodicVector.val, planeInclusion, field, + PlanarHamiltonian.basis, NonperiodicExpr.val] using congrArg Neg.neg h₀ + · simp [hamiltonianField, NonperiodicVector.val, planeInclusion, field, + PlanarHamiltonian.basis, NonperiodicExpr.val] + +end ForcedComputation.BalancedExpressions + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFiniteCode.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFiniteCode.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf99f023a5fc07565c00538377edc4913eade59d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFiniteCode.lean @@ -0,0 +1,180 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedVelocity + +namespace OAI + +/-! A finite rational program for the complete balanced velocity on any +bounded time window. The repeated portion is compiled from the machine +alone; the input affects only the translation used during loading. -/ + +noncomputable section +namespace ForcedComputation.BalancedExpressions +open ShearFlows PlanarHamiltonian VelocityDetector Recorder.Planar Set Filter +open scoped Topology ContDiff + +def substitute (σ : Fin 4 → NonperiodicExpr) : NonperiodicExpr → NonperiodicExpr + | .const r => .const r + | .coord j => σ j + | .atom a e => .atom a (substitute σ e) + | .add e f => .add (substitute σ e) (substitute σ f) + | .mul e f => .mul (substitute σ e) (substitute σ f) + +theorem substitute_val (σ : Fin 4 → NonperiodicExpr) (e : NonperiodicExpr) + (y z : SpaceTime) (h : ∀ j, (σ j).val y = timeSpaceCoord j z) : + (substitute σ e).val y = e.val z := by + induction e with + | const => rfl + | coord j => exact h j + | atom a e ih => exact congrArg a.profile.val ih + | add e f ihe ihf => exact congrArg₂ (· + ·) ihe ihf + | mul e f ihe ihf => exact congrArg₂ (· * ·) ihe ihf + +def inverseCoordinates (j : Fin 4) : NonperiodicExpr := + .mul (.const (if j = 2 then 1/16 else 1)) (.coord j) + +theorem inverseCoordinates_val (j : Fin 4) (y : SpaceTime) : + (inverseCoordinates j).val y = timeSpaceCoord j (y.1,BalancedStretch.stretch.symm y.2) := by + fin_cases j + · change ((1 : ℚ) : ℝ) * y.1 = y.1 + norm_num + · change ((1 : ℚ) : ℝ) * y.2 0 = BalancedStretch.stretch.symm y.2 0 + norm_num [BalancedStretch.coefficient] + · change ((1/16 : ℚ) : ℝ) * y.2 1 = BalancedStretch.stretch.symm y.2 1 + norm_num [BalancedStretch.coefficient] + · change ((1 : ℚ) : ℝ) * y.2 2 = BalancedStretch.stretch.symm y.2 2 + norm_num [BalancedStretch.coefficient] + +def stretchCode (c : NonperiodicVector) : NonperiodicVector := fun j => + .mul (.const (if j = 1 then 16 else 1)) (substitute inverseCoordinates (c j)) + +theorem stretchCode_val (c : NonperiodicVector) : + (stretchCode c).val = BalancedStretch.velocity c.val := by + funext y j + change (((if j = 1 then 16 else 1 : ℚ) : ℝ) * _) = _ + rw [substitute_val _ _ _ _ (fun k => inverseCoordinates_val k y)] + simp only [BalancedStretch.velocity, BalancedStretch.push, BalancedStretch.stretch_apply, + BalancedStretch.coefficient, NonperiodicVector.val] + split_ifs <;> norm_num + +def verticalCode : NonperiodicExpr := + NonperiodicExpr.composeProfile (.cutoff (-2) (-1) 1 2) (.coord 3) + +theorem verticalCode_val (y : SpaceTime) : + verticalCode.val y = BalancedBody.verticalCutoff (y.2 2) := by + rw [verticalCode, NonperiodicExpr.val_composeProfile, ProfileExpr.val_cutoff] + change closedCutoff ((-2 : ℚ) : ℝ) ((-1 : ℚ) : ℝ) ((1 : ℚ) : ℝ) + ((2 : ℚ) : ℝ) (y.2 2) = _ + norm_num [BalancedBody.verticalCutoff] + +def liftCode (c : NonperiodicVector) : NonperiodicVector := fun j => .mul verticalCode (c j) + +theorem liftCode_val (c : NonperiodicVector) (y : SpaceTime) : + (liftCode c).val y = BalancedBody.verticalCutoff (y.2 2) • c.val y := by + ext j + exact congrArg (fun r => r * (c j).val y) (verticalCode_val y) + +def bodyCode (M : Alternating.Machine) (hM : M.WellFormed) (u v : ℚ) : NonperiodicVector := + stretchCode (liftCode (hamiltonianField (hamiltonianCode + (normalizedPulse (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) u v))) + +theorem bodyCode_val (M : Alternating.Machine) (hM : M.WellFormed) (u v : ℚ) + {y : SpaceTime} (hy : y.1 ∈ Icc (u : ℝ) v) : + (bodyCode M hM u v).val y = BalancedBody.velocity M hM y := by + rw [bodyCode, stretchCode_val] + change BalancedStretch.stretch ((liftCode _).val + (y.1, BalancedStretch.stretch.symm y.2)) = _ + rw [liftCode_val] + rw [hamiltonianField_val (periodicHamiltonian_slice_smooth _ y.1) + (fun x => hamiltonianCode_val + (normalizedPulse_valid (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) + u v (y := (y.1,x)) hy)] + simp only [BalancedBody.velocity, BalancedStretch.velocity, BalancedStretch.push, + BalancedBody.raw, CompactLift.velocity, CompactLift.spatial, triangularLift, + horizontalLinear_eq, zero_smul, add_zero, BalancedPlanar.bodyVelocity, + compactVelocity, periodicVelocity] + +def loaderPrimitive (q : Fin 2 → ℚ) : Primitive := .translation (fun j => q j - ![4,0] j) + +def loaderPotentialCode (q : Fin 2 → ℚ) : NonperiodicExpr := + .mul (cutoffCode BalancedLoader.rectangle 1) (primitiveCode (loaderPrimitive q)) + +theorem loaderPotentialCode_val (q : Fin 2 → ℚ) (y : SpaceTime) : + (loaderPotentialCode q).val y = BalancedLoader.potential (fun j => (q j : ℝ)) (horizontal y.2) := by + rw [loaderPotentialCode, NonperiodicExpr.val, cutoffCode_val, primitiveCode_val] + simp only [loaderPrimitive, Primitive.potential, BalancedLoader.potential, + BalancedLoader.direction, BalancedLoader.start, Rat.cast_sub] + have he : (fun j => (q j : ℝ) - ((![(4 : ℚ),0] j : ℚ) : ℝ)) = + (fun j => (q j : ℝ)) - ![4,0] := by + funext j + fin_cases j <;> norm_num [Pi.sub_apply] + rw [he] + +def loaderCode (q : Fin 2 → ℚ) : NonperiodicVector := + let p := NonperiodicExpr.composeProfile (ProfileExpr.ramp (1/8) (1/4)).diff (.coord 0) + stretchCode (liftCode (fun j => .mul p (hamiltonianField (loaderPotentialCode q) j))) + +theorem loaderCode_val (q : Fin 2 → ℚ) : + (loaderCode q).val = BalancedLoader.velocity (fun j => (q j : ℝ)) := by + funext y + rw [loaderCode, stretchCode_val] + change BalancedStretch.stretch ((liftCode _).val (y.1,BalancedStretch.stretch.symm y.2)) = _ + rw [liftCode_val] + have hp : (NonperiodicExpr.composeProfile (ProfileExpr.ramp (1/8) (1/4)).diff + (.coord 0)).val (y.1,BalancedStretch.stretch.symm y.2) = BalancedLoader.pulse y.1 := by + rw [NonperiodicExpr.val_composeProfile, ProfileExpr.val_diff, ProfileExpr.val_ramp] + change deriv (smoothRamp ((1/8 : ℚ) : ℝ) ((1/4 : ℚ) : ℝ)) y.1 = _ + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + rfl + have hv : NonperiodicVector.val (fun j => (.mul + (NonperiodicExpr.composeProfile (ProfileExpr.ramp (1/8) (1/4)).diff (.coord 0)) + (hamiltonianField (loaderPotentialCode q) j) : NonperiodicExpr)) + (y.1,BalancedStretch.stretch.symm y.2) = + BalancedLoader.pulse y.1 • (hamiltonianField (loaderPotentialCode q)).val + (y.1,BalancedStretch.stretch.symm y.2) := by + funext j + exact congrArg (fun r => r * _) hp + rw [hv, hamiltonianField_val + ((rectangleCutoff_smooth _ _).mul (translationPotential_smooth _)) + (fun x => loaderPotentialCode_val q (y.1,x))] + simp only [BalancedLoader.velocity, BalancedStretch.velocity, BalancedStretch.push, + BalancedLoader.raw, CompactLift.velocity, CompactLift.spatial, triangularLift, + horizontalLinear_eq, zero_smul, add_zero, BalancedLoader.planarVelocity, + BalancedLoader.spatial, map_smul] + rfl + +def activationCode (M : Alternating.Machine) (hM : M.WellFormed) : NonperiodicExpr := + NonperiodicExpr.composeProfile (ProfileExpr.ramp + (BalancedBody.activationStart (BalancedBody.bodyLength M hM)) + (BalancedBody.activationFinish (BalancedBody.bodyLength M hM))) (.coord 0) + +theorem activationCode_val (M : Alternating.Machine) (hM : M.WellFormed) (y : SpaceTime) : + (activationCode M hM).val y = BalancedBody.activation M hM y.1 := by + rw [activationCode, NonperiodicExpr.val_composeProfile, ProfileExpr.val_ramp] + rfl + +def code (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (u v : ℚ) : NonperiodicVector := + fun j => .add (loaderCode (BalancedPlanar.inputPosition I hI) j) + (.mul (activationCode I.1 hI.1) (bodyCode I.1 hI.1 u v j)) + +theorem code_val (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (u v : ℚ) + {y : SpaceTime} (hy : y.1 ∈ Icc (u : ℝ) v) : + (code I hI u v).val y = BalancedVelocity.velocity I hI y := by + have hL := congrFun (loaderCode_val (BalancedPlanar.inputPosition I hI)) y + rw [← BalancedPlanar.inputCode_rational I hI] at hL + have hB := bodyCode_val I.1 hI.1 u v hy + ext j + change (loaderCode _).val y j + (activationCode _ _).val y * (bodyCode _ _ _ _).val y j = _ + rw [hL, activationCode_val, hB] + rfl + +theorem code_germ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (u v : ℚ) + {y : SpaceTime} (hy : y.1 ∈ Ioo (u : ℝ) v) : + (code I hI u v).val =ᶠ[𝓝 y] BalancedVelocity.velocity I hI := by + filter_upwards [(continuous_fst.tendsto y).eventually (Ioo_mem_nhds hy.1 hy.2)] with z hz + exact code_val I hI u v ⟨hz.1.le,hz.2.le⟩ + +end ForcedComputation.BalancedExpressions + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab2358e4db172707131eb2e7d8e03bc14e7028d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedFluid.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedPath +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedEuclidean + +namespace OAI + +/-! The compact balanced application: a machine-only repeated field, a +finite initial loader, and the fixed open-cube material observation. -/ + +noncomputable section +namespace ForcedComputation.Balanced +open ShearFlows Set Filter Recorder.Planar RapidForcing.CompactEmbedding +open scoped ContDiff Topology + +def velocity (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Velocity := + BalancedVelocity.velocity I hI + +def force (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (ν : ℝ) : Velocity := + residual ν (velocity I hI) + +def initialLabel : AlternatingNS.Space := piCoordinates.symm ![4,0,0] + +def observer : Set AlternatingNS.Space := {x | ∀ j : Fin 3, -1 < x j ∧ x j < 2} + +theorem force_tail (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ) {t : ℝ} (ht : 1 ≤ t) (x : Space) : + force I hI ν (t,x) = residual ν (BalancedBody.velocity I.1 hI.1) (t,x) := by + have he : EqOn (fun s => force I hI ν (s,x)) + (fun s => residual ν (BalancedBody.velocity I.1 hI.1) (s,x)) (Ioi 1) := by + intro s hs + apply residual_congr_germ + filter_upwards [(continuous_fst.tendsto (s,x)).eventually + (eventually_gt_nhds hs)] with y hy + exact BalancedVelocity.tail I hI hy.le y.2 + have h₁ : Continuous (fun s => force I hI ν (s,x)) := + (residual_smooth (BalancedVelocity.smooth I hI) ν).continuous.comp + (continuous_id.prodMk continuous_const) + have h₂ : Continuous (fun s => residual ν (BalancedBody.velocity I.1 hI.1) (s,x)) := + (residual_smooth (BalancedBody.velocity_smooth I.1 hI.1) ν).continuous.comp + (continuous_id.prodMk continuous_const) + exact he.closure h₁ h₂ (by + rw [closure_Ioi] + change 1 ≤ t + exact ht) + +theorem force_tail_periodic (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ) {t : ℝ} (ht : 1 ≤ t) (x : Space) : + force I hI ν (t+1,x) = force I hI ν (t,x) := by + rw [force_tail I hI ν (by linarith), force_tail I hI ν ht] + exact BalancedVelocity.residual_periodic + (BalancedBody.velocity_smooth I.1 hI.1) + (BalancedBody.velocity_periodic I.1 hI.1) ν t x + +/-- Every clause refers to the named prescribed force and its actual +Euclidean Navier--Stokes solution. -/ +def FluidProperties (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ) : Prop := + let V := velocity I hI + let f := force I hI ν + let U := CompactEuclidean.velocity V + let F := CompactEuclidean.velocity f + ContDiff ℝ ∞ V ∧ ContDiff ℝ ∞ f ∧ + BoundedMixedDerivatives V ∧ BoundedMixedDerivatives f ∧ + (∀ t, tsupport (fun x => V (t,x)) ⊆ BalancedVelocity.support ∧ + tsupport (fun x => f (t,x)) ⊆ BalancedVelocity.support) ∧ + (∀ t, 1 ≤ t → ∀ x, V (t,x) = BalancedBody.velocity I.1 hI.1 (t,x) ∧ + V (t+1,x) = V (t,x) ∧ + f (t,x) = residual ν (BalancedBody.velocity I.1 hI.1) (t,x) ∧ + f (t+1,x) = f (t,x)) ∧ + AlternatingNS.NavierStokes ν F U (fun _ _ => 0) ∧ + AlternatingNS.EnergyClass U (fun _ _ => 0) ∧ + (∀ v p, CompactEuclidean.IsEnergySolutionModuloConstants ν F v p → + ∃ c : ℝ → ℝ, ∀ t, 0 ≤ t → ∀ x, v t x = U t x ∧ p t x = c t) ∧ + ∃ X : AlternatingNS.Space → ℝ → AlternatingNS.Space, + (∀ a, AlternatingNS.IsTrajectory U a (X a)) ∧ + (∀ a γ, AlternatingNS.IsTrajectory U a γ → ∀ t, 0 ≤ t → γ t = X a t) ∧ + ((∃ t, 0 ≤ t ∧ X initialLabel t ∈ observer) ↔ Alternating.Halts I) + +theorem fluid_properties (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {ν : ℝ} (hν : 0 < ν) : FluidProperties I hI ν := by + have hs := BalancedVelocity.smooth I hI + have hsupport (t : ℝ) : Function.support (fun x => velocity I hI (t,x)) ⊆ + BalancedVelocity.support := + (subset_tsupport _).trans (BalancedVelocity.supported I hI t) + obtain ⟨hsol,hE,huniq⟩ := CompactEuclidean.compact_prescribed_solution hν hs + BalancedVelocity.support_compact hsupport + (fun x => BalancedVelocity.zero_before I hI (by norm_num) x) + (BalancedVelocity.solenoidal I hI) + obtain ⟨X,hX,hXuniq⟩ := CompactEuclidean.velocity_global_material_flow hs + BalancedVelocity.support_compact hsupport + refine ⟨hs, residual_smooth hs ν, BalancedVelocity.bounded I hI, + BalancedVelocity.force_bounded I hI ν, + fun t => ⟨BalancedVelocity.supported I hI t, BalancedVelocity.force_supported I hI ν t⟩, + fun t ht x => ⟨BalancedVelocity.tail I hI ht x, + by + change BalancedVelocity.velocity I hI (t+1,x) = BalancedVelocity.velocity I hI (t,x) + rw [BalancedVelocity.tail I hI (by linarith), BalancedVelocity.tail I hI ht, + BalancedBody.velocity_periodic], + force_tail I hI ν ht x, force_tail_periodic I hI ν ht x⟩, + hsol,hE,huniq,X,hX,hXuniq,?_⟩ + obtain ⟨Ψ,hΨ⟩ := compactVelocity_transitions (BalancedPlanar.referenceInput I.1) + (BalancedPlanar.referenceValid hI.1) + obtain ⟨Ω,hΩ⟩ := exists_planarTransition + (normalizedHamiltonian_valid (BalancedPlanar.referenceInput I.1) + (BalancedPlanar.referenceValid hI.1)) + (normalizedHamiltonian_noTime (BalancedPlanar.referenceInput I.1) + (BalancedPlanar.referenceValid hI.1)) + let γ : ℝ → AlternatingNS.Space := fun t => piCoordinates.symm (BalancedPath.path I hI Ψ t) + have hγ : AlternatingNS.IsTrajectory (CompactEuclidean.velocity (velocity I hI)) + initialLabel γ := by + refine ⟨congrArg piCoordinates.symm (BalancedPath.path_initial I hI Ψ),?_⟩ + intro t _ + let : AddCommGroup AlternatingNS.Space := WithLp.instAddCommGroup 2 (Fin 3 → ℝ) + let : Module ℝ AlternatingNS.Space := WithLp.instModule 2 ℝ (Fin 3 → ℝ) + let : TopologicalSpace AlternatingNS.Space := PiLp.topologicalSpace 2 (fun _ : Fin 3 => ℝ) + let lift : Space →L[ℝ] AlternatingNS.Space := + { toFun := fun x => WithLp.toLp 2 x + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl + cont := PiLp.continuous_toLp 2 (fun _ : Fin 3 => ℝ) } + have hd := lift.hasFDerivAt.comp_hasDerivAt t (BalancedPath.path_deriv I hI hΨ t) + convert hd.hasDerivWithinAt (s := Ici 0) using 1 <;> + simp only [γ, lift, Function.comp_def, CompactEuclidean.velocity, velocity, + piCoordinates, ContinuousLinearEquiv.apply_symm_apply] <;> rfl + have he (t : ℝ) (ht : 0 ≤ t) : γ t = X initialLabel t := hXuniq _ _ hγ t ht + have hob := BalancedPath.path_observation I hI hΨ hΩ + constructor + · rintro ⟨t,ht,hobs⟩ + apply hob.mp + refine ⟨t,ht,?_⟩ + intro j + have hj := hobs j + rw [← he t ht] at hj + change -1 < piCoordinates.symm (BalancedPath.path I hI Ψ t) j ∧ + piCoordinates.symm (BalancedPath.path I hI Ψ t) j < 2 at hj + exact hj + · intro hh + obtain ⟨t,ht,hobs⟩ := hob.mpr hh + refine ⟨t,ht,?_⟩ + intro j + rw [← he t ht] + exact hobs j + +end ForcedComputation.Balanced + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedLoader.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedLoader.lean new file mode 100644 index 0000000000000000000000000000000000000000..eafb2695802a5b89ee160afb5dc446b377d17fc6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedLoader.lean @@ -0,0 +1,201 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedActivation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedPlanarOrbit + +namespace OAI + +/-! One compact Hamiltonian translation loads the input point. The source +and target belong to a fixed rectangle, hence its whole straight path is +inside the cutoff plateau and outside the balanced cube after stretching. -/ + +noncomputable section +namespace ForcedComputation.BalancedLoader +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +def start : Plane := ![4, 0] +def rectangle : RationalBox 2 := ⟨![0, -1], ![4, 1]⟩ +def direction (q : Plane) : Plane := q - start + +def potential (q : Plane) (x : Plane) : ℝ := + rectangleCutoff rectangle 1 x * translationPotential (direction q) x + +def spatial (q : Plane) : Plane → Plane := field (potential q) +def clock : ℝ → ℝ := smoothRamp (1 / 8) (1 / 4) +def pulse : ℝ → ℝ := smoothPulse (1 / 8) (1 / 4) +def planarVelocity (q : Plane) (t : ℝ) (x : Plane) : Plane := pulse t • spatial q x + +def planarPath (q : Plane) (t : ℝ) : Plane := start + clock t • direction q + +def raw (q : Plane) : Velocity := CompactLift.velocity BalancedBody.verticalCutoff (planarVelocity q) +def velocity (q : Plane) : Velocity := BalancedStretch.velocity (raw q) +def path (q : Plane) (t : ℝ) : Space := BalancedStretch.stretch (atHeight (planarPath q t) 0) + +theorem spatial_smooth (q : Plane) : ContDiff ℝ ∞ (spatial q) := + field_smooth ((rectangleCutoff_smooth rectangle 1).mul (translationPotential_smooth _)) + +theorem planarVelocity_smooth (q : Plane) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => planarVelocity q y.1 y.2) := + ((smoothPulse_smooth _ _).comp contDiff_fst).smul ((spatial_smooth q).comp contDiff_snd) + +theorem velocity_smooth (q : Plane) : ContDiff ℝ ∞ (velocity q) := + BalancedStretch.velocity_smooth + (CompactLift.velocity_smooth BalancedBody.verticalCutoff_smooth (planarVelocity_smooth q)) + +theorem planarPath_in_rectangle {q : Plane} (hq : ∀ j, 0 ≤ q j ∧ q j ≤ 1) (t : ℝ) : + planarPath q t ∈ rectangle.carrier := by + have hc := smoothRamp_range (1 / 8) (1 / 4) t + obtain ⟨hc0, hc1⟩ := hc + intro j + fin_cases j + · norm_num [rectangle, planarPath, direction, start, Matrix.vecHead, Matrix.vecTail] + dsimp only [clock] at * + constructor + · nlinarith [mul_nonneg hc0 (hq 0).1] + · have hp := mul_nonpos_of_nonneg_of_nonpos hc0 + (show q 0 - 4 ≤ 0 by linarith [(hq 0).2]) + nlinarith + · norm_num [rectangle, planarPath, direction, start, Matrix.vecHead, Matrix.vecTail] + dsimp only [clock] at * + constructor + · nlinarith [mul_nonneg hc0 (hq 1).1] + · nlinarith [mul_le_mul hc1 (hq 1).2 (hq 1).1 (by norm_num : (0 : ℝ) ≤ 1)] + +theorem spatial_on_rectangle (q : Plane) {x : Plane} (hx : x ∈ rectangle.carrier) : + spatial q x = direction q := by + change field (fun y => rectangleCutoff rectangle 1 y * translationPotential (direction q) y) x = _ + rw [field_cutoff_plateau _ _ + (rectangleCutoff_one_near (by norm_num : (0 : ℚ) < 1) hx), field_translation] + +theorem planarPath_deriv {q : Plane} (hq : ∀ j, 0 ≤ q j ∧ q j ≤ 1) (t : ℝ) : + HasDerivAt (planarPath q) (planarVelocity q t (planarPath q t)) t := by + have hθ : HasDerivAt clock (pulse t) t := + ((smoothRamp_smooth (1 / 8) (1 / 4)).differentiable (by simp) t).hasDerivAt + have hd := (hθ.smul_const (direction q)).const_add start + have he : planarVelocity q t (planarPath q t) = pulse t • direction q := by + rw [planarVelocity, spatial_on_rectangle q (planarPath_in_rectangle hq t)] + rw [he] + exact hd + +theorem path_deriv {q : Plane} (hq : ∀ j, 0 ≤ q j ∧ q j ≤ 1) (t : ℝ) : + HasDerivAt (path q) (velocity q (t, path q t)) t := by + have h := CompactLift.trajectory_atHeight (V := planarVelocity q) (a := 0) + BalancedBody.verticalCutoff_zero (by simpa only [zero_add] using planarPath_deriv hq t) + apply hasDerivAt_pi.mpr + intro j + simpa only [zero_add, path, velocity, raw] using + (hasDerivAt_pi.mp (BalancedStretch.trajectory h)) j + +theorem path_before (q : Plane) {t : ℝ} (ht : t ≤ 1 / 8) : + path q t = ![4, 0, 0] := by + have hc : clock t = 0 := smoothRamp_before (by norm_num) ht + ext j + fin_cases j <;> simp [path, planarPath, hc, start, BalancedStretch.coefficient, atHeight] + +theorem path_after (q : Plane) {t : ℝ} (ht : 1 / 4 ≤ t) : + path q t = BalancedStretch.stretch (atHeight q 0) := by + have hc : clock t = 1 := smoothRamp_after (by norm_num) ht + rw [path, planarPath, hc, one_smul, direction] + congr 2 + abel + +theorem path_safe {q : Plane} (hq : 4 ≤ q 0 + 16 * q 1) (t : ℝ) : + path q t ∉ BalancedStretch.observer := by + have hc := smoothRamp_range (1 / 8) (1 / 4) t + have he : path q t = (1 - clock t) • ![4, 0, 0] + + clock t • BalancedStretch.stretch (atHeight q 0) := by + ext j + fin_cases j <;> simp [path, planarPath, direction, start, atHeight, + BalancedStretch.coefficient, Matrix.vecHead, Matrix.vecTail] <;> ring + rw [he] + apply BalancedStretch.loading_outside + · simpa [BalancedStretch.coefficient, atHeight] using hq + · exact hc + +theorem velocity_before (q : Plane) {t : ℝ} (ht : t ≤ 1 / 8) (x : Space) : + velocity q (t, x) = 0 := by + have hp : pulse t = 0 := smoothPulse_before (by norm_num) ht + simp [velocity, BalancedStretch.velocity, BalancedStretch.push, raw, CompactLift.velocity, + CompactLift.spatial, VelocityDetector.triangularLift, planarVelocity, hp] + +theorem velocity_after (q : Plane) {t : ℝ} (ht : 1 / 4 ≤ t) (x : Space) : + velocity q (t, x) = 0 := by + have hp : pulse t = 0 := smoothPulse_after (by norm_num) ht + simp [velocity, BalancedStretch.velocity, BalancedStretch.push, raw, CompactLift.velocity, + CompactLift.spatial, VelocityDetector.triangularLift, planarVelocity, hp] + + +def rawSupport : Set Space := Icc ![-2, -3, -2] ![6, 3, 2] +def support : Set Space := BalancedStretch.stretch '' rawSupport + +theorem support_compact : IsCompact support := + (isCompact_Icc : IsCompact rawSupport).image BalancedStretch.stretch.continuous + +theorem spatial_support (q : Plane) : + tsupport (spatial q) ⊆ (rectangleCollar rectangle 1).carrier := + (field_tsupport (potential q)).trans + (tsupport_mul_subset_left.trans (closure_minimal + (rectangleCutoff_support (by norm_num : (0 : ℚ) < 1)) + (rectangleCollar_compact rectangle 1).isClosed)) + +theorem raw_support (q : Plane) (t : ℝ) : + tsupport (fun x => raw q (t, x)) ⊆ rawSupport := by + apply closure_minimal _ (isCompact_Icc : IsCompact rawSupport).isClosed + intro x hx + have hχ : BalancedBody.verticalCutoff (x 2) ≠ 0 := by + intro hz + apply hx + simp only [raw, CompactLift.velocity, CompactLift.spatial, hz, zero_smul] + have hV : spatial q (horizontal x) ≠ 0 := by + intro hz + apply hx + simp only [raw, CompactLift.velocity, CompactLift.spatial, VelocityDetector.triangularLift, + VelocityDetector.horizontalLinear_eq, planarVelocity, hz, smul_zero, + map_zero, zero_smul, add_zero] + have hp := spatial_support q (subset_tsupport _ hV) + have hz := closedCutoff_support (by norm_num : (-2 : ℝ) < -1) + (by norm_num : (1 : ℝ) < 2) hχ + have h₀ := hp (0 : Fin 2) + have h₁ := hp (1 : Fin 2) + norm_num [rectangleCollar, rectangle] at h₀ h₁ + constructor <;> intro j <;> fin_cases j + · exact h₀.1 + · exact h₁.1 + · exact hz.1.le + · exact h₀.2 + · exact h₁.2 + · exact hz.2.le + +theorem velocity_support (q : Plane) (t : ℝ) : + tsupport (fun x => velocity q (t, x)) ⊆ support := by + change tsupport (BalancedStretch.push (fun x => raw q (t,x))) ⊆ + BalancedStretch.stretch '' rawSupport + exact BalancedStretch.push_support (a := fun x => raw q (t,x)) (K := rawSupport) + (isCompact_Icc : IsCompact rawSupport).isClosed (raw_support q t) + +theorem planarVelocity_divergence (q : Plane) (t : ℝ) (x : Plane) : + PlanarHamiltonian.divergence (planarVelocity q t) x = 0 := by + have he : planarVelocity q t = field (fun y => pulse t * potential q y) := by + funext y + exact (field_const_mul ((rectangleCutoff_smooth rectangle 1).mul + (translationPotential_smooth _)) _ _).symm + rw [he] + exact field_divergence (contDiff_const.mul + ((rectangleCutoff_smooth rectangle 1).mul (translationPotential_smooth _))) x + +theorem raw_divergence (q : Plane) (t : ℝ) (x : Space) : + divergence (fun y => raw q (t, y)) x = 0 := by + have hs : ContDiff ℝ ∞ (planarVelocity q t) := + (contDiff_const : ContDiff ℝ ∞ (fun _ : Plane => pulse t)).smul (spatial_smooth q) + rw [show (fun y => raw q (t, y)) = + CompactLift.spatial BalancedBody.verticalCutoff (planarVelocity q t) from rfl, + CompactLift.spatial_divergence BalancedBody.verticalCutoff_smooth hs, + planarVelocity_divergence, mul_zero] + +theorem velocity_divergence (q : Plane) : Solenoidal (velocity q) := + BalancedStretch.velocity_divergence (raw_divergence q) + +end ForcedComputation.BalancedLoader + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ca2a816f1d0a6645333ed12fdd687accb982f74 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedMain.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedCoefficientEvaluation + +namespace OAI + +/-! The compact balanced main theorem includes a terminating evaluator +for every mixed derivative of the prescribed force. -/ + +noncomputable section +namespace ForcedComputation.Balanced +open ShearFlows Set +open scoped ContDiff + +/-- The two finite coefficients prescribe the compact zero-data flow for +every viscosity; named finite queries evaluate every force derivative. -/ +theorem balanced_three_stack_realization : + IsCompact BalancedVelocity.support ∧ + ∀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I), + (∀ ν : ℝ, force I hI ν = BalancedVelocity.force₀ I hI + + ν • BalancedVelocity.force₁ I hI) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (BalancedVelocity.force₀ I hI) α y - + rationalVector (BalancedExpressions.evaluateCoefficient₀ I hI α b ε hε)‖ ≤ (ε : ℝ) ∧ + ‖mixedDerivative (BalancedVelocity.force₁ I hI) α y - + rationalVector (BalancedExpressions.evaluateCoefficient₁ I hI α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ ν : ℝ, 0 < ν → FluidProperties I hI ν) ∧ + (∀ (ν : ℝ) (a : ℕ → ℚ), IsFastRealName a ν → + ∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (force I hI ν) α y - + rationalVector (BalancedExpressions.evaluate I hI α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (ν : ℝ) (a : ℕ → ℚ), IsFastRealName a ν → + ∀ (α : List (Fin 4)) (u v M : ℚ) (y : SpaceTime), + y.1 ∈ Ioo (u : ℝ) v → + (∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) → + ‖mixedDerivative (force I hI ν) α y‖ ≤ + (BalancedExpressions.boxForceBound I hI α u v M a : ℝ)) := by + refine ⟨BalancedVelocity.support_compact,?_⟩ + intro I hI + refine ⟨BalancedVelocity.force_affine I hI,?_, + fun ν hν => fluid_properties I hI hν,?_,?_⟩ + · intro α b y hb ε hε + exact ⟨BalancedExpressions.evaluateCoefficient₀_spec I hI α hb ε hε, + BalancedExpressions.evaluateCoefficient₁_spec I hI α hb ε hε⟩ + · intro ν a ha α b y hb ε hε + exact BalancedExpressions.evaluate_spec I hI α ha hb ε hε + · intro ν a ha α u v M y ht hy + exact BalancedExpressions.boxForceBound_spec I hI α u v M ha y ht hy + +end ForcedComputation.Balanced + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPath.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..946c8f1794dfcfacc331b87041fe16d400815ed5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPath.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedVelocity + +namespace OAI + +/-! The loading trajectory and the compact planar trajectory join with zero +velocity at time one. This identifies the fixed Euclidean particle without +assuming a computational flow or a halting correspondence. -/ + +noncomputable section +namespace ForcedComputation.BalancedPath +open ShearFlows Recorder.Planar PlanarHamiltonian Set Filter +open scoped ContDiff Topology + +def bodyPath (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ψ : ℝ → ℝ → Plane → Plane) (t : ℝ) : Space := + BalancedStretch.stretch (atHeight (Ψ 0 (t - 1) (BalancedPlanar.inputCode I hI)) 0) + +def path (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ψ : ℝ → ℝ → Plane → Plane) (t : ℝ) : Space := + if t ≤ 1 then BalancedLoader.path (BalancedPlanar.inputCode I hI) t else bodyPath I hI Ψ t + +private theorem body_zero_phase (M : Alternating.Machine) (hM : M.WellFormed) (x : Space) : + BalancedBody.velocity M hM (0,x) = 0 := by + have hz := (periodicVelocity_zero_near_zero + (normalizedPulse_valid (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM)) + (normalizedPulse_inUnit (BalancedPlanar.referenceInput M) (BalancedPlanar.referenceValid hM))).self_of_nhds + have hv : ∀ z, BalancedPlanar.bodyVelocity M hM 0 z = 0 := hz + simp only [BalancedBody.velocity, BalancedStretch.velocity, BalancedStretch.push, + BalancedBody.raw, CompactLift.velocity, CompactLift.spatial, + VelocityDetector.triangularLift, VelocityDetector.horizontalLinear_eq, hv, + map_zero, zero_smul, add_zero, smul_zero] + +theorem bodyPath_one (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (BalancedPlanar.bodyVelocity I.1 hI.1) Ψ) : + bodyPath I hI Ψ 1 = BalancedLoader.path (BalancedPlanar.inputCode I hI) 1 := by + rw [BalancedLoader.path_after _ (by norm_num)] + simp only [bodyPath, sub_self, hΨ.initial] + +theorem bodyPath_deriv (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (BalancedPlanar.bodyVelocity I.1 hI.1) Ψ) (t : ℝ) : + HasDerivAt (bodyPath I hI Ψ) + (BalancedBody.velocity I.1 hI.1 (t-1, bodyPath I hI Ψ t)) t := by + have hp := hΨ.ode 0 (t-1) (BalancedPlanar.inputCode I hI) + have hl := CompactLift.trajectory_atHeight + (χ := BalancedBody.verticalCutoff) (a := 0) (z := 0) + BalancedBody.verticalCutoff_zero hp + have hs := BalancedStretch.trajectory hl + have hc := hs.scomp t ((hasDerivAt_id t).sub_const 1) + apply hasDerivAt_pi.mpr + intro j + simpa only [Function.comp_def, one_smul, zero_add, id_eq, bodyPath, + BalancedBody.velocity, BalancedBody.raw] using (hasDerivAt_pi.mp hc) j + +private theorem glue_deriv {f g : ℝ → Space} {v : Space} + (hf : HasDerivAt f v 1) (hg : HasDerivAt g v 1) (he : f 1 = g 1) : + HasDerivAt (fun t => if t ≤ 1 then f t else g t) v 1 := by + have hl : HasDerivWithinAt (fun t => if t ≤ 1 then f t else g t) v (Iic 1) 1 := + (hf.hasDerivWithinAt (s := Iic (1 : ℝ))).congr_of_mem + (fun t ht => ite_eq_left ht) + (by change (1 : ℝ) ≤ 1; exact le_rfl) + have hr : HasDerivWithinAt (fun t => if t ≤ 1 then f t else g t) v (Ici 1) 1 := by + apply (hg.hasDerivWithinAt (s := Ici (1 : ℝ))).congr_of_mem _ + (by change (1 : ℝ) ≤ 1; exact le_rfl) + intro t ht + by_cases ht' : t ≤ 1 + · have h : t = 1 := le_antisymm ht' ht + simpa only [h, ite_eq_left le_rfl] using he + · exact ite_eq_right ht' + simpa only [Iic_union_Ici, hasDerivWithinAt_univ] using hl.union hr + +theorem path_deriv (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (BalancedPlanar.bodyVelocity I.1 hI.1) Ψ) (t : ℝ) : + HasDerivAt (path I hI Ψ) (BalancedVelocity.velocity I hI (t,path I hI Ψ t)) t := by + have hq : ∀ j, 0 ≤ BalancedPlanar.inputCode I hI j ∧ BalancedPlanar.inputCode I hI j ≤ 1 := + fun j => ⟨(BalancedPlanar.inputCode_in_unit I hI j).1.le, + (BalancedPlanar.inputCode_in_unit I hI j).2.le⟩ + rcases lt_trichotomy t 1 with ht | rfl | ht + · have he : path I hI Ψ =ᶠ[𝓝 t] BalancedLoader.path (BalancedPlanar.inputCode I hI) := by + filter_upwards [eventually_lt_nhds ht] with s hs + exact ite_eq_left hs.le + rw [he.self_of_nhds, BalancedVelocity.before I hI ht.le] + exact (BalancedLoader.path_deriv hq t).congr_of_eventuallyEq he + · have hl := BalancedLoader.path_deriv hq 1 + rw [BalancedLoader.velocity_after _ (by norm_num)] at hl + have hr := bodyPath_deriv I hI hΨ 1 + rw [sub_self, body_zero_phase] at hr + have hh := glue_deriv hl hr (bodyPath_one I hI hΨ).symm + have hz : BalancedVelocity.velocity I hI (1,path I hI Ψ 1) = 0 := by + rw [BalancedVelocity.before I hI le_rfl, BalancedLoader.velocity_after _ (by norm_num)] + rw [hz] + exact hh + · have he : path I hI Ψ =ᶠ[𝓝 t] bodyPath I hI Ψ := by + filter_upwards [eventually_gt_nhds ht] with s hs + exact ite_eq_right (not_le.mpr hs) + rw [he.self_of_nhds, BalancedVelocity.tail I hI ht.le] + have hp := BalancedBody.velocity_periodic I.1 hI.1 (t-1) (bodyPath I hI Ψ t) + rw [sub_add_cancel] at hp + rw [hp] + exact (bodyPath_deriv I hI hΨ t).congr_of_eventuallyEq he + +theorem path_initial (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (Ψ : ℝ → ℝ → Plane → Plane) : path I hI Ψ 0 = ![4,0,0] := by + rw [path, ite_eq_left (by norm_num), BalancedLoader.path_before _ (by norm_num)] + +theorem path_after (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (BalancedPlanar.bodyVelocity I.1 hI.1) Ψ) + {t : ℝ} (ht : 1 ≤ t) : path I hI Ψ t = bodyPath I hI Ψ t := by + by_cases h : t ≤ 1 + · have he : t = 1 := le_antisymm h ht + rw [he, path, ite_eq_left le_rfl, bodyPath_one I hI hΨ] + · exact ite_eq_right h + +theorem path_observation (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ Ω : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (BalancedPlanar.bodyVelocity I.1 hI.1) Ψ) + (hΩ : IsPlanarTransition (planarSlice (BalancedPlanar.bodyHamiltonian I.1 hI.1)) Ω) : + (∃ t, 0 ≤ t ∧ path I hI Ψ t ∈ BalancedStretch.observer) ↔ Alternating.Halts I := by + have hsame (t : ℝ) : Ψ 0 t (BalancedPlanar.inputCode I hI) = + Ω 0 t (BalancedPlanar.inputCode I hI) := + compactTransition_eq_slice (BalancedPlanar.referenceInput I.1) + (BalancedPlanar.referenceValid hI.1) hΨ hΩ + (BalancedPlanar.inputCode_in_unit I hI) 0 t + constructor + · rintro ⟨t, ht, he⟩ + by_contra hn + by_cases h : t ≤ 1 + · rw [path, ite_eq_left h] at he + exact BalancedLoader.path_safe (BalancedPlanar.inputCode_loader_guard I hI) t he + · rw [path_after I hI hΨ (le_of_not_ge h), bodyPath, hsame] at he + exact BalancedStretch.nonhalting_outside + (BalancedPlanar.body_nonhalting_corridor I hI hΩ hn (by linarith)).2 he + · intro hh + obtain ⟨n, hx, hy⟩ := BalancedPlanar.body_halting_clearance I hI hΩ hh + refine ⟨(n : ℝ)+1, by positivity, ?_⟩ + rw [path_after I hI hΨ (by have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n; linarith), + bodyPath, add_sub_cancel_right, hsame] + exact BalancedStretch.halting_inside hx hy + +end ForcedComputation.BalancedPath + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarOrbit.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..e073a28fa5d3e68c03f8b97d169e4e7a5b248de2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarOrbit.lean @@ -0,0 +1,145 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedPlanarProgram + +namespace OAI + +/-! The same machine-only body processes every input point. Quantitative +orbit bounds make the all-time cube guard independent of the choice of +compact vertical cutoff. -/ + +noncomputable section +namespace ForcedComputation.BalancedPlanar +open ShearFlows Recorder Recorder.Planar Set + +/-- The input point is rational and can be used as the loading target. -/ +def inputPosition (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Fin 2 → ℚ := + fun j => initialPoint (freshInput I) (freshInput_valid hI) j + referenceShift I.1 hI.1 j + +theorem inputCode_rational (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + inputCode I hI = fun j => (inputPosition I hI j : ℝ) := by + change shiftPoint (referenceShift I.1 hI.1) + (point (freshInput I).1 (freshInput_valid hI).1 + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI))) = _ + rw [← initialPoint_spec (freshInput I) (freshInput_valid hI)] + funext j + simp only [shiftPoint, inputPosition, Rat.cast_add] + +theorem inputCode_bounds (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + |inputCode I hI 0 - 1 / 4| ≤ 1 / 256 ∧ + |inputCode I hI 1 - 1 / 4| ≤ 3 / 512 := by + have hr := referenceShift_small I.1 hI.1 + have hi := initialShift_small (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI) + have he (j : Fin 2) : inputCode I hI j - 1 / 4 = + (referenceShift I.1 hI.1 j : ℝ) - + (initialShift (freshInput I) (freshInput_valid hI) j : ℝ) := by + rw [inputCode_rational] + simp only [inputPosition, initialShift, Rat.cast_add, Rat.cast_sub, Rat.cast_div, + Rat.cast_one, Rat.cast_ofNat] + ring + constructor + · rw [he] + exact (abs_sub _ _).trans (by linarith [hr.1, hi.1]) + · rw [he] + exact (abs_sub _ _).trans (by linarith [hr.2, hi.2]) + +theorem inputCode_in_unit (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ∀ j : Fin 2, 0 < inputCode I hI j ∧ inputCode I hI j < 1 := by + have h := inputCode_bounds I hI + intro j + fin_cases j + · change 0 < inputCode I hI 0 ∧ inputCode I hI 0 < 1 + obtain ⟨hl, hu⟩ := abs_le.mp h.1 + constructor <;> linarith + · change 0 < inputCode I hI 1 ∧ inputCode I hI 1 < 1 + obtain ⟨hl, hu⟩ := abs_le.mp h.2 + constructor <;> linarith + +theorem inputCode_loader_guard (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + 4 ≤ inputCode I hI 0 + 16 * inputCode I hI 1 := by + have h := inputCode_bounds I hI + obtain ⟨hl, _⟩ := abs_le.mp h.1 + obtain ⟨hy, _⟩ := abs_le.mp h.2 + linarith + +theorem body_periodic (M : Alternating.Machine) (hM : M.WellFormed) (x : Plane) : + Function.Periodic (fun t => planarSlice (bodyHamiltonian M hM) t x) 1 := + planarSlice_periodic (normalizedHamiltonian_periodic (referenceInput M) (referenceValid hM)) x + +theorem body_nonhalting_corridor (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian I.1 hI.1)) Ψ) + (hno : ¬ Alternating.Halts I) {t : ℝ} (ht : 0 ≤ t) : + Ψ 0 t (inputCode I hI) ∈ clockRectangle.carrier ∧ + 3 / 16 ≤ Ψ 0 t (inputCode I hI) 1 := by + let J := freshInput I + have hJ : Alternating.ValidInput J := freshInput_valid hI + have hnoJ : ¬ Alternating.Halts J := fun hh => hno ((freshInput_halts_iff hI).mp hh) + let C₀ := finiteInitializedRecorder J hJ + have hn := finite_work_nonhalting J hJ hnoJ + have hsteps (n : ℕ) : Steps (finiteMachine J.1 hJ.1) n C₀ + (run (finiteMachine J.1 hJ.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine J.1 hJ.1) + (run (finiteMachine J.1 hJ.1) C₀ n) (run (finiteMachine J.1 hJ.1) C₀ (n + 1)) := + run_step_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting J.1 + (run (finiteMachine J.1 hJ.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State J.1) (Alphabet J.1)) : + haltingControl (finiteMachine J.1 hJ.1) q = recorderHalting J.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hs : t - (n : ℝ) ∈ Icc (0 : ℝ) 1 := by constructor <;> linarith + have he := planar_recorder_steps hΨ (body_periodic I.1 hI.1) + (bodyCode I.1 hI.1) (body_step I.1 hI.1 hΨ) (hsteps n) + have htime : t = (n : ℝ) + (t - (n : ℝ)) := by ring + have hpath : Ψ 0 t (inputCode I hI) = + Ψ 0 (t - (n : ℝ)) (bodyCode I.1 hI.1 (run (finiteMachine J.1 hJ.1) C₀ n)) := by + change Ψ 0 t (bodyCode I.1 hI.1 C₀) = _ + conv_lhs => rw [htime, hΨ.nat_shift (body_periodic I.1 hI.1), he] + rw [hpath] + exact ⟨body_step_corridor I.1 hI.1 hΨ (hnext n) hs, + body_step_safe I.1 hI.1 hΨ (hnext n) (hcontrol (n + 1)) hs⟩ + +theorem body_halting_clearance (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian I.1 hI.1)) Ψ) + (hh : Alternating.Halts I) : + ∃ n : ℕ, (0 < Ψ 0 n (inputCode I hI) 0 ∧ Ψ 0 n (inputCode I hI) 0 < 1) ∧ + 1 / 16 ≤ Ψ 0 n (inputCode I hI) 1 ∧ Ψ 0 n (inputCode I hI) 1 ≤ 3 / 32 := by + obtain ⟨n, C, q, hs, hc, hhalt⟩ := + (finite_recorder_halts_iff (freshInput I) (freshInput_valid hI)).mpr + ((freshInput_halts_iff hI).mpr hh) + have he := planar_recorder_steps hΨ (body_periodic I.1 hI.1) + (bodyCode I.1 hI.1) (body_step I.1 hI.1 hΨ) hs + have hq : recorderHalting (freshMachine I.1) C.control = true := by + rw [hc] + exact hhalt + have hd := referenceShift_small I.1 hI.1 + have hy := shifted_halting_clearance (freshMachine I.1) (freshInput_valid hI).1 C + (referenceShift I.1 hI.1) hq hd.2 + have hx := point_horizontal_bound (freshMachine I.1) (freshInput_valid hI).1 C + have hk := compression_le_real (freshMachine I.1) (freshInput_valid hI).1 + obtain ⟨hxl, hxu⟩ := abs_le.mp hx + obtain ⟨hdl, hdu⟩ := abs_le.mp hd.1 + refine ⟨n, ?_⟩ + have he' : Ψ 0 n (inputCode I hI) = bodyCode I.1 hI.1 C := he + rw [he'] + change (0 < shiftPoint _ _ 0 ∧ shiftPoint _ _ 0 < 1) ∧ + 1 / 16 ≤ shiftPoint _ _ 1 ∧ shiftPoint _ _ 1 ≤ 3 / 32 + refine ⟨?_, hy⟩ + change 0 < point (freshMachine I.1) (freshInput_valid hI).1 C 0 + + (referenceShift I.1 hI.1 0 : ℝ) ∧ + point (freshMachine I.1) (freshInput_valid hI).1 C 0 + + (referenceShift I.1 hI.1 0 : ℝ) < 1 + constructor <;> linarith + +end ForcedComputation.BalancedPlanar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed7e5b8b714259673c0ec41c7bc7fc0837973616 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedPlanarProgram.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarProcessorOrbit +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPlanarFlow + +namespace OAI + +/-! A machine-only planar body for the Euclidean box test. Normalize using +one fixed empty input, then encode every other input at its own point in the +same body. The one-period realization theorems hold for every configuration. -/ + +noncomputable section +namespace ForcedComputation.BalancedPlanar +open ShearFlows Recorder Recorder.Planar Set + +/-- The empty input fixes the spatial normalization of the repeated body. -/ +def referenceInput (M : Alternating.Machine) : Alternating.MachineInput := (M, []) + +theorem referenceValid {M : Alternating.Machine} (hM : M.WellFormed) : + Alternating.ValidInput (referenceInput M) := by + refine ⟨hM, ?_⟩ + intro a ha + simp [referenceInput] at ha + +def bodyHamiltonian (M : Alternating.Machine) (hM : M.WellFormed) : FieldExpr := + normalizedHamiltonian (referenceInput M) (referenceValid hM) + +def bodyVelocity (M : Alternating.Machine) (hM : M.WellFormed) : ℝ → Plane → Plane := + compactVelocity (referenceInput M) (referenceValid hM) + +def bodyCode (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State (freshMachine M)) (Alphabet (freshMachine M))) : Plane := + normalizedPoint (referenceInput M) (referenceValid hM) C + +def inputCode (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Plane := + bodyCode I.1 hI.1 (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)) + +def referenceShift (M : Alternating.Machine) (hM : M.WellFormed) : Fin 2 → ℚ := + initialShift (freshInput (referenceInput M)) (freshInput_valid (referenceValid hM)) + +theorem referenceShift_small (M : Alternating.Machine) (hM : M.WellFormed) : + |(referenceShift M hM 0 : ℝ)| ≤ 1 / 512 ∧ + |(referenceShift M hM 1 : ℝ)| ≤ 3 / 1024 := + initialShift_small _ _ (fresh_initial_nonhalting _ (referenceValid hM)) + +theorem body_step (M : Alternating.Machine) (hM : M.WellFormed) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian M hM)) Ψ) + {C D : Configuration (State (freshMachine M)) (Alphabet (freshMachine M))} + (hs : Step (finiteMachine (freshMachine M) (freshInput_valid (referenceValid hM)).1) C D) : + Ψ 0 1 (bodyCode M hM C) = bodyCode M hM D := + normalized_planar_step (referenceInput M) (referenceValid hM) hΨ hs + +theorem body_step_safe (M : Alternating.Machine) (hM : M.WellFormed) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian M hM)) Ψ) + {C D : Configuration (State (freshMachine M)) (Alphabet (freshMachine M))} + (hs : Step (finiteMachine (freshMachine M) (freshInput_valid (referenceValid hM)).1) C D) + (hD : recorderHalting (freshMachine M) D.control = false) {s : ℝ} (ht : s ∈ Icc (0 : ℝ) 1) : + 3 / 16 ≤ Ψ 0 s (bodyCode M hM C) 1 := + normalized_step_safe (referenceInput M) (referenceValid hM) hΨ hs hD ht + +theorem body_step_corridor (M : Alternating.Machine) (hM : M.WellFormed) + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian M hM)) Ψ) + {C D : Configuration (State (freshMachine M)) (Alphabet (freshMachine M))} + (hs : Step (finiteMachine (freshMachine M) (freshInput_valid (referenceValid hM)).1) C D) + {s : ℝ} (ht : s ∈ Icc (0 : ℝ) 1) : + Ψ 0 s (bodyCode M hM C) ∈ clockRectangle.carrier := + normalized_step_corridor (referenceInput M) (referenceValid hM) hΨ hs ht + +theorem body_observation (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (bodyHamiltonian I.1 hI.1)) Ψ) : + (∃ t : ℝ, 0 ≤ t ∧ Ψ 0 t (inputCode I hI) ∈ observer) ↔ Alternating.Halts I := by + have hδ := (referenceShift_small I.1 hI.1).2 + have h := shifted_planar_observation (freshInput I) (freshInput_valid hI) + (referenceShift I.1 hI.1) hδ hΨ + (planarSlice_periodic (normalizedHamiltonian_periodic + (referenceInput I.1) (referenceValid hI.1))) + (body_step I.1 hI.1 hΨ) + (fun {C D} hs _ hD s ht => body_step_safe I.1 hI.1 hΨ hs hD ht) + exact h.trans (freshInput_halts_iff hI) + +end ForcedComputation.BalancedPlanar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedRules.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedRules.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa1fd7e59ae6f6aae153f1beb29bdd2fd936a3b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedRules.lean @@ -0,0 +1,261 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Recorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RadixEncoding + +namespace OAI + +/-! The balanced three-stack table in paper 379-09, `balanced.tex`. +Every row preserves total prefix length, and its record identifies the +individual work-step row. The table acts on arbitrary independent tails. -/ + +namespace ForcedComputation.Balanced + +open scoped BigOperators + +variable {Q A : Type*} + +inductive Record (Q A : Type*) + | stay (q : Q) (a : A) + | left (q : Q) (a c : A) + | right (q : Q) (a c : A) + | boundary (q : Q) (a : A) + deriving DecidableEq, Fintype + +inductive Symbol (Q A : Type*) + | work (a : A) + | marked (a : A) + | boundary + | record (r : Record Q A) + deriving DecidableEq, Fintype + +inductive Control (Q : Type*) + | checkpoint (q : Q) + | outward (q : Q) + | inward (q : Q) + | dispatch (q : Q) + deriving DecidableEq, Fintype + +inductive Row (Q A : Type*) + | enter (q : Q) (a : A) + | outward (q : Q) (c : A) + | supply (q : Q) + | inward (q : Q) (c : A) + | restore (q : Q) (a : A) + | stay (q : Q) (a : A) + | left (q : Q) (a c : A) + | right (q : Q) (a c : A) + | boundary (q : Q) (a : A) + deriving DecidableEq, Fintype + +open ForcedComputation.Balanced.Symbol + +def Row.Allowed (M : Recorder.Machine Q A) : Row Q A → Prop + | .enter q _ => M.halting q = false + | .stay q a => M.move q a = 0 + | .left q a _ => M.move q a = -1 + | .right q a _ => M.move q a = 1 + | .boundary q a => M.move q a = 1 + | _ => True + +def Row.sourceControl : Row Q A → Control Q + | .enter q _ => .checkpoint q + | .outward q _ | .supply q => .outward q + | .inward q _ | .restore q _ => .inward q + | .stay q _ | .left q _ _ | .right q _ _ | .boundary q _ => .dispatch q + +def Row.targetControl (M : Recorder.Machine Q A) : Row Q A → Control Q + | .enter q _ | .outward q _ => .outward q + | .supply q | .inward q _ => .inward q + | .restore q _ => .dispatch q + | .stay q a | .left q a _ | .right q a _ | .boundary q a => .checkpoint (M.next q a) + +def Row.sourcePrefixes (blank : A) : Row Q A → Fin 3 → List (Symbol Q A) + | .enter _ a => ![[], [work a], []] + | .outward _ c => ![[], [work c], []] + | .supply _ => ![[], [.boundary, work blank], []] + | .inward _ c => ![[work c], [], []] + | .restore _ a => ![[marked a], [], []] + | .stay _ a => ![[], [work a], [work blank]] + | .left _ a c => ![[work c], [work a], [work blank]] + | .right _ a c => ![[], [work a, work c], [work blank]] + | .boundary _ a => ![[], [work a, .boundary, work blank], [work blank]] + +def Row.targetPrefixes (M : Recorder.Machine Q A) (blank : A) : + Row Q A → Fin 3 → List (Symbol Q A) + | .enter _ a => ![[marked a], [], []] + | .outward _ c => ![[work c], [], []] + | .supply _ => ![[], [.boundary], [work blank]] + | .inward _ c => ![[], [work c], []] + | .restore _ a => ![[], [work a], []] + | .stay q a => ![[], [work (M.write q a)], [record (.stay q a)]] + | .left q a c => ![[], [work c, work (M.write q a)], [record (.left q a c)]] + | .right q a c => ![[work (M.write q a)], [work c], [record (.right q a c)]] + | .boundary q a => ![[work (M.write q a)], [work blank, .boundary], [record (.boundary q a)]] + +/-- Balance is an identity for the complete table, without assumptions on tails. -/ +theorem Row.balanced (M : Recorder.Machine Q A) (blank : A) (r : Row Q A) : + (∑ j : Fin 3, (r.sourcePrefixes blank j).length) = + ∑ j : Fin 3, (r.targetPrefixes M blank j).length := by + cases r <;> simp [Row.sourcePrefixes, Row.targetPrefixes, Fin.sum_univ_succ] + +abbrev Stack (Q A : Type*) := ℕ → Symbol Q A +abbrev Tails (Q A : Type*) := Fin 3 → Stack Q A + +structure Configuration (Q A : Type*) where + control : Control Q + tapes : Tails Q A + +def prefixConfiguration (q : Control Q) (words : Fin 3 → List (Symbol Q A)) + (tails : Tails Q A) : Configuration Q A := + ⟨q, fun j => Radix.prependWord (words j) (tails j)⟩ + +def Row.source (blank : A) (r : Row Q A) (tails : Tails Q A) : Configuration Q A := + prefixConfiguration r.sourceControl (r.sourcePrefixes blank) tails + +def Row.target (M : Recorder.Machine Q A) (blank : A) (r : Row Q A) + (tails : Tails Q A) : Configuration Q A := + prefixConfiguration (r.targetControl M) (r.targetPrefixes M blank) tails + +/-- A row replaces exactly its three specified prefixes and preserves every tail. -/ +def Step (M : Recorder.Machine Q A) (blank : A) + (x y : Configuration Q A) : Prop := + ∃ r : Row Q A, r.Allowed M ∧ ∃ tails, x = r.source blank tails ∧ y = r.target M blank tails + +theorem Row.step {M : Recorder.Machine Q A} {blank : A} {r : Row Q A} + (hr : r.Allowed M) (tails : Tails Q A) : + Step M blank (r.source blank tails) (r.target M blank tails) := + ⟨r, hr, tails, rfl, rfl⟩ + +/-- Finite words followed by an independent infinite tail decompose uniquely. -/ +theorem prependWord_injective (w : List (Symbol Q A)) : + Function.Injective (Radix.prependWord w) := by + induction w with + | nil => exact fun _ _ h => h + | cons a w ih => + intro u v h + apply ih + funext n + exact congrFun h (n + 1) + +theorem Row.source_tails_injective (blank : A) (r : Row Q A) : + Function.Injective (r.source blank) := by + intro u v h + funext j + apply prependWord_injective (r.sourcePrefixes blank j) + exact congrArg (fun c : Configuration Q A => c.tapes j) h + +theorem Row.target_tails_injective (M : Recorder.Machine Q A) (blank : A) (r : Row Q A) : + Function.Injective (r.target M blank) := by + intro u v h + funext j + apply prependWord_injective (r.targetPrefixes M blank j) + exact congrArg (fun c : Configuration Q A => c.tapes j) h + +/-- Every target control specifies the stack whose top identifies the incoming row. -/ +def targetKey (c : Configuration Q A) : Control Q × Symbol Q A := + (c.control, match c.control with + | .checkpoint _ => c.tapes 2 0 + | .outward _ => c.tapes 0 0 + | .inward _ => c.tapes 1 0 + | .dispatch _ => c.tapes 1 0) + +def Row.targetKey (M : Recorder.Machine Q A) : Row Q A → Control Q × Symbol Q A + | .enter q a => (.outward q, marked a) + | .outward q c => (.outward q, work c) + | .supply q => (.inward q, .boundary) + | .inward q c => (.inward q, work c) + | .restore q a => (.dispatch q, work a) + | .stay q a => (.checkpoint (M.next q a), record (.stay q a)) + | .left q a c => (.checkpoint (M.next q a), record (.left q a c)) + | .right q a c => (.checkpoint (M.next q a), record (.right q a c)) + | .boundary q a => (.checkpoint (M.next q a), record (.boundary q a)) + +theorem Row.targetKey_eq (M : Recorder.Machine Q A) (blank : A) + (r : Row Q A) (tails : Tails Q A) : + Balanced.targetKey (r.target M blank tails) = r.targetKey M := by + cases r <;> simp [Balanced.targetKey, Row.target, prefixConfiguration, Row.targetControl, + Row.targetPrefixes, Row.targetKey, Radix.prependWord, Radix.prepend] + +theorem Row.targetKey_injective (M : Recorder.Machine Q A) : + Function.Injective (Row.targetKey M) := by + intro r s h + cases r <;> cases s <;> simp_all [Row.targetKey] + +/-- Incoming branches are disjoint for arbitrary independent stack tails. -/ +theorem Row.target_rows_eq (M : Recorder.Machine Q A) (blank : A) + {r s : Row Q A} {u v : Tails Q A} + (h : r.target M blank u = s.target M blank v) : r = s := by + apply Row.targetKey_injective M + simpa only [Row.targetKey_eq] using congrArg Balanced.targetKey h + +/-- The complete target state recovers both the row and all three original tails. -/ +theorem Row.target_unique (M : Recorder.Machine Q A) (blank : A) + {r s : Row Q A} {u v : Tails Q A} + (h : r.target M blank u = s.target M blank v) : r = s ∧ u = v := by + have hrs := Row.target_rows_eq M blank h + subst s + exact ⟨rfl, r.target_tails_injective M blank h⟩ + +/-- A finite source decoder. It need not accept malformed configurations; +on each guarded source cylinder it recovers the unique table row. -/ +def decodeSource (M : Recorder.Machine Q A) (c : Configuration Q A) : Option (Row Q A) := + match c.control with + | .checkpoint q => match c.tapes 1 0 with + | .work a => some (.enter q a) + | _ => none + | .outward q => match c.tapes 1 0 with + | .work a => some (.outward q a) + | .boundary => some (.supply q) + | _ => none + | .inward q => match c.tapes 0 0 with + | .work a => some (.inward q a) + | .marked a => some (.restore q a) + | _ => none + | .dispatch q => match c.tapes 1 0 with + | .work a => + if M.move q a = 0 then some (.stay q a) + else if M.move q a = -1 then + match c.tapes 0 0 with + | .work b => some (.left q a b) + | _ => none + else match c.tapes 1 1 with + | .work b => some (.right q a b) + | .boundary => some (.boundary q a) + | _ => none + | _ => none + +theorem Row.decode_source {M : Recorder.Machine Q A} {blank : A} + {r : Row Q A} (hr : r.Allowed M) (tails : Tails Q A) : + decodeSource M (r.source blank tails) = some r := by + cases r <;> simp_all [decodeSource, Row.source, prefixConfiguration, Row.sourceControl, + Row.sourcePrefixes, Row.Allowed, Radix.prependWord, Radix.prepend] + +/-- Outgoing guarded branches are disjoint on the complete tail domains. -/ +theorem Row.source_rows_eq {M : Recorder.Machine Q A} {blank : A} + {r s : Row Q A} (hr : r.Allowed M) (hs : s.Allowed M) {u v : Tails Q A} + (h : r.source blank u = s.source blank v) : r = s := by + have hh := congrArg (decodeSource M) h + rw [r.decode_source hr, s.decode_source hs] at hh + exact Option.some.inj hh + +theorem Step.deterministic {M : Recorder.Machine Q A} {blank : A} + {x y z : Configuration Q A} (hy : Step M blank x y) (hz : Step M blank x z) : y = z := by + obtain ⟨r, hr, u, rfl, rfl⟩ := hy + obtain ⟨s, hs, v, he, rfl⟩ := hz + have hrs := Row.source_rows_eq hr hs he + subst s + have huv := r.source_tails_injective blank he + rw [huv] + +theorem Step.predecessor_unique {M : Recorder.Machine Q A} {blank : A} + {x y z : Configuration Q A} (hx : Step M blank x z) (hy : Step M blank y z) : x = y := by + obtain ⟨r, hr, u, rfl, rfl⟩ := hx + obtain ⟨s, hs, v, rfl, he⟩ := hy + have huv := Row.target_unique M blank he + rcases huv with ⟨hrs, huv⟩ + subst s + subst v + rfl + +end ForcedComputation.Balanced + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedStretch.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedStretch.lean new file mode 100644 index 0000000000000000000000000000000000000000..74907699a2d3ac662bc0ab7a2ad65e0f93715ceb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedStretch.lean @@ -0,0 +1,168 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCompactLift + +namespace OAI + +/-! A rational volume-independent coordinate change for the Euclidean cube +observer. The velocity is pushed forward; the force is subsequently defined +by its Navier--Stokes residual, so anisotropic diffusion causes no restriction. -/ + +noncomputable section +namespace ForcedComputation.BalancedStretch +open ShearFlows Set +open scoped ContDiff BigOperators + +def coefficient (j : Fin 3) : ℝ := if j = 1 then 16 else 1 + +def linear : Space →L[ℝ] Space := + ContinuousLinearMap.pi (fun j => coefficient j • + (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ)) + +def inverseLinear : Space →L[ℝ] Space := + ContinuousLinearMap.pi (fun j => (coefficient j)⁻¹ • + (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ)) + +@[simp] theorem linear_apply (x : Space) (j : Fin 3) : + linear x j = coefficient j * x j := rfl + +@[simp] theorem inverseLinear_apply (x : Space) (j : Fin 3) : + inverseLinear x j = (coefficient j)⁻¹ * x j := rfl + +theorem coefficient_ne (j : Fin 3) : coefficient j ≠ 0 := by + simp only [coefficient] + split_ifs <;> norm_num + +def stretch : Space ≃L[ℝ] Space := + { toLinearEquiv := + { toFun := linear + invFun := inverseLinear + left_inv := by + intro x + ext j + simp [coefficient_ne] + right_inv := by + intro x + ext j + simp [coefficient_ne] + map_add' := linear.map_add + map_smul' := linear.map_smul } + continuous_toFun := linear.continuous + continuous_invFun := inverseLinear.continuous } + +@[simp] theorem stretch_apply (x : Space) (j : Fin 3) : + stretch x j = coefficient j * x j := rfl + +@[simp] theorem stretch_symm_apply (x : Space) (j : Fin 3) : + stretch.symm x j = (coefficient j)⁻¹ * x j := rfl + +@[simp] theorem stretch_symm_basis (j : Fin 3) : + stretch.symm (basis j) = (coefficient j)⁻¹ • basis j := by + ext k + by_cases h : k = j + · subst k + simp [basis] + · simp [basis, Pi.single_eq_of_ne h] + +def push (a : Space → Space) (x : Space) : Space := stretch (a (stretch.symm x)) + +def velocity (V : Velocity) : Velocity := fun y => push (fun x => V (y.1, x)) y.2 + +theorem push_smooth {a : Space → Space} (ha : ContDiff ℝ ∞ a) : + ContDiff ℝ ∞ (push a) := + stretch.contDiff.comp (ha.comp stretch.symm.contDiff) + +theorem velocity_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (velocity V) := + stretch.contDiff.comp + (hV.comp (contDiff_fst.prodMk (stretch.symm.contDiff.comp contDiff_snd))) + +theorem push_derivative (a : Space → Space) (x : Space) (j : Fin 3) : + derivative (push a) j x = + (coefficient j)⁻¹ • stretch (derivative a j (stretch.symm x)) := by + change fderiv ℝ (stretch ∘ (a ∘ stretch.symm)) x (basis j) = _ + rw [stretch.comp_fderiv, stretch.symm.comp_right_fderiv] + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, + stretch_symm_basis, map_smul, derivative] + +theorem push_divergence (a : Space → Space) (x : Space) : + divergence (push a) x = divergence a (stretch.symm x) := by + unfold divergence + apply Finset.sum_congr rfl + intro j _ + rw [push_derivative] + simp only [Pi.smul_apply, smul_eq_mul, stretch_apply] + rw [← mul_assoc, inv_mul_cancel₀ (coefficient_ne j), one_mul] + +theorem velocity_divergence {V : Velocity} + (hV : ∀ t x, divergence (fun y => V (t, y)) x = 0) (t : ℝ) (x : Space) : + divergence (fun y => velocity V (t, y)) x = 0 := by + exact (push_divergence _ _).trans (hV _ _) + +theorem push_zero_iff (a : Space → Space) (x : Space) : + push a x = 0 ↔ a (stretch.symm x) = 0 := by + change stretch _ = 0 ↔ _ + exact stretch.map_eq_zero_iff + +theorem push_support {a : Space → Space} {K : Set Space} + (hK : IsClosed K) (ha : tsupport a ⊆ K) : + tsupport (push a) ⊆ stretch '' K := by + apply closure_minimal + · intro x hx + refine ⟨stretch.symm x, ha ?_, by simp⟩ + exact subset_tsupport _ ((push_zero_iff a x).not.mp hx) + · exact stretch.toHomeomorph.isClosedMap _ hK + +theorem push_compact {a : Space → Space} (ha : HasCompactSupport a) : + HasCompactSupport (push a) := + (ha.image stretch.continuous).of_isClosed_subset (isClosed_tsupport _) + (push_support (isClosed_tsupport _) (Subset.refl _)) + +theorem trajectory {V : Velocity} {γ : ℝ → Space} {a t : ℝ} + (hγ : HasDerivAt γ (V (a + t, γ t)) t) : + HasDerivAt (fun s => stretch (γ s)) + (velocity V (a + t, stretch (γ t))) t := by + apply hasDerivAt_pi.mpr + intro j + simpa only [velocity, push, stretch_apply, ContinuousLinearEquiv.symm_apply_apply] + using ((hasDerivAt_pi.mp hγ) j).const_mul (coefficient j) + +/-- The cube used by the balanced Euclidean main result. -/ +def observer : Set Space := {x | ∀ j : Fin 3, -1 < x j ∧ x j < 2} + +theorem nonhalting_outside {x : Plane} (hx : 3 / 16 ≤ x 1) : + stretch (atHeight x 0) ∉ observer := by + intro h + have h₁ := (h (1 : Fin 3)).2 + change coefficient 1 * x 1 < 2 at h₁ + norm_num [coefficient] at h₁ + linarith + +theorem halting_inside {x : Plane} (hx : 0 < x 0 ∧ x 0 < 1) + (hy : 1 / 16 ≤ x 1 ∧ x 1 ≤ 3 / 32) : + stretch (atHeight x 0) ∈ observer := by + intro j + fin_cases j <;> simp only [stretch_apply, coefficient, atHeight] + · norm_num + constructor <;> linarith [hx.1, hx.2] + · norm_num + constructor <;> linarith [hy.1, hy.2] + · norm_num + +/-- A straight loading path stays outside the cube whenever its endpoint +satisfies `x₀+x₁≥4`. This lets the body use a fixed machine-only normalization. -/ +theorem loading_outside {p : Space} (hp : 4 ≤ p 0 + p 1) + {θ : ℝ} (hθ : θ ∈ Icc (0 : ℝ) 1) : + (1 - θ) • ![4, 0, 0] + θ • p ∉ observer := by + intro h + have h₀ := (h (0 : Fin 3)).2 + have h₁ := (h (1 : Fin 3)).2 + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, + Matrix.cons_val_zero, Matrix.cons_val_one, mul_zero, zero_add] at h₀ h₁ + have hs : 4 ≤ (1 - θ) * 4 + θ * p 0 + θ * p 1 := by + nlinarith [mul_nonneg hθ.1 (sub_nonneg.mpr hp)] + linarith + +end ForcedComputation.BalancedStretch + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedVelocity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedVelocity.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd55fc3ceecee208579b03dfb968ebdea11df125 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BalancedVelocity.lean @@ -0,0 +1,161 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BalancedLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StartupEffective +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactEuclideanEnergy + +namespace OAI + +/-! The compact Euclidean velocity is the input loader followed by the +machine-only periodic processor. Its full Navier--Stokes residual is affine +in viscosity and has the same fixed compact spatial support. -/ + +noncomputable section +namespace ForcedComputation.BalancedVelocity +open ShearFlows Set Filter +open scoped ContDiff Topology BigOperators + +def velocity (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Velocity := + BalancedLoader.velocity (BalancedPlanar.inputCode I hI) + BalancedBody.activated I.1 hI.1 + +def support : Set Space := BalancedLoader.support ∪ BalancedBody.support + +theorem support_compact : IsCompact support := + BalancedLoader.support_compact.union BalancedBody.support_compact + +theorem smooth (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ContDiff ℝ ∞ (velocity I hI) := + (BalancedLoader.velocity_smooth _).add (BalancedBody.activated_smooth _ _) + +theorem supported (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (t : ℝ) : + tsupport (fun x => velocity I hI (t, x)) ⊆ support := by + change tsupport ((fun x => BalancedLoader.velocity (BalancedPlanar.inputCode I hI) (t,x)) + + (fun x => BalancedBody.activated I.1 hI.1 (t,x))) ⊆ support + exact (tsupport_add _ _).trans (union_subset_union + (BalancedLoader.velocity_support _ t) (BalancedBody.activated_support _ _ t)) + +theorem before (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {t : ℝ} (ht : t ≤ 1) (x : Space) : + velocity I hI (t, x) = BalancedLoader.velocity (BalancedPlanar.inputCode I hI) (t, x) := by + simp only [velocity, Pi.add_apply, BalancedBody.activated_before _ _ ht, add_zero] + +theorem tail (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {t : ℝ} (ht : 1 ≤ t) (x : Space) : + velocity I hI (t, x) = BalancedBody.velocity I.1 hI.1 (t, x) := by + simp only [velocity, Pi.add_apply, BalancedBody.activated_tail _ _ ht, + BalancedLoader.velocity_after _ (show (1 : ℝ) / 4 ≤ t by linarith), zero_add] + +theorem zero_before (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {t : ℝ} (ht : t ≤ 1 / 8) (x : Space) : velocity I hI (t, x) = 0 := by + rw [before I hI (by linarith), BalancedLoader.velocity_before _ ht] + +theorem solenoidal (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Solenoidal (velocity I hI) := by + intro t x + have hL : ContDiff ℝ ∞ + (fun z : Space => BalancedLoader.velocity (BalancedPlanar.inputCode I hI) (t,z)) := + (BalancedLoader.velocity_smooth (BalancedPlanar.inputCode I hI)).comp + (contDiff_const.prodMk contDiff_id) + have hB : ContDiff ℝ ∞ (fun z : Space => BalancedBody.activated I.1 hI.1 (t,z)) := + (BalancedBody.activated_smooth I.1 hI.1).comp + (contDiff_const.prodMk contDiff_id) + unfold divergence derivative + change (∑ j, (fderiv ℝ + ((fun z => BalancedLoader.velocity (BalancedPlanar.inputCode I hI) (t,z)) + + (fun z => BalancedBody.activated I.1 hI.1 (t,z))) x) (basis j) j) = 0 + rw [fderiv_add (hL.differentiable (by simp) x) (hB.differentiable (by simp) x)] + simp only [add_apply, Pi.add_apply, + Finset.sum_add_distrib] + change divergence (fun z => BalancedLoader.velocity (BalancedPlanar.inputCode I hI) (t,z)) x + + divergence (fun z => BalancedBody.activation I.1 hI.1 t • + BalancedBody.velocity I.1 hI.1 (t,z)) x = 0 + rw [BalancedLoader.velocity_divergence, divergence_smul, + BalancedBody.velocity_divergence, mul_zero, add_zero] + +theorem bounded (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + BoundedMixedDerivatives (velocity I hI) := + boundedMixed_of_compact_tail (smooth I hI) (BalancedBody.velocity_smooth _ _) + support_compact (supported I hI) + (fun t => (BalancedBody.velocity_support _ _ t).trans subset_union_right) + (BalancedBody.velocity_periodic _ _) + (fun _ ht x => zero_before I hI (by linarith) x) + (fun _ ht x => tail I hI ht.le x) + +private theorem residual_zero (ν : ℝ) : residual ν (fun _ : SpaceTime => (0 : Space)) = 0 := by + have hd : derivative (fun _ : Space => (0 : Space)) = fun _ _ => 0 := by + funext j x + simp [derivative] + have hl (x : Space) : laplacian (fun _ : Space => (0 : Space)) x = 0 := by + simp only [laplacian, hd] + apply Finset.sum_eq_zero + intro j _ + rw [fderiv_const_apply] + rfl + funext y + simp [residual, timeDerivative, advection, hl] + +private theorem residual_supported {V : Velocity} {K : Set Space} (hK : IsClosed K) + (hs : ∀ t, tsupport (fun x => V (t,x)) ⊆ K) (ν t : ℝ) : + tsupport (fun x => residual ν V (t,x)) ⊆ K := by + apply closure_minimal _ hK + intro x hx + by_contra hn + have ho : {y : SpaceTime | y.2 ∉ K} ∈ 𝓝 (t,x) := + (hK.isOpen_compl.preimage continuous_snd).mem_nhds hn + have he : V =ᶠ[𝓝 (t,x)] fun _ => 0 := by + filter_upwards [ho] with y hy + exact image_eq_zero_of_notMem_tsupport (f := fun x : Space => V (y.1,x)) + (fun hm => hy (hs y.1 hm)) + apply hx + change residual ν V (t,x) = 0 + rw [residual_congr_germ he ν, residual_zero] + rfl + +theorem residual_periodic {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hp : TimePeriodic V) (ν : ℝ) : TimePeriodic (residual ν V) := by + intro t x + rw [residual_eq_force_add, Pi.add_apply, force_time_periodic hV hp] + congr 1 + simp only [convectiveField_eq_mixed hV] + apply Finset.sum_congr rfl + intro j _ + rw [hp t x, mixedDerivative_time_periodic hV hp [j.succ] t x] + +theorem force_supported (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν t : ℝ) : tsupport (fun x => residual ν (velocity I hI) (t,x)) ⊆ support := + residual_supported support_compact.isClosed (supported I hI) ν t + +theorem force_bounded (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (ν : ℝ) : + BoundedMixedDerivatives (residual ν (velocity I hI)) := by + apply boundedMixed_of_compact_tail (residual_smooth (smooth I hI) ν) + (residual_smooth (BalancedBody.velocity_smooth _ _) ν) support_compact + (force_supported I hI ν) + (residual_supported support_compact.isClosed + (fun t => (BalancedBody.velocity_support _ _ t).trans subset_union_right) ν) + (residual_periodic (BalancedBody.velocity_smooth _ _) (BalancedBody.velocity_periodic _ _) ν) + · intro t ht x + have he : velocity I hI =ᶠ[𝓝 (t,x)] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto (t,x)).eventually (eventually_lt_nhds ht)] with y hy + exact zero_before I hI (by linarith) y.2 + rw [residual_congr_germ he ν, residual_zero] + rfl + · intro t ht x + apply residual_congr_germ + filter_upwards [(continuous_fst.tendsto (t,x)).eventually (eventually_gt_nhds ht)] with y hy + exact tail I hI hy.le y.2 + +def force₀ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Velocity := + residual 0 (velocity I hI) + +def force₁ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Velocity := + fun y => -laplacian (fun x => velocity I hI (y.1,x)) y.2 + +theorem force_affine (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (ν : ℝ) : + residual ν (velocity I hI) = force₀ I hI + ν • force₁ I hI := by + funext y + simp only [residual, force₀, force₁, Pi.add_apply, Pi.smul_apply, zero_smul, sub_zero, smul_neg] + rfl + +end ForcedComputation.BalancedVelocity + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoundedProfiles.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoundedProfiles.lean new file mode 100644 index 0000000000000000000000000000000000000000..18880be931e677cb26d48460faf439a5b0c8bbe7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoundedProfiles.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicSpatialForce +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! The logarithmic estimate applies to an initialized field as soon as all +its original derivatives are bounded. Periodicity in time is unnecessary. -/ + +noncomputable section +open scoped ContDiff BigOperators +open ShearFlows + +namespace ForcedComputation + +theorem boundedMixed_derivative {V : Velocity} (hb : BoundedMixedDerivatives V) + (β : List (Fin 4)) : BoundedMixedDerivatives (mixedDerivative V β) := by + intro α + simpa only [mixedDerivative_append] using hb (α ++ β) + +theorem boundedMixed_sub {V W : Velocity} (hV : ContDiff ℝ ∞ V) + (hW : ContDiff ℝ ∞ W) (hVB : BoundedMixedDerivatives V) + (hWB : BoundedMixedDerivatives W) : BoundedMixedDerivatives (V - W) := by + intro α + obtain ⟨A, hA, hbA⟩ := hVB α + obtain ⟨B, hB, hbB⟩ := hWB α + refine ⟨A + B, add_nonneg hA hB, fun y => ?_⟩ + rw [mixedDerivative_sub hV hW] + exact (norm_sub_le _ _).trans (add_le_add (hbA y) (hbB y)) + +theorem boundedMixed_sum {ι : Type*} [Fintype ι] (V : ι → Velocity) + (hs : ∀ i, ContDiff ℝ ∞ (V i)) (hb : ∀ i, BoundedMixedDerivatives (V i)) : + BoundedMixedDerivatives (∑ i, V i) := by + intro α + choose C hC hbC using fun i => hb i α + refine ⟨∑ i, C i, Finset.sum_nonneg (fun i _ => hC i), fun y => ?_⟩ + rw [mixedDerivative_sum V hs] + simpa only [Finset.sum_apply] using + (norm_sum_le (s := Finset.univ) (f := fun i => mixedDerivative (V i) α y)).trans + (Finset.sum_le_sum fun i _ => hbC i y) + +theorem bounded_uniformTimeBounds {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hb : BoundedMixedDerivatives V) : UniformTimeBounds (fun x s => V (s, x)) := by + intro n + obtain ⟨C, hC, hbound⟩ := hb (List.replicate n 0) + exact ⟨C, hC, fun x t => by rw [iteratedDeriv_eq_mixedTime hV]; exact hbound (t, x)⟩ + +theorem bounded_spatialPhase {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hb : BoundedMixedDerivatives V) (α : List (Fin 3)) : + BoundedMixedDerivatives (spatialPhase V α) := by + rw [spatialPhase_eq_mixed hV] + exact boundedMixed_derivative hb _ + +theorem bounded_quadraticPhase {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) : + BoundedMixedDerivatives (fun y : SpaceTime => quadraticPhase V y.2 y.1) := by + have he : (fun y : SpaceTime => quadraticPhase V y.2 y.1) = mixedDerivative V [0] - V := by + funext y + simp only [quadraticPhase, ha y.1 y.2, add_zero, timeDerivative_eq hV] + rfl + rw [he] + exact boundedMixed_sub (mixedDerivative_smooth hV _) hV (boundedMixed_derivative hb _) hb + +theorem bounded_viscousPhase {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hb : BoundedMixedDerivatives V) : + BoundedMixedDerivatives (fun y : SpaceTime => viscousPhase V y.2 y.1) := by + have he : (fun y : SpaceTime => viscousPhase V y.2 y.1) = + ∑ j : Fin 3, mixedDerivative V [j.succ,j.succ] := by + funext y + simpa only [viscousPhase, Finset.sum_apply] using laplacian_eq_mixed hV y.1 y.2 + rw [he] + exact boundedMixed_sum _ (fun _ => mixedDerivative_smooth hV _) + (fun _ => boundedMixed_derivative hb _) + +theorem bounded_profile_mixed_decay {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hb : BoundedMixedDerivatives V) (r n : ℕ) (α : List (Fin 3)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n + (fun s => spatialWord α (fun y => logarithmicProfile r (fun q => V (q, y)) s) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (r + n) := by + have hphase (x : Space) : ContDiff ℝ ∞ (fun s => spatialPhase V α (s, x)) := + (spatialPhase_smooth hV α).comp (contDiff_id.prodMk contDiff_const) + obtain ⟨C, hC, hbound⟩ := logarithmicProfile_uniform_decay r n hphase + (bounded_uniformTimeBounds (spatialPhase_smooth hV α) (bounded_spatialPhase hV hb α)) + refine ⟨C, hC, fun x t ht => ?_⟩ + have he : (fun s => spatialWord α (fun y => logarithmicProfile r (fun q => V (q, y)) s) x) = + logarithmicProfile r (fun s => spatialPhase V α (s, x)) := + funext (fun s => spatialWord_logarithmicProfile r V α s x) + rw [he] + exact hbound x t ht + +theorem bounded_slowForce_spatial_time_decay (ν : ℝ) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) + (α : List (Fin 3)) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => spatialWord α (fun y => slowForce ν V (s, y)) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n) := by + let Q : Velocity := fun y => quadraticPhase V y.2 y.1 + let D : Velocity := fun y => viscousPhase V y.2 y.1 + have hQ : ContDiff ℝ ∞ Q := quadraticPhase_smooth hV + have hD : ContDiff ℝ ∞ D := viscousPhase_smooth hV + obtain ⟨A, hA, hQA⟩ := bounded_profile_mixed_decay hQ (bounded_quadraticPhase hV hb ha) 2 n α + obtain ⟨B, hB, hDB⟩ := bounded_profile_mixed_decay hD (bounded_viscousPhase hV hb) 1 n α + refine ⟨A + ‖ν‖ * B, by positivity, fun x t ht0 => ?_⟩ + have hQx : ContDiff ℝ ∞ (fun s => spatialPhase Q α (s, x)) := + (spatialPhase_smooth hQ α).comp (contDiff_id.prodMk contDiff_const) + have hDx : ContDiff ℝ ∞ (fun s => spatialPhase D α (s, x)) := + (spatialPhase_smooth hD α).comp (contDiff_id.prodMk contDiff_const) + have hqt := logarithmicProfile_contDiffAt 2 hQx (show -1 < t by linarith) + have hdt := logarithmicProfile_contDiffAt 1 hDx (show -1 < t by linarith) + have he : (fun s => spatialWord α (fun y => slowForce ν V (s, y)) x) = + fun s => logarithmicProfile 2 (fun q => spatialPhase Q α (q, x)) s - + ν • logarithmicProfile 1 (fun q => spatialPhase D α (q, x)) s := + funext (fun s => spatialWord_slowForce hV ν α s x) + rw [he, iteratedDeriv_fun_sub (hqt.of_le (by simp)) + ((hdt.const_smul ν).of_le (by simp)), iteratedDeriv_fun_const_smul_field] + have hQA' := hQA x t ht0 + have hDB' := hDB x t ht0 + simp_rw [spatialWord_logarithmicProfile] at hQA' hDB' + have hinv : 0 ≤ (1 + t)⁻¹ := by positivity + have hinvle : (1 + t)⁻¹ ≤ 1 := + (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + have hpow : (1 + t)⁻¹ ^ (2 + n) ≤ (1 + t)⁻¹ ^ (1 + n) := by + calc + _ = (1 + t)⁻¹ ^ (1 + n) * (1 + t)⁻¹ := by rw [← pow_succ]; congr 1; omega + _ ≤ (1 + t)⁻¹ ^ (1 + n) * 1 := + mul_le_mul_of_nonneg_left hinvle (pow_nonneg hinv _) + _ = _ := mul_one _ + calc + _ ≤ ‖iteratedDeriv n (logarithmicProfile 2 (fun q => spatialPhase Q α (q, x))) t‖ + + ‖ν • iteratedDeriv n (logarithmicProfile 1 (fun q => spatialPhase D α (q, x))) t‖ := + norm_sub_le _ _ + _ ≤ A * (1 + t)⁻¹ ^ (2 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := by + rw [norm_smul] + exact add_le_add hQA' (mul_le_mul_of_nonneg_left hDB' (norm_nonneg ν)) + _ ≤ A * (1 + t)⁻¹ ^ (1 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := + add_le_add (mul_le_mul_of_nonneg_left hpow hA) le_rfl + _ = _ := by ring + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoxBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoxBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e2440b02ac4fdb029391ffe11ee091e7f6cbffe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BoxBounds.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InstructionRectangles + +namespace OAI + +namespace ForcedComputation.Radix + +open ShearFlows + +def InUnit (R : RationalBox 2) : Prop := ∀ j, 0 ≤ R.lower j ∧ R.upper j ≤ 1 + +theorem sourceBox_inUnit {B : ℚ} (hB : 0 < B) {l a : ℚ} + (hl : 0 ≤ l ∧ l + 1 ≤ B) (ha : 0 ≤ a ∧ a + 1 ≤ B) : + InUnit (sourceBox B l a) := by + intro j + fin_cases j + · exact ⟨div_nonneg hl.1 hB.le, (div_le_one hB).mpr hl.2⟩ + · exact ⟨div_nonneg ha.1 hB.le, (div_le_one hB).mpr ha.2⟩ + +theorem targetBox_inUnit {B : ℚ} (hB : 0 < B) {l b : ℚ} + (hl : 0 ≤ l ∧ l + 1 ≤ B) (hb : 0 ≤ b ∧ b + 1 ≤ B) (m : HeadMove) : + InUnit (targetBox B l b m) := by + have hp : 0 < B ^ 2 := pow_pos hB 2 + have nested {a c : ℚ} (ha : 0 ≤ a ∧ a + 1 ≤ B) (hc : 0 ≤ c ∧ c + 1 ≤ B) : + 0 ≤ a / B + c / B ^ 2 ∧ a / B + (c + 1) / B ^ 2 ≤ 1 := by + refine ⟨add_nonneg (div_nonneg ha.1 hB.le) (div_nonneg hc.1 hp.le), ?_⟩ + calc + a / B + (c + 1) / B ^ 2 ≤ a / B + B / B ^ 2 := by + exact add_le_add (le_refl _) ((div_le_div_iff_of_pos_right hp).mpr hc.2) + _ = (a + 1) / B := by field_simp + _ ≤ 1 := (div_le_one hB).mpr ha.2 + intro j + cases m <;> fin_cases j + · exact ⟨le_rfl, le_rfl⟩ + · exact nested hl hb + · exact ⟨div_nonneg hl.1 hB.le, (div_le_one hB).mpr hl.2⟩ + · exact ⟨div_nonneg hb.1 hB.le, (div_le_one hB).mpr hb.2⟩ + · exact nested hb hl + · exact ⟨le_rfl, le_rfl⟩ + +theorem center_mem {R : RationalBox 2} (hR : R.positive) : R.center ∈ R.carrier := by + intro j + have h : (R.lower j : ℝ) < R.upper j := by exact_mod_cast hR j + dsimp [RationalBox.center] + constructor <;> linarith + +theorem halfWidth_le_half {R : RationalBox 2} (hR : InUnit R) (j : Fin 2) : + R.halfWidth j ≤ 1 / 2 := by + have hl : (0 : ℝ) ≤ R.lower j := by exact_mod_cast (hR j).1 + have hu : (R.upper j : ℝ) ≤ 1 := by exact_mod_cast (hR j).2 + dsimp [RationalBox.halfWidth] + linarith + +theorem scaledBox_between {κ : ℚ} (hκ : 0 ≤ κ) (offset : Fin 2 → ℚ) + {R : RationalBox 2} (hR : InUnit R) {x : Plane} + (hx : x ∈ (scaledBox κ offset R).carrier) (j : Fin 2) : + (offset j : ℝ) ≤ x j ∧ x j ≤ (offset j : ℝ) + (κ : ℝ) := by + have hp : (0 : ℝ) ≤ κ := by exact_mod_cast hκ + have hl : (0 : ℝ) ≤ R.lower j := by exact_mod_cast (hR j).1 + have hu : (R.upper j : ℝ) ≤ 1 := by exact_mod_cast (hR j).2 + have hj := hx j + simp only [scaledBox, Rat.cast_add, Rat.cast_mul] at hj + exact ⟨(le_add_of_nonneg_right (mul_nonneg hp hl)).trans hj.1, + hj.2.trans (by simpa only [mul_one] using (add_le_add (le_refl (offset j : ℝ)) (mul_le_mul_of_nonneg_left hu hp)))⟩ + +end ForcedComputation.Radix + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BranchClockGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BranchClockGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cdfdc1d157d9056ac80511fdbf149320fe54026 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/BranchClockGeometry.lean @@ -0,0 +1,233 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedBranchTrace +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarClockMargins + +namespace OAI + +/-! Clock and observation margins for the entire filled branch trajectory. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting Set + +/-- The parking rectangles have room for the rational initial translation. -/ +theorem shifted_parking_bounds {n : ℕ} {κ : ℚ} (hκ : 0 ≤ κ) (hκ' : κ ≤ 1 / 64) + (i : Fin n) (δ : Fin 2 → ℚ) + (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ (parkingBox n κ i).carrier) : + translatedPoint δ x ∈ clockRectangle.carrier ∧ 3 / 16 ≤ translatedPoint δ x 1 := by + have hb := parkingBox_bounds hκ hκ' i hx + have hs : (parkingScale n : ℝ) ≤ 1 / 64 := by + have hh := (Rat.cast_le (K := ℝ)).mpr (parkingScale_le n) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hh + exact hh + have hk : (0 : ℝ) ≤ κ := by exact_mod_cast hκ + have hk' : (κ : ℝ) ≤ 1 / 64 := by + have hh := (Rat.cast_le (K := ℝ)).mpr hκ' + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hh + exact hh + have hc : (parkingCenter n i 0 : ℝ) < 3 / 4 := by + have hh := (Rat.cast_lt (K := ℝ)).mpr (parkingCenter_bounds n i).2 + norm_num only [Rat.cast_div, Rat.cast_ofNat] at hh + exact hh + have hxu := (hx 0).2 + change x 0 ≤ ((parkingCenter n i 0 + parkingScale n * κ : ℚ) : ℝ) at hxu + push_cast at hxu + have hm := mul_le_mul hs hk' hk (by norm_num : (0 : ℝ) ≤ 1 / 64) + obtain ⟨hd₀, hd₀'⟩ := abs_le.mp hδ₀ + obtain ⟨hd₁, hd₁'⟩ := abs_le.mp hδ₁ + constructor + · intro j + fin_cases j + · change ((1 / 8 : ℚ) : ℝ) ≤ x 0 + (δ 0 : ℝ) ∧ + x 0 + (δ 0 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith [hb.1] + · change ((1 / 32 : ℚ) : ℝ) ≤ x 1 + (δ 1 : ℝ) ∧ + x 1 + (δ 1 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith [hb.2.2.1, hb.2.2.2] + · change 3 / 16 ≤ x 1 + (δ 1 : ℝ) + linarith [hb.2.2.1] + +theorem horizontalPoint_vertical (R : RationalBox 2) (p : Fin 2 → ℚ) (x : Plane) : + horizontalPoint R p x 1 = x 1 := by + simp [horizontalPoint, horizontalCenter] + +theorem shifted_horizontalPoint_clock (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (R : RationalBox 2) + (hwidth : R.halfWidth 0 ≤ 1 / 128) + (δ : Fin 2 → ℚ) (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) + (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ R.carrier) + (hy : (5 / 128 : ℝ) ≤ x 1 ∧ x 1 ≤ 19 / 64) : + translatedPoint δ (horizontalPoint R (parkingFor M hM b) x) ∈ clockRectangle.carrier := by + have hc := parkingCenter_bounds (geometricBranches M hM).length (branchIndex M hM b) + have hcl : (1 / 2 : ℝ) < (parkingFor M hM b 0 : ℝ) := by + have hh := (Rat.cast_lt (K := ℝ)).mpr hc.1 + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hh + exact hh + have hcu : (parkingFor M hM b 0 : ℝ) < 3 / 4 := by + have hh := (Rat.cast_lt (K := ℝ)).mpr hc.2 + norm_num only [Rat.cast_div, Rat.cast_ofNat] at hh + exact hh + have hw := RationalBox.mem_carrier_iff.mp hx 0 + obtain ⟨hwl, hwu⟩ := abs_le.mp hw + obtain ⟨hd₀, hd₀'⟩ := abs_le.mp hδ₀ + obtain ⟨hd₁, hd₁'⟩ := abs_le.mp hδ₁ + intro j + fin_cases j + · change ((1 / 8 : ℚ) : ℝ) ≤ + horizontalPoint R (parkingFor M hM b) x 0 + (δ 0 : ℝ) ∧ + horizontalPoint R (parkingFor M hM b) x 0 + (δ 0 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + have he : horizontalPoint R (parkingFor M hM b) x 0 = + x 0 + (parkingFor M hM b 0 : ℝ) - R.center 0 := by + simp [horizontalPoint, horizontalCenter] + ring + rw [he] + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith + · change ((1 / 32 : ℚ) : ℝ) ≤ + horizontalPoint R (parkingFor M hM b) x 1 + (δ 1 : ℝ) ∧ + horizontalPoint R (parkingFor M hM b) x 1 + (δ 1 : ℝ) ≤ ((7 / 8 : ℚ) : ℝ) + rw [horizontalPoint_vertical] + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith [hy.1, hy.2] + +theorem branch_scaledStage_mem (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 5) : + scaledStage (instruction M hM b) (parkingScale (geometricBranches M hM).length) + (3 / 8) (parkingFor M hM b) x k ∈ + (parkingBox (geometricBranches M hM).length (bandScale M) (branchIndex M hM b)).carrier := by + have hw := instruction_halfWidths M hM b + exact scaledStage_mem_parking (bandScale_pos M).le (branchIndex M hM b) _ + (instruction_factor_pos M hM b) (instruction_image M hM b) + hw.1 hw.2.1 hw.2.2.1 hw.2.2.2 hx k + +theorem shifted_branchAnchors_clock (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (δ : Fin 2 → ℚ) + (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 9) : + translatedPoint δ (branchAnchors M hM b x k) ∈ clockRectangle.carrier := by + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hs := instruction_source_bounds M hM b hx + have ht' := instruction_target_bounds M hM b ht + have hw := instruction_halfWidthQ_bound M hM b + have hws : (instruction M hM b).source.halfWidth 0 ≤ 1 / 128 := by + have hh := (Rat.cast_le (K := ℝ)).mpr (hw.1 0) + simpa only [halfWidthQ_cast, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hh + have hwt : (instruction M hM b).target.halfWidth 0 ≤ 1 / 128 := by + have hh := (Rat.cast_le (K := ℝ)).mpr (hw.2 0) + simpa only [halfWidthQ_cast, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hh + have hp (j : Fin 5) := (shifted_parking_bounds (bandScale_pos M).le (bandScale_le M) + (branchIndex M hM b) δ hδ₀ hδ₁ (branch_scaledStage_mem M hM b hx j)).1 + fin_cases k + · exact shifted_coding_rectangle_clock M hM δ hδ₀ hδ₁ hs + · exact shifted_horizontalPoint_clock M hM b _ hws δ hδ₀ hδ₁ hx hs.2 + · exact hp 0 + · exact hp 1 + · exact hp 2 + · exact hp 3 + · exact hp 4 + · exact shifted_horizontalPoint_clock M hM b _ hwt δ hδ₀ hδ₁ ht ht'.2 + · exact shifted_coding_rectangle_clock M hM δ hδ₀ hδ₁ ht' + +theorem shifted_branchAnchors_safe (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (hn : recorderHalting M b.target = false) + (δ : Fin 2 → ℚ) (hδ₀ : |(δ 0 : ℝ)| ≤ 1 / 512) (hδ₁ : |(δ 1 : ℝ)| ≤ 3 / 1024) + {x : Plane} (hx : x ∈ (instruction M hM b).source.carrier) (k : Fin 9) : + 3 / 16 ≤ translatedPoint δ (branchAnchors M hM b x k) 1 := by + have ht : (instruction M hM b).affine x ∈ (instruction M hM b).target.carrier := by + rw [← instruction_image M hM b] + exact mem_image_of_mem _ hx + have hs := (shifted_instruction_source_height M hM b δ hδ₁ hx).1 + have ht' := (shifted_instruction_target_nonterminal_height M hM b hn δ hδ₁ ht).1 + have hp (j : Fin 5) := (shifted_parking_bounds (bandScale_pos M).le (bandScale_le M) + (branchIndex M hM b) δ hδ₀ hδ₁ (branch_scaledStage_mem M hM b hx j)).2 + fin_cases k + · exact hs + · change 3 / 16 ≤ horizontalPoint _ _ x 1 + (δ 1 : ℝ) + rw [horizontalPoint_vertical] + exact hs + · exact hp 0 + · exact hp 1 + · exact hp 2 + · exact hp 3 + · exact hp 4 + · change 3 / 16 ≤ horizontalPoint _ _ ((instruction M hM b).affine x) 1 + (δ 1 : ℝ) + rw [horizontalPoint_vertical] + exact ht' + · exact ht' + +theorem normalizedAnchors_clock (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 9) : normalizedAnchors I hI b x k ∈ clockRectangle.carrier := by + have hδ := initialShift_small (freshInput I) (freshInput_valid hI) (fresh_initial_nonhalting I hI) + exact shifted_branchAnchors_clock _ _ b _ hδ.1 hδ.2 hx k + +theorem normalizedAnchors_safe (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hn : recorderHalting (freshMachine I.1) b.target = false) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 9) : 3 / 16 ≤ normalizedAnchors I hI b x k 1 := by + have hδ := initialShift_small (freshInput I) (freshInput_valid hI) (fresh_initial_nonhalting I hI) + exact shifted_branchAnchors_safe _ _ b hn _ hδ.1 hδ.2 hx k + +theorem normalizedCurve_segment (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 8) (t : ℝ) : + normalizedCurve I hI b x k t = normalizedAnchors I hI b x k.castSucc + + smoothRamp (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).start + (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).finish t • + (normalizedAnchors I hI b x k.succ - normalizedAnchors I hI b x k.castSucc) := by + unfold normalizedCurve branchCurve + rw [Pulse.curve, Primitive.path_segment, branchCurve_endpoint] + ext j + simp only [translatedPoint, normalizedAnchors, Pi.add_apply, Pi.sub_apply, Pi.smul_apply, + smul_eq_mul] + ring + +theorem normalizedCurve_clock (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 8) (t : ℝ) : normalizedCurve I hI b x k t ∈ clockRectangle.carrier := by + have h₀ := normalizedAnchors_clock I hI b hx k.castSucc + have h₁ := normalizedAnchors_clock I hI b hx k.succ + have hθ := smoothRamp_range + (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).start + (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).finish t + rw [normalizedCurve_segment] + intro j + have hj₀ := h₀ j + have hj₁ := h₁ j + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.sub_apply] + constructor <;> nlinarith [hθ.1, hθ.2] + +theorem normalizedCurve_safe (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hn : recorderHalting (freshMachine I.1) b.target = false) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 8) (t : ℝ) : 3 / 16 ≤ normalizedCurve I hI b x k t 1 := by + have h₀ := normalizedAnchors_safe I hI b hn hx k.castSucc + have h₁ := normalizedAnchors_safe I hI b hn hx k.succ + have hθ := smoothRamp_range + (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).start + (compiledPulse (freshMachine I.1) (freshInput_valid hI).1 + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).finish t + rw [normalizedCurve_segment] + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.sub_apply] + nlinarith [hθ.1, hθ.2] + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Branches.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Branches.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3dc8fd069c0e938f0058dc01aabb5ecb560278b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Branches.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteRecorder + +namespace OAI + +/-! The branch keys used to separate full source and target rectangles. -/ + +namespace ForcedComputation.Recorder + +variable {Q A : Type*} + +structure Branch (M : Machine Q A) where + source : Control Q A + read : Symbol Q A + target : Control Q A + write : Symbol Q A + displacement : ℤ + left : Symbol Q A + rule : LocalStep M source read target write displacement + +theorem Branch.source_key_injective [DecidableEq Q] [DecidableEq A] (M : Machine Q A) : + Function.Injective (fun b : Branch M => (b.source, b.read, b.left)) := by + intro b c he + have hs : b.source = c.source := congrArg Prod.fst he + have hr : b.read = c.read := congrArg (fun p => p.2.1) he + have hl : b.left = c.left := congrArg (fun p => p.2.2) he + have hc : LocalStep M b.source b.read c.target c.write c.displacement := by + simpa only [hs, hr] using c.rule + obtain ⟨ht, hw, hd⟩ := b.rule.successor_unique hc + cases b + cases c + simp only at hs hr hl ht hw hd + subst_vars + rfl + +theorem Branch.target_key_injective (M : Machine Q A) : + Function.Injective (fun b : Branch M => (b.target, b.write, b.left)) := by + intro b c he + have ht : b.target = c.target := congrArg Prod.fst he + have hw : b.write = c.write := congrArg (fun p => p.2.1) he + have hl : b.left = c.left := congrArg (fun p => p.2.2) he + have hc : LocalStep M c.source c.read b.target b.write c.displacement := by + simpa only [ht, hw] using c.rule + obtain ⟨hs, hr, hd⟩ := b.rule.predecessor_unique hc + cases b + cases c + simp only at hs hr hl ht hw hd + subst_vars + rfl + +theorem Branch.same_target_displacement {M : Machine Q A} {b c : Branch M} + (ht : b.target = c.target) : b.displacement = c.displacement := by + rw [← b.rule.incoming_eq, ht, c.rule.incoming_eq] + +theorem Branch.source_symbols_differ [DecidableEq Q] [DecidableEq A] + {M : Machine Q A} {b c : Branch M} (hne : b ≠ c) (hs : b.source = c.source) : + b.read ≠ c.read ∨ b.left ≠ c.left := by + by_contra h + push Not at h + exact hne (Branch.source_key_injective M (by simp [hs, h.1, h.2])) + +instance [DecidableEq Q] [DecidableEq A] (M : Machine Q A) : DecidableEq (Branch M) := + fun b c => decidable_of_iff (b.source = c.source ∧ b.read = c.read ∧ b.left = c.left) + ⟨fun h => Branch.source_key_injective M (by simp [h.1, h.2.1, h.2.2]), + fun h => by subst c; simp⟩ + +theorem Branch.target_symbols_differ {M : Machine Q A} {b c : Branch M} + (hne : b ≠ c) (ht : b.target = c.target) : b.write ≠ c.write ∨ b.left ≠ c.left := by + by_contra h + push Not at h + exact hne (Branch.target_key_injective M (by simp [ht, h.1, h.2])) + +def compileBranches (M : Alternating.Machine) (hM : M.WellFormed) : + List (Branch (finiteMachine M hM)) := + (instructionTable M hM).attach.flatMap fun entry => + (allSymbols M).map fun l => + { source := entry.val.1.1 + read := entry.val.1.2 + target := entry.val.2.1 + write := entry.val.2.2.1 + displacement := entry.val.2.2.2 + left := l + rule := (mem_instructionTable_iff M hM).mp entry.property } + +theorem mem_compileBranches (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : b ∈ compileBranches M hM := by + let entry := ((b.source, b.read), (b.target, b.write, b.displacement)) + have he : entry ∈ instructionTable M hM := localStep_mem_instructionTable M hM b.rule + apply List.mem_flatMap.mpr + refine ⟨⟨entry, he⟩, by simp, List.mem_map.mpr ?_⟩ + refine ⟨b.left, mem_allSymbols M b.left, ?_⟩ + cases b + rfl + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockNames.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockNames.lean new file mode 100644 index 0000000000000000000000000000000000000000..0419c931cc003c071d790c862e46570eae155a5e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockNames.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmName +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Reparametrization + +namespace OAI + +/-! Fast names for the internal logarithmic clock and the reciprocal clock +speed. These are operations on rational names, rather than real oracles. -/ + +namespace ForcedComputation +open ShearFlows + +def shiftedTimeName (b : ℕ → RationalSpaceTime) : ℕ → ℚ := fun n => 1 + (b n).1 + +theorem shiftedTimeName_spec {y : SpaceTime} {b : ℕ → RationalSpaceTime} + (hb : IsFastName b y) : IsFastRealName (shiftedTimeName b) (1 + y.1) := by + intro n + have h := (norm_fst_le (y - rationalPoint (b n))).trans (hb n) + simpa only [shiftedTimeName, Rat.cast_add, Rat.cast_one, add_sub_add_left_eq_sub, + Prod.fst_sub, rationalPoint, Real.norm_eq_abs] using h + +def clockPointName {y : SpaceTime} (b : ℕ → RationalSpaceTime) + (hy : 0 < 1 + y.1) (hb : IsFastName b y) : ℕ → RationalSpaceTime := fun n => + (logFastName (shiftedTimeName b) hy (shiftedTimeName_spec hb) n, (b n).2) + +theorem clockPointName_spec {y : SpaceTime} (b : ℕ → RationalSpaceTime) + (hy : 0 < 1 + y.1) (hb : IsFastName b y) : + IsFastName (clockPointName b hy hb) (logClock y.1, y.2) := by + intro n + apply norm_prod_le_iff.mpr + constructor + · have h := logFastName_spec (shiftedTimeName b) hy (shiftedTimeName_spec hb) n + change |Real.log (1 + y.1) - + (logFastName (shiftedTimeName b) hy (shiftedTimeName_spec hb) n : ℝ)| ≤ errorTolerance n + exact h + · have h := (norm_snd_le (y - rationalPoint (b n))).trans (hb n) + exact h + +def reciprocalClockName (b : ℕ → RationalSpaceTime) : ℕ → ℚ := fun n => + (max (1 / 2) (1 + (b (n + 2)).1))⁻¹ + +theorem reciprocalClockName_spec {y : SpaceTime} (b : ℕ → RationalSpaceTime) + (hy : (1 / 2 : ℝ) ≤ 1 + y.1) (hb : IsFastName b y) : + IsFastRealName (reciprocalClockName b) ((1 + y.1)⁻¹) := by + intro n + have h : (QBall.mk (1 + (b (n + 2)).1) ((2 : ℚ) ^ (-((n + 2 : ℕ) : ℤ)))).Contains + (1 + y.1) := by + have h := shiftedTimeName_spec hb (n + 2) + simpa only [QBall.Contains, shiftedTimeName, Rat.cast_zpow, Rat.cast_ofNat, + zpow_neg, zpow_natCast, Rat.cast_inv, Rat.cast_pow, errorTolerance] using h + have hy' : ((1 / 2 : ℚ) : ℝ) ≤ 1 + y.1 := by + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + exact hy + have hInv := QBall.contains_invLower h (show (0 : ℚ) < 1 / 2 by norm_num) hy' + change |(1 + y.1)⁻¹ - (reciprocalClockName b n : ℝ)| ≤ errorTolerance n + have he : ((((2 : ℚ) ^ (-((n + 2 : ℕ) : ℤ))) / (1 / 2) ^ 2 : ℚ) : ℝ) = + errorTolerance n := by + simp only [Rat.cast_div, Rat.cast_pow, Rat.cast_one, Rat.cast_ofNat, + zpow_neg, zpow_natCast, errorTolerance, pow_add, mul_inv_rev] + norm_num + simpa only [QBall.Contains, QBall.invLower, reciprocalClockName, he] using hInv + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1a161651a7fedb9c9c985155010e976dd8a9b43 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedBounds.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedExpressions +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EffectiveInterface + +namespace OAI + +/-! Local effective bounds for clocked expressions. Periodic field factors +have global bounds; only the explicit clock profiles use a time radius. -/ + +namespace ForcedComputation.ClockedExpr +open ShearFlows +open scoped ContDiff BigOperators + +def bound (M : ℚ) : ClockedExpr → ℚ + | .const r => |r| + | .profile q => q.bound M + | .field _ e => e.bound + | .add e f => e.bound M + f.bound M + | .mul e f => e.bound M * f.bound M + +theorem bound_nonneg (e : ClockedExpr) (M : ℚ) : 0 ≤ e.bound M := by + induction e with + | const => exact abs_nonneg _ + | profile q => exact q.bound_nonneg M + | field q e => exact e.bound_nonneg + | add e f he hf => exact add_nonneg he hf + | mul e f he hf => exact mul_nonneg he hf + +theorem val_bound {e : ClockedExpr} (he : e.Valid) (M : ℚ) (y : SpaceTime) + (hy : |y.1| ≤ |(M : ℝ)|) : |e.val y| ≤ (e.bound M : ℝ) := by + induction e with + | const r => simp [val, bound] + | profile q => exact q.val_bound hy + | field q e => exact e.val_bound he _ + | add e f ih₁ ih₂ => + simpa only [val, bound, Rat.cast_add] using + (abs_add_le _ _).trans (add_le_add (ih₁ he.1) (ih₂ he.2)) + | mul e f ih₁ ih₂ => + simpa only [val, bound, Rat.cast_mul, abs_mul] using + mul_le_mul (ih₁ he.1) (ih₂ he.2) (abs_nonneg _) + (Rat.cast_nonneg.mpr (e.bound_nonneg M)) + +def diffWord (e : ClockedExpr) : List (Fin 4) → ClockedExpr + | [] => e + | j :: α => (e.diffWord α).diff j + +theorem valid_diffWord {e : ClockedExpr} (he : e.Valid) (α : List (Fin 4)) : + (e.diffWord α).Valid := by + induction α with + | nil => exact he + | cons j α ih => exact valid_diff ih j + +noncomputable def scalarMixed (f : SpaceTime → ℝ) : List (Fin 4) → SpaceTime → ℝ := + List.rec f (fun j _ g y => fderiv ℝ g y (spaceTimeDirection j)) + +theorem val_diffWord {e : ClockedExpr} (he : e.Valid) (α : List (Fin 4)) : + (e.diffWord α).val = scalarMixed e.val α := by + induction α with + | nil => rfl + | cons j α ih => + funext y + change ((e.diffWord α).diff j).val y = _ + rw [val_diff (valid_diffWord he α), ih] + rfl + +theorem mixed_bound {e : ClockedExpr} (he : e.Valid) (α : List (Fin 4)) + (M : ℚ) (y : SpaceTime) (hy : |y.1| ≤ |(M : ℝ)|) : + |scalarMixed e.val α y| ≤ ((e.diffWord α).bound M : ℝ) := by + rw [← val_diffWord he α] + exact val_bound (valid_diffWord he α) M y hy + +end ForcedComputation.ClockedExpr + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3d81a292ae1c81f23447e15d826d7da2c156571 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedEvaluation.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedLipschitz +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedRationalEvaluation + +namespace OAI + +/-! Evaluation at a named real point uses a time slab obtained from the +zeroth approximation. The derivative bound on this slab gives a finite +input precision for every mixed derivative. -/ + +noncomputable section +namespace ForcedComputation.ClockedExpr +open ShearFlows + +def nameRadius (a : ℕ → RationalSpaceTime) : ℚ := |(a 0).1| + 2 + +theorem errorTolerance_le_one (n : ℕ) : errorTolerance n ≤ 1 := by + unfold errorTolerance + exact inv_le_one_of_one_le₀ (one_le_pow₀ (by norm_num)) + +theorem nameRadius_bounds {a : ℕ → RationalSpaceTime} {y : SpaceTime} + (ha : IsFastName a y) (n : ℕ) : + |y.1| ≤ |(nameRadius a : ℝ)| ∧ + |(rationalPoint (a n)).1| ≤ |(nameRadius a : ℝ)| := by + have hzero : |y.1 - ((a 0).1 : ℝ)| ≤ 1 := + (norm_fst_le (y - rationalPoint (a 0))).trans + ((ha 0).trans (errorTolerance_le_one 0)) + have hn : |y.1 - ((a n).1 : ℝ)| ≤ 1 := + (norm_fst_le (y - rationalPoint (a n))).trans + ((ha n).trans (errorTolerance_le_one n)) + have hy : |y.1| ≤ |((a 0).1 : ℝ)| + 1 := by + have h := abs_add_le (y.1 - ((a 0).1 : ℝ)) ((a 0).1 : ℝ) + rw [sub_add_cancel] at h + linarith + have hq : |((a n).1 : ℝ)| ≤ |((a 0).1 : ℝ)| + 2 := by + have h := abs_add_le (((a n).1 : ℝ) - y.1) y.1 + rw [sub_add_cancel, abs_sub_comm ((a n).1 : ℝ) y.1] at h + linarith + have hr : (nameRadius a : ℝ) = |((a 0).1 : ℝ)| + 2 := by + simp only [nameRadius, Rat.cast_add, Rat.cast_abs, Rat.cast_ofNat] + rw [hr, abs_of_nonneg (show 0 ≤ |((a 0).1 : ℝ)| + 2 by positivity)] + exact ⟨by linarith, hq⟩ + +def inputPrecision (e : ClockedExpr) (M ε : ℚ) : ℕ := + ⌈2 * e.derivativeBound M / ε⌉₊ + 1 + +theorem inputPrecision_spec (e : ClockedExpr) (M : ℚ) {ε : ℚ} (hε : 0 < ε) : + (e.derivativeBound M : ℝ) * errorTolerance (e.inputPrecision M ε) ≤ (ε : ℝ) / 2 := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + have hn : 2 * (e.derivativeBound M : ℝ) / ε ≤ (e.inputPrecision M ε : ℝ) := by + have h : 2 * e.derivativeBound M / ε ≤ (e.inputPrecision M ε : ℚ) := + (Nat.le_ceil _).trans (by simp [inputPrecision]) + exact_mod_cast h + have hp : (e.inputPrecision M ε : ℝ) ≤ (2 : ℝ) ^ (e.inputPrecision M ε) := by + exact_mod_cast (Nat.lt_two_pow_self (n := e.inputPrecision M ε)).le + have hle := hn.trans hp + have hpow : (0 : ℝ) < 2 ^ (e.inputPrecision M ε) := by positivity + rw [errorTolerance, ← div_eq_mul_inv] + apply (div_le_iff₀ hpow).mpr + have h := (div_le_iff₀ he).mp hle + linarith + +def evaluate (e : ClockedExpr) (he : e.Valid) (a : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : ℚ := + e.evaluateRational he (a (e.inputPrecision (nameRadius a) ε)) (ε / 2) (by positivity) + +theorem evaluate_spec {e : ClockedExpr} (he : e.Valid) + (a : ℕ → RationalSpaceTime) {y : SpaceTime} (ha : IsFastName a y) + (ε : ℚ) (hε : 0 < ε) : + |e.val y - (e.evaluate he a ε hε : ℝ)| ≤ (ε : ℝ) := by + let n := e.inputPrecision (nameRadius a) ε + let q := a n + obtain ⟨hy, hq⟩ := nameRadius_bounds ha n + calc + _ ≤ |e.val y - e.val (rationalPoint q)| + + |e.val (rationalPoint q) - (e.evaluate he a ε hε : ℝ)| := abs_sub_le _ _ _ + _ ≤ (ε : ℝ) / 2 + (ε : ℝ) / 2 := by + apply add_le_add + · exact (lipschitz_bound he (nameRadius a) y (rationalPoint q) hy hq).trans + ((mul_le_mul_of_nonneg_left (ha n) + (Rat.cast_nonneg.mpr (e.derivativeBound_nonneg _))).trans + (inputPrecision_spec e (nameRadius a) hε)) + · simpa only [evaluate, Rat.cast_div, Rat.cast_ofNat] using + e.evaluateRational_spec he q (ε / 2) (by positivity) + _ = _ := by ring + +theorem evaluate_mixed_spec {e : ClockedExpr} (he : e.Valid) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) {y : SpaceTime} (ha : IsFastName a y) + (ε : ℚ) (hε : 0 < ε) : + |scalarMixed e.val α y - + ((e.diffWord α).evaluate (e.valid_diffWord he α) a ε hε : ℝ)| ≤ (ε : ℝ) := by + rw [← e.val_diffWord he α] + exact evaluate_spec (e.valid_diffWord he α) a ha ε hε + +end ForcedComputation.ClockedExpr + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..74e7558a24d53e3c2933ed6671b7da9141202da5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedExpressions.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.FieldExpressions + +namespace OAI + +/-! Finite expressions for the prescribed detector clock. Differentiation +keeps the smooth clock separate from the periodic field it samples. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +noncomputable def clockedPoint (q : ProfileExpr) (y : SpaceTime) : SpaceTime := + (q.val y.1, y.2) + +theorem clockedPoint_smooth (q : ProfileExpr) : ContDiff ℝ ∞ (clockedPoint q) := + (q.smooth.comp contDiff_fst).prodMk contDiff_snd + +theorem clockedPoint_direction (q : ProfileExpr) (y : SpaceTime) (j : Fin 4) : + fderiv ℝ (clockedPoint q) y (spaceTimeDirection j) = + if j = 0 then q.diff.val y.1 • spaceTimeDirection 0 else spaceTimeDirection j := by + have hq := (q.hasDerivAt y.1).comp_hasFDerivAt y + (ContinuousLinearMap.fst ℝ ℝ Space).hasFDerivAt + have hd := hq.prodMk (ContinuousLinearMap.snd ℝ ℝ Space).hasFDerivAt + change HasFDerivAt (clockedPoint q) _ y at hd + rw [hd.fderiv] + cases j using Fin.cases with + | zero => simp [spaceTimeDirection, Prod.smul_mk] + | succ k => simp [spaceTimeDirection] + +inductive ClockedExpr + | const (r : ℚ) + | profile (q : ProfileExpr) + | field (q : ProfileExpr) (e : FieldExpr) + | add (e f : ClockedExpr) + | mul (e f : ClockedExpr) + deriving DecidableEq + +namespace ClockedExpr + +noncomputable def val : ClockedExpr → SpaceTime → ℝ + | .const r, _ => r + | .profile q, y => q.val y.1 + | .field q e, y => e.val (clockedPoint q y) + | .add e f, y => e.val y + f.val y + | .mul e f, y => e.val y * f.val y + +def Valid : ClockedExpr → Prop + | .const _ => True + | .profile _ => True + | .field _ e => e.Valid + | .add e f => e.Valid ∧ f.Valid + | .mul e f => e.Valid ∧ f.Valid + +def diff (j : Fin 4) : ClockedExpr → ClockedExpr + | .const _ => .const 0 + | .profile q => if j = 0 then .profile q.diff else .const 0 + | .field q e => if j = 0 then .mul (.profile q.diff) (.field q (e.diff 0)) + else .field q (e.diff j) + | .add e f => .add (e.diff j) (f.diff j) + | .mul e f => .add (.mul (e.diff j) f) (.mul e (f.diff j)) + +theorem valid_diff {e : ClockedExpr} (he : e.Valid) (j : Fin 4) : (e.diff j).Valid := by + induction e with + | const => trivial + | profile => simp only [diff]; split_ifs <;> trivial + | field q e => + by_cases hj : j = 0 + · simp only [diff, hj, ite_true, Valid] + exact ⟨trivial, e.valid_diff he 0⟩ + · simpa only [diff, hj, ite_false, Valid] using e.valid_diff he j + | add e f ih₁ ih₂ => exact ⟨ih₁ he.1, ih₂ he.2⟩ + | mul e f ih₁ ih₂ => exact ⟨⟨ih₁ he.1, he.2⟩, ⟨he.1, ih₂ he.2⟩⟩ + +theorem smooth {e : ClockedExpr} (he : e.Valid) : ContDiff ℝ ∞ e.val := by + induction e with + | const => exact contDiff_const + | profile q => exact q.smooth.comp contDiff_fst + | field q e => exact (e.smooth he).comp (clockedPoint_smooth q) + | add e f ih₁ ih₂ => exact (ih₁ he.1).add (ih₂ he.2) + | mul e f ih₁ ih₂ => exact (ih₁ he.1).mul (ih₂ he.2) + +theorem val_diff {e : ClockedExpr} (he : e.Valid) (j : Fin 4) (y : SpaceTime) : + (e.diff j).val y = fderiv ℝ e.val y (spaceTimeDirection j) := by + induction e with + | const r => simp [diff, val] + | profile q => + have hd := (q.hasDerivAt y.1).comp_hasFDerivAt y + (ContinuousLinearMap.fst ℝ ℝ Space).hasFDerivAt + change _ = fderiv ℝ (q.val ∘ Prod.fst) y (spaceTimeDirection j) + rw [hd.fderiv] + cases j using Fin.cases with + | zero => simp [diff, val, spaceTimeDirection] + | succ k => simp [diff, val, spaceTimeDirection] + | field q e => + have hd := ((e.smooth he).differentiable (by simp) (clockedPoint q y)).hasFDerivAt.comp y + ((clockedPoint_smooth q).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (e.val ∘ clockedPoint q) y (spaceTimeDirection j) + rw [hd.fderiv, ContinuousLinearMap.comp_apply, clockedPoint_direction] + by_cases hj : j = 0 + · subst j + simp only [diff, ite_true, val, map_smul, smul_eq_mul] + rw [e.val_diff he 0] + · simp only [diff, hj, ite_false, val] + exact e.val_diff he j _ + | add e f ih₁ ih₂ => + rw [show ClockedExpr.val (.add e f) = e.val + f.val from rfl, + fderiv_add ((smooth he.1).differentiable (by simp) y) + ((smooth he.2).differentiable (by simp) y)] + exact congrArg₂ (· + ·) (ih₁ he.1) (ih₂ he.2) + | mul e f ih₁ ih₂ => + have hd := ((smooth he.1).differentiable (by simp) y).hasFDerivAt.mul + ((smooth he.2).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (e.val * f.val) y (spaceTimeDirection j) + rw [hd.fderiv] + simp only [diff, val, add_apply, smul_apply, smul_eq_mul] + rw [ih₁ he.1, ih₂ he.2] + ring + +end ClockedExpr +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedFieldBalls.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedFieldBalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ba7e7356c381b4412de6bb7967226819789cfad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedFieldBalls.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmName + +namespace OAI + +/-! Certified rational balls for a periodic field evaluated at a smooth +clock. The outer evaluation is refined to an explicit dyadic tolerance; +the clock error uses the field's global derivative bound. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Filter +open scoped Topology + +theorem QBall.converges_of_contains {b : ℕ → QBall} {x : ℝ} + (hb : ∀ n, (b n).Contains x) + (hr : Tendsto (fun n => ((b n).radius : ℝ)) atTop (𝓝 0)) : QBall.Converges b x := by + refine ⟨?_, hr⟩ + apply tendsto_iff_dist_tendsto_zero.mpr + apply squeeze_zero (fun n => dist_nonneg) + (fun n => ?_) hr + simpa only [QBall.Contains, Real.dist_eq, abs_sub_comm] using hb n + +namespace ClockedExpr + +def fieldVector (e : FieldExpr) : VelocityExpr := fun _ => e + +theorem fieldVector_valid {e : FieldExpr} (he : e.Valid) : (fieldVector e).Valid := + fun _ => he + +def dyadic (n : ℕ) : ℚ := (2 : ℚ) ^ (-(n : ℤ)) + +theorem dyadic_pos (n : ℕ) : 0 < dyadic n := by unfold dyadic; positivity + +theorem dyadic_cast (n : ℕ) : (dyadic n : ℝ) = errorTolerance n := by + simp [dyadic, errorTolerance] + +theorem dyadic_tendsto : Tendsto (fun n => (dyadic n : ℝ)) atTop (𝓝 0) := by + simpa only [dyadic_cast] using errorTolerance_tendsto + +def fieldBall (q : ProfileExpr) (e : FieldExpr) (he : e.Valid) + (y : RationalSpaceTime) (n : ℕ) : QBall := + let b := q.enclose y.1 n + let c := fieldVector e + let v := c.evaluateRational (fieldVector_valid he) [] (b.center, y.2) (dyadic n) (dyadic_pos n) + ⟨v 0, dyadic n + (c.modulusBound [] : ℚ) * b.radius⟩ + +theorem fieldBall_contains (q : ProfileExpr) {e : FieldExpr} (he : e.Valid) + (y : RationalSpaceTime) (n : ℕ) : + (fieldBall q e he y n).Contains (e.val (clockedPoint q (rationalPoint y))) := by + let b := q.enclose y.1 n + let c := fieldVector e + let z : RationalSpaceTime := (b.center, y.2) + let v := c.evaluateRational (fieldVector_valid he) [] z (dyadic n) (dyadic_pos n) + have houter := c.evaluateRational_spec (fieldVector_valid he) [] z (dyadic n) (dyadic_pos n) + have heval : |e.val (rationalPoint z) - (v 0 : ℝ)| ≤ (dyadic n : ℝ) := by + exact (norm_le_pi_norm + (mixedDerivative c.val [] (rationalPoint z) - rationalVector v) 0).trans houter + have hclock := q.enclose_contains y.1 n + have hdist : ‖clockedPoint q (rationalPoint y) - rationalPoint z‖ ≤ (b.radius : ℝ) := by + apply norm_prod_le_iff.mpr + constructor + · exact hclock + · change ‖(fun j => (y.2 j : ℝ)) - (fun j => (y.2 j : ℝ))‖ ≤ (b.radius : ℝ) + rw [sub_self, norm_zero] + exact_mod_cast QBall.radius_nonneg hclock + have hspace := c.lipschitz_bound (fieldVector_valid he) [] + (clockedPoint q (rationalPoint y)) (rationalPoint z) + have hval : |e.val (clockedPoint q (rationalPoint y)) - e.val (rationalPoint z)| ≤ + (c.modulusBound [] : ℝ) * (b.radius : ℝ) := by + exact (norm_le_pi_norm + (mixedDerivative c.val [] (clockedPoint q (rationalPoint y)) - + mixedDerivative c.val [] (rationalPoint z)) 0).trans + (hspace.trans (mul_le_mul_of_nonneg_left hdist (Nat.cast_nonneg _))) + change |e.val (clockedPoint q (rationalPoint y)) - (v 0 : ℝ)| ≤ _ + calc + _ ≤ |e.val (clockedPoint q (rationalPoint y)) - e.val (rationalPoint z)| + + |e.val (rationalPoint z) - (v 0 : ℝ)| := abs_sub_le _ _ _ + _ ≤ (c.modulusBound [] : ℝ) * (b.radius : ℝ) + (dyadic n : ℝ) := add_le_add hval heval + _ = _ := by + change _ = ((dyadic n + (c.modulusBound [] : ℚ) * b.radius : ℚ) : ℝ) + push_cast + ring + +theorem fieldBall_converges (q : ProfileExpr) {e : FieldExpr} (he : e.Valid) + (y : RationalSpaceTime) : + QBall.Converges (fieldBall q e he y) (e.val (clockedPoint q (rationalPoint y))) := by + apply QBall.converges_of_contains (fieldBall_contains q he y) + have hr := (q.enclose_converges y.1).2 + have h := dyadic_tendsto.add (hr.const_mul ((fieldVector e).modulusBound [] : ℝ)) + simpa only [fieldBall, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, mul_zero, add_zero] using h + +end ClockedExpr +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedLipschitz.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..b172ecabfde9176e881257410106417c48ac7054 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedLipschitz.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedBounds + +namespace OAI + +/-! A computable modulus on each finite time slab for the detector's +clocked expressions. Spatial coordinates remain unrestricted. -/ + +namespace ForcedComputation.ClockedExpr +open ShearFlows Set +open scoped ContDiff BigOperators + +def derivativeBound (e : ClockedExpr) (M : ℚ) : ℚ := + ∑ j : Fin 4, (e.diff j).bound M + +theorem derivativeBound_nonneg (e : ClockedExpr) (M : ℚ) : 0 ≤ e.derivativeBound M := + Finset.sum_nonneg (fun j _ => (e.diff j).bound_nonneg M) + +theorem fderiv_bound {e : ClockedExpr} (he : e.Valid) (M : ℚ) (y : SpaceTime) + (hy : |y.1| ≤ |(M : ℝ)|) : ‖fderiv ℝ e.val y‖ ≤ (e.derivativeBound M : ℝ) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Rat.cast_nonneg.mpr (e.derivativeBound_nonneg M)) + intro v + conv_lhs => rw [← spaceTimeDirections_sum v] + rw [map_sum] + calc + _ ≤ ∑ j : Fin 4, ‖fderiv ℝ e.val y (timeSpaceCoord j v • spaceTimeDirection j)‖ := + norm_sum_le _ _ + _ ≤ ∑ j : Fin 4, ‖v‖ * ((e.diff j).bound M : ℝ) := by + apply Finset.sum_le_sum + intro j _ + rw [map_smul, norm_smul] + have hj : ‖fderiv ℝ e.val y (spaceTimeDirection j)‖ ≤ ((e.diff j).bound M : ℝ) := by + rw [← e.val_diff he j y, Real.norm_eq_abs] + exact val_bound (valid_diff he j) M y hy + exact mul_le_mul (timeSpaceCoord_norm j v) hj (norm_nonneg _) (norm_nonneg _) + _ = _ := by + rw [derivativeBound, Rat.cast_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem lipschitz_bound {e : ClockedExpr} (he : e.Valid) (M : ℚ) (x y : SpaceTime) + (hx : |x.1| ≤ |(M : ℝ)|) (hy : |y.1| ≤ |(M : ℝ)|) : + |e.val x - e.val y| ≤ (e.derivativeBound M : ℝ) * ‖x - y‖ := by + let S : Set SpaceTime := Icc (-|(M : ℝ)|) |(M : ℝ)| ×ˢ (univ : Set Space) + have hc : Convex ℝ S := (convex_Icc (-|(M : ℝ)|) |(M : ℝ)|).prod convex_univ + have hxS : x ∈ S := ⟨abs_le.mp hx, mem_univ _⟩ + have hyS : y ∈ S := ⟨abs_le.mp hy, mem_univ _⟩ + have h := Convex.norm_image_sub_le_of_norm_fderiv_le + (fun z (_ : z ∈ S) => (e.smooth he).differentiable (by simp) z) + (fun z hz => fderiv_bound he M z (abs_le.mpr hz.1)) hc hyS hxS + simpa only [Real.norm_eq_abs] using h + +end ForcedComputation.ClockedExpr + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedRationalEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedRationalEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca1b5b25ae759e4cc9ee0e1d0c49d5592508f889 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedRationalEvaluation.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedFieldBalls + +namespace OAI + +/-! Finite rational evaluation of a clocked expression, with an adaptive +search justified by convergence of its explicit rational enclosures. -/ + +namespace ForcedComputation.ClockedExpr +open ShearFlows Filter +open scoped Topology + +noncomputable def enclose : (e : ClockedExpr) → e.Valid → RationalSpaceTime → ℕ → QBall + | .const r, _, _, _ => .exact r + | .profile q, _, y, n => q.enclose y.1 n + | .field q e, he, y, n => fieldBall q e he y n + | .add e f, he, y, n => (e.enclose he.1 y n).add (f.enclose he.2 y n) + | .mul e f, he, y, n => (e.enclose he.1 y n).mul (f.enclose he.2 y n) + +theorem enclose_contains {e : ClockedExpr} (he : e.Valid) (y : RationalSpaceTime) (n : ℕ) : + (e.enclose he y n).Contains (e.val (rationalPoint y)) := by + induction e with + | const r => exact QBall.contains_exact r + | profile q => exact q.enclose_contains y.1 n + | field q e => exact fieldBall_contains q he y n + | add e f ih₁ ih₂ => exact QBall.contains_add (ih₁ he.1) (ih₂ he.2) + | mul e f ih₁ ih₂ => exact QBall.contains_mul (ih₁ he.1) (ih₂ he.2) + +theorem enclose_converges {e : ClockedExpr} (he : e.Valid) (y : RationalSpaceTime) : + QBall.Converges (e.enclose he y) (e.val (rationalPoint y)) := by + induction e with + | const r => exact QBall.converges_exact r + | profile q => exact q.enclose_converges y.1 + | field q e => exact fieldBall_converges q he y + | add e f ih₁ ih₂ => exact (ih₁ he.1).add (ih₂ he.2) + | mul e f ih₁ ih₂ => exact (ih₁ he.1).mul (ih₂ he.2) + +noncomputable def Ready (e : ClockedExpr) (he : e.Valid) (y : RationalSpaceTime) + (ε : ℚ) (n : ℕ) : Prop := (e.enclose he y n).radius ≤ ε + +noncomputable instance (e : ClockedExpr) (he : e.Valid) (y : RationalSpaceTime) + (ε : ℚ) (n : ℕ) : Decidable (e.Ready he y ε n) := + inferInstanceAs (Decidable ((e.enclose he y n).radius ≤ ε)) + +theorem ready_exists {e : ClockedExpr} (he : e.Valid) (y : RationalSpaceTime) + {ε : ℚ} (hε : 0 < ε) : ∃ n, e.Ready he y ε n := by + have hε' : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := ((e.enclose_converges he y).2.eventually_lt_const hε').exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +noncomputable def evaluateRational (e : ClockedExpr) (he : e.Valid) + (y : RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : ℚ := + (e.enclose he y (Nat.find (e.ready_exists he y hε))).center + +theorem evaluateRational_spec {e : ClockedExpr} (he : e.Valid) + (y : RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : + |e.val (rationalPoint y) - (e.evaluateRational he y ε hε : ℝ)| ≤ (ε : ℝ) := by + have h := e.enclose_contains he y (Nat.find (e.ready_exists he y hε)) + exact h.trans (by exact_mod_cast Nat.find_spec (e.ready_exists he y hε)) + +end ForcedComputation.ClockedExpr + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedResidual.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fa6953557d4fa3345c50ce5158680b9090af121 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedResidual.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedVector +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualExpressions + +namespace OAI + +/-! Finite clocked expressions are closed under the full Navier–Stokes +residual, including the quadratic convection term. -/ + +namespace ForcedComputation +open ShearFlows +open scoped BigOperators + +namespace ClockedExpr + +def sum (l : List ClockedExpr) : ClockedExpr := l.foldr .add (.const 0) + +theorem sum_valid {l : List ClockedExpr} (hl : ∀ e ∈ l, e.Valid) : (sum l).Valid := by + induction l with + | nil => trivial + | cons e l ih => + exact ⟨hl e (by simp), ih (fun f hf => hl f (by simp [hf]))⟩ + +theorem sum_val (l : List ClockedExpr) (y : SpaceTime) : + (sum l).val y = (l.map (fun e => e.val y)).sum := by + induction l with + | nil => simp only [sum, List.foldr_nil, val, List.map_nil, List.sum_nil, Rat.cast_zero] + | cons e l ih => + change e.val y + (sum l).val y = _ + simp only [List.map_cons, List.sum_cons, ih] + +theorem sum_ofFn_valid {n : ℕ} (e : Fin n → ClockedExpr) (he : ∀ j, (e j).Valid) : + (sum (List.ofFn e)).Valid := + sum_valid (fun f hf => by obtain ⟨j, rfl⟩ := List.mem_ofFn.mp hf; exact he j) + +theorem sum_ofFn_val {n : ℕ} (e : Fin n → ClockedExpr) (y : SpaceTime) : + (sum (List.ofFn e)).val y = ∑ j, (e j).val y := by + rw [sum_val, List.map_ofFn, List.sum_ofFn] + rfl + +end ClockedExpr + +namespace ClockedResidual + +def convection (c : ClockedVector) : ClockedVector := fun k => + ClockedExpr.sum (List.ofFn (fun j : Fin 3 => .mul (c j) ((c k).diff j.succ))) + +def linear (c : ClockedVector) (r : ℚ) : ClockedVector := fun k => + .add ((c k).diff 0) (.mul (.const (-r)) + (ClockedExpr.sum (List.ofFn (fun j : Fin 3 => (c k).diffWord [j.succ, j.succ])))) + +def code (c : ClockedVector) (r : ℚ) : ClockedVector := fun k => + .add (linear c r k) (convection c k) + +theorem convection_valid {c : ClockedVector} (hc : c.Valid) : (convection c).Valid := by + intro k + exact ClockedExpr.sum_ofFn_valid _ (fun j => ⟨hc j, (c k).valid_diff (hc k) j.succ⟩) + +theorem linear_valid {c : ClockedVector} (hc : c.Valid) (r : ℚ) : + (linear c r).Valid := by + intro k + exact ⟨(c k).valid_diff (hc k) 0, trivial, + ClockedExpr.sum_ofFn_valid _ (fun j => (c k).valid_diffWord (hc k) _)⟩ + +theorem valid {c : ClockedVector} (hc : c.Valid) (r : ℚ) : (code c r).Valid := + fun k => ⟨linear_valid hc r k, convection_valid hc k⟩ + +theorem convection_val {c : ClockedVector} (hc : c.Valid) : + (convection c).val = convectiveField c.val := by + funext y k + rw [convectiveField_eq_mixed (ClockedVector.smooth hc)] + simp only [convection, ClockedVector.val, ClockedExpr.sum_ofFn_val, + ClockedExpr.val, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + apply Finset.sum_congr rfl + intro j _ + have he := congrFun (congrFun (ClockedVector.val_diffWord hc [j.succ]) y) k + exact congrArg (fun z => (c j).val y * z) he + +theorem linear_val {c : ClockedVector} (hc : c.Valid) (r : ℚ) : + (linear c r).val = force r c.val := by + funext y k + rw [force_eq_mixed (ClockedVector.smooth hc)] + simp_rw [← ClockedVector.val_diffWord hc] + simp only [linear, ClockedVector.val, ClockedExpr.val, ClockedExpr.sum_ofFn_val, + ClockedVector.diffWord, ClockedExpr.diffWord, Finset.sum_apply, Pi.sub_apply, Pi.smul_apply, + smul_eq_mul, Rat.cast_neg] + ring + +theorem val {c : ClockedVector} (hc : c.Valid) (r : ℚ) : + (code c r).val = residual r c.val := by + rw [residual_eq_force_add, ← linear_val hc r, ← convection_val hc] + rfl + +end ClockedResidual +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedVector.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedVector.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2caceed50c2b028dbd23121eed2bc5312ca4166 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ClockedVector.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedEvaluation + +namespace OAI + +/-! Vector-valued finite clocked programs, with certified evaluation and +bounds for every ordered mixed derivative on finite time slabs. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff BigOperators + +abbrev ClockedVector := Fin 3 → ClockedExpr + +namespace ClockedVector + +def Valid (c : ClockedVector) : Prop := ∀ j, (c j).Valid + +def val (c : ClockedVector) : Velocity := fun y j => (c j).val y + +def diffWord (c : ClockedVector) (α : List (Fin 4)) : ClockedVector := + fun j => (c j).diffWord α + +theorem valid_diffWord {c : ClockedVector} (hc : c.Valid) (α : List (Fin 4)) : + (c.diffWord α).Valid := fun j => (c j).valid_diffWord (hc j) α + +theorem smooth {c : ClockedVector} (hc : c.Valid) : ContDiff ℝ ∞ c.val := + contDiff_pi.mpr (fun j => (c j).smooth (hc j)) + +theorem val_diffWord {c : ClockedVector} (hc : c.Valid) (α : List (Fin 4)) : + (c.diffWord α).val = mixedDerivative c.val α := by + induction α with + | nil => rfl + | cons i α ih => + funext y j + rw [mixedDerivative, ← ih] + have h := fderiv_pi (fun k => + (((c k).diffWord α).smooth ((c k).valid_diffWord (hc k) α)).differentiable (by simp) y) + change ((c j).diffWord (i :: α)).val y = + (fderiv ℝ (c.diffWord α).val y (spaceTimeDirection i)) j + change fderiv ℝ (c.diffWord α).val y = _ at h + rw [h] + exact ((c j).diffWord α).val_diff ((c j).valid_diffWord (hc j) α) i y + +def bound (c : ClockedVector) (α : List (Fin 4)) (M : ℚ) : ℚ := + ∑ j, ((c j).diffWord α).bound M + +theorem bound_nonneg (c : ClockedVector) (α : List (Fin 4)) (M : ℚ) : + 0 ≤ c.bound α M := + Finset.sum_nonneg (fun j _ => ((c j).diffWord α).bound_nonneg M) + +theorem val_bound {c : ClockedVector} (hc : c.Valid) (α : List (Fin 4)) + (M : ℚ) (y : SpaceTime) (hy : |y.1| ≤ |(M : ℝ)|) : + ‖mixedDerivative c.val α y‖ ≤ (c.bound α M : ℝ) := by + rw [← val_diffWord hc] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr (c.bound_nonneg α M))).mpr + intro j + have hj := ((c j).diffWord α).val_bound ((c j).valid_diffWord (hc j) α) M y hy + apply hj.trans + exact_mod_cast Finset.single_le_sum + (fun k _ => ((c k).diffWord α).bound_nonneg M) (Finset.mem_univ j) + +def evaluate (c : ClockedVector) (hc : c.Valid) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + fun j => ((c j).diffWord α).evaluate ((c j).valid_diffWord (hc j) α) a ε hε + +theorem evaluate_spec {c : ClockedVector} (hc : c.Valid) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) {y : SpaceTime} (ha : IsFastName a y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative c.val α y - rationalVector (c.evaluate hc α a ε hε)‖ ≤ (ε : ℝ) := by + rw [← val_diffWord hc] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr hε.le)).mpr + intro j + exact ((c j).diffWord α).evaluate_spec ((c j).valid_diffWord (hc j) α) a ha ε hε + +end ClockedVector +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidCoordinates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f699bb74b6e2d9aa54e76c2e44ce8145f632a33 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidCoordinates.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.CompactPeriodizationNS +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.PeriodicCalculus +import OAI.MathematicalPhysics.RapidForcing.JointSmoothness + +namespace OAI + +/-! Coordinate change from the Euclidean rapid-field convention to the +coordinate convention used for periodic fluid fields and cube integrals. -/ + +noncomputable section +open Set +open scoped BigOperators ContDiff +namespace RapidForcing.CompactEmbedding + +def piCoordinates : Space ≃L[ℝ] ShearFlows.Space := + PiLp.continuousLinearEquiv 2 ℝ (fun _ : Fin 3 => ℝ) + +@[simp] theorem piCoordinates_apply (x : Space) (i : Fin 3) : + piCoordinates x i = x i := rfl + +@[simp] theorem piCoordinates_symm_apply (x : ShearFlows.Space) (i : Fin 3) : + piCoordinates.symm x i = x i := rfl + +@[simp] theorem piCoordinates_basis (i : Fin 3) : + piCoordinates (basis i) = ShearFlows.basis i := by + ext j + simp [basis, ShearFlows.basis, piCoordinates, Pi.single_apply] + +@[simp] theorem piCoordinates_symm_basis (i : Fin 3) : + piCoordinates.symm (ShearFlows.basis i) = basis i := by + apply piCoordinates.injective + simp + +@[simp] theorem piCoordinates_symm_lattice (k : Fin 3 → ℤ) : + piCoordinates.symm (ShearFlows.latticeVector 1 k) = latticeVector k := by + ext i + simp [ShearFlows.latticeVector] + +def piField (f : Field Space) : ShearFlows.Velocity := + fun p => piCoordinates (f p.1 (piCoordinates.symm p.2)) + +theorem piField_smooth {f : Field Space} + (hf : ContDiff ℝ ∞ (Function.uncurry f)) : ContDiff ℝ ∞ (piField f) := + piCoordinates.contDiff.comp + (hf.comp (contDiff_fst.prodMk (piCoordinates.symm.contDiff.comp contDiff_snd))) + +theorem piField_derivative (f : Field Space) (t : ℝ) (x : ShearFlows.Space) + (i : Fin 3) : + ShearFlows.derivative (fun y => piField f (t, y)) i x = + piCoordinates (spatialD i f t (piCoordinates.symm x)) := by + change fderiv ℝ (piCoordinates ∘ (f t ∘ piCoordinates.symm)) x + (ShearFlows.basis i) = _ + rw [piCoordinates.comp_fderiv, piCoordinates.symm.comp_right_fderiv] + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, + piCoordinates_symm_basis, spatialD] + +theorem piField_divergence (f : Field Space) (t : ℝ) (x : ShearFlows.Space) : + ShearFlows.divergence (fun y => piField f (t, y)) x = + divergence f t (piCoordinates.symm x) := by + simp only [ShearFlows.divergence, piField_derivative, piCoordinates_apply, divergence] + +theorem piField_advection (f : Field Space) (t : ℝ) (x : ShearFlows.Space) : + ShearFlows.advection (fun y => piField f (t, y)) x = + piCoordinates (advection f t (piCoordinates.symm x)) := by + have hex : piField f (t, x) = + ∑ i, piField f (t, x) i • ShearFlows.basis i := + (ShearFlows.sum_coordinates_basis _).symm + unfold ShearFlows.advection + change (fderiv ℝ (fun y => piField f (t, y)) x) (piField f (t, x)) = _ + rw [hex, map_sum] + simp only [map_smul] + change (∑ i, piField f (t, x) i • + ShearFlows.derivative (fun y => piField f (t, y)) i x) = _ + simp_rw [piField_derivative] + simp only [advection, map_sum, map_smul, piField, piCoordinates_apply] + +theorem piField_laplacian (f : Field Space) (t : ℝ) (x : ShearFlows.Space) : + ShearFlows.laplacian (fun y => piField f (t, y)) x = + piCoordinates (laplace f t (piCoordinates.symm x)) := by + have hd (i : Fin 3) : ShearFlows.derivative (fun y => piField f (t, y)) i = + fun y => piField (spatialD i f) (t, y) := funext (fun y => piField_derivative f t y i) + unfold ShearFlows.laplacian + simp only [hd] + change (∑ i, ShearFlows.derivative (fun y => piField (spatialD i f) (t, y)) i x) = _ + simp only [piField_derivative, laplace, map_sum] + +theorem piField_timeDerivative {f : Field Space} + (hf : ContDiff ℝ ∞ (Function.uncurry f)) {t : ℝ} (ht : 0 ≤ t) + (x : ShearFlows.Space) : + ShearFlows.timeDerivative (piField f) t x = + piCoordinates (timeD f t (piCoordinates.symm x)) := by + rw [timeD_eq_ordinary hf ht] + change fderiv ℝ (piCoordinates ∘ (fun s : ℝ => f s (piCoordinates.symm x))) t 1 = + piCoordinates (fderiv ℝ (fun s : ℝ => f s (piCoordinates.symm x)) t 1) + rw [piCoordinates.comp_fderiv] + rfl + +theorem piField_periodic {f : Field Space} + (hf : ∀ t x k, f t (x + latticeVector k) = f t x) : + ShearFlows.SpatiallyPeriodic 1 (piField f) := by + intro t x k + unfold piField + rw [map_add, piCoordinates_symm_lattice, hf] + +theorem piField_periodic_extension (f : Field Space) : + ShearFlows.SpatiallyPeriodic 1 (piField (periodic f)) := + piField_periodic (periodic_add_lattice f) + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidDifferential.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..657ec12bd936b807e99609b392c0cb739c0343c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidDifferential.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.CompactRapidEmbedding + +namespace OAI + +/-! The similarity has length scale 1/8. Thus viscosity 64ν before the +similarity gives viscosity ν afterwards. All identities are proved directly +from the coordinate derivatives used in the rapid construction. -/ + +noncomputable section +open Set +open scoped BigOperators +namespace RapidForcing.CompactEmbedding + +theorem spatialD_field {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) (i : Fin 3) (x : Space) : + spatialD i (field u) t x = (8 * coordinateSign i) • + linear (spatialD i u t (unembed x)) := by + have hd := linear.hasFDerivAt.comp x + ((hu (unembed x)).hasFDerivAt.comp x (unembed_hasFDerivAt x)) + simp only [Function.comp_def] at hd + change fderiv ℝ (fun y => linear (u t (unembed y))) x (basis i) = _ + rw [hd.fderiv] + simp only [ContinuousLinearMap.comp_apply, inverseLinear_basis, map_smul, spatialD] + +theorem divergence_field {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) (x : Space) : + divergence (field u) t x = divergence u t (unembed x) := by + unfold divergence + apply Finset.sum_congr rfl + intro i _ + rw [spatialD_field hu, PiLp.smul_apply, linear_apply] + by_cases hi : i = 0 + all_goals simp [coordinateSign, hi] + all_goals ring + +theorem advection_field {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) (x : Space) : + advection (field u) t x = linear (advection u t (unembed x)) := by + unfold advection + rw [map_sum] + apply Finset.sum_congr rfl + intro i _ + rw [spatialD_field hu, field, linear_apply, smul_smul, map_smul] + congr 1 + by_cases hi : i = 0 <;> simp [coordinateSign, hi] <;> ring + +theorem spatialD_const_smul {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) (a : ℝ) (i : Fin 3) (x : Space) : + spatialD i (fun t x => a • u t x) t x = a • spatialD i u t x := by + change fderiv ℝ (a • u t) x (basis i) = _ + rw [((hu x).hasFDerivAt.const_smul a).fderiv] + rfl + +theorem spatialD_field_differentiable {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) : Differentiable ℝ (field u t) := + linear.differentiable.comp (hu.comp (unembed_contDiff.differentiable (by simp))) + +theorem spatialD_twice_field {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) + (hdu : ∀ i, Differentiable ℝ (spatialD i u t)) (i : Fin 3) (x : Space) : + spatialD i (spatialD i (field u)) t x = + (64 : ℝ) • linear (spatialD i (spatialD i u) t (unembed x)) := by + have he : spatialD i (field u) t = + fun y => (8 * coordinateSign i) • field (spatialD i u) t y := by + funext y + exact spatialD_field hu i y + change fderiv ℝ (spatialD i (field u) t) x (basis i) = _ + rw [he] + change spatialD i (fun s y => (8 * coordinateSign i) • field (spatialD i u) s y) t x = _ + rw [spatialD_const_smul (spatialD_field_differentiable (hdu i)), + spatialD_field (hdu i), smul_smul] + congr 1 + by_cases hi : i = 0 <;> norm_num [coordinateSign, hi] + +theorem laplace_field {u : Field Space} {t : ℝ} + (hu : Differentiable ℝ (u t)) + (hdu : ∀ i, Differentiable ℝ (spatialD i u t)) (x : Space) : + laplace (field u) t x = (64 : ℝ) • linear (laplace u t (unembed x)) := by + unfold laplace + rw [map_sum, Finset.smul_sum] + exact Finset.sum_congr rfl (fun i _ => spatialD_twice_field hu hdu i x) + +theorem timeD_field {u : Field Space} {t : ℝ} (ht : 0 ≤ t) (x : Space) + (hu : DifferentiableWithinAt ℝ (fun s => u s (unembed x)) (Ici 0) t) : + timeD (field u) t x = linear (timeD u t (unembed x)) := by + have hd := linear.hasFDerivAt.comp_hasDerivWithinAt t hu.hasDerivWithinAt + exact hd.derivWithin (uniqueDiffOn_Ici 0 t ht) + +theorem residual_field {u : Field Space} {t : ℝ} (ht : 0 ≤ t) + (hu : Differentiable ℝ (u t)) + (hdu : ∀ i, Differentiable ℝ (spatialD i u t)) + (htime : ∀ x, DifferentiableWithinAt ℝ (fun s => u s x) (Ici 0) t) + (ν : ℝ) (x : Space) : + residual ν (field u) t x = linear (residual (64 * ν) u t (unembed x)) := by + unfold residual + rw [timeD_field ht x (htime _), advection_field hu, laplace_field hu hdu, + map_sub, map_add, map_smul, smul_smul] + congr 1 + congr 1 + ring + +theorem navierStokes_field {u f : Field Space} (ν : ℝ) + (hNS : NavierStokes (64 * ν) f u (fun _ _ => 0)) + (hu : ∀ t, 0 ≤ t → Differentiable ℝ (u t)) + (hdu : ∀ t, 0 ≤ t → ∀ i, Differentiable ℝ (spatialD i u t)) + (htime : ∀ t, 0 ≤ t → ∀ x, + DifferentiableWithinAt ℝ (fun s => u s x) (Ici 0) t) : + NavierStokes ν (field f) (field u) (fun _ _ => 0) := by + refine ⟨?_, ?_, ?_⟩ + · intro t ht x + have hres : residual (64 * ν) u t (unembed x) = f t (unembed x) := by + have he := hNS.1 t ht (unembed x) + simp [gradient, spatialD] at he + unfold residual + rw [he] + abel + have he := residual_field ht (hu t ht) (hdu t ht) (htime t ht) ν x + rw [hres] at he + change timeD (field u) t x + advection (field u) t x = _ + simp only [gradient, spatialD, fderiv_const_apply, zero_apply, + zero_smul, Finset.sum_const_zero, neg_zero, zero_add] + change timeD (field u) t x + advection (field u) t x = + ν • laplace (field u) t x + linear (f t (unembed x)) + unfold residual at he + rw [← he] + abel + · intro t ht x + rw [divergence_field (hu t ht)] + exact hNS.2.1 t ht (unembed x) + · intro x + simp [field, hNS.2.2] + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidEmbedding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8a256b066a98a9caef4006326e5564826350591 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/CompactRapidEmbedding.lean @@ -0,0 +1,210 @@ +import OAI.MathematicalPhysics.RapidForcing.Support + +namespace OAI + +/-! An explicit reflected similarity places the compact rapid-forcing +construction in a single unit chart. The first-coordinate observation is +preserved, and material trajectories are conjugated by the same map. -/ + +noncomputable section +open Set +open scoped ContDiff +namespace RapidForcing.CompactEmbedding + +def reflection : Space ≃ₗᵢ[ℝ] Space := + LinearIsometryEquiv.piLpCongrRight 2 (fun i : Fin 3 => + if i = 0 then LinearIsometryEquiv.neg ℝ else LinearIsometryEquiv.refl ℝ ℝ) + +@[simp] theorem reflection_apply (x : Space) (i : Fin 3) : + reflection x i = if i = 0 then -x i else x i := by + by_cases hi : i = 0 <;> simp [reflection, LinearIsometryEquiv.piLpCongrRight_apply, hi] + +@[simp] theorem reflection_reflection (x : Space) : reflection (reflection x) = x := by + ext i + by_cases hi : i = 0 <;> simp [hi] + +def linear : Space →L[ℝ] Space := + (1 / 8 : ℝ) • reflection.toContinuousLinearMap + +def inverseLinear : Space →L[ℝ] Space := + (8 : ℝ) • reflection.toContinuousLinearMap + +def coordinateSign (i : Fin 3) : ℝ := if i = 0 then -1 else 1 + +theorem linear_apply (x : Space) (i : Fin 3) : + linear x i = (coordinateSign i / 8) * x i := by + by_cases hi : i = 0 <;> simp [linear, coordinateSign, hi, div_eq_mul_inv] + +theorem inverseLinear_basis (i : Fin 3) : + inverseLinear (basis i) = (8 * coordinateSign i) • basis i := by + ext j + by_cases hji : j = i + · subst j + by_cases hi : i = 0 <;> simp [inverseLinear, coordinateSign, basis, hi] + · have hj0 : i = 0 → j ≠ 0 := by intro hi; simpa [hi] using hji + by_cases hi : i = 0 <;> simp [inverseLinear, coordinateSign, basis, hji, hi, hj0] + +@[simp] theorem inverseLinear_linear (x : Space) : inverseLinear (linear x) = x := by + simp [inverseLinear, linear, map_smul, smul_smul] + +@[simp] theorem linear_inverseLinear (x : Space) : linear (inverseLinear x) = x := by + simp [inverseLinear, linear, map_smul, smul_smul] + +theorem norm_linear (x : Space) : ‖linear x‖ = (1 / 8 : ℝ) * ‖x‖ := by + simp [linear, norm_smul] + +theorem norm_inverseLinear (x : Space) : ‖inverseLinear x‖ = 8 * ‖x‖ := by + simp [inverseLinear, norm_smul] + +def center : Space := vec (3 / 8) (1 / 2) (1 / 2) + +def embed (x : Space) : Space := center + linear x + +def unembed (x : Space) : Space := inverseLinear (x - center) + +@[simp] theorem unembed_embed (x : Space) : unembed (embed x) = x := by + simp [unembed, embed] + +@[simp] theorem embed_unembed (x : Space) : embed (unembed x) = x := by + simp [unembed, embed] + +@[simp] theorem embed_zero : embed 0 = center := by simp [embed] + +@[simp] theorem unembed_center : unembed center = 0 := by simp [unembed] + +theorem embed_injective : Function.Injective embed := + Function.LeftInverse.injective unembed_embed + +theorem unembed_injective : Function.Injective unembed := + Function.LeftInverse.injective embed_unembed + +@[simp] theorem embed_first (x : Space) : embed x 0 = 3 / 8 - x 0 / 8 := by + simp [embed, center, vec, linear, sub_eq_add_neg, div_eq_mul_inv, mul_comm] + +@[simp] theorem embed_second (x : Space) : embed x 1 = 1 / 2 + x 1 / 8 := by + simp [embed, center, vec, linear, div_eq_mul_inv, mul_comm] + +@[simp] theorem embed_third (x : Space) : embed x 2 = 1 / 2 + x 2 / 8 := by + simp [embed, center, vec, linear, div_eq_mul_inv, mul_comm] + +theorem embed_observation (x : Space) : 1 / 2 < embed x 0 ↔ x 0 < -1 := by + rw [embed_first] + constructor <;> intro h <;> linarith + +def chart : Set Space := {x | (∀ i, 1 / 4 ≤ x i) ∧ ∀ i, x i ≤ 3 / 4} + +theorem embed_mem_chart {x : Space} (hx : x ∈ K) : embed x ∈ chart := by + obtain ⟨hx0, hx0', hx1, hx1', hx2, hx2'⟩ := hx + have h0 := embed_first x + have h1 := embed_second x + have h2 := embed_third x + constructor <;> intro i <;> fin_cases i <;> dsimp <;> linarith + +theorem chart_inside_unit {x : Space} (hx : x ∈ chart) : + ∀ i, 0 < x i ∧ x i < 1 := by + intro i + have h0 := hx.1 i + have h1 := hx.2 i + constructor <;> linarith + +def compactChart : Set Space := embed '' K + +theorem compactChart_compact : IsCompact compactChart := + K_compact.image (continuous_const.add linear.continuous) + +theorem compactChart_subset_chart : compactChart ⊆ chart := by + rintro _ ⟨x, hx, rfl⟩ + exact embed_mem_chart hx + +theorem embed_hasFDerivAt (x : Space) : HasFDerivAt embed linear x := by + exact linear.hasFDerivAt.const_add center + +theorem unembed_hasFDerivAt (x : Space) : HasFDerivAt unembed inverseLinear x := by + have he : unembed = fun y => inverseLinear y - inverseLinear center := by + funext y + exact map_sub inverseLinear y center + rw [he] + exact inverseLinear.hasFDerivAt.sub_const _ + +theorem embed_contDiff : ContDiff ℝ ∞ embed := + contDiff_const.add linear.contDiff + +theorem unembed_contDiff : ContDiff ℝ ∞ unembed := + inverseLinear.contDiff.comp (contDiff_id.sub contDiff_const) + +def field (u : Field Space) : Field Space := + fun t x => linear (u t (unembed x)) + +@[simp] theorem field_embed (u : Field Space) (t : ℝ) (x : Space) : + field u t (embed x) = linear (u t x) := by simp [field] + +theorem field_zero (u : Field Space) {t : ℝ} (hu : ∀ x, u t x = 0) : + ∀ x, field u t x = 0 := by intro x; simp [field, hu] + +theorem field_supported {u : Field Space} (hu : Supported u) {t : ℝ} (ht : 0 ≤ t) : + tsupport (field u t) ⊆ compactChart := by + apply closure_minimal _ compactChart_compact.isClosed + intro x hx + have hmem : unembed x ∈ K := by + by_contra h + exact hx (by simp [field, hu.zero_off ht h]) + exact ⟨unembed x, hmem, embed_unembed x⟩ + +theorem field_smooth {u : Field Space} (hu : Smooth u) : Smooth (field u) := by + exact linear.contDiff.comp_contDiffOn + (hu.comp (contDiff_fst.prodMk (unembed_contDiff.comp contDiff_snd)).contDiffOn + (fun y hy => ⟨hy.1, mem_univ _⟩)) + +theorem embed_curve_hasDerivWithinAt {γ : ℝ → Space} {v : Space} + {s : Set ℝ} {t : ℝ} (hγ : HasDerivWithinAt γ v s t) : + HasDerivWithinAt (fun r => embed (γ r)) (linear v) s t := by + simpa only [Function.comp_def] using (embed_hasFDerivAt (γ t)).comp_hasDerivWithinAt t hγ + +theorem unembed_curve_hasDerivWithinAt {γ : ℝ → Space} {v : Space} + {s : Set ℝ} {t : ℝ} (hγ : HasDerivWithinAt γ v s t) : + HasDerivWithinAt (fun r => unembed (γ r)) (inverseLinear v) s t := by + simpa only [Function.comp_def] using + (unembed_hasFDerivAt (γ t)).comp_hasDerivWithinAt t hγ + +def flow (X : ℝ → Space → Space) : ℝ → Space → Space := + fun t x => embed (X t (unembed x)) + +@[simp] theorem flow_embed (X : ℝ → Space → Space) (t : ℝ) (x : Space) : + flow X t (embed x) = embed (X t x) := by simp [flow] + +theorem trajectory_unembed {u : Field Space} {a : Space} {T : ℝ} {γ : ℝ → Space} + (hγ : TrajectoryOn (field u) a T γ) : + TrajectoryOn u (unembed a) T (fun t => unembed (γ t)) := by + refine ⟨by change unembed (γ 0) = unembed a; rw [hγ.1], ?_⟩ + intro t ht + simpa only [field, inverseLinear_linear] using + unembed_curve_hasDerivWithinAt (hγ.2 t ht) + +theorem materialFlow {u : Field Space} {X : ℝ → Space → Space} + (hX : MaterialFlow u X) : MaterialFlow (field u) (flow X) := by + refine ⟨?_, ?_, ?_⟩ + · intro a + simp [flow, hX.1] + · intro a t ht + simpa only [flow, field, unembed_embed] using + embed_curve_hasDerivWithinAt (hX.2.1 (unembed a) t ht) + · intro T hT a γ hγ t ht + have he := hX.2.2 T hT (unembed a) (fun r => unembed (γ r)) + (trajectory_unembed hγ) t ht + have he' := congrArg embed he + simpa only [embed_unembed, flow] using he' + +theorem flow_observation (X : ℝ → Space → Space) (t : ℝ) : + 1 / 2 < flow X t center 0 ↔ X t 0 0 < -1 := by + simpa only [flow, unembed_center] using embed_observation (X t 0) + +theorem reaches_iff (X : ℝ → Space → Space) : + (∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < flow X t center 0) ↔ + ∃ t : ℝ, 0 ≤ t ∧ X t 0 0 < -1 := by + simp only [flow_observation] + +end RapidForcing.CompactEmbedding + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ConfigurationTapes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ConfigurationTapes.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cbaa520e8b39328f36f936c7b3c40a029f43fa4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ConfigurationTapes.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Recorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TapeCoordinates + +namespace OAI + +/-! Exact two-stream coordinates of a one-head tape update. -/ + +namespace ForcedComputation.Recorder + +variable {Q A : Type*} + +def tapeAt (C : Configuration Q A) : Radix.Tape (Symbol Q A) := + (fun n => C.tape (C.head - ((n : ℤ) + 1)), fun n => C.tape (C.head + (n : ℤ))) + +theorem tapeAt_right (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) : + tapeAt ⟨q', C.head + 1, Function.update C.tape C.head b⟩ = + Radix.writeRight b (tapeAt C) := by + apply Prod.ext + · funext n + cases n with + | zero => simp [tapeAt, Radix.writeRight, Radix.prepend] + | succ n => + dsimp [tapeAt, Radix.writeRight, Radix.prepend] + rw [Function.update_of_ne (by omega)] + congr 1 + omega + · funext n + dsimp [tapeAt, Radix.writeRight] + rw [Function.update_of_ne (by omega)] + congr 1 + omega + +theorem tapeAt_stay (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) : + tapeAt ⟨q', C.head, Function.update C.tape C.head b⟩ = + Radix.writeStay b (tapeAt C) := by + apply Prod.ext + · funext n + dsimp [tapeAt, Radix.writeStay] + rw [Function.update_of_ne (by omega)] + · funext n + cases n with + | zero => simp [tapeAt, Radix.writeStay, Radix.prepend] + | succ n => + dsimp [tapeAt, Radix.writeStay, Radix.prepend] + rw [Function.update_of_ne (by omega)] + +theorem tapeAt_left (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) : + tapeAt ⟨q', C.head - 1, Function.update C.tape C.head b⟩ = + Radix.writeLeft b (tapeAt C) := by + apply Prod.ext + · funext n + dsimp [tapeAt, Radix.writeLeft] + rw [Function.update_of_ne (by omega)] + congr 1 + omega + · funext n + cases n with + | zero => + dsimp [tapeAt, Radix.writeLeft, Radix.prepend] + rw [Function.update_of_ne (by omega)] + congr 1 + omega + | succ n => + cases n with + | zero => simp [tapeAt, Radix.writeLeft, Radix.prepend] + | succ n => + dsimp [tapeAt, Radix.writeLeft, Radix.prepend] + rw [Function.update_of_ne (by omega)] + congr 1 + omega + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FastVectorArithmetic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FastVectorArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d079881287a9a48fe5f4eff732d9787dc6125750 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FastVectorArithmetic.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FinitePhaseEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmName + +namespace OAI + +/-! Finite rational interval arithmetic for vector-valued derivative formulas. +The stopping test is rational and finite; convergence proves its termination. -/ + +namespace ForcedComputation +open ShearFlows Filter +open scoped Topology + +def realNameBall (a : ℕ → ℚ) (n : ℕ) : QBall := + ⟨a n, (2 : ℚ) ^ (-(n : ℤ))⟩ + +def vectorNameBall (a : ℕ → RationalVector) (n : ℕ) (j : Fin 3) : QBall := + realNameBall (fun k => a k j) n + +theorem realNameBall_contains {a : ℕ → ℚ} {x : ℝ} + (ha : IsFastRealName a x) (n : ℕ) : (realNameBall a n).Contains x := by + simpa [realNameBall, QBall.Contains, errorTolerance] using ha n + +theorem realNameBall_converges {a : ℕ → ℚ} {x : ℝ} + (ha : IsFastRealName a x) : QBall.Converges (realNameBall a) x := by + refine ⟨fastRealName_tendsto ha, ?_⟩ + have he : (fun n => ((realNameBall a n).radius : ℝ)) = errorTolerance := by + funext n + simp [realNameBall, errorTolerance] + rw [he] + exact errorTolerance_tendsto + +theorem vectorNameBall_contains {a : ℕ → RationalVector} {v : Space} + (ha : IsFastVectorName a v) (n : ℕ) (j : Fin 3) : + (vectorNameBall a n j).Contains (v j) := by + apply realNameBall_contains + intro k + exact (show |v j - (a k j : ℝ)| ≤ ‖v - rationalVector (a k)‖ from + norm_le_pi_norm (v - rationalVector (a k)) j).trans (ha k) + +theorem vectorNameBall_converges {a : ℕ → RationalVector} {v : Space} + (ha : IsFastVectorName a v) (j : Fin 3) : + QBall.Converges (fun n => vectorNameBall a n j) (v j) := by + apply realNameBall_converges + intro k + exact (show |v j - (a k j : ℝ)| ≤ ‖v - rationalVector (a k)‖ from + norm_le_pi_norm (v - rationalVector (a k)) j).trans (ha k) + +def vectorBallReady (b : ℕ → Fin 3 → QBall) (ε : ℚ) (n : ℕ) : Prop := + ∀ j, (b n j).radius ≤ ε + +instance (b : ℕ → Fin 3 → QBall) (ε : ℚ) (n : ℕ) : + Decidable (vectorBallReady b ε n) := + inferInstanceAs (Decidable (∀ j, (b n j).radius ≤ ε)) + +theorem vectorBallReady_exists {b : ℕ → Fin 3 → QBall} {v : Space} + (hb : ∀ j, QBall.Converges (fun n => b n j) (v j)) + {ε : ℚ} (hε : 0 < ε) : ∃ n, vectorBallReady b ε n := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + have h : ∀ j, ∀ᶠ n in atTop, ((b n j).radius : ℝ) < ε := fun j => + (hb j).2.eventually_lt_const he + obtain ⟨n, hn⟩ := (eventually_all.mpr h).exists + exact ⟨n, fun j => by exact_mod_cast (hn j).le⟩ + +def evaluateVectorBalls (b : ℕ → Fin 3 → QBall) (ε : ℚ) + (h : ∃ n, vectorBallReady b ε n) : RationalVector := + fun j => (b (Nat.find h) j).center + +theorem evaluateVectorBalls_spec {v : Space} (b : ℕ → Fin 3 → QBall) + (hb : ∀ j, QBall.Converges (fun n => b n j) (v j)) + (hc : ∀ n j, (b n j).Contains (v j)) (ε : ℚ) (hε : 0 < ε) : + ‖v - rationalVector (evaluateVectorBalls b ε (vectorBallReady_exists hb hε))‖ ≤ (ε : ℝ) := by + apply (pi_norm_le_iff_of_nonneg (by exact_mod_cast hε.le)).mpr + intro j + change |v j - ((b (Nat.find (vectorBallReady_exists hb hε)) j).center : ℝ)| ≤ ε + exact (hc _ j).trans (by exact_mod_cast (Nat.find_spec (vectorBallReady_exists hb hε) j)) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FieldReindex.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FieldReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d0054f92248093f68b7cfdec92cd660a8dd82d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FieldReindex.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.FieldExpressions + +namespace OAI + +/-! Coordinate changes in finite field expressions. This moves the planar +processor's periodic phase from its third spatial coordinate to time. -/ + +namespace ForcedComputation +open ShearFlows + +noncomputable def reindexPoint (σ : Fin 4 → Fin 4) (y : SpaceTime) : SpaceTime := + (timeSpaceCoord (σ 0) y, fun j => timeSpaceCoord (σ j.succ) y) + +theorem timeSpaceCoord_reindex (σ : Fin 4 → Fin 4) (j : Fin 4) (y : SpaceTime) : + timeSpaceCoord j (reindexPoint σ y) = timeSpaceCoord (σ j) y := by + fin_cases j <;> rfl + +def _root_.OAI.ShearFlows.FieldExpr.reindex (σ : Fin 4 → Fin 4) : FieldExpr → FieldExpr + | .const r => .const r + | .atom j p => .atom (σ j) p + | .add e f => .add (e.reindex σ) (f.reindex σ) + | .mul e f => .mul (e.reindex σ) (f.reindex σ) + +theorem _root_.OAI.ShearFlows.FieldExpr.valid_reindex {e : FieldExpr} (he : e.Valid) (σ : Fin 4 → Fin 4) : + (e.reindex σ).Valid := by + induction e with + | const => trivial + | atom j p => exact he + | add e f ih₁ ih₂ => exact ⟨ih₁ he.1, ih₂ he.2⟩ + | mul e f ih₁ ih₂ => exact ⟨ih₁ he.1, ih₂ he.2⟩ + +theorem _root_.OAI.ShearFlows.FieldExpr.val_reindex (e : FieldExpr) (σ : Fin 4 → Fin 4) (y : SpaceTime) : + (e.reindex σ).val y = e.val (reindexPoint σ y) := by + induction e with + | const => rfl + | atom j p => simp only [FieldExpr.reindex, FieldExpr.val, timeSpaceCoord_reindex] + | add e f ih₁ ih₂ => simp only [FieldExpr.reindex, FieldExpr.val, ih₁, ih₂] + | mul e f ih₁ ih₂ => simp only [FieldExpr.reindex, FieldExpr.val, ih₁, ih₂] + +def timeHeightSwap : Fin 4 → Fin 4 := ![3, 1, 2, 0] + +theorem reindexPoint_timeHeightSwap (y : SpaceTime) : + reindexPoint timeHeightSwap y = (y.2 2, atHeight (horizontal y.2) y.1) := by + apply Prod.ext + · rfl + · ext j + fin_cases j <;> rfl + +theorem _root_.OAI.ShearFlows.FieldExpr.val_timeHeightSwap (e : FieldExpr) (y : SpaceTime) : + (e.reindex timeHeightSwap).val y = e.val (y.2 2, atHeight (horizontal y.2) y.1) := by + rw [FieldExpr.val_reindex, reindexPoint_timeHeightSwap] + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c82a57373589d2f8dd8808107070d695a7b8a69 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteGeometry.lean @@ -0,0 +1,353 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteLabels +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderCoordinates +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BoxBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RectangleSeparation + +namespace OAI + +/-! The actual finite list of rational affine instructions and the fixed +unit-torus geometric data for the initialized computation construction. -/ + +namespace ForcedComputation.Recorder + +open Radix ShearFlows + +def geometricBranches (M : Alternating.Machine) (hM : M.WellFormed) : + List (Branch (finiteMachine M hM)) := (compileBranches M hM).dedup + +def geometricInstruction (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : Instruction := + branchInstruction (bandScale M) (radixBase M) (radixDigit M) (stateOffset M) b + +def compiledInput (M : Alternating.Machine) (hM : M.WellFormed) : Input where + period := 1 + chart := ⟨![1 / 32, 1 / 32, 1 / 8], ![31 / 32, 31 / 32, 7 / 8]⟩ + h := bandScale M / 2 + codingHeight := 1 / 2 + centers := ⟨![1 / 8, 1 / 4], ![13 / 16, 1 / 2]⟩ + instructions := (geometricBranches M hM).map (geometricInstruction M hM) + +theorem geometricInstruction_mem (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + geometricInstruction M hM b ∈ (compiledInput M hM).instructions := by + apply List.mem_map.mpr + refine ⟨b, ?_, rfl⟩ + simpa only [geometricBranches, List.mem_dedup] using mem_compileBranches M hM b + +theorem geometricInstruction_factor_pos (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : 0 < (geometricInstruction M hM b).factor := + headFactor_pos (lt_trans (by norm_num) (radixBase_gt_one M)) _ + +theorem geometricInstruction_source_positive (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (geometricInstruction M hM b).source.positive := + scaledBox_positive (bandScale_pos M) _ + (sourceBox_positive (lt_trans (by norm_num) (radixBase_gt_one M)) _ _) + +theorem geometricInstruction_target_positive (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : (geometricInstruction M hM b).target.positive := + scaledBox_positive (bandScale_pos M) _ + (targetBox_positive (lt_trans (by norm_num) (radixBase_gt_one M)) _ _ _) + +theorem radixDigit_bounds_rat (M : Alternating.Machine) (a : Symbol (State M) (Alphabet M)) : + 0 ≤ radixDigit M a ∧ radixDigit M a + 1 ≤ radixBase M := by + constructor + · exact_mod_cast (radixDigit_bounds M a).1 + · exact_mod_cast (radixDigit_bounds M a).2 + +theorem geometricInstruction_source_unit (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + InUnit (sourceBox (radixBase M) (radixDigit M b.left) (radixDigit M b.read)) := + sourceBox_inUnit (lt_trans (by norm_num) (radixBase_gt_one M)) + (radixDigit_bounds_rat M _) (radixDigit_bounds_rat M _) + +theorem geometricInstruction_target_unit (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + InUnit (targetBox (radixBase M) (radixDigit M b.left) (radixDigit M b.write) + (headMoveOfInt b.displacement)) := + targetBox_inUnit (lt_trans (by norm_num) (radixBase_gt_one M)) + (radixDigit_bounds_rat M _) (radixDigit_bounds_rat M _) _ + +theorem geometricInstruction_halfWidths (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (j : Fin 2) : + (geometricInstruction M hM b).source.halfWidth j ≤ (bandScale M : ℝ) / 2 ∧ + (geometricInstruction M hM b).target.halfWidth j ≤ (bandScale M : ℝ) / 2 := by + have hp : (0 : ℝ) ≤ bandScale M := by exact_mod_cast (bandScale_pos M).le + constructor + · change (scaledBox (bandScale M) (stateOffset M b.source) + (sourceBox (radixBase M) (radixDigit M b.left) (radixDigit M b.read))).halfWidth j ≤ _ + rw [scaledBox_halfWidth] + nlinarith [halfWidth_le_half (geometricInstruction_source_unit M hM b) j] + · change (scaledBox (bandScale M) (stateOffset M b.target) + (targetBox (radixBase M) (radixDigit M b.left) (radixDigit M b.write) + (headMoveOfInt b.displacement))).halfWidth j ≤ _ + rw [scaledBox_halfWidth] + nlinarith [halfWidth_le_half (geometricInstruction_target_unit M hM b) j] + +theorem stateBox_bounds (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) + {R : RationalBox 2} (hR : InUnit R) {x : Plane} + (hx : x ∈ (scaledBox (bandScale M) (stateOffset M q) R).carrier) : + (1 / 8 : ℝ) ≤ x 0 ∧ x 0 ≤ 13 / 16 ∧ (1 / 4 : ℝ) ≤ x 1 ∧ x 1 ≤ 1 / 2 := by + have h₀ := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 0 + have h₁ := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 1 + have hk : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + norm_num at h + exact h + have hy : (3 / 8 : ℝ) < centerY M q ∧ (centerY M q : ℝ) < 7 / 16 := by + constructor + · have h := (Rat.cast_lt (K := ℝ)).mpr (centerY_bounds M q).1 + norm_num at h + exact h + · have h := (Rat.cast_lt (K := ℝ)).mpr (centerY_bounds M q).2 + norm_num at h + exact h + simp only [stateOffset, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_sub, Rat.cast_div, Rat.cast_ofNat] at h₀ h₁ + cases ht : recorderHalting M q <;> simp only [ht, Bool.false_eq_true, ite_false, ite_true] at h₀ <;> + norm_num at h₀ + all_goals exact ⟨by linarith [h₀.1, h₀.2], by linarith [h₀.1, h₀.2], + by linarith [h₁.1, h₁.2], by linarith [h₁.1, h₁.2]⟩ + +theorem stateBox_nonterminal_x (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) + (hq : recorderHalting M q = false) {R : RationalBox 2} (hR : InUnit R) {x : Plane} + (hx : x ∈ (scaledBox (bandScale M) (stateOffset M q) R).carrier) : + 1 / 4 - (bandScale M : ℝ) / 2 ≤ x 0 ∧ + x 0 ≤ 1 / 4 + (bandScale M : ℝ) / 2 := by + have h := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 0 + norm_num [stateOffset, hq] at h + constructor <;> linarith [h.1, h.2] + +theorem stateBox_terminal_x (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) + (hq : recorderHalting M q = true) {R : RationalBox 2} (hR : InUnit R) {x : Plane} + (hx : x ∈ (scaledBox (bandScale M) (stateOffset M q) R).carrier) : + 3 / 4 - (bandScale M : ℝ) / 2 ≤ x 0 ∧ + x 0 ≤ 3 / 4 + (bandScale M : ℝ) / 2 := by + have h := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 0 + norm_num [stateOffset, hq] at h + constructor <;> linarith [h.1, h.2] + +theorem geometricInstruction_source_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (geometricInstruction M hM b).source.carrier) : + (1 / 8 : ℝ) ≤ x 0 ∧ x 0 ≤ 13 / 16 ∧ (1 / 4 : ℝ) ≤ x 1 ∧ x 1 ≤ 1 / 2 := + stateBox_bounds M b.source (geometricInstruction_source_unit M hM b) hx + +theorem geometricInstruction_target_bounds (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) {x : Plane} + (hx : x ∈ (geometricInstruction M hM b).target.carrier) : + (1 / 8 : ℝ) ≤ x 0 ∧ x 0 ≤ 13 / 16 ∧ (1 / 4 : ℝ) ≤ x 1 ∧ x 1 ≤ 1 / 2 := + stateBox_bounds M b.target (geometricInstruction_target_unit M hM b) hx + +theorem geometricInstruction_image (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) : + (geometricInstruction M hM b).affine '' (geometricInstruction M hM b).source.carrier = + (geometricInstruction M hM b).target.carrier := by + let r := radixInstruction (radixBase M) (radixDigit M b.left) (radixDigit M b.read) + (radixDigit M b.write) (headMoveOfInt b.displacement) + change (scaledInstruction (bandScale M) (stateOffset M b.source) (stateOffset M b.target) r).affine '' + (scaledBox (bandScale M) (stateOffset M b.source) r.source).carrier = + (scaledBox (bandScale M) (stateOffset M b.target) r.target).carrier + rw [← scaledBox_image (bandScale_pos M), ← scaledBox_image (bandScale_pos M), Set.image_image] + have he : (scaledInstruction (bandScale M) (stateOffset M b.source) (stateOffset M b.target) r).affine ∘ + embedPlane (bandScale M) (stateOffset M b.source) = + embedPlane (bandScale M) (stateOffset M b.target) ∘ r.affine := by + funext x + exact scaledInstruction_action _ _ _ _ _ + simp only [Function.comp_def] at he + have hr : r.affine '' r.source.carrier = r.target.carrier := + radixInstruction_image (lt_trans (by norm_num) (radixBase_gt_one M)) _ _ _ _ + rw [he, ← Set.image_image, hr] + +theorem compiledInput_basic (M : Alternating.Machine) (hM : M.WellFormed) : + 0 < (compiledInput M hM).period ∧ (compiledInput M hM).chart.positive ∧ + (∀ j, (compiledInput M hM).chart.upper j - (compiledInput M hM).chart.lower j < + (compiledInput M hM).period) ∧ + 0 < (compiledInput M hM).h ∧ (compiledInput M hM).centers.nonemptyBox ∧ + ((compiledInput M hM).chart.lower 2 : ℝ) < (compiledInput M hM).codingHeight ∧ + ((compiledInput M hM).codingHeight : ℝ) < (compiledInput M hM).chart.upper 2 := by + refine ⟨by norm_num [compiledInput], ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro j + fin_cases j <;> norm_num [compiledInput] + · intro j + fin_cases j <;> norm_num [compiledInput] + · exact div_pos (bandScale_pos M) (by norm_num) + · intro j + fin_cases j <;> norm_num [compiledInput] + · norm_num [compiledInput] + · norm_num [compiledInput] + +theorem compiledInput_chartMargin (M : Alternating.Machine) (hM : M.WellFormed) : + ∀ j : Fin 2, + ((compiledInput M hM).chart.lower j.castSucc : ℝ) < + ((compiledInput M hM).centers.lower j : ℝ) - 2 * ((compiledInput M hM).h : ℝ) ∧ + ((compiledInput M hM).centers.upper j : ℝ) + 2 * ((compiledInput M hM).h : ℝ) < + ((compiledInput M hM).chart.upper j.castSucc : ℝ) := by + have hs : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + norm_num at h + exact h + intro j + fin_cases j <;> norm_num [compiledInput] <;> constructor <;> linarith + +theorem stateBox_separation (M : Alternating.Machine) + {q r : Control (State M) (Alphabet M)} (hqr : q ≠ r) + {R S : RationalBox 2} (hR : InUnit R) (hS : InUnit S) : + PositivelySeparated (scaledBox (bandScale M) (stateOffset M q) R).carrier + (scaledBox (bandScale M) (stateOffset M r) S).carrier := by + have hp : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + refine ⟨3 * (bandScale M : ℝ), by positivity, ?_⟩ + intro x hx y hy + have hgap := centerY_gap M hqr + have hxb := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 1 + have hyb := scaledBox_between (bandScale_pos M).le (stateOffset M r) hS hy 1 + dsimp [stateOffset] at hxb hyb + push_cast at hxb hyb + have hab : 3 * (bandScale M : ℝ) ≤ |x 1 - y 1| := by + rcases le_total (centerY M q : ℝ) (centerY M r : ℝ) with h | h + · rw [abs_of_nonpos (sub_nonpos.mpr h)] at hgap + calc + 3 * (bandScale M : ℝ) ≤ y 1 - x 1 := by linarith [hxb.2, hyb.1] + _ ≤ |y 1 - x 1| := le_abs_self _ + _ = |x 1 - y 1| := abs_sub_comm _ _ + · rw [abs_of_nonneg (sub_nonneg.mpr h)] at hgap + exact (show 3 * (bandScale M : ℝ) ≤ x 1 - y 1 by linarith [hxb.1, hyb.2]).trans + (le_abs_self _) + exact hab.trans (by simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) 1) + +theorem geometricInstruction_source_separation (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + PositivelySeparated (geometricInstruction M hM b).source.carrier + (geometricInstruction M hM c).source.carrier := by + by_cases hs : b.source = c.source + · have hpair : (symbolLabel M b.left, symbolLabel M b.read) ≠ + (symbolLabel M c.left, symbolLabel M c.read) := by + intro h + have hl := (symbolLabel M).injective (congrArg Prod.fst h) + have hr := (symbolLabel M).injective (congrArg Prod.snd h) + rcases Branch.source_symbols_differ hne hs with hn | hn + · exact hn hr + · exact hn hl + have hgap := (sourceBox_gap (symbolLabel M b.left) (symbolLabel M b.read) + (symbolLabel M c.left) (symbolLabel M c.read) hpair).scaled (bandScale_pos M) + (stateOffset M b.source) + have hp : 0 < (bandScale M : ℝ) * (1 / (radixBase M : ℝ)) := by + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hB : (0 : ℝ) < radixBase M := by exact_mod_cast lt_trans (by norm_num) (radixBase_gt_one M) + positivity + simpa only [geometricInstruction, branchInstruction, scaledInstruction, radixInstruction, + radixBase, radixDigit, hs] using hgap.positiveSeparated hp + · exact stateBox_separation M hs (geometricInstruction_source_unit M hM b) + (geometricInstruction_source_unit M hM c) + +theorem geometricInstruction_target_separation (M : Alternating.Machine) (hM : M.WellFormed) + {b c : Branch (finiteMachine M hM)} (hne : b ≠ c) : + PositivelySeparated (geometricInstruction M hM b).target.carrier + (geometricInstruction M hM c).target.carrier := by + by_cases ht : b.target = c.target + · have hpair : (symbolLabel M b.left, symbolLabel M b.write) ≠ + (symbolLabel M c.left, symbolLabel M c.write) := by + intro h + have hl := (symbolLabel M).injective (congrArg Prod.fst h) + have hw := (symbolLabel M).injective (congrArg Prod.snd h) + rcases Branch.target_symbols_differ hne ht with hn | hn + · exact hn hw + · exact hn hl + have hd := Branch.same_target_displacement ht + have hgap := (targetBox_gap (symbolLabel M b.left) (symbolLabel M b.write) + (symbolLabel M c.left) (symbolLabel M c.write) (headMoveOfInt b.displacement) hpair).scaled + (bandScale_pos M) (stateOffset M b.target) + have hp : 0 < (bandScale M : ℝ) * (1 / (radixBase M : ℝ) ^ 2) := by + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hB : (0 : ℝ) < radixBase M := by exact_mod_cast lt_trans (by norm_num) (radixBase_gt_one M) + positivity + simpa only [geometricInstruction, branchInstruction, scaledInstruction, radixInstruction, + radixBase, radixDigit, ht, hd] using hgap.positiveSeparated hp + · exact stateBox_separation M ht (geometricInstruction_target_unit M hM b) + (geometricInstruction_target_unit M hM c) + +/-- Transfer a separation relation through a duplicate-free finite map. -/ +theorem indexed_map_separation {A B : Type*} (l : List A) (F : A → B) + (hl : l.Nodup) (P : B → B → Prop) + (hP : ∀ a b, a ≠ b → P (F a) (F b)) + (i j : Fin (l.map F).length) (hij : i ≠ j) : P ((l.map F)[i]) ((l.map F)[j]) := by + let i' : Fin l.length := ⟨i.val, by simpa only [List.length_map] using i.isLt⟩ + let j' : Fin l.length := ⟨j.val, by simpa only [List.length_map] using j.isLt⟩ + have hne : l.get i' ≠ l.get j' := by + intro he + have heq := hl.get_inj_iff.mp he + have hv : i.val = j.val := congrArg (fun k : Fin l.length => k.val) heq + exact hij (Fin.ext hv) + have hp := hP (l.get i') (l.get j') hne + simpa only [List.get_eq_getElem, Fin.getElem_fin, List.getElem_map, i', j'] using hp + +theorem compiledInput_source_separation (M : Alternating.Machine) (hM : M.WellFormed) + (i j : Fin (compiledInput M hM).instructions.length) (hij : i ≠ j) : + PositivelySeparated ((compiledInput M hM).instructions[i].source.carrier) + ((compiledInput M hM).instructions[j].source.carrier) := by + apply indexed_map_separation (geometricBranches M hM) (geometricInstruction M hM) + (List.nodup_dedup _) (fun b c => PositivelySeparated b.source.carrier c.source.carrier) + (fun _ _ hn => geometricInstruction_source_separation M hM hn) i j hij + +theorem compiledInput_target_separation (M : Alternating.Machine) (hM : M.WellFormed) + (i j : Fin (compiledInput M hM).instructions.length) (hij : i ≠ j) : + PositivelySeparated ((compiledInput M hM).instructions[i].target.carrier) + ((compiledInput M hM).instructions[j].target.carrier) := by + apply indexed_map_separation (geometricBranches M hM) (geometricInstruction M hM) + (List.nodup_dedup _) (fun b c => PositivelySeparated b.target.carrier c.target.carrier) + (fun _ _ hn => geometricInstruction_target_separation M hM hn) i j hij + +/-- The finite machine compiler supplies every hypothesis of the full-rectangle +solenoidal-shear realization theorem. -/ +theorem compiledInput_valid (M : Alternating.Machine) (hM : M.WellFormed) : + ValidInput (compiledInput M hM) := by + obtain ⟨hp, hc, hcl, hh, hn, hz₀, hz₁⟩ := compiledInput_basic M hM + refine ⟨hp, hc, hcl, hh, hn, compiledInput_chartMargin M hM, ⟨hz₀, hz₁⟩, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + exact geometricInstruction_source_positive M hM c + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + exact geometricInstruction_target_positive M hM c + · intro b hb x hx + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + obtain ⟨h₀, h₁, h₂, h₃⟩ := geometricInstruction_source_bounds M hM c hx + intro j + fin_cases j <;> norm_num [compiledInput, Input.inPlanarChart] <;> constructor <;> linarith + · intro b hb x hx + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + obtain ⟨h₀, h₁, h₂, h₃⟩ := geometricInstruction_target_bounds M hM c hx + intro j + fin_cases j <;> norm_num [compiledInput, Input.inPlanarChart] <;> constructor <;> linarith + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + exact geometricInstruction_factor_pos M hM c + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + exact geometricInstruction_image M hM c + · exact compiledInput_source_separation M hM + · exact compiledInput_target_separation M hM + · intro b hb j + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + simpa only [compiledInput, Rat.cast_div, Rat.cast_ofNat] using + geometricInstruction_halfWidths M hM c j + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + have hx := geometricInstruction_source_bounds M hM c + (center_mem (geometricInstruction_source_positive M hM c)) + intro j + fin_cases j + · simpa [compiledInput] using And.intro hx.1 hx.2.1 + · simpa [compiledInput] using And.intro hx.2.2.1 hx.2.2.2 + · intro b hb + obtain ⟨c, _, rfl⟩ := List.mem_map.mp hb + have hx := geometricInstruction_target_bounds M hM c + (center_mem (geometricInstruction_target_positive M hM c)) + intro j + fin_cases j + · simpa [compiledInput] using And.intro hx.1 hx.2.1 + · simpa [compiledInput] using And.intro hx.2.2.1 hx.2.2.2 + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteLabels.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..c18cd8b50fe3780738fe6883ae0bc6430006321b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteLabels.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteRecorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.GappedSeparation + +namespace OAI + +/-! Computable state and symbol labels obtained by indexing explicit finite lists. -/ + +namespace ForcedComputation.Recorder + +def controlEnumeration (M : Alternating.Machine) : List (Control (State M) (Alphabet M)) := + (allControls M).dedup + +def symbolEnumeration (M : Alternating.Machine) : List (Symbol (State M) (Alphabet M)) := + (allSymbols M).dedup + +def controlLabel (M : Alternating.Machine) : + Control (State M) (Alphabet M) ≃ Fin (controlEnumeration M).length := + (List.Nodup.getEquivOfForallMemList (controlEnumeration M) (List.nodup_dedup _) + (fun q => by simpa [controlEnumeration] using mem_allControls M q)).symm + +def symbolLabel (M : Alternating.Machine) : + Symbol (State M) (Alphabet M) ≃ Fin (symbolEnumeration M).length := + (List.Nodup.getEquivOfForallMemList (symbolEnumeration M) (List.nodup_dedup _) + (fun a => by simpa [symbolEnumeration] using mem_allSymbols M a)).symm + +def radixBase (M : Alternating.Machine) : ℚ := + Radix.rationalBase (symbolEnumeration M).length + +def radixDigit (M : Alternating.Machine) (a : Symbol (State M) (Alphabet M)) : ℚ := + Radix.rationalDigit (symbolLabel M a) + +theorem radixBase_gt_one (M : Alternating.Machine) : (1 : ℚ) < radixBase M := by + dsimp [radixBase, Radix.rationalBase] + have hn : (0 : ℚ) ≤ (symbolEnumeration M).length := by positivity + linarith + +theorem radixDigit_bounds (M : Alternating.Machine) (a : Symbol (State M) (Alphabet M)) : + 0 ≤ (radixDigit M a : ℝ) ∧ (radixDigit M a : ℝ) + 1 ≤ (radixBase M : ℝ) := + Radix.rationalDigit_bounds (symbolLabel M a) + +theorem radixDigit_gap (M : Alternating.Machine) {a b : Symbol (State M) (Alphabet M)} + (hab : a ≠ b) : 2 ≤ |(radixDigit M a : ℝ) - (radixDigit M b : ℝ)| := + Radix.rationalDigit_gap (fun h => hab ((symbolLabel M).injective h)) + +def bandScale (M : Alternating.Machine) : ℚ := + 1 / (64 * ((controlEnumeration M).length + 1)) + +def centerY (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : ℚ := + 3 / 8 + ((controlLabel M q).val + 1) / (16 * ((controlEnumeration M).length + 1)) + +def recorderHalting (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : Bool := + Control.casesOn q (fun q => M.isHalting q.val) + (fun _ => false) (fun _ => false) (fun _ => false) (fun _ => false) + +def stateOffset (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : Fin 2 → ℚ := + ![(if recorderHalting M q then 3 / 4 else 1 / 4) - bandScale M / 2, + centerY M q - bandScale M / 2] + +theorem bandScale_pos (M : Alternating.Machine) : 0 < bandScale M := by + dsimp [bandScale] + positivity + +theorem bandScale_le (M : Alternating.Machine) : bandScale M ≤ 1 / 64 := by + dsimp [bandScale] + apply (div_le_div_iff₀ (by positivity) (by norm_num)).mpr + have hn : (0 : ℚ) ≤ (controlEnumeration M).length := by positivity + nlinarith + +theorem centerY_bounds (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : + 3 / 8 < centerY M q ∧ centerY M q < 7 / 16 := by + have hi : ((controlLabel M q).val : ℚ) < (controlEnumeration M).length := by + exact_mod_cast (controlLabel M q).isLt + have hi0 : (0 : ℚ) ≤ (controlLabel M q).val := by positivity + have hd : (0 : ℚ) < 16 * ((controlEnumeration M).length + 1) := by positivity + dsimp [centerY] + constructor + · have hp : 0 < (((controlLabel M q).val : ℚ) + 1) / + (16 * ((controlEnumeration M).length + 1)) := div_pos (by linarith) hd + linarith + · have hp : (((controlLabel M q).val : ℚ) + 1) / + (16 * ((controlEnumeration M).length + 1)) < 1 / 16 := by + apply (div_lt_div_iff₀ hd (by norm_num)).mpr + nlinarith + linarith + +theorem centerY_gap (M : Alternating.Machine) + {q r : Control (State M) (Alphabet M)} (hqr : q ≠ r) : + 4 * (bandScale M : ℝ) ≤ |(centerY M q : ℝ) - (centerY M r : ℝ)| := by + have hne : (controlLabel M q).val ≠ (controlLabel M r).val := by + intro h + exact hqr ((controlLabel M).injective (Fin.ext h)) + have hg : (1 : ℝ) ≤ |((controlLabel M q).val : ℝ) - (controlLabel M r).val| := by + rcases lt_or_gt_of_ne hne with h | h + · have hh : ((controlLabel M q).val : ℝ) + 1 ≤ (controlLabel M r).val := by + exact_mod_cast (Nat.succ_le_iff.mpr h) + rw [abs_of_nonpos (by linarith)] + linarith + · have hh : ((controlLabel M r).val : ℝ) + 1 ≤ (controlLabel M q).val := by + exact_mod_cast (Nat.succ_le_iff.mpr h) + rw [abs_of_nonneg (by linarith)] + linarith + have hd : (0 : ℝ) < 16 * ((controlEnumeration M).length + 1) := by positivity + have he : (centerY M q : ℝ) - (centerY M r : ℝ) = + (((controlLabel M q).val : ℝ) - (controlLabel M r).val) / + (16 * ((controlEnumeration M).length + 1)) := by + simp only [centerY, Rat.cast_add, Rat.cast_div, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_ofNat] + ring + rw [he, abs_div, abs_of_pos hd] + apply (le_div_iff₀ hd).mpr + have hs : 4 * (bandScale M : ℝ) * (16 * ((controlEnumeration M).length + 1)) = 1 := by + simp only [bandScale, Rat.cast_div, Rat.cast_mul, Rat.cast_add, Rat.cast_natCast, + Rat.cast_one, Rat.cast_ofNat] + field_simp + ring + simpa only [hs] using hg + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteMachineHaltingDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteMachineHaltingDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..851a8766e5adc6e908d591c5119297072db0f364 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteMachineHaltingDischarge.lean @@ -0,0 +1,25 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FixedInterpreter +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MachineDecisionInput + +namespace OAI + +/-! Discharge of the finite-table undecidability input, using the fixed +universal interpreter and Mathlib's proved halting theorem. -/ + +namespace ForcedComputation + +theorem finiteMachineHaltingUndecidable : FiniteMachineHaltingUndecidable := by + rintro ⟨d, hd, hcorrect⟩ + obtain ⟨M, input, hi, hM⟩ := FiniteMachine.exists_fixed_universal_machine + apply ComputablePred.halting_problem 0 + apply ComputablePred.computable_iff.mpr + refine ⟨fun c : Nat.Partrec.Code => d (M, input (Encodable.encode c)), + hd.comp ((Computable.const M).pair (hi.comp Computable.encode)), ?_⟩ + funext c + apply propext + have h := (hcorrect (M, input (Encodable.encode c)) (hM _).1).trans (hM _).2 + simpa only [Denumerable.ofNat_encode] using h.symm + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FinitePhaseEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FinitePhaseEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1933069a0e411b1a5524ca7fbc91929134b4358d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FinitePhaseEvaluation.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedVelocityEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicBounds + +namespace OAI + +/-! Finite recursive evaluation of the Euler derivative polynomials that +occur in the logarithmic slowdown. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def IsFastVectorName (a : ℕ → RationalVector) (v : Space) : Prop := + ∀ n, ‖v - rationalVector (a n)‖ ≤ errorTolerance n + +theorem initializedVelocityTolerance_pos (n : ℕ) : + 0 < (2 : ℚ) ^ (-(n : ℤ)) := by positivity + +def initializedVelocityName (loader body : Input) + (hl : ValidInput loader) (hb : ValidInput body) (α : List (Fin 4)) + (b : ℕ → RationalSpaceTime) : ℕ → RationalVector := fun n => + evaluateInitializedVelocity loader body hl hb α b ((2 : ℚ) ^ (-(n : ℤ))) (initializedVelocityTolerance_pos n) + +theorem initializedVelocityName_spec {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) (α : List (Fin 4)) + {b : ℕ → RationalSpaceTime} {y : SpaceTime} (hy : IsFastName b y) : + IsFastVectorName (initializedVelocityName loader body hl hb α b) + (mixedDerivative (initializedProgram loader body) α y) := by + intro n + have h := evaluateInitializedVelocity_spec hl hb α hy + ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + simpa [initializedVelocityName, errorTolerance] using h + +def subtractNatName (c : ℕ) (a b : ℕ → RationalVector) : ℕ → RationalVector := + fun n => a (n + c + 1) - (c : ℚ) • b (n + c + 1) + +theorem subtractNatName_spec {a b : ℕ → RationalVector} {x y : Space} + (ha : IsFastVectorName a x) (hb : IsFastVectorName b y) (c : ℕ) : + IsFastVectorName (subtractNatName c a b) (x - (c : ℝ) • y) := by + intro n + have hcast (m : ℕ) : rationalVector (a m - (c : ℚ) • b m) = + rationalVector (a m) - (c : ℝ) • rationalVector (b m) := by + ext j + simp only [rationalVector, Pi.sub_apply, Pi.smul_apply, smul_eq_mul, + Rat.cast_sub, Rat.cast_mul, Rat.cast_natCast] + have hsize : (1 + (c : ℝ)) ≤ (2 : ℝ) ^ (c + 1) := by + have h := Nat.lt_two_pow_self (n := c + 1) + rw [add_comm 1] + exact_mod_cast h.le + have ht : (1 + (c : ℝ)) * errorTolerance (n + c + 1) ≤ errorTolerance n := by + calc + _ ≤ (2 : ℝ) ^ (c + 1) * errorTolerance (n + c + 1) := + mul_le_mul_of_nonneg_right hsize (by dsimp [errorTolerance]; positivity) + _ = errorTolerance n := by + simp only [errorTolerance, show n + c + 1 = n + (c + 1) by omega, + pow_add, mul_inv_rev] + field_simp + rw [subtractNatName, hcast] + have he : x - (c : ℝ) • y - (rationalVector (a (n + c + 1)) - + (c : ℝ) • rationalVector (b (n + c + 1))) = + (x - rationalVector (a (n + c + 1))) - + (c : ℝ) • (y - rationalVector (b (n + c + 1))) := by module + rw [he] + calc + _ ≤ ‖x - rationalVector (a (n + c + 1))‖ + + ‖(c : ℝ) • (y - rationalVector (b (n + c + 1)))‖ := norm_sub_le _ _ + _ ≤ errorTolerance (n + c + 1) + (c : ℝ) * errorTolerance (n + c + 1) := by + rw [norm_smul, Real.norm_of_nonneg (Nat.cast_nonneg c)] + exact add_le_add (ha _) (mul_le_mul_of_nonneg_left (hb _) (Nat.cast_nonneg c)) + _ = (1 + (c : ℝ)) * errorTolerance (n + c + 1) := by ring + _ ≤ _ := ht + +def phaseName (r : ℕ) (a : ℕ → ℕ → RationalVector) : ℕ → ℕ → ℕ → RationalVector + | 0, k => a k + | n + 1, k => subtractNatName (r + n) (phaseName r a n (k + 1)) (phaseName r a n k) + +theorem phaseName_spec (r : ℕ) {A : ℝ → Space} (hA : ContDiff ℝ ∞ A) (s : ℝ) + {a : ℕ → ℕ → RationalVector} + (ha : ∀ k, IsFastVectorName (a k) (iteratedDeriv k A s)) (n k : ℕ) : + IsFastVectorName (phaseName r a n k) (iteratedDeriv k (phaseIter r A n) s) := by + induction n generalizing k with + | zero => exact ha k + | succ n ih => + rw [show phaseIter r A (n + 1) = + phaseDerivative (r + n) (phaseIter r A n) from rfl, + iteratedDeriv_phaseDerivative (r + n) k (phaseIter_smooth r hA n)] + exact subtractNatName_spec (ih (k + 1)) (ih k) (r + n) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteRecorder.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteRecorder.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd8e128bc7144541e99bc30f3136ffb72e90edcf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteRecorder.lean @@ -0,0 +1,235 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderMachine + +namespace OAI + +/-! A genuinely finite recorder alphabet and control set for a well-formed +machine. The extra state is the normalized missing-instruction halt state. -/ + +namespace ForcedComputation.Recorder + +open History Control + +abbrev State (M : Alternating.Machine) := Fin (M.stateCount + 1) +abbrev Alphabet (M : Alternating.Machine) := Fin M.symbolCount + +def finiteMachine (M : Alternating.Machine) (hM : M.WellFormed) : + Machine (State M) (Alphabet M) where + halting := fun q => M.isHalting q.val + next := fun q a => ⟨(M.normalizedInstruction q.val a.val).1, + Nat.lt_succ_of_le (M.normalizedInstruction_bounds hM (Nat.le_of_lt_succ q.isLt) a.isLt).1⟩ + write := fun q a => ⟨(M.normalizedInstruction q.val a.val).2.1, + (M.normalizedInstruction_bounds hM (Nat.le_of_lt_succ q.isLt) a.isLt).2⟩ + move := fun q a => ((M.normalizedInstruction q.val a.val).2.2.val : ℤ) - 1 + move_bound := by + intro q a + have h := (M.normalizedInstruction q.val a.val).2.2.isLt + constructor <;> omega + +def forgetWork {M : Alternating.Machine} (C : WorkConfiguration (State M) (Alphabet M)) : + WorkConfiguration ℕ ℕ := + ⟨C.state.val, C.head, fun j => (C.tape j).val⟩ + +theorem forgetWork_next (M : Alternating.Machine) (hM : M.WellFormed) + (C : WorkConfiguration (State M) (Alphabet M)) : + forgetWork (workNext (finiteMachine M hM) C) = workNext (ofMachine M) (forgetWork C) := by + cases C with + | mk q h t => + simp only [forgetWork, workNext, finiteMachine, ofMachine] + congr 1 + funext j + by_cases hj : j = h <;> simp [hj] + +def initialState (M : Alternating.Machine) : State M := ⟨0, by simp⟩ + +def initialAlphabet (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ℤ → Alphabet I.1 := + fun j => ⟨(Alternating.initialConfiguration I.2).tape j, + (Alternating.initialConfiguration_valid hI).2 j⟩ + +theorem finite_workAt (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) (n : ℕ) : + forgetWork (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n) = + originalConfiguration (Alternating.configurationAt I n) := by + induction n with + | zero => rfl + | succ n ih => + rw [workAt_succ, forgetWork_next, Alternating.configurationAt_succ, + originalConfiguration_step, ih] + +def finiteInitializedRecorder (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Configuration (State I.1) (Alphabet I.1) := + checkpointAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) 2 0 + +theorem finite_recorder_halts_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + (∃ m C q, Steps (finiteMachine I.1 hI.1) m (finiteInitializedRecorder I hI) C ∧ + C.control = Control.checkpoint q ∧ I.1.isHalting q.val = true) ↔ Alternating.Halts I := by + change (∃ m C q, Steps (finiteMachine I.1 hI.1) m + (checkpointAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) 2 0) C ∧ + C.control = Control.checkpoint q ∧ (finiteMachine I.1 hI.1).halting q = true) ↔ _ + rw [halting_checkpoint_iff _ _ _ 2 (by norm_num)] + have hs (n : ℕ) := congrArg WorkConfiguration.state (finite_workAt I hI n) + simp only [forgetWork, originalConfiguration] at hs + change (∃ n, I.1.isHalting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state.val = true) ↔ _ + simp only [hs, Alternating.Halts] + +def allControls (M : Alternating.Machine) : List (Control (State M) (Alphabet M)) := + let states := List.finRange (M.stateCount + 1) + let letters := List.finRange M.symbolCount + states.map checkpoint ++ + states.flatMap (fun q => letters.flatMap fun a => [mark (q, a), scanRight (q, a)]) ++ + states.map advance ++ states.map scanLeft + +def allHistories (M : Alternating.Machine) : List (History (State M) (Alphabet M)) := + [empty, frontier] ++ (List.finRange (M.stateCount + 1)).flatMap + fun q => (List.finRange M.symbolCount).map fun a => History.record (q, a) + +def allSymbols (M : Alternating.Machine) : List (Symbol (State M) (Alphabet M)) := + (List.finRange M.symbolCount).flatMap fun a => + (allHistories M).flatMap fun l => [false, true].map fun b => (a, l, b) + +theorem mem_allControls (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : + q ∈ allControls M := by + cases q with + | checkpoint q => simp [allControls] + | mark r => rcases r with ⟨q, a⟩; simp [allControls] + | scanRight r => rcases r with ⟨q, a⟩; simp [allControls] + | advance q => simp [allControls] + | scanLeft q => simp [allControls] + +theorem mem_allHistories (M : Alternating.Machine) (l : History (State M) (Alphabet M)) : + l ∈ allHistories M := by + cases l with + | empty => simp [allHistories] + | frontier => simp [allHistories] + | record r => rcases r with ⟨q, a⟩; simp [allHistories] + +theorem mem_allSymbols (M : Alternating.Machine) (s : Symbol (State M) (Alphabet M)) : + s ∈ allSymbols M := by + rcases s with ⟨a, l, b⟩ + apply List.mem_flatMap.mpr + refine ⟨a, by simp, List.mem_flatMap.mpr ?_⟩ + refine ⟨l, mem_allHistories M l, List.mem_map.mpr ?_⟩ + exact ⟨b, by cases b <;> simp, rfl⟩ + +/-- Enumerate all control/read-symbol pairs by finite loops and execute the +seven-row local interpreter. This is the finite table used by the geometry. -/ +def instructionTable (M : Alternating.Machine) (hM : M.WellFormed) : + List ((Control (State M) (Alphabet M) × Symbol (State M) (Alphabet M)) × + (Control (State M) (Alphabet M) × Symbol (State M) (Alphabet M) × ℤ)) := + ((allControls M).flatMap fun q => (allSymbols M).map fun s => (q, s)).filterMap + fun p => (evalLocal (finiteMachine M hM) p.1 p.2).map fun out => (p, out) + +theorem evalLocal_sound {Q A : Type*} [DecidableEq Q] [DecidableEq A] + {M : Machine Q A} {q q' : Control Q A} {s s' : Symbol Q A} {d : ℤ} + (he : evalLocal M q s = some (q', s', d)) : LocalStep M q s q' s' d := by + rcases s with ⟨a, l, b⟩ + cases q with + | checkpoint q => + cases b with + | true => simp [evalLocal] at he + | false => + simp only [evalLocal] at he + split at he + · rename_i hguard + obtain ⟨hq, hl⟩ := hguard + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.work q a l hq hl + · simp at he + | mark r => + cases b with + | true => simp [evalLocal] at he + | false => + simp only [evalLocal] at he + split at he + · rename_i hl + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.setMark r a l hl + · simp at he + | scanRight r => + cases b with + | true => simp [evalLocal] at he + | false => + simp only [evalLocal] at he + split at he + · rename_i hl + subst l + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.record r a + · rename_i hl + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.right r a l hl + | advance q => + cases b with + | true => cases l <;> simp [evalLocal] at he + | false => + cases l with + | empty => + simp only [evalLocal] at he + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.advance q a + | frontier => simp [evalLocal] at he + | record r => simp [evalLocal] at he + | scanLeft q => + simp only [evalLocal] at he + split at he + · rename_i hl + cases b with + | false => + simp only [Bool.false_eq_true, ite_false] at he + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.left q a l hl + | true => + simp only [ite_true] at he + have hh := Option.some.inj he + simp only [Prod.mk.injEq] at hh + rcases hh with ⟨hq', hs', hd'⟩ + subst_vars + exact LocalStep.clearMark q a l hl + · simp at he + +theorem localStep_mem_instructionTable (M : Alternating.Machine) (hM : M.WellFormed) + {q q' : Control (State M) (Alphabet M)} {s s' : Symbol (State M) (Alphabet M)} {d : ℤ} + (h : LocalStep (finiteMachine M hM) q s q' s' d) : + ((q, s), (q', s', d)) ∈ instructionTable M hM := by + apply List.mem_filterMap.mpr + refine ⟨(q, s), List.mem_flatMap.mpr ?_, ?_⟩ + · exact ⟨q, mem_allControls M q, List.mem_map.mpr ⟨s, mem_allSymbols M s, rfl⟩⟩ + · simp only [h.eval, Option.map_some] + +theorem mem_instructionTable_iff (M : Alternating.Machine) (hM : M.WellFormed) + {q q' : Control (State M) (Alphabet M)} {s s' : Symbol (State M) (Alphabet M)} {d : ℤ} : + ((q, s), (q', s', d)) ∈ instructionTable M hM ↔ + LocalStep (finiteMachine M hM) q s q' s' d := by + constructor + · intro h + obtain ⟨p, _, hp⟩ := List.mem_filterMap.mp h + cases he : evalLocal (finiteMachine M hM) p.1 p.2 with + | none => simp [he] at hp + | some output => + simp only [he, Option.map_some, Option.some.injEq, Prod.mk.injEq] at hp + obtain ⟨rfl, rfl⟩ := hp + exact evalLocal_sound he + · exact localStep_mem_instructionTable M hM + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackArithmetic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce8b48e4a191c3ca6904b270a7da8988c4110978 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackArithmetic.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LatticeStacks + +namespace OAI + +/-! Faithfulness of finite little-endian integer stacks, including their +infinite zero tails. This is used for the entire finite recorder table. -/ + +namespace ForcedComputation.Lattice + +theorem stackValue_injective_prefix {b d : ℕ} (hb : 0 < b) + {a c : ℕ → ℕ} (ha : ∀ i < d, a i < b) (hc : ∀ i < d, c i < b) + (he : stackValue b d a = stackValue b d c) : ∀ i < d, a i = c i := by + induction d generalizing a c with + | zero => intro i hi; omega + | succ d ih => + have hhead : a 0 = c 0 := by + have h := congrArg (fun n => n % b) he + simpa only [stackValue_head (ha 0 (by omega)), stackValue_head (hc 0 (by omega))] using h + have htail : stackValue b d (fun i => a (i + 1)) = + stackValue b d (fun i => c (i + 1)) := by + have h := congrArg (fun n => n / b) he + simpa only [stackValue_tail hb (ha 0 (by omega)), + stackValue_tail hb (hc 0 (by omega))] using h + intro i hi + cases i with + | zero => exact hhead + | succ i => + exact ih (fun j hj => ha (j + 1) (by omega)) + (fun j hj => hc (j + 1) (by omega)) htail i (by omega) + +theorem stackValue_injective_zero_tail {b d : ℕ} (hb : 0 < b) + {a c : ℕ → ℕ} (ha : ∀ i, a i < b) (hc : ∀ i, c i < b) + (ha0 : ∀ i, d ≤ i → a i = 0) (hc0 : ∀ i, d ≤ i → c i = 0) + (he : stackValue b d a = stackValue b d c) : a = c := by + funext i + by_cases hi : i < d + · exact stackValue_injective_prefix hb (fun j _ => ha j) (fun j _ => hc j) he i hi + · rw [ha0 i (by omega), hc0 i (by omega)] + +theorem prepend_injective {b a c L R : ℕ} (hb : 0 < b) (ha : a < b) (hc : c < b) + (he : a + b * L = c + b * R) : a = c ∧ L = R := by + have hm := congrArg (fun n => n % b) he + have hd := congrArg (fun n => n / b) he + constructor + · simpa only [Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt ha, + Nat.mod_eq_of_lt hc] using hm + · simpa only [Nat.add_mul_div_left _ _ hb, Nat.div_eq_of_lt ha, + Nat.div_eq_of_lt hc, Nat.zero_add] using hd + +theorem nat_eq_of_mod_div_eq {b L R : ℕ} (hm : L % b = R % b) (hd : L / b = R / b) : + L = R := by + calc + L = L % b + b * (L / b) := (Nat.mod_add_div L b).symm + _ = R % b + b * (R / b) := by rw [hm, hd] + _ = R := Nat.mod_add_div R b + +/-- The written digit and both old stack tails are recoverable from the +new stacks, once the incoming movement is known. -/ +theorem nextStacks_recover {b L₁ L₂ R₁ R₂ a₁ a₂ : ℕ} + (hb : 0 < b) (ha₁ : a₁ < b) (ha₂ : a₂ < b) (m : Fin 3) + (hL : nextLeft b L₁ a₁ m = nextLeft b L₂ a₂ m) + (hR : nextRight b L₁ R₁ a₁ m = nextRight b L₂ R₂ a₂ m) : + L₁ = L₂ ∧ R₁ / b = R₂ / b ∧ a₁ = a₂ := by + fin_cases m + · simp only [nextLeft, nextRight] at hL hR + obtain ⟨hm, ht⟩ := prepend_injective hb (Nat.mod_lt _ hb) (Nat.mod_lt _ hb) hR + obtain ⟨ha, hq⟩ := prepend_injective hb ha₁ ha₂ ht + exact ⟨nat_eq_of_mod_div_eq hm hL, hq, ha⟩ + · simp only [nextLeft, nextRight] at hL hR + obtain ⟨ha, hq⟩ := prepend_injective hb ha₁ ha₂ hR + exact ⟨hL, hq, ha⟩ + · simp only [nextLeft, nextRight] at hL hR + obtain ⟨ha, hq⟩ := prepend_injective hb ha₁ ha₂ hL + exact ⟨hq, hR, ha⟩ + +theorem nextStacks_injective_of_read {b L₁ L₂ R₁ R₂ a₁ a₂ : ℕ} + (hb : 0 < b) (ha₁ : a₁ < b) (ha₂ : a₂ < b) (m : Fin 3) + (hL : nextLeft b L₁ a₁ m = nextLeft b L₂ a₂ m) + (hR : nextRight b L₁ R₁ a₁ m = nextRight b L₂ R₂ a₂ m) + (hread : R₁ % b = R₂ % b) : L₁ = L₂ ∧ R₁ = R₂ ∧ a₁ = a₂ := by + obtain ⟨hl, hr, ha⟩ := nextStacks_recover hb ha₁ ha₂ m hL hR + exact ⟨hl, nat_eq_of_mod_div_eq hread hr, ha⟩ + +end ForcedComputation.Lattice + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackUpdates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackUpdates.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab872022a26c0714d3a1ae38d44434d9e2a2e57e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteStackUpdates.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteStackArithmetic +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ConfigurationTapes + +namespace OAI + +/-! Exact integer stack formulas for each recorder head move. A single +additional digit accommodates a step; a popped infinite blank tail stays zero. -/ + +namespace ForcedComputation.Lattice + +def StackTailZero (d : ℕ) (a : ℕ → ℕ) : Prop := ∀ i, d ≤ i → a i = 0 + +theorem stackValue_pop_padding {b k : ℕ} (hb : 0 < b) {a : ℕ → ℕ} + (ha : a 0 < b) (hz : StackTailZero (k + 1) a) (e : ℕ) : + stackValue b (k + e) (fun i => a (i + 1)) = stackValue b (k + 1) a / b := by + rw [stackValue_tail hb ha] + apply stackValue_extend + intro i hi + exact hz (i + 1) (by omega) + +def integerTapeCode (b d : ℕ) (T : Radix.Tape ℕ) : ℕ × ℕ := + (stackValue b d T.1, stackValue b d T.2) + +theorem integerTapeCode_right {b k : ℕ} (hb : 0 < b) (s : ℕ) (T : Radix.Tape ℕ) + (hR : T.2 0 < b) (hR0 : StackTailZero (k + 1) T.2) : + integerTapeCode b (k + 2) (Radix.writeRight s T) = + (s + b * (integerTapeCode b (k + 1) T).1, + (integerTapeCode b (k + 1) T).2 / b) := by + apply Prod.ext + · rfl + · exact stackValue_pop_padding hb hR hR0 2 + +theorem integerTapeCode_stay {b k : ℕ} (hb : 0 < b) (s : ℕ) (T : Radix.Tape ℕ) + (hL0 : StackTailZero (k + 1) T.1) + (hR : T.2 0 < b) (hR0 : StackTailZero (k + 1) T.2) : + integerTapeCode b (k + 2) (Radix.writeStay s T) = + ((integerTapeCode b (k + 1) T).1, + s + b * ((integerTapeCode b (k + 1) T).2 / b)) := by + apply Prod.ext + · exact stackValue_extend b (k + 1) 1 T.1 hL0 + · change s + b * stackValue b (k + 1) (fun i => T.2 (i + 1)) = _ + rw [stackValue_pop_padding hb hR hR0 1] + rfl + +theorem integerTapeCode_left {b k : ℕ} (hb : 0 < b) (s : ℕ) (T : Radix.Tape ℕ) + (hL : T.1 0 < b) (hL0 : StackTailZero (k + 1) T.1) (hR : T.2 0 < b) : + integerTapeCode b (k + 2) (Radix.writeLeft s T) = + ((integerTapeCode b (k + 1) T).1 / b, + (integerTapeCode b (k + 1) T).1 % b + + b * (s + b * ((integerTapeCode b (k + 1) T).2 / b))) := by + apply Prod.ext + · exact stackValue_pop_padding hb hL hL0 2 + · change T.1 0 + b * (s + b * stackValue b k (fun i => T.2 (i + 1))) = _ + simp only [integerTapeCode, stackValue_head hL, stackValue_tail hb hR] + +theorem integerTapeCode_move {b d : ℕ} (hb : 0 < b) (hd : 0 < d) + (s : ℕ) (T : Radix.Tape ℕ) (hL : T.1 0 < b) (hR : T.2 0 < b) + (hL0 : StackTailZero d T.1) (hR0 : StackTailZero d T.2) (m : Fin 3) : + integerTapeCode b (d + 1) + (if m = 0 then Radix.writeLeft s T else + if m = 1 then Radix.writeStay s T else Radix.writeRight s T) = + (nextLeft b (integerTapeCode b d T).1 s m, + nextRight b (integerTapeCode b d T).1 (integerTapeCode b d T).2 s m) := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hd) + fin_cases m + · simpa [nextLeft, nextRight, Nat.succ_eq_add_one] using + integerTapeCode_left hb s T hL hL0 hR + · simpa [nextLeft, nextRight, Nat.succ_eq_add_one] using + integerTapeCode_stay hb s T hL0 hR hR0 + · simpa [nextLeft, nextRight, Nat.succ_eq_add_one] using + integerTapeCode_right hb s T hR hR0 + +end ForcedComputation.Lattice + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteTimeUniqueness.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteTimeUniqueness.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ff4579c2e762162b50050c7ed850fad78ccd7d7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FiniteTimeUniqueness.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ClassicalUniqueness + +namespace OAI + +/-! The energy uniqueness argument only needs a derivative bound on each +finite interval. This covers the increasing-speed torus detector. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +theorem finite_interval_classical_velocity_unique {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {f u v : Velocity} {p : Pressure} + (hu : IsClassicalSolution L ν f u p) (hv : IsClassicalSolution L ν f v (fun _ => 0)) + (hb : ∀ T, 0 ≤ T → ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x, + ‖fderiv ℝ (fun y => v (t,y)) x‖ ≤ B) : + ∀ t, 0 ≤ t → ∀ x, u (t,x) = v (t,x) := by + let W : Velocity := fun y => u y - v y + let G : Velocity := fun y => initialTimeDerivative u y.1 y.2 - initialTimeDerivative v y.1 y.2 + let E : ℝ → ℝ := fun t => ∫ x in fundamentalCube L, dot (W (t,x)) (W (t,x)) + have hWs (t : ℝ) (ht : 0 ≤ t) : ContDiff ℝ 2 (fun x => W (t,x)) := + (hu.regularity.spatial_u t ht).sub (hv.regularity.spatial_u t ht) + have hWp (t : ℝ) (ht : 0 ≤ t) : CubePeriodic L (fun x => W (t,x)) := by + intro x n + dsimp [W] + rw [hu.periodic_u t ht, hv.periodic_u t ht] + have hWc (T : ℝ) (hT : 0 ≤ T) : ContinuousOn W (timeCylinder T) := + (hu.regularity.continuous_u T hT).sub (hv.regularity.continuous_u T hT) + have hGc (T : ℝ) (hT : 0 ≤ T) : ContinuousOn G (timeCylinder T) := + (hu.regularity.continuous_ut T hT).sub (hv.regularity.continuous_ut T hT) + have hGd (t : ℝ) (ht : 0 < t) (x : Space) : HasDerivAt (fun s => W (s,x)) (G (t,x)) t := + ((hu.regularity.temporal_u t ht.le x).hasDerivWithinAt.hasDerivAt (Ici_mem_nhds ht)).sub + ((hv.regularity.temporal_u t ht.le x).hasDerivWithinAt.hasDerivAt (Ici_mem_nhds ht)) + have hE0 : E 0 = 0 := by simp [E,W,hu.initial,hv.initial] + have hEpos (t : ℝ) : 0 ≤ E t := integral_nonneg (fun _ => dot_self_nonneg _) + have hEc (T : ℝ) (hT : 0 ≤ T) : ContinuousOn E (Icc 0 T) := + continuousOn_cube_integral (dot_continuousOn (hWc T hT) (hWc T hT)) + have hEd (T : ℝ) (hT : 0 ≤ T) (t : ℝ) (ht : t ∈ Ioo 0 T) : + HasDerivAt E (2 * ∫ x in fundamentalCube L, dot (W (t,x)) (G (t,x))) t := by + have hh := hasDerivAt_cube_integral (L := L) + (dot_continuousOn (hWc T hT) (hWc T hT)) + (continuousOn_const.mul (dot_continuousOn (hWc T hT) (hGc T hT))) + (fun s hs x => hasDerivAt_dot_self (hGd s hs.1 x)) ht + simpa only [Pi.mul_apply, integral_const_mul] using hh + intro T hT x + obtain ⟨B, hB⟩ := hb T hT + have hineq (t : ℝ) (htT : t ∈ Icc 0 T) : + (∫ x in fundamentalCube L, dot (W (t,x)) (G (t,x))) ≤ 3 * B * E t := by + have ht : 0 ≤ t := htT.1 + + apply integrated_comparison_inequality hL.le hν (hWs t ht) + ((hu.regularity.spatial_u t ht).of_le (by norm_num)) + ((hv.regularity.spatial_u t ht).of_le (by norm_num)) + (hu.regularity.spatial_p t ht) (hWp t ht) (hu.periodic_u t ht) (hu.periodic_p t ht) + · intro x + rw [divergence_sub ((hu.regularity.spatial_u t ht).differentiable (by norm_num)) + ((hv.regularity.spatial_u t ht).differentiable (by norm_num)), + hu.divergence_zero t ht, hv.divergence_zero t ht, sub_self] + · exact hu.divergence_zero t ht + · exact hB t htT + · intro x + dsimp only [G, W] + rw [← initialTimeDerivative_sub (hu.regularity.temporal_u t ht x) + (hv.regularity.temporal_u t ht x)] + exact classical_difference_equation hu hv ht x + have hEt : E T = 0 := by + apply zero_of_energy_inequality (C := 6 * B) hT (hEc T hT) hE0 (fun s _ => hEpos s) + intro s hs + refine ⟨_, hEd T hT s hs, ?_⟩ + have hh := hineq s ⟨hs.1.le, hs.2.le⟩ + nlinarith + exact sub_eq_zero.mp (periodic_field_zero_of_energy_zero hL (hWs T hT).continuous + (hWp T hT) hEt x) + +private theorem compact_scalar_bound {L T : ℝ} {g : SpaceTime → ℝ} + (hg : ContinuousOn g (Icc 0 T ×ˢ fundamentalCube L)) : + ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x ∈ fundamentalCube L, g (t, x) ≤ B := by + have hk : IsCompact (Icc (0 : ℝ) T ×ˢ fundamentalCube L) := + isCompact_Icc.prod isCompact_Icc + obtain ⟨B, hB⟩ := hk.bddAbove_image hg + refine ⟨B, ?_⟩ + intro t ht x hx + exact hB ⟨(t, x), ⟨ht, hx⟩, rfl⟩ + +theorem classical_compact_derivative_bound {L ν : ℝ} + {f v : Velocity} {p : Pressure} (hv : IsClassicalSolution L ν f v p) + (T : ℝ) (hT : 0 ≤ T) : + ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x ∈ fundamentalCube L, + ‖fderiv ℝ (fun y => v (t,y)) x‖ ≤ B := by + let D : SpaceTime → Space →L[ℝ] Space := fun y => fderiv ℝ (fun x => v (y.1, x)) y.2 + have hc : ContinuousOn D (Icc 0 T ×ˢ fundamentalCube L) := + (hv.regularity.continuous_du T hT).mono (fun _ hy => ⟨hy.1, mem_univ _⟩) + exact compact_scalar_bound (g := fun y => ‖D y‖) hc.norm + +theorem classical_spatial_derivative_periodic {L ν : ℝ} + {f v : Velocity} {p : Pressure} (hv : IsClassicalSolution L ν f v p) + {t : ℝ} (ht : 0 ≤ t) : CubePeriodic L (fderiv ℝ (fun x => v (t, x))) := by + have hd : Differentiable ℝ (fun x => v (t, x)) := + (hv.regularity.spatial_u t ht).differentiable (by norm_num) + exact CubePeriodic.fderiv (hv.periodic_u t ht) hd + +theorem classical_finite_derivative_bound {L ν : ℝ} (hL : 0 < L) + {f v : Velocity} {p : Pressure} (hv : IsClassicalSolution L ν f v p) + (T : ℝ) (hT : 0 ≤ T) : + ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x, ‖fderiv ℝ (fun y => v (t,y)) x‖ ≤ B := by + obtain ⟨B, hB⟩ := classical_compact_derivative_bound hv T hT + refine ⟨B, ?_⟩ + intro t ht x + obtain ⟨y, hy, n, rfl⟩ := fundamentalCube_representative hL x + rw [classical_spatial_derivative_periodic hv ht.1 y n] + exact hB t ht y hy + +theorem finite_time_classical_unique {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {f v : Velocity} (hv : IsClassicalSolution L ν f v (fun _ => 0)) : + ∀ u p, IsClassicalSolution L ν f u p → + ∀ t, 0 ≤ t → ∀ x, u (t,x) = v (t,x) ∧ p (t,x) = 0 := by + intro u p hu + have he := finite_interval_classical_velocity_unique hL hν hu hv + (classical_finite_derivative_bound hL hv) + have hp := classical_pressure_unique hL hu hv he + exact fun t ht x => ⟨he t ht x, hp t ht x⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedInterpreter.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedInterpreter.lean new file mode 100644 index 0000000000000000000000000000000000000000..af092e3560c25f614eda7cd61a10fd2d31f7a6de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedInterpreter.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0FiniteCoding +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TuringInputEncoding +import Mathlib.Computability.Halting + +namespace OAI + +/-! One fixed finite interpreter and a computable input encoding. Arbitrary +partial-recursive programs enter as input data, not as varying machine tables. -/ + +namespace ForcedComputation.FiniteMachine + +open Turing Alternating + +theorem exists_universal_list_code : + ∃ c : ToPartrec.Code, ∀ n : ℕ, + (c.eval [n]).Dom ↔ ((Denumerable.ofNat Nat.Partrec.Code n).eval 0).Dom := by + have hf : Partrec (fun n : ℕ => (Denumerable.ofNat Nat.Partrec.Code n).eval 0) := + Nat.Partrec.Code.eval_part.comp (Computable.ofNat _) (Computable.const 0) + obtain ⟨c, hc⟩ := ToPartrec.Code.exists_code (Nat.Partrec'.part_iff₁.mpr hf) + refine ⟨c, fun n => ?_⟩ + have h := congrArg Part.Dom (hc ⟨[n], rfl⟩) + exact iff_of_eq h + +theorem fixed_list_TM0 (c : ToPartrec.Code) : + ∃ g q : ℕ, ∃ M : TM0.Machine (Fin (g + 1)) (Fin (q + 1)), + ∃ input : List ℕ → List (Fin (g + 1)), + Computable input ∧ ∀ v, (TM0.eval M (input v)).Dom ↔ (c.eval v).Dom := by + classical + let : Inhabited PartrecToTM2.Λ' := + ⟨PartrecToTM2.trNormal c PartrecToTM2.Cont'.halt⟩ + let : Fintype PartrecToTM2.K' := + ⟨{.main, .rev, .aux, .stack}, by intro k; cases k <;> simp⟩ + let Γ : Type := TM2to1.Γ' PartrecToTM2.K' (fun _ => PartrecToTM2.Γ') + let m₁ := TM2to1.tr PartrecToTM2.tr + let m₀ := TM1to0.tr m₁ + let S₁ := TM2to1.trSupp PartrecToTM2.tr + (PartrecToTM2.codeSupp c PartrecToTM2.Cont'.halt) + have hs₁ : TM1.Supports m₁ S₁ := + TM2to1.tr_supports _ (PartrecToTM2.tr_supports c PartrecToTM2.Cont'.halt) + have hs₀ := TM1to0.tr_supports m₁ hs₁ + obtain ⟨g, q, N, e, he, hN⟩ := finite_supported_TM0 m₀ + (TM1to0.trStmts m₁ S₁) hs₀ + let : Primcodable PartrecToTM2.Γ' := + Primcodable.ofEquiv (Fin (Fintype.card PartrecToTM2.Γ')) + (Fintype.equivFin PartrecToTM2.Γ') + let : Primcodable Γ := Primcodable.ofEquiv (Fin (g + 1)) e + let input : List ℕ → List (Fin (g + 1)) := fun v => + (TM2to1.trInit PartrecToTM2.K'.main (PartrecToTM2.trList v)).map e + have hin : Computable input := by + apply Primrec.to_comp + exact Primrec.list_map + ((trInit_primrec PartrecToTM2.K'.main).comp trList_primrec) + ((Primrec.dom_finite (fun a : Γ => e a)).comp Primrec.snd).to₂ + refine ⟨g, q, N, input, hin, fun v => ?_⟩ + change (TM0.eval N ((TM2to1.trInit PartrecToTM2.K'.main + (PartrecToTM2.trList v)).map e)).Dom ↔ _ + apply (hN _).trans + rw [TM1to0.tr_eval] + apply (TM2to1.tr_eval_dom (M := PartrecToTM2.tr) + PartrecToTM2.K'.main (PartrecToTM2.trList v)).trans + have hi : (TM2.init PartrecToTM2.K'.main (PartrecToTM2.trList v) : + TM2.Cfg (fun _ : PartrecToTM2.K' => PartrecToTM2.Γ') + PartrecToTM2.Λ' (Option PartrecToTM2.Γ')) = PartrecToTM2.init c v := by + unfold TM2.init PartrecToTM2.init + congr 1 + funext k + cases k <;> rfl + change (StateTransition.eval (TM2.step PartrecToTM2.tr) + (TM2.init PartrecToTM2.K'.main (PartrecToTM2.trList v))).Dom ↔ _ + rw [hi, PartrecToTM2.tr_eval] + rfl + +theorem exists_fixed_universal_TM0 : + ∃ g q : ℕ, ∃ M : TM0.Machine (Fin (g + 1)) (Fin (q + 1)), + ∃ input : ℕ → List (Fin (g + 1)), + Computable input ∧ ∀ n, (TM0.eval M (input n)).Dom ↔ + ((Denumerable.ofNat Nat.Partrec.Code n).eval 0).Dom := by + obtain ⟨c, hc⟩ := exists_universal_list_code + obtain ⟨g, q, M, input, hi, hM⟩ := fixed_list_TM0 c + refine ⟨g, q, M, fun n => input [n], hi.comp ?_, fun n => (hM [n]).trans (hc n)⟩ + exact Computable.list_cons.comp Computable.id (Computable.const []) + +theorem exists_fixed_universal_machine : + ∃ M : Machine, ∃ input : ℕ → List ℕ, + Computable input ∧ ∀ n, + ValidInput (M, input n) ∧ + (Halts (M, input n) ↔ ((Denumerable.ofNat Nat.Partrec.Code n).eval 0).Dom) := by + obtain ⟨g, q, M, input, hi, hM⟩ := exists_fixed_universal_TM0 + have hv : Computable (fun w : List (Fin (g + 1)) => w.map Fin.val) := + (Primrec.list_map Primrec.id + ((Primrec.dom_finite Fin.val).comp Primrec.snd).to₂).to_comp + refine ⟨compileTM0 M, fun n => (input n).map Fin.val, + hv.comp hi, fun n => ⟨compileTM0Input_valid M (input n), ?_⟩⟩ + exact (compileTM0_halts_iff M (input n)).trans (hM n) + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleAnalytic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleAnalytic.lean new file mode 100644 index 0000000000000000000000000000000000000000..208335e9c1e3bf6ac78b632e1baf3d8d1fc95c30 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleAnalytic.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LoadedMachine +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowBundle + +namespace OAI + +/-! Analytic properties and the fixed-particle observation for the +square-integrable forcing construction. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Recorder Set +open scoped ContDiff NNReal + +def fixedParticleVelocity (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Velocity := + slowFromRest (loadedMachineVelocity fixedStart 0 I hI) + +theorem fixed_particle_analytic_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + SlowFluidProperties 1 ν (fixedParticleVelocity I hI) ∧ + ∃ Ψ : ℝ → Space → Space, IsMaterialFlow 1 (fixedParticleVelocity I hI) Ψ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t ![1 / 8, 3 / 8, 0] 0 ∧ Ψ t ![1 / 8, 3 / 8, 0] 0 < 1) := by + let loader := shiftedLoader fixedStart (initialPointQ I hI) 0 + let body := recorderInputAtHeight I.1 hI.1 0 + let V := loadedMachineVelocity fixedStart 0 I hI + have hl : ValidInput loader := shiftedLoader_valid _ _ _ + (by intro j; fin_cases j <;> norm_num [fixedStart]) (initialPointQ_bounds I hI) + have hb : ValidInput body := recorderInputAtHeight_valid _ _ _ + have hp : loader.period = body.period := rfl + have hbodyPeriod : (body.period : ℝ) = 1 := recorderInputAtHeight_period _ _ _ + have hprops := slow_initialized_bundle hl hb hp ν hν.le + rw [hbodyPeriod] at hprops + refine ⟨hprops, ?_⟩ + obtain ⟨_, Φ, hΦ, hobs⟩ := loadedMachine_computation fixedStart 0 + (by intro j; fin_cases j <;> norm_num [fixedStart]) (by norm_num [fixedStart]) I hI ν hν + simp only [Rat.cast_zero] at hobs + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hl hb + have hs : ContDiff ℝ ∞ V := initializedProgram_smooth hl hb + have hper : SpatiallyPeriodic 1 V := by + change SpatiallyPeriodic 1 (initializedProgram loader body) + simpa only [hbodyPeriod] using initializedProgram_periodic hp + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + obtain ⟨B, hB, hbound⟩ := initializedProgram_bounded hl hb hp [] + obtain ⟨Ψ, hΨ⟩ := slowFromRest_materialFlow hs hper hz hK hB hbound + refine ⟨Ψ, hΨ, ?_⟩ + have he := slowFromRest_reaches_iff (fun x => hz 0 (by norm_num) x) hΦ hΨ hK + (atHeight (fun j => (fixedStart j : ℝ)) 0) {x : Space | 1 / 2 < x 0 ∧ x 0 < 1} + simp only [Reaches, mem_ofPred_eq] at he + have hevent := hobs.trans he.symm + simpa only [Reaches, mem_ofPred_eq, fixedStart, atHeight, + Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_div, Rat.cast_one, + Rat.cast_ofNat, Rat.cast_zero] using hevent + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..46bd38c32f5b910a2223bd991b654ad5aa45caee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FixedParticleMain.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FixedParticleAnalytic +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowEffective +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowTail + +namespace OAI + +/-! Full main theorem of A Fixed Particle Test for Computation in a Forced +Viscous Flow, including the terminating evaluator and machine-only tail. -/ + +namespace ForcedComputation +open ShearFlows Recorder + +def fixedParticleProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Input × Input := + (shiftedLoader fixedStart (initialPointQ I hI) 0, recorderInputAtHeight I.1 hI.1 0) + +theorem fixedParticleLoader_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (fixedParticleProgram I hI).1 := + shiftedLoader_valid _ _ _ (by intro j; fin_cases j <;> norm_num [fixedStart]) + (initialPointQ_bounds I hI) + +theorem fixedParticleBody_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (fixedParticleProgram I hI).2 := + recorderInputAtHeight_valid I.1 (Alternating.ValidInput.machine_wellFormed hI) 0 + +noncomputable def fixedParticleForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := force ν (fixedParticleVelocity I hI) + +theorem fixed_particle_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + SlowFluidProperties 1 ν (fixedParticleVelocity I hI) ∧ + (∀ t x, Real.exp 1 - 1 ≤ t → + fixedParticleVelocity I hI (t, x) = + slowVelocity (recorderInputAtHeight I.1 hI.1 0).realizingVelocity (t, x) ∧ + fixedParticleForce ν I hI (t, x) = + force ν (slowVelocity (recorderInputAtHeight I.1 hI.1 0).realizingVelocity) (t, x)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (y : SpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (fixedParticleForce ν I hI) α y - + rationalVector (evaluateSlowForce (fixedParticleProgram I hI).1 + (fixedParticleProgram I hI).2 (fixedParticleLoader_valid I hI) + (fixedParticleBody_valid I hI) α a ha b hb ε hε)‖ ≤ (ε : ℝ)) ∧ + ∃ Ψ : ℝ → Space → Space, IsMaterialFlow 1 (fixedParticleVelocity I hI) Ψ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t ![1 / 8, 3 / 8, 0] 0 ∧ Ψ t ![1 / 8, 3 / 8, 0] 0 < 1) := by + obtain ⟨hp, he⟩ := fixed_particle_analytic_computation I hI ν hν + refine ⟨hp, ?_, ?_, he⟩ + · intro t x ht + exact slow_initialized_tail _ _ ν ht x + · intro α a b y ha hb ε hε + exact evaluateSlowForce_spec (fixedParticleLoader_valid I hI) + (fixedParticleBody_valid I hI) α a ha b hb ε hε + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceGerm.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceGerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..872471ca35a220a4253384bcf76bf5dc8ccf2a68 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceGerm.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedFluid + +namespace OAI + +/-! The flat-coordinate force depends only on a germ. No smoothness away +from the point is needed for this locality statement. -/ + +noncomputable section +open Filter +open scoped Topology +open ShearFlows + +namespace ForcedComputation + +theorem force_congr_germ {U V : Velocity} {t : ℝ} {x : Space} + (he : U =ᶠ[𝓝 (t, x)] V) (ν : ℝ) : force ν U (t, x) = force ν V (t, x) := by + have ht : (fun s => U (s, x)) =ᶠ[𝓝 t] fun s => V (s, x) := + he.comp_tendsto (continuous_id.prodMk continuous_const).continuousAt + have hx : (fun z => U (t, z)) =ᶠ[𝓝 x] fun z => V (t, z) := + he.comp_tendsto (continuous_const.prodMk continuous_id).continuousAt + have hd (j : Fin 3) : derivative (fun z => U (t, z)) j =ᶠ[𝓝 x] + derivative (fun z => V (t, z)) j := + (hx.fderiv (𝕜 := ℝ)).mono (fun z hz => congrArg (fun A => A (basis j)) hz) + have hl : laplacian (fun z => U (t, z)) x = laplacian (fun z => V (t, z)) x := by + apply Finset.sum_congr rfl + intro j _ + exact congrArg (fun A => A (basis j)) ((hd j).fderiv_eq (𝕜 := ℝ)) + change deriv (fun s => U (s, x)) t - ν • laplacian (fun z => U (t, z)) x = + deriv (fun s => V (s, x)) t - ν • laplacian (fun z => V (t, z)) x + rw [ht.deriv_eq, hl] + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceMean.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc54dc5357d4e7e8bad3a728eef5c69a30cb445a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ForceMean.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.AutonomousStartup + +namespace OAI + +/-! +# The mean of the full startup force + +For a periodic incompressible field, the convective acceleration is the +divergence of its momentum flux, and therefore has zero spatial mean. This is +the additional term needed in the autonomous construction; a shear-only force +identity would not suffice. +-/ + +noncomputable section +open Set MeasureTheory +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +theorem advection_mean_zero {L : ℝ} (hL : 0 ≤ L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : CubePeriodic L W) + (hd : ∀ x, divergence W x = 0) : + (∫ x in fundamentalCube L, advection W x) = 0 := by + have hW₁ : ContDiff ℝ 1 W := hW.of_le (by simp) + have hi : IntegrableOn (advection W) (fundamentalCube L) := + ((hW.continuous_fderiv (by simp)).clm_apply hW.continuous).integrableOn_Icc + ext j + change (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ) + (∫ x in fundamentalCube L, advection W x) = 0 + rw [← (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ).integral_comp_comm hi] + change (∫ x in fundamentalCube L, advection W x j) = 0 + have hcoord : ContDiff ℝ 1 (fun y => W y j) := + (ContinuousLinearMap.proj j : Space →L[ℝ] ℝ).contDiff.comp hW₁ + have he (x : Space) : divergence (fun y => W y j • W y) x = advection W x j := by + rw [divergence_scalar_mul (hcoord.differentiable (by norm_num)) + (hW₁.differentiable (by norm_num)), hd x, mul_zero, zero_add] + exact fderiv_coordinate (hW.differentiable (by simp)) x (W x) j + have hz : (∫ x in fundamentalCube L, divergence (fun y => W y j • W y) x) = 0 := + integral_periodic_divergence hL (hcoord.smul hW₁) + (show CubePeriodic L (fun y => W y j • W y) from fun x n => by dsimp only; rw [hp]) + simpa only [he] using hz + +theorem ramp_force_mean_zero {L : ℝ} (hL : 0 ≤ L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : CubePeriodic L W) + (hd : ∀ x, divergence W x = 0) + (hm : (∫ x in fundamentalCube L, W x) = 0) + {α : ℝ → ℝ} (hα : Differentiable ℝ α) (ν : ℝ) : + HasZeroMean L (residual ν (rampVelocity α W)) := by + have hw : IntegrableOn W (fundamentalCube L) := hW.continuous.integrableOn_Icc + have ha : IntegrableOn (advection W) (fundamentalCube L) := + ((hW.continuous_fderiv (by simp)).clm_apply hW.continuous).integrableOn_Icc + have hl : IntegrableOn (laplacian W) (fundamentalCube L) := + (laplacian_continuous (hW.of_le (by simp))).integrableOn_Icc + have hla : (∫ x in fundamentalCube L, laplacian W x) = 0 := + laplacian_mean_zero hL (hW.comp contDiff_snd) + (show SpatiallyPeriodic L (fun y : SpaceTime => W y.2) from fun _ => hp) 0 + intro t + simp_rw [residual_ramp ν α W (hα t)] + have hsum := integral_add (hw.smul (deriv α t)) (ha.smul (α t ^ 2)) + simp only [Pi.smul_apply, integral_smul, hm, advection_mean_zero hL hW hp hd, + smul_zero, add_zero] at hsum + have hdiff := integral_sub ((hw.smul (deriv α t)).add (ha.smul (α t ^ 2))) + ((hl.smul (α t)).smul ν) + simpa only [Pi.add_apply, Pi.smul_apply, hsum, integral_smul, hla, smul_zero, sub_zero] using hdiff + +theorem startup_force_mean_zero {L : ℝ} (hL : 0 ≤ L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : CubePeriodic L W) + (hd : ∀ x, divergence W x = 0) + (hm : (∫ x in fundamentalCube L, W x) = 0) (ν : ℝ) : + HasZeroMean L (residual ν (rampVelocity startupRamp W)) := + ramp_force_mean_zero hL hW hp hd hm (startupRamp_smooth.differentiable (by simp)) ν + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshBranches.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshBranches.lean new file mode 100644 index 0000000000000000000000000000000000000000..94ba2b1710d92a60002796929bfe8c632a1b2ba5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshBranches.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FreshMachine +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteRecorder + +namespace OAI + +/-! The incoming row of the fresh checkpoint is unreachable. Removing this +row leaves every actual recorder transition intact and frees a loader target. -/ + +namespace ForcedComputation +open Alternating + +theorem freshMachine_normalized_nonzero (M : Alternating.Machine) (q a : ℕ) : + ((freshMachine M).normalizedInstruction q a).1 ≠ 0 := by + unfold Machine.normalizedInstruction + split + · rename_i hhalt + intro hq + change q = 0 at hq + subst q + simp at hhalt + · cases hi : (freshMachine M).instruction q a with + | none => simp [Machine.stateCount, freshMachine] + | some i => exact freshMachine_no_incoming hi + +namespace Recorder +open Control + +def FreshControl {Q A : Type*} (q₀ : Q) (c : Control Q A) : Prop := + c ≠ advance q₀ ∧ c ≠ scanLeft q₀ + +theorem LocalStep.freshControl {Q A : Type*} {M : Machine Q A} {q₀ : Q} + (hn : ∀ q a, M.next q a ≠ q₀) + {q q' : Control Q A} {a a' : Symbol Q A} {d : ℤ} + (h : LocalStep M q a q' a' d) (hq : FreshControl q₀ q) : FreshControl q₀ q' := by + cases h <;> simp_all [FreshControl] + +theorem LocalStep.not_fresh_checkpoint {Q A : Type*} {M : Machine Q A} {q₀ : Q} + {q q' : Control Q A} {a a' : Symbol Q A} {d : ℤ} + (h : LocalStep M q a q' a' d) (hq : FreshControl q₀ q) : q' ≠ checkpoint q₀ := by + cases h <;> simp_all [FreshControl] + +theorem Step.freshControl {Q A : Type*} {M : Machine Q A} {q₀ : Q} + (hn : ∀ q a, M.next q a ≠ q₀) + {C D : Configuration Q A} (h : Step M C D) (hC : FreshControl q₀ C.control) : + FreshControl q₀ D.control := by + obtain ⟨q, a, d, hl, rfl⟩ := h + exact hl.freshControl hn hC + +theorem Steps.freshControl {Q A : Type*} {M : Machine Q A} {q₀ : Q} + (hn : ∀ q a, M.next q a ≠ q₀) + {C D : Configuration Q A} {n : ℕ} (h : Steps M n C D) + (hC : FreshControl q₀ C.control) : FreshControl q₀ D.control := by + induction h with + | zero => exact hC + | next h hs ih => exact hs.freshControl hn (ih hC) + +theorem fresh_finiteMachine_next (M : Alternating.Machine) + (hM : (freshMachine M).WellFormed) (q : State (freshMachine M)) + (a : Alphabet (freshMachine M)) : + (finiteMachine (freshMachine M) hM).next q a ≠ initialState (freshMachine M) := by + intro he + have hv := congrArg Fin.val he + exact freshMachine_normalized_nonzero M q.val a.val hv + +theorem fresh_recorder_never_returns (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {n : ℕ} + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hc : Steps (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) n + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)) C) + (hd : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) : + D.control ≠ checkpoint (initialState (freshMachine I.1)) := by + have hzero : FreshControl (initialState (freshMachine I.1)) + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)).control := by + constructor <;> intro he <;> cases he + have hC := hc.freshControl (fresh_finiteMachine_next I.1 (freshInput_valid hI).1) hzero + obtain ⟨q, a, d, hl, rfl⟩ := hd + exact hl.not_fresh_checkpoint hC + +end Recorder +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshMachine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshMachine.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cb3ab148294b16b08ca307805c8b1f78c85cfa1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/FreshMachine.lean @@ -0,0 +1,160 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Machines + +namespace OAI + +/-! A fresh initial state, with no incoming machine transition. It performs +one stationary step before simulating the supplied machine. This lets a +periodically repeated loader occupy an otherwise unused incoming branch. -/ + +namespace ForcedComputation +open Alternating + +def shiftInstruction (i : Alternating.Instruction) : Alternating.Instruction := + (i.1 + 1, i.2) + +def freshMachine (M : Alternating.Machine) : Alternating.Machine := + letI := Alternating.neZeroThree + (M.1 + 1, M.2.1, M.haltingStates.image Nat.succ, + ((List.range M.symbolCount).map fun a => some (1, a, (1 : Fin 3))) :: + M.table.map (List.map (Option.map shiftInstruction))) + +abbrev freshInput (I : MachineInput) : MachineInput := (freshMachine I.1, I.2) + +@[simp] theorem freshMachine_stateCount (M : Alternating.Machine) : + (freshMachine M).stateCount = M.stateCount + 1 := rfl + +@[simp] theorem freshMachine_symbolCount (M : Alternating.Machine) : + (freshMachine M).symbolCount = M.symbolCount := rfl + +theorem freshMachine_wellFormed {M : Alternating.Machine} (hM : M.WellFormed) : + (freshMachine M).WellFormed := by + refine ⟨?_, ?_, ?_⟩ + · simpa [freshMachine, Machine.table, Machine.stateCount] using congrArg Nat.succ hM.1 + · intro q hq + obtain ⟨r, hr, rfl⟩ := Finset.mem_image.mp hq + exact Nat.succ_lt_succ (hM.2.1 r hr) + · intro row hrow + change row ∈ _ :: _ at hrow + rcases List.mem_cons.mp hrow with rfl | hrow + · refine ⟨by simp, ?_⟩ + intro i hi + obtain ⟨a, ha, he⟩ := List.mem_map.mp hi + have he' := Option.some.inj he + subst i + exact ⟨by change 1 < M.1 + 1 + 1; omega, List.mem_range.mp ha⟩ + · obtain ⟨old, hold, rfl⟩ := List.mem_map.mp hrow + obtain ⟨hlen, hib⟩ := hM.2.2 old hold + refine ⟨by simpa using hlen, ?_⟩ + intro i hi + obtain ⟨oi, hoi, he⟩ := List.mem_map.mp hi + cases oi with + | none => simp at he + | some j => + have he' := Option.some.inj he + subst i + have hj := hib j hoi + exact ⟨Nat.succ_lt_succ hj.1, hj.2⟩ + +theorem freshInput_valid {I : MachineInput} (hI : Alternating.ValidInput I) : + Alternating.ValidInput (freshInput I) := + ⟨freshMachine_wellFormed hI.1, hI.2⟩ + +theorem freshInput_wellFormed {I : MachineInput} (hI : Alternating.ValidInput I) : + (freshMachine I.1).WellFormed := + freshMachine_wellFormed (Alternating.ValidInput.machine_wellFormed hI) + +@[simp] theorem freshMachine_not_halting_zero (M : Alternating.Machine) : + (freshMachine M).isHalting 0 = false := by + simp [Machine.isHalting, freshMachine, Machine.stateCount, Machine.haltingStates] + +@[simp] theorem freshMachine_halting_succ (M : Alternating.Machine) (q : ℕ) : + (freshMachine M).isHalting (q + 1) = M.isHalting q := by + apply Bool.eq_iff_iff.mpr + simp [Machine.isHalting, freshMachine, Machine.stateCount, Machine.haltingStates] + exact (decide_eq_true_iff (p := q = M.1 + 1 ∨ q ∈ M.2.2.1)).symm + +theorem freshMachine_instruction_zero (M : Alternating.Machine) {a : ℕ} + (ha : a < M.symbolCount) : + (freshMachine M).instruction 0 a = some (1, a, (1 : Fin 3)) := by + simp [Machine.instruction, freshMachine, Machine.table, ha] + +theorem freshMachine_instruction_succ (M : Alternating.Machine) (q a : ℕ) : + (freshMachine M).instruction (q + 1) a = + (M.instruction q a).map shiftInstruction := by + simp only [Machine.instruction, freshMachine, Machine.table, List.getElem?_cons_succ, + List.getElem?_map] + cases hr : M.table[q]? with + | none => simp [Machine.table] at hr; simp [hr] + | some row => + simp only [Machine.table] at hr + simp only [hr, Option.map_some, Option.bind_some, List.getElem?_map] + cases row[a]? <;> rfl + +def liftConfiguration (c : Alternating.Configuration) : Alternating.Configuration := + ⟨c.state + 1, c.head, c.tape⟩ + +theorem freshMachine_step_lift (M : Alternating.Machine) (c : Alternating.Configuration) : + (freshMachine M).step (liftConfiguration c) = liftConfiguration (M.step c) := by + simp only [Machine.step, liftConfiguration, freshMachine_halting_succ] + cases hh : M.isHalting c.state with + | true => simp + | false => + simp only [Bool.false_eq_true, ↓reduceIte, freshMachine_instruction_succ] + cases hi : M.instruction c.state (c.tape c.head) with + | none => simp [freshMachine_stateCount] + | some i => rfl + +theorem freshMachine_initial_step {I : MachineInput} (hI : Alternating.ValidInput I) : + (freshMachine I.1).step (initialConfiguration I.2) = + liftConfiguration (initialConfiguration I.2) := by + have ha := (initialConfiguration_valid hI).2 0 + rw [Machine.step] + simp only [show (initialConfiguration I.2).state = 0 from rfl, + show (initialConfiguration I.2).head = 0 from rfl, + freshMachine_not_halting_zero, Bool.false_eq_true, ↓reduceIte] + rw [freshMachine_instruction_zero I.1 ha] + simp [liftConfiguration, initialConfiguration] + +theorem freshInput_configuration {I : MachineInput} (hI : Alternating.ValidInput I) (n : ℕ) : + configurationAt (freshInput I) (n + 1) = liftConfiguration (configurationAt I n) := by + induction n with + | zero => exact freshMachine_initial_step hI + | succ n ih => + rw [configurationAt_succ, ih, configurationAt_succ] + exact freshMachine_step_lift I.1 _ + +theorem freshInput_halts_iff {I : MachineInput} (hI : Alternating.ValidInput I) : + Alternating.Halts (freshInput I) ↔ Alternating.Halts I := by + constructor + · rintro ⟨n, hn⟩ + cases n with + | zero => simp [freshInput, initialConfiguration] at hn + | succ n => + rw [freshInput_configuration hI] at hn + exact ⟨n, by simpa [freshInput, liftConfiguration] using hn⟩ + · rintro ⟨n, hn⟩ + refine ⟨n + 1, ?_⟩ + rw [freshInput_configuration hI] + simpa [freshInput, liftConfiguration] using hn + +theorem freshMachine_no_incoming {M : Alternating.Machine} {q a : ℕ} + {i : Alternating.Instruction} (hi : (freshMachine M).instruction q a = some i) : + i.1 ≠ 0 := by + cases q with + | zero => + unfold Machine.instruction freshMachine Machine.table at hi + simp only [List.getElem?_cons_zero, Option.bind_some, List.getElem?_map] at hi + cases ha : (List.range M.symbolCount)[a]? with + | none => simp [ha] at hi + | some b => + simp only [ha, Option.map_some, Option.join_some, Option.some.injEq] at hi + subst i + norm_num + | succ q => + rw [freshMachine_instruction_succ] at hi + obtain ⟨j, _, rfl⟩ := Option.map_eq_some_iff.mp hi + exact Nat.succ_ne_zero _ + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedInstructions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedInstructions.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cf6908cdea8518da9957446f52e611597a3609b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedInstructions.lean @@ -0,0 +1,144 @@ +import Mathlib + +namespace OAI + +/-! +Closed radix rectangles for Section 4 of *Finite Instructions and Solenoidal +Shear Flows*. These statements concern whole intervals and rectangles, not +merely the subset consisting of encoded tapes. +-/ + +namespace ForcedComputation.Radix + +noncomputable section + +open Set + +def push (B d x : ℝ) : ℝ := (d + x) / B + +def pop (B d x : ℝ) : ℝ := B * x - d + +def cylinder (B d : ℝ) : Set ℝ := Icc (d / B) ((d + 1) / B) + +theorem pop_push {B : ℝ} (hB : B ≠ 0) (d x : ℝ) : + pop B d (push B d x) = x := by + dsimp [pop, push] + field_simp + ring + +theorem push_pop {B : ℝ} (hB : B ≠ 0) (d x : ℝ) : + push B d (pop B d x) = x := by + dsimp [pop, push] + field_simp + ring + +theorem push_mem_cylinder {B : ℝ} (hB : 0 < B) (d : ℝ) {x : ℝ} : + push B d x ∈ cylinder B d ↔ x ∈ Icc (0 : ℝ) 1 := by + simp only [push, cylinder, mem_Icc] + constructor + · rintro ⟨hl, hu⟩ + constructor <;> nlinarith [(div_le_div_iff_of_pos_right hB).mp hl, + (div_le_div_iff_of_pos_right hB).mp hu] + · rintro ⟨hl, hu⟩ + constructor <;> apply (div_le_div_iff_of_pos_right hB).mpr <;> linarith + +theorem pop_mem_unit {B : ℝ} (hB : 0 < B) (d : ℝ) {x : ℝ} : + pop B d x ∈ Icc (0 : ℝ) 1 ↔ x ∈ cylinder B d := by + rw [← push_mem_cylinder hB d, push_pop hB.ne'] + +theorem push_image_unit {B : ℝ} (hB : 0 < B) (d : ℝ) : + push B d '' Icc (0 : ℝ) 1 = cylinder B d := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact (push_mem_cylinder hB d).mpr hy + · intro hx + exact ⟨pop B d x, (pop_mem_unit hB d).mpr hx, push_pop hB.ne' d x⟩ + +theorem pop_image_cylinder {B : ℝ} (hB : 0 < B) (d : ℝ) : + pop B d '' cylinder B d = Icc (0 : ℝ) 1 := by + rw [← push_image_unit hB d, ← image_comp] + simp only [Function.comp_def, pop_push hB.ne', image_id'] + +theorem cylinder_gap {B : ℝ} (hB : 0 < B) {d e : ℝ} (hde : d + 2 ≤ e) + {x y : ℝ} (hx : x ∈ cylinder B d) (hy : y ∈ cylinder B e) : + 1 / B ≤ y - x := by + have hxy : (d + 1) / B ≤ e / B - 1 / B := by + rw [← sub_div] + apply (div_le_div_iff_of_pos_right hB).mpr + linarith + exact (le_sub_iff_add_le).mpr (by linarith [hx.2, hy.1]) + +theorem nested_cylinder_gap {B : ℝ} (hB : 0 < B) (a : ℝ) + {d e : ℝ} (hde : d + 2 ≤ e) {x y : ℝ} + (hx : x ∈ push B a '' cylinder B d) + (hy : y ∈ push B a '' cylinder B e) : 1 / B ^ 2 ≤ y - x := by + obtain ⟨u, hu, rfl⟩ := hx + obtain ⟨v, hv, rfl⟩ := hy + have hgap := cylinder_gap hB hde hu hv + have h := (div_le_div_iff_of_pos_right hB).mpr hgap + dsimp [push] + calc + 1 / B ^ 2 = (1 / B) / B := by ring + _ ≤ (v - u) / B := h + _ = (a + v) / B - (a + u) / B := by ring + +def rectangle (B l a : ℝ) : Set (ℝ × ℝ) := cylinder B l ×ˢ cylinder B a + +def rightMove (B a b : ℝ) (p : ℝ × ℝ) : ℝ × ℝ := + (push B b p.1, pop B a p.2) + +def stayMove (B a b : ℝ) (p : ℝ × ℝ) : ℝ × ℝ := + (p.1, push B b (pop B a p.2)) + +def leftMove (B l a b : ℝ) (p : ℝ × ℝ) : ℝ × ℝ := + (pop B l p.1, push B l (push B b (pop B a p.2))) + +theorem rightMove_image {B : ℝ} (hB : 0 < B) (l a b : ℝ) : + rightMove B a b '' rectangle B l a = + (push B b '' cylinder B l) ×ˢ Icc (0 : ℝ) 1 := by + ext p + constructor + · rintro ⟨q, hq, rfl⟩ + exact ⟨⟨q.1, hq.1, rfl⟩, (pop_mem_unit hB a).mpr hq.2⟩ + · rintro ⟨⟨x, hx, he⟩, hy⟩ + refine ⟨(x, push B a p.2), ⟨hx, (push_mem_cylinder hB a).mpr hy⟩, ?_⟩ + exact Prod.ext he (pop_push hB.ne' a p.2) + +theorem stayMove_image {B : ℝ} (hB : 0 < B) (l a b : ℝ) : + stayMove B a b '' rectangle B l a = cylinder B l ×ˢ cylinder B b := by + ext p + constructor + · rintro ⟨q, hq, rfl⟩ + exact ⟨hq.1, (push_mem_cylinder hB b).mpr ((pop_mem_unit hB a).mpr hq.2)⟩ + · intro hp + refine ⟨(p.1, push B a (pop B b p.2)), + ⟨hp.1, (push_mem_cylinder hB a).mpr ((pop_mem_unit hB b).mpr hp.2)⟩, ?_⟩ + apply Prod.ext + · rfl + · dsimp [stayMove] + rw [pop_push hB.ne', push_pop hB.ne'] + +theorem leftMove_image {B : ℝ} (hB : 0 < B) (l a b : ℝ) : + leftMove B l a b '' rectangle B l a = + Icc (0 : ℝ) 1 ×ˢ (push B l '' cylinder B b) := by + ext p + constructor + · rintro ⟨q, hq, rfl⟩ + exact ⟨(pop_mem_unit hB l).mpr hq.1, + ⟨push B b (pop B a q.2), + (push_mem_cylinder hB b).mpr ((pop_mem_unit hB a).mpr hq.2), rfl⟩⟩ + · rintro ⟨hx, ⟨y, hy, he⟩⟩ + refine ⟨(push B l p.1, push B a (pop B b y)), + ⟨(push_mem_cylinder hB l).mpr hx, + (push_mem_cylinder hB a).mpr ((pop_mem_unit hB b).mpr hy)⟩, ?_⟩ + apply Prod.ext (pop_push hB.ne' l p.1) + dsimp [leftMove] + rw [pop_push hB.ne', push_pop hB.ne'] + exact he + +end + +end ForcedComputation.Radix + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedSeparation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c397dc4bf7bc485bb2af704ba3b1a6d18cbbf19f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/GappedSeparation.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.GappedInstructions + +namespace OAI + +/-! Quantitative gaps for one- and two-symbol filled radix cylinders. -/ + +noncomputable section + +namespace ForcedComputation.Radix + +open Set + +def Separated (δ : ℝ) (S T : Set ℝ) : Prop := + ∀ x ∈ S, ∀ y ∈ T, δ ≤ |x - y| + +theorem Separated.symm {δ : ℝ} {S T : Set ℝ} (h : Separated δ S T) : + Separated δ T S := by + intro x hx y hy + simpa only [abs_sub_comm] using h y hy x hx + +theorem cylinder_separated {B : ℝ} (hB : 0 < B) {a b : ℝ} + (hab : 2 ≤ |a - b|) : Separated (1 / B) (cylinder B a) (cylinder B b) := by + intro x hx y hy + rcases le_total a b with h | h + · have hg : a + 2 ≤ b := by rw [abs_of_nonpos (sub_nonpos.mpr h)] at hab; linarith + calc + 1 / B ≤ y - x := cylinder_gap hB hg hx hy + _ ≤ |y - x| := le_abs_self _ + _ = |x - y| := abs_sub_comm _ _ + · have hg : b + 2 ≤ a := by rw [abs_of_nonneg (sub_nonneg.mpr h)] at hab; linarith + exact (cylinder_gap hB hg hy hx).trans (le_abs_self _) + +theorem cylinder_subset_unit {B d : ℝ} (hB : 0 < B) + (hd : 0 ≤ d ∧ d + 1 ≤ B) : cylinder B d ⊆ Icc (0 : ℝ) 1 := by + intro x hx + refine ⟨(div_nonneg hd.1 hB.le).trans hx.1, hx.2.trans ?_⟩ + exact (div_le_one hB).mpr hd.2 + +theorem nested_subset_cylinder {B a d : ℝ} (hB : 0 < B) + (hd : 0 ≤ d ∧ d + 1 ≤ B) : + push B a '' cylinder B d ⊆ cylinder B a := by + rintro x ⟨y, hy, rfl⟩ + exact (push_mem_cylinder hB a).mpr (cylinder_subset_unit hB hd hy) + +theorem nested_same_separated {B : ℝ} (hB : 0 < B) (a : ℝ) {d e : ℝ} + (hde : 2 ≤ |d - e|) : + Separated (1 / B ^ 2) (push B a '' cylinder B d) (push B a '' cylinder B e) := by + rintro x ⟨u, hu, rfl⟩ y ⟨v, hv, rfl⟩ + have hg := cylinder_separated hB hde u hu v hv + calc + 1 / B ^ 2 = (1 / B) / B := by ring + _ ≤ |u - v| / B := (div_le_div_iff_of_pos_right hB).mpr hg + _ = |push B a u - push B a v| := by + rw [show push B a u - push B a v = (u - v) / B by dsimp [push]; ring, + abs_div, abs_of_pos hB] + +theorem nested_different_separated {B : ℝ} (hB : 1 ≤ B) + {a b d e : ℝ} (hab : 2 ≤ |a - b|) + (hd : 0 ≤ d ∧ d + 1 ≤ B) (he : 0 ≤ e ∧ e + 1 ≤ B) : + Separated (1 / B ^ 2) (push B a '' cylinder B d) (push B b '' cylinder B e) := by + have hp : 0 < B := lt_of_lt_of_le zero_lt_one hB + have hBB : B ≤ B ^ 2 := by nlinarith + have hrecip : 1 / B ^ 2 ≤ 1 / B := one_div_le_one_div_of_le hp hBB + intro x hx y hy + exact hrecip.trans (cylinder_separated hp hab x (nested_subset_cylinder hp hd hx) + y (nested_subset_cylinder hp he hy)) + +def rationalBase (N : ℕ) : ℚ := 2 * N + 2 + +def rationalDigit {N : ℕ} (a : Fin N) : ℚ := 2 * a.val + 1 + +theorem rationalBase_ge_one (N : ℕ) : (1 : ℝ) ≤ (rationalBase N : ℝ) := by + simp only [rationalBase, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, Rat.cast_ofNat] + nlinarith [show (0 : ℝ) ≤ N by positivity] + +theorem rationalDigit_bounds {N : ℕ} (a : Fin N) : + 0 ≤ (rationalDigit a : ℝ) ∧ (rationalDigit a : ℝ) + 1 ≤ (rationalBase N : ℝ) := by + have ha : (a.val : ℝ) < N := by exact_mod_cast a.isLt + simp only [rationalDigit, rationalBase, Rat.cast_add, Rat.cast_mul, + Rat.cast_natCast, Rat.cast_one, Rat.cast_ofNat] + constructor <;> nlinarith [show (0 : ℝ) ≤ a.val by positivity] + +theorem rationalDigit_gap {N : ℕ} {a b : Fin N} (hab : a ≠ b) : + 2 ≤ |(rationalDigit a : ℝ) - (rationalDigit b : ℝ)| := by + have hne : a.val ≠ b.val := fun h => hab (Fin.ext h) + rcases lt_or_gt_of_ne hne with h | h + · have hh : (a.val : ℝ) + 1 ≤ b.val := by exact_mod_cast (Nat.succ_le_iff.mpr h) + rw [abs_of_nonpos] + · simp only [rationalDigit, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_one, Rat.cast_ofNat] + linarith + · simp only [rationalDigit, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_one, Rat.cast_ofNat] + linarith + · have hh : (b.val : ℝ) + 1 ≤ a.val := by exact_mod_cast (Nat.succ_le_iff.mpr h) + rw [abs_of_nonneg] + · simp only [rationalDigit, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_one, Rat.cast_ofNat] + linarith + · simp only [rationalDigit, Rat.cast_add, Rat.cast_mul, Rat.cast_natCast, + Rat.cast_one, Rat.cast_ofNat] + linarith + +/-- Distinct two-symbol words have a gap at least one inverse square base. -/ +theorem twoSymbol_separated {N : ℕ} (a b d e : Fin N) (hne : (a, d) ≠ (b, e)) : + Separated (1 / (rationalBase N : ℝ) ^ 2) + (push (rationalBase N) (rationalDigit a) '' + cylinder (rationalBase N) (rationalDigit d)) + (push (rationalBase N) (rationalDigit b) '' + cylinder (rationalBase N) (rationalDigit e)) := by + by_cases hab : a = b + · subst b + have hde : d ≠ e := by intro h; exact hne (by simp [h]) + exact nested_same_separated (lt_of_lt_of_le zero_lt_one (rationalBase_ge_one N)) _ + (rationalDigit_gap hde) + · exact nested_different_separated (rationalBase_ge_one N) (rationalDigit_gap hab) + (rationalDigit_bounds d) (rationalDigit_bounds e) + +end ForcedComputation.Radix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/HeightShift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/HeightShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c7c0a973a53dae980cc840c6e9a592bce5b9e2b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/HeightShift.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! Moving the coding sheet does not change the finite planar program. This +supplies the different fixed particle heights in the assigned applications. -/ + +namespace ShearFlows + +def Input.shiftHeight (d : Input) (c : ℚ) : Input := + letI := neZeroThree + { d with + chart := ⟨fun j => d.chart.lower j + if j = 2 then c else 0, + fun j => d.chart.upper j + if j = 2 then c else 0⟩ + codingHeight := d.codingHeight + c } + +theorem ValidInput.shiftHeight {d : Input} (hd : ValidInput d) (c : ℚ) : + ValidInput (d.shiftHeight c) := by + refine ⟨hd.period_pos, ?_, ?_, hd.h_pos, hd.centers_nonempty, ?_, ?_, + hd.source_positive, hd.target_positive, ?_, ?_, hd.factor_pos, hd.image_eq, + hd.source_separation, hd.target_separation, hd.halfWidths, + hd.source_centers, hd.target_centers⟩ + · intro j + have hj := hd.chart_positive j + change d.chart.lower j + (if j = 2 then c else 0) < + d.chart.upper j + (if j = 2 then c else 0) + linarith + · intro j + have hj := hd.chart_length j + change (d.chart.upper j + (if j = 2 then c else 0)) - + (d.chart.lower j + (if j = 2 then c else 0)) < d.period + simpa only [add_sub_add_right_eq_sub] using hj + · intro j + fin_cases j + · simpa [Input.shiftHeight] using hd.chartMargin 0 + · simpa [Input.shiftHeight] using hd.chartMargin 1 + · simpa [Input.shiftHeight, Rat.cast_add] using hd.height_inside + · intro b hb x hx j + fin_cases j + · simpa [Input.shiftHeight, Input.inPlanarChart] using hd.source_in_chart b hb hx 0 + · simpa [Input.shiftHeight, Input.inPlanarChart] using hd.source_in_chart b hb hx 1 + · intro b hb x hx j + fin_cases j + · simpa [Input.shiftHeight, Input.inPlanarChart] using hd.target_in_chart b hb hx 0 + · simpa [Input.shiftHeight, Input.inPlanarChart] using hd.target_in_chart b hb hx 1 + +@[simp] theorem Input.shiftHeight_period (d : Input) (c : ℚ) : + (d.shiftHeight c).period = d.period := rfl + +@[simp] theorem Input.shiftHeight_instructions (d : Input) (c : ℚ) : + (d.shiftHeight c).instructions = d.instructions := rfl + +@[simp] theorem Input.shiftHeight_codingHeight (d : Input) (c : ℚ) : + (d.shiftHeight c).codingHeight = d.codingHeight + c := rfl + +end ShearFlows + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedBundle.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedBundle.lean new file mode 100644 index 0000000000000000000000000000000000000000..211f669343c6d54bf825f2d8e385a0df076586bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedBundle.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedEffective + +namespace OAI + +/-! Fluid regularity for a finite loading program followed by a periodic +machine program. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def InitializedFluidProperties (L ν : ℝ) (U : Velocity) : Prop := + letI := ShearFlows.thirtyTwoAtLeastTwo + ContDiff ℝ ∞ U ∧ ContDiff ℝ ∞ (force ν U) ∧ + SpatiallyPeriodic L U ∧ SpatiallyPeriodic L (force ν U) ∧ + Solenoidal U ∧ Solenoidal (force ν U) ∧ + HasZeroMean L U ∧ HasZeroMean L (force ν U) ∧ + BoundedMixedDerivatives U ∧ BoundedMixedDerivatives (force ν U) ∧ + (∀ t x, 1 ≤ t → U (t + 1, x) = U (t, x) ∧ force ν U (t + 1, x) = force ν U (t, x)) ∧ + (∀ k : ℤ, ∀ t : ℝ, |t - (k : ℝ)| < (1 / 32 : ℝ) → ∀ x, + U (t, x) = 0 ∧ force ν U (t, x) = 0) ∧ + (∃ E : ℝ, ∀ t, kineticEnergy L U t ≤ E) ∧ + IsClassicalSolution L ν (force ν U) U (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution L ν (force ν U) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = U (t, x) ∧ p (t, x) = 0) + +theorem initialized_bundle {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) + (hp : loader.period = body.period) (ν : ℝ) (hν : 0 ≤ ν) : + InitializedFluidProperties body.period ν (initializedProgram loader body) := by + have hs := initializedProgram_smooth hl hb + refine ⟨hs, force_smooth hs ν, initializedProgram_periodic hp, + force_spatially_periodic hs (initializedProgram_periodic hp) ν, + initializedProgram_solenoidal hl hb, initializedForce_solenoidal hl hb ν, + initializedProgram_mean_zero hl hb hp, initializedForce_mean_zero hl hb hp ν, + initializedProgram_bounded hl hb hp, initializedForce_bounded hl hb hp ν, + ?_, ?_, initializedProgram_energy_bounded hl hb hp, + initializedProgram_solution hl hb hp ν, initializedProgram_unique hl hb hp hν⟩ + · intro t x ht + exact ⟨initializedProgram_eventually_periodic loader body ht x, + initializedForce_eventually_periodic hl hb ν ht x⟩ + · intro k t ht x + exact ⟨initializedProgram_integer_collars loader body k ht x, + initializedForce_integer_collars hl hb ν k ht x⟩ + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedEffective.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedEffective.lean new file mode 100644 index 0000000000000000000000000000000000000000..e679100ada463294dfb7f18372901bd847e3d775 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedEffective.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedFluid +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! A terminating evaluator for the initialized force and every mixed derivative. +A single coarse time approximation chooses a valid local formula. The overlap +is supplied by the fixed zero collars, including at times zero and one. -/ + +namespace ForcedComputation + +open ShearFlows Set Filter +open scoped Topology ContDiff + +theorem force_germ_of_germ {U V : Velocity} (hU : ContDiff ℝ ∞ U) + (hV : ContDiff ℝ ∞ V) {y : SpaceTime} (he : U =ᶠ[𝓝 y] V) (ν : ℝ) : + force ν U =ᶠ[𝓝 y] force ν V := by + filter_upwards [he.eventuallyEq_nhds] with z hz + exact force_eq_of_eventuallyEq hU hV hz ν + +theorem mixedForce_eq_of_germ {U V : Velocity} (hU : ContDiff ℝ ∞ U) + (hV : ContDiff ℝ ∞ V) {y : SpaceTime} (he : U =ᶠ[𝓝 y] V) + (ν : ℝ) (α : List (Fin 4)) : + mixedDerivative (force ν U) α y = mixedDerivative (force ν V) α y := + (mixedDerivative_eventuallyEq (force_germ_of_germ hU hV he ν) α).self_of_nhds + +/-- The two finite shear expressions are evaluated by their existing certified +algorithms; the extra time test only selects between overlapping exact germs. -/ +def evaluateInitializedForce (loader body : Input) + (hloader : ValidInput loader) (hbody : ValidInput body) + (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : RationalVector := + if (b 6).1 ≤ 0 then 0 + else if (b 6).1 ≤ 1 then + loader.velocityExpr.evaluateForce (velocityExpr_valid hloader) α a b ε hε + else body.velocityExpr.evaluateForce (velocityExpr_valid hbody) α a b ε hε + +theorem evaluateInitializedForce_spec {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (α : List (Fin 4)) {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + {b : ℕ → RationalSpaceTime} {y : SpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (force ν (initializedProgram loader body)) α y - + rationalVector (evaluateInitializedForce loader body hloader hbody α a b ε hε)‖ ≤ + (ε : ℝ) := by + have htime : |y.1 - ((b 6).1 : ℝ)| ≤ (1 / 64 : ℝ) := by + have h := (norm_fst_le (y - rationalPoint (b 6))).trans (hb 6) + norm_num [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, errorTolerance] at h + exact h + have hU := initializedProgram_smooth hloader hbody + unfold evaluateInitializedForce + split + · rename_i hz + have ht : y.1 < (1 / 32 : ℝ) := by + have hz' : ((b 6).1 : ℝ) ≤ 0 := by exact_mod_cast hz + linarith [(abs_le.mp htime).2] + have he : initializedProgram loader body =ᶠ[𝓝 y] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_lt_nhds ht)] with z hz + exact initializedProgram_zero_extend loader body hz z.2 + rw [mixedForce_eq_of_germ hU contDiff_const he ν α] + have hzero : force ν (fun _ : SpaceTime => (0 : Space)) = fun _ => 0 := by + funext z + exact force_zero ν z + rw [hzero, mixedDerivative_zero] + have hεR : (0 : ℝ) < (ε : ℝ) := by exact_mod_cast hε + have hzv : ShearFlows.rationalVector (0 : RationalVector) = 0 := by + ext j + change ((0 : ℚ) : ℝ) = 0 + norm_num + change ‖(0 : Space) - ShearFlows.rationalVector 0‖ ≤ (ε : ℝ) + rw [hzv, sub_self, norm_zero] + exact hεR.le + · rename_i hz + split + · rename_i ho + have hzero : (0 : ℝ) < (b 6).1 := by exact_mod_cast lt_of_not_ge hz + have hone : ((b 6).1 : ℝ) ≤ 1 := by exact_mod_cast ho + have hl : -(1 / 32 : ℝ) < y.1 := by linarith [(abs_le.mp htime).1] + have hr : y.1 < 1 + (1 / 32 : ℝ) := by linarith [(abs_le.mp htime).2] + have he : initializedProgram loader body =ᶠ[𝓝 y] loader.realizingVelocity := by + filter_upwards [(continuous_fst.tendsto y).eventually (Ioo_mem_nhds hl hr)] with z hz + exact initializedProgram_loading_extend loader body hz z.2 + rw [mixedForce_eq_of_germ hU (realizingVelocity_smooth hloader) he ν α, + ← velocityExpr_val hloader] + exact VelocityExpr.evaluateForce_spec (velocityExpr_valid hloader) α ha hb ε hε + · rename_i ho + have hone : (1 : ℝ) < (b 6).1 := by exact_mod_cast lt_of_not_ge ho + have hl : 1 - (1 / 32 : ℝ) < y.1 := by linarith [(abs_le.mp htime).1] + have he : initializedProgram loader body =ᶠ[𝓝 y] body.realizingVelocity := by + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_gt_nhds hl)] with z hz + exact initializedProgram_tail_extend loader body hz z.2 + rw [mixedForce_eq_of_germ hU (realizingVelocity_smooth hbody) he ν α, + ← velocityExpr_val hbody] + exact VelocityExpr.evaluateForce_spec (velocityExpr_valid hbody) α ha hb ε hε + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd416d2ac6a0d1852ce2fa8c20349be7dd01ca4e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedFluid.lean @@ -0,0 +1,306 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedProgram + +namespace OAI + +/-! The loaded program retains the analytic properties of its two shear fields. -/ + +noncomputable section +open Set Filter MeasureTheory +open scoped ContDiff Topology NNReal +open ShearFlows + +namespace ForcedComputation + +theorem force_zero (ν : ℝ) (y : SpaceTime) : + force ν (fun _ : SpaceTime => (0 : Space)) y = 0 := by + rw [force_eq_mixed contDiff_const] + simp [mixedDerivative_zero] + +theorem force_eq_of_eventuallyEq {U V : Velocity} (hU : ContDiff ℝ ∞ U) + (hV : ContDiff ℝ ∞ V) {y : SpaceTime} (he : U =ᶠ[𝓝 y] V) (ν : ℝ) : + force ν U y = force ν V y := by + have hh (α) := (mixedDerivative_eventuallyEq he α).self_of_nhds + simp only [force_eq_mixed hU, force_eq_mixed hV, hh] + +theorem initializedProgram_zero_extend (loader body : Input) {t : ℝ} + (ht : t < 1 / 32) (x : Space) : initializedProgram loader body (t, x) = 0 := by + by_cases hn : t ≤ 0 + · exact initializedProgram_before loader body hn x + · rw [initializedProgram_loading loader body ⟨(lt_of_not_ge hn).le, by linarith⟩] + apply realizingVelocity_vanish_near_integers loader 0 + simpa only [Int.cast_zero, sub_zero, abs_of_pos (lt_of_not_ge hn)] using ht + +theorem initializedProgram_loading_extend (loader body : Input) {t : ℝ} + (ht : -(1 / 32 : ℝ) < t ∧ t < 1 + 1 / 32) (x : Space) : + initializedProgram loader body (t, x) = loader.realizingVelocity (t, x) := by + by_cases hn : t < 0 + · rw [initializedProgram_before loader body hn.le] + symm + apply realizingVelocity_vanish_near_integers loader 0 + simpa only [Int.cast_zero, sub_zero, abs_of_neg hn] using (show -t < 1 / 32 by linarith) + by_cases hp : 1 < t + · rw [initializedProgram_tail loader body hp.le] + have hc : |t - (1 : ℤ)| < (1 / 32 : ℝ) := by + rw [Int.cast_one, abs_of_pos (by linarith : 0 < t - 1)] + linarith + rw [realizingVelocity_vanish_near_integers body 1 hc, + realizingVelocity_vanish_near_integers loader 1 hc] + · exact initializedProgram_loading loader body ⟨le_of_not_gt hn, le_of_not_gt hp⟩ x + +theorem initializedProgram_tail_extend (loader body : Input) {t : ℝ} + (ht : 1 - 1 / 32 < t) (x : Space) : + initializedProgram loader body (t, x) = body.realizingVelocity (t, x) := by + by_cases hp : 1 ≤ t + · exact initializedProgram_tail loader body hp x + · have hc : |t - (1 : ℤ)| < (1 / 32 : ℝ) := by + apply abs_lt.mpr + norm_num only [Int.cast_one] + constructor <;> linarith + rw [initializedProgram_loading loader body ⟨by linarith, (lt_of_not_ge hp).le⟩, + realizingVelocity_vanish_near_integers body 1 hc, + realizingVelocity_vanish_near_integers loader 1 hc] + +theorem initializedProgram_loading_germ (loader body : Input) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) (x : Space) : + initializedProgram loader body =ᶠ[𝓝 (t, x)] loader.realizingVelocity := by + have hl : -(1 / 32 : ℝ) < t := by linarith [ht.1] + have hr : t < 1 + 1 / 32 := by linarith [ht.2] + filter_upwards [(continuous_fst.tendsto (t, x)).eventually + (Ioo_mem_nhds hl hr)] with y hy + exact initializedProgram_loading_extend loader body hy y.2 + +theorem initializedProgram_tail_germ (loader body : Input) {t : ℝ} + (ht : 1 ≤ t) (x : Space) : + initializedProgram loader body =ᶠ[𝓝 (t, x)] body.realizingVelocity := by + have hl : 1 - (1 / 32 : ℝ) < t := by linarith + filter_upwards [(continuous_fst.tendsto (t, x)).eventually + (eventually_gt_nhds hl)] with y hy + exact initializedProgram_tail_extend loader body hy y.2 + +theorem initializedProgram_zero_germ (loader body : Input) {t : ℝ} + (ht : t ≤ 0) (x : Space) : + initializedProgram loader body =ᶠ[𝓝 (t, x)] fun _ => 0 := by + have hr : t < (1 / 32 : ℝ) := by linarith + filter_upwards [(continuous_fst.tendsto (t, x)).eventually + (eventually_lt_nhds hr)] with y hy + exact initializedProgram_zero_extend loader body hy y.2 + +theorem initializedForce_loading {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Space) : + force ν (initializedProgram loader body) (t, x) = force ν loader.realizingVelocity (t, x) := + force_eq_of_eventuallyEq (initializedProgram_smooth hloader hbody) + (realizingVelocity_smooth hloader) (initializedProgram_loading_germ loader body ht x) ν + +theorem initializedForce_tail {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) + {t : ℝ} (ht : 1 ≤ t) (x : Space) : + force ν (initializedProgram loader body) (t, x) = force ν body.realizingVelocity (t, x) := + force_eq_of_eventuallyEq (initializedProgram_smooth hloader hbody) + (realizingVelocity_smooth hbody) (initializedProgram_tail_germ loader body ht x) ν + +theorem initializedForce_before {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) + {t : ℝ} (ht : t ≤ 0) (x : Space) : + force ν (initializedProgram loader body) (t, x) = 0 := by + rw [force_eq_of_eventuallyEq (initializedProgram_smooth hloader hbody) + contDiff_const (initializedProgram_zero_germ loader body ht x) ν] + exact force_zero ν (t, x) + +theorem initializedProgram_eventually_periodic (loader body : Input) + {t : ℝ} (ht : 1 ≤ t) (x : Space) : + initializedProgram loader body (t + 1, x) = initializedProgram loader body (t, x) := by + rw [initializedProgram_tail loader body (by linarith), + initializedProgram_tail loader body ht, realizingVelocity_time_periodic body] + +theorem initializedForce_eventually_periodic {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) + {t : ℝ} (ht : 1 ≤ t) (x : Space) : + force ν (initializedProgram loader body) (t + 1, x) = + force ν (initializedProgram loader body) (t, x) := by + rw [initializedForce_tail hloader hbody ν (by linarith), + initializedForce_tail hloader hbody ν ht] + exact force_time_periodic (realizingVelocity_smooth hbody) + (realizingVelocity_time_periodic body) ν t x + +theorem initializedForce_bounded {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) (ν : ℝ) : + BoundedMixedDerivatives (force ν (initializedProgram loader body)) := + boundedMixed_of_stationary_tail (by exact_mod_cast hbody.period_pos) + (force_smooth (initializedProgram_smooth hloader hbody) ν) + (force_smooth (realizingVelocity_smooth hbody) ν) + (force_spatially_periodic (initializedProgram_smooth hloader hbody) + (initializedProgram_periodic hperiod) ν) + (force_spatially_periodic (realizingVelocity_smooth hbody) + (realizingVelocity_spatially_periodic body) ν) + (force_time_periodic (realizingVelocity_smooth hbody) + (realizingVelocity_time_periodic body) ν) + (fun _ ht x => initializedForce_before hloader hbody ν ht.le x) + (fun _ ht x => initializedForce_tail hloader hbody ν ht.le x) + +theorem initializedForce_mean_zero {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) (ν : ℝ) : + HasZeroMean body.period (force ν (initializedProgram loader body)) := by + intro t + by_cases hn : t ≤ 0 + · simp_rw [initializedForce_before hloader hbody ν hn] + simp + by_cases hp : 1 ≤ t + · simp_rw [initializedForce_tail hloader hbody ν hp] + exact realizingForce_mean_zero hbody ν t + · simp_rw [initializedForce_loading hloader hbody ν + (show t ∈ Icc (0 : ℝ) 1 from ⟨(lt_of_not_ge hn).le, (lt_of_not_ge hp).le⟩)] + rw [← hperiod] + exact realizingForce_mean_zero hloader ν t + +theorem initializedProgram_slice (loader body : Input) (t : ℝ) : + (fun x => initializedProgram loader body (t, x)) = (fun _ => 0) ∨ + (fun x => initializedProgram loader body (t, x)) = (fun x => loader.realizingVelocity (t, x)) ∨ + (fun x => initializedProgram loader body (t, x)) = (fun x => body.realizingVelocity (t, x)) := by + by_cases hn : t ≤ 0 + · exact Or.inl (funext (initializedProgram_before loader body hn)) + by_cases hp : 1 ≤ t + · exact Or.inr (Or.inr (funext (initializedProgram_tail loader body hp))) + · exact Or.inr (Or.inl (funext (initializedProgram_loading loader body + ⟨(lt_of_not_ge hn).le, (lt_of_not_ge hp).le⟩))) + +theorem initializedProgram_integer_collars (loader body : Input) (k : ℤ) + {t : ℝ} (ht : |t - (k : ℝ)| < (1 / 32 : ℝ)) (x : Space) : + initializedProgram loader body (t, x) = 0 := by + rcases initializedProgram_slice loader body t with he | he | he + · exact congrFun he x + · rw [congrFun he x] + exact realizingVelocity_vanish_near_integers loader k ht x + · rw [congrFun he x] + exact realizingVelocity_vanish_near_integers body k ht x + +theorem initializedForce_integer_collars {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) (k : ℤ) + {t : ℝ} (ht : |t - (k : ℝ)| < (1 / 32 : ℝ)) (x : Space) : + force ν (initializedProgram loader body) (t, x) = 0 := by + have he : initializedProgram loader body =ᶠ[𝓝 (t, x)] fun _ => 0 := by + have hopen : IsOpen {y : SpaceTime | |y.1 - (k : ℝ)| < (1 / 32 : ℝ)} := + isOpen_lt (continuous_fst.sub continuous_const).abs continuous_const + filter_upwards [hopen.mem_nhds ht] with y hy + exact initializedProgram_integer_collars loader body k hy y.2 + rw [force_eq_of_eventuallyEq (initializedProgram_smooth hloader hbody) contDiff_const he ν] + exact force_zero ν (t, x) + +theorem initializedProgram_solenoidal {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) : + Solenoidal (initializedProgram loader body) := by + intro t x + rcases initializedProgram_slice loader body t with he | he | he + · rw [he] + simp [divergence, derivative] + · rw [he] + exact (realizingVelocity_divergence_advection hloader).1 t x + · rw [he] + exact (realizingVelocity_divergence_advection hbody).1 t x + +theorem initializedProgram_zero_advection {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) : + ZeroAdvection (initializedProgram loader body) := by + intro t x + rcases initializedProgram_slice loader body t with he | he | he + · rw [he] + simp [advection] + · rw [he] + exact (realizingVelocity_divergence_advection hloader).2 t x + · rw [he] + exact (realizingVelocity_divergence_advection hbody).2 t x + +theorem initializedForce_solenoidal {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) (ν : ℝ) : + Solenoidal (force ν (initializedProgram loader body)) := + force_solenoidal (initializedProgram_smooth hloader hbody) + (initializedProgram_solenoidal hloader hbody) ν + +theorem initializedProgram_mean_zero {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) : + HasZeroMean body.period (initializedProgram loader body) := by + intro t + rcases initializedProgram_slice loader body t with he | he | he + · rw [he]; simp + · rw [he, ← hperiod]; exact realizingVelocity_mean_zero hloader t + · rw [he]; exact realizingVelocity_mean_zero hbody t + +theorem initializedProgram_solution {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) (ν : ℝ) : + IsClassicalSolution body.period ν (force ν (initializedProgram loader body)) + (initializedProgram loader body) (fun _ => 0) := + velocity_solves_forced_NS (initializedProgram_smooth hloader hbody) + (initializedProgram_periodic hperiod) (initializedProgram_solenoidal hloader hbody) + (initializedProgram_zero_advection hloader hbody) + (initializedProgram_before loader body le_rfl) ν + +theorem initializedProgram_spatial_lipschitz {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) : + ∃ K : ℝ≥0, ∀ t, LipschitzWith K (fun x => initializedProgram loader body (t, x)) := by + obtain ⟨KL, hKL⟩ := smooth_periodic_lipschitz (by exact_mod_cast hloader.period_pos) + (realizingVelocity_smooth hloader) (realizingVelocity_spatially_periodic loader) + (realizingVelocity_time_periodic loader) + obtain ⟨KB, hKB⟩ := smooth_periodic_lipschitz (by exact_mod_cast hbody.period_pos) + (realizingVelocity_smooth hbody) (realizingVelocity_spatially_periodic body) + (realizingVelocity_time_periodic body) + refine ⟨max KL KB, fun t => ?_⟩ + rcases initializedProgram_slice loader body t with he | he | he + · rw [he] + exact (LipschitzWith.const (0 : Space)).weaken (zero_le) + · rw [he] + apply (show LipschitzWith KL (fun x => loader.realizingVelocity (t, x)) from ?_).weaken + (le_max_left _ _) + apply LipschitzWith.of_dist_le_mul + intro x y + simpa using hKL.dist_le_mul (t, x) (t, y) + · rw [he] + apply (show LipschitzWith KB (fun x => body.realizingVelocity (t, x)) from ?_).weaken + (le_max_right _ _) + apply LipschitzWith.of_dist_le_mul + intro x y + simpa using hKB.dist_le_mul (t, x) (t, y) + +theorem initializedProgram_materialFlow {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) : + ∃ Φ : ℝ → Space → Space, IsMaterialFlow body.period (initializedProgram loader body) Φ := by + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hloader hbody + obtain ⟨B, hB, hb⟩ := initializedProgram_bounded hloader hbody hperiod [] + exact exists_materialFlow_of_bounded_lipschitz (B := ⟨B, hB⟩) hK + (fun x => (initializedProgram_smooth hloader hbody).continuous.comp + (continuous_id.prodMk continuous_const)) + (fun t x => hb (t, x)) (initializedProgram_periodic hperiod) + +theorem initializedProgram_unique {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) {ν : ℝ} (hν : 0 ≤ ν) : + ∀ u p, IsClassicalSolution body.period ν (force ν (initializedProgram loader body)) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = initializedProgram loader body (t, x) ∧ p (t, x) = 0 := by + have hsol := initializedProgram_solution hloader hbody hperiod ν + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hloader hbody + have hb (t : ℝ) (_ : 0 ≤ t) (x : Space) : + ‖fderiv ℝ (fun y => initializedProgram loader body (t, y)) x‖ ≤ (K : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (hK t) + intro u p hu + have he := classical_velocity_unique (by exact_mod_cast hbody.period_pos) hν hu hsol hb + have hp := classical_pressure_unique (by exact_mod_cast hbody.period_pos) hu hsol he + exact fun t ht x => ⟨he t ht x, hp t ht x⟩ + +theorem initializedProgram_energy_bounded {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) : + ∃ E : ℝ, ∀ t, kineticEnergy body.period (initializedProgram loader body) t ≤ E := by + obtain ⟨B, hB, hb⟩ := initializedProgram_bounded hloader hbody hperiod [] + exact ⟨(1 / 2 : ℝ) * volume.real (fundamentalCube body.period) * (3 * B ^ 2), + fun t => kineticEnergy_bound (initializedProgram_smooth hloader hbody).continuous + body.period hB hb t⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b0f8d30d9017444dd3516bd6a3a89c2a07aa186 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedMain.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedBundle + +namespace OAI + +/-! The initialized-computation main theorem of *Finite Instructions and +Solenoidal Shear Flows*. The machine-only body and input loader are explicit +finite rational data. -/ + +namespace ForcedComputation +open ShearFlows Recorder +open scoped ContDiff + +noncomputable def machineVelocity (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := + initializedProgram (recorderLoader I hI) (compiledInput I.1 hI.1) + +noncomputable def machineForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := force ν (machineVelocity I hI) + +/-- The compiler outputs two finite rational instruction tables. The body +is computed from the machine alone; only the one-period loader uses the input. -/ +def machineProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Input × Input := (recorderLoader I hI, compiledInput I.1 hI.1) + +theorem machineVelocity_tail (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {t : ℝ} (ht : 1 ≤ t) (x : Space) : + machineVelocity I hI (t, x) = (compiledInput I.1 hI.1).realizingVelocity (t, x) := + initializedProgram_tail _ _ ht x + +theorem machineForce_tail (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) {t : ℝ} (ht : 1 ≤ t) (x : Space) : + machineForce ν I hI (t, x) = force ν (compiledInput I.1 hI.1).realizingVelocity (t, x) := + initializedForce_tail (recorderLoader_valid I hI) (compiledInput_valid I.1 hI.1) ν ht x + +theorem initialized_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + InitializedFluidProperties 1 ν (machineVelocity I hI) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (machineVelocity I hI) Φ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t ![1 / 8, 3 / 8, 1 / 2] 0 ∧ Φ t ![1 / 8, 3 / 8, 1 / 2] 0 < 1) := by + let loader := recorderLoader I hI + let body := compiledInput I.1 hI.1 + have hl : ValidInput loader := recorderLoader_valid I hI + have hb : ValidInput body := compiledInput_valid I.1 hI.1 + have hp : loader.period = body.period := rfl + have hp1 : (body.period : ℝ) = 1 := by + change ((1 : ℚ) : ℝ) = 1 + norm_num + have hproperties := initialized_bundle hl hb hp ν hν.le + rw [hp1] at hproperties + refine ⟨hproperties, ?_⟩ + obtain ⟨Φ, hΦ⟩ := initializedProgram_materialFlow hl hb hp + obtain ⟨Ψ, hΨ⟩ := realizingVelocity_materialFlow hb + obtain ⟨Λ, hΛ⟩ := realizingVelocity_materialFlow hl + have hΛ' : IsMaterialFlow 1 loader.realizingVelocity Λ := by + simpa only [loader, recorderLoader, loaderInput, Rat.cast_one] using hΛ + have hbody := recorder_flow_halting_iff I hI 1 (by norm_num) hΨ + rw [← initialPointQ_spec I hI] at hbody + have hq : ¬Alternating.Halts I → (initialPointQ I hI 0 : ℝ) ≤ 1 / 3 := by + intro hno + have hc : recorderHalting I.1 (finiteInitializedRecorder I hI).control = false := by + cases hh : recorderHalting I.1 (finiteInitializedRecorder I hI).control with + | false => rfl + | true => + apply False.elim + apply hno + apply (finite_recorder_halts_iff I hI).mp + exact ⟨0, finiteInitializedRecorder I hI, initialState I.1, Steps.zero _, rfl, hh⟩ + have hB : (1 : ℝ) < radixBase I.1 := by exact_mod_cast radixBase_gt_one I.1 + have hd : ∀ a, (0 : ℝ) ≤ radixDigit I.1 a ∧ + (radixDigit I.1 a : ℝ) ≤ (radixBase I.1 : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds I.1 a).1, by linarith [(radixDigit_bounds I.1 a).2]⟩ + have he := Radix.encode_mem_unit hB hd (tapeAt (finiteInitializedRecorder I hI)).1 + have hκ : (0 : ℝ) < bandScale I.1 := by exact_mod_cast bandScale_pos I.1 + have hκ' : (bandScale I.1 : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le I.1) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + rw [show (initialPointQ I hI 0 : ℝ) = + codedPoint I.1 (finiteInitializedRecorder I hI) 0 from congrFun (initialPointQ_spec I hI) 0, + codedPoint_first, hc] + simp only [Bool.false_eq_true, ite_false] + nlinarith [he.2] + have hevent := initialized_observation_iff hl hb hΦ hΨ hΛ' hbody hq + refine ⟨Φ, ?_, ?_⟩ + · change IsMaterialFlow 1 (initializedProgram loader body) Φ + simpa only [hp1] using hΦ + · simpa only [fixedStart, atHeight, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hevent.symm + +/-- The force is evaluated to every rational accuracy by the explicit finite +loader/body program, with an oracle only for the viscosity and query point. -/ +theorem machineForce_effective (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (α : List (Fin 4)) + {a : ℕ → ℚ} (ha : IsFastRealName a ν) {b : ℕ → RationalSpaceTime} + {y : SpaceTime} (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (machineForce ν I hI) α y - + rationalVector (evaluateInitializedForce (recorderLoader I hI) (compiledInput I.1 hI.1) + (recorderLoader_valid I hI) (compiledInput_valid I.1 hI.1) α a b ε hε)‖ ≤ (ε : ℝ) := + evaluateInitializedForce_spec (recorderLoader_valid I hI) (compiledInput_valid I.1 hI.1) + α ha hb ε hε + +/-- The complete initialized main result, including the explicit evaluator +and the machine-only tail of both velocity and forcing. -/ +theorem initialized_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + InitializedFluidProperties 1 ν (machineVelocity I hI) ∧ + (∀ t x, 1 ≤ t → + machineVelocity I hI (t, x) = (compiledInput I.1 hI.1).realizingVelocity (t, x) ∧ + machineForce ν I hI (t, x) = force ν (compiledInput I.1 hI.1).realizingVelocity (t, x)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastRealName a ν → IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (machineForce ν I hI) α y - + rationalVector (evaluateInitializedForce (recorderLoader I hI) (compiledInput I.1 hI.1) + (recorderLoader_valid I hI) (compiledInput_valid I.1 hI.1) α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (machineVelocity I hI) Φ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t ![1 / 8, 3 / 8, 1 / 2] 0 ∧ Φ t ![1 / 8, 3 / 8, 1 / 2] 0 < 1) := by + obtain ⟨hp, hf⟩ := initialized_computation I hI ν hν + refine ⟨hp, fun t x ht => ⟨machineVelocity_tail I hI ht x, + machineForce_tail I hI ν ht x⟩, ?_, hf⟩ + intro α a b y ha hb ε hε + exact machineForce_effective I hI ν α ha hb ε hε + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b6c0060d8b109e9d7904caed4972e157d68639a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedObservation.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedTrajectories +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RationalLoader + +namespace OAI + +/-! A safe rational loader transfers the periodic body's continuous-time event +criterion to the fixed starting point of the initialized fluid. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set + +def fixedStart : Fin 2 → ℚ := ![1 / 8, 3 / 8] + +theorem initialized_observation_iff {q : Fin 2 → ℚ} {body : Input} + (hl : ValidInput (loaderInput fixedStart q (1 / 2))) (hb : ValidInput body) + {Φ Ψ Λ : ℝ → Space → Space} + (hΦ : IsMaterialFlow body.period + (initializedProgram (loaderInput fixedStart q (1 / 2)) body) Φ) + (hΨ : IsMaterialFlow body.period body.realizingVelocity Ψ) + (hΛ : IsMaterialFlow 1 (loaderInput fixedStart q (1 / 2)).realizingVelocity Λ) + {H : Prop} {upper : ℝ} + (hbody : (∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t (atHeight (fun j => (q j : ℝ)) (1 / 2)) 0 ∧ + Ψ t (atHeight (fun j => (q j : ℝ)) (1 / 2)) 0 < upper) ↔ H) + (hq : ¬H → (q 0 : ℝ) ≤ 1 / 3) : + (∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t (atHeight (fun j => (fixedStart j : ℝ)) (1 / 2)) 0 ∧ + Φ t (atHeight (fun j => (fixedStart j : ℝ)) (1 / 2)) 0 < upper) ↔ H := by + have hΛ' : IsMaterialFlow (loaderInput fixedStart q (1 / 2)).period + (loaderInput fixedStart q (1 / 2)).realizingVelocity Λ := by + simpa only [loaderInput, Rat.cast_one] using hΛ + have hload : Φ 1 (atHeight (fun j => (fixedStart j : ℝ)) (1 / 2)) = + atHeight (fun j => (q j : ℝ)) (1 / 2) := by + rw [initializedFlow_loading hl hb hΦ hΛ' _ (t := 1) (by norm_num)] + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using loaderFlow_endpoint hl hΛ + constructor + · rintro ⟨t, ht, hx, hy⟩ + by_cases hlate : 1 ≤ t + · apply hbody.mp + refine ⟨t - 1, by linarith, ?_⟩ + rw [initializedFlow_tail hl hb hΦ hΨ _ hlate, hload] at hx hy + exact ⟨hx, hy⟩ + · by_contra hn + have hΛbound := loaderFlow_first_le hl hΛ + (a := 1 / 3) (by norm_num [fixedStart]) (hq hn) + (show t ∈ Icc (0 : ℝ) 1 from ⟨ht, (lt_of_not_ge hlate).le⟩) + rw [initializedFlow_loading hl hb hΦ hΛ' _ ⟨ht, (lt_of_not_ge hlate).le⟩] at hx + linarith + · intro h + obtain ⟨t, ht, hx, hy⟩ := hbody.mpr h + refine ⟨t + 1, by linarith, ?_⟩ + rw [initializedFlow_tail hl hb hΦ hΨ _ (by linarith), hload] + simpa only [add_sub_cancel_right] using And.intro hx hy + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6743adfaa494702fff3bf1cd38167566b03a835 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedProgram.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Velocity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBounds + +namespace OAI + +/-! A single loading period followed by the machine's periodic shear program. -/ + +noncomputable section +open Set +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +def hasTimeCollar (c : ℝ) (V : Velocity) : Prop := + ∀ t, |t - c| < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 + +def collarSwitch (c : ℝ) (U V : Velocity) : Velocity := + letI := ShearFlows.oneTwentyEightAtLeastTwo + letI := ShearFlows.twoAtLeastTwo + fun y => + (1 - Real.smoothTransition (128 * (y.1 - c) + 1 / 2)) • U y + + Real.smoothTransition (128 * (y.1 - c) + 1 / 2) • V y + +theorem collarSwitch_smooth (c : ℝ) {U V : Velocity} + (hU : ContDiff ℝ ∞ U) (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (collarSwitch c U V) := by + have hχ : ContDiff ℝ ∞ (fun y : SpaceTime => + Real.smoothTransition (128 * (y.1 - c) + 1 / 2)) := + Real.smoothTransition.contDiff.comp + ((contDiff_const.mul (contDiff_fst.sub contDiff_const)).add contDiff_const) + exact ((contDiff_const.sub hχ).smul hU).add (hχ.smul hV) + +theorem collarSwitch_before {c : ℝ} {U V : Velocity} + (hU : hasTimeCollar c U) (hV : hasTimeCollar c V) + {t : ℝ} (ht : t ≤ c) (x : Space) : collarSwitch c U V (t, x) = U (t, x) := by + by_cases hχ : 128 * (t - c) + 1 / 2 ≤ 0 + · simp only [collarSwitch, Real.smoothTransition.zero_of_nonpos hχ, + sub_zero, one_smul, zero_smul, add_zero] + · have hc : |t - c| < (1 / 32 : ℝ) := by + apply abs_lt.mpr + constructor <;> linarith + simp only [collarSwitch, hU t hc x, hV t hc x, smul_zero, add_zero] + +theorem collarSwitch_after {c : ℝ} {U V : Velocity} + (hU : hasTimeCollar c U) (hV : hasTimeCollar c V) + {t : ℝ} (ht : c ≤ t) (x : Space) : collarSwitch c U V (t, x) = V (t, x) := by + by_cases hχ : 1 ≤ 128 * (t - c) + 1 / 2 + · simp only [collarSwitch, Real.smoothTransition.one_of_one_le hχ, + sub_self, one_smul, zero_smul, zero_add] + · have hc : |t - c| < (1 / 32 : ℝ) := by + apply abs_lt.mpr + constructor <;> linarith + simp only [collarSwitch, hU t hc x, hV t hc x, smul_zero, add_zero] + +theorem collarSwitch_periodic {L c : ℝ} {U V : Velocity} + (hU : SpatiallyPeriodic L U) (hV : SpatiallyPeriodic L V) : + SpatiallyPeriodic L (collarSwitch c U V) := by + intro t x n + simp only [collarSwitch, hU t x n, hV t x n] + +def initializedProgram (loader body : Input) : Velocity := + collarSwitch 1 (collarSwitch 0 (fun _ => 0) loader.realizingVelocity) + body.realizingVelocity + +private theorem loader_collar_zero (loader : Input) : + hasTimeCollar 0 loader.realizingVelocity := by + intro t ht x + exact realizingVelocity_vanish_near_integers loader 0 (by simpa using ht) x + +private theorem loader_started_collar_one (loader : Input) : + hasTimeCollar 1 (collarSwitch 0 (fun _ => 0) loader.realizingVelocity) := by + intro t ht x + have hp : 0 ≤ t := by have h := (abs_lt.mp ht).1; linarith + rw [collarSwitch_after (fun _ _ _ => rfl) (loader_collar_zero loader) hp] + exact realizingVelocity_vanish_near_integers loader 1 (by simpa using ht) x + +private theorem body_collar_one (body : Input) : + hasTimeCollar 1 body.realizingVelocity := by + intro t ht x + exact realizingVelocity_vanish_near_integers body 1 (by simpa using ht) x + +theorem initializedProgram_before (loader body : Input) {t : ℝ} (ht : t ≤ 0) (x : Space) : + initializedProgram loader body (t, x) = 0 := by + rw [initializedProgram, collarSwitch_before (loader_started_collar_one loader) + (body_collar_one body) (by linarith)] + exact collarSwitch_before (fun _ _ _ => rfl) (loader_collar_zero loader) ht x + +theorem initializedProgram_loading (loader body : Input) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) (x : Space) : + initializedProgram loader body (t, x) = loader.realizingVelocity (t, x) := by + rw [initializedProgram, collarSwitch_before (loader_started_collar_one loader) + (body_collar_one body) ht.2] + exact collarSwitch_after (fun _ _ _ => rfl) (loader_collar_zero loader) ht.1 x + +theorem initializedProgram_tail (loader body : Input) {t : ℝ} (ht : 1 ≤ t) (x : Space) : + initializedProgram loader body (t, x) = body.realizingVelocity (t, x) := + collarSwitch_after (loader_started_collar_one loader) (body_collar_one body) ht x + +theorem initializedProgram_smooth {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) : + ContDiff ℝ ∞ (initializedProgram loader body) := + collarSwitch_smooth 1 + (collarSwitch_smooth 0 contDiff_const (realizingVelocity_smooth hloader)) + (realizingVelocity_smooth hbody) + +theorem initializedProgram_periodic {loader body : Input} + (hperiod : loader.period = body.period) : + SpatiallyPeriodic body.period (initializedProgram loader body) := by + apply collarSwitch_periodic + · apply collarSwitch_periodic + · intro _ _ _; rfl + · rw [← hperiod] + exact realizingVelocity_spatially_periodic loader + · exact realizingVelocity_spatially_periodic body + +theorem initializedProgram_bounded {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (hperiod : loader.period = body.period) : + BoundedMixedDerivatives (initializedProgram loader body) := + boundedMixed_of_stationary_tail (by exact_mod_cast hbody.period_pos) + (initializedProgram_smooth hloader hbody) (realizingVelocity_smooth hbody) + (initializedProgram_periodic hperiod) (realizingVelocity_spatially_periodic body) + (realizingVelocity_time_periodic body) + (fun _ ht x => initializedProgram_before loader body ht.le x) + (fun _ ht x => initializedProgram_tail loader body ht.le x) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedTrajectories.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedTrajectories.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fb94004bb3f673962a9d717a2f0fa644f8735ff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedTrajectories.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedFluid +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.StageFlow + +namespace OAI + +/-! Exact trajectories of a loader followed by a periodic machine body. -/ + +noncomputable section +open Set +open ShearFlows + +namespace ForcedComputation + +theorem initializedFlow_loading {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + {Φ Ψ : ℝ → Space → Space} + (hΦ : IsMaterialFlow body.period (initializedProgram loader body) Φ) + (hΨ : IsMaterialFlow loader.period loader.realizingVelocity Ψ) + (x : Space) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : Φ t x = Ψ t x := by + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hloader hbody + apply hΦ.eqOn_of_candidate hK x (fun s => Ψ s x) + ((continuous_iff_continuousAt.mpr (fun s => (hΨ.ode s x).continuousAt)).continuousOn) + (by rw [hΨ.initial, hΦ.initial]) ?_ ht + intro s hs + rw [initializedProgram_loading loader body ⟨hs.1, hs.2.le⟩] + exact hΨ.ode s x + +theorem initializedFlow_tail {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + {Φ Ψ : ℝ → Space → Space} + (hΦ : IsMaterialFlow body.period (initializedProgram loader body) Φ) + (hΨ : IsMaterialFlow body.period body.realizingVelocity Ψ) + (x : Space) {t : ℝ} (ht : 1 ≤ t) : Φ t x = Ψ (t - 1) (Φ 1 x) := by + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hloader hbody + have hc : Continuous (fun s => Ψ (s - 1) (Φ 1 x)) := + (continuous_iff_continuousAt.mpr (fun s => (hΨ.ode s (Φ 1 x)).continuousAt)).comp + (continuous_id.sub continuous_const) + apply hΦ.eqOn_of_candidate hK x (fun s => Ψ (s - 1) (Φ 1 x)) hc.continuousOn + (by simpa using hΨ.initial (Φ 1 x)) ?_ ⟨ht, le_rfl⟩ + intro s hs + have hd := (hΨ.ode (s - 1) (Φ 1 x)).scomp s ((hasDerivAt_id s).sub_const 1) + have hp : body.realizingVelocity (s, Ψ (s - 1) (Φ 1 x)) = + body.realizingVelocity (s - 1, Ψ (s - 1) (Φ 1 x)) := by + simpa only [sub_add_cancel] using + realizingVelocity_time_periodic body (s - 1) (Ψ (s - 1) (Φ 1 x)) + rw [initializedProgram_tail loader body hs.1, hp] + simpa only [one_smul, Function.comp_def, id_eq] using hd + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedVelocityEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedVelocityEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..94661f442529eaac1e8c863664f84d9707be3464 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InitializedVelocityEvaluation.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedEffective + +namespace OAI + +/-! The finite two-table evaluator also evaluates every derivative of the +initialized velocity itself. This supplies the coefficients of the slowed +force evaluator. -/ + +namespace ForcedComputation +open ShearFlows Set Filter +open scoped Topology ContDiff + +def evaluateInitializedVelocity (loader body : Input) + (hloader : ValidInput loader) (hbody : ValidInput body) + (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : RationalVector := + if (b 6).1 ≤ 0 then 0 + else if (b 6).1 ≤ 1 then + loader.velocityExpr.evaluate (velocityExpr_valid hloader) α b ε hε + else body.velocityExpr.evaluate (velocityExpr_valid hbody) α b ε hε + +theorem evaluateInitializedVelocity_spec {loader body : Input} + (hloader : ValidInput loader) (hbody : ValidInput body) + (α : List (Fin 4)) + {b : ℕ → RationalSpaceTime} {y : SpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (initializedProgram loader body) α y - + rationalVector (evaluateInitializedVelocity loader body hloader hbody α b ε hε)‖ ≤ + (ε : ℝ) := by + have htime : |y.1 - ((b 6).1 : ℝ)| ≤ (1 / 64 : ℝ) := by + have h := (norm_fst_le (y - rationalPoint (b 6))).trans (hb 6) + norm_num [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, errorTolerance] at h + exact h + unfold evaluateInitializedVelocity + split + · rename_i hz + have ht : y.1 < (1 / 32 : ℝ) := by + have hz' : ((b 6).1 : ℝ) ≤ 0 := by exact_mod_cast hz + linarith [(abs_le.mp htime).2] + have he : initializedProgram loader body =ᶠ[𝓝 y] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_lt_nhds ht)] with z hz + exact initializedProgram_zero_extend loader body hz z.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, mixedDerivative_zero] + have hεR : (0 : ℝ) < (ε : ℝ) := by exact_mod_cast hε + have hzv : ShearFlows.rationalVector (0 : RationalVector) = 0 := by + ext j + change ((0 : ℚ) : ℝ) = 0 + norm_num + change ‖(0 : Space) - ShearFlows.rationalVector 0‖ ≤ (ε : ℝ) + rw [hzv, sub_self, norm_zero] + exact hεR.le + · rename_i hz + split + · rename_i ho + have hzero : (0 : ℝ) < (b 6).1 := by exact_mod_cast lt_of_not_ge hz + have hone : ((b 6).1 : ℝ) ≤ 1 := by exact_mod_cast ho + have hl : -(1 / 32 : ℝ) < y.1 := by linarith [(abs_le.mp htime).1] + have hr : y.1 < 1 + (1 / 32 : ℝ) := by linarith [(abs_le.mp htime).2] + have he : initializedProgram loader body =ᶠ[𝓝 y] loader.realizingVelocity := by + filter_upwards [(continuous_fst.tendsto y).eventually (Ioo_mem_nhds hl hr)] with z hz + exact initializedProgram_loading_extend loader body hz z.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, + ← velocityExpr_val hloader] + exact VelocityExpr.evaluate_spec (velocityExpr_valid hloader) α b hb ε hε + · rename_i ho + have hone : (1 : ℝ) < (b 6).1 := by exact_mod_cast lt_of_not_ge ho + have hl : 1 - (1 / 32 : ℝ) < y.1 := by linarith [(abs_le.mp htime).1] + have he : initializedProgram loader body =ᶠ[𝓝 y] body.realizingVelocity := by + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_gt_nhds hl)] with z hz + exact initializedProgram_tail_extend loader body hz z.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, + ← velocityExpr_val hbody] + exact VelocityExpr.evaluate_spec (velocityExpr_valid hbody) α b hb ε hε + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InstructionRectangles.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InstructionRectangles.lean new file mode 100644 index 0000000000000000000000000000000000000000..5470d6308ff7ede0bd33c872ff3fdf67f46b9507 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/InstructionRectangles.lean @@ -0,0 +1,174 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RectangleAffine +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.GappedInstructions + +namespace OAI + +/-! Rational filled rectangles and reciprocal affine maps for all three head +moves. These are the exact rows of the radix table in Section 4 of paper 379-01. -/ + +noncomputable section + +namespace ForcedComputation.Radix + +open ShearFlows + +inductive HeadMove + | left | stay | right + deriving DecidableEq + +def sourceBox (B l a : ℚ) : RationalBox 2 := + ⟨![l / B, a / B], ![(l + 1) / B, (a + 1) / B]⟩ + +def targetBox (B l b : ℚ) : HeadMove → RationalBox 2 + | .right => ⟨![b / B + l / B ^ 2, 0], ![b / B + (l + 1) / B ^ 2, 1]⟩ + | .stay => ⟨![l / B, b / B], ![(l + 1) / B, (b + 1) / B]⟩ + | .left => ⟨![0, l / B + b / B ^ 2], ![1, l / B + (b + 1) / B ^ 2]⟩ + +def headFactor (B : ℚ) : HeadMove → ℚ + | .right => B⁻¹ + | .stay => 1 + | .left => B + +def radixInstruction (B l a b : ℚ) (m : HeadMove) : Instruction := + ⟨sourceBox B l a, targetBox B l b m, headFactor B m⟩ + +theorem headFactor_pos {B : ℚ} (hB : 0 < B) (m : HeadMove) : + 0 < headFactor B m := by + cases m <;> simp [headFactor, hB, inv_pos.mpr hB] + +theorem sourceBox_positive {B : ℚ} (hB : 0 < B) (l a : ℚ) : + (sourceBox B l a).positive := by + intro j + fin_cases j <;> dsimp [sourceBox] + all_goals apply (div_lt_div_iff_of_pos_right hB).mpr; linarith + +theorem targetBox_positive {B : ℚ} (hB : 0 < B) (l b : ℚ) (m : HeadMove) : + (targetBox B l b m).positive := by + have hBB : 0 < B ^ 2 := pow_pos hB 2 + have hdiv (x : ℚ) : x / B < (x + 1) / B := + (div_lt_div_iff_of_pos_right hB).mpr (by linarith) + have hdiv2 (x : ℚ) : x / B ^ 2 < (x + 1) / B ^ 2 := + (div_lt_div_iff_of_pos_right hBB).mpr (by linarith) + intro j + cases m <;> fin_cases j <;> dsimp [targetBox] + · norm_num + · linarith [hdiv2 b] + · exact hdiv l + · exact hdiv b + · linarith [hdiv2 l] + · norm_num + +theorem radixInstruction_image {B : ℚ} (hB : 0 < B) (l a b : ℚ) (m : HeadMove) : + (radixInstruction B l a b m).affine '' (sourceBox B l a).carrier = + (targetBox B l b m).carrier := by + have hn : (B : ℝ) ≠ 0 := by exact_mod_cast hB.ne' + apply Instruction.image_eq_of_halfWidths _ (headFactor_pos hB m) + all_goals cases m <;> + simp only [radixInstruction, sourceBox, targetBox, headFactor, RationalBox.halfWidth, + Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_add, Rat.cast_div, + Rat.cast_zero, Rat.cast_one, Rat.cast_pow, Rat.cast_inv] <;> field_simp <;> ring + +def normalizedMove (B l a b : ℝ) : HeadMove → (ℝ × ℝ) → ℝ × ℝ + | .right => rightMove B a b + | .stay => stayMove B a b + | .left => leftMove B l a b + +def planeOfPair (p : ℝ × ℝ) : Plane := ![p.1, p.2] + +theorem radixInstruction_action {B : ℚ} (hB : 0 < B) (l a b : ℚ) + (m : HeadMove) (p : ℝ × ℝ) : + (radixInstruction B l a b m).affine (planeOfPair p) = + planeOfPair (normalizedMove B l a b m p) := by + have hn : (B : ℝ) ≠ 0 := by exact_mod_cast hB.ne' + funext j + cases m <;> fin_cases j <;> + simp only [radixInstruction, sourceBox, targetBox, headFactor, normalizedMove, + rightMove, leftMove, stayMove, planeOfPair, push, pop, Instruction.affine, + RationalBox.center, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_add, Rat.cast_div, Rat.cast_zero, Rat.cast_one, Rat.cast_pow, Rat.cast_inv] <;> + dsimp <;> field_simp <;> ring + +def scaledBox (κ : ℚ) (offset : Fin 2 → ℚ) (R : RationalBox 2) : RationalBox 2 := + ⟨fun j => offset j + κ * R.lower j, fun j => offset j + κ * R.upper j⟩ + +theorem scaledBox_center (κ : ℚ) (offset : Fin 2 → ℚ) (R : RationalBox 2) (j : Fin 2) : + (scaledBox κ offset R).center j = (offset j : ℝ) + (κ : ℝ) * R.center j := by + simp only [scaledBox, RationalBox.center, Rat.cast_add, Rat.cast_mul] + ring + +theorem scaledBox_halfWidth (κ : ℚ) (offset : Fin 2 → ℚ) (R : RationalBox 2) (j : Fin 2) : + (scaledBox κ offset R).halfWidth j = (κ : ℝ) * R.halfWidth j := by + simp only [scaledBox, RationalBox.halfWidth, Rat.cast_add, Rat.cast_mul] + ring + +theorem scaledBox_positive {κ : ℚ} (hκ : 0 < κ) (offset : Fin 2 → ℚ) + {R : RationalBox 2} (hR : R.positive) : (scaledBox κ offset R).positive := by + intro j + dsimp [scaledBox] + linarith [mul_lt_mul_of_pos_left (hR j) hκ] + +def scaledInstruction (κ : ℚ) (sourceOffset targetOffset : Fin 2 → ℚ) + (b : Instruction) : Instruction := + ⟨scaledBox κ sourceOffset b.source, scaledBox κ targetOffset b.target, b.factor⟩ + +theorem scaledInstruction_image {κ : ℚ} (sourceOffset targetOffset : Fin 2 → ℚ) + (b : Instruction) (hf : 0 < b.factor) + (h₀ : b.target.halfWidth 0 = (b.factor : ℝ) * b.source.halfWidth 0) + (h₁ : b.target.halfWidth 1 = b.source.halfWidth 1 / (b.factor : ℝ)) : + (scaledInstruction κ sourceOffset targetOffset b).affine '' + (scaledBox κ sourceOffset b.source).carrier = + (scaledBox κ targetOffset b.target).carrier := by + apply Instruction.image_eq_of_halfWidths (scaledInstruction κ sourceOffset targetOffset b) hf + · change (scaledBox κ targetOffset b.target).halfWidth 0 = + (b.factor : ℝ) * (scaledBox κ sourceOffset b.source).halfWidth 0 + rw [scaledBox_halfWidth, scaledBox_halfWidth, h₀] + ring + · change (scaledBox κ targetOffset b.target).halfWidth 1 = + (scaledBox κ sourceOffset b.source).halfWidth 1 / (b.factor : ℝ) + rw [scaledBox_halfWidth, scaledBox_halfWidth, h₁] + ring + +def embedPlane (κ : ℚ) (offset : Fin 2 → ℚ) (x : Plane) : Plane := + fun j => (offset j : ℝ) + (κ : ℝ) * x j + +theorem scaledBox_image {κ : ℚ} (hκ : 0 < κ) (offset : Fin 2 → ℚ) + (R : RationalBox 2) : embedPlane κ offset '' R.carrier = (scaledBox κ offset R).carrier := by + have hp : (0 : ℝ) < κ := by exact_mod_cast hκ + ext y + constructor + · rintro ⟨x, hx, rfl⟩ j + have hj := hx j + simpa only [scaledBox, embedPlane, Rat.cast_add, Rat.cast_mul] using + And.intro (add_le_add (le_refl (offset j : ℝ)) (mul_le_mul_of_nonneg_left hj.1 hp.le)) + (add_le_add (le_refl (offset j : ℝ)) (mul_le_mul_of_nonneg_left hj.2 hp.le)) + · intro hy + let x : Plane := fun j => (y j - (offset j : ℝ)) / (κ : ℝ) + refine ⟨x, ?_, ?_⟩ + · intro j + have hj := hy j + simp only [scaledBox, Rat.cast_add, Rat.cast_mul] at hj + constructor + · change (R.lower j : ℝ) ≤ (y j - (offset j : ℝ)) / (κ : ℝ) + apply (le_div_iff₀ hp).mpr + linarith [hj.1] + · change (y j - (offset j : ℝ)) / (κ : ℝ) ≤ (R.upper j : ℝ) + apply (div_le_iff₀ hp).mpr + linarith [hj.2] + · funext j + dsimp [embedPlane, x] + field_simp + ring + +theorem scaledInstruction_action (κ : ℚ) (sourceOffset targetOffset : Fin 2 → ℚ) + (b : Instruction) (x : Plane) : + (scaledInstruction κ sourceOffset targetOffset b).affine (embedPlane κ sourceOffset x) = + embedPlane κ targetOffset (b.affine x) := by + funext j + fin_cases j <;> + simp only [scaledInstruction, Instruction.affine, embedPlane, scaledBox_center] <;> dsimp <;> ring + +end ForcedComputation.Radix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/IntermediateObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/IntermediateObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5f319997b67ec25be63bc0518b06baffa790ed1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/IntermediateObservation.lean @@ -0,0 +1,160 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Trajectories + +namespace OAI + +/-! The finite shear program cannot produce an observation between safe endpoints. -/ + +noncomputable section +open Set + +namespace ShearFlows + +theorem RationalBox.coordinate_le_center_add_halfWidth {R : RationalBox 2} {X : Plane} + (hX : X ∈ R.carrier) (j : Fin 2) : X j ≤ R.center j + R.halfWidth j := by + have hj := (hX j).2 + dsimp [RationalBox.center, RationalBox.halfWidth] + linarith + +theorem RationalBox.center_sub_halfWidth_le_coordinate {R : RationalBox 2} {X : Plane} + (hX : X ∈ R.carrier) (j : Fin 2) : R.center j - R.halfWidth j ≤ X j := by + have hj := (hX j).1 + dsimp [RationalBox.center, RationalBox.halfWidth] + linarith + +theorem branchNodes_first_le {d : Input} (hd : ValidInput d) + (i : Fin d.instructions.length) {X : Plane} (hX : X ∈ (d.sources i).carrier) + {a : ℝ} (hs : d.instructions[i].source.center 0 ≤ a) + (ht : d.instructions[i].target.center 0 ≤ a) (k : Fin 8) : + branchNodes d i X 0 k 0 ≤ a + 2 * (d.h : ℝ) := by + have hh : (0 : ℝ) < d.h := by exact_mod_cast hd.h_pos + have hXs : X ∈ d.instructions[i].source.carrier := hX + have hys : d.instructions[i].affine X ∈ d.instructions[i].target.carrier := by + rw [← hd.image_eq d.instructions[i] (List.getElem_mem i.isLt)] + exact mem_image_of_mem _ hXs + have hx₀ := RationalBox.coordinate_le_center_add_halfWidth hXs 0 + have hy₀ := RationalBox.coordinate_le_center_add_halfWidth hys 0 + have hx : X 0 ≤ a + 2 * (d.h : ℝ) := by + have hw := (hd.halfWidths d.instructions[i] (List.getElem_mem i.isLt) 0).1 + linarith + have hy : d.instructions[i].affine X 0 ≤ a + 2 * (d.h : ℝ) := by + have hw := (hd.halfWidths d.instructions[i] (List.getElem_mem i.isLt) 0).2 + linarith + have hscale (j : Fin 5) : scalingPoint d.instructions[i] X j 0 ≤ a + 2 * (d.h : ℝ) := by + have hb := scalingPoint_bound hd (b := d.instructions[i]) (List.getElem_mem i.isLt) hXs j + have hb' := (abs_le.mp ((norm_le_pi_norm _ 0).trans hb)).2 + change scalingPoint d.instructions[i] X j 0 - d.instructions[i].source.center 0 ≤ _ at hb' + linarith + fin_cases k + · exact hx + · exact hx + · exact hscale 1 + · exact hscale 2 + · exact hscale 3 + · exact hscale 4 + · exact hy + · exact hy + +theorem branchNodes_first_ge {d : Input} (hd : ValidInput d) + (i : Fin d.instructions.length) {X : Plane} (hX : X ∈ (d.sources i).carrier) + {a : ℝ} (hs : a ≤ d.instructions[i].source.center 0) + (ht : a ≤ d.instructions[i].target.center 0) (k : Fin 8) : + a - 2 * (d.h : ℝ) ≤ branchNodes d i X 0 k 0 := by + have hh : (0 : ℝ) < d.h := by exact_mod_cast hd.h_pos + have hXs : X ∈ d.instructions[i].source.carrier := hX + have hys : d.instructions[i].affine X ∈ d.instructions[i].target.carrier := by + rw [← hd.image_eq d.instructions[i] (List.getElem_mem i.isLt)] + exact mem_image_of_mem _ hXs + have hx₀ := RationalBox.center_sub_halfWidth_le_coordinate hXs 0 + have hy₀ := RationalBox.center_sub_halfWidth_le_coordinate hys 0 + have hx : a - 2 * (d.h : ℝ) ≤ X 0 := by + have hw := (hd.halfWidths d.instructions[i] (List.getElem_mem i.isLt) 0).1 + linarith + have hy : a - 2 * (d.h : ℝ) ≤ d.instructions[i].affine X 0 := by + have hw := (hd.halfWidths d.instructions[i] (List.getElem_mem i.isLt) 0).2 + linarith + have hscale (j : Fin 5) : a - 2 * (d.h : ℝ) ≤ scalingPoint d.instructions[i] X j 0 := by + have hb := scalingPoint_bound hd (b := d.instructions[i]) (List.getElem_mem i.isLt) hXs j + have hb' := (abs_le.mp ((norm_le_pi_norm _ 0).trans hb)).1 + change _ ≤ scalingPoint d.instructions[i] X j 0 - d.instructions[i].source.center 0 at hb' + linarith + fin_cases k + · exact hx + · exact hx + · exact hscale 1 + · exact hscale 2 + · exact hscale 3 + · exact hscale 4 + · exact hy + · exact hy + +theorem exists_block_of_mem {t : ℝ} (ht : t ∈ Icc (0 : ℝ) (7 / 8)) : + ∃ j : Fin 7, t ∈ Icc (blockStart j) (blockFinish j) := by + by_cases h₀ : t ≤ 1 / 8 + · exact ⟨0, by norm_num [blockStart, blockFinish]; exact ⟨ht.1, h₀⟩⟩ + by_cases h₁ : t ≤ 2 / 8 + · exact ⟨1, by norm_num [blockStart, blockFinish]; constructor <;> linarith⟩ + by_cases h₂ : t ≤ 3 / 8 + · exact ⟨2, by norm_num [blockStart, blockFinish]; constructor <;> linarith⟩ + by_cases h₃ : t ≤ 4 / 8 + · exact ⟨3, by norm_num [blockStart, blockFinish]; constructor <;> linarith⟩ + by_cases h₄ : t ≤ 5 / 8 + · exact ⟨4, by norm_num [blockStart, blockFinish]; constructor <;> linarith⟩ + by_cases h₅ : t ≤ 6 / 8 + · exact ⟨5, by norm_num [blockStart, blockFinish]; constructor <;> linarith⟩ + exact ⟨6, by norm_num [blockStart, blockFinish]; constructor <;> linarith [ht.2]⟩ + +theorem materialFlow_first_le {d : Input} (hd : ValidInput d) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) + (i : Fin d.instructions.length) {X : Plane} (hX : X ∈ (d.sources i).carrier) + {a : ℝ} (hs : d.instructions[i].source.center 0 ≤ a) + (ht : d.instructions[i].target.center 0 ≤ a) {t : ℝ} (htime : t ∈ Icc (0 : ℝ) 1) : + Φ t (atHeight X d.codingHeight) 0 ≤ a + 2 * (d.h : ℝ) := by + have hδ : (0 : ℝ) < d.tubeRadius := by exact_mod_cast tubeRadius_pos hd + have hblock {s : ℝ} (hs' : s ∈ Icc (0 : ℝ) (7 / 8)) : + Φ s (atHeight X d.codingHeight) 0 ≤ a + 2 * (d.h : ℝ) := by + obtain ⟨j, hj⟩ := exists_block_of_mem hs' + have he := materialFlow_branch_segment hd hΦ i hX + (X := X) (by simpa using hδ) (ζ := 0) (by simpa using hδ) j hj + simp only [add_zero] at he + rw [he] + have ha := branchNodes_first_le hd i hX hs ht j.castSucc + have hb := branchNodes_first_le hd i hX hs ht j.succ + have hp := standardSchedule.range j s + change (1 - standardSchedule.progress j s) * _ + standardSchedule.progress j s * _ ≤ _ + nlinarith [mul_nonneg (sub_nonneg.mpr hp.2) (sub_nonneg.mpr ha), + mul_nonneg hp.1 (sub_nonneg.mpr hb)] + by_cases he : t ≤ 7 / 8 + · exact hblock ⟨htime.1, he⟩ + · rw [materialFlow_period_tail hd hΦ _ ⟨(lt_of_not_ge he).le, htime.2⟩] + exact hblock (by norm_num) + +theorem materialFlow_first_ge {d : Input} (hd : ValidInput d) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) + (i : Fin d.instructions.length) {X : Plane} (hX : X ∈ (d.sources i).carrier) + {a : ℝ} (hs : a ≤ d.instructions[i].source.center 0) + (ht : a ≤ d.instructions[i].target.center 0) {t : ℝ} (htime : t ∈ Icc (0 : ℝ) 1) : + a - 2 * (d.h : ℝ) ≤ Φ t (atHeight X d.codingHeight) 0 := by + have hδ : (0 : ℝ) < d.tubeRadius := by exact_mod_cast tubeRadius_pos hd + have hblock {s : ℝ} (hs' : s ∈ Icc (0 : ℝ) (7 / 8)) : + a - 2 * (d.h : ℝ) ≤ Φ s (atHeight X d.codingHeight) 0 := by + obtain ⟨j, hj⟩ := exists_block_of_mem hs' + have he := materialFlow_branch_segment hd hΦ i hX + (X := X) (by simpa using hδ) (ζ := 0) (by simpa using hδ) j hj + simp only [add_zero] at he + rw [he] + have ha := branchNodes_first_ge hd i hX hs ht j.castSucc + have hb := branchNodes_first_ge hd i hX hs ht j.succ + have hp := standardSchedule.range j s + change _ ≤ (1 - standardSchedule.progress j s) * _ + standardSchedule.progress j s * _ + nlinarith [mul_nonneg (sub_nonneg.mpr hp.2) (sub_nonneg.mpr ha), + mul_nonneg hp.1 (sub_nonneg.mpr hb)] + by_cases he : t ≤ 7 / 8 + · exact hblock ⟨htime.1, he⟩ + · rw [materialFlow_period_tail hd hΦ _ ⟨(lt_of_not_ge he).le, htime.2⟩] + exact hblock (by norm_num) + +end ShearFlows + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeArithmetic.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7402d63662587729f85b5078a8c5def3390066e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeArithmetic.lean @@ -0,0 +1,218 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Machines + +namespace OAI + +/-! The finite integer arithmetic of the periodic-lattice processor. A +configuration uses two fixed-width stacks and one state digit. Every integer +address is decoded by its least nonnegative residue, including negative lifts +of the same point on the torus. -/ + +namespace ForcedComputation.Lattice + +def stackBase (b d : ℕ) : ℕ := b ^ d + +def period (b d : ℕ) : ℕ := b ^ (2 * d + 1) + +def pack (b d L R q : ℕ) : ℕ := L + stackBase b d * (R + stackBase b d * q) + +def leftStack (b d c : ℕ) : ℕ := c % stackBase b d + +def rightStack (b d c : ℕ) : ℕ := (c / stackBase b d) % stackBase b d + +def stateDigit (b d c : ℕ) : ℕ := (c / stackBase b d) / stackBase b d + +theorem stackBase_pos {b : ℕ} (hb : 0 < b) (d : ℕ) : 0 < stackBase b d := + pow_pos hb d + +theorem period_pos {b : ℕ} (hb : 0 < b) (d : ℕ) : 0 < period b d := + pow_pos hb _ + +theorem period_eq (b d : ℕ) : period b d = stackBase b d * stackBase b d * b := by + simp only [period, stackBase, two_mul, pow_add, pow_one] + +theorem prepend_lt {b B a t : ℕ} (ha : a < b) (ht : t < B) : a + b * t < b * B := by + nlinarith + +theorem pack_lt {b d L R q : ℕ} (hL : L < stackBase b d) + (hR : R < stackBase b d) (hq : q < b) : pack b d L R q < period b d := by + rw [period_eq] + simpa only [pack, Nat.mul_assoc] using prepend_lt hL (prepend_lt hR hq) + +theorem pack_left {b d L R q : ℕ} (hL : L < stackBase b d) : + leftStack b d (pack b d L R q) = L := by + simp only [leftStack, pack, Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt hL] + +theorem pack_div {b d L R q : ℕ} (hb : 0 < b) (hL : L < stackBase b d) : + pack b d L R q / stackBase b d = R + stackBase b d * q := by + rw [pack, Nat.add_mul_div_left _ _ (stackBase_pos hb d), Nat.div_eq_of_lt hL, + Nat.zero_add] + +theorem pack_right {b d L R q : ℕ} (hb : 0 < b) (hL : L < stackBase b d) + (hR : R < stackBase b d) : rightStack b d (pack b d L R q) = R := by + rw [rightStack, pack_div hb hL] + simp only [Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt hR] + +theorem pack_state {b d L R q : ℕ} (hb : 0 < b) (hL : L < stackBase b d) + (hR : R < stackBase b d) : stateDigit b d (pack b d L R q) = q := by + rw [stateDigit, pack_div hb hL, + Nat.add_mul_div_left _ _ (stackBase_pos hb d), Nat.div_eq_of_lt hR, Nat.zero_add] + +theorem leftStack_lt {b : ℕ} (hb : 0 < b) (d c : ℕ) : + leftStack b d c < stackBase b d := Nat.mod_lt _ (stackBase_pos hb d) + +theorem rightStack_lt {b : ℕ} (hb : 0 < b) (d c : ℕ) : + rightStack b d c < stackBase b d := Nat.mod_lt _ (stackBase_pos hb d) + +theorem stateDigit_lt {b d c : ℕ} (hb : 0 < b) (hc : c < period b d) : + stateDigit b d c < b := by + unfold stateDigit + apply (Nat.div_lt_iff_lt_mul (stackBase_pos hb d)).mpr + apply (Nat.div_lt_iff_lt_mul (stackBase_pos hb d)).mpr + rw [period_eq] at hc + simpa only [Nat.mul_assoc, Nat.mul_left_comm, Nat.mul_comm] using hc + +theorem pack_decode (b d c : ℕ) : + pack b d (leftStack b d c) (rightStack b d c) (stateDigit b d c) = c := by + unfold pack leftStack rightStack stateDigit + rw [Nat.mod_add_div, Nat.mod_add_div] + +def address (b d : ℕ) (j : ℤ) : ℕ := j.natMod (period b d) + +theorem address_lt {b : ℕ} (hb : 0 < b) (d : ℕ) (j : ℤ) : + address b d j < period b d := Int.natMod_lt (Nat.ne_of_gt (period_pos hb d)) + +theorem address_periodic (b d : ℕ) : + Function.Periodic (address b d) (period b d : ℤ) := by + intro j + simp only [address, Int.natMod, Int.add_emod_right] + +theorem address_nat {b d c : ℕ} (hc : c < period b d) : address b d (c : ℤ) = c := by + simp only [address, Int.natMod, ← Int.natCast_mod, Int.toNat_natCast, + Nat.mod_eq_of_lt hc] + +theorem address_congr {b d : ℕ} {i j : ℤ} + (h : i % (period b d : ℤ) = j % (period b d : ℤ)) : + address b d i = address b d j := congrArg Int.toNat h + +/-- Move 0 is left, move 1 is stationary, and move 2 is right. -/ +def nextLeft (b L a : ℕ) (m : Fin 3) : ℕ := + if m = 0 then L / b else if m = 1 then L else a + b * L + +def nextRight (b L R a : ℕ) (m : Fin 3) : ℕ := + if m = 0 then L % b + b * (a + b * (R / b)) + else if m = 1 then a + b * (R / b) else R / b + +theorem left_move_formula (b L R a : ℕ) : + nextRight b L R a 0 = L % b + b * a + b * (R - R % b) := by + have h := Nat.mod_add_div R b + have hs : R - R % b = b * (R / b) := by omega + norm_num [nextRight, Fin.ext_iff] + rw [hs] + ring + +theorem stationary_move_formula (b L R a : ℕ) : + nextRight b L R a 1 = R - R % b + a := by + have h := Nat.mod_add_div R b + have hs : R - R % b = b * (R / b) := by omega + norm_num [nextRight, Fin.ext_iff] + rw [hs, Nat.add_comm] + +theorem quotient_power_lt {b d R : ℕ} (hb : 0 < b) (hd : 0 < d) + (hR : R < b ^ d) : R / b < b ^ (d - 1) := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hd) + apply (Nat.div_lt_iff_lt_mul hb).mpr + simpa only [pow_succ, Nat.succ_sub_one] using hR + +theorem next_stacks_lt {b d L R a : ℕ} (hb : 2 ≤ b) (hd : 0 < d) + (hL : L < stackBase b d) (hR : R < stackBase b d) (ha : a < b) + (m : Fin 3) : + nextLeft b L a m < b ^ (d + 1) ∧ nextRight b L R a m < b ^ (d + 1) := by + have hb₀ : 0 < b := by omega + have hpow : b ^ d ≤ b ^ (d + 1) := Nat.pow_le_pow_right (by omega) (by omega) + have hq : R / b < b ^ (d - 1) := quotient_power_lt hb₀ hd hR + have hp : a + b * (R / b) < b ^ d := by + have hp := prepend_lt ha hq + have he : b * b ^ (d - 1) = b ^ d := by + rw [← pow_succ'] + congr 1 + omega + rwa [he] at hp + fin_cases m + · norm_num [nextLeft, nextRight, Fin.ext_iff] + refine ⟨(Nat.div_le_self L b).trans_lt (hL.trans_le hpow), ?_⟩ + simpa only [pow_succ, Nat.mul_comm] using + (prepend_lt (Nat.mod_lt L hb₀) hp) + · norm_num [nextLeft, nextRight, Fin.ext_iff] + exact ⟨hL.trans_le hpow, hp.trans_le hpow⟩ + · norm_num [nextLeft, nextRight, Fin.ext_iff] + exact ⟨by simpa only [stackBase, pow_succ, Nat.mul_comm] using prepend_lt ha hL, + (Nat.div_le_self R b).trans_lt (hR.trans_le hpow)⟩ + +structure Rule (b : ℕ) where + next : Fin b + write : Fin b + move : Fin 3 + deriving DecidableEq + +/-- A finite lookup table, without any assumption about addresses visited by a run. -/ +structure Table (b : ℕ) where + rows : List (List (Option (Rule b))) + halting : List ℕ + deriving DecidableEq + +def Table.lookup {b : ℕ} (T : Table b) (q a : ℕ) : Option (Rule b) := + ((T.rows[q]?).bind fun row => row[a]?).join + +def readTransition {b : ℕ} (T : Table b) (d c : ℕ) : ℕ := + match T.lookup (stateDigit b d c) (rightStack b d c % b) with + | none => 0 + | some r => pack b (d + 2) + (nextLeft b (leftStack b d c) r.write r.move) + (nextRight b (leftStack b d c) (rightStack b d c) r.write r.move) r.next + +def transition {b : ℕ} (T : Table b) (d : ℕ) (j : ℤ) : ℕ := + readTransition T d (address b d j) + +def haltFlag {b : ℕ} (T : Table b) (d : ℕ) (j : ℤ) : Bool := + decide (stateDigit b d (address b d j) ∈ T.halting) + +theorem transition_periodic {b : ℕ} (T : Table b) (d : ℕ) : + Function.Periodic (transition T d) (period b d : ℤ) := by + intro j + unfold transition + rw [address_periodic b d j] + +theorem haltFlag_periodic {b : ℕ} (T : Table b) (d : ℕ) : + Function.Periodic (haltFlag T d) (period b d : ℤ) := by + intro j + unfold haltFlag + rw [address_periodic b d j] + +theorem readTransition_lt {b : ℕ} (T : Table b) (hb : 2 ≤ b) {d c : ℕ} + (hd : 0 < d) (_hc : c < period b d) : readTransition T d c < period b (d + 2) := by + have hb₀ : 0 < b := by omega + unfold readTransition + split + · exact period_pos hb₀ _ + · rename_i r _ + have hp := next_stacks_lt hb hd (leftStack_lt hb₀ d c) + (rightStack_lt hb₀ d c) r.write.isLt r.move + have hs : b ^ (d + 1) ≤ stackBase b (d + 2) := + Nat.pow_le_pow_right (by omega) (by omega) + exact pack_lt (hp.1.trans_le hs) (hp.2.trans_le hs) r.next.isLt + +theorem transition_lt {b : ℕ} (T : Table b) (hb : 2 ≤ b) {d : ℕ} + (hd : 0 < d) (j : ℤ) : transition T d j < period b (d + 2) := + readTransition_lt T hb hd (address_lt (by omega) d j) + +theorem readTransition_pack {b : ℕ} (T : Table b) (hb : 0 < b) + {d L R q : ℕ} (hL : L < stackBase b d) (hR : R < stackBase b d) {r : Rule b} + (hr : T.lookup q (R % b) = some r) : + readTransition T d (pack b d L R q) = + pack b (d + 2) (nextLeft b L r.write r.move) (nextRight b L R r.write r.move) r.next := by + simp only [readTransition, pack_state hb hL hR, pack_right hb hL hR, + pack_left hL, hr] + +end ForcedComputation.Lattice + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeMachine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeMachine.lean new file mode 100644 index 0000000000000000000000000000000000000000..98fc78d77b3d12b6cafb9f438c02d08af528206e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeMachine.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LatticeArithmetic + +namespace OAI + +/-! The finite lattice lookup table obtained from an actual machine. The +least significant bit of every symbol is a read-only origin marker. Missing +instructions use the existing normalized extra halting state. -/ + +namespace ForcedComputation.Lattice + +def machineBase (M : Alternating.Machine) : ℕ := + max 2 (max (2 * M.symbolCount) (M.stateCount + 1)) + +theorem machineBase_two_le (M : Alternating.Machine) : 2 ≤ machineBase M := le_max_left _ _ + +theorem machineBase_symbols (M : Alternating.Machine) : 2 * M.symbolCount ≤ machineBase M := + (le_max_left _ _).trans (le_max_right _ _) + +theorem machineBase_states (M : Alternating.Machine) : M.stateCount + 1 ≤ machineBase M := + (le_max_right _ _).trans (le_max_right _ _) + +def markedDigit (a : ℕ) (origin : Bool) : ℕ := 2 * a + origin.toNat + +theorem markedDigit_symbol (a : ℕ) (origin : Bool) : markedDigit a origin / 2 = a := by + cases origin with + | false => simp [markedDigit] + | true => simp only [markedDigit, Bool.toNat_true]; omega + +theorem markedDigit_bit (a : ℕ) (origin : Bool) : markedDigit a origin % 2 = origin.toNat := by + cases origin <;> simp [markedDigit] + +theorem markedDigit_lt {M : Alternating.Machine} {a : ℕ} + (ha : a < M.symbolCount) (origin : Bool) : markedDigit a origin < machineBase M := by + have hb := machineBase_symbols M + cases origin <;> simp [markedDigit] <;> omega + +def markedTape (C : Alternating.Configuration) (j : ℤ) : ℕ := + markedDigit (C.tape j) (decide (j = 0)) + +theorem markedTape_symbol (C : Alternating.Configuration) (j : ℤ) : + markedTape C j / 2 = C.tape j := markedDigit_symbol _ _ + +theorem markedTape_origin (C : Alternating.Configuration) (j : ℤ) : + markedTape C j % 2 = 1 ↔ j = 0 := by + rw [markedTape, markedDigit_bit] + by_cases hj : j = 0 <;> simp [hj] + +theorem markedTape_lt {M : Alternating.Machine} {C : Alternating.Configuration} + (hC : C.ValidFor M) (j : ℤ) : markedTape C j < machineBase M := + markedDigit_lt (hC.2 j) _ + +def machineRule (M : Alternating.Machine) (hM : M.WellFormed) (q a : ℕ) : + Option (Rule (machineBase M)) := + if hq : q ≤ M.stateCount then + if ha : a / 2 < M.symbolCount then + if M.isHalting q then none else + let r := M.normalizedInstruction q (a / 2) + some { + next := ⟨r.1, by + dsimp only [r] + have hr := M.normalizedInstruction_bounds hM hq ha + have hb := machineBase_states M + omega⟩ + write := ⟨2 * r.2.1 + a % 2, by + dsimp only [r] + have hr := M.normalizedInstruction_bounds hM hq ha + have hb := machineBase_symbols M + have ha₂ := Nat.mod_lt a (by decide : 0 < 2) + omega⟩ + move := r.2.2 } + else none + else none + +def machineTable (M : Alternating.Machine) (hM : M.WellFormed) : Table (machineBase M) where + rows := List.ofFn fun q : Fin (machineBase M) => + List.ofFn fun a : Fin (machineBase M) => machineRule M hM q a + halting := (List.range (M.stateCount + 1)).filter M.isHalting + +theorem machineTable_lookup (M : Alternating.Machine) (hM : M.WellFormed) + {q a : ℕ} (hq : q < machineBase M) (ha : a < machineBase M) : + (machineTable M hM).lookup q a = machineRule M hM q a := by + simp [Table.lookup, machineTable, hq, ha] + +theorem machineTable_halting (M : Alternating.Machine) (hM : M.WellFormed) + {q : ℕ} (hq : q ≤ M.stateCount) : + q ∈ (machineTable M hM).halting ↔ M.isHalting q = true := by + have hq' : q < M.stateCount + 1 := by omega + simp only [machineTable, List.mem_filter, List.mem_range, hq', true_and] + +theorem machineRule_halted (M : Alternating.Machine) (hM : M.WellFormed) + {q a : ℕ} (hh : M.isHalting q = true) : machineRule M hM q a = none := by + unfold machineRule + split + · split + · simp + · rfl + · rfl + +theorem machineRule_spec (M : Alternating.Machine) (hM : M.WellFormed) + {q a : ℕ} (hq : q ≤ M.stateCount) (ha : a / 2 < M.symbolCount) + (hh : M.isHalting q = false) : + ∃ r, machineRule M hM q a = some r ∧ + r.next.val = (M.normalizedInstruction q (a / 2)).1 ∧ + r.write.val = 2 * (M.normalizedInstruction q (a / 2)).2.1 + a % 2 ∧ + r.move = (M.normalizedInstruction q (a / 2)).2.2 := by + simp only [machineRule, dite_eq_left hq, dite_eq_left ha, hh, Bool.false_eq_true, ite_false] + exact ⟨_, rfl, rfl, rfl, rfl⟩ + +theorem machineRule_preserves_origin (M : Alternating.Machine) (hM : M.WellFormed) + {q a : ℕ} (hq : q ≤ M.stateCount) (ha : a / 2 < M.symbolCount) + (hh : M.isHalting q = false) : + ∃ r, machineRule M hM q a = some r ∧ r.write.val % 2 = a % 2 ∧ + r.write.val / 2 = (M.normalizedInstruction q (a / 2)).2.1 := by + obtain ⟨r, hr, _, hw, _⟩ := machineRule_spec M hM hq ha hh + have ha₂ := Nat.mod_lt a (by decide : 0 < 2) + refine ⟨r, hr, ?_, ?_⟩ <;> rw [hw] <;> omega + +end ForcedComputation.Lattice + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeStacks.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeStacks.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf11d360f51046464d1ded2236291338b4e0cd7a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LatticeStacks.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LatticeMachine + +namespace OAI + +/-! Finite little-endian stack codes and the effective support bound for the +actual machine's marked tape. The width grows twice as fast as the head. -/ + +namespace ForcedComputation.Lattice + +def stackValue (b : ℕ) : ℕ → (ℕ → ℕ) → ℕ + | 0, _ => 0 + | d + 1, a => a 0 + b * stackValue b d (fun i => a (i + 1)) + +theorem stackValue_ext (b d : ℕ) {a c : ℕ → ℕ} + (h : ∀ i < d, a i = c i) : stackValue b d a = stackValue b d c := by + induction d generalizing a c with + | zero => rfl + | succ d ih => + simp only [stackValue] + rw [h 0 (by omega), ih (fun i hi => h (i + 1) (by omega))] + +theorem stackValue_zero (b d : ℕ) : stackValue b d (fun _ => 0) = 0 := by + induction d with + | zero => rfl + | succ d ih => simp only [stackValue, ih, Nat.mul_zero, Nat.zero_add] + +theorem stackValue_lt {b : ℕ} (_hb : 0 < b) (d : ℕ) {a : ℕ → ℕ} + (ha : ∀ i < d, a i < b) : stackValue b d a < b ^ d := by + induction d generalizing a with + | zero => simp only [stackValue, pow_zero]; omega + | succ d ih => + have ht := ih (a := fun i => a (i + 1)) (fun i hi => ha (i + 1) (by omega)) + simpa only [stackValue, pow_succ, Nat.mul_comm] using prepend_lt (ha 0 (by omega)) ht + +theorem stackValue_head {b d : ℕ} {a : ℕ → ℕ} (ha : a 0 < b) : + stackValue b (d + 1) a % b = a 0 := by + simp only [stackValue, Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt ha] + +theorem stackValue_tail {b d : ℕ} (hb : 0 < b) {a : ℕ → ℕ} (ha : a 0 < b) : + stackValue b (d + 1) a / b = stackValue b d (fun i => a (i + 1)) := by + rw [stackValue, Nat.add_mul_div_left _ _ hb, Nat.div_eq_of_lt ha, Nat.zero_add] + +theorem stackValue_add (b d e : ℕ) (a : ℕ → ℕ) : + stackValue b (d + e) a = stackValue b d a + b ^ d * stackValue b e (fun i => a (d + i)) := by + induction d generalizing a with + | zero => simp only [Nat.zero_add, stackValue, pow_zero, Nat.one_mul] + | succ d ih => + rw [Nat.succ_add, stackValue, ih, stackValue, pow_succ] + have he : (fun i => a (d + i + 1)) = (fun i => a (d + 1 + i)) := by + funext i + congr 1 + omega + rw [he] + ring + +theorem stackValue_extend (b d e : ℕ) (a : ℕ → ℕ) + (hz : ∀ i, d ≤ i → a i = 0) : stackValue b (d + e) a = stackValue b d a := by + rw [stackValue_add] + have he : stackValue b e (fun i => a (d + i)) = 0 := by + rw [stackValue_ext b e (a := fun i => a (d + i)) (c := fun _ => 0) + (fun i _ => hz _ (by omega)), stackValue_zero] + rw [he, Nat.mul_zero, Nat.add_zero] + +def configurationWidth (I : Alternating.MachineInput) (n : ℕ) : ℕ := I.2.length + 1 + 2 * n + +def leftDigits (C : Alternating.Configuration) (i : ℕ) : ℕ := + markedTape C (C.head - 1 - (i : ℤ)) + +def rightDigits (C : Alternating.Configuration) (i : ℕ) : ℕ := + markedTape C (C.head + (i : ℤ)) + +theorem configurationWidth_pos (I : Alternating.MachineInput) (n : ℕ) : + 0 < configurationWidth I n := by unfold configurationWidth; omega + +theorem configurationWidth_succ (I : Alternating.MachineInput) (n : ℕ) : + configurationWidth I (n + 1) = configurationWidth I n + 2 := by + unfold configurationWidth + omega + +theorem marked_tape_outside (I : Alternating.MachineInput) (n : ℕ) {j : ℤ} + (hj : j < -(n : ℤ) ∨ (I.2.length : ℤ) + n ≤ j) (hzero : j ≠ 0) : + markedTape (Alternating.configurationAt I n) j = 0 := by + rw [markedTape, Alternating.configurationAt_tape_outside I n hj] + simp [markedDigit, hzero] + +theorem leftDigits_zero (I : Alternating.MachineInput) (n i : ℕ) + (hi : configurationWidth I n ≤ i) : leftDigits (Alternating.configurationAt I n) i = 0 := by + have hh := Alternating.configurationAt_head_bounds I n + unfold configurationWidth at hi + apply marked_tape_outside I n + · left + omega + · omega + +theorem rightDigits_zero (I : Alternating.MachineInput) (n i : ℕ) + (hi : configurationWidth I n ≤ i) : rightDigits (Alternating.configurationAt I n) i = 0 := by + have hh := Alternating.configurationAt_head_bounds I n + unfold configurationWidth at hi + apply marked_tape_outside I n + · right + omega + · omega + +def configurationCode (I : Alternating.MachineInput) (n : ℕ) : ℕ := + let C := Alternating.configurationAt I n + let d := configurationWidth I n + pack (machineBase I.1) d + (stackValue (machineBase I.1) d (leftDigits C)) + (stackValue (machineBase I.1) d (rightDigits C)) C.state + +theorem configurationCode_lt (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (n : ℕ) : configurationCode I n < period (machineBase I.1) (configurationWidth I n) := by + have hv := Alternating.configurationAt_valid hI n + have hb : 0 < machineBase I.1 := lt_of_lt_of_le (by decide) (machineBase_two_le I.1) + apply pack_lt + · apply stackValue_lt hb + intro i _ + exact markedTape_lt hv _ + · apply stackValue_lt hb + intro i _ + exact markedTape_lt hv _ + · have h := machineBase_states I.1 + have hstate := hv.1 + omega + +end ForcedComputation.Lattice + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LoadedMachine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LoadedMachine.lean new file mode 100644 index 0000000000000000000000000000000000000000..66f4de474db954fce373c684626e0bc7e21cb401 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LoadedMachine.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ShiftedLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderAtHeight +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedBundle + +namespace OAI + +/-! Initialized computation at each paper's fixed rational particle label. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Recorder Set + +theorem initialized_observation_atHeight {p q : Fin 2 → ℚ} {z : ℚ} {body : Input} + (hl : ValidInput (shiftedLoader p q z)) (hb : ValidInput body) + {Φ Ψ Λ : ℝ → Space → Space} + (hΦ : IsMaterialFlow body.period + (initializedProgram (shiftedLoader p q z) body) Φ) + (hΨ : IsMaterialFlow body.period body.realizingVelocity Ψ) + (hΛ : IsMaterialFlow 1 (shiftedLoader p q z).realizingVelocity Λ) + {H : Prop} {upper : ℝ} + (hbody : (∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t (atHeight (fun j => (q j : ℝ)) (z : ℝ)) 0 ∧ + Ψ t (atHeight (fun j => (q j : ℝ)) (z : ℝ)) 0 < upper) ↔ H) + (hp : (p 0 : ℝ) ≤ 1 / 3) + (hq : ¬H → (q 0 : ℝ) ≤ 1 / 3) : + (∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t (atHeight (fun j => (p j : ℝ)) (z : ℝ)) 0 ∧ + Φ t (atHeight (fun j => (p j : ℝ)) (z : ℝ)) 0 < upper) ↔ H := by + have hΛ' : IsMaterialFlow (shiftedLoader p q z).period + (shiftedLoader p q z).realizingVelocity Λ := by + simpa only [shiftedLoader_period] using hΛ + have hload : Φ 1 (atHeight (fun j => (p j : ℝ)) (z : ℝ)) = + atHeight (fun j => (q j : ℝ)) (z : ℝ) := by + rw [initializedFlow_loading hl hb hΦ hΛ' _ (t := 1) (by norm_num)] + simpa only [shiftedLoader_height] using shiftedLoader_endpoint hl hΛ + constructor + · rintro ⟨t, ht, hx, hy⟩ + by_cases hlate : 1 ≤ t + · apply hbody.mp + refine ⟨t - 1, by linarith, ?_⟩ + rw [initializedFlow_tail hl hb hΦ hΨ _ hlate, hload] at hx hy + exact ⟨hx, hy⟩ + · by_contra hn + have hΛbound := shiftedLoader_first_le hl hΛ + (a := 1 / 3) hp (hq hn) + (show t ∈ Icc (0 : ℝ) 1 from ⟨ht, (lt_of_not_ge hlate).le⟩) + rw [initializedFlow_loading hl hb hΦ hΛ' _ ⟨ht, (lt_of_not_ge hlate).le⟩] at hx + linarith + · intro h + obtain ⟨t, ht, hx, hy⟩ := hbody.mpr h + refine ⟨t + 1, by linarith, ?_⟩ + rw [initializedFlow_tail hl hb hΦ hΨ _ (by linarith), hload] + simpa only [add_sub_cancel_right] using And.intro hx hy + + +theorem initialPointQ_nonhalting (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ¬Alternating.Halts I → (initialPointQ I hI 0 : ℝ) ≤ 1 / 3 := by + intro hno + have hc : recorderHalting I.1 (finiteInitializedRecorder I hI).control = false := by + cases hh : recorderHalting I.1 (finiteInitializedRecorder I hI).control with + | false => rfl + | true => + apply False.elim + apply hno + apply (finite_recorder_halts_iff I hI).mp + exact ⟨0, finiteInitializedRecorder I hI, initialState I.1, Steps.zero _, rfl, hh⟩ + have hB : (1 : ℝ) < radixBase I.1 := by exact_mod_cast radixBase_gt_one I.1 + have hd : ∀ a, (0 : ℝ) ≤ radixDigit I.1 a ∧ + (radixDigit I.1 a : ℝ) ≤ (radixBase I.1 : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds I.1 a).1, by linarith [(radixDigit_bounds I.1 a).2]⟩ + have he := Radix.encode_mem_unit hB hd (tapeAt (finiteInitializedRecorder I hI)).1 + have hκ : (0 : ℝ) < bandScale I.1 := by exact_mod_cast bandScale_pos I.1 + have hκ' : (bandScale I.1 : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le I.1) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + rw [show (initialPointQ I hI 0 : ℝ) = + codedPoint I.1 (finiteInitializedRecorder I hI) 0 from congrFun (initialPointQ_spec I hI) 0, + codedPoint_first, hc] + simp only [Bool.false_eq_true, ite_false] + nlinarith [he.2] + +def loadedMachineVelocity (p : Fin 2 → ℚ) (z : ℚ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := + initializedProgram (shiftedLoader p (initialPointQ I hI) z) + (recorderInputAtHeight I.1 hI.1 z) + +theorem loadedMachine_computation (p : Fin 2 → ℚ) (z : ℚ) + (hp : ∀ j, 1 / 8 ≤ p j ∧ p j ≤ 7 / 8) (hp0 : (p 0 : ℝ) ≤ 1 / 3) + (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (ν : ℝ) (hν : 0 < ν) : + InitializedFluidProperties 1 ν (loadedMachineVelocity p z I hI) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (loadedMachineVelocity p z I hI) Φ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t (atHeight (fun j => (p j : ℝ)) z) 0 ∧ + Φ t (atHeight (fun j => (p j : ℝ)) z) 0 < 1) := by + let loader := shiftedLoader p (initialPointQ I hI) z + let body := recorderInputAtHeight I.1 hI.1 z + have hl : ValidInput loader := shiftedLoader_valid p _ z hp (initialPointQ_bounds I hI) + have hb : ValidInput body := recorderInputAtHeight_valid I.1 hI.1 z + have hperiod : loader.period = body.period := rfl + have hp1 : (body.period : ℝ) = 1 := recorderInputAtHeight_period I.1 hI.1 z + have hproperties := initialized_bundle hl hb hperiod ν hν.le + rw [hp1] at hproperties + refine ⟨hproperties, ?_⟩ + obtain ⟨Φ, hΦ⟩ := initializedProgram_materialFlow hl hb hperiod + obtain ⟨Ψ, hΨ⟩ := realizingVelocity_materialFlow hb + obtain ⟨Λ, hΛ⟩ := realizingVelocity_materialFlow hl + have hΛ' : IsMaterialFlow 1 loader.realizingVelocity Λ := by + simpa only [loader, shiftedLoader_period] using hΛ + have hbody := recorder_flow_halting_iff_atHeight z I hI 1 (by norm_num) hΨ + rw [← initialPointQ_spec I hI] at hbody + have hevent := initialized_observation_atHeight hl hb hΦ hΨ hΛ' hbody hp0 + (initialPointQ_nonhalting I hI) + refine ⟨Φ, ?_, hevent.symm⟩ + change IsMaterialFlow 1 (initializedProgram loader body) Φ + simpa only [hp1] using hΦ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmName.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmName.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ff688681e218ef85b37160c73b28876f6065af5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmName.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! A terminating rational search for the logarithm of a positive named real. +The search compares certified exponential balls with the input name; it never +uses a test of equality or ordering on real numbers. -/ + +open Filter +open scoped Topology +open ShearFlows + +namespace ForcedComputation + +def logSearchData (n : ℕ) : ℚ × ℚ × ℕ := + (Encodable.decode (α := ℚ × ℚ × ℕ) n).getD (0, 0, 0) + +def logReady (a : ℕ → ℚ) (ε : ℚ) (n : ℕ) : Prop := + let d := logSearchData n + d.1 < d.2.1 ∧ d.2.1 - d.1 < 2 * ε ∧ + (expBall d.1 d.2.2).center + (expBall d.1 d.2.2).radius < + a d.2.2 - (2 : ℚ) ^ (-(d.2.2 : ℤ)) ∧ + a d.2.2 + (2 : ℚ) ^ (-(d.2.2 : ℤ)) < + (expBall d.2.1 d.2.2).center - (expBall d.2.1 d.2.2).radius + +instance (a : ℕ → ℚ) (ε : ℚ) (n : ℕ) : Decidable (logReady a ε n) := + inferInstanceAs (Decidable (_ ∧ _ ∧ _ ∧ _)) + +noncomputable section + +theorem errorTolerance_tendsto : Tendsto errorTolerance atTop (𝓝 (0 : ℝ)) := by + have h := tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 2) + (by norm_num : (1 / 2 : ℝ) < 1) + change Tendsto (fun n : ℕ => ((2 : ℝ) ^ n)⁻¹) atTop (𝓝 0) + simpa only [one_div, inv_pow] using h + +theorem fastRealName_tendsto {x : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a x) : + Tendsto (fun n => (a n : ℝ)) atTop (𝓝 x) := by + apply tendsto_iff_dist_tendsto_zero.mpr + apply squeeze_zero (fun n => dist_nonneg) + (fun n => by simpa only [Real.dist_eq, abs_sub_comm] using ha n) + errorTolerance_tendsto + +theorem logReady_exists {x : ℝ} (hx : 0 < x) {a : ℕ → ℚ} + (ha : IsFastRealName a x) {ε : ℚ} (hε : 0 < ε) : ∃ n, logReady a ε n := by + have hεR : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨l, hl₁, hl₂⟩ := exists_rat_btwn (show Real.log x - ε < Real.log x by linarith) + obtain ⟨u, hu₁, hu₂⟩ := exists_rat_btwn (show Real.log x < Real.log x + ε by linarith) + have hlx : Real.exp l < x := (Real.exp_lt_exp.mpr hl₂).trans_eq (Real.exp_log hx) + have hux : x < Real.exp u := (Real.exp_log hx).symm.trans_lt (Real.exp_lt_exp.mpr hu₁) + have hleft := ((expBall_converges l).1.add (expBall_converges l).2).eventually_lt + ((fastRealName_tendsto ha).sub errorTolerance_tendsto) (by simpa using hlx) + have hright := ((fastRealName_tendsto ha).add errorTolerance_tendsto).eventually_lt + ((expBall_converges u).1.sub (expBall_converges u).2) (by simpa using hux) + obtain ⟨k, hkL, hkU⟩ := (hleft.and hright).exists + refine ⟨Encodable.encode (l, u, k), ?_⟩ + have hd : logSearchData (Encodable.encode (l, u, k)) = (l, u, k) := by + simp only [logSearchData, Encodable.encodek, Option.getD_some] + rw [logReady, hd] + refine ⟨?_, ?_, ?_, ?_⟩ + · exact_mod_cast hl₂.trans hu₁ + · exact_mod_cast (show (u : ℝ) - l < 2 * (ε : ℝ) by linarith) + · have he : (((2 : ℚ) ^ (-(k : ℤ))) : ℝ) = errorTolerance k := by + simp [errorTolerance, zpow_neg, zpow_natCast] + exact_mod_cast (show (expBall l k).center + (expBall l k).radius < + (a k : ℝ) - ((2 : ℚ) ^ (-(k : ℤ)) : ℝ) by simpa only [he] using hkL) + · have he : (((2 : ℚ) ^ (-(k : ℤ))) : ℝ) = errorTolerance k := by + simp [errorTolerance, zpow_neg, zpow_natCast] + exact_mod_cast (show (a k : ℝ) + ((2 : ℚ) ^ (-(k : ℤ)) : ℝ) < + (expBall u k).center - (expBall u k).radius by simpa only [he] using hkU) + +end + +/-- Rational bisection is not required: an exhaustive finite search of strict +certified brackets terminates for every positive input. -/ +def logApprox {x : ℝ} (a : ℕ → ℚ) (hx : 0 < x) (ha : IsFastRealName a x) + (ε : ℚ) (hε : 0 < ε) : ℚ := + let d := logSearchData (Nat.find (logReady_exists hx ha hε)) + (d.1 + d.2.1) / 2 + +noncomputable section + +theorem logApprox_spec {x : ℝ} (a : ℕ → ℚ) (hx : 0 < x) (ha : IsFastRealName a x) + (ε : ℚ) (hε : 0 < ε) : |Real.log x - (logApprox a hx ha ε hε : ℝ)| ≤ ε := by + let n := Nat.find (logReady_exists hx ha hε) + let d := logSearchData n + obtain ⟨hlu, hwidth, hl, hu⟩ := Nat.find_spec (logReady_exists hx ha hε) + change d.1 < d.2.1 at hlu + change d.2.1 - d.1 < 2 * ε at hwidth + change (expBall d.1 d.2.2).center + (expBall d.1 d.2.2).radius < + a d.2.2 - (2 : ℚ) ^ (-(d.2.2 : ℤ)) at hl + change a d.2.2 + (2 : ℚ) ^ (-(d.2.2 : ℤ)) < + (expBall d.2.1 d.2.2).center - (expBall d.2.1 d.2.2).radius at hu + have hlow := expBall_contains d.1 d.2.2 + have hhigh := expBall_contains d.2.1 d.2.2 + have hname := ha d.2.2 + have htol : (2 : ℝ) ^ (-(d.2.2 : ℤ)) = errorTolerance d.2.2 := by + simp [errorTolerance, zpow_neg, zpow_natCast] + have hlR := (Rat.cast_lt (K := ℝ)).mpr hl + have huR := (Rat.cast_lt (K := ℝ)).mpr hu + push_cast at hlR huR + rw [htol] at hlR huR + have heL : Real.exp (d.1 : ℝ) < x := by + dsimp only [QBall.Contains] at hlow + linarith [(abs_le.mp hlow).2, (abs_le.mp hname).1] + have heU : x < Real.exp (d.2.1 : ℝ) := by + dsimp only [QBall.Contains] at hhigh + linarith [(abs_le.mp hhigh).1, (abs_le.mp hname).2] + have hlLog : (d.1 : ℝ) < Real.log x := (Real.lt_log_iff_exp_lt hx).mpr heL + have huLog : Real.log x < (d.2.1 : ℝ) := (Real.log_lt_iff_lt_exp hx).mpr heU + have hw : (d.2.1 : ℝ) - d.1 < 2 * (ε : ℝ) := by exact_mod_cast hwidth + change |Real.log x - (((d.1 + d.2.1) / 2 : ℚ) : ℝ)| ≤ ε + push_cast + rw [abs_le] + constructor <;> linarith + +end + +def logFastName {x : ℝ} (a : ℕ → ℚ) (hx : 0 < x) (ha : IsFastRealName a x) : ℕ → ℚ := + fun n => logApprox a hx ha ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + +theorem logFastName_spec {x : ℝ} (a : ℕ → ℚ) (hx : 0 < x) (ha : IsFastRealName a x) : + IsFastRealName (logFastName a hx ha) (Real.log x) := by + intro n + have h := logApprox_spec a hx ha ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + simpa [logFastName, errorTolerance] using h + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..02e97146a5a1380de48ecb9a7ad95ab77beef405 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicBounds.lean @@ -0,0 +1,185 @@ +import Mathlib + +namespace OAI + +/-! +# Derivative bounds for the logarithmic clock + +This is the analytic calculation in Lemma `bcs:clock` of *Scalar Potentials +and Slow Clocks for Forced Fluid Computation*. It proves the decay of every +time derivative, rather than assuming decay of the reparametrized field. +-/ + +noncomputable section + +open Filter +open scoped Topology ContDiff + +namespace ForcedComputation + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def logarithmicProfile (r : ℕ) (A : ℝ → E) (t : ℝ) : E := + (1 + t)⁻¹ ^ r • A (Real.log (1 + t)) + +def phaseDerivative (r : ℕ) (A : ℝ → E) (s : ℝ) : E := + deriv A s - (r : ℝ) • A s + +def phaseIter (r : ℕ) (A : ℝ → E) : ℕ → ℝ → E := + Nat.rec A (fun n phase => phaseDerivative (r + n) phase) + +theorem logarithmicProfile_contDiffAt (r : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) {t : ℝ} (ht : -1 < t) : + ContDiffAt ℝ ∞ (logarithmicProfile r A) t := by + have hp : 1 + t ≠ 0 := by linarith + have hb : ContDiffAt ℝ ∞ (fun s : ℝ => 1 + s) t := + contDiffAt_const.add contDiffAt_id + exact ((hb.inv hp).pow r).smul (hA.contDiffAt.comp t (hb.log hp)) + +theorem logarithmicProfile_hasDerivAt (r : ℕ) {A : ℝ → E} + {t : ℝ} (ht : -1 < t) (hA : DifferentiableAt ℝ A (Real.log (1 + t))) : + HasDerivAt (logarithmicProfile r A) + (logarithmicProfile (r + 1) (phaseDerivative r A) t) t := by + have hp : 0 < 1 + t := by linarith + have hbase := (hasDerivAt_id t).const_add 1 + have hlog := hbase.log hp.ne' + have hpow := (hbase.inv hp.ne').pow r + have h := hpow.smul (hA.hasDerivAt.scomp t hlog) + simp only [Pi.pow_apply, Pi.inv_apply, Function.comp_apply, id_eq] at h + have hfrac : -(1 : ℝ) / (1 + t) ^ 2 = -((1 + t)⁻¹ ^ 2) := by + rw [neg_div, one_div, inv_pow] + rw [hfrac] at h + convert h using 1 + · rfl + · cases r with + | zero => simp [logarithmicProfile, phaseDerivative] + | succ r => + simp only [logarithmicProfile, phaseDerivative, Nat.cast_add, Nat.cast_one, + Nat.add_sub_cancel, one_div, pow_succ, + smul_sub, smul_smul] + module + +theorem phaseDerivative_smooth (r : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) : ContDiff ℝ ∞ (phaseDerivative r A) := by + exact (contDiff_infty_iff_deriv.mp hA).2.sub (hA.const_smul (r : ℝ)) + +theorem phaseIter_smooth (r : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) (n : ℕ) : ContDiff ℝ ∞ (phaseIter r A n) := by + induction n with + | zero => exact hA + | succ n ih => exact phaseDerivative_smooth (r + n) ih + +theorem iteratedDeriv_logarithmicProfile (r n : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) {t : ℝ} (ht : -1 < t) : + iteratedDeriv n (logarithmicProfile r A) t = + logarithmicProfile (r + n) (phaseIter r A n) t := by + induction n generalizing t with + | zero => simp [phaseIter] + | succ n ih => + rw [iteratedDeriv_succ] + have he : iteratedDeriv n (logarithmicProfile r A) =ᶠ[𝓝 t] + logarithmicProfile (r + n) (phaseIter r A n) := + (eventually_gt_nhds ht).mono fun s hs => ih hs + rw [he.deriv_eq] + simpa only [phaseIter, Nat.add_assoc] using + (logarithmicProfile_hasDerivAt (r + n) ht + ((phaseIter_smooth r hA n).differentiable (by simp) _)).deriv + +def HasBoundedTimeDerivatives (A : ℝ → E) : Prop := + ∀ n : ℕ, ∃ C : ℝ, 0 ≤ C ∧ ∀ s : ℝ, ‖iteratedDeriv n A s‖ ≤ C + +theorem iteratedDeriv_phaseDerivative (r n : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) (s : ℝ) : + iteratedDeriv n (phaseDerivative r A) s = + iteratedDeriv (n + 1) A s - (r : ℝ) • iteratedDeriv n A s := by + have hderiv : ContDiff ℝ ∞ (deriv A) := (contDiff_infty_iff_deriv.mp hA).2 + have hd : ContDiffAt ℝ n (deriv A) s := hderiv.contDiffAt.of_le (by simp) + have ha : ContDiffAt ℝ n (fun s => (r : ℝ) • A s) s := + (hA.const_smul (r : ℝ)).contDiffAt.of_le (by simp) + change iteratedDeriv n (fun t => deriv A t - (r : ℝ) • A t) s = _ + rw [iteratedDeriv_fun_sub hd ha, iteratedDeriv_fun_const_smul_field, + iteratedDeriv_succ'] + +theorem phaseDerivative_bounded (r : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) (hbound : HasBoundedTimeDerivatives A) : + HasBoundedTimeDerivatives (phaseDerivative r A) := by + intro n + obtain ⟨C, hC, hCbound⟩ := hbound (n + 1) + obtain ⟨D, hD, hDbound⟩ := hbound n + refine ⟨C + (r : ℝ) * D, by positivity, fun s => ?_⟩ + rw [iteratedDeriv_phaseDerivative r n hA] + calc + _ ≤ ‖iteratedDeriv (n + 1) A s‖ + ‖(r : ℝ) • iteratedDeriv n A s‖ := norm_sub_le _ _ + _ = ‖iteratedDeriv (n + 1) A s‖ + (r : ℝ) * ‖iteratedDeriv n A s‖ := by + rw [norm_smul, Real.norm_of_nonneg (Nat.cast_nonneg r)] + _ ≤ C + (r : ℝ) * D := add_le_add (hCbound s) + (mul_le_mul_of_nonneg_left (hDbound s) (Nat.cast_nonneg r)) + +theorem phaseIter_bounded (r : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) (hbound : HasBoundedTimeDerivatives A) (n : ℕ) : + HasBoundedTimeDerivatives (phaseIter r A n) := by + induction n with + | zero => exact hbound + | succ n ih => exact phaseDerivative_bounded (r + n) (phaseIter_smooth r hA n) ih + +/-- Each time derivative gains a full inverse power of physical time. -/ +theorem logarithmicProfile_decay (r n : ℕ) {A : ℝ → E} + (hA : ContDiff ℝ ∞ A) (hbound : HasBoundedTimeDerivatives A) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t : ℝ, 0 ≤ t → + ‖iteratedDeriv n (logarithmicProfile r A) t‖ ≤ C * (1 + t)⁻¹ ^ (r + n) := by + obtain ⟨C, hC, hboundC⟩ := phaseIter_bounded r hA hbound n 0 + refine ⟨C, hC, fun t ht => ?_⟩ + rw [iteratedDeriv_logarithmicProfile r n hA (by linarith), logarithmicProfile, + norm_smul, Real.norm_of_nonneg (by positivity : 0 ≤ (1 + t)⁻¹ ^ (r + n))] + exact (mul_le_mul_of_nonneg_left (hboundC _) (by positivity)).trans_eq (mul_comm _ _) + +section Uniform + +variable {ι : Type*} + +/-- Bounds uniform in the spatial point (or a spatial derivative index). -/ +def UniformTimeBounds (A : ι → ℝ → E) : Prop := + ∀ n : ℕ, ∃ C : ℝ, 0 ≤ C ∧ ∀ x : ι, ∀ s : ℝ, ‖iteratedDeriv n (A x) s‖ ≤ C + +theorem phaseDerivative_uniform (r : ℕ) {A : ι → ℝ → E} + (hA : ∀ x, ContDiff ℝ ∞ (A x)) (hbound : UniformTimeBounds A) : + UniformTimeBounds (fun x => phaseDerivative r (A x)) := by + intro n + obtain ⟨C, hC, hCbound⟩ := hbound (n + 1) + obtain ⟨D, hD, hDbound⟩ := hbound n + refine ⟨C + (r : ℝ) * D, by positivity, fun x s => ?_⟩ + rw [iteratedDeriv_phaseDerivative r n (hA x)] + calc + _ ≤ ‖iteratedDeriv (n + 1) (A x) s‖ + ‖(r : ℝ) • iteratedDeriv n (A x) s‖ := + norm_sub_le _ _ + _ = ‖iteratedDeriv (n + 1) (A x) s‖ + (r : ℝ) * ‖iteratedDeriv n (A x) s‖ := by + rw [norm_smul, Real.norm_of_nonneg (Nat.cast_nonneg r)] + _ ≤ C + (r : ℝ) * D := add_le_add (hCbound x s) + (mul_le_mul_of_nonneg_left (hDbound x s) (Nat.cast_nonneg r)) + +theorem phaseIter_uniform (r : ℕ) {A : ι → ℝ → E} + (hA : ∀ x, ContDiff ℝ ∞ (A x)) (hbound : UniformTimeBounds A) (n : ℕ) : + UniformTimeBounds (fun x => phaseIter r (A x) n) := by + induction n with + | zero => exact hbound + | succ n ih => + exact phaseDerivative_uniform (r + n) (fun x => phaseIter_smooth r (hA x) n) ih + +theorem logarithmicProfile_uniform_decay (r n : ℕ) {A : ι → ℝ → E} + (hA : ∀ x, ContDiff ℝ ∞ (A x)) (hbound : UniformTimeBounds A) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x : ι, ∀ t : ℝ, 0 ≤ t → + ‖iteratedDeriv n (logarithmicProfile r (A x)) t‖ ≤ + C * (1 + t)⁻¹ ^ (r + n) := by + obtain ⟨C, hC, hboundC⟩ := phaseIter_uniform r hA hbound n 0 + refine ⟨C, hC, fun x t ht => ?_⟩ + rw [iteratedDeriv_logarithmicProfile r n (hA x) (by linarith), logarithmicProfile, + norm_smul, Real.norm_of_nonneg (by positivity : 0 ≤ (1 + t)⁻¹ ^ (r + n))] + exact (mul_le_mul_of_nonneg_left (hboundC x _) (by positivity)).trans_eq (mul_comm _ _) + +end Uniform + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicForce.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicForce.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c9862203162517847699b55836144be05c38da3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicForce.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualScaling +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Reparametrization + +namespace OAI + +/-! +# The force produced by a logarithmic clock + +This is the residual calculation in the slow-clock construction, with the +linear viscous term separated from the quadratic material acceleration. +-/ + +noncomputable section +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +def slowVelocity (V : Velocity) : Velocity := + reparametrizedVelocity logClock (fun t => (1 + t)⁻¹) V + +def quadraticPhase (V : Velocity) (x : Space) (s : ℝ) : Space := + timeDerivative V s x + advection (fun y => V (s, y)) x - V (s, x) + +def viscousPhase (V : Velocity) (x : Space) (s : ℝ) : Space := + laplacian (fun y => V (s, y)) x + +def slowForce (ν : ℝ) (V : Velocity) : Velocity := fun y => + logarithmicProfile 2 (quadraticPhase V y.2) y.1 - + ν • logarithmicProfile 1 (viscousPhase V y.2) y.1 + +theorem slowForce_eq_residual (ν : ℝ) {V : Velocity} {t : ℝ} (ht : 0 ≤ t) + (x : Space) (hV : DifferentiableAt ℝ (fun s => V (s, x)) (logClock t)) : + slowForce ν V (t, x) = residual ν (slowVelocity V) (t, x) := by + have hp : 1 + t ≠ 0 := by linarith + have hτ : HasDerivAt logClock ((1 + t)⁻¹) t := by + simpa only [one_div] using logClock_hasDerivAt ht + have ha : HasDerivAt (fun s : ℝ => (1 + s)⁻¹) (-((1 + t)⁻¹ ^ 2)) t := by + convert ((hasDerivAt_id t).const_add 1).inv hp using 1 <;> + simp [one_div, inv_pow, neg_div] + rfl + rw [slowVelocity, residual_reparametrization ν hτ ha x hV] + simp only [slowForce, quadraticPhase, viscousPhase, logarithmicProfile, + logClock, pow_one, smul_sub, smul_add, neg_smul] + module + +/-- Uniform phase derivative bounds give exactly the slow-clock force estimate. +The hypotheses refer to the original bounded periodic profiles, not to the +force or to its desired decay. -/ +theorem slowForce_time_decay (ν : ℝ) {V : Velocity} + (hQ : ∀ x, ContDiff ℝ ∞ (quadraticPhase V x)) + (hD : ∀ x, ContDiff ℝ ∞ (viscousPhase V x)) + (hQB : UniformTimeBounds (quadraticPhase V)) + (hDB : UniformTimeBounds (viscousPhase V)) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => slowForce ν V (s, x)) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n) := by + obtain ⟨A, hA, hQA⟩ := logarithmicProfile_uniform_decay 2 n hQ hQB + obtain ⟨B, hB, hDB⟩ := logarithmicProfile_uniform_decay 1 n hD hDB + refine ⟨A + ‖ν‖ * B, by positivity, fun x t ht => ?_⟩ + have hqt := logarithmicProfile_contDiffAt 2 (hQ x) (show -1 < t by linarith) + have hdt := logarithmicProfile_contDiffAt 1 (hD x) (show -1 < t by linarith) + change ‖iteratedDeriv n (fun s => logarithmicProfile 2 (quadraticPhase V x) s - + ν • logarithmicProfile 1 (viscousPhase V x) s) t‖ ≤ _ + rw [iteratedDeriv_fun_sub (hqt.of_le (by simp)) + ((hdt.const_smul ν).of_le (by simp)), iteratedDeriv_fun_const_smul_field] + have hinv : 0 ≤ (1 + t)⁻¹ := by positivity + have hinvle : (1 + t)⁻¹ ≤ 1 := by + exact (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + have hpow : (1 + t)⁻¹ ^ (2 + n) ≤ (1 + t)⁻¹ ^ (1 + n) := by + calc + _ = (1 + t)⁻¹ ^ (1 + n) * (1 + t)⁻¹ := by rw [← pow_succ]; congr 1; omega + _ ≤ (1 + t)⁻¹ ^ (1 + n) * 1 := + mul_le_mul_of_nonneg_left hinvle (pow_nonneg hinv _) + _ = _ := mul_one _ + calc + _ ≤ ‖iteratedDeriv n (logarithmicProfile 2 (quadraticPhase V x)) t‖ + + ‖ν • iteratedDeriv n (logarithmicProfile 1 (viscousPhase V x)) t‖ := norm_sub_le _ _ + _ ≤ A * (1 + t)⁻¹ ^ (2 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := by + rw [norm_smul] + exact add_le_add (hQA x t ht) (mul_le_mul_of_nonneg_left (hDB x t ht) (norm_nonneg ν)) + _ ≤ A * (1 + t)⁻¹ ^ (1 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := + add_le_add (mul_le_mul_of_nonneg_left hpow hA) le_rfl + _ = _ := by ring + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpace.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1cf310f12aef99ada38f4cff41f1beb8cb3fe02 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpace.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicProfiles + +namespace OAI + +/-! Spatial derivatives of the slow clock retain its full time decay. -/ + +noncomputable section +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +def spatialWord : List (Fin 3) → (Space → Space) → Space → Space + | [], U => U + | j :: α, U => derivative (spatialWord α U) j + +theorem spatialWord_smul (α : List (Fin 3)) (a : ℝ) (U : Space → Space) : + spatialWord α (fun x => a • U x) = fun x => a • spatialWord α U x := by + induction α with + | nil => rfl + | cons j α ih => + simp only [spatialWord, ih] + funext x + exact derivative_smul a _ j x + +def spatialPhase (V : Velocity) (α : List (Fin 3)) : Velocity := + fun y => spatialWord α (fun x => V (y.1, x)) y.2 + +theorem spatialPhase_eq_mixed {V : Velocity} (hV : ContDiff ℝ ∞ V) (α : List (Fin 3)) : + spatialPhase V α = mixedDerivative V (α.map Fin.succ) := by + induction α with + | nil => rfl + | cons j α ih => + funext y + change derivative (fun x => spatialPhase V α (y.1, x)) j y.2 = _ + rw [ih, spatialDerivative_eq_mixed (mixedDerivative_smooth hV _)] + rfl + +theorem spatialPhase_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) (α : List (Fin 3)) : + ContDiff ℝ ∞ (spatialPhase V α) := by + rw [spatialPhase_eq_mixed hV] + exact mixedDerivative_smooth hV _ + +theorem spatialPhase_uniformTimeBounds {L : ℝ} (hL : 0 < L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) + (α : List (Fin 3)) : UniformTimeBounds (fun x s => spatialPhase V α (s, x)) := by + rw [spatialPhase_eq_mixed hV] + exact periodic_uniformTimeBounds hL (mixedDerivative_smooth hV _) + (mixedDerivative_spatially_periodic hV hs _) (mixedDerivative_time_periodic hV ht _) + +theorem spatialWord_logarithmicProfile (r : ℕ) (V : Velocity) (α : List (Fin 3)) + (t : ℝ) (x : Space) : + spatialWord α (fun y => logarithmicProfile r (fun s => V (s, y)) t) x = + logarithmicProfile r (fun s => spatialPhase V α (s, x)) t := by + exact congrFun (spatialWord_smul α ((1 + t)⁻¹ ^ r) + (fun y => V (Real.log (1 + t), y))) x + +theorem periodic_profile_mixed_decay {L : ℝ} (hL : 0 < L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) + (r n : ℕ) (α : List (Fin 3)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n + (fun s => spatialWord α (fun y => logarithmicProfile r (fun q => V (q, y)) s) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (r + n) := by + have hphase (x : Space) : ContDiff ℝ ∞ (fun s => spatialPhase V α (s, x)) := + (spatialPhase_smooth hV α).comp (contDiff_id.prodMk contDiff_const) + obtain ⟨C, hC, hb⟩ := logarithmicProfile_uniform_decay r n hphase + (spatialPhase_uniformTimeBounds hL hV hs ht α) + refine ⟨C, hC, fun x t ht => ?_⟩ + have he : (fun s => spatialWord α (fun y => logarithmicProfile r (fun q => V (q, y)) s) x) = + logarithmicProfile r (fun s => spatialPhase V α (s, x)) := + funext (fun s => spatialWord_logarithmicProfile r V α s x) + rw [he] + exact hb x t ht + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpatialForce.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpatialForce.lean new file mode 100644 index 0000000000000000000000000000000000000000..860df8337f1648fdf5042a20e107ca8204a902df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/LogarithmicSpatialForce.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicSpace + +namespace OAI + +/-! Every spatial derivative of the slow force has the same integrable time +decay. The phase fields are the actual acceleration and Laplacian of the +original periodic velocity. -/ + +noncomputable section +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +theorem spatialWord_smooth {U : Space → Space} (hU : ContDiff ℝ ∞ U) + (α : List (Fin 3)) : ContDiff ℝ ∞ (spatialWord α U) := by + induction α with + | nil => exact hU + | cons j α ih => exact (ih.fderiv_right (by simp)).clm_apply contDiff_const + +theorem spatialWord_sub {U V : Space → Space} (hU : ContDiff ℝ ∞ U) + (hV : ContDiff ℝ ∞ V) (α : List (Fin 3)) : + spatialWord α (fun x => U x - V x) = fun x => spatialWord α U x - spatialWord α V x := by + induction α with + | nil => rfl + | cons j α ih => + simp only [spatialWord, ih] + funext x + unfold derivative + change (fderiv ℝ (spatialWord α U - spatialWord α V) x) (basis j) = _ + rw [fderiv_sub ((spatialWord_smooth hU α).differentiable (by simp) x) + ((spatialWord_smooth hV α).differentiable (by simp) x)] + rfl + +theorem spatialWord_slowForce {V : Velocity} (hV : ContDiff ℝ ∞ V) + (ν : ℝ) (α : List (Fin 3)) (t : ℝ) (x : Space) : + spatialWord α (fun y => slowForce ν V (t, y)) x = + logarithmicProfile 2 + (fun s => spatialPhase (fun y => quadraticPhase V y.2 y.1) α (s, x)) t - + ν • logarithmicProfile 1 + (fun s => spatialPhase (fun y => viscousPhase V y.2 y.1) α (s, x)) t := by + have hQ : ContDiff ℝ ∞ (fun y : Space => quadraticPhase V y (Real.log (1 + t))) := + (quadraticPhase_smooth hV).comp (contDiff_const.prodMk contDiff_id) + have hD : ContDiff ℝ ∞ (fun y : Space => viscousPhase V y (Real.log (1 + t))) := + (viscousPhase_smooth hV).comp (contDiff_const.prodMk contDiff_id) + change spatialWord α (fun y => + logarithmicProfile 2 (quadraticPhase V y) t - + ν • logarithmicProfile 1 (viscousPhase V y) t) x = _ + have hPQ : ContDiff ℝ ∞ (fun y => logarithmicProfile 2 (quadraticPhase V y) t) := + hQ.const_smul ((1 + t)⁻¹ ^ 2) + have hPD : ContDiff ℝ ∞ (fun y => ν • logarithmicProfile 1 (viscousPhase V y) t) := + (hD.const_smul ((1 + t)⁻¹ ^ 1)).const_smul ν + rw [spatialWord_sub hPQ hPD, spatialWord_smul] + exact congrArg₂ (fun a b : Space => a - ν • b) + (spatialWord_logarithmicProfile 2 (fun y => quadraticPhase V y.2 y.1) α t x) + (spatialWord_logarithmicProfile 1 (fun y => viscousPhase V y.2 y.1) α t x) + +theorem periodic_slowForce_spatial_time_decay {L : ℝ} (hL : 0 < L) + (ν : ℝ) {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) + (α : List (Fin 3)) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => spatialWord α (fun y => slowForce ν V (s, y)) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n) := by + let Q : Velocity := fun y => quadraticPhase V y.2 y.1 + let D : Velocity := fun y => viscousPhase V y.2 y.1 + have hQ : ContDiff ℝ ∞ Q := quadraticPhase_smooth hV + have hD : ContDiff ℝ ∞ D := viscousPhase_smooth hV + obtain ⟨A, hA, hQA⟩ := periodic_profile_mixed_decay hL hQ + (quadraticPhase_spatially_periodic hV hs) (quadraticPhase_time_periodic hV ht) 2 n α + obtain ⟨B, hB, hDB⟩ := periodic_profile_mixed_decay hL hD + (viscousPhase_spatially_periodic hV hs) (viscousPhase_time_periodic hV ht) 1 n α + refine ⟨A + ‖ν‖ * B, by positivity, fun x t ht0 => ?_⟩ + have hQx : ContDiff ℝ ∞ (fun s => spatialPhase Q α (s, x)) := + (spatialPhase_smooth hQ α).comp (contDiff_id.prodMk contDiff_const) + have hDx : ContDiff ℝ ∞ (fun s => spatialPhase D α (s, x)) := + (spatialPhase_smooth hD α).comp (contDiff_id.prodMk contDiff_const) + have hqt := logarithmicProfile_contDiffAt 2 hQx (show -1 < t by linarith) + have hdt := logarithmicProfile_contDiffAt 1 hDx (show -1 < t by linarith) + have he : (fun s => spatialWord α (fun y => slowForce ν V (s, y)) x) = + fun s => logarithmicProfile 2 (fun q => spatialPhase Q α (q, x)) s - + ν • logarithmicProfile 1 (fun q => spatialPhase D α (q, x)) s := + funext (fun s => spatialWord_slowForce hV ν α s x) + rw [he, iteratedDeriv_fun_sub (hqt.of_le (by simp)) + ((hdt.const_smul ν).of_le (by simp)), iteratedDeriv_fun_const_smul_field] + have hQA' := hQA x t ht0 + have hDB' := hDB x t ht0 + simp_rw [spatialWord_logarithmicProfile] at hQA' hDB' + have hinv : 0 ≤ (1 + t)⁻¹ := by positivity + have hinvle : (1 + t)⁻¹ ≤ 1 := + (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + have hpow : (1 + t)⁻¹ ^ (2 + n) ≤ (1 + t)⁻¹ ^ (1 + n) := by + calc + _ = (1 + t)⁻¹ ^ (1 + n) * (1 + t)⁻¹ := by rw [← pow_succ]; congr 1; omega + _ ≤ (1 + t)⁻¹ ^ (1 + n) * 1 := + mul_le_mul_of_nonneg_left hinvle (pow_nonneg hinv _) + _ = _ := mul_one _ + calc + _ ≤ ‖iteratedDeriv n (logarithmicProfile 2 (fun q => spatialPhase Q α (q, x))) t‖ + + ‖ν • iteratedDeriv n (logarithmicProfile 1 (fun q => spatialPhase D α (q, x))) t‖ := + norm_sub_le _ _ + _ ≤ A * (1 + t)⁻¹ ^ (2 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := by + rw [norm_smul] + exact add_le_add hQA' (mul_le_mul_of_nonneg_left hDB' (norm_nonneg ν)) + _ ≤ A * (1 + t)⁻¹ ^ (1 + n) + ‖ν‖ * (B * (1 + t)⁻¹ ^ (1 + n)) := + add_le_add (mul_le_mul_of_nonneg_left hpow hA) le_rfl + _ = _ := by ring + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachineDecisionInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachineDecisionInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d180218c32bd700c9035cac72f3ed066fc54257 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachineDecisionInput.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Model + +namespace OAI + +/-! The machine-theoretic published input for the decision corollaries. + +A. M. Turing, On computable numbers, with an application to the +Entscheidungsproblem, Proc. London Math. Soc. (2) 42 (1936–1937), 230–265, +Section 8, printed p.248: undecidability of ever printing a designated symbol. +No fluid event, force compiler, or geometric conclusion is assumed. +-/ + +namespace ForcedComputation + +/-- The standard halting undecidability specialization to finite one-tape +machine tables. Correctness is required on every well-formed finite input. -/ +def FiniteMachineHaltingUndecidable : Prop := + ¬ ∃ d : Alternating.MachineInput → Bool, Computable d ∧ + ∀ I, Alternating.ValidInput I → (d I = true ↔ Alternating.Halts I) + +/-- No total algorithm on the finite source descriptions decides the given +observation for all valid compiled inputs. -/ +def NoCompiledInputDecider + (event : (I : Alternating.MachineInput) → Alternating.ValidInput I → Prop) : Prop := + ¬ ∃ d : Alternating.MachineInput → Bool, Computable d ∧ + ∀ I hI, d I = true ↔ event I hI + +theorem noCompiledInputDecider_of_halting (hT : FiniteMachineHaltingUndecidable) + {event : (I : Alternating.MachineInput) → Alternating.ValidInput I → Prop} + (he : ∀ I hI, event I hI ↔ Alternating.Halts I) : NoCompiledInputDecider event := by + rintro ⟨d, hd, hcorrect⟩ + exact hT ⟨d, hd, fun I hI => (hcorrect I hI).trans (he I hI)⟩ + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachinePartialStep.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachinePartialStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..579cbf92c2320f09d0c52b8954cf4e046de45643 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MachinePartialStep.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Model +import Mathlib.Computability.StateTransition + +namespace OAI + +/-! Partial execution semantics for the finite table model. A missing table +entry stops this semantics immediately; the existing total semantics records +the same event by entering its distinguished terminal state. -/ + +namespace ForcedComputation.FiniteMachine + +open Alternating + +def partialStep (M : Machine) (c : Configuration) : Option Configuration := + if M.isHalting c.state then none else + (M.instruction c.state (c.tape c.head)).map fun i => + { state := i.1 + head := c.head + (i.2.2.val : ℤ) - 1 + tape := Function.update c.tape c.head i.2.1 } + +theorem step_of_partialStep_some (M : Machine) {c c' : Configuration} + (h : partialStep M c = some c') : M.step c = c' := by + unfold partialStep at h + split at h + · contradiction + · rename_i hn + cases hi : M.instruction c.state (c.tape c.head) with + | none => simp [hi] at h + | some i => + simp only [hi, Option.map_some, Option.some.injEq] at h + simp only [Machine.step, hn, Bool.false_eq_true, ↓reduceIte, hi] + exact h + +theorem halting_after_partialStep_none (M : Machine) {c : Configuration} + (h : partialStep M c = none) : M.isHalting (M.step c).state = true := by + unfold partialStep at h + split at h + · rename_i hh + rw [Machine.step, ite_eq_left hh] + exact hh + · rename_i hn + have hi : M.instruction c.state (c.tape c.head) = none := by + simpa only [Option.map_eq_none_iff] using h + rw [Machine.step, ite_eq_right hn, hi] + simp [Machine.isHalting] + +theorem partialStep_none_of_halting (M : Machine) {c : Configuration} + (h : M.isHalting c.state = true) : partialStep M c = none := by + simp only [partialStep, h, ↓reduceIte] + +theorem reaches_iterate (M : Machine) {c c' : Configuration} + (h : StateTransition.Reaches (partialStep M) c c') : + ∃ n : ℕ, M.step^[n] c = c' := by + induction h with + | refl => exact ⟨0, rfl⟩ + | @tail b d _ hd ih => + obtain ⟨n, hn⟩ := ih + refine ⟨n + 1, ?_⟩ + rw [Function.iterate_succ_apply', hn] + exact step_of_partialStep_some M hd + +theorem eval_dom_iff (M : Machine) (c : Configuration) : + (StateTransition.eval (partialStep M) c).Dom ↔ + ∃ n : ℕ, M.isHalting (M.step^[n] c).state = true := by + constructor + · intro h + obtain ⟨d, hd⟩ := Part.dom_iff_mem.mp h + obtain ⟨hr, hs⟩ := StateTransition.mem_eval.mp hd + obtain ⟨n, hn⟩ := reaches_iterate M hr + refine ⟨n + 1, ?_⟩ + rw [Function.iterate_succ_apply', hn] + exact halting_after_partialStep_none M hs + · rintro ⟨n, hn⟩ + induction n generalizing c with + | zero => + exact Part.dom_iff_mem.mpr ⟨c, + StateTransition.mem_eval.mpr ⟨.refl, partialStep_none_of_halting M hn⟩⟩ + | succ n ih => + cases hs : partialStep M c with + | none => + exact Part.dom_iff_mem.mpr ⟨c, StateTransition.mem_eval.mpr ⟨.refl, hs⟩⟩ + | some d => + have hstep := step_of_partialStep_some M hs + have hd : (StateTransition.eval (partialStep M) d).Dom := by + apply ih + simpa only [Function.iterate_succ_apply, hstep] using hn + have he := StateTransition.reaches_eval + (Relation.ReflTransGen.single hs) + rw [he] + exact hd + +theorem halts_iff_eval_dom (I : MachineInput) : + Halts I ↔ (StateTransition.eval (partialStep I.1) + (initialConfiguration I.2)).Dom := + (eval_dom_iff I.1 (initialConfiguration I.2)).symm + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedNormalFormData.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedNormalFormData.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0ed5dd8884456618ec4a609739fe405a0b3716c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedNormalFormData.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MixedOrdering + +namespace OAI + +/-! A computable ordering of mixed derivatives for the finite evaluator. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def timeSpaceWord : List (Fin 4) → ℕ × List (Fin 3) := + List.rec (0, []) (fun j _ word => Fin.cases + (word.1 + 1, word.2) (fun k => (word.1, k :: word.2)) j) + +theorem timeSpaceWord_perm (α : List (Fin 4)) : + α.Perm (List.replicate (timeSpaceWord α).1 0 ++ + (timeSpaceWord α).2.map Fin.succ) := by + induction α with + | nil => exact List.Perm.refl [] + | cons j α ih => + refine Fin.cases ?_ (fun k => ?_) j + · simpa only [timeSpaceWord, Fin.cases_zero, List.replicate_succ, + List.cons_append] using ih.cons 0 + · have he := (List.perm_append_comm : + ([k.succ] ++ List.replicate (timeSpaceWord α).1 0).Perm + (List.replicate (timeSpaceWord α).1 0 ++ [k.succ])).append_right + ((timeSpaceWord α).2.map Fin.succ) + simpa only [timeSpaceWord, Fin.cases_succ, List.singleton_append, + List.map_cons, List.append_assoc, List.cons_append, List.nil_append] using + (ih.cons k.succ).trans he + +theorem mixedDerivative_normalForm {V : Velocity} (hV : ContDiff ℝ ∞ V) + (α : List (Fin 4)) (t : ℝ) (x : Space) : + mixedDerivative V α (t, x) = + iteratedDeriv (timeSpaceWord α).1 + (fun s => spatialWord (timeSpaceWord α).2 (fun y => V (s, y)) x) t := by + rw [mixedDerivative_perm hV (timeSpaceWord_perm α)] + exact mixedDerivative_time_spatial hV _ _ t x + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedOrdering.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedOrdering.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e8d18973cabbe5cc85b9c6ba674146a207c2ed9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/MixedOrdering.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BoundedProfiles + +namespace OAI + +/-! Ordered directional derivatives can be grouped into time derivatives and +spatial derivatives, by the symmetry already proved for the flat calculus. -/ + +noncomputable section +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +theorem mixedDerivative_perm {V : Velocity} (hV : ContDiff ℝ ∞ V) + {α β : List (Fin 4)} (h : α.Perm β) : mixedDerivative V α = mixedDerivative V β := by + induction h with + | nil => rfl + | cons a h ih => simp only [mixedDerivative, ih] + | swap a b α => exact mixedDerivative_commute hV α b a + | trans h₁ h₂ ih₁ ih₂ => exact ih₁.trans ih₂ + +theorem time_spatial_normal_form (α : List (Fin 4)) : + ∃ n : ℕ, ∃ β : List (Fin 3), α.Perm (List.replicate n 0 ++ β.map Fin.succ) := by + induction α with + | nil => exact ⟨0, [], List.Perm.refl _⟩ + | cons a α ih => + obtain ⟨n, β, h⟩ := ih + refine Fin.cases ?_ (fun j => ?_) a + · refine ⟨n + 1, β, ?_⟩ + simpa only [List.replicate_succ, List.cons_append] using h.cons 0 + · refine ⟨n, j :: β, ?_⟩ + have he := (List.perm_append_comm : + ([j.succ] ++ List.replicate n 0).Perm (List.replicate n 0 ++ [j.succ])).append_right + (β.map Fin.succ) + exact (h.cons j.succ).trans (by simpa only [List.singleton_append, List.map_cons, + List.append_assoc, List.cons_append, List.nil_append] using he) + +theorem mixedDerivative_time_spatial {V : Velocity} (hV : ContDiff ℝ ∞ V) + (n : ℕ) (β : List (Fin 3)) (t : ℝ) (x : Space) : + mixedDerivative V (List.replicate n 0 ++ β.map Fin.succ) (t, x) = + iteratedDeriv n (fun s => spatialWord β (fun y => V (s, y)) x) t := by + have he := iteratedDeriv_eq_mixedTime (spatialPhase_smooth hV β) n t x + calc + _ = mixedDerivative (spatialPhase V β) (List.replicate n 0) (t, x) := by + rw [spatialPhase_eq_mixed hV, mixedDerivative_append] + _ = _ := he.symm + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicAtoms.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicAtoms.lean new file mode 100644 index 0000000000000000000000000000000000000000..db3b197b1e5bd97a51fda8d175a049f4daab24ff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicAtoms.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedFieldBalls + +namespace OAI + +/-! Certified evaluation of a flat smooth atom at an approximate real +argument. A global derivative bound controls the argument error. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set Filter +open scoped ContDiff Topology + +def profileNoCoord : ProfileExpr → Prop + | .coord => False + | .const _ | .glue _ _ _ | .denom _ _ _ => True + | .add p q | .mul p q => profileNoCoord p ∧ profileNoCoord q + +theorem profileNoCoord_bound {p : ProfileExpr} (hp : profileNoCoord p) (x : ℝ) : + |p.val x| ≤ (p.bound 0 : ℝ) := by + induction p with + | const r => simp [ProfileExpr.val, ProfileExpr.bound] + | coord => exact False.elim hp + | glue k a b => simpa [ProfileExpr.val, ProfileExpr.bound] using + gluePower_bound k ((a : ℝ) * x + b) + | denom k a b => simpa [ProfileExpr.val, ProfileExpr.bound] using + denomPower_bound k ((a : ℝ) * x + b) + | add p q ihp ihq => + simpa only [ProfileExpr.val, ProfileExpr.bound, Rat.cast_add] using + (abs_add_le _ _).trans (add_le_add (ihp hp.1) (ihq hp.2)) + | mul p q ihp ihq => + simpa only [ProfileExpr.val, ProfileExpr.bound, Rat.cast_mul, abs_mul] using + mul_le_mul (ihp hp.1) (ihq hp.2) (abs_nonneg _) + (Rat.cast_nonneg.mpr (p.bound_nonneg 0)) + +def SmoothAtom.derivativeBound (a : SmoothAtom) : ℚ := a.profile.diff.bound 0 + +theorem SmoothAtom.lipschitz_bound (a : SmoothAtom) (x y : ℝ) : + |a.profile.val x - a.profile.val y| ≤ (a.derivativeBound : ℝ) * |x - y| := by + have hnc : profileNoCoord a.profile.diff := by + cases a <;> simp [SmoothAtom.profile, ProfileExpr.diff, ProfileExpr.sub, profileNoCoord] + have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun z (_ : z ∈ (univ : Set ℝ)) => (a.profile.hasDerivAt z).hasDerivWithinAt) + (fun z _ => show ‖a.profile.diff.val z‖ ≤ (a.derivativeBound : ℝ) by + simpa only [Real.norm_eq_abs, SmoothAtom.derivativeBound] using profileNoCoord_bound hnc z) + convex_univ (mem_univ y) (mem_univ x) + simpa only [Real.norm_eq_abs] using h + +namespace ProfileEvaluation + +def Ready (p : ProfileExpr) (q ε : ℚ) (n : ℕ) : Prop := (p.enclose q n).radius ≤ ε + +instance (p : ProfileExpr) (q ε : ℚ) (n : ℕ) : Decidable (Ready p q ε n) := + inferInstanceAs (Decidable ((p.enclose q n).radius ≤ ε)) + +theorem ready_exists (p : ProfileExpr) (q : ℚ) {ε : ℚ} (hε : 0 < ε) : + ∃ n, Ready p q ε n := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := ((p.enclose_converges q).2.eventually_lt_const he).exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +def evaluate (p : ProfileExpr) (q ε : ℚ) (hε : 0 < ε) : ℚ := + (p.enclose q (Nat.find (ready_exists p q hε))).center + +theorem evaluate_spec (p : ProfileExpr) (q ε : ℚ) (hε : 0 < ε) : + |p.val q - (evaluate p q ε hε : ℝ)| ≤ (ε : ℝ) := by + have h := p.enclose_contains q (Nat.find (ready_exists p q hε)) + exact h.trans (by exact_mod_cast Nat.find_spec (ready_exists p q hε)) + +end ProfileEvaluation + +def SmoothAtom.enclose (a : SmoothAtom) (b : QBall) (n : ℕ) : QBall := + ⟨ProfileEvaluation.evaluate a.profile b.center (ClockedExpr.dyadic n) + (ClockedExpr.dyadic_pos n), + ClockedExpr.dyadic n + a.derivativeBound * b.radius⟩ + +theorem SmoothAtom.enclose_contains (a : SmoothAtom) {b : QBall} {x : ℝ} + (hb : b.Contains x) (n : ℕ) : (a.enclose b n).Contains (a.profile.val x) := by + have he := ProfileEvaluation.evaluate_spec a.profile b.center + (ClockedExpr.dyadic n) (ClockedExpr.dyadic_pos n) + have hl := (a.lipschitz_bound x b.center).trans + (mul_le_mul_of_nonneg_left hb (Rat.cast_nonneg.mpr (a.profile.diff.bound_nonneg 0))) + change |a.profile.val x - _| ≤ _ + calc + _ ≤ |a.profile.val x - a.profile.val b.center| + |a.profile.val b.center - _| := abs_sub_le _ _ _ + _ ≤ (a.derivativeBound : ℝ) * b.radius + (ClockedExpr.dyadic n : ℝ) := add_le_add hl he + _ = _ := by + dsimp only [SmoothAtom.enclose] + push_cast + ring + +theorem SmoothAtom.enclose_converges (a : SmoothAtom) {b : ℕ → QBall} {x : ℝ} + (hb : ∀ n, (b n).Contains x) (hr : QBall.Converges b x) : + QBall.Converges (fun n => a.enclose (b n) n) (a.profile.val x) := by + apply QBall.converges_of_contains (fun n => a.enclose_contains (hb n) n) + have h := ClockedExpr.dyadic_tendsto.add (hr.2.const_mul (a.derivativeBound : ℝ)) + simpa only [SmoothAtom.enclose, Rat.cast_add, Rat.cast_mul, mul_zero, add_zero] using h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..74f9db11a9ecc9a80cd962ea3912b8258c0fe1c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicBounds.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicExpressions + +namespace OAI + +/-! Rational bounds for the finite gate expressions on a coordinate box. +The glue primitives have global bounds, even when their arguments move. -/ + +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff BigOperators + +def SmoothAtom.bound : SmoothAtom → ℚ + | .glue k => k.factorial + | .denom k => 9 ^ k + +theorem SmoothAtom.bound_nonneg (a : SmoothAtom) : 0 ≤ a.bound := by + cases a <;> simp only [bound] <;> positivity + +theorem SmoothAtom.val_bound (a : SmoothAtom) (x : ℝ) : + |a.profile.val x| ≤ (a.bound : ℝ) := by + cases a with + | glue k => simpa [profile, ProfileExpr.val, bound] using gluePower_bound k x + | denom k => simpa [profile, ProfileExpr.val, bound] using denomPower_bound k x + +namespace NonperiodicExpr + +def bound (M : ℚ) : NonperiodicExpr → ℚ + | .const r => |r| + | .coord _ => |M| + | .atom a _ => a.bound + | .add e f => e.bound M + f.bound M + | .mul e f => e.bound M * f.bound M + +theorem bound_nonneg (e : NonperiodicExpr) (M : ℚ) : 0 ≤ e.bound M := by + induction e with + | const r => exact abs_nonneg _ + | coord j => exact abs_nonneg _ + | atom a e ih => exact a.bound_nonneg + | add e f he hf => exact add_nonneg he hf + | mul e f he hf => exact mul_nonneg he hf + +theorem val_bound (e : NonperiodicExpr) (M : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : |e.val y| ≤ (e.bound M : ℝ) := by + induction e with + | const r => simp [val, bound] + | coord j => simpa only [val, bound, Rat.cast_abs] using hy j + | atom a e ih => exact a.val_bound _ + | add e f ihe ihf => + simpa only [val, bound, Rat.cast_add] using + (abs_add_le _ _).trans (add_le_add ihe ihf) + | mul e f ihe ihf => + simpa only [val, bound, Rat.cast_mul, abs_mul] using + mul_le_mul ihe ihf (abs_nonneg _) (Rat.cast_nonneg.mpr (e.bound_nonneg M)) + +def derivativeBound (e : NonperiodicExpr) (M : ℚ) : ℚ := + ∑ j : Fin 4, (e.diff j).bound M + +theorem derivativeBound_nonneg (e : NonperiodicExpr) (M : ℚ) : + 0 ≤ e.derivativeBound M := Finset.sum_nonneg (fun j _ => (e.diff j).bound_nonneg M) + +theorem fderiv_bound (e : NonperiodicExpr) (M : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + ‖fderiv ℝ e.val y‖ ≤ (e.derivativeBound M : ℝ) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Rat.cast_nonneg.mpr (e.derivativeBound_nonneg M)) + intro v + conv_lhs => rw [← spaceTimeDirections_sum v] + rw [map_sum] + calc + _ ≤ ∑ j : Fin 4, ‖fderiv ℝ e.val y (timeSpaceCoord j v • spaceTimeDirection j)‖ := + norm_sum_le _ _ + _ ≤ ∑ j : Fin 4, ‖v‖ * ((e.diff j).bound M : ℝ) := by + apply Finset.sum_le_sum + intro j _ + rw [map_smul, norm_smul] + have hj : ‖fderiv ℝ e.val y (spaceTimeDirection j)‖ ≤ ((e.diff j).bound M : ℝ) := by + rw [← e.val_diff j y, Real.norm_eq_abs] + exact (e.diff j).val_bound M y hy + exact mul_le_mul (timeSpaceCoord_norm j v) hj (norm_nonneg _) (norm_nonneg _) + _ = _ := by + rw [derivativeBound, Rat.cast_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem lipschitz_bound (e : NonperiodicExpr) (M : ℚ) (x y : SpaceTime) + (hx : ∀ j, |timeSpaceCoord j x| ≤ |(M : ℝ)|) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + |e.val x - e.val y| ≤ (e.derivativeBound M : ℝ) * ‖x - y‖ := by + let S : Set SpaceTime := {z | ∀ j, |timeSpaceCoord j z| ≤ |(M : ℝ)|} + have hc : Convex ℝ S := by + intro u hu v hv a b ha hb hab j + simp only [map_add, map_smul, smul_eq_mul] + calc + _ ≤ |a * timeSpaceCoord j u| + |b * timeSpaceCoord j v| := abs_add_le _ _ + _ = a * |timeSpaceCoord j u| + b * |timeSpaceCoord j v| := by + rw [abs_mul, abs_mul, abs_of_nonneg ha, abs_of_nonneg hb] + _ ≤ a * |(M : ℝ)| + b * |(M : ℝ)| := add_le_add + (mul_le_mul_of_nonneg_left (hu j) ha) (mul_le_mul_of_nonneg_left (hv j) hb) + _ = _ := by rw [← add_mul, hab, one_mul] + have h := Convex.norm_image_sub_le_of_norm_fderiv_le + (fun z (_ : z ∈ S) => e.smooth.differentiable (by simp) z) + (fun z hz => e.fderiv_bound M z hz) hc hy hx + simpa only [Real.norm_eq_abs] using h + +theorem mixed_bound (e : NonperiodicExpr) (α : List (Fin 4)) (M : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + |ClockedExpr.scalarMixed e.val α y| ≤ ((e.diffWord α).bound M : ℝ) := by + rw [← e.val_diffWord α] + exact (e.diffWord α).val_bound M y hy + +end NonperiodicExpr +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e18bf36cb28bce024e2f135d7e01113b1434c3e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicEvaluation.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicRationalEvaluation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedEvaluation + +namespace OAI + +/-! Evaluation of a finite moving-gate expression at a fast Cauchy name. +A coordinate box read from its zeroth approximation supplies a rational +Lipschitz bound and hence an explicit finite input precision. -/ + +noncomputable section +namespace ForcedComputation.NonperiodicExpr +open ShearFlows +open scoped BigOperators + +def nameRadius (a : ℕ → RationalSpaceTime) : ℚ := + (∑ j : Fin 4, |rationalCoord j (a 0)|) + 2 + +theorem nameRadius_bounds {a : ℕ → RationalSpaceTime} {y : SpaceTime} + (ha : IsFastName a y) (n : ℕ) : + (∀ j, |timeSpaceCoord j y| ≤ |(nameRadius a : ℝ)|) ∧ + (∀ j, |timeSpaceCoord j (rationalPoint (a n))| ≤ |(nameRadius a : ℝ)|) := by + have hr : (0 : ℝ) ≤ nameRadius a := by + exact_mod_cast (show (0 : ℚ) ≤ nameRadius a by unfold nameRadius; positivity) + have hq (j : Fin 4) : |(rationalCoord j (a 0) : ℝ)| + 2 ≤ (nameRadius a : ℝ) := by + have hq : |rationalCoord j (a 0)| + 2 ≤ nameRadius a := by + unfold nameRadius + have hs := Finset.single_le_sum (fun i (_ : i ∈ (Finset.univ : Finset (Fin 4))) => + abs_nonneg (rationalCoord i (a 0))) (Finset.mem_univ j) + linarith + exact_mod_cast hq + have hd (j : Fin 4) (k : ℕ) : + |timeSpaceCoord j y - (rationalCoord j (a k) : ℝ)| ≤ 1 := by + have h := (timeSpaceCoord_norm j (y - rationalPoint (a k))).trans + ((ha k).trans (ClockedExpr.errorTolerance_le_one k)) + simpa only [map_sub, timeSpaceCoord_rational, Real.norm_eq_abs] using h + have hy (j : Fin 4) : |timeSpaceCoord j y| ≤ |(rationalCoord j (a 0) : ℝ)| + 1 := by + have h := abs_add_le (timeSpaceCoord j y - (rationalCoord j (a 0) : ℝ)) + (rationalCoord j (a 0) : ℝ) + rw [sub_add_cancel] at h + linarith [hd j 0] + constructor + · intro j + rw [abs_of_nonneg hr] + linarith [hy j, hq j] + · intro j + rw [timeSpaceCoord_rational, abs_of_nonneg hr] + have h := abs_add_le ((rationalCoord j (a n) : ℝ) - timeSpaceCoord j y) (timeSpaceCoord j y) + rw [sub_add_cancel, abs_sub_comm] at h + linarith [hd j n, hy j, hq j] + +def inputPrecision (e : NonperiodicExpr) (M ε : ℚ) : ℕ := + ⌈2 * e.derivativeBound M / ε⌉₊ + 1 + +theorem inputPrecision_spec (e : NonperiodicExpr) (M : ℚ) {ε : ℚ} (hε : 0 < ε) : + (e.derivativeBound M : ℝ) * errorTolerance (e.inputPrecision M ε) ≤ (ε : ℝ) / 2 := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + have hn : 2 * (e.derivativeBound M : ℝ) / ε ≤ (e.inputPrecision M ε : ℝ) := by + have h : 2 * e.derivativeBound M / ε ≤ (e.inputPrecision M ε : ℚ) := + (Nat.le_ceil _).trans (by simp [inputPrecision]) + exact_mod_cast h + have hp : (e.inputPrecision M ε : ℝ) ≤ (2 : ℝ) ^ (e.inputPrecision M ε) := by + exact_mod_cast (Nat.lt_two_pow_self (n := e.inputPrecision M ε)).le + have hpow : (0 : ℝ) < 2 ^ (e.inputPrecision M ε) := by positivity + rw [errorTolerance, ← div_eq_mul_inv] + apply (div_le_iff₀ hpow).mpr + have h := (div_le_iff₀ he).mp (hn.trans hp) + linarith + +def evaluate (e : NonperiodicExpr) (a : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : ℚ := + e.evaluateRational (a (e.inputPrecision (nameRadius a) ε)) (ε / 2) (by positivity) + +theorem evaluate_spec (e : NonperiodicExpr) (a : ℕ → RationalSpaceTime) + {y : SpaceTime} (ha : IsFastName a y) (ε : ℚ) (hε : 0 < ε) : + |e.val y - (e.evaluate a ε hε : ℝ)| ≤ (ε : ℝ) := by + let n := e.inputPrecision (nameRadius a) ε + let q := a n + obtain ⟨hy, hq⟩ := nameRadius_bounds ha n + calc + _ ≤ |e.val y - e.val (rationalPoint q)| + + |e.val (rationalPoint q) - (e.evaluate a ε hε : ℝ)| := abs_sub_le _ _ _ + _ ≤ (ε : ℝ) / 2 + (ε : ℝ) / 2 := by + apply add_le_add + · exact (e.lipschitz_bound (nameRadius a) y (rationalPoint q) hy hq).trans + ((mul_le_mul_of_nonneg_left (ha n) + (Rat.cast_nonneg.mpr (e.derivativeBound_nonneg _))).trans + (e.inputPrecision_spec (nameRadius a) hε)) + · simpa only [evaluate, Rat.cast_div, Rat.cast_ofNat] using + e.evaluateRational_spec q (ε / 2) (by positivity) + _ = _ := by ring + +theorem evaluate_mixed_spec (e : NonperiodicExpr) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) {y : SpaceTime} (ha : IsFastName a y) + (ε : ℚ) (hε : 0 < ε) : + |ClockedExpr.scalarMixed e.val α y - ((e.diffWord α).evaluate a ε hε : ℝ)| ≤ (ε : ℝ) := by + rw [← e.val_diffWord α] + exact (e.diffWord α).evaluate_spec a ha ε hε + +end ForcedComputation.NonperiodicExpr + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..82d07c847f7ad091603b20dd4fc1d10ea4dea894 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicExpressions.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockedBounds + +namespace OAI + +/-! Finite smooth expressions for the moving whole-plane gates. Unlike +periodic field expressions, their profile arguments may depend on both +time and position. The only nonpolynomial primitives are the existing +effective flat glue and its everywhere positive transition denominator. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +inductive SmoothAtom + | glue (k : ℕ) + | denom (k : ℕ) + deriving DecidableEq + +def SmoothAtom.profile : SmoothAtom → ProfileExpr + | .glue k => .glue k 1 0 + | .denom k => .denom k 1 0 + +inductive NonperiodicExpr + | const (r : ℚ) + | coord (j : Fin 4) + | atom (a : SmoothAtom) (e : NonperiodicExpr) + | add (e f : NonperiodicExpr) + | mul (e f : NonperiodicExpr) + deriving DecidableEq + +namespace NonperiodicExpr + +noncomputable def val : NonperiodicExpr → SpaceTime → ℝ + | .const r, _ => r + | .coord j, y => timeSpaceCoord j y + | .atom a e, y => a.profile.val (e.val y) + | .add e f, y => e.val y + f.val y + | .mul e f, y => e.val y * f.val y + +def sub (e f : NonperiodicExpr) : NonperiodicExpr := .add e (.mul (.const (-1)) f) + +def composeProfile : ProfileExpr → NonperiodicExpr → NonperiodicExpr + | .const r, _ => .const r + | .coord, e => e + | .glue k a b, e => .atom (.glue k) (.add (.mul (.const a) e) (.const b)) + | .denom k a b, e => .atom (.denom k) (.add (.mul (.const a) e) (.const b)) + | .add p q, e => .add (composeProfile p e) (composeProfile q e) + | .mul p q, e => .mul (composeProfile p e) (composeProfile q e) + +theorem val_composeProfile (p : ProfileExpr) (e : NonperiodicExpr) (y : SpaceTime) : + (composeProfile p e).val y = p.val (e.val y) := by + induction p with + | const => rfl + | coord => rfl + | glue k a b => simp [composeProfile, val, SmoothAtom.profile, ProfileExpr.val] + | denom k a b => simp [composeProfile, val, SmoothAtom.profile, ProfileExpr.val] + | add p q ihp ihq => exact congrArg₂ (· + ·) ihp ihq + | mul p q ihp ihq => exact congrArg₂ (· * ·) ihp ihq + +def diff (j : Fin 4) : NonperiodicExpr → NonperiodicExpr + | .const _ => .const 0 + | .coord i => .const (if i = j then 1 else 0) + | .atom a e => .mul (composeProfile a.profile.diff e) (e.diff j) + | .add e f => .add (e.diff j) (f.diff j) + | .mul e f => .add (.mul (e.diff j) f) (.mul e (f.diff j)) + +theorem smooth (e : NonperiodicExpr) : ContDiff ℝ ∞ e.val := by + induction e with + | const => exact contDiff_const + | coord j => exact (timeSpaceCoord j).contDiff + | atom a e ih => exact a.profile.smooth.comp ih + | add e f ihe ihf => exact ihe.add ihf + | mul e f ihe ihf => exact ihe.mul ihf + +theorem val_diff (e : NonperiodicExpr) (j : Fin 4) (y : SpaceTime) : + (e.diff j).val y = fderiv ℝ e.val y (spaceTimeDirection j) := by + induction e with + | const r => simp [diff, val] + | coord i => + change ((if i = j then 1 else 0 : ℚ) : ℝ) = + fderiv ℝ (timeSpaceCoord i) y (spaceTimeDirection j) + rw [(timeSpaceCoord i).fderiv, timeSpaceCoord_direction] + split_ifs <;> norm_num + | atom a e ih => + have hd := (a.profile.hasDerivAt (e.val y)).comp_hasFDerivAt y + ((smooth e).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (a.profile.val ∘ e.val) y (spaceTimeDirection j) + rw [hd.fderiv] + change (composeProfile a.profile.diff e).val y * (e.diff j).val y = _ + rw [val_composeProfile, ih] + rfl + | add e f ihe ihf => + rw [show NonperiodicExpr.val (.add e f) = e.val + f.val from rfl, + fderiv_add ((smooth e).differentiable (by simp) y) + ((smooth f).differentiable (by simp) y)] + exact congrArg₂ (· + ·) ihe ihf + | mul e f ihe ihf => + have hd := ((smooth e).differentiable (by simp) y).hasFDerivAt.mul + ((smooth f).differentiable (by simp) y).hasFDerivAt + change _ = fderiv ℝ (e.val * f.val) y (spaceTimeDirection j) + rw [hd.fderiv] + simp only [diff, val, add_apply, smul_apply, smul_eq_mul] + rw [ihe, ihf] + ring + +def diffWord (e : NonperiodicExpr) : List (Fin 4) → NonperiodicExpr + | [] => e + | j :: α => (e.diffWord α).diff j + +theorem val_diffWord (e : NonperiodicExpr) (α : List (Fin 4)) : + (e.diffWord α).val = ClockedExpr.scalarMixed e.val α := by + induction α with + | nil => rfl + | cons j α ih => + funext y + change ((e.diffWord α).diff j).val y = _ + rw [val_diff, ih] + rfl + +end NonperiodicExpr +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicForceEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicForceEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..47696529c5ba8b9468dcd2995c4ce280cece1398 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicForceEvaluation.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicResidual + +namespace OAI + +/-! The viscosity enters the residual linearly. A finite box bound supplies +an explicit precision for its real name, so evaluation remains terminating. -/ + +noncomputable section +namespace ForcedComputation.NonperiodicResidual +open ShearFlows +open scoped ContDiff BigOperators + +def laplaceBound (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) : ℚ := + ∑ j : Fin 3, c.bound (α ++ [j.succ,j.succ]) M + +theorem laplaceBound_nonneg (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) : + 0 ≤ laplaceBound c α M := Finset.sum_nonneg (fun _ _ => c.bound_nonneg _ _) + +theorem laplaceBound_spec (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) + (y : SpaceTime) (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + ‖∑ j : Fin 3, mixedDerivative c.val (α ++ [j.succ,j.succ]) y‖ ≤ + (laplaceBound c α M : ℝ) := by + apply (norm_sum_le _ _).trans + simpa only [laplaceBound, Rat.cast_sum] using + Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => c.val_bound _ M y hy) + +theorem coefficient_error (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) + (y : SpaceTime) (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) (ν r : ℝ) : + ‖mixedDerivative (residual ν c.val) α y - + mixedDerivative (residual r c.val) α y‖ ≤ + |ν-r| * (laplaceBound c α M : ℝ) := by + rw [residual_eq_force_add, residual_eq_force_add, + mixedDerivative_add (force_smooth c.smooth ν) (convectiveField_smooth c.smooth), + mixedDerivative_add (force_smooth c.smooth r) (convectiveField_smooth c.smooth)] + simp only [Pi.add_apply, add_sub_add_right_eq_sub] + rw [mixedDerivative_force c.smooth, mixedDerivative_force c.smooth] + have he {v w : Space} : (v - ν • w) - (v - r • w) = (r-ν) • w := by module + rw [he, norm_smul, Real.norm_eq_abs, abs_sub_comm] + exact mul_le_mul_of_nonneg_left (laplaceBound_spec c α M y hy) (abs_nonneg _) + +def coefficientPrecision (c : NonperiodicVector) (α : List (Fin 4)) (M ε : ℚ) : ℕ := + ⌈2 * laplaceBound c α M / ε⌉₊ + 1 + +theorem coefficientPrecision_spec (c : NonperiodicVector) (α : List (Fin 4)) + (M : ℚ) {ε : ℚ} (hε : 0 < ε) : + errorTolerance (coefficientPrecision c α M ε) * (laplaceBound c α M : ℝ) ≤ + (ε : ℝ) / 2 := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + have hn : 2 * (laplaceBound c α M : ℝ) / ε ≤ + (coefficientPrecision c α M ε : ℝ) := by + have hh : 2 * laplaceBound c α M / ε ≤ (coefficientPrecision c α M ε : ℚ) := + (Nat.le_ceil _).trans (by simp [coefficientPrecision]) + exact_mod_cast hh + have hp : (coefficientPrecision c α M ε : ℝ) ≤ + (2 : ℝ) ^ (coefficientPrecision c α M ε) := by + exact_mod_cast (Nat.lt_two_pow_self (n := coefficientPrecision c α M ε)).le + have hle := hn.trans hp + have h2 : (0 : ℝ) < 2 ^ (coefficientPrecision c α M ε) := by positivity + rw [errorTolerance, mul_comm, ← div_eq_mul_inv] + apply (div_le_iff₀ h2).mpr + have hh := (div_le_iff₀ he).mp hle + linarith + +def evaluate (c : NonperiodicVector) (α : List (Fin 4)) + (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + let M := NonperiodicExpr.nameRadius b + let r := a (coefficientPrecision c α M ε) + (code c r).evaluate α b (ε/2) (by positivity) + +theorem evaluate_spec (c : NonperiodicVector) (α : List (Fin 4)) + {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + {y : SpaceTime} {b : ℕ → RationalSpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (residual ν c.val) α y - + rationalVector (evaluate c α a b ε hε)‖ ≤ (ε : ℝ) := by + let M := NonperiodicExpr.nameRadius b + let r := a (coefficientPrecision c α M ε) + have hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)| := + fun j => (NonperiodicExpr.nameRadius_bounds hb 0).1 j + calc + _ ≤ ‖mixedDerivative (residual ν c.val) α y - mixedDerivative (residual r c.val) α y‖ + + ‖mixedDerivative (residual r c.val) α y - + rationalVector (evaluate c α a b ε hε)‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ (ε : ℝ)/2 + (ε : ℝ)/2 := by + apply add_le_add + · exact (coefficient_error c α M y hy ν r).trans + ((mul_le_mul_of_nonneg_right (ha _) + (Rat.cast_nonneg.mpr (laplaceBound_nonneg c α M))).trans + (coefficientPrecision_spec c α M hε)) + · simpa only [evaluate, val, Rat.cast_div, Rat.cast_ofNat] using + (code c r).evaluate_spec α b hb (ε/2) (by positivity) + _ = _ := by ring + +end ForcedComputation.NonperiodicResidual + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicRationalEvaluation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicRationalEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a09707dea6c32fb104785bc307a4a3c1e4aa0df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicRationalEvaluation.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicAtoms + +namespace OAI + +/-! A terminating rational evaluation procedure for every finite moving +gate expression and all of its formal mixed derivatives. -/ + +noncomputable section +namespace ForcedComputation.NonperiodicExpr +open ShearFlows Filter +open scoped Topology + +def enclose : NonperiodicExpr → RationalSpaceTime → ℕ → QBall + | .const r, _, _ => .exact r + | .coord j, y, _ => .exact (rationalCoord j y) + | .atom a e, y, n => a.enclose (e.enclose y n) n + | .add e f, y, n => (e.enclose y n).add (f.enclose y n) + | .mul e f, y, n => (e.enclose y n).mul (f.enclose y n) + +theorem enclose_contains (e : NonperiodicExpr) (y : RationalSpaceTime) (n : ℕ) : + (e.enclose y n).Contains (e.val (rationalPoint y)) := by + induction e with + | const r => exact QBall.contains_exact r + | coord j => simpa only [val, enclose, timeSpaceCoord_rational] using + QBall.contains_exact (rationalCoord j y) + | atom a e ih => exact a.enclose_contains ih n + | add e f ihe ihf => exact QBall.contains_add ihe ihf + | mul e f ihe ihf => exact QBall.contains_mul ihe ihf + +theorem enclose_converges (e : NonperiodicExpr) (y : RationalSpaceTime) : + QBall.Converges (e.enclose y) (e.val (rationalPoint y)) := by + induction e with + | const r => exact QBall.converges_exact r + | coord j => simpa only [val, enclose, timeSpaceCoord_rational] using + QBall.converges_exact (rationalCoord j y) + | atom a e ih => exact a.enclose_converges (fun n => e.enclose_contains y n) ih + | add e f ihe ihf => exact ihe.add ihf + | mul e f ihe ihf => exact ihe.mul ihf + +def Ready (e : NonperiodicExpr) (y : RationalSpaceTime) (ε : ℚ) (n : ℕ) : Prop := + (e.enclose y n).radius ≤ ε + +instance (e : NonperiodicExpr) (y : RationalSpaceTime) (ε : ℚ) (n : ℕ) : + Decidable (e.Ready y ε n) := inferInstanceAs (Decidable ((e.enclose y n).radius ≤ ε)) + +theorem ready_exists (e : NonperiodicExpr) (y : RationalSpaceTime) {ε : ℚ} (hε : 0 < ε) : + ∃ n, e.Ready y ε n := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := ((e.enclose_converges y).2.eventually_lt_const he).exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +def evaluateRational (e : NonperiodicExpr) (y : RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : ℚ := + (e.enclose y (Nat.find (e.ready_exists y hε))).center + +theorem evaluateRational_spec (e : NonperiodicExpr) (y : RationalSpaceTime) + (ε : ℚ) (hε : 0 < ε) : + |e.val (rationalPoint y) - (e.evaluateRational y ε hε : ℝ)| ≤ (ε : ℝ) := by + have h := e.enclose_contains y (Nat.find (e.ready_exists y hε)) + exact h.trans (by exact_mod_cast Nat.find_spec (e.ready_exists y hε)) + +end ForcedComputation.NonperiodicExpr + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicResidual.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..abf35af31a5fa5831f40cd80f21ead5f1bb358c6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicResidual.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicVector +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualExpressions + +namespace OAI + +/-! Moving-gate syntax is closed under the full viscous residual. -/ + +namespace ForcedComputation +open ShearFlows +open scoped BigOperators + +namespace NonperiodicExpr + +def sum (l : List NonperiodicExpr) : NonperiodicExpr := l.foldr .add (.const 0) + +theorem sum_val (l : List NonperiodicExpr) (y : SpaceTime) : + (sum l).val y = (l.map (fun e => e.val y)).sum := by + induction l with + | nil => simp only [sum, List.foldr_nil, val, List.map_nil, List.sum_nil, Rat.cast_zero] + | cons e l ih => + change e.val y + (sum l).val y = _ + simp only [List.map_cons, List.sum_cons, ih] + +theorem sum_ofFn_val {n : ℕ} (e : Fin n → NonperiodicExpr) (y : SpaceTime) : + (sum (List.ofFn e)).val y = ∑ j, (e j).val y := by + rw [sum_val, List.map_ofFn, List.sum_ofFn] + rfl + +end NonperiodicExpr + +namespace NonperiodicResidual + +def convection (c : NonperiodicVector) : NonperiodicVector := fun k => + NonperiodicExpr.sum (List.ofFn (fun j : Fin 3 => .mul (c j) ((c k).diff j.succ))) + +def linear (c : NonperiodicVector) (r : ℚ) : NonperiodicVector := fun k => + .add ((c k).diff 0) (.mul (.const (-r)) + (NonperiodicExpr.sum (List.ofFn (fun j : Fin 3 => (c k).diffWord [j.succ, j.succ])))) + +def code (c : NonperiodicVector) (r : ℚ) : NonperiodicVector := fun k => + .add (linear c r k) (convection c k) + +theorem convection_val (c : NonperiodicVector) : + (convection c).val = convectiveField c.val := by + funext y k + rw [convectiveField_eq_mixed c.smooth] + simp only [convection, NonperiodicVector.val, NonperiodicExpr.sum_ofFn_val, + NonperiodicExpr.val, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + apply Finset.sum_congr rfl + intro j _ + have he := congrFun (congrFun (c.val_diffWord [j.succ]) y) k + exact congrArg (fun z => (c j).val y * z) he + +theorem linear_val (c : NonperiodicVector) (r : ℚ) : + (linear c r).val = force r c.val := by + funext y k + rw [force_eq_mixed c.smooth] + simp_rw [← c.val_diffWord] + simp only [linear, NonperiodicVector.val, NonperiodicExpr.val, NonperiodicExpr.sum_ofFn_val, + NonperiodicVector.diffWord, NonperiodicExpr.diffWord, Finset.sum_apply, + Pi.sub_apply, Pi.smul_apply, smul_eq_mul, Rat.cast_neg] + ring + +theorem val (c : NonperiodicVector) (r : ℚ) : (code c r).val = residual r c.val := by + rw [residual_eq_force_add, ← linear_val c r, ← convection_val c] + rfl + +end NonperiodicResidual +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicVector.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicVector.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5aa4e1858bd978e426350f8c8c5a78d9c32a371 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NonperiodicVector.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NonperiodicEvaluation + +namespace OAI + +/-! Three-component moving-gate programs and their certified mixed jets. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff BigOperators + +abbrev NonperiodicVector := Fin 3 → NonperiodicExpr + +namespace NonperiodicVector + +def val (c : NonperiodicVector) : Velocity := fun y j => (c j).val y + +def diffWord (c : NonperiodicVector) (α : List (Fin 4)) : NonperiodicVector := + fun j => (c j).diffWord α + +theorem smooth (c : NonperiodicVector) : ContDiff ℝ ∞ c.val := + contDiff_pi.mpr (fun j => (c j).smooth) + +theorem val_diffWord (c : NonperiodicVector) (α : List (Fin 4)) : + (c.diffWord α).val = mixedDerivative c.val α := by + induction α with + | nil => rfl + | cons i α ih => + funext y j + rw [mixedDerivative, ← ih] + have h := fderiv_pi (fun k => (((c k).diffWord α).smooth).differentiable (by simp) y) + change ((c j).diffWord (i :: α)).val y = + (fderiv ℝ (c.diffWord α).val y (spaceTimeDirection i)) j + change fderiv ℝ (c.diffWord α).val y = _ at h + rw [h] + exact ((c j).diffWord α).val_diff i y + +def bound (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) : ℚ := + ∑ j, ((c j).diffWord α).bound M + +theorem bound_nonneg (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) : + 0 ≤ c.bound α M := Finset.sum_nonneg (fun j _ => ((c j).diffWord α).bound_nonneg M) + +theorem val_bound (c : NonperiodicVector) (α : List (Fin 4)) (M : ℚ) (y : SpaceTime) + (hy : ∀ j, |timeSpaceCoord j y| ≤ |(M : ℝ)|) : + ‖mixedDerivative c.val α y‖ ≤ (c.bound α M : ℝ) := by + rw [← c.val_diffWord α] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr (c.bound_nonneg α M))).mpr + intro j + apply (((c j).diffWord α).val_bound M y hy).trans + exact_mod_cast Finset.single_le_sum + (fun k _ => ((c k).diffWord α).bound_nonneg M) (Finset.mem_univ j) + +def evaluate (c : NonperiodicVector) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + fun j => ((c j).diffWord α).evaluate a ε hε + +theorem evaluate_spec (c : NonperiodicVector) (α : List (Fin 4)) + (a : ℕ → RationalSpaceTime) {y : SpaceTime} (ha : IsFastName a y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative c.val α y - rationalVector (c.evaluate α a ε hε)‖ ≤ (ε : ℝ) := by + rw [← c.val_diffWord α] + apply (pi_norm_le_iff_of_nonneg (Rat.cast_nonneg.mpr hε.le)).mpr + intro j + exact ((c j).diffWord α).evaluate_spec a ha ε hε + +end NonperiodicVector +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedBranchTrace.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedBranchTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..767ff533f9f1341076a6d5ad70be13fa26c854f3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedBranchTrace.lean @@ -0,0 +1,155 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarBranchAnchors +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedPulseSchedule + +namespace OAI + +/-! The eight actual local trajectories, translated to the fixed initial +particle chart. Their derivatives are derivatives of the full processor, +not merely of isolated polynomial fields. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting PlanarTiming Set +open scoped ContDiff + +theorem mem_translated_collar (δ : Fin 2 → ℚ) (R : RationalBox 2) (r : ℚ) (x : Plane) : + translatedPoint δ x ∈ (rectangleCollar (translatedBox δ R) r).carrier ↔ + x ∈ (rectangleCollar R r).carrier := by + constructor + · intro h j + have hj := h j + change ((R.lower j - 2 * r : ℚ) : ℝ) ≤ x j ∧ + x j ≤ ((R.upper j + 2 * r : ℚ) : ℝ) + change ((R.lower j + δ j - 2 * r : ℚ) : ℝ) ≤ x j + (δ j : ℝ) ∧ + x j + (δ j : ℝ) ≤ ((R.upper j + δ j + 2 * r : ℚ) : ℝ) at hj + push_cast at hj ⊢ + constructor <;> linarith [hj.1, hj.2] + · intro h j + have hj := h j + change ((R.lower j + δ j - 2 * r : ℚ) : ℝ) ≤ x j + (δ j : ℝ) ∧ + x j + (δ j : ℝ) ≤ ((R.upper j + δ j + 2 * r : ℚ) : ℝ) + change ((R.lower j - 2 * r : ℚ) : ℝ) ≤ x j ∧ + x j ≤ ((R.upper j + 2 * r : ℚ) : ℝ) at hj + push_cast at hj ⊢ + constructor <;> linarith [hj.1, hj.2] + +def branchCurve (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) (k : Fin 8) : ℝ → Plane := + (compiledPulse M hM (branchIndices M hM b k)).curve + (branchAnchors M hM b x k.castSucc) + +theorem branchCurve_start (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) (k : Fin 8) : + branchCurve M hM b x k (cut (actions M hM).length (branchIndices M hM b k).val) = + branchAnchors M hM b x k.castSucc := + Pulse.curve_before (compiledPulse_valid M hM _) _ (cut_le_start _) + +theorem branchCurve_endpoint (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) (k : Fin 8) : + (compiledPulse M hM (branchIndices M hM b k)).primitive.endpoint + (branchAnchors M hM b x k.castSucc) = branchAnchors M hM b x k.succ := by + change ((actions M hM).get (branchIndices M hM b k)).primitive.endpoint _ = _ + rw [branchIndices_get] + exact branchAnchors_endpoint M hM b x k + +theorem branchCurve_finish (M : Alternating.Machine) (hM : M.WellFormed) + (b : Branch (finiteMachine M hM)) (x : Plane) (k : Fin 8) : + branchCurve M hM b x k (cut (actions M hM).length ((branchIndices M hM b k).val + 1)) = + branchAnchors M hM b x k.succ := by + unfold branchCurve + rw [Pulse.curve_after (compiledPulse_valid M hM _) _ (by + change (finish (branchIndices M hM b k) : ℝ) ≤ _ + rw [finish_eq_cut])] + exact branchCurve_endpoint M hM b x k + +def normalizedAnchors (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 9) : Plane := + translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) + (branchAnchors (freshMachine I.1) (freshInput_valid hI).1 b x k) + +def normalizedCurve (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 8) (t : ℝ) : Plane := + translatedPoint (initialShift (freshInput I) (freshInput_valid hI)) + (branchCurve (freshMachine I.1) (freshInput_valid hI).1 b x k t) + +theorem normalizedCurve_start (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 8) : + normalizedCurve I hI b x k + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val) = + normalizedAnchors I hI b x k.castSucc := by + unfold normalizedCurve normalizedAnchors + rw [branchCurve_start] + +theorem normalizedCurve_finish (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 8) : + normalizedCurve I hI b x k + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + ((branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val + 1)) = + normalizedAnchors I hI b x k.succ := by + unfold normalizedCurve normalizedAnchors + rw [branchCurve_finish] + +theorem normalizedCurve_smooth (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (x : Plane) (k : Fin 8) : ContDiff ℝ ∞ (normalizedCurve I hI b x k) := by + exact (Pulse.curve_smooth _ _).add contDiff_const + +theorem normalizedCurve_mem (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 8) (t : ℝ) : normalizedCurve I hI b x k t ∈ + (normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).rectangle.carrier := + (mem_translatedBox _ _ _).mpr (branch_curve_mem_rectangle _ _ b hx k t) + +theorem normalizedCurve_chart (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 8) (t : ℝ) (j : Fin 2) : + 0 < normalizedCurve I hI b x k t j ∧ normalizedCurve I hI b x k t j < 1 := by + have hm := normalizedCurve_mem I hI b hx k t j + have hb := (normalizedPulse_inUnit I hI + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).2.2 j + have hc := (normalizedPulse_valid I hI + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).1 + have hb' : (0 : ℝ) < + ((normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).rectangle.lower j : ℝ) - + 2 * (normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).collar ∧ + ((normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).rectangle.upper j : ℝ) + + 2 * (normalizedPulse I hI (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).collar < 1 := by + exact_mod_cast hb + have hc' : (0 : ℝ) < (normalizedPulse I hI + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k)).collar := by exact_mod_cast hc + constructor <;> linarith [hm.1, hm.2, hb'.1, hb'.2] + +theorem normalizedCurve_ode (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (k : Fin 8) (t : ℝ) + (ht : t ∈ Icc + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + ((branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val + 1))) : + HasDerivAt (normalizedCurve I hI b x k) + (planarSlice (normalizedHamiltonian I hI) t (normalizedCurve I hI b x k t)) t := by + have hm := branch_curve_mem_rectangle _ _ b hx k t + have hd := Pulse.translated_hasDerivAt + (initialShift (freshInput I) (freshInput_valid hI)) (compiledPulse_valid _ _ _) + hm (Pulse.curve_ode (compiledPulse_valid _ _ _) _ t hm) + have h₀ := normalizedCurve_chart I hI b hx k t 0 + have h₁ := normalizedCurve_chart I hI b hx k t 1 + have he := normalizedSlice_on_cell I hI + (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k) ht + (normalizedCurve I hI b x k t) h₀ h₁ + exact hd.congr_deriv he.symm + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedDormantVelocity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedDormantVelocity.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f22fb44e7b53cb209b01cb1e428d32d89c82da2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedDormantVelocity.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BranchClockGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDormantZero + +namespace OAI + +/-! Every unused time cell has zero actual normalized planar velocity at +its waiting anchor. Spatial clearance and the final idle cell are explicit. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting PlanarTiming Set + +theorem translatedPoint_eq_shiftPoint : PlanarRouting.translatedPoint = shiftPoint := rfl + +theorem normalized_sparseAnchor_zero (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + (i : ℕ) (hi : i < (actions (freshMachine I.1) (freshInput_valid hI).1).length + 1) + (hne : ∀ k, (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b k).val ≠ i) + (s : ℝ) (hs : s ∈ Ico + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length i) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length (i + 1))) : + planarSlice (normalizedHamiltonian I hI) s + (sparseAnchor (branchIndices (freshMachine I.1) (freshInput_valid hI).1 b) + (normalizedAnchors I hI b x) i) = 0 := by + let n := (actions (freshMachine I.1) (freshInput_valid hI).1).length + let J := branchIndices (freshMachine I.1) (freshInput_valid hI).1 b + have hchart : sparseAnchor J (normalizedAnchors I hI b x) i ∈ clockRectangle.carrier := + normalizedAnchors_clock I hI b hx _ + have h₀ := hchart 0 + have h₁ := hchart 1 + have h₀' : sparseAnchor J (normalizedAnchors I hI b x) i 0 ∈ Ioo (0 : ℝ) 1 := by + change ((1 / 8 : ℚ) : ℝ) ≤ _ ∧ _ ≤ ((7 / 8 : ℚ) : ℝ) at h₀ + constructor <;> norm_num at h₀ ⊢ <;> linarith [h₀.1, h₀.2] + have h₁' : sparseAnchor J (normalizedAnchors I hI b x) i 1 ∈ Ioo (0 : ℝ) 1 := by + change ((1 / 32 : ℚ) : ℝ) ≤ _ ∧ _ ≤ ((7 / 8 : ℚ) : ℝ) at h₁ + constructor <;> norm_num at h₁ ⊢ <;> linarith [h₁.1, h₁.2] + by_cases hin : i < n + · let ii : Fin n := ⟨i, hin⟩ + have hm := sparseAnchor_notMem_collar _ _ b hx ii hne + have hm' : sparseAnchor J (normalizedAnchors I hI b x) i ∉ + (rectangleCollar (normalizedPulse I hI ii).rectangle (normalizedPulse I hI ii).collar).carrier := by + intro he + exact hm ((mem_translated_collar _ _ _ _).mp he) + rw [normalizedSlice_on_cell I hI ii ⟨hs.1, hs.2.le⟩ _ h₀' h₁'] + exact Pulse.velocity_zero_of_notMem (normalizedPulse_valid I hI ii) hm' s + · have he : i = n := by omega + subst i + apply normalizedSlice_on_tail I hI _ _ h₀' h₁' + exact ⟨hs.1, (hs.2.trans_le (by rw [cut_last])).le⟩ + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b610e0d0f79ac2a24ef91706b8ade4a619356bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarProgram.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTranslation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarInitialShift + +namespace OAI + +/-! The finite Hamiltonian data for the prescribed initial particle. All +branches are translated by the same rational normalization, after adjoining +the fresh nonhalting initial state. -/ + +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting + +def normalizedPulse (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (i : Fin (actions (freshMachine I.1) (freshInput_wellFormed hI)).length) : Pulse := + (compiledPulse (freshMachine I.1) (freshInput_wellFormed hI) i).translated + (initialShift (freshInput I) (freshInput_valid hI)) + +theorem normalizedPulse_valid (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (i : Fin (actions (freshMachine I.1) (freshInput_valid hI).1).length) : + (normalizedPulse I hI i).Valid := + Pulse.translated_valid _ (compiledPulse_valid _ _ i) + +theorem normalizedPulse_inUnit (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (i : Fin (actions (freshMachine I.1) (freshInput_valid hI).1).length) : + (normalizedPulse I hI i).InUnit := by + let M := freshMachine I.1 + let hM := (freshInput_valid hI).1 + have hδ := initialShift_small_rat (freshInput I) (freshInput_valid hI) + (fresh_initial_nonhalting I hI) + apply Pulse.translated_inUnit _ (compiledPulse_inUnit M hM i) + (Action.rectangle_between ((actions M hM).get i)) + · have hc := routingCollar_parking_bound M hM + have hε := parkingScale_le (geometricBranches M hM).length + change routingCollar M hM ≤ 1 / 65536 + linarith + · intro j + fin_cases j + · change -(1 / 128 : ℚ) ≤ initialShift (freshInput I) (freshInput_valid hI) 0 ∧ + initialShift (freshInput I) (freshInput_valid hI) 0 ≤ 1 / 128 + obtain ⟨hl, hu⟩ := abs_le.mp hδ.1 + constructor <;> linarith + · change -(1 / 128 : ℚ) ≤ initialShift (freshInput I) (freshInput_valid hI) 1 ∧ + initialShift (freshInput I) (freshInput_valid hI) 1 ≤ 1 / 128 + obtain ⟨hl, hu⟩ := abs_le.mp hδ.2 + constructor <;> linarith + +def normalizedHamiltonian (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + FieldExpr := processorExpression (normalizedPulse I hI) + +theorem normalizedHamiltonian_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : (normalizedHamiltonian I hI).Valid := + processorExpression_valid (normalizedPulse_valid I hI) + +theorem normalizedHamiltonian_noTime (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + SpatialExpression.NoTime (normalizedHamiltonian I hI) := processorExpression_noTime _ + +theorem normalizedHamiltonian_unitPeriods (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + SpatialExpression.UnitPeriods (normalizedHamiltonian I hI) := processorExpression_unitPeriods _ + +theorem normalizedHamiltonian_periodic (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + CubePeriodic 1 (SpatialExpression.spatialValue (normalizedHamiltonian I hI)) := + SpatialExpression.unitPeriods_periodic (normalizedHamiltonian_unitPeriods I hI) + +end ForcedComputation.Recorder.Planar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarRouting.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3a94a154a09d7536dd8fcbd7b295b363e6db226 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPlanarRouting.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedDormantVelocity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarConcatenation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarStepBranch + +namespace OAI + +/-! One complete period of the actual planar processor implements every +filled instruction rectangle and, consequently, each encoded machine step. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting PlanarTiming Set + +theorem normalized_branch_planar_in (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {S : Set Plane} (hp : ∀ k, normalizedAnchors I hI b x k ∈ S) + (hcurve : ∀ k t, normalizedCurve I hI b x k t ∈ S) : + Ψ 0 1 (normalizedAnchors I hI b x 0) = normalizedAnchors I hI b x 8 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, Ψ 0 s (normalizedAnchors I hI b x 0) ∈ S := by + let n := (actions (freshMachine I.1) (freshInput_valid hI).1).length + exact sparse_planarTransition hΨ + (planarSlice_lipschitz (normalizedHamiltonian_valid I hI) (normalizedHamiltonian_noTime I hI)) + (N := n + 1) (by omega) (by omega) + (branchIndices_strictMono _ _ b) (normalizedAnchors I hI b x) (normalizedCurve I hI b x) + (cut n) (cut_zero n) (cut_last n) (fun i _ => cut_mono n (by omega)) + (normalizedCurve_start I hI b x) (normalizedCurve_finish I hI b x) + (fun k => (normalizedCurve_smooth I hI b x k).continuous.continuousOn) + (fun k s hs => normalizedCurve_ode I hI b hx k s ⟨hs.1, hs.2.le⟩) + (normalized_sparseAnchor_zero I hI b hx) hp (fun k s _ => hcurve k s) + +theorem normalized_branch_planar (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) : + Ψ 0 1 (normalizedAnchors I hI b x 0) = normalizedAnchors I hI b x 8 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, + Ψ 0 s (normalizedAnchors I hI b x 0) ∈ clockRectangle.carrier := + normalized_branch_planar_in I hI b hx hΨ + (normalizedAnchors_clock I hI b hx) (normalizedCurve_clock I hI b hx) + +theorem normalized_branch_planar_safe (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hn : recorderHalting (freshMachine I.1) b.target = false) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) : + Ψ 0 1 (normalizedAnchors I hI b x 0) = normalizedAnchors I hI b x 8 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, + Ψ 0 s (normalizedAnchors I hI b x 0) ∈ {y : Plane | y ∈ clockRectangle.carrier ∧ 3 / 16 ≤ y 1} := + normalized_branch_planar_in I hI b hx hΨ + (fun k => ⟨normalizedAnchors_clock I hI b hx k, normalizedAnchors_safe I hI b hn hx k⟩) + (fun k s => ⟨normalizedCurve_clock I hI b hx k s, normalizedCurve_safe I hI b hn hx k s⟩) + +theorem normalized_planar_step (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Ψ : ℝ → ℝ → Plane → Plane} + (hΨ : IsPlanarTransition (planarSlice (normalizedHamiltonian I hI)) Ψ) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hstep : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) : + Ψ 0 1 (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) = + shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 D) := by + obtain ⟨b, _, _, hx, he⟩ := step_branch hstep + have h := (normalized_branch_planar I hI b hx hΨ).1 + simpa [normalizedAnchors, branchAnchors_first, branchAnchors_last, he, translatedPoint_eq_shiftPoint] using h + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPulseSchedule.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPulseSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..d59205fa777e628d17dd0d419f7f31d7b8043e59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedPulseSchedule.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSchedule +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarCompactBridge + +namespace OAI + +/-! The actual normalized Hamiltonian follows the same disjoint pulse +schedule as the unshifted program. -/ + +noncomputable section +namespace ForcedComputation.PlanarTiming +open ShearFlows Set + +theorem cell_in_unit (n i : ℕ) (hi : i ≤ n) {t : ℝ} + (ht : t ∈ Icc (cut n i) (cut n (i + 1))) : t ∈ Icc (0 : ℝ) 1 := by + have hn : (0 : ℝ) < (n : ℝ) + 1 := by positivity + have hl : 0 ≤ cut n i := div_nonneg (Nat.cast_nonneg _) hn.le + have hu : cut n (i + 1) ≤ 1 := by + apply (div_le_one hn).mpr + exact_mod_cast Nat.succ_le_succ hi + exact ⟨hl.trans ht.1, ht.2.trans hu⟩ + +end ForcedComputation.PlanarTiming + +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarTiming Set + +theorem normalizedProcessor_on_cell (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (i : Fin (actions (freshMachine I.1) (freshInput_valid hI).1).length) {t : ℝ} + (ht : t ∈ Icc (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length i.val) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length (i.val + 1))) + (x : Plane) : + processorVelocity (normalizedPulse I hI) t x = (normalizedPulse I hI i).velocity t x := by + rw [processorVelocity_eq_sum] + apply Finset.sum_eq_single i + · intro j _ hji + change pulse j t • (normalizedPulse I hI j).spatial x = 0 + rw [pulse_other_on_cell hji.symm ht, zero_smul] + · intro hi + exact False.elim (hi (Finset.mem_univ i)) + +theorem normalizedProcessor_on_tail (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {t : ℝ} + (ht : cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (actions (freshMachine I.1) (freshInput_valid hI).1).length ≤ t) (x : Plane) : + processorVelocity (normalizedPulse I hI) t x = 0 := by + rw [processorVelocity_eq_sum] + apply Finset.sum_eq_zero + intro i _ + change pulse i t • (normalizedPulse I hI i).spatial x = 0 + rw [pulse_on_tail i ht, zero_smul] + +theorem normalizedSlice_on_unit (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) (x : Plane) + (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + planarSlice (normalizedHamiltonian I hI) t x = + processorVelocity (normalizedPulse I hI) t x := + (normalized_planar_field_on_chart I hI t x hx₀ hx₁).symm.trans + (periodicVelocity_on_unit (normalizedPulse_valid I hI) (normalizedPulse_inUnit I hI) ht x) + +theorem normalizedSlice_on_cell (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (i : Fin (actions (freshMachine I.1) (freshInput_valid hI).1).length) {t : ℝ} + (ht : t ∈ Icc (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length i.val) + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length (i.val + 1))) + (x : Plane) (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + planarSlice (normalizedHamiltonian I hI) t x = (normalizedPulse I hI i).velocity t x := + (normalizedSlice_on_unit I hI (cell_in_unit _ _ i.isLt.le ht) x hx₀ hx₁).trans + (normalizedProcessor_on_cell I hI i ht x) + +theorem normalizedSlice_on_tail (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {t : ℝ} + (ht : t ∈ Icc + (cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (actions (freshMachine I.1) (freshInput_valid hI).1).length) 1) + (x : Plane) (hx₀ : x 0 ∈ Ioo (0 : ℝ) 1) (hx₁ : x 1 ∈ Ioo (0 : ℝ) 1) : + planarSlice (normalizedHamiltonian I hI) t x = 0 := by + have hzero : 0 ≤ cut (actions (freshMachine I.1) (freshInput_valid hI).1).length + (actions (freshMachine I.1) (freshInput_valid hI).1).length := by + apply div_nonneg (Nat.cast_nonneg _) + positivity + exact (normalizedSlice_on_unit I hI ⟨hzero.trans ht.1, ht.2⟩ x hx₀ hx₁).trans + (normalizedProcessor_on_tail I hI ht.1 x) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedSuspensionRouting.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedSuspensionRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..60c09a9cc24d1e33e5055faeaa6e177f659be3a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/NormalizedSuspensionRouting.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedDormantVelocity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SparseSuspension + +namespace OAI + +/-! The finite geometric exclusion condition implies the exact one-period +material trajectory of the normalized stationary suspension. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarHamiltonian PlanarRouting PlanarTiming Set + +/-- The pulse schedule, spatial clearance, ODE, endpoints and clock bounds +all come from the finite compiler. -/ +theorem normalized_branch_suspension_in (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) + {S : Set Plane} (hS : S ⊆ clockRectangle.carrier) + (hp : ∀ k, normalizedAnchors I hI b x k ∈ S) + (hcurve : ∀ k t, normalizedCurve I hI b x k t ∈ S) : + Φ 1 (atHeight (normalizedAnchors I hI b x 0) 0) = + atHeight (normalizedAnchors I hI b x 8) 1 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, + horizontal (Φ s (atHeight (normalizedAnchors I hI b x 0) 0)) ∈ S := by + let n := (actions (freshMachine I.1) (freshInput_valid hI).1).length + exact sparse_suspension (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_periodic I hI) hΦ (N := n + 1) (by omega) (by omega) + (branchIndices_strictMono _ _ b) (normalizedAnchors I hI b x) (normalizedCurve I hI b x) + (cut n) (cut_zero n) (cut_last n) (fun i _ => cut_mono n (by omega)) + (normalizedCurve_start I hI b x) (normalizedCurve_finish I hI b x) + (fun k => (normalizedCurve_smooth I hI b x k).continuous.continuousOn) + (fun k s hs => normalizedCurve_ode I hI b hx k s ⟨hs.1, hs.2.le⟩) + (normalized_sparseAnchor_zero I hI b hx) hS hp (fun k s _ => hcurve k s) + +theorem normalized_branch_suspension (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) : + Φ 1 (atHeight (normalizedAnchors I hI b x 0) 0) = + atHeight (normalizedAnchors I hI b x 8) 1 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, + horizontal (Φ s (atHeight (normalizedAnchors I hI b x 0) 0)) ∈ clockRectangle.carrier := by + exact normalized_branch_suspension_in I hI b hx hΦ (S := clockRectangle.carrier) + Subset.rfl (normalizedAnchors_clock I hI b hx) (normalizedCurve_clock I hI b hx) + +theorem normalized_branch_suspension_safe (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hn : recorderHalting (freshMachine I.1) b.target = false) + {x : Plane} (hx : x ∈ (instruction (freshMachine I.1) (freshInput_valid hI).1 b).source.carrier) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) : + Φ 1 (atHeight (normalizedAnchors I hI b x 0) 0) = + atHeight (normalizedAnchors I hI b x 8) 1 ∧ + ∀ s ∈ Icc (0 : ℝ) 1, + horizontal (Φ s (atHeight (normalizedAnchors I hI b x 0) 0)) ∈ {y : Plane | y ∈ clockRectangle.carrier ∧ 3 / 16 ≤ y 1} := by + exact normalized_branch_suspension_in I hI b hx hΦ + (S := {y : Plane | y ∈ clockRectangle.carrier ∧ 3 / 16 ≤ y 1}) + (fun _ h => h.1) + (fun k => ⟨normalizedAnchors_clock I hI b hx k, normalizedAnchors_safe I hI b hn hx k⟩) + (fun k t => ⟨normalizedCurve_clock I hI b hx k t, normalizedCurve_safe I hI b hn hx k t⟩) + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ObservationByInstruction.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ObservationByInstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..572edb9f6340cbfd0136869d77cb8698850f02aa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ObservationByInstruction.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.IntermediateObservation + +namespace OAI + +namespace ShearFlows +open Set + +theorem materialFlow_first_ge_of_mem {d : Input} (hd : ValidInput d) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) + {b : Instruction} (hb : b ∈ d.instructions) {x : Plane} (hx : x ∈ b.source.carrier) + {a t : ℝ} (hs : a ≤ b.source.center 0) (htarget : a ≤ b.target.center 0) + (ht : t ∈ Icc (0 : ℝ) 1) : + a - 2 * (d.h : ℝ) ≤ Φ t (atHeight x d.codingHeight) 0 := by + obtain ⟨i, hi, he⟩ := List.mem_iff_getElem.mp hb + let k : Fin d.instructions.length := ⟨i, hi⟩ + have hsource : d.sources k = b.source := by change d.instructions[i].source = b.source; rw [he] + have htarget' : d.targets k = b.target := by change d.instructions[i].target = b.target; rw [he] + apply materialFlow_first_ge hd hΦ k + · rwa [hsource] + · change a ≤ (d.sources k).center 0 + rwa [hsource] + · change a ≤ (d.targets k).center 0 + rwa [htarget'] + · exact ht + +theorem materialFlow_first_le_of_mem {d : Input} (hd : ValidInput d) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) + {b : Instruction} (hb : b ∈ d.instructions) {x : Plane} (hx : x ∈ b.source.carrier) + {a t : ℝ} (hs : b.source.center 0 ≤ a) (htarget : b.target.center 0 ≤ a) + (ht : t ∈ Icc (0 : ℝ) 1) : + Φ t (atHeight x d.codingHeight) 0 ≤ a + 2 * (d.h : ℝ) := by + obtain ⟨i, hi, he⟩ := List.mem_iff_getElem.mp hb + let k : Fin d.instructions.length := ⟨i, hi⟩ + have hsource : d.sources k = b.source := by change d.instructions[i].source = b.source; rw [he] + have htarget' : d.targets k = b.target := by change d.instructions[i].target = b.target; rw [he] + apply materialFlow_first_le hd hΦ k + · rwa [hsource] + · change (d.sources k).center 0 ≤ a + rwa [hsource] + · change (d.targets k).center 0 ≤ a + rwa [htarget'] + · exact ht + +end ShearFlows + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionCorollaries.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionCorollaries.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d953d0246dbf7a997389129d6101d597f39b7f7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionCorollaries.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ParticleEvents + +namespace OAI + +/-! Undecidability of the compiled particle experiments, conditional only on +the separately cited finite-machine halting input. -/ + +namespace ForcedComputation +open ShearFlows + +/-- 379-01, the undecidability corollary for the initialized experiment. -/ +theorem initialized_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (machineVelocity I hI) ![1 / 8, 3 / 8, 1 / 2] particleRightHalf) := + noCompiledInputDecider_of_halting hT (fun I hI => initialized_material_event_iff I hI hν) + +/-- 379-02, the fixed-particle undecidability corollary. -/ +theorem fixed_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (fixedParticleVelocity I hI) ![1 / 8, 3 / 8, 0] particleRightHalf) := + noCompiledInputDecider_of_halting hT (fun I hI => fixed_particle_material_event_iff I hI hν) + +/-- 379-03, eventual stationarity does not make the particle event decidable. -/ +theorem stationary_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (stationaryVelocity I hI) stationaryStartingPoint + stationaryObserver) := + noCompiledInputDecider_of_halting hT (fun I hI => stationary_material_event_iff I hI hν) + +/-- 379-08, the logarithmic-clock particle event remains undecidable. -/ +theorem slow_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (torusSlowVelocity I hI) ![1 / 4, 1 / 2, 1 / 2] particleRightHalf) := + noCompiledInputDecider_of_halting hT (fun I hI => slow_material_event_iff I hI hν) + +/-- The interspersed-history prefix experiment has no total decision algorithm. -/ +theorem prefix_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (prefixVelocity I hI) ![1 / 8, 1 / 4, 1 / 4] particleRightHalf) := + noCompiledInputDecider_of_halting hT (fun I hI => prefix_material_event_iff I hI hν) + +/-- Repeating the initializer does not make the material observation decidable. -/ +theorem periodic_particle_undecidable (hT : FiniteMachineHaltingUndecidable) + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (periodicVelocity I hI) ![1 / 4, 1 / 2, 1 / 4] + {x | 1 / 2 < x 0 ∧ x 0 < 7 / 8}) := + noCompiledInputDecider_of_halting hT (fun I hI => periodic_material_event_iff I hI hν) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionUnconditional.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionUnconditional.lean new file mode 100644 index 0000000000000000000000000000000000000000..e17d5de0352489a62bc17a81da6b02ab337a82f4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleDecisionUnconditional.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ParticleDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteMachineHaltingDischarge + +namespace OAI + +/-! Particle-decision main results with the finite-machine input discharged. -/ + +namespace ForcedComputation +open ShearFlows + +theorem initialized_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (machineVelocity I hI) ![1 / 8, 3 / 8, 1 / 2] particleRightHalf) := + initialized_particle_undecidable finiteMachineHaltingUndecidable hν + +theorem fixed_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (fixedParticleVelocity I hI) ![1 / 8, 3 / 8, 0] particleRightHalf) := + fixed_particle_undecidable finiteMachineHaltingUndecidable hν + +theorem stationary_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (stationaryVelocity I hI) stationaryStartingPoint + stationaryObserver) := + stationary_particle_undecidable finiteMachineHaltingUndecidable hν + +theorem slow_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (torusSlowVelocity I hI) ![1 / 4, 1 / 2, 1 / 2] particleRightHalf) := + slow_particle_undecidable finiteMachineHaltingUndecidable hν + +theorem prefix_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (prefixVelocity I hI) ![1 / 8, 1 / 4, 1 / 4] particleRightHalf) := + prefix_particle_undecidable finiteMachineHaltingUndecidable hν + +theorem periodic_particle_undecidable_unconditional + {ν : ℝ} (hν : 0 < ν) : + NoCompiledInputDecider (fun I hI => + MaterialEvent (periodicVelocity I hI) ![1 / 4, 1 / 2, 1 / 4] + {x | 1 / 2 < x 0 ∧ x 0 < 7 / 8}) := + periodic_particle_undecidable finiteMachineHaltingUndecidable hν + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleEvents.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleEvents.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9f0bd43f034c98ebcc1660bf5e7613242c94b3a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ParticleEvents.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MachineDecisionInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FixedParticleMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusSlowMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PrefixMain +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicMain + +namespace OAI + +/-! Decision corollaries for the actual compiled fluid experiments. +The sole new premise is the separately cited finite-machine halting input. +The particle events and their equivalence to halting are proved from the +compiled Navier–Stokes main results, including uniqueness of material flow. +-/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set + +/-- The designated particle of the prescribed fluid enters the open set. -/ +def MaterialEvent (V : Velocity) (a : Space) (O : Set Space) : Prop := + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 V Φ ∧ Reaches (fun t => Φ t a) O + +theorem materialEvent_iff {V : Velocity} {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 V Φ) (a : Space) (O : Set Space) : + MaterialEvent V a O ↔ Reaches (fun t => Φ t a) O := by + constructor + · rintro ⟨Ψ, hΨ, t, ht, hx⟩ + have he : Ψ t a = Φ t a := + hΦ.unique a (fun s => Ψ s a) (hΨ.initial a) (fun s => hΨ.ode s a) t + exact ⟨t, ht, by simpa only [he] using hx⟩ + · intro h + exact ⟨Φ, hΦ, h⟩ + +def particleRightHalf : Set Space := {x | 1 / 2 < x 0 ∧ x 0 < 1} + +theorem initialized_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (machineVelocity I hI) ![1 / 8, 3 / 8, 1 / 2] particleRightHalf ↔ + Alternating.Halts I := by + obtain ⟨_, _, _, Φ, hΦ, he⟩ := initialized_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans (by + simpa only [Reaches, particleRightHalf, mem_ofPred_eq] using he.symm) + +theorem fixed_particle_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (fixedParticleVelocity I hI) ![1 / 8, 3 / 8, 0] particleRightHalf ↔ + Alternating.Halts I := by + obtain ⟨_, _, _, Φ, hΦ, he⟩ := fixed_particle_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans (by + simpa only [Reaches, particleRightHalf, mem_ofPred_eq] using he.symm) + +theorem stationary_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (stationaryVelocity I hI) stationaryStartingPoint + stationaryObserver ↔ Alternating.Halts I := by + obtain ⟨_, _, _, _, _, Φ, hΦ, he⟩ := stationary_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans he + +theorem slow_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (torusSlowVelocity I hI) ![1 / 4, 1 / 2, 1 / 2] particleRightHalf ↔ + Alternating.Halts I := by + obtain ⟨_, _, _, _, Φ, hΦ, he⟩ := torus_slow_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans (by + simpa only [Reaches, particleRightHalf, mem_ofPred_eq] using he.symm) + +theorem prefix_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (prefixVelocity I hI) ![1 / 8, 1 / 4, 1 / 4] particleRightHalf ↔ + Alternating.Halts I := by + obtain ⟨_, _, _, Φ, hΦ, he⟩ := prefix_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans (by + simpa only [Reaches, particleRightHalf, mem_ofPred_eq] using he.symm) + +theorem periodic_material_event_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {ν : ℝ} (hν : 0 < ν) : + MaterialEvent (periodicVelocity I hI) ![1 / 4, 1 / 2, 1 / 4] + {x | 1 / 2 < x 0 ∧ x 0 < 7 / 8} ↔ Alternating.Halts I := by + obtain ⟨_, _, _, _, Φ, hΦ, he⟩ := periodic_effective_computation I hI ν hν + exact (materialEvent_iff hΦ _ _).trans (by + simpa only [Reaches, mem_ofPred_eq] using he.symm) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicFlow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbeafa9d2c362c6f36d10b610130898a95c78ffa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicFlow.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.MaterialFlow + +namespace OAI + +/-! Integer-time sampling of the material flow of a periodic program. -/ + +noncomputable section + +namespace ShearFlows + +theorem TimePeriodic.nat_shift {V : Velocity} (hV : TimePeriodic V) + (n : ℕ) (t : ℝ) (x : Space) : V (t + (n : ℝ), x) = V (t, x) := by + have hp : Function.Periodic (fun s => V (s, x)) 1 := fun s => hV s x + simpa only [mul_one] using hp.nat_mul n t + +theorem IsMaterialFlow.nat_shift {L : ℝ} {V : Velocity} + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow L V Φ) (hV : TimePeriodic V) + (n : ℕ) (t : ℝ) (a : Space) : + Φ (t + (n : ℝ)) a = Φ t (Φ n a) := by + apply hΦ.unique (Φ n a) (fun s => Φ (s + (n : ℝ)) a) + · simp + · intro s + have hd := (hΦ.ode (s + (n : ℝ)) a).scomp s ((hasDerivAt_id s).add_const (n : ℝ)) + simpa only [one_smul, Function.comp_def, id_eq, hV.nat_shift] using hd + +theorem IsMaterialFlow.nat_eq_iterate {L : ℝ} {V : Velocity} + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow L V Φ) (hV : TimePeriodic V) + (n : ℕ) (a : Space) : Φ n a = (Φ 1)^[n] a := by + induction n with + | zero => simpa using hΦ.initial a + | succ n ih => + rw [Nat.cast_add, Nat.cast_one, add_comm, hΦ.nat_shift hV, ih] + exact (Function.iterate_succ_apply' _ _ _).symm + +end ShearFlows + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..753e76f5defc1fc1a8d591a111341f469907a70d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryGeometry.lean @@ -0,0 +1,148 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeTransform + +namespace OAI + +/-! The exact label and open slab of the rapid torus corollary. -/ + +noncomputable section +open Set +open scoped ContDiff BigOperators +namespace PeriodicLattice.RapidTorus +open TorusCalculus Planar Scales + +def corollaryStart : Space := WithLp.toLp 2 ![1 / 2, 1 / 4, 1 / 2] +def corollaryDetector : Set Torus := + {q | ∃ s : ℝ, 1 / 4 < s ∧ s < 3 / 8 ∧ (s : UnitAddCircle) = q 0} + +def pointTransform (x : Space) : Space := + transverseLinear x + WithLp.toLp 2 ![5 / 8, -(1 / 4), 0] + +theorem pointTransform_first (x : Space) : + pointTransform x 0 = 5 / 8 - x 0 / 2 := by + simp [pointTransform, transverseLinear_apply, PiLp.add_apply] + ring + +theorem pointTransform_second (x : Space) : pointTransform x 1 = x 1 - 1 / 4 := by + simp [pointTransform, transverseLinear_apply, PiLp.add_apply, sub_eq_add_neg] + +theorem pointTransform_third (x : Space) : pointTransform x 2 = x 2 := by + simp [pointTransform, transverseLinear_apply, PiLp.add_apply] + +theorem pointTransform_initial : pointTransform initialParticle = corollaryStart := by + ext i + fin_cases i <;> norm_num [pointTransform, transverseLinear_apply, initialParticle, + corollaryStart, PiLp.add_apply] + +theorem corollaryDetector_open : IsOpen corollaryDetector := by + have he : corollaryDetector = (fun q : Torus => q 0) ⁻¹' + ((fun s : ℝ => (s : UnitAddCircle)) '' Ioo (1 / 4) (3 / 8)) := by + ext q + simp [corollaryDetector, and_assoc] + rw [he] + have hopen : IsOpen ((fun s : ℝ => (s : UnitAddCircle)) '' Ioo (1 / 4) (3 / 8)) := + QuotientAddGroup.isOpenMap_coe _ isOpen_Ioo + exact hopen.preimage (continuous_apply 0) + +theorem corollaryDetector_mem {x : Space} (hx0 : 0 ≤ x 0) (hx1 : x 0 < 1) : + torusMk x ∈ corollaryDetector ↔ 1 / 4 < x 0 ∧ x 0 < 3 / 8 := by + constructor + · rintro ⟨s, hs0, hs1, he⟩ + have hx : x 0 ∈ Ico (0 : ℝ) (0 + 1) := ⟨hx0, by simpa using hx1⟩ + have hs : s ∈ Ico (0 : ℝ) (0 + 1) := ⟨by linarith, by linarith⟩ + have h := (AddCircle.coe_eq_coe_iff_of_mem_Ico hs hx).mp he + exact h ▸ ⟨hs0, hs1⟩ + · exact fun h => ⟨x 0, h.1, h.2, rfl⟩ + +theorem transformed_curve_event {b : ℕ} (hb : 2 ≤ b) (L : ℕ) (c : ℕ → ℕ) + (H : ℕ → ℤ → Bool) : + (∃ t : ℝ, 0 ≤ t ∧ + torusMk (pointTransform (embed (curve b L c H t))) ∈ corollaryDetector) ↔ + ∃ n : ℕ, H n (c n) = true := by + constructor + · rintro ⟨t, ht, hevent⟩ + by_contra hn + have hall : ∀ n, H n (c n) = false := by + intro n + exact Bool.eq_false_iff.mpr (fun hh => hn ⟨n, hh⟩) + obtain ⟨hlo, hhi⟩ := curve_no_signal hb L c H hall ht + have hp0 : 0 ≤ pointTransform (embed (curve b L c H t)) 0 := by + rw [pointTransform_first, embed_first] + linarith + have hp1 : pointTransform (embed (curve b L c H t)) 0 < 1 := by + rw [pointTransform_first, embed_first] + linarith + have hh := (corollaryDetector_mem hp0 hp1).mp hevent + rw [pointTransform_first, embed_first] at hh + linarith + · intro hn + let n := Nat.find hn + have hs : H n (c n) = true := Nat.find_spec hn + have hp : ∀ m < n, H m (c m) = false := by + intro m hm + exact Bool.eq_false_iff.mpr (Nat.find_min hn hm) + have he : (curve b L c H (n + 2)).1 = 1 / 2 + beta b L (n + 1) := by + rw [curve_x_slot b L c H n hp (by linarith) le_rfl, hs, + Profiles.clock_one (by linarith), Signal.halting_end] + have hβ0 := beta_pos hb L (n + 1) + have hβ1 : beta b L (n + 1) < 1 / 4 := by + simpa only [beta_zero] using beta_strictAnti hb L (Nat.succ_pos n) + have hlo : 1 / 4 < pointTransform (embed (curve b L c H (n + 2))) 0 := by + rw [pointTransform_first, embed_first, he] + linarith + have hhi : pointTransform (embed (curve b L c H (n + 2))) 0 < 3 / 8 := by + rw [pointTransform_first, embed_first, he] + linarith + exact ⟨(n : ℝ) + 2, by positivity, + (corollaryDetector_mem (by linarith) (by linarith)).mpr ⟨hlo, hhi⟩⟩ + +theorem transformed_path_event (d : Input) (hd : d.WellFormed) : + (∃ t : ℝ, 0 ≤ t ∧ + torusMk (pointTransform (FluidLift.path d t)) ∈ corollaryDetector) ↔ Halts d := by + have he := CompilerPlanar.path_event_iff d hd + rw [CompilerPlanar.path, curve_event_iff (CompilerPlanar.radix_ge_two d)] at he + exact (transformed_curve_event (CompilerPlanar.radix_ge_two d) _ _ _).trans he + +theorem velocity_shift_pointTransform (d : Input) (t : ℝ) (x : Space) : + FluidLift.velocity d t (shift (torusMk (pointTransform x))) = + FluidLift.velocity d t (torusMk x) := by + rw [shift, ← mk_add, FluidLift.velocity_cover, FluidLift.velocity_cover] + have hy : (pointTransform x + shiftVector) 1 = x 1 := by + rw [PiLp.add_apply, pointTransform_second] + norm_num [shiftVector] + have hz : (pointTransform x + shiftVector) 2 = x 2 := by + rw [PiLp.add_apply, pointTransform_third] + norm_num [shiftVector] + rw [hy, hz] + +def corollaryPath (d : Input) (t : ℝ) : Space := pointTransform (FluidLift.path d t) + +theorem corollaryPath_start (d : Input) : corollaryPath d 0 = corollaryStart := by + rw [corollaryPath, FluidLift.path_start, pointTransform_initial] + +theorem corollaryPath_hasDerivAt (d : Input) (hd : d.WellFormed) {t : ℝ} (ht : 0 ≤ t) : + HasDerivAt (corollaryPath d) + (transformedField (FluidLift.velocity d) t (torusMk (corollaryPath d t))) t := by + have h := (transverseLinear.hasFDerivAt.comp_hasDerivAt t + (FluidLift.path_hasDerivAt d hd ht)).add_const + (WithLp.toLp 2 ![5 / 8, -(1 / 4), 0] : Space) + change HasDerivAt (corollaryPath d) + (transverseLinear (FluidLift.velocity d t (torusMk (FluidLift.path d t)))) t at h + simpa only [transformedField, shiftedField, corollaryPath, + velocity_shift_pointTransform] using h + +theorem corollaryPath_unique (d : Input) (hd : d.WellFormed) {Y : ℝ → Space} + (hY₀ : Y 0 = corollaryStart) + (hY : ∀ t : ℝ, 0 ≤ t → HasDerivWithinAt Y + (transformedField (FluidLift.velocity d) t (torusMk (Y t))) (Ici 0) t) + {t : ℝ} (ht : 0 ≤ t) : Y t = corollaryPath d t := by + apply Trajectories.unique (v := fun s x => transformedField (FluidLift.velocity d) s (torusMk x)) + ((transformedField_smooth (FluidLift.velocity_contDiff d)).of_le + (by exact WithTop.coe_le_coe.mpr le_top)) + hY (fun s hs => (corollaryPath_hasDerivAt d hd hs).hasDerivWithinAt) _ ht + rw [hY₀, corollaryPath_start] + +end PeriodicLattice.RapidTorus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..408fbb04b2ed1b491594fd46fa71410ab0ec60df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeCorollaryMain.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeCorollaryGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeEffective + +namespace OAI + +/-! The rapid-torus corollary with its stated fixed particle and observation +slab. The construction is a rational transverse change of the proved lattice +program; in particular no Poisson existence or computation assumption is used. -/ + +noncomputable section +open Set +open scoped ContDiff +namespace PeriodicLattice.RapidTorus +open TorusCalculus Quantitative EffectiveFields + +def IsCorollaryParticle (U : VectorField) (X : ℝ → Space) : Prop := + X 0 = corollaryStart ∧ ∀ t : ℝ, 0 ≤ t → + HasDerivWithinAt X (U t (torusMk (X t))) (Ici 0) t + +def CorollaryConclusion (ν : ℝ) (d : Input) (U f : VectorField) (p : ScalarField) + (C : ℕ → MultiIndex → ℕ → ℕ) : Prop := + Smooth U ∧ Smooth f ∧ Smooth p ∧ + MeanZero U ∧ MeanZero f ∧ MeanZero p ∧ Solenoidal f ∧ + ClassicalSolution ν f U p ∧ UniqueClassical ν f U p ∧ + RapidPair U f C ∧ + ∃ X : ℝ → Space, IsCorollaryParticle U X ∧ + (∀ Y : ℝ → Space, IsCorollaryParticle U Y → + ∀ t : ℝ, 0 ≤ t → Y t = X t) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ torusMk (X t) ∈ corollaryDetector) ↔ Halts d) + +/-- Corollary `cor:rapid-torus` of paper 379-06: the exact fixed label is +`(1/2,1/4,1/2)` and the open observation slab is `1/4 < x₀ < 3/8`. +Both the velocity and solenoidal force have terminating evaluators and +computable bounds for every mixed derivative and every polynomial decay rate. -/ +theorem solenoidal_rapid_torus (ν : ℝ) (hν : 0 < ν) (hc : ComputableReal ν) : + IsOpen corollaryDetector ∧ + ∃ (U f : Input → VectorField) (p : Input → ScalarField) + (C : Input → ℕ → MultiIndex → ℕ → ℕ), + UniformlyEffective U ∧ UniformlyEffective f ∧ EffectiveConstants C ∧ + ∀ d : Input, d.WellFormed → CorollaryConclusion ν d (U d) (f d) (p d) (C d) := by + obtain ⟨N, hN⟩ := exists_nat_ge ‖ν‖ + have he := CertifiedReal.computableReal_effective hc + refine ⟨corollaryDetector_open, + (fun d => transformedField (FluidLift.velocity d)), + (fun d => transformedField (FluidLift.solenoidalForce ν d)), + (fun d => -shiftedField (FluidLift.potential d)), corollaryConstants ν N hN, + uniformlyEffective_of_certificate (transformedCertificate velocityCertificate) + (componentsEffective_transformed velocity_effective), + uniformlyEffective_of_certificate + (transformedCertificate (solenoidalForceCertificate ν N hN)) + (componentsEffective_transformed (solenoidalForce_effective ν he)), + corollaryConstants_effective ν N hN, fun d hd => ?_⟩ + have hu := transformedField_smooth (FluidLift.velocity_contDiff d) + have hf := transformedField_smooth (FluidLift.solenoidalForce_contDiff ν d) + have hp := (shiftedField_smooth (FluidLift.potential_contDiff d)).neg + have hclass := transformed_classical_solution ν d + refine ⟨hu.contDiffOn, hf.contDiffOn, hp.contDiffOn, + transformedField_meanZero (FluidLift.velocity_contDiff d) (FluidLift.velocity_meanZero d), + transformedField_meanZero (FluidLift.solenoidalForce_contDiff ν d) + (FluidLift.solenoidalForce_meanZero ν d), hclass.pressureMeanZero, + transformed_solenoidalForce ν d hd, hclass, classical_unique hν.le hclass, + (corollaryConstants_bounds ν N hN d hd).2, corollaryPath d, + ⟨corollaryPath_start d, fun t ht => + (corollaryPath_hasDerivAt d hd ht).hasDerivWithinAt⟩, + fun Y hY t ht => corollaryPath_unique d hd hY.1 hY.2 ht, + transformed_path_event d hd⟩ + +end PeriodicLattice.RapidTorus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeEffective.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeEffective.lean new file mode 100644 index 0000000000000000000000000000000000000000..8138223a9b0abc69fcf95875e59ba711918d6993 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeEffective.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeTransform + +namespace OAI + +/-! Explicit derivative budgets and terminating programs for the transformed +periodic lattice field. Only rational coordinate and output arithmetic is added. -/ + +namespace PeriodicLattice.RapidTorus +local instance {n : ℕ} {A : Type*} [Encodable A] : Encodable (Fin n → A) := Encodable.finArrow +noncomputable section +open Quantitative TorusCalculus EffectiveFields CertifiedReal RecursiveArithmetic +open scoped ContDiff +local instance : Primcodable ℚ := ratPrimcodable +local instance : DecidablePred Input.WellFormed := Classical.decPred _ +local instance : Primcodable ValidInput := Primcodable.subtype inputWellFormed + +noncomputable def transformedCertificate {F : Input → VectorField} (h : FieldCertificate F) : + FieldCertificate (fun d => transformedField (F d)) where + budget p := 3 * h.budget p + recursive := Primrec.nat_mul.comp (Primrec.const 3) h.recursive + smooth d := transformedField_smooth (h.smooth d) + estimate d hd w n J hn t ht q := by + rw [transformedField_word (h.smooth d)] + change (1 + t)^J * ‖transverseLinear (fieldWord w (F d) t (shift q))‖ ≤ _ + calc + _ ≤ (1 + t)^J * (3 * ‖fieldWord w (F d) t (shift q)‖) := + mul_le_mul_of_nonneg_left (transverseLinear_bound _) (by positivity) + _ = 3 * ((1 + t)^J * ‖fieldWord w (F d) t (shift q)‖) := by ring + _ ≤ 3 * (h.budget (d,n,J) : ℝ) := by + gcongr + exact h.estimate d hd w n J hn t ht (shift q) + _ = _ := by norm_num + +def rationalShift (p : RationalPoint) : RationalPoint := + (p.1, fun i => p.2 i + if i = 1 then 1 / 4 else 0) + +@[fun_prop] theorem rationalShift_computable : Computable rationalShift := by + have hc (i : Fin 3) : Primrec (fun p : RationalPoint => + p.2 i + if i = 1 then (1 / 4 : ℚ) else 0) := + rat_add.comp ((Primrec.fin_app.comp Primrec.snd (Primrec.const i)).pair + (Primrec.const (if i = 1 then (1 / 4 : ℚ) else 0))) + have hcoords : Primrec (fun p : RationalPoint => fun i : Fin 3 => + p.2 i + if i = 1 then (1 / 4 : ℚ) else 0) := + Primrec.fin_curry.mpr (Primrec.fin_curry₁.mpr hc).swap + exact (Primrec.fst.pair hcoords).to_comp + +theorem rationalShift_vector (p : RationalPoint) : + rationalVector (rationalShift p).2 = rationalVector p.2 + shiftVector := by + ext i + fin_cases i <;> simp [rationalShift, rationalVector, shiftVector, PiLp.add_apply] + +theorem fieldValue_shifted {F : ScalarField} (p : RationalPoint) : + fieldValue (shiftedField F) p = fieldValue F (rationalShift p) := by + simp only [fieldValue, shiftedField, shift, rationalShift_vector, mk_add] + rfl + +theorem componentsEffective_transformed {F : Input → VectorField} (hF : ComponentsEffective F) : + ComponentsEffective (fun d => transformedField (F d)) := by + intro j + have hshift : Effective (fun p : ValidInput × RationalPoint => + fieldValue (fun t q => F p.1.1 t q j) (rationalShift p.2)) := + (hF j).comp (Computable.fst.pair (rationalShift_computable.comp Computable.snd)) + have hscale := (constant (A := ValidInput × RationalPoint) + (if j = 0 then -(1 / 2 : ℚ) else 1)).mul hshift + apply hscale.congr + intro p + simp only [fieldValue, transformedField, transverseLinear_apply, shiftedField, + shift, rationalShift_vector, mk_add] + split_ifs <;> norm_num [rationalShift] + +noncomputable def corollaryConstants (ν : ℝ) (N : ℕ) (hν : ‖ν‖ ≤ N) + (d : Input) (r : ℕ) (α : MultiIndex) (J : ℕ) : ℕ := + (transformedCertificate velocityCertificate).mixedBudget d r α J + + (transformedCertificate (forceCertificate ν N hν)).mixedBudget d r α J + + (transformedCertificate (solenoidalForceCertificate ν N hν)).mixedBudget d r α J + +theorem corollaryConstants_effective (ν : ℝ) (N : ℕ) (hν : ‖ν‖ ≤ N) : + EffectiveConstants (corollaryConstants ν N hν) := by + have hc : Primrec (fun p : Input × ℕ × MultiIndex × ℕ => + corollaryConstants ν N hν p.1 p.2.1 p.2.2.1 p.2.2.2) := + Primrec.nat_add.comp + (Primrec.nat_add.comp (transformedCertificate velocityCertificate).mixedBudget_recursive + (transformedCertificate (forceCertificate ν N hν)).mixedBudget_recursive) + (transformedCertificate (solenoidalForceCertificate ν N hν)).mixedBudget_recursive + obtain ⟨P,hP⟩ := program_of_computable hc.to_comp + exact ⟨P,fun d _ r α J => hP (d,r,α,J)⟩ + +theorem corollaryConstants_bounds (ν : ℝ) (N : ℕ) (hν : ‖ν‖ ≤ N) + (d : Input) (hd : d.WellFormed) : + RapidPair (transformedField (FluidLift.velocity d)) + (transformedField (FluidLift.force ν d)) (corollaryConstants ν N hν d) ∧ + RapidPair (transformedField (FluidLift.velocity d)) + (transformedField (FluidLift.solenoidalForce ν d)) (corollaryConstants ν N hν d) := by + have hpair {F G : Input → VectorField} (hf : FieldCertificate F) (hg : FieldCertificate G) + {C : ℕ → MultiIndex → ℕ → ℕ} + (hc : ∀ r α J, hf.mixedBudget d r α J + hg.mixedBudget d r α J ≤ C r α J) : + RapidPair (F d) (G d) C := by + intro r J α t ht + calc + _ ≤ (hf.mixedBudget d r α J : ℝ) / (1+t)^J + + (hg.mixedBudget d r α J : ℝ) / (1+t)^J := + add_le_add (hf.sup_estimate d hd r α J ht) (hg.sup_estimate d hd r α J ht) + _ = ((hf.mixedBudget d r α J + hg.mixedBudget d r α J : ℕ) : ℝ) / (1+t)^J := by + rw [Nat.cast_add, add_div] + _ ≤ _ := div_le_div_of_nonneg_right (Nat.cast_le.mpr (hc r α J)) (by positivity) + constructor + · exact hpair (transformedCertificate velocityCertificate) + (transformedCertificate (forceCertificate ν N hν)) (fun _ _ _ => Nat.le_add_right _ _) + · apply hpair (transformedCertificate velocityCertificate) + (transformedCertificate (solenoidalForceCertificate ν N hν)) + intro r α J + exact Nat.add_le_add_right (Nat.le_add_right _ _) _ + +end +end PeriodicLattice.RapidTorus + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..64aa2384932244d3586ac5b830286ece0f5b8c75 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeFluid.lean @@ -0,0 +1,175 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeTransform + +namespace OAI + +/-! Navier--Stokes transport for the transverse lattice transformation. +The vanishing first derivative makes the nonisometric scaling harmless. -/ + +noncomputable section +open Set MeasureTheory +open scoped ContDiff BigOperators +namespace PeriodicLattice.RapidTorus +open TorusCalculus Quantitative + +theorem transformedField_laplacian {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) : + laplacian (transformedField F) = transformedField (laplacian F) := by + funext t q + simp only [laplacian, transformedField_spaceD hF, + transformedField_spaceD (contDiff_spaceD hF _), transformedField, shiftedField, + map_sum] + +theorem transformedField_timeD {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) (t : ℝ) (ht : 0 ≤ t) (q : Torus) : + timeD (transformedField F) t q = transverseLinear (timeD F t (shift q)) := by + rw [timeD_eq_fullTimeD (transformedField_smooth hF) ht, + transformedField_fullTimeD hF, timeD_eq_fullTimeD hF ht] + rfl + +theorem transformedField_advection {U : VectorField} + (hU : ContDiff ℝ ∞ (lifted U)) (hzero : spaceD 0 U = 0) : + advection (transformedField U) = transformedField (advection U) := by + funext t q + simp only [advection, Fin.sum_univ_three, + transformedField_spaceD hU, transformedField, shiftedField, + transverseLinear_apply, Fin.isValue, reduceIte, hzero, Pi.zero_apply, + map_zero, smul_zero, zero_add, map_add, map_smul] + norm_num + +theorem transformedField_divergence {U : VectorField} + (hU : ContDiff ℝ ∞ (lifted U)) (hzero : spaceD 0 U = 0) (t : ℝ) (q : Torus) : + divergence (transformedField U) t q = divergence U t (shift q) := by + have hdiv {V : VectorField} (hV : ContDiff ℝ ∞ (lifted V)) (s : ℝ) (x : Torus) : + divergence V s x = ∑ i : Fin 3, spaceD i V s x i := by + unfold divergence + apply Finset.sum_congr rfl + intro i _ + exact (congrFun₂ (spaceD_component_eq hV i i) s x).symm + rw [hdiv (transformedField_smooth hU), hdiv hU] + simp only [transformedField_spaceD hU, transformedField, shiftedField, + Fin.sum_univ_three, transverseLinear_apply, Fin.isValue, reduceIte, + hzero, Pi.zero_apply, PiLp.zero_apply, mul_zero] + norm_num + +theorem shiftedField_gradient {p : ScalarField} + (hp : ContDiff ℝ ∞ (lifted p)) (hz : spaceD 0 p = 0) : + gradient (shiftedField p) = transformedField (gradient p) := by + funext t q + ext i + change spaceD i (shiftedField p) t q = transverseLinear (gradient p t (shift q)) i + rw [shiftedField_spaceD hp, transverseLinear_apply] + change spaceD i p t (shift q) = + if i = 0 then -(1 / 2 : ℝ) * spaceD i p t (shift q) else spaceD i p t (shift q) + split_ifs with hi + · subst i + rw [hz] + simp + · rfl + +theorem transformed_classical_equations {ν : ℝ} {g U : VectorField} {p : ScalarField} + (hU : ContDiff ℝ ∞ (lifted U)) (hp : ContDiff ℝ ∞ (lifted p)) + (hzU : spaceD 0 U = 0) (hzp : spaceD 0 p = 0) + (hNS : NavierStokes ν g U p) : + NavierStokes ν (transformedField g) (transformedField U) (shiftedField p) := by + refine ⟨?_, ?_, ?_⟩ + · intro t ht q + rw [transformedField_timeD hU t ht, + congrFun₂ (transformedField_advection hU hzU) t q, + congrFun₂ (transformedField_laplacian hU) t q, + congrFun₂ (shiftedField_gradient hp hzp) t q] + simpa only [transformedField, shiftedField, map_add, map_neg, map_smul] using + congrArg transverseLinear (hNS.1 t ht (shift q)) + · intro t ht q + rw [transformedField_divergence hU hzU] + exact hNS.2.1 t ht (shift q) + · intro q + change transverseLinear (U 0 (shift q)) = 0 + rw [hNS.2.2, map_zero] + +theorem velocity_firstDerivative (d : Input) : spaceD 0 (FluidLift.velocity d) = 0 := by + funext t q + obtain ⟨x, rfl⟩ := mk_surjective q + rw [spaceD_cover] + have he : (fun s : ℝ => spaceLift (FluidLift.velocity d) t + (x + EuclideanSpace.single 0 s)) = fun _ => FluidLift.velocity d t (torusMk x) := by + funext s + simp only [spaceLift, FluidLift.velocity_cover] + congr 1 + simp [PiLp.add_apply] + rw [he] + exact deriv_const _ _ + +theorem potential_firstDerivative (d : Input) : spaceD 0 (FluidLift.potential d) = 0 := by + funext t q + obtain ⟨x, rfl⟩ := mk_surjective q + rw [spaceD_cover] + have he : (fun s : ℝ => spaceLift (FluidLift.potential d) t + (x + EuclideanSpace.single 0 s)) = fun _ => FluidLift.potential d t (torusMk x) := by + funext s + simp only [spaceLift, FluidLift.potential, Pi.add_apply, + PeriodicInverse.horizontal_cover, FluidLift.pressureOsc_cover] + norm_num [PiLp.add_apply, PiLp.single_apply] + rw [he] + exact deriv_const _ _ + +theorem shiftedField_meanZero {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + {F : Field A} (hm : MeanZero F) : MeanZero (shiftedField F) := by + intro t ht + change (∫ q, F t (q + torusMk shiftVector) ∂torusVolume) = 0 + rw [integral_add_right_eq_self, hm t ht] + +theorem algebra_firstDerivative {F : ScalarField} (hF : RapidCalculus.Algebra F) : + spaceD 0 F = 0 := by + induction hF with + | zero => exact Residual.spaceD_zero 0 + | tensor F f h hf hh he => exact RapidCalculus.tensor_spaceD_zero he + | @add F G hF hG ihF ihG => + rw [spaceD_add_eq hF.smooth hG.smooth, ihF, ihG, add_zero] + | @mul F G hF hG ihF ihG => + funext t q + change spaceD 0 (fun t q => F t q • G t q) t q = 0 + rw [spaceD_smul hF.smooth hG.smooth] + change spaceD 0 F t q * G t q + F t q * spaceD 0 G t q = 0 + rw [ihF, ihG] + simp + | @scale c F hF ihF => + rw [spaceD_scale hF.smooth, ihF, smul_zero] + +theorem vectorAlgebra_firstDerivative {F : VectorField} + (hF : RapidCalculus.VectorAlgebra F) (hs : ContDiff ℝ ∞ (lifted F)) : + spaceD 0 F = 0 := by + funext t q + ext i + rw [congrFun₂ (spaceD_component_eq hs 0 i) t q, algebra_firstDerivative (hF i)] + rfl + +theorem transformed_solenoidalForce (ν : ℝ) (d : Input) (hd : d.WellFormed) : + Solenoidal (transformedField (FluidLift.solenoidalForce ν d)) := by + have hF := FluidLift.solenoidalForce_contDiff ν d + have hz := vectorAlgebra_firstDerivative (FluidLift.solenoidalForce_algebra ν d hd) hF + intro t ht q + rw [transformedField_divergence hF hz] + exact FluidLift.solenoidalForce_solenoidal ν d t ht (shift q) + +theorem transformed_classical_solution (ν : ℝ) (d : Input) : + ClassicalSolution ν (transformedField (FluidLift.solenoidalForce ν d)) + (transformedField (FluidLift.velocity d)) (-shiftedField (FluidLift.potential d)) := by + have hu := FluidLift.velocity_contDiff d + have hp := FluidLift.potential_contDiff d + have hn' : spaceD 0 (-FluidLift.potential d) = 0 := by + rw [← neg_one_smul ℝ (FluidLift.potential d), spaceD_scale hp, potential_firstDerivative, smul_zero] + have hneg : ContDiff ℝ ∞ (lifted (-FluidLift.potential d)) := hp.neg + have hNS := transformed_classical_equations (p := -FluidLift.potential d) + hu hneg (velocity_firstDerivative d) hn' + (FluidLift.solenoidalForce_equations ν d) + have hm : MeanZero (-shiftedField (FluidLift.potential d)) := by + intro t ht + change (∫ q, -shiftedField (FluidLift.potential d) t q ∂torusVolume) = 0 + rw [integral_neg, shiftedField_meanZero (FluidLift.potential_meanZero d) t ht, neg_zero] + exact classical_of_smooth_pressure (transformedField_smooth hu) (shiftedField_smooth hp).neg hm hNS + +end PeriodicLattice.RapidTorus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeTransform.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..1afe682bc4b6aa9800d62c625dad823885c16e67 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLatticeTransform.lean @@ -0,0 +1,139 @@ +import OAI.Analysis.PeriodicLattice.Main + +namespace OAI + +/-! A rational transverse transformation of the periodic lattice field. +The first direction is ignorable for this field, so its velocity can be +scaled without defining a nonintegral dilation of the circle. -/ + +noncomputable section +open Set MeasureTheory +open scoped ContDiff BigOperators +namespace PeriodicLattice.RapidTorus +open TorusCalculus Quantitative + +theorem realRingHomCompTriple : + RingHomCompTriple (RingHom.id ℝ) (RingHom.id ℝ) (RingHom.id ℝ) := inferInstance + +theorem spaceContinuousSMul : ContinuousSMul ℝ Space := inferInstance + +def transverseLinear : Space →L[ℝ] Space := + letI := neZeroThree + letI := twoAtLeastTwo + letI := threeAtLeastTwo + letI := realRingHomCompTriple + letI := spaceContinuousSMul + ContinuousLinearMap.id ℝ Space - (3 / 2 : ℝ) • + ((ContinuousLinearMap.toSpanSingleton ℝ (EuclideanSpace.single 0 1)).comp + (EuclideanSpace.proj 0)) + +theorem transverseLinear_apply (x : Space) (i : Fin 3) : + transverseLinear x i = if i = 0 then -(1 / 2 : ℝ) * x i else x i := by + change ((x - (3 / 2 : ℝ) • (x 0 • EuclideanSpace.single 0 1)) : Space) i = _ + simp only [PiLp.sub_apply, PiLp.smul_apply, smul_eq_mul, PiLp.single_apply] + split_ifs with hi + · subst i + ring + · simp + +theorem transverseLinear_bound (x : Space) : ‖transverseLinear x‖ ≤ 3 * ‖x‖ := by + have hs : ‖(EuclideanSpace.single (0 : Fin 3) (1 : ℝ) : Space)‖ = 1 := by + exact (PiLp.norm_single 2 (fun _ : Fin 3 => ℝ) (0 : Fin 3) (1 : ℝ)).trans norm_one + change ‖x - (3 / 2 : ℝ) • (x 0 • EuclideanSpace.single 0 1)‖ ≤ _ + calc + _ ≤ ‖x‖ + ‖(3 / 2 : ℝ) • (x 0 • EuclideanSpace.single 0 1)‖ := norm_sub_le _ _ + _ = ‖x‖ + (3 / 2 : ℝ) * ‖x 0‖ := by + simp only [norm_smul, hs, Real.norm_eq_abs] + norm_num + _ ≤ ‖x‖ + (3 / 2 : ℝ) * ‖x‖ := by gcongr; exact PiLp.norm_apply_le x 0 + _ ≤ _ := by nlinarith [norm_nonneg x] + +def shiftVector : Space := + letI := twoAtLeastTwo + letI := fourAtLeastTwo + WithLp.toLp 2 ![0, 1 / 4, 0] +def shift (q : Torus) : Torus := q + torusMk shiftVector + +def shiftedField {A : Type*} (F : Field A) : Field A := fun t q => F t (shift q) +def transformedField (F : VectorField) : VectorField := + fun t q => transverseLinear (shiftedField F t q) + +theorem shiftedField_smooth {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + {F : Field A} (hF : ContDiff ℝ ∞ (lifted F)) : + ContDiff ℝ ∞ (lifted (shiftedField F)) := by + have hg : ContDiff ℝ ∞ (fun tx : ℝ × Space => (tx.1, tx.2 + shiftVector)) := + contDiff_fst.prodMk (contDiff_snd.add contDiff_const) + change ContDiff ℝ ∞ (fun tx : ℝ × Space => F tx.1 (torusMk tx.2 + torusMk shiftVector)) + simpa only [lifted, shiftedField, shift, mk_add, Function.comp_def] using hF.comp hg + +theorem transformedField_smooth {F : VectorField} (hF : ContDiff ℝ ∞ (lifted F)) : + ContDiff ℝ ∞ (lifted (transformedField F)) := + transverseLinear.contDiff.comp (shiftedField_smooth hF) + +theorem shiftedField_spaceD {A : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + {F : Field A} (hF : ContDiff ℝ ∞ (lifted F)) (i : Fin 3) : + spaceD i (shiftedField F) = shiftedField (spaceD i F) := by + funext t q + have he : (fun s : ℝ => shiftedField F t (q + torusMk (EuclideanSpace.single i s))) = + (fun s : ℝ => F t (shift q + torusMk (EuclideanSpace.single i s))) := by + funext s + unfold shiftedField shift + congr 1 + abel + change deriv (fun s : ℝ => shiftedField F t (q + torusMk (EuclideanSpace.single i s))) 0 = _ + rw [he] + exact ((hasDerivAt_translation hF t (shift q) i 0).deriv).trans (by + simp only [single_zero, mk_zero, add_zero, shiftedField]) + +theorem transformedField_spaceD {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) (i : Fin 3) : + spaceD i (transformedField F) = transformedField (spaceD i F) := by + funext t q + have hd := hasDerivAt_translation (shiftedField_smooth hF) t q i 0 + have hc := transverseLinear.hasFDerivAt.comp_hasDerivAt 0 hd + change deriv (fun s : ℝ => transverseLinear + (shiftedField F t (q + torusMk (EuclideanSpace.single i s)))) 0 = _ + simpa only [Function.comp_def, single_zero, mk_zero, add_zero, + shiftedField_spaceD hF, transformedField] using hc.deriv + +theorem transformedField_fullTimeD {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) : + fullTimeD (transformedField F) = transformedField (fullTimeD F) := by + funext t q + have hc := transverseLinear.hasFDerivAt.comp_hasDerivAt t + (fullTime_hasDerivAt hF t (shift q)) + exact hc.deriv + +theorem transformedField_coordD {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) (i : Option (Fin 3)) : + coordD i (transformedField F) = transformedField (coordD i F) := by + cases i with + | none => exact transformedField_fullTimeD hF + | some j => exact transformedField_spaceD hF j + +theorem transformedField_word {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) (w : List (Option (Fin 3))) : + fieldWord w (transformedField F) = transformedField (fieldWord w F) := by + induction w with + | nil => rfl + | cons i w ih => + rw [fieldWord_cons, ih, transformedField_coordD (fieldWord_contDiff hF w)] + rfl + +theorem transformedField_meanZero {F : VectorField} + (hF : ContDiff ℝ ∞ (lifted F)) (hm : MeanZero F) : MeanZero (transformedField F) := by + intro t ht + have hi : Integrable (fun q => F t (shift q)) torusVolume := + ((continuous_iff_lifted (shiftedField F)).mpr (shiftedField_smooth hF).continuous).comp + (continuous_const.prodMk continuous_id) |>.integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + change (∫ q, transverseLinear (F t (shift q)) ∂torusVolume) = 0 + rw [transverseLinear.integral_comp_comm hi] + change transverseLinear (∫ q, F t (q + torusMk shiftVector) ∂torusVolume) = 0 + rw [integral_add_right_eq_self, hm t ht, map_zero] + +end PeriodicLattice.RapidTorus + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderFlow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7e67a1a33d39a9836055176ff66cd72dc25378b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderFlow.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLoaderGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderSubprogramFlow + +namespace OAI + +/-! The periodically repeated loading row is used once. Every later material +step belongs to the fresh recorder, whose orbit never returns to that row. -/ + +noncomputable section +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +def periodicStartingPoint : Space := ![1 / 4, 1 / 2, 1 / 4] + +theorem periodicLoader_center (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + (periodicLoaderInstruction I hI).affine (fun j => (periodicLoaderStart j : ℝ)) = + fun j => (initialPointQ I hI j : ℝ) := by + funext j + fin_cases j <;> + simp [periodicLoaderInstruction, Instruction.affine, centeredBox_center] + +theorem periodicLoader_contains (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + (fun j => (periodicLoaderStart j : ℝ)) ∈ (periodicLoaderInstruction I hI).source.carrier := by + intro j + change ((periodicLoaderStart j - periodicLoaderRadius I.1 : ℚ) : ℝ) ≤ _ ∧ + _ ≤ ((periodicLoaderStart j + periodicLoaderRadius I.1 : ℚ) : ℝ) + have hr : (0 : ℝ) < periodicLoaderRadius I.1 := by + exact_mod_cast div_pos (bandScale_pos I.1) (by norm_num : (0 : ℚ) < 8) + simp only [Rat.cast_sub, Rat.cast_add] + constructor <;> linarith + +theorem periodicLoading_endpoint (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (periodicInitializedInput I hI).period + (periodicInitializedInput I hI).realizingVelocity Φ) : + Φ 1 periodicStartingPoint = + atHeight (codedPoint (freshMachine I.1) + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI))) (1 / 4) := by + let d := periodicInitializedInput I hI + let b := periodicLoaderInstruction (freshInput I) (freshInput_valid hI) + have hd := periodicInitializedInput_valid I hI + have hb : b ∈ d.instructions := by + simp [d, b, periodicInitializedInput, periodicLoadedInput, loadedInput, Input.withInstructions] + have hc := periodicLoader_contains (freshInput I) (freshInput_valid hI) + have hδ : (0 : ℝ) < d.tubeRadius := by exact_mod_cast tubeRadius_pos hd + have ht := sourceTube_contains b d.codingHeight hδ + (Set.mem_image_of_mem (fun X => atHeight X d.codingHeight) hc) + have he := realizingVelocity_periodMap hd hΦ hb ht + rw [atHeight_horizontal, periodicLoader_center, initialPointQ_spec] at he + simpa [d, periodicStartingPoint, periodicLoaderStart, atHeight] using he + +theorem Steps.flow_loaded {I : Alternating.MachineInput} + {hI : Alternating.ValidInput I} {n : ℕ} + {C : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (h : Steps (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) n + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)) C) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (periodicInitializedInput I hI).period + (periodicInitializedInput I hI).realizingVelocity Φ) : + Φ (n + 1) periodicStartingPoint = atHeight (codedPoint (freshMachine I.1) C) (1 / 4) := by + have he := h.flow_nat_in (periodicInitializedInput_valid I hI) + (fun m E hc b hb _ _ => periodicLoadedInput_used_mem I hI hc b hb) hΦ + have hs := hΦ.nat_shift (realizingVelocity_time_periodic _) 1 (n : ℝ) periodicStartingPoint + norm_num only [Nat.cast_one] at hs + rw [hs, periodicLoading_endpoint I hI hΦ] + simpa only [periodicInitializedInput_height, Rat.cast_div, Rat.cast_one, + Rat.cast_ofNat] using he + +theorem periodicLoading_safe (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (periodicInitializedInput I hI).period + (periodicInitializedInput I hI).realizingVelocity Φ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Φ t periodicStartingPoint 0 < 1 / 2 := by + let M := freshMachine I.1 + let hv := freshInput_valid hI + let d := periodicInitializedInput I hI + let b := periodicLoaderInstruction (freshInput I) hv + have hb : b ∈ d.instructions := by + simp [d, b, periodicInitializedInput, periodicLoadedInput, loadedInput, Input.withInstructions] + have hc := periodicLoader_contains (freshInput I) hv + have hkpos : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hfirst : codedPoint M (finiteInitializedRecorder (freshInput I) hv) 0 ≤ + 1 / 4 + (bandScale M : ℝ) / 2 := by + rw [codedPoint_first] + have hh : recorderHalting M (finiteInitializedRecorder (freshInput I) hv).control = false := by + change (freshMachine I.1).isHalting 0 = false + exact freshMachine_not_halting_zero I.1 + rw [hh] + simp only [Bool.false_eq_true, ite_false] + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hd : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have he := encode_mem_unit hB hd + (tapeAt (finiteInitializedRecorder (freshInput I) hv)).1 + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + nlinarith [he.2] + have he := materialFlow_first_le_of_mem (periodicInitializedInput_valid I hI) hΦ hb hc + (a := 1 / 4 + (bandScale M : ℝ) / 2) + (by simp only [b, periodicLoaderInstruction, centeredBox_center, periodicLoaderStart, + Matrix.cons_val_zero, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + linarith) + (by + change (centeredBox (initialPointQ (freshInput I) hv) + (periodicLoaderRadius (freshMachine I.1))).center 0 ≤ _ + rw [centeredBox_center, congrFun (initialPointQ_spec (freshInput I) hv) 0] + exact hfirst) ht + have hk := bandScale_le_real M + change _ ≤ _ + 2 * ((bandScale M / 2 : ℚ) : ℝ) at he + norm_num only [Rat.cast_div, Rat.cast_ofNat] at he + have hp : atHeight (fun j => (periodicLoaderStart j : ℝ)) (d.codingHeight : ℝ) = + periodicStartingPoint := by simp [d, periodicStartingPoint, periodicLoaderStart, atHeight] + rw [hp] at he + linarith + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..e468fcca7eaf6f49585e1728991809af29249ec9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicLoaderGeometry.lean @@ -0,0 +1,254 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FreshBranches +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Subprogram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SmallTranslation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.HeightShift + +namespace OAI + +/-! A small loading rectangle at the unused initial checkpoint. The incoming +checkpoint row is removed; all remaining target rectangles stay separated +from the loader, and all sources stay below its fixed source. -/ + +noncomputable section +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +theorem stateBox_second_bounds (M : Alternating.Machine) + (q : Control (State M) (Alphabet M)) {R : RationalBox 2} (hR : InUnit R) + {x : Plane} (hx : x ∈ (scaledBox (bandScale M) (stateOffset M q) R).carrier) : + (centerY M q : ℝ) - (bandScale M : ℝ) / 2 ≤ x 1 ∧ + x 1 ≤ (centerY M q : ℝ) + (bandScale M : ℝ) / 2 := by + have h := scaledBox_between (bandScale_pos M).le (stateOffset M q) hR hx 1 + dsimp [stateOffset] at h + push_cast at h + constructor <;> linarith [h.1, h.2] + +theorem codedPoint_second_bounds (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) : + (centerY M C.control : ℝ) - (bandScale M : ℝ) / 2 ≤ codedPoint M C 1 ∧ + codedPoint M C 1 ≤ (centerY M C.control : ℝ) + (bandScale M : ℝ) / 2 := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hd : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have he := encode_mem_unit hB hd (tapeAt C).2 + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + change _ ≤ (stateOffset M C.control 1 : ℝ) + (bandScale M : ℝ) * + encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).2 ∧ + (stateOffset M C.control 1 : ℝ) + (bandScale M : ℝ) * + encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).2 ≤ _ + simp only [stateOffset, Matrix.cons_val_one, Matrix.cons_val_zero, Rat.cast_sub, + Rat.cast_div, Rat.cast_ofNat] + constructor <;> nlinarith [he.1, he.2] + +theorem bandScale_le_real (M : Alternating.Machine) : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + +theorem centerY_bounds_real (M : Alternating.Machine) (q : Control (State M) (Alphabet M)) : + (3 / 8 : ℝ) < centerY M q ∧ (centerY M q : ℝ) < 7 / 16 := by + have hl := (Rat.cast_lt (K := ℝ)).mpr (centerY_bounds M q).1 + have hu := (Rat.cast_lt (K := ℝ)).mpr (centerY_bounds M q).2 + constructor + · simpa only [Rat.cast_div, Rat.cast_ofNat] using hl + · simpa only [Rat.cast_div, Rat.cast_ofNat] using hu + +theorem codedPoint_in_compiledCenters (M : Alternating.Machine) (hM : M.WellFormed) + (C : Configuration (State M) (Alphabet M)) : + codedPoint M C ∈ (compiledInput M hM).centers.carrier := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hd : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have hx := encode_mem_unit hB hd (tapeAt C).1 + have hy := codedPoint_second_bounds M C + have hk : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hk' := bandScale_le_real M + have hc : (3 / 8 : ℝ) < centerY M C.control ∧ + (centerY M C.control : ℝ) < 7 / 16 := by + exact centerY_bounds_real M C.control + intro j + fin_cases j + · norm_num [compiledInput] + rw [codedPoint_first] + cases hh : recorderHalting M C.control <;> + simp only [Bool.false_eq_true, ite_false, ite_true] + all_goals constructor <;> nlinarith [hx.1, hx.2] + · norm_num [compiledInput] + constructor <;> linarith [hy.1, hy.2, hc.1, hc.2] + +def periodicLoaderStart : Fin 2 → ℚ := ![1 / 4, 1 / 2] + +def periodicLoaderRadius (M : Alternating.Machine) : ℚ := bandScale M / 8 + +def periodicLoaderInstruction (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Instruction := + ⟨centeredBox periodicLoaderStart (periodicLoaderRadius I.1), + centeredBox (initialPointQ I hI) (periodicLoaderRadius I.1), 1⟩ + +theorem periodicLoaderInstruction_image (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + (periodicLoaderInstruction I hI).affine '' + (periodicLoaderInstruction I hI).source.carrier = + (periodicLoaderInstruction I hI).target.carrier := by + apply Instruction.image_eq_of_halfWidths _ (by norm_num [periodicLoaderInstruction]) + · simp only [periodicLoaderInstruction, centeredBox_halfWidth, Rat.cast_one, one_mul] + · simp only [periodicLoaderInstruction, centeredBox_halfWidth, Rat.cast_one, div_one] + +theorem periodicLoader_source_separated (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (b : Branch (finiteMachine I.1 hI.1)) : + PositivelySeparated (periodicLoaderInstruction I hI).source.carrier + (geometricInstruction I.1 hI.1 b).source.carrier := by + apply CoordinateGap.positiveSeparated (by norm_num : (0 : ℝ) < 1 / 32) + intro x hx y hy + have hx1 := hx 1 + change ((periodicLoaderStart 1 - periodicLoaderRadius I.1 : ℚ) : ℝ) ≤ x 1 ∧ + x 1 ≤ ((periodicLoaderStart 1 + periodicLoaderRadius I.1 : ℚ) : ℝ) at hx1 + norm_num only [periodicLoaderStart, Matrix.cons_val_one, Matrix.cons_val_zero, + periodicLoaderRadius, Rat.cast_sub, Rat.cast_add, Rat.cast_div, Rat.cast_ofNat] at hx1 + have hy1 := stateBox_second_bounds I.1 b.source + (geometricInstruction_source_unit I.1 hI.1 b) hy + have hc : (centerY I.1 b.source : ℝ) < 7 / 16 := by + exact (centerY_bounds_real I.1 b.source).2 + have hk := bandScale_le_real I.1 + refine ⟨1, ?_⟩ + exact (show (1 / 32 : ℝ) ≤ x 1 - y 1 by linarith [hx1.1, hy1.2]).trans + (le_abs_self _) + +theorem periodicLoader_target_separated (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (b : Branch (finiteMachine I.1 hI.1)) + (hb : b.target ≠ (finiteInitializedRecorder I hI).control) : + PositivelySeparated (periodicLoaderInstruction I hI).target.carrier + (geometricInstruction I.1 hI.1 b).target.carrier := by + have hk : (0 : ℝ) < bandScale I.1 := by exact_mod_cast bandScale_pos I.1 + apply CoordinateGap.positiveSeparated (mul_pos (by norm_num : (0 : ℝ) < 2) hk) + intro x hx y hy + have hx1 := hx 1 + change ((initialPointQ I hI 1 - periodicLoaderRadius I.1 : ℚ) : ℝ) ≤ x 1 ∧ + x 1 ≤ ((initialPointQ I hI 1 + periodicLoaderRadius I.1 : ℚ) : ℝ) at hx1 + simp only [periodicLoaderRadius, Rat.cast_sub, Rat.cast_add, Rat.cast_div, + Rat.cast_ofNat] at hx1 + have hi := codedPoint_second_bounds I.1 (finiteInitializedRecorder I hI) + rw [← initialPointQ_spec I hI] at hi + have hy1 := stateBox_second_bounds I.1 b.target + (geometricInstruction_target_unit I.1 hI.1 b) hy + have hgap := centerY_gap I.1 hb + refine ⟨1, ?_⟩ + rcases le_total (centerY I.1 b.target : ℝ) + (centerY I.1 (finiteInitializedRecorder I hI).control : ℝ) with he | he + · rw [abs_of_nonpos (sub_nonpos.mpr he)] at hgap + exact (show 2 * (bandScale I.1 : ℝ) ≤ x 1 - y 1 by + linarith [hx1.1, hy1.2, hi.1]).trans (le_abs_self _) + · rw [abs_of_nonneg (sub_nonneg.mpr he)] at hgap + calc + 2 * (bandScale I.1 : ℝ) ≤ y 1 - x 1 := by linarith [hx1.2, hy1.1, hi.2] + _ ≤ |y 1 - x 1| := le_abs_self _ + _ = |x 1 - y 1| := abs_sub_comm _ _ + +def filteredGeometricBranches (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) := + (geometricBranches I.1 (Alternating.ValidInput.machine_wellFormed hI)).filter + fun b => decide (b.target ≠ (finiteInitializedRecorder I hI).control) + +def loadedInput (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Input := + (compiledInput I.1 (Alternating.ValidInput.machine_wellFormed hI)).withInstructions + (periodicLoaderInstruction I hI :: + (filteredGeometricBranches I hI).map (geometricInstruction I.1 (Alternating.ValidInput.machine_wellFormed hI))) + +def freshGeometricBranches (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) := + filteredGeometricBranches (freshInput I) (freshInput_valid hI) + +def periodicLoadedInput (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Input := + loadedInput (freshInput I) (freshInput_valid hI) + +theorem periodicLoader_single_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ValidInput ((compiledInput I.1 hI.1).withInstructions [periodicLoaderInstruction I hI]) := by + apply translationInstruction_singleton_valid (compiledInput_valid I.1 hI.1) + periodicLoaderStart (initialPointQ I hI) + · exact div_pos (bandScale_pos I.1) (by norm_num) + · change bandScale I.1 / 8 ≤ bandScale I.1 / 2 + linarith [bandScale_pos I.1] + · intro j + fin_cases j <;> norm_num [compiledInput, periodicLoaderStart] + · rw [initialPointQ_spec I hI] + exact codedPoint_in_compiledCenters I.1 hI.1 _ + +theorem loadedInput_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (loadedInput I hI) := by + let bs := filteredGeometricBranches I hI + let F := geometricInstruction I.1 hI.1 + have hsub : (bs.map F).Sublist (compiledInput I.1 hI.1).instructions := + List.Sublist.map F List.filter_sublist + change ValidInput ((compiledInput I.1 hI.1).withInstructions + (periodicLoaderInstruction I hI :: bs.map F)) + apply (compiledInput_valid I.1 hI.1).prependSublist hsub + (periodicLoaderInstruction I hI) (periodicLoader_single_valid I hI) + · intro c hc + obtain ⟨b, _, rfl⟩ := List.mem_map.mp hc + exact periodicLoader_source_separated I hI b + · intro c hc + obtain ⟨b, hb, rfl⟩ := List.mem_map.mp hc + have hne := (List.mem_filter.mp hb).2 + exact periodicLoader_target_separated I hI b (of_decide_eq_true hne) + +theorem periodicLoadedInput_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (periodicLoadedInput I hI) := + loadedInput_valid (freshInput I) (freshInput_valid hI) + +theorem periodicLoadedInput_geometric_mem (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hb : b.target ≠ (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)).control) : + geometricInstruction (freshMachine I.1) (freshInput_valid hI).1 b ∈ + (periodicLoadedInput I hI).instructions := by + classical + apply List.mem_cons_of_mem + apply List.mem_map.mpr + refine ⟨b, List.mem_filter.mpr ⟨?_, decide_eq_true hb⟩, rfl⟩ + change b ∈ (compileBranches (freshMachine I.1) (freshInput_valid hI).1).dedup + exact List.mem_dedup.mpr (mem_compileBranches (freshMachine I.1) (freshInput_valid hI).1 b) + +theorem periodicLoadedInput_used_mem (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {n : ℕ} + {C : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hc : Steps (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) n + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)) C) + (b : Branch (finiteMachine (freshMachine I.1) (freshInput_valid hI).1)) + (hs : b.source = C.control) : + geometricInstruction (freshMachine I.1) (freshInput_valid hI).1 b ∈ + (periodicLoadedInput I hI).instructions := by + have hzero : FreshControl (initialState (freshMachine I.1)) + (finiteInitializedRecorder (freshInput I) (freshInput_valid hI)).control := by + constructor <;> intro he <;> cases he + have hC := hc.freshControl (fresh_finiteMachine_next I.1 (freshInput_valid hI).1) hzero + apply periodicLoadedInput_geometric_mem I hI b + change b.target ≠ Control.checkpoint (initialState (freshMachine I.1)) + exact b.rule.not_fresh_checkpoint (by simpa only [hs] using hC) + +def periodicInitializedInput (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Input := + (periodicLoadedInput I hI).shiftHeight (-(1 / 4)) + +theorem periodicInitializedInput_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (periodicInitializedInput I hI) := + (periodicLoadedInput_valid I hI).shiftHeight _ + +@[simp] theorem periodicInitializedInput_height (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : (periodicInitializedInput I hI).codingHeight = 1 / 4 := by + norm_num [periodicInitializedInput, Input.shiftHeight, periodicLoadedInput, loadedInput, Input.withInstructions, compiledInput] + +@[simp] theorem periodicInitializedInput_period (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : (periodicInitializedInput I hI).period = 1 := rfl + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..192899f7dacc076fceee3fce693f7462df1e00d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicMain.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicObservation +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! The periodic-initialization main theorem of *Geometric Programs for +Solenoidal Forcing*. The finite program repeats its loading instruction, but +the fresh recorder never returns to that instruction's source or target. -/ + +namespace ForcedComputation +open ShearFlows Recorder +open scoped ContDiff + +def PeriodicFluidProperties (L ν : ℝ) (U : Velocity) : Prop := + ContDiff ℝ ∞ U ∧ ContDiff ℝ ∞ (force ν U) ∧ + SpatiallyPeriodic L U ∧ SpatiallyPeriodic L (force ν U) ∧ + Solenoidal U ∧ Solenoidal (force ν U) ∧ + HasZeroMean L U ∧ HasZeroMean L (force ν U) ∧ + TimePeriodic U ∧ TimePeriodic (force ν U) ∧ ZeroAdvection U ∧ + BoundedMixedDerivatives U ∧ BoundedMixedDerivatives (force ν U) ∧ + (∀ k : ℤ, ∀ t : ℝ, |t - (k : ℝ)| < (1 / 32 : ℝ) → ∀ x, U (t, x) = 0) ∧ + (∃ E : ℝ, ∀ t, kineticEnergy L U t ≤ E) ∧ + IsClassicalSolution L ν (force ν U) U (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution L ν (force ν U) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = U (t, x) ∧ p (t, x) = 0) + +theorem periodic_bundle {d : Input} (hd : ValidInput d) (ν : ℝ) (hν : 0 < ν) : + PeriodicFluidProperties d.period ν d.realizingVelocity := by + have hs := realizingVelocity_smooth hd + have hp := realizingVelocity_spatially_periodic d + have ht := realizingVelocity_time_periodic d + have hz := realizingVelocity_divergence_advection hd + exact ⟨hs, force_smooth hs ν, hp, force_spatially_periodic hs hp ν, + hz.1, force_solenoidal hs hz.1 ν, realizingVelocity_mean_zero hd, + realizingForce_mean_zero hd ν, ht, force_time_periodic hs ht ν, hz.2, + realizingVelocity_boundedMixedDerivatives hd, + force_boundedMixedDerivatives (by exact_mod_cast hd.period_pos) hs hp ht ν, + fun k t hk x => realizingVelocity_vanish_near_integers d k hk x, + realizingVelocity_kineticEnergy_bound hd, realizingVelocity_solves_NS hd ν, + realizingVelocity_unique hd hν⟩ + +def periodicProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Input := + periodicInitializedInput I hI + +noncomputable def periodicVelocity (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := (periodicProgram I hI).realizingVelocity + +noncomputable def periodicForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := force ν (periodicVelocity I hI) + +theorem periodic_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + PeriodicFluidProperties 1 ν (periodicVelocity I hI) ∧ + HasEffectiveDerivatives (periodicVelocity I hI) (periodicProgram I hI).velocityExpr ∧ + HasEffectiveForce ν (periodicVelocity I hI) (periodicProgram I hI).velocityExpr ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastRealName a ν → IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (periodicForce ν I hI) α y - + rationalVector ((periodicProgram I hI).velocityExpr.evaluateForce + (velocityExpr_valid (periodicInitializedInput_valid I hI)) α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (periodicVelocity I hI) Φ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t ![1 / 4, 1 / 2, 1 / 4] 0 ∧ + Φ t ![1 / 4, 1 / 2, 1 / 4] 0 < 7 / 8) := by + have hd := periodicInitializedInput_valid I hI + have hp := periodic_bundle hd ν hν + refine ⟨by simpa [periodicVelocity, periodicProgram] using hp, ?_, ?_, ?_, ?_⟩ + · simpa only [periodicVelocity, periodicProgram, compileShears] using compileShears_effective hd + · simpa only [periodicVelocity, periodicProgram, compileShears] using compileShears_force_effective hd ν + · intro α a b y ha hb ε hε + simpa only [periodicForce, periodicVelocity, periodicProgram, ← velocityExpr_val hd] using + VelocityExpr.evaluateForce_spec (velocityExpr_valid hd) α ha hb ε hε + · obtain ⟨Φ, hΦ⟩ := realizingVelocity_materialFlow hd + refine ⟨Φ, by simpa [periodicVelocity, periodicProgram] using hΦ, ?_⟩ + simpa only [periodicStartingPoint] using (periodic_flow_halting_iff I hI hΦ).symm + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..92d066b4c194aa7d14b08748b8c1563ab08b9067 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicObservation.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLoaderFlow + +namespace OAI + +/-! The fixed observer for the program which includes its loader in every +period. The fresh initial machine state makes every later loading row inert. -/ + +noncomputable section +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +theorem periodic_flow_halting_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (periodicInitializedInput I hI).period + (periodicInitializedInput I hI).realizingVelocity Φ) : + (∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < Φ t periodicStartingPoint 0 ∧ + Φ t periodicStartingPoint 0 < 7 / 8) ↔ Alternating.Halts I := by + let J := freshInput I + let hv := freshInput_valid hI + let C₀ := finiteInitializedRecorder J hv + rw [← freshInput_halts_iff hI] + constructor + · rintro ⟨t, ht, hx, _⟩ + by_contra hno + by_cases ht1 : t ≤ 1 + · have hh := periodicLoading_safe I hI hΦ ⟨ht, ht1⟩ + linarith + have hn (n : ℕ) : (finiteMachine J.1 hv.1).halting + (workAt (finiteMachine J.1 hv.1) (initialState J.1) + (initialAlphabet J hv) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt J hv n) + change (workAt (finiteMachine J.1 hv.1) (initialState J.1) + (initialAlphabet J hv) n).state.val = (Alternating.configurationAt J n).state at he + change J.1.isHalting _ = false + rw [he] + cases hh : J.1.isHalting (Alternating.configurationAt J n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + have hs (n : ℕ) : Steps (finiteMachine J.1 hv.1) n C₀ + (run (finiteMachine J.1 hv.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine J.1 hv.1) + (run (finiteMachine J.1 hv.1) C₀ n) + (run (finiteMachine J.1 hv.1) C₀ (n + 1)) := + run_step_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting J.1 + (run (finiteMachine J.1 hv.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State J.1) (Alphabet J.1)) : + haltingControl (finiteMachine J.1 hv.1) q = recorderHalting J.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t - 1⌋₊ + have hnt : (n : ℝ) ≤ t - 1 := Nat.floor_le (by linarith) + have htn : t - 1 < (n : ℝ) + 1 := Nat.lt_floor_add_one (t - 1) + have hsafe := (hnext n).flow_safe_in (hcontrol n) (hcontrol (n + 1)) + (periodicInitializedInput_valid I hI) + (show ((periodicInitializedInput I hI).h : ℝ) ≤ (bandScale J.1 : ℝ) / 2 by + simp [periodicInitializedInput, Input.shiftHeight, periodicLoadedInput, loadedInput, + Input.withInstructions, compiledInput, J]) + (fun b hb _ _ => periodicLoadedInput_used_mem I hI (hs n) b hb) hΦ + (show t - ((n : ℝ) + 1) ∈ Icc (0 : ℝ) 1 by constructor <;> linarith) + have he := (hs n).flow_loaded hΦ + have htime : t = (t - ((n : ℝ) + 1)) + ((n + 1 : ℕ) : ℝ) := by push_cast; ring + rw [htime, hΦ.nat_shift (realizingVelocity_time_periodic _) (n + 1)] at hx + have he' : Φ (n + 1 : ℕ) periodicStartingPoint = + atHeight (codedPoint J.1 (run (finiteMachine J.1 hv.1) C₀ n)) + (periodicInitializedInput I hI).codingHeight := by simpa using he + rw [he'] at hx + linarith [hsafe.2] + · intro hhalt + obtain ⟨n, C, q, hs, hc, hh⟩ := (finite_recorder_halts_iff J hv).mpr hhalt + have he := hs.flow_loaded hΦ + have hob := (codedPoint_observation_iff J.1 C).mpr + (by simpa only [hc, recorderHalting] using hh) + refine ⟨n + 1, by positivity, ?_⟩ + rw [he] + exact hob + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicProfiles.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicProfiles.lean new file mode 100644 index 0000000000000000000000000000000000000000..282fa8cd1af9b92aadbf2b55f150d967a5f32fba --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodicProfiles.lean @@ -0,0 +1,126 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicForce +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.PeriodicCalculus + +namespace OAI + +/-! +# Periodic profiles supply the logarithmic-force bounds + +The phase bounds used in the slow-clock estimate follow from smoothness and +periodicity of the original field. They are not extra decay assumptions. +-/ + +noncomputable section +open scoped ContDiff +open ShearFlows + +namespace ForcedComputation + +theorem iteratedDeriv_eq_mixedTime {V : Velocity} (hV : ContDiff ℝ ∞ V) + (n : ℕ) (t : ℝ) (x : Space) : + iteratedDeriv n (fun s => V (s, x)) t = + mixedDerivative V (List.replicate n 0) (t, x) := by + induction n generalizing t with + | zero => rfl + | succ n ih => + rw [iteratedDeriv_succ] + have he : iteratedDeriv n (fun s => V (s, x)) = + fun s => mixedDerivative V (List.replicate n 0) (s, x) := funext ih + rw [he] + change timeDerivative (mixedDerivative V (List.replicate n 0)) t x = _ + rw [timeDerivative_eq (mixedDerivative_smooth hV _)] + rfl + +theorem periodic_uniformTimeBounds {L : ℝ} (hL : 0 < L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) : + UniformTimeBounds (fun x s => V (s, x)) := by + intro n + obtain ⟨C, hC, hb⟩ := periodic_boundedMixedDerivatives hL hV hs ht (List.replicate n 0) + exact ⟨C, hC, fun x s => by rw [iteratedDeriv_eq_mixedTime hV]; exact hb (s, x)⟩ + +theorem quadraticPhase_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (fun y : SpaceTime => quadraticPhase V y.2 y.1) := + ((timeDerivative_smooth hV).add ((spatial_fderiv_smooth hV).clm_apply hV)).sub hV + +theorem quadraticPhase_spatially_periodic {L : ℝ} {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) : + SpatiallyPeriodic L (fun y : SpaceTime => quadraticPhase V y.2 y.1) := by + intro t x n + simp only [quadraticPhase, timeDerivative_eq hV] + change mixedDerivative V [0] (t, x + latticeVector L n) + + advection (fun y => V (t, y)) (x + latticeVector L n) - V (t, x + latticeVector L n) = + mixedDerivative V [0] (t, x) + advection (fun y => V (t, y)) x - V (t, x) + rw [mixedDerivative_spatially_periodic hV hs, hs] + congr 2 + unfold advection + have hd := CubePeriodic.fderiv (show CubePeriodic L (fun y => V (t, y)) from hs t) + ((hV.comp (contDiff_const.prodMk contDiff_id)).differentiable (by simp)) + rw [hd x n] + dsimp only + rw [hs t x n] + +theorem quadraticPhase_time_periodic {V : Velocity} + (hV : ContDiff ℝ ∞ V) (ht : TimePeriodic V) : + TimePeriodic (fun y : SpaceTime => quadraticPhase V y.2 y.1) := by + intro t x + have he : (fun y => V (t + 1, y)) = fun y => V (t, y) := funext (ht t) + simp only [quadraticPhase, timeDerivative_eq hV] + change mixedDerivative V [0] (t + 1, x) + advection (fun y => V (t + 1, y)) x - + V (t + 1, x) = mixedDerivative V [0] (t, x) + advection (fun y => V (t, y)) x - V (t, x) + rw [mixedDerivative_time_periodic hV ht, he, ht] + +theorem viscousPhase_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (fun y : SpaceTime => viscousPhase V y.2 y.1) := laplacian_smooth hV + +theorem viscousPhase_spatially_periodic {L : ℝ} {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) : + SpatiallyPeriodic L (fun y : SpaceTime => viscousPhase V y.2 y.1) := by + intro t x n + change laplacian (fun y => V (t, y)) (x + latticeVector L n) = + laplacian (fun y => V (t, y)) x + simp only [laplacian_eq_mixed hV] + apply Finset.sum_congr rfl + intro j _ + exact mixedDerivative_spatially_periodic hV hs _ t x n + +theorem viscousPhase_time_periodic {V : Velocity} (hV : ContDiff ℝ ∞ V) + (ht : TimePeriodic V) : TimePeriodic (fun y : SpaceTime => viscousPhase V y.2 y.1) := by + intro t x + change laplacian (fun y => V (t + 1, y)) x = laplacian (fun y => V (t, y)) x + simp only [laplacian_eq_mixed hV] + apply Finset.sum_congr rfl + intro j _ + exact mixedDerivative_time_periodic hV ht _ t x + +theorem quadraticPhase_uniformTimeBounds {L : ℝ} (hL : 0 < L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) : + UniformTimeBounds (quadraticPhase V) := by + exact periodic_uniformTimeBounds (V := fun y => quadraticPhase V y.2 y.1) + hL (quadraticPhase_smooth hV) + (quadraticPhase_spatially_periodic hV hs) (quadraticPhase_time_periodic hV ht) + +theorem viscousPhase_uniformTimeBounds {L : ℝ} (hL : 0 < L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) : + UniformTimeBounds (viscousPhase V) := by + exact periodic_uniformTimeBounds (V := fun y => viscousPhase V y.2 y.1) + hL (viscousPhase_smooth hV) + (viscousPhase_spatially_periodic hV hs) (viscousPhase_time_periodic hV ht) + +theorem periodic_slowForce_time_decay {L : ℝ} (hL : 0 < L) (ν : ℝ) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hs : SpatiallyPeriodic L V) (ht : TimePeriodic V) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => slowForce ν V (s, x)) t‖ ≤ C * (1 + t)⁻¹ ^ (1 + n) := by + have hQ : ∀ x, ContDiff ℝ ∞ (quadraticPhase V x) := by + intro x + exact (quadraticPhase_smooth hV).comp (contDiff_id.prodMk contDiff_const) + have hD : ∀ x, ContDiff ℝ ∞ (viscousPhase V x) := by + intro x + exact (viscousPhase_smooth hV).comp (contDiff_id.prodMk contDiff_const) + exact slowForce_time_decay (V := V) ν hQ hD (quadraticPhase_uniformTimeBounds hL hV hs ht) + (viscousPhase_uniformTimeBounds hL hV hs ht) n + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodizeBound.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodizeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c0f2954563feeb762d84bcd81afdaea132757b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PeriodizeBound.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.PeriodicExpressions +import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas + +namespace OAI + +/-! Periodization preserves a sup bound when the support is shorter than +one period: at any point, at most one translated copy contributes. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem iteratedDeriv_support_interval {f : ℝ → ℝ} {a b : ℝ} + (hs : Function.support f ⊆ Icc a b) (n : ℕ) : + Function.support (iteratedDeriv n f) ⊆ Icc a b := by + induction n with + | zero => simpa only [iteratedDeriv_zero] using hs + | succ n ih => + rw [iteratedDeriv_succ] + exact support_deriv_subset.trans (closure_minimal ih isClosed_Icc) + +theorem iteratedDeriv_smooth {f : ℝ → ℝ} (hf : ContDiff ℝ ∞ f) (n : ℕ) : + ContDiff ℝ ∞ (iteratedDeriv n f) := by + induction n with + | zero => simpa only [iteratedDeriv_zero] using hf + | succ n ih => + rw [iteratedDeriv_succ] + exact (contDiff_infty_iff_deriv.mp ih).2 + +theorem periodize_iteratedDeriv {f : ℝ → ℝ} {a b : ℝ} + (hf : ContDiff ℝ ∞ f) (hs : Function.support f ⊆ Icc a b) (n : ℕ) : + iteratedDeriv n (periodize 1 f) = periodize 1 (iteratedDeriv n f) := by + induction n with + | zero => rfl + | succ n ih => + rw [iteratedDeriv_succ, ih, + periodize_deriv (by norm_num : (0 : ℝ) < 1) (iteratedDeriv_support_interval hs n) + (iteratedDeriv_smooth hf n), iteratedDeriv_succ] + +theorem periodize_unit_bound {f : ℝ → ℝ} {a b B : ℝ} + (hs : Function.support f ⊆ Icc a b) (hlen : b - a < 1) + (hB : 0 ≤ B) (hb : ∀ x, |f x| ≤ B) (x : ℝ) : + |periodize 1 f x| ≤ B := by + classical + by_cases hex : ∃ n : ℤ, f (x - (n : ℝ)) ≠ 0 + · obtain ⟨n, hn⟩ := hex + have hu (m : ℤ) (hm : m ≠ n) : f (x - (m : ℝ)) = 0 := by + by_contra hfm + have hsn := hs hn + have hsm := hs hfm + rcases lt_or_gt_of_ne hm with hm | hm + · have hc : (m : ℝ) + 1 ≤ n := by exact_mod_cast (Int.add_one_le_iff.mpr hm) + linarith [hsn.1, hsm.2] + · have hc : (n : ℝ) + 1 ≤ m := by exact_mod_cast (Int.add_one_le_iff.mpr hm) + linarith [hsm.1, hsn.2] + have he : periodize 1 f x = f (x - (n : ℝ)) := by + unfold periodize + simpa only [one_mul] using (tsum_eq_single n (fun m hm => by + simpa only [one_mul] using hu m hm)) + rw [he] + exact hb _ + · have he : periodize 1 f x = 0 := by + change (∑' n : ℤ, f (x - 1 * (n : ℝ))) = 0 + trans (∑' _ : ℤ, (0 : ℝ)) + swap + · exact tsum_zero + apply tsum_congr + intro n + simpa only [one_mul, ne_eq, not_not] using (not_exists.mp hex n) + rw [he, abs_zero] + exact hB + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PhaseBalls.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PhaseBalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..9fe7a21856aba1c0351ded6f6e06900716cb8f50 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PhaseBalls.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FastVectorArithmetic + +namespace OAI + +/-! Rational balls for the finite derivative recurrence of the logarithmic +clock. No modulus for a derivative of the slowed field is assumed. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def phaseBalls (r : ℕ) (a : ℕ → ℕ → Fin 3 → QBall) : + ℕ → ℕ → ℕ → Fin 3 → QBall + | 0, k => a k + | n + 1, k => fun N j => + (phaseBalls r a n (k + 1) N j).add + ((QBall.exact (-(r + n : ℚ))).mul (phaseBalls r a n k N j)) + +theorem phaseBalls_contains (r : ℕ) {A : ℝ → Space} (hA : ContDiff ℝ ∞ A) + (s : ℝ) {a : ℕ → ℕ → Fin 3 → QBall} + (ha : ∀ k N j, (a k N j).Contains (iteratedDeriv k A s j)) + (n k N : ℕ) (j : Fin 3) : + (phaseBalls r a n k N j).Contains (iteratedDeriv k (phaseIter r A n) s j) := by + induction n generalizing k with + | zero => exact ha k N j + | succ n ih => + rw [show phaseIter r A (n + 1) = + phaseDerivative (r + n) (phaseIter r A n) from rfl, + iteratedDeriv_phaseDerivative (r + n) k (phaseIter_smooth r hA n)] + have h := QBall.contains_add (ih (k + 1)) + (QBall.contains_mul (QBall.contains_exact (-(r + n : ℚ))) (ih k)) + simpa only [phaseBalls, Rat.cast_neg, Rat.cast_add, Rat.cast_natCast, Nat.cast_add, + Pi.sub_apply, Pi.smul_apply, smul_eq_mul, sub_eq_add_neg, neg_mul] using h + +theorem phaseBalls_converges (r : ℕ) {A : ℝ → Space} (hA : ContDiff ℝ ∞ A) + (s : ℝ) {a : ℕ → ℕ → Fin 3 → QBall} + (ha : ∀ k j, QBall.Converges (fun N => a k N j) (iteratedDeriv k A s j)) + (n k : ℕ) (j : Fin 3) : + QBall.Converges (fun N => phaseBalls r a n k N j) + (iteratedDeriv k (phaseIter r A n) s j) := by + induction n generalizing k with + | zero => exact ha k j + | succ n ih => + rw [show phaseIter r A (n + 1) = + phaseDerivative (r + n) (phaseIter r A n) from rfl, + iteratedDeriv_phaseDerivative (r + n) k (phaseIter_smooth r hA n)] + have h := (ih (k + 1)).add + ((QBall.converges_exact (-(r + n : ℚ))).mul (ih k)) + simpa only [phaseBalls, Rat.cast_neg, Rat.cast_add, Rat.cast_natCast, Nat.cast_add, + Pi.sub_apply, Pi.smul_apply, smul_eq_mul, sub_eq_add_neg, neg_mul] using h + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PrefixMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PrefixMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb84fb418aca03ea5b680ce504a8ffc417adbe10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PrefixMain.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LoadedMachine + +namespace OAI + +/-! The initialized prefix-computation main theorem: the fixed label and +unit-torus observer are those in Prefix Instructions and Incompressible Flows. +The repeated table uses the machine alone, and the input appears only in the +finite rational loader. -/ + +namespace ForcedComputation +open ShearFlows Recorder + +def prefixStart : Fin 2 → ℚ := ![1 / 8, 1 / 4] + +def prefixProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Input × Input := + (shiftedLoader prefixStart (initialPointQ I hI) (1 / 4), + recorderInputAtHeight I.1 hI.1 (1 / 4)) + +theorem prefixLoader_valid (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ValidInput (prefixProgram I hI).1 := + shiftedLoader_valid _ _ _ (by intro j; fin_cases j <;> norm_num [prefixStart]) + (initialPointQ_bounds I hI) + +theorem prefixBody_valid (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ValidInput (prefixProgram I hI).2 := + recorderInputAtHeight_valid I.1 (Alternating.ValidInput.machine_wellFormed hI) (1 / 4) + +noncomputable def prefixVelocity (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Velocity := loadedMachineVelocity prefixStart (1 / 4) I hI + +noncomputable def prefixForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := force ν (prefixVelocity I hI) + +/-- Full fixed-label main result, with the finite force evaluator and the +machine-only repeated velocity/force template exposed in its statement. -/ +theorem prefix_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + InitializedFluidProperties 1 ν (prefixVelocity I hI) ∧ + (∀ t x, 1 ≤ t → + prefixVelocity I hI (t, x) = (recorderInputAtHeight I.1 hI.1 (1 / 4)).realizingVelocity (t, x) ∧ + prefixForce ν I hI (t, x) = + force ν (recorderInputAtHeight I.1 hI.1 (1 / 4)).realizingVelocity (t, x)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (y : SpaceTime), + IsFastRealName a ν → IsFastName b y → ∀ (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (prefixForce ν I hI) α y - + rationalVector (evaluateInitializedForce (prefixProgram I hI).1 (prefixProgram I hI).2 + (prefixLoader_valid I hI) (prefixBody_valid I hI) α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (prefixVelocity I hI) Φ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Φ t ![1 / 8, 1 / 4, 1 / 4] 0 ∧ Φ t ![1 / 8, 1 / 4, 1 / 4] 0 < 1) := by + obtain ⟨hp, Φ, hΦ, hevent⟩ := loadedMachine_computation prefixStart (1 / 4) + (by intro j; fin_cases j <;> norm_num [prefixStart]) (by norm_num [prefixStart]) I hI ν hν + refine ⟨hp, ?_, ?_, Φ, hΦ, ?_⟩ + · intro t x ht + exact ⟨initializedProgram_tail _ _ ht x, + initializedForce_tail (prefixLoader_valid I hI) (prefixBody_valid I hI) ν ht x⟩ + · intro α a b y ha hb ε hε + exact evaluateInitializedForce_spec (prefixLoader_valid I hI) (prefixBody_valid I hI) + α ha hb ε hε + · simpa only [prefixStart, atHeight, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hevent + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ProductNames.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ProductNames.lean new file mode 100644 index 0000000000000000000000000000000000000000..5948e5ae4be2d26c34f028694214e98ae78751fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ProductNames.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FastVectorArithmetic + +namespace OAI + +/-! Terminating rational-ball searches give product names and the scaled +physical-time input used by the viscosity-dependent detector evaluator. -/ + +namespace ForcedComputation +open ShearFlows Filter +open scoped Topology + +def scalarBallReady (b : ℕ → QBall) (ε : ℚ) (n : ℕ) : Prop := (b n).radius ≤ ε + +instance (b : ℕ → QBall) (ε : ℚ) (n : ℕ) : Decidable (scalarBallReady b ε n) := + inferInstanceAs (Decidable ((b n).radius ≤ ε)) + +theorem scalarBallReady_exists {b : ℕ → QBall} {x : ℝ} + (hb : QBall.Converges b x) {ε : ℚ} (hε : 0 < ε) : + ∃ n, scalarBallReady b ε n := by + have he : (0 : ℝ) < ε := by exact_mod_cast hε + obtain ⟨n, hn⟩ := (hb.2.eventually_lt_const he).exists + exact ⟨n, by exact_mod_cast hn.le⟩ + +def scalarBallApprox (b : ℕ → QBall) (ε : ℚ) + (h : ∃ n, scalarBallReady b ε n) : ℚ := (b (Nat.find h)).center + +theorem scalarBallApprox_spec {b : ℕ → QBall} {x : ℝ} + (hb : QBall.Converges b x) (hc : ∀ n, (b n).Contains x) + (ε : ℚ) (hε : 0 < ε) : + |x - (scalarBallApprox b ε (scalarBallReady_exists hb hε) : ℝ)| ≤ (ε : ℝ) := by + exact (hc _).trans (by exact_mod_cast Nat.find_spec (scalarBallReady_exists hb hε)) + +def mulNameBalls (a b : ℕ → ℚ) (n : ℕ) : QBall := + (realNameBall a n).mul (realNameBall b n) + +theorem mulNameBalls_contains {a b : ℕ → ℚ} {x y : ℝ} + (ha : IsFastRealName a x) (hb : IsFastRealName b y) (n : ℕ) : + (mulNameBalls a b n).Contains (x * y) := + QBall.contains_mul (realNameBall_contains ha n) (realNameBall_contains hb n) + +theorem mulNameBalls_converges {a b : ℕ → ℚ} {x y : ℝ} + (ha : IsFastRealName a x) (hb : IsFastRealName b y) : + QBall.Converges (mulNameBalls a b) (x * y) := + (realNameBall_converges ha).mul (realNameBall_converges hb) + +def mulFastName {x y : ℝ} (a b : ℕ → ℚ) + (ha : IsFastRealName a x) (hb : IsFastRealName b y) : ℕ → ℚ := fun n => + scalarBallApprox (mulNameBalls a b) ((2 : ℚ) ^ (-(n : ℤ))) + (scalarBallReady_exists (mulNameBalls_converges ha hb) (by positivity)) + +theorem mulFastName_spec {x y : ℝ} (a b : ℕ → ℚ) + (ha : IsFastRealName a x) (hb : IsFastRealName b y) : + IsFastRealName (mulFastName a b ha hb) (x * y) := by + intro n + have h := scalarBallApprox_spec (mulNameBalls_converges ha hb) + (mulNameBalls_contains ha hb) ((2 : ℚ) ^ (-(n : ℤ))) (by positivity) + simpa [mulFastName, errorTolerance] using h + +def timeName (b : ℕ → RationalSpaceTime) : ℕ → ℚ := fun n => (b n).1 + +theorem timeName_spec {b : ℕ → RationalSpaceTime} {z : SpaceTime} + (hb : IsFastName b z) : IsFastRealName (timeName b) z.1 := by + intro n + have h := (norm_fst_le (z - rationalPoint (b n))).trans (hb n) + simpa only [timeName, Prod.fst_sub, rationalPoint, Real.norm_eq_abs] using h + +def scaleTimeName {ν : ℝ} {z : SpaceTime} (a : ℕ → ℚ) + (b : ℕ → RationalSpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b z) : + ℕ → RationalSpaceTime := fun n => + (mulFastName a (timeName b) ha (timeName_spec hb) n, (b n).2) + +theorem scaleTimeName_spec {ν : ℝ} {z : SpaceTime} (a : ℕ → ℚ) + (b : ℕ → RationalSpaceTime) (ha : IsFastRealName a ν) (hb : IsFastName b z) : + IsFastName (scaleTimeName a b ha hb) (ν * z.1, z.2) := by + intro n + apply norm_prod_le_iff.mpr + exact ⟨mulFastName_spec a (timeName b) ha (timeName_spec hb) n, + (norm_snd_le (z - rationalPoint (b n))).trans (hb n)⟩ + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PullbackMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PullbackMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..d282de4903200b102d300c41d169ca6bb63b91cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PullbackMass.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarCharacteristics +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassEvolution + +namespace OAI + +/-! For the detector, preservation of the transported bump's mass follows +directly from its transport equation and periodic integration by parts. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +theorem scalar_spatial_fderiv_smooth {u : ℝ → Plane → ℝ} + (hu : ContDiff ℝ ∞ (Function.uncurry u)) : + ContDiff ℝ ∞ (fun y : ℝ × Plane => fderiv ℝ (u y.1) y.2) := by + have h : ContDiff ℝ ∞ + (Function.uncurry (fun y : ℝ × Plane => fun x : Plane => u y.1 x)) := + hu.comp (contDiff_fst.fst.prodMk contDiff_snd) + exact h.fderiv contDiff_snd (by simp) + +theorem pullbackScalar_mass {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hV : ContDiff ℝ ∞ (Function.uncurry V)) + (hp : ∀ s, PlanePeriodic (V s)) + (hdiv : ∀ s x, PlanarHamiltonian.divergence (V s) x = 0) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) (hgp : PlanePeriodic g) (t : ℝ) : + (∫ x in Icc (0 : Plane) (fun _ => 1), pullbackScalar Ψ g t x) = + ∫ x in Icc (0 : Plane) (fun _ => 1), g x := by + let u := pullbackScalar Ψ g + let d : ℝ → Plane → ℝ := fun s x => -fderiv ℝ (u s) x (V s x) + have hu : ContDiff ℝ ∞ (Function.uncurry u) := hg.comp hback + have hd : Continuous (Function.uncurry d) := + ((scalar_spatial_fderiv_smooth hu).clm_apply hV).neg.continuous + have hVs : ∀ s, ContDiff ℝ ∞ (V s) := + fun s => hV.comp (contDiff_const.prodMk contDiff_id) + have hm (s : ℝ) : HasDerivAt (scalarMass u) 0 s := by + have h := scalarMass_source_derivative (ν := 0) (h := fun _ _ => 0) hu hd + hVs hp + (pullbackScalar_periodic hΨ hp hgp) hdiv + (pullbackScalar_transport hΨ hback hg) + (fun s x => by simp only [d, scalarGenerator, zero_mul, zero_sub, add_zero]) + (fun _ => continuous_const) s + simpa only [scalarMass, integral_zero] using h + have he : scalarMass u t = scalarMass u 0 := + is_const_of_deriv_eq_zero (fun s => (hm s).differentiableAt) + (fun s => (hm s).deriv) t 0 + change scalarMass u t = _ + rw [he] + simp only [scalarMass, u, pullbackScalar, neg_zero, hΨ.initial] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PulsePlateau.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PulsePlateau.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7afdba5bdac6c954254dd4235451341309c050f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/PulsePlateau.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarSegments + +namespace OAI + +/-! Exact local motion on the open plateau surrounding a pulse rectangle. +The explicit collar allows source neighborhoods, rather than only the closed +source rectangles, to follow the same affine motion. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian +open ShearFlows Set Filter +open scoped Topology + +theorem rectangleCutoff_one_near_plateau {R : RationalBox 2} {δ : ℚ} + (hδ : 0 < δ) {x : Plane} (hx : x ∈ rectanglePlateau R δ) : + rectangleCutoff R δ =ᶠ[𝓝 x] fun _ => 1 := + Filter.eventually_of_mem ((rectanglePlateau_open R δ).mem_nhds hx) + (fun _ hy => rectangleCutoff_one hδ hy) + +theorem Pulse.spatial_on_plateau {p : Pulse} (hp : p.Valid) {x : Plane} + (hx : x ∈ rectanglePlateau p.rectangle p.collar) : + p.spatial x = field p.primitive.potential x := by + exact field_cutoff_plateau _ _ (rectangleCutoff_one_near_plateau hp.1 hx) + +theorem Pulse.curve_ode_plateau {p : Pulse} (hp : p.Valid) (x : Plane) (t : ℝ) + (hx : p.curve x t ∈ rectanglePlateau p.rectangle p.collar) : + HasDerivAt (p.curve x) (p.velocity t (p.curve x t)) t := by + rw [Pulse.velocity, p.spatial_on_plateau hp hx] + exact p.primitive.path_hasDerivAt x + (((smoothRamp_smooth p.start p.finish).differentiable (by simp) t).hasDerivAt) + +/-- A perturbation smaller than the rational collar remains on the exact +polynomial plateau. The norm here is the coordinate maximum norm. -/ +theorem rectanglePlateau_of_dist_lt {R : RationalBox 2} {δ : ℚ} + {x y : Plane} (hx : x ∈ R.carrier) (hxy : dist y x < (δ : ℝ)) : + y ∈ rectanglePlateau R δ := by + intro j + have hj : |y j - x j| < (δ : ℝ) := + (norm_le_pi_norm (y - x) j).trans_lt (by simpa only [dist_eq_norm] using hxy) + obtain ⟨hj₀, hj₁⟩ := abs_lt.mp hj + constructor <;> linarith [(hx j).1, (hx j).2] + +/-- Endpoint-gap separation survives a controlled perturbation. -/ +theorem notMem_collar_of_dist_lt {R S : RationalBox 2} {gap δ ε : ℚ} + (hgap : PlanarRouting.EndpointGap gap R S) (hsmall : 2 * δ + ε ≤ gap) + {x y : Plane} (hx : x ∈ S.carrier) (hxy : dist y x < (ε : ℝ)) : + y ∉ (rectangleCollar R δ).carrier := by + obtain ⟨j, hj⟩ := hgap + have hdist : |y j - x j| < (ε : ℝ) := + (norm_le_pi_norm (y - x) j).trans_lt (by simpa only [dist_eq_norm] using hxy) + obtain ⟨hd₀, hd₁⟩ := abs_lt.mp hdist + have hb : (2 : ℝ) * δ + ε ≤ gap := by exact_mod_cast hsmall + intro hy + have hR := hy j + have hS := hx j + dsimp [rectangleCollar] at hR + push_cast at hR + rcases hj with hj | hj + · have hg : (R.upper j : ℝ) + gap ≤ S.lower j := by exact_mod_cast hj + linarith [hR.2, hS.1] + · have hg : (S.upper j : ℝ) + gap ≤ R.lower j := by exact_mod_cast hj + linarith [hS.2, hR.1] + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RadixEncoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RadixEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..28a8d7376219df4394fe048d969442faedca0ee7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RadixEncoding.lean @@ -0,0 +1,138 @@ +import Mathlib + +namespace OAI + +/-! +# Infinite tape tails and their radix coordinates + +Unlike finite prefix interval arithmetic, these lemmas connect the actual +infinite symbolic tail to a real point of its coding interval. +-/ + +noncomputable section + +namespace ForcedComputation.Radix + +variable {A : Type*} + +def encode (B : ℝ) (digit : A → ℝ) (u : ℕ → A) : ℝ := + ∑' n : ℕ, digit (u n) * B⁻¹ ^ (n + 1) + +theorem summable_bound {B : ℝ} (hB : 1 < B) : + Summable (fun n : ℕ => (B - 1) * B⁻¹ ^ (n + 1)) := by + have hi : ‖B⁻¹‖ < 1 := by + rw [Real.norm_eq_abs, abs_of_pos (inv_pos.mpr (by linarith))] + exact inv_lt_one_of_one_lt₀ hB + exact ((summable_geometric_of_norm_lt_one hi).mul_left ((B - 1) * B⁻¹)).congr + (fun n => by rw [pow_succ]; ring) + +theorem summable_digits {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (u : ℕ → A) : + Summable (fun n : ℕ => digit (u n) * B⁻¹ ^ (n + 1)) := + Summable.of_nonneg_of_le (fun n => mul_nonneg (hd (u n)).1 (by positivity)) + (fun n => mul_le_mul_of_nonneg_right (hd (u n)).2 (by positivity)) (summable_bound hB) + +theorem tsum_bound {B : ℝ} (hB : 1 < B) : + (∑' n : ℕ, (B - 1) * B⁻¹ ^ (n + 1)) = 1 := by + have hi : ‖B⁻¹‖ < 1 := by + rw [Real.norm_eq_abs, abs_of_pos (inv_pos.mpr (by linarith))] + exact inv_lt_one_of_one_lt₀ hB + calc + (∑' n : ℕ, (B - 1) * B⁻¹ ^ (n + 1)) = + ∑' n : ℕ, ((B - 1) * B⁻¹) * B⁻¹ ^ n := by + apply tsum_congr + intro n + rw [pow_succ] + ring + _ = ((B - 1) * B⁻¹) * (1 - B⁻¹)⁻¹ := by + rw [tsum_mul_left, tsum_geometric_of_norm_lt_one hi] + _ = 1 := by + have hb : B ≠ 0 := by linarith + have hsub : B - 1 ≠ 0 := by linarith + field_simp [hb, hsub] + +theorem encode_mem_unit {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (u : ℕ → A) : + encode B digit u ∈ Set.Icc 0 1 := by + refine ⟨tsum_nonneg (fun n => mul_nonneg (hd (u n)).1 (by positivity)), ?_⟩ + calc + encode B digit u ≤ ∑' n : ℕ, (B - 1) * B⁻¹ ^ (n + 1) := + (summable_digits hB hd u).tsum_le_tsum + (fun n => mul_le_mul_of_nonneg_right (hd (u n)).2 (by positivity)) (summable_bound hB) + _ = 1 := tsum_bound hB + +theorem encode_shift {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (u : ℕ → A) : + encode B digit u = (digit (u 0) + encode B digit (fun n => u (n + 1))) / B := by + unfold encode + rw [(summable_digits hB hd u).tsum_eq_zero_add] + have ht : (∑' n : ℕ, digit (u (n + 1)) * B⁻¹ ^ (n + 1 + 1)) = + B⁻¹ * ∑' n : ℕ, digit (u (n + 1)) * B⁻¹ ^ (n + 1) := by + rw [← tsum_mul_left] + apply tsum_congr + intro n + rw [pow_succ] + ring + rw [ht] + simp only [zero_add, pow_one, div_eq_mul_inv] + ring + +def prepend (a : A) (u : ℕ → A) (n : ℕ) : A := + Nat.casesOn n a u + +theorem encode_prepend {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (a : A) (u : ℕ → A) : + encode B digit (prepend a u) = (digit a + encode B digit u) / B := by + exact encode_shift hB hd (prepend a u) + +theorem encode_const {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (a : A) : + encode B digit (fun _ => a) = digit a / (B - 1) := by + have he := encode_shift hB hd (fun _ => a) + have hb : B ≠ 0 := by linarith + have hsub : B - 1 ≠ 0 := by linarith + apply (eq_div_iff hsub).mpr + have hh := (eq_div_iff hb).mp he + nlinarith + +def prependWord : List A → (ℕ → A) → ℕ → A + | [], u => u + | a :: w, u => prepend a (prependWord w u) + +def prefixValue (B : ℝ) (digit : A → ℝ) : List A → ℝ + | [] => 0 + | a :: w => (digit a + prefixValue B digit w) / B + +theorem encode_prependWord {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (w : List A) (u : ℕ → A) : + encode B digit (prependWord w u) = + prefixValue B digit w + B⁻¹ ^ w.length * encode B digit u := by + induction w with + | nil => simp [prependWord, prefixValue] + | cons a w ih => + rw [prependWord, encode_prepend hB hd, ih, prefixValue, List.length_cons, pow_succ] + simp only [div_eq_mul_inv] + ring + +/-- A finite input on a blank tail has an explicitly rational radix formula. -/ +theorem encode_finite_input {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (w : List A) (blank : A) : + encode B digit (prependWord w (fun _ => blank)) = + prefixValue B digit w + B⁻¹ ^ w.length * (digit blank / (B - 1)) := by + rw [encode_prependWord hB hd, encode_const hB hd] + +theorem encode_in_first_cylinder {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (u : ℕ → A) : + encode B digit u ∈ Set.Icc (digit (u 0) / B) ((digit (u 0) + 1) / B) := by + rw [encode_shift hB hd] + have ht := encode_mem_unit hB hd (fun n => u (n + 1)) + have hp : 0 < B := by linarith + constructor + · exact (div_le_div_iff_of_pos_right hp).mpr (by linarith [ht.1]) + · exact (div_le_div_iff_of_pos_right hp).mpr (by linarith [ht.2]) + +end ForcedComputation.Radix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidConsequences.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidConsequences.lean new file mode 100644 index 0000000000000000000000000000000000000000..2227d0dede601ae46d3aff908133e0c661989c58 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidConsequences.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.RapidForcing.JetControl +import OAI.MathematicalPhysics.RapidForcing.Energy + +namespace OAI + +/-! Slow-decay and space-time energy consequences of the addressed construction. -/ + +noncomputable section +open Set MeasureTheory +open scoped Topology SchwartzMap ENNReal + +namespace RapidForcing + +def SlowDecay (f : Field Space) : Prop := + ∀ l α, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedD l α f t x‖ ≤ C * (1 + t)⁻¹ ^ (1 + l) + +theorem spaceFinite : Module.Finite ℝ Space := inferInstance + +theorem spaceBorel : BorelSpace Space := inferInstance + +def SpaceTimeL2 (f : Field Space) : Prop := + letI := twoAtLeastTwo + letI := spaceFinite + letI := spaceBorel + ∀ l α, MemLp (Function.uncurry (mixedD l α f)) 2 + (volume.restrict (Ici (0 : ℝ) ×ˢ (univ : Set Space))) + +theorem Rapid.slowDecay {f : Field Space} (hf : Rapid f) : SlowDecay f := by + intro l α + obtain ⟨C, hC, hb⟩ := hf (1 + l) l α + refine ⟨C, hC, fun t ht x => ?_⟩ + have hp : 0 < (1 + t) ^ (1 + l) := by positivity + have h : ‖mixedD l α f t x‖ ≤ C / (1 + t) ^ (1 + l) := + (le_div_iff₀ hp).mpr (by simpa only [mul_comm] using hb t ht x) + simpa only [div_eq_mul_inv, inv_pow] using h + +theorem JetControl.spaceTimeL2 {f : Field Space} {B : ℕ → ℕ → ℚ} + (hf : JetControl f B) : SpaceTimeL2 f := by + intro l α + obtain ⟨g, hg, he, hb⟩ := hf.mixedD l α + let : (volume : Measure (ℝ × Space)).IsAddHaarMeasure := + Measure.prod.instIsAddHaarMeasure _ _ + let s : 𝓢(ℝ × Space, Space) := { + toFun := g + smooth' := hg + decay' := by + intro J k + refine ⟨(B J (k + (l + α 0 + α 1 + α 2)) : ℝ), fun p => ?_⟩ + exact (mul_le_mul_of_nonneg_right + (pow_le_pow_left₀ (norm_nonneg p) (by linarith : ‖p‖ ≤ 1 + ‖p‖) J) + (norm_nonneg (iteratedFDeriv ℝ k g p))).trans (hb J k p) } + have heq : (fun p => s p) =ᶠ[ae (volume.restrict (Ici (0 : ℝ) ×ˢ (univ : Set Space)))] + Function.uncurry (RapidForcing.mixedD l α f) := by + filter_upwards [ae_restrict_mem (measurableSet_Ici.prod MeasurableSet.univ)] with p hp + exact (he p.1 hp.1 p.2).symm + exact (memLp_congr_ae heq).mp + ((s.memLp 2 volume).restrict (Ici (0 : ℝ) ×ˢ (univ : Set Space))) + +theorem supported_uniform_energy {f : Field Space} + (hc : ∀ t, Continuous (f t)) (hs : Supported f) + (hb : ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, ‖f t x‖ ≤ C) : + ∃ E : ℝ, ∀ t, 0 ≤ t → (1 / 2 : ℝ) * ∫ x, ‖f t x‖ ^ 2 ≤ E := by + obtain ⟨C, hC, hb⟩ := hb + refine ⟨(1 / 2 : ℝ) * ((volume K).toReal * C ^ 2), fun t ht => ?_⟩ + have he : (fun x => ‖f t x‖ ^ 2) = K.indicator (fun x => ‖f t x‖ ^ 2) := by + funext x + by_cases hx : x ∈ K + · simp only [indicator_of_mem hx] + · simp [indicator_of_notMem hx, hs.zero_off ht hx] + have hi : IntegrableOn (fun x => ‖f t x‖ ^ 2) K := + ((hc t).norm.pow 2).continuousOn.integrableOn_compact K_compact + have hconst : IntegrableOn (fun _ : Space => C ^ 2) K := + integrableOn_const K_compact.measure_ne_top + apply mul_le_mul_of_nonneg_left _ (by norm_num) + rw [he, integral_indicator K_closed.measurableSet] + calc + _ ≤ ∫ _x in K, C ^ 2 := setIntegral_mono_on hi hconst K_closed.measurableSet + (fun x _ => pow_le_pow_left₀ (norm_nonneg _) (hb t ht x) 2) + _ = _ := by simp [Measure.real] + +end RapidForcing + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionCorollaries.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionCorollaries.lean new file mode 100644 index 0000000000000000000000000000000000000000..6937ffe469d5ad157a0681be12e9100bdf4925c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionCorollaries.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidMachineDecisionInput +import OAI.MathematicalPhysics.RapidForcing.Main +import OAI.MathematicalPhysics.AlternatingFlow.Development +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicLatticeCorollaryMain + +namespace OAI + +/-! The four undecidable material experiments in paper 379-06. Their events +refer only to actual material paths and fixed open observation sets. -/ + +noncomputable section +namespace ForcedComputation + +open Set + +def RapidMaterialEvent (u : RapidForcing.Field RapidForcing.Space) : Prop := + ∃ X : ℝ → RapidForcing.Space → RapidForcing.Space, + RapidForcing.MaterialFlow u X ∧ ∃ t, 0 ≤ t ∧ (X t 0) 0 < -1 + +theorem rapid_material_event_iff (M : RapidForcing.Machine) (w : M.Input) : + RapidMaterialEvent (RapidForcing.addressedVelocity M w) ↔ M.Halts w := by + constructor + · rintro ⟨X, hX, he⟩ + exact (RapidForcing.materialFlow_halting_iff M w hX).mpr he + · intro hh + obtain ⟨X, hX⟩ := RapidForcing.addressed_materialFlow M w + exact ⟨X, hX, (RapidForcing.materialFlow_halting_iff M w hX).mp hh⟩ + +/-- The compact Euclidean rapid-force experiment has no total decider. -/ +theorem rapid_particle_undecidable (hT : RapidMachineHaltingUndecidable) : + ¬ ∃ d : ℕ → Bool, Computable d ∧ + ∀ (M : RapidForcing.Machine) (w : M.Input), + d (M.inputDescription w) = true ↔ + RapidMaterialEvent (RapidForcing.addressedVelocity M w) := by + rintro ⟨d, hd, he⟩ + exact hT ⟨d, hd, fun M w => (he M w).trans (rapid_material_event_iff M w)⟩ + +def AlternatingMaterialEvent (u : AlternatingNS.Velocity) : Prop := + ∃ γ : ℝ → AlternatingNS.Space, + AlternatingNS.IsTrajectory u AlternatingNS.observedParticle γ ∧ + ∃ t, 0 ≤ t ∧ 0 < γ t 0 + +theorem alternating_material_event_iff (M : AlternatingNS.Machine) (w : List ℕ) + (hM : M.WellFormed) (hw : M.ValidInput w) : + AlternatingMaterialEvent (AlternatingNS.Construction.velocity M w) ↔ M.Halts w := by + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, X, hX, huniq, hhalt⟩ := + AlternatingNS.Construction.alternating_analytic 1 (by norm_num) M w hM hw + constructor + · rintro ⟨γ, hγ, t, ht, he⟩ + exact hhalt.mp ⟨t, ht, by simpa only [huniq _ _ hγ t ht] using he⟩ + · intro hh + obtain ⟨t, ht, he⟩ := hhalt.mpr hh + exact ⟨X AlternatingNS.observedParticle, hX _, t, ht, he⟩ + +/-- The alternating-memory rapid-force experiment has no total decider. -/ +theorem alternating_particle_undecidable (hT : AlternatingMachineHaltingUndecidable) : + ¬ ∃ d : AlternatingNS.Machine × List ℕ → Bool, Computable d ∧ + ∀ (M : AlternatingNS.Machine) (w : List ℕ), M.WellFormed → M.ValidInput w → + (d (M,w) = true ↔ AlternatingMaterialEvent (AlternatingNS.Construction.velocity M w)) := by + rintro ⟨d, hd, he⟩ + exact hT ⟨d, hd, fun M w hM hw => + (he M w hM hw).trans (alternating_material_event_iff M w hM hw)⟩ + +def LatticeMaterialEvent (u : PeriodicLattice.VectorField) : Prop := + ∃ γ, PeriodicLattice.IsParticle u γ ∧ PeriodicLattice.MaterialEvent γ + +def RapidTorusMaterialEvent (u : PeriodicLattice.VectorField) : Prop := + ∃ γ, PeriodicLattice.RapidTorus.IsCorollaryParticle u γ ∧ + ∃ t, 0 ≤ t ∧ PeriodicLattice.torusMk (γ t) ∈ PeriodicLattice.RapidTorus.corollaryDetector + +theorem lattice_material_event_iff (I : PeriodicLattice.Input) (hI : I.WellFormed) : + LatticeMaterialEvent (PeriodicLattice.FluidLift.velocity I) ↔ PeriodicLattice.Halts I := by + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, hX, huniq, he⟩ := + PeriodicLattice.FluidLift.analytic_lattice_conclusion 1 (by norm_num) I hI + constructor + · rintro ⟨γ, hγ, t, ht, hobs⟩ + exact he.mp ⟨t, ht, by simpa only [huniq γ hγ t ht] using hobs⟩ + · intro hh + exact ⟨X, hX, he.mpr hh⟩ + +theorem rapid_torus_material_event_iff (I : PeriodicLattice.Input) (hI : I.WellFormed) : + RapidTorusMaterialEvent + (PeriodicLattice.RapidTorus.transformedField (PeriodicLattice.FluidLift.velocity I)) ↔ + PeriodicLattice.Halts I := by + constructor + · rintro ⟨γ, hγ, t, ht, hobs⟩ + apply (PeriodicLattice.RapidTorus.transformed_path_event I hI).mp + exact ⟨t, ht, by + simpa only [PeriodicLattice.RapidTorus.corollaryPath_unique I hI hγ.1 hγ.2 ht, + PeriodicLattice.RapidTorus.corollaryPath] using hobs⟩ + · intro hh + refine ⟨PeriodicLattice.RapidTorus.corollaryPath I, ?_, + (PeriodicLattice.RapidTorus.transformed_path_event I hI).mpr hh⟩ + exact ⟨PeriodicLattice.RapidTorus.corollaryPath_start I, fun t ht => + (PeriodicLattice.RapidTorus.corollaryPath_hasDerivAt I hI ht).hasDerivWithinAt⟩ + +/-- Both general and solenoidal lattice forces drive this same material event. -/ +theorem lattice_particle_undecidable (hT : LatticeMachineHaltingUndecidable) : + ¬ ∃ d : PeriodicLattice.Input → Bool, Computable d ∧ + ∀ I : PeriodicLattice.Input, I.WellFormed → (d I = true ↔ LatticeMaterialEvent (PeriodicLattice.FluidLift.velocity I)) := by + rintro ⟨d, hd, he⟩ + exact hT ⟨d, hd, fun I hI => (he I hI).trans (lattice_material_event_iff I hI)⟩ + +/-- The solenoidal mean-zero rapid-force experiment on the torus is undecidable. -/ +theorem rapid_torus_particle_undecidable (hT : LatticeMachineHaltingUndecidable) : + ¬ ∃ d : PeriodicLattice.Input → Bool, Computable d ∧ + ∀ I : PeriodicLattice.Input, I.WellFormed → (d I = true ↔ RapidTorusMaterialEvent + (PeriodicLattice.RapidTorus.transformedField (PeriodicLattice.FluidLift.velocity I))) := by + rintro ⟨d, hd, he⟩ + exact hT ⟨d, hd, fun I hI => (he I hI).trans (rapid_torus_material_event_iff I hI)⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionUnconditional.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionUnconditional.lean new file mode 100644 index 0000000000000000000000000000000000000000..d25474f7b8c23c5c787e3f9768c33e65af1fffa0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidDecisionUnconditional.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidDecisionCorollaries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidMachineHaltingDischarge + +namespace OAI + +/-! The four primary rapid-forcing decision results with the finite-machine +undecidability inputs discharged. -/ + +noncomputable section +namespace ForcedComputation + +theorem rapid_particle_undecidable_unconditional : + ¬ ∃ d : ℕ → Bool, Computable d ∧ + ∀ (M : RapidForcing.Machine) (w : M.Input), + d (M.inputDescription w) = true ↔ + RapidMaterialEvent (RapidForcing.addressedVelocity M w) := + rapid_particle_undecidable rapidMachineHaltingUndecidable + +theorem alternating_particle_undecidable_unconditional : + ¬ ∃ d : AlternatingNS.Machine × List ℕ → Bool, Computable d ∧ + ∀ (M : AlternatingNS.Machine) (w : List ℕ), M.WellFormed → M.ValidInput w → + (d (M,w) = true ↔ AlternatingMaterialEvent (AlternatingNS.Construction.velocity M w)) := + alternating_particle_undecidable alternatingMachineHaltingUndecidable + +theorem lattice_particle_undecidable_unconditional : + ¬ ∃ d : PeriodicLattice.Input → Bool, Computable d ∧ + ∀ I : PeriodicLattice.Input, I.WellFormed → (d I = true ↔ LatticeMaterialEvent (PeriodicLattice.FluidLift.velocity I)) := + lattice_particle_undecidable latticeMachineHaltingUndecidable + +theorem rapid_torus_particle_undecidable_unconditional : + ¬ ∃ d : PeriodicLattice.Input → Bool, Computable d ∧ + ∀ I : PeriodicLattice.Input, I.WellFormed → (d I = true ↔ RapidTorusMaterialEvent + (PeriodicLattice.RapidTorus.transformedField (PeriodicLattice.FluidLift.velocity I))) := + rapid_torus_particle_undecidable latticeMachineHaltingUndecidable + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineDecisionInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineDecisionInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c8e24e01c34789ce728e3ac7300d8dc16863de7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineDecisionInput.lean @@ -0,0 +1,31 @@ +import OAI.MathematicalPhysics.RapidForcing.Model +import OAI.MathematicalPhysics.AlternatingFlow.Model +import OAI.Analysis.PeriodicLattice.Basic + +namespace OAI + +/-! Turing's Section 8 designated-symbol undecidability, specialized to the +three finite presentations used by the rapid-forcing constructions. These +are purely machine-theoretic conditional inputs. -/ + +namespace ForcedComputation + +/-- Finite transition tables with a distinguished terminal state. -/ +def RapidMachineHaltingUndecidable : Prop := + ¬ ∃ d : ℕ → Bool, Computable d ∧ + ∀ (M : RapidForcing.Machine) (w : M.Input), + d (M.inputDescription w) = true ↔ M.Halts w + +/-- Flattened finite tables with a finite list of terminal states. -/ +def AlternatingMachineHaltingUndecidable : Prop := + ¬ ∃ d : AlternatingNS.Machine × List ℕ → Bool, Computable d ∧ + ∀ (M : AlternatingNS.Machine) (w : List ℕ), M.WellFormed → M.ValidInput w → (d (M,w) = true ↔ M.Halts w) + +/-- Ragged finite tables, stopping at the first absent instruction. -/ +def LatticeMachineHaltingUndecidable : Prop := + ¬ ∃ d : PeriodicLattice.Input → Bool, Computable d ∧ + ∀ I : PeriodicLattice.Input, I.WellFormed → (d I = true ↔ PeriodicLattice.Halts I) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineHaltingDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineHaltingDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..92432e45982afe6cac804062b24c1f9d92a1bdca --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RapidMachineHaltingDischarge.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FixedInterpreter +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0AlternatingPresentation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0LatticePresentation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidMachineDecisionInput + +namespace OAI + +/-! All three rapid-forcing decision inputs follow from Mathlib's halting +theorem. The universal machine is fixed; its program argument is encoded +in the finite input word. -/ + +namespace ForcedComputation + +open FiniteMachine + +private theorem list_val_computable (n : ℕ) : + Computable (fun w : List (Fin n) => w.map Fin.val) := + (Primrec.list_map Primrec.id + ((Primrec.dom_finite Fin.val).comp Primrec.snd).to₂).to_comp + +theorem rapidMachineHaltingUndecidable : RapidMachineHaltingUndecidable := by + rintro ⟨d, hd, hcorrect⟩ + obtain ⟨g, q, M, input, hi, hM⟩ := exists_fixed_universal_TM0 + have hc : Computable (fun n => (rapidTM0 M).inputDescription (input n)) := + Computable.encode.comp ((Computable.const _).pair + ((list_val_computable _).comp hi)) + apply ComputablePred.halting_problem 0 + apply ComputablePred.computable_iff.mpr + refine ⟨fun c : Nat.Partrec.Code => d ((rapidTM0 M).inputDescription + (input (Encodable.encode c))), hd.comp (hc.comp Computable.encode), ?_⟩ + funext c + apply propext + have h := (hcorrect (rapidTM0 M) (input (Encodable.encode c))).trans + ((rapidTM0_halts_iff M _).trans (hM _)) + simpa only [Denumerable.ofNat_encode] using h.symm + +theorem alternatingMachineHaltingUndecidable : AlternatingMachineHaltingUndecidable := by + rintro ⟨d, hd, hcorrect⟩ + obtain ⟨g, q, M, input, hi, hM⟩ := exists_fixed_universal_TM0 + have hc : Computable (fun n => (alternatingTM0 M, (input n).map Fin.val)) := + (Computable.const _).pair ((list_val_computable _).comp hi) + apply ComputablePred.halting_problem 0 + apply ComputablePred.computable_iff.mpr + refine ⟨fun c : Nat.Partrec.Code => d (alternatingTM0 M, + (input (Encodable.encode c)).map Fin.val), hd.comp (hc.comp Computable.encode), ?_⟩ + funext c + apply propext + have hv : (alternatingTM0 M).ValidInput ((input (Encodable.encode c)).map Fin.val) := by + intro a ha + obtain ⟨b, _, rfl⟩ := List.mem_map.mp ha + exact b.isLt + have h := (hcorrect (alternatingTM0 M) _ (alternatingTM0_wellFormed M) hv).trans + ((alternatingTM0_halts_iff M _).trans (hM _)) + simpa only [Denumerable.ofNat_encode] using h.symm + +private theorem lattice_constructor_computable (M : PeriodicLattice.Machine) : + Computable (fun w : List ℕ => (⟨M, w⟩ : PeriodicLattice.Input)) := by + apply Computable.encode_iff.mp + change Computable (fun w : List ℕ => Encodable.encode (M, w)) + exact Computable.encode.comp ((Computable.const M).pair Computable.id) + +private theorem lattice_input_computable (R : RapidForcing.Machine) : + Computable (fun w : R.Input => + (⟨latticeMachine R, w.map Fin.val⟩ : PeriodicLattice.Input)) := + (lattice_constructor_computable (latticeMachine R)).comp (list_val_computable R.symbols) + +private theorem lattice_input_valid (R : RapidForcing.Machine) (w : R.Input) : + (⟨latticeMachine R, w.map Fin.val⟩ : PeriodicLattice.Input).WellFormed := by + refine ⟨latticeMachine_wellFormed R, ?_⟩ + intro a ha + obtain ⟨b, _, rfl⟩ := List.mem_map.mp ha + exact b.isLt + +private theorem lattice_undecidable_of_universal (R : RapidForcing.Machine) + (input : ℕ → R.Input) (hi : Computable input) + (hM : ∀ n, R.Halts (input n) ↔ + ((Denumerable.ofNat Nat.Partrec.Code n).eval 0).Dom) : + LatticeMachineHaltingUndecidable := by + rintro ⟨d, hd, hcorrect⟩ + have hc := (lattice_input_computable R).comp hi + apply ComputablePred.halting_problem 0 + apply ComputablePred.computable_iff.mpr + refine ⟨fun c : Nat.Partrec.Code => d + ⟨latticeMachine R, (input (Encodable.encode c)).map Fin.val⟩, + hd.comp (hc.comp Computable.encode), ?_⟩ + funext c + apply propext + have h := (hcorrect + ⟨latticeMachine R, (input (Encodable.encode c)).map Fin.val⟩ + (lattice_input_valid R (input (Encodable.encode c)))).trans + ((latticeMachine_halts_iff R (input (Encodable.encode c))).trans + (hM (Encodable.encode c))) + simpa only [Denumerable.ofNat_encode] using h.symm + +theorem latticeMachineHaltingUndecidable : LatticeMachineHaltingUndecidable := by + obtain ⟨g, q, M, input, hi, hM⟩ := exists_fixed_universal_TM0 + apply lattice_undecidable_of_universal (rapidTM0 M) input hi + intro n + exact (rapidTM0_halts_iff M (input n)).trans (hM n) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalEncoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..04e2fef13f42fd10a6458c509af683983d63a0f2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalEncoding.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RadixEncoding + +namespace OAI + +/-! The finite input supplies an actual rational coordinate to the loader. -/ + +namespace ForcedComputation.Radix + +variable {A : Type*} + +def prefixValueQ (B : ℚ) (digit : A → ℚ) : List A → ℚ := + List.rec 0 (fun a _ value => (digit a + value) / B) + +def finiteCode (B : ℚ) (digit : A → ℚ) (w : List A) (blank : A) : ℚ := + prefixValueQ B digit w + B⁻¹ ^ w.length * (digit blank / (B - 1)) + +theorem prefixValueQ_cast (B : ℚ) (digit : A → ℚ) (w : List A) : + (prefixValueQ B digit w : ℝ) = prefixValue B (fun a => (digit a : ℝ)) w := by + induction w with + | nil => simp [prefixValueQ, prefixValue] + | cons a w ih => + change (((digit a + prefixValueQ B digit w) / B : ℚ) : ℝ) = _ + rw [Rat.cast_div, Rat.cast_add, ih] + rfl + +theorem finiteCode_spec {B : ℚ} (hB : 1 < B) {digit : A → ℚ} + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (w : List A) (blank : A) : + encode (B : ℝ) (fun a => (digit a : ℝ)) (prependWord w (fun _ => blank)) = + (finiteCode B digit w blank : ℝ) := by + have hBr : (1 : ℝ) < B := by exact_mod_cast hB + have hdr : ∀ a, (0 : ℝ) ≤ digit a ∧ (digit a : ℝ) ≤ (B : ℝ) - 1 := by + intro a + constructor + · exact_mod_cast (hd a).1 + · exact_mod_cast (hd a).2 + rw [encode_finite_input hBr hdr] + simp only [finiteCode, Rat.cast_add, Rat.cast_mul, Rat.cast_inv, Rat.cast_pow, + Rat.cast_div, Rat.cast_sub, Rat.cast_one, prefixValueQ_cast] + +end ForcedComputation.Radix + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalLoader.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalLoader.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ea0bcf8260473154593d7464376396012263832 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RationalLoader.lean @@ -0,0 +1,204 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RectangleAffine +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.IntermediateObservation + +namespace OAI + +/-! One rational translation supplies the entire input-dependent loading period. -/ + +noncomputable section +open Set + +namespace ForcedComputation + +open ShearFlows + +def centeredBox (p : Fin 2 → ℚ) (r : ℚ) : RationalBox 2 := + ⟨fun j => p j - r, fun j => p j + r⟩ + +theorem centeredBox_center (p : Fin 2 → ℚ) (r : ℚ) (j : Fin 2) : + (centeredBox p r).center j = (p j : ℝ) := by + simp only [centeredBox, RationalBox.center, Rat.cast_sub, Rat.cast_add] + ring + +theorem centeredBox_halfWidth (p : Fin 2 → ℚ) (r : ℚ) (j : Fin 2) : + (centeredBox p r).halfWidth j = (r : ℝ) := by + simp only [centeredBox, RationalBox.halfWidth, Rat.cast_sub, Rat.cast_add] + ring + +def loaderInstruction (p q : Fin 2 → ℚ) : Instruction := + ⟨centeredBox p (1 / 512), centeredBox q (1 / 512), 1⟩ + +def loaderInput (p q : Fin 2 → ℚ) (z : ℚ) : Input where + period := 1 + chart := ⟨fun _ => 1 / 32, fun _ => 31 / 32⟩ + h := 1 / 512 + codingHeight := z + centers := ⟨fun _ => 1 / 8, fun _ => 7 / 8⟩ + instructions := [loaderInstruction p q] + +theorem loaderInstruction_image (p q : Fin 2 → ℚ) : + (loaderInstruction p q).affine '' (loaderInstruction p q).source.carrier = + (loaderInstruction p q).target.carrier := by + apply Instruction.image_eq_of_halfWidths _ (by norm_num [loaderInstruction]) + · simp only [loaderInstruction, centeredBox_halfWidth, Rat.cast_one, one_mul] + · simp only [loaderInstruction, centeredBox_halfWidth, Rat.cast_one, div_one] + +theorem loaderInput_valid (p q : Fin 2 → ℚ) (z : ℚ) + (hp : ∀ j, 1 / 8 ≤ p j ∧ p j ≤ 7 / 8) + (hq : ∀ j, 1 / 8 ≤ q j ∧ q j ≤ 7 / 8) + (hz : 1 / 32 < z ∧ z < 31 / 32) : ValidInput (loaderInput p q z) := by + have hpos (a : Fin 2 → ℚ) : (centeredBox a (1 / 512)).positive := by + intro j + change a j - 1 / 512 < a j + 1 / 512 + linarith + have hin (a : Fin 2 → ℚ) (ha : ∀ j, 1 / 8 ≤ a j ∧ a j ≤ 7 / 8) : + (centeredBox a (1 / 512)).carrier ⊆ (loaderInput p q z).inPlanarChart := by + intro x hx j + have hj := hx j + have haj : (1 / 8 : ℝ) ≤ (a j : ℝ) ∧ (a j : ℝ) ≤ 7 / 8 := by + have h : (((1 / 8 : ℚ) : ℝ) ≤ (a j : ℝ) ∧ (a j : ℝ) ≤ ((7 / 8 : ℚ) : ℝ)) := + ⟨Rat.cast_le.mpr (ha j).1, Rat.cast_le.mpr (ha j).2⟩ + norm_num only [Rat.cast_div, Rat.cast_ofNat] at h + exact h + change ((a j - 1 / 512 : ℚ) : ℝ) ≤ x j ∧ x j ≤ ((a j + 1 / 512 : ℚ) : ℝ) at hj + simp only [Rat.cast_sub, Rat.cast_add, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hj + change ((1 / 32 : ℚ) : ℝ) < x j ∧ x j < ((31 / 32 : ℚ) : ℝ) + norm_num only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith [haj.1, haj.2] + have hcenter (a : Fin 2 → ℚ) (ha : ∀ j, 1 / 8 ≤ a j ∧ a j ≤ 7 / 8) : + (centeredBox a (1 / 512)).center ∈ (loaderInput p q z).centers.carrier := by + intro j + rw [centeredBox_center] + exact_mod_cast ha j + refine { + period_pos := by norm_num [loaderInput] + chart_positive := by intro j; norm_num [loaderInput, RationalBox.positive] + chart_length := by intro j; norm_num [loaderInput] + h_pos := by norm_num [loaderInput] + centers_nonempty := by intro j; norm_num [loaderInput] + chartMargin := by intro j; norm_num [loaderInput] + height_inside := by exact_mod_cast hz + source_positive := ?_ + target_positive := ?_ + source_in_chart := ?_ + target_in_chart := ?_ + factor_pos := ?_ + image_eq := ?_ + source_separation := ?_ + target_separation := ?_ + halfWidths := ?_ + source_centers := ?_ + target_centers := ?_ } + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hpos p + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hpos q + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hin p hp + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hin q hq + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + norm_num [loaderInstruction] + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact loaderInstruction_image p q + · intro i j hij + apply False.elim ∘ hij + apply Fin.ext + have hi : i.val < 1 := by simpa only [loaderInput, List.length_singleton] using i.isLt + have hj : j.val < 1 := by simpa only [loaderInput, List.length_singleton] using j.isLt + omega + · intro i j hij + apply False.elim ∘ hij + apply Fin.ext + have hi : i.val < 1 := by simpa only [loaderInput, List.length_singleton] using i.isLt + have hj : j.val < 1 := by simpa only [loaderInput, List.length_singleton] using j.isLt + omega + · intro b hb j + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + simp only [loaderInstruction, centeredBox_halfWidth, loaderInput, le_refl, and_self] + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hcenter p hp + · intro b hb + have he : b = loaderInstruction p q := by simpa only [loaderInput, List.mem_singleton] using hb + subst b + exact hcenter q hq + +theorem loaderInstruction_center (p q : Fin 2 → ℚ) : + (loaderInstruction p q).affine (fun j => (p j : ℝ)) = fun j => (q j : ℝ) := by + funext j + fin_cases j <;> simp [loaderInstruction, Instruction.affine, centeredBox_center] + +theorem loaderInstruction_contains_center (p q : Fin 2 → ℚ) : + (fun j => (p j : ℝ)) ∈ (loaderInstruction p q).source.carrier := by + intro j + change ((p j - 1 / 512 : ℚ) : ℝ) ≤ (p j : ℝ) ∧ + (p j : ℝ) ≤ ((p j + 1 / 512 : ℚ) : ℝ) + simp only [Rat.cast_sub, Rat.cast_add, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + constructor <;> linarith + +theorem loaderFlow_endpoint {p q : Fin 2 → ℚ} {z : ℚ} + (hd : ValidInput (loaderInput p q z)) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (loaderInput p q z).realizingVelocity Φ) : + Φ 1 (atHeight (fun j => (p j : ℝ)) z) = atHeight (fun j => (q j : ℝ)) z := by + have hΦ' : IsMaterialFlow (loaderInput p q z).period (loaderInput p q z).realizingVelocity Φ := by + simpa only [loaderInput, Rat.cast_one] using hΦ + have hδ : (0 : ℝ) < (loaderInput p q z).tubeRadius := by + exact_mod_cast tubeRadius_pos hd + have hx : atHeight (fun j => (p j : ℝ)) z ∈ + sourceTube (loaderInstruction p q) z (loaderInput p q z).tubeRadius := by + refine ⟨_, loaderInstruction_contains_center p q, ?_, ?_⟩ + · simpa only [atHeight_horizontal, sub_self, norm_zero] using hδ + · simpa [atHeight] using hδ + have he := realizingVelocity_periodMap hd hΦ' (b := loaderInstruction p q) + (by simp [loaderInput]) hx + rw [atHeight_horizontal, loaderInstruction_center] at he + exact he + +theorem loaderFlow_first_le {p q : Fin 2 → ℚ} {z : ℚ} + (hd : ValidInput (loaderInput p q z)) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (loaderInput p q z).realizingVelocity Φ) + {a t : ℝ} (hp : (p 0 : ℝ) ≤ a) (hq : (q 0 : ℝ) ≤ a) (ht : t ∈ Icc (0 : ℝ) 1) : + Φ t (atHeight (fun j => (p j : ℝ)) z) 0 ≤ a + 1 / 256 := by + have hΦ' : IsMaterialFlow (loaderInput p q z).period (loaderInput p q z).realizingVelocity Φ := by + simpa only [loaderInput, Rat.cast_one] using hΦ + have he := materialFlow_first_le hd hΦ' ⟨0, by simp [loaderInput]⟩ + (loaderInstruction_contains_center p q) + (by simpa [loaderInput, loaderInstruction, centeredBox_center] using hp) + (by simpa [loaderInput, loaderInstruction, centeredBox_center] using hq) ht + norm_num [loaderInput] at he ⊢ + exact he + +theorem loaderFlow_first_ge {p q : Fin 2 → ℚ} {z : ℚ} + (hd : ValidInput (loaderInput p q z)) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (loaderInput p q z).realizingVelocity Φ) + {a t : ℝ} (hp : a ≤ (p 0 : ℝ)) (hq : a ≤ (q 0 : ℝ)) (ht : t ∈ Icc (0 : ℝ) 1) : + a - 1 / 256 ≤ Φ t (atHeight (fun j => (p j : ℝ)) z) 0 := by + have hΦ' : IsMaterialFlow (loaderInput p q z).period (loaderInput p q z).realizingVelocity Φ := by + simpa only [loaderInput, Rat.cast_one] using hΦ + have he := materialFlow_first_ge hd hΦ' ⟨0, by simp [loaderInput]⟩ + (loaderInstruction_contains_center p q) + (by simpa [loaderInput, loaderInstruction, centeredBox_center] using hp) + (by simpa [loaderInput, loaderInstruction, centeredBox_center] using hq) ht + norm_num [loaderInput] at he ⊢ + exact he + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Recorder.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Recorder.lean new file mode 100644 index 0000000000000000000000000000000000000000..938601c64fd87b117f511dbfbb9b738160a579d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Recorder.lean @@ -0,0 +1,396 @@ +import Mathlib + +namespace OAI + +/-! +The seven-row reversible recording table in Section 2 of *Finite Instructions +and Solenoidal Shear Flows* (2026), Lemma `lem:recorder`. + +The inverse below is valid on the entire guarded domain, including tapes that +do not satisfy the checkpoint invariant. The record is the pair consisting of +the original state and the symbol read, as in Bennett, *Logical reversibility +of computation* (1973), equations (9)--(11); the concrete seven-row construction +and its proof are supplied here rather than assumed from that reference. +-/ + +namespace ForcedComputation.Recorder + +variable {Q A : Type*} + +structure Machine (Q A : Type*) where + halting : Q → Bool + next : Q → A → Q + write : Q → A → A + move : Q → A → ℤ + move_bound : ∀ q a, -1 ≤ move q a ∧ move q a ≤ 1 + +abbrev Record (Q A : Type*) := Q × A + +inductive History (Q A : Type*) + | empty + | frontier + | record (r : Record Q A) + deriving DecidableEq, Fintype + +inductive Control (Q A : Type*) + | checkpoint (q : Q) + | mark (r : Record Q A) + | scanRight (r : Record Q A) + | advance (q : Q) + | scanLeft (q : Q) + deriving DecidableEq, Fintype + +abbrev Symbol (Q A : Type*) := A × History Q A × Bool + +open History Control + +/-- Exactly the seven rows of the manuscript's guarded local table. -/ +inductive LocalStep (M : Machine Q A) : + Control Q A → Symbol Q A → Control Q A → Symbol Q A → ℤ → Prop + | work (q : Q) (a : A) (l : History Q A) + (hq : M.halting q = false) (hl : l ≠ frontier) : + LocalStep M (checkpoint q) (a, l, false) + (mark (q, a)) (M.write q a, l, false) (M.move q a) + | setMark (r : Record Q A) (c : A) (l : History Q A) (hl : l ≠ frontier) : + LocalStep M (mark r) (c, l, false) (scanRight r) (c, l, true) 1 + | right (r : Record Q A) (c : A) (l : History Q A) (hl : l ≠ frontier) : + LocalStep M (scanRight r) (c, l, false) (scanRight r) (c, l, false) 1 + | record (r : Record Q A) (c : A) : + LocalStep M (scanRight r) (c, frontier, false) + (advance (M.next r.1 r.2)) (c, History.record r, false) 1 + | advance (q : Q) (c : A) : + LocalStep M (Control.advance q) (c, empty, false) + (scanLeft q) (c, frontier, false) (-1) + | left (q : Q) (c : A) (l : History Q A) (hl : l ≠ frontier) : + LocalStep M (scanLeft q) (c, l, false) (scanLeft q) (c, l, false) (-1) + | clearMark (q : Q) (c : A) (l : History Q A) (hl : l ≠ frontier) : + LocalStep M (scanLeft q) (c, l, true) (checkpoint q) (c, l, false) 0 + +def incoming (M : Machine Q A) : Control Q A → ℤ + | checkpoint _ => 0 + | mark r => M.move r.1 r.2 + | scanRight _ => 1 + | advance _ => 1 + | scanLeft _ => -1 + +theorem LocalStep.incoming_eq {M : Machine Q A} {q q' : Control Q A} + {s s' : Symbol Q A} {d : ℤ} (h : LocalStep M q s q' s' d) : + incoming M q' = d := by + cases h <;> rfl + +/-- Reconstruct the preceding control and read symbol from the new control and +the complete symbol that was written. No checkpoint invariant is consulted. -/ +def undoLocal : Control Q A → Symbol Q A → Option (Control Q A × Symbol Q A) + | checkpoint q, (c, l, _) => some (scanLeft q, (c, l, true)) + | mark r, (_, l, _) => some (checkpoint r.1, (r.2, l, false)) + | scanRight r, (c, l, true) => some (mark r, (c, l, false)) + | scanRight r, (c, l, false) => some (scanRight r, (c, l, false)) + | advance _, (c, History.record r, _) => some (scanRight r, (c, frontier, false)) + | advance _, _ => none + | scanLeft q, (c, History.frontier, _) => some (advance q, (c, empty, false)) + | scanLeft q, (c, l, _) => some (scanLeft q, (c, l, false)) + +theorem LocalStep.undo {M : Machine Q A} {q q' : Control Q A} + {s s' : Symbol Q A} {d : ℤ} (h : LocalStep M q s q' s' d) : + undoLocal q' s' = some (q, s) := by + cases h with + | work => rfl + | setMark => rfl + | right => rfl + | record => rfl + | advance => rfl + | left q c l hl => cases l <;> simp_all [undoLocal] + | clearMark => rfl + +theorem LocalStep.predecessor_unique {M : Machine Q A} + {q₁ q₂ q' : Control Q A} {s₁ s₂ s' : Symbol Q A} {d₁ d₂ : ℤ} + (h₁ : LocalStep M q₁ s₁ q' s' d₁) (h₂ : LocalStep M q₂ s₂ q' s' d₂) : + q₁ = q₂ ∧ s₁ = s₂ ∧ d₁ = d₂ := by + have h := Option.some.inj (h₁.undo.symm.trans h₂.undo) + exact ⟨(Prod.mk.inj h).1, (Prod.mk.inj h).2, + h₁.incoming_eq.symm.trans h₂.incoming_eq⟩ + +/-- A terminating local interpreter for the finite table. -/ +def evalLocal [DecidableEq Q] [DecidableEq A] (M : Machine Q A) + (q : Control Q A) (s : Symbol Q A) : Option (Control Q A × Symbol Q A × ℤ) := + match q, s with + | checkpoint q, (a, l, false) => + if M.halting q = false ∧ l ≠ frontier then + some (mark (q, a), (M.write q a, l, false), M.move q a) else none + | mark r, (c, l, false) => + if l ≠ frontier then some (scanRight r, (c, l, true), 1) else none + | scanRight r, (c, l, false) => + if l = frontier then some (advance (M.next r.1 r.2), (c, History.record r, false), 1) + else some (scanRight r, (c, l, false), 1) + | advance q, (c, empty, false) => some (scanLeft q, (c, frontier, false), -1) + | scanLeft q, (c, l, b) => + if l ≠ frontier then + if b then some (checkpoint q, (c, l, false), 0) + else some (scanLeft q, (c, l, false), -1) + else none + | _, _ => none + +theorem LocalStep.eval [DecidableEq Q] [DecidableEq A] {M : Machine Q A} + {q q' : Control Q A} {s s' : Symbol Q A} {d : ℤ} + (h : LocalStep M q s q' s' d) : evalLocal M q s = some (q', s', d) := by + cases h <;> simp_all [evalLocal] + +theorem LocalStep.successor_unique [DecidableEq Q] [DecidableEq A] + {M : Machine Q A} {q q₁ q₂ : Control Q A} {s s₁ s₂ : Symbol Q A} {d₁ d₂ : ℤ} + (h₁ : LocalStep M q s q₁ s₁ d₁) (h₂ : LocalStep M q s q₂ s₂ d₂) : + q₁ = q₂ ∧ s₁ = s₂ ∧ d₁ = d₂ := by + have h := Prod.mk.inj (Option.some.inj (h₁.eval.symm.trans h₂.eval)) + exact ⟨h.1, (Prod.mk.inj h.2).1, (Prod.mk.inj h.2).2⟩ + +structure Configuration (Q A : Type*) where + control : Control Q A + head : ℤ + tape : ℤ → Symbol Q A + +def Step (M : Machine Q A) (C D : Configuration Q A) : Prop := + ∃ q' s' d, LocalStep M C.control (C.tape C.head) q' s' d ∧ + D = ⟨q', C.head + d, Function.update C.tape C.head s'⟩ + +def undo (M : Machine Q A) (D : Configuration Q A) : Option (Configuration Q A) := + let h := D.head - incoming M D.control + (undoLocal D.control (D.tape h)).map fun p => + ⟨p.1, h, Function.update D.tape h p.2⟩ + +/-- The entire predecessor tape, head, and control are recovered. -/ +theorem Step.undo {M : Machine Q A} {C D : Configuration Q A} (h : Step M C D) : + undo M D = some C := by + obtain ⟨q', s', d, hlocal, rfl⟩ := h + have hhead : C.head + d - incoming M q' = C.head := by + rw [hlocal.incoming_eq] + omega + change (undoLocal q' ((Function.update C.tape C.head s') + (C.head + d - incoming M q'))).map (fun p => + ⟨p.1, C.head + d - incoming M q', + Function.update (Function.update C.tape C.head s') + (C.head + d - incoming M q') p.2⟩) = some C + rw [hhead, Function.update_self, hlocal.undo, Option.map_some] + congr 1 + have ht : Function.update (Function.update C.tape C.head s') C.head (C.tape C.head) = + C.tape := by + funext j + by_cases hj : j = C.head <;> simp [hj] + rw [ht] + +theorem Step.predecessor_unique {M : Machine Q A} {C₁ C₂ D : Configuration Q A} + (h₁ : Step M C₁ D) (h₂ : Step M C₂ D) : C₁ = C₂ := + Option.some.inj (h₁.undo.symm.trans h₂.undo) + +theorem Step.scan_right {M : Machine Q A} {r : Record Q A} {h : ℤ} + {tape : ℤ → Symbol Q A} {c : A} {l : History Q A} + (hs : tape h = (c, l, false)) (hl : l ≠ frontier) : + Step M ⟨scanRight r, h, tape⟩ ⟨scanRight r, h + 1, tape⟩ := by + refine ⟨scanRight r, (c, l, false), 1, ?_, ?_⟩ + · simpa only [hs] using LocalStep.right (M := M) r c l hl + · simp only + rw [← hs, Function.update_eq_self] + +theorem Step.scan_left {M : Machine Q A} {q : Q} {h : ℤ} + {tape : ℤ → Symbol Q A} {c : A} {l : History Q A} + (hs : tape h = (c, l, false)) (hl : l ≠ frontier) : + Step M ⟨scanLeft q, h, tape⟩ ⟨scanLeft q, h - 1, tape⟩ := by + refine ⟨scanLeft q, (c, l, false), -1, ?_, ?_⟩ + · simpa only [hs] using LocalStep.left (M := M) q c l hl + · simp only + rw [← hs, Function.update_eq_self] + congr 1 + +/-- Execution with an exact finite number of local transitions. -/ +inductive Steps (M : Machine Q A) : ℕ → Configuration Q A → Configuration Q A → Prop + | zero (C) : Steps M 0 C C + | next {n C D E} : Steps M n C D → Step M D E → Steps M (n + 1) C E + +theorem Steps.trans {M : Machine Q A} {m n : ℕ} {C D E : Configuration Q A} + (h₁ : Steps M m C D) (h₂ : Steps M n D E) : Steps M (m + n) C E := by + induction h₂ with + | zero => simpa using h₁ + | next h₂ hstep ih => simpa [Nat.add_assoc] using Steps.next (ih h₁) hstep + +theorem scan_right_steps (M : Machine Q A) (r : Record Q A) + (h : ℤ) (tape : ℤ → Symbol Q A) (n : ℕ) + (hs : ∀ i < n, ∃ c l, tape (h + (i : ℤ)) = (c, l, false) ∧ l ≠ frontier) : + Steps M n ⟨scanRight r, h, tape⟩ ⟨scanRight r, h + (n : ℤ), tape⟩ := by + induction n with + | zero => simpa using Steps.zero (M := M) ⟨scanRight r, h, tape⟩ + | succ n ih => + obtain ⟨c, l, he, hl⟩ := hs n (Nat.lt_succ_self n) + have hn := ih (fun i hi => hs i (Nat.lt_succ_of_lt hi)) + have hstep := Step.scan_right (M := M) (r := r) he hl + convert Steps.next hn hstep using 1 + simp [Nat.cast_add, Nat.cast_one, add_assoc] + +theorem scan_left_steps (M : Machine Q A) (q : Q) + (h : ℤ) (tape : ℤ → Symbol Q A) (n : ℕ) + (hs : ∀ i < n, ∃ c l, tape (h - (i : ℤ)) = (c, l, false) ∧ l ≠ frontier) : + Steps M n ⟨scanLeft q, h, tape⟩ ⟨scanLeft q, h - (n : ℤ), tape⟩ := by + induction n with + | zero => simpa using Steps.zero (M := M) ⟨scanLeft q, h, tape⟩ + | succ n ih => + obtain ⟨c, l, he, hl⟩ := hs n (Nat.lt_succ_self n) + have hn := ih (fun i hi => hs i (Nat.lt_succ_of_lt hi)) + have hstep := Step.scan_left (M := M) (q := q) he hl + convert Steps.next hn hstep using 1 + simp [Nat.cast_add, Nat.cast_one, sub_sub] + +def tracks (w : ℤ → A) (h : ℤ → History Q A) (b : ℤ → Bool) : ℤ → Symbol Q A := + fun j => (w j, h j, b j) + +theorem tracks_update_work (w : ℤ → A) (h : ℤ → History Q A) (b : ℤ → Bool) + (j : ℤ) (a : A) : + Function.update (tracks w h b) j (a, h j, b j) = + tracks (Function.update w j a) h b := by + funext k + by_cases hk : k = j <;> simp [tracks, hk] + +theorem tracks_update_history (w : ℤ → A) (h : ℤ → History Q A) (b : ℤ → Bool) + (j : ℤ) (l : History Q A) : + Function.update (tracks w h b) j (w j, l, b j) = + tracks w (Function.update h j l) b := by + funext k + by_cases hk : k = j <;> simp [tracks, hk] + +theorem tracks_update_mark (w : ℤ → A) (h : ℤ → History Q A) (b : ℤ → Bool) + (j : ℤ) (v : Bool) : + Function.update (tracks w h b) j (w j, h j, v) = + tracks w h (Function.update b j v) := by + funext k + by_cases hk : k = j <;> simp [tracks, hk] + +/-- A complete recorder cycle. There are `k` right-scan steps and `k + 1` +left-scan steps, in addition to the five non-scan transitions. The hypotheses +describe the actual work/history tracks, not a pre-assumed simulation. -/ +theorem checkpoint_cycle (M : Machine Q A) (q : Q) (w : ℤ → A) + (history : ℤ → History Q A) (head : ℤ) (k : ℕ) + (hq : M.halting q = false) + (hhead : history head ≠ frontier) + (hbefore : ∀ j < head + M.move q (w head) + (k : ℤ) + 1, + history j ≠ frontier) + (hfront : history (head + M.move q (w head) + (k : ℤ) + 1) = frontier) + (hempty : history (head + M.move q (w head) + (k : ℤ) + 1 + 1) = empty) : + let r : Record Q A := (q, w head) + let head' := head + M.move q (w head) + let g := head' + (k : ℤ) + 1 + let w' := Function.update w head (M.write q (w head)) + let history' := Function.update (Function.update history g (History.record r)) + (g + 1) frontier + Steps M (2 * k + 6) + ⟨checkpoint q, head, tracks w history (fun _ => false)⟩ + ⟨checkpoint (M.next q (w head)), head', tracks w' history' (fun _ => false)⟩ := by + dsimp only + let r : Record Q A := (q, w head) + let head' := head + M.move q (w head) + let g := head' + (k : ℤ) + 1 + let w' := Function.update w head (M.write q (w head)) + let marks : ℤ → Bool := Function.update (fun _ => false) head' true + let hist₁ := Function.update history g (History.record r) + let hist₂ := Function.update hist₁ (g + 1) frontier + have hh'g : head' < g := by dsimp [g]; omega + have hhfront : history head' ≠ frontier := hbefore head' hh'g + have hg : history g = frontier := hfront + have hge : history (g + 1) = empty := hempty + have hm (j : ℤ) (hj : j ≠ head') : marks j = false := by + simp [marks, Function.update_of_ne hj] + have hmark : marks head' = true := by simp [marks] + have h₁ : Step M + ⟨checkpoint q, head, tracks w history (fun _ => false)⟩ + ⟨mark r, head', tracks w' history (fun _ => false)⟩ := by + refine ⟨mark r, (M.write q (w head), history head, false), M.move q (w head), + LocalStep.work q (w head) (history head) hq hhead, ?_⟩ + simp only [tracks_update_work] + rfl + have h₂ : Step M + ⟨mark r, head', tracks w' history (fun _ => false)⟩ + ⟨scanRight r, head' + 1, tracks w' history marks⟩ := by + refine ⟨scanRight r, (w' head', history head', true), 1, + LocalStep.setMark r (w' head') (history head') hhfront, ?_⟩ + simp only [tracks_update_mark] + rfl + have hR : Steps M k + ⟨scanRight r, head' + 1, tracks w' history marks⟩ + ⟨scanRight r, g, tracks w' history marks⟩ := by + have hs : ∀ i < k, ∃ c l, + tracks w' history marks (head' + 1 + (i : ℤ)) = (c, l, false) ∧ + l ≠ frontier := by + intro i hi + refine ⟨w' (head' + 1 + (i : ℤ)), history (head' + 1 + (i : ℤ)), ?_, + hbefore (head' + 1 + (i : ℤ)) ?_⟩ + · dsimp only [tracks] + rw [hm _ (by omega)] + · dsimp [g, head'] at * + omega + convert scan_right_steps M r (head' + 1) (tracks w' history marks) k hs using 1 + congr 1 + dsimp [g] + omega + have h₃ : Step M + ⟨scanRight r, g, tracks w' history marks⟩ + ⟨advance (M.next q (w head)), g + 1, tracks w' hist₁ marks⟩ := by + refine ⟨advance (M.next q (w head)), (w' g, History.record r, false), 1, ?_, ?_⟩ + · simpa only [tracks, hg, hm g (by omega)] using LocalStep.record (M := M) r (w' g) + · rw [← hm g (by omega), tracks_update_history] + have h₄ : Step M + ⟨advance (M.next q (w head)), g + 1, tracks w' hist₁ marks⟩ + ⟨scanLeft (M.next q (w head)), g, tracks w' hist₂ marks⟩ := by + have he : hist₁ (g + 1) = empty := by + simpa [hist₁, Function.update_of_ne (show g + 1 ≠ g by omega)] using hge + refine ⟨scanLeft (M.next q (w head)), (w' (g + 1), frontier, false), -1, ?_, ?_⟩ + · simpa only [tracks, he, hm (g + 1) (by omega)] using + LocalStep.advance (M := M) (M.next q (w head)) (w' (g + 1)) + · rw [← hm (g + 1) (by omega), tracks_update_history] + change (⟨scanLeft (M.next q (w head)), g, tracks w' hist₂ marks⟩ : + Configuration Q A) = ⟨scanLeft (M.next q (w head)), (g + 1) + (-1), + tracks w' hist₂ marks⟩ + congr 1 + omega + have hL : Steps M (k + 1) + ⟨scanLeft (M.next q (w head)), g, tracks w' hist₂ marks⟩ + ⟨scanLeft (M.next q (w head)), head', tracks w' hist₂ marks⟩ := by + have hs : ∀ i < k + 1, ∃ c l, + tracks w' hist₂ marks (g - (i : ℤ)) = (c, l, false) ∧ l ≠ History.frontier := by + intro i hi + have hji : head' < g - (i : ℤ) := by dsimp [g]; omega + have hjg : g - (i : ℤ) ≤ g := by omega + refine ⟨w' (g - (i : ℤ)), hist₂ (g - (i : ℤ)), ?_, ?_⟩ + · dsimp only [tracks] + rw [hm _ (by omega)] + · dsimp only [hist₂] + rw [Function.update_of_ne (by omega)] + by_cases hgg : g - (i : ℤ) = g + · simp [hist₁, hgg] + · rw [show hist₁ (g - (i : ℤ)) = history (g - (i : ℤ)) by + exact Function.update_of_ne hgg _ _] + exact hbefore _ (lt_of_le_of_ne hjg hgg) + convert scan_left_steps M (M.next q (w head)) g (tracks w' hist₂ marks) (k + 1) hs using 1 + congr 1 + dsimp [g] + omega + have h₅ : Step M + ⟨scanLeft (M.next q (w head)), head', tracks w' hist₂ marks⟩ + ⟨checkpoint (M.next q (w head)), head', tracks w' hist₂ (fun _ => false)⟩ := by + have hh : hist₂ head' = history head' := by + simp [hist₂, hist₁, Function.update_of_ne (show head' ≠ g + 1 by omega), + Function.update_of_ne (show head' ≠ g by omega)] + refine ⟨checkpoint (M.next q (w head)), (w' head', hist₂ head', false), 0, ?_, ?_⟩ + · simpa only [tracks, hmark] using + LocalStep.clearMark (M := M) (M.next q (w head)) (w' head') (hist₂ head') + (by simpa only [hh] using hhfront) + · rw [tracks_update_mark] + have hmclear : Function.update marks head' false = fun _ => false := by + funext j + by_cases hj : j = head' <;> simp [marks, hj] + rw [hmclear] + simp + have h12 := Steps.next (Steps.next (Steps.zero _) h₁) h₂ + have h123 := Steps.next (h12.trans hR) h₃ + have h1234 := Steps.next h123 h₄ + have result := Steps.next (h1234.trans hL) h₅ + convert result using 1 + omega + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderAtHeight.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderAtHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cefdc884c3b4e0b89fb95542c842eeb41528aef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderAtHeight.lean @@ -0,0 +1,175 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.HeightShift +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderLoader + +namespace OAI + +/-! The same finite recorder operates on any rational horizontal sheet. +Only the chart height changes; all planar instructions are retained. -/ + +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +def recorderInputAtHeight (M : Alternating.Machine) (hM : M.WellFormed) (z : ℚ) : Input := + (compiledInput M hM).shiftHeight (z - 1 / 2) + +theorem recorderInputAtHeight_valid (M : Alternating.Machine) + (hM : M.WellFormed) (z : ℚ) : ValidInput (recorderInputAtHeight M hM z) := + (compiledInput_valid M hM).shiftHeight _ + +@[simp] theorem recorderInputAtHeight_height (M : Alternating.Machine) + (hM : M.WellFormed) (z : ℚ) : ((recorderInputAtHeight M hM z).codingHeight : ℝ) = z := by + simp only [recorderInputAtHeight, Input.shiftHeight_codingHeight, compiledInput, + Rat.cast_add, Rat.cast_sub, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + ring + +@[simp] theorem recorderInputAtHeight_period (M : Alternating.Machine) + (hM : M.WellFormed) (z : ℚ) : ((recorderInputAtHeight M hM z).period : ℝ) = 1 := by + norm_num [recorderInputAtHeight, compiledInput, Input.shiftHeight] + +@[simp] theorem recorderInputAtHeight_halfWidth (M : Alternating.Machine) + (hM : M.WellFormed) (z : ℚ) : + ((recorderInputAtHeight M hM z).h : ℝ) = (bandScale M : ℝ) / 2 := by + simp only [recorderInputAtHeight, Input.shiftHeight, compiledInput, + Rat.cast_div, Rat.cast_ofNat] + +theorem Step.flow_oneAtHeight (z : ℚ) {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (recorderInputAtHeight M hM z).period + (recorderInputAtHeight M hM z).realizingVelocity Φ) : + Φ 1 (atHeight (codedPoint M C) (z : ℝ)) = atHeight (codedPoint M D) (z : ℝ) := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hd := recorderInputAtHeight_valid M hM z + have hmem : geometricInstruction M hM b ∈ (recorderInputAtHeight M hM z).instructions := + geometricInstruction_mem M hM b + have hB := radixBase_gt_one M + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hc : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains hB hdigits (bandScale_pos M).le (stateOffset M) b C rfl rfl rfl + have htube := sourceTube_contains (geometricInstruction M hM b) + (recorderInputAtHeight M hM z).codingHeight (δ := ((recorderInputAtHeight M hM z).tubeRadius : ℝ)) + (by exact_mod_cast tubeRadius_pos hd) + (Set.mem_image_of_mem (fun X => atHeight X (recorderInputAtHeight M hM z).codingHeight) hc) + have he := realizingVelocity_periodMap hd hΦ hmem htube + have ha := branchInstruction_step hB hdigits (bandScale M) (stateOffset M) b C rfl rfl rfl + simp only [atHeight_horizontal] at he + change Φ 1 (atHeight (codedPoint M C) (recorderInputAtHeight M hM z).codingHeight) = + atHeight ((geometricInstruction M hM b).affine (codedPoint M C)) + (recorderInputAtHeight M hM z).codingHeight at he + have ha' : (geometricInstruction M hM b).affine (codedPoint M C) = + codedPoint M ⟨q, C.head + d, Function.update C.tape C.head a⟩ := ha + rw [ha'] at he + simpa only [recorderInputAtHeight_height] using he + +theorem Steps.flow_natAtHeight (z : ℚ) {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} {n : ℕ} + (h : Steps (finiteMachine M hM) n C D) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (recorderInputAtHeight M hM z).period + (recorderInputAtHeight M hM z).realizingVelocity Φ) : + Φ n (atHeight (codedPoint M C) (z : ℝ)) = atHeight (codedPoint M D) (z : ℝ) := by + induction h with + | zero C => simpa only [Nat.cast_zero] using hΦ.initial (atHeight (codedPoint M C) (z : ℝ)) + | @next n C D E h hs ih => + rw [Nat.cast_add, Nat.cast_one, add_comm, + hΦ.nat_shift (realizingVelocity_time_periodic _) n 1, ih] + exact hs.flow_oneAtHeight z hΦ + +theorem Step.flow_safeAtHeight (z : ℚ) {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + (hc : recorderHalting M C.control = false) (hd : recorderHalting M D.control = false) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (recorderInputAtHeight M hM z).period + (recorderInputAtHeight M hM z).realizingVelocity Φ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + 0 < Φ t (atHeight (codedPoint M C) (z : ℝ)) 0 ∧ + Φ t (atHeight (codedPoint M C) (z : ℝ)) 0 < 1 / 2 := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hv := recorderInputAtHeight_valid M hM z + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hx : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains (radixBase_gt_one M) hdigits (bandScale_pos M).le + (stateOffset M) b C rfl rfl rfl + have hs := stateBox_nonterminal_x M b.source hc (geometricInstruction_source_unit M hM b) + (center_mem (geometricInstruction_source_positive M hM b)) + have hq := stateBox_nonterminal_x M b.target hd (geometricInstruction_target_unit M hM b) + (center_mem (geometricInstruction_target_positive M hM b)) + have hlow := materialFlow_first_ge_of_mem hv hΦ (geometricInstruction_mem M hM b) hx + (a := 1 / 4 - (bandScale M : ℝ) / 2) hs.1 hq.1 ht + have hhigh := materialFlow_first_le_of_mem hv hΦ (geometricInstruction_mem M hM b) hx + (a := 1 / 4 + (bandScale M : ℝ) / 2) hs.2 hq.2 ht + have hκ : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + simp only [recorderInputAtHeight_height, recorderInputAtHeight_halfWidth] at hlow hhigh + constructor <;> linarith + +theorem recorder_flow_halting_iff_atHeight (z : ℚ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (upper : ℝ) (hupper : (7 / 8 : ℝ) ≤ upper) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (recorderInputAtHeight I.1 hI.1 z).period + (recorderInputAtHeight I.1 hI.1 z).realizingVelocity Φ) : + (∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < Φ t + (atHeight (codedPoint I.1 (finiteInitializedRecorder I hI)) (z : ℝ)) 0 ∧ + Φ t (atHeight (codedPoint I.1 (finiteInitializedRecorder I hI)) (z : ℝ)) 0 < upper) ↔ + Alternating.Halts I := by + constructor + · rintro ⟨t, ht, hx, _⟩ + by_contra hno + have hn (n : ℕ) : (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt I hI n) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) n).state.val = (Alternating.configurationAt I n).state at he + change I.1.isHalting _ = false + rw [he] + cases hh : I.1.isHalting (Alternating.configurationAt I n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + let C₀ := finiteInitializedRecorder I hI + have hs (n : ℕ) : Steps (finiteMachine I.1 hI.1) n C₀ + (run (finiteMachine I.1 hI.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine I.1 hI.1) + (run (finiteMachine I.1 hI.1) C₀ n) (run (finiteMachine I.1 hI.1) C₀ (n + 1)) := + run_step_of_nonhalting (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting I.1 + (run (finiteMachine I.1 hI.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State I.1) (Alphabet I.1)) : + haltingControl (finiteMachine I.1 hI.1) q = recorderHalting I.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hsafe := (hnext n).flow_safeAtHeight z (hcontrol n) (hcontrol (n + 1)) hΦ + (show t - (n : ℝ) ∈ Icc (0 : ℝ) 1 by constructor <;> linarith) + have he := (hs n).flow_natAtHeight z hΦ + have htime : t = (t - (n : ℝ)) + (n : ℝ) := by ring + rw [htime, hΦ.nat_shift (realizingVelocity_time_periodic _) n, he] at hx + linarith [hsafe.2] + · intro hhalt + obtain ⟨n, C, q, hs, hc, hh⟩ := (finite_recorder_halts_iff I hI).mpr hhalt + have he := hs.flow_natAtHeight z hΦ + have hob := (codedPoint_observation_iff I.1 C).mpr + (by simpa only [hc, recorderHalting] using hh) + refine ⟨n, Nat.cast_nonneg _, ?_⟩ + rw [he] + exact ⟨hob.1, hob.2.trans_le hupper⟩ + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderCoordinates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c668820f1fb47ef815ce77718e435649a07e233 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderCoordinates.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Branches +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ConfigurationTapes +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InstructionRectangles + +namespace OAI + +/-! The actual recorder step agrees with its filled-rectangle affine instruction. -/ + +noncomputable section + +namespace ForcedComputation.Recorder + +open Radix ShearFlows + +variable {Q A : Type*} + +def headMoveOfInt (d : ℤ) : HeadMove := + if d = -1 then .left else if d = 0 then .stay else .right + +theorem LocalStep.displacement_bounds {M : Machine Q A} {q q' : Control Q A} + {s s' : Symbol Q A} {d : ℤ} (h : LocalStep M q s q' s' d) : -1 ≤ d ∧ d ≤ 1 := by + cases h <;> first | exact M.move_bound _ _ | norm_num + +theorem tape_coordinates_update {B : ℝ} {digit : Symbol Q A → ℝ} + (hB : 1 < B) (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) + (C : Configuration Q A) (q' : Control Q A) (b : Symbol Q A) + (d : ℤ) (hlo : -1 ≤ d) (hhi : d ≤ 1) : + coordinates B digit (tapeAt ⟨q', C.head + d, Function.update C.tape C.head b⟩) = + normalizedMove B (digit (C.tape (C.head - 1))) (digit (C.tape C.head)) (digit b) + (headMoveOfInt d) (coordinates B digit (tapeAt C)) := by + have hc : d = -1 ∨ d = 0 ∨ d = 1 := by omega + rcases hc with rfl | rfl | rfl + · have h := congrArg (coordinates B digit) (tapeAt_left C q' b) + rw [coordinates_left hB hd] at h + simpa only [headMoveOfInt, ite_eq_left, normalizedMove, tapeAt, + Nat.cast_zero, zero_add, add_zero, sub_eq_add_neg] using h + · have h := congrArg (coordinates B digit) (tapeAt_stay C q' b) + rw [coordinates_stay hB hd] at h + simpa only [headMoveOfInt, show (0 : ℤ) ≠ -1 by norm_num, ite_false, ite_eq_left, + normalizedMove, tapeAt, Nat.cast_zero, add_zero] using h + · have h := congrArg (coordinates B digit) (tapeAt_right C q' b) + rw [coordinates_right hB hd] at h + simpa only [headMoveOfInt, show (1 : ℤ) ≠ -1 by norm_num, + show (1 : ℤ) ≠ 0 by norm_num, ite_false, normalizedMove, tapeAt, + Nat.cast_zero, add_zero] using h + +def configurationPoint (κ B : ℚ) (digit : Symbol Q A → ℚ) + (offset : Control Q A → Fin 2 → ℚ) (C : Configuration Q A) : Plane := + embedPlane κ (offset C.control) + (planeOfPair (coordinates B (fun a => (digit a : ℝ)) (tapeAt C))) + +def branchInstruction {M : Machine Q A} (κ B : ℚ) (digit : Symbol Q A → ℚ) + (offset : Control Q A → Fin 2 → ℚ) (b : Branch M) : Instruction := + scaledInstruction κ (offset b.source) (offset b.target) + (radixInstruction B (digit b.left) (digit b.read) (digit b.write) + (headMoveOfInt b.displacement)) + +theorem embedPlane_mem_scaledBox {κ : ℚ} (hκ : 0 ≤ κ) + (offset : Fin 2 → ℚ) {R : RationalBox 2} {x : Plane} (hx : x ∈ R.carrier) : + embedPlane κ offset x ∈ (scaledBox κ offset R).carrier := by + have hκr : (0 : ℝ) ≤ κ := by exact_mod_cast hκ + intro j + change ((offset j + κ * R.lower j : ℚ) : ℝ) ≤ + (offset j : ℝ) + (κ : ℝ) * x j ∧ + (offset j : ℝ) + (κ : ℝ) * x j ≤ ((offset j + κ * R.upper j : ℚ) : ℝ) + simp only [Rat.cast_add, Rat.cast_mul] + exact ⟨add_le_add (le_refl _) (mul_le_mul_of_nonneg_left (hx j).1 hκr), + add_le_add (le_refl _) (mul_le_mul_of_nonneg_left (hx j).2 hκr)⟩ + +theorem branchInstruction_contains {M : Machine Q A} {B : ℚ} (hB : 1 < B) + {digit : Symbol Q A → ℚ} (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) + {κ : ℚ} (hκ : 0 ≤ κ) (offset : Control Q A → Fin 2 → ℚ) (b : Branch M) + (C : Configuration Q A) (hs : C.control = b.source) + (hr : C.tape C.head = b.read) (hl : C.tape (C.head - 1) = b.left) : + configurationPoint κ B digit offset C ∈ (branchInstruction κ B digit offset b).source.carrier := by + have hBr : (1 : ℝ) < B := by exact_mod_cast hB + have hdr : ∀ a, (0 : ℝ) ≤ digit a ∧ (digit a : ℝ) ≤ (B : ℝ) - 1 := by + intro a + constructor + · exact_mod_cast (hd a).1 + · exact_mod_cast (hd a).2 + have hx := encode_in_first_cylinder hBr hdr (tapeAt C).1 + have hy := encode_in_first_cylinder hBr hdr (tapeAt C).2 + simp only [tapeAt, Nat.cast_zero, zero_add, add_zero, hl, hr] at hx hy + unfold configurationPoint branchInstruction + rw [hs] + apply embedPlane_mem_scaledBox hκ + intro j + fin_cases j + · dsimp [radixInstruction, sourceBox, planeOfPair, coordinates] + simpa only [Set.mem_Icc, tapeAt, Rat.cast_div, Rat.cast_add, Rat.cast_one] using hx + · dsimp [radixInstruction, sourceBox, planeOfPair, coordinates] + simpa only [Set.mem_Icc, tapeAt, Rat.cast_div, Rat.cast_add, Rat.cast_one] using hy + +theorem branchInstruction_step {M : Machine Q A} {B : ℚ} (hB : 1 < B) + {digit : Symbol Q A → ℚ} (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) + (κ : ℚ) (offset : Control Q A → Fin 2 → ℚ) (b : Branch M) + (C : Configuration Q A) (hs : C.control = b.source) + (hr : C.tape C.head = b.read) (hl : C.tape (C.head - 1) = b.left) : + (branchInstruction κ B digit offset b).affine (configurationPoint κ B digit offset C) = + configurationPoint κ B digit offset + ⟨b.target, C.head + b.displacement, Function.update C.tape C.head b.write⟩ := by + have hBr : (1 : ℝ) < B := by exact_mod_cast hB + have hdr : ∀ a, (0 : ℝ) ≤ digit a ∧ (digit a : ℝ) ≤ (B : ℝ) - 1 := by + intro a + constructor + · exact_mod_cast (hd a).1 + · exact_mod_cast (hd a).2 + have hc := tape_coordinates_update hBr hdr C b.target b.write b.displacement + b.rule.displacement_bounds.1 b.rule.displacement_bounds.2 + simp only [hr, hl] at hc + unfold branchInstruction configurationPoint + rw [hs, scaledInstruction_action, radixInstruction_action (by linarith : (0 : ℚ) < B), hc] + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderExecution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderExecution.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d8a4de2ec1ee45ebde5977aa46bb0535f99095f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderExecution.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderRun + +namespace OAI + +/-! The executable recorder orbit and its halting equivalence. -/ + +namespace ForcedComputation.Recorder + +variable {Q A : Type*} [DecidableEq Q] [DecidableEq A] + +def nextConfiguration (M : Machine Q A) (C : Configuration Q A) : Configuration Q A := + match evalLocal M C.control (C.tape C.head) with + | none => C + | some (q, a, d) => ⟨q, C.head + d, Function.update C.tape C.head a⟩ + +def run (M : Machine Q A) (C : Configuration Q A) (n : ℕ) : Configuration Q A := + (nextConfiguration M)^[n] C + +theorem run_zero (M : Machine Q A) (C : Configuration Q A) : run M C 0 = C := rfl + +theorem run_succ (M : Machine Q A) (C : Configuration Q A) (n : ℕ) : + run M C (n + 1) = nextConfiguration M (run M C n) := + Function.iterate_succ_apply' _ _ _ + +theorem Step.next_eq {M : Machine Q A} {C D : Configuration Q A} (h : Step M C D) : + nextConfiguration M C = D := by + obtain ⟨q, a, d, hl, rfl⟩ := h + simp only [nextConfiguration, hl.eval] + +theorem Steps.run_eq {M : Machine Q A} {C D : Configuration Q A} {n : ℕ} + (h : Steps M n C D) : run M C n = D := by + induction h with + | zero => rfl + | next h hs ih => rw [run_succ, ih, hs.next_eq] + +theorem reachable_has_successor_of_nonhalting (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) + (hn : ∀ n, M.halting (workAt M q w n).state = false) + {m : ℕ} {C : Configuration Q A} (hC : Steps M m (checkpointAt M q w g₀ 0) C) : + ∃ D, Step M C D := by + obtain ⟨k, hk, hlong⟩ := simulate_prefix_length M q w g₀ hg₀ (m + 1) + (fun i _ => hn i) + exact hC.prefix_has_successor hlong (by omega) + +theorem run_steps_of_nonhalting (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) + (hn : ∀ n, M.halting (workAt M q w n).state = false) (n : ℕ) : + Steps M n (checkpointAt M q w g₀ 0) (run M (checkpointAt M q w g₀ 0) n) := by + induction n with + | zero => exact Steps.zero _ + | succ n ih => + obtain ⟨D, hD⟩ := reachable_has_successor_of_nonhalting M q w g₀ hg₀ hn ih + rw [run_succ, hD.next_eq] + exact Steps.next ih hD + +theorem run_step_of_nonhalting (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) + (hn : ∀ n, M.halting (workAt M q w n).state = false) (n : ℕ) : + Step M (run M (checkpointAt M q w g₀ 0) n) + (run M (checkpointAt M q w g₀ 0) (n + 1)) := by + obtain ⟨D, hD⟩ := reachable_has_successor_of_nonhalting M q w g₀ hg₀ hn + (run_steps_of_nonhalting M q w g₀ hg₀ hn n) + rw [run_succ, hD.next_eq] + exact hD + +theorem run_halting_iff (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) : + (∃ n, haltingControl M (run M (checkpointAt M q w g₀ 0) n).control = true) ↔ + ∃ n, M.halting (workAt M q w n).state = true := by + constructor + · rintro ⟨n, hterminal⟩ + by_contra hnone + have hn (k : ℕ) : M.halting (workAt M q w k).state = false := by + cases he : M.halting (workAt M q w k).state with + | false => rfl + | true => exact False.elim (hnone ⟨k, he⟩) + obtain ⟨_, _, _, hl, _⟩ := run_step_of_nonhalting M q w g₀ hg₀ hn n + have hf := hl.source_nonhalting + rw [hterminal] at hf + cases hf + · intro hhalt + obtain ⟨n, C, q', hC, hq', hh⟩ := + (halting_checkpoint_iff M q w g₀ hg₀).mpr hhalt + refine ⟨n, ?_⟩ + rw [hC.run_eq, hq'] + exact hh + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderFlow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c7b89c7e658a0fe679f96e9530be78643bd931f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderFlow.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteGeometry +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodicFlow +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Main + +namespace OAI + +/-! The finite recorder's actual tape configurations are the integer-time +positions of the smooth periodic shear flow. -/ + +noncomputable section + +namespace ForcedComputation.Recorder + +open ShearFlows Radix + +def codedPoint (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) : Plane := + configurationPoint (bandScale M) (radixBase M) (radixDigit M) (stateOffset M) C + +theorem Step.flow_one {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (compiledInput M hM).period + (compiledInput M hM).realizingVelocity Φ) : + Φ 1 (atHeight (codedPoint M C) (1 / 2)) = atHeight (codedPoint M D) (1 / 2) := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hd := compiledInput_valid M hM + have hmem := geometricInstruction_mem M hM b + have hB := radixBase_gt_one M + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hc : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains hB hdigits (bandScale_pos M).le (stateOffset M) b C rfl rfl rfl + have htube := sourceTube_contains (geometricInstruction M hM b) + (compiledInput M hM).codingHeight (δ := ((compiledInput M hM).tubeRadius : ℝ)) + (by exact_mod_cast tubeRadius_pos hd) + (Set.mem_image_of_mem (fun X => atHeight X (compiledInput M hM).codingHeight) hc) + have he := realizingVelocity_periodMap hd hΦ hmem htube + have ha := branchInstruction_step hB hdigits (bandScale M) (stateOffset M) b C rfl rfl rfl + simp only [atHeight_horizontal] at he + change Φ 1 (atHeight (codedPoint M C) (compiledInput M hM).codingHeight) = + atHeight ((geometricInstruction M hM b).affine (codedPoint M C)) + (compiledInput M hM).codingHeight at he + have ha' : (geometricInstruction M hM b).affine (codedPoint M C) = + codedPoint M ⟨q, C.head + d, Function.update C.tape C.head a⟩ := ha + rw [ha'] at he + simpa only [compiledInput, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using he + +theorem Steps.flow_nat {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} {n : ℕ} + (h : Steps (finiteMachine M hM) n C D) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (compiledInput M hM).period + (compiledInput M hM).realizingVelocity Φ) : + Φ n (atHeight (codedPoint M C) (1 / 2)) = atHeight (codedPoint M D) (1 / 2) := by + induction h with + | zero C => simpa only [Nat.cast_zero] using hΦ.initial (atHeight (codedPoint M C) (1 / 2)) + | @next n C D E h hs ih => + rw [Nat.cast_add, Nat.cast_one, add_comm, + hΦ.nat_shift (realizingVelocity_time_periodic _) n 1, ih] + exact hs.flow_one hΦ + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderInputEncoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderInputEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d2ffcf526cb5c5726744af9513a89d6ee36dd11 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderInputEncoding.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.FiniteRecorder +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ConfigurationTapes +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RationalEncoding + +namespace OAI + +/-! The initialized recorder point is computable from a finite rational word. -/ + +namespace ForcedComputation.Radix + +theorem prependWord_ofFn_eq {A : Type*} (u : ℕ → A) (blank : A) (N : ℕ) + (ht : ∀ n, N ≤ n → u n = blank) : + prependWord (List.ofFn (fun i : Fin N => u i)) (fun _ => blank) = u := by + induction N generalizing u with + | zero => + funext n + simpa only [List.ofFn_zero, prependWord] using (ht n (Nat.zero_le n)).symm + | succ N ih => + rw [List.ofFn_succ] + funext n + cases n with + | zero => rfl + | succ n => + change prependWord (List.ofFn (fun i : Fin N => u (i.val + 1))) (fun _ => blank) n = _ + exact congrFun (ih (fun k => u (k + 1)) (fun k hk => ht (k + 1) (by omega))) n + +end ForcedComputation.Radix + +namespace ForcedComputation.Recorder + +open Radix + +def recorderBlank (M : Alternating.Machine) : Symbol (State M) (Alphabet M) := + (⟨0, by simp [Alternating.Machine.symbolCount]⟩, History.empty, false) + +def initialWordLength (I : Alternating.MachineInput) : ℕ := max I.2.length 3 + +def initialRightWord (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + List (Symbol (State I.1) (Alphabet I.1)) := + List.ofFn fun i : Fin (initialWordLength I) => (finiteInitializedRecorder I hI).tape i.val + +theorem initialTape_blank (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {j : ℤ} (hj : j < 0 ∨ (initialWordLength I : ℤ) ≤ j) : + (finiteInitializedRecorder I hI).tape j = recorderBlank I.1 := by + have hjdata : j < 0 ∨ (I.2.length : ℤ) ≤ j := by + rcases hj with hj | hj + · exact Or.inl hj + · right + have hlen : I.2.length ≤ initialWordLength I := le_max_left _ _ + exact (by exact_mod_cast hlen : (I.2.length : ℤ) ≤ initialWordLength I).trans hj + have hjfront : j ≠ 2 := by + have hlen : 3 ≤ initialWordLength I := le_max_right _ _ + rcases hj with hj | hj <;> omega + have hd := Alternating.initialConfiguration_tape_outside I.2 hjdata + change (initialAlphabet I hI j, historyRun 2 + (workRecord (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI)) 0 j, false) = _ + apply Prod.ext + · apply Fin.ext + exact hd + · simp [historyRun, recorderBlank, Function.update_of_ne hjfront] + +theorem initialTape_left (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (tapeAt (finiteInitializedRecorder I hI)).1 = fun _ => recorderBlank I.1 := by + funext n + apply initialTape_blank I hI + left + change (0 : ℤ) - ((n : ℤ) + 1) < 0 + omega + +theorem initialTape_right (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (tapeAt (finiteInitializedRecorder I hI)).2 = + prependWord (initialRightWord I hI) (fun _ => recorderBlank I.1) := by + symm + have hhead : (finiteInitializedRecorder I hI).head = 0 := rfl + change prependWord (List.ofFn (fun i : Fin (initialWordLength I) => + (finiteInitializedRecorder I hI).tape i.val)) (fun _ => recorderBlank I.1) = + fun n : ℕ => (finiteInitializedRecorder I hI).tape + ((finiteInitializedRecorder I hI).head + (n : ℤ)) + simp only [hhead, zero_add] + apply prependWord_ofFn_eq (fun n : ℕ => (finiteInitializedRecorder I hI).tape n) + (recorderBlank I.1) (initialWordLength I) + intro n hn + apply initialTape_blank I hI + right + exact_mod_cast hn + +theorem initial_coordinates_rational (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + {B : ℚ} (hB : 1 < B) {digit : Symbol (State I.1) (Alphabet I.1) → ℚ} + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) : + coordinates B (fun a => (digit a : ℝ)) (tapeAt (finiteInitializedRecorder I hI)) = + (((digit (recorderBlank I.1) / (B - 1) : ℚ) : ℝ), + ((finiteCode B digit (initialRightWord I hI) (recorderBlank I.1) : ℚ) : ℝ)) := by + have hBr : (1 : ℝ) < B := by exact_mod_cast hB + have hdr : ∀ a, (0 : ℝ) ≤ digit a ∧ (digit a : ℝ) ≤ (B : ℝ) - 1 := by + intro a + constructor + · exact_mod_cast (hd a).1 + · exact_mod_cast (hd a).2 + apply Prod.ext + · change encode B (fun a => (digit a : ℝ)) (tapeAt (finiteInitializedRecorder I hI)).1 = _ + rw [initialTape_left, encode_const hBr hdr] + simp + · change encode B (fun a => (digit a : ℝ)) (tapeAt (finiteInitializedRecorder I hI)).2 = _ + rw [initialTape_right] + exact finiteCode_spec hB hd _ _ + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderLoader.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderLoader.lean new file mode 100644 index 0000000000000000000000000000000000000000..703d535992fcaaaf50c5ea4f1689bbd288501850 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderLoader.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderInputEncoding +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderObservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedObservation + +namespace OAI + +/-! The finite input determines the rational endpoint of the one-period loader. -/ + +namespace ForcedComputation.Recorder +open Radix ShearFlows + +def initialCoordinatesQ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : ℚ × ℚ := + (radixDigit I.1 (recorderBlank I.1) / (radixBase I.1 - 1), + finiteCode (radixBase I.1) (radixDigit I.1) (initialRightWord I hI) (recorderBlank I.1)) + +def initialPointQ (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Fin 2 → ℚ := + letI := ShearFlows.neZeroTwo + fun j => stateOffset I.1 (finiteInitializedRecorder I hI).control j + bandScale I.1 * + (if j = 0 then (initialCoordinatesQ I hI).1 else (initialCoordinatesQ I hI).2) + +theorem initialPointQ_spec (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (fun j => (initialPointQ I hI j : ℝ)) = + codedPoint I.1 (finiteInitializedRecorder I hI) := by + have hd : ∀ a, 0 ≤ radixDigit I.1 a ∧ radixDigit I.1 a ≤ radixBase I.1 - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat I.1 a).1, by linarith [(radixDigit_bounds_rat I.1 a).2]⟩ + have he := initial_coordinates_rational I hI (radixBase_gt_one I.1) hd + funext j + fin_cases j <;> + norm_num [initialPointQ, initialCoordinatesQ, codedPoint, configurationPoint, + embedPlane, planeOfPair, he] + +private theorem coordinates_unit (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) : + (coordinates (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C)).1 ∈ Set.Icc 0 1 ∧ + (coordinates (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C)).2 ∈ Set.Icc 0 1 := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hd : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + exact ⟨encode_mem_unit hB hd _, encode_mem_unit hB hd _⟩ + +theorem codedPoint_in_loader_chart (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) (j : Fin 2) : + 1 / 8 ≤ codedPoint M C j ∧ codedPoint M C j ≤ 7 / 8 := by + obtain ⟨hx, hy⟩ := coordinates_unit M C + have hκ : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hκ' : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hcenter : (3 / 8 : ℝ) < centerY M C.control ∧ + (centerY M C.control : ℝ) < 7 / 16 := by + have h := centerY_bounds M C.control + exact ⟨by simpa only [Rat.cast_div, Rat.cast_ofNat] using + (Rat.cast_lt (K := ℝ)).mpr h.1, + by simpa only [Rat.cast_div, Rat.cast_ofNat] using (Rat.cast_lt (K := ℝ)).mpr h.2⟩ + fin_cases j + · change (1 / 8 : ℝ) ≤ codedPoint M C 0 ∧ codedPoint M C 0 ≤ 7 / 8 + rw [codedPoint_first] + change 0 ≤ encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 ∧ + encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 ≤ 1 at hx + cases ht : recorderHalting M C.control <;> simp only [Bool.false_eq_true, ite_false, ite_true] + all_goals constructor <;> nlinarith [hx.1, hx.2] + · change (1 / 8 : ℝ) ≤ (stateOffset M C.control 1 : ℝ) + (bandScale M : ℝ) * + (coordinates (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C)).2 ∧ + (stateOffset M C.control 1 : ℝ) + (bandScale M : ℝ) * + (coordinates (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C)).2 ≤ 7 / 8 + simp only [stateOffset, Matrix.cons_val_one, Matrix.cons_val_zero, Rat.cast_sub, + Rat.cast_div, Rat.cast_ofNat] + constructor <;> nlinarith [hy.1, hy.2, hcenter.1, hcenter.2] + +theorem initialPointQ_bounds (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) + (j : Fin 2) : 1 / 8 ≤ initialPointQ I hI j ∧ initialPointQ I hI j ≤ 7 / 8 := by + have h := codedPoint_in_loader_chart I.1 (finiteInitializedRecorder I hI) j + rw [← initialPointQ_spec I hI] at h + exact ⟨(Rat.cast_le (K := ℝ)).mp (by + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h.1), + (Rat.cast_le (K := ℝ)).mp (by + simpa only [Rat.cast_div, Rat.cast_ofNat] using h.2)⟩ + +def recorderLoader (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : Input := + loaderInput fixedStart (initialPointQ I hI) (1 / 2) + +theorem recorderLoader_valid (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + ValidInput (recorderLoader I hI) := + loaderInput_valid _ _ _ (by intro j; fin_cases j <;> norm_num [fixedStart]) + (initialPointQ_bounds I hI) (by norm_num) + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderMachine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderMachine.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e3453d75b5b6133c8ac9be26b08c38a2b947b08 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderMachine.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderRun +import OAI.MathematicalPhysics.NavierStokes.Material.Machines + +namespace OAI + +/-! The seven-row recorder applied to finite machine tables. -/ + +namespace ForcedComputation.Recorder + +def ofMachine (M : Alternating.Machine) : Machine ℕ ℕ where + halting := M.isHalting + next := fun q a => (M.normalizedInstruction q a).1 + write := fun q a => (M.normalizedInstruction q a).2.1 + move := fun q a => ((M.normalizedInstruction q a).2.2.val : ℤ) - 1 + move_bound := by + intro q a + have h := (M.normalizedInstruction q a).2.2.isLt + constructor <;> omega + +def originalConfiguration (C : Alternating.Configuration) : WorkConfiguration ℕ ℕ := + ⟨C.state, C.head, C.tape⟩ + +theorem originalConfiguration_step (M : Alternating.Machine) (C : Alternating.Configuration) : + originalConfiguration (M.step C) = workNext (ofMachine M) (originalConfiguration C) := by + rw [M.step_eq_normalized] + simp only [originalConfiguration, Alternating.applyInstruction, workNext, ofMachine, + sub_eq_add_neg, add_assoc] + +theorem workAt_ofMachine (I : Alternating.MachineInput) (n : ℕ) : + workAt (ofMachine I.1) 0 (Alternating.initialConfiguration I.2).tape n = + originalConfiguration (Alternating.configurationAt I n) := by + induction n with + | zero => rfl + | succ n ih => + rw [workAt_succ, Alternating.configurationAt_succ, originalConfiguration_step, ih] + +def initializedRecorder (I : Alternating.MachineInput) : Configuration ℕ ℕ := + checkpointAt (ofMachine I.1) 0 (Alternating.initialConfiguration I.2).tape 2 0 + +/-- The recorder's finite initialized run has exactly the original machine's +halting event, including a machine initially in a halting state. -/ +theorem recorder_halts_iff (I : Alternating.MachineInput) : + (∃ m C q, Steps (ofMachine I.1) m (initializedRecorder I) C ∧ + C.control = Control.checkpoint q ∧ I.1.isHalting q = true) ↔ Alternating.Halts I := by + change (∃ m C q, Steps (ofMachine I.1) m + (checkpointAt (ofMachine I.1) 0 (Alternating.initialConfiguration I.2).tape 2 0) C ∧ + C.control = Control.checkpoint q ∧ (ofMachine I.1).halting q = true) ↔ _ + rw [halting_checkpoint_iff _ _ _ 2 (by norm_num)] + change (∃ n, I.1.isHalting + (workAt (ofMachine I.1) 0 (Alternating.initialConfiguration I.2).tape n).state = true) ↔ _ + simp only [workAt_ofMachine, originalConfiguration, Alternating.Halts] + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..abe4f6f419a646e3c4de114c150850f749ba1a9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderObservation.lean @@ -0,0 +1,151 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderFlow +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderExecution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ObservationByInstruction + +namespace OAI + +/-! Continuous-time observation of the genuine recorder orbit. Safe steps remain +inside the nonterminal strip throughout all seven shear stages. -/ + +noncomputable section +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +theorem codedPoint_first (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) : + codedPoint M C 0 = (if recorderHalting M C.control then (3 / 4 : ℝ) else 1 / 4) + + (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) := by + cases hh : recorderHalting M C.control <;> + simp only [codedPoint, configurationPoint, embedPlane, stateOffset, planeOfPair, coordinates, + Matrix.cons_val_zero, hh, Bool.false_eq_true, ite_false, ite_true, + Rat.cast_sub, Rat.cast_div, Rat.cast_ofNat] <;> ring + + +theorem codedPoint_observation_iff (M : Alternating.Machine) + (C : Configuration (State M) (Alphabet M)) : + (1 / 2 < codedPoint M C 0 ∧ codedPoint M C 0 < 7 / 8) ↔ + recorderHalting M C.control = true := by + have hB : (1 : ℝ) < radixBase M := by exact_mod_cast radixBase_gt_one M + have hdigits : ∀ a, (0 : ℝ) ≤ radixDigit M a ∧ + (radixDigit M a : ℝ) ≤ (radixBase M : ℝ) - 1 := by + intro a + exact ⟨(radixDigit_bounds M a).1, by linarith [(radixDigit_bounds M a).2]⟩ + have he := encode_mem_unit hB hdigits (tapeAt C).1 + have hκ : (0 : ℝ) < bandScale M := by exact_mod_cast bandScale_pos M + have hκ' : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + have hl : -(bandScale M : ℝ) / 2 ≤ (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) := by + nlinarith [he.1] + have hu : (bandScale M : ℝ) * + (encode (radixBase M) (fun a => (radixDigit M a : ℝ)) (tapeAt C).1 - 1 / 2) ≤ + (bandScale M : ℝ) / 2 := by nlinarith [he.2] + rw [codedPoint_first] + cases hh : recorderHalting M C.control <;> simp only [Bool.false_eq_true, ite_false, ite_true] + · constructor + · intro h + linarith [h.1] + · exact False.elim + · constructor + · intro _ + trivial + · intro _ + constructor <;> linarith + +theorem Step.flow_safe {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + (hc : recorderHalting M C.control = false) (hd : recorderHalting M D.control = false) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (compiledInput M hM).period + (compiledInput M hM).realizingVelocity Φ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + 0 < Φ t (atHeight (codedPoint M C) (1 / 2)) 0 ∧ + Φ t (atHeight (codedPoint M C) (1 / 2)) 0 < 1 / 2 := by + obtain ⟨q, a, d, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, d, C.tape (C.head - 1), hl⟩ + have hv := compiledInput_valid M hM + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hx : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains (radixBase_gt_one M) hdigits (bandScale_pos M).le + (stateOffset M) b C rfl rfl rfl + have hs := stateBox_nonterminal_x M b.source hc (geometricInstruction_source_unit M hM b) + (center_mem (geometricInstruction_source_positive M hM b)) + have hq := stateBox_nonterminal_x M b.target hd (geometricInstruction_target_unit M hM b) + (center_mem (geometricInstruction_target_positive M hM b)) + have hlow := materialFlow_first_ge_of_mem hv hΦ (geometricInstruction_mem M hM b) hx + (a := 1 / 4 - (bandScale M : ℝ) / 2) hs.1 hq.1 ht + have hhigh := materialFlow_first_le_of_mem hv hΦ (geometricInstruction_mem M hM b) hx + (a := 1 / 4 + (bandScale M : ℝ) / 2) hs.2 hq.2 ht + have hκ : (bandScale M : ℝ) ≤ 1 / 64 := by + have h := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using h + simp only [compiledInput, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at hlow hhigh + constructor <;> linarith + +theorem recorder_flow_halting_iff (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (upper : ℝ) (hupper : (7 / 8 : ℝ) ≤ upper) + {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow (compiledInput I.1 hI.1).period + (compiledInput I.1 hI.1).realizingVelocity Φ) : + (∃ t : ℝ, 0 ≤ t ∧ 1 / 2 < Φ t + (atHeight (codedPoint I.1 (finiteInitializedRecorder I hI)) (1 / 2)) 0 ∧ + Φ t (atHeight (codedPoint I.1 (finiteInitializedRecorder I hI)) (1 / 2)) 0 < upper) ↔ + Alternating.Halts I := by + constructor + · rintro ⟨t, ht, hx, _⟩ + by_contra hno + have hn (n : ℕ) : (finiteMachine I.1 hI.1).halting + (workAt (finiteMachine I.1 hI.1) (initialState I.1) (initialAlphabet I hI) n).state = false := by + have he := congrArg WorkConfiguration.state (finite_workAt I hI n) + change (workAt (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) n).state.val = (Alternating.configurationAt I n).state at he + change I.1.isHalting _ = false + rw [he] + cases hh : I.1.isHalting (Alternating.configurationAt I n).state with + | false => rfl + | true => exact False.elim (hno ⟨n, hh⟩) + let C₀ := finiteInitializedRecorder I hI + have hs (n : ℕ) : Steps (finiteMachine I.1 hI.1) n C₀ + (run (finiteMachine I.1 hI.1) C₀ n) := + run_steps_of_nonhalting _ _ _ 2 (by norm_num) hn n + have hnext (n : ℕ) : Step (finiteMachine I.1 hI.1) + (run (finiteMachine I.1 hI.1) C₀ n) (run (finiteMachine I.1 hI.1) C₀ (n + 1)) := + run_step_of_nonhalting (finiteMachine I.1 hI.1) (initialState I.1) + (initialAlphabet I hI) 2 (by norm_num) hn n + have hcontrol (n : ℕ) : recorderHalting I.1 + (run (finiteMachine I.1 hI.1) C₀ n).control = false := by + obtain ⟨_, _, _, hr, _⟩ := hnext n + have hh := hr.source_nonhalting + have heq (q : Control (State I.1) (Alphabet I.1)) : + haltingControl (finiteMachine I.1 hI.1) q = recorderHalting I.1 q := by + cases q <;> rfl + rwa [heq] at hh + let n : ℕ := ⌊t⌋₊ + have hnt : (n : ℝ) ≤ t := Nat.floor_le ht + have htn : t < (n : ℝ) + 1 := Nat.lt_floor_add_one t + have hsafe := (hnext n).flow_safe (hcontrol n) (hcontrol (n + 1)) hΦ + (show t - (n : ℝ) ∈ Icc (0 : ℝ) 1 by constructor <;> linarith) + have he := (hs n).flow_nat hΦ + have htime : t = (t - (n : ℝ)) + (n : ℝ) := by ring + rw [htime, hΦ.nat_shift (realizingVelocity_time_periodic _) n, he] at hx + linarith [hsafe.2] + · intro hhalt + obtain ⟨n, C, q, hs, hc, hh⟩ := (finite_recorder_halts_iff I hI).mpr hhalt + have he := hs.flow_nat hΦ + have hob := (codedPoint_observation_iff I.1 C).mpr + (by simpa only [hc, recorderHalting] using hh) + refine ⟨n, Nat.cast_nonneg _, ?_⟩ + rw [he] + exact ⟨hob.1, hob.2.trans_le hupper⟩ + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderRun.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderRun.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc246fad64ae6c045fa4e40810a1e0cd2ff9eaaa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderRun.lean @@ -0,0 +1,245 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Recorder + +namespace OAI + +/-! Iterating the seven-row recorder from its actual initialized tape. -/ + +namespace ForcedComputation.Recorder + +variable {Q A : Type*} + +open History Control + +structure WorkConfiguration (Q A : Type*) where + state : Q + head : ℤ + tape : ℤ → A + +def workNext (M : Machine Q A) (C : WorkConfiguration Q A) : WorkConfiguration Q A := + { state := M.next C.state (C.tape C.head) + head := C.head + M.move C.state (C.tape C.head) + tape := Function.update C.tape C.head (M.write C.state (C.tape C.head)) } + +def workAt (M : Machine Q A) (q : Q) (w : ℤ → A) (n : ℕ) : WorkConfiguration Q A := + (workNext M)^[n] ⟨q, 0, w⟩ + +theorem workAt_zero (M : Machine Q A) (q : Q) (w : ℤ → A) : + workAt M q w 0 = ⟨q, 0, w⟩ := rfl + +theorem workAt_succ (M : Machine Q A) (q : Q) (w : ℤ → A) (n : ℕ) : + workAt M q w (n + 1) = workNext M (workAt M q w n) := + Function.iterate_succ_apply' _ _ _ + +theorem workAt_head_bounds (M : Machine Q A) (q : Q) (w : ℤ → A) (n : ℕ) : + -(n : ℤ) ≤ (workAt M q w n).head ∧ (workAt M q w n).head ≤ n := by + induction n with + | zero => simp [workAt_zero] + | succ n ih => + have hm := M.move_bound (workAt M q w n).state + ((workAt M q w n).tape (workAt M q w n).head) + rw [workAt_succ] + dsimp only [workNext] + constructor <;> push_cast <;> omega + +/-- The history track retains every recorded instruction. -/ +def historyRun (g₀ : ℤ) (r : ℕ → Record Q A) : ℕ → ℤ → History Q A := + Nat.rec (Function.update (fun _ => empty) g₀ frontier) + (fun n h => Function.update + (Function.update h (g₀ + (n : ℤ)) (History.record (r n))) + (g₀ + (n : ℤ) + 1) frontier) + +theorem historyRun_frontier (g₀ : ℤ) (r : ℕ → Record Q A) (n : ℕ) : + historyRun g₀ r n (g₀ + (n : ℤ)) = frontier := by + cases n with + | zero => simp [historyRun] + | succ n => simp [historyRun, Nat.cast_add, Nat.cast_one, add_assoc] + +theorem historyRun_before (g₀ : ℤ) (r : ℕ → Record Q A) (n : ℕ) + (j : ℤ) (hj : j < g₀ + (n : ℤ)) : historyRun g₀ r n j ≠ frontier := by + induction n with + | zero => simp [historyRun, Function.update_of_ne (by omega : j ≠ g₀)] + | succ n ih => + have hjnew : j ≠ g₀ + (n : ℤ) + 1 := by omega + simp only [historyRun, Function.update_of_ne hjnew] + by_cases hjold : j = g₀ + (n : ℤ) + · simp [hjold] + · rw [Function.update_of_ne hjold] + exact ih (by omega) + +theorem historyRun_after (g₀ : ℤ) (r : ℕ → Record Q A) (n : ℕ) + (j : ℤ) (hj : g₀ + (n : ℤ) < j) : historyRun g₀ r n j = empty := by + induction n with + | zero => simp [historyRun, Function.update_of_ne (by omega : j ≠ g₀)] + | succ n ih => + have hjnew : j ≠ g₀ + (n : ℤ) + 1 := by omega + have hjold : j ≠ g₀ + (n : ℤ) := by omega + simp only [historyRun, Function.update_of_ne hjnew, Function.update_of_ne hjold] + exact ih (by omega) + +def workRecord (M : Machine Q A) (q : Q) (w : ℤ → A) (n : ℕ) : Record Q A := + ((workAt M q w n).state, (workAt M q w n).tape (workAt M q w n).head) + +def checkpointAt (M : Machine Q A) (q : Q) (w : ℤ → A) (g₀ : ℤ) (n : ℕ) : + Configuration Q A := + ⟨checkpoint (workAt M q w n).state, (workAt M q w n).head, + tracks (workAt M q w n).tape (historyRun g₀ (workRecord M q w) n) (fun _ => false)⟩ + +theorem checkpointAt_zero (M : Machine Q A) (q : Q) (w : ℤ → A) (g₀ : ℤ) : + checkpointAt M q w g₀ 0 = + ⟨checkpoint q, 0, tracks w (Function.update (fun _ => empty) g₀ frontier) + (fun _ => false)⟩ := rfl + +theorem checkpoint_successor (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) (n : ℕ) + (hn : M.halting (workAt M q w n).state = false) : + ∃ m : ℕ, 0 < m ∧ Steps M m + (checkpointAt M q w g₀ n) (checkpointAt M q w g₀ (n + 1)) := by + let C := workAt M q w n + let H := historyRun g₀ (workRecord M q w) n + let h' := C.head + M.move C.state (C.tape C.head) + let g := g₀ + (n : ℤ) + have hhead : C.head ≤ (n : ℤ) := (workAt_head_bounds M q w n).2 + have hmove := (M.move_bound C.state (C.tape C.head)).2 + have hsep : h' < g := by dsimp [h', g]; omega + let k := (g - h' - 1).toNat + have hk : (k : ℤ) = g - h' - 1 := Int.toNat_of_nonneg (by omega) + have hgap : C.head + M.move C.state (C.tape C.head) + (k : ℤ) + 1 = g := by + dsimp [h'] at hk + omega + have hbefore : ∀ j < g, H j ≠ frontier := historyRun_before _ _ n + have hfront : H g = frontier := historyRun_frontier _ _ n + have hempty : H (g + 1) = empty := historyRun_after _ _ n _ (by dsimp [g]; omega) + have hc := checkpoint_cycle M C.state C.tape H C.head k hn + (hbefore _ (by dsimp [g]; omega)) + (by simpa only [hgap] using hbefore) + (by simpa only [hgap] using hfront) + (by simpa only [hgap] using hempty) + refine ⟨2 * k + 6, by omega, ?_⟩ + dsimp only at hc + rw [hgap] at hc + simpa only [checkpointAt, workAt_succ, workNext, historyRun, workRecord, + C, H, g] using hc + +/-- Every finite nonhalting prefix of the original machine has a finite +recorder execution reaching exactly its work configuration. -/ +theorem simulate_prefix (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) (n : ℕ) + (hn : ∀ i < n, M.halting (workAt M q w i).state = false) : + ∃ m : ℕ, Steps M m (checkpointAt M q w g₀ 0) (checkpointAt M q w g₀ n) := by + induction n with + | zero => exact ⟨0, Steps.zero _⟩ + | succ n ih => + obtain ⟨m, hm⟩ := ih (fun i hi => hn i (Nat.lt_succ_of_lt hi)) + obtain ⟨k, _, hk⟩ := checkpoint_successor M q w g₀ hg₀ n (hn n (Nat.lt_succ_self n)) + exact ⟨m + k, hm.trans hk⟩ + +theorem simulate_prefix_length (M : Machine Q A) (q : Q) (w : ℤ → A) + (g₀ : ℤ) (hg₀ : 2 ≤ g₀) (n : ℕ) + (hn : ∀ i < n, M.halting (workAt M q w i).state = false) : + ∃ m : ℕ, n ≤ m ∧ + Steps M m (checkpointAt M q w g₀ 0) (checkpointAt M q w g₀ n) := by + induction n with + | zero => exact ⟨0, le_rfl, Steps.zero _⟩ + | succ n ih => + obtain ⟨m, hnm, hm⟩ := ih (fun i hi => hn i (Nat.lt_succ_of_lt hi)) + obtain ⟨k, hkpos, hk⟩ := checkpoint_successor M q w g₀ hg₀ n + (hn n (Nat.lt_succ_self n)) + exact ⟨m + k, by omega, hm.trans hk⟩ + +theorem Step.successor_unique [DecidableEq Q] [DecidableEq A] + {M : Machine Q A} {C D E : Configuration Q A} (hD : Step M C D) (hE : Step M C E) : + D = E := by + obtain ⟨qD, sD, dD, hlD, rfl⟩ := hD + obtain ⟨qE, sE, dE, hlE, rfl⟩ := hE + obtain ⟨rfl, rfl, rfl⟩ := hlD.successor_unique hlE + rfl + +theorem Steps.head {M : Machine Q A} {n : ℕ} {C E : Configuration Q A} + (h : Steps M (n + 1) C E) : + ∃ D, Step M C D ∧ Steps M n D E := by + induction n generalizing C E with + | zero => + cases h with + | next h hs => + cases h + exact ⟨_, hs, Steps.zero _⟩ + | succ n ih => + cases h with + | next h hs => + obtain ⟨D, hD, hrest⟩ := ih h + exact ⟨D, hD, Steps.next hrest hs⟩ + +theorem Steps.prefix_has_successor [DecidableEq Q] [DecidableEq A] + {M : Machine Q A} {m n : ℕ} {C D E : Configuration Q A} + (hshort : Steps M m C D) (hlong : Steps M n C E) (hmn : m < n) : + ∃ F, Step M D F := by + induction m generalizing n C D E with + | zero => + cases hshort + cases n with + | zero => omega + | succ n => + obtain ⟨F, hF, _⟩ := hlong.head + exact ⟨F, hF⟩ + | succ m ih => + obtain ⟨C₁, hC₁, hrest⟩ := hshort.head + cases n with + | zero => omega + | succ n => + obtain ⟨C₂, hC₂, htail⟩ := hlong.head + have he : C₁ = C₂ := hC₁.successor_unique hC₂ + subst C₂ + exact ih hrest htail (by omega) + +def haltingControl (M : Machine Q A) : Control Q A → Bool + | checkpoint q => M.halting q + | _ => false + +theorem LocalStep.source_nonhalting {M : Machine Q A} {q q' : Control Q A} + {s s' : Symbol Q A} {d : ℤ} (h : LocalStep M q s q' s' d) : + haltingControl M q = false := by + cases h <;> simp_all [haltingControl] + +theorem halted_no_step (M : Machine Q A) (q : Q) (head : ℤ) + (tape : ℤ → Symbol Q A) (hq : M.halting q = true) (D : Configuration Q A) : + ¬ Step M ⟨checkpoint q, head, tape⟩ D := by + rintro ⟨q', s', d, hlocal, _⟩ + have hfalse := hlocal.source_nonhalting + simp [haltingControl, hq] at hfalse + +/-- Starting with the actual finite-history initialization, a recorder reaches +a halting checkpoint exactly when the original machine halts. -/ +theorem halting_checkpoint_iff [DecidableEq Q] [DecidableEq A] + (M : Machine Q A) (q : Q) (w : ℤ → A) (g₀ : ℤ) (hg₀ : 2 ≤ g₀) : + (∃ m C q', Steps M m (checkpointAt M q w g₀ 0) C ∧ + C.control = checkpoint q' ∧ M.halting q' = true) ↔ + ∃ n, M.halting (workAt M q w n).state = true := by + classical + constructor + · rintro ⟨m, C, q', hrun, hcontrol, hhalt⟩ + by_contra hnone + have hnonhalt (i : ℕ) : M.halting (workAt M q w i).state = false := by + cases he : M.halting (workAt M q w i).state with + | false => rfl + | true => exact False.elim (hnone ⟨i, he⟩) + obtain ⟨k, hmk, hlong⟩ := simulate_prefix_length M q w g₀ hg₀ (m + 1) + (fun i _ => hnonhalt i) + obtain ⟨D, hD⟩ := hrun.prefix_has_successor hlong (by omega) + cases C with + | mk control head tape => + simp only at hcontrol + subst control + exact halted_no_step M q' head tape hhalt D hD + · intro hhalt + let n := Nat.find hhalt + have hn : M.halting (workAt M q w n).state = true := Nat.find_spec hhalt + have hprior (i : ℕ) (hi : i < n) : M.halting (workAt M q w i).state = false := by + cases he : M.halting (workAt M q w i).state with + | false => rfl + | true => exact False.elim (Nat.find_min hhalt hi he) + obtain ⟨m, hm⟩ := simulate_prefix M q w g₀ hg₀ n hprior + exact ⟨m, checkpointAt M q w g₀ n, (workAt M q w n).state, hm, rfl, hn⟩ + +end ForcedComputation.Recorder + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderSubprogramFlow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderSubprogramFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..4beb0d5e1140d1fb3cf7781165d678aeb41cd629 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RecorderSubprogramFlow.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RecorderObservation + +namespace OAI + +/-! Recorder transitions inside a larger geometric program. This version +allows the fresh-state loader and the used recorder rows to share one period. -/ + +noncomputable section +namespace ForcedComputation.Recorder +open ShearFlows Radix Set + +theorem Step.flow_one_in {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) {d : Input} (hd : ValidInput d) + (hm : ∀ b : Branch (finiteMachine M hM), b.source = C.control → + b.read = C.tape C.head → b.left = C.tape (C.head - 1) → + geometricInstruction M hM b ∈ d.instructions) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) : + Φ 1 (atHeight (codedPoint M C) d.codingHeight) = + atHeight (codedPoint M D) d.codingHeight := by + obtain ⟨q, a, k, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, k, C.tape (C.head - 1), hl⟩ + have hb := hm b rfl rfl rfl + have hB := radixBase_gt_one M + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hc : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains hB hdigits (bandScale_pos M).le (stateOffset M) b C rfl rfl rfl + have he := realizingVelocity_periodMap hd hΦ hb + (sourceTube_contains (geometricInstruction M hM b) d.codingHeight + (by exact_mod_cast tubeRadius_pos hd) + (Set.mem_image_of_mem (fun X => atHeight X d.codingHeight) hc)) + simp only [atHeight_horizontal] at he + change Φ 1 (atHeight (codedPoint M C) d.codingHeight) = + atHeight ((geometricInstruction M hM b).affine (codedPoint M C)) d.codingHeight at he + have ha : (geometricInstruction M hM b).affine (codedPoint M C) = + codedPoint M ⟨q, C.head + k, Function.update C.tape C.head a⟩ := + branchInstruction_step hB hdigits (bandScale M) (stateOffset M) b C rfl rfl rfl + simpa only [ha] using he + +theorem Step.flow_safe_in {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} + (h : Step (finiteMachine M hM) C D) + (hc : recorderHalting M C.control = false) (ht : recorderHalting M D.control = false) + {d : Input} (hd : ValidInput d) (hsmall : (d.h : ℝ) ≤ (bandScale M : ℝ) / 2) + (hm : ∀ b : Branch (finiteMachine M hM), b.source = C.control → + b.read = C.tape C.head → b.left = C.tape (C.head - 1) → + geometricInstruction M hM b ∈ d.instructions) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) + {s : ℝ} (hs : s ∈ Icc (0 : ℝ) 1) : + 0 < Φ s (atHeight (codedPoint M C) d.codingHeight) 0 ∧ + Φ s (atHeight (codedPoint M C) d.codingHeight) 0 < 1 / 2 := by + obtain ⟨q, a, k, hl, rfl⟩ := h + let b : Branch (finiteMachine M hM) := + ⟨C.control, C.tape C.head, q, a, k, C.tape (C.head - 1), hl⟩ + have hb := hm b rfl rfl rfl + have hdigits : ∀ a, 0 ≤ radixDigit M a ∧ radixDigit M a ≤ radixBase M - 1 := by + intro a + exact ⟨(radixDigit_bounds_rat M a).1, by linarith [(radixDigit_bounds_rat M a).2]⟩ + have hx : codedPoint M C ∈ (geometricInstruction M hM b).source.carrier := + branchInstruction_contains (radixBase_gt_one M) hdigits (bandScale_pos M).le + (stateOffset M) b C rfl rfl rfl + have hsource := stateBox_nonterminal_x M b.source hc (geometricInstruction_source_unit M hM b) + (center_mem (geometricInstruction_source_positive M hM b)) + have htarget := stateBox_nonterminal_x M b.target ht (geometricInstruction_target_unit M hM b) + (center_mem (geometricInstruction_target_positive M hM b)) + have hlo := materialFlow_first_ge_of_mem hd hΦ hb hx hsource.1 htarget.1 hs + have hhi := materialFlow_first_le_of_mem hd hΦ hb hx hsource.2 htarget.2 hs + have hk : (bandScale M : ℝ) ≤ 1 / 64 := by + have he := (Rat.cast_le (K := ℝ)).mpr (bandScale_le M) + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using he + constructor <;> linarith + +theorem Steps.flow_nat_in {M : Alternating.Machine} {hM : M.WellFormed} + {C D : Configuration (State M) (Alphabet M)} {n : ℕ} + (h : Steps (finiteMachine M hM) n C D) {d : Input} (hd : ValidInput d) + (hm : ∀ m E, Steps (finiteMachine M hM) m C E → + ∀ b : Branch (finiteMachine M hM), b.source = E.control → + b.read = E.tape E.head → b.left = E.tape (E.head - 1) → + geometricInstruction M hM b ∈ d.instructions) + {Φ : ℝ → Space → Space} (hΦ : IsMaterialFlow d.period d.realizingVelocity Φ) : + Φ n (atHeight (codedPoint M C) d.codingHeight) = + atHeight (codedPoint M D) d.codingHeight := by + induction h with + | zero C => simpa only [Nat.cast_zero] using hΦ.initial (atHeight (codedPoint M C) d.codingHeight) + | @next n C D E hc hs ih => + rw [Nat.cast_add, Nat.cast_one, add_comm, + hΦ.nat_shift (realizingVelocity_time_periodic _) n 1, ih hm] + exact hs.flow_one_in hd (hm n D hc) hΦ + +end ForcedComputation.Recorder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleAffine.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleAffine.lean new file mode 100644 index 0000000000000000000000000000000000000000..09b0cc28984b742575b051384059c129069236ac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleAffine.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! A criterion for the full closed rectangles of a reciprocal instruction. -/ + +noncomputable section +open Set + +namespace ShearFlows + +theorem RationalBox.mem_carrier_iff {R : RationalBox 2} {x : Plane} : + x ∈ R.carrier ↔ ∀ j, |x j - R.center j| ≤ R.halfWidth j := by + constructor + · intro hx j + have hj := hx j + apply abs_le.mpr + dsimp [RationalBox.center, RationalBox.halfWidth] + constructor <;> linarith [hj.1, hj.2] + · intro hx j + have hj := abs_le.mp (hx j) + dsimp [RationalBox.center, RationalBox.halfWidth] at hj + constructor <;> linarith [hj.1, hj.2] + +theorem Instruction.image_eq_of_halfWidths (b : Instruction) (hf : 0 < b.factor) + (h₀ : b.target.halfWidth 0 = (b.factor : ℝ) * b.source.halfWidth 0) + (h₁ : b.target.halfWidth 1 = b.source.halfWidth 1 / (b.factor : ℝ)) : + b.affine '' b.source.carrier = b.target.carrier := by + have hp : (0 : ℝ) < b.factor := by exact_mod_cast hf + have hn : (b.factor : ℝ) ≠ 0 := hp.ne' + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + apply RationalBox.mem_carrier_iff.mpr + have hm := RationalBox.mem_carrier_iff.mp hx + intro j + fin_cases j + · change |b.target.center 0 + (b.factor : ℝ) * (x 0 - b.source.center 0) - + b.target.center 0| ≤ b.target.halfWidth 0 + simp only [add_sub_cancel_left, abs_mul, abs_of_pos hp, h₀] + exact mul_le_mul_of_nonneg_left (hm 0) hp.le + · change |b.target.center 1 + (x 1 - b.source.center 1) / (b.factor : ℝ) - + b.target.center 1| ≤ b.target.halfWidth 1 + simp only [add_sub_cancel_left, abs_div, abs_of_pos hp, h₁] + exact (div_le_div_iff_of_pos_right hp).mpr (hm 1) + · intro hy + let x : Plane := ![b.source.center 0 + (y 0 - b.target.center 0) / (b.factor : ℝ), + b.source.center 1 + (b.factor : ℝ) * (y 1 - b.target.center 1)] + have hm := RationalBox.mem_carrier_iff.mp hy + refine ⟨x, RationalBox.mem_carrier_iff.mpr ?_, ?_⟩ + · intro j + fin_cases j + · change |b.source.center 0 + (y 0 - b.target.center 0) / (b.factor : ℝ) - + b.source.center 0| ≤ b.source.halfWidth 0 + simp only [add_sub_cancel_left, abs_div, abs_of_pos hp] + apply (div_le_iff₀ hp).mpr + simpa only [h₀, mul_comm] using hm 0 + · change |b.source.center 1 + (b.factor : ℝ) * (y 1 - b.target.center 1) - + b.source.center 1| ≤ b.source.halfWidth 1 + simp only [add_sub_cancel_left, abs_mul, abs_of_pos hp] + have hh := mul_le_mul_of_nonneg_left (hm 1) hp.le + rw [h₁, mul_div_cancel₀ _ hn] at hh + exact hh + · funext j + fin_cases j <;> dsimp [Instruction.affine, x] <;> field_simp <;> ring + +end ShearFlows + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleSeparation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9411df6db2b784afbcc816daf1c407f6fdf0801f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/RectangleSeparation.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.GappedSeparation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InstructionRectangles + +namespace OAI + +noncomputable section + +namespace ForcedComputation.Radix + +open ShearFlows Set + +def pairOfPlane (x : Plane) : ℝ × ℝ := + letI := ShearFlows.neZeroTwo + (x 0, x 1) + +theorem plane_pair (x : Plane) : planeOfPair (pairOfPlane x) = x := by + funext j + fin_cases j <;> rfl + +theorem planeOfPair_injective : Function.Injective planeOfPair := by + intro x y h + exact Prod.ext (congrFun h 0) (congrFun h 1) + +theorem sourceBox_pair_mem (B l a : ℚ) (p : ℝ × ℝ) : + planeOfPair p ∈ (sourceBox B l a).carrier ↔ p ∈ rectangle B l a := by + constructor + · intro h + constructor + · simpa only [sourceBox, planeOfPair, RationalBox.carrier, cylinder, mem_Icc, + Matrix.cons_val_zero, Rat.cast_div, Rat.cast_add, Rat.cast_one] using h 0 + · simpa only [sourceBox, planeOfPair, RationalBox.carrier, cylinder, mem_Icc, + Matrix.cons_val_zero, Matrix.cons_val_one, Rat.cast_div, Rat.cast_add, Rat.cast_one] using h 1 + · intro h j + fin_cases j + · dsimp [sourceBox, planeOfPair] + simpa only [cylinder, Set.mem_Icc, Rat.cast_div, Rat.cast_add, Rat.cast_one] using h.1 + · dsimp [sourceBox, planeOfPair] + simpa only [cylinder, Set.mem_Icc, Rat.cast_div, Rat.cast_add, Rat.cast_one] using h.2 + +def targetRegion (B l b : ℝ) (m : HeadMove) : Set (ℝ × ℝ) := + HeadMove.casesOn m + (Icc 0 1 ×ˢ (push B l '' cylinder B b)) + (cylinder B l ×ˢ cylinder B b) + ((push B b '' cylinder B l) ×ˢ Icc 0 1) + +theorem targetBox_pair_mem {B : ℚ} (hB : 0 < B) (l a b : ℚ) + (m : HeadMove) (p : ℝ × ℝ) : + planeOfPair p ∈ (targetBox B l b m).carrier ↔ p ∈ targetRegion B l b m := by + have hp : (0 : ℝ) < B := by exact_mod_cast hB + have himage : normalizedMove B l a b m '' rectangle B l a = targetRegion B l b m := by + cases m + · exact leftMove_image hp _ _ _ + · exact stayMove_image hp _ _ _ + · exact rightMove_image hp _ _ _ + rw [← himage] + constructor + · intro h + rw [← radixInstruction_image hB l a b m] at h + obtain ⟨x, hx, he⟩ := h + refine ⟨pairOfPlane x, (sourceBox_pair_mem B l a _).mp ?_, ?_⟩ + · simpa only [plane_pair] using hx + · apply planeOfPair_injective + rw [← radixInstruction_action hB, plane_pair] + exact he + · rintro ⟨x, hx, rfl⟩ + rw [← radixInstruction_action hB] + rw [← radixInstruction_image hB l a b m] + exact mem_image_of_mem _ ((sourceBox_pair_mem B l a x).mpr hx) + +def CoordinateGap (δ : ℝ) (R S : RationalBox 2) : Prop := + ∀ x ∈ R.carrier, ∀ y ∈ S.carrier, ∃ j : Fin 2, δ ≤ |x j - y j| + +theorem CoordinateGap.positiveSeparated {δ : ℝ} {R S : RationalBox 2} + (hδ : 0 < δ) (h : CoordinateGap δ R S) : PositivelySeparated R.carrier S.carrier := by + refine ⟨δ, hδ, ?_⟩ + intro x hx y hy + obtain ⟨j, hj⟩ := h x hx y hy + exact hj.trans (by simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - y) j) + +theorem CoordinateGap.scaled {δ : ℝ} {R S : RationalBox 2} + (h : CoordinateGap δ R S) {κ : ℚ} (hκ : 0 < κ) (offset : Fin 2 → ℚ) : + CoordinateGap ((κ : ℝ) * δ) (scaledBox κ offset R) (scaledBox κ offset S) := by + intro x hx y hy + rw [← scaledBox_image hκ offset R] at hx + rw [← scaledBox_image hκ offset S] at hy + obtain ⟨u, hu, rfl⟩ := hx + obtain ⟨v, hv, rfl⟩ := hy + obtain ⟨j, hj⟩ := h u hu v hv + refine ⟨j, ?_⟩ + have hp : (0 : ℝ) < κ := by exact_mod_cast hκ + have he : embedPlane κ offset u j - embedPlane κ offset v j = (κ : ℝ) * (u j - v j) := by + dsimp [embedPlane] + ring + rw [he, abs_mul, abs_of_pos hp] + exact mul_le_mul_of_nonneg_left hj hp.le + +theorem sourceBox_gap {N : ℕ} (l a l' a' : Fin N) (hne : (l, a) ≠ (l', a')) : + CoordinateGap (1 / (rationalBase N : ℝ)) + (sourceBox (rationalBase N) (rationalDigit l) (rationalDigit a)) + (sourceBox (rationalBase N) (rationalDigit l') (rationalDigit a')) := by + intro x hx y hy + have hx' := (sourceBox_pair_mem _ _ _ (pairOfPlane x)).mp (by simpa only [plane_pair] using hx) + have hy' := (sourceBox_pair_mem _ _ _ (pairOfPlane y)).mp (by simpa only [plane_pair] using hy) + have hp : (0 : ℝ) < rationalBase N := lt_of_lt_of_le zero_lt_one (rationalBase_ge_one N) + by_cases hl : l = l' + · have ha : a ≠ a' := by intro h; exact hne (by simp [hl, h]) + exact ⟨1, cylinder_separated hp (rationalDigit_gap ha) _ hx'.2 _ hy'.2⟩ + · exact ⟨0, cylinder_separated hp (rationalDigit_gap hl) _ hx'.1 _ hy'.1⟩ + +theorem targetBox_gap {N : ℕ} (l b l' b' : Fin N) (m : HeadMove) + (hne : (l, b) ≠ (l', b')) : + CoordinateGap (1 / (rationalBase N : ℝ) ^ 2) + (targetBox (rationalBase N) (rationalDigit l) (rationalDigit b) m) + (targetBox (rationalBase N) (rationalDigit l') (rationalDigit b') m) := by + intro x hx y hy + have hp : (0 : ℚ) < rationalBase N := by dsimp [rationalBase]; positivity + have hpr : (0 : ℝ) < rationalBase N := by exact_mod_cast hp + have hx' := (targetBox_pair_mem hp _ 0 _ m (pairOfPlane x)).mp (by simpa only [plane_pair] using hx) + have hy' := (targetBox_pair_mem hp _ 0 _ m (pairOfPlane y)).mp (by simpa only [plane_pair] using hy) + cases m with + | left => + exact ⟨1, twoSymbol_separated l l' b b' hne _ hx'.2 _ hy'.2⟩ + | right => + have hne' : (b, l) ≠ (b', l') := by + intro he + exact hne (Prod.ext (congrArg Prod.snd he) (congrArg Prod.fst he)) + exact ⟨0, twoSymbol_separated b b' l l' hne' _ hx'.1 _ hy'.1⟩ + | stay => + have hrecip : 1 / (rationalBase N : ℝ) ^ 2 ≤ 1 / (rationalBase N : ℝ) := + one_div_le_one_div_of_le hpr (by nlinarith [rationalBase_ge_one N]) + by_cases hl : l = l' + · have hb : b ≠ b' := by intro h; exact hne (by simp [hl, h]) + exact ⟨1, hrecip.trans (cylinder_separated hpr (rationalDigit_gap hb) _ hx'.2 _ hy'.2)⟩ + · exact ⟨0, hrecip.trans (cylinder_separated hpr (rationalDigit_gap hl) _ hx'.1 _ hy'.1)⟩ + +end ForcedComputation.Radix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Reparametrization.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Reparametrization.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5aa29c0d4ecb1ae3a56d05ad3a8d45313d5d58c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Reparametrization.lean @@ -0,0 +1,80 @@ +import Mathlib.Analysis.Calculus.Deriv.Comp +import Mathlib.Analysis.SpecialFunctions.Log.Deriv +import Mathlib.Analysis.SpecialFunctions.ExpDeriv +import Mathlib.Topology.Order.IntermediateValue + +namespace OAI + +/-! +# Material trajectories under an onto clock + +The change of clock used in §6 of *Universal Computation with Eventually +Stationary Navier–Stokes Forcing* and in *Scalar Potentials and Slow Clocks +for Forced Fluid Computation*. These lemmas concern the actual ODE and +observation event; no computation/flow correspondence is postulated here. +-/ + +namespace ForcedComputation + +section Trajectories + +variable {E : Type*} + +/-- The nonnegative-time particle observation used in the manuscripts. -/ +def Reaches (X : ℝ → E) (O : Set E) : Prop := + ∃ t : ℝ, 0 ≤ t ∧ X t ∈ O + +/-- A clock visits every nonnegative internal time and never visits a negative one. -/ +def OntoClock (τ : ℝ → ℝ) : Prop := + (∀ t, 0 ≤ t → 0 ≤ τ t) ∧ ∀ s, 0 ≤ s → ∃ t, 0 ≤ t ∧ τ t = s + +theorem reaches_comp_iff {τ : ℝ → ℝ} (hτ : OntoClock τ) + (X : ℝ → E) (O : Set E) : Reaches (X ∘ τ) O ↔ Reaches X O := by + constructor + · rintro ⟨t, ht, hO⟩ + exact ⟨τ t, hτ.1 t ht, hO⟩ + · rintro ⟨s, hs, hO⟩ + obtain ⟨t, ht, he⟩ := hτ.2 s hs + exact ⟨t, ht, by simpa only [Function.comp_apply, he] using hO⟩ + +/-- Chain rule for the material ODE, including the initial condition. -/ +theorem trajectory_reparametrization [NormedAddCommGroup E] [NormedSpace ℝ E] + {V : ℝ → E → E} {X : ℝ → E} + {τ a : ℝ → ℝ} {x₀ : E} + (hX₀ : X 0 = x₀) (hτ₀ : τ 0 = 0) + (hX : ∀ s, 0 ≤ s → HasDerivAt X (V s (X s)) s) + (hτ : ∀ t, 0 ≤ t → HasDerivAt τ (a t) t) + (hnonneg : ∀ t, 0 ≤ t → 0 ≤ τ t) : + (X ∘ τ) 0 = x₀ ∧ + ∀ t, 0 ≤ t → HasDerivAt (X ∘ τ) + (a t • V (τ t) ((X ∘ τ) t)) t := by + refine ⟨by simp only [Function.comp_apply, hτ₀, hX₀], ?_⟩ + intro t ht + exact (hX (τ t) (hnonneg t ht)).scomp t (hτ t ht) + +end Trajectories + +/-- The logarithmic slowdown traverses infinitely many periods. -/ +noncomputable def logClock (t : ℝ) : ℝ := Real.log (1 + t) + +theorem logClock_onto : OntoClock logClock := by + constructor + · intro t ht + exact Real.log_nonneg (by linarith) + · intro s hs + refine ⟨Real.exp s - 1, sub_nonneg.mpr (Real.one_le_exp_iff.mpr hs), ?_⟩ + simp [logClock] + +theorem logClock_hasDerivAt {t : ℝ} (ht : 0 ≤ t) : + HasDerivAt logClock (1 / (1 + t)) t := by + have hp : 0 < 1 + t := by linarith + change HasDerivAt (fun s : ℝ => Real.log (1 + s)) (1 / (1 + t)) t + simpa only [id_eq] using ((hasDerivAt_id t).const_add 1).log hp.ne' + +theorem logClock_reaches_iff {E : Type*} (X : ℝ → E) (O : Set E) : + Reaches (X ∘ logClock) O ↔ Reaches X O := + reaches_comp_iff logClock_onto X O + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualExpressions.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualExpressions.lean new file mode 100644 index 0000000000000000000000000000000000000000..92301bf983c3c930a3f455fa1ca763f2a3c691c7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualExpressions.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualScaling +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! Finite expressions and certified evaluation for the full viscous residual, +including the quadratic convection term. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff BigOperators + +theorem mixedDerivative_add {V W : Velocity} (hV : ContDiff ℝ ∞ V) + (hW : ContDiff ℝ ∞ W) (α : List (Fin 4)) : + mixedDerivative (V + W) α = mixedDerivative V α + mixedDerivative W α := by + induction α with + | nil => rfl + | cons j α ih => + funext y + simp only [mixedDerivative, ih] + rw [fderiv_add ((mixedDerivative_smooth hV α).differentiable (by simp) y) + ((mixedDerivative_smooth hW α).differentiable (by simp) y)] + rfl + +noncomputable def convectiveField (V : Velocity) : Velocity := + fun y => advection (fun x => V (y.1, x)) y.2 + +theorem convectiveField_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) : + ContDiff ℝ ∞ (convectiveField V) := + (spatial_fderiv_smooth hV).clm_apply hV + +theorem convectiveField_eq_mixed {V : Velocity} (hV : ContDiff ℝ ∞ V) + (y : SpaceTime) : + convectiveField V y = ∑ j : Fin 3, V y j • mixedDerivative V [j.succ] y := by + change fderiv ℝ (fun x => V (y.1, x)) y.2 (V y) = _ + calc + _ = fderiv ℝ (fun x => V (y.1, x)) y.2 + (∑ j : Fin 3, V y j • basis j) := by rw [sum_coordinates_basis] + _ = ∑ j : Fin 3, V y j • derivative (fun x => V (y.1, x)) j y.2 := by + simp only [map_sum, map_smul, derivative] + _ = _ := by simp only [spatialDerivative_eq_mixed hV] + +theorem residual_eq_force_add (ν : ℝ) (V : Velocity) : + residual ν V = force ν V + convectiveField V := by + funext y + simp only [residual, force, convectiveField, Pi.add_apply] + abel + +namespace ResidualCode + +def convection (c : VelocityExpr) : VelocityExpr := fun k => + FieldExpr.sum (List.ofFn (fun j : Fin 3 => .mul (c j) ((c k).diff j.succ))) + +theorem convection_valid {c : VelocityExpr} (hc : c.Valid) : (convection c).Valid := by + intro k + exact FieldExpr.sum_ofFn_valid _ (fun j => ⟨hc j, FieldExpr.valid_diff (hc k) j.succ⟩) + +theorem convection_val {c : VelocityExpr} (hc : c.Valid) : + (convection c).val = convectiveField c.val := by + funext y k + rw [convectiveField_eq_mixed (VelocityExpr.smooth hc)] + simp only [convection, VelocityExpr.val, FieldExpr.sum_ofFn_val, + FieldExpr.val, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + apply Finset.sum_congr rfl + intro j _ + have he := congrFun (congrFun (VelocityExpr.val_diffWord hc [j.succ]) y) k + exact congrArg (fun z => (c j).val y * z) he + +def code (c : VelocityExpr) (r : ℚ) : VelocityExpr := fun k => + .add (c.forceCode r k) (convection c k) + +theorem valid {c : VelocityExpr} (hc : c.Valid) (r : ℚ) : (code c r).Valid := + fun k => ⟨VelocityExpr.forceCode_valid hc r k, convection_valid hc k⟩ + +theorem val {c : VelocityExpr} (hc : c.Valid) (r : ℚ) : + (code c r).val = residual r c.val := by + rw [residual_eq_force_add, ← VelocityExpr.forceCode_val hc r, ← convection_val hc] + rfl + +theorem coefficient_error {c : VelocityExpr} (hc : c.Valid) + (α : List (Fin 4)) (y : SpaceTime) (ν r : ℝ) : + ‖mixedDerivative (residual ν c.val) α y - + mixedDerivative (residual r c.val) α y‖ ≤ + |ν-r| * (c.laplaceBound α : ℝ) := by + rw [residual_eq_force_add, residual_eq_force_add, + mixedDerivative_add (force_smooth (VelocityExpr.smooth hc) ν) + (convectiveField_smooth (VelocityExpr.smooth hc)), + mixedDerivative_add (force_smooth (VelocityExpr.smooth hc) r) + (convectiveField_smooth (VelocityExpr.smooth hc))] + simpa only [Pi.add_apply, add_sub_add_right_eq_sub] using + VelocityExpr.force_coefficient_error hc α y ν r + +theorem halfTolerance_pos (ε : ℚ) (hε : 0 < ε) : 0 < ε/2 := half_pos hε + +def evaluate (c : VelocityExpr) (hc : c.Valid) (α : List (Fin 4)) + (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + let r := a (c.coefficientPrecision α ε) + (code c r).evaluate (valid hc r) α b (ε/2) (halfTolerance_pos ε hε) + +theorem evaluate_spec {c : VelocityExpr} (hc : c.Valid) (α : List (Fin 4)) + {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + {y : SpaceTime} {b : ℕ → RationalSpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (residual ν c.val) α y - + rationalVector (evaluate c hc α a b ε hε)‖ ≤ (ε : ℝ) := by + let r := a (c.coefficientPrecision α ε) + calc + _ ≤ ‖mixedDerivative (residual ν c.val) α y - mixedDerivative (residual r c.val) α y‖ + + ‖mixedDerivative (residual r c.val) α y - + rationalVector (evaluate c hc α a b ε hε)‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ (ε : ℝ)/2 + (ε : ℝ)/2 := by + apply add_le_add + · exact (coefficient_error hc α y ν r).trans + ((mul_le_mul_of_nonneg_right (ha _) (Nat.cast_nonneg _)).trans + (VelocityExpr.coefficientPrecision_spec c α hε)) + · simpa only [evaluate, val hc, Rat.cast_div, Rat.cast_ofNat] using + VelocityExpr.evaluate_spec (valid hc r) α b hb (ε/2) (by positivity) + _ = _ := by ring + +def bound (c : VelocityExpr) (α : List (Fin 4)) (a : ℕ → ℚ) : ℕ := + ⌈((code c 0).bound α : ℚ) + (|a 0|+1) * (c.laplaceBound α : ℚ)⌉₊ + +theorem bound_spec {c : VelocityExpr} (hc : c.Valid) (α : List (Fin 4)) + {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) (y : SpaceTime) : + ‖mixedDerivative (residual ν c.val) α y‖ ≤ (bound c α a : ℝ) := by + have hν : |ν| ≤ |(a 0 : ℝ)|+1 := by + have hh := ha 0 + simp only [errorTolerance, pow_zero, inv_one] at hh + linarith [abs_sub_abs_le_abs_sub ν (a 0)] + calc + _ ≤ ‖mixedDerivative (residual 0 c.val) α y‖ + + ‖mixedDerivative (residual ν c.val) α y - mixedDerivative (residual 0 c.val) α y‖ := by + simpa only [norm_sub_rev] using norm_le_norm_add_norm_sub + (mixedDerivative (residual 0 c.val) α y) (mixedDerivative (residual ν c.val) α y) + _ ≤ ((code c 0).bound α : ℝ) + (|(a 0 : ℝ)|+1) * (c.laplaceBound α : ℝ) := by + apply add_le_add + · simpa only [val hc, Rat.cast_zero] using VelocityExpr.val_bound (valid hc 0) α y + · exact (coefficient_error hc α y ν 0).trans + (by simpa only [sub_zero] using + mul_le_mul_of_nonneg_right hν (Nat.cast_nonneg (c.laplaceBound α))) + _ ≤ _ := by exact_mod_cast (Nat.le_ceil + (((code c 0).bound α : ℚ) + (|a 0|+1) * (c.laplaceBound α : ℚ))) + +end ResidualCode +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualScaling.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..73cd251a62b3f3b0c53f426d668d2417eec06ca1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ResidualScaling.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! +# Residual force under startup and changes of clock + +The fields and differential operators are the concrete flat-coordinate ones +already used by the shear realization. In particular, `residual` includes the +convective term, which need not vanish for a spatial suspension. +-/ + +noncomputable section + +open scoped BigOperators ContDiff Topology +open ShearFlows + +namespace ForcedComputation + +def residual (ν : ℝ) (V : Velocity) : Velocity := + fun y => timeDerivative V y.1 y.2 + advection (fun x => V (y.1, x)) y.2 - + ν • laplacian (fun x => V (y.1, x)) y.2 + +theorem derivative_smul (a : ℝ) (W : Space → Space) (j : Fin 3) (x : Space) : + derivative (fun y => a • W y) j x = a • derivative W j x := by + unfold derivative + rw [show (fun y => a • W y) = a • W from rfl, fderiv_const_smul_field] + rfl + +theorem laplacian_smul (a : ℝ) (W : Space → Space) (x : Space) : + laplacian (fun y => a • W y) x = a • laplacian W x := by + unfold laplacian + have hd (j : Fin 3) : derivative (fun y => a • W y) j = + fun y => a • derivative W j y := funext (derivative_smul a W j) + simp_rw [hd] + change (∑ j, fderiv ℝ (a • derivative W j) x (basis j)) = _ + simp only [fderiv_const_smul_field, Pi.smul_apply, smul_apply, Finset.smul_sum] + +theorem advection_smul (a : ℝ) (W : Space → Space) (x : Space) : + advection (fun y => a • W y) x = a ^ 2 • advection W x := by + unfold advection + rw [show (fun y => a • W y) = a • W from rfl, fderiv_const_smul_field] + simp only [Pi.smul_apply, smul_apply, map_smul, smul_smul, pow_two] + +theorem divergence_smul (a : ℝ) (W : Space → Space) (x : Space) : + divergence (fun y => a • W y) x = a * divergence W x := by + simp only [divergence, derivative_smul, Pi.smul_apply, smul_eq_mul, Finset.mul_sum] + +def rampVelocity (α : ℝ → ℝ) (W : Space → Space) : Velocity := + fun y => α y.1 • W y.2 + +/-- Formula (steady-force) in the eventually stationary forcing manuscript. -/ +theorem residual_ramp (ν : ℝ) (α : ℝ → ℝ) (W : Space → Space) + {t : ℝ} (hα : DifferentiableAt ℝ α t) (x : Space) : + residual ν (rampVelocity α W) (t, x) = + deriv α t • W x + α t ^ 2 • advection W x - ν • (α t • laplacian W x) := by + have ht : timeDerivative (rampVelocity α W) t x = deriv α t • W x := + (hα.hasDerivAt.smul_const (W x)).deriv + change timeDerivative (rampVelocity α W) t x + + advection (fun y => α t • W y) x - ν • laplacian (fun y => α t • W y) x = _ + rw [ht, advection_smul, laplacian_smul] + +theorem ramp_initial_zero {α : ℝ → ℝ} (hα : α 0 = 0) (W : Space → Space) (x : Space) : + rampVelocity α W (0, x) = 0 := by + simp [rampVelocity, hα] + +theorem ramp_solenoidal (α : ℝ → ℝ) {W : Space → Space} + (hW : ∀ x, divergence W x = 0) : Solenoidal (rampVelocity α W) := by + intro t x + change divergence (fun y => α t • W y) x = 0 + rw [divergence_smul, hW x, mul_zero] + +/-- Once a startup ramp is locally one, its force is the stationary residual. -/ +theorem residual_ramp_of_eventually_one (ν : ℝ) {α : ℝ → ℝ} (W : Space → Space) + {t : ℝ} (hα : α =ᶠ[𝓝 t] fun _ => 1) (x : Space) : + residual ν (rampVelocity α W) (t, x) = advection W x - ν • laplacian W x := by + have ha : α t = 1 := hα.self_of_nhds + have hd : HasDerivAt α 0 t := (hasDerivAt_const t (1 : ℝ)).congr_of_eventuallyEq hα + rw [residual_ramp ν α W hd.differentiableAt x, hd.deriv, ha] + simp + +/-- The endpoint of the stationary interval is included; differentiability +forces the startup derivative to agree with the constant right-hand tail. -/ +theorem residual_ramp_on_tail (ν : ℝ) {α : ℝ → ℝ} (W : Space → Space) + (htail : ∀ s, 1 ≤ s → α s = 1) {t : ℝ} (ht : 1 ≤ t) + (hα : DifferentiableAt ℝ α t) (x : Space) : + residual ν (rampVelocity α W) (t, x) = advection W x - ν • laplacian W x := by + have hu : UniqueDiffWithinAt ℝ (Set.Ici 1) t := uniqueDiffOn_Ici 1 t ht + have hw : HasDerivWithinAt α 0 (Set.Ici 1) t := + (hasDerivWithinAt_const t (Set.Ici 1) (1 : ℝ)).congr_of_mem htail ht + have hd : deriv α t = 0 := by + rw [← hα.derivWithin hu] + exact hw.derivWithin hu + rw [residual_ramp ν α W hα x, hd, htail t ht] + simp + +def reparametrizedVelocity (τ a : ℝ → ℝ) (V : Velocity) : Velocity := + fun y => a y.1 • V (τ y.1, y.2) + +/-- The full clock-force formula, including convection and the clock acceleration. -/ +theorem residual_reparametrization (ν : ℝ) {τ a : ℝ → ℝ} {V : Velocity} + {t da : ℝ} (hτ : HasDerivAt τ (a t) t) (ha : HasDerivAt a da t) + (x : Space) (hV : DifferentiableAt ℝ (fun s => V (s, x)) (τ t)) : + residual ν (reparametrizedVelocity τ a V) (t, x) = + da • V (τ t, x) - ν • (a t • laplacian (fun y => V (τ t, y)) x) + + a t ^ 2 • (timeDerivative V (τ t) x + advection (fun y => V (τ t, y)) x) := by + have hd : timeDerivative (reparametrizedVelocity τ a V) t x = + a t • (a t • timeDerivative V (τ t) x) + da • V (τ t, x) := by + exact (ha.smul (hV.hasDerivAt.scomp t hτ)).deriv + change timeDerivative (reparametrizedVelocity τ a V) t x + + advection (fun y => a t • V (τ t, y)) x - + ν • laplacian (fun y => a t • V (τ t, y)) x = _ + rw [hd, advection_smul, laplacian_smul] + simp only [pow_two, smul_add, smul_smul] + abel + +theorem reparametrized_initial_zero {τ a : ℝ → ℝ} {V : Velocity} + (hτ : τ 0 = 0) (hV : ∀ x, V (0, x) = 0) (x : Space) : + reparametrizedVelocity τ a V (0, x) = 0 := by + simp [reparametrizedVelocity, hτ, hV] + +theorem reparametrized_solenoidal (τ a : ℝ → ℝ) {V : Velocity} + (hV : Solenoidal V) : Solenoidal (reparametrizedVelocity τ a V) := by + intro t x + change divergence (fun y => a t • V (τ t, y)) x = 0 + rw [divergence_smul, hV, mul_zero] + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ScaledDetectorProfile.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ScaledDetectorProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4eb21db4881adc8b0660b0187a6db179031d929 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ScaledDetectorProfile.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorProfileBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PeriodizeBound +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.DetectorBump + +namespace OAI + +/-! Width-independent derivative constants for the periodized detector +profile, with the exact inverse-width scaling in each derivative. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def scaledDetectorProfile (b : ℝ) (x : ℝ) : ℝ := + baseDetectorProfile.val ((x - 1 / 4) / b) + +theorem scaledDetectorProfile_smooth (b : ℝ) : ContDiff ℝ ∞ (scaledDetectorProfile b) := + baseDetectorProfile.smooth.comp ((contDiff_id.sub contDiff_const).div_const b) + +theorem scaledDetectorProfile_eq {b : ℝ} (hb : 0 < b) (x : ℝ) : + scaledDetectorProfile b x = + closedCutoff (1 / 4 - b) (1 / 4 - b / 2) (1 / 4 + b / 2) (1 / 4 + b) x := by + have he : baseDetectorProfile.val = closedCutoff (-1) (-1 / 2) (1 / 2) 1 := by + simpa only [baseDetectorProfile, Rat.cast_neg, Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using + ProfileExpr.val_cutoff (-1) (-1 / 2) (1 / 2) 1 + unfold scaledDetectorProfile + rw [he] + have hd₁ : (1 / 4 - b / 2) - (1 / 4 - b) = b / 2 := by ring + have hd₂ : -(1 / 4 + b / 2) - -(1 / 4 + b) = b / 2 := by ring + simp only [closedCutoff, smoothRamp, hd₁, hd₂] + apply congrArg₂ (· * ·) + · apply congrArg Real.smoothTransition + field_simp [hb.ne'] + ring + · apply congrArg Real.smoothTransition + field_simp [hb.ne'] + ring + +theorem scaledDetectorProfile_iteratedDeriv {b : ℝ} (_hb : 0 < b) (n : ℕ) (x : ℝ) : + iteratedDeriv n (scaledDetectorProfile b) x = + b⁻¹ ^ n * iteratedDeriv n baseDetectorProfile.val ((x - 1 / 4) / b) := by + have he : scaledDetectorProfile b = + fun x => (fun z => baseDetectorProfile.val (b⁻¹ * z)) (x - 1 / 4) := by + funext x + simp only [scaledDetectorProfile, div_eq_mul_inv, mul_comm] + rw [he, iteratedDeriv_comp_sub_const n (fun z => baseDetectorProfile.val (b⁻¹ * z)) (1 / 4), + iteratedDeriv_comp_const_mul (n := n) (baseDetectorProfile.smooth.of_le (by simp)) b⁻¹] + simp only [div_eq_mul_inv, mul_comm] + +theorem scaledDetectorProfile_derivative_bound {b : ℝ} (hb : 0 < b) (n : ℕ) (x : ℝ) : + |iteratedDeriv n (scaledDetectorProfile b) x| ≤ + b⁻¹ ^ n * (detectorProfileDerivativeBound n : ℝ) := by + rw [scaledDetectorProfile_iteratedDeriv hb, abs_mul, + abs_of_nonneg (pow_nonneg (inv_nonneg.mpr hb.le) n)] + exact mul_le_mul_of_nonneg_left (baseDetectorProfile_derivative_bound n _) + (pow_nonneg (inv_nonneg.mpr hb.le) n) + +theorem scaledDetectorProfile_support {b : ℝ} (hb : 0 < b) : + Function.support (scaledDetectorProfile b) ⊆ Icc (1 / 4 - b) (1 / 4 + b) := by + intro x hx + have he := baseDetectorProfile_support 0 + (subset_closure (show baseDetectorProfile.val ((x - 1 / 4) / b) ≠ 0 from hx)) + have hlo := (le_div_iff₀ hb).mp he.1 + have hhi := (div_le_iff₀ hb).mp he.2 + constructor <;> linarith + +theorem detectorProfile_eq_periodize_scaled {b : ℝ} (hb : 0 < b) : + detectorProfile b = periodize 1 (scaledDetectorProfile b) := by + unfold detectorProfile circleCutoff + congr 1 + funext x + exact (scaledDetectorProfile_eq hb x).symm + +theorem detectorProfile_iteratedDeriv_bound {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1 / 16) + (n : ℕ) (x : ℝ) : + |iteratedDeriv n (detectorProfile b) x| ≤ + b⁻¹ ^ n * (detectorProfileDerivativeBound n : ℝ) := by + rw [detectorProfile_eq_periodize_scaled hb, + periodize_iteratedDeriv (scaledDetectorProfile_smooth b) (scaledDetectorProfile_support hb)] + exact periodize_unit_bound + (iteratedDeriv_support_interval (scaledDetectorProfile_support hb) n) + (by linarith) (by positivity) (scaledDetectorProfile_derivative_bound hb n) x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ShiftedLoader.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ShiftedLoader.lean new file mode 100644 index 0000000000000000000000000000000000000000..07be6da54ea92088e39db844f1e838b3313de1d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ShiftedLoader.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.HeightShift +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RationalLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ObservationByInstruction + +namespace OAI + +/-! A rational loader on an arbitrary horizontal coding sheet. -/ + +open Set +namespace ForcedComputation +open ShearFlows + +def shiftedLoader (p q : Fin 2 → ℚ) (z : ℚ) : Input := + (loaderInput p q (1 / 2)).shiftHeight (z - 1 / 2) + +theorem shiftedLoader_valid (p q : Fin 2 → ℚ) (z : ℚ) + (hp : ∀ j, 1 / 8 ≤ p j ∧ p j ≤ 7 / 8) + (hq : ∀ j, 1 / 8 ≤ q j ∧ q j ≤ 7 / 8) : ValidInput (shiftedLoader p q z) := + (loaderInput_valid p q (1 / 2) hp hq (by norm_num)).shiftHeight _ + +@[simp] theorem shiftedLoader_height (p q : Fin 2 → ℚ) (z : ℚ) : + ((shiftedLoader p q z).codingHeight : ℝ) = z := by + simp only [shiftedLoader, Input.shiftHeight_codingHeight, loaderInput, + Rat.cast_add, Rat.cast_sub, Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] + ring + +@[simp] theorem shiftedLoader_period (p q : Fin 2 → ℚ) (z : ℚ) : + ((shiftedLoader p q z).period : ℝ) = 1 := by + norm_num [shiftedLoader, loaderInput, Input.shiftHeight] + +theorem shiftedLoader_endpoint {p q : Fin 2 → ℚ} {z : ℚ} + (hd : ValidInput (shiftedLoader p q z)) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (shiftedLoader p q z).realizingVelocity Φ) : + Φ 1 (atHeight (fun j => (p j : ℝ)) z) = atHeight (fun j => (q j : ℝ)) z := by + have hΦ' : IsMaterialFlow (shiftedLoader p q z).period + (shiftedLoader p q z).realizingVelocity Φ := by + simpa only [shiftedLoader_period] using hΦ + have hδ : (0 : ℝ) < (shiftedLoader p q z).tubeRadius := by + exact_mod_cast tubeRadius_pos hd + have hx : atHeight (fun j => (p j : ℝ)) z ∈ + sourceTube (loaderInstruction p q) z (shiftedLoader p q z).tubeRadius := by + refine ⟨_, loaderInstruction_contains_center p q, ?_, ?_⟩ + · simpa only [atHeight_horizontal, sub_self, norm_zero] using hδ + · simpa [atHeight] using hδ + have he := realizingVelocity_periodMap hd hΦ' (b := loaderInstruction p q) + (by simp [shiftedLoader, loaderInput, Input.shiftHeight]) (by + simpa only [shiftedLoader_height] using hx) + rw [atHeight_horizontal, loaderInstruction_center] at he + change Φ 1 (atHeight (fun j => (p j : ℝ)) z) = + atHeight (fun j => (q j : ℝ)) z at he + exact he + +theorem shiftedLoader_first_le {p q : Fin 2 → ℚ} {z : ℚ} + (hd : ValidInput (shiftedLoader p q z)) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (shiftedLoader p q z).realizingVelocity Φ) + {a t : ℝ} (hp : (p 0 : ℝ) ≤ a) (hq : (q 0 : ℝ) ≤ a) (ht : t ∈ Icc (0 : ℝ) 1) : + Φ t (atHeight (fun j => (p j : ℝ)) z) 0 ≤ a + 1 / 256 := by + have hΦ' : IsMaterialFlow (shiftedLoader p q z).period + (shiftedLoader p q z).realizingVelocity Φ := by + simpa only [shiftedLoader_period] using hΦ + have he := materialFlow_first_le_of_mem hd hΦ' (b := loaderInstruction p q) + (by simp [shiftedLoader, loaderInput, Input.shiftHeight]) + (loaderInstruction_contains_center p q) + (by simpa [loaderInstruction, centeredBox_center] using hp) + (by simpa [loaderInstruction, centeredBox_center] using hq) ht + simp only [shiftedLoader_height] at he + norm_num only [shiftedLoader, Input.shiftHeight, loaderInput, + Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] at he + exact he + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowBundle.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowBundle.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a4c02497f9c10945480492f240d989f9b66d061 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowBundle.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowFluid + +namespace OAI + +/-! Analytic bundle for the square-integrable fixed-particle construction. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff NNReal + +def SlowFluidProperties (L ν : ℝ) (U : Velocity) : Prop := + ContDiff ℝ ∞ U ∧ ContDiff ℝ ∞ (force ν U) ∧ + SpatiallyPeriodic L U ∧ SpatiallyPeriodic L (force ν U) ∧ + Solenoidal U ∧ Solenoidal (force ν U) ∧ + HasZeroMean L U ∧ HasZeroMean L (force ν U) ∧ + UniformMixedL2 U ∧ UniformMixedL2 (force ν U) ∧ + (∃ E : ℝ, ∀ t, kineticEnergy L U t ≤ E) ∧ + IsClassicalSolution L ν (force ν U) U (fun _ => 0) ∧ + (∀ u p, IsClassicalSolution L ν (force ν U) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = U (t, x) ∧ p (t, x) = 0) + +theorem slow_initialized_bundle {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) + (hp : loader.period = body.period) (ν : ℝ) (hν : 0 ≤ ν) : + SlowFluidProperties body.period ν (slowFromRest (initializedProgram loader body)) := by + let V := initializedProgram loader body + have hs : ContDiff ℝ ∞ V := initializedProgram_smooth hl hb + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + have hper : SpatiallyPeriodic body.period V := initializedProgram_periodic hp + have hdiv : Solenoidal V := initializedProgram_solenoidal hl hb + have hadv : ZeroAdvection V := initializedProgram_zero_advection hl hb + have hbounded : BoundedMixedDerivatives V := initializedProgram_bounded hl hb hp + have hslow := slowFromRest_smooth hs hz + have hslowper := slowFromRest_periodic hper + obtain ⟨hUL2, hFL2⟩ := slowFromRest_uniformMixedL2 hs hz hbounded hadv ν + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hl hb + refine ⟨hslow, force_smooth hslow ν, hslowper, + force_spatially_periodic hslow hslowper ν, slowFromRest_solenoidal hdiv, + force_solenoidal hslow (slowFromRest_solenoidal hdiv) ν, + slowFromRest_mean_zero (initializedProgram_mean_zero hl hb hp), + slowFromRest_force_mean_zero (by exact_mod_cast hb.period_pos.le) hs hper hz hadv + (initializedProgram_mean_zero hl hb hp) (initializedForce_mean_zero hl hb hp 0) ν, + hUL2, hFL2, slowFromRest_energy hs hz hbounded, + slowFromRest_solution hs hper hz hdiv hadv ν, + slowFromRest_unique (by exact_mod_cast hb.period_pos) hν hs hper hz hdiv hadv hK⟩ + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowDerivativeFormula.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowDerivativeFormula.lean new file mode 100644 index 0000000000000000000000000000000000000000..8595eaa5de18ab5bb116f376f08eaca09b034e09 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowDerivativeFormula.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MixedNormalFormData + +namespace OAI + +/-! Exact finite formulas for every mixed derivative of the actual slow force. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Filter +open scoped ContDiff Topology BigOperators + +theorem mixedDerivative_quadraticPhase {V : Velocity} (hV : ContDiff ℝ ∞ V) + (ha : ZeroAdvection V) (α : List (Fin 4)) : + mixedDerivative (fun y => quadraticPhase V y.2 y.1) α = + mixedDerivative V (α ++ [0]) - mixedDerivative V α := by + have he : (fun y => quadraticPhase V y.2 y.1) = mixedDerivative V [0] - V := by + funext y + simp only [quadraticPhase, ha y.1 y.2, add_zero, timeDerivative_eq hV] + rfl + rw [he, mixedDerivative_sub (mixedDerivative_smooth hV _) hV, + mixedDerivative_append] + +theorem mixedDerivative_viscousPhase {V : Velocity} (hV : ContDiff ℝ ∞ V) + (α : List (Fin 4)) : + mixedDerivative (fun y => viscousPhase V y.2 y.1) α = + ∑ j : Fin 3, mixedDerivative V (α ++ [j.succ, j.succ]) := by + have he : (fun y => viscousPhase V y.2 y.1) = + ∑ j : Fin 3, mixedDerivative V [j.succ, j.succ] := by + funext y + simpa only [viscousPhase, Finset.sum_apply] using laplacian_eq_mixed hV y.1 y.2 + rw [he, mixedDerivative_sum _ (fun j => mixedDerivative_smooth hV _)] + simp only [mixedDerivative_append] + +theorem slowFromRest_mixed_formula {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (ha : ZeroAdvection V) (ν : ℝ) (n : ℕ) (β : List (Fin 3)) + {t : ℝ} (ht : -(1 / 2 : ℝ) < t) (x : Space) : + mixedDerivative (force ν (slowFromRest V)) + (List.replicate n 0 ++ β.map Fin.succ) (t, x) = + (1 + t)⁻¹ ^ (2 + n) • + phaseIter 2 (fun s => spatialPhase (fun y => quadraticPhase V y.2 y.1) β (s, x)) n + (logClock t) - + ν • ((1 + t)⁻¹ ^ (1 + n) • + phaseIter 1 (fun s => spatialPhase (fun y => viscousPhase V y.2 y.1) β (s, x)) n + (logClock t)) := by + let Q : Velocity := fun y => quadraticPhase V y.2 y.1 + let D : Velocity := fun y => viscousPhase V y.2 y.1 + have hQ : ContDiff ℝ ∞ Q := quadraticPhase_smooth hV + have hD : ContDiff ℝ ∞ D := viscousPhase_smooth hV + have hQx : ContDiff ℝ ∞ (fun s => spatialPhase Q β (s, x)) := + (spatialPhase_smooth hQ β).comp (contDiff_id.prodMk contDiff_const) + have hDx : ContDiff ℝ ∞ (fun s => spatialPhase D β (s, x)) := + (spatialPhase_smooth hD β).comp (contDiff_id.prodMk contDiff_const) + rw [mixedDerivative_time_spatial (force_smooth (slowFromRest_smooth hV hzero) ν)] + have he : (fun s => spatialWord β (fun y => force ν (slowFromRest V) (s, y)) x) + =ᶠ[𝓝 t] fun s => logarithmicProfile 2 (fun q => spatialPhase Q β (q, x)) s - + ν • logarithmicProfile 1 (fun q => spatialPhase D β (q, x)) s := by + filter_upwards [eventually_gt_nhds ht] with s hs + have hf : (fun y => force ν (slowFromRest V) (s, y)) = fun y => slowForce ν V (s, y) := + funext (slowFromRest_force_eq hV hzero ha ν hs) + rw [hf] + exact spatialWord_slowForce hV ν β s x + rw [he.iteratedDeriv_eq n] + have hqt := logarithmicProfile_contDiffAt 2 hQx (show -1 < t by linarith) + have hdt := logarithmicProfile_contDiffAt 1 hDx (show -1 < t by linarith) + rw [iteratedDeriv_fun_sub (hqt.of_le (by simp)) + ((hdt.const_smul ν).of_le (by simp)), iteratedDeriv_fun_const_smul_field, + iteratedDeriv_logarithmicProfile 2 n hQx (by linarith), + iteratedDeriv_logarithmicProfile 1 n hDx (by linarith)] + rfl + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEffective.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEffective.lean new file mode 100644 index 0000000000000000000000000000000000000000..95a47e6a59b0a9d14447704f5fe1f0adbda5d4e9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEffective.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowEvaluationBalls +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowFluid + +namespace OAI + +/-! A terminating evaluator for every mixed derivative of the slow force. +Its only inputs beyond the finite rational program are fast names for the +viscosity and the evaluation point. -/ + +namespace ForcedComputation +open ShearFlows Filter Set +open scoped Topology ContDiff + +theorem slowCoarseTimeBound {y : SpaceTime} {b : ℕ → RationalSpaceTime} + (hb : IsFastName b y) : |y.1 - ((b 7).1 : ℝ)| ≤ (1 / 128 : ℝ) := by + have h := (norm_fst_le (y - rationalPoint (b 7))).trans (hb 7) + norm_num [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, errorTolerance] at h + exact h + +theorem slowCoarsePositive {y : SpaceTime} {b : ℕ → RationalSpaceTime} + (hb : IsFastName b y) (h : ¬(b 7).1 ≤ 0) : -(1 / 2 : ℝ) < y.1 := by + have hp : (0 : ℝ) < (b 7).1 := by exact_mod_cast lt_of_not_ge h + linarith [(abs_le.mp (slowCoarseTimeBound hb)).1] + +def evaluateSlowForce {ν : ℝ} {y : SpaceTime} (loader body : Input) + (hl : ValidInput loader) (hb : ValidInput body) (α : List (Fin 4)) + (a : ℕ → ℚ) (ha : IsFastRealName a ν) + (b : ℕ → RationalSpaceTime) (hname : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : RationalVector := + if h : (b 7).1 ≤ 0 then 0 + else evaluateVectorBalls + (slowEvaluationBalls loader body hl hb a b (slowCoarsePositive hname h) hname α) + ε (vectorBallReady_exists + (slowEvaluationBalls_converges hl hb ha b (slowCoarsePositive hname h) hname α) hε) + +theorem evaluateSlowForce_spec {ν : ℝ} {y : SpaceTime} {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) (α : List (Fin 4)) + (a : ℕ → ℚ) (ha : IsFastRealName a ν) + (b : ℕ → RationalSpaceTime) (hname : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (force ν (slowFromRest (initializedProgram loader body))) α y - + rationalVector (evaluateSlowForce loader body hl hb α a ha b hname ε hε)‖ ≤ + (ε : ℝ) := by + unfold evaluateSlowForce + split + · rename_i h + have htime : y.1 < (1 / 64 : ℝ) := by + have hc : ((b 7).1 : ℝ) ≤ 0 := by exact_mod_cast h + linarith [(abs_le.mp (slowCoarseTimeBound hname)).2] + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, initializedProgram loader body (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + have he : force ν (slowFromRest (initializedProgram loader body)) =ᶠ[𝓝 y] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_lt_nhds htime)] with z hz' + exact slowFromRest_force_zero hz ν hz' z.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, mixedDerivative_zero] + have heq : rationalVector (0 : RationalVector) = 0 := by + ext j + change ((0 : ℚ) : ℝ) = 0 + norm_num + rw [heq, sub_self, norm_zero] + exact_mod_cast hε.le + · rename_i h + exact evaluateVectorBalls_spec _ + (slowEvaluationBalls_converges hl hb ha b (slowCoarsePositive hname h) hname α) + (slowEvaluationBalls_contains hl hb ha b (slowCoarsePositive hname h) hname α) ε hε + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEvaluationBalls.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEvaluationBalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa587fe1bac83a5ac6837a065ac03f152ef725f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowEvaluationBalls.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowForceBalls + +namespace OAI + +/-! Interval evaluation of every derivative of the actual initialized slow +force, from the finite program and fast names for viscosity and the query. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +theorem slowClockTime_pos {y : SpaceTime} (hy : -(1 / 2 : ℝ) < y.1) : + 0 < 1 + y.1 := by linarith + +def slowEvaluationBalls {y : SpaceTime} (loader body : Input) + (hl : ValidInput loader) (hb : ValidInput body) (a : ℕ → ℚ) + (b : ℕ → RationalSpaceTime) (hy : -(1 / (2 : ℕ) : ℝ) < y.1) + (hname : IsFastName b y) (α : List (Fin 4)) (N : ℕ) (j : Fin 3) : QBall := + letI := ShearFlows.twoAtLeastTwo + let c := clockPointName b (slowClockTime_pos hy) hname + let n := (timeSpaceWord α).1 + let β := (timeSpaceWord α).2 + let speed := realNameBall (reciprocalClockName b) N + let q := phaseBalls 2 (quadraticPhaseBalls loader body hl hb c β) n 0 N j + let d := phaseBalls 1 (viscousPhaseBalls loader body hl hb c β) n 0 N j + ((speed.pow (2 + n)).mul q).add + ((QBall.exact (-1)).mul + ((realNameBall a N).mul ((speed.pow (1 + n)).mul d))) + +theorem slowEvaluationBalls_contains {y : SpaceTime} {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) {ν : ℝ} {a : ℕ → ℚ} + (ha : IsFastRealName a ν) (b : ℕ → RationalSpaceTime) + (hy : -(1 / 2 : ℝ) < y.1) (hname : IsFastName b y) + (α : List (Fin 4)) (N : ℕ) (j : Fin 3) : + (slowEvaluationBalls loader body hl hb a b hy hname α N j).Contains + (mixedDerivative (force ν (slowFromRest (initializedProgram loader body))) α y j) := by + let V := initializedProgram loader body + let n := (timeSpaceWord α).1 + let β := (timeSpaceWord α).2 + let c := clockPointName b (by linarith : 0 < 1 + y.1) hname + have hc : IsFastName c (logClock y.1, y.2) := clockPointName_spec b _ hname + have hs : ContDiff ℝ ∞ V := initializedProgram_smooth hl hb + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + have hQ := (spatialPhase_smooth (quadraticPhase_smooth hs) β).comp + (contDiff_id.prodMk (contDiff_const : ContDiff ℝ ∞ (fun _ : ℝ => y.2))) + have hD := (spatialPhase_smooth (viscousPhase_smooth hs) β).comp + (contDiff_id.prodMk (contDiff_const : ContDiff ℝ ∞ (fun _ : ℝ => y.2))) + have hq := phaseBalls_contains 2 hQ (logClock y.1) + (quadraticPhaseBalls_contains hl hb hc β) n 0 N j + have hd := phaseBalls_contains 1 hD (logClock y.1) + (viscousPhaseBalls_contains hl hb hc β) n 0 N j + have hv := realNameBall_contains (reciprocalClockName_spec b (by linarith) hname) N + have h := QBall.contains_add (QBall.contains_mul (QBall.contains_pow hv (2 + n)) hq) + (QBall.contains_mul (QBall.contains_exact (-1)) + (QBall.contains_mul (realNameBall_contains ha N) + (QBall.contains_mul (QBall.contains_pow hv (1 + n)) hd))) + rw [mixedDerivative_perm (force_smooth (slowFromRest_smooth hs hz) ν) + (timeSpaceWord_perm α)] + rw [slowFromRest_mixed_formula hs hz (initializedProgram_zero_advection hl hb) ν _ _ hy] + simpa only [slowEvaluationBalls, iteratedDeriv_zero, Pi.sub_apply, Pi.smul_apply, + smul_eq_mul, Rat.cast_neg, Rat.cast_one, neg_one_mul, sub_eq_add_neg, + n, β, c, Function.comp_def, id_eq] using h + +theorem slowEvaluationBalls_converges {y : SpaceTime} {loader body : Input} + (hl : ValidInput loader) (hb : ValidInput body) {ν : ℝ} {a : ℕ → ℚ} + (ha : IsFastRealName a ν) (b : ℕ → RationalSpaceTime) + (hy : -(1 / 2 : ℝ) < y.1) (hname : IsFastName b y) + (α : List (Fin 4)) (j : Fin 3) : + QBall.Converges (fun N => slowEvaluationBalls loader body hl hb a b hy hname α N j) + (mixedDerivative (force ν (slowFromRest (initializedProgram loader body))) α y j) := by + let V := initializedProgram loader body + let n := (timeSpaceWord α).1 + let β := (timeSpaceWord α).2 + let c := clockPointName b (by linarith : 0 < 1 + y.1) hname + have hc : IsFastName c (logClock y.1, y.2) := clockPointName_spec b _ hname + have hs : ContDiff ℝ ∞ V := initializedProgram_smooth hl hb + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + have hQ := (spatialPhase_smooth (quadraticPhase_smooth hs) β).comp + (contDiff_id.prodMk (contDiff_const : ContDiff ℝ ∞ (fun _ : ℝ => y.2))) + have hD := (spatialPhase_smooth (viscousPhase_smooth hs) β).comp + (contDiff_id.prodMk (contDiff_const : ContDiff ℝ ∞ (fun _ : ℝ => y.2))) + have hq := phaseBalls_converges 2 hQ (logClock y.1) + (quadraticPhaseBalls_converges hl hb hc β) n 0 j + have hd := phaseBalls_converges 1 hD (logClock y.1) + (viscousPhaseBalls_converges hl hb hc β) n 0 j + have hv := realNameBall_converges (reciprocalClockName_spec b (by linarith) hname) + have h := ((hv.pow (2 + n)).mul hq).add + ((QBall.converges_exact (-1)).mul + ((realNameBall_converges ha).mul ((hv.pow (1 + n)).mul hd))) + rw [mixedDerivative_perm (force_smooth (slowFromRest_smooth hs hz) ν) + (timeSpaceWord_perm α)] + rw [slowFromRest_mixed_formula hs hz (initializedProgram_zero_advection hl hb) ν _ _ hy] + simpa only [slowEvaluationBalls, iteratedDeriv_zero, Pi.sub_apply, Pi.smul_apply, + smul_eq_mul, Rat.cast_neg, Rat.cast_one, neg_one_mul, sub_eq_add_neg, + n, β, c, Function.comp_def, id_eq] using h + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..57d6a346ee53a52c565f1cbf1aadb711302978d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowFluid.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowVelocityBounds + +namespace OAI + +/-! Mean-zero forcing, classical uniqueness, and bounded energy for the +initialized logarithmic slowdown. -/ + +noncomputable section +open Set Filter MeasureTheory +open scoped ContDiff Topology NNReal +open ShearFlows + +namespace ForcedComputation + +theorem slowFromRest_force_zero {V : Velocity} + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (ν : ℝ) {t : ℝ} (ht : t < (1 / 64 : ℝ)) (x : Space) : + force ν (slowFromRest V) (t, x) = 0 := by + have he : slowFromRest V =ᶠ[𝓝 (t, x)] (fun _ => 0) := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_lt_nhds ht)] with y hy + exact slowFromRest_zero_collar hzero hy y.2 + rw [force_congr_germ he ν] + rw [force_eq_mixed (contDiff_const : ContDiff ℝ ∞ (fun _ : SpaceTime => (0 : Space)))] + simp only [mixedDerivative_zero, Finset.sum_const_zero, smul_zero, sub_zero] + +theorem slowFromRest_force_mean_zero {L : ℝ} (hL : 0 ≤ L) {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hper : SpatiallyPeriodic L V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (ha : ZeroAdvection V) (hm : HasZeroMean L V) (hm0 : HasZeroMean L (force 0 V)) + (ν : ℝ) : HasZeroMean L (force ν (slowFromRest V)) := by + have hd : HasZeroMean L (fun y => laplacian (fun x => V (y.1, x)) y.2) := + laplacian_mean_zero hL hV hper + intro t + by_cases ht : t < 0 + · simp_rw [slowFromRest_force_zero hzero ν (by linarith : t < (1 / 64 : ℝ))] + simp + · have ht0 : 0 ≤ t := le_of_not_gt ht + have he (x : Space) : force ν (slowFromRest V) (t, x) = + (1 + t)⁻¹ ^ 2 • force 0 V (logClock t, x) - + (1 + t)⁻¹ ^ 2 • V (logClock t, x) - + ν • ((1 + t)⁻¹ • laplacian (fun y => V (logClock t, y)) x) := by + rw [slowFromRest_force_eq hV hzero ha ν (by linarith)] + simp only [slowForce, quadraticPhase, viscousPhase, logarithmicProfile, + ha (Real.log (1 + t)) x, add_zero, pow_one, smul_sub, force, zero_smul, sub_zero, logClock] + simp_rw [he] + have hi0 : IntegrableOn (fun x => force 0 V (logClock t, x)) (fundamentalCube L) := + ((force_smooth hV 0).continuous.comp (continuous_const.prodMk continuous_id)).integrableOn_Icc + have hi : IntegrableOn (fun x => V (logClock t, x)) (fundamentalCube L) := + (hV.continuous.comp (continuous_const.prodMk continuous_id)).integrableOn_Icc + have hiD : IntegrableOn (laplacian (fun x => V (logClock t, x))) (fundamentalCube L) := + ((laplacian_smooth hV).continuous.comp (continuous_const.prodMk continuous_id)).integrableOn_Icc + have hiL : IntegrableOn (fun x => (1 + t)⁻¹ ^ 2 • force 0 V (logClock t, x) - + (1 + t)⁻¹ ^ 2 • V (logClock t, x)) (fundamentalCube L) := + (hi0.smul ((1 + t)⁻¹ ^ 2)).sub (hi.smul ((1 + t)⁻¹ ^ 2)) + have hiR : IntegrableOn (fun x => ν • ((1 + t)⁻¹ • + laplacian (fun y => V (logClock t, y)) x)) (fundamentalCube L) := + (hiD.smul ((1 + t)⁻¹)).smul ν + have hiA : IntegrableOn (fun x => (1 + t)⁻¹ ^ 2 • force 0 V (logClock t, x)) + (fundamentalCube L) := hi0.smul ((1 + t)⁻¹ ^ 2) + have hiB : IntegrableOn (fun x => (1 + t)⁻¹ ^ 2 • V (logClock t, x)) + (fundamentalCube L) := hi.smul ((1 + t)⁻¹ ^ 2) + rw [integral_sub hiL hiR, integral_sub hiA hiB] + simp only [integral_smul, hm0 (logClock t), hm (logClock t), hd (logClock t), smul_zero, sub_zero] + +theorem slowFromRest_unique {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {V : Velocity} (hV : ContDiff ℝ ∞ V) (hper : SpatiallyPeriodic L V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hdiv : Solenoidal V) (ha : ZeroAdvection V) {K : ℝ≥0} + (hK : ∀ t, LipschitzWith K (fun x => V (t, x))) : + ∀ u p, IsClassicalSolution L ν (force ν (slowFromRest V)) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = slowFromRest V (t, x) ∧ p (t, x) = 0 := by + have hsol := slowFromRest_solution hV hper hzero hdiv ha ν + have hb (t : ℝ) (_ : 0 ≤ t) (x : Space) : + ‖fderiv ℝ (fun y => slowFromRest V (t, y)) x‖ ≤ (K : ℝ) := + norm_fderiv_le_of_lipschitz ℝ (slowFromRest_lipschitz hK t) + intro u p hu + have he := classical_velocity_unique hL hν hu hsol hb + have hp := classical_pressure_unique hL hu hsol he + exact fun t ht x => ⟨he t ht x, hp t ht x⟩ + +theorem slowFromRest_energy {L : ℝ} {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) : + ∃ E : ℝ, ∀ t, kineticEnergy L (slowFromRest V) t ≤ E := by + obtain ⟨B, hB, hbound⟩ := hb [] + exact ⟨(1 / 2 : ℝ) * volume.real (fundamentalCube L) * (3 * B ^ 2), + fun t => kineticEnergy_bound (slowFromRest_smooth hV hzero).continuous L hB + (fun y => slowFromRest_uniform_bound hB hbound y) t⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForce.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForce.lean new file mode 100644 index 0000000000000000000000000000000000000000..36d068affe2e056302c368dc7b654ec838e70dee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForce.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ForceGerm +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.BoundedProfiles + +namespace OAI + +/-! The globally smooth slowdown has the calculated residual on a neighborhood +of nonnegative time, so its actual force inherits every derivative estimate. -/ + +noncomputable section +open Set Filter +open scoped Topology ContDiff +open ShearFlows + +namespace ForcedComputation + +theorem slowFromRest_eq_near_nonnegative {V : Velocity} + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + {t : ℝ} (ht : -(1 / 2 : ℝ) < t) (x : Space) : + slowFromRest V (t, x) = slowVelocity V (t, x) := by + by_cases hn : t ≤ 0 + · have hp : 0 < 1 + t := by linarith + have hl : Real.log (1 + t) < (1 / 32 : ℝ) := by + have := Real.log_nonpos hp.le (by linarith : 1 + t ≤ 1) + linarith + simp only [slowFromRest, hn, ite_true, slowVelocity, reparametrizedVelocity, + logClock, hzero _ hl x, smul_zero] + · simp only [slowFromRest, hn, ite_false, slowVelocity, reparametrizedVelocity, logClock] + +theorem slowFromRest_germ {V : Velocity} + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + {t : ℝ} (ht : -(1 / 2 : ℝ) < t) (x : Space) : + slowFromRest V =ᶠ[𝓝 (t, x)] slowVelocity V := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_gt_nhds ht)] with y hy + exact slowFromRest_eq_near_nonnegative hzero hy y.2 + +theorem slowForce_residual_near_nonnegative (ν : ℝ) {V : Velocity} + {t : ℝ} (ht : -1 < t) (x : Space) + (hV : DifferentiableAt ℝ (fun s => V (s, x)) (logClock t)) : + slowForce ν V (t, x) = residual ν (slowVelocity V) (t, x) := by + have hp : 1 + t ≠ 0 := by linarith + have hτ : HasDerivAt logClock ((1 + t)⁻¹) t := by + change HasDerivAt (fun s : ℝ => Real.log (1 + s)) ((1 + t)⁻¹) t + simpa only [one_div, id_eq] using ((hasDerivAt_id t).const_add 1).log hp + have ha : HasDerivAt (fun s : ℝ => (1 + s)⁻¹) (-((1 + t)⁻¹ ^ 2)) t := by + convert ((hasDerivAt_id t).const_add 1).inv hp using 1 <;> + simp [one_div, inv_pow, neg_div] + rfl + rw [slowVelocity, residual_reparametrization ν hτ ha x hV] + simp only [slowForce, quadraticPhase, viscousPhase, logarithmicProfile, + logClock, pow_one, smul_sub, smul_add, neg_smul] + module + +theorem slowFromRest_force_eq {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (ha : ZeroAdvection V) (ν : ℝ) {t : ℝ} (ht : -(1 / 2 : ℝ) < t) (x : Space) : + force ν (slowFromRest V) (t, x) = slowForce ν V (t, x) := by + rw [force_congr_germ (slowFromRest_germ hzero ht x) ν, + slowForce_residual_near_nonnegative ν (by linarith) x + ((hV.comp (contDiff_id.prodMk contDiff_const)).differentiable (by simp) _)] + have hadv : advection (fun z => slowVelocity V (t, z)) x = 0 := by + change advection (fun z => (1 + t)⁻¹ • V (logClock t, z)) x = 0 + rw [advection_smul, ha, smul_zero] + simp only [force, residual, hadv, add_zero] + +theorem slowFromRest_force_spatial_time_decay {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) (ν : ℝ) + (α : List (Fin 3)) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => spatialWord α + (fun y => force ν (slowFromRest V) (s, y)) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n) := by + obtain ⟨C, hC, hbound⟩ := bounded_slowForce_spatial_time_decay ν hV hb ha α n + refine ⟨C, hC, fun x t ht => ?_⟩ + have he : (fun s => spatialWord α (fun y => force ν (slowFromRest V) (s, y)) x) + =ᶠ[𝓝 t] fun s => spatialWord α (fun y => slowForce ν V (s, y)) x := by + filter_upwards [eventually_gt_nhds (show -(1 / 2 : ℝ) < t by linarith)] with s hs + have hf : (fun y => force ν (slowFromRest V) (s, y)) = fun y => slowForce ν V (s, y) := + funext (slowFromRest_force_eq hV hzero ha ν hs) + rw [hf] + rw [he.iteratedDeriv_eq n] + exact hbound x t ht + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForceBalls.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForceBalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5c19729c50589dbf9871fe1670f94604ad9037f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowForceBalls.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ClockNames +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.PhaseBalls +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowDerivativeFormula + +namespace OAI + +/-! Certified rational balls for the quadratic and viscous phase fields. +All oracle calls go to derivatives of the original finite two-table program. -/ + +namespace ForcedComputation +open ShearFlows +open scoped ContDiff BigOperators + +theorem iteratedDeriv_spatialPhase_eq_mixed {V : Velocity} (hV : ContDiff ℝ ∞ V) + (k : ℕ) (β : List (Fin 3)) (t : ℝ) (x : Space) : + iteratedDeriv k (fun s => spatialPhase V β (s, x)) t = + mixedDerivative V (List.replicate k 0 ++ β.map Fin.succ) (t, x) := by + change iteratedDeriv k (fun s => spatialWord β (fun y => V (s, y)) x) t = _ + exact (mixedDerivative_time_spatial hV k β t x).symm + +def initializedVelocityBalls (loader body : Input) (hl : ValidInput loader) + (hb : ValidInput body) (b : ℕ → RationalSpaceTime) (α : List (Fin 4)) + (N : ℕ) (j : Fin 3) : QBall := + vectorNameBall (initializedVelocityName loader body hl hb α b) N j + +def quadraticPhaseBalls (loader body : Input) (hl : ValidInput loader) + (hb : ValidInput body) (b : ℕ → RationalSpaceTime) (β : List (Fin 3)) + (k N : ℕ) (j : Fin 3) : QBall := + letI := ShearFlows.neZeroFour + let α := List.replicate k 0 ++ β.map Fin.succ + (initializedVelocityBalls loader body hl hb b (α ++ [0]) N j).add + ((QBall.exact (-1)).mul (initializedVelocityBalls loader body hl hb b α N j)) + +def viscousPhaseBalls (loader body : Input) (hl : ValidInput loader) + (hb : ValidInput body) (b : ℕ → RationalSpaceTime) (β : List (Fin 3)) + (k N : ℕ) (j : Fin 3) : QBall := + letI := ShearFlows.neZeroFour + letI := ShearFlows.neZeroThree + let α := List.replicate k 0 ++ β.map Fin.succ + let a := fun i : Fin 3 => + initializedVelocityBalls loader body hl hb b (α ++ [i.succ, i.succ]) N j + ((a 0).add (a 1)).add (a 2) + +theorem initializedVelocityBalls_contains {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (α : List (Fin 4)) (N : ℕ) (j : Fin 3) : + (initializedVelocityBalls loader body hl hb b α N j).Contains + (mixedDerivative (initializedProgram loader body) α y j) := + vectorNameBall_contains (initializedVelocityName_spec hl hb α hy) N j + +theorem initializedVelocityBalls_converges {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (α : List (Fin 4)) (j : Fin 3) : + QBall.Converges (fun N => initializedVelocityBalls loader body hl hb b α N j) + (mixedDerivative (initializedProgram loader body) α y j) := + vectorNameBall_converges (initializedVelocityName_spec hl hb α hy) j + +theorem quadraticPhaseBalls_contains {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (β : List (Fin 3)) (k N : ℕ) (j : Fin 3) : + (quadraticPhaseBalls loader body hl hb b β k N j).Contains + (iteratedDeriv k (fun s => spatialPhase + (fun z => quadraticPhase (initializedProgram loader body) z.2 z.1) β (s, y.2)) y.1 j) := by + have hs := initializedProgram_smooth hl hb + rw [iteratedDeriv_spatialPhase_eq_mixed (quadraticPhase_smooth hs), + mixedDerivative_quadraticPhase hs (initializedProgram_zero_advection hl hb)] + let α : List (Fin 4) := List.replicate k 0 ++ β.map Fin.succ + have h := QBall.contains_add + (initializedVelocityBalls_contains hl hb hy (α ++ [0]) N j) + (QBall.contains_mul (QBall.contains_exact (-1)) + (initializedVelocityBalls_contains hl hb hy α N j)) + simpa only [quadraticPhaseBalls, Pi.sub_apply, Rat.cast_neg, Rat.cast_one, + neg_one_mul, sub_eq_add_neg] using h + +theorem quadraticPhaseBalls_converges {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (β : List (Fin 3)) (k : ℕ) (j : Fin 3) : + QBall.Converges (fun N => quadraticPhaseBalls loader body hl hb b β k N j) + (iteratedDeriv k (fun s => spatialPhase + (fun z => quadraticPhase (initializedProgram loader body) z.2 z.1) β (s, y.2)) y.1 j) := by + have hs := initializedProgram_smooth hl hb + rw [iteratedDeriv_spatialPhase_eq_mixed (quadraticPhase_smooth hs), + mixedDerivative_quadraticPhase hs (initializedProgram_zero_advection hl hb)] + let α : List (Fin 4) := List.replicate k 0 ++ β.map Fin.succ + have h := (initializedVelocityBalls_converges hl hb hy (α ++ [0]) j).add + ((QBall.converges_exact (-1)).mul (initializedVelocityBalls_converges hl hb hy α j)) + simpa only [quadraticPhaseBalls, Pi.sub_apply, Rat.cast_neg, Rat.cast_one, + neg_one_mul, sub_eq_add_neg] using h + +theorem viscousPhaseBalls_contains {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (β : List (Fin 3)) (k N : ℕ) (j : Fin 3) : + (viscousPhaseBalls loader body hl hb b β k N j).Contains + (iteratedDeriv k (fun s => spatialPhase + (fun z => viscousPhase (initializedProgram loader body) z.2 z.1) β (s, y.2)) y.1 j) := by + have hs := initializedProgram_smooth hl hb + rw [iteratedDeriv_spatialPhase_eq_mixed (viscousPhase_smooth hs), mixedDerivative_viscousPhase hs] + simp only [Finset.sum_apply, Fin.sum_univ_three] + exact QBall.contains_add (QBall.contains_add + (initializedVelocityBalls_contains hl hb hy _ N j) + (initializedVelocityBalls_contains hl hb hy _ N j)) + (initializedVelocityBalls_contains hl hb hy _ N j) + +theorem viscousPhaseBalls_converges {loader body : Input} (hl : ValidInput loader) + (hb : ValidInput body) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hy : IsFastName b y) (β : List (Fin 3)) (k : ℕ) (j : Fin 3) : + QBall.Converges (fun N => viscousPhaseBalls loader body hl hb b β k N j) + (iteratedDeriv k (fun s => spatialPhase + (fun z => viscousPhase (initializedProgram loader body) z.2 z.1) β (s, y.2)) y.1 j) := by + have hs := initializedProgram_smooth hl hb + rw [iteratedDeriv_spatialPhase_eq_mixed (viscousPhase_smooth hs), mixedDerivative_viscousPhase hs] + simp only [Finset.sum_apply, Fin.sum_univ_three] + exact ((initializedVelocityBalls_converges hl hb hy _ j).add + (initializedVelocityBalls_converges hl hb hy _ j)).add + (initializedVelocityBalls_converges hl hb hy _ j) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowIntegrability.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..afe613f9361470a523c7b7c87401ea2fd1c982da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowIntegrability.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MixedOrdering + +namespace OAI + +/-! Square integrability on the torus follows from the actual inverse-time +bound, for every mixed derivative of the initialized slow force. -/ + +noncomputable section +open Set MeasureTheory +open scoped ContDiff Topology +open ShearFlows + +namespace ForcedComputation + +def TorusMixedL2 (L : ℝ) (F : Velocity) : Prop := + ∀ α, MemLp (mixedDerivative F α) 2 + (volume.restrict (Ici (0 : ℝ) ×ˢ fundamentalCube L)) + +theorem inverse_time_memLp : MemLp (fun t : ℝ => (1 + t)⁻¹) 2 + (volume.restrict (Ici (0 : ℝ))) := by + have hc : ContinuousOn (fun t : ℝ => (1 + t)⁻¹) (Ici (0 : ℝ)) := by + apply ContinuousOn.inv₀ (continuous_const.add continuous_id).continuousOn + intro t ht + change 1 + t ≠ 0 + have ht0 : 0 ≤ t := ht + linarith + apply (memLp_two_iff_integrable_sq (hc.aestronglyMeasurable measurableSet_Ici)).mpr + apply (integrableOn_Ici_iff_integrableOn_Ioi (by finiteness)).mpr + have hi : IntegrableOn (fun t : ℝ => (t + 1) ^ (-2 : ℝ)) (Ioi (0 : ℝ)) := + integrableOn_add_rpow_Ioi_of_lt (by norm_num) (by norm_num) + apply hi.congr_fun _ measurableSet_Ioi + intro t ht + have ht0 : 0 < t := ht + change (t + 1) ^ (-2 : ℝ) = ((1 + t)⁻¹) ^ 2 + rw [Real.rpow_neg (by linarith [ht0] : 0 ≤ t + 1), + show (2 : ℝ) = ((2 : ℕ) : ℝ) from rfl, Real.rpow_natCast, inv_pow, add_comm] + +theorem torus_memLp_of_inverse_bound (L : ℝ) {F : Velocity} (hc : Continuous F) + {C : ℝ} (hb : ∀ t, 0 ≤ t → ∀ x, ‖F (t, x)‖ ≤ C * (1 + t)⁻¹) : + MemLp F 2 (volume.restrict (Ici (0 : ℝ) ×ˢ fundamentalCube L)) := by + let : IsFiniteMeasure (volume.restrict (fundamentalCube L)) := + isFiniteMeasure_restrict.mpr isCompact_Icc.measure_ne_top + have hg := inverse_time_memLp.comp_fst (volume.restrict (fundamentalCube L)) + rw [Measure.prod_restrict] at hg + apply hg.of_le_mul (c := C) hc.aestronglyMeasurable + filter_upwards [ae_restrict_mem (measurableSet_Ici.prod measurableSet_Icc)] with y hy + have ht0 : 0 ≤ y.1 := hy.1 + have hi : 0 ≤ (1 + y.1)⁻¹ := by positivity + simpa only [Real.norm_eq_abs, abs_of_nonneg hi] using hb y.1 ht0 y.2 + +theorem slowFromRest_force_mixed_bound {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) (ν : ℝ) + (α : List (Fin 4)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedDerivative (force ν (slowFromRest V)) α (t, x)‖ ≤ C * (1 + t)⁻¹ := by + have hs := force_smooth (slowFromRest_smooth hV hzero) ν + obtain ⟨n, β, hp⟩ := time_spatial_normal_form α + obtain ⟨C, hC, hbound⟩ := slowFromRest_force_spatial_time_decay hV hzero hb ha ν β n + refine ⟨C, hC, fun t ht x => ?_⟩ + rw [mixedDerivative_perm hs hp, mixedDerivative_time_spatial hs] + apply (hbound x t ht).trans + apply mul_le_mul_of_nonneg_left _ hC + have hp0 : 0 ≤ (1 + t)⁻¹ := by positivity + have hp1 : (1 + t)⁻¹ ≤ 1 := (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + rw [pow_add, pow_one] + exact mul_le_of_le_one_right hp0 (pow_le_one₀ hp0 hp1) + +theorem slowFromRest_force_L2 {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) (ν L : ℝ) : + TorusMixedL2 L (force ν (slowFromRest V)) := by + intro α + obtain ⟨C, _, hC⟩ := slowFromRest_force_mixed_bound hV hzero hb ha ν α + exact torus_memLp_of_inverse_bound L + (mixedDerivative_smooth (force_smooth (slowFromRest_smooth hV hzero) ν) α).continuous hC + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowLoaded.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowLoaded.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d7bb49a2ca54f1dc2f84e88b6942010003acbb8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowLoaded.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LoadedMachine +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowBundle + +namespace OAI + +/-! The slowed computation works at every rational loading point and coding +height used by the fixed-label applications. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Recorder Set +open scoped ContDiff NNReal + +theorem slow_loaded_computation (p : Fin 2 → ℚ) (z : ℚ) + (hp : ∀ j, 1 / 8 ≤ p j ∧ p j ≤ 7 / 8) (hp0 : (p 0 : ℝ) ≤ 1 / 3) + (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + SlowFluidProperties 1 ν (slowFromRest (loadedMachineVelocity p z I hI)) ∧ + ∃ Ψ : ℝ → Space → Space, IsMaterialFlow 1 (slowFromRest (loadedMachineVelocity p z I hI)) Ψ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t (atHeight (fun j => (p j : ℝ)) z) 0 ∧ Ψ t (atHeight (fun j => (p j : ℝ)) z) 0 < 1) := by + let loader := shiftedLoader p (initialPointQ I hI) z + let body := recorderInputAtHeight I.1 hI.1 z + let V := loadedMachineVelocity p z I hI + have hl : ValidInput loader := shiftedLoader_valid _ _ _ + hp (initialPointQ_bounds I hI) + have hb : ValidInput body := recorderInputAtHeight_valid _ _ _ + have hperiod : loader.period = body.period := rfl + have hbodyPeriod : (body.period : ℝ) = 1 := recorderInputAtHeight_period _ _ _ + have hprops := slow_initialized_bundle hl hb hperiod ν hν.le + rw [hbodyPeriod] at hprops + refine ⟨hprops, ?_⟩ + obtain ⟨_, Φ, hΦ, hobs⟩ := loadedMachine_computation p z hp hp0 I hI ν hν + obtain ⟨K, hK⟩ := initializedProgram_spatial_lipschitz hl hb + have hs : ContDiff ℝ ∞ V := initializedProgram_smooth hl hb + have hper : SpatiallyPeriodic 1 V := by + change SpatiallyPeriodic 1 (initializedProgram loader body) + simpa only [hbodyPeriod] using initializedProgram_periodic hperiod + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + obtain ⟨B, hB, hbound⟩ := initializedProgram_bounded hl hb hperiod [] + obtain ⟨Ψ, hΨ⟩ := slowFromRest_materialFlow hs hper hz hK hB hbound + refine ⟨Ψ, hΨ, ?_⟩ + have he := slowFromRest_reaches_iff (fun x => hz 0 (by norm_num) x) hΦ hΨ hK + (atHeight (fun j => (p j : ℝ)) z) {x : Space | 1 / 2 < x 0 ∧ x 0 < 1} + simp only [Reaches, mem_ofPred_eq] at he + have hevent := hobs.trans he.symm + exact hevent + + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2964e26b20fcfc2f7bc0b7f4cf19446250dc6eb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowProgram.lean @@ -0,0 +1,188 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.InitializedFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.LogarithmicSpatialForce +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.StageFlow + +namespace OAI + +/-! The logarithmic slowdown is extended smoothly through all negative times. +The given zero collar removes the apparent singularity of the logarithm. -/ + +noncomputable section +open Set Filter +open scoped ContDiff Topology NNReal +open ShearFlows + +namespace ForcedComputation + +def slowFromRest (V : Velocity) : Velocity := fun y => + if y.1 ≤ 0 then 0 else (1 + y.1)⁻¹ • V (Real.log (1 + y.1), y.2) + +theorem slowFromRest_before (V : Velocity) {t : ℝ} (ht : t ≤ 0) (x : Space) : + slowFromRest V (t, x) = 0 := by simp only [slowFromRest, ht, ite_true] + +theorem slowFromRest_eq {V : Velocity} (hzero : ∀ x, V (0, x) = 0) + {t : ℝ} (ht : 0 ≤ t) (x : Space) : slowFromRest V (t, x) = slowVelocity V (t, x) := by + by_cases hp : t ≤ 0 + · have he : t = 0 := le_antisymm hp ht + subst t + simp [slowFromRest, slowVelocity, reparametrizedVelocity, logClock, hzero] + · simp only [slowFromRest, hp, ite_false, slowVelocity, reparametrizedVelocity, logClock] + +theorem slowFromRest_zero_collar {V : Velocity} + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + {t : ℝ} (ht : t < (1 / 64 : ℝ)) (x : Space) : slowFromRest V (t, x) = 0 := by + by_cases hn : t ≤ 0 + · exact slowFromRest_before V hn x + · have hp : 0 < 1 + t := by linarith + have hl : Real.log (1 + t) < (1 / 32 : ℝ) := by + have h := Real.log_le_sub_one_of_pos hp + linarith + simp only [slowFromRest, hn, ite_false, hzero _ hl x, smul_zero] + +theorem slowFromRest_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) : + ContDiff ℝ ∞ (slowFromRest V) := by + rw [contDiff_iff_contDiffAt] + intro y + by_cases hn : y.1 < (1 / 64 : ℝ) + · apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : SpaceTime => (0 : Space)) y).congr_of_eventuallyEq + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_lt_nhds hn)] with z hz + exact slowFromRest_zero_collar hzero hz z.2 + · have hp : 0 < y.1 := by linarith + have harg : 1 + y.1 ≠ 0 := by linarith + have ha : ContDiffAt ℝ ∞ (fun z : SpaceTime => (1 + z.1)⁻¹) y := + (contDiffAt_const.add contDiffAt_fst).inv harg + have hc : ContDiffAt ℝ ∞ (fun z : SpaceTime => (Real.log (1 + z.1), z.2)) y := + ((Real.contDiffAt_log.mpr harg).comp y (contDiffAt_const.add contDiffAt_fst)).prodMk + contDiffAt_snd + apply (ha.smul (hV.contDiffAt.comp y hc)).congr_of_eventuallyEq + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_gt_nhds hp)] with z hz + exact ite_eq_right (not_le.mpr hz) + +theorem slowFromRest_periodic {L : ℝ} {V : Velocity} (hV : SpatiallyPeriodic L V) : + SpatiallyPeriodic L (slowFromRest V) := by + intro t x n + by_cases ht : t ≤ 0 + · simp only [slowFromRest, ht, ite_true] + · simp only [slowFromRest, ht, ite_false] + rw [hV] + +theorem slowFromRest_solenoidal {V : Velocity} (hV : Solenoidal V) : + Solenoidal (slowFromRest V) := by + intro t x + by_cases ht : t ≤ 0 + · simp only [slowFromRest, ht, ite_true] + simp [divergence, derivative] + · simp only [slowFromRest, ht, ite_false] + rw [divergence_smul, hV, mul_zero] + +theorem slowFromRest_zero_advection {V : Velocity} (hV : ZeroAdvection V) : + ZeroAdvection (slowFromRest V) := by + intro t x + by_cases ht : t ≤ 0 + · simp only [slowFromRest, ht, ite_true] + simp [advection] + · simp only [slowFromRest, ht, ite_false] + rw [advection_smul, hV, smul_zero] + +theorem slowFromRest_mean_zero {L : ℝ} {V : Velocity} (hV : HasZeroMean L V) : + HasZeroMean L (slowFromRest V) := by + intro t + by_cases ht : t ≤ 0 + · simp only [slowFromRest, ht, ite_true] + simp + · simp only [slowFromRest, ht, ite_false] + rw [MeasureTheory.integral_smul, hV, smul_zero] + +theorem slowFromRest_solution {V : Velocity} {L : ℝ} + (hV : ContDiff ℝ ∞ V) (hper : SpatiallyPeriodic L V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hdiv : Solenoidal V) (hadv : ZeroAdvection V) (ν : ℝ) : + IsClassicalSolution L ν (force ν (slowFromRest V)) (slowFromRest V) (fun _ => 0) := + velocity_solves_forced_NS (slowFromRest_smooth hV hzero) + (slowFromRest_periodic hper) (slowFromRest_solenoidal hdiv) + (slowFromRest_zero_advection hadv) (slowFromRest_before V le_rfl) ν + +theorem slowFromRest_uniform_bound {V : Velocity} {B : ℝ} (hB : 0 ≤ B) + (hb : ∀ y, ‖V y‖ ≤ B) (y : SpaceTime) : ‖slowFromRest V y‖ ≤ B := by + by_cases ht : y.1 ≤ 0 + · simpa only [slowFromRest, ht, ite_true, norm_zero] using hB + · have hp : 0 < 1 + y.1 := by linarith + have hi : (1 + y.1)⁻¹ ≤ 1 := (inv_le_one₀ hp).mpr (by linarith) + simp only [slowFromRest, ht, ite_false, norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hp)] + exact (mul_le_mul_of_nonneg_left (hb _) (inv_pos.mpr hp).le).trans + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hi hB) + +theorem slowFromRest_lipschitz {V : Velocity} {K : ℝ≥0} + (hK : ∀ t, LipschitzWith K (fun x => V (t, x))) (t : ℝ) : + LipschitzWith K (fun x => slowFromRest V (t, x)) := by + by_cases ht : t ≤ 0 + · have he : (fun x => slowFromRest V (t, x)) = fun _ => 0 := + funext (slowFromRest_before V ht) + rw [he] + exact (LipschitzWith.const (0 : Space)).weaken (zero_le) + · have hp : 0 < 1 + t := by linarith + have hi : (1 + t)⁻¹ ≤ 1 := (inv_le_one₀ hp).mpr (by linarith) + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [slowFromRest, ht, ite_false, dist_eq_norm, ← smul_sub, norm_smul, + Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hp)] + calc + _ ≤ 1 * ‖V (Real.log (1 + t), x) - V (Real.log (1 + t), y)‖ := + mul_le_mul_of_nonneg_right hi (norm_nonneg _) + _ ≤ (K : ℝ) * ‖x - y‖ := by + simpa only [one_mul, dist_eq_norm] using (hK (Real.log (1 + t))).dist_le_mul x y + +theorem slowFromRest_materialFlow {V : Velocity} {L : ℝ} + (hV : ContDiff ℝ ∞ V) (hper : SpatiallyPeriodic L V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + {K : ℝ≥0} (hK : ∀ t, LipschitzWith K (fun x => V (t, x))) + {B : ℝ} (hB : 0 ≤ B) (hb : ∀ y, ‖V y‖ ≤ B) : + ∃ Φ : ℝ → Space → Space, IsMaterialFlow L (slowFromRest V) Φ := by + exact exists_materialFlow_of_bounded_lipschitz (B := ⟨B, hB⟩) + (slowFromRest_lipschitz hK) + (fun x => (slowFromRest_smooth hV hzero).continuous.comp + (continuous_id.prodMk continuous_const)) + (fun t x => slowFromRest_uniform_bound hB hb (t, x)) (slowFromRest_periodic hper) + +theorem slowFromRest_trace {V : Velocity} {L : ℝ} + (hzero : ∀ x, V (0, x) = 0) + {Φ Ψ : ℝ → Space → Space} (hΦ : IsMaterialFlow L V Φ) + (hΨ : IsMaterialFlow L (slowFromRest V) Ψ) + {K : ℝ≥0} (hK : ∀ t, LipschitzWith K (fun x => slowFromRest V (t, x))) + (x : Space) {t : ℝ} (ht : 0 ≤ t) : Ψ t x = Φ (logClock t) x := by + have hc : ContinuousOn (fun s => Φ (logClock s) x) (Icc 0 t) := by + apply (continuous_iff_continuousAt.mpr (fun s => (hΦ.ode s x).continuousAt)).comp_continuousOn + apply ContinuousOn.log + · fun_prop + · intro s hs + linarith [hs.1] + apply hΨ.eqOn_of_candidate hK x (fun s => Φ (logClock s) x) hc + (by simp only [logClock, add_zero, Real.log_one, hΦ.initial, hΨ.initial]) ?_ ⟨ht, le_rfl⟩ + intro s hs + rw [slowFromRest_eq hzero hs.1] + have hd := (hΦ.ode (logClock s) x).scomp s (logClock_hasDerivAt hs.1) + simpa only [Function.comp_def, one_div, slowVelocity, reparametrizedVelocity] using hd + +theorem slowFromRest_reaches_iff {V : Velocity} {L : ℝ} + (hzero : ∀ x, V (0, x) = 0) + {Φ Ψ : ℝ → Space → Space} (hΦ : IsMaterialFlow L V Φ) + (hΨ : IsMaterialFlow L (slowFromRest V) Ψ) + {K : ℝ≥0} (hK : ∀ t, LipschitzWith K (fun x => V (t, x))) + (x : Space) (O : Set Space) : + Reaches (fun t => Ψ t x) O ↔ Reaches (fun t => Φ t x) O := by + have he : Reaches (fun t => Ψ t x) O ↔ Reaches ((fun t => Φ t x) ∘ logClock) O := by + constructor <;> rintro ⟨t, ht, hx⟩ <;> refine ⟨t, ht, ?_⟩ + · change Ψ t x ∈ O at hx + change Φ (logClock t) x ∈ O + rwa [slowFromRest_trace hzero hΦ hΨ (slowFromRest_lipschitz hK) x ht] at hx + · change Φ (logClock t) x ∈ O at hx + change Ψ t x ∈ O + rwa [slowFromRest_trace hzero hΦ hΨ (slowFromRest_lipschitz hK) x ht] + exact he.trans (logClock_reaches_iff _ _) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowTail.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..d187adb6b001f3fcfb97c63a70b529bbd100b699 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowTail.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowForce + +namespace OAI + +/-! After the finite loading interval, the slowed mechanism uses only the +machine's periodic table. This statement concerns the actual force as well. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Filter +open scoped Topology + +theorem slow_initialized_tail (loader body : Input) (ν : ℝ) + {t : ℝ} (ht : Real.exp 1 - 1 ≤ t) (x : Space) : + slowFromRest (initializedProgram loader body) (t, x) = + slowVelocity body.realizingVelocity (t, x) ∧ + force ν (slowFromRest (initializedProgram loader body)) (t, x) = + force ν (slowVelocity body.realizingVelocity) (t, x) := by + have he : 1 < Real.exp (1 : ℝ) := by + exact Real.one_lt_exp_iff.mpr (by norm_num) + have hp : 0 < t := by linarith + have hlog : (1 : ℝ) ≤ logClock t := by + apply (Real.le_log_iff_exp_le (show 0 < 1 + t by linarith)).mpr + linarith + have hc : ContinuousAt (fun y : SpaceTime => logClock y.1) (t, x) := by + have hb : ContinuousAt (fun y : SpaceTime => 1 + y.1) (t, x) := + continuousAt_const.add continuousAt_fst + exact (Real.continuousAt_log (by linarith : 1 + t ≠ 0)).comp + (f := fun y : SpaceTime => 1 + y.1) (x := (t, x)) hb + have hg : slowFromRest (initializedProgram loader body) =ᶠ[𝓝 (t, x)] + slowVelocity body.realizingVelocity := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_gt_nhds hp), + hc.eventually (eventually_gt_nhds (show 1 - (1 / 32 : ℝ) < logClock t by linarith))] + with y hy hly + change (if y.1 ≤ 0 then 0 else (1 + y.1)⁻¹ • + initializedProgram loader body (logClock y.1, y.2)) = + (1 + y.1)⁻¹ • body.realizingVelocity (logClock y.1, y.2) + rw [ite_eq_right (not_le.mpr hy), initializedProgram_tail_extend loader body hly] + exact ⟨hg.self_of_nhds, force_congr_germ hg ν⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowVelocityBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowVelocityBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6857175c336e44629f38217bdef545e103ad4fe4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SlowVelocityBounds.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowIntegrability + +namespace OAI + +/-! Uniform-in-space, square-integrable-in-time bounds for both the slowed +velocity and its force. These imply the time-supremum norm bounds in the +fixed-particle theorem, not just space-time integrability. -/ + +noncomputable section +open Set Filter MeasureTheory +open scoped Topology ContDiff +open ShearFlows + +namespace ForcedComputation + +def UniformMixedL2 (V : Velocity) : Prop := + letI := ShearFlows.twoAtLeastTwo + ∀ α, ∃ g : ℝ → ℝ, MemLp g 2 (volume.restrict (Ici (0 : ℝ))) ∧ + (∃ C : ℝ, ∀ t, 0 ≤ t → g t ≤ C) ∧ + ∀ t, 0 ≤ t → ∀ x, ‖mixedDerivative V α (t, x)‖ ≤ g t + +theorem uniformMixedL2_of_inverse_bound {V : Velocity} + (h : ∀ α, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedDerivative V α (t, x)‖ ≤ C * (1 + t)⁻¹) : UniformMixedL2 V := by + intro α + obtain ⟨C, hC, hbound⟩ := h α + refine ⟨fun t => C * (1 + t)⁻¹, inverse_time_memLp.const_mul C, ⟨C, ?_⟩, hbound⟩ + intro t ht + have hi : (1 + t)⁻¹ ≤ 1 := (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + simpa only [mul_one] using mul_le_mul_of_nonneg_left hi hC + +theorem slowFromRest_spatial_time_decay {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (α : List (Fin 3)) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => spatialWord α + (fun y => slowFromRest V (s, y)) x) t‖ ≤ C * (1 + t)⁻¹ ^ (1 + n) := by + obtain ⟨C, hC, hbound⟩ := bounded_profile_mixed_decay hV hb 1 n α + refine ⟨C, hC, fun x t ht => ?_⟩ + have he : (fun s => spatialWord α (fun y => slowFromRest V (s, y)) x) + =ᶠ[𝓝 t] fun s => spatialWord α + (fun y => logarithmicProfile 1 (fun q => V (q, y)) s) x := by + filter_upwards [eventually_gt_nhds (show -(1 / 2 : ℝ) < t by linarith)] with s hs + have hf : (fun y => slowFromRest V (s, y)) = + fun y => logarithmicProfile 1 (fun q => V (q, y)) s := by + funext y + rw [slowFromRest_eq_near_nonnegative hzero hs] + simp only [slowVelocity, reparametrizedVelocity, logarithmicProfile, logClock, pow_one] + rw [hf] + rw [he.iteratedDeriv_eq n] + exact hbound x t ht + +theorem slowFromRest_mixed_bound {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (α : List (Fin 4)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedDerivative (slowFromRest V) α (t, x)‖ ≤ C * (1 + t)⁻¹ := by + have hs := slowFromRest_smooth hV hzero + obtain ⟨n, β, hp⟩ := time_spatial_normal_form α + obtain ⟨C, hC, hbound⟩ := slowFromRest_spatial_time_decay hV hzero hb β n + refine ⟨C, hC, fun t ht x => ?_⟩ + rw [mixedDerivative_perm hs hp, mixedDerivative_time_spatial hs] + apply (hbound x t ht).trans + apply mul_le_mul_of_nonneg_left _ hC + have hp0 : 0 ≤ (1 + t)⁻¹ := by positivity + have hp1 : (1 + t)⁻¹ ≤ 1 := (inv_le_one₀ (by linarith : 0 < 1 + t)).mpr (by linarith) + rw [pow_add, pow_one] + exact mul_le_of_le_one_right hp0 (pow_le_one₀ hp0 hp1) + +theorem slowFromRest_uniformMixedL2 {V : Velocity} (hV : ContDiff ℝ ∞ V) + (hzero : ∀ t, t < (1 / 32 : ℝ) → ∀ x, V (t, x) = 0) + (hb : BoundedMixedDerivatives V) (ha : ZeroAdvection V) (ν : ℝ) : + UniformMixedL2 (slowFromRest V) ∧ UniformMixedL2 (force ν (slowFromRest V)) := + ⟨uniformMixedL2_of_inverse_bound (slowFromRest_mixed_bound hV hzero hb), + uniformMixedL2_of_inverse_bound (slowFromRest_force_mixed_bound hV hzero hb ha ν)⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SmallTranslation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SmallTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e73982035d5f2705349f67f91b560b1da224812 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/SmallTranslation.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RationalLoader +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Subprogram + +namespace OAI + +/-! A translation can be inserted at any sufficiently small rational scale +inside the existing processor chart. -/ + +namespace ForcedComputation +open ShearFlows + +def translationInstruction (p q : Fin 2 → ℚ) (r : ℚ) : Instruction := + ⟨centeredBox p r, centeredBox q r, 1⟩ + +theorem translationInstruction_image (p q : Fin 2 → ℚ) (r : ℚ) : + (translationInstruction p q r).affine '' (translationInstruction p q r).source.carrier = + (translationInstruction p q r).target.carrier := by + apply Instruction.image_eq_of_halfWidths _ (by norm_num [translationInstruction]) + · simp only [translationInstruction, centeredBox_halfWidth, Rat.cast_one, one_mul] + · simp only [translationInstruction, centeredBox_halfWidth, Rat.cast_one, div_one] + +theorem translationInstruction_singleton_valid {d : Input} (hd : ValidInput d) + (p q : Fin 2 → ℚ) {r : ℚ} (hr : 0 < r) (hrh : r ≤ d.h) + (hp : (fun j => (p j : ℝ)) ∈ d.centers.carrier) + (hq : (fun j => (q j : ℝ)) ∈ d.centers.carrier) : + ValidInput (d.withInstructions [translationInstruction p q r]) := by + have hrr : (0 : ℝ) < r := by exact_mod_cast hr + have hrhr : (r : ℝ) ≤ d.h := by exact_mod_cast hrh + have hpbox (a : Fin 2 → ℚ) : (centeredBox a r).positive := by + intro j + change a j - r < a j + r + linarith + have hin (a : Fin 2 → ℚ) (ha : (fun j => (a j : ℝ)) ∈ d.centers.carrier) : + (centeredBox a r).carrier ⊆ d.inPlanarChart := by + intro x hx j + have hj := hx j + change ((a j - r : ℚ) : ℝ) ≤ x j ∧ x j ≤ ((a j + r : ℚ) : ℝ) at hj + simp only [Rat.cast_sub, Rat.cast_add] at hj + have hm := hd.chartMargin j + change (d.chart.lower j.castSucc : ℝ) < x j ∧ x j < (d.chart.upper j.castSucc : ℝ) + constructor <;> linarith [(ha j).1, (ha j).2, hm.1, hm.2] + have hc (a : Fin 2 → ℚ) : (centeredBox a r).center = fun j => (a j : ℝ) := by + funext j + exact centeredBox_center a r j + refine { + period_pos := hd.period_pos + chart_positive := hd.chart_positive + chart_length := hd.chart_length + h_pos := hd.h_pos + centers_nonempty := hd.centers_nonempty + chartMargin := hd.chartMargin + height_inside := hd.height_inside + source_positive := ?_ + target_positive := ?_ + source_in_chart := ?_ + target_in_chart := ?_ + factor_pos := ?_ + image_eq := ?_ + source_separation := ?_ + target_separation := ?_ + halfWidths := ?_ + source_centers := ?_ + target_centers := ?_ } + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact hpbox p + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact hpbox q + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact hin p hp + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact hin q hq + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + norm_num [translationInstruction] + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact translationInstruction_image p q r + · intro i j hij + change Fin 1 at i j + exact False.elim (hij (Subsingleton.elim i j)) + · intro i j hij + change Fin 1 at i j + exact False.elim (hij (Subsingleton.elim i j)) + · intro b hb j + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + simpa only [translationInstruction, centeredBox_halfWidth, Input.withInstructions] + using And.intro hrhr hrhr + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact (hc p).symm ▸ hp + · intro b hb + have he : b = translationInstruction p q r := List.mem_singleton.mp hb + subst b + exact (hc q).symm ▸ hq + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupClock.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..8939c866e30d10f2d5926718039c780efec81514 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupClock.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.Reparametrization + +namespace OAI + +/-! +# A startup ramp has an onto accumulated clock + +This supplies the time-change argument in the eventually stationary forcing +construction. Nonnegativity controls the initial interval; the constant tail +ensures that every finite computational time is reached. +-/ + +noncomputable section + +open Set +open scoped ContDiff + +namespace ForcedComputation + +def accumulatedClock (α : ℝ → ℝ) (t : ℝ) : ℝ := ∫ s in 0..t, α s + +theorem accumulatedClock_zero (α : ℝ → ℝ) : accumulatedClock α 0 = 0 := by + simp [accumulatedClock] + +theorem accumulatedClock_hasDerivAt {α : ℝ → ℝ} (hα : Continuous α) (t : ℝ) : + HasDerivAt (accumulatedClock α) (α t) t := + intervalIntegral.integral_hasDerivAt_right (hα.intervalIntegrable _ _) + hα.aestronglyMeasurable.stronglyMeasurableAtFilter hα.continuousAt + +theorem accumulatedClock_nonneg {α : ℝ → ℝ} + (hα : ∀ t, 0 ≤ t → 0 ≤ α t) {t : ℝ} (ht : 0 ≤ t) : + 0 ≤ accumulatedClock α t := + intervalIntegral.integral_nonneg ht (fun s hs => hα s hs.1) + +theorem accumulatedClock_tail {α : ℝ → ℝ} (hα : Continuous α) + (htail : ∀ t, 1 ≤ t → α t = 1) {t : ℝ} (ht : 1 ≤ t) : + accumulatedClock α t = accumulatedClock α 1 + (t - 1) := by + unfold accumulatedClock + rw [← intervalIntegral.integral_add_adjacent_intervals + (hα.intervalIntegrable 0 1) (hα.intervalIntegrable 1 t)] + congr 1 + calc + (∫ s in (1 : ℝ)..t, α s) = ∫ _s in (1 : ℝ)..t, (1 : ℝ) := by + apply intervalIntegral.integral_congr + intro s hs + rw [uIcc_of_le ht] at hs + exact htail s hs.1 + _ = t - 1 := by simp + +theorem accumulatedClock_onto {α : ℝ → ℝ} (hα : Continuous α) + (hnonneg : ∀ t, 0 ≤ t → 0 ≤ α t) (htail : ∀ t, 1 ≤ t → α t = 1) : + OntoClock (accumulatedClock α) := by + refine ⟨fun _ ht => accumulatedClock_nonneg hnonneg ht, ?_⟩ + intro s hs + have hc : Continuous (accumulatedClock α) := + (show Differentiable ℝ (accumulatedClock α) from + fun t => (accumulatedClock_hasDerivAt hα t).differentiableAt).continuous + have hb : s ≤ accumulatedClock α (s + 1) := by + rw [accumulatedClock_tail hα htail (by linarith)] + have hzero := accumulatedClock_nonneg hnonneg (show (0 : ℝ) ≤ 1 by norm_num) + linarith + obtain ⟨t, ht, he⟩ := intermediate_value_Icc (show (0 : ℝ) ≤ s + 1 by linarith) + hc.continuousOn (show s ∈ Icc (accumulatedClock α 0) + (accumulatedClock α (s + 1)) by rw [accumulatedClock_zero]; exact ⟨hs, hb⟩) + exact ⟨t, ht.1, he⟩ + +/-- A completely specified fixed startup, zero until time `1/2` and one from time `1`. -/ +def startupRamp (t : ℝ) : ℝ := Real.smoothTransition (2 * t - 1) + +theorem startupRamp_smooth : ContDiff ℝ ∞ startupRamp := by + exact Real.smoothTransition.contDiff.comp ((contDiff_const.mul contDiff_id).sub contDiff_const) + +theorem startupRamp_zero : startupRamp 0 = 0 := by + apply Real.smoothTransition.zero_of_nonpos + norm_num + +theorem startupRamp_nonneg (t : ℝ) : 0 ≤ startupRamp t := + Real.smoothTransition.nonneg _ + +theorem startupRamp_tail {t : ℝ} (ht : 1 ≤ t) : startupRamp t = 1 := by + apply Real.smoothTransition.one_of_one_le + linarith + +theorem startupClock_onto : OntoClock (accumulatedClock startupRamp) := + accumulatedClock_onto startupRamp_smooth.continuous + (fun t _ => startupRamp_nonneg t) (fun _ ht => startupRamp_tail ht) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupEffective.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupEffective.lean new file mode 100644 index 0000000000000000000000000000000000000000..254d895585417edd5248db811d7f90beb66f4434 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StartupEffective.lean @@ -0,0 +1,215 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ResidualExpressions +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ForceGerm +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBounds + +namespace OAI + +/-! Effective startup of an autonomous finite field expression. A fixed +three-region selector uses a finite transition expression near startup and +the autonomous expression on the entire late-time tail. -/ + +namespace ForcedComputation +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem residual_congr_germ {U V : Velocity} {t : ℝ} {x : Space} + (he : U =ᶠ[𝓝 (t, x)] V) (ν : ℝ) : residual ν U (t, x) = residual ν V (t, x) := by + have hx : (fun z => U (t, z)) =ᶠ[𝓝 x] fun z => V (t, z) := + he.comp_tendsto (continuous_const.prodMk continuous_id).continuousAt + rw [residual_eq_force_add, residual_eq_force_add] + change force ν U (t, x) + fderiv ℝ (fun z => U (t, z)) x (U (t, x)) = + force ν V (t, x) + fderiv ℝ (fun z => V (t, z)) x (V (t, x)) + rw [force_congr_germ he ν, hx.fderiv_eq, he.self_of_nhds] + +theorem residual_eventuallyEq {U V : Velocity} {y : SpaceTime} + (he : U =ᶠ[𝓝 y] V) (ν : ℝ) : residual ν U =ᶠ[𝓝 y] residual ν V := by + filter_upwards [eventually_eventually_nhds.mpr he] with z hz + exact residual_congr_germ hz ν + +def startupTransition : PeriodicExpr := PeriodicExpr.cutoff 4 (1/2) 1 (3/2) 2 + +theorem startupTransition_valid : startupTransition.Valid := + PeriodicExpr.cutoff_valid (by norm_num) (by norm_num) (by norm_num) + +theorem startupTransition_val {t : ℝ} (ht : t ∈ Ioo 0 (3/2)) : + startupTransition.val t = startupRamp t := by + have he : startupTransition.val t = closedCutoff (1/2) 1 (3/2) 2 t := by + rw [startupTransition, PeriodicExpr.cutoff_val] + norm_num only [Rat.cast_ofNat, Rat.cast_div] + unfold circleCutoff + apply periodize_eq_in_chart (A := 0) (B := 2) (by norm_num) (by norm_num) + · intro z hz + have hs := closedCutoff_support (by norm_num : (1/2 : ℝ) < 1) + (by norm_num : (3/2 : ℝ) < 2) hz + exact ⟨by linarith [hs.1], hs.2⟩ + · exact ⟨ht.1.le, by linarith [ht.2]⟩ + rw [he, closedCutoff, smoothRamp_after (by norm_num : (-2 : ℝ) < -(3/2)) + (by linarith [ht.2]), mul_one] + unfold smoothRamp startupRamp + congr 1 + ring + +def startupCode (c : VelocityExpr) : VelocityExpr := + letI := ShearFlows.neZeroFour + fun k => + .mul (.atom 0 startupTransition) (c k) + +theorem startupCode_valid {c : VelocityExpr} (hc : c.Valid) : (startupCode c).Valid := + fun k => ⟨startupTransition_valid, hc k⟩ + +theorem startupCode_val {c : VelocityExpr} {W : Space → Space} + (hcW : c.val = fun y => W y.2) {y : SpaceTime} (hy : y.1 ∈ Ioo 0 (3/2)) : + (startupCode c).val y = rampVelocity startupRamp W y := by + have hc := congrFun hcW y + funext k + change startupTransition.val (timeSpaceCoord 0 y) * (c k).val y = _ + rw [show timeSpaceCoord 0 y = y.1 from rfl, startupTransition_val hy] + exact congrArg (fun v : Space => startupRamp y.1 * v k) hc + +def zeroCode : VelocityExpr := fun _ => .const 0 + +theorem zeroCode_valid : zeroCode.Valid := fun _ => trivial + +theorem zeroCode_val : zeroCode.val = fun _ => 0 := by + funext y k + simp [zeroCode, VelocityExpr.val, FieldExpr.val] + +def startupSelectCode (c : VelocityExpr) (b : ℕ → RationalSpaceTime) : VelocityExpr := + if (b 6).1 ≤ 1/4 then zeroCode + else if (b 6).1 ≤ 5/4 then startupCode c else c + +theorem startupSelectCode_valid {c : VelocityExpr} (hc : c.Valid) + (b : ℕ → RationalSpaceTime) : (startupSelectCode c b).Valid := by + unfold startupSelectCode + split + · exact zeroCode_valid + · split + · exact startupCode_valid hc + · exact hc + +theorem startupSelectCode_germ_of_time {c : VelocityExpr} {W : Space → Space} + (hcW : c.val = fun y => W y.2) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (ht : |y.1 - ((b 6).1 : ℝ)| ≤ (1/64 : ℝ)) : + rampVelocity startupRamp W =ᶠ[𝓝 y] (startupSelectCode c b).val := by + unfold startupSelectCode + split + · rename_i hzero + have hq : ((b 6).1 : ℝ) ≤ 1/4 := by + simpa only [Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using (Rat.cast_le (K := ℝ)).mpr hzero + have hy : y.1 < 1/2 := by linarith [(abs_le.mp ht).2] + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_lt_nhds hy)] with z hz + rw [zeroCode_val] + have ha : startupRamp z.1 = 0 := Real.smoothTransition.zero_of_nonpos (by linarith) + simp only [rampVelocity, ha, zero_smul] + · rename_i hzero + split + · rename_i htrans + have hq₀ : (1/4 : ℝ) < (b 6).1 := by + simpa only [Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using (Rat.cast_lt (K := ℝ)).mpr (lt_of_not_ge hzero) + have hq₁ : ((b 6).1 : ℝ) ≤ 5/4 := by + simpa only [Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using (Rat.cast_le (K := ℝ)).mpr htrans + have hy : y.1 ∈ Ioo 0 (3/2) := + ⟨by linarith [(abs_le.mp ht).1], by linarith [(abs_le.mp ht).2]⟩ + filter_upwards [(continuous_fst.tendsto y).eventually (Ioo_mem_nhds hy.1 hy.2)] with z hz + exact (startupCode_val hcW hz).symm + · rename_i htail + have hq : (5/4 : ℝ) < (b 6).1 := by + simpa only [Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] using (Rat.cast_lt (K := ℝ)).mpr (lt_of_not_ge htail) + have hy : 1 < y.1 := by linarith [(abs_le.mp ht).1] + filter_upwards [(continuous_fst.tendsto y).eventually (eventually_gt_nhds hy)] with z hz + rw [hcW] + simp only [rampVelocity, startupRamp_tail hz.le, one_smul] + +theorem startupSelectCode_germ {c : VelocityExpr} {W : Space → Space} + (hcW : c.val = fun y => W y.2) {b : ℕ → RationalSpaceTime} {y : SpaceTime} + (hb : IsFastName b y) : + rampVelocity startupRamp W =ᶠ[𝓝 y] (startupSelectCode c b).val := by + apply startupSelectCode_germ_of_time hcW + have h := (norm_fst_le (y - rationalPoint (b 6))).trans (hb 6) + norm_num [Prod.fst_sub, rationalPoint, Real.norm_eq_abs, errorTolerance] at h + exact h + +def evaluateStartupVelocity (c : VelocityExpr) (hc : c.Valid) (α : List (Fin 4)) + (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + (startupSelectCode c b).evaluate (startupSelectCode_valid hc b) α b ε hε + +theorem evaluateStartupVelocity_spec {c : VelocityExpr} (hc : c.Valid) + {W : Space → Space} (hcW : c.val = fun y => W y.2) (α : List (Fin 4)) + {b : ℕ → RationalSpaceTime} {y : SpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (rampVelocity startupRamp W) α y - + rationalVector (evaluateStartupVelocity c hc α b ε hε)‖ ≤ (ε : ℝ) := by + rw [(mixedDerivative_eventuallyEq (startupSelectCode_germ hcW hb) α).self_of_nhds] + exact VelocityExpr.evaluate_spec (startupSelectCode_valid hc b) α b hb ε hε + +def evaluateStartupForce (c : VelocityExpr) (hc : c.Valid) (α : List (Fin 4)) + (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (ε : ℚ) (hε : 0 < ε) : RationalVector := + ResidualCode.evaluate (startupSelectCode c b) (startupSelectCode_valid hc b) α a b ε hε + +theorem evaluateStartupForce_spec {c : VelocityExpr} (hc : c.Valid) + {W : Space → Space} (hcW : c.val = fun y => W y.2) (α : List (Fin 4)) + {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) + {b : ℕ → RationalSpaceTime} {y : SpaceTime} (hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (residual ν (rampVelocity startupRamp W)) α y - + rationalVector (evaluateStartupForce c hc α a b ε hε)‖ ≤ (ε : ℝ) := by + rw [(mixedDerivative_eventuallyEq + (residual_eventuallyEq (startupSelectCode_germ hcW hb) ν) α).self_of_nhds] + exact ResidualCode.evaluate_spec (startupSelectCode_valid hc b) α ha hb ε hε + +def startupVelocityBound (c : VelocityExpr) (α : List (Fin 4)) : ℕ := + max (zeroCode.bound α) (max ((startupCode c).bound α) (c.bound α)) + +def startupForceBound (c : VelocityExpr) (α : List (Fin 4)) (a : ℕ → ℚ) : ℕ := + max (ResidualCode.bound zeroCode α a) + (max (ResidualCode.bound (startupCode c) α a) (ResidualCode.bound c α a)) + +theorem startupSelectCode_bound_le (c : VelocityExpr) (b : ℕ → RationalSpaceTime) + (α : List (Fin 4)) : (startupSelectCode c b).bound α ≤ startupVelocityBound c α := by + unfold startupSelectCode startupVelocityBound + split + · exact le_max_left _ _ + · split + · exact (le_max_left _ _).trans (le_max_right _ _) + · exact (le_max_right _ _).trans (le_max_right _ _) + +theorem startupSelectCode_forceBound_le (c : VelocityExpr) (b : ℕ → RationalSpaceTime) + (α : List (Fin 4)) (a : ℕ → ℚ) : + ResidualCode.bound (startupSelectCode c b) α a ≤ startupForceBound c α a := by + unfold startupSelectCode startupForceBound + split + · exact le_max_left _ _ + · split + · exact (le_max_left _ _).trans (le_max_right _ _) + · exact (le_max_right _ _).trans (le_max_right _ _) + +theorem exists_startup_time_approximation (y : SpaceTime) : + ∃ b : ℕ → RationalSpaceTime, |y.1 - ((b 6).1 : ℝ)| ≤ (1/64 : ℝ) := by + obtain ⟨q, hq₀, hq₁⟩ := exists_rat_btwn + (show y.1 - (1/64 : ℝ) < y.1 + 1/64 by linarith) + exact ⟨fun _ => (q, 0), abs_le.mpr ⟨by linarith, by linarith⟩⟩ + +theorem startupVelocityBound_spec {c : VelocityExpr} (hc : c.Valid) + {W : Space → Space} (hcW : c.val = fun y => W y.2) + (α : List (Fin 4)) (y : SpaceTime) : + ‖mixedDerivative (rampVelocity startupRamp W) α y‖ ≤ + (startupVelocityBound c α : ℝ) := by + obtain ⟨b, hb⟩ := exists_startup_time_approximation y + rw [(mixedDerivative_eventuallyEq (startupSelectCode_germ_of_time hcW hb) α).self_of_nhds] + exact (VelocityExpr.val_bound (startupSelectCode_valid hc b) α y).trans + (by exact_mod_cast startupSelectCode_bound_le c b α) + +theorem startupForceBound_spec {c : VelocityExpr} (hc : c.Valid) + {W : Space → Space} (hcW : c.val = fun y => W y.2) + (α : List (Fin 4)) {ν : ℝ} {a : ℕ → ℚ} (ha : IsFastRealName a ν) (y : SpaceTime) : + ‖mixedDerivative (residual ν (rampVelocity startupRamp W)) α y‖ ≤ + (startupForceBound c α a : ℝ) := by + obtain ⟨b, hb⟩ := exists_startup_time_approximation y + rw [(mixedDerivative_eventuallyEq + (residual_eventuallyEq (startupSelectCode_germ_of_time hcW hb) ν) α).self_of_nhds] + exact (ResidualCode.bound_spec (startupSelectCode_valid hc b) α ha y).trans + (by exact_mod_cast startupSelectCode_forceBound_le c b α a) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d63f5ac6c4d27df5c2d440da15344b40e8a0a243 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBounds.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.ForceMean + +namespace OAI + +/-! +# Uniform bounds for a smooth startup and its stationary tail + +All mixed derivatives are controlled by one compact transition cylinder and +the periodic stationary tail. The argument works with actual germs of the +fields, so it also controls derivatives across the ends of the transition. +-/ + +noncomputable section +open Set Filter +open scoped ContDiff Topology +open ShearFlows + +namespace ForcedComputation + +theorem mixedDerivative_eventuallyEq {U V : Velocity} {y : SpaceTime} + (h : U =ᶠ[𝓝 y] V) (α : List (Fin 4)) : + mixedDerivative U α =ᶠ[𝓝 y] mixedDerivative V α := by + induction α with + | nil => exact h + | cons j α ih => + exact (ih.fderiv (𝕜 := ℝ)).mono (fun z hz => congrArg (fun A => A (spaceTimeDirection j)) hz) + +theorem mixedDerivative_zero (α : List (Fin 4)) : + mixedDerivative (fun _ : SpaceTime => (0 : Space)) α = fun _ => 0 := by + induction α with + | nil => rfl + | cons j α ih => + simp only [mixedDerivative, ih, fderiv_fun_const] + rfl + +/-- A smooth periodic field which is zero before zero and stationary after +one has globally bounded derivatives of every mixed order. -/ +theorem boundedMixed_of_stationary_tail {L : ℝ} (hL : 0 < L) + {F G : Velocity} (hF : ContDiff ℝ ∞ F) (hG : ContDiff ℝ ∞ G) + (hpF : SpatiallyPeriodic L F) (hpG : SpatiallyPeriodic L G) + (htG : TimePeriodic G) + (hleft : ∀ t, t < 0 → ∀ x, F (t, x) = 0) + (hright : ∀ t, 1 < t → ∀ x, F (t, x) = G (t, x)) : + BoundedMixedDerivatives F := by + intro α + have hk : IsCompact (Icc (0 : ℝ) 1 ×ˢ fundamentalCube L) := + isCompact_Icc.prod isCompact_Icc + obtain ⟨C, hC⟩ := hk.bddAbove_image (mixedDerivative_smooth hF α).continuous.norm.continuousOn + obtain ⟨D, hD, hbD⟩ := periodic_boundedMixedDerivatives hL hG hpG htG α + refine ⟨max C D, le_trans hD (le_max_right _ _), ?_⟩ + rintro ⟨t, x⟩ + by_cases ht0 : t < 0 + · have he : F =ᶠ[𝓝 (t, x)] fun _ => 0 := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_lt_nhds ht0)] with y hy + exact hleft y.1 hy y.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds, mixedDerivative_zero] + simpa only [norm_zero] using le_trans hD (le_max_right C D) + by_cases ht1 : 1 < t + · have he : F =ᶠ[𝓝 (t, x)] G := by + filter_upwards [(continuous_fst.tendsto (t, x)).eventually (eventually_gt_nhds ht1)] with y hy + exact hright y.1 hy y.2 + rw [(mixedDerivative_eventuallyEq he α).self_of_nhds] + exact (hbD (t, x)).trans (le_max_right _ _) + · obtain ⟨z, hz, n, hx⟩ := fundamentalCube_representative hL x + rw [hx, mixedDerivative_spatially_periodic hF hpF] + exact (hC (mem_image_of_mem _ (show (t, z) ∈ Icc (0 : ℝ) 1 ×ˢ fundamentalCube L from + ⟨⟨le_of_not_gt ht0, le_of_not_gt ht1⟩, hz⟩))).trans (le_max_left _ _) + +theorem residual_spatially_periodic {L : ℝ} {V : Velocity} + (hV : ContDiff ℝ ∞ V) (hp : SpatiallyPeriodic L V) (ν : ℝ) : + SpatiallyPeriodic L (residual ν V) := by + intro t x n + have he : residual ν V (t, x + latticeVector L n) = + force ν V (t, x + latticeVector L n) + advection (fun y => V (t, y)) (x + latticeVector L n) := by + unfold residual force + abel + rw [he, force_spatially_periodic hV hp] + unfold residual force advection + dsimp only + have hd := CubePeriodic.fderiv (show CubePeriodic L (fun y => V (t, y)) from hp t) + ((hV.comp (contDiff_const.prodMk contDiff_id)).differentiable (by simp)) + rw [hd x n, hp t x n] + abel + +theorem startup_bounds {L : ℝ} (hL : 0 < L) {W : Space → Space} + (hW : ContDiff ℝ ∞ W) (hp : CubePeriodic L W) (ν : ℝ) : + BoundedMixedDerivatives (rampVelocity startupRamp W) ∧ + BoundedMixedDerivatives (residual ν (rampVelocity startupRamp W)) := by + have hU := ramp_smooth startupRamp_smooth hW + have hpU := ramp_periodic startupRamp hp + let A : Velocity := fun y => W y.2 + have hA : ContDiff ℝ ∞ A := hW.comp contDiff_snd + have hpA : SpatiallyPeriodic L A := fun _ => hp + have htA : TimePeriodic A := fun _ _ => rfl + have hleft : ∀ t, t < 0 → ∀ x, rampVelocity startupRamp W (t, x) = 0 := by + intro t ht x + have ha : startupRamp t = 0 := Real.smoothTransition.zero_of_nonpos (by linarith) + simp only [rampVelocity, ha, zero_smul] + have hright : ∀ t, 1 < t → ∀ x, rampVelocity startupRamp W (t, x) = A (t, x) := by + intro t ht x + simp only [rampVelocity, startupRamp_tail ht.le, one_smul, A] + have hFU := residual_smooth hU ν + have hFA := residual_smooth hA ν + have hpFU := residual_spatially_periodic hU hpU ν + have hpFA := residual_spatially_periodic hA hpA ν + have htFA : TimePeriodic (residual ν A) := by + intro t x + have he : residual ν A = fun y => advection W y.2 - ν • laplacian W y.2 := by + funext y + simp [residual, A, timeDerivative] + rw [he] + refine ⟨boundedMixed_of_stationary_tail hL hU hA hpU hpA htA hleft hright, + boundedMixed_of_stationary_tail hL hFU hFA hpFU hpFA htFA ?_ ?_⟩ + · intro t ht x + have ha : startupRamp =ᶠ[𝓝 t] fun _ => 0 := by + filter_upwards [eventually_lt_nhds ht] with s hs + exact Real.smoothTransition.zero_of_nonpos (by linarith) + have hd : deriv startupRamp t = 0 := + (hasDerivAt_const t (0 : ℝ)).congr_of_eventuallyEq ha |>.deriv + have hz : startupRamp t = 0 := ha.self_of_nhds + rw [residual_ramp ν startupRamp W (startupRamp_smooth.differentiable (by simp) t), hd, hz] + simp + · intro t ht x + rw [residual_ramp_on_tail ν W (fun _ hs => startupRamp_tail hs) ht.le + (startupRamp_smooth.differentiable (by simp) t)] + simp [residual, A, timeDerivative] + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBundle.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBundle.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c468a8474541cf9e84f3be654dd96a087feb643 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryBundle.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryBounds + +namespace OAI + +/-! The complete analytic bundle for a smooth periodic autonomous field +started from rest. The finite planar processor is supplied separately. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set MeasureTheory +open scoped ContDiff + +structure StationaryFluidProperties (L ν : ℝ) (U : Velocity) : Prop where + velocity_smooth : ContDiff ℝ ∞ U + force_smooth : ContDiff ℝ ∞ (residual ν U) + velocity_periodic : SpatiallyPeriodic L U + force_periodic : SpatiallyPeriodic L (residual ν U) + velocity_solenoidal : Solenoidal U + velocity_mean : HasZeroMean L U + force_mean : HasZeroMean L (residual ν U) + velocity_bounds : BoundedMixedDerivatives U + force_bounds : BoundedMixedDerivatives (residual ν U) + energy_bound : ∃ E : ℝ, ∀ t, kineticEnergy L U t ≤ E + velocity_tail : ∀ t, 1 ≤ t → ∀ x, U (t, x) = U (1, x) + force_tail : ∀ t, 1 ≤ t → ∀ x, residual ν U (t, x) = residual ν U (1, x) + solution : IsClassicalSolution L ν (residual ν U) U (fun _ => 0) + unique : ∀ u p, IsClassicalSolution L ν (residual ν U) u p → + ∀ t, 0 ≤ t → ∀ x, u (t, x) = U (t, x) ∧ p (t, x) = 0 + +theorem startup_bundle {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {W : Space → Space} (hW : ContDiff ℝ ∞ W) + (hp : CubePeriodic L W) (hd : ∀ x, divergence W x = 0) + (hm : (∫ x in fundamentalCube L, W x) = 0) : + StationaryFluidProperties L ν (rampVelocity startupRamp W) := by + have hs := ramp_smooth startupRamp_smooth hW + have hsp := ramp_periodic startupRamp hp + have hb := startup_bounds hL hW hp ν + have hsol := startup_solution hW hp hd ν + refine ⟨hs, residual_smooth hs ν, hsp, residual_spatially_periodic hs hsp ν, + ramp_solenoidal startupRamp hd, ?_, startup_force_mean_zero hL.le hW hp hd hm ν, + hb.1, hb.2, startup_energy_bounded hL hW hp, ?_, ?_, hsol.2.2.1, + startup_solution_unique hL hν hW hp hd⟩ + · intro t + change (∫ x in fundamentalCube L, startupRamp t • W x) = 0 + rw [integral_smul, hm, smul_zero] + · intro t ht x + simp only [rampVelocity, startupRamp_tail ht, startupRamp_tail le_rfl, one_smul] + · intro t ht x + rw [hsol.2.2.2 t ht x, hsol.2.2.2 1 le_rfl x] + +/-- Startup preserves the actual autonomous material trajectories, with an +onto nonnegative clock. The statement applies to every chosen particle and +observation set at once. -/ +theorem startup_bundle_with_flow {L ν : ℝ} (hL : 0 < L) (hν : 0 ≤ ν) + {W : Space → Space} (hW : ContDiff ℝ ∞ W) + (hp : CubePeriodic L W) (hd : ∀ x, divergence W x = 0) + (hm : (∫ x in fundamentalCube L, W x) = 0) : + StationaryFluidProperties L ν (rampVelocity startupRamp W) ∧ + ∃ Φ : ℝ → Space → Space, + IsMaterialFlow L (fun y => W y.2) Φ ∧ + IsMaterialFlow L (rampVelocity startupRamp W) + (fun t x => Φ (accumulatedClock startupRamp t) x) ∧ + ∀ x O, Reaches (fun t => Φ (accumulatedClock startupRamp t) x) O ↔ + Reaches (fun t => Φ t x) O := + ⟨startup_bundle hL hν hW hp hd hm, startup_materialFlow hL hW hp⟩ + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3486d994a3a59be52fdeb30a0304815ea4dbc08 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryMain.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.StationaryObservation + +namespace OAI + +/-! The main theorem of Universal Computation with Eventually Stationary +Navier–Stokes Forcing, including a terminating finite force evaluator, +global derivative bounds, and the fixed-particle observation. -/ + +namespace ForcedComputation +open ShearFlows Recorder.Planar + +theorem stationary_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + StationaryFluidProperties 1 ν (stationaryVelocity I hI) ∧ + (∀ (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) (y : SpaceTime) + (_hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (stationaryVelocity I hI) α y - + rationalVector (evaluateStartupVelocity (stationaryCode I hI) + (stationaryCode_valid I hI) α b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) + (b : ℕ → RationalSpaceTime) (y : SpaceTime) (_hb : IsFastName b y) + (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (stationaryForce ν I hI) α y - + rationalVector (evaluateStartupForce (stationaryCode I hI) + (stationaryCode_valid I hI) α a b ε hε)‖ ≤ (ε : ℝ)) ∧ + (∀ (α : List (Fin 4)) (y : SpaceTime), + ‖mixedDerivative (stationaryVelocity I hI) α y‖ ≤ + (startupVelocityBound (stationaryCode I hI) α : ℝ)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (_ha : IsFastRealName a ν) (y : SpaceTime), + ‖mixedDerivative (stationaryForce ν I hI) α y‖ ≤ + (startupForceBound (stationaryCode I hI) α a : ℝ)) ∧ + ∃ Φ : ℝ → Space → Space, IsMaterialFlow 1 (stationaryVelocity I hI) Φ ∧ + (Reaches (fun t => Φ t stationaryStartingPoint) stationaryObserver ↔ Alternating.Halts I) := by + refine ⟨stationary_program_properties I hI ν hν.le, + stationary_velocity_evaluate I hI, stationary_force_evaluate I hI ν, + stationary_velocity_bound I hI, stationary_force_bound I hI ν, ?_⟩ + obtain ⟨Φ, hΦ, hstartup, he⟩ := stationary_program_flows I hI + refine ⟨fun t x => Φ (accumulatedClock startupRamp t) x, hstartup, ?_⟩ + exact (he stationaryStartingPoint stationaryObserver).trans + (stationary_suspension_observation I hI hΦ) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryObservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5478e43a8b2b6aadcae70d38ebb1ab2f8e987f6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryObservation.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedSuspensionRouting +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarDormantZero +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarStepBranch +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.SuspensionObservation + +namespace OAI + +/-! Exact machine steps and all-time nonhalting exclusion for the actual +normalized autonomous suspension. All geometric obligations are proved +from the finite compiler; no routing hypothesis remains in these statements. -/ + +noncomputable section +namespace ForcedComputation.Recorder.Planar +open ShearFlows PlanarRouting Set + +theorem normalized_suspension_step (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hstep : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) : + Φ 1 (atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) 0) = + atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 D)) 1 := by + obtain ⟨b, _, _, hx, he⟩ := step_branch hstep + have h := normalized_branch_suspension I hI b hx hΦ + simpa [normalizedAnchors, branchAnchors_first, branchAnchors_last, he, translatedPoint_eq_shiftPoint] using h.1 + +theorem normalized_suspension_step_safe (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) + {C D : Configuration (State (freshMachine I.1)) (Alphabet (freshMachine I.1))} + (hstep : Step (finiteMachine (freshMachine I.1) (freshInput_valid hI).1) C D) + (hD : recorderHalting (freshMachine I.1) D.control = false) + (s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : + 3 / 16 ≤ Φ s (atHeight (shiftPoint (initialShift (freshInput I) (freshInput_valid hI)) + (point (freshMachine I.1) (freshInput_valid hI).1 C)) 0) 1 := by + obtain ⟨b, _, ht, hx, _⟩ := step_branch hstep + have hn : recorderHalting (freshMachine I.1) b.target = false := by rw [ht]; exact hD + have h := normalized_branch_suspension_safe I hI b hn hx hΦ + simpa [normalizedAnchors, branchAnchors_first, translatedPoint_eq_shiftPoint, horizontal] using (h.2 s hs).2 + +theorem stationary_suspension_observation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) {Φ : ℝ → Space → Space} + (hΦ : IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ) : + Reaches (fun t => Φ t stationaryStartingPoint) stationaryObserver ↔ Alternating.Halts I := by + apply normalized_suspension_observation I hI hΦ + · intro C D hstep + exact normalized_suspension_step I hI hΦ hstep + · intro C D hstep _ hD s hs + exact normalized_suspension_step_safe I hI hΦ hstep hD s hs + +end ForcedComputation.Recorder.Planar + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryProgram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b277ef3384f7a1089cab9b9843a022b9e6b32ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/StationaryProgram.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.NormalizedPlanarProgram +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.HamiltonianStartup + +namespace OAI + +/-! A finite force program for eventually stationary computation, with +analytic properties and terminating derivative evaluation. -/ + +namespace ForcedComputation +open ShearFlows Recorder.Planar + +def stationaryCode (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + VelocityExpr := SpatialExpression.suspensionCode (normalizedHamiltonian I hI) + +theorem stationaryCode_valid (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + (stationaryCode I hI).Valid := + SpatialExpression.suspensionCode_valid (normalizedHamiltonian_valid I hI) + +noncomputable def stationaryVelocity (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := + hamiltonianStartupVelocity (normalizedHamiltonian I hI) + +noncomputable def stationaryForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := residual ν (stationaryVelocity I hI) + +theorem stationary_program_properties (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 ≤ ν) : + StationaryFluidProperties 1 ν (stationaryVelocity I hI) := + (hamiltonian_startup_effective (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI) (normalizedHamiltonian_periodic I hI) hν).1 + +theorem stationary_velocity_evaluate (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (α : List (Fin 4)) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (stationaryVelocity I hI) α y - + rationalVector (evaluateStartupVelocity (stationaryCode I hI) + (stationaryCode_valid I hI) α b ε hε)‖ ≤ (ε : ℝ) := + evaluateStartupVelocity_spec (stationaryCode_valid I hI) + (SpatialExpression.suspensionCode_val (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI)) α hb ε hε + +theorem stationary_force_evaluate (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (α : List (Fin 4)) + (a : ℕ → ℚ) (ha : IsFastRealName a ν) (b : ℕ → RationalSpaceTime) + (y : SpaceTime) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε) : + ‖mixedDerivative (stationaryForce ν I hI) α y - + rationalVector (evaluateStartupForce (stationaryCode I hI) + (stationaryCode_valid I hI) α a b ε hε)‖ ≤ (ε : ℝ) := + evaluateStartupForce_spec (stationaryCode_valid I hI) + (SpatialExpression.suspensionCode_val (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI)) α ha hb ε hε + +theorem stationary_velocity_bound (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (α : List (Fin 4)) (y : SpaceTime) : + ‖mixedDerivative (stationaryVelocity I hI) α y‖ ≤ + (startupVelocityBound (stationaryCode I hI) α : ℝ) := + startupVelocityBound_spec (stationaryCode_valid I hI) + (SpatialExpression.suspensionCode_val (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI)) α y + +theorem stationary_force_bound (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (α : List (Fin 4)) + (a : ℕ → ℚ) (ha : IsFastRealName a ν) (y : SpaceTime) : + ‖mixedDerivative (stationaryForce ν I hI) α y‖ ≤ + (startupForceBound (stationaryCode I hI) α a : ℝ) := + startupForceBound_spec (stationaryCode_valid I hI) + (SpatialExpression.suspensionCode_val (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_noTime I hI)) α ha y + +theorem stationary_program_flows (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : + ∃ Φ : ℝ → Space → Space, + IsMaterialFlow 1 (fun y => + SpatialExpression.suspensionField (normalizedHamiltonian I hI) y.2) Φ ∧ + IsMaterialFlow 1 (stationaryVelocity I hI) + (fun t x => Φ (accumulatedClock startupRamp t) x) ∧ + ∀ x O, Reaches (fun t => Φ (accumulatedClock startupRamp t) x) O ↔ + Reaches (fun t => Φ t x) O := + startup_materialFlow (by norm_num) + (SpatialExpression.suspensionField_smooth (normalizedHamiltonian_valid I hI)) + (SpatialExpression.suspensionField_periodic (normalizedHamiltonian_valid I hI) + (normalizedHamiltonian_periodic I hI)) + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Subprogram.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Subprogram.lean new file mode 100644 index 0000000000000000000000000000000000000000..4be778d01ee1e4d9058d43d7372aabd6d470a751 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/Subprogram.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model + +namespace OAI + +/-! Removing instructions preserves the geometric conditions of a processor. +The fresh-state initializer uses this to remove an unreachable incoming row. -/ + +namespace ShearFlows + +def Input.withInstructions (d : Input) (l : List Instruction) : Input := + { d with instructions := l } + +theorem ValidInput.withInstructions {d : Input} (hd : ValidInput d) + {l : List Instruction} (hl : l.Sublist d.instructions) : + ValidInput (d.withInstructions l) := by + obtain ⟨f, hf⟩ := List.sublist_iff_exists_fin_orderEmbedding_get_eq.mp hl + have hmem : ∀ b ∈ l, b ∈ d.instructions := fun _ hb => hl.subset hb + refine { + period_pos := hd.period_pos + chart_positive := hd.chart_positive + chart_length := hd.chart_length + h_pos := hd.h_pos + centers_nonempty := hd.centers_nonempty + chartMargin := hd.chartMargin + height_inside := hd.height_inside + source_positive := fun b hb => hd.source_positive b (hmem b hb) + target_positive := fun b hb => hd.target_positive b (hmem b hb) + source_in_chart := fun b hb => hd.source_in_chart b (hmem b hb) + target_in_chart := fun b hb => hd.target_in_chart b (hmem b hb) + factor_pos := fun b hb => hd.factor_pos b (hmem b hb) + image_eq := fun b hb => hd.image_eq b (hmem b hb) + source_separation := ?_ + target_separation := ?_ + halfWidths := fun b hb => hd.halfWidths b (hmem b hb) + source_centers := fun b hb => hd.source_centers b (hmem b hb) + target_centers := fun b hb => hd.target_centers b (hmem b hb) } + · intro i j hij + have h := hd.source_separation (f i) (f j) (fun he => hij (f.injective he)) + change PositivelySeparated (d.instructions.get (f i)).source.carrier + (d.instructions.get (f j)).source.carrier at h + rw [← hf i, ← hf j] at h + exact h + · intro i j hij + have h := hd.target_separation (f i) (f j) (fun he => hij (f.injective he)) + change PositivelySeparated (d.instructions.get (f i)).target.carrier + (d.instructions.get (f j)).target.carrier at h + rw [← hf i, ← hf j] at h + exact h + +def Input.filterInstructions (d : Input) (p : Instruction → Bool) : Input := + d.withInstructions (d.instructions.filter p) + +theorem ValidInput.filterInstructions {d : Input} (hd : ValidInput d) + (p : Instruction → Bool) : ValidInput (d.filterInstructions p) := + hd.withInstructions List.filter_sublist + +theorem PositivelySeparated.symm {A B : Set Plane} (h : PositivelySeparated A B) : + PositivelySeparated B A := by + obtain ⟨ε, hε, hb⟩ := h + exact ⟨ε, hε, fun x hx y hy => by simpa only [norm_sub_rev] using hb y hy x hx⟩ + +theorem indexed_cons_separation {A : Type*} (a : A) (l : List A) (R : A → A → Prop) + (hsym : ∀ a b, R a b → R b a) + (hhead : ∀ b ∈ l, R a b) + (htail : ∀ i j : Fin l.length, i ≠ j → R l[i] l[j]) + (i j : Fin (a :: l).length) (hij : i ≠ j) : R (a :: l)[i] (a :: l)[j] := by + cases i using Fin.cases with + | zero => + cases j using Fin.cases with + | zero => exact False.elim (hij rfl) + | succ j => simpa using hhead l[j] (List.getElem_mem j.isLt) + | succ i => + cases j using Fin.cases with + | zero => simpa using hsym a l[i] (hhead l[i] (List.getElem_mem i.isLt)) + | succ j => + exact htail i j (fun he => hij (congrArg Fin.succ he)) + +theorem ValidInput.consInstruction {d : Input} (hd : ValidInput d) (b : Instruction) + (hb : ValidInput (d.withInstructions [b])) + (hs : ∀ c ∈ d.instructions, PositivelySeparated b.source.carrier c.source.carrier) + (ht : ∀ c ∈ d.instructions, PositivelySeparated b.target.carrier c.target.carrier) : + ValidInput (d.withInstructions (b :: d.instructions)) := by + have hall {P : Instruction → Prop} (hp : P b) (hps : ∀ c ∈ d.instructions, P c) : + ∀ c ∈ b :: d.instructions, P c := by + intro c hc + rcases List.mem_cons.mp hc with rfl | hc + · exact hp + · exact hps c hc + refine { + period_pos := hd.period_pos + chart_positive := hd.chart_positive + chart_length := hd.chart_length + h_pos := hd.h_pos + centers_nonempty := hd.centers_nonempty + chartMargin := hd.chartMargin + height_inside := hd.height_inside + source_positive := hall (hb.source_positive b (by simp [Input.withInstructions])) + hd.source_positive + target_positive := hall (hb.target_positive b (by simp [Input.withInstructions])) + hd.target_positive + source_in_chart := hall (hb.source_in_chart b (by simp [Input.withInstructions])) + hd.source_in_chart + target_in_chart := hall (hb.target_in_chart b (by simp [Input.withInstructions])) + hd.target_in_chart + factor_pos := hall (hb.factor_pos b (by simp [Input.withInstructions])) hd.factor_pos + image_eq := hall (hb.image_eq b (by simp [Input.withInstructions])) hd.image_eq + source_separation := indexed_cons_separation b d.instructions + (fun a c => PositivelySeparated a.source.carrier c.source.carrier) + (fun _ _ h => h.symm) hs hd.source_separation + target_separation := indexed_cons_separation b d.instructions + (fun a c => PositivelySeparated a.target.carrier c.target.carrier) + (fun _ _ h => h.symm) ht hd.target_separation + halfWidths := hall (hb.halfWidths b (by simp [Input.withInstructions])) hd.halfWidths + source_centers := hall (hb.source_centers b (by simp [Input.withInstructions])) + hd.source_centers + target_centers := hall (hb.target_centers b (by simp [Input.withInstructions])) + hd.target_centers } + +theorem ValidInput.prependSublist {d : Input} (hd : ValidInput d) + {l : List Instruction} (hl : l.Sublist d.instructions) (b : Instruction) + (hb : ValidInput (d.withInstructions [b])) + (hs : ∀ c ∈ l, PositivelySeparated b.source.carrier c.source.carrier) + (ht : ∀ c ∈ l, PositivelySeparated b.target.carrier c.target.carrier) : + ValidInput (d.withInstructions (b :: l)) := by + have hv := hd.withInstructions hl + exact hv.consInstruction b hb hs ht + +end ShearFlows + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0AlternatingPresentation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0AlternatingPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8efbc633ca379dd2c5287fe6a4981f461be51be5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0AlternatingPresentation.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0RapidPresentation +import OAI.MathematicalPhysics.AlternatingFlow.Model + +namespace OAI + +/-! Flattening the fixed finite interpreter into the alternating-flow input +format changes only the storage layout of its transition table. -/ + +namespace ForcedComputation.FiniteMachine + +open Turing + +def alternatingTM0 {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : AlternatingNS.Machine := + (q, g, 0, [], List.ofFn fun i : Fin ((q + 1) * (g + 1)) => + let a : Fin (g + 1) := ⟨i.val % (g + 1), Nat.mod_lt _ (Nat.succ_pos _)⟩ + let r : Fin (q + 1) := ⟨i.val / (g + 1), + (Nat.div_lt_iff_lt_mul (Nat.succ_pos g)).mpr i.isLt⟩ + (M r a).map (encodeAction a)) + +theorem alternatingTM0_instruction {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (r : Fin (q + 1)) (a : Fin (g + 1)) : + (alternatingTM0 M).instruction r.val a.val = (M r a).map (encodeAction a) := by + have hi : r.val * (g + 1) + a.val < (q + 1) * (g + 1) := by + calc + _ < r.val * (g + 1) + (g + 1) := Nat.add_lt_add_left a.isLt _ + _ = (r.val + 1) * (g + 1) := by rw [Nat.add_mul, one_mul] + _ ≤ (q + 1) * (g + 1) := Nat.mul_le_mul_right _ r.isLt + have hd : (r.val * (g + 1) + a.val) / (g + 1) = r.val := by + rw [Nat.mul_comm r.val, Nat.mul_add_div (Nat.succ_pos _), + Nat.div_eq_of_lt a.isLt, Nat.add_zero] + have hm : (r.val * (g + 1) + a.val) % (g + 1) = a.val := + Nat.mul_add_mod_of_lt a.isLt + change ((List.ofFn fun i : Fin ((q + 1) * (g + 1)) => + let a : Fin (g + 1) := ⟨i.val % (g + 1), Nat.mod_lt _ (Nat.succ_pos _)⟩ + let r : Fin (q + 1) := ⟨i.val / (g + 1), + (Nat.div_lt_iff_lt_mul (Nat.succ_pos g)).mpr i.isLt⟩ + (M r a).map (encodeAction a))[r.val * (g + 1) + a.val]?).join = _ + simp only [List.getElem?_ofFn, hi, ↓reduceDIte, Option.join_some, hd, hm] + +theorem alternatingTM0_wellFormed {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + (alternatingTM0 M).WellFormed := by + refine ⟨Nat.succ_pos _, by simp [alternatingTM0, AlternatingNS.Machine.haltingStates], ?_⟩ + intro r a s hr ha hs + change r < q + 1 at hr + change a < g + 1 at ha + rw [alternatingTM0_instruction M ⟨r, hr⟩ ⟨a, ha⟩] at hs + obtain ⟨v, _, rfl⟩ := Option.map_eq_some_iff.mp hs + exact encodeAction_bounds ⟨a, ha⟩ v + +def eraseAlternating {g q : ℕ} {M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))} + (c : (rapidTM0 M).Config) : AlternatingNS.Machine.Configuration := + ⟨c.state.val, c.head, fun j => (c.tape j).val⟩ + +private theorem alternating_configuration_ext + {c d : AlternatingNS.Machine.Configuration} + (hs : c.state = d.state) (hh : c.head = d.head) (ht : c.tape = d.tape) : c = d := by + cases c + cases d + cases hs + cases hh + cases ht + rfl + +theorem eraseAlternating_step {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (c : (rapidTM0 M).Config) : + eraseAlternating ((rapidTM0 M).nextConfig c) = + (alternatingTM0 M).step (eraseAlternating c) := by + by_cases hr : c.state.val < q + 1 + · have hh : (alternatingTM0 M).isHalting (eraseAlternating c) = false := by + change decide (c.state.val = q + 1 ∨ c.state.val ∈ ([] : List ℕ)) = false + simp only [List.not_mem_nil, or_false, decide_eq_false_iff_not, ne_of_lt hr, + not_false_eq_true] + have hi := alternatingTM0_instruction M ⟨c.state.val, hr⟩ (c.tape c.head) + change (alternatingTM0 M).instruction (eraseAlternating c).state + ((eraseAlternating c).tape (eraseAlternating c).head) = _ at hi + simp only [AlternatingNS.Machine.step, hh, Bool.false_eq_true, ↓reduceIte] + rw [hi] + cases hm : M ⟨c.state.val, hr⟩ (c.tape c.head) with + | none => + simp only [RapidForcing.Machine.nextConfig, rapidTM0, hr, ↓reduceDIte, + hm, Option.map_none, eraseAlternating, AlternatingNS.Machine.states, alternatingTM0] + | some rs => + rcases rs with ⟨r, s⟩ + cases s with + | move d => + cases d <;> + simp [RapidForcing.Machine.nextConfig, rapidTM0, hr, hm, eraseAlternating, + rapidAction, encodeAction, sub_eq_add_neg, add_assoc] + | write a => + simp [RapidForcing.Machine.nextConfig, rapidTM0, hr, hm, eraseAlternating, + rapidAction, encodeAction, val_update] + · have hs : c.state.val = q + 1 := by + have hb : c.state.val < q + 2 := c.state.isLt + omega + have hh : (alternatingTM0 M).isHalting (eraseAlternating c) = true := by + change decide (c.state.val = q + 1 ∨ c.state.val ∈ ([] : List ℕ)) = true + simp only [hs, true_or, decide_true] + simp only [RapidForcing.Machine.nextConfig, rapidTM0, hr, ↓reduceDIte, + AlternatingNS.Machine.step, hh, ↓reduceIte] + +theorem eraseAlternating_initial {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) : + eraseAlternating ((rapidTM0 M).initialConfig w) = + (alternatingTM0 M).initial (w.map Fin.val) := by + apply alternating_configuration_ext + · rfl + · rfl + · funext j + by_cases hj : 0 ≤ j + · change (if 0 ≤ j then (w[j.toNat]?).getD (0 : Fin (g + 1)) else 0).val = + if 0 ≤ j then ((w.map Fin.val)[j.toNat]?).getD 0 else 0 + simp only [hj, ↓reduceIte, List.getElem?_map] + exact (Option.getD_map Fin.val (0 : Fin (g + 1)) _).symm + · simp [eraseAlternating, RapidForcing.Machine.initialConfig, + AlternatingNS.Machine.initial, hj, RapidForcing.Machine.blank, rapidTM0] + +theorem eraseAlternating_run {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) (n : ℕ) : + eraseAlternating ((rapidTM0 M).run w n) = + (alternatingTM0 M).run (w.map Fin.val) n := by + induction n with + | zero => exact eraseAlternating_initial M w + | succ n ih => + have he := (eraseAlternating_step M _).trans (congrArg (alternatingTM0 M).step ih) + simpa only [RapidForcing.Machine.run, AlternatingNS.Machine.run, + Function.iterate_succ_apply'] using he + +theorem alternatingTM0_halts_iff {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) : + (alternatingTM0 M).Halts (w.map Fin.val) ↔ (TM0.eval M w).Dom := by + rw [← rapidTM0_halts_iff] + change (∃ n, (alternatingTM0 M).isHalting + ((alternatingTM0 M).run (w.map Fin.val) n) = true) ↔ _ + apply exists_congr + intro n + rw [← eraseAlternating_run M w n] + change decide (((rapidTM0 M).run w n).state.val = q + 1 ∨ + ((rapidTM0 M).run w n).state.val ∈ ([] : List ℕ)) = true ↔ _ + simp only [List.not_mem_nil, or_false, decide_eq_true_eq] + rfl + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteCoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteCoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb0556488a200f33af593ca499f5c2cd31bde320 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteCoding.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0TableSimulation + +namespace OAI + +/-! Finite support is sufficient for a fixed TM0 program to have a genuine +finite table. Only the input word varies in this conversion. -/ + +namespace ForcedComputation.FiniteMachine + +open Turing + +theorem exists_pointed_fin_equiv (A : Type*) [Fintype A] [Inhabited A] : + ∃ n : ℕ, ∃ e : A ≃ Fin (n + 1), e default = 0 := by + classical + obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero + (ne_of_gt (Fintype.card_pos : 0 < Fintype.card A)) + let e : A ≃ Fin (n + 1) := Fintype.equivFinOfCardEq hn + exact ⟨n, e.trans (Equiv.swap (e default) 0), by simp⟩ + +theorem map_eval_dom {Γ Λ Γ' Λ' : Type*} + [Inhabited Γ] [Inhabited Λ] [Inhabited Γ'] [Inhabited Λ'] + (M : TM0.Machine Γ Λ) (S : Set Λ) (hS : TM0.Supports M S) + (f : PointedMap Γ Γ') (f' : PointedMap Γ' Γ) + (q : PointedMap Λ Λ') (q' : Λ' → Λ) + (hf : Function.RightInverse f f') + (hq : ∀ a ∈ S, q' (q a) = a) (w : List Γ) : + (TM0.eval (M.map f f' q q') (w.map f)).Dom ↔ (TM0.eval M w).Dom := by + have hr := M.map_respects f f' q q' hS hf hq + have hi : (TM0.init w : TM0.Cfg Γ Λ).q ∈ S ∧ + TM0.Cfg.map f q (TM0.init w) = TM0.init (w.map f) := + ⟨hS.1, TM0.map_init f q w⟩ + exact StateTransition.tr_eval_dom hr hi + +theorem finite_supported_TM0 {Γ Λ : Type*} [Fintype Γ] [Inhabited Γ] + [Inhabited Λ] [DecidableEq Λ] + (M : TM0.Machine Γ Λ) (S : Finset Λ) (hS : TM0.Supports M (S : Set Λ)) : + ∃ g q : ℕ, ∃ N : TM0.Machine (Fin (g + 1)) (Fin (q + 1)), + ∃ e : Γ ≃ Fin (g + 1), e default = 0 ∧ + ∀ w, (TM0.eval N (w.map e)).Dom ↔ (TM0.eval M w).Dom := by + classical + let : Inhabited S := ⟨⟨default, hS.1⟩⟩ + obtain ⟨g, e, he⟩ := exists_pointed_fin_equiv Γ + obtain ⟨q, d, hd⟩ := exists_pointed_fin_equiv S + let f : PointedMap Γ (Fin (g + 1)) := ⟨e, he⟩ + let f' : PointedMap (Fin (g + 1)) Γ := ⟨e.symm, by + apply e.injective + simpa only [Equiv.apply_symm_apply, Fin.default_eq_zero] using he.symm⟩ + let d₁ : PointedMap Λ (Fin (q + 1)) := + ⟨fun a => if h : a ∈ S then d ⟨a, h⟩ else 0, by + have hs : (default : Λ) ∈ S := hS.1 + rw [dite_eq_left hs, Fin.default_eq_zero] + exact hd⟩ + let d₂ : Fin (q + 1) → Λ := fun a => (d.symm a).val + refine ⟨g, q, M.map f f' d₁ d₂, e, he, ?_⟩ + intro w + apply map_eval_dom M (S : Set Λ) hS f f' d₁ d₂ + · intro a + exact e.symm_apply_apply a + · intro a ha + have ha' : a ∈ S := ha + change (d.symm (if h : a ∈ S then d ⟨a, h⟩ else 0)).val = a + rw [dite_eq_left ha'] + exact congrArg Subtype.val (d.symm_apply_apply ⟨a, ha⟩) + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteTable.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fc051fae71b844dae7d63dd121ef426f2a1941a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0FiniteTable.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.MachinePartialStep +import Mathlib.Computability.TuringMachine.PostTuringMachine +import Mathlib.Data.List.OfFn + +namespace OAI + +/-! Compile finite TM0 tables into the finite table presentation used by the +fluid theorems. A move writes back the symbol that was read; a write uses the +stationary move. -/ + +namespace ForcedComputation.FiniteMachine + +open Alternating Turing + +def encodeAction {g q : ℕ} (a : Fin (g + 1)) : + Fin (q + 1) × TM0.Stmt (Fin (g + 1)) → Instruction + | (r, .move .left) => (r.val, a.val, 0) + | (r, .move .right) => (r.val, a.val, 2) + | (r, .write b) => (r.val, b.val, 1) + +def compileTM0 {g q : ℕ} (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : Machine := + (q, g, ∅, List.ofFn fun r => List.ofFn fun a => (M r a).map (encodeAction a)) + +@[simp] theorem compileTM0_stateCount {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + (compileTM0 M).stateCount = q + 1 := rfl + +@[simp] theorem compileTM0_symbolCount {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + (compileTM0 M).symbolCount = g + 1 := rfl + +theorem encodeAction_bounds {g q : ℕ} (a : Fin (g + 1)) + (s : Fin (q + 1) × TM0.Stmt (Fin (g + 1))) : + (encodeAction a s).1 < q + 1 ∧ (encodeAction a s).2.1 < g + 1 := by + rcases s with ⟨r, s⟩ + cases s with + | move d => cases d <;> exact ⟨r.isLt, a.isLt⟩ + | write b => exact ⟨r.isLt, b.isLt⟩ + +theorem compileTM0_wellFormed {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + (compileTM0 M).WellFormed := by + refine ⟨List.length_ofFn, ?_, ?_⟩ + · simp [compileTM0, Machine.haltingStates] + · intro row hr + obtain ⟨r, rfl⟩ := List.mem_ofFn.mp hr + refine ⟨List.length_ofFn, ?_⟩ + intro i hi + obtain ⟨a, ha⟩ := List.mem_ofFn.mp hi + obtain ⟨s, _, rfl⟩ := Option.map_eq_some_iff.mp ha + exact encodeAction_bounds a s + +@[simp] theorem compileTM0_instruction {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (r : Fin (q + 1)) (a : Fin (g + 1)) : + (compileTM0 M).instruction r.val a.val = (M r a).map (encodeAction a) := by + change (((List.ofFn (fun r => List.ofFn (fun a => + (M r a).map (encodeAction a))))[r.val]?).bind + (fun row => row[a.val]?)).join = _ + simp only [List.getElem?_ofFn, r.isLt, a.isLt, ↓reduceDIte, + Option.bind_some, Option.join_some] + +@[simp] theorem compileTM0_not_halting {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (r : Fin (q + 1)) : + (compileTM0 M).isHalting r.val = false := by + change decide (r.val = q + 1 ∨ r.val ∈ (∅ : Finset ℕ)) = false + simp only [Finset.notMem_empty, or_false, decide_eq_false_iff_not, + ne_of_lt r.isLt, not_false_eq_true] + +def compileTM0Input {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (w : List (Fin (g + 1))) : MachineInput := + (compileTM0 M, w.map Fin.val) + +theorem compileTM0Input_valid {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (w : List (Fin (g + 1))) : ValidInput (compileTM0Input M w) := by + refine ⟨compileTM0_wellFormed M, ?_⟩ + intro a ha + obtain ⟨b, _, rfl⟩ := List.mem_map.mp ha + exact b.isLt + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0LatticePresentation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0LatticePresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b37fbb054746cea62259dc87a521fefded3a0743 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0LatticePresentation.lean @@ -0,0 +1,158 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0RapidPresentation +import OAI.Analysis.PeriodicLattice.Basic + +namespace OAI + +/-! The bounded rapid-machine presentation embeds into a ragged lattice +table by turning absent instructions into explicit transfers to a final +empty row. Thus its terminal-state test is exactly the lattice stop test. -/ + +namespace ForcedComputation.FiniteMachine + +def latticeAction (M : RapidForcing.Machine) (r : Fin M.states) (a : Fin M.symbols) : + PeriodicLattice.Instruction := + match M.transition r a with + | none => ⟨M.states, a.val, 1⟩ + | some (s, b, d) => ⟨s.val, b.val, d⟩ + +def latticeMachine (M : RapidForcing.Machine) : PeriodicLattice.Machine where + states := M.states + 1 + symbols := M.symbols + start := M.initial.val + table := List.ofFn fun r : Fin (M.states + 1) => + if h : r.val < M.states then + List.ofFn fun a : Fin M.symbols => some (latticeAction M ⟨r.val, h⟩ a) + else [] + +theorem latticeAction_bounds (M : RapidForcing.Machine) (r : Fin M.states) + (a : Fin M.symbols) : + (latticeAction M r a).nextState < M.states + 1 ∧ + (latticeAction M r a).writeSymbol < M.symbols := by + cases hm : M.transition r a with + | none => + simpa only [latticeAction, hm] using And.intro (Nat.lt_succ_self M.states) a.isLt + | some v => + rcases v with ⟨s, b, d⟩ + simpa only [latticeAction, hm] using And.intro (Nat.lt_succ_of_lt s.isLt) b.isLt + +theorem latticeMachine_lookup (M : RapidForcing.Machine) + (r : Fin M.states) (a : Fin M.symbols) : + (latticeMachine M).lookup r.val a.val = some (latticeAction M r a) := by + change ((List.ofFn fun s : Fin (M.states + 1) => + if h : s.val < M.states then + List.ofFn fun b : Fin M.symbols => some (latticeAction M ⟨s.val, h⟩ b) + else []).getD r.val []).getD a.val none = _ + simp only [List.getD_eq_getElem?_getD, List.getElem?_ofFn, + Nat.lt_succ_of_lt r.isLt, r.isLt, a.isLt, ↓reduceDIte, Option.getD_some] + +theorem latticeMachine_terminal (M : RapidForcing.Machine) (a : ℕ) : + (latticeMachine M).lookup M.states a = none := by + change ((List.ofFn fun s : Fin (M.states + 1) => + if h : s.val < M.states then + List.ofFn fun b : Fin M.symbols => some (latticeAction M ⟨s.val, h⟩ b) + else []).getD M.states []).getD a none = none + simp only [List.getD_eq_getElem?_getD, List.getElem?_ofFn, + Nat.lt_succ_self, ↓reduceDIte, lt_self_iff_false, Option.getD_some, + List.getElem?_nil, Option.getD_none] + +theorem latticeMachine_wellFormed (M : RapidForcing.Machine) : + (latticeMachine M).WellFormed := by + refine ⟨Nat.succ_pos _, M.symbols_pos, Nat.lt_succ_of_lt M.initial.isLt, + le_of_eq List.length_ofFn, ?_, ?_⟩ + · intro row hr + obtain ⟨r, rfl⟩ := List.mem_ofFn.mp hr + split + · exact le_of_eq List.length_ofFn + · exact Nat.zero_le _ + · intro row hr entry he I hI + obtain ⟨r, rfl⟩ := List.mem_ofFn.mp hr + split at he + · obtain ⟨a, ha⟩ := List.mem_ofFn.mp he + have hi : latticeAction M _ a = I := Option.some.inj (ha.trans hI) + rw [← hi] + exact latticeAction_bounds M _ a + · simp only [List.not_mem_nil] at he + +def eraseLattice {M : RapidForcing.Machine} (c : M.Config) : + PeriodicLattice.Configuration := + ⟨c.state.val, c.head, fun j => (c.tape j).val⟩ + +theorem eraseLattice_step (M : RapidForcing.Machine) (c : M.Config) : + eraseLattice (M.nextConfig c) = + PeriodicLattice.machineStep (latticeMachine M) (eraseLattice c) := by + by_cases hr : c.state.val < M.states + · have hi := latticeMachine_lookup M ⟨c.state.val, hr⟩ (c.tape c.head) + cases hm : M.transition ⟨c.state.val, hr⟩ (c.tape c.head) with + | none => + simp only [RapidForcing.Machine.nextConfig, hr, ↓reduceDIte, hm, + PeriodicLattice.machineStep, eraseLattice, hi, latticeAction, Fin.val_one, + Nat.cast_one, sub_self, add_zero] + congr 1 + funext j + by_cases hj : j = c.head + · subst j + simp only [Function.update_self] + · exact (Function.update_of_ne hj (c.tape c.head).val (fun j => (c.tape j).val)).symm + | some v => + rcases v with ⟨s, b, d⟩ + simp only [RapidForcing.Machine.nextConfig, hr, ↓reduceDIte, hm, + PeriodicLattice.machineStep, eraseLattice, hi, latticeAction, add_sub_assoc] + congr 1 + funext j + exact Function.apply_update (fun _ (a : Fin M.symbols) => a.val) c.tape c.head b j + · have hs : c.state.val = M.states := by have := c.state.isLt; omega + have hn : M.nextConfig c = c := by + simp only [RapidForcing.Machine.nextConfig, hr, ↓reduceDIte] + rw [hn] + simp only [PeriodicLattice.machineStep, eraseLattice, hs, latticeMachine_terminal] + +theorem eraseLattice_initial (M : RapidForcing.Machine) (w : M.Input) : + eraseLattice (M.initialConfig w) = + PeriodicLattice.initialConfiguration ⟨latticeMachine M, w.map Fin.val⟩ := by + unfold eraseLattice RapidForcing.Machine.initialConfig PeriodicLattice.initialConfiguration + congr 1 + funext j + by_cases hj : 0 ≤ j + · simp only [hj, ↓reduceIte, List.getD_eq_getElem?_getD, List.getElem?_map] + exact (Option.getD_map Fin.val M.blank _).symm + · simp [hj, RapidForcing.Machine.blank] + +theorem eraseLattice_run (M : RapidForcing.Machine) (w : M.Input) (n : ℕ) : + eraseLattice (M.run w n) = + PeriodicLattice.execution ⟨latticeMachine M, w.map Fin.val⟩ n := by + induction n with + | zero => exact eraseLattice_initial M w + | succ n ih => + have he := (eraseLattice_step M _).trans + (congrArg (PeriodicLattice.machineStep (latticeMachine M)) ih) + simpa only [RapidForcing.Machine.run, PeriodicLattice.execution, + Function.iterate_succ_apply'] using he + +theorem latticeMachine_halts_iff (M : RapidForcing.Machine) (w : M.Input) : + PeriodicLattice.Halts ⟨latticeMachine M, w.map Fin.val⟩ ↔ M.Halts w := by + change (∃ n, (latticeMachine M).lookup + (PeriodicLattice.execution ⟨latticeMachine M, w.map Fin.val⟩ n).state + ((PeriodicLattice.execution ⟨latticeMachine M, w.map Fin.val⟩ n).tape + (PeriodicLattice.execution ⟨latticeMachine M, w.map Fin.val⟩ n).head) = none) ↔ + ∃ n, (M.run w n).state.val = M.states + apply exists_congr + intro n + rw [← eraseLattice_run M w n] + change (latticeMachine M).lookup (M.run w n).state.val + ((M.run w n).tape (M.run w n).head).val = none ↔ (M.run w n).state.val = M.states + by_cases hr : (M.run w n).state.val < M.states + · have hi := latticeMachine_lookup M ⟨(M.run w n).state.val, hr⟩ + ((M.run w n).tape (M.run w n).head) + change _ = none ↔ _ + rw [hi] + simp only [reduceCtorEq, false_iff] + exact ne_of_lt hr + · have hs : (M.run w n).state.val = M.states := by + have := (M.run w n).state.isLt + omega + change (latticeMachine M).lookup (M.run w n).state.val _ = none ↔ _ + simp only [hs, latticeMachine_terminal] + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0RapidPresentation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0RapidPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6116db6cba904333c94ab46307578bddae14dcbc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0RapidPresentation.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0TableSimulation +import OAI.MathematicalPhysics.RapidForcing.Model + +namespace OAI + +/-! The same finite TM0 table in the bounded-state presentation used by the +rapid-forcing development. -/ + +namespace ForcedComputation.FiniteMachine + +open Turing Alternating + +def rapidAction {g q : ℕ} (a : Fin (g + 1)) : + Fin (q + 1) × TM0.Stmt (Fin (g + 1)) → + Fin (q + 1) × Fin (g + 1) × Fin 3 + | (r, .move .left) => (r, a, 0) + | (r, .move .right) => (r, a, 2) + | (r, .write b) => (r, b, 1) + +def rapidTM0 {g q : ℕ} (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + RapidForcing.Machine where + states := q + 1 + symbols := g + 1 + states_pos := Nat.succ_pos _ + symbols_pos := Nat.succ_pos _ + initial := 0 + transition r a := (M r a).map (rapidAction a) + +def eraseRapid {g q : ℕ} {M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))} + (c : (rapidTM0 M).Config) : Configuration := + ⟨c.state.val, c.head, fun j => (c.tape j).val⟩ + +theorem val_update {g : ℕ} (t : ℤ → Fin (g + 1)) (h : ℤ) + (a : Fin (g + 1)) : + (fun j => (Function.update t h a j).val) = + Function.update (fun j => (t j).val) h a.val := by + funext j + exact Function.apply_update (fun _ (a : Fin (g + 1)) => a.val) t h a j + +theorem eraseRapid_step {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (c : (rapidTM0 M).Config) : + eraseRapid ((rapidTM0 M).nextConfig c) = (compileTM0 M).step (eraseRapid c) := by + by_cases hr : c.state.val < q + 1 + · have hh := compileTM0_not_halting M ⟨c.state.val, hr⟩ + have hi := compileTM0_instruction M ⟨c.state.val, hr⟩ (c.tape c.head) + cases hm : M ⟨c.state.val, hr⟩ (c.tape c.head) with + | none => + simp only [RapidForcing.Machine.nextConfig, rapidTM0, hr, ↓reduceDIte, + hm, Option.map_none, eraseRapid, Machine.step, hh, Bool.false_eq_true, + ↓reduceIte, hi, compileTM0_stateCount] + | some rs => + rcases rs with ⟨r, s⟩ + cases s with + | move d => + cases d <;> + simp [RapidForcing.Machine.nextConfig, rapidTM0, hr, hm, eraseRapid, + Machine.step, hh, hi, rapidAction, encodeAction] + | write a => + simp [RapidForcing.Machine.nextConfig, rapidTM0, hr, hm, eraseRapid, + Machine.step, hh, hi, rapidAction, encodeAction, val_update] + · have hs : c.state.val = q + 1 := by + have hb : c.state.val < q + 2 := c.state.isLt + omega + have hh : (compileTM0 M).isHalting (eraseRapid c).state = true := by + change decide (c.state.val = q + 1 ∨ c.state.val ∈ (∅ : Finset ℕ)) = true + simp only [hs, true_or, decide_true] + simp only [RapidForcing.Machine.nextConfig, rapidTM0, hr, ↓reduceDIte, + Machine.step, hh, ↓reduceIte] + +theorem eraseRapid_initial {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) : + eraseRapid ((rapidTM0 M).initialConfig w) = initialConfiguration (w.map Fin.val) := by + apply configuration_ext + · rfl + · rfl + · funext j + by_cases hj : 0 ≤ j + · change (if 0 ≤ j then (w[j.toNat]?).getD (0 : Fin (g + 1)) else 0).val = + if j < 0 then 0 else ((w.map Fin.val)[j.toNat]?).getD 0 + simp only [hj, not_lt_of_ge hj, ↓reduceIte, List.getElem?_map] + exact (Option.getD_map Fin.val (0 : Fin (g + 1)) _).symm + · simp [eraseRapid, RapidForcing.Machine.initialConfig, + initialConfiguration, hj, lt_of_not_ge hj, RapidForcing.Machine.blank, rapidTM0] + +theorem eraseRapid_run {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) (n : ℕ) : + eraseRapid ((rapidTM0 M).run w n) = + (compileTM0 M).step^[n] (initialConfiguration (w.map Fin.val)) := by + induction n with + | zero => exact eraseRapid_initial M w + | succ n ih => + have he := (eraseRapid_step M _).trans (congrArg (compileTM0 M).step ih) + simpa only [RapidForcing.Machine.run, Function.iterate_succ_apply'] using he + +theorem rapidTM0_halts_iff {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) (w : List (Fin (g + 1))) : + (rapidTM0 M).Halts w ↔ (TM0.eval M w).Dom := by + rw [← compileTM0_halts_iff] + change (∃ n, ((rapidTM0 M).run w n).state.val = q + 1) ↔ + ∃ n, (compileTM0 M).isHalting + ((compileTM0 M).step^[n] (initialConfiguration (w.map Fin.val))).state = true + apply exists_congr + intro n + rw [← eraseRapid_run M w n] + change _ ↔ decide (((rapidTM0 M).run w n).state.val = q + 1 ∨ + ((rapidTM0 M).run w n).state.val ∈ (∅ : Finset ℕ)) = true + simp only [Finset.notMem_empty, or_false, decide_eq_true_eq] + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0TableSimulation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0TableSimulation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9cd83358c215ac8a526d4517baee40b67d176a0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TM0TableSimulation.lean @@ -0,0 +1,155 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TM0FiniteTable + +namespace OAI + +/-! Exact tape simulation of a finite TM0 machine by the fluid source model. -/ + +namespace ForcedComputation.FiniteMachine + +open Alternating Turing + +theorem configuration_ext {c d : Configuration} (hs : c.state = d.state) + (hh : c.head = d.head) (ht : c.tape = d.tape) : c = d := by + cases c + cases d + cases hs + cases hh + cases ht + rfl + +def embedConfiguration {g q : ℕ} + (c : TM0.Cfg (Fin (g + 1)) (Fin (q + 1))) (h : ℤ) : Configuration := + { state := c.q.val + head := h + tape := fun j => (c.Tape.nth (j - h)).val } + +def actionDisplacement {g : ℕ} : TM0.Stmt (Fin (g + 1)) → ℤ + | .move .left => -1 + | .move .right => 1 + | .write _ => 0 + +def actionTape {g : ℕ} (s : TM0.Stmt (Fin (g + 1))) + (T : Tape (Fin (g + 1))) : Tape (Fin (g + 1)) := + match s with + | .move d => T.move d + | .write a => T.write a + +theorem embedConfiguration_action {g q : ℕ} + (c : TM0.Cfg (Fin (g + 1)) (Fin (q + 1))) (h : ℤ) + (r : Fin (q + 1)) (s : TM0.Stmt (Fin (g + 1))) : + ({ state := (encodeAction c.Tape.head (r, s)).1 + head := h + ((encodeAction c.Tape.head (r, s)).2.2.val : ℤ) - 1 + tape := Function.update (embedConfiguration c h).tape h + (encodeAction c.Tape.head (r, s)).2.1 } : Configuration) = + embedConfiguration ⟨r, actionTape s c.Tape⟩ (h + actionDisplacement s) := by + cases s with + | move d => + cases d with + | left => + apply configuration_ext + · rfl + · dsimp [embedConfiguration, actionDisplacement, encodeAction] + omega + · funext j + have hi : j - (h + -1) - 1 = j - h := by omega + by_cases hj : j = h + · subst j + simp [embedConfiguration, actionTape, actionDisplacement, encodeAction] + · simp [embedConfiguration, actionTape, actionDisplacement, encodeAction, + Function.update_of_ne hj, hi] + | right => + apply configuration_ext + · rfl + · dsimp [embedConfiguration, actionDisplacement, encodeAction] + omega + · funext j + have hi : j - (h + 1) + 1 = j - h := by omega + by_cases hj : j = h + · subst j + simp [embedConfiguration, actionTape, actionDisplacement, encodeAction] + · simp [embedConfiguration, actionTape, actionDisplacement, encodeAction, + Function.update_of_ne hj, hi] + | write a => + apply configuration_ext + · rfl + · simp [embedConfiguration, actionDisplacement, encodeAction] + · funext j + by_cases hj : j = h + · subst j + simp [embedConfiguration, actionTape, actionDisplacement, encodeAction] + · have hd : j - h ≠ 0 := sub_ne_zero.mpr hj + simp [embedConfiguration, actionTape, actionDisplacement, encodeAction, + Function.update_of_ne hj, hd] + +theorem partialStep_embed {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (c : TM0.Cfg (Fin (g + 1)) (Fin (q + 1))) (h : ℤ) : + partialStep (compileTM0 M) (embedConfiguration c h) = + (M c.q c.Tape.head).map (fun rs => + embedConfiguration ⟨rs.1, actionTape rs.2 c.Tape⟩ + (h + actionDisplacement rs.2)) := by + unfold partialStep + simp only [embedConfiguration, compileTM0_not_halting, Bool.false_eq_true, + ↓reduceIte, sub_self, Tape.nth_zero, compileTM0_instruction] + cases hm : M c.q c.Tape.head with + | none => rfl + | some rs => + simp only [Option.map_some] + exact congrArg some (embedConfiguration_action c h rs.1 rs.2) + +def ConfigurationRelation {g q : ℕ} + (c : TM0.Cfg (Fin (g + 1)) (Fin (q + 1))) (d : Configuration) : Prop := + ∃ h, embedConfiguration c h = d + +theorem compileTM0_respects {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) : + StateTransition.Respects (TM0.step M) (partialStep (compileTM0 M)) + ConfigurationRelation := by + rintro c _ ⟨h, rfl⟩ + cases hm : M c.q c.Tape.head with + | none => + simp only [TM0.step, hm, Option.map_none] + simp only [partialStep_embed, hm, Option.map_none] + | some rs => + simp only [TM0.step, hm, Option.map_some] + refine ⟨embedConfiguration ⟨rs.1, actionTape rs.2 c.Tape⟩ + (h + actionDisplacement rs.2), ?_, .single ?_⟩ + · refine ⟨h + actionDisplacement rs.2, ?_⟩ + cases rs.2 <;> rfl + exact (partialStep_embed M c h).trans (by rw [hm]; rfl) + +theorem embedConfiguration_initial {g q : ℕ} (w : List (Fin (g + 1))) : + embedConfiguration (TM0.init w : TM0.Cfg (Fin (g + 1)) (Fin (q + 1))) 0 = + initialConfiguration (w.map Fin.val) := by + apply configuration_ext + · rfl + · rfl + · funext j + cases j with + | ofNat n => + change ((Tape.mk₁ w).nth (n : ℤ)).val = + if (n : ℤ) < 0 then 0 else ((w.map Fin.val)[n]?).getD 0 + simp only [show ¬ (n : ℤ) < 0 from not_lt_of_ge (Int.natCast_nonneg n), + ↓reduceIte, Tape.mk₁, Tape.mk₂, Tape.mk'_nth_nat, ListBlank.nth_mk, + List.getElem?_map, List.getI_eq_getElem?_getD] + cases w[n]? <;> rfl + | negSucc n => + simp [embedConfiguration, TM0.init, initialConfiguration, Tape.mk₁, + Tape.mk₂, Tape.mk', Tape.nth] + +theorem compileTM0_halts_iff {g q : ℕ} + (M : TM0.Machine (Fin (g + 1)) (Fin (q + 1))) + (w : List (Fin (g + 1))) : + Halts (compileTM0Input M w) ↔ (TM0.eval M w).Dom := by + rw [halts_iff_eval_dom] + change (StateTransition.eval (partialStep (compileTM0 M)) + (initialConfiguration (w.map Fin.val))).Dom ↔ _ + rw [← embedConfiguration_initial] + have h := StateTransition.tr_eval_dom (compileTM0_respects M) + (show ConfigurationRelation (TM0.init w) (embedConfiguration (TM0.init w) 0) + from ⟨0, rfl⟩) + exact h + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TapeCoordinates.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TapeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4218bdce774a9f2c580ea2d625adecf94ede33e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TapeCoordinates.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RadixEncoding +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.GappedInstructions + +namespace OAI + +/-! +# Symbolic tape updates give the closed-rectangle affine maps + +The first stream lists cells to the left of the head, nearest first; the +second starts at the current cell. The three formulas include writing the +new symbol before moving the head. +-/ + +noncomputable section + +namespace ForcedComputation.Radix + +variable {A : Type*} + +abbrev Tape (A : Type*) := (ℕ → A) × (ℕ → A) + +def coordinates (B : ℝ) (digit : A → ℝ) (tape : Tape A) : ℝ × ℝ := + (encode B digit tape.1, encode B digit tape.2) + +def writeRight (b : A) (tape : Tape A) : Tape A := + (prepend b tape.1, fun n => tape.2 (n + 1)) + +def writeStay (b : A) (tape : Tape A) : Tape A := + (tape.1, prepend b (fun n => tape.2 (n + 1))) + +def writeLeft (b : A) (tape : Tape A) : Tape A := + (fun n => tape.1 (n + 1), prepend (tape.1 0) (prepend b (fun n => tape.2 (n + 1)))) + +theorem encode_pop {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (u : ℕ → A) : + pop B (digit (u 0)) (encode B digit u) = encode B digit (fun n => u (n + 1)) := by + rw [encode_shift hB hd] + exact pop_push (by linarith) _ _ + +theorem coordinates_right {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (b : A) (tape : Tape A) : + coordinates B digit (writeRight b tape) = + rightMove B (digit (tape.2 0)) (digit b) (coordinates B digit tape) := by + apply Prod.ext + · exact encode_prepend hB hd b tape.1 + · exact (encode_pop hB hd tape.2).symm + +theorem coordinates_stay {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (b : A) (tape : Tape A) : + coordinates B digit (writeStay b tape) = + stayMove B (digit (tape.2 0)) (digit b) (coordinates B digit tape) := by + apply Prod.ext + · rfl + · change encode B digit (prepend b (fun n => tape.2 (n + 1))) = _ + rw [encode_prepend hB hd] + change push B (digit b) (encode B digit (fun n => tape.2 (n + 1))) = + push B (digit b) (pop B (digit (tape.2 0)) (encode B digit tape.2)) + rw [encode_pop hB hd] + +theorem coordinates_left {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (b : A) (tape : Tape A) : + coordinates B digit (writeLeft b tape) = + leftMove B (digit (tape.1 0)) (digit (tape.2 0)) (digit b) (coordinates B digit tape) := by + apply Prod.ext + · exact (encode_pop hB hd tape.1).symm + · change encode B digit (prepend (tape.1 0) (prepend b (fun n => tape.2 (n + 1)))) = _ + rw [encode_prepend hB hd, encode_prepend hB hd] + change push B (digit (tape.1 0)) (push B (digit b) + (encode B digit (fun n => tape.2 (n + 1)))) = + push B (digit (tape.1 0)) (push B (digit b) + (pop B (digit (tape.2 0)) (encode B digit tape.2))) + rw [encode_pop hB hd] + +theorem coordinates_mem_rectangle {B : ℝ} {digit : A → ℝ} (hB : 1 < B) + (hd : ∀ a, 0 ≤ digit a ∧ digit a ≤ B - 1) (tape : Tape A) : + coordinates B digit tape ∈ rectangle B (digit (tape.1 0)) (digit (tape.2 0)) := + ⟨encode_in_first_cylinder hB hd tape.1, encode_in_first_cylinder hB hd tape.2⟩ + +end ForcedComputation.Radix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusConvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..acca2f2a305fd5ef9947059f50d71c4346ecc213 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusConvolution.lean @@ -0,0 +1,126 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.CompactParameterIntegral +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CompactDetectorScalarTranslation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatEvolutionSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatPeriodicity + +namespace OAI + +/-! Spatial differentiation of the heat convolution by differentiating the data. +Translation invariance of the periodic cell removes derivatives of the kernel. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +def weightedShiftIntegral (k g : Plane → ℝ) (x : Plane) : ℝ := + ∫ y in Icc (0 : Plane) (fun _ => 1), k y * g (x+y) + +private abbrev Cell := Icc (0 : Plane) (fun _ => 1) +private instance : CompactSpace Cell := isCompact_iff_compactSpace.mp isCompact_Icc +local instance : MeasureSpace Cell := Measure.Subtype.measureSpace +private instance : IsFiniteMeasure (volume : Measure Cell) := by + constructor + rw [Measure.Subtype.volume_univ measurableSet_Icc.nullMeasurableSet] + exact (isCompact_Icc : IsCompact (Icc (0 : Plane) (fun _ => 1))).measure_lt_top + +theorem weightedShiftIntegral_smooth {k g : Plane → ℝ} + (hk : Continuous k) (hg : ContDiff ℝ ∞ g) : + ContDiff ℝ ∞ (weightedShiftIntegral k g) := by + let f : Plane × ℝ → ℝ := fun q => q.2 * g q.1 + have hf : ContDiff ℝ ∞ f := contDiff_snd.mul (hg.comp contDiff_fst) + let b : C(Cell, Plane × ℝ) := ⟨fun y => ((y : Plane), k y), + continuous_subtype_val.prodMk (hk.comp continuous_subtype_val)⟩ + let A : Plane →L[ℝ] C(Cell, Plane × ℝ) := + (ContinuousLinearMap.const ℝ Cell).comp (ContinuousLinearMap.inl ℝ Plane ℝ) + have h := Flow.contDiff_compactIntegral (volume : Measure Cell) + (⟨f, hf.continuous⟩ : C(Plane × ℝ, ℝ)) hf (fun x => A x+b) + (A.contDiff.add contDiff_const) + convert h using 1 + funext x + rw [weightedShiftIntegral, ← integral_subtype measurableSet_Icc] + congr 1 + funext y + change k y * g (x+(y : Plane)) = (0+k y) * g (x+(y : Plane)) + rw [zero_add] + +theorem weightedShiftIntegral_fderiv {k g : Plane → ℝ} + (hk : Continuous k) (hg : ContDiff ℝ ∞ g) (x v : Plane) : + fderiv ℝ (weightedShiftIntegral k g) x v = + weightedShiftIntegral k (fun y => fderiv ℝ g y v) x := by + let W : ℝ → Plane → ℝ := fun s y => k y * g (x+s • v+y) + let D : ℝ → Plane → ℝ := fun s y => k y * fderiv ℝ g (x+s • v+y) v + have hi : ContDiff ℝ ∞ (fun p : ℝ × Plane => x+p.1 • v+p.2) := + (contDiff_const.add (contDiff_fst.smul contDiff_const)).add contDiff_snd + have hW : Continuous (Function.uncurry W) := + (hk.comp continuous_snd).mul (hg.comp hi).continuous + have hD : Continuous (Function.uncurry D) := + (hk.comp continuous_snd).mul + (((hg.fderiv_right (by simp)).comp hi).clm_apply contDiff_const).continuous + have hd (s : ℝ) (y : Plane) : HasDerivAt (fun r => W r y) (D s y) s := by + have h := ((hg.differentiable (by simp) _).hasFDerivAt.comp_hasDerivAt s + ((((hasDerivAt_id s).smul_const v).const_add x).add_const y)).const_mul (k y) + simpa only [W, D, Function.comp_def, id_eq, one_smul] using h + have h₁ := scalarMass_hasDerivAt hW hD hd 0 + have hl : HasDerivAt (fun s : ℝ => x+s • v) v 0 := by + simpa only [id_eq, one_smul] using (((hasDerivAt_id (0 : ℝ)).smul_const v).const_add x) + have h₂ := ((weightedShiftIntegral_smooth hk hg).differentiable (by simp) x).hasFDerivAt.comp_hasDerivAt_of_eq (0 : ℝ) hl (by simp) + have h := h₂.unique h₁ + simpa only [scalarMass, W, D, weightedShiftIntegral, Function.comp_def, + id_eq, zero_smul, add_zero, one_smul] using h + +theorem torusHeatEvolution_eq_shift {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) {t : ℝ} (ht : 0 < t) (x : Plane) : + torusHeatEvolution g t x = weightedShiftIntegral (fun y => torusHeatKernel t (-y)) g x := by + let f : Plane → ℝ := fun y => torusHeatKernel t (x-y) * g y + have hks : ContDiff ℝ ∞ (torusHeatKernel t) := by + have h := torusHeatKernel_smooth_positive.comp + (contDiff_const.prodMk contDiff_id).contDiffOn + (show MapsTo (fun y : Plane => (t, y)) univ (Ioi (0 : ℝ) ×ˢ univ) from + fun _ _ => ⟨ht, mem_univ _⟩) + simpa only [Function.comp_def, id_eq, contDiffOn_univ] using h + have hf : ContDiff ℝ ∞ f := + (hks.comp (contDiff_const.sub contDiff_id)).mul hg + have hfp : PlanePeriodic f := by + intro y n + dsimp [f] + rw [hp y n] + have he : x-(y+fun j => (n j : ℝ)) = (x-y)+fun j => ((-n j : ℤ) : ℝ) := by + ext j + simp only [Pi.sub_apply, Pi.add_apply, Int.cast_neg] + ring + rw [he, torusHeatKernel_periodic ht (x-y) (fun j => -n j)] + have hi := CompactCenter.integral_translated hf hfp x + rw [torusHeatEvolution, ite_eq_right (not_le.mpr ht)] + unfold weightedShiftIntegral + convert hi.symm using 1 + congr 1 + funext y + dsimp [f] + rw [show x-(y+x) = -y by abel, add_comm y x] + +theorem torusHeatEvolution_spatialD {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) (t : ℝ) (j : Fin 2) : + PlanarHamiltonian.spatialD j (torusHeatEvolution g t) = + torusHeatEvolution (PlanarHamiltonian.spatialD j g) t := by + by_cases ht : t ≤ 0 + · have he (f : Plane → ℝ) : torusHeatEvolution f t = f := by + funext x + simp only [torusHeatEvolution, ite_eq_left ht] + rw [he g, he (PlanarHamiltonian.spatialD j g)] + · have ht' : 0 < t := lt_of_not_ge ht + have he : torusHeatEvolution g t = + weightedShiftIntegral (fun y => torusHeatKernel t (-y)) g := + funext (torusHeatEvolution_eq_shift hg hp ht') + funext x + have hk : Continuous (fun y : Plane => torusHeatKernel t (-y)) := + (torusHeatKernel_continuous ht').comp continuous_neg + rw [PlanarHamiltonian.spatialD, he, weightedShiftIntegral_fderiv hk hg] + exact (torusHeatEvolution_eq_shift (PlanarHamiltonian.spatialD_smooth j hg) + (spatialD_periodic hg hp j) ht' x).symm + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusGeometry.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..047cde612791d2089f8be6d29402b3541c7014a5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusGeometry.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanDerivativeBounds + +namespace OAI + +/-! The two-dimensional torus distance needed for support separation. +Only the centered representative and its elementary triangle inequality +are used; no geometric quotient machinery is required. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows + +def centeredRepresentative (x : Plane) : Plane := + letI := ShearFlows.twoAtLeastTwo + fun j => x j - (⌊x j + 1 / 2⌋ : ℤ) + +def torusNorm (x : Plane) : ℝ := ‖planeCoordinates.symm (centeredRepresentative x)‖ + +theorem centered_nearest_integer (r : ℝ) (k : ℤ) : + |r - (⌊r + 1 / 2⌋ : ℤ)| ≤ |r - (k : ℝ)| := by + have hlo := Int.floor_le (r + 1 / 2) + have hhi := Int.lt_floor_add_one (r + 1 / 2) + rcases lt_trichotomy k ⌊r + 1 / 2⌋ with hk | hk | hk + · have hki : (k : ℝ) + 1 ≤ (⌊r + 1 / 2⌋ : ℤ) := by + exact_mod_cast Int.add_one_le_iff.mpr hk + rw [abs_of_nonneg (show 0 ≤ r - (k : ℝ) by linarith)] + exact abs_le.mpr ⟨by linarith, by linarith⟩ + · rw [hk] + · have hki : (⌊r + 1 / 2⌋ : ℤ) + (1 : ℝ) ≤ (k : ℝ) := by + exact_mod_cast Int.add_one_le_iff.mpr hk + rw [abs_of_nonpos (show r - (k : ℝ) ≤ 0 by linarith)] + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +theorem torusNorm_sq (x : Plane) : torusNorm x ^ 2 = torusDistanceSq x := by + rw [torusNorm, EuclideanSpace.real_norm_sq_eq] + rfl + +theorem torusNorm_nonneg (x : Plane) : 0 ≤ torusNorm x := norm_nonneg _ + +theorem torusNorm_le_lattice (x : Plane) (k : Fin 2 → ℤ) : + torusNorm x ≤ ‖planeCoordinates.symm (x - fun j => (k j : ℝ))‖ := by + have hsq : torusNorm x ^ 2 ≤ + ‖planeCoordinates.symm (x - fun j => (k j : ℝ))‖ ^ 2 := by + rw [torusNorm_sq, EuclideanSpace.real_norm_sq_eq] + apply Finset.sum_le_sum + intro j _ + change (x j - (⌊x j + 1 / 2⌋ : ℤ)) ^ 2 ≤ (x j - (k j : ℝ)) ^ 2 + exact (sq_le_sq).mpr (centered_nearest_integer (x j) (k j)) + nlinarith [torusNorm_nonneg x, norm_nonneg (planeCoordinates.symm (x - fun j => (k j : ℝ)))] + +theorem torusNorm_le_norm (x : Plane) : torusNorm x ≤ ‖planeCoordinates.symm x‖ := by + have h := torusNorm_le_lattice x (fun _ => 0) + have hz : (fun _ : Fin 2 => ((0 : ℤ) : ℝ)) = (0 : Plane) := by + ext j + simp only [Int.cast_zero, Pi.zero_apply] + simpa only [hz, sub_zero] using h + +theorem torusNorm_add_le (x y : Plane) : torusNorm (x + y) ≤ torusNorm x + torusNorm y := by + let k : Fin 2 → ℤ := fun j => ⌊x j + 1 / 2⌋ + ⌊y j + 1 / 2⌋ + have he : (x + y) - (fun j => (k j : ℝ)) = + centeredRepresentative x + centeredRepresentative y := by + ext j + simp only [Pi.add_apply, Pi.sub_apply, k, Int.cast_add, centeredRepresentative] + ring + calc + _ ≤ ‖planeCoordinates.symm ((x + y) - fun j => (k j : ℝ))‖ := torusNorm_le_lattice _ k + _ = ‖planeCoordinates.symm (centeredRepresentative x) + + planeCoordinates.symm (centeredRepresentative y)‖ := by rw [he, map_add] + _ ≤ _ := norm_add_le _ _ + +theorem torusNorm_neg (x : Plane) : torusNorm (-x) = torusNorm x := by + have h (y : Plane) : torusNorm (-y) ≤ torusNorm y := by + let k : Fin 2 → ℤ := fun j => -⌊y j + 1 / 2⌋ + have he : (-y) - (fun j => (k j : ℝ)) = -centeredRepresentative y := by + ext j + simp only [Pi.neg_apply, Pi.sub_apply, k, Int.cast_neg, centeredRepresentative] + ring + calc + _ ≤ ‖planeCoordinates.symm ((-y) - fun j => (k j : ℝ))‖ := torusNorm_le_lattice _ k + _ = torusNorm y := by rw [he, map_neg, norm_neg]; rfl + exact le_antisymm (h x) (by simpa only [neg_neg] using h (-x)) + +theorem torus_separation {p x y : Plane} {d ε : ℝ} + (hnear : torusNorm (y - p) ≤ ε) (hfar : 2 * d ≤ torusNorm (p - x)) + (hε : ε ≤ d) : d ≤ torusNorm (x - y) := by + have htri := torusNorm_add_le (p - y) (y - x) + have he : (p - y) + (y - x) = p - x := by abel + have he₁ : p - y = -(y - p) := by abel + have he₂ : y - x = -(x - y) := by abel + rw [he, he₁, he₂, torusNorm_neg, torusNorm_neg] at htri + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusSlowMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusSlowMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..d11b59663b6e194a00565a149454c8481f185843 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TorusSlowMain.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowLoaded +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowEffective +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.SlowTail + +namespace OAI + +/-! The unit-torus slow-clock main theorem, at the fixed particle specified +in Scalar Potentials and Slow Clocks for Forced Fluid Computation. -/ + +namespace ForcedComputation +open ShearFlows Recorder + +def torusSlowStart : Fin 2 → ℚ := ![1 / 4, 1 / 2] + +def torusSlowProgram (I : Alternating.MachineInput) (hI : Alternating.ValidInput I) : + Input × Input := + (shiftedLoader torusSlowStart (initialPointQ I hI) (1 / 2), + recorderInputAtHeight I.1 hI.1 (1 / 2)) + +theorem torusSlowLoader_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (torusSlowProgram I hI).1 := + shiftedLoader_valid _ _ _ (by intro j; fin_cases j <;> norm_num [torusSlowStart]) + (initialPointQ_bounds I hI) + +theorem torusSlowBody_valid (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : ValidInput (torusSlowProgram I hI).2 := + recorderInputAtHeight_valid I.1 (Alternating.ValidInput.machine_wellFormed hI) (1 / 2) + +noncomputable def torusSlowVelocity (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := + slowFromRest (loadedMachineVelocity torusSlowStart (1 / 2) I hI) + +noncomputable def torusSlowForce (ν : ℝ) (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) : Velocity := force ν (torusSlowVelocity I hI) + +theorem torus_slow_effective_computation (I : Alternating.MachineInput) + (hI : Alternating.ValidInput I) (ν : ℝ) (hν : 0 < ν) : + SlowFluidProperties 1 ν (torusSlowVelocity I hI) ∧ + (∀ (β : List (Fin 3)) (n : ℕ), ∃ C : ℝ, 0 ≤ C ∧ ∀ x t, 0 ≤ t → + ‖iteratedDeriv n (fun s => spatialWord β (fun y => torusSlowVelocity I hI (s, y)) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n) ∧ + ‖iteratedDeriv n (fun s => spatialWord β (fun y => torusSlowForce ν I hI (s, y)) x) t‖ ≤ + C * (1 + t)⁻¹ ^ (1 + n)) ∧ + (∀ t x, Real.exp 1 - 1 ≤ t → + torusSlowVelocity I hI (t, x) = + slowVelocity (recorderInputAtHeight I.1 hI.1 (1 / 2)).realizingVelocity (t, x) ∧ + torusSlowForce ν I hI (t, x) = + force ν (slowVelocity (recorderInputAtHeight I.1 hI.1 (1 / 2)).realizingVelocity) (t, x)) ∧ + (∀ (α : List (Fin 4)) (a : ℕ → ℚ) (b : ℕ → RationalSpaceTime) (y : SpaceTime) + (ha : IsFastRealName a ν) (hb : IsFastName b y) (ε : ℚ) (hε : 0 < ε), + ‖mixedDerivative (torusSlowForce ν I hI) α y - + rationalVector (evaluateSlowForce (torusSlowProgram I hI).1 + (torusSlowProgram I hI).2 (torusSlowLoader_valid I hI) + (torusSlowBody_valid I hI) α a ha b hb ε hε)‖ ≤ (ε : ℝ)) ∧ + ∃ Ψ : ℝ → Space → Space, IsMaterialFlow 1 (torusSlowVelocity I hI) Ψ ∧ + (Alternating.Halts I ↔ ∃ t : ℝ, 0 ≤ t ∧ + 1 / 2 < Ψ t ![1 / 4, 1 / 2, 1 / 2] 0 ∧ Ψ t ![1 / 4, 1 / 2, 1 / 2] 0 < 1) := by + obtain ⟨hp, Ψ, hΨ, hevent⟩ := slow_loaded_computation torusSlowStart (1 / 2) + (by intro j; fin_cases j <;> norm_num [torusSlowStart]) + (by norm_num [torusSlowStart]) I hI ν hν + refine ⟨hp, ?_, ?_, ?_, Ψ, hΨ, ?_⟩ + · intro β n + let loader := (torusSlowProgram I hI).1 + let body := (torusSlowProgram I hI).2 + have hl : ValidInput loader := torusSlowLoader_valid I hI + have hb : ValidInput body := torusSlowBody_valid I hI + have hs := initializedProgram_smooth hl hb + have hz : ∀ t, t < (1 / 32 : ℝ) → ∀ x, initializedProgram loader body (t, x) = 0 := + fun _ ht x => initializedProgram_zero_extend loader body ht x + have hbounded := initializedProgram_bounded hl hb (show loader.period = body.period from rfl) + obtain ⟨A, hA, hUA⟩ := slowFromRest_spatial_time_decay hs hz hbounded β n + obtain ⟨B, hB, hFB⟩ := slowFromRest_force_spatial_time_decay hs hz hbounded + (initializedProgram_zero_advection hl hb) ν β n + refine ⟨A + B, add_nonneg hA hB, fun x t ht => ⟨?_, ?_⟩⟩ + · exact (hUA x t ht).trans + (mul_le_mul_of_nonneg_right (le_add_of_nonneg_right hB) (by positivity)) + · exact (hFB x t ht).trans + (mul_le_mul_of_nonneg_right (le_add_of_nonneg_left hA) (by positivity)) + · intro t x ht + exact slow_initialized_tail _ _ ν ht x + · intro α a b y ha hb ε hε + exact evaluateSlowForce_spec (torusSlowLoader_valid I hI) + (torusSlowBody_valid I hI) α a ha b hb ε hε + · simpa only [torusSlowStart, atHeight, Matrix.cons_val_zero, Matrix.cons_val_one, + Rat.cast_div, Rat.cast_one, Rat.cast_ofNat] using hevent + +end ForcedComputation + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TuringInputEncoding.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TuringInputEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..f11d5f15284f741e45d854b7286c3308fa5c2bb3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/TuringInputEncoding.lean @@ -0,0 +1,109 @@ +import Mathlib.Computability.TuringMachine.ToPartrec +import Mathlib.Computability.Primrec.List + +namespace OAI + +/-! The input word of Mathlib's fixed interpreter is primitive recursive. +No computability claim about varying the machine table is needed. -/ + +namespace ForcedComputation.FiniteMachine + +open Turing PartrecToTM2 + +private theorem trNat_pos (p : PosNum) : trNat (p : ℕ) = trPosNum p := by + unfold trNat + rw [PosNum.of_to_nat] + rfl + +theorem trNat_rec (n : ℕ) : + trNat n = if n = 0 then [] else + (if n % 2 = 0 then Γ'.bit0 else Γ'.bit1) :: trNat (n / 2) := by + have h := Num.to_of_nat n + generalize (n : Num) = m at h ⊢ + rw [← h] + cases m with + | zero => simp [trNat, trNum] + | pos p => + change trNat (p : ℕ) = _ + rw [trNat_pos] + cases p with + | one => simp [trNat, trNum, trPosNum] + | bit0 p => + have hp := PosNum.to_nat_pos p + have hzero : (p : ℕ) + p ≠ 0 := by omega + have hmod : ((p : ℕ) + p) % 2 = 0 := by omega + have hdiv : ((p : ℕ) + p) / 2 = p := by omega + simp only [trPosNum, Num.cast_pos, PosNum.cast_bit0, hzero, ↓reduceIte, hmod, hdiv, + trNat_pos] + | bit1 p => + have hzero : (p : ℕ) + p + 1 ≠ 0 := by omega + have hmod : ((p : ℕ) + p + 1) % 2 ≠ 0 := by omega + have hdiv : ((p : ℕ) + p + 1) / 2 = p := by omega + simp only [trPosNum, Num.cast_pos, PosNum.cast_bit1, hzero, ↓reduceIte, hmod, hdiv, + trNat_pos] + +section +variable [Primcodable Γ'] + +private def nextBits (l : List (List Γ')) : Option (List Γ') := + if l.length = 0 then some [] else + (l[l.length / 2]?).map fun bs => + (if l.length % 2 = 0 then Γ'.bit0 else Γ'.bit1) :: bs + +private theorem nextBits_primrec : Primrec nextBits := by + apply Primrec.ite (Primrec.eq.comp Primrec.list_length (Primrec.const 0)) + (Primrec.const (some [])) + apply Primrec.option_map + (Primrec.list_getElem?.comp Primrec.id + (Primrec.nat_div.comp Primrec.list_length (Primrec.const 2))) + apply Primrec₂.uncurry.mp + apply Primrec.list_cons.comp + (Primrec.ite + (Primrec.eq.comp + (Primrec.nat_mod.comp (Primrec.list_length.comp Primrec.fst) (Primrec.const 2)) + (Primrec.const 0)) + (Primrec.const Γ'.bit0) (Primrec.const Γ'.bit1)) Primrec.snd + +theorem trNat_primrec : Primrec trNat := by + have h : Primrec₂ (fun (_ : Unit) n => trNat n) := + Primrec.nat_strong_rec (fun (_ : Unit) n => trNat n) + (nextBits_primrec.comp Primrec.snd).to₂ (by + intro _ n + rw [nextBits, List.length_map, List.length_range] + by_cases hn : n = 0 + · subst n + simp [trNat_zero] + · have hlt : n / 2 < n := Nat.div_lt_self (Nat.pos_of_ne_zero hn) (by decide) + simp only [hn, ↓reduceIte, List.getElem?_map, + List.getElem?_range hlt, Option.map_some] + rw [trNat_rec n, ite_eq_right hn]) + exact h.comp (Primrec.const ()) Primrec.id + +theorem trList_primrec : Primrec trList := by + have h : Primrec fun l : List ℕ => l.flatMap (fun n => trNat n ++ [Γ'.cons]) := + Primrec.list_flatMap Primrec.id + (Primrec.list_append.comp (trNat_primrec.comp Primrec.snd) + (Primrec.const [Γ'.cons])).to₂ + exact h.of_eq (by intro l; induction l <;> simp_all [trList]) + +end + +theorem trInit_primrec {K : Type*} [DecidableEq K] + {Γ : K → Type*} (k : K) [Finite (Γ k)] + [Primcodable (Γ k)] [Primcodable (TM2to1.Γ' K Γ)] + [Finite (TM2to1.Γ' K Γ)] : + Primrec (TM2to1.trInit (Γ := Γ) k) := by + let f : Γ k → TM2to1.Γ' K Γ := + fun a => (false, Function.update (fun _ => none) k (some a)) + have hL : Primrec (fun L : List (Γ k) => L.reverse.map f) := + Primrec.list_map Primrec.list_reverse + ((Primrec.dom_finite f).comp Primrec.snd).to₂ + exact (Primrec.list_cons.comp + ((Primrec.dom_finite (fun a : TM2to1.Γ' K Γ => + (show TM2to1.Γ' K Γ from (true, a.2)))).comp + (Primrec.list_headI.comp hL)) + (Primrec.list_tail.comp hL)) + +end ForcedComputation.FiniteMachine + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/VelocityTimeScale.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/VelocityTimeScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..15568d6a91de9f5af5949e4dc8cf240e4d4c6bf1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/VelocityTimeScale.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Regularity +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ForceEvaluation + +namespace OAI + +/-! Exact ordered mixed derivatives under multiplication of physical time. +This is the time part of the detector's viscosity rescaling. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +def scaledTimeLinear (ν : ℝ) : SpaceTime →L[ℝ] SpaceTime := + (ν • ContinuousLinearMap.fst ℝ ℝ Space).prod (ContinuousLinearMap.snd ℝ ℝ Space) + +theorem scaledTimeLinear_apply (ν : ℝ) (y : SpaceTime) : + scaledTimeLinear ν y = (ν * y.1, y.2) := rfl + +theorem scaledTimeLinear_direction (ν : ℝ) (j : Fin 4) : + scaledTimeLinear ν (spaceTimeDirection j) = + (if j = 0 then ν else 1) • spaceTimeDirection j := by + cases j using Fin.cases with + | zero => simp [scaledTimeLinear, spaceTimeDirection, Prod.smul_mk] + | succ k => simp [scaledTimeLinear, spaceTimeDirection] + +def velocityTimeScale (ν : ℝ) (V : Velocity) : Velocity := V ∘ scaledTimeLinear ν + +theorem velocityTimeScale_smooth {V : Velocity} (hV : ContDiff ℝ ∞ V) (ν : ℝ) : + ContDiff ℝ ∞ (velocityTimeScale ν V) := + hV.comp (scaledTimeLinear ν).contDiff + +theorem velocityTimeScale_derivative {V : Velocity} (hV : ContDiff ℝ ∞ V) + (ν : ℝ) (j : Fin 4) (y : SpaceTime) : + fderiv ℝ (velocityTimeScale ν V) y (spaceTimeDirection j) = + (if j = 0 then ν else 1) • + fderiv ℝ V (scaledTimeLinear ν y) (spaceTimeDirection j) := by + rw [velocityTimeScale, fderiv_comp y (hV.differentiable (by simp) _) + (scaledTimeLinear ν).differentiableAt, (scaledTimeLinear ν).fderiv, + ContinuousLinearMap.comp_apply, scaledTimeLinear_direction, map_smul] + +theorem mixedDerivative_velocityTimeScale {V : Velocity} (hV : ContDiff ℝ ∞ V) + (ν : ℝ) (α : List (Fin 4)) : + mixedDerivative (velocityTimeScale ν V) α = + ν ^ α.count 0 • velocityTimeScale ν (mixedDerivative V α) := by + induction α with + | nil => simp only [mixedDerivative, List.count_nil, pow_zero, one_smul] + | cons j α ih => + funext y + change fderiv ℝ (mixedDerivative (velocityTimeScale ν V) α) y + (spaceTimeDirection j) = _ + rw [ih, fderiv_const_smul + ((velocityTimeScale_smooth (mixedDerivative_smooth hV α) ν).differentiable (by simp) y), + smul_apply, + velocityTimeScale_derivative (mixedDerivative_smooth hV α)] + by_cases hj : j = 0 + · subst j + simp only [ite_true, List.count_cons_self, pow_succ, smul_smul] + rfl + · simp only [hj, ite_false, one_smul, List.count_cons_of_ne hj] + rfl + +theorem mixedDerivative_clm {V : Velocity} (hV : ContDiff ℝ ∞ V) + (A : Space →L[ℝ] Space) (α : List (Fin 4)) : + mixedDerivative (A ∘ V) α = A ∘ mixedDerivative V α := by + induction α with + | nil => rfl + | cons j α ih => + funext y + change fderiv ℝ (mixedDerivative (A ∘ V) α) y (spaceTimeDirection j) = _ + rw [ih, fderiv_comp y A.differentiableAt + ((mixedDerivative_smooth hV α).differentiable (by simp) y), A.fderiv] + rfl + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ViscosityScaling.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ViscosityScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..607e4a62e2607d4d5e36b739ce71c2169dc0b2cd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Programs/ViscosityScaling.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid + +namespace OAI + +/-! The detector's viscosity rescaling preserves its vertical height. +Only the planar drift is multiplied by the viscosity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def viscosityDrift (ν : ℝ) (a : ℝ → Plane → Plane) (t : ℝ) : Plane → Plane := + fun x => ν • a (ν * t) x + +def viscosityScalar (ν : ℝ) (w : ℝ → Plane → ℝ) (t : ℝ) : Plane → ℝ := w (ν * t) + +def viscositySource (ν : ℝ) (h : ℝ → Plane → ℝ) (t : ℝ) : Plane → ℝ := + fun x => ν * h (ν * t) x + +theorem viscosityDrift_smooth {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (ν : ℝ) : + ContDiff ℝ ∞ (Function.uncurry (viscosityDrift ν a)) := by + exact (contDiff_const (c := ν)).smul + (ha.comp ((contDiff_const.mul contDiff_fst).prodMk contDiff_snd)) + +theorem viscosityScalar_smooth {w : ℝ → Plane → ℝ} + (hw : ContDiff ℝ ∞ (Function.uncurry w)) (ν : ℝ) : + ContDiff ℝ ∞ (Function.uncurry (viscosityScalar ν w)) := + hw.comp ((contDiff_const.mul contDiff_fst).prodMk contDiff_snd) + +theorem GlobalTorusScalarSolution.viscosity {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 a h w w₀) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) {ν : ℝ} (hν : 0 ≤ ν) : + GlobalTorusScalarSolution ν (viscosityDrift ν a) (viscositySource ν h) + (viscosityScalar ν w) w₀ := by + intro T _ + refine ⟨(viscosityScalar_smooth hw ν).contDiffOn, ?_, ?_, ?_⟩ + · intro t ht + have ht₀ := mul_nonneg hν ht.1 + exact (hs (ν * t) ht₀).periodic (ν * t) ⟨ht₀, le_rfl⟩ + · simpa only [viscosityScalar, mul_zero] using (hs 0 le_rfl).initial + · intro t ht x + have ht₀ := mul_nonneg hν ht.1 + have hd : HasDerivAt (fun r => w r x) + (scalarGenerator 1 (a (ν * t)) (w (ν * t)) x + h (ν * t) x) (ν * t) := by + rw [← hs.deriv_eq hw ht₀ x] + exact ((hw.comp (contDiff_id.prodMk contDiff_const)).differentiable + (by simp) (ν * t)).hasDerivAt + have hc := (hd.scomp t (by simpa only [mul_one, id_eq] using + (hasDerivAt_id t).const_mul ν)).hasDerivWithinAt (s := Icc (0 : ℝ) T) + convert hc using 1 + · rfl + · simp only [scalarGenerator, viscosityDrift, viscosityScalar, viscositySource, + map_smul, smul_eq_mul, one_mul] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedDerivativeGraph.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedDerivativeGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..cec1e718adb77ddea49e163fb40889a2f67224a1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedDerivativeGraph.lean @@ -0,0 +1,66 @@ +import Mathlib.Analysis.Calculus.UniformLimitsDeriv +import Mathlib.Topology.ContinuousMap.Bounded.Normed +import Mathlib.Topology.Algebra.Module.ClosedSubmodule + +namespace OAI + +/-! The graph of spatial differentiation in the uniform norm is closed. + +Both the function and its proposed derivative are bounded continuous maps. This +is the basic completeness lemma for finite families of bounded spatial jets. +-/ + +noncomputable section +namespace ForcedComputation + +open Filter +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Uniform limits of a function and its derivative remain a derivative pair. -/ +theorem isClosed_boundedDerivativeGraph : + IsClosed {p : (E →ᵇ F) × (E →ᵇ (E →L[ℝ] F)) | + ∀ x, HasFDerivAt p.1 (p.2 x) x} := by + apply IsSeqClosed.isClosed + intro u p hu hp + have h₀ : TendstoUniformly (fun n => (u n).1) p.1 atTop := + BoundedContinuousFunction.tendsto_iff_tendstoUniformly.mp + (continuous_fst.tendsto p |>.comp hp) + have h₁ : TendstoUniformly (fun n => (u n).2) p.2 atTop := + BoundedContinuousFunction.tendsto_iff_tendstoUniformly.mp + (continuous_snd.tendsto p |>.comp hp) + exact fun x => hasFDerivAt_of_tendstoUniformly h₁ + (fun n y => hu n y) (fun y => h₀.tendsto_at y) x + +/-- The bounded derivative graph, with its inherited uniform product norm. -/ +def boundedDerivativeGraph : + ClosedSubmodule ℝ ((E →ᵇ F) × (E →ᵇ (E →L[ℝ] F))) where + carrier := {p | ∀ x, HasFDerivAt p.1 (p.2 x) x} + zero_mem' := by + intro x + change HasFDerivAt (fun _ : E => (0 : F)) (0 : E →L[ℝ] F) x + exact hasFDerivAt_const (𝕜 := ℝ) (0 : F) x + add_mem' := by + intro p q hp hq x + exact (hp x).add (hq x) + smul_mem' := by + intro c p hp x + exact (hp x).const_smul c + isClosed' := isClosed_boundedDerivativeGraph E F + +@[simp] theorem mem_boundedDerivativeGraph + (p : (E →ᵇ F) × (E →ᵇ (E →L[ℝ] F))) : + p ∈ boundedDerivativeGraph E F ↔ ∀ x, HasFDerivAt p.1 (p.2 x) x := Iff.rfl + +/-- A bounded function with bounded continuous derivative, in its graph norm. -/ +abbrev BoundedC1 := boundedDerivativeGraph E F + +instance [CompleteSpace F] : CompleteSpace (BoundedC1 E F) := inferInstance + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedKernelConvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedKernelConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..b678e45432aa0c17605d22ee97067fa7b40f93ba --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedKernelConvolution.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJets +import Mathlib.Analysis.Calculus.ParametricIntegral + +namespace OAI + +/-! Pointwise convolution and differentiation for integrable kernels and bounded spatial jets. -/ + +noncomputable section +namespace ForcedComputation.BoundedKernel + +open MeasureTheory Set Filter +open scoped Topology ContDiff + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +def convolve (μ : Measure E) (w : E → ℝ) (f : E → F) (x : E) : F := + ∫ y, w y • f (x - y) ∂μ + +omit [NormedSpace ℝ E] [CompleteSpace F] in +theorem integrand_integrable (μ : Measure E) (w : E → ℝ) (f : E → F) + (hw : Integrable w μ) (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) + (x : E) : Integrable (fun y => w y • f (x - y)) μ := by + apply (hw.norm.mul_const C).mono' + · exact hw.aestronglyMeasurable.smul + ((hf.comp (continuous_const.sub continuous_id)).aestronglyMeasurable) + · exact ae_of_all _ fun y => by + rw [norm_smul] + exact mul_le_mul_of_nonneg_left (hC (x - y)) (norm_nonneg _) + +omit [NormedSpace ℝ E] [CompleteSpace F] in +theorem norm_convolve_le (μ : Measure E) (w : E → ℝ) (f : E → F) + (hw : Integrable w μ) (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) + (x : E) : ‖convolve E F μ w f x‖ ≤ C * ∫ y, |w y| ∂μ := by + have hi := integrand_integrable E F μ w f hw hf C hC x + calc + _ ≤ ∫ y, ‖w y • f (x - y)‖ ∂μ := norm_integral_le_integral_norm _ + _ ≤ ∫ y, ‖w y‖ * C ∂μ := by + apply integral_mono hi.norm (hw.norm.mul_const C) + intro y + change ‖w y • f (x - y)‖ ≤ ‖w y‖ * C + rw [norm_smul] + exact mul_le_mul_of_nonneg_left (hC (x - y)) (norm_nonneg _) + _ = C * ∫ y, |w y| ∂μ := by + rw [integral_mul_const] + simp only [Real.norm_eq_abs] + ring + +omit [CompleteSpace F] in +/-- Dominated differentiation transfers a spatial derivative to the bounded input function. -/ +theorem hasFDerivAt_convolve (μ : Measure E) (w : E → ℝ) (f : E → F) + (hw : Integrable w μ) (hf : ContDiff ℝ 1 f) + (C D : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) + (x : E) : + HasFDerivAt (convolve E F μ w f) + (∫ y, w y • fderiv ℝ f (x - y) ∂μ) x := by + have hdc : Continuous (fderiv ℝ f) := hf.continuous_fderiv (by norm_num) + refine hasFDerivAt_integral_of_dominated_of_fderiv_le + (μ := μ) (s := univ) (F' := fun z y => w y • fderiv ℝ f (z - y)) + (bound := fun y => ‖w y‖ * D) univ_mem ?_ ?_ ?_ ?_ ?_ ?_ + · exact Eventually.of_forall fun z => + (integrand_integrable E F μ w f hw hf.continuous C hC z).aestronglyMeasurable + · exact integrand_integrable E F μ w f hw hf.continuous C hC x + · exact (integrand_integrable E (E →L[ℝ] F) μ w (fderiv ℝ f) hw hdc D hD x).aestronglyMeasurable + · exact ae_of_all _ fun y z _ => by + rw [norm_smul] + exact mul_le_mul_of_nonneg_left (hD (z - y)) (norm_nonneg _) + · exact hw.norm.mul_const D + · exact ae_of_all _ fun y z _ => by + have h := (((hf.differentiable (by norm_num)) (z - y)).hasFDerivAt.comp z + ((hasFDerivAt_id z).sub_const y)).const_smul (w y) + change HasFDerivAt (fun v => w y • f (v - y)) _ z at h + simpa only [ContinuousLinearMap.comp_id, Function.comp_def, id_eq, Pi.smul_apply] using h + +omit [CompleteSpace F] in +theorem fderiv_convolve (μ : Measure E) (w : E → ℝ) (f : E → F) + (hw : Integrable w μ) (hf : ContDiff ℝ 1 f) + (C D : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) + (x : E) : + fderiv ℝ (convolve E F μ w f) x = + ∫ y, w y • fderiv ℝ f (x - y) ∂μ := + (hasFDerivAt_convolve E F μ w f hw hf C D hC hD x).fderiv + +end ForcedComputation.BoundedKernel + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetBilinear.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetBilinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0d1504bae100e930a48602f112c0abdbb1af809 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetBilinear.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetOperators + +namespace OAI + +/-! The pointwise product as a continuous bilinear operator on finite spatial jets. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open scoped Topology BoundedContinuousFunction + +variable (E F G H : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + [NormedAddCommGroup G] [NormedSpace ℝ G] + [NormedAddCommGroup H] [NormedSpace ℝ H] + +/-- The operator type with its normed-space structure fixed before taking another operator space. -/ +def Operator (k : ℕ) := Space E G k →L[ℝ] Space E H k + +instance (k : ℕ) : NormedAddCommGroup (Operator E G H k) := + inferInstanceAs (NormedAddCommGroup (Space E G k →L[ℝ] Space E H k)) + +instance (k : ℕ) : NormedSpace ℝ (Operator E G H k) := + inferInstanceAs (NormedSpace ℝ (Space E G k →L[ℝ] Space E H k)) + +def operatorEquiv (k : ℕ) : + Operator E G H k ≃ₗᵢ[ℝ] (Space E G k →L[ℝ] Space E H k) := + LinearIsometryEquiv.refl ℝ _ + +instance (k : ℕ) : CoeFun (Operator E G H k) (fun _ => Space E G k → Space E H k) := + ⟨fun L => operatorEquiv E G H k L⟩ + +/-- Dependence of the multiplication operator on its coefficient jet is linear and bounded. -/ +def bilinearCLM (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) : + Space E F k →L[ℝ] Operator E G H k := + LinearMap.mkContinuous + { toFun := fixedBilinear E F G H k B + map_add' := by + intro J L + apply ContinuousLinearMap.ext + intro K + apply function_injective E H k + apply BoundedContinuousFunction.ext + intro x + change function E H k (bilinear E F G H k B (J + L) K) x = + function E H k (bilinear E F G H k B J K + bilinear E F G H k B L K) x + simp only [function_bilinear, function_add, map_add, + add_apply] + map_smul' := by + intro c J + apply ContinuousLinearMap.ext + intro K + apply function_injective E H k + apply BoundedContinuousFunction.ext + intro x + change function E H k (bilinear E F G H k B (c • J) K) x = + function E H k (c • bilinear E F G H k B J K) x + simp only [function_bilinear, function_smul, map_smul, smul_apply] } + (‖B‖ * (2 : ℝ) ^ k) + (fun J => by + change ‖fixedBilinear E F G H k B J‖ ≤ (‖B‖ * (2 : ℝ) ^ k) * ‖J‖ + exact norm_fixedBilinear_le E F G H k B J) + +@[simp] theorem bilinearCLM_apply (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) : + bilinearCLM E F G H k B J K = bilinear E F G H k B J K := rfl + +theorem norm_bilinearCLM_le (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) : + ‖bilinearCLM E F G H k B‖ ≤ ‖B‖ * (2 : ℝ) ^ k := by + refine (bilinearCLM E F G H k B).opNorm_le_bound (by positivity) ?_ + intro J + change ‖fixedBilinear E F G H k B J‖ ≤ (‖B‖ * (2 : ℝ) ^ k) * ‖J‖ + exact norm_fixedBilinear_le E F G H k B J + +/-- Joint time continuity of coefficient and unknown is enough for continuity of the source. -/ +theorem continuous_bilinear {X : Type*} [TopologicalSpace X] (k : ℕ) + (B : F →L[ℝ] G →L[ℝ] H) (J : X → Space E F k) (K : X → Space E G k) + (hJ : Continuous J) (hK : Continuous K) : + Continuous (fun t => bilinear E F G H k B (J t) (K t)) := by + convert! (((operatorEquiv E G H k).continuous.comp + ((bilinearCLM E F G H k B).continuous.comp hJ)).clm_apply hK) using 1 + +/-- The same continuity statement restricted to a time interval. -/ +theorem continuousOn_bilinear {X : Type*} [TopologicalSpace X] (S : Set X) (k : ℕ) + (B : F →L[ℝ] G →L[ℝ] H) (J : X → Space E F k) (K : X → Space E G k) + (hJ : ContinuousOn J S) (hK : ContinuousOn K S) : + ContinuousOn (fun t => bilinear E F G H k B (J t) (K t)) S := by + convert! (((operatorEquiv E G H k).continuous.comp_continuousOn + ((bilinearCLM E F G H k B).continuous.comp_continuousOn hJ)).clm_apply hK) using 1 + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetConvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..33ab143f44ece2f6efefc447958e778f350a9ee0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetConvolution.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedKernelConvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetOperators +import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap + +namespace OAI + +/-! Convolution by an integrable scalar kernel on the Banach space of finite spatial jets. + +The construction integrates each jet pointwise. It therefore does not assume that spatial +translations act strongly continuously on the uniform norm of the highest derivative. +-/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open MeasureTheory Set Filter +open scoped Topology ContDiff BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +omit [NormedSpace ℝ E] [CompleteSpace F] in +private theorem continuous_convolve (μ : Measure E) (w : E → ℝ) (f : E → F) + (hw : Integrable w μ) (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) : + Continuous (BoundedKernel.convolve E F μ w f) := by + apply continuous_of_dominated (bound := fun y => ‖w y‖ * C) + · intro x + exact (BoundedKernel.integrand_integrable E F μ w f hw hf C hC x).aestronglyMeasurable + · intro x + exact ae_of_all _ fun y => by + rw [norm_smul] + exact mul_le_mul_of_nonneg_left (hC (x - y)) (norm_nonneg _) + · exact hw.norm.mul_const C + · exact ae_of_all _ fun y => + (hf.comp (continuous_id.sub continuous_const)).const_smul (w y) + +/-- The kernel mass controlling every jet, with absolute values for signed kernels. -/ +def kernelMass (μ : Measure E) (w : E → ℝ) : ℝ := ∫ y, |w y| ∂μ + +omit [NormedAddCommGroup E] [NormedSpace ℝ E] [BorelSpace E] + [SecondCountableTopology E] in +theorem kernelMass_nonneg (μ : Measure E) (w : E → ℝ) : 0 ≤ kernelMass E μ w := + integral_nonneg fun y => abs_nonneg (w y) + +/-- Pointwise convolution of the finite family of bounded derivatives. -/ +def convolutionFamily (k : ℕ) (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) + (J : Space E F k) : Family E F k := fun i => + BoundedContinuousFunction.ofNormedAddCommGroup + (BoundedKernel.convolve E (Value E F i.val) μ w (J.val i)) + (continuous_convolve E (Value E F i.val) μ w (J.val i) hw (J.val i).continuous + ‖J‖ (norm_jet_le E F k J i)) + (‖J‖ * kernelMass E μ w) + (fun x => BoundedKernel.norm_convolve_le E (Value E F i.val) μ w (J.val i) + hw (J.val i).continuous ‖J‖ (norm_jet_le E F k J i) x) + +/-- The consecutive derivatives remain compatible after convolution. -/ +theorem convolutionFamily_compatible (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) : + convolutionFamily E F k μ w hw J ∈ compatible E F k := by + apply (mem_compatible E F k _).mpr + intro i x + have hf : ContDiff ℝ 1 (J.val i.castSucc) := + jet_contDiff E F k J i.val 1 (by omega) + have hd (z : E) : + fderiv ℝ (J.val i.castSucc) z = curryMap E F i.val (J.val i.succ z) := + (hasFDerivAt E F k J i z).fderiv + have hb (z : E) : ‖fderiv ℝ (J.val i.castSucc) z‖ ≤ ‖J‖ := by + rw [hd, (curryMap E F i.val).norm_map] + exact norm_jet_le E F k J i.succ z + have h := BoundedKernel.hasFDerivAt_convolve E (Value E F i.val) μ w + (J.val i.castSucc) hw hf ‖J‖ ‖J‖ (norm_jet_le E F k J i.castSucc) hb x + have hi := BoundedKernel.integrand_integrable E (Value E F (i.val + 1)) μ w + (J.val i.succ) hw (J.val i.succ).continuous ‖J‖ + (norm_jet_le E F k J i.succ) x + have he : (∫ y, w y • fderiv ℝ (J.val i.castSucc) (x - y) ∂μ) = + curryMap E F i.val (∫ y, w y • J.val i.succ (x - y) ∂μ) := by + simp_rw [hd] + simpa only [map_smul, ContinuousLinearEquiv.coe_coe, + LinearIsometryEquiv.coe_toContinuousLinearEquiv] using + ((curryMap E F i.val).toContinuousLinearEquiv.toContinuousLinearMap.integral_comp_comm hi) + rw [he] at h + exact h + +/-- Convolution as an element of the same finite-order jet space. -/ +def convolution (k : ℕ) (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) + (J : Space E F k) : Space E F k := + ⟨convolutionFamily E F k μ w hw J, convolutionFamily_compatible E F k μ w hw J⟩ + +@[simp] theorem convolution_jet (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) (i : Fin (k + 1)) (x : E) : + (convolution E F k μ w hw J).val i x = ∫ y, w y • J.val i (x - y) ∂μ := rfl + +theorem function_convolution (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) (x : E) : + function E F k (convolution E F k μ w hw J) x = + ∫ y, w y • function E F k J (x - y) ∂μ := by + rw [function_apply, convolution_jet] + have hi := BoundedKernel.integrand_integrable E (Value E F 0) μ w + (J.val (firstIndex k)) hw (J.val (firstIndex k)).continuous ‖J‖ + (norm_jet_le E F k J (firstIndex k)) x + symm + simpa only [function_apply, map_smul, ContinuousLinearEquiv.coe_coe, + LinearIsometryEquiv.coe_toContinuousLinearEquiv] using + ((valueMap E F).toContinuousLinearEquiv.toContinuousLinearMap.integral_comp_comm hi) + +theorem norm_convolution_le (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) : + ‖convolution E F k μ w hw J‖ ≤ kernelMass E μ w * ‖J‖ := by + change ‖convolutionFamily E F k μ w hw J‖ ≤ _ + apply (pi_norm_le_iff_of_nonneg (mul_nonneg (kernelMass_nonneg E μ w) (norm_nonneg J))).mpr + intro i + apply (BoundedContinuousFunction.norm_le + (mul_nonneg (kernelMass_nonneg E μ w) (norm_nonneg J))).mpr + intro x + change ‖BoundedKernel.convolve E (Value E F i.val) μ w (J.val i) x‖ ≤ _ + simpa only [kernelMass, mul_comm] using BoundedKernel.norm_convolve_le E (Value E F i.val) + μ w (J.val i) hw (J.val i).continuous ‖J‖ (norm_jet_le E F k J i) x + +/-- The bounded linear heat/convolution operator; its norm is at most the kernel's L1 mass. -/ +def convolutionCLM (k : ℕ) (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) : + Space E F k →L[ℝ] Space E F k := + LinearMap.mkContinuous + { toFun := convolution E F k μ w hw + map_add' := by + intro J K + apply Subtype.ext + funext i + apply BoundedContinuousFunction.ext + intro x + change (∫ y, w y • (J.val i (x - y) + K.val i (x - y)) ∂μ) = + (∫ y, w y • J.val i (x - y) ∂μ) + ∫ y, w y • K.val i (x - y) ∂μ + simp_rw [smul_add] + exact integral_add + (BoundedKernel.integrand_integrable E (Value E F i.val) μ w (J.val i) + hw (J.val i).continuous ‖J‖ (norm_jet_le E F k J i) x) + (BoundedKernel.integrand_integrable E (Value E F i.val) μ w (K.val i) + hw (K.val i).continuous ‖K‖ (norm_jet_le E F k K i) x) + map_smul' := by + intro c J + apply Subtype.ext + funext i + apply BoundedContinuousFunction.ext + intro x + change (∫ y, w y • (c • J.val i (x - y)) ∂μ) = + c • ∫ y, w y • J.val i (x - y) ∂μ + simp_rw [smul_comm (w _) c] + exact integral_smul c _ } + (kernelMass E μ w) (norm_convolution_le E F k μ w hw) + +@[simp] theorem convolutionCLM_apply (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) : + convolutionCLM E F k μ w hw J = convolution E F k μ w hw J := rfl + +theorem norm_convolutionCLM_le (k : ℕ) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) : ‖convolutionCLM E F k μ w hw‖ ≤ kernelMass E μ w := by + exact (convolutionCLM E F k μ w hw).opNorm_le_bound + (kernelMass_nonneg E μ w) (norm_convolution_le E F k μ w hw) + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetCurves.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetCurves.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ebe673f9952f493b2b357cecdb984f3786043c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetCurves.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetProduct +import Mathlib.Topology.ContinuousMap.Compact + +namespace OAI + +/-! Uniform spatial derivative estimates give continuous coefficient curves in jet norm. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets +open scoped Topology NNReal BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem norm_sub_le_of_jets (k : ℕ) (J K : Space E F k) {C : ℝ} (hC : 0 ≤ C) + (h : ∀ (i : Fin (k+1)) (x : E), ‖J.val i x - K.val i x‖ ≤ C) : + ‖J-K‖ ≤ C := by + change ‖J.val-K.val‖ ≤ C + apply (pi_norm_le_iff_of_nonneg hC).mpr + intro i + apply (BoundedContinuousFunction.norm_le hC).mpr + exact h i + +/-- A common modulus for each derivative controls the Banach-space distance. -/ +theorem lipschitzWith_of_jets {A : Type*} [PseudoMetricSpace A] (k : ℕ) + (J : A → Space E F k) (L : ℝ≥0) + (h : ∀ s t (i : Fin (k+1)) (x : E), + ‖(J s).val i x - (J t).val i x‖ ≤ L * dist s t) : LipschitzWith L J := by + apply LipschitzWith.of_dist_le_mul + intro s t + rw [dist_eq_norm] + exact norm_sub_le_of_jets E F k (J s) (J t) (mul_nonneg L.coe_nonneg dist_nonneg) + (h s t) + +/-- Bounded derivatives on a compact time interval, with a uniform time modulus. -/ +def ofFunctionCurve (k : ℕ) (T : ℝ) (f : ℝ → E → F) + (hf : ∀ t ∈ Set.Icc (0 : ℝ) T, ContDiff ℝ k (f t)) (C : ℝ) + (hC : ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n (f t) x‖ ≤ C) + (L : ℝ≥0) + (hL : ∀ s ∈ Set.Icc (0 : ℝ) T, ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (f s) x - iteratedFDeriv ℝ n (f t) x‖ ≤ L * |s-t|) : + C(Set.Icc (0 : ℝ) T, Space E F k) where + toFun := fun t => ofFunction E F k (f t) (hf t t.property) C (hC t t.property) + continuous_toFun := by + apply LipschitzWith.continuous (K := L) + apply lipschitzWith_of_jets E F k _ L + intro s t i x + change ‖iteratedFDeriv ℝ i.val (f s) x - iteratedFDeriv ℝ i.val (f t) x‖ ≤ + L * dist s t + simpa only [Subtype.dist_eq, Real.dist_eq] using + hL s s.property t t.property i.val (Nat.le_of_lt_succ i.isLt) x + +@[simp] theorem function_ofFunctionCurve (k : ℕ) (T : ℝ) (f : ℝ → E → F) + (hf : ∀ t ∈ Set.Icc (0 : ℝ) T, ContDiff ℝ k (f t)) (C : ℝ) + (hC : ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n (f t) x‖ ≤ C) + (L : ℝ≥0) + (hL : ∀ s ∈ Set.Icc (0 : ℝ) T, ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (f s) x - iteratedFDeriv ℝ n (f t) x‖ ≤ L * |s-t|) + (t : Set.Icc (0 : ℝ) T) (x : E) : + function E F k (ofFunctionCurve E F k T f hf C hC L hL t) x = f t x := + function_ofFunction E F k _ _ _ _ x + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetDifferentiation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetDifferentiation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e9d49f077d53843ab4e59fadb8faae2e0fd8408 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetDifferentiation.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetLinear +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetConvolution + +namespace OAI + +/-! Bounded differentiation and linear maps commute with spatial convolution. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open MeasureTheory +open scoped Topology ContDiff + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +section Linear +variable (G : Type*) [NormedAddCommGroup G] [NormedSpace ℝ G] [CompleteSpace G] + +/-- Fixed linear postcomposition commutes with convolution on each finite jet space. -/ +theorem postcomposeCLM_convolution (k : ℕ) (L : F →L[ℝ] G) + (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) (J : Space E F k) : + postcomposeCLM E F G k L (convolution E F k μ w hw J) = + convolution E G k μ w hw (postcomposeCLM E F G k L J) := by + apply function_injective E G k + ext x + simp only [postcomposeCLM_apply, function_postcompose, function_convolution] + have hi := BoundedKernel.integrand_integrable E F μ w (function E F k J) + hw (function E F k J).continuous ‖J‖ (norm_function_le E F k J) x + simpa only [map_smul] using (L.integral_comp_comm hi).symm + +end Linear + +/-- A bounded spatial derivative may be taken on the input of a convolution. -/ +theorem derivativeCLM_convolution (k : ℕ) + (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) (J : Space E F (k+1)) : + derivativeCLM E F k (convolution E F (k+1) μ w hw J) = + convolution E (E →L[ℝ] F) k μ w hw (derivativeCLM E F k J) := by + apply function_injective E (E →L[ℝ] F) k + apply BoundedContinuousFunction.ext + intro x + change function E (E →L[ℝ] F) k (derivative E F k (convolution E F (k+1) μ w hw J)) x = _ + rw [function_derivative, function_convolution] + have he : (function E F (k+1) (convolution E F (k+1) μ w hw J) : E → F) = + BoundedKernel.convolve E F μ w (function E F (k+1) J) := by + funext z + exact function_convolution E F (k+1) μ w hw J z + rw [he] + have hd : ∀ z, ‖fderiv ℝ (function E F (k+1) J) z‖ ≤ ‖J‖ := by + intro z + rw [← function_derivative E F k J z] + exact (norm_function_le E (E →L[ℝ] F) k (derivative E F k J) z).trans + (norm_derivative_le E F k J) + have hp := BoundedKernel.fderiv_convolve E F μ w (function E F (k+1) J) hw + ((function_contDiff E F (k+1) J).of_le (by simp)) + ‖J‖ ‖J‖ (norm_function_le E F (k+1) J) hd x + exact hp.trans (integral_congr_ae (ae_of_all _ (fun y => by + change w y • fderiv ℝ (function E F (k+1) J) (x-y) = + w y • function E (E →L[ℝ] F) k (derivative E F k J) (x-y) + rw [function_derivative]))) + +/-- In particular, directional derivatives commute with spatial convolution. -/ +theorem directionalDerivativeCLM_convolution (k : ℕ) (v : E) + (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) (J : Space E F (k+1)) : + directionalDerivativeCLM E F k v (convolution E F (k+1) μ w hw J) = + convolution E F k μ w hw (directionalDerivativeCLM E F k v J) := by + change postcomposeCLM E (E →L[ℝ] F) F k (ContinuousLinearMap.apply ℝ F v) + (derivativeCLM E F k (convolution E F (k+1) μ w hw J)) = _ + exact (congrArg (postcomposeCLM E (E →L[ℝ] F) F k (ContinuousLinearMap.apply ℝ F v)) + (derivativeCLM_convolution E F k μ w hw J)).trans + (postcomposeCLM_convolution E (E →L[ℝ] F) F k (ContinuousLinearMap.apply ℝ F v) + μ w hw (derivativeCLM E F k J)) + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetIntegral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fedd1f4f566d38f4ec0985907b17cce017139e7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetIntegral.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetBilinear +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic + +namespace OAI + +/-! Integrating time-dependent sources in the finite spatial jet Banach space. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open MeasureTheory +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +/-- Time integration commutes with pointwise evaluation of the represented function. -/ +theorem function_intervalIntegral (k : ℕ) (J : ℝ → Space E F k) (a b : ℝ) + (hJ : IntervalIntegrable J volume a b) (x : E) : + function E F k (∫ t in a..b, J t) x = + ∫ t in a..b, function E F k (J t) x := by + let L : Space E F k →L[ℝ] F := + (BoundedContinuousFunction.evalCLM ℝ x).comp (functionMap E F k) + exact (L.intervalIntegral_comp_comm hJ).symm + +/-- Every recorded spatial jet commutes with time integration. -/ +theorem jet_intervalIntegral (k : ℕ) (J : ℝ → Space E F k) (a b : ℝ) + (hJ : IntervalIntegrable J volume a b) (i : Fin (k + 1)) (x : E) : + (∫ t in a..b, J t).val i x = ∫ t in a..b, (J t).val i x := by + let L : Space E F k →L[ℝ] Value E F i.val := + (BoundedContinuousFunction.evalCLM ℝ x).comp (projection E F k i) + exact (L.intervalIntegral_comp_comm hJ).symm + +/-- Time integration preserves all spatial derivatives through the selected finite order. -/ +theorem iteratedFDeriv_intervalIntegral (k : ℕ) (J : ℝ → Space E F k) (a b : ℝ) + (hJ : IntervalIntegrable J volume a b) (n : ℕ) (hn : n ≤ k) (x : E) : + iteratedFDeriv ℝ n (function E F k (∫ t in a..b, J t)) x = + ∫ t in a..b, iteratedFDeriv ℝ n (function E F k (J t)) x := by + simp only [iteratedFDeriv_function E F k _ n hn] + exact jet_intervalIntegral E F k J a b hJ ⟨n, by omega⟩ x + +omit [CompleteSpace F] in +/-- A uniform source bound gives the exact interval-length bound in the jet norm. -/ +theorem norm_intervalIntegral_le (k : ℕ) (J : ℝ → Space E F k) (a b C : ℝ) + (hJ : ∀ t ∈ Set.uIoc a b, ‖J t‖ ≤ C) : + ‖∫ t in a..b, J t‖ ≤ C * |b - a| := + intervalIntegral.norm_integral_le_of_norm_le_const hJ + +variable (G H : Type*) [NormedAddCommGroup G] [NormedSpace ℝ G] + [NormedAddCommGroup H] [NormedSpace ℝ H] [CompleteSpace H] + +omit [CompleteSpace F] [CompleteSpace H] in +/-- A time-dependent coefficient and unknown yield an integrable jet-valued source. -/ +theorem intervalIntegrable_bilinear (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : ℝ → Space E F k) (K : ℝ → Space E G k) (a b : ℝ) + (hJ : ContinuousOn J (Set.uIcc a b)) (hK : ContinuousOn K (Set.uIcc a b)) : + IntervalIntegrable (fun t => bilinear E F G H k B (J t) (K t)) volume a b := + (continuousOn_bilinear E F G H (Set.uIcc a b) k B J K hJ hK).intervalIntegrable + +omit [CompleteSpace F] [CompleteSpace H] in +/-- Explicit finite-time source bound, with the finite-order Leibniz constant. -/ +theorem norm_intervalIntegral_bilinear_le (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : ℝ → Space E F k) (K : ℝ → Space E G k) (a b A C : ℝ) + (hC : 0 ≤ C) (hJ : ∀ t ∈ Set.uIoc a b, ‖J t‖ ≤ A) + (hK : ∀ t ∈ Set.uIoc a b, ‖K t‖ ≤ C) : + ‖∫ t in a..b, bilinear E F G H k B (J t) (K t)‖ ≤ + (‖B‖ * (2 : ℝ) ^ k * A * C) * |b - a| := by + apply intervalIntegral.norm_integral_le_of_norm_le_const + intro t ht + calc + _ ≤ ‖B‖ * (2 : ℝ) ^ k * ‖J t‖ * ‖K t‖ := + norm_bilinear_le E F G H k B (J t) (K t) + _ ≤ ‖B‖ * (2 : ℝ) ^ k * ‖J t‖ * C := + mul_le_mul_of_nonneg_left (hK t ht) (by positivity) + _ ≤ ‖B‖ * (2 : ℝ) ^ k * A * C := + mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (hJ t ht) (by positivity)) hC + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetJointSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetJointSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..c49c5f0759beebae92b8c7078ebd2dab432d6df9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetJointSmooth.lean @@ -0,0 +1,196 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetLinear +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatDataEquation +import Mathlib.Analysis.Calculus.ContDiff.Deriv +import Mathlib.Analysis.Calculus.FDeriv.Partial +import Mathlib.Analysis.Calculus.FDeriv.Extend +import Mathlib.Analysis.Calculus.TangentCone.Prod +import Mathlib.Analysis.Calculus.TangentCone.Real + +namespace OAI + +/-! Smooth time curves of compatible spatial jets are jointly smooth on the closed slab. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets +open ShearFlows Set Filter +open scoped Topology ContDiff BigOperators BoundedContinuousFunction + +structure SmoothPlaneCurves (T : ℝ) where + curve : ∀ k, ℝ → Space Plane ℝ k + smooth : ∀ k, ContDiffOn ℝ ∞ (curve k) (Icc 0 T) + compatible : ∀ k n (hkn : k ≤ n) t, t ∈ Icc (0 : ℝ) T → + truncateCLM Plane ℝ k n hkn (curve n t) = curve k t + +namespace SmoothPlaneCurves + +def value {T : ℝ} (J : SmoothPlaneCurves T) (p : ℝ × Plane) : ℝ := + function Plane ℝ 0 (J.curve 0 p.1) p.2 + +theorem value_eq {T : ℝ} (J : SmoothPlaneCurves T) (k : ℕ) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + (fun x => J.value (t,x)) = (function Plane ℝ k (J.curve k t) : Plane → ℝ) := by + funext x + have he := congrArg (fun L : Space Plane ℝ 0 => function Plane ℝ 0 L x) + (J.compatible 0 k (Nat.zero_le k) t ht) + change function Plane ℝ 0 (truncate Plane ℝ 0 k (Nat.zero_le k) (J.curve k t)) x = _ at he + rw [function_truncate] at he + exact he.symm + +theorem value_slice_smooth {T : ℝ} (J : SmoothPlaneCurves T) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : ContDiff ℝ ∞ (fun x => J.value (t,x)) := by + apply contDiff_infty.mpr + intro k + rw [J.value_eq k ht] + exact function_contDiff Plane ℝ k _ + +theorem value_continuousOn {T : ℝ} (J : SmoothPlaneCurves T) : + ContinuousOn J.value (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := by + have hc : ContinuousOn (fun p : ℝ × Plane => function Plane ℝ 0 (J.curve 0 p.1)) + (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := + (functionMap Plane ℝ 0).continuous.comp_continuousOn + ((J.smooth 0).continuousOn.comp continuous_fst.continuousOn (fun p hp => hp.1)) + exact (show Continuous (fun p : (Plane →ᵇ ℝ) × Plane => p.1 p.2) from continuous_eval).comp_continuousOn + (hc.prodMk continuous_snd.continuousOn) + +def timeDerivative {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) : SmoothPlaneCurves T where + curve k := derivWithin (J.curve k) (Icc (0 : ℝ) T) + smooth k := (J.smooth k).derivWithin (uniqueDiffOn_Icc hT) (by simp) + compatible := by + intro k n hkn t ht + let L := truncateCLM Plane ℝ k n hkn + have hd := L.hasFDerivAt.comp_hasDerivWithinAt t + (((J.smooth n).differentiableOn (by simp) t ht).hasDerivWithinAt) + have hd' : HasDerivWithinAt (J.curve k) + (L (derivWithin (J.curve n) (Icc (0 : ℝ) T) t)) (Icc (0 : ℝ) T) t := + hd.congr (fun s hs => (J.compatible k n hkn s hs).symm) + (J.compatible k n hkn t ht).symm + exact (hd'.derivWithin (uniqueDiffOn_Icc hT t ht)).symm + +def spaceDerivative {T : ℝ} (J : SmoothPlaneCurves T) (j : Fin 2) : SmoothPlaneCurves T where + curve k t := directionalDerivativeCLM Plane ℝ k (Pi.single j 1) (J.curve (k+1) t) + smooth k := (directionalDerivativeCLM Plane ℝ k (Pi.single j 1)).contDiff.comp_contDiffOn + (J.smooth (k+1)) + compatible := by + intro k n hkn t ht + rw [directionalDerivativeCLM_truncate, + J.compatible (k+1) (n+1) (Nat.add_le_add_right hkn 1) t ht] + +theorem value_spaceDerivative {T : ℝ} (J : SmoothPlaneCurves T) (j : Fin 2) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) (x : Plane) : + (J.spaceDerivative j).value (t,x) = PlaneHeat.spatialPartial ℝ j (fun y => J.value (t,y)) x := by + change function Plane ℝ 0 (directionalDerivativeCLM Plane ℝ 0 (Pi.single j 1) (J.curve 1 t)) x = _ + rw [function_directionalDerivativeCLM, ← J.value_eq 1 ht] + rfl + +theorem value_time_hasDerivWithinAt {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) (x : Plane) : + HasDerivWithinAt (fun s => J.value (s,x)) ((J.timeDerivative hT).value (t,x)) + (Icc (0 : ℝ) T) t := by + let L : Space Plane ℝ 0 →L[ℝ] ℝ := + (BoundedContinuousFunction.evalCLM ℝ x).comp (functionMap Plane ℝ 0) + exact L.hasFDerivAt.comp_hasDerivWithinAt t + (((J.smooth 0).differentiableOn (by simp) t ht).hasDerivWithinAt) + +def spatialDerivative {T : ℝ} (J : SmoothPlaneCurves T) (p : ℝ × Plane) : Plane →L[ℝ] ℝ := + ∑ j : Fin 2, (J.spaceDerivative j).value p • ContinuousLinearMap.proj j + +def totalDerivative {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) (p : ℝ × Plane) : + (ℝ × Plane) →L[ℝ] ℝ := + ((J.timeDerivative hT).value p • (1 : ℝ →L[ℝ] ℝ)).coprod (J.spatialDerivative p) + +theorem spatialDerivative_eq {T : ℝ} (J : SmoothPlaneCurves T) + {p : ℝ × Plane} (hp : p ∈ Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) : + J.spatialDerivative p = fderiv ℝ (fun y => J.value (p.1,y)) p.2 := by + apply ContinuousLinearMap.ext + intro v + have hv : v = v 0 • Pi.single 0 1 + v 1 • Pi.single 1 1 := by + ext j + fin_cases j <;> simp + rw [spatialDerivative, Fin.sum_univ_two, add_apply, smul_apply, + smul_apply, ContinuousLinearMap.proj_apply, ContinuousLinearMap.proj_apply, + value_spaceDerivative J 0 hp.1, value_spaceDerivative J 1 hp.1] + conv_rhs => rw [hv, map_add, map_smul, map_smul] + simp only [PlaneHeat.spatialPartial, smul_eq_mul] + ring + +theorem spatialDerivative_continuousOn {T : ℝ} (J : SmoothPlaneCurves T) : + ContinuousOn J.spatialDerivative (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := + continuousOn_finsetSum _ (fun j _ => (J.spaceDerivative j).value_continuousOn.smul continuousOn_const) + +theorem totalDerivative_continuousOn {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) : + ContinuousOn (J.totalDerivative hT) (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := + ((J.timeDerivative hT).value_continuousOn.smul continuousOn_const).continuousLinearMapCoprod + J.spatialDerivative_continuousOn + +theorem value_hasFDerivAt_interior {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) + {p : ℝ × Plane} (hp : p ∈ Ioo (0 : ℝ) T ×ˢ (univ : Set Plane)) : + HasFDerivAt J.value (J.totalDerivative hT p) p := by + have hc : p ∈ Icc (0 : ℝ) T ×ˢ (univ : Set Plane) := ⟨⟨hp.1.1.le, hp.1.2.le⟩, hp.2⟩ + have htime : ∀ᶠ v : ℝ × Plane in 𝓝 p, HasFDerivAt (fun s => J.value (s,v.2)) + ((J.timeDerivative hT).value v • (1 : ℝ →L[ℝ] ℝ)) v.1 := by + filter_upwards [(isOpen_Ioo.prod isOpen_univ).mem_nhds hp] with v hv + have hd := (J.value_time_hasDerivWithinAt hT ⟨hv.1.1.le,hv.1.2.le⟩ v.2).hasDerivAt + (Icc_mem_nhds hv.1.1 hv.1.2) + convert hd.hasFDerivAt using 1 + apply ContinuousLinearMap.ext + intro r + simp [smul_eq_mul, mul_comm] + have hspace : ∀ᶠ v : ℝ × Plane in 𝓝 p, HasFDerivAt (fun y => J.value (v.1,y)) + (J.spatialDerivative v) v.2 := by + filter_upwards [(isOpen_Ioo.prod isOpen_univ).mem_nhds hp] with v hv + rw [J.spatialDerivative_eq ⟨⟨hv.1.1.le,hv.1.2.le⟩,hv.2⟩] + exact ((J.value_slice_smooth ⟨hv.1.1.le,hv.1.2.le⟩).differentiable (by simp) v.2).hasFDerivAt + exact (hasStrictFDerivAt_uncurry_coprod + (u := p) (f := fun t x => J.value (t,x)) + (f₁ := fun t x => (J.timeDerivative hT).value (t,x) • (1 : ℝ →L[ℝ] ℝ)) + (f₂ := fun t x => J.spatialDerivative (t,x)) htime hspace + (((J.timeDerivative hT).value_continuousOn.smul continuousOn_const).continuousAt + (prod_mem_nhds (Icc_mem_nhds hp.1.1 hp.1.2) (show (univ : Set Plane) ∈ 𝓝 p.2 from univ_mem))) + (J.spatialDerivative_continuousOn.continuousAt + (prod_mem_nhds (Icc_mem_nhds hp.1.1 hp.1.2) (show (univ : Set Plane) ∈ 𝓝 p.2 from univ_mem)))).hasFDerivAt + +theorem value_hasFDerivWithinAt {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) + {p : ℝ × Plane} (hp : p ∈ Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) : + HasFDerivWithinAt J.value (J.totalDerivative hT p) (Icc (0 : ℝ) T ×ˢ univ) p := by + have hc : closure (Ioo (0 : ℝ) T ×ˢ (univ : Set Plane)) = Icc (0 : ℝ) T ×ˢ univ := by + rw [closure_prod_eq, closure_Ioo hT.ne, closure_univ] + have hsub : Ioo (0 : ℝ) T ×ˢ (univ : Set Plane) ⊆ Icc (0 : ℝ) T ×ˢ univ := + prod_mono Ioo_subset_Icc_self (Subset.refl _) + have he : (fun q => fderiv ℝ J.value q) =ᶠ[𝓝[Ioo (0 : ℝ) T ×ˢ (univ : Set Plane)] p] + J.totalDerivative hT := by + filter_upwards [self_mem_nhdsWithin] with q hq + exact (J.value_hasFDerivAt_interior hT hq).fderiv + have hd := hasFDerivWithinAt_closure_of_tendsto_fderiv + (fun q hq => (J.value_hasFDerivAt_interior hT hq).differentiableAt.differentiableWithinAt) + ((convex_Ioo (0 : ℝ) T).prod convex_univ) (isOpen_Ioo.prod isOpen_univ) + (fun q hq => (J.value_continuousOn q (hc ▸ hq)).mono hsub) + (((J.totalDerivative_continuousOn hT p hp).mono hsub).congr' he.symm) + rwa [hc] at hd + +theorem value_contDiffOn {T : ℝ} (hT : 0 < T) (J : SmoothPlaneCurves T) : + ContDiffOn ℝ ∞ J.value (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := by + have hi (n : ℕ) : ∀ J : SmoothPlaneCurves T, + ContDiffOn ℝ n J.value (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := by + induction n with + | zero => exact fun K => contDiffOn_zero.mpr K.value_continuousOn + | succ n ih => + intro K + rw [Nat.cast_add, Nat.cast_one] + apply (contDiffOn_succ_iff_hasFDerivWithinAt_of_uniqueDiffOn + ((uniqueDiffOn_Icc hT).prod uniqueDiffOn_univ)).mpr + refine ⟨by simp, K.totalDerivative hT, ?_, fun p hp => K.value_hasFDerivWithinAt hT hp⟩ + change ContDiffOn ℝ (n : ℕ∞ω) (fun p => + ((K.timeDerivative hT).value p • (1 : ℝ →L[ℝ] ℝ)).coprod + (K.spatialDerivative p)) _ + simp only [← ContinuousLinearMap.comp_fst_add_comp_snd] + exact (((ih (K.timeDerivative hT)).smul contDiffOn_const).clm_comp contDiffOn_const).add + ((ContDiffOn.sum (fun j _ => + (ih (K.spaceDerivative j)).smul contDiffOn_const)).clm_comp contDiffOn_const) + exact contDiffOn_infty.mpr (fun n => hi n J) + +end SmoothPlaneCurves +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetKernelDependence.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetKernelDependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f1156cf8ca3cf87bb81e1db5168d5be6fd44ea3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetKernelDependence.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetConvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetBilinear + +namespace OAI + +/-! Dependence of finite-jet convolution operators on their integrable scalar kernels. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open MeasureTheory Filter +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +theorem convolutionCLM_sub_kernel (k : ℕ) (μ : Measure E) (w v : E → ℝ) + (hw : Integrable w μ) (hv : Integrable v μ) : + convolutionCLM E F k μ (w - v) (hw.sub hv) = + convolutionCLM E F k μ w hw - convolutionCLM E F k μ v hv := by + apply ContinuousLinearMap.ext + intro J + apply Subtype.ext + funext i + apply BoundedContinuousFunction.ext + intro x + change (∫ y, (w y - v y) • J.val i (x - y) ∂μ) = + (∫ y, w y • J.val i (x - y) ∂μ) - ∫ y, v y • J.val i (x - y) ∂μ + simp_rw [sub_smul] + exact integral_sub + (BoundedKernel.integrand_integrable E (Value E F i.val) μ w (J.val i) + hw (J.val i).continuous ‖J‖ (norm_jet_le E F k J i) x) + (BoundedKernel.integrand_integrable E (Value E F i.val) μ v (J.val i) + hv (J.val i).continuous ‖J‖ (norm_jet_le E F k J i) x) + +/-- L1 perturbations of the scalar kernel uniformly control the whole jet operator. -/ +theorem norm_convolutionCLM_sub_le (k : ℕ) (μ : Measure E) (w v : E → ℝ) + (hw : Integrable w μ) (hv : Integrable v μ) : + ‖convolutionCLM E F k μ w hw - convolutionCLM E F k μ v hv‖ ≤ + ∫ y, |w y - v y| ∂μ := by + rw [← convolutionCLM_sub_kernel E F k μ w v hw hv] + exact norm_convolutionCLM_le E F k μ (w - v) (hw.sub hv) + +/-- The convolution operator in the fixed normed operator space. -/ +def convolutionOperator (k : ℕ) (μ : Measure E) (w : E → ℝ) (hw : Integrable w μ) : + Operator E F F k := convolutionCLM E F k μ w hw + +@[simp] theorem operatorEquiv_convolutionOperator (k : ℕ) (μ : Measure E) + (w : E → ℝ) (hw : Integrable w μ) : + operatorEquiv E F F k (convolutionOperator E F k μ w hw) = + convolutionCLM E F k μ w hw := rfl + +/-- L1 convergence of kernels implies convergence in operator norm at every finite jet order. -/ +theorem tendsto_convolutionCLM {A : Type*} (l : Filter A) (k : ℕ) (μ : Measure E) + (w : A → E → ℝ) (v : E → ℝ) (hw : ∀ a, Integrable (w a) μ) + (hv : Integrable v μ) + (h : Tendsto (fun a => ∫ y, |w a y - v y| ∂μ) l (𝓝 0)) : + Tendsto (fun a => convolutionCLM E F k μ (w a) (hw a)) l + (𝓝 (convolutionCLM E F k μ v hv)) := by + have hnorm : Tendsto + (fun a => ‖convolutionOperator E F k μ (w a) (hw a) - + convolutionOperator E F k μ v hv‖) l (𝓝 0) := by + apply squeeze_zero (fun a => norm_nonneg _) + · intro a + exact norm_convolutionCLM_sub_le E F k μ (w a) v (hw a) hv + · exact h + have ht : Tendsto (fun a => convolutionOperator E F k μ (w a) (hw a)) l + (𝓝 (convolutionOperator E F k μ v hv)) := + tendsto_iff_norm_sub_tendsto_zero.mpr hnorm + have he := ((operatorEquiv E F F k).continuous.tendsto + (convolutionOperator E F k μ v hv)).comp ht + simpa only [Function.comp_def, operatorEquiv_convolutionOperator] using he + +/-- Forgetting higher derivatives commutes exactly with convolution. -/ +theorem convolution_truncate (k n : ℕ) (hkn : k ≤ n) (μ : Measure E) + (w : E → ℝ) (hw : Integrable w μ) (J : Space E F n) : + convolution E F k μ w hw (truncate E F k n hkn J) = + truncate E F k n hkn (convolution E F n μ w hw J) := by + apply function_injective E F k + apply BoundedContinuousFunction.ext + intro x + simp only [function_convolution, function_truncate] + +/-- The exact operator identity used when comparing fixed points at different jet orders. -/ +theorem convolutionCLM_truncate (k n : ℕ) (hkn : k ≤ n) (μ : Measure E) + (w : E → ℝ) (hw : Integrable w μ) : + (convolutionCLM E F k μ w hw).comp (truncateCLM E F k n hkn) = + (truncateCLM E F k n hkn).comp (convolutionCLM E F n μ w hw) := by + apply ContinuousLinearMap.ext + intro J + exact convolution_truncate E F k n hkn μ w hw J + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetLinear.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f3abacf94be7c1ea2addcdd7a5c4ca0e70dcd21 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetLinear.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetOperators + +namespace OAI + +/-! Fixed linear maps and directional derivatives on bounded spatial jets. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open scoped Topology BoundedContinuousFunction + +variable (E F G : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + [NormedAddCommGroup G] [NormedSpace ℝ G] + +/-- Postcomposition acts boundedly on every derivative in a finite jet. -/ +def postcompose (k : ℕ) (L : F →L[ℝ] G) (J : Space E F k) : Space E G k := + ofFunction E G k (L ∘ function E F k J) + (L.contDiff.comp (function_contDiff E F k J)) (‖L‖ * ‖J‖) + (fun n hn x => + (L.norm_iteratedFDeriv_comp_left (function_contDiff E F k J).contDiffAt + (by exact_mod_cast hn)).trans + (mul_le_mul_of_nonneg_left (norm_iteratedFDeriv_le E F k J n hn x) (norm_nonneg L))) + +@[simp] theorem function_postcompose (k : ℕ) (L : F →L[ℝ] G) (J : Space E F k) (x : E) : + function E G k (postcompose E F G k L J) x = L (function E F k J x) := + function_ofFunction E G k _ _ _ _ x + +theorem norm_postcompose_le (k : ℕ) (L : F →L[ℝ] G) (J : Space E F k) : + ‖postcompose E F G k L J‖ ≤ ‖L‖ * ‖J‖ := + norm_ofFunction_le E G k _ _ _ _ (mul_nonneg (norm_nonneg L) (norm_nonneg J)) + +/-- Apply one fixed bounded linear map to a jet-valued function. -/ +def postcomposeCLM (k : ℕ) (L : F →L[ℝ] G) : Space E F k →L[ℝ] Space E G k := + LinearMap.mkContinuous + { toFun := postcompose E F G k L + map_add' := by + intro J K + apply function_injective E G k + ext x + simp only [function_postcompose, function_add, map_add] + map_smul' := by + intro c J + apply function_injective E G k + ext x + simp only [function_postcompose, function_smul, map_smul, RingHom.id_apply] } + ‖L‖ (norm_postcompose_le E F G k L) + +@[simp] theorem postcomposeCLM_apply (k : ℕ) (L : F →L[ℝ] G) (J : Space E F k) : + postcomposeCLM E F G k L J = postcompose E F G k L J := rfl + +theorem norm_postcomposeCLM_le (k : ℕ) (L : F →L[ℝ] G) : + ‖postcomposeCLM E F G k L‖ ≤ ‖L‖ := + (postcomposeCLM E F G k L).opNorm_le_bound (norm_nonneg L) (norm_postcompose_le E F G k L) + +theorem postcomposeCLM_truncate (k n : ℕ) (hkn : k ≤ n) (L : F →L[ℝ] G) + (J : Space E F n) : + truncateCLM E G k n hkn (postcomposeCLM E F G n L J) = + postcomposeCLM E F G k L (truncateCLM E F k n hkn J) := by + apply function_injective E G k + ext x + change function E G k (truncate E G k n hkn (postcompose E F G n L J)) x = _ + simp only [function_truncate, postcomposeCLM_apply, function_postcompose] + rfl + +omit [NormedAddCommGroup G] [NormedSpace ℝ G] in +private theorem norm_evaluation_le (v : E) : ‖ContinuousLinearMap.apply ℝ F v‖ ≤ ‖v‖ := by + apply (ContinuousLinearMap.apply ℝ F v).opNorm_le_bound (norm_nonneg v) + intro L + simpa only [ContinuousLinearMap.apply_apply, mul_comm] using L.le_opNorm v + +omit [NormedAddCommGroup G] [NormedSpace ℝ G] in +/-- One directional derivative loses one order and has norm at most the direction norm. -/ +def directionalDerivativeCLM (k : ℕ) (v : E) : Space E F (k+1) →L[ℝ] Space E F k := + (postcomposeCLM E (E →L[ℝ] F) F k (ContinuousLinearMap.apply ℝ F v)).comp + (derivativeCLM E F k) + +omit [NormedAddCommGroup G] [NormedSpace ℝ G] in +@[simp] theorem function_directionalDerivativeCLM (k : ℕ) (v : E) + (J : Space E F (k+1)) (x : E) : + function E F k (directionalDerivativeCLM E F k v J) x = + fderiv ℝ (function E F (k+1) J) x v := by + change function E F k (postcompose E (E →L[ℝ] F) F k + (ContinuousLinearMap.apply ℝ F v) (derivative E F k J)) x = _ + rw [function_postcompose, function_derivative] + rfl + +omit [NormedAddCommGroup G] [NormedSpace ℝ G] in +theorem norm_directionalDerivativeCLM_le (k : ℕ) (v : E) : + ‖directionalDerivativeCLM E F k v‖ ≤ ‖v‖ := by + calc + _ ≤ ‖postcomposeCLM E (E →L[ℝ] F) F k (ContinuousLinearMap.apply ℝ F v)‖ * + ‖derivativeCLM E F k‖ := ContinuousLinearMap.opNorm_comp_le _ _ + _ ≤ ‖ContinuousLinearMap.apply ℝ F v‖ * 1 := + mul_le_mul (norm_postcomposeCLM_le E (E →L[ℝ] F) F k _) + (norm_derivativeCLM_le_one E F k) (norm_nonneg (derivativeCLM E F k)) + (norm_nonneg (ContinuousLinearMap.apply ℝ F v)) + _ ≤ ‖v‖ := by simpa only [mul_one] using norm_evaluation_le E F v + +omit [NormedAddCommGroup G] [NormedSpace ℝ G] in +theorem directionalDerivativeCLM_truncate (k n : ℕ) (hkn : k ≤ n) (v : E) + (J : Space E F (n+1)) : + truncateCLM E F k n hkn (directionalDerivativeCLM E F n v J) = + directionalDerivativeCLM E F k v + (truncateCLM E F (k+1) (n+1) (Nat.add_le_add_right hkn 1) J) := by + apply function_injective E F k + ext x + change function E F k + (truncate E F k n hkn (directionalDerivativeCLM E F n v J)) x = _ + rw [function_truncate, function_directionalDerivativeCLM, function_directionalDerivativeCLM] + have he : (function E F (k+1) + (truncateCLM E F (k+1) (n+1) (Nat.add_le_add_right hkn 1) J) : E → F) = + function E F (n+1) J := by + funext y + exact function_truncate E F (k+1) (n+1) (Nat.add_le_add_right hkn 1) J y + rw [he] + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetOperators.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetOperators.lean new file mode 100644 index 0000000000000000000000000000000000000000..99f9405cdcd9d998a3c3c799dc39ca2d9681a820 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetOperators.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetProduct + +namespace OAI + +/-! Bounded operators needed for the finite-order Volterra equation: +fixed-coefficient multiplication, lossless truncation, and one spatial derivative. +-/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +@[simp] theorem function_add (k : ℕ) (J K : Space E F k) (x : E) : + function E F k (J + K) x = function E F k J x + function E F k K x := by + simpa only [functionMap_apply, BoundedContinuousFunction.add_apply] using + congrArg (fun f : E →ᵇ F => f x) ((functionMap E F k).map_add J K) + +@[simp] theorem function_smul (k : ℕ) (c : ℝ) (J : Space E F k) (x : E) : + function E F k (c • J) x = c • function E F k J x := by + simpa only [functionMap_apply, BoundedContinuousFunction.smul_apply] using + congrArg (fun f : E →ᵇ F => f x) ((functionMap E F k).map_smul c J) + +section Product + +variable (G H : Type*) [NormedAddCommGroup G] [NormedSpace ℝ G] + [NormedAddCommGroup H] [NormedSpace ℝ H] + +/-- Fixing the first factor of a pointwise bilinear product gives a bounded linear map. -/ +def fixedBilinear (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) (J : Space E F k) : + Space E G k →L[ℝ] Space E H k := + LinearMap.mkContinuous + { toFun := bilinear E F G H k B J + map_add' := by + intro K L + apply function_injective E H k + ext x + simp only [function_bilinear, function_add, map_add] + map_smul' := by + intro c K + apply function_injective E H k + ext x + simp only [function_bilinear, function_smul, map_smul, RingHom.id_apply] } + (‖B‖ * (2 : ℝ) ^ k * ‖J‖) + (fun K => norm_bilinear_le E F G H k B J K) + +@[simp] theorem fixedBilinear_apply (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) : + fixedBilinear E F G H k B J K = bilinear E F G H k B J K := rfl + +theorem norm_fixedBilinear_le (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) (J : Space E F k) : + ‖fixedBilinear E F G H k B J‖ ≤ ‖B‖ * (2 : ℝ) ^ k * ‖J‖ := by + refine (fixedBilinear E F G H k B J).opNorm_le_bound (by positivity) ?_ + exact fun K => norm_bilinear_le E F G H k B J K + +end Product + +/-- Forget higher regularity without changing the represented function. -/ +def truncate (k n : ℕ) (hkn : k ≤ n) (J : Space E F n) : Space E F k := + ofFunction E F k (function E F n J) + ((function_contDiff E F n J).of_le (by exact_mod_cast hkn)) ‖J‖ + (fun m hm x => norm_iteratedFDeriv_le E F n J m (hm.trans hkn) x) + +@[simp] theorem function_truncate (k n : ℕ) (hkn : k ≤ n) (J : Space E F n) (x : E) : + function E F k (truncate E F k n hkn J) x = function E F n J x := + function_ofFunction E F k _ _ _ _ x + +theorem norm_truncate_le (k n : ℕ) (hkn : k ≤ n) (J : Space E F n) : + ‖truncate E F k n hkn J‖ ≤ ‖J‖ := + norm_ofFunction_le E F k _ _ _ _ (norm_nonneg J) + +/-- The lossless bounded linear map forgetting higher spatial jets. -/ +def truncateCLM (k n : ℕ) (hkn : k ≤ n) : Space E F n →L[ℝ] Space E F k := + LinearMap.mkContinuous + { toFun := truncate E F k n hkn + map_add' := by + intro J K + apply function_injective E F k + ext x + simp only [function_truncate, function_add] + map_smul' := by + intro c J + apply function_injective E F k + ext x + simp only [function_truncate, function_smul, RingHom.id_apply] } + 1 (fun J => by + change ‖truncate E F k n hkn J‖ ≤ 1 * ‖J‖ + simpa only [one_mul] using norm_truncate_le E F k n hkn J) + +theorem norm_truncateCLM_le_one (k n : ℕ) (hkn : k ≤ n) : + ‖truncateCLM E F k n hkn‖ ≤ 1 := by + refine (truncateCLM E F k n hkn).opNorm_le_bound zero_le_one ?_ + intro J + change ‖truncate E F k n hkn J‖ ≤ 1 * ‖J‖ + simpa only [one_mul] using norm_truncate_le E F k n hkn J + +/-- A spatial derivative loses exactly one order, with no increase of jet norm. -/ +def derivative (k : ℕ) (J : Space E F (k + 1)) : Space E (E →L[ℝ] F) k := + ofFunction E (E →L[ℝ] F) k (fderiv ℝ (function E F (k + 1) J)) + ((function_contDiff E F (k + 1) J).fderiv_right (by simp)) ‖J‖ + (fun m hm x => by + rw [norm_iteratedFDeriv_fderiv] + exact norm_iteratedFDeriv_le E F (k + 1) J (m + 1) (Nat.add_le_add_right hm 1) x) + +@[simp] theorem function_derivative (k : ℕ) (J : Space E F (k + 1)) (x : E) : + function E (E →L[ℝ] F) k (derivative E F k J) x = + fderiv ℝ (function E F (k + 1) J) x := + function_ofFunction E (E →L[ℝ] F) k _ _ _ _ x + +theorem norm_derivative_le (k : ℕ) (J : Space E F (k + 1)) : + ‖derivative E F k J‖ ≤ ‖J‖ := + norm_ofFunction_le E (E →L[ℝ] F) k _ _ _ _ (norm_nonneg J) + +private theorem function_differentiable (k : ℕ) (J : Space E F (k + 1)) : + Differentiable ℝ (function E F (k + 1) J) := + (function_contDiff E F (k + 1) J).differentiable (by simp) + +/-- Bounded spatial differentiation between consecutive finite jet spaces. -/ +def derivativeCLM (k : ℕ) : Space E F (k + 1) →L[ℝ] Space E (E →L[ℝ] F) k := + LinearMap.mkContinuous + { toFun := derivative E F k + map_add' := by + intro J K + apply function_injective E (E →L[ℝ] F) k + apply BoundedContinuousFunction.ext + intro x + simp only [function_derivative, function_add] + have he : (function E F (k + 1) (J + K) : E → F) = + fun y => function E F (k + 1) J y + function E F (k + 1) K y := by + funext y + exact function_add E F (k + 1) J K y + rw [he] + exact fderiv_fun_add (function_differentiable E F k J x) + (function_differentiable E F k K x) + map_smul' := by + intro c J + apply function_injective E (E →L[ℝ] F) k + apply BoundedContinuousFunction.ext + intro x + simp only [function_derivative, function_smul, RingHom.id_apply] + have he : (function E F (k + 1) (c • J) : E → F) = + fun y => c • function E F (k + 1) J y := by + funext y + exact function_smul E F (k + 1) c J y + rw [he] + exact fderiv_fun_const_smul (function_differentiable E F k J x) c } + 1 (fun J => by + change ‖derivative E F k J‖ ≤ 1 * ‖J‖ + simpa only [one_mul] using norm_derivative_le E F k J) + +theorem norm_derivativeCLM_le_one (k : ℕ) : ‖derivativeCLM E F k‖ ≤ 1 := by + refine (derivativeCLM E F k).opNorm_le_bound zero_le_one ?_ + intro J + change ‖derivative E F k J‖ ≤ 1 * ‖J‖ + simpa only [one_mul] using norm_derivative_le E F k J + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetProduct.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..72257e3f4296f16f964eb92075912615c9d2725a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetProduct.lean @@ -0,0 +1,138 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJets +import Mathlib.Analysis.Calculus.ContDiff.Bounds +import Mathlib.Data.Nat.Choose.Sum + +namespace OAI + +/-! Bounded spatial jets of pointwise bilinear products. + +The finite-order Leibniz estimate gives the constant `2^k`. In particular, +fixing a smooth bounded coefficient gives a bounded linear multiplication +operator on the jet Banach space used in a Volterra equation. +-/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Bundle the actual derivatives of a function with bounded jets. -/ +def ofFunctionFamily (k : ℕ) (f : E → F) (hf : ContDiff ℝ k f) (C : ℝ) + (hC : ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C) : Family E F k := + fun i => BoundedContinuousFunction.ofNormedAddCommGroup + (fun x => (show Value E F i.val from iteratedFDeriv ℝ i.val f x)) + (by + change Continuous (iteratedFDeriv ℝ i.val f) + exact hf.continuous_iteratedFDeriv (by exact_mod_cast Nat.le_of_lt_succ i.isLt)) + C (hC i.val (Nat.le_of_lt_succ i.isLt)) + +/-- A `C^k` function whose first `k` derivatives are uniformly bounded defines a jet. -/ +def ofFunction (k : ℕ) (f : E → F) (hf : ContDiff ℝ k f) (C : ℝ) + (hC : ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C) : Space E F k := by + refine ⟨ofFunctionFamily E F k f hf C hC, ?_⟩ + apply (mem_compatible E F k _).mpr + intro i x + have hd := (hf.differentiable_iteratedFDeriv (m := i.val) + (by exact_mod_cast i.isLt) x).hasFDerivAt + rw [fderiv_iteratedFDeriv] at hd + convert! hd using 1 + +@[simp] theorem ofFunction_apply (k : ℕ) (f : E → F) (hf : ContDiff ℝ k f) (C : ℝ) + (hC : ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C) + (i : Fin (k + 1)) (x : E) : + (ofFunction E F k f hf C hC).val i x = + (show Value E F i.val from iteratedFDeriv ℝ i.val f x) := rfl + +@[simp] theorem function_ofFunction (k : ℕ) (f : E → F) (hf : ContDiff ℝ k f) (C : ℝ) + (hC : ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C) (x : E) : + function E F k (ofFunction E F k f hf C hC) x = f x := by + rw [function_apply, ofFunction_apply] + change (continuousMultilinearCurryFin0 ℝ E F) (iteratedFDeriv ℝ 0 f x) = f x + rw [iteratedFDeriv_zero_eq_comp] + exact (continuousMultilinearCurryFin0 ℝ E F).apply_symm_apply (f x) + +theorem norm_ofFunction_le (k : ℕ) (f : E → F) (hf : ContDiff ℝ k f) (C : ℝ) + (hC : ∀ n ≤ k, ∀ x, ‖iteratedFDeriv ℝ n f x‖ ≤ C) (hC₀ : 0 ≤ C) : + ‖ofFunction E F k f hf C hC‖ ≤ C := by + change ‖ofFunctionFamily E F k f hf C hC‖ ≤ C + apply (pi_norm_le_iff_of_nonneg hC₀).mpr + intro i + apply (BoundedContinuousFunction.norm_le hC₀).mpr + exact hC i.val (Nat.le_of_lt_succ i.isLt) + +/-- A compatible family is determined by its zeroth-order function. -/ +theorem function_injective (k : ℕ) : Function.Injective (function E F k) := by + intro J K h + apply Subtype.ext + funext i + apply BoundedContinuousFunction.ext + intro x + have hf : (function E F k J : E → F) = function E F k K := congrArg DFunLike.coe h + have hd := congrArg (fun f : E → F => iteratedFDeriv ℝ i.val f x) hf + rw [iteratedFDeriv_function E F k J i.val (Nat.le_of_lt_succ i.isLt), + iteratedFDeriv_function E F k K i.val (Nat.le_of_lt_succ i.isLt)] at hd + exact hd + +variable (G H : Type*) [NormedAddCommGroup G] [NormedSpace ℝ G] + [NormedAddCommGroup H] [NormedSpace ℝ H] + +/-- The finite Leibniz estimate, uniformly in the spatial point. -/ +theorem bilinear_derivative_bound (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) (n : ℕ) (hn : n ≤ k) (x : E) : + ‖iteratedFDeriv ℝ n (fun y => B (function E F k J y) (function E G k K y)) x‖ ≤ + ‖B‖ * (2 : ℝ) ^ k * ‖J‖ * ‖K‖ := by + have hsum : (∑ i ∈ Finset.range (n + 1), (n.choose i : ℝ)) = (2 : ℝ) ^ n := by + exact_mod_cast Nat.sum_range_choose n + calc + _ ≤ ‖B‖ * ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ‖iteratedFDeriv ℝ i (function E F k J) x‖ * + ‖iteratedFDeriv ℝ (n - i) (function E G k K) x‖ := + B.norm_iteratedFDeriv_le_of_bilinear (function_contDiff E F k J) + (function_contDiff E G k K) x (by exact_mod_cast hn) + _ ≤ ‖B‖ * ∑ i ∈ Finset.range (n + 1), (n.choose i : ℝ) * ‖J‖ * ‖K‖ := by + apply mul_le_mul_of_nonneg_left _ (norm_nonneg B) + apply Finset.sum_le_sum + intro i hi + have hi' : i ≤ k := (Nat.le_of_lt_succ (Finset.mem_range.mp hi)).trans hn + apply mul_le_mul + · exact mul_le_mul_of_nonneg_left (norm_iteratedFDeriv_le E F k J i hi' x) + (Nat.cast_nonneg _) + · exact norm_iteratedFDeriv_le E G k K (n - i) ((Nat.sub_le n i).trans hn) x + · exact norm_nonneg _ + · positivity + _ = ‖B‖ * (2 : ℝ) ^ n * ‖J‖ * ‖K‖ := by + rw [← Finset.sum_mul, ← Finset.sum_mul, hsum] + ring + _ ≤ ‖B‖ * (2 : ℝ) ^ k * ‖J‖ * ‖K‖ := by + have hp : (2 : ℝ) ^ n ≤ 2 ^ k := pow_le_pow_right₀ (by norm_num) hn + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hp (norm_nonneg B)) (norm_nonneg J)) (norm_nonneg K) + +/-- Pointwise application of a bounded bilinear map to two compatible jets. -/ +def bilinear (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) : Space E H k := + ofFunction E H k (fun y => B (function E F k J y) (function E G k K y)) + ((B.contDiff.comp (function_contDiff E F k J)).clm_apply (function_contDiff E G k K)) + (‖B‖ * (2 : ℝ) ^ k * ‖J‖ * ‖K‖) + (bilinear_derivative_bound E F G H k B J K) + +@[simp] theorem function_bilinear (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) (x : E) : + function E H k (bilinear E F G H k B J K) x = + B (function E F k J x) (function E G k K x) := + function_ofFunction E H k _ _ _ _ x + +theorem norm_bilinear_le (k : ℕ) (B : F →L[ℝ] G →L[ℝ] H) + (J : Space E F k) (K : Space E G k) : + ‖bilinear E F G H k B J K‖ ≤ ‖B‖ * (2 : ℝ) ^ k * ‖J‖ * ‖K‖ := + norm_ofFunction_le E H k _ _ _ _ (by positivity) + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTimeDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTimeDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a38a8a0e6d65473767bda0c5e69780d608c3909 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTimeDerivative.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetIntegral +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! Lift the pointwise scalar equation to the finite spatial-jet Banach space by FTC. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets +open ShearFlows Set MeasureTheory +open scoped Topology Interval + +variable (k : ℕ) + +theorem integral_eq_sub_of_pointwise_derivative {T : ℝ} + (u r : ℝ → Space Plane ℝ k) (hu : Continuous u) (hr : Continuous r) + (hd : ∀ s ∈ Ioo (0 : ℝ) T, ∀ x : Plane, + HasDerivAt (fun t => function Plane ℝ k (u t) x) (function Plane ℝ k (r s) x) s) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + (∫ s in 0..t, r s) = u t - u 0 := by + apply function_injective Plane ℝ k + apply BoundedContinuousFunction.ext + intro x + let L : Space Plane ℝ k →L[ℝ] ℝ := + (BoundedContinuousFunction.evalCLM ℝ x).comp (functionMap Plane ℝ k) + change L (∫ s in 0..t, r s) = L (u t-u 0) + rw [← L.intervalIntegral_comp_comm (hr.intervalIntegrable 0 t)] + have hc : Continuous (fun s => L (u s)) := L.continuous.comp hu + have hr' : Continuous (fun s => L (r s)) := L.continuous.comp hr + have hd' (s : ℝ) (hs : s ∈ Ioo (0 : ℝ) t) : + HasDerivAt (fun v => L (u v)) (L (r s)) s := + hd s ⟨hs.1, hs.2.trans_le ht.2⟩ x + have he := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ht.1 + hc.continuousOn hd' + (hr'.intervalIntegrable 0 t) + simpa only [map_sub] using he + +theorem hasDerivWithinAt_of_pointwise_derivative {T : ℝ} + (u r : ℝ → Space Plane ℝ k) (hu : Continuous u) (hr : Continuous r) + (hd : ∀ s ∈ Ioo (0 : ℝ) T, ∀ x : Plane, + HasDerivAt (fun t => function Plane ℝ k (u t) x) (function Plane ℝ k (r s) x) s) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + HasDerivWithinAt u (r t) (Icc (0 : ℝ) T) t := by + let : SecondCountableTopologyEither ℝ (Space Plane ℝ k) := + secondCountableTopologyEither_of_left _ _ + have he (s : ℝ) (hs : s ∈ Icc (0 : ℝ) T) : u s = u 0 + ∫ v in 0..s, r v := by + rw [integral_eq_sub_of_pointwise_derivative k u r hu hr hd hs] + abel + have hi := (intervalIntegral.integral_hasDerivAt_right (hr.intervalIntegrable 0 t) + hr.aestronglyMeasurable.stronglyMeasurableAtFilter hr.continuousAt).const_add (u 0) + exact hi.hasDerivWithinAt.congr he (he t ht) + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTranslation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1222dec41e0cb4c43b70214bc522679848fe1f75 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJetTranslation.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetConvolution + +namespace OAI + +/-! Fixed spatial translations on finite bounded jets, including convolution covariance. -/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open MeasureTheory +open scoped Topology ContDiff BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- A fixed translation does not increase any derivative norm. -/ +def translation (k : ℕ) (a : E) (J : Space E F k) : Space E F k := + ofFunction E F k (fun x => function E F k J (x+a)) + ((function_contDiff E F k J).comp (contDiff_id.add contDiff_const)) ‖J‖ + (fun n hn x => by + rw [iteratedFDeriv_comp_add_right] + exact norm_iteratedFDeriv_le E F k J n hn (x+a)) + +@[simp] theorem function_translation (k : ℕ) (a : E) (J : Space E F k) (x : E) : + function E F k (translation E F k a J) x = function E F k J (x+a) := + function_ofFunction E F k _ _ _ _ x + +theorem norm_translation_le (k : ℕ) (a : E) (J : Space E F k) : + ‖translation E F k a J‖ ≤ ‖J‖ := + norm_ofFunction_le E F k _ _ _ _ (norm_nonneg J) + +def translationCLM (k : ℕ) (a : E) : Space E F k →L[ℝ] Space E F k := + LinearMap.mkContinuous + { toFun := translation E F k a + map_add' := by + intro J K + apply function_injective E F k + apply BoundedContinuousFunction.ext + intro x + simp only [function_translation, function_add] + map_smul' := by + intro c J + apply function_injective E F k + apply BoundedContinuousFunction.ext + intro x + simp only [function_translation, function_smul, RingHom.id_apply] } + 1 (fun J => (norm_translation_le E F k a J).trans_eq (one_mul ‖J‖).symm) + +@[simp] theorem translationCLM_apply (k : ℕ) (a : E) (J : Space E F k) : + translationCLM E F k a J = translation E F k a J := rfl + +theorem translation_eq_self (k : ℕ) (a : E) (J : Space E F k) + (h : ∀ x, function E F k J (x+a) = function E F k J x) : + translationCLM E F k a J = J := by + apply function_injective E F k + apply BoundedContinuousFunction.ext + intro x + exact (function_translation E F k a J x).trans (h x) + +section Convolution + +variable [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] [CompleteSpace F] + +theorem translation_convolution (k : ℕ) (a : E) (μ : Measure E) (w : E → ℝ) + (hw : Integrable w μ) (J : Space E F k) : + translationCLM E F k a (convolution E F k μ w hw J) = + convolution E F k μ w hw (translationCLM E F k a J) := by + apply function_injective E F k + apply BoundedContinuousFunction.ext + intro x + rw [translationCLM_apply, function_translation, function_convolution, function_convolution] + simp_rw [translationCLM_apply, function_translation] + apply integral_congr_ae + filter_upwards [] with y + congr 2 + abel + +end Convolution +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb5a81d68ec42d676e590507fad0aeffeaa77079 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/BoundedSpatialJets.lean @@ -0,0 +1,185 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedDerivativeGraph +import Mathlib.Analysis.Normed.Module.Multilinear.Curry +import Mathlib.Analysis.Calculus.ContDiff.Comp + +namespace OAI + +/-! A Banach space of bounded continuous spatial jets of any finite order. + +The ambient space is a finite product with the maximum of the uniform norms. +Compatibility of consecutive jets is imposed by closed derivative graphs, so +uniform convergence of every jet preserves the spatial derivatives. +-/ + +noncomputable section +namespace ForcedComputation.BoundedSpatialJets + +open scoped Topology BoundedContinuousFunction + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Values of the spatial derivative of order `n`. +The type synonym fixes one normed-space structure throughout the jet family. -/ +def Value (n : ℕ) := ContinuousMultilinearMap ℝ (fun _ : Fin n => E) F + +instance (n : ℕ) : NormedAddCommGroup (Value E F n) := + inferInstanceAs (NormedAddCommGroup (ContinuousMultilinearMap ℝ (fun _ : Fin n => E) F)) + +instance (n : ℕ) : NormedSpace ℝ (Value E F n) := + inferInstanceAs (NormedSpace ℝ (ContinuousMultilinearMap ℝ (fun _ : Fin n => E) F)) + +instance (n : ℕ) [CompleteSpace F] : CompleteSpace (Value E F n) := + inferInstanceAs (CompleteSpace (ContinuousMultilinearMap ℝ (fun _ : Fin n => E) F)) + +/-- Split the first slot of a jet value, with the fixed normed-space structures. -/ +def curryMap (n : ℕ) : Value E F (n + 1) ≃ₗᵢ[ℝ] (E →L[ℝ] Value E F n) := by + convert! (continuousMultilinearCurryLeftEquiv ℝ (fun _ : Fin (n + 1) => E) F) using 1 + +/-- A zero-order multilinear value is an ordinary value. -/ +def valueMap : Value E F 0 ≃ₗᵢ[ℝ] F := by + convert! (continuousMultilinearCurryFin0 ℝ E F) using 1 + +/-- Bounded continuous candidate jets through order `k`. -/ +abbrev Family (k : ℕ) := (i : Fin (k + 1)) → (E →ᵇ Value E F i.val) + +/-- The zeroth index, avoiding modular reduction of a variable-sized `Fin`. -/ +abbrev firstIndex (k : ℕ) : Fin (k + 1) := ⟨0, Nat.zero_lt_succ k⟩ + +@[simp] theorem firstIndex_val (k : ℕ) : (firstIndex k).val = 0 := rfl + +/-- Extract two consecutive jets, currying the higher jet as a derivative. -/ +def consecutive (k : ℕ) (i : Fin k) : + Family E F k →L[ℝ] + ((E →ᵇ Value E F i.val) × (E →ᵇ (E →L[ℝ] Value E F i.val))) := + (ContinuousLinearMap.proj i.castSucc).prod + ((((curryMap E F i.val).toContinuousLinearEquiv.toContinuousLinearMap).compLeftContinuousBounded E).comp (ContinuousLinearMap.proj i.succ)) + +@[simp] theorem consecutive_apply (k : ℕ) (i : Fin k) (J : Family E F k) : + consecutive E F k i J = + (J i.castSucc, + ((curryMap E F i.val).toContinuousLinearEquiv.toContinuousLinearMap).compLeftContinuousBounded E (J i.succ)) := rfl + +/-- Derivative compatibility is a closed linear condition on the finite family. -/ +def compatible (k : ℕ) : ClosedSubmodule ℝ (Family E F k) := + ⨅ i : Fin k, (boundedDerivativeGraph E (Value E F i.val)).comap (consecutive E F k i) + +@[simp] theorem mem_compatible (k : ℕ) (J : Family E F k) : + J ∈ compatible E F k ↔ + ∀ i : Fin k, ∀ x, HasFDerivAt (J i.castSucc) ((curryMap E F i.val) (J i.succ x)) x := by + simp only [compatible, ClosedSubmodule.mem_iInf, ClosedSubmodule.mem_comap, + mem_boundedDerivativeGraph, consecutive_apply, + ContinuousLinearMap.compLeftContinuousBounded_apply, ContinuousLinearEquiv.coe_coe, + LinearIsometryEquiv.coe_toContinuousLinearEquiv] + +/-- The Banach space of bounded continuous spatial jets through order `k`. -/ +abbrev Space (k : ℕ) := compatible E F k + +instance (k : ℕ) [CompleteSpace F] : CompleteSpace (Space E F k) := inferInstance + +/-- Bounded linear extraction of any spatial jet. -/ +def projection (k : ℕ) (i : Fin (k + 1)) : + Space E F k →L[ℝ] (E →ᵇ Value E F i.val) := + (ContinuousLinearMap.proj i).comp (compatible E F k).toSubmodule.subtypeL + +@[simp] theorem projection_apply (k : ℕ) (i : Fin (k + 1)) (J : Space E F k) : + projection E F k i J = J.val i := rfl + +theorem norm_projection_le_one (k : ℕ) (i : Fin (k + 1)) : + ‖projection E F k i‖ ≤ 1 := by + refine (projection E F k i).opNorm_le_bound zero_le_one ?_ + intro J + change ‖J.val i‖ ≤ 1 * ‖J.val‖ + simpa only [one_mul] using norm_le_pi_norm J.val i + +/-- Every consecutive pair in a compatible family is an actual derivative pair. -/ +theorem hasFDerivAt (k : ℕ) (J : Space E F k) (i : Fin k) (x : E) : + HasFDerivAt (J.val i.castSucc) ((curryMap E F i.val) (J.val i.succ x)) x := + (mem_compatible E F k J.val).mp J.property i x + +/-- The Banach norm controls every spatial jet uniformly in the base point. -/ +theorem norm_jet_le (k : ℕ) (J : Space E F k) (i : Fin (k + 1)) (x : E) : + ‖J.val i x‖ ≤ ‖J‖ := + (J.val i).norm_coe_le_norm x |>.trans (norm_le_pi_norm J.val i) + +/-- Each jet has the differentiability supplied by the remaining higher jets. -/ +theorem jet_contDiff (k : ℕ) (J : Space E F k) (n m : ℕ) (h : n + m ≤ k) : + ContDiff ℝ m (J.val ⟨n, by omega⟩) := by + induction m generalizing n with + | zero => + exact contDiff_zero.mpr (J.val ⟨n, by omega⟩).continuous + | succ m ih => + let L := (curryMap E F n).toContinuousLinearEquiv.toContinuousLinearMap + have hnext : n + 1 + m ≤ k := by omega + have hd : ContDiff ℝ m (fun x => L (J.val ⟨n + 1, by omega⟩ x)) := + L.contDiff.comp (ih (n + 1) hnext) + apply contDiff_succ_iff_hasFDerivAt.mpr + refine ⟨_, hd, ?_⟩ + intro x + exact hasFDerivAt E F k J ⟨n, by omega⟩ x + +/-- The ordinary function represented by the zeroth jet. -/ +def function (k : ℕ) (J : Space E F k) : E →ᵇ F := + (valueMap E F).toContinuousLinearEquiv.toContinuousLinearMap.compLeftContinuousBounded E + (J.val (firstIndex k)) + +@[simp] theorem function_apply (k : ℕ) (J : Space E F k) (x : E) : + function E F k J x = valueMap E F (J.val (firstIndex k) x) := rfl + +theorem function_contDiff (k : ℕ) (J : Space E F k) : + ContDiff ℝ k (function E F k J) := + (valueMap E F).toContinuousLinearEquiv.toContinuousLinearMap.contDiff.comp (jet_contDiff E F k J 0 k (by omega)) + +theorem norm_function_le (k : ℕ) (J : Space E F k) (x : E) : + ‖function E F k J x‖ ≤ ‖J‖ := by + rw [function_apply, (valueMap E F).norm_map] + exact norm_jet_le E F k J (firstIndex k) x + +/-- Bounded linear extraction of the represented function. -/ +def functionMap (k : ℕ) : Space E F k →L[ℝ] (E →ᵇ F) := + ((valueMap E F).toContinuousLinearEquiv.toContinuousLinearMap.compLeftContinuousBounded E).comp + (projection E F k (firstIndex k)) + +@[simp] theorem functionMap_apply (k : ℕ) (J : Space E F k) : + functionMap E F k J = function E F k J := rfl + +theorem norm_functionMap_le_one (k : ℕ) : ‖functionMap E F k‖ ≤ 1 := by + refine (functionMap E F k).opNorm_le_bound zero_le_one ?_ + intro J + rw [one_mul, functionMap_apply] + exact (BoundedContinuousFunction.norm_le (norm_nonneg J)).mpr + (norm_function_le E F k J) + +/-- The supplied jets are the actual iterated spatial derivatives. -/ +theorem iteratedFDeriv_function (k : ℕ) (J : Space E F k) (n : ℕ) (hn : n ≤ k) : + iteratedFDeriv ℝ n (function E F k J) = J.val ⟨n, by omega⟩ := by + induction n with + | zero => + funext x + rw [iteratedFDeriv_zero_eq_comp] + change (valueMap E F).symm ((valueMap E F) (J.val (firstIndex k) x)) = _ + exact (valueMap E F).symm_apply_apply (J.val (firstIndex k) x) + | succ n ih => + have hprev : n ≤ k := by omega + rw [iteratedFDeriv_succ_eq_comp_left, ih hprev] + funext x + change (continuousMultilinearCurryLeftEquiv ℝ + (fun _ : Fin (n + 1) => E) F).symm + (fderiv ℝ (J.val ⟨n, by omega⟩) x) = _ + have hd := (hasFDerivAt E F k J ⟨n, by omega⟩ x).fderiv + change fderiv ℝ (J.val ⟨n, by omega⟩) x = + curryMap E F n (J.val ⟨n + 1, by omega⟩ x) at hd + change (curryMap E F n).symm (fderiv ℝ (J.val ⟨n, by omega⟩) x) = _ + rw [hd] + exact (curryMap E F n).symm_apply_apply (J.val ⟨n + 1, by omega⟩ x) + +theorem norm_iteratedFDeriv_le (k : ℕ) (J : Space E F k) (n : ℕ) (hn : n ≤ k) + (x : E) : ‖iteratedFDeriv ℝ n (function E F k J) x‖ ≤ ‖J‖ := by + rw [iteratedFDeriv_function E F k J n hn] + exact norm_jet_le E F k J ⟨n, by omega⟩ x + +end ForcedComputation.BoundedSpatialJets + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/CompactParameterIntegral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/CompactParameterIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbba687bb01786311fbdbae5050e68f3a8d664e0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/CompactParameterIntegral.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.FlowSuperposition +import Mathlib.MeasureTheory.Function.LpSpace.ContinuousFunctions +import Mathlib.MeasureTheory.Integral.Bochner.Basic + +namespace OAI + +/-! Smooth compact parameter integrals via continuous functions and the +bounded Bochner integral. -/ + +noncomputable section +namespace ForcedComputation.Flow +open MeasureTheory +open scoped ContDiff + +variable {K E F P : Type} [TopologicalSpace K] [CompactSpace K] + [MeasurableSpace K] [BorelSpace K] [SecondCountableTopology K] + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + [NormedAddCommGroup P] [NormedSpace ℝ P] + +def compactIntegral (μ : Measure K) [IsFiniteMeasure μ] : C(K, F) →L[ℝ] F := + (MeasureTheory.L1.integralCLM (α := K) (E := F) (μ := μ)).comp + (ContinuousMap.toLp 1 μ ℝ) + +theorem compactIntegral_apply (μ : Measure K) [IsFiniteMeasure μ] (f : C(K, F)) : + compactIntegral μ f = ∫ y, f y ∂μ := by + change MeasureTheory.L1.integralCLM (ContinuousMap.toLp 1 μ ℝ f) = _ + rw [← MeasureTheory.L1.integral_eq, MeasureTheory.L1.integral_eq_integral] + exact integral_congr_ae (ContinuousMap.coeFn_toLp (p := 1) (𝕜 := ℝ) μ f) + +theorem compactIntegral_hasFDerivAt (μ : Measure K) [IsFiniteMeasure μ] + (f : C(E, F)) (hf : ContDiff ℝ 1 (f : E → F)) + {v : P → C(K, E)} {p : P} {v' : P →L[ℝ] C(K, E)} + (hv : HasFDerivAt v v' p) : + HasFDerivAt (fun q => ∫ y, f (v q y) ∂μ) + ((compactIntegral (F := F) μ).comp + ((applyPath ⟨fun y => fderiv ℝ f (v p y), + (hf.continuous_fderiv (by simp)).comp (v p).continuous⟩).comp v')) p := by + have h := (compactIntegral (F := F) μ).hasFDerivAt.comp p + ((postcompose_hasFDerivAt f hf (v p)).comp p hv) + convert h using 1 + funext q + exact (compactIntegral_apply μ (postcompose f (v q))).symm + +theorem fderiv_compactIntegral_apply (μ : Measure K) [IsFiniteMeasure μ] + (f : C(E, F)) (hf : ContDiff ℝ 1 (f : E → F)) + {v : P → C(K, E)} {p : P} {v' : P →L[ℝ] C(K, E)} + (hv : HasFDerivAt v v' p) (q : P) : + fderiv ℝ (fun r => ∫ y, f (v r y) ∂μ) p q = + ∫ y, fderiv ℝ f (v p y) (v' q y) ∂μ := by + rw [(compactIntegral_hasFDerivAt μ f hf hv).fderiv] + exact compactIntegral_apply μ _ + +theorem contDiff_compactIntegral (μ : Measure K) [IsFiniteMeasure μ] + (f : C(E, F)) (hf : ContDiff ℝ ∞ (f : E → F)) + (v : P → C(K, E)) (hv : ContDiff ℝ ∞ v) : + ContDiff ℝ ∞ (fun p => ∫ y, f (v p y) ∂μ) := by + have h := (compactIntegral (F := F) μ).contDiff.comp + ((postcompose_contDiff f hf).comp hv) + convert h using 1 + funext p + exact (compactIntegral_apply μ (postcompose f (v p))).symm + +end ForcedComputation.Flow + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatComparison.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..04217cef5ec38360a7a4d710aa542614f156c18f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatComparison.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatEvolution + +namespace OAI + +/-! Supremum-norm stability of the explicit periodic heat evolution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +theorem torusHeatEvolution_stability (hK : TorusHeatInput) {g h : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hh : ContDiff ℝ ∞ h) + (hgp : PlanePeriodic g) (hhp : PlanePeriodic h) + {E : ℝ} (hE : ∀ x, |g x - h x| ≤ E) {t : ℝ} (ht : 0 ≤ t) (x : Plane) : + |torusHeatEvolution g t x - torusHeatEvolution h t x| ≤ E := by + have he : (fun y => h y + (g y - h y)) = g := by + funext y + ring + have hadd := torusHeatEvolution_add hK hh.continuous (hg.sub hh).continuous t x + rw [he] at hadd + rw [hadd, add_sub_cancel_left] + exact torusHeatEvolution_error_bound hK (hg.sub hh) + (fun y k => by dsimp only; rw [hgp y k, hhp y k]) hE ht x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatGaussianBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatGaussianBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbf1f01541e3b890345999a1871b24f4a1cec0a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/HeatGaussianBounds.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorBounds +import Mathlib.Analysis.SpecialFunctions.Exp +import Mathlib.Analysis.Real.Pi.Bounds + +namespace OAI + +/-! Numerical Gaussian estimates for the two-torus detector. These estimates +are proved directly and introduce no heat-kernel hypothesis. -/ + +namespace ForcedComputation.VelocityDetector +open scoped BigOperators + +theorem heat_shell_ratio : Real.exp (-(1 / 32 : ℝ)) ≤ 32 / 33 := by + have h := Real.add_one_le_exp (1 / 32 : ℝ) + rw [Real.exp_neg] + apply (inv_le_iff_one_le_mul₀ (Real.exp_pos _)).mpr + nlinarith + +theorem heat_shell_series : + 1 + 8 * (∑' j : ℕ, (j : ℝ) * Real.exp (-(1 / 32 : ℝ)) ^ j) < 10000 := by + let q : ℝ := Real.exp (-(1 / 32 : ℝ)) + have hq₀ : 0 ≤ q := (Real.exp_pos _).le + have hq : q ≤ 32 / 33 := heat_shell_ratio + have hq₁ : ‖q‖ < 1 := by rw [Real.norm_eq_abs, abs_of_nonneg hq₀]; linarith + have hr : ‖(32 / 33 : ℝ)‖ < 1 := by norm_num + have hsum : (∑' j : ℕ, (j : ℝ) * q ^ j) ≤ 1056 := by + calc + _ ≤ ∑' j : ℕ, (j : ℝ) * (32 / 33 : ℝ) ^ j := + (hasSum_coe_mul_geometric_of_norm_lt_one hq₁).summable.tsum_le_tsum + (fun j => mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hq₀ hq j) (Nat.cast_nonneg j)) + (hasSum_coe_mul_geometric_of_norm_lt_one hr).summable + _ = 1056 := by rw [tsum_coe_mul_geometric_of_norm_lt_one hr]; norm_num + change 1 + 8 * (∑' j : ℕ, (j : ℝ) * q ^ j) < 10000 + linarith + +theorem gaussian_time_factor {d t : ℝ} (hd : 0 < d) (ht : 0 < t) : + t⁻¹ * Real.exp (-(d ^ 2 / (8 * t))) ≤ 8 / d ^ 2 := by + have he : (d ^ 2 / (8 * t)) * Real.exp (-(d ^ 2 / (8 * t))) ≤ 1 := + (Real.mul_exp_neg_le_exp_neg_one _).trans (Real.exp_le_one_iff.mpr (by norm_num)) + have hpos : 0 < d ^ 2 := sq_pos_of_pos hd + apply (le_div_iff₀ hpos).mpr + calc + _ = 8 * ((d ^ 2 / (8 * t)) * Real.exp (-(d ^ 2 / (8 * t)))) := by + field_simp [ht.ne'] + _ ≤ 8 * 1 := mul_le_mul_of_nonneg_left he (by norm_num) + _ = 8 := by norm_num + +theorem heat_constant_small : + (8 * 10000 : ℝ) / (4 * Real.pi * (1 / 32) ^ 2) < 1000000000 ∧ + (8 * 10000 : ℝ) / (4 * Real.pi * (1 / 16) ^ 2) < 100000000 := by + have hp := Real.pi_gt_three + constructor + · apply (div_lt_iff₀ (by positivity)).mpr + nlinarith + · apply (div_lt_iff₀ (by positivity)).mpr + nlinarith + +end ForcedComputation.VelocityDetector + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/JetVolterraFixedPoint.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/JetVolterraFixedPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbb3bfd6963751fec95fda4d44d9ecdf84b3489e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/JetVolterraFixedPoint.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetOperators +import Mathlib.Topology.ContinuousMap.Compact +import Mathlib.Topology.MetricSpace.Contracting + +namespace OAI + +/-! A short-time Volterra contraction on continuous curves of bounded spatial jets. +-/ + +noncomputable section +namespace ForcedComputation.JetVolterra + +open scoped Topology + +variable (A : Type*) [NormedAddCommGroup A] [NormedSpace ℝ A] + +theorem affine_contracting (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : + ContractingWith ‖L‖₊ (fun u => a + L u) := by + refine ⟨?_, LipschitzWith.of_dist_le_mul ?_⟩ + · exact_mod_cast hL + · intro u v + simpa only [dist_add_left] using L.lipschitzWith.dist_le_mul u v + +variable [CompleteSpace A] + +/-- The unique solution of the short-time linear Volterra equation. -/ +def solution (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : A := + ContractingWith.fixedPoint (fun u => a + L u) (affine_contracting A a L hL) + +theorem solution_eq (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : + solution A a L hL = a + L (solution A a L hL) := + (affine_contracting A a L hL).fixedPoint_isFixedPt.symm + +theorem solution_unique (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) + (u : A) (hu : u = a + L u) : u = solution A a L hL := + (affine_contracting A a L hL).fixedPoint_unique hu.symm + +theorem exists_unique (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : + ∃! u : A, u = a + L u := + ⟨solution A a L hL, solution_eq A a L hL, + fun u hu => solution_unique A a L hL u hu⟩ + +theorem norm_solution_le (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : + ‖solution A a L hL‖ ≤ ‖a‖ / (1 - ‖L‖) := by + have h := (affine_contracting A a L hL).dist_fixedPoint_le (0 : A) + simpa only [solution, dist_zero_left, map_zero, add_zero, coe_nnnorm] using h + +/-- Stability with respect to the inhomogeneous source, in the same path norm. -/ +theorem solution_source_lipschitz (a b : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) : + ‖solution A a L hL - solution A b L hL‖ ≤ ‖a - b‖ / (1 - ‖L‖) := by + have h := (affine_contracting A a L hL).dist_fixedPoint_fixedPoint_of_dist_le' + (fun u => b + L u) (solution_eq A a L hL).symm (solution_eq A b L hL).symm + (C := dist a b) (fun u => by simp only [dist_add_right, le_refl]) + simpa only [dist_eq_norm, coe_nnnorm] using h + +variable (D : Type*) [NormedAddCommGroup D] [NormedSpace ℝ D] [CompleteSpace D] + +/-- An intertwining bounded linear map carries the high-order solution to the lower one. -/ +theorem solution_map (a : A) (L : A →L[ℝ] A) (hL : ‖L‖ < 1) + (P : A →L[ℝ] D) (M : D →L[ℝ] D) (hM : ‖M‖ < 1) + (hcomm : P.comp L = M.comp P) : + P (solution A a L hL) = solution D (P a) M hM := by + apply solution_unique D (P a) M hM + calc + P (solution A a L hL) = P (a + L (solution A a L hL)) := + congrArg P (solution_eq A a L hL) + _ = P a + M (P (solution A a L hL)) := by + rw [map_add] + congr 1 + exact congrArg (fun Q : A →L[ℝ] D => Q (solution A a L hL)) hcomm + +section Paths + +variable (E F : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Continuous finite-order jet curves on a closed short-time interval. -/ +def Path (k : ℕ) (T : ℝ) := C(Set.Icc (0 : ℝ) T, BoundedSpatialJets.Space E F k) + +instance (k : ℕ) (T : ℝ) : NormedAddCommGroup (Path E F k T) := + inferInstanceAs (NormedAddCommGroup + C(Set.Icc (0 : ℝ) T, BoundedSpatialJets.Space E F k)) + +instance (k : ℕ) (T : ℝ) : NormedSpace ℝ (Path E F k T) := + inferInstanceAs (NormedSpace ℝ C(Set.Icc (0 : ℝ) T, BoundedSpatialJets.Space E F k)) + +instance (k : ℕ) (T : ℝ) [CompleteSpace F] : CompleteSpace (Path E F k T) := + inferInstanceAs (CompleteSpace C(Set.Icc (0 : ℝ) T, BoundedSpatialJets.Space E F k)) + +def pathEquiv (k : ℕ) (T : ℝ) : + Path E F k T ≃ₗᵢ[ℝ] C(Set.Icc (0 : ℝ) T, BoundedSpatialJets.Space E F k) := + LinearIsometryEquiv.refl ℝ _ + +instance (k : ℕ) (T : ℝ) : CoeFun (Path E F k T) + (fun _ => Set.Icc (0 : ℝ) T → BoundedSpatialJets.Space E F k) := + ⟨fun u => pathEquiv E F k T u⟩ + +/-- Pointwise truncation of continuous jet curves. -/ +def pathTruncate (k n : ℕ) (hkn : k ≤ n) (T : ℝ) : + Path E F n T →L[ℝ] Path E F k T := + (pathEquiv E F k T).symm.toContinuousLinearEquiv.toContinuousLinearMap.comp + (((BoundedSpatialJets.truncateCLM E F k n hkn).compLeftContinuous ℝ + (Set.Icc (0 : ℝ) T)).comp + (pathEquiv E F n T).toContinuousLinearEquiv.toContinuousLinearMap) + +@[simp] theorem pathTruncate_apply (k n : ℕ) (hkn : k ≤ n) (T : ℝ) + (u : Path E F n T) (t : Set.Icc (0 : ℝ) T) : + pathTruncate E F k n hkn T u t = BoundedSpatialJets.truncate E F k n hkn (u t) := rfl + +theorem norm_pathTruncate_le_one (k n : ℕ) (hkn : k ≤ n) (T : ℝ) : + ‖pathTruncate E F k n hkn T‖ ≤ 1 := by + refine (pathTruncate E F k n hkn T).opNorm_le_bound zero_le_one ?_ + intro u + rw [one_mul] + change ‖(pathEquiv E F k T) (pathTruncate E F k n hkn T u)‖ ≤ ‖u‖ + apply (ContinuousMap.norm_le _ (norm_nonneg u)).mpr + intro t + exact (BoundedSpatialJets.norm_truncate_le E F k n hkn (u t)).trans + ((pathEquiv E F n T u).norm_coe_le_norm t) + +variable [CompleteSpace F] + +/-- The abstract Volterra equation is uniquely solvable in the actual continuous jet-path space. -/ +theorem exists_unique_path (k : ℕ) (T : ℝ) (a : Path E F k T) + (L : Path E F k T →L[ℝ] Path E F k T) (hL : ‖L‖ < 1) : + ∃! u : Path E F k T, u = a + L u := exists_unique _ a L hL + +/-- Compatible integral operators give compatible solutions across finite spatial orders. -/ +theorem solution_truncate (k n : ℕ) (hkn : k ≤ n) (T : ℝ) (a : Path E F n T) + (L : Path E F n T →L[ℝ] Path E F n T) (hL : ‖L‖ < 1) + (M : Path E F k T →L[ℝ] Path E F k T) (hM : ‖M‖ < 1) + (hcomm : (pathTruncate E F k n hkn T).comp L = + M.comp (pathTruncate E F k n hkn T)) : + pathTruncate E F k n hkn T (solution _ a L hL) = + solution _ (pathTruncate E F k n hkn T a) M hM := + solution_map _ _ a L hL (pathTruncate E F k n hkn T) M hM hcomm + +end Paths +end ForcedComputation.JetVolterra + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f56c7fecf67d87f67512455c339ea0dcf135f7f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatEquation.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatSeries + +namespace OAI + +/-! The time and spatial derivatives of the periodic heat Fourier moments. +The zeroth moment satisfies the one-dimensional heat equation. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open Set +open scoped ContDiff + +theorem periodicHeatMoment_time (k : ℕ) {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (fun s => periodicHeatMoment k (s, x)) + (-4 * (Real.pi : ℂ) ^ 2 * periodicHeatMoment (k + 2) (t, x)) t := by + have h := (periodicHeatMoment_hasFDerivAt k ht).comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + simpa only [Function.comp_def, id_eq, periodicHeatMomentDerivative_eq k (p := (t, x)) ht, add_apply, + smul_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_fst', + ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply, Complex.ofReal_one, + Complex.ofReal_zero, smul_zero, add_zero, smul_eq_mul, mul_one, mul_zero] using h + +theorem periodicHeatMoment_space (k : ℕ) {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (fun y => periodicHeatMoment k (t, y)) + (2 * (Real.pi : ℂ) * Complex.I * periodicHeatMoment (k + 1) (t, x)) x := by + have h := (periodicHeatMoment_hasFDerivAt k ht).comp_hasDerivAt x + ((hasDerivAt_const x t).prodMk (hasDerivAt_id x)) + have he : periodicHeatMomentDerivative k (t, x) (0, 1) = + 2 * (Real.pi : ℂ) * Complex.I * periodicHeatMoment (k + 1) (t, x) := by + simp only [periodicHeatMomentDerivative_eq k (p := (t, x)) ht, add_apply, smul_apply, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_fst', + ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply, Complex.ofReal_one, + Complex.ofReal_zero, zero_add, smul_eq_mul, mul_one, mul_zero] + ring + simpa only [Function.comp_def, id_eq, he] using h + +theorem periodicHeatMoment_heat {t : ℝ} (ht : 0 < t) (x : ℝ) : + deriv (fun s => periodicHeatMoment 0 (s, x)) t = + deriv (fun y => deriv (fun z => periodicHeatMoment 0 (t, z)) y) x := by + have he : (fun y => deriv (fun z => periodicHeatMoment 0 (t, z)) y) = + fun y => 2 * (Real.pi : ℂ) * Complex.I * periodicHeatMoment 1 (t, y) := by + funext y + exact (periodicHeatMoment_space 0 ht y).deriv + rw [he, (periodicHeatMoment_time 0 ht x).deriv] + rw [((periodicHeatMoment_space 1 ht x).const_mul (2 * (Real.pi : ℂ) * Complex.I)).deriv] + simp only [show (0 + 2 : ℕ) = 2 from rfl] + ring_nf + rw [Complex.I_sq] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a24c800b391dc91b6d7c49324a173eda07fcb21 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatMass.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatSeries +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! Unit mass for the periodic heat Fourier kernel. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open Set MeasureTheory +open scoped BigOperators + +theorem heatFrequency_integral (n : ℤ) : + (∫ y in Icc (0 : ℝ) 1, + Complex.exp ((2 * (Real.pi : ℂ) * (n : ℂ) * Complex.I) * y)) = + if n = 0 then 1 else 0 := by + rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le zero_le_one] + by_cases hn : n = 0 + · simp [hn] + · rw [ite_eq_right hn, integral_exp_mul_complex (by + exact mul_ne_zero (mul_ne_zero (mul_ne_zero (by norm_num) + (Complex.ofReal_ne_zero.mpr Real.pi_ne_zero)) (Int.cast_ne_zero.mpr hn)) + Complex.I_ne_zero)] + have he : Complex.exp (2 * (Real.pi : ℂ) * (n : ℂ) * Complex.I) = 1 := by + have h := (Complex.exp_periodic.int_mul n) 0 + calc + _ = Complex.exp ((n : ℂ) * (2 * (Real.pi : ℂ) * Complex.I)) := + congrArg Complex.exp (by ring) + _ = 1 := by simpa only [Complex.exp_zero, zero_add] using h + simp only [Complex.ofReal_one, Complex.ofReal_zero, mul_one, mul_zero, Complex.exp_zero, he, sub_self, zero_div] + +theorem heatMode_shift_factor (n : ℤ) (t x y : ℝ) : + heatMode 0 n (t, x - y) = heatMode 0 n (t, x) * + Complex.exp ((2 * (Real.pi : ℂ) * ((-n : ℤ) : ℂ) * Complex.I) * y) := by + simp only [heatMode, pow_zero, one_mul, heatModeLinear, add_apply, smul_apply, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_fst', + ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply, Complex.real_smul, smul_eq_mul] + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +theorem periodicHeatMoment_integral {t : ℝ} (ht : 0 < t) (x : ℝ) : + (∫ y in Icc (0 : ℝ) 1, periodicHeatMoment 0 (t, x - y)) = 1 := by + have hs := hasSum_integral_of_dominated_convergence + (μ := volume.restrict (Icc (0 : ℝ) 1)) + (fun n : ℤ => fun _ : ℝ => heatModeBound 0 t n) + (fun n => ((heatMode_smooth 0 n).continuous.comp + (continuous_const.prodMk (continuous_const.sub continuous_id))).aestronglyMeasurable) + (fun n => ae_of_all _ fun y => (heatMode_norm 0 n (t, x - y)).le) + (ae_of_all _ fun _ => heatModeBound_summable 0 ht) + continuous_const.integrableOn_Icc + (ae_of_all _ fun y => (periodicHeatMoment_summable 0 (p := (t, x - y)) ht).hasSum) + have he (n : ℤ) : (∫ y in Icc (0 : ℝ) 1, heatMode 0 n (t, x - y)) = + if n = 0 then 1 else 0 := by + simp_rw [heatMode_shift_factor] + rw [integral_const_mul, heatFrequency_integral] + by_cases hn : n = 0 + · subst n + simp [heatMode, heatModeLinear] + · simp [hn] + have h := hs.tsum_eq + change (∑' n : ℤ, ∫ y in Icc (0 : ℝ) 1, heatMode 0 n (t, x - y)) = _ at h + simp only [he] at h + simpa only [periodicHeatMoment, tsum_ite_eq, ite_true] using h.symm + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatModes.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatModes.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3c76cca3a75061776faf88085f482cc945b952e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatModes.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatGaussianBound +import Mathlib.Analysis.Calculus.SmoothSeries +import Mathlib.Analysis.Complex.Basic + +namespace OAI + +/-! Polynomially weighted Fourier modes for the classical periodic heat +solution. The positive-time Gaussian majorants are explicit. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Complex +open scoped ContDiff BigOperators + +def heatModeLinear (n : ℤ) : (ℝ × ℝ) →L[ℝ] ℂ := + (-4 * Real.pi ^ 2 * (n : ℝ) ^ 2) • + (Complex.ofRealCLM.comp (ContinuousLinearMap.fst ℝ ℝ ℝ)) + + (2 * Real.pi * (n : ℝ)) • + (Complex.I • (Complex.ofRealCLM.comp (ContinuousLinearMap.snd ℝ ℝ ℝ))) + +def heatMode (k : ℕ) (n : ℤ) (p : ℝ × ℝ) : ℂ := + (n : ℂ) ^ k * Complex.exp (heatModeLinear n p) + +def heatModeBound (k : ℕ) (T : ℝ) (n : ℤ) : ℝ := + |(n : ℝ)| ^ k * Real.exp (-4 * Real.pi ^ 2 * (n : ℝ) ^ 2 * T) + +theorem heatModeLinear_re (n : ℤ) (p : ℝ × ℝ) : + (heatModeLinear n p).re = -4 * Real.pi ^ 2 * (n : ℝ) ^ 2 * p.1 := by + simp [heatModeLinear, -Complex.ofReal_pow, Complex.mul_re, Complex.mul_im, mul_assoc] + +theorem heatMode_smooth (k : ℕ) (n : ℤ) : ContDiff ℝ ∞ (heatMode k n) := by + exact contDiff_const.mul ((heatModeLinear n).contDiff.cexp) + +theorem heatMode_hasFDerivAt (k : ℕ) (n : ℤ) (p : ℝ × ℝ) : + HasFDerivAt (heatMode k n) (heatMode k n p • heatModeLinear n) p := by + have h := ((heatModeLinear n).hasFDerivAt (x := p)).cexp.const_mul ((n : ℂ) ^ k) + convert! h using 1 + simp only [heatMode, smul_smul] + +theorem heatMode_norm (k : ℕ) (n : ℤ) (p : ℝ × ℝ) : + ‖heatMode k n p‖ = heatModeBound k p.1 n := by + simp only [heatMode, norm_mul, norm_pow, Complex.norm_intCast, + Complex.norm_exp, heatModeLinear_re, heatModeBound] + +theorem heatModeBound_summable (k : ℕ) {T : ℝ} (hT : 0 < T) : + Summable (heatModeBound k T) := by + have h := summable_pow_mul_jacobiTheta₂_term_bound 0 + (T := 4 * Real.pi * T) (by positivity) k + convert h using 1 + funext n + simp only [heatModeBound, Int.cast_abs] + congr 2 + ring + +theorem heatMode_norm_le (k : ℕ) (n : ℤ) {T : ℝ} {p : ℝ × ℝ} + (hp : T ≤ p.1) : ‖heatMode k n p‖ ≤ heatModeBound k T n := by + rw [heatMode_norm] + unfold heatModeBound + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply Real.exp_le_exp.mpr + apply mul_le_mul_of_nonpos_left hp + have h : 0 ≤ 4 * Real.pi ^ 2 * (n : ℝ) ^ 2 := by positivity + linarith + +theorem heatModeLinear_norm_le (n : ℤ) : + ‖heatModeLinear n‖ ≤ 4 * Real.pi ^ 2 * |(n : ℝ)| ^ 2 + 2 * Real.pi * |(n : ℝ)| := by + apply (heatModeLinear n).opNorm_le_bound (by positivity) + intro p + simp only [heatModeLinear, add_apply, smul_apply, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.coe_fst', ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply] + calc + _ ≤ ‖(-4 * Real.pi ^ 2 * (n : ℝ) ^ 2) • (p.1 : ℂ)‖ + + ‖(2 * Real.pi * (n : ℝ)) • (Complex.I • (p.2 : ℂ))‖ := norm_add_le _ _ + _ = (4 * Real.pi ^ 2 * |(n : ℝ)| ^ 2) * |p.1| + + (2 * Real.pi * |(n : ℝ)|) * |p.2| := by + simp only [norm_smul, Real.norm_eq_abs, Complex.norm_real, Complex.norm_I, + one_mul, abs_mul, abs_pow, abs_neg, abs_of_pos Real.pi_pos] + norm_num + _ ≤ _ := by + have h₁ : |p.1| ≤ ‖p‖ := norm_fst_le p + have h₂ : |p.2| ≤ ‖p‖ := norm_snd_le p + nlinarith [mul_le_mul_of_nonneg_left h₁ + (show 0 ≤ 4 * Real.pi ^ 2 * |(n : ℝ)| ^ 2 by positivity), + mul_le_mul_of_nonneg_left h₂ + (show 0 ≤ 2 * Real.pi * |(n : ℝ)| by positivity)] + +def heatModeDerivativeBound (k : ℕ) (T : ℝ) (n : ℤ) : ℝ := + 4 * Real.pi ^ 2 * heatModeBound (k + 2) T n + + 2 * Real.pi * heatModeBound (k + 1) T n + +theorem heatModeDerivativeBound_summable (k : ℕ) {T : ℝ} (hT : 0 < T) : + Summable (heatModeDerivativeBound k T) := + ((heatModeBound_summable (k + 2) hT).mul_left _).add + ((heatModeBound_summable (k + 1) hT).mul_left _) + +theorem heatMode_derivative_norm_le (k : ℕ) (n : ℤ) {T : ℝ} {p : ℝ × ℝ} + (hp : T ≤ p.1) : + ‖heatMode k n p • heatModeLinear n‖ ≤ heatModeDerivativeBound k T n := by + rw [norm_smul] + calc + _ ≤ heatModeBound k T n * + (4 * Real.pi ^ 2 * |(n : ℝ)| ^ 2 + 2 * Real.pi * |(n : ℝ)|) := + mul_le_mul (heatMode_norm_le k n hp) (heatModeLinear_norm_le n) + (norm_nonneg _) (by unfold heatModeBound; positivity) + _ = _ := by + simp only [heatModeDerivativeBound, heatModeBound, pow_add] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatPoisson.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatPoisson.lean new file mode 100644 index 0000000000000000000000000000000000000000..04ad3a3e00041dc345b22d247319d6ffd99529b4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatPoisson.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatSeries +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatLattice +import Mathlib.Analysis.SpecialFunctions.Gaussian.PoissonSummation + +namespace OAI + +/-! Poisson summation identifies the periodic heat Fourier series with the +actual Gaussian lattice sum used in the detector. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open scoped ContDiff BigOperators + +theorem periodicHeatMoment_zero_gaussian {t : ℝ} (ht : 0 < t) (x : ℝ) : + periodicHeatMoment 0 (t, x) = + (Real.sqrt (4 * Real.pi * t) : ℂ)⁻¹ * (gaussianLattice t x : ℂ) := by + let a : ℝ := 4 * Real.pi * t + have ha : 0 < a := by dsimp only [a]; positivity + have h := Complex.tsum_exp_neg_quadratic (a := (a : ℂ)) + (by simpa only [Complex.ofReal_re] using ha) (Complex.I * (x : ℂ)) + have hl : periodicHeatMoment 0 (t, x) = + ∑' n : ℤ, Complex.exp (-(Real.pi : ℂ) * (a : ℂ) * (n : ℂ) ^ 2 + + 2 * (Real.pi : ℂ) * (Complex.I * (x : ℂ)) * (n : ℂ)) := by + apply tsum_congr + intro n + simp only [heatMode, pow_zero, one_mul, heatModeLinear, add_apply, smul_apply, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_fst', + ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply, Complex.real_smul, + smul_eq_mul, a] + congr 1 + push_cast + ring + have hr : (∑' n : ℤ, Complex.exp (-(Real.pi : ℂ) / (a : ℂ) * + ((n : ℂ) + Complex.I * (Complex.I * (x : ℂ))) ^ 2)) = + (gaussianLattice t x : ℂ) := by + calc + _ = ∑' n : ℤ, (Real.exp (-((x + ((-n : ℤ) : ℝ)) ^ 2) / (4 * t)) : ℂ) := by + apply tsum_congr + intro n + rw [Complex.ofReal_exp] + congr 1 + simp only [a, Int.cast_neg] + push_cast + simp only [← mul_assoc Complex.I Complex.I, Complex.I_mul_I, neg_one_mul] + field_simp [ht.ne', Real.pi_ne_zero] + ring + _ = ∑' n : ℤ, (Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t)) : ℂ) := + (Equiv.neg ℤ).tsum_eq (fun n : ℤ => + (Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t)) : ℂ)) + _ = _ := (Complex.ofReal_tsum _).symm + rw [hl, h, hr] + congr 1 + rw [one_div] + congr 1 + rw [Real.sqrt_eq_rpow, Complex.ofReal_cpow ha.le] + congr 1 + norm_num + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatSeries.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..b257091fe063e03c357575d68c7e0a362ee4a6db --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PeriodicHeatSeries.lean @@ -0,0 +1,105 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatModes + +namespace OAI + +/-! Differentiation of the actual periodic heat Fourier series at positive + times, with summable Gaussian majorants for its weighted moments. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff BigOperators + +def periodicHeatMoment (k : ℕ) (p : ℝ × ℝ) : ℂ := ∑' n : ℤ, heatMode k n p + +def periodicHeatMomentDerivative (k : ℕ) (p : ℝ × ℝ) : (ℝ × ℝ) →L[ℝ] ℂ := + ∑' n : ℤ, heatMode k n p • heatModeLinear n + +theorem periodicHeatMoment_summable (k : ℕ) {p : ℝ × ℝ} (hp : 0 < p.1) : + Summable (fun n : ℤ => heatMode k n p) := + (heatModeBound_summable k hp).of_norm_bounded (fun n => (heatMode_norm k n p).le) + +theorem periodicHeatMoment_hasFDerivAt (k : ℕ) {p : ℝ × ℝ} (hp : 0 < p.1) : + HasFDerivAt (periodicHeatMoment k) (periodicHeatMomentDerivative k p) p := by + let T := p.1 / 2 + let V : Set (ℝ × ℝ) := Ioi T ×ˢ univ + have hT : 0 < T := half_pos hp + have hpV : p ∈ V := ⟨by change p.1 / 2 < p.1; linarith, mem_univ _⟩ + have hVo : IsOpen V := isOpen_Ioi.prod isOpen_univ + have hVc : IsPreconnected V := ((convex_Ioi T).prod convex_univ).isPreconnected + exact hasFDerivAt_tsum_of_isPreconnected (heatModeDerivativeBound_summable k hT) + hVo hVc (fun n q _ => heatMode_hasFDerivAt k n q) + (fun n q hq => heatMode_derivative_norm_le k n hq.1.le) + hpV (periodicHeatMoment_summable k hp) hpV + +theorem periodicHeatMoment_continuousOn (k : ℕ) : + ContinuousOn (periodicHeatMoment k) (Ioi (0 : ℝ) ×ˢ univ) := by + intro p hp + exact (periodicHeatMoment_hasFDerivAt k hp.1).continuousAt.continuousWithinAt + +theorem periodicHeatMomentDerivative_eq (k : ℕ) {p : ℝ × ℝ} (hp : 0 < p.1) : + periodicHeatMomentDerivative k p = + (-4 * (Real.pi : ℂ) ^ 2 * periodicHeatMoment (k + 2) p) • + (Complex.ofRealCLM.comp (ContinuousLinearMap.fst ℝ ℝ ℝ)) + + (2 * (Real.pi : ℂ) * periodicHeatMoment (k + 1) p) • + (Complex.I • (Complex.ofRealCLM.comp (ContinuousLinearMap.snd ℝ ℝ ℝ))) := by + let A := Complex.ofRealCLM.comp (ContinuousLinearMap.fst ℝ ℝ ℝ) + let B := Complex.I • (Complex.ofRealCLM.comp (ContinuousLinearMap.snd ℝ ℝ ℝ)) + let c₀ : ℂ := -4 * (Real.pi : ℂ) ^ 2 + let c₁ : ℂ := 2 * (Real.pi : ℂ) + have he (n : ℤ) : heatMode k n p • heatModeLinear n = + (c₀ * heatMode (k + 2) n p) • A + (c₁ * heatMode (k + 1) n p) • B := by + apply ContinuousLinearMap.ext + intro q + simp only [heatMode, heatModeLinear, A, B, c₀, c₁, add_apply, smul_apply, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_fst', + ContinuousLinearMap.coe_snd', Complex.ofRealCLM_apply, Complex.real_smul, smul_eq_mul, + pow_add, pow_two] + push_cast + ring + have h₀ := periodicHeatMoment_summable (k + 2) hp + have h₁ := periodicHeatMoment_summable (k + 1) hp + unfold periodicHeatMomentDerivative + simp_rw [he] + rw [((h₀.mul_left c₀).smul_const A).tsum_add ((h₁.mul_left c₁).smul_const B), + (h₀.mul_left c₀).tsum_smul_const, (h₁.mul_left c₁).tsum_smul_const, + h₀.tsum_mul_left, h₁.tsum_mul_left] + rfl + +theorem periodicHeatMoment_contDiffOn_nat (m : ℕ) (k : ℕ) : + ContDiffOn ℝ m (periodicHeatMoment k) (Ioi (0 : ℝ) ×ˢ univ) := by + induction m generalizing k with + | zero => exact contDiffOn_zero.mpr (periodicHeatMoment_continuousOn k) + | succ m ih => + have ho : IsOpen (Ioi (0 : ℝ) ×ˢ (univ : Set ℝ)) := isOpen_Ioi.prod isOpen_univ + have hd : DifferentiableOn ℝ (periodicHeatMoment k) (Ioi (0 : ℝ) ×ˢ univ) := by + intro p hp + exact (periodicHeatMoment_hasFDerivAt k hp.1).differentiableAt.differentiableWithinAt + have hF : ContDiffOn ℝ m (fun p : ℝ × ℝ => + (-4 * (Real.pi : ℂ) ^ 2 * periodicHeatMoment (k + 2) p) • + (Complex.ofRealCLM.comp (ContinuousLinearMap.fst ℝ ℝ ℝ)) + + (2 * (Real.pi : ℂ) * periodicHeatMoment (k + 1) p) • + (Complex.I • (Complex.ofRealCLM.comp (ContinuousLinearMap.snd ℝ ℝ ℝ)))) + (Ioi (0 : ℝ) ×ˢ univ) := + ((contDiffOn_const.mul (ih (k + 2))).smul contDiffOn_const).add + ((contDiffOn_const.mul (ih (k + 1))).smul contDiffOn_const) + have hfd : ContDiffOn ℝ m (fderiv ℝ (periodicHeatMoment k)) (Ioi (0 : ℝ) ×ˢ univ) := by + apply hF.congr + intro p hp + rw [(periodicHeatMoment_hasFDerivAt k hp.1).fderiv, + periodicHeatMomentDerivative_eq k hp.1] + have hsucc := (contDiffOn_succ_iff_fderiv_of_isOpen ho).mpr + ⟨hd, by simp, hfd⟩ + simpa only [Nat.cast_add, Nat.cast_one] using hsucc + +theorem periodicHeatMoment_smooth (k : ℕ) : + ContDiffOn ℝ ∞ (periodicHeatMoment k) (Ioi (0 : ℝ) ×ˢ univ) := by + rw [contDiffOn_infty] + intro m + exact periodicHeatMoment_contDiffOn_nat m k + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneBarrier.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneBarrier.lean new file mode 100644 index 0000000000000000000000000000000000000000..2df391dd35bfb199d5c8e68a861900931b4a651a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneBarrier.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMaximumCompact +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarComparison + +namespace OAI + +/-! A quadratic barrier for bounded whole-plane drift. It supplies strict +comparison without requiring compact support of the diffusing scalar. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +def planeBarrierSquare (x : Plane) : ℝ := 1 + (x 0) ^ 2 + (x 1) ^ 2 + +theorem planeBarrierSquare_smooth : ContDiff ℝ ∞ planeBarrierSquare := by + unfold planeBarrierSquare + fun_prop + +theorem planeBarrierSquare_one_le (x : Plane) : 1 ≤ planeBarrierSquare x := by + unfold planeBarrierSquare + nlinarith [sq_nonneg (x 0), sq_nonneg (x 1)] + +theorem planeBarrierSquare_fderiv (x v : Plane) : + fderiv ℝ planeBarrierSquare x v = 2 * x 0 * v 0 + 2 * x 1 * v 1 := by + have hd := (((hasFDerivAt_apply (𝕜 := ℝ) 0 x).pow 2).const_add 1).add + ((hasFDerivAt_apply (𝕜 := ℝ) 1 x).pow 2) + change HasFDerivAt planeBarrierSquare _ x at hd + rw [hd.fderiv] + simp + +theorem planeBarrierSquare_spatialD (j : Fin 2) : + spatialD j planeBarrierSquare = fun x => 2 * x j := by + funext x + rw [spatialD, planeBarrierSquare_fderiv] + fin_cases j <;> simp [PlanarHamiltonian.basis] + +theorem planeBarrierSquare_laplacian (x : Plane) : + scalarLaplacian planeBarrierSquare x = 4 := by + have hd (j : Fin 2) : spatialD j (spatialD j planeBarrierSquare) x = 2 := by + rw [planeBarrierSquare_spatialD] + have hh := (hasFDerivAt_apply (𝕜 := ℝ) j x).const_mul 2 + simp [spatialD, hh.fderiv, PlanarHamiltonian.basis] + norm_num [scalarLaplacian, hd] + +theorem planeBarrierSquare_generator (ν : ℝ) (a : Plane → Plane) (x : Plane) : + scalarGenerator ν a planeBarrierSquare x = + 4 * ν - (2 * x 0 * a x 0 + 2 * x 1 * a x 1) := by + rw [scalarGenerator, planeBarrierSquare_laplacian, planeBarrierSquare_fderiv] + ring + +theorem planeBarrierSquare_generator_bound {ν A : ℝ} (hν : 0 ≤ ν) (_hA : 0 ≤ A) + (a : Plane → Plane) (ha : ∀ x, ‖a x‖ ≤ A) (x : Plane) : + scalarGenerator ν a planeBarrierSquare x + planeBarrierSquare x ≤ + (4 * ν + 2 * A ^ 2 + 2) * planeBarrierSquare x := by + have hac (j : Fin 2) : |a x j| ≤ A := by + have hnorm : |a x j| ≤ ‖a x‖ := by + simpa only [Real.norm_eq_abs] using (norm_le_pi_norm (a x) j) + exact hnorm.trans (ha x) + have hs (j : Fin 2) : -(2 * x j * a x j) ≤ (x j) ^ 2 + A ^ 2 := by + obtain ⟨hlo, hhi⟩ := abs_le.mp (hac j) + have hsquare : (a x j) ^ 2 ≤ A ^ 2 := by + nlinarith [mul_nonneg (sub_nonneg.mpr hhi) + (show 0 ≤ A + a x j by linarith)] + nlinarith [sq_nonneg (x j + a x j)] + have hsum : 0 ≤ (x 0) ^ 2 + (x 1) ^ 2 := by positivity + have hcoef : 0 ≤ 4 * ν + 2 * A ^ 2 := by positivity + rw [planeBarrierSquare_generator] + unfold planeBarrierSquare + nlinarith [hs 0, hs 1, mul_nonneg hcoef hsum] + +theorem spatialD_const_mul {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (c : ℝ) (j : Fin 2) : + spatialD j (fun x => c * f x) = fun x => c * spatialD j f x := by + funext x + simp only [spatialD, fderiv_const_mul (hf.differentiable (by simp) x) c, + smul_apply, smul_eq_mul] + +theorem scalarGenerator_const_mul {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (ν c : ℝ) (a : Plane → Plane) (x : Plane) : + scalarGenerator ν a (fun y => c * f y) x = c * scalarGenerator ν a f x := by + have hl : scalarLaplacian (fun y => c * f y) x = c * scalarLaplacian f x := by + simp only [scalarLaplacian, spatialD_const_mul hf, + spatialD_const_mul (spatialD_smooth _ hf), Finset.mul_sum] + simp only [scalarGenerator, hl, fderiv_const_mul (hf.differentiable (by simp) x) c, + smul_apply, smul_eq_mul] + ring + +theorem quadratic_barrier_positive_compact {w : ℝ → Plane → ℝ} {T B ε : ℝ} + (hε : 0 < ε) (hb : ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ B) + (c : ℝ → ℝ) (hc : ∀ t ∈ Icc 0 T, 1 ≤ c t) : + ∃ K : Set Plane, IsCompact K ∧ ∀ t ∈ Icc 0 T, ∀ x, + 0 < w t x - ε * c t * planeBarrierSquare x → x ∈ K := by + let R := |B| / ε + 1 + have hdiv : 0 ≤ |B| / ε := div_nonneg (abs_nonneg _) hε.le + have hR : 0 < R := by dsimp [R]; linarith + have hR₁ : 1 ≤ R := by dsimp [R]; linarith + have hmul : ε * R = |B| + ε := by + dsimp [R] + field_simp [hε.ne'] + have hBR : B < ε * R ^ 2 := by + have hsq : R ≤ R ^ 2 := by nlinarith [mul_nonneg hR.le (sub_nonneg.mpr hR₁)] + have hle := mul_le_mul_of_nonneg_left hsq hε.le + nlinarith [le_abs_self B] + refine ⟨Icc (fun _ : Fin 2 => -R) (fun _ => R), isCompact_Icc, ?_⟩ + intro t ht x hx + have hp : 0 ≤ planeBarrierSquare x := (by norm_num : (0 : ℝ) ≤ 1).trans + (planeBarrierSquare_one_le x) + have hcoef : ε ≤ ε * c t := by nlinarith [hc t ht] + have hφ : ε * planeBarrierSquare x < B := by + have hm := mul_le_mul_of_nonneg_right hcoef hp + linarith [hb t ht x] + have hj (j : Fin 2) : |x j| < R := by + have hsq : (x j) ^ 2 ≤ planeBarrierSquare x := by + fin_cases j + · change (x 0) ^ 2 ≤ 1 + (x 0) ^ 2 + (x 1) ^ 2 + nlinarith [sq_nonneg (x 1)] + · change (x 1) ^ 2 ≤ 1 + (x 0) ^ 2 + (x 1) ^ 2 + nlinarith [sq_nonneg (x 0)] + have hεsq : ε * (x j) ^ 2 < ε * R ^ 2 := + ((mul_le_mul_of_nonneg_left hsq hε.le).trans_lt hφ).trans hBR + exact abs_lt_of_sq_lt_sq ((mul_lt_mul_iff_right₀ hε).mp hεsq) hR.le + exact ⟨fun j => (abs_lt.mp (hj j)).1.le, fun j => (abs_lt.mp (hj j)).2.le⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneClassicalRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneClassicalRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2cc8ddfda87fd9c60a1084023315ffc090d7ac7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneClassicalRegularity.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderSpatialCalculus +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTimeRegularity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneFluid + +namespace OAI + +/-! Classical space-time regularity of the triangular whole-plane solution. +At time zero its time derivative is the right derivative, as in the +Navier–Stokes solution class. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem PlaneScalarSolution.triangularVelocity_plane_smoothOn {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) : + ContDiffOn ℝ ∞ (triangularVelocity a w) (timeCylinder T) := by + let H : SpaceTime → ℝ × Plane := fun y => (y.1, horizontalLinear y.2) + have hH : ContDiff ℝ ∞ H := + contDiff_fst.prodMk (horizontalLinear.contDiff.comp contDiff_snd) + have hwc := hw.smooth.comp hH.contDiffOn + (show MapsTo H (timeCylinder T) (Icc 0 T ×ˢ univ) from + fun y hy => ⟨hy.1, mem_univ _⟩) + have hac := ha.comp hH + exact (planeInclusion.contDiff.comp_contDiffOn hac.contDiffOn).add + (hwc.smul contDiffOn_const) + +theorem GlobalPlaneScalarSolution.velocity_time_differentiable {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + DifferentiableWithinAt ℝ (fun s => triangularVelocity a w (s, x)) (Ici 0) t := by + have hda : HasDerivAt (fun s => a s (horizontalLinear x)) + (deriv (fun s => a s (horizontalLinear x)) t) t := + ((ha.comp (contDiff_id.prodMk contDiff_const)).differentiable (by simp) t).hasDerivAt + have hdw := hw.hasDerivWithinAt ht (horizontalLinear x) + exact ((planeInclusion.hasFDerivAt.comp_hasDerivWithinAt t hda.hasDerivWithinAt).add + (hdw.smul_const (basis 2))).differentiableWithinAt + +theorem GlobalPlaneScalarSolution.velocity_time_formula {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + ShearFlows.initialTimeDerivative (triangularVelocity a w) t x = + timeDerivative (triangularVelocity a (fun _ _ => 0)) t x + + planeTimeDerivative ν a h w t (horizontalLinear x) • basis 2 := by + rw [hw.initialTimeDerivative ha ht, triangularVelocity_timeDerivative ha contDiff_const] + simp only [triangularLift, planeTimeDerivative, deriv_const, zero_smul, add_zero] + +theorem GlobalPlaneScalarSolution.velocity_time_continuous {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (T : ℝ) (hT : 0 ≤ T) : + ContinuousOn (fun y : SpaceTime => + ShearFlows.initialTimeDerivative (triangularVelocity a w) y.1 y.2) (timeCylinder T) := by + have hg := ((hw (T+1) (by linarith)).cylinder_generator (by linarith) ha hh).continuousOn + have hH : ContinuousOn (fun y : SpaceTime => (y.1, horizontalLinear y.2)) + (timeCylinder T) := + (continuous_fst.prodMk (horizontalLinear.continuous.comp continuous_snd)).continuousOn + have hgc := hg.comp hH (fun y hy => ⟨⟨hy.1.1, by linarith [hy.1.2]⟩, mem_univ _⟩) + have hb := (timeDerivative_smooth (triangularVelocity_smooth ha (show ContDiff ℝ ∞ (Function.uncurry (fun (_ : ℝ) (_ : Plane) => (0 : ℝ))) from contDiff_const))).continuous + exact (hb.continuousOn.add (hgc.smul continuousOn_const)).congr + (fun y hy => hw.velocity_time_formula ha hy.1.1 y.2) + +theorem GlobalPlaneScalarSolution.classicalRegularity {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) : + ClassicalRegularity (triangularVelocity a w) (fun _ => 0) where + spatial_u t ht := (triangularLift_smooth + (ha.comp (contDiff_const.prodMk contDiff_id)) + ((hw t ht).slice_smooth ⟨ht, le_rfl⟩)).of_le (by norm_num) + temporal_u t ht x := hw.velocity_time_differentiable ha ht x + spatial_p _ _ := contDiff_const + continuous_u T hT := ((hw T hT).triangularVelocity_plane_smoothOn ha).continuousOn + continuous_du T hT := by + have hs := (hw (T+1) (by linarith)).triangularVelocity_plane_smoothOn ha + exact (cylinder_spatial_fderiv_smooth (by linarith) hs).continuousOn.mono + (fun y hy => ⟨⟨hy.1.1, by linarith [hy.1.2]⟩, hy.2⟩) + continuous_ddu T hT := by + have hs := (hw (T+1) (by linarith)).triangularVelocity_plane_smoothOn ha + exact (cylinder_second_spatial_fderiv_smooth (by linarith) hs).continuousOn.mono + (fun y hy => ⟨⟨hy.1.1, by linarith [hy.1.2]⟩, hy.2⟩) + continuous_ut T hT := hw.velocity_time_continuous ha hh T hT + continuous_p _ _ := continuousOn_const + continuous_dp _ _ := by + simp only [gradient_constant] + exact continuousOn_const + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b29c53599e9a5e1ecdbeb2973378ddcca163644 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientBounds.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.SpatialParameterDerivatives +import Mathlib.Analysis.Calculus.MeanValue + +namespace OAI + +/-! Uniform bounds and time moduli for periodic and compactly supported coefficients. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff NNReal + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +omit [NormedSpace ℝ F] in +theorem planePeriodic_bound_on {f : ℝ × Plane → F} {a b : ℝ} + (hf : ContinuousOn f (Icc a b ×ˢ (univ : Set Plane))) + (hp : ∀ t ∈ Icc a b, PlanePeriodic (fun x => f (t,x))) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc a b, ∀ x, ‖f (t,x)‖ ≤ C := by + obtain ⟨C,hC⟩ := (isCompact_Icc.prod + (isCompact_Icc : IsCompact (Icc (0 : Plane) (fun _ => 1)))).exists_bound_of_continuousOn + (hf.mono (fun p hp => ⟨hp.1, mem_univ _⟩)) + refine ⟨max C 0, le_max_right _ _, ?_⟩ + intro t ht x + let y : Plane := fun j => Int.fract (x j) + have hy : y ∈ Icc (0 : Plane) (fun _ => 1) := + ⟨fun j => Int.fract_nonneg _, fun j => (Int.fract_lt_one _).le⟩ + have he : y + (fun j => ((⌊x j⌋ : ℤ) : ℝ)) = x := by + ext j + exact Int.fract_add_floor (x j) + have hv := hp t ht y (fun j => ⌊x j⌋) + rw [he] at hv + change f (t,x) = f (t,y) at hv + rw [hv] + exact (hC (t,y) ⟨ht,hy⟩).trans (le_max_left _ _) + +theorem planePeriodic_totalDerivative {f : ℝ × Plane → F} + (hf : ContDiff ℝ ∞ f) (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) (t : ℝ) : + PlanePeriodic (fun x => fderiv ℝ f (t,x)) := by + intro x k + have hs : ∀ p : ℝ × Plane, f (p+(0,fun j => (k j : ℝ))) = f p := by + rintro ⟨s,y⟩ + simpa only [Prod.mk_add_mk, add_zero] using hp s y k + have h := fderiv_translation (hf.differentiable (by simp)) hs (t,x) + simpa only [Prod.mk_add_mk, add_zero] using h + +theorem timeSlice_hasDerivAt {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (t : ℝ) (x : Plane) : + HasDerivAt (fun s => f (s,x)) (fderiv ℝ f (t,x) (1,0)) t := by + exact (hf.differentiable (by simp) (t,x)).hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + +theorem timeSlice_norm_derivative_le {f : ℝ × Plane → F} {C t : ℝ} {x : Plane} + (hC : ‖fderiv ℝ f (t,x)‖ ≤ C) : ‖fderiv ℝ f (t,x) (1,0)‖ ≤ C := by + calc + _ ≤ ‖fderiv ℝ f (t,x)‖ * ‖((1 : ℝ), (0 : Plane))‖ := + (fderiv ℝ f (t,x)).le_opNorm _ + _ = ‖fderiv ℝ f (t,x)‖ := by simp + _ ≤ C := hC + +theorem planePeriodic_time_lipschitz {f : ℝ × Plane → F} + (hf : ContDiff ℝ ∞ f) (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) (a b : ℝ) : + ∃ L : ℝ≥0, ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, ∀ x, + ‖f (s,x)-f (t,x)‖ ≤ L * |s-t| := by + obtain ⟨C,hC,hb⟩ := planePeriodic_bound_on + (hf.continuous_fderiv (by simp)).continuousOn + (fun t _ => planePeriodic_totalDerivative hf hp t) (a := a) (b := b) + refine ⟨⟨C,hC⟩, ?_⟩ + intro s hs t ht x + have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun r (_ : r ∈ Icc a b) => (timeSlice_hasDerivAt hf r x).hasDerivWithinAt) + (fun r hr => timeSlice_norm_derivative_le (hb r hr x)) (convex_Icc a b) ht hs + change ‖f (s,x)-f (t,x)‖ ≤ C * |s-t| + simpa only [Real.norm_eq_abs] using h + +omit [NormedSpace ℝ F] in +theorem supported_bound_on {f : ℝ × Plane → F} {a b : ℝ} {K : Set Plane} + (hK : IsCompact K) (hf : ContinuousOn f (Icc a b ×ˢ K)) + (hs : ∀ t ∈ Icc a b, ∀ x ∉ K, f (t,x) = 0) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc a b, ∀ x, ‖f (t,x)‖ ≤ C := by + obtain ⟨C,hC⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn hf + refine ⟨max C 0, le_max_right _ _, ?_⟩ + intro t ht x + by_cases hx : x ∈ K + · exact (hC (t,x) ⟨ht,hx⟩).trans (le_max_left _ _) + · rw [hs t ht x hx, norm_zero] + exact le_max_right _ _ + +theorem supported_time_lipschitz {f : ℝ × Plane → F} + (hf : ContDiff ℝ ∞ f) {K : Set Plane} (hK : IsCompact K) (a b : ℝ) + (hs : ∀ t ∈ Icc a b, ∀ x ∉ K, f (t,x) = 0) : + ∃ L : ℝ≥0, ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, ∀ x, + ‖f (s,x)-f (t,x)‖ ≤ L * |s-t| := by + obtain ⟨C,hC⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn + (hf.continuous_fderiv (by simp)).continuousOn + refine ⟨⟨max C 0, le_max_right _ _⟩, ?_⟩ + intro s hs₀ t ht x + by_cases hx : x ∈ K + · have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun r (_ : r ∈ Icc a b) => (timeSlice_hasDerivAt hf r x).hasDerivWithinAt) + (fun r hr => timeSlice_norm_derivative_le + ((hC (r,x) ⟨hr,hx⟩).trans (le_max_left C 0))) (convex_Icc a b) ht hs₀ + change ‖f (s,x)-f (t,x)‖ ≤ max C 0 * |s-t| + simpa only [Real.norm_eq_abs] using h + · rw [hs s hs₀ x hx, hs t ht x hx, sub_self, norm_zero] + exact mul_nonneg (le_max_right _ _) (abs_nonneg _) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9bc3a3255b79cc01f73ebb20ec2974f32e87c4d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientJets.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetCurves + +namespace OAI + +/-! The actual smooth coefficients define bounded continuous curves of every finite jet order. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff NNReal BigOperators + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +private theorem collect_jet_bounds (k : ℕ) (f : ℝ × Plane → F) (T : ℝ) + (hb : ∀ n ≤ k, ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc (0 : ℝ) T, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ C) + (hl : ∀ n ≤ k, ∃ L : ℝ≥0, ∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (s,y)) x - + iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ L * |s-t|) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ L : ℝ≥0, + (∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ C) ∧ + (∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (s,y)) x - + iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ L * |s-t|) := by + have hb' (i : Fin (k+1)) := hb i.val (Nat.le_of_lt_succ i.isLt) + have hl' (i : Fin (k+1)) := hl i.val (Nat.le_of_lt_succ i.isLt) + choose C hC hbound using hb' + choose L hmod using hl' + refine ⟨∑ i, C i, Finset.sum_nonneg (fun i _ => hC i), ∑ i, L i, ?_, ?_⟩ + · intro t ht n hn x + let i : Fin (k+1) := ⟨n, Nat.lt_succ_of_le hn⟩ + exact (hbound i t ht x).trans (Finset.single_le_sum (fun j _ => hC j) (Finset.mem_univ i)) + · intro s hs t ht n hn x + let i : Fin (k+1) := ⟨n, Nat.lt_succ_of_le hn⟩ + apply (hmod i s hs t ht x).trans + apply mul_le_mul_of_nonneg_right _ (abs_nonneg _) + exact_mod_cast Finset.single_le_sum (fun j (_ : j ∈ Finset.univ) => (L j).coe_nonneg) + (Finset.mem_univ i) + +theorem periodic_jet_bounds {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) (k : ℕ) (T : ℝ) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ L : ℝ≥0, + (∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ C) ∧ + (∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (s,y)) x - + iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ L * |s-t|) := by + have hper (n : ℕ) (t : ℝ) : PlanePeriodic (fun x => spatialParameterDerivative n f (t,x)) := by + simpa only [spatialParameterDerivative_eq hf] using planePeriodic_iteratedFDeriv (hp t) n + apply collect_jet_bounds k f T + · intro n _ + simpa only [spatialParameterDerivative_eq hf] using + planePeriodic_bound_on (spatialParameterDerivative_smooth hf n).continuous.continuousOn + (fun t _ => hper n t) (a := 0) (b := T) + · intro n _ + simpa only [spatialParameterDerivative_eq hf] using + planePeriodic_time_lipschitz (spatialParameterDerivative_smooth hf n) (hper n) 0 T + +theorem supported_spatialParameterDerivative {f : ℝ × Plane → F} + (hf : ContDiff ℝ ∞ f) {K : Set Plane} (hK : IsClosed K) {t : ℝ} + (hs : ∀ x ∉ K, f (t,x) = 0) (n : ℕ) (x : Plane) (hx : x ∉ K) : + spatialParameterDerivative n f (t,x) = 0 := by + rw [spatialParameterDerivative_eq hf] + have hc : tsupport (fun y => f (t,y)) ⊆ K := by + apply closure_minimal _ hK + intro y hy + by_contra h + exact hy (hs y h) + by_contra hn + exact hx (hc (support_iteratedFDeriv_subset n hn)) + +theorem supported_jet_bounds {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + {K : Set Plane} (hK : IsCompact K) (T : ℝ) + (hs : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, f (t,x) = 0) (k : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ L : ℝ≥0, + (∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ C) ∧ + (∀ s ∈ Icc (0 : ℝ) T, ∀ t ∈ Icc (0 : ℝ) T, ∀ n ≤ k, ∀ x, + ‖iteratedFDeriv ℝ n (fun y => f (s,y)) x - + iteratedFDeriv ℝ n (fun y => f (t,y)) x‖ ≤ L * |s-t|) := by + have hsup (n : ℕ) : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, + spatialParameterDerivative n f (t,x) = 0 := + fun t ht x hx => supported_spatialParameterDerivative hf hK.isClosed (hs t ht) n x hx + apply collect_jet_bounds k f T + · intro n _ + simpa only [spatialParameterDerivative_eq hf] using + supported_bound_on hK (spatialParameterDerivative_smooth hf n).continuous.continuousOn (hsup n) + · intro n _ + simpa only [spatialParameterDerivative_eq hf] using + supported_time_lipschitz (spatialParameterDerivative_smooth hf n) hK 0 T (hsup n) + +theorem exists_periodic_jet_curve {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) (k : ℕ) (T : ℝ) : + ∃ J : C(Icc (0 : ℝ) T, BoundedSpatialJets.Space Plane F k), + ∀ t x, BoundedSpatialJets.function Plane F k (J t) x = f (t,x) := by + obtain ⟨C,_,L,hC,hL⟩ := periodic_jet_bounds hf hp k T + refine ⟨BoundedSpatialJets.ofFunctionCurve Plane F k T (fun t x => f (t,x)) + (fun t _ => (hf.comp (contDiff_const.prodMk contDiff_id)).of_le (by simp)) C hC L hL, ?_⟩ + exact fun t x => BoundedSpatialJets.function_ofFunctionCurve Plane F k T _ _ _ _ _ _ t x + +theorem exists_supported_jet_curve {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + {K : Set Plane} (hK : IsCompact K) (T : ℝ) + (hs : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, f (t,x) = 0) (k : ℕ) : + ∃ J : C(Icc (0 : ℝ) T, BoundedSpatialJets.Space Plane F k), + ∀ t x, BoundedSpatialJets.function Plane F k (J t) x = f (t,x) := by + obtain ⟨C,_,L,hC,hL⟩ := supported_jet_bounds hf hK T hs k + refine ⟨BoundedSpatialJets.ofFunctionCurve Plane F k T (fun t x => f (t,x)) + (fun t _ => (hf.comp (contDiff_const.prodMk contDiff_id)).of_le (by simp)) C hC L hL, ?_⟩ + exact fun t x => BoundedSpatialJets.function_ofFunctionCurve Plane F k T _ _ _ _ _ _ t x + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientTimeJets.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientTimeJets.lean new file mode 100644 index 0000000000000000000000000000000000000000..332606f564138f2c76b4b53e3375a2def8f92fb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCoefficientTimeJets.lean @@ -0,0 +1,182 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientJets +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetTimeDerivative +import Mathlib.Analysis.Calculus.ContDiff.Deriv + +namespace OAI + +/-! Smooth time dependence of the bounded spatial jets of actual coefficients. -/ + +noncomputable section +namespace ForcedComputation + +open Set Filter ShearFlows +open scoped Topology ContDiff BoundedContinuousFunction + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Repeated time differentiation, retaining space as a parameter. -/ +def timePartial : ℕ → (ℝ × Plane → F) → ℝ × Plane → F + | 0, f => f + | n+1, f => fun p => fderiv ℝ (timePartial n f) p (1,0) + +theorem timePartial_smooth {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) (n : ℕ) : + ContDiff ℝ ∞ (timePartial n f) := by + induction n with + | zero => exact hf + | succ n ih => exact (ih.fderiv_right (by simp)).clm_apply contDiff_const + +theorem timePartial_hasDerivAt {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (n : ℕ) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => timePartial n f (s,x)) (timePartial (n+1) f (t,x)) t := + timeSlice_hasDerivAt (timePartial_smooth hf n) t x + +theorem timePartial_periodic {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) (n : ℕ) (t : ℝ) : + PlanePeriodic (fun x => timePartial n f (t,x)) := by + induction n generalizing t with + | zero => exact hp t + | succ n ih => + intro x z + exact congrArg (fun L : (ℝ × Plane) →L[ℝ] F => L (1,0)) + (planePeriodic_totalDerivative (timePartial_smooth hf n) ih t x z) + +theorem timePartial_supported {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + {T : ℝ} (hT : 0 < T) {K : Set Plane} + (hs : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, f (t,x) = 0) + (n : ℕ) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) T) (x : Plane) (hx : x ∉ K) : + timePartial n f (t,x) = 0 := by + induction n generalizing t with + | zero => exact hs t ht x hx + | succ n ih => + have hd : HasDerivWithinAt (fun _ : ℝ => (0 : F)) + (timePartial (n+1) f (t,x)) (Icc (0 : ℝ) T) t := + (timePartial_hasDerivAt hf n t x).hasDerivWithinAt.congr + (fun s hs => (ih s hs).symm) (ih t ht).symm + exact (uniqueDiffOn_Icc hT t ht).eq_deriv _ hd + (hasDerivWithinAt_const t (Icc (0 : ℝ) T) (0 : F)) + +namespace CoefficientTimeJets + +abbrev Jet (k : ℕ) := BoundedSpatialJets.Space Plane ℝ k + +/-- Constant continuation is used only to state derivatives within the closed time slab. -/ +def extend {T : ℝ} (hT : 0 ≤ T) {k : ℕ} (J : C(Icc (0 : ℝ) T, Jet k)) + (t : ℝ) : Jet k := J (projIcc 0 T hT t) + +theorem continuous_extend {T : ℝ} (hT : 0 ≤ T) {k : ℕ} + (J : C(Icc (0 : ℝ) T, Jet k)) : Continuous (extend hT J) := + J.continuous.comp continuous_projIcc + +theorem extend_eq {T : ℝ} (hT : 0 ≤ T) {k : ℕ} + (J : C(Icc (0 : ℝ) T, Jet k)) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + extend hT J t = J ⟨t,ht⟩ := by + unfold extend + rw [projIcc_of_mem hT ht] + +/-- The next actual coefficient derivative supplies the derivative of its jet curve. -/ +theorem hasDerivWithinAt_extend {T : ℝ} (hT : 0 ≤ T) {k : ℕ} + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) (n : ℕ) + (J J' : C(Icc (0 : ℝ) T, Jet k)) + (hJ : ∀ t x, BoundedSpatialJets.function Plane ℝ k (J t) x = timePartial n f (t.val,x)) + (hJ' : ∀ t x, BoundedSpatialJets.function Plane ℝ k (J' t) x = timePartial (n+1) f (t.val,x)) + {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + HasDerivWithinAt (extend hT J) (extend hT J' t) (Icc (0 : ℝ) T) t := by + apply BoundedSpatialJets.hasDerivWithinAt_of_pointwise_derivative k + (extend hT J) (extend hT J') (continuous_extend hT J) (continuous_extend hT J') _ ht + intro s hs x + have he : (fun r => BoundedSpatialJets.function Plane ℝ k (extend hT J r) x) + =ᶠ[𝓝 s] (fun r => timePartial n f (r,x)) := by + filter_upwards [Ioo_mem_nhds hs.1 hs.2] with r hr + rw [extend_eq hT J ⟨hr.1.le,hr.2.le⟩] + exact hJ ⟨r,hr.1.le,hr.2.le⟩ x + have hd := (timePartial_hasDerivAt hf n s x).congr_of_eventuallyEq he + rw [extend_eq hT J' ⟨hs.1.le,hs.2.le⟩, hJ'] + exact hd + +/-- A continuous hierarchy of actual time derivatives gives all time regularity, at endpoints too. -/ +theorem smooth_extend_of_representatives {T : ℝ} (hT : 0 < T) {k : ℕ} + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (J : ℕ → C(Icc (0 : ℝ) T, Jet k)) + (hJ : ∀ n t x, BoundedSpatialJets.function Plane ℝ k (J n t) x = timePartial n f (t.val,x)) + (n : ℕ) : ContDiffOn ℝ ∞ (extend hT.le (J n)) (Icc (0 : ℝ) T) := by + have hd (i : ℕ) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) T) := + hasDerivWithinAt_extend hT.le hf i (J i) (J (i+1)) (hJ i) (hJ (i+1)) ht + have hall : ∀ m : ℕ, ∀ i : ℕ, + ContDiffOn ℝ m (extend hT.le (J i)) (Icc (0 : ℝ) T) := by + intro m + induction m with + | zero => intro i; exact contDiffOn_zero.mpr (continuous_extend hT.le (J i)).continuousOn + | succ m ih => + intro i + rw [Nat.cast_add, Nat.cast_one, + contDiffOn_succ_iff_derivWithin (uniqueDiffOn_Icc hT)] + refine ⟨fun t ht => (hd i t ht).differentiableWithinAt, ?_, ?_⟩ + · simp + · apply (ih (i+1)).congr + intro t ht + exact (hd i t ht).derivWithin (uniqueDiffOn_Icc hT t ht) + exact contDiffOn_infty.mpr (fun m => hall m n) + +/-- Smooth periodic scalar coefficients have continuous jets for every time derivative. -/ +theorem exists_periodic {T : ℝ} (hT : 0 < T) (k : ℕ) + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) : + ∃ J : ℕ → C(Icc (0 : ℝ) T, Jet k), + (∀ n t x, BoundedSpatialJets.function Plane ℝ k (J n t) x = timePartial n f (t.val,x)) ∧ + (∀ n, ContDiffOn ℝ ∞ (extend hT.le (J n)) (Icc (0 : ℝ) T)) := by + have he (n : ℕ) := exists_periodic_jet_curve (timePartial_smooth hf n) + (timePartial_periodic hf hp n) k T + choose J hJ using he + exact ⟨J, hJ, smooth_extend_of_representatives hT hf J hJ⟩ + +/-- Common compact spatial support is preserved by every time derivative on the slab. -/ +theorem exists_supported {T : ℝ} (hT : 0 < T) (k : ℕ) + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) {K : Set Plane} (hK : IsCompact K) + (hs : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, f (t,x) = 0) : + ∃ J : ℕ → C(Icc (0 : ℝ) T, Jet k), + (∀ n t x, BoundedSpatialJets.function Plane ℝ k (J n t) x = timePartial n f (t.val,x)) ∧ + (∀ n, ContDiffOn ℝ ∞ (extend hT.le (J n)) (Icc (0 : ℝ) T)) := by + have he (n : ℕ) := exists_supported_jet_curve (timePartial_smooth hf n) hK T + (timePartial_supported hf hT hs n) k + choose J hJ using he + exact ⟨J, hJ, smooth_extend_of_representatives hT hf J hJ⟩ + +private theorem extend_eq_of_representatives {T : ℝ} (hT : 0 ≤ T) {k : ℕ} + (J J' : C(Icc (0 : ℝ) T, Jet k)) + (he : ∀ t x, BoundedSpatialJets.function Plane ℝ k (J t) x = + BoundedSpatialJets.function Plane ℝ k (J' t) x) : extend hT J = extend hT J' := by + funext t + apply BoundedSpatialJets.function_injective Plane ℝ k + apply BoundedContinuousFunction.ext + intro x + exact he _ x + +/-- Smoothness holds for any representative, including the curves in compatible data. -/ +theorem periodic_curve_smooth {T : ℝ} (hT : 0 < T) {k : ℕ} + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hp : ∀ t, PlanePeriodic (fun x => f (t,x))) + (J : C(Icc (0 : ℝ) T, Jet k)) + (hJ : ∀ t x, BoundedSpatialJets.function Plane ℝ k (J t) x = f (t.val,x)) : + ContDiffOn ℝ ∞ (extend hT.le J) (Icc (0 : ℝ) T) := by + obtain ⟨A,hA,hAs⟩ := exists_periodic hT k hf hp + have he := extend_eq_of_representatives hT.le J (A 0) (fun t x => (hJ t x).trans (hA 0 t x).symm) + rw [he] + exact hAs 0 + +theorem supported_curve_smooth {T : ℝ} (hT : 0 < T) {k : ℕ} + {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) {K : Set Plane} (hK : IsCompact K) + (hs : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, f (t,x) = 0) + (J : C(Icc (0 : ℝ) T, Jet k)) + (hJ : ∀ t x, BoundedSpatialJets.function Plane ℝ k (J t) x = f (t.val,x)) : + ContDiffOn ℝ ∞ (extend hT.le J) (Icc (0 : ℝ) T) := by + obtain ⟨A,hA,hAs⟩ := exists_supported hT k hf hK hs + have he := extend_eq_of_representatives hT.le J (A 0) (fun t x => (hJ t x).trans (hA 0 t x).symm) + rw [he] + exact hAs 0 + +end CoefficientTimeJets +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactC1L2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactC1L2.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fffb54040c5e2ad5bf7a6162cbbe6d3a321cb60 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactC1L2.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactL2 + +namespace OAI + +/-! A smooth drift with common compact spatial support has the required +strong time regularity on every finite interval. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology ContDiff + +def planeTemporalDerivative (F : ℝ → Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + fderiv ℝ (Function.uncurry F) (t, x) (1, 0) + +theorem planeTemporalDerivative_smooth {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) : + ContDiff ℝ ∞ (Function.uncurry (planeTemporalDerivative F)) := + (hF.fderiv_right (m := ∞) (by simp)).clm_apply contDiff_const + +theorem planeTemporalDerivative_hasDerivAt {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) (t : ℝ) (x : Plane) : + HasDerivAt (fun r => F r x) (planeTemporalDerivative F t x) t := by + have hh := (hF.differentiable (by simp) (t,x)).hasFDerivAt.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + exact hh + +theorem planeTemporalDerivative_zero {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) {K : Set Plane} + (hz : ∀ t x, x ∉ K → F t x = 0) (t : ℝ) {x : Plane} (hx : x ∉ K) : + planeTemporalDerivative F t x = 0 := by + have he : (fun r => F r x) = fun _ => (0 : ℝ) := funext (fun r => hz r x hx) + have hd := planeTemporalDerivative_hasDerivAt hF t x + rw [he] at hd + exact (hasDerivAt_const t (0 : ℝ)).unique hd |>.symm + +theorem compact_family_c1L2 {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (T : ℝ) : + PlaneC1L2 F (planeTemporalDerivative F) (Icc 0 T) := by + let G := planeTemporalDerivative F + have hG : Continuous (Function.uncurry G) := (planeTemporalDerivative_smooth hF).continuous + have hzG : ∀ t x, x ∉ K → G t x = 0 := fun t _ hx => planeTemporalDerivative_zero hF hz t hx + obtain ⟨bF, hiF, hbF⟩ := compact_family_square_envelope hF.continuous hK hz T + obtain ⟨bG, hiG, hbG⟩ := compact_family_square_envelope hG hK hzG T + have hcF : SquareDistanceContinuousOn F (Icc 0 T) := + squareDistanceContinuousOn_of_envelope + (fun t _ => hF.continuous.comp (continuous_const.prodMk continuous_id)) + (fun x => (hF.continuous.comp (continuous_id.prodMk continuous_const)).continuousOn) hiF hbF + have hcG : SquareDistanceContinuousOn G (Icc 0 T) := + squareDistanceContinuousOn_of_envelope + (fun t _ => hG.comp (continuous_const.prodMk continuous_id)) + (fun x => (hG.comp (continuous_id.prodMk continuous_const)).continuousOn) hiG hbG + have hd : PlaneStrongDerivativeOn F G (Icc 0 T) := + strongDerivativeOn_of_envelope (convex_Icc 0 T) + (fun t _ => hF.continuous.comp (continuous_const.prodMk continuous_id)) + (fun t _ => hG.comp (continuous_const.prodMk continuous_id)) + (fun t _ x => (planeTemporalDerivative_hasDerivAt hF t x).hasDerivWithinAt) hiG hbG + exact planeC1L2_of_square_estimates + (fun t _ => compact_family_memLp hF.continuous hK hz t) + (fun t _ => compact_family_memLp hG hK hzG t) hcF hcG hd + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactH2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactH2.lean new file mode 100644 index 0000000000000000000000000000000000000000..070b05787e660ebc3cb7d44f11e1484832704993 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactH2.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactC1L2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSobolevL2 + +namespace OAI + +/-! The prescribed compact drift has continuous spatial jets in L2. +These are the H2 conditions for its smooth spatial slices. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory Set Filter +open scoped ContDiff Topology + +theorem planeSpatialD_joint_smooth {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) (j : Fin 2) : + ContDiff ℝ ∞ (Function.uncurry (fun t => spatialD j (F t))) := by + have hc := (hF.fderiv_right (m := ∞) (by simp)).clm_apply + (contDiff_const (c := ((0 : ℝ), basis j))) + convert hc using 1 + funext y + have hd := (hF.differentiable (by simp) y).hasFDerivAt.comp y.2 + ((hasFDerivAt_const (𝕜 := ℝ) y.1 y.2).prodMk (hasFDerivAt_id y.2)) + exact congrArg (fun L => L (basis j)) hd.fderiv + +theorem planeSpatialD_zero_off_compact {F : ℝ → Plane → ℝ} + {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (j : Fin 2) (t : ℝ) + {x : Plane} (hx : x ∉ K) : spatialD j (F t) x = 0 := by + have he : F t =ᶠ[𝓝 x] fun _ => (0 : ℝ) := by + filter_upwards [hK.isClosed.isOpen_compl.mem_nhds hx] with y hy + exact hz t y hy + unfold spatialD + rw [he.fderiv_eq] + simp only [fderiv_fun_const, Pi.zero_apply, zero_apply] + +theorem compact_family_cInH2 {F : ℝ → Plane → ℝ} + (hF : ContDiff ℝ ∞ (Function.uncurry F)) {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (T : ℝ) : + PlaneCInH2 F (Icc 0 T) := by + have hD (j : Fin 2) := planeSpatialD_joint_smooth hF j + have hzD (j : Fin 2) : ∀ t x, x ∉ K → spatialD j (F t) x = 0 := + fun t _ hx => planeSpatialD_zero_off_compact hK hz j t hx + refine ⟨compact_family_continuousL2 hF.continuous hK hz T, ?_, ?_⟩ + · intro j + exact compact_family_continuousL2 (hD j).continuous hK (hzD j) T + · intro j k + exact compact_family_continuousL2 (planeSpatialD_joint_smooth (hD k) j).continuous + hK (fun t _ hx => planeSpatialD_zero_off_compact hK (hzD k) j t hx) T + +theorem PlaneContinuousL2.congr_slices {F G : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneContinuousL2 F S) (hFG : ∀ t ∈ S, F t = G t) : PlaneContinuousL2 G S := by + obtain ⟨U, hU, hUF⟩ := hF + refine ⟨U, hU, ?_⟩ + intro t ht + rw [← hFG t ht] + exact hUF t ht + +theorem PlaneCInH2.congr_slices {F G : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneCInH2 F S) (hFG : ∀ t ∈ S, F t = G t) : PlaneCInH2 G S := by + exact ⟨hF.1.congr_slices hFG, + fun j => (hF.2.1 j).congr_slices (fun t ht => by rw [hFG t ht]), + fun j k => (hF.2.2 j k).congr_slices (fun t ht => by rw [hFG t ht])⟩ + +theorem PlaneC1L2.congr_slices {F G F' G' : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneC1L2 F G S) (hFF : ∀ t ∈ S, F t = F' t) + (hGG : ∀ t ∈ S, G t = G' t) : PlaneC1L2 F' G' S := by + obtain ⟨U, V, hU, hV, hUV⟩ := hF + refine ⟨U, V, hU, hV, ?_⟩ + intro t ht + obtain ⟨hu, hv, hd⟩ := hUV t ht + rw [hFF t ht] at hu + rw [hGG t ht] at hv + exact ⟨hu, hv, hd⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactIntegration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6131e42e7294fe671f8cced799349daca7692cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactIntegration.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarHamiltonian +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus + +namespace OAI + +/-! Integration by parts against a compact scalar test function on the +whole plane. The diffusing scalar itself need not have compact support. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff BigOperators + +theorem spatialD_mul {f g : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hg : ContDiff ℝ ∞ g) (j : Fin 2) (x : Plane) : + spatialD j (fun y => f y * g y) x = + f x * spatialD j g x + g x * spatialD j f x := by + unfold spatialD + have hd := (hf.differentiable (by simp) x).hasFDerivAt.mul + (hg.differentiable (by simp) x).hasFDerivAt + change HasFDerivAt (fun y => f y * g y) _ x at hd + rw [hd.fderiv] + rfl + +theorem integral_compact_spatialD {φ g : Plane → ℝ} + (hφ : ContDiff ℝ ∞ φ) (hg : ContDiff ℝ ∞ g) (hc : HasCompactSupport φ) (j : Fin 2) : + (∫ x, φ x * spatialD j g x) = -(∫ x, g x * spatialD j φ x) := by + have hi : Integrable (fun x => φ x * spatialD j g x) := + (hφ.mul (spatialD_smooth j hg)).continuous.integrable_of_hasCompactSupport hc.mul_right + have hj : Integrable (fun x => g x * spatialD j φ x) := + (hg.mul (spatialD_smooth j hφ)).continuous.integrable_of_hasCompactSupport + (hc.fderiv_apply ℝ (basis j)).mul_left + have hz := spatialD_integral_eq_zero (hφ.mul hg) hc.mul_right j + have he : spatialD j (fun x => φ x * g x) = + fun x => φ x * spatialD j g x + g x * spatialD j φ x := + funext (spatialD_mul hφ hg j) + rw [he, integral_add hi hj] at hz + linarith + +theorem integral_compact_second_spatialD {φ g : Plane → ℝ} + (hφ : ContDiff ℝ ∞ φ) (hg : ContDiff ℝ ∞ g) (hc : HasCompactSupport φ) (j : Fin 2) : + (∫ x, φ x * spatialD j (spatialD j g) x) = + ∫ x, g x * spatialD j (spatialD j φ) x := by + calc + _ = -(∫ x, spatialD j g x * spatialD j φ x) := + integral_compact_spatialD hφ (spatialD_smooth j hg) hc j + _ = -(∫ x, spatialD j φ x * spatialD j g x) := by + congr 1 + apply integral_congr_ae + filter_upwards [] with x + exact mul_comm _ _ + _ = -(-(∫ x, g x * spatialD j (spatialD j φ) x)) := by + rw [integral_compact_spatialD (spatialD_smooth j hφ) hg + (hc.fderiv_apply ℝ (basis j)) j] + _ = _ := neg_neg _ + +theorem integral_compact_laplacian {φ g : Plane → ℝ} + (hφ : ContDiff ℝ ∞ φ) (hg : ContDiff ℝ ∞ g) (hc : HasCompactSupport φ) : + (∫ x, φ x * scalarLaplacian g x) = ∫ x, g x * scalarLaplacian φ x := by + have hi (j : Fin 2) : Integrable (fun x => φ x * spatialD j (spatialD j g) x) := + (hφ.mul (spatialD_smooth j (spatialD_smooth j hg))).continuous.integrable_of_hasCompactSupport hc.mul_right + have hj (j : Fin 2) : Integrable (fun x => g x * spatialD j (spatialD j φ) x) := + (hg.mul (spatialD_smooth j (spatialD_smooth j hφ))).continuous.integrable_of_hasCompactSupport + ((hc.fderiv_apply ℝ (basis j)).fderiv_apply ℝ (basis j)).mul_left + simp only [scalarLaplacian, Finset.mul_sum] + rw [integral_finsetSum Finset.univ (fun j _ => hi j), integral_finsetSum Finset.univ (fun j _ => hj j)] + exact Finset.sum_congr rfl (fun j _ => integral_compact_second_spatialD hφ hg hc j) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactL2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..e22d672fac625ceb2a2c9fefec7880e01c480565 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactL2.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneL2Lift + +namespace OAI + +/-! A common compact spatial support gives finite-time L2 bounds and +continuity for each smooth prescribed drift component. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +theorem compact_family_square_envelope {F : ℝ → Plane → ℝ} + (hF : Continuous (Function.uncurry F)) {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (T : ℝ) : + ∃ b : Plane → ℝ, Integrable (fun x => b x ^ 2) ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x, |F t x| ≤ b x := by + classical + obtain ⟨B, hB⟩ := ((isCompact_Icc : IsCompact (Icc (0 : ℝ) T)).prod hK).bddAbove_image hF.norm.continuousOn + let C := max 0 B + let b : Plane → ℝ := K.indicator (fun _ => C) + refine ⟨b, ?_, ?_⟩ + · have hi : Integrable (K.indicator (fun _ : Plane => C ^ 2)) := + (integrableOn_const hK.measure_lt_top.ne).integrable_indicator hK.measurableSet + convert hi using 1 + funext x + by_cases hx : x ∈ K <;> simp [b, hx] + · intro t ht x + by_cases hx : x ∈ K + · have hb := hB ⟨(t, x), ⟨ht, hx⟩, rfl⟩ + change ‖F t x‖ ≤ B at hb + simpa only [b, indicator_of_mem hx, Real.norm_eq_abs] using hb.trans (le_max_right 0 B) + · simp [b, hx, hz t x hx] + +theorem compact_family_memLp {F : ℝ → Plane → ℝ} + (hF : Continuous (Function.uncurry F)) {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (t : ℝ) : MemLp (F t) 2 volume := by + have hc : Continuous (F t) := hF.comp (continuous_const.prodMk continuous_id) + exact hc.memLp_of_hasCompactSupport (HasCompactSupport.intro hK (hz t)) + +theorem compact_family_continuousL2 {F : ℝ → Plane → ℝ} + (hF : Continuous (Function.uncurry F)) {K : Set Plane} (hK : IsCompact K) + (hz : ∀ t x, x ∉ K → F t x = 0) (T : ℝ) : + ∃ U : ℝ → PlaneL2, ContinuousOn U (Icc 0 T) ∧ + ∀ t ∈ Icc (0 : ℝ) T, (fun x => U t x) =ᵐ[volume] F t := by + obtain ⟨b, hb, hbound⟩ := compact_family_square_envelope hF hK hz T + apply exists_planeL2_continuous_representation + (fun t _ => compact_family_memLp hF hK hz t) + exact squareDistanceContinuousOn_of_envelope + (fun t _ => hF.comp (continuous_const.prodMk continuous_id)) + (fun x => (hF.comp (continuous_id.prodMk continuous_const)).continuousOn) hb hbound + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactTransport.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0966411da7157cbdb44d835ef0e4d183c661469 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCompactTransport.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactIntegration + +namespace OAI + +/-! The weak transport-diffusion identity with compact spatial tests. +The scalar may have a noncompact diffusion tail. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff BigOperators + +theorem integral_compact_transport {φ g : Plane → ℝ} {a : Plane → Plane} + (hφ : ContDiff ℝ ∞ φ) (hg : ContDiff ℝ ∞ g) (ha : ContDiff ℝ ∞ a) + (hc : HasCompactSupport φ) (hdiv : ∀ x, divergence a x = 0) : + (∫ x, φ x * fderiv ℝ g x (a x)) = -(∫ x, g x * fderiv ℝ φ x (a x)) := by + have hi (j : Fin 2) : Integrable (fun x => (φ x * a x j) * spatialD j g x) := + ((hφ.mul ((contDiff_apply ℝ ℝ j).comp ha)).mul (spatialD_smooth j hg)).continuous.integrable_of_hasCompactSupport hc.mul_right.mul_right + have hj (j : Fin 2) : Integrable (fun x => g x * spatialD j (fun y => φ y * a y j) x) := + (hg.mul (spatialD_smooth j (hφ.mul ((contDiff_apply ℝ ℝ j).comp ha)))).continuous.integrable_of_hasCompactSupport + ((hc.mul_right).fderiv_apply ℝ (basis j)).mul_left + have he (x : Plane) : + (∑ j : Fin 2, g x * spatialD j (fun y => φ y * a y j) x) = + g x * fderiv ℝ φ x (a x) := by + have hz : spatialD 0 (fun y => a y 0) x + spatialD 1 (fun y => a y 1) x = 0 := by + simpa only [PlanarHamiltonian.divergence, Fin.sum_univ_two] using hdiv x + have ha0 : ContDiff ℝ ∞ (fun y : Plane => a y 0) := + (contDiff_apply ℝ ℝ 0).comp ha + have ha1 : ContDiff ℝ ∞ (fun y : Plane => a y 1) := + (contDiff_apply ℝ ℝ 1).comp ha + simp only [Fin.sum_univ_two] + rw [spatialD_mul hφ ha0, spatialD_mul hφ ha1, + scalar_directional_basis, Fin.sum_univ_two] + linear_combination (g x * φ x) * hz + + calc + _ = ∫ x, ∑ j : Fin 2, (φ x * a x j) * spatialD j g x := by + apply integral_congr_ae + filter_upwards [] with x + rw [scalar_directional_basis, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + _ = ∑ j : Fin 2, ∫ x, (φ x * a x j) * spatialD j g x := + integral_finsetSum Finset.univ (fun j _ => hi j) + _ = ∑ j : Fin 2, -(∫ x, g x * spatialD j (fun y => φ y * a y j) x) := by + apply Finset.sum_congr rfl + intro j _ + exact integral_compact_spatialD (hφ.mul ((contDiff_apply ℝ ℝ j).comp ha)) hg + hc.mul_right j + _ = -(∫ x, ∑ j : Fin 2, g x * spatialD j (fun y => φ y * a y j) x) := by + rw [integral_finsetSum Finset.univ (fun j _ => hj j), Finset.sum_neg_distrib] + _ = _ := by simp_rw [he] + +theorem integral_compact_generator {φ g : Plane → ℝ} {a : Plane → Plane} + (hφ : ContDiff ℝ ∞ φ) (hg : ContDiff ℝ ∞ g) (ha : ContDiff ℝ ∞ a) + (hc : HasCompactSupport φ) (hdiv : ∀ x, divergence a x = 0) (ν : ℝ) : + (∫ x, φ x * scalarGenerator ν a g x) = + ∫ x, g x * (ν * scalarLaplacian φ x + fderiv ℝ φ x (a x)) := by + have hl : ContDiff ℝ ∞ (scalarLaplacian g) := by + unfold scalarLaplacian + exact ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hg)) + have hd := (hg.fderiv_right (m := ∞) (by simp)).clm_apply ha + have hpl : Integrable (fun x => φ x * scalarLaplacian g x) := + (hφ.mul hl).continuous.integrable_of_hasCompactSupport hc.mul_right + have hpd : Integrable (fun x => φ x * fderiv ℝ g x (a x)) := + (hφ.mul hd).continuous.integrable_of_hasCompactSupport hc.mul_right + have hdl : Integrable (fun x => g x * scalarLaplacian φ x) := by + have hh : ContDiff ℝ ∞ (scalarLaplacian φ) := by + unfold scalarLaplacian + exact ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hφ)) + have hs : HasCompactSupport (scalarLaplacian φ) := by + have he : scalarLaplacian φ = (fun x => spatialD 0 (spatialD 0 φ) x + + spatialD 1 (spatialD 1 φ) x) := by + funext x + simp only [scalarLaplacian, Fin.sum_univ_two] + rw [he] + exact ((hc.fderiv_apply ℝ (basis 0)).fderiv_apply ℝ (basis 0)).add + ((hc.fderiv_apply ℝ (basis 1)).fderiv_apply ℝ (basis 1)) + exact (hg.mul hh).continuous.integrable_of_hasCompactSupport hs.mul_left + have hsupport : HasCompactSupport (fun x => fderiv ℝ φ x (a x)) := by + apply hc.mono' + intro x hx + by_contra hn + exact hx (by simp [fderiv_of_notMem_tsupport ℝ hn]) + have hdd : Integrable (fun x => g x * fderiv ℝ φ x (a x)) := + (hg.mul ((hφ.fderiv_right (m := ∞) (by simp)).clm_apply ha)).continuous.integrable_of_hasCompactSupport hsupport.mul_left + have he (x : Plane) : φ x * scalarGenerator ν a g x = + ν * (φ x * scalarLaplacian g x) - φ x * fderiv ℝ g x (a x) := by + unfold scalarGenerator + ring + have hf (x : Plane) : g x * (ν * scalarLaplacian φ x + fderiv ℝ φ x (a x)) = + ν * (g x * scalarLaplacian φ x) + g x * fderiv ℝ φ x (a x) := by ring + simp_rw [he, hf] + rw [integral_sub (hpl.const_mul ν) hpd, integral_add (hdl.const_mul ν) hdd, + integral_const_mul, integral_const_mul, + integral_compact_laplacian hφ hg hc, integral_compact_transport hφ hg ha hc hdiv] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffCoefficients.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..d44e7dd527b0793b09dab21c127a31b13661c835 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffCoefficients.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput + +namespace OAI + +/-! Sufficiently large compact tests are identically one on the common +support of the finite-time drift and source. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector Set +open scoped ContDiff + +theorem CompactPlaneCoefficients.cutoff_eventually_exact + {a : ℝ → Plane → Plane} {h : ℝ → Plane → ℝ} + (hc : CompactPlaneCoefficients a h) (T : ℝ) (hT : 0 ≤ T) : + ∃ N : ℕ, ∀ n ≥ N, ∀ t ∈ Icc 0 T, ∀ x, + fderiv ℝ (concentrationCutoff ((n : ℝ) + 1) 0) x (a t x) = 0 ∧ + concentrationCutoff ((n : ℝ) + 1) 0 x * h t x = h t x := by + obtain ⟨K, hK, hz⟩ := hc T hT + obtain ⟨B, hB⟩ := hK.bddAbove_image (continuous_norm.continuousOn : ContinuousOn (fun x : Plane => ‖x‖) K) + obtain ⟨N, hN⟩ := exists_nat_gt (3 * max 0 B) + refine ⟨N, ?_⟩ + intro n hn t ht x + by_cases hx : x ∈ K + · have hxn : ‖x‖ ≤ B := hB (mem_image_of_mem _ hx) + have hNn : (N : ℝ) ≤ n := by exact_mod_cast hn + have hr : (0 : ℝ) < (n : ℝ) + 1 := by positivity + have he := concentrationCutoff_one_near (c := (0 : Plane)) hr (x := x) (by + intro j + have hj : |x j| ≤ ‖x‖ := by simpa only [Real.norm_eq_abs] using norm_le_pi_norm x j + simp only [Pi.zero_apply, sub_zero] + linarith [le_max_right (0 : ℝ) B]) + have hd : fderiv ℝ (concentrationCutoff ((n : ℝ) + 1) 0) x = 0 := by + rw [he.fderiv_eq] + exact fderiv_const_apply (1 : ℝ) + exact ⟨by rw [hd]; rfl, by rw [he.eq_of_nhds, one_mul]⟩ + · obtain ⟨ha, hh⟩ := hz t ht x hx + rw [ha, hh, map_zero, mul_zero] + exact ⟨rfl, rfl⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffLimit.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..69714a0f80fee80a589b2c6eb7e9b8afeed92f33 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCutoffLimit.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMovingCutoff +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! Compact concentration tests tend to one on the plane, and recover the +mass of every integrable scalar by dominated convergence. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set MeasureTheory Filter +open scoped Topology + +theorem concentrationCutoff_eventually_one (c x : Plane) : + ∀ᶠ n : ℕ in atTop, concentrationCutoff ((n : ℝ) + 1) c x = 1 := by + obtain ⟨N, hN⟩ := exists_nat_gt (3 * ‖x - c‖) + filter_upwards [eventually_ge_atTop N] with n hn + apply concentrationCutoff_one (by positivity) + intro j + have hcoord : |x j - c j| ≤ ‖x - c‖ := by + simpa only [Pi.sub_apply, Real.norm_eq_abs] using norm_le_pi_norm (x - c) j + have hNn : (N : ℝ) ≤ n := by exact_mod_cast hn + nlinarith [norm_nonneg (x - c)] + +theorem concentrationCutoff_tendsto_one (c x : Plane) : + Tendsto (fun n : ℕ => concentrationCutoff ((n : ℝ) + 1) c x) atTop (𝓝 1) := by + have he : (fun n : ℕ => concentrationCutoff ((n : ℝ) + 1) c x) =ᶠ[atTop] + (fun _ => 1) := concentrationCutoff_eventually_one c x + exact tendsto_const_nhds.congr' he.symm + +theorem concentrationCutoff_integral_limit {f : Plane → ℝ} (hf : Integrable f) (c : Plane) : + Tendsto (fun n : ℕ => ∫ x, concentrationCutoff ((n : ℝ) + 1) c x * f x) + atTop (𝓝 (∫ x, f x)) := by + apply tendsto_integral_of_dominated_convergence (fun x => |f x|) + · intro n + exact (concentrationCutoff_smooth _ _).continuous.aestronglyMeasurable.mul + hf.aestronglyMeasurable + · simpa only [Real.norm_eq_abs] using hf.norm + · intro n + filter_upwards [] with x + rw [Real.norm_eq_abs, abs_mul, + abs_of_nonneg (concentrationCutoff_range ((n : ℝ) + 1) c x).1] + calc + _ ≤ 1 * |f x| := mul_le_mul_of_nonneg_right + (concentrationCutoff_range ((n : ℝ) + 1) c x).2 (abs_nonneg _) + _ = _ := one_mul _ + · filter_upwards [] with x + simpa only [one_mul] using (concentrationCutoff_tendsto_one c x).mul_const (f x) + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b812ec7b470f62f10ffc3fde30f543b020bc1ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderCalculus.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneInteriorCalculus + +namespace OAI + +/-! Spatial differentiation preserves smoothness on a closed time cylinder. +Only spatial directions are used at the two time endpoints. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +theorem planeWithinD_spatial {T : ℝ} {f : ℝ × Plane → ℝ} + (hf : ContDiffOn ℝ ∞ f (Icc 0 T ×ˢ univ)) + {t : ℝ} (ht : t ∈ Icc 0 T) (x : Plane) (j : Fin 2) : + fderivWithin ℝ f (Icc 0 T ×ˢ univ) (t, x) (0, basis j) = + spatialD j (fun y => f (t, y)) x := by + have hd := (hf.differentiableOn (by simp) (t, x) ⟨ht, mem_univ x⟩).hasFDerivWithinAt + have hi := (hasFDerivAt_const (𝕜 := ℝ) t x).prodMk (hasFDerivAt_id (𝕜 := ℝ) x) + have hc := hd.comp_hasFDerivAt x hi + (Filter.Eventually.of_forall (fun y => ⟨ht, mem_univ y⟩)) + change _ = fderiv ℝ (fun y => f (t, y)) x (basis j) + have hce := hc.fderiv + change fderiv ℝ (fun y => f (t, y)) x = _ at hce + rw [hce] + simp + +theorem spatialD_contDiffOn_cylinder {T : ℝ} (hT : 0 < T) + {f : ℝ × Plane → ℝ} (hf : ContDiffOn ℝ ∞ f (Icc 0 T ×ˢ univ)) + (j : Fin 2) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => spatialD j (fun y => f (p.1, y)) p.2) + (Icc 0 T ×ˢ univ) := by + have hS : UniqueDiffOn ℝ (Icc 0 T ×ˢ (univ : Set Plane)) := + (uniqueDiffOn_Icc hT).prod uniqueDiffOn_univ + have hd : ContDiffOn ℝ ∞ + (fun p => fderivWithin ℝ f (Icc 0 T ×ˢ univ) p (0, basis j)) + (Icc 0 T ×ˢ univ) := + (hf.fderivWithin hS (by simp)).clm_apply contDiffOn_const + apply hd.congr + rintro ⟨t, x⟩ hp + exact (planeWithinD_spatial hf hp.1 x j).symm + +theorem PlaneScalarSolution.cylinder_spatialD {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (j : Fin 2) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => spatialD j (w p.1) p.2) + (Icc 0 T ×ˢ univ) := by + simpa only [Function.uncurry_apply_pair] using spatialD_contDiffOn_cylinder hT hw.smooth j + +theorem PlaneScalarSolution.cylinder_second_spatialD {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (j k : Fin 2) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => spatialD j (spatialD k (w p.1)) p.2) + (Icc 0 T ×ˢ univ) := + spatialD_contDiffOn_cylinder hT (hw.cylinder_spatialD hT k) j + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderComponents.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderComponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..342b8ed85720ae51f198f367feae8d6e65afc941 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderComponents.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderLiftH2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneClassicalRegularity + +namespace OAI + +/-! Component identities needed to transfer the planar L2 and strong time +derivative estimates to the three-dimensional classical solution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem triangularVelocity_horizontal_component (a : ℝ → Plane → Plane) + (w : ℝ → Plane → ℝ) (t : ℝ) (x : Space) (j : Fin 2) : + triangularVelocity a w (t, x) j.castSucc = a t (horizontalLinear x) j := by + fin_cases j <;> simp [triangularVelocity, triangularLift, planeInclusion, basis] + +theorem triangularVelocity_vertically_periodic (a : ℝ → Plane → Plane) + (w : ℝ → Plane → ℝ) (t : ℝ) : + VerticallyPeriodic (fun x => triangularVelocity a w (t, x)) := by + intro x n + simp only [triangularVelocity, triangularLift, map_add, map_smul, + horizontalLinear_basis_two, smul_zero, add_zero] + +theorem planeTemporalDerivative_component {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (t : ℝ) (x : Plane) (j : Fin 2) : + planeTemporalDerivative (fun s y => a s y j) t x = deriv (fun s => a s x) t j := by + have hscalar := planeTemporalDerivative_hasDerivAt (F := fun s y => a s y j) + ((contDiff_apply ℝ ℝ j).comp ha) t x + have hvector : HasDerivAt (fun s => a s x) (deriv (fun s => a s x) t) t := + ((ha.comp (contDiff_id.prodMk contDiff_const)).differentiable + (by simp) t).hasDerivAt + have hcoord := (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).hasFDerivAt.comp_hasDerivAt t hvector + exact hscalar.unique hcoord + +theorem GlobalPlaneScalarSolution.initialTimeDerivative_horizontal {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) + (x : Space) (j : Fin 2) : + ShearFlows.initialTimeDerivative (triangularVelocity a w) t x j.castSucc = + planeTemporalDerivative (fun s y => a s y j) t (horizontalLinear x) := by + rw [hw.initialTimeDerivative ha ht, planeTemporalDerivative_component ha] + fin_cases j <;> simp [triangularLift, planeInclusion, basis] + +theorem GlobalPlaneScalarSolution.initialTimeDerivative_vertical {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + ShearFlows.initialTimeDerivative (triangularVelocity a w) t x 2 = + planeTimeDerivative ν a h w t (horizontalLinear x) := by + rw [hw.initialTimeDerivative ha ht] + simp [triangularLift, planeInclusion, basis, planeTimeDerivative] + +theorem CylinderContinuousL2.mono {F : ℝ → Plane × ℝ → ℝ} {S T : Set ℝ} + (hF : CylinderContinuousL2 F T) (hST : S ⊆ T) : CylinderContinuousL2 F S := by + obtain ⟨U, hU, hUF⟩ := hF + exact ⟨U, hU.mono hST, fun t ht => hUF t (hST ht)⟩ + +theorem CylinderC1L2.mono {F G : ℝ → Plane × ℝ → ℝ} {S T : Set ℝ} + (hF : CylinderC1L2 F G T) (hST : S ⊆ T) : CylinderC1L2 F G S := by + obtain ⟨U, V, hU, hV, hUV⟩ := hF + refine ⟨U, V, hU.mono hST, hV.mono hST, ?_⟩ + intro t ht + obtain ⟨hu, hv, hd⟩ := hUV t (hST ht) + exact ⟨hu, hv, hd.mono hST⟩ + +theorem CylinderCInH2.mono {F : ℝ → Space → ℝ} {S T : Set ℝ} + (hF : CylinderCInH2 F T) (hST : S ⊆ T) : CylinderCInH2 F S := + ⟨hF.1.mono hST, fun j => (hF.2.1 j).mono hST, + fun j k => (hF.2.2 j k).mono hST⟩ + +theorem CylinderCInH2.congr_slices {F G : ℝ → Space → ℝ} {S : Set ℝ} + (hF : CylinderCInH2 F S) (hFG : ∀ t ∈ S, F t = G t) : CylinderCInH2 G S := + ⟨hF.1.congr_slices (fun t ht => by rw [hFG t ht]), + fun j => (hF.2.1 j).congr_slices (fun t ht => by rw [hFG t ht]), + fun j k => (hF.2.2 j k).congr_slices (fun t ht => by rw [hFG t ht])⟩ + +theorem cylinderCInH1_zero (S : Set ℝ) : CylinderCInH1 (fun _ _ => 0) S := by + refine ⟨cylinderContinuousL2_zero S, ?_⟩ + intro j + have hz : scalarSpatialD j (fun _ : Space => (0 : ℝ)) = fun _ => 0 := by + funext x + simp [scalarSpatialD] + change CylinderContinuousL2 (fun t => cylinderPullback (scalarSpatialD j (fun _ => 0))) S + rw [hz] + exact cylinderContinuousL2_zero S + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderL2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..5574875181fb341a36231672c3af1da3b39068ac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderL2.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSobolevL2 +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.CylinderMeasure + +namespace OAI + +/-! Lifting planar L2 representatives to one vertical period. The lift is +an isometry because the vertical interval has measure one. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set + +def planeCylinderLift : PlaneL2 →L[ℝ] CylinderL2 := + (Lp.compMeasurePreservingₗᵢ ℝ Prod.fst + (measurePreserving_fst (μ := (volume : Measure Plane)) + (ν := verticalPeriodMeasure))).toContinuousLinearMap + +theorem planeCylinderLift_ae (u : PlaneL2) {f : Plane → ℝ} + (hf : (fun x => u x) =ᵐ[volume] f) : + (fun x => planeCylinderLift u x) =ᵐ[cylinderMeasure] fun x => f x.1 := by + have hp := measurePreserving_fst (μ := (volume : Measure Plane)) + (ν := verticalPeriodMeasure) + exact (Lp.coeFn_compMeasurePreserving u hp).trans + (hp.quasiMeasurePreserving.ae_eq_comp hf) + +theorem planeCylinderLift_norm (u : PlaneL2) : ‖planeCylinderLift u‖ = ‖u‖ := + Lp.norm_compMeasurePreserving u _ + +theorem PlaneContinuousL2.cylinder {F : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneContinuousL2 F S) : + CylinderContinuousL2 (fun t x => F t x.1) S := by + obtain ⟨U, hU, hUF⟩ := hF + exact ⟨fun t => planeCylinderLift (U t), + planeCylinderLift.continuous.comp_continuousOn hU, + fun t ht => planeCylinderLift_ae (U t) (hUF t ht)⟩ + +theorem PlaneC1L2.cylinder {F G : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : PlaneC1L2 F G S) : + CylinderC1L2 (fun t x => F t x.1) (fun t x => G t x.1) S := by + obtain ⟨U, V, hU, hV, hUV⟩ := hF + refine ⟨fun t => planeCylinderLift (U t), fun t => planeCylinderLift (V t), + planeCylinderLift.continuous.comp_continuousOn hU, + planeCylinderLift.continuous.comp_continuousOn hV, ?_⟩ + intro t ht + obtain ⟨hu, hv, hd⟩ := hUV t ht + refine ⟨planeCylinderLift_ae (U t) hu, planeCylinderLift_ae (V t) hv, ?_⟩ + exact planeCylinderLift.hasFDerivAt.comp_hasDerivWithinAt t hd + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderSolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..98821f024204a45c79076ed4ef40c289cd420c58 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneCylinderSolution.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCylinderComponents +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneFluidBounds + +namespace OAI + +/-! The scalar existence input supplies a full classical cylinder solution +once the prescribed horizontal drift has strong L2 regularity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem GlobalPlaneScalarSolution.cylinder_h2 (hE : PlaneScalarExistence) + {ν : ℝ} (hν : 0 < ν) {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t, 0 ≤ t → ∀ x, 0 ≤ h t x) + (haL2 : ∀ T, 0 ≤ T → ∀ j, PlaneCInH2 (fun t x => a t x j) (Icc 0 T)) + (T : ℝ) (hT : 0 ≤ T) (i : Fin 3) : + CylinderCInH2 (fun t x => triangularVelocity a w (t, x) i) (Icc 0 T) := by + have hinc : Icc (0 : ℝ) T ⊆ Icc 0 (T+1) := fun _ ht => ⟨ht.1, by linarith [ht.2]⟩ + refine Fin.lastCases ?_ (fun j => ?_) i + · have hs := ((hw (T+1) (by linarith)).cInH2 hE (by linarith) hν ha hh hc + (fun t ht x => hpos t ht.1 x)).scalarPlaneLift + (fun t ht => (hw (T+1) (by linarith)).slice_smooth ht) + apply (hs.mono hinc).congr_slices + intro t _ + funext x + exact (triangularVelocity_third a w t x).symm + · have hs := (haL2 T hT j).scalarPlaneLift (fun t _ => + ((contDiff_apply ℝ ℝ j).comp ha).comp (contDiff_const.prodMk contDiff_id)) + apply hs.congr_slices + intro t _ + funext x + exact (triangularVelocity_horizontal_component a w t x j).symm + +theorem GlobalPlaneScalarSolution.cylinder_c1 (hE : PlaneScalarExistence) + {ν : ℝ} (hν : 0 < ν) {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t, 0 ≤ t → ∀ x, 0 ≤ h t x) + (haL2 : ∀ T, 0 ≤ T → ∀ j, PlaneC1L2 (fun t x => a t x j) + (planeTemporalDerivative (fun t x => a t x j)) (Icc 0 T)) + (T : ℝ) (hT : 0 ≤ T) (i : Fin 3) : + CylinderC1L2 + (fun t => cylinderPullback (fun x => triangularVelocity a w (t, x) i)) + (fun t => cylinderPullback (fun x => ShearFlows.initialTimeDerivative (triangularVelocity a w) t x i)) + (Icc 0 T) := by + have hinc : Icc (0 : ℝ) T ⊆ Icc 0 (T+1) := fun _ ht => ⟨ht.1, by linarith [ht.2]⟩ + refine Fin.lastCases ?_ (fun j => ?_) i + · have hs := ((hw (T+1) (by linarith)).c1L2 hE (by linarith) hν ha hh hc + (fun t ht x => hpos t ht.1 x)).cylinder + apply (hs.mono hinc).congr_slices + · intro t _ + funext y + change w t y.1 = triangularVelocity a w (t, atHeight y.1 y.2) 2 + simp only [triangularVelocity_third, horizontalLinear_eq, atHeight_horizontal] + · intro t ht + funext y + change planeTimeDerivative ν a h w t y.1 = + ShearFlows.initialTimeDerivative (triangularVelocity a w) t (atHeight y.1 y.2) 2 + simp only [hw.initialTimeDerivative_vertical ha ht.1, horizontalLinear_eq, + atHeight_horizontal] + · apply (haL2 T hT j).cylinder.congr_slices + · intro t _ + funext y + simp only [cylinderPullback, triangularVelocity_horizontal_component, + horizontalLinear_eq, atHeight_horizontal] + · intro t ht + funext y + simp only [cylinderPullback, hw.initialTimeDerivative_horizontal ha ht.1, + horizontalLinear_eq, atHeight_horizontal] + +theorem GlobalPlaneScalarSolution.cylinder_solution (hE : PlaneScalarExistence) + {ν : ℝ} (hν : 0 < ν) {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t, 0 ≤ t → ∀ x, 0 ≤ h t x) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (ha0 : ∀ x, a 0 x = 0) + (haL2 : ∀ T, 0 ≤ T → ∀ j, + PlaneCInH2 (fun t x => a t x j) (Icc 0 T) ∧ + PlaneC1L2 (fun t x => a t x j) (planeTemporalDerivative (fun t x => a t x j)) (Icc 0 T)) : + IsCylinderClassicalSolution ν (triangularForce ν a h) + (triangularVelocity a w) (fun _ => 0) where + regularity := hw.classicalRegularity ha hh + periodic_u t _ := triangularVelocity_vertically_periodic a w t + periodic_p _ _ _ _ := rfl + initial := triangularVelocity_plane_initial hw ha0 + divergence_zero t ht x := triangularVelocity_plane_divergence hw ha hdiv ht x + equation t ht x := by + simp only [gradient_constant, neg_zero, zero_add] + exact triangularVelocity_plane_equation hw ha ht x + velocity_h2 := hw.cylinder_h2 hE hν ha hh hc hpos (fun T hT j => (haL2 T hT j).1) + velocity_c1 := hw.cylinder_c1 hE hν ha hh hc hpos (fun T hT j => (haL2 T hT j).2) + pressure_h1 T _ := cylinderCInH1_zero (Icc 0 T) + bounded T hT := (hw T hT).velocity_gradient_bound hT ha hc + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneDerivativeTail.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneDerivativeTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..192dfa1b04ca5b2ebe081a5d38c7f7dbfee9e09c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneDerivativeTail.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneLineDerivatives +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTailShift + +namespace OAI + +/-! The scalar tail and a third-derivative bound force +second directional derivatives to have an integrable square envelope. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory +open scoped ContDiff + +def derivativeTail (x : Plane) : ℝ := (planeTailProfile x) ^ (1 / 3 : ℝ) + +theorem derivativeTail_pos (x : Plane) : 0 < derivativeTail x := + Real.rpow_pos_of_pos (planeTailProfile_pos x) _ + +theorem derivativeTail_le_one (x : Plane) : derivativeTail x ≤ 1 := + Real.rpow_le_one (planeTailProfile_pos x).le (planeTailProfile_le_one x) (by norm_num) + +theorem derivativeTail_cube (x : Plane) : derivativeTail x ^ 3 = planeTailProfile x := by + unfold derivativeTail + rw [← Real.rpow_natCast, ← Real.rpow_mul (planeTailProfile_pos x).le] + norm_num + +theorem derivativeTail_continuous : Continuous derivativeTail := + planeTailProfile_smooth.continuous.rpow_const (fun x => Or.inl (planeTailProfile_pos x).ne') + +theorem derivativeTail_square_integrable : Integrable (fun x => derivativeTail x ^ 2) := by + have hi : Integrable (fun x : Plane => (1 + ‖x‖ ^ 2) ^ (-(8 / 3 : ℝ) / 2)) := + integrable_rpow_neg_one_add_norm_sq (by simp [Plane]; norm_num) + have he (x : Plane) : derivativeTail x ^ 2 = planeBarrierSquare x ^ (-(4 / 3 : ℝ)) := by + have hp : planeTailProfile x = planeBarrierSquare x ^ (-(2 : ℝ)) := by + rw [Real.rpow_neg_eq_inv_rpow, Real.rpow_two] + rfl + unfold derivativeTail + rw [hp, ← Real.rpow_natCast, + ← Real.rpow_mul (Real.rpow_nonneg (planeBarrierSquare_pos x).le _), + ← Real.rpow_mul (planeBarrierSquare_pos x).le] + norm_num + apply hi.mono' (derivativeTail_continuous.pow 2).aestronglyMeasurable + filter_upwards [] with x + change ‖derivativeTail x ^ 2‖ ≤ _ + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _), he] + have hpow := Real.rpow_le_rpow_of_nonpos + (by positivity : (0 : ℝ) < 1 + ‖x‖ ^ 2) + (planeBarrierSquare_norm_sq x) (by norm_num : -(4 / 3 : ℝ) ≤ 0) + convert hpow using 1 + norm_num + +theorem scalar_second_directional_tail {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 3 f y‖ ≤ M) + (x v : Plane) (hv : ‖v‖ ≤ 1) : + |iteratedFDeriv ℝ 2 f x (fun _ => v)| ≤ (100 * B + M) * derivativeTail x := by + let h := derivativeTail x + have hh : 0 < h := derivativeTail_pos x + have hh1 : h ≤ 1 := derivativeTail_le_one x + have hline (t : ℝ) : |iteratedDeriv 3 (scalarLine f x v) t| ≤ M := by + have ht := scalarLine_iteratedDeriv_bound hf x v 3 hfM t + have hp : ‖v‖ ^ 3 ≤ 1 := pow_le_one₀ (norm_nonneg v) hv + exact ht.trans (by nlinarith) + have hb (t : ℝ) (ht : |t| ≤ 1) : + |scalarLine f x v t| ≤ 25 * B * planeTailProfile x := by + have hs := mul_le_mul_of_nonneg_left (planeTailProfile_line_le x v ht hv) hB + exact (hfB _).trans (by nlinarith [hs]) + have he := second_derivative_three_point_bound (scalarLine_smooth hf x v) hh hM hline + (hb 0 (by norm_num)) (hb h (by simpa only [abs_of_pos hh] using hh1)) + (hb (-h) (by simpa only [abs_neg, abs_of_pos hh] using hh1)) + have hc : h ^ 3 = planeTailProfile x := derivativeTail_cube x + have hd : iteratedDeriv 2 (scalarLine f x v) 0 = + iteratedFDeriv ℝ 2 f x (fun _ => v) := by + simpa only [zero_smul, add_zero] using scalarLine_iteratedDeriv hf x v 2 0 + rw [hd] at he + apply (mul_le_mul_iff_left₀ (sq_pos_of_pos hh)).mp + calc + _ ≤ 4 * (25 * B * planeTailProfile x) + M * h ^ 3 := he + _ = ((100 * B + M) * derivativeTail x) * h ^ 2 := by rw [← hc]; dsimp [h]; ring + + +theorem scalar_first_directional_tail {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 2 f y‖ ≤ M) + (x v : Plane) (hv : ‖v‖ ≤ 1) : + |iteratedFDeriv ℝ 1 f x (fun _ => v)| ≤ (50 * B + M) * derivativeTail x := by + let h := derivativeTail x + have hh : 0 < h := derivativeTail_pos x + have hh1 : h ≤ 1 := derivativeTail_le_one x + have hline (t : ℝ) : |iteratedDeriv 2 (scalarLine f x v) t| ≤ M := by + have ht := scalarLine_iteratedDeriv_bound hf x v 2 hfM t + have hp : ‖v‖ ^ 2 ≤ 1 := pow_le_one₀ (norm_nonneg v) hv + exact ht.trans (by nlinarith) + have hb (t : ℝ) (ht : |t| ≤ 1) : + |scalarLine f x v t| ≤ 25 * B * planeTailProfile x := by + have hs := mul_le_mul_of_nonneg_left (planeTailProfile_line_le x v ht hv) hB + exact (hfB _).trans (by nlinarith [hs]) + have he := first_derivative_two_point_bound (scalarLine_smooth hf x v) hh hM hline + (hb 0 (by norm_num)) (hb h (by simpa only [abs_of_pos hh] using hh1)) + have hc : h ^ 3 = planeTailProfile x := derivativeTail_cube x + have hd : iteratedDeriv 1 (scalarLine f x v) 0 = + iteratedFDeriv ℝ 1 f x (fun _ => v) := by + simpa only [zero_smul, add_zero] using scalarLine_iteratedDeriv hf x v 1 0 + rw [hd] at he + have hp : h ^ 3 ≤ h ^ 2 := by + nlinarith [mul_nonneg (sq_nonneg h) (sub_nonneg.mpr hh1)] + apply (mul_le_mul_iff_left₀ hh).mp + calc + _ ≤ 2 * (25 * B * planeTailProfile x) + M * h ^ 2 := he + _ ≤ (50 * B + M) * h ^ 2 := by + rw [← hc] + nlinarith [mul_le_mul_of_nonneg_left hp (show 0 ≤ 50 * B by positivity)] + _ = ((50 * B + M) * derivativeTail x) * h := by dsimp [h]; ring + + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneEnergyLimit.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneEnergyLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5aa84f831c0571e6e2952c40822e1a64bd9031b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneEnergyLimit.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.ClassicalUniqueness +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCutoffLimit + +namespace OAI + +/-! The limiting step in the noncompact energy argument. A vanishing +boundary error is allowed in each compactly localized energy estimate. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped Topology + +theorem localized_energy_bound {E : ℝ → ℝ} {T C ε : ℝ} (hT : 0 ≤ T) + (hε : 0 ≤ ε) (hc : ContinuousOn E (Icc 0 T)) (h0 : E 0 = 0) + (hn : ∀ t ∈ Icc 0 T, 0 ≤ E t) + (hd : ∀ t ∈ Ioo 0 T, ∃ e, HasDerivAt E e t ∧ e ≤ C * E t + ε) : + E T ≤ ε * Real.exp ((|C| + 1) * T) := by + let A := |C| + 1 + let W : ℝ → ℝ := fun t => Real.exp (-A * t) * (E t + ε) + have hWc : ContinuousOn W (Icc 0 T) := + (Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn.mul + (hc.add continuousOn_const) + have hWd (t : ℝ) (ht : t ∈ Ioo 0 T) : + ∃ e, HasDerivAt W e t ∧ e ≤ 0 := by + obtain ⟨e, he, heB⟩ := hd t ht + have hn' := hn t ⟨ht.1.le, ht.2.le⟩ + have hCA : C ≤ A := by dsimp [A]; linarith [le_abs_self C] + have hA : 1 ≤ A := by dsimp [A]; linarith [abs_nonneg C] + have heA : e ≤ A * (E t + ε) := by + have h1 := mul_le_mul_of_nonneg_right hCA hn' + have h2 := mul_le_mul_of_nonneg_right hA hε + nlinarith + refine ⟨_, (((hasDerivAt_id t).const_mul (-A)).exp).mul (he.add_const ε), ?_⟩ + simp only [id_eq, mul_one] + nlinarith [mul_nonneg (Real.exp_pos (-A * t)).le (sub_nonneg.mpr heA)] + have hant : AntitoneOn W (Icc 0 T) := by + apply antitoneOn_of_deriv_nonpos (convex_Icc _ _) hWc + · intro t ht + obtain ⟨e, he, _⟩ := hWd t (by simpa only [interior_Icc] using ht) + exact he.differentiableAt.differentiableWithinAt + · intro t ht + obtain ⟨e, he, he0⟩ := hWd t (by simpa only [interior_Icc] using ht) + simpa only [he.deriv] using he0 + have hle := hant ⟨le_rfl, hT⟩ ⟨hT, le_rfl⟩ hT + have hw : Real.exp (-A * T) * (E T + ε) ≤ ε := by + simpa only [W, h0, mul_zero, Real.exp_zero, zero_add, one_mul] using hle + have hh := mul_le_mul_of_nonneg_left hw (Real.exp_pos (A * T)).le + have hexp : Real.exp (A * T) * Real.exp (-A * T) = 1 := by + rw [← Real.exp_add, show A * T + -A * T = 0 by ring, Real.exp_zero] + rw [← mul_assoc, hexp, one_mul] at hh + dsimp only [A] at hh + nlinarith + +theorem zero_of_localized_energy_limit {E : ℕ → ℝ → ℝ} {ε : ℕ → ℝ} + {T C limit : ℝ} (hT : 0 ≤ T) (hε : ∀ n, 0 ≤ ε n) + (hεlim : Tendsto ε atTop (𝓝 0)) + (hc : ∀ n, ContinuousOn (E n) (Icc 0 T)) (h0 : ∀ n, E n 0 = 0) + (hn : ∀ n t, t ∈ Icc 0 T → 0 ≤ E n t) + (hd : ∀ n t, t ∈ Ioo 0 T → + ∃ e, HasDerivAt (E n) e t ∧ e ≤ C * E n t + ε n) + (hlim : Tendsto (fun n => E n T) atTop (𝓝 limit)) : limit = 0 := by + have hnonneg : 0 ≤ limit := le_of_tendsto_of_tendsto + tendsto_const_nhds hlim (Filter.Eventually.of_forall (fun n => hn n T ⟨hT, le_rfl⟩)) + have hupper : limit ≤ 0 := by + have hlim' := hεlim.mul_const (Real.exp ((|C| + 1) * T)) + simp only [zero_mul] at hlim' + exact le_of_tendsto_of_tendsto' hlim hlim' (fun n => + localized_energy_bound hT (hε n) (hc n) (h0 n) (hn n) (hd n)) + exact le_antisymm hupper hnonneg + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFiniteDivergence.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFiniteDivergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..4472c5db2dd8540a18c6795f4d27e5fffb0240be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFiniteDivergence.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPulse + +namespace OAI + +/-! Divergence commutes with the finite arrays used by the prescribed +whole-plane drift. -/ + +noncomputable section +namespace ForcedComputation.PlanarHamiltonian +open ShearFlows +open scoped ContDiff BigOperators + +theorem divergence_finite_sum {ι : Type*} (s : Finset ι) (V : ι → Plane → Plane) + (hV : ∀ i ∈ s, ContDiff ℝ ∞ (V i)) (x : Plane) : + divergence (fun y => ∑ i ∈ s, V i y) x = ∑ i ∈ s, divergence (V i) x := by + have he (j : Fin 2) : spatialD j (fun y => (∑ i ∈ s, V i y) j) x = + ∑ i ∈ s, spatialD j (fun y => V i y j) x := by + have hf : (fun y : Plane => (∑ i ∈ s, V i y) j) = + (fun y => ∑ i ∈ s, V i y j) := by + funext y + simp only [Finset.sum_apply] + rw [hf] + unfold spatialD + have hVi (i : ι) (hi : i ∈ s) : DifferentiableAt ℝ (fun y => V i y j) x := + ((contDiff_apply ℝ ℝ j).comp (hV i hi)).differentiable (by simp) x + rw [fderiv_fun_sum hVi] + simp only [sum_apply] + unfold divergence + simp_rw [he] + exact Finset.sum_comm + +end ForcedComputation.PlanarHamiltonian + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluid.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluid.lean new file mode 100644 index 0000000000000000000000000000000000000000..400804a00b6c2633df6cb48232fbb99396bfd020 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluid.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarGlobal +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularForce +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingCutoffObservation + +namespace OAI + +/-! The whole-plane scalar produces an actual Navier–Stokes velocity. +The force is prescribed from the drift and source, before solving for w. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter MeasureTheory +open scoped ContDiff Topology + +theorem GlobalPlaneScalarSolution.hasDerivWithinAt {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) {t : ℝ} (ht : 0 ≤ t) (x : Plane) : + HasDerivWithinAt (fun s => w s x) + (scalarGenerator ν (a t) (w t) x + h t x) (Ici 0) t := by + have he := (hw (t + 1) (by linarith)).equation t ⟨ht, by linarith⟩ x + apply he.mono_of_mem_nhdsWithin + filter_upwards [self_mem_nhdsWithin, + (show Iic (t + 1) ∈ 𝓝[Ici (0 : ℝ)] t from + nhdsWithin_le_nhds (Iic_mem_nhds (by linarith : t < t + 1)))] with s hs hs' + exact ⟨hs, hs'⟩ + +theorem GlobalPlaneScalarSolution.initialTimeDerivative {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + initialTimeDerivative (triangularVelocity a w) t x = + triangularLift (fun z => deriv (fun s => a s z) t) + (fun z => scalarGenerator ν (a t) (w t) z + h t z) x := by + have hda : HasDerivAt (fun s => a s (horizontalLinear x)) + (deriv (fun s => a s (horizontalLinear x)) t) t := + ((ha.comp (contDiff_id.prodMk contDiff_const)).differentiable (by simp) t).hasDerivAt + have hdw := hw.hasDerivWithinAt ht (horizontalLinear x) + have hdu := (planeInclusion.hasFDerivAt.comp_hasDerivWithinAt t hda.hasDerivWithinAt).add + (hdw.smul_const (basis 2)) + change HasDerivWithinAt (fun s => triangularVelocity a w (s, x)) _ (Ici 0) t at hdu + exact hdu.derivWithin (uniqueDiffOn_Ici (0 : ℝ) t ht) + +theorem triangularVelocity_plane_equation {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) {t : ℝ} (ht : 0 ≤ t) (x : Space) : + initialTimeDerivative (triangularVelocity a w) t x + + advection (fun y => triangularVelocity a w (t, y)) x = + ν • laplacian (fun y => triangularVelocity a w (t, y)) x + triangularForce ν a h (t, x) := by + have has : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hws : ContDiff ℝ ∞ (w t) := (hw t ht).slice_smooth ⟨ht, le_rfl⟩ + rw [hw.initialTimeDerivative ha ht, + show (fun y => triangularVelocity a w (t, y)) = triangularLift (a t) (w t) from rfl, + triangularLift_advection has hws, triangularLift_laplacian has hws] + simp only [triangularLift, triangularForce, planarResidual, scalarGenerator, + map_add, map_sub, map_smul, smul_add, smul_smul] + module + +theorem triangularVelocity_plane_divergence {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + {t : ℝ} (ht : 0 ≤ t) (x : Space) : + divergence (fun y => triangularVelocity a w (t, y)) x = 0 := by + have has : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + rw [show (fun y => triangularVelocity a w (t, y)) = triangularLift (a t) (w t) from rfl, + triangularLift_divergence has + ((hw t ht).slice_smooth ⟨ht, le_rfl⟩)] + exact hdiv t _ + +theorem triangularVelocity_plane_initial {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalPlaneScalarSolution ν a h w) (ha : ∀ x, a 0 x = 0) (x : Space) : + triangularVelocity a w (0, x) = 0 := by + have hz := congrFun (hw 0 le_rfl).initial (horizontalLinear x) + simp [triangularVelocity, triangularLift, ha, hz] + +theorem triangularVelocity_third (a : ℝ → Plane → Plane) (w : ℝ → Plane → ℝ) + (t : ℝ) (x : Space) : triangularVelocity a w (t, x) 2 = w t (horizontalLinear x) := by + simp [triangularVelocity, triangularLift, planeInclusion, basis] + +/-- Normalized integration over the period-one coordinate gives exactly + the scalar half-plane observation used in the construction. -/ +theorem triangularVelocity_halfPlane_integral (a : ℝ → Plane → Plane) + (w : ℝ → Plane → ℝ) (t : ℝ) : + (∫ X in ExpandingDetector.upperHalfPlane, ∫ z in Icc (0 : ℝ) 1, + triangularVelocity a w (t, atHeight X z) 2) = + ∫ X in ExpandingDetector.upperHalfPlane, w t X := by + simp only [triangularVelocity_third, horizontalLinear_eq, atHeight_horizontal, + setIntegral_const, smul_eq_mul] + norm_num [Measure.real, Real.volume_Icc] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluidBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluidBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6de97d92387285bd23dc732d6f7a40ba5cb420c2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneFluidBounds.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarComparison + +namespace OAI + +/-! Finite-time velocity and gradient bounds required by the whole-plane +comparison class. Compact support is needed only for the prescribed drift. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +theorem CompactPlaneCoefficients.drift_derivative_bound {a : ℝ → Plane → Plane} + {h : ℝ → Plane → ℝ} (hc : CompactPlaneCoefficients a h) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (T : ℝ) (hT : 0 ≤ T) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc 0 T, ∀ x, ‖fderiv ℝ (a t) x‖ ≤ B := by + have hs : ContDiff ℝ ∞ (fun y : ℝ × Plane => fderiv ℝ (a y.1) y.2) := by + have hp : ContDiff ℝ ∞ + (Function.uncurry (fun y : ℝ × Plane => fun x : Plane => a y.1 x)) := + ha.comp (contDiff_fst.fst.prodMk contDiff_snd) + exact hp.fderiv contDiff_snd (by simp) + obtain ⟨K, hK, hz⟩ := hc T hT + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hK).bddAbove_image hs.continuous.norm.continuousOn + refine ⟨max 0 B, le_max_left _ _, ?_⟩ + intro t ht x + by_cases hx : x ∈ K + · exact (hB ⟨(t, x), ⟨ht, hx⟩, rfl⟩).trans (le_max_right _ _) + · have he : a t =ᶠ[𝓝 x] fun _ => (0 : Plane) := by + filter_upwards [hK.isClosed.isOpen_compl.mem_nhds hx] with y hy + exact (hz t ht y hy).1 + rw [he.fderiv_eq] + simpa only [fderiv_fun_const, Pi.zero_apply, norm_zero] using (le_max_left (0 : ℝ) B) + +theorem triangularLift_norm_bound {a : Plane → Plane} {w : Plane → ℝ} + {A B : ℝ} (ha : ∀ x, ‖a x‖ ≤ A) (hw : ∀ x, |w x| ≤ B) (x : Space) : + ‖triangularLift a w x‖ ≤ ‖planeInclusion‖ * A + B * ‖basis 2‖ := by + unfold triangularLift + calc + _ ≤ ‖planeInclusion (a (horizontalLinear x))‖ + ‖w (horizontalLinear x) • basis 2‖ := norm_add_le _ _ + _ ≤ ‖planeInclusion‖ * A + B * ‖basis 2‖ := by + rw [norm_smul, Real.norm_eq_abs] + exact add_le_add + ((planeInclusion.le_opNorm _).trans + (mul_le_mul_of_nonneg_left (ha _) (norm_nonneg _))) + (mul_le_mul_of_nonneg_right (hw _) (norm_nonneg _)) + +theorem triangularLift_fderiv_norm_bound {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) {A B : ℝ} + (hA : 0 ≤ A) (hB : 0 ≤ B) + (hda : ∀ x, ‖fderiv ℝ a x‖ ≤ A) (hdw : ∀ x, ‖fderiv ℝ w x‖ ≤ B) (x : Space) : + ‖fderiv ℝ (triangularLift a w) x‖ ≤ + (‖planeInclusion‖ * A + B * ‖basis 2‖) * ‖horizontalLinear‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro v + rw [triangularLift_fderiv ha hw] + have hav : ‖fderiv ℝ a (horizontalLinear x) (horizontalLinear v)‖ ≤ + A * (‖horizontalLinear‖ * ‖v‖) := by + apply ((fderiv ℝ a (horizontalLinear x)).le_opNorm _).trans + exact mul_le_mul (hda _) (horizontalLinear.le_opNorm _) (norm_nonneg _) hA + have hwv : ‖fderiv ℝ w (horizontalLinear x) (horizontalLinear v)‖ ≤ + B * (‖horizontalLinear‖ * ‖v‖) := by + apply ((fderiv ℝ w (horizontalLinear x)).le_opNorm _).trans + exact mul_le_mul (hdw _) (horizontalLinear.le_opNorm _) (norm_nonneg _) hB + calc + _ ≤ ‖planeInclusion (fderiv ℝ a (horizontalLinear x) (horizontalLinear v))‖ + + ‖fderiv ℝ w (horizontalLinear x) (horizontalLinear v) • basis 2‖ := norm_add_le _ _ + _ ≤ ‖planeInclusion‖ * (A * (‖horizontalLinear‖ * ‖v‖)) + + (B * (‖horizontalLinear‖ * ‖v‖)) * ‖basis 2‖ := by + rw [norm_smul] + exact add_le_add + ((planeInclusion.le_opNorm _).trans (mul_le_mul_of_nonneg_left hav (norm_nonneg _))) + (mul_le_mul_of_nonneg_right hwv (norm_nonneg _)) + _ = _ := by ring + +theorem PlaneScalarSolution.velocity_gradient_bound {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (hc : CompactPlaneCoefficients a h) : + ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x, + ‖triangularVelocity a w (t,x)‖ + + ‖fderiv ℝ (fun y => triangularVelocity a w (t,y)) x‖ ≤ B := by + obtain ⟨A, hA, hab⟩ := hc.drift_bound ha T hT + obtain ⟨D, hD, hdb⟩ := hc.drift_derivative_bound ha T hT + obtain ⟨C, hC⟩ := hw.bounded + let B := max 0 C + have hB : 0 ≤ B := le_max_left _ _ + refine ⟨‖planeInclusion‖ * A + B * ‖basis 2‖ + + (‖planeInclusion‖ * D + B * ‖basis 2‖) * ‖horizontalLinear‖, ?_⟩ + intro t ht x + apply add_le_add + · exact triangularLift_norm_bound (hab t ht) + (fun y => (hC t ht y).1.trans (le_max_right _ _)) x + · exact triangularLift_fderiv_norm_bound + (ha.comp (contDiff_const.prodMk contDiff_id)) (hw.slice_smooth ht) hD hB (hdb t ht) + (fun y => (hC t ht y).2.trans (le_max_right _ _)) x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneGradientTail.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneGradientTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6bc0a78a9d251ba3a74c1d4d1be54ff937ca5a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneGradientTail.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHessianTail + +namespace OAI + +/-! Square integrability of the first spatial derivatives follows from +the same scalar tail, now using the bounded second derivative. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory +open scoped ContDiff + +theorem scalar_gradient_entry_tail {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 2 f y‖ ≤ M) + (x : Plane) (j : Fin 2) : + |spatialD j f x| ≤ (50 * B + M) * derivativeTail x := by + have hh := scalar_first_directional_tail hf hB hM hfB hfM x (basis j) (plane_basis_norm_le j) + simpa only [iteratedFDeriv_one_apply, spatialD] using hh + +theorem scalar_gradient_square_integrable {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 2 f y‖ ≤ M) (j : Fin 2) : + Integrable (fun x => (spatialD j f x) ^ 2) := by + let A := 50 * B + M + apply (derivativeTail_square_integrable.const_mul (A ^ 2)).mono' + ((spatialD_smooth j hf).continuous.pow 2).aestronglyMeasurable + filter_upwards [] with x + have hb : |spatialD j f x| ≤ A * derivativeTail x := + scalar_gradient_entry_tail hf hB hM hfB hfM x j + have hA : 0 ≤ A * derivativeTail x := + mul_nonneg (by dsimp [A]; positivity) (derivativeTail_pos x).le + have hs := (sq_le_sq₀ (abs_nonneg _) hA).mpr hb + change ‖spatialD j f x ^ 2‖ ≤ A ^ 2 * derivativeTail x ^ 2 + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (spatialD j f x)] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatAppliedContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatAppliedContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..16e0eb94ba326e540c06d28d42b4ad08f942567f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatAppliedContinuity.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTimeLipschitz + +namespace OAI + +/-! Joint continuity of heat evolution with a varying bounded initial jet. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows Set Filter +open scoped Topology NNReal + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +theorem norm_evolutionOperator_apply_le (k : ℕ) (r : ℝ) + (J : BoundedSpatialJets.Space Plane F k) : ‖evolutionOperator F k r J‖ ≤ ‖J‖ := by + by_cases hr : 0 < r + · rw [evolutionOperator, dite_eq_left hr] + exact norm_heatOperator_apply_le F k r hr J + · simp only [evolutionOperator, dite_eq_right hr, ContinuousLinearMap.id_apply, le_refl] + +def appliedHeat (r : ℝ) (x : Plane) : BoundedSpatialJets.Space Plane F 1 →L[ℝ] F := + (BoundedContinuousFunction.evalCLM ℝ x).comp + ((BoundedSpatialJets.functionMap Plane F 0).comp + ((evolutionOperator F 0 r).comp (BoundedSpatialJets.truncateCLM Plane F 0 1 (by omega)))) + +theorem appliedHeat_eq (r : ℝ) (x : Plane) (J : BoundedSpatialJets.Space Plane F 1) : + appliedHeat F r x J = evolution F (BoundedSpatialJets.function Plane F 1 J) r x := by + change BoundedSpatialJets.function Plane F 0 + (evolutionOperator F 0 r (BoundedSpatialJets.truncate Plane F 0 1 (by omega) J)) x = _ + rw [evolutionOperator_function] + congr 1 + +theorem norm_appliedHeat_le (r : ℝ) (x : Plane) : ‖appliedHeat F r x‖ ≤ 1 := by + apply (appliedHeat F r x).opNorm_le_bound zero_le_one + intro J + rw [one_mul] + exact (BoundedSpatialJets.norm_function_le Plane F 0 _ x).trans <| + (norm_evolutionOperator_apply_le F 0 r _).trans <| + BoundedSpatialJets.norm_truncate_le Plane F 0 1 (by omega) J + +theorem appliedHeat_time_continuous (J : BoundedSpatialJets.Space Plane F 1) (x : Plane) : + Continuous (fun r => appliedHeat F r x J) := by + have hL : LipschitzWith ‖J‖₊ (BoundedSpatialJets.function Plane F 1 J) := by + have h := (BoundedSpatialJets.valueMap Plane F).lipschitz.comp + (jet_lipschitz F 0 J 0) + convert! h using 1 + simp only [one_mul] + have h := evolution_time_continuous F hL ‖J‖ (BoundedSpatialJets.norm_function_le Plane F 1 J) x + simpa only [appliedHeat_eq] using h + +/-- The extra first jet supplies uniform initial continuity even when both time and +initial data vary. -/ +theorem appliedHeat_joint_continuous (x : Plane) : + Continuous (fun p : ℝ × BoundedSpatialJets.Space Plane F 1 => appliedHeat F p.1 x p.2) := by + apply continuous_prod_of_continuous_lipschitzWith' _ 1 + · intro r + apply (appliedHeat F r x).lipschitzWith.weaken + exact_mod_cast norm_appliedHeat_le F r x + · intro J + exact appliedHeat_time_continuous F J x + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDataEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDataEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ac0f2b7175bbf990214b3a09b2a2e14543091c7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDataEquation.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatLaplacian + +namespace OAI + +/-! The Gaussian heat equation transferred to bounded smooth initial data. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff BigOperators + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] + +def spatialPartial (j : Fin 2) (f : Plane → F) (x : Plane) : F := + fderiv ℝ f x (Pi.single j 1) + +theorem partial_smooth {f : Plane → F} (hf : ContDiff ℝ ∞ f) (j : Fin 2) : + ContDiff ℝ ∞ (spatialPartial F j f) := + (hf.fderiv_right (by simp)).clm_apply contDiff_const + +theorem slice_one_hasDerivAt {f : Plane → F} (hf : ContDiff ℝ ∞ f) (r s : ℝ) : + HasDerivAt (fun y => f ![r,y]) (spatialPartial F 1 f ![r,s]) s := by + have hi : HasDerivAt (fun y : ℝ => (![r,y] : Plane)) (Pi.single 1 1) s := by + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · change HasDerivAt (fun _ : ℝ => r) (0 : ℝ) s + exact hasDerivAt_const s r + · change HasDerivAt (fun y : ℝ => y) (1 : ℝ) s + convert! hasDerivAt_id s + exact (hf.differentiable (by simp) ![r,s]).hasFDerivAt.comp_hasDerivAt s hi + +theorem slice_zero_hasDerivAt {f : Plane → F} (hf : ContDiff ℝ ∞ f) (r s : ℝ) : + HasDerivAt (fun y => f ![y,s]) (spatialPartial F 0 f ![r,s]) r := by + have hi : HasDerivAt (fun y : ℝ => (![y,s] : Plane)) (Pi.single 0 1) r := by + apply hasDerivAt_pi.mpr + intro j + fin_cases j + · change HasDerivAt (fun y : ℝ => y) (1 : ℝ) r + convert! hasDerivAt_id r + · change HasDerivAt (fun _ : ℝ => s) (0 : ℝ) r + exact hasDerivAt_const r s + exact (hf.differentiable (by simp) ![r,s]).hasFDerivAt.comp_hasDerivAt r hi + +theorem kernelSecond_zero (t : ℝ) (x : Plane) : + kernelSecond t 0 x = oneDimSecond t (x 0) * oneDim t (x 1) := by + dsimp [kernelSecond, oneDimSecond, kernel] + ring + +theorem kernelSecond_one (t : ℝ) (x : Plane) : + kernelSecond t 1 x = oneDim t (x 0) * oneDimSecond t (x 1) := by + dsimp [kernelSecond, oneDimSecond, kernel] + ring + +/-- A Gaussian second derivative can be moved onto the bounded data. -/ +theorem kernelSecond_transfer {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (j : Fin 2) (C D E : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖spatialPartial F j f x‖ ≤ D) + (hE : ∀ x, ‖spatialPartial F j (spatialPartial F j f) x‖ ≤ E) : + (∫ x, kernelSecond t j x • f x) = + ∫ x, kernel t x • spatialPartial F j (spatialPartial F j f) x := by + fin_cases j + · change (∫ x, kernelSecond t 0 x • f x) = _ + simp_rw [kernelSecond_zero] + exact integral_second_zero F ht hf.continuous + (partial_smooth F (partial_smooth F hf 0) 0).continuous + (slice_zero_hasDerivAt F hf) (slice_zero_hasDerivAt F (partial_smooth F hf 0)) + C D E hC hD hE + · change (∫ x, kernelSecond t 1 x • f x) = _ + simp_rw [kernelSecond_one] + exact integral_second_one F ht hf.continuous + (partial_smooth F (partial_smooth F hf 1) 1).continuous + (slice_one_hasDerivAt F hf) (slice_one_hasDerivAt F (partial_smooth F hf 1)) + C D E hC hD hE + +theorem partial_reflection {f : Plane → F} (hf : ContDiff ℝ ∞ f) + (j : Fin 2) (x y : Plane) : + spatialPartial F j (fun z => f (x-z)) y = -(spatialPartial F j f (x-y)) := by + have hd := (hf.differentiable (by simp) (x-y)).hasFDerivAt.comp y + ((hasFDerivAt_const (𝕜 := ℝ) x y).sub (hasFDerivAt_id y)) + change HasFDerivAt (fun z => f (x-z)) _ y at hd + unfold spatialPartial + rw [hd.fderiv] + simp only [ContinuousLinearMap.comp_apply, zero_sub, neg_apply, + ContinuousLinearMap.id_apply, map_neg] + +theorem partial_reflection_twice {f : Plane → F} (hf : ContDiff ℝ ∞ f) + (j : Fin 2) (x y : Plane) : + spatialPartial F j (spatialPartial F j (fun z => f (x-z))) y = + spatialPartial F j (spatialPartial F j f) (x-y) := by + have he : spatialPartial F j (fun z => f (x-z)) = -(fun z => spatialPartial F j f (x-z)) := by + funext z + exact partial_reflection F hf j x z + rw [he] + change fderiv ℝ (-(fun z => spatialPartial F j f (x-z))) y (Pi.single j 1) = _ + rw [fderiv_neg] + change -(spatialPartial F j (fun z => spatialPartial F j f (x-z)) y) = _ + rw [partial_reflection F (partial_smooth F hf j), neg_neg] + +theorem kernelSecond_convolve {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (j : Fin 2) (C D E : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖spatialPartial F j f x‖ ≤ D) + (hE : ∀ x, ‖spatialPartial F j (spatialPartial F j f) x‖ ≤ E) (x : Plane) : + BoundedKernel.convolve Plane F volume (kernelSecond t j) f x = + BoundedKernel.convolve Plane F volume (kernel t) (spatialPartial F j (spatialPartial F j f)) x := by + have hg : ContDiff ℝ ∞ (fun y => f (x-y)) := hf.comp (contDiff_const.sub contDiff_id) + have h := kernelSecond_transfer F ht hg j C D E + (fun y => hC (x-y)) + (fun y => by simpa only [partial_reflection F hf, norm_neg] using hD (x-y)) + (fun y => by simpa only [partial_reflection_twice F hf] using hE (x-y)) + change (∫ y, kernelSecond t j y • f (x-y)) = + ∫ y, kernel t y • spatialPartial F j (spatialPartial F j f) (x-y) + simpa only [partial_reflection_twice F hf] using h + +/-- The time derivative is the sum of heat evolutions of the actual second partials. -/ +theorem hasDerivAt_heatConvolution_data {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (C D E : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ j x, ‖spatialPartial F j f x‖ ≤ D) + (hE : ∀ j x, ‖spatialPartial F j (spatialPartial F j f) x‖ ≤ E) (x : Plane) : + HasDerivAt (fun s => heatConvolution F s f x) + (∑ j : Fin 2, heatConvolution F t (spatialPartial F j (spatialPartial F j f)) x) t := by + have hd := hasDerivAt_heatConvolution F ht f hf.continuous C hC x + convert! hd using 1 + rw [← integral_sub_left_eq_self _ volume x] + simp only [sub_sub_self] + simp_rw [Finset.sum_smul] + rw [integral_finsetSum _ (fun j _ => + BoundedKernel.integrand_integrable Plane F volume (kernelSecond t j) f + (kernelSecond_integrable ht j) hf.continuous C hC x)] + apply Finset.sum_congr rfl + intro j _ + rw [heatConvolution_eq] + exact (kernelSecond_convolve F ht hf j C D E hC (hD j) (hE j) x).symm + +theorem norm_partial_le {f : Plane → F} (j : Fin 2) (D : ℝ) + (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) (x : Plane) : ‖spatialPartial F j f x‖ ≤ D := by + have h := (fderiv ℝ f x).le_opNorm (Pi.single j 1) + simpa only [spatialPartial, Pi.norm_single, norm_one, mul_one] using h.trans + (mul_le_mul_of_nonneg_right (hD x) (norm_nonneg _)) + +theorem partial_heatConvolution {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (j : Fin 2) (C D : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) (x : Plane) : + spatialPartial F j (heatConvolution F t f) x = heatConvolution F t (spatialPartial F j f) x := by + have he : heatConvolution F t f = + BoundedKernel.convolve Plane F volume (kernel t) f := + funext (heatConvolution_eq F t f) + have hi := BoundedKernel.integrand_integrable Plane (Plane →L[ℝ] F) volume (kernel t) + (fderiv ℝ f) (kernel_integrable ht) (hf.continuous_fderiv (by simp)) D hD x + rw [spatialPartial, he, BoundedKernel.fderiv_convolve Plane F volume (kernel t) f + (kernel_integrable ht) (hf.of_le (by simp)) C D hC hD x, + ContinuousLinearMap.integral_apply hi, heatConvolution_eq] + rfl + +theorem gradient_convolve_data {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (j : Fin 2) (C D : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) (x : Plane) : + BoundedKernel.convolve Plane F volume (kernelDerivative t j) f x = + heatConvolution F t (spatialPartial F j f) x := by + rw [← fderiv_heatConvolution_basis F ht f hf.continuous C hC x j] + exact partial_heatConvolution F ht hf j C D hC hD x + +/-- The actual heat convolution solves the heat equation, with no assumed PDE input. -/ +theorem hasDerivAt_heatConvolution_equation {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : ContDiff ℝ ∞ f) (C D E : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) + (hE : ∀ j x, ‖fderiv ℝ (spatialPartial F j f) x‖ ≤ E) (x : Plane) : + HasDerivAt (fun s => heatConvolution F s f x) + (∑ j : Fin 2, spatialPartial F j (spatialPartial F j (heatConvolution F t f)) x) t := by + convert! hasDerivAt_heatConvolution_data F ht hf C D E hC + (fun j => norm_partial_le F j D hD) (fun j => norm_partial_le F j E (hE j)) x using 1 + apply Finset.sum_congr rfl + intro j _ + have he : spatialPartial F j (heatConvolution F t f) = + heatConvolution F t (spatialPartial F j f) := + funext (partial_heatConvolution F ht hf j C D hC hD) + rw [he, partial_heatConvolution F ht (partial_smooth F hf j) j D E + (norm_partial_le F j D hD) (hE j)] + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDuhamelEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDuhamelEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..38830e119cff710852e5bd1cb37874e79ba68630 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatDuhamelEquation.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatSourceEquation + +namespace OAI + +/-! The inhomogeneous heat equation for the initial-value plus source formula. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff Interval BigOperators + +theorem norm_fderiv_jet_le (k : ℕ) (J : BoundedSpatialJets.Space Plane ℝ (k+1)) (x : Plane) : + ‖fderiv ℝ (BoundedSpatialJets.function Plane ℝ (k+1) J) x‖ ≤ ‖J‖ := by + rw [← BoundedSpatialJets.function_derivative Plane ℝ k J x] + exact (BoundedSpatialJets.norm_function_le Plane (Plane →L[ℝ] ℝ) k _ x).trans + (BoundedSpatialJets.norm_derivative_le Plane ℝ k J) + +theorem hasDerivAt_initial_evolution {ν t : ℝ} (hν : 0 < ν) (ht : 0 < t) + (f : Plane → ℝ) (hf : ContDiff ℝ ∞ f) (J : BoundedSpatialJets.Space Plane ℝ 3) + (hJ : (BoundedSpatialJets.function Plane ℝ 3 J : Plane → ℝ) = f) (x : Plane) : + HasDerivAt (fun s => evolution ℝ f (ν*s) x) + (ν * ∑ j : Fin 2, spatialPartial ℝ j (spatialPartial ℝ j (evolution ℝ f (ν*t))) x) t := by + have hC (y : Plane) : ‖f y‖ ≤ ‖J‖ := by + rw [← hJ] + exact BoundedSpatialJets.norm_function_le Plane ℝ 3 J y + have hD (y : Plane) : ‖fderiv ℝ f y‖ ≤ ‖J‖ := by + rw [← hJ] + exact norm_fderiv_jet_le 2 J y + have hE (j : Fin 2) (y : Plane) : ‖fderiv ℝ (spatialPartial ℝ j f) y‖ ≤ ‖J‖ := by + let P := BoundedSpatialJets.directionalDerivativeCLM Plane ℝ 2 (Pi.single j 1) + have he : (BoundedSpatialJets.function Plane ℝ 2 (P J) : Plane → ℝ) = spatialPartial ℝ j f := by + funext z + rw [BoundedSpatialJets.function_directionalDerivativeCLM, hJ] + rfl + rw [← he] + apply (norm_fderiv_jet_le 1 (P J) y).trans + apply (P.le_opNorm J).trans + have hp : ‖P‖ ≤ 1 := by + simpa only [P, Pi.norm_single, norm_one] using + BoundedSpatialJets.norm_directionalDerivativeCLM_le Plane ℝ 2 (Pi.single j 1) + simpa only [one_mul] using mul_le_mul_of_nonneg_right hp (norm_nonneg J) + have hd := (hasDerivAt_heatConvolution_equation ℝ (mul_pos hν ht) hf + ‖J‖ ‖J‖ ‖J‖ hC hD hE x).comp t ((hasDerivAt_id t).const_mul ν) + have he : evolution ℝ f (ν*t) = heatConvolution ℝ (ν*t) f := by + funext y + exact ite_eq_right (not_le.mpr (mul_pos hν ht)) + rw [he] + convert hd.congr_of_eventuallyEq (f₁ := fun s => evolution ℝ f (ν*s) x) ?_ using 1 + · simp only [mul_one, mul_comm] + · filter_upwards [Ioi_mem_nhds ht] with s hs + exact ite_eq_right (not_le.mpr (mul_pos hν hs)) + +theorem spatialPartial_add {f g : Plane → ℝ} (hf : Differentiable ℝ f) + (hg : Differentiable ℝ g) (j : Fin 2) : + spatialPartial ℝ j (fun x => f x+g x) = fun x => spatialPartial ℝ j f x+spatialPartial ℝ j g x := by + funext x + rw [spatialPartial, fderiv_fun_add (hf x) (hg x)] + rfl + +theorem spatialPartial_twice_add {f g : Plane → ℝ} (hf : ContDiff ℝ 2 f) + (hg : ContDiff ℝ 2 g) (j : Fin 2) : + spatialPartial ℝ j (spatialPartial ℝ j (fun x => f x+g x)) = + fun x => spatialPartial ℝ j (spatialPartial ℝ j f) x+ + spatialPartial ℝ j (spatialPartial ℝ j g) x := by + rw [spatialPartial_add (hf.differentiable (by norm_num)) (hg.differentiable (by norm_num))] + apply spatialPartial_add + · exact ((hf.fderiv_right (m := 1) (by norm_num)).clm_apply contDiff_const).differentiable (by norm_num) + · exact ((hg.fderiv_right (m := 1) (by norm_num)).clm_apply contDiff_const).differentiable (by norm_num) + +theorem hasDerivAt_duhamel {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (f : Plane → ℝ) (hf : ContDiff ℝ ∞ f) (J : BoundedSpatialJets.Space Plane ℝ 3) + (hJ : (BoundedSpatialJets.function Plane ℝ 3 J : Plane → ℝ) = f) + (q : WeaklySingular.Path (PlaneScalarMild.Jet 3) T) + (hq : ∀ s, ContDiff ℝ ∞ (PlaneScalarMild.sourceValue hT 3 q s)) + {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) T) (x : Plane) : + HasDerivAt + (fun s => evolution ℝ f (ν*s) x + PlaneScalarMild.heatSourceValue hT hν 3 q s x) + (ν * ∑ j : Fin 2, spatialPartial ℝ j (spatialPartial ℝ j + (fun y => evolution ℝ f (ν*t) y + PlaneScalarMild.heatSourceValue hT hν 3 q t y)) x + + PlaneScalarMild.sourceValue hT 3 q t x) t := by + have hi : ContDiff ℝ 3 (evolution ℝ f (ν*t)) := by + have he := evolutionOperator_function ℝ 3 (ν*t) J + have he' : (BoundedSpatialJets.function Plane ℝ 3 (evolutionOperator ℝ 3 (ν*t) J) : Plane → ℝ) = + evolution ℝ f (ν*t) := by + funext y + rw [he, hJ] + rw [← he'] + exact BoundedSpatialJets.function_contDiff Plane ℝ 3 _ + have hs : ContDiff ℝ 3 (PlaneScalarMild.heatSourceValue hT hν 3 q t) := + BoundedSpatialJets.function_contDiff Plane ℝ 3 _ + have hd := (hasDerivAt_initial_evolution hν ht.1 f hf J hJ x).add + (PlaneScalarMild.hasDerivAt_heatSourceValue hT hν q hq ht x) + convert hd using 1 + simp only [spatialPartial_twice_add (hi.of_le (by norm_num)) (hs.of_le (by norm_num)), + Finset.sum_add_distrib] + ring + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..69c0cdf5fa7b5387c5d9d67cadd8a36db6fe5df6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatEquation.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatKernel + +namespace OAI + +/-! The normalized Euclidean Gaussian satisfies the heat equation. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows +open scoped ContDiff BigOperators + +def oneDimSecond (t x : ℝ) : ℝ := (x^2 / (4*t^2) - 1/(2*t)) * oneDim t x + +theorem oneDimDerivative_hasDerivAt {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (oneDimDerivative t) (oneDimSecond t x) x := by + have h := (((hasDerivAt_id x).div_const (2*t)).neg).mul (oneDim_hasDerivAt ht x) + convert! h using 1 + dsimp [oneDimDerivative, oneDimSecond] + ring + +theorem oneDim_time_hasDerivAt {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (fun s => oneDim s x) (oneDimSecond t x) t := by + have hA : 0 < 4 * Real.pi * t := by positivity + have hlin : HasDerivAt (fun s : ℝ => 4 * Real.pi * s) (4 * Real.pi) t := by + convert! (hasDerivAt_id t).const_mul (4 * Real.pi) using 1 + simp only [mul_one] + have hs := hlin.sqrt hA.ne' + have hp : HasDerivAt (fun s : ℝ => (Real.sqrt (4 * Real.pi * s))⁻¹) + (-(1 / (2*t)) * (Real.sqrt (4 * Real.pi * t))⁻¹) t := by + convert! hs.inv (Real.sqrt_pos.mpr hA).ne' using 1 + field_simp [ht.ne', (Real.sqrt_pos.mpr hA).ne'] + nlinarith [Real.sq_sqrt hA.le, + Real.sq_sqrt (show 0 ≤ t * 4 * Real.pi by positivity)] + have he : HasDerivAt (fun s : ℝ => Real.exp (-(4*s)⁻¹*x^2)) + (x^2 / (4*t^2) * Real.exp (-(4*t)⁻¹*x^2)) t := by + have h := (((((hasDerivAt_id t).const_mul 4).inv + (mul_ne_zero (by norm_num) ht.ne')).neg).mul_const (x^2)).exp + simp only [id_eq, Pi.inv_apply, Pi.neg_apply] at h + convert! h using 1 + field_simp [ht.ne'] + convert! hp.mul he using 1 + dsimp [oneDimSecond, oneDim] + ring + +def kernelSecond (t : ℝ) (j : Fin 2) (x : Plane) : ℝ := + (x j ^ 2 / (4*t^2) - 1/(2*t)) * kernel t x + +theorem kernel_time_hasDerivAt {t : ℝ} (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => kernel s x) (∑ j : Fin 2, kernelSecond t j x) t := by + have h := (oneDim_time_hasDerivAt ht (x 0)).mul (oneDim_time_hasDerivAt ht (x 1)) + convert! h using 1 + dsimp [kernelSecond, oneDimSecond, kernel] + rw [Fin.sum_univ_two] + ring + +theorem kernelDerivative_fderiv_basis {t : ℝ} (ht : 0 < t) (x : Plane) (j : Fin 2) : + fderiv ℝ (kernelDerivative t j) x (Pi.single j 1) = kernelSecond t j x := by + have hp := ((ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).hasFDerivAt.const_mul + (-(2*t)⁻¹)).mul ((kernel_smooth t).differentiable (by simp) x).hasFDerivAt + have he : (fun y : Plane => -(2*t)⁻¹ * y j * kernel t y) = kernelDerivative t j := by + funext y + unfold kernelDerivative + ring + change HasFDerivAt (fun y : Plane => -(2*t)⁻¹ * y j * kernel t y) _ x at hp + rw [he] at hp + change HasFDerivAt (kernelDerivative t j) _ x at hp + rw [hp.fderiv] + simp only [add_apply, smul_apply, ContinuousLinearMap.proj_apply, + Pi.single_eq_same, kernel_fderiv_basis ht, smul_eq_mul] + dsimp [kernelSecond, kernelDerivative] + ring + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatInitialContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatInitialContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..20017e85dc1ed1a51a28edae66349981c9e77b9d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatInitialContinuity.lean @@ -0,0 +1,197 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatSmoothing +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatOperator +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetCurves +import Mathlib.Topology.UniformSpace.UniformApproximation + +namespace OAI + +/-! The Gaussian first moment and uniform initial continuity for bounded Lipschitz data. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows MeasureTheory Set Filter +open scoped Topology NNReal ContDiff + +theorem kernel_coordinate_moment {t : ℝ} (ht : 0 < t) (x : Plane) (j : Fin 2) : + kernel t x * |x j| = (2*t) * |kernelDerivative t j x| := by + simp only [kernelDerivative, abs_mul, abs_neg, abs_div, + abs_of_pos (mul_pos (by norm_num : (0 : ℝ) < 2) ht), + abs_of_nonneg (kernel_nonneg t x)] + field_simp [ht.ne'] + +theorem kernel_coordinate_integrable {t : ℝ} (ht : 0 < t) (j : Fin 2) : + Integrable (fun x : Plane => kernel t x * |x j|) := by + simpa only [kernel_coordinate_moment ht] using + ((kernelDerivative_integrable ht j).abs.const_mul (2*t)) + +theorem kernel_coordinate_integral_le {t : ℝ} (ht : 0 < t) (j : Fin 2) : + (∫ x : Plane, kernel t x * |x j|) ≤ 4 * Real.sqrt t := by + simp_rw [kernel_coordinate_moment ht] + rw [integral_const_mul] + have hdiv : t / Real.sqrt t = Real.sqrt t := by + apply (div_eq_iff (Real.sqrt_pos.mpr ht).ne').mpr + nlinarith [Real.sq_sqrt ht.le] + calc + _ ≤ (2*t) * (2 / Real.sqrt t) := mul_le_mul_of_nonneg_left + (kernelDerivative_abs_integral_le ht j) (by positivity) + _ = 4 * (t / Real.sqrt t) := by ring + _ = _ := by rw [hdiv] + +private theorem plane_norm_le_coordinate_sum (x : Plane) : ‖x‖ ≤ |x 0|+|x 1| := by + apply (pi_norm_le_iff_of_nonneg (add_nonneg (abs_nonneg _) (abs_nonneg _))).mpr + intro j + fin_cases j <;> simp only [Real.norm_eq_abs] + · exact le_add_of_nonneg_right (abs_nonneg _) + · exact le_add_of_nonneg_left (abs_nonneg _) + +theorem kernel_norm_moment_integrable {t : ℝ} (ht : 0 < t) : + Integrable (fun x : Plane => kernel t x * ‖x‖) := by + apply ((kernel_coordinate_integrable ht 0).add + (kernel_coordinate_integrable ht 1)).mono' + · exact ((kernel_smooth t).continuous.mul continuous_norm).aestronglyMeasurable + · exact ae_of_all _ fun x => by + rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (kernel_nonneg t x) (norm_nonneg x))] + simpa only [mul_add, Pi.add_apply] using mul_le_mul_of_nonneg_left + (plane_norm_le_coordinate_sum x) (kernel_nonneg t x) + +theorem kernel_norm_moment_le {t : ℝ} (ht : 0 < t) : + (∫ x : Plane, kernel t x * ‖x‖) ≤ 8 * Real.sqrt t := by + calc + _ ≤ ∫ x : Plane, kernel t x * |x 0| + kernel t x * |x 1| := by + apply integral_mono (kernel_norm_moment_integrable ht) + ((kernel_coordinate_integrable ht 0).add (kernel_coordinate_integrable ht 1)) + intro x + simpa only [mul_add, Pi.add_apply] using mul_le_mul_of_nonneg_left + (plane_norm_le_coordinate_sum x) (kernel_nonneg t x) + _ = (∫ x : Plane, kernel t x * |x 0|) + ∫ x : Plane, kernel t x * |x 1| := + integral_add (kernel_coordinate_integrable ht 0) (kernel_coordinate_integrable ht 1) + _ ≤ _ := by linarith [kernel_coordinate_integral_le ht 0, kernel_coordinate_integral_le ht 1] + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +def evolution (f : Plane → F) (t : ℝ) (x : Plane) : F := + if t ≤ 0 then f x else heatConvolution F t f x + +theorem norm_evolution_sub_le {f : Plane → F} {L : ℝ≥0} (hL : LipschitzWith L f) + (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) {t : ℝ} (ht : 0 < t) (x : Plane) : + ‖evolution F f t x - f x‖ ≤ 8 * L * Real.sqrt t := by + have hi := BoundedKernel.integrand_integrable Plane F volume (kernel t) f + (kernel_integrable ht) hL.continuous C hC x + have hc := (kernel_integrable ht).smul_const (f x) + have he : evolution F f t x - f x = + ∫ y : Plane, kernel t y • (f (x-y)-f x) := by + rw [evolution, ite_eq_right (not_le.mpr ht), heatConvolution_eq] + unfold BoundedKernel.convolve + simp_rw [smul_sub] + rw [integral_sub hi hc, integral_smul_const, kernel_integral ht, one_smul] + have hm : Integrable (fun y : Plane => kernel t y • (f (x-y)-f x)) := by + convert! hi.sub hc using 1 + funext y + exact smul_sub _ _ _ + rw [he] + calc + _ ≤ ∫ y : Plane, ‖kernel t y • (f (x-y)-f x)‖ := norm_integral_le_integral_norm _ + _ ≤ ∫ y : Plane, (L : ℝ) * (kernel t y * ‖y‖) := by + apply integral_mono hm.norm ((kernel_norm_moment_integrable ht).const_mul (L : ℝ)) + intro y + have hd := hL.norm_sub_le (x-y) x + have hy : x-y-x = -y := by abel + rw [hy, norm_neg] at hd + change ‖kernel t y • (f (x-y)-f x)‖ ≤ (L : ℝ) * (kernel t y * ‖y‖) + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (kernel_nonneg t y)] + calc + _ ≤ kernel t y * ((L : ℝ)*‖y‖) := mul_le_mul_of_nonneg_left hd (kernel_nonneg t y) + _ = _ := by ring + _ = (L : ℝ) * ∫ y : Plane, kernel t y * ‖y‖ := integral_const_mul _ _ + _ ≤ (L : ℝ) * (8 * Real.sqrt t) := + mul_le_mul_of_nonneg_left (kernel_norm_moment_le ht) L.coe_nonneg + _ = _ := by ring + +theorem evolution_tendsto_uniformly {f : Plane → F} {L : ℝ≥0} (hL : LipschitzWith L f) + (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) : + TendstoUniformly (evolution F f) f (𝓝[>] 0) := by + have hlim : Tendsto (fun t : ℝ => 8 * (L : ℝ) * Real.sqrt t) (𝓝[>] 0) (𝓝 0) := by + convert! (show Tendsto (fun t : ℝ => 8 * (L : ℝ) * Real.sqrt t) + (𝓝 (0 : ℝ) ⊓ 𝓟 (Ioi (0 : ℝ))) (𝓝 (8 * (L : ℝ) * Real.sqrt 0)) from + (Real.continuous_sqrt.tendsto (0 : ℝ)).mono_left inf_le_left |>.const_mul (8 * (L : ℝ)) + ) using 1 + simp only [Real.sqrt_zero, mul_zero] + rw [Metric.tendstoUniformly_iff] + intro ε hε + filter_upwards [self_mem_nhdsWithin, (tendsto_order.mp hlim).2 ε hε] with t ht hb x + have h := (norm_evolution_sub_le F hL C hC ht x).trans_lt hb + simpa only [dist_eq_norm, norm_sub_rev] using h + +omit [CompleteSpace F] in +theorem jet_lipschitz (k : ℕ) (J : BoundedSpatialJets.Space Plane F (k+1)) + (i : Fin (k+1)) : LipschitzWith ‖J‖₊ (J.val i.castSucc) := by + have hd (x : Plane) := BoundedSpatialJets.hasFDerivAt Plane F (k+1) J i x + apply lipschitzWith_of_nnnorm_fderiv_le (fun x => (hd x).differentiableAt) + intro x + have hn : ‖fderiv ℝ (J.val i.castSucc) x‖ ≤ ‖J‖ := by + rw [(hd x).fderiv, (BoundedSpatialJets.curryMap Plane F i.val).norm_map] + exact BoundedSpatialJets.norm_jet_le Plane F (k+1) J i.succ x + exact_mod_cast hn + +theorem norm_heatOperator_truncate_sub_le (k : ℕ) + (J : BoundedSpatialJets.Space Plane F (k+1)) {t : ℝ} (ht : 0 < t) : + ‖heatOperator F k t ht (BoundedSpatialJets.truncate Plane F k (k+1) (by omega) J) - + BoundedSpatialJets.truncate Plane F k (k+1) (by omega) J‖ ≤ + 8 * ‖J‖ * Real.sqrt t := by + have htr (i : Fin (k+1)) (x : Plane) : + (BoundedSpatialJets.truncate Plane F k (k+1) (by omega) J).val i x = + J.val i.castSucc x := by + change iteratedFDeriv ℝ i.val (BoundedSpatialJets.function Plane F (k+1) J) x = _ + exact congrFun (BoundedSpatialJets.iteratedFDeriv_function Plane F (k+1) J i.val (by omega)) x + apply BoundedSpatialJets.norm_sub_le_of_jets Plane F k _ _ (by positivity) + intro i x + rw [heatOperator_jet] + simp_rw [htr] + have h := norm_evolution_sub_le (BoundedSpatialJets.Value Plane F i.val) + (jet_lipschitz F k J i) ‖J‖ (BoundedSpatialJets.norm_jet_le Plane F (k+1) J i.castSucc) + ht x + rw [evolution, ite_eq_right (not_le.mpr ht), heatConvolution_eq] at h + exact h + +/-- The heat operator at nonpositive time is the identity. Only strong, applied +continuity at zero is asserted; operator-norm continuity there is unnecessary. -/ +def evolutionOperator (k : ℕ) (t : ℝ) : + BoundedSpatialJets.Space Plane F k →L[ℝ] BoundedSpatialJets.Space Plane F k := + if ht : 0 < t then heatOperator F k t ht else ContinuousLinearMap.id ℝ _ + +theorem evolutionOperator_function (k : ℕ) (t : ℝ) + (J : BoundedSpatialJets.Space Plane F k) (x : Plane) : + BoundedSpatialJets.function Plane F k (evolutionOperator F k t J) x = + evolution F (BoundedSpatialJets.function Plane F k J) t x := by + by_cases ht : 0 < t + · rw [evolutionOperator, dite_eq_left ht, evolution, ite_eq_right (not_le.mpr ht), + heatConvolution_eq] + exact heatOperator_apply F k t ht J x + · simp only [evolutionOperator, dite_eq_right ht, ContinuousLinearMap.id_apply, + evolution, ite_eq_left (not_lt.mp ht)] + +theorem evolutionOperator_initial (k : ℕ) : + evolutionOperator F k 0 = ContinuousLinearMap.id ℝ _ := by + simp only [evolutionOperator, lt_self_iff_false, ↓reduceDIte] + +theorem evolutionOperator_truncate_tendsto (k : ℕ) + (J : BoundedSpatialJets.Space Plane F (k+1)) : + Tendsto (fun t : ℝ => evolutionOperator F k t + (BoundedSpatialJets.truncate Plane F k (k+1) (by omega) J)) (𝓝 0) + (𝓝 (BoundedSpatialJets.truncate Plane F k (k+1) (by omega) J)) := by + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero (fun _ => norm_nonneg _) + · intro t + by_cases ht : 0 < t + · rw [evolutionOperator, dite_eq_left ht] + exact norm_heatOperator_truncate_sub_le F k J ht + · rw [evolutionOperator, dite_eq_right ht, ContinuousLinearMap.id_apply, sub_self, norm_zero] + positivity + · convert! (Real.continuous_sqrt.tendsto (0 : ℝ)).const_mul (8 * ‖J‖) using 1 + simp only [Real.sqrt_zero, mul_zero] + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernel.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd5315a373893be6c607cae3b420f5bdfadf2673 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernel.lean @@ -0,0 +1,206 @@ +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Model +import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral +import Mathlib.MeasureTheory.Integral.Prod +import Mathlib.MeasureTheory.Measure.Lebesgue.Integral +import Mathlib.MeasureTheory.Constructions.Pi + +namespace OAI + +/-! The normalized Euclidean heat kernel, with its integrable first derivatives. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology BigOperators ContDiff + +def oneDim (t x : ℝ) : ℝ := + (Real.sqrt (4 * Real.pi * t))⁻¹ * Real.exp (-(4 * t)⁻¹ * x ^ 2) + +def oneDimDerivative (t x : ℝ) : ℝ := -(x / (2 * t)) * oneDim t x + +theorem oneDim_nonneg (t x : ℝ) : 0 ≤ oneDim t x := by + unfold oneDim + positivity + +theorem oneDim_integrable {t : ℝ} (ht : 0 < t) : Integrable (oneDim t) := + (integrable_exp_neg_mul_sq (by positivity : 0 < (4 * t)⁻¹)).const_mul _ + +theorem oneDim_integral {t : ℝ} (ht : 0 < t) : (∫ x, oneDim t x) = 1 := by + unfold oneDim + rw [integral_const_mul, integral_gaussian] + have he : Real.pi / (4 * t)⁻¹ = 4 * Real.pi * t := by rw [div_inv_eq_mul]; ring + rw [he, inv_mul_cancel₀] + exact ne_of_gt (Real.sqrt_pos.2 (by positivity)) + +theorem oneDim_hasDerivAt {t : ℝ} (ht : 0 < t) (x : ℝ) : + HasDerivAt (oneDim t) (oneDimDerivative t x) x := by + have h := (((hasDerivAt_pow 2 x).const_mul (-(4 * t)⁻¹)).exp).const_mul + (Real.sqrt (4 * Real.pi * t))⁻¹ + convert! h using 1 + simp only [oneDim, oneDimDerivative] + field_simp [ht.ne'] + ring + +theorem oneDim_smooth (t : ℝ) : ContDiff ℝ ∞ (oneDim t) := by + unfold oneDim + exact contDiff_const.mul + ((contDiff_const.mul ((contDiff_id : ContDiff ℝ ∞ (fun x : ℝ => x)).pow 2)).exp) + +private theorem firstMoment_Ioi {b : ℝ} (hb : 0 < b) : + (∫ x : ℝ in Ioi 0, x * Real.exp (-b * x ^ 2)) = (2 * b)⁻¹ := by + have hd (x : ℝ) : HasDerivAt (fun y : ℝ => -(2 * b)⁻¹ * Real.exp (-b * y ^ 2)) + (x * Real.exp (-b * x ^ 2)) x := by + convert! (((hasDerivAt_pow 2 x).const_mul (-b)).exp).const_mul (-(2 * b)⁻¹) + using 1 + field_simp [hb.ne'] + ring + have hlim : Tendsto (fun x : ℝ => -(2 * b)⁻¹ * Real.exp (-b * x ^ 2)) + atTop (𝓝 (-(2 * b)⁻¹ * 0)) := by + apply Tendsto.const_mul + exact Real.tendsto_exp_atBot.comp + ((tendsto_pow_atTop two_ne_zero).const_mul_atTop_of_neg (neg_lt_zero.mpr hb)) + convert! integral_Ioi_of_hasDerivAt_of_tendsto' (fun x _ => hd x) + (integrable_mul_exp_neg_mul_sq hb).integrableOn hlim using 1 + simp + +theorem absoluteFirstMoment {b : ℝ} (hb : 0 < b) : + (∫ x : ℝ, |x| * Real.exp (-b * x ^ 2)) = b⁻¹ := by + calc + _ = ∫ x : ℝ, (fun y => y * Real.exp (-b * y ^ 2)) |x| := by + simp only [sq_abs] + _ = 2 * ∫ x : ℝ in Ioi 0, x * Real.exp (-b * x ^ 2) := + integral_comp_abs (f := fun y : ℝ => y * Real.exp (-b * y ^ 2)) + _ = b⁻¹ := by rw [firstMoment_Ioi hb]; field_simp + +theorem oneDimDerivative_integrable {t : ℝ} (ht : 0 < t) : + Integrable (oneDimDerivative t) := by + have h := (integrable_mul_exp_neg_mul_sq + (by positivity : 0 < (4 * t)⁻¹)).const_mul + (-(2 * t)⁻¹ * (Real.sqrt (4 * Real.pi * t))⁻¹) + convert! h using 1 + funext x + simp only [oneDimDerivative, oneDim] + ring + +theorem oneDimDerivative_abs_integral {t : ℝ} (ht : 0 < t) : + (∫ x, |oneDimDerivative t x|) = 2 / Real.sqrt (4 * Real.pi * t) := by + have he (x : ℝ) : |oneDimDerivative t x| = + ((2 * t)⁻¹ * (Real.sqrt (4 * Real.pi * t))⁻¹) * + (|x| * Real.exp (-(4 * t)⁻¹ * x ^ 2)) := by + simp only [oneDimDerivative, oneDim, abs_mul, abs_neg, abs_div, + abs_of_pos (by positivity : 0 < 2 * t), + abs_of_nonneg (inv_nonneg.mpr (Real.sqrt_nonneg _)), + abs_of_pos (Real.exp_pos _)] + ring + simp_rw [he] + rw [integral_const_mul, absoluteFirstMoment (by positivity)] + field_simp + ring + +theorem oneDimDerivative_abs_integral_le {t : ℝ} (ht : 0 < t) : + (∫ x, |oneDimDerivative t x|) ≤ 2 / Real.sqrt t := by + rw [oneDimDerivative_abs_integral ht] + apply div_le_div_of_nonneg_left (by norm_num) (Real.sqrt_pos.mpr ht) + apply Real.sqrt_le_sqrt + have hp := Real.pi_gt_three + nlinarith + +def kernel (t : ℝ) (x : Plane) : ℝ := oneDim t (x 0) * oneDim t (x 1) + +def kernelDerivative (t : ℝ) (j : Fin 2) (x : Plane) : ℝ := + -(x j / (2 * t)) * kernel t x + +theorem kernel_smooth (t : ℝ) : ContDiff ℝ ∞ (kernel t) := + ((oneDim_smooth t).comp (contDiff_apply ℝ ℝ 0)).mul + ((oneDim_smooth t).comp (contDiff_apply ℝ ℝ 1)) + +/-- The explicit first derivative in each Cartesian direction. -/ +theorem kernel_fderiv_basis {t : ℝ} (ht : 0 < t) (x : Plane) (j : Fin 2) : + fderiv ℝ (kernel t) x (Pi.single j 1) = kernelDerivative t j x := by + let P₀ : Plane →L[ℝ] ℝ := ContinuousLinearMap.proj 0 + let P₁ : Plane →L[ℝ] ℝ := ContinuousLinearMap.proj 1 + have h₀ := (oneDim_hasDerivAt ht (x 0)).hasFDerivAt.comp x P₀.hasFDerivAt + have h₁ := (oneDim_hasDerivAt ht (x 1)).hasFDerivAt.comp x P₁.hasFDerivAt + have hd := h₀.mul h₁ + change HasFDerivAt (kernel t) _ x at hd + rw [hd.fderiv] + fin_cases j <;> + simp [P₀, P₁, kernelDerivative, kernel, oneDimDerivative, + ContinuousLinearMap.comp_apply] <;> ring + +private theorem integrable_coordinate_product (f g : ℝ → ℝ) + (hf : Integrable f) (hg : Integrable g) : + Integrable (fun x : Plane => f (x 0) * g (x 1)) := by + exact (volume_preserving_finTwoArrow ℝ).integrable_comp_of_integrable (hf.mul_prod hg) + +private theorem integral_coordinate_product (f g : ℝ → ℝ) : + (∫ x : Plane, f (x 0) * g (x 1)) = (∫ x, f x) * ∫ x, g x := by + calc + _ = ∫ z : ℝ × ℝ, f z.1 * g z.2 := + (volume_preserving_finTwoArrow ℝ).integral_comp' _ + _ = _ := integral_prod_mul f g + +theorem kernel_nonneg (t : ℝ) (x : Plane) : 0 ≤ kernel t x := + mul_nonneg (oneDim_nonneg t _) (oneDim_nonneg t _) + +theorem kernel_integrable {t : ℝ} (ht : 0 < t) : Integrable (kernel t) := + integrable_coordinate_product _ _ (oneDim_integrable ht) (oneDim_integrable ht) + +theorem kernel_integral {t : ℝ} (ht : 0 < t) : (∫ x : Plane, kernel t x) = 1 := by + change (∫ x : Plane, oneDim t (x 0) * oneDim t (x 1)) = 1 + rw [integral_coordinate_product, oneDim_integral ht, one_mul] + +theorem kernelDerivative_zero (t : ℝ) (x : Plane) : + kernelDerivative t 0 x = oneDimDerivative t (x 0) * oneDim t (x 1) := by + simp only [kernelDerivative, kernel, oneDimDerivative] + ring + +theorem kernelDerivative_one (t : ℝ) (x : Plane) : + kernelDerivative t 1 x = oneDim t (x 0) * oneDimDerivative t (x 1) := by + simp only [kernelDerivative, kernel, oneDimDerivative] + ring + +theorem kernelDerivative_integrable {t : ℝ} (ht : 0 < t) (j : Fin 2) : + Integrable (kernelDerivative t j) := by + fin_cases j + · change Integrable (kernelDerivative t 0) + rw [show kernelDerivative t 0 = (fun x : Plane => + oneDimDerivative t (x 0) * oneDim t (x 1)) from funext (kernelDerivative_zero t)] + exact integrable_coordinate_product _ _ (oneDimDerivative_integrable ht) + (oneDim_integrable ht) + · change Integrable (kernelDerivative t 1) + rw [show kernelDerivative t 1 = (fun x : Plane => + oneDim t (x 0) * oneDimDerivative t (x 1)) from funext (kernelDerivative_one t)] + exact integrable_coordinate_product _ _ (oneDim_integrable ht) + (oneDimDerivative_integrable ht) + +theorem kernelDerivative_abs_integral {t : ℝ} (ht : 0 < t) (j : Fin 2) : + (∫ x : Plane, |kernelDerivative t j x|) = 2 / Real.sqrt (4 * Real.pi * t) := by + fin_cases j + · change (∫ x : Plane, |kernelDerivative t 0 x|) = _ + rw [show kernelDerivative t 0 = (fun x : Plane => + oneDimDerivative t (x 0) * oneDim t (x 1)) from funext (kernelDerivative_zero t)] + simp only [abs_mul, + abs_of_nonneg (oneDim_nonneg t _)] + rw [integral_coordinate_product (fun y => |oneDimDerivative t y|) (oneDim t), oneDim_integral ht, + oneDimDerivative_abs_integral ht, mul_one] + · change (∫ x : Plane, |kernelDerivative t 1 x|) = _ + rw [show kernelDerivative t 1 = (fun x : Plane => + oneDim t (x 0) * oneDimDerivative t (x 1)) from funext (kernelDerivative_one t)] + simp only [abs_mul, + abs_of_nonneg (oneDim_nonneg t _)] + rw [integral_coordinate_product (oneDim t) (fun y => |oneDimDerivative t y|), oneDim_integral ht, + oneDimDerivative_abs_integral ht, one_mul] + +/-- The integrable gradient bound used in the short-time Volterra contraction. -/ +theorem kernelDerivative_abs_integral_le {t : ℝ} (ht : 0 < t) (j : Fin 2) : + (∫ x : Plane, |kernelDerivative t j x|) ≤ 2 / Real.sqrt t := by + rw [kernelDerivative_abs_integral ht j, ← oneDimDerivative_abs_integral ht] + exact oneDimDerivative_abs_integral_le ht + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernelBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernelBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e712ab8664901c2e8af9a2f2159d21c7a4b9fa0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatKernelBounds.lean @@ -0,0 +1,141 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatKernel + +namespace OAI + +/-! An integrable Gaussian majorant for all spatial shifts in a bounded set. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open Real MeasureTheory Set ShearFlows +open scoped Topology BigOperators + +/-- A slower Gaussian, used to dominate bounded translations of the heat kernel. -/ +def envelopeCore (t y : ℝ) : ℝ := Real.exp (-((4 * t)⁻¹ / 2) * y ^ 2) + +def envelopeMoment (t R y : ℝ) : ℝ := (|y| + R) * envelopeCore t y + +def shiftCoefficient (t R : ℝ) : ℝ := + (Real.sqrt (4 * Real.pi * t))⁻¹ * Real.exp ((4 * t)⁻¹ * R ^ 2) + +theorem envelopeCore_pos (t y : ℝ) : 0 < envelopeCore t y := Real.exp_pos _ + +theorem shiftCoefficient_nonneg (t R : ℝ) : 0 ≤ shiftCoefficient t R := by + unfold shiftCoefficient + positivity + +private theorem shifted_square (R z y : ℝ) (_hR : 0 ≤ R) (hz : |z| ≤ R) : + y ^ 2 / 2 - R ^ 2 ≤ (z - y) ^ 2 := by + have hz' := abs_le.mp hz + have hzz : z ^ 2 ≤ R ^ 2 := by nlinarith + nlinarith [sq_nonneg (y - 2 * z)] + +theorem oneDim_shift_le {t : ℝ} (ht : 0 < t) {R z : ℝ} + (hR : 0 ≤ R) (hz : |z| ≤ R) (y : ℝ) : + oneDim t (z - y) ≤ shiftCoefficient t R * envelopeCore t y := by + have ha : 0 ≤ (4 * t)⁻¹ := by positivity + have hs := mul_le_mul_of_nonneg_left (shifted_square R z y hR hz) ha + have he : -(4 * t)⁻¹ * (z - y) ^ 2 ≤ + (4 * t)⁻¹ * R ^ 2 + (-((4 * t)⁻¹ / 2) * y ^ 2) := by linarith + unfold oneDim shiftCoefficient envelopeCore + calc + _ ≤ (Real.sqrt (4 * Real.pi * t))⁻¹ * + Real.exp ((4 * t)⁻¹ * R ^ 2 + (-((4 * t)⁻¹ / 2) * y ^ 2)) := + mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr he) (by positivity) + _ = _ := by rw [Real.exp_add]; ring + +theorem oneDimDerivative_shift_le {t : ℝ} (ht : 0 < t) {R z : ℝ} + (hR : 0 ≤ R) (hz : |z| ≤ R) (y : ℝ) : + |oneDimDerivative t (z - y)| ≤ + (shiftCoefficient t R / (2 * t)) * envelopeMoment t R y := by + have hab : |z - y| ≤ |y| + R := (abs_sub z y).trans (by linarith) + rw [oneDimDerivative, abs_mul, abs_neg, abs_div, + abs_of_pos (by positivity : 0 < 2 * t), abs_of_nonneg (oneDim_nonneg _ _)] + calc + _ ≤ ((|y| + R) / (2 * t)) * (shiftCoefficient t R * envelopeCore t y) := + mul_le_mul (div_le_div_of_nonneg_right hab (by positivity)) + (oneDim_shift_le ht hR hz y) (oneDim_nonneg _ _) (by positivity) + _ = _ := by unfold envelopeMoment; ring + +theorem envelopeCore_integrable {t : ℝ} (ht : 0 < t) : Integrable (envelopeCore t) := + integrable_exp_neg_mul_sq (by positivity) + +theorem envelopeMoment_integrable {t : ℝ} (ht : 0 < t) (R : ℝ) : + Integrable (envelopeMoment t R) := by + have hi : Integrable (fun y : ℝ => |y| * envelopeCore t y) := by + simpa only [Real.norm_eq_abs, abs_mul, abs_of_pos (Real.exp_pos _), envelopeCore] + using (integrable_mul_exp_neg_mul_sq (by positivity : 0 < (4 * t)⁻¹ / 2)).norm + convert! hi.add ((envelopeCore_integrable ht).mul_const R) using 1 + funext y + dsimp only [envelopeMoment, Pi.add_apply] + ring + +/-- Operator norm of a scalar linear functional in the coordinate maximum norm. -/ +theorem functional_norm_le (L : Plane →L[ℝ] ℝ) : + ‖L‖ ≤ |L (Pi.single 0 1)| + |L (Pi.single 1 1)| := by + apply L.opNorm_le_bound (by positivity) + intro v + have hv : v = v 0 • (Pi.single 0 1 : Plane) + v 1 • Pi.single 1 1 := by + funext j + fin_cases j <;> simp + have he : L v = v 0 * L (Pi.single 0 1) + v 1 * L (Pi.single 1 1) := by + conv_lhs => rw [hv] + simp only [map_add, map_smul, smul_eq_mul] + rw [he, Real.norm_eq_abs] + calc + _ ≤ |v 0| * |L (Pi.single 0 1)| + |v 1| * |L (Pi.single 1 1)| := by + simpa only [abs_mul] using abs_add_le (v 0 * L (Pi.single 0 1)) + (v 1 * L (Pi.single 1 1)) + _ ≤ ‖v‖ * |L (Pi.single 0 1)| + ‖v‖ * |L (Pi.single 1 1)| := by + exact add_le_add + (mul_le_mul_of_nonneg_right (norm_le_pi_norm v 0) (abs_nonneg _)) + (mul_le_mul_of_nonneg_right (norm_le_pi_norm v 1) (abs_nonneg _)) + _ = _ := by ring + +def derivativeEnvelope (t R : ℝ) (y : Plane) : ℝ := + (shiftCoefficient t R ^ 2 / (2 * t)) * + (envelopeMoment t R (y 0) * envelopeCore t (y 1) + + envelopeCore t (y 0) * envelopeMoment t R (y 1)) + +private theorem integrable_product (f g : ℝ → ℝ) (hf : Integrable f) (hg : Integrable g) : + Integrable (fun y : Plane => f (y 0) * g (y 1)) := by + have hp := hf.mul_prod hg + exact (volume_preserving_finTwoArrow ℝ).integrable_comp_of_integrable hp + +theorem derivativeEnvelope_integrable {t : ℝ} (ht : 0 < t) (R : ℝ) : + Integrable (derivativeEnvelope t R) := by + exact ((integrable_product (envelopeMoment t R) (envelopeCore t) + (envelopeMoment_integrable ht R) (envelopeCore_integrable ht)).add + (integrable_product (envelopeCore t) (envelopeMoment t R) + (envelopeCore_integrable ht) (envelopeMoment_integrable ht R))).const_mul _ + +theorem kernel_fderiv_shift_le {t : ℝ} (ht : 0 < t) {R : ℝ} (hR : 0 ≤ R) + (z y : Plane) (hz : ∀ j, |z j| ≤ R) : + ‖fderiv ℝ (kernel t) (z - y)‖ ≤ derivativeEnvelope t R y := by + have h0 := oneDim_shift_le ht hR (hz 0) (y 0) + have h1 := oneDim_shift_le ht hR (hz 1) (y 1) + have hd0 := oneDimDerivative_shift_le ht hR (hz 0) (y 0) + have hd1 := oneDimDerivative_shift_le ht hR (hz 1) (y 1) + have ha0 : 0 ≤ shiftCoefficient t R * envelopeCore t (y 0) := + mul_nonneg (shiftCoefficient_nonneg t R) (le_of_lt (envelopeCore_pos t (y 0))) + calc + _ ≤ |kernelDerivative t 0 (z - y)| + |kernelDerivative t 1 (z - y)| := by + simpa only [kernel_fderiv_basis ht] using functional_norm_le (fderiv ℝ (kernel t) (z - y)) + _ = |oneDimDerivative t (z 0 - y 0)| * oneDim t (z 1 - y 1) + + oneDim t (z 0 - y 0) * |oneDimDerivative t (z 1 - y 1)| := by + rw [kernelDerivative_zero, kernelDerivative_one] + simp only [Pi.sub_apply, abs_mul, abs_of_nonneg (oneDim_nonneg _ _)] + _ ≤ ((shiftCoefficient t R / (2 * t)) * envelopeMoment t R (y 0)) * + (shiftCoefficient t R * envelopeCore t (y 1)) + + (shiftCoefficient t R * envelopeCore t (y 0)) * + ((shiftCoefficient t R / (2 * t)) * envelopeMoment t R (y 1)) := by + exact add_le_add + (mul_le_mul hd0 h1 (oneDim_nonneg _ _) ((abs_nonneg _).trans hd0)) + (mul_le_mul h0 hd1 (abs_nonneg _) ha0) + _ = _ := by unfold derivativeEnvelope; ring + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatLaplacian.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatLaplacian.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8aa3a966bce9838986b3cf4570ab9b05b6582fe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatLaplacian.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTransfer + +namespace OAI + +/-! Cartesian integration by parts for the Euclidean Gaussian. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem integral_cartesian (f : Plane → F) (hf : Integrable f) : + (∫ x, f x) = ∫ r : ℝ, ∫ s : ℝ, f ![r,s] := by + have hi := (volume_preserving_finTwoArrow ℝ).symm.integrable_comp_of_integrable hf + calc + _ = ∫ z : ℝ × ℝ, f ![z.1,z.2] := by + convert! (volume_preserving_finTwoArrow ℝ).symm.integral_comp' f |>.symm using 1 + _ = _ := by + exact integral_prod _ hi + +theorem integral_cartesian_symm (f : Plane → F) (hf : Integrable f) : + (∫ x, f x) = ∫ s : ℝ, ∫ r : ℝ, f ![r,s] := by + have hi := (volume_preserving_finTwoArrow ℝ).symm.integrable_comp_of_integrable hf + calc + _ = ∫ z : ℝ × ℝ, f ![z.1,z.2] := by + convert! (volume_preserving_finTwoArrow ℝ).symm.integral_comp' f |>.symm using 1 + _ = _ := by + exact integral_prod_symm _ hi + +private theorem product_data_integrable (w v : ℝ → ℝ) (hw : Integrable w) + (hv : Integrable v) (f : Plane → F) (hf : Continuous f) + (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) : + Integrable (fun x : Plane => (w (x 0) * v (x 1)) • f x) := + (product_integrable w v hw hv).smul_bdd C hf.aestronglyMeasurable (ae_of_all _ hC) + +/-- Integration by parts in the second Cartesian coordinate; hypotheses refer to +the actual one-variable slices of the data. -/ +theorem integral_second_one {t : ℝ} (ht : 0 < t) {f f' f'' : Plane → F} + (hf : Continuous f) (hf'' : Continuous f'') + (hd : ∀ r s, HasDerivAt (fun y => f ![r,y]) (f' ![r,s]) s) + (hdd : ∀ r s, HasDerivAt (fun y => f' ![r,y]) (f'' ![r,s]) s) + (C D E : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖f' x‖ ≤ D) + (hE : ∀ x, ‖f'' x‖ ≤ E) : + (∫ x : Plane, (oneDim t (x 0) * oneDimSecond t (x 1)) • f x) = + ∫ x : Plane, kernel t x • f'' x := by + rw [integral_cartesian F _ (product_data_integrable F _ _ (oneDim_integrable ht) + (oneDimSecond_integrable ht) f hf C hC)] + change _ = ∫ x : Plane, (oneDim t (x 0) * oneDim t (x 1)) • f'' x + rw [integral_cartesian F _ (product_data_integrable F _ _ (oneDim_integrable ht) + (oneDim_integrable ht) f'' hf'' E hE)] + apply integral_congr_ae + exact ae_of_all _ fun r => by + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, mul_smul] + rw [integral_smul, integral_smul] + congr 1 + apply gaussian_second_integral_by_parts F ht (hd r) (hdd r) + (hf''.comp (by fun_prop)) C D E + · intro s; exact hC ![r,s] + · intro s; exact hD ![r,s] + · intro s; exact hE ![r,s] + +theorem integral_second_zero {t : ℝ} (ht : 0 < t) {f f' f'' : Plane → F} + (hf : Continuous f) (hf'' : Continuous f'') + (hd : ∀ r s, HasDerivAt (fun y => f ![y,s]) (f' ![r,s]) r) + (hdd : ∀ r s, HasDerivAt (fun y => f' ![y,s]) (f'' ![r,s]) r) + (C D E : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖f' x‖ ≤ D) + (hE : ∀ x, ‖f'' x‖ ≤ E) : + (∫ x : Plane, (oneDimSecond t (x 0) * oneDim t (x 1)) • f x) = + ∫ x : Plane, kernel t x • f'' x := by + rw [integral_cartesian_symm F _ (product_data_integrable F _ _ (oneDimSecond_integrable ht) + (oneDim_integrable ht) f hf C hC)] + change _ = ∫ x : Plane, (oneDim t (x 0) * oneDim t (x 1)) • f'' x + rw [integral_cartesian_symm F _ (product_data_integrable F _ _ (oneDim_integrable ht) + (oneDim_integrable ht) f'' hf'' E hE)] + apply integral_congr_ae + exact ae_of_all _ fun s => by + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, + mul_comm _ (oneDim t s), mul_smul] + rw [integral_smul, integral_smul] + congr 1 + apply gaussian_second_integral_by_parts F ht (fun r => hd r s) (fun r => hdd r s) + (hf''.comp (by fun_prop)) C D E + · intro r; exact hC ![r,s] + · intro r; exact hD ![r,s] + · intro r; exact hE ![r,s] + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatOperator.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..efdd5038236c07f3d000f05214695ebb95176fde --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatOperator.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatKernel +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetConvolution + +namespace OAI + +/-! The normalized Gaussian and its first spatial derivatives act on every finite jet space. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open MeasureTheory ShearFlows +open scoped Topology + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +/-- The Gaussian heat operator on bounded spatial jets of order `k`. -/ +def heatOperator (k : ℕ) (t : ℝ) (ht : 0 < t) : + BoundedSpatialJets.Space Plane F k →L[ℝ] BoundedSpatialJets.Space Plane F k := + BoundedSpatialJets.convolutionCLM Plane F k volume (kernel t) (kernel_integrable ht) + +/-- Convolution by one Cartesian derivative of the Gaussian. -/ +def gradientOperator (k : ℕ) (t : ℝ) (ht : 0 < t) (j : Fin 2) : + BoundedSpatialJets.Space Plane F k →L[ℝ] BoundedSpatialJets.Space Plane F k := + BoundedSpatialJets.convolutionCLM Plane F k volume (kernelDerivative t j) + (kernelDerivative_integrable ht j) + +theorem norm_heatOperator_le (k : ℕ) (t : ℝ) (ht : 0 < t) : + ‖heatOperator F k t ht‖ ≤ 1 := by + have h := BoundedSpatialJets.norm_convolutionCLM_le Plane F k volume + (kernel t) (kernel_integrable ht) + have hm : BoundedSpatialJets.kernelMass Plane volume (kernel t) = 1 := by + unfold BoundedSpatialJets.kernelMass + simp_rw [abs_of_nonneg (kernel_nonneg t _)] + exact kernel_integral ht + simpa only [heatOperator, hm] using h + +theorem norm_gradientOperator_le (k : ℕ) (t : ℝ) (ht : 0 < t) (j : Fin 2) : + ‖gradientOperator F k t ht j‖ ≤ 2 / Real.sqrt t := + (BoundedSpatialJets.norm_convolutionCLM_le Plane F k volume + (kernelDerivative t j) (kernelDerivative_integrable ht j)).trans + (kernelDerivative_abs_integral_le ht j) + +/-- The zeroth component is the usual pointwise Gaussian convolution. -/ +theorem heatOperator_apply (k : ℕ) (t : ℝ) (ht : 0 < t) + (J : BoundedSpatialJets.Space Plane F k) (x : Plane) : + BoundedSpatialJets.function Plane F k (heatOperator F k t ht J) x = + ∫ y, kernel t y • BoundedSpatialJets.function Plane F k J (x - y) := + BoundedSpatialJets.function_convolution Plane F k volume (kernel t) + (kernel_integrable ht) J x + +theorem gradientOperator_apply (k : ℕ) (t : ℝ) (ht : 0 < t) (j : Fin 2) + (J : BoundedSpatialJets.Space Plane F k) (x : Plane) : + BoundedSpatialJets.function Plane F k (gradientOperator F k t ht j J) x = + ∫ y, kernelDerivative t j y • BoundedSpatialJets.function Plane F k J (x - y) := + BoundedSpatialJets.function_convolution Plane F k volume (kernelDerivative t j) + (kernelDerivative_integrable ht j) J x + +/-- Every supplied derivative is transported by the same Gaussian kernel. -/ +theorem heatOperator_jet (k : ℕ) (t : ℝ) (ht : 0 < t) + (J : BoundedSpatialJets.Space Plane F k) (i : Fin (k + 1)) (x : Plane) : + (heatOperator F k t ht J).val i x = ∫ y, kernel t y • J.val i (x - y) := rfl + +theorem gradientOperator_jet (k : ℕ) (t : ℝ) (ht : 0 < t) (j : Fin 2) + (J : BoundedSpatialJets.Space Plane F k) (i : Fin (k + 1)) (x : Plane) : + (gradientOperator F k t ht j J).val i x = + ∫ y, kernelDerivative t j y • J.val i (x - y) := rfl + +theorem norm_heatOperator_apply_le (k : ℕ) (t : ℝ) (ht : 0 < t) + (J : BoundedSpatialJets.Space Plane F k) : ‖heatOperator F k t ht J‖ ≤ ‖J‖ := by + calc + _ ≤ ‖heatOperator F k t ht‖ * ‖J‖ := (heatOperator F k t ht).le_opNorm J + _ ≤ 1 * ‖J‖ := mul_le_mul_of_nonneg_right (norm_heatOperator_le F k t ht) (norm_nonneg J) + _ = ‖J‖ := one_mul _ + +theorem norm_gradientOperator_apply_le (k : ℕ) (t : ℝ) (ht : 0 < t) (j : Fin 2) + (J : BoundedSpatialJets.Space Plane F k) : + ‖gradientOperator F k t ht j J‖ ≤ (2 / Real.sqrt t) * ‖J‖ := + ((gradientOperator F k t ht j).le_opNorm J).trans + (mul_le_mul_of_nonneg_right (norm_gradientOperator_le F k t ht j) (norm_nonneg J)) + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSmoothing.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSmoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d805c377779477be142c5a8d259e2790e8b68bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSmoothing.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatKernelBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedKernelConvolution +import Mathlib.Analysis.Convolution +import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap + +namespace OAI + +/-! Gaussian convolution differentiates bounded continuous data by differentiating the kernel. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- The symmetric form of heat convolution, convenient for differentiating the kernel. -/ +def heatConvolution (t : ℝ) (f : Plane → F) (x : Plane) : F := + ∫ y, kernel t (x - y) • f y + +theorem heatConvolution_eq (t : ℝ) (f : Plane → F) (x : Plane) : + heatConvolution F t f x = BoundedKernel.convolve Plane F volume (kernel t) f x := by + unfold heatConvolution BoundedKernel.convolve + rw [← integral_sub_left_eq_self _ volume x] + simp only [sub_sub_self] + +private theorem integrand_integrable {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + Integrable (fun y => kernel t (x - y) • f y) := by + have hi := BoundedKernel.integrand_integrable Plane F volume (kernel t) f + (kernel_integrable ht) hf C hC x + convert! hi.comp_sub_left x using 1 + simp only [sub_sub_self] + +private theorem derivativeIntegrand_continuous (t : ℝ) (f : Plane → F) + (hf : Continuous f) (x : Plane) : + Continuous (fun y => (fderiv ℝ (kernel t) (x - y)).smulRight (f y)) := by + have hk : Continuous (fderiv ℝ (kernel t)) := + (kernel_smooth t).continuous_fderiv (by simp) + exact ((ContinuousLinearMap.smulRightL ℝ Plane F).continuous.comp + (hk.comp (continuous_const.sub continuous_id))).clm_apply hf + +private theorem derivativeIntegrand_integrable {t : ℝ} (ht : 0 < t) + (f : Plane → F) (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + Integrable (fun y => (fderiv ℝ (kernel t) (x - y)).smulRight (f y)) := by + apply ((derivativeEnvelope_integrable ht (‖x‖ + 1)).mul_const C).mono' + (derivativeIntegrand_continuous F t f hf x).aestronglyMeasurable + exact ae_of_all _ fun y => by + rw [ContinuousLinearMap.norm_smulRight_apply] + apply mul_le_mul + · exact kernel_fderiv_shift_le ht (by positivity) x y fun j => + (norm_le_pi_norm x j).trans (by linarith) + · exact hC y + · exact norm_nonneg _ + · have h := kernel_fderiv_shift_le ht (by positivity : 0 ≤ ‖x‖ + 1) x y + (fun j => (norm_le_pi_norm x j).trans (by linarith)) + exact (norm_nonneg _).trans h + +/-- Differentiating under the integral is valid for bounded continuous data, without a +spatial derivative assumption on that data. -/ +theorem hasFDerivAt_heatConvolution {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + HasFDerivAt (heatConvolution F t f) + (∫ y, (fderiv ℝ (kernel t) (x - y)).smulRight (f y)) x := by + let R := ‖x‖ + 1 + have hR : 0 ≤ R := by dsimp [R]; positivity + have hcoord (z : Plane) (hz : z ∈ Metric.ball x 1) (j : Fin 2) : |z j| ≤ R := by + have hz' : ‖z - x‖ < 1 := by simpa only [Metric.mem_ball, dist_eq_norm] using hz + calc + |z j| ≤ ‖z‖ := norm_le_pi_norm z j + _ = ‖(z - x) + x‖ := by rw [sub_add_cancel] + _ ≤ ‖z - x‖ + ‖x‖ := norm_add_le _ _ + _ ≤ R := by dsimp [R]; linarith + refine hasFDerivAt_integral_of_dominated_of_fderiv_le + (μ := volume) (s := Metric.ball x 1) + (F' := fun z y => (fderiv ℝ (kernel t) (z - y)).smulRight (f y)) + (bound := fun y => derivativeEnvelope t R y * C) + (Metric.ball_mem_nhds x zero_lt_one) ?_ ?_ ?_ ?_ ?_ ?_ + · exact Eventually.of_forall fun z => (integrand_integrable F ht f hf C hC z).aestronglyMeasurable + · exact integrand_integrable F ht f hf C hC x + · exact (derivativeIntegrand_integrable F ht f hf C hC x).aestronglyMeasurable + · exact ae_of_all _ fun y z hz => by + rw [ContinuousLinearMap.norm_smulRight_apply] + have hk := kernel_fderiv_shift_le ht hR z y (hcoord z hz) + exact mul_le_mul hk (hC y) (norm_nonneg _) ((norm_nonneg _).trans hk) + · exact (derivativeEnvelope_integrable ht R).mul_const C + · exact ae_of_all _ fun y z _ => by + have h := (((kernel_smooth t).differentiable (by simp) (z - y)).hasFDerivAt.comp z + ((hasFDerivAt_id z).sub_const y)).smul_const (f y) + change HasFDerivAt (fun v => kernel t (v - y) • f y) _ z at h + simpa only [ContinuousLinearMap.comp_id, Function.comp_def, id_eq] using h + +/-- Each directional derivative is convolution against the corresponding integrable +Gaussian derivative. -/ +theorem fderiv_heatConvolution_basis {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) (j : Fin 2) : + fderiv ℝ (heatConvolution F t f) x (Pi.single j 1) = + BoundedKernel.convolve Plane F volume (kernelDerivative t j) f x := by + rw [(hasFDerivAt_heatConvolution F ht f hf C hC x).fderiv, + ContinuousLinearMap.integral_apply (derivativeIntegrand_integrable F ht f hf C hC x)] + simp_rw [ContinuousLinearMap.smulRight_apply, kernel_fderiv_basis ht] + unfold BoundedKernel.convolve + rw [← integral_sub_left_eq_self _ volume x] + simp only [sub_sub_self] + +theorem norm_fderiv_heatConvolution_basis_le {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) (j : Fin 2) : + ‖fderiv ℝ (heatConvolution F t f) x (Pi.single j 1)‖ ≤ C * (2 / Real.sqrt t) := by + rw [fderiv_heatConvolution_basis F ht f hf C hC] + apply (BoundedKernel.norm_convolve_le Plane F volume (kernelDerivative t j) f + (kernelDerivative_integrable ht j) hf C hC x).trans + exact mul_le_mul_of_nonneg_left (kernelDerivative_abs_integral_le ht j) + ((norm_nonneg (f 0)).trans (hC 0)) + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8dc3ea08e2263efeb784e651873d550dbfb55a9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceDerivative.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTimeLipschitz +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.VolterraDifferentiation + +namespace OAI + +/-! Differentiation of the actual inhomogeneous Gaussian heat integral. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows Set Filter MeasureTheory +open scoped Topology NNReal ContDiff Interval BigOperators + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +theorem hasDerivAt_heat_source {ν t : ℝ} (hν : 0 < ν) (ht : 0 < t) + (g : ℝ → Plane → F) (hg : ∀ s, ContDiff ℝ ∞ (g s)) + (L : ℝ≥0) (hL : ∀ s, LipschitzWith L (g s)) (C D E : ℝ) + (hC : ∀ s x, ‖g s x‖ ≤ C) + (hD : ∀ s j x, ‖spatialPartial F j (g s) x‖ ≤ D) + (hE : ∀ s j x, ‖spatialPartial F j (spatialPartial F j (g s)) x‖ ≤ E) + (x : Plane) + (hc : Continuous (fun p : ℝ × ℝ => evolution F (g p.2) (ν*(p.1-p.2)) x)) + (hdc : Continuous (fun s => ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x)) : + HasDerivAt (fun u => ∫ s in 0..u, evolution F (g s) (ν*(u-s)) x) + ((∫ s in 0..t, ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x) + g t x) t := by + have hE0 : 0 ≤ E := (norm_nonneg _).trans (hE 0 0 0) + have htime (s : ℝ) : LipschitzWith (Real.nnabs (2*E*ν)) + (fun r => evolution F (g s) (ν*(r-s)) x) := by + apply LipschitzWith.of_dist_le_mul + intro r u + have hh := (evolution_time_lipschitz F (hg s) (hL s) C D E + (hC s) (hD s) (hE s) x).dist_le_mul (ν*(r-s)) (ν*(u-s)) + convert! hh using 1 + simp only [Real.coe_nnabs, Real.dist_eq, ← mul_sub, sub_sub_sub_cancel_right, + abs_mul, abs_of_pos hν, abs_of_nonneg (by positivity : 0 ≤ 2*E)] + ring + have hd : HasDerivAt (fun u => ∫ s in 0..t, evolution F (g s) (ν*(u-s)) x) + (∫ s in 0..t, ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x) t := by + refine (intervalIntegral.hasDerivAt_integral_of_dominated_loc_of_lip + (μ := volume) (s := univ) (bound := fun _ => 2*E*ν) + (F' := fun s => ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x) + univ_mem ?_ ?_ hdc.aestronglyMeasurable.restrict ?_ ?_ ?_).2 + · exact Eventually.of_forall fun u => + (hc.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable.restrict + · exact (hc.comp (continuous_const.prodMk continuous_id)).intervalIntegrable 0 t + · exact ae_of_all _ fun s _ => (htime s).lipschitzOnWith + · exact intervalIntegrable_const + · filter_upwards [volume.ae_ne t] with s hs hst + rw [uIoc_of_le ht.le] at hst + have hst' : s < t := lt_of_le_of_ne hst.2 hs + have hh := (evolution_time_hasDerivAt_pos F (hg s) C D E + (hC s) (hD s) (hE s) (mul_pos hν (sub_pos.mpr hst')) x).scomp t + (((hasDerivAt_id t).sub_const s).const_mul ν) + convert! hh using 1 + simp only [mul_one] + apply congrArg (fun z : F => ν • z) + apply Finset.sum_congr rfl + intro j _ + rw [evolution, ite_eq_right (not_le.mpr (mul_pos hν (sub_pos.mpr hst')))] + convert! hasDerivAt_volterra_of_fixed F + (fun u s => evolution F (g s) (ν*(u-s)) x) hc 0 t _ hd using 1 + simp only [sub_self, mul_zero, evolution, le_refl, ite_true] + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a8cf85a8b86eb8acc715ce1ee0db6f8ee6eef1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceEquation.lean @@ -0,0 +1,148 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildDerivatives +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatSourceJetDerivative +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetIntegral + +namespace OAI + +/-! Spatial derivatives and the time equation of the actual Gaussian source integral. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff Interval BigOperators + +theorem heatSourcePath_directional {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (v : Plane) (q : WeaklySingular.Path (Jet (k+1)) T) : + directionalPath k v T (heatSourcePath hT hν (k+1) q) = + heatSourcePath hT hν k (directionalPath k v T q) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + change BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v + (heatSourcePath hT hν (k+1) q t) = _ + simp only [heatSourcePath_apply] + exact rawKernelIntegral_directional hT hν k v q 0 t + +theorem function_heatSourcePath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (q : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (heatSourcePath hT hν k q t) x = + ∫ s in 0..t.val, PlaneHeat.evolution ℝ + (BoundedSpatialJets.function Plane ℝ k (WeaklySingular.extendPath (Jet k) hT q s)) + (ν*(t.val-s)) x := by + rw [heatSourcePath_apply, BoundedSpatialJets.function_intervalIntegral] + · apply intervalIntegral.integral_congr_ae + filter_upwards [volume.ae_ne t.val] with s hs hst + rw [uIoc_of_le t.property.1] at hst + have hp : 0 < t.val-s := sub_pos.mpr (lt_of_le_of_ne hst.2 hs) + rw [rawHeatKernel_pos hν k hp, PlaneHeat.heatOperator_apply] + rw [PlaneHeat.evolution, ite_eq_right (not_le.mpr (mul_pos hν hp)), + PlaneHeat.heatConvolution_eq] + rfl + · exact rawKernel_path_integrable hT hν k q 0 t + +theorem spatialPartial_heatSourcePath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (j : Fin 2) (q : WeaklySingular.Path (Jet (k+1)) T) + (t : Icc (0 : ℝ) T) (x : Plane) : + PlaneHeat.spatialPartial ℝ j + (BoundedSpatialJets.function Plane ℝ (k+1) (heatSourcePath hT hν (k+1) q t)) x = + BoundedSpatialJets.function Plane ℝ k + (heatSourcePath hT hν k (directionalPath k (Pi.single j 1) T q) t) x := by + rw [← heatSourcePath_directional hT hν k (Pi.single j 1) q] + change _ = BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) + (heatSourcePath hT hν (k+1) q t)) x + exact (BoundedSpatialJets.function_directionalDerivativeCLM Plane ℝ k (Pi.single j 1) _ x).symm + +theorem spatialPartial_twice_heatSourcePath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (j : Fin 2) (q : WeaklySingular.Path (Jet (k+2)) T) + (t : Icc (0 : ℝ) T) (x : Plane) : + PlaneHeat.spatialPartial ℝ j (PlaneHeat.spatialPartial ℝ j + (BoundedSpatialJets.function Plane ℝ (k+2) (heatSourcePath hT hν (k+2) q t))) x = + BoundedSpatialJets.function Plane ℝ k + (heatSourcePath hT hν k + (directionalPath k (Pi.single j 1) T (directionalPath (k+1) (Pi.single j 1) T q)) t) x := by + have he := funext (spatialPartial_heatSourcePath hT hν (k+1) j q t) + rw [he] + exact spatialPartial_heatSourcePath hT hν k j _ t x + +/-- The bounded source is continued constantly in time outside the finite slab. -/ +def sourceValue {T : ℝ} (hT : 0 ≤ T) (k : ℕ) (q : WeaklySingular.Path (Jet k) T) + (s : ℝ) (x : Plane) : ℝ := + BoundedSpatialJets.function Plane ℝ k (WeaklySingular.extendPath (Jet k) hT q s) x + +/-- Scalar value of the source integral, with the same constant time continuation. -/ +def heatSourceValue {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (q : WeaklySingular.Path (Jet k) T) (s : ℝ) (x : Plane) : ℝ := + sourceValue hT k (heatSourcePath hT hν k q) s x + +theorem sourceValue_directional {T : ℝ} (hT : 0 ≤ T) (k : ℕ) (j : Fin 2) + (q : WeaklySingular.Path (Jet (k+1)) T) (s : ℝ) : + sourceValue hT k (directionalPath k (Pi.single j 1) T q) s = + PlaneHeat.spatialPartial ℝ j (sourceValue hT (k+1) q s) := by + funext x + unfold sourceValue + rw [extendPath_directional, BoundedSpatialJets.function_directionalDerivativeCLM] + rfl + +theorem sourceValue_twice_directional {T : ℝ} (hT : 0 ≤ T) (k : ℕ) (j : Fin 2) + (q : WeaklySingular.Path (Jet (k+2)) T) (s : ℝ) : + sourceValue hT k + (directionalPath k (Pi.single j 1) T (directionalPath (k+1) (Pi.single j 1) T q)) s = + PlaneHeat.spatialPartial ℝ j (PlaneHeat.spatialPartial ℝ j (sourceValue hT (k+2) q s)) := by + rw [sourceValue_directional, sourceValue_directional] + +theorem hasDerivAt_heatSourceValue {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (q : WeaklySingular.Path (Jet 3) T) + (hq : ∀ s, ContDiff ℝ ∞ (sourceValue hT 3 q s)) + {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) T) (x : Plane) : + HasDerivAt (fun s => heatSourceValue hT hν 3 q s x) + (ν * ∑ j : Fin 2, PlaneHeat.spatialPartial ℝ j + (PlaneHeat.spatialPartial ℝ j (heatSourceValue hT hν 3 q t)) x + sourceValue hT 3 q t x) t := by + let J : C(ℝ, Jet 3) := ⟨WeaklySingular.extendPath (Jet 3) hT q, + WeaklySingular.continuous_extendPath (Jet 3) hT q⟩ + have hd := PlaneHeat.hasDerivAt_heat_source_of_jets ℝ hν ht.1 + (sourceValue hT 3 q) hq J (fun _ _ => rfl) ‖q‖ + (WeaklySingular.norm_extendPath_le (Jet 3) hT q) x + have he : (fun s => heatSourceValue hT hν 3 q s x) =ᶠ[𝓝 t] + (fun s => ∫ r in 0..s, PlaneHeat.evolution ℝ (sourceValue hT 3 q r) (ν*(s-r)) x) := by + filter_upwards [isOpen_Ioo.mem_nhds ht] with s hs + unfold heatSourceValue sourceValue WeaklySingular.extendPath + rw [projIcc_of_mem hT ⟨hs.1.le, hs.2.le⟩, function_heatSourcePath] + rfl + have hder := hd.congr_of_eventuallyEq he + let d (j : Fin 2) : WeaklySingular.Path (Jet 1) T := + directionalPath 1 (Pi.single j 1) T (directionalPath 2 (Pi.single j 1) T q) + have hj (j : Fin 2) : Continuous (fun s => + PlaneHeat.evolution ℝ (PlaneHeat.spatialPartial ℝ j + (PlaneHeat.spatialPartial ℝ j (sourceValue hT 3 q s))) (ν*(t-s)) x) := by + have hm : Continuous (fun s : ℝ => (ν*(t-s), WeaklySingular.extendPath (Jet 1) hT (d j) s)) := + (continuous_const.mul (continuous_const.sub continuous_id)).prodMk + (WeaklySingular.continuous_extendPath (Jet 1) hT (d j)) + have hh := (PlaneHeat.appliedHeat_joint_continuous ℝ x).comp hm + simp only [Function.comp_def, PlaneHeat.appliedHeat_eq] at hh + change Continuous (fun s => PlaneHeat.evolution ℝ (sourceValue hT 1 (d j) s) (ν*(t-s)) x) at hh + simpa only [d, sourceValue_twice_directional] using hh + have hl (j : Fin 2) : + PlaneHeat.spatialPartial ℝ j (PlaneHeat.spatialPartial ℝ j + (heatSourceValue hT hν 3 q t)) x = + ∫ s in 0..t, PlaneHeat.evolution ℝ (PlaneHeat.spatialPartial ℝ j + (PlaneHeat.spatialPartial ℝ j (sourceValue hT 3 q s))) (ν*(t-s)) x := by + have heval : heatSourceValue hT hν 3 q t = + BoundedSpatialJets.function Plane ℝ 3 + (heatSourcePath hT hν 3 q ⟨t, ht.1.le, ht.2.le⟩) := by + funext y + simp only [heatSourceValue, sourceValue, WeaklySingular.extendPath, + projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] + rw [heval, spatialPartial_twice_heatSourcePath, function_heatSourcePath] + change (∫ s in 0..t, PlaneHeat.evolution ℝ (sourceValue hT 1 (d j) s) (ν*(t-s)) x) = _ + simp only [d, sourceValue_twice_directional] + convert hder using 1 + rw [intervalIntegral.integral_smul, intervalIntegral.integral_finsetSum + (fun j _ => (hj j).intervalIntegrable 0 t)] + simp only [smul_eq_mul, hl] + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceJetDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceJetDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..e773ad1e8a15197f9e26ee69a9d27be6023fea6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatSourceJetDerivative.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatSourceDerivative +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatAppliedContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetLinear + +namespace OAI + +/-! Continuous bounded source jets supply all hypotheses for Gaussian source differentiation. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open ShearFlows Set Filter MeasureTheory +open scoped Topology NNReal ContDiff Interval BigOperators + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +theorem hasDerivAt_heat_source_of_jets {ν t : ℝ} (hν : 0 < ν) (ht : 0 < t) + (g : ℝ → Plane → F) (hg : ∀ s, ContDiff ℝ ∞ (g s)) + (J : C(ℝ, BoundedSpatialJets.Space Plane F 3)) + (hJ : ∀ s x, BoundedSpatialJets.function Plane F 3 (J s) x = g s x) + (B : ℝ) (hB : ∀ s, ‖J s‖ ≤ B) (x : Plane) : + HasDerivAt (fun u => ∫ s in 0..u, evolution F (g s) (ν*(u-s)) x) + ((∫ s in 0..t, ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x) + g t x) t := by + let P := BoundedSpatialJets.truncateCLM Plane F 1 3 (by omega) + let Q (j : Fin 2) := BoundedSpatialJets.directionalDerivativeCLM Plane F 2 (Pi.single j 1) + let R (j : Fin 2) := BoundedSpatialJets.directionalDerivativeCLM Plane F 1 (Pi.single j 1) + have hfun (s : ℝ) : (BoundedSpatialJets.function Plane F 3 (J s) : Plane → F) = g s := by + funext y + exact hJ s y + have hfirst (s : ℝ) (j : Fin 2) : + (BoundedSpatialJets.function Plane F 2 (Q j (J s)) : Plane → F) = + spatialPartial F j (g s) := by + funext y + change BoundedSpatialJets.function Plane F 2 + (BoundedSpatialJets.directionalDerivativeCLM Plane F 2 (Pi.single j 1) (J s)) y = _ + rw [BoundedSpatialJets.function_directionalDerivativeCLM, hfun] + rfl + have hsecond (s : ℝ) (j : Fin 2) : + (BoundedSpatialJets.function Plane F 1 (R j (Q j (J s))) : Plane → F) = + spatialPartial F j (spatialPartial F j (g s)) := by + funext y + change BoundedSpatialJets.function Plane F 1 + (BoundedSpatialJets.directionalDerivativeCLM Plane F 1 (Pi.single j 1) (Q j (J s))) y = _ + rw [BoundedSpatialJets.function_directionalDerivativeCLM, hfirst] + rfl + have hnormQ (j : Fin 2) : ‖Q j‖ ≤ 1 := by + simpa only [Q, Pi.norm_single, norm_one] using + BoundedSpatialJets.norm_directionalDerivativeCLM_le Plane F 2 (Pi.single j 1) + have hnormR (j : Fin 2) : ‖R j‖ ≤ 1 := by + simpa only [R, Pi.norm_single, norm_one] using + BoundedSpatialJets.norm_directionalDerivativeCLM_le Plane F 1 (Pi.single j 1) + have hQ (s : ℝ) (j : Fin 2) : ‖Q j (J s)‖ ≤ B := + ((Q j).le_opNorm _).trans ((mul_le_mul_of_nonneg_right (hnormQ j) (norm_nonneg _)).trans + (by simpa only [one_mul] using hB s)) + have hR (s : ℝ) (j : Fin 2) : ‖R j (Q j (J s))‖ ≤ B := + ((R j).le_opNorm _).trans ((mul_le_mul_of_nonneg_right (hnormR j) (norm_nonneg _)).trans + (by simpa only [one_mul] using hQ s j)) + have hB0 : 0 ≤ B := (norm_nonneg _).trans (hB 0) + have hC (s : ℝ) (y : Plane) : ‖g s y‖ ≤ B := by + rw [← hJ s y] + exact (BoundedSpatialJets.norm_function_le Plane F 3 _ y).trans (hB s) + have hD (s : ℝ) (j : Fin 2) (y : Plane) : ‖spatialPartial F j (g s) y‖ ≤ B := by + rw [← hfirst s j] + exact (BoundedSpatialJets.norm_function_le Plane F 2 _ y).trans (hQ s j) + have hE (s : ℝ) (j : Fin 2) (y : Plane) : + ‖spatialPartial F j (spatialPartial F j (g s)) y‖ ≤ B := by + rw [← hsecond s j] + exact (BoundedSpatialJets.norm_function_le Plane F 1 _ y).trans (hR s j) + have hP (s : ℝ) : (BoundedSpatialJets.function Plane F 1 (P (J s)) : Plane → F) = g s := by + funext y + change BoundedSpatialJets.function Plane F 1 + (BoundedSpatialJets.truncate Plane F 1 3 (by omega) (J s)) y = _ + rw [BoundedSpatialJets.function_truncate, hJ] + have hL (s : ℝ) : LipschitzWith ⟨B, hB0⟩ (g s) := by + have hl := (BoundedSpatialJets.valueMap Plane F).lipschitz.comp + (jet_lipschitz F 0 (P (J s)) 0) + have he : (fun y => BoundedSpatialJets.valueMap Plane F ((P (J s)).val 0 y)) = g s := by + exact hP s + simp only [one_mul] at hl + change LipschitzWith ‖P (J s)‖₊ + (fun y => BoundedSpatialJets.valueMap Plane F ((P (J s)).val 0 y)) at hl + rw [he] at hl + apply hl.weaken + change ‖P (J s)‖ ≤ B + exact (BoundedSpatialJets.norm_truncate_le Plane F 1 3 (by omega) (J s)).trans (hB s) + have hc : Continuous (fun p : ℝ × ℝ => evolution F (g p.2) (ν*(p.1-p.2)) x) := by + have hm : Continuous (fun p : ℝ × ℝ => (ν*(p.1-p.2), P (J p.2))) := + (continuous_const.mul (continuous_fst.sub continuous_snd)).prodMk + (P.continuous.comp (J.continuous.comp continuous_snd)) + have hh := (appliedHeat_joint_continuous F x).comp hm + simpa only [Function.comp_def, appliedHeat_eq, hP] using hh + have hdc : Continuous (fun s => ν • ∑ j : Fin 2, + evolution F (spatialPartial F j (spatialPartial F j (g s))) (ν*(t-s)) x) := by + apply Continuous.const_smul + apply continuous_finsetSum + intro j _ + have hm : Continuous (fun s : ℝ => (ν*(t-s), R j (Q j (J s)))) := + (continuous_const.mul (continuous_const.sub continuous_id)).prodMk + ((R j).continuous.comp ((Q j).continuous.comp J.continuous)) + have hh := (appliedHeat_joint_continuous F x).comp hm + simpa only [Function.comp_def, appliedHeat_eq, hsecond] using hh + exact hasDerivAt_heat_source F hν ht g hg ⟨B, hB0⟩ hL B B B hC hD hE x hc hdc + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d771138417640c43196b6f9f48a3d81ce9d49541 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeContinuity.lean @@ -0,0 +1,196 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatOperator +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetKernelDependence + +namespace OAI + +/-! Operator-norm continuity of Gaussian heat operators at every strictly positive time. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff + +def timeCore (b y : ℝ) : ℝ := Real.exp (-(4 * b)⁻¹ * y ^ 2) +def timeCoefficient (a : ℝ) : ℝ := (Real.sqrt (4 * Real.pi * a))⁻¹ +def timeEnvelope (a b : ℝ) (y : Plane) : ℝ := + timeCoefficient a ^ 2 * (timeCore b (y 0) * timeCore b (y 1)) +private def timeDerivativeEnvelope (a b : ℝ) (j : Fin 2) (y : Plane) : ℝ := + (|y j| / (2 * a)) * timeEnvelope a b y + +theorem oneDim_time_le {a b s : ℝ} (ha : 0 < a) (has : a ≤ s) (hsb : s ≤ b) + (y : ℝ) : oneDim s y ≤ timeCoefficient a * timeCore b y := by + have hs : 0 < s := ha.trans_le has + have hn : (Real.sqrt (4 * Real.pi * s))⁻¹ ≤ timeCoefficient a := by + unfold timeCoefficient + simpa only [one_div] using (show (1 / Real.sqrt (4 * Real.pi * s)) ≤ + 1 / Real.sqrt (4 * Real.pi * a) from + one_div_le_one_div_of_le (Real.sqrt_pos.mpr (by positivity)) + (Real.sqrt_le_sqrt (by nlinarith [Real.pi_pos]))) + have hi : (4 * b)⁻¹ ≤ (4 * s)⁻¹ := by + simpa only [one_div] using one_div_le_one_div_of_le + (by positivity : 0 < 4 * s) (by linarith : 4 * s ≤ 4 * b) + have he : -(4 * s)⁻¹ * y ^ 2 ≤ -(4 * b)⁻¹ * y ^ 2 := by + nlinarith [mul_le_mul_of_nonneg_right hi (sq_nonneg y)] + exact mul_le_mul hn (Real.exp_le_exp.mpr he) (le_of_lt (Real.exp_pos _)) + (by unfold timeCoefficient; positivity) + +theorem kernel_time_le {a b s : ℝ} (ha : 0 < a) (has : a ≤ s) (hsb : s ≤ b) + (y : Plane) : kernel s y ≤ timeEnvelope a b y := by + have h0 := oneDim_time_le ha has hsb (y 0) + have h1 := oneDim_time_le ha has hsb (y 1) + calc + _ ≤ (timeCoefficient a * timeCore b (y 0)) * + (timeCoefficient a * timeCore b (y 1)) := + mul_le_mul h0 h1 (oneDim_nonneg _ _) ((oneDim_nonneg _ _).trans h0) + _ = _ := by unfold timeEnvelope; ring + +private theorem derivative_time_le {a b s : ℝ} (ha : 0 < a) (has : a ≤ s) (hsb : s ≤ b) + (j : Fin 2) (y : Plane) : |kernelDerivative s j y| ≤ timeDerivativeEnvelope a b j y := by + have hs : 0 < s := ha.trans_le has + rw [kernelDerivative, abs_mul, abs_neg, abs_div, abs_of_pos (by positivity : 0 < 2 * s), + abs_of_nonneg (kernel_nonneg _ _)] + exact mul_le_mul + (div_le_div_of_nonneg_left (abs_nonneg _) (by positivity) (by linarith : 2 * a ≤ 2 * s)) + (kernel_time_le ha has hsb y) (kernel_nonneg _ _) (by positivity) + +theorem timeCore_integrable {b : ℝ} (hb : 0 < b) : Integrable (timeCore b) := + integrable_exp_neg_mul_sq (by positivity) + +private theorem timeMoment_integrable {b : ℝ} (hb : 0 < b) : + Integrable (fun y : ℝ => |y| * timeCore b y) := by + simpa only [Real.norm_eq_abs, abs_mul, abs_of_pos (Real.exp_pos _), timeCore] using + (integrable_mul_exp_neg_mul_sq (by positivity : 0 < (4 * b)⁻¹)).norm + +theorem product_integrable (f g : ℝ → ℝ) (hf : Integrable f) (hg : Integrable g) : + Integrable (fun y : Plane => f (y 0) * g (y 1)) := + (volume_preserving_finTwoArrow ℝ).integrable_comp_of_integrable (hf.mul_prod hg) + +theorem timeEnvelope_integrable (a : ℝ) {b : ℝ} (hb : 0 < b) : + Integrable (timeEnvelope a b) := + (product_integrable (timeCore b) (timeCore b) (timeCore_integrable hb) + (timeCore_integrable hb)).const_mul _ + +private theorem timeDerivativeEnvelope_integrable (a : ℝ) {b : ℝ} (hb : 0 < b) + (j : Fin 2) : Integrable (timeDerivativeEnvelope a b j) := by + fin_cases j + · have h := (product_integrable (fun y => |y| * timeCore b y) (timeCore b) + (timeMoment_integrable hb) (timeCore_integrable hb)).const_mul + (timeCoefficient a ^ 2 / (2 * a)) + convert! h using 1 + funext y + simp only [timeDerivativeEnvelope, timeEnvelope, Fin.reduceFinMk] + ring + · have h := (product_integrable (timeCore b) (fun y => |y| * timeCore b y) + (timeCore_integrable hb) (timeMoment_integrable hb)).const_mul + (timeCoefficient a ^ 2 / (2 * a)) + convert! h using 1 + funext y + simp only [timeDerivativeEnvelope, timeEnvelope, Fin.reduceFinMk] + ring + +private theorem oneDim_time_continuousAt {t : ℝ} (ht : 0 < t) (y : ℝ) : + ContinuousAt (fun s => oneDim s y) t := by + unfold oneDim + fun_prop (disch := positivity) + +private theorem kernel_time_continuousAt {t : ℝ} (ht : 0 < t) (y : Plane) : + ContinuousAt (fun s => kernel s y) t := + (oneDim_time_continuousAt ht (y 0)).mul (oneDim_time_continuousAt ht (y 1)) + +private theorem derivative_time_continuousAt {t : ℝ} (ht : 0 < t) (j : Fin 2) (y : Plane) : + ContinuousAt (fun s => kernelDerivative s j y) t := by + unfold kernelDerivative + have hd : ContinuousAt (fun s : ℝ => (2 : ℝ) * s) t := + continuousAt_const.mul continuousAt_id + have hq : ContinuousAt (fun s : ℝ => y j / (2 * s)) t := + continuousAt_const.div hd (mul_ne_zero (by norm_num) ht.ne') + exact hq.neg.mul (kernel_time_continuousAt ht y) + +/-- Gaussian kernels are continuous in L1 at every strictly positive time. -/ +theorem kernel_l1_tendsto {t : ℝ} (ht : 0 < t) : + Tendsto (fun s => ∫ y, |kernel s y - kernel t y|) (𝓝 t) (𝓝 0) := by + let a := t / 2 + let b := 2 * t + have ha : 0 < a := by dsimp [a]; positivity + have hb : 0 < b := by dsimp [b]; positivity + have hat : a < t := by dsimp [a]; linarith + have htb : t < b := by dsimp [b]; linarith + have hI : Ioo a b ∈ 𝓝 t := Ioo_mem_nhds hat htb + have hc : ContinuousAt (fun s => ∫ y, |kernel s y - kernel t y|) t := by + apply continuousAt_of_dominated (bound := fun y => 2 * timeEnvelope a b y) + · exact Eventually.of_forall fun s => + (((kernel_smooth s).continuous.sub (kernel_smooth t).continuous).abs).aestronglyMeasurable + · filter_upwards [hI] with s hs + exact ae_of_all _ fun y => by + simp only [Real.norm_eq_abs, abs_abs] + calc + _ ≤ |kernel s y| + |kernel t y| := abs_sub _ _ + _ = kernel s y + kernel t y := by + rw [abs_of_nonneg (kernel_nonneg _ _), abs_of_nonneg (kernel_nonneg _ _)] + _ ≤ timeEnvelope a b y + timeEnvelope a b y := + add_le_add (kernel_time_le ha hs.1.le hs.2.le y) + (kernel_time_le ha hat.le htb.le y) + _ = _ := by ring + · exact (timeEnvelope_integrable a hb).const_mul 2 + · exact ae_of_all _ fun y => + ((kernel_time_continuousAt ht y).sub continuousAt_const).abs + simpa only [ContinuousAt, sub_self, abs_zero, integral_zero] using hc + +/-- The Cartesian Gaussian derivatives are also continuous in L1 at positive time. -/ +theorem kernelDerivative_l1_tendsto {t : ℝ} (ht : 0 < t) (j : Fin 2) : + Tendsto (fun s => ∫ y, |kernelDerivative s j y - kernelDerivative t j y|) (𝓝 t) (𝓝 0) := by + let a := t / 2 + let b := 2 * t + have ha : 0 < a := by dsimp [a]; positivity + have hb : 0 < b := by dsimp [b]; positivity + have hat : a < t := by dsimp [a]; linarith + have htb : t < b := by dsimp [b]; linarith + have hI : Ioo a b ∈ 𝓝 t := Ioo_mem_nhds hat htb + have hspace (s : ℝ) : Continuous (kernelDerivative s j) := by + change Continuous (fun y : Plane => -(y j / (2 * s)) * kernel s y) + convert! ((continuous_apply j).div_const (2 * s)).neg.mul (kernel_smooth s).continuous using 1 + have hc : ContinuousAt (fun s => ∫ y, |kernelDerivative s j y - kernelDerivative t j y|) t := by + apply continuousAt_of_dominated (bound := fun y => 2 * timeDerivativeEnvelope a b j y) + · exact Eventually.of_forall fun s => ((hspace s).sub (hspace t)).abs.aestronglyMeasurable + · filter_upwards [hI] with s hs + exact ae_of_all _ fun y => by + simp only [Real.norm_eq_abs, abs_abs] + calc + _ ≤ |kernelDerivative s j y| + |kernelDerivative t j y| := abs_sub _ _ + _ ≤ timeDerivativeEnvelope a b j y + timeDerivativeEnvelope a b j y := + add_le_add (derivative_time_le ha hs.1.le hs.2.le j y) + (derivative_time_le ha hat.le htb.le j y) + _ = _ := by ring + · exact (timeDerivativeEnvelope_integrable a hb j).const_mul 2 + · exact ae_of_all _ fun y => + ((derivative_time_continuousAt ht j y).sub continuousAt_const).abs + simpa only [ContinuousAt, sub_self, abs_zero, integral_zero] using hc + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +/-- Heat operators depend continuously on positive time in the operator norm on C_b^k. -/ +theorem continuous_heatOperator (k : ℕ) : + Continuous (fun t : {t : ℝ // 0 < t} => heatOperator F k t.val t.property) := by + apply continuous_iff_continuousAt.mpr + intro t + exact BoundedSpatialJets.tendsto_convolutionCLM Plane F (𝓝 t) k volume + (fun s : {s : ℝ // 0 < s} => kernel s.val) (kernel t.val) + (fun s => kernel_integrable s.property) (kernel_integrable t.property) + ((kernel_l1_tendsto t.property).comp continuous_subtype_val.continuousAt) + +/-- The singular gradient bound causes no loss of operator continuity away from time zero. -/ +theorem continuous_gradientOperator (k : ℕ) (j : Fin 2) : + Continuous (fun t : {t : ℝ // 0 < t} => gradientOperator F k t.val t.property j) := by + apply continuous_iff_continuousAt.mpr + intro t + exact BoundedSpatialJets.tendsto_convolutionCLM Plane F (𝓝 t) k volume + (fun s : {s : ℝ // 0 < s} => kernelDerivative s.val j) (kernelDerivative t.val j) + (fun s => kernelDerivative_integrable s.property j) (kernelDerivative_integrable t.property j) + ((kernelDerivative_l1_tendsto t.property j).comp continuous_subtype_val.continuousAt) + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..2de474f4f51999f9ab40ef6edfca5edadec9d1aa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeDerivative.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTimeContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatSmoothing + +namespace OAI + +/-! Time differentiation of Gaussian convolution on bounded continuous data. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat + +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff BigOperators + +def timeSecondEnvelope (a b : ℝ) (j : Fin 2) (y : Plane) : ℝ := + (y j ^ 2 / (4*a^2) + 1/(2*a)) * timeEnvelope a b y + +theorem kernelSecond_time_le {a b s : ℝ} (ha : 0 < a) (has : a ≤ s) + (hsb : s ≤ b) (j : Fin 2) (y : Plane) : + |kernelSecond s j y| ≤ timeSecondEnvelope a b j y := by + have hs : 0 < s := ha.trans_le has + have hq : y j ^ 2 / (4*s^2) ≤ y j ^ 2 / (4*a^2) := by + apply div_le_div_of_nonneg_left (sq_nonneg _) (by positivity) + nlinarith + have hr : 1/(2*s) ≤ 1/(2*a) := + one_div_le_one_div_of_le (by positivity) (by linarith) + rw [kernelSecond, abs_mul, abs_of_nonneg (kernel_nonneg _ _)] + apply mul_le_mul _ (kernel_time_le ha has hsb y) (kernel_nonneg _ _) (by positivity) + calc + _ ≤ |y j ^ 2 / (4*s^2)| + |1/(2*s)| := abs_sub _ _ + _ = y j ^ 2 / (4*s^2) + 1/(2*s) := by + rw [abs_of_nonneg (by positivity), abs_of_nonneg (by positivity)] + _ ≤ _ := add_le_add hq hr + +theorem timeMomentTwo_integrable {b : ℝ} (hb : 0 < b) : + Integrable (fun y : ℝ => y^2 * timeCore b y) := by + simpa only [Real.rpow_two, timeCore] using + (integrable_rpow_mul_exp_neg_mul_sq (by positivity : 0 < (4*b)⁻¹) + (by norm_num : (-1:ℝ) < 2)) + +theorem timeSecondEnvelope_integrable (a : ℝ) {b : ℝ} (hb : 0 < b) (j : Fin 2) : + Integrable (timeSecondEnvelope a b j) := by + have hm : Integrable (fun y : Plane => y j ^ 2 * timeEnvelope a b y) := by + fin_cases j + · convert! (product_integrable (fun y => y^2 * timeCore b y) (timeCore b) + (timeMomentTwo_integrable hb) (timeCore_integrable hb)).const_mul + (timeCoefficient a ^ 2) using 1 + funext y + dsimp [timeEnvelope] + ring + · convert! (product_integrable (timeCore b) (fun y => y^2 * timeCore b y) + (timeCore_integrable hb) (timeMomentTwo_integrable hb)).const_mul + (timeCoefficient a ^ 2) using 1 + funext y + dsimp [timeEnvelope] + ring + convert! (hm.div_const (4*a^2)).add ((timeEnvelope_integrable a hb).const_mul (1/(2*a))) + using 1 + funext y + dsimp [timeSecondEnvelope] + ring + +theorem kernelSecond_continuous (t : ℝ) (j : Fin 2) : Continuous (kernelSecond t j) := by + unfold kernelSecond + exact (((continuous_apply j).pow 2).div_const _ |>.sub continuous_const).mul + (kernel_smooth t).continuous + +theorem kernelSecond_integrable {t : ℝ} (ht : 0 < t) (j : Fin 2) : + Integrable (kernelSecond t j) := by + apply (timeSecondEnvelope_integrable t ht j).mono' + (kernelSecond_continuous t j).aestronglyMeasurable + exact ae_of_all _ fun y => by + simpa only [Real.norm_eq_abs] using kernelSecond_time_le ht le_rfl le_rfl j y + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] + +private theorem timeIntegrand_integrable {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + Integrable (fun y => kernel t (x-y) • f y) := by + have hi := BoundedKernel.integrand_integrable Plane F volume (kernel t) f + (kernel_integrable ht) hf C hC x + convert! hi.comp_sub_left x using 1 + simp only [sub_sub_self] + +theorem hasDerivAt_heatConvolution {t : ℝ} (ht : 0 < t) (f : Plane → F) + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + HasDerivAt (fun s => heatConvolution F s f x) + (∫ y, (∑ j : Fin 2, kernelSecond t j (x-y)) • f y) t := by + let a := t/2 + let b := 2*t + have ha : 0 < a := by dsimp [a]; positivity + have hb : 0 < b := by dsimp [b]; positivity + have hat : a < t := by dsimp [a]; linarith + have htb : t < b := by dsimp [b]; linarith + have hI : Ioo a b ∈ 𝓝 t := Ioo_mem_nhds hat htb + have hc (s : ℝ) : Continuous (fun y => (∑ j : Fin 2, kernelSecond s j (x-y)) • f y) := + (continuous_finsetSum _ (fun j _ => + (kernelSecond_continuous s j).comp (continuous_const.sub continuous_id))).smul hf + refine (hasDerivAt_integral_of_dominated_loc_of_deriv_le + (μ := volume) (s := Ioo a b) + (F' := fun s y => (∑ j : Fin 2, kernelSecond s j (x-y)) • f y) + (bound := fun y => (∑ j : Fin 2, timeSecondEnvelope a b j (x-y)) * C) + hI ?_ (timeIntegrand_integrable F ht f hf C hC x) + (hc t).aestronglyMeasurable ?_ ?_ ?_).2 + · exact Eventually.of_forall fun s => + (((kernel_smooth s).continuous.comp (continuous_const.sub continuous_id)).smul hf).aestronglyMeasurable + · exact ae_of_all _ fun y s hs => by + rw [norm_smul] + apply mul_le_mul _ (hC y) (norm_nonneg _) (by + apply Finset.sum_nonneg + intro j _ + dsimp [timeSecondEnvelope, timeEnvelope, timeCoefficient, timeCore] + positivity) + calc + ‖∑ j : Fin 2, kernelSecond s j (x-y)‖ ≤ + ∑ j : Fin 2, ‖kernelSecond s j (x-y)‖ := norm_sum_le _ _ + _ ≤ _ := Finset.sum_le_sum fun j _ => by + simpa only [Real.norm_eq_abs] using + kernelSecond_time_le ha hs.1.le hs.2.le j (x-y) + · exact ((integrable_finsetSum _ (fun j _ => + (timeSecondEnvelope_integrable a hb j).comp_sub_left x))).mul_const C + · exact ae_of_all _ fun y s hs => + (kernel_time_hasDerivAt (ha.trans hs.1) (x-y)).smul_const (f y) + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeLipschitz.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..8897625071c2af19c3884a62ebbed258d19ce2fd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTimeLipschitz.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatDataEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatInitialContinuity + +namespace OAI + +/-! Uniform time Lipschitz bounds for bounded smooth Gaussian evolutions. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff BigOperators NNReal + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +omit [CompleteSpace F] in +theorem norm_heatConvolution_le {t : ℝ} (ht : 0 < t) {f : Plane → F} + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + ‖heatConvolution F t f x‖ ≤ C := by + rw [heatConvolution_eq] + have h := BoundedKernel.norm_convolve_le Plane F volume (kernel t) f + (kernel_integrable ht) hf C hC x + simpa only [abs_of_nonneg (kernel_nonneg t _), kernel_integral ht, mul_one] using h + +omit [CompleteSpace F] in +theorem evolution_time_hasDerivAt_pos {f : Plane → F} (hf : ContDiff ℝ ∞ f) + (C D E : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) + (hD : ∀ j x, ‖spatialPartial F j f x‖ ≤ D) + (hE : ∀ j x, ‖spatialPartial F j (spatialPartial F j f) x‖ ≤ E) + {t : ℝ} (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => evolution F f s x) + (∑ j : Fin 2, heatConvolution F t (spatialPartial F j (spatialPartial F j f)) x) t := by + apply (hasDerivAt_heatConvolution_data F ht hf C D E hC hD hE x).congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds ht] with s hs + exact ite_eq_right (not_le.mpr hs) + +theorem evolution_time_continuous {f : Plane → F} + {L : ℝ≥0} (hL : LipschitzWith L f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (x : Plane) : + Continuous (fun t => evolution F f t x) := by + apply continuous_iff_continuousAt.mpr + intro t + rcases lt_trichotomy t 0 with ht | rfl | ht + · apply (show ContinuousAt (fun _ : ℝ => f x) t from continuousAt_const).congr + filter_upwards [Iio_mem_nhds ht] with s hs + change s < 0 at hs + exact (ite_eq_left hs.le).symm + · apply continuousAt_iff_continuous_left'_right'.mpr + constructor + · apply continuousWithinAt_const.congr + · intro s hs + change s < 0 at hs + exact ite_eq_left hs.le + · exact ite_eq_left le_rfl + · change Tendsto (fun t => evolution F f t x) (𝓝[>] 0) (𝓝 (evolution F f 0 x)) + simpa only [evolution, ite_eq_left le_rfl] using + (evolution_tendsto_uniformly F hL C hC).tendsto_at x + · apply (hasDerivAt_heatConvolution F ht f hL.continuous C hC x).continuousAt.congr + filter_upwards [Ioi_mem_nhds ht] with s hs + change 0 < s at hs + exact (ite_eq_right (not_le.mpr hs)).symm + +theorem evolution_time_lipschitz {f : Plane → F} (hf : ContDiff ℝ ∞ f) + {L : ℝ≥0} (hL : LipschitzWith L f) (C D E : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) + (hD : ∀ j x, ‖spatialPartial F j f x‖ ≤ D) + (hE : ∀ j x, ‖spatialPartial F j (spatialPartial F j f) x‖ ≤ E) (x : Plane) : + LipschitzWith (Real.nnabs (2*E)) (fun t => evolution F f t x) := by + have hE0 : 0 ≤ E := (norm_nonneg _).trans (hE 0 0) + have hpos : LipschitzOnWith (Real.nnabs (2*E)) (fun t => evolution F f t x) (Ioi 0) := by + apply (convex_Ioi (0:ℝ)).lipschitzOnWith_of_nnnorm_hasDerivWithin_le + (fun t ht => (evolution_time_hasDerivAt_pos F hf C D E hC hD hE ht x).hasDerivWithinAt) + intro t ht + rw [← NNReal.coe_le_coe, coe_nnnorm, Real.coe_nnabs, abs_of_nonneg (by positivity : 0 ≤ 2*E)] + calc + _ ≤ ∑ j : Fin 2, ‖heatConvolution F t (spatialPartial F j (spatialPartial F j f)) x‖ := + norm_sum_le _ _ + _ ≤ ∑ _j : Fin 2, E := Finset.sum_le_sum fun j _ => + norm_heatConvolution_le F ht (partial_smooth F (partial_smooth F hf j) j).continuous E (hE j) x + _ = 2*E := by simp + have hclosed : LipschitzOnWith (Real.nnabs (2*E)) (fun t => evolution F f t x) (Ici 0) := by + have h := LipschitzOnWith.closure + (show ContinuousOn (fun t => evolution F f t x) (closure (Ioi (0:ℝ))) from + (evolution_time_continuous F hL C hC x).continuousOn) hpos + simpa only [closure_Ioi] using h + have he (t : ℝ) : evolution F f (max t 0) x = evolution F f t x := by + by_cases ht : 0 ≤ t + · rw [max_eq_left ht] + · rw [max_eq_right (le_of_not_ge ht)] + simp only [evolution, ite_eq_left le_rfl, ite_eq_left (le_of_not_ge ht)] + apply LipschitzWith.of_dist_le_mul + intro s t + rw [← he s, ← he t] + exact (hclosed.dist_le_mul (max s 0) (show max s 0 ∈ Ici (0:ℝ) from le_max_right s 0) + (max t 0) (show max t 0 ∈ Ici (0:ℝ) from le_max_right t 0)).trans + (mul_le_mul_of_nonneg_left (by simpa only [Real.dist_eq] using abs_max_sub_max_le_abs s t 0) + (NNReal.coe_nonneg _)) + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTransfer.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..3070a56376d8c35be6fce352a6363fcaf2dccd03 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHeatTransfer.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTimeDerivative +import Mathlib.MeasureTheory.Integral.IntegralEqImproper + +namespace OAI + +/-! Integration by parts transfers Gaussian derivatives to bounded smooth data. -/ + +noncomputable section +namespace ForcedComputation.PlaneHeat +open Real MeasureTheory Set Filter ShearFlows +open scoped Topology ContDiff + +theorem oneDimSecond_integrable {t : ℝ} (ht : 0 < t) : Integrable (oneDimSecond t) := by + have hm : Integrable (fun x => x^2 * oneDim t x) := by + convert! (timeMomentTwo_integrable ht).const_mul (timeCoefficient t) using 1 + funext x + dsimp [timeCoefficient, timeCore, oneDim] + ring + convert! (hm.div_const (4*t^2)).sub ((oneDim_integrable ht).const_mul (1/(2*t))) + using 1 + funext x + dsimp [oneDimSecond] + ring + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] + +theorem integrable_weight_smul {w : ℝ → ℝ} (hw : Integrable w) {f : ℝ → F} + (hf : Continuous f) (C : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) : + Integrable (fun x => w x • f x) := by + apply (hw.norm.mul_const C).mono' (hw.aestronglyMeasurable.smul hf.aestronglyMeasurable) + exact ae_of_all _ fun x => by + change ‖w x • f x‖ ≤ ‖w x‖ * C + rw [norm_smul] + exact mul_le_mul_of_nonneg_left (hC x) (norm_nonneg _) + +theorem gaussian_integral_by_parts {t : ℝ} (ht : 0 < t) {f f' : ℝ → F} + (hf : ∀ x, HasDerivAt f (f' x) x) (hf' : Continuous f') + (C D : ℝ) (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖f' x‖ ≤ D) : + (∫ x, oneDimDerivative t x • f x) = -(∫ x, oneDim t x • f' x) := by + have hc : Continuous f := continuous_iff_continuousAt.mpr fun x => (hf x).continuousAt + have he := integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable + (L := ContinuousLinearMap.lsmul ℝ ℝ) + (u := oneDim t) (v := f) (u' := oneDimDerivative t) (v' := f') + (fun x _ => oneDim_hasDerivAt ht x) (fun x _ => hf x) + (integrable_weight_smul F (oneDim_integrable ht) hf' D hD) + (integrable_weight_smul F (oneDimDerivative_integrable ht) hc C hC) + (integrable_weight_smul F (oneDim_integrable ht) hc C hC) + change (∫ x, oneDim t x • f' x) = -(∫ x, oneDimDerivative t x • f x) at he + simpa only [neg_neg] using congrArg Neg.neg he.symm + +theorem gaussian_second_integral_by_parts {t : ℝ} (ht : 0 < t) {f f' f'' : ℝ → F} + (hf : ∀ x, HasDerivAt f (f' x) x) (hf' : ∀ x, HasDerivAt f' (f'' x) x) + (hf'' : Continuous f'') (C D E : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖f' x‖ ≤ D) (hE : ∀ x, ‖f'' x‖ ≤ E) : + (∫ x, oneDimSecond t x • f x) = ∫ x, oneDim t x • f'' x := by + have hc : Continuous f := continuous_iff_continuousAt.mpr fun x => (hf x).continuousAt + have hc' : Continuous f' := continuous_iff_continuousAt.mpr fun x => (hf' x).continuousAt + have he := integral_bilinear_hasDerivAt_right_eq_neg_left_of_integrable + (L := ContinuousLinearMap.lsmul ℝ ℝ) + (u := oneDimDerivative t) (v := f) (u' := oneDimSecond t) (v' := f') + (fun x _ => oneDimDerivative_hasDerivAt ht x) (fun x _ => hf x) + (integrable_weight_smul F (oneDimDerivative_integrable ht) hc' D hD) + (integrable_weight_smul F (oneDimSecond_integrable ht) hc C hC) + (integrable_weight_smul F (oneDimDerivative_integrable ht) hc C hC) + change (∫ x, oneDimDerivative t x • f' x) = -(∫ x, oneDimSecond t x • f x) at he + have hb := gaussian_integral_by_parts F ht hf' hf'' D E hD hE + rw [hb] at he + exact neg_injective he.symm + +end ForcedComputation.PlaneHeat + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHessianTail.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHessianTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1e03dc12428a93aa9415eba0df51d273c9e6d1d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneHessianTail.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneDerivativeTail +import Mathlib.Analysis.Calculus.FDeriv.Symmetric + +namespace OAI + +/-! Polarization turns the directional tail estimate into bounds for +every coordinate entry of the Hessian. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory +open scoped ContDiff + +theorem plane_basis_norm_le (j : Fin 2) : ‖basis j‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)).mpr + intro i + simp only [PlanarHamiltonian.basis, Pi.single_apply, Real.norm_eq_abs] + split_ifs <;> norm_num + +theorem scalar_second_spatial_eq {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (x : Plane) (j k : Fin 2) : + spatialD j (spatialD k f) x = fderiv ℝ (fderiv ℝ f) x (basis j) (basis k) := by + unfold spatialD + rw [fderiv_clm_apply ((hf.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x) + (differentiableAt_const _)] + simp + +theorem scalar_hessian_entry_tail {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 3 f y‖ ≤ M) + (x : Plane) (j k : Fin 2) : + |spatialD j (spatialD k f) x| ≤ 3 * (100 * B + M) * derivativeTail x := by + let H := fderiv ℝ (fderiv ℝ f) x + let C := (100 * B + M) * derivativeTail x + have hC : 0 ≤ C := mul_nonneg (by positivity) (derivativeTail_pos x).le + have hs (u v : Plane) : H u v = H v u := + hf.contDiffAt.isSymmSndFDerivAt (by simp) u v + have hdiag (v : Plane) (hv : ‖v‖ ≤ 1) : |H v v| ≤ C := by + simpa only [iteratedFDeriv_two_apply, H, C] using + scalar_second_directional_tail hf hB hM hfB hfM x v hv + let u := basis j + let v := basis k + let z := (1 / 2 : ℝ) • (u + v) + have hu : ‖u‖ ≤ 1 := plane_basis_norm_le j + have hv : ‖v‖ ≤ 1 := plane_basis_norm_le k + have hz : ‖z‖ ≤ 1 := by + have ha := norm_add_le u v + dsimp [z] + rw [norm_smul, Real.norm_eq_abs] + norm_num + linarith + have hp : 4 * H z z = H u u + 2 * H u v + H v v := by + dsimp [z] + simp only [map_smul, smul_apply, smul_eq_mul, + map_add, add_apply, hs v u] + ring + have h0 := abs_le.mp (hdiag u hu) + have h1 := abs_le.mp (hdiag v hv) + have h2 := abs_le.mp (hdiag z hz) + rw [scalar_second_spatial_eq hf] + change |H u v| ≤ 3 * (100 * B + M) * derivativeTail x + have hb : |H u v| ≤ 3 * C := by + apply abs_le.mpr + constructor <;> linarith + simpa only [C, mul_assoc] using hb + + +theorem scalar_hessian_square_integrable {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ y, |f y| ≤ B * planeTailProfile y) + (hfM : ∀ y, ‖iteratedFDeriv ℝ 3 f y‖ ≤ M) (j k : Fin 2) : + Integrable (fun x => (spatialD j (spatialD k f) x) ^ 2) := by + let A := 3 * (100 * B + M) + apply (derivativeTail_square_integrable.const_mul (A ^ 2)).mono' + ((spatialD_smooth j (spatialD_smooth k hf)).continuous.pow 2).aestronglyMeasurable + filter_upwards [] with x + have hb : |spatialD j (spatialD k f) x| ≤ A * derivativeTail x := + scalar_hessian_entry_tail hf hB hM hfB hfM x j k + have hA : 0 ≤ A * derivativeTail x := + mul_nonneg (by dsimp [A]; positivity) (derivativeTail_pos x).le + have hs := (sq_le_sq₀ (abs_nonneg _) hA).mpr hb + change ‖spatialD j (spatialD k f) x ^ 2‖ ≤ A ^ 2 * derivativeTail x ^ 2 + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (spatialD j (spatialD k f) x)] + + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneImpulseScalar.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneImpulseScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..4920bc08bd29945740bcabffe07a579d0e0882db --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneImpulseScalar.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMassConservation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneUnitImpulse + +namespace OAI + +/-! The actual unit impulse has nonnegative integrable scalar evolution, +with total mass exactly the prescribed smooth injection ramp. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows VelocityDetector Set MeasureTheory +open scoped ContDiff + +theorem unitImpulse_scalar_exists (hE : PlaneScalarExistence) + (ν : ℝ) (hν : 0 < ν) (a : ℝ → Plane → Plane) (p : Plane) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hc : CompactPlaneCoefficients a (unitImpulse p)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) : + ∃ w : ℝ → Plane → ℝ, GlobalPlaneScalarSolution ν a (unitImpulse p) w ∧ + (∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x) ∧ + (∀ t, 0 ≤ t → Integrable (w t)) ∧ + (∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) := by + obtain ⟨w, hw⟩ := hE.global ν hν a (unitImpulse p) ha (unitImpulse_smooth p) hc + have hn : ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x := + hw.nonnegative hν.le ha hc (fun t _ x => unitImpulse_nonneg p t x) + refine ⟨w, hw, hn, ?_, ?_⟩ + · intro t ht + exact (hw t ht).integrable ht hν.le ha (unitImpulse_smooth p) hc + (fun s _ x => unitImpulse_nonneg p s x) t ⟨ht, le_rfl⟩ + · intro t ht + apply (hw t ht).mass_eq_source ht hν.le ha (unitImpulse_smooth p) hc hdiv + (fun s _ x => unitImpulse_nonneg p s x) + (smoothRamp_smooth 0 1).continuous.continuousOn + (smoothRamp_before (by norm_num) le_rfl) + intro s _ + rw [unitImpulse_mass] + exact ((smoothRamp_smooth 0 1).differentiable (by simp) s).hasDerivAt + +theorem unitImpulse_mass_after {w : ℝ → Plane → ℝ} + (hm : ∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) + {t : ℝ} (ht : 1 ≤ t) : (∫ x, w t x) = 1 := by + rw [hm t (by linarith), smoothRamp_after (by norm_num) ht] + +theorem unitImpulse_mass_le_one {w : ℝ → Plane → ℝ} + (hm : ∀ t, 0 ≤ t → (∫ x, w t x) = smoothRamp 0 1 t) + {t : ℝ} (ht : 0 ≤ t) : (∫ x, w t x) ≤ 1 := by + rw [hm t ht] + exact (smoothRamp_range 0 1 t).2 + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneIntegralBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneIntegralBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..93e315635204ead0c7574d809d534a5078ceb0be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneIntegralBounds.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTestIntegral + +namespace OAI + +/-! Quantitative error bounds used by the compact-test mass argument. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory + +theorem abs_increment_le_of_derivative_bound {F d : ℝ → ℝ} {T C : ℝ} + (hT : 0 ≤ T) (hc : ContinuousOn F (Icc 0 T)) + (hd : ∀ t ∈ Ioo 0 T, HasDerivAt F (d t) t) + (hb : ∀ t ∈ Ioo 0 T, |d t| ≤ C) : |F T - F 0| ≤ C * T := by + have hdiff : DifferentiableOn ℝ F (interior (Icc 0 T)) := by + rw [interior_Icc] + exact fun t ht => (hd t ht).differentiableAt.differentiableWithinAt + have hu : ∀ t ∈ interior (Icc 0 T), deriv F t ≤ C := by + rw [interior_Icc] + intro t ht + rw [(hd t ht).deriv] + exact (abs_le.mp (hb t ht)).2 + have hl : ∀ t ∈ interior (Icc 0 T), -C ≤ deriv F t := by + rw [interior_Icc] + intro t ht + rw [(hd t ht).deriv] + exact (abs_le.mp (hb t ht)).1 + have hu' := (convex_Icc (0 : ℝ) T).image_sub_le_mul_sub_of_deriv_le hc hdiff hu + 0 ⟨le_rfl, hT⟩ T ⟨hT, le_rfl⟩ hT + have hl' := (convex_Icc (0 : ℝ) T).mul_sub_le_image_sub_of_le_deriv hc hdiff hl + 0 ⟨le_rfl, hT⟩ T ⟨hT, le_rfl⟩ hT + apply abs_le.mpr + constructor <;> linarith + +theorem abs_integral_mul_le {f g : Plane → ℝ} (hf : Integrable f) + (hg : AEStronglyMeasurable g) {C : ℝ} (hb : ∀ x, |g x| ≤ C) : + |∫ x, f x * g x| ≤ C * ∫ x, |f x| := by + have hi : Integrable (fun x => f x * g x) := hf.mul_bdd hg (by + filter_upwards [] with x + simpa only [Real.norm_eq_abs] using hb x) + calc + _ ≤ ∫ x, |f x * g x| := by + simpa only [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun x => f x * g x) + _ ≤ ∫ x, C * |f x| := by + apply integral_mono hi.norm (hf.norm.const_mul C) + intro x + simp only [Real.norm_eq_abs] + rw [abs_mul] + simpa only [mul_comm C] using mul_le_mul_of_nonneg_left (hb x) (abs_nonneg (f x)) + _ = _ := integral_const_mul _ _ + +theorem lower_increment_of_derivative_bound {F d : ℝ → ℝ} {a b C : ℝ} + (hab : a ≤ b) (hc : ContinuousOn F (Icc a b)) + (hd : ∀ t ∈ Ioo a b, HasDerivAt F (d t) t) + (hb : ∀ t ∈ Ioo a b, -C ≤ d t) : F a - C * (b - a) ≤ F b := by + have hdiff : DifferentiableOn ℝ F (interior (Icc a b)) := by + rw [interior_Icc] + exact fun t ht => (hd t ht).differentiableAt.differentiableWithinAt + have hl : ∀ t ∈ interior (Icc a b), -C ≤ deriv F t := by + rw [interior_Icc] + intro t ht + rw [(hd t ht).deriv] + exact hb t ht + have h := (convex_Icc a b).mul_sub_le_image_sub_of_le_deriv hc hdiff hl + a ⟨le_rfl, hab⟩ b ⟨hab, le_rfl⟩ hab + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneInteriorCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneInteriorCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..5355d3a20e504480e64b32c04fd110318de0ec77 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneInteriorCalculus.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus + +namespace OAI + +/-! Joint interior derivatives of a finite-cylinder scalar solution. These +lemmas use only the smoothness supplied by the narrow existence input. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +def planeJointD (v : ℝ × Plane) (f : ℝ × Plane → ℝ) (p : ℝ × Plane) : ℝ := + fderiv ℝ f p v + +theorem planeJointD_smoothOn {f : ℝ × Plane → ℝ} {S : Set (ℝ × Plane)} + (hf : ContDiffOn ℝ ∞ f S) (hS : IsOpen S) (v : ℝ × Plane) : + ContDiffOn ℝ ∞ (planeJointD v f) S := + (hf.fderiv_of_isOpen hS (by simp)).clm_apply contDiffOn_const + +theorem planeJointD_spatial {f : ℝ × Plane → ℝ} {t : ℝ} {x : Plane} + (hf : DifferentiableAt ℝ f (t, x)) (j : Fin 2) : + planeJointD (0, basis j) f (t, x) = spatialD j (fun y => f (t, y)) x := by + have hh := hf.hasFDerivAt.comp x + ((hasFDerivAt_const t x).prodMk (hasFDerivAt_id x)) + change _ = fderiv ℝ (fun y => f (t, y)) x (basis j) + change HasFDerivAt (fun y => f (t, y)) _ x at hh + rw [hh.fderiv] + simp [planeJointD] + +theorem PlaneScalarSolution.interior_smooth {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) : + ContDiffOn ℝ ∞ (Function.uncurry w) (Ioo 0 T ×ˢ univ) := + hw.smooth.mono (fun _ hp => ⟨Ioo_subset_Icc_self hp.1, hp.2⟩) + +theorem PlaneScalarSolution.interior_spatialD {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) (j : Fin 2) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => spatialD j (w p.1) p.2) + (Ioo 0 T ×ˢ univ) := by + have ho : IsOpen (Ioo (0 : ℝ) T ×ˢ (univ : Set Plane)) := isOpen_Ioo.prod isOpen_univ + apply (planeJointD_smoothOn hw.interior_smooth ho (0, basis j)).congr + intro p hp + exact (planeJointD_spatial + ((hw.interior_smooth.contDiffAt (ho.mem_nhds hp)).differentiableAt (by simp)) j).symm + +theorem PlaneScalarSolution.interior_laplacian {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => scalarLaplacian (w p.1) p.2) + (Ioo 0 T ×ˢ univ) := by + have ho : IsOpen (Ioo (0 : ℝ) T ×ˢ (univ : Set Plane)) := isOpen_Ioo.prod isOpen_univ + have hh (j : Fin 2) : ContDiffOn ℝ ∞ + (fun p : ℝ × Plane => spatialD j (spatialD j (w p.1)) p.2) + (Ioo 0 T ×ˢ univ) := by + apply (planeJointD_smoothOn (hw.interior_spatialD j) ho (0, basis j)).congr + intro p hp + exact (planeJointD_spatial + (((hw.interior_spatialD j).contDiffAt (ho.mem_nhds hp)).differentiableAt (by simp)) j).symm + exact ContDiffOn.sum (fun j _ => hh j) + +theorem PlaneScalarSolution.interior_generator {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => scalarGenerator ν (a p.1) (w p.1) p.2) + (Ioo 0 T ×ˢ univ) := by + have hprod : ContDiffOn ℝ ∞ + (fun p : ℝ × Plane => ∑ j : Fin 2, a p.1 p.2 j * spatialD j (w p.1) p.2) + (Ioo 0 T ×ˢ univ) := + ContDiffOn.sum (fun j _ => ((contDiff_apply ℝ ℝ j).comp ha).contDiffOn.mul + (hw.interior_spatialD j)) + have hc : ContDiffOn ℝ ∞ (fun p : ℝ × Plane => ν * scalarLaplacian (w p.1) p.2) + (Ioo 0 T ×ˢ univ) := contDiffOn_const.mul hw.interior_laplacian + have hh := hc.sub hprod + exact hh.congr (fun p _ => by rw [scalarGenerator, scalar_directional_basis]) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Continuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Continuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2f2025f3dd2e16f5ef2f244a5e9db6053e7952e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Continuity.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSquareContinuity +import Mathlib.MeasureTheory.Function.L2Space + +namespace OAI + +/-! The square-distance formulation gives continuity in the usual L2 +space, rather than only pointwise time continuity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +abbrev PlaneL2 := Lp ℝ 2 (volume : Measure Plane) + +theorem planeL2_norm_sq (u : PlaneL2) {f : Plane → ℝ} + (hf : (fun x => u x) =ᵐ[volume] f) : ‖u‖ ^ 2 = ∫ x, f x ^ 2 := by + rw [← real_inner_self_eq_norm_sq, L2.inner_def] + apply integral_congr_ae + filter_upwards [hf] with x hx + change u x * u x = f x ^ 2 + rw [hx, pow_two] + +theorem planeL2_sub_norm_sq (u v : PlaneL2) {f g : Plane → ℝ} + (hf : (fun x => u x) =ᵐ[volume] f) (hg : (fun x => v x) =ᵐ[volume] g) : + ‖u - v‖ ^ 2 = ∫ x, (f x - g x) ^ 2 := by + apply planeL2_norm_sq + exact (Lp.coeFn_sub u v).trans (hf.sub hg) + +theorem planeL2_continuousOn_of_squareDistance {F : ℝ → Plane → ℝ} + {S : Set ℝ} {U : ℝ → PlaneL2} + (hU : ∀ t ∈ S, (fun x => U t x) =ᵐ[volume] F t) + (hF : SquareDistanceContinuousOn F S) : ContinuousOn U S := by + intro s hs + apply tendsto_iff_norm_sub_tendsto_zero.mpr + have hsq : Tendsto (fun t => ‖U t - U s‖ ^ 2) (𝓝[S] s) (𝓝 (0 : ℝ)) := by + apply (tendsto_congr' ?_).mpr (hF s hs) + filter_upwards [self_mem_nhdsWithin] with t ht + exact planeL2_sub_norm_sq (U t) (U s) (hU t ht) (hU s hs) + have hroot := Real.continuous_sqrt.continuousAt.tendsto.comp hsq + simpa only [Function.comp_def, Real.sqrt_sq_eq_abs, abs_of_nonneg (norm_nonneg _), + Real.sqrt_zero] using hroot + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Derivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Derivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..178d0420fcbf43f3a46d4e22328824452bd589cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Derivative.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneL2Continuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneStrongDerivative + +namespace OAI + +/-! Strong differentiation of the scalar in the actual L2 norm. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +theorem planeL2_slope_ae (U : ℝ → PlaneL2) {F : ℝ → Plane → ℝ} + {s t : ℝ} + (hs : (fun x => U s x) =ᵐ[volume] F s) + (ht : (fun x => U t x) =ᵐ[volume] F t) : + (fun x => slope U t s x) =ᵐ[volume] + fun x => slope (fun r => F r x) t s := by + rw [slope_def_module] + have he := (Lp.coeFn_smul (s - t)⁻¹ (U s - U t)).trans + (((Lp.coeFn_sub (U s) (U t)).trans (hs.sub ht)).const_smul (s - t)⁻¹) + filter_upwards [he] with x hx + simpa only [slope_def_module, Pi.smul_apply, Pi.sub_apply, smul_eq_mul] using hx + +theorem planeL2_hasDerivWithinAt_of_strongDerivative + {F G : ℝ → Plane → ℝ} {S : Set ℝ} {U V : ℝ → PlaneL2} + (hU : ∀ t ∈ S, (fun x => U t x) =ᵐ[volume] F t) + (hV : ∀ t ∈ S, (fun x => V t x) =ᵐ[volume] G t) + (hF : PlaneStrongDerivativeOn F G S) {t : ℝ} (ht : t ∈ S) : + HasDerivWithinAt U (V t) S t := by + apply hasDerivWithinAt_iff_tendsto_slope.mpr + apply tendsto_iff_norm_sub_tendsto_zero.mpr + have hsq : Tendsto (fun s => ‖slope U t s - V t‖ ^ 2) + (𝓝[S \ {t}] t) (𝓝 (0 : ℝ)) := by + apply (tendsto_congr' ?_).mpr (hF t ht) + filter_upwards [self_mem_nhdsWithin] with s hs + exact planeL2_sub_norm_sq (slope U t s) (V t) + (planeL2_slope_ae U (hU s hs.1) (hU t ht)) (hV t ht) + have hroot := Real.continuous_sqrt.continuousAt.tendsto.comp hsq + simpa only [Function.comp_def, Real.sqrt_sq_eq_abs, abs_of_nonneg (norm_nonneg _), + Real.sqrt_zero] using hroot + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Lift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Lift.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b1ac362681a93009b81fe53a5be3dc50d3036ba --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneL2Lift.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneL2Derivative + +namespace OAI + +/-! Canonical representatives in L2 on a finite time interval. The values +outside the specified interval have no role in the regularity statement. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set + +def planeL2Lift (F : ℝ → Plane → ℝ) (S : Set ℝ) + (hF : ∀ t ∈ S, MemLp (F t) 2 volume) (t : ℝ) : PlaneL2 := by + classical + exact if ht : t ∈ S then (hF t ht).toLp (F t) else 0 + +theorem planeL2Lift_ae (F : ℝ → Plane → ℝ) (S : Set ℝ) + (hF : ∀ t ∈ S, MemLp (F t) 2 volume) {t : ℝ} (ht : t ∈ S) : + (fun x => planeL2Lift F S hF t x) =ᵐ[volume] F t := by + simp only [planeL2Lift, dite_eq_left ht] + exact (hF t ht).coeFn_toLp + +theorem exists_planeL2_continuous_representation {F : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : ∀ t ∈ S, MemLp (F t) 2 volume) + (hc : SquareDistanceContinuousOn F S) : + ∃ U : ℝ → PlaneL2, ContinuousOn U S ∧ + ∀ t ∈ S, (fun x => U t x) =ᵐ[volume] F t := by + refine ⟨planeL2Lift F S hF, ?_, fun t ht => planeL2Lift_ae F S hF ht⟩ + exact planeL2_continuousOn_of_squareDistance (fun t ht => planeL2Lift_ae F S hF ht) hc + +def PlaneC1L2 (F G : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + ∃ U V : ℝ → PlaneL2, ContinuousOn U S ∧ ContinuousOn V S ∧ + ∀ t ∈ S, ((fun x => U t x) =ᵐ[volume] F t) ∧ + ((fun x => V t x) =ᵐ[volume] G t) ∧ HasDerivWithinAt U (V t) S t + +theorem planeC1L2_of_square_estimates {F G : ℝ → Plane → ℝ} {S : Set ℝ} + (hF : ∀ t ∈ S, MemLp (F t) 2 volume) + (hG : ∀ t ∈ S, MemLp (G t) 2 volume) + (hcF : SquareDistanceContinuousOn F S) (hcG : SquareDistanceContinuousOn G S) + (hd : PlaneStrongDerivativeOn F G S) : PlaneC1L2 F G S := by + obtain ⟨U, hUc, hU⟩ := exists_planeL2_continuous_representation hF hcF + obtain ⟨V, hVc, hV⟩ := exists_planeL2_continuous_representation hG hcG + exact ⟨U, V, hUc, hVc, fun t ht => + ⟨hU t ht, hV t ht, planeL2_hasDerivWithinAt_of_strongDerivative hU hV hd ht⟩⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneLineDerivatives.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneLineDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..827615e8ee86d08d0851e159a21a9742b63ae12d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneLineDerivatives.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTaylorControl +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput + +namespace OAI + +/-! Directional restrictions of the scalar retain spatial derivative bounds +on the closed time slab. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def scalarLine (f : Plane → ℝ) (x v : Plane) (t : ℝ) : ℝ := f (x + t • v) + +theorem scalarLine_smooth {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) (x v : Plane) : + ContDiff ℝ ∞ (scalarLine f x v) := + hf.comp (contDiff_const.add (contDiff_id.smul contDiff_const)) + +theorem scalarLine_iteratedDeriv {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (x v : Plane) (n : ℕ) (t : ℝ) : + iteratedDeriv n (scalarLine f x v) t = + iteratedFDeriv ℝ n f (x + t • v) (fun _ => v) := by + let L : ℝ →L[ℝ] Plane := (ContinuousLinearMap.id ℝ ℝ).smulRight v + have hF : ContDiff ℝ ∞ (fun y : Plane => f (x + y)) := + hf.comp (contDiff_const.add contDiff_id) + change iteratedFDeriv ℝ n ((fun y : Plane => f (x + y)) ∘ L) t (fun _ => 1) = _ + rw [L.iteratedFDeriv_comp_right hF t (by simp), + ContinuousMultilinearMap.compContinuousLinearMap_apply, iteratedFDeriv_comp_add_left] + simp [L] + +theorem scalarLine_iteratedDeriv_bound {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (x v : Plane) (n : ℕ) {B : ℝ} + (hB : ∀ y, ‖iteratedFDeriv ℝ n f y‖ ≤ B) (t : ℝ) : + |iteratedDeriv n (scalarLine f x v) t| ≤ B * ‖v‖ ^ n := by + rw [scalarLine_iteratedDeriv hf] + calc + _ ≤ ‖iteratedFDeriv ℝ n f (x + t • v)‖ * ‖v‖ ^ n := by + simpa only [Real.norm_eq_abs, Finset.prod_const, Finset.card_univ, Fintype.card_fin] using + (iteratedFDeriv ℝ n f (x + t • v)).le_opNorm (fun _ => v) + _ ≤ _ := mul_le_mul_of_nonneg_right (hB _) (pow_nonneg (norm_nonneg _) _) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassConservation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassConservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..be590c8f367c3b71bb272c15c8ec55ccc6eea41f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassConservation.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneWeightedEvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMassContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCutoffCoefficients +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCutoffLimit +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneIntegralBounds + +namespace OAI + +/-! Mass conservation is derived from compact tests and vanishing +inverse-square diffusion errors. It is not a hypothesis in the scalar +existence input. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows ExpandingDetector Set MeasureTheory Filter +open scoped ContDiff Topology + +theorem PlaneScalarSolution.mass_eq_source + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) + {θ : ℝ → ℝ} (hθ : ContinuousOn θ (Icc 0 T)) (hθ0 : θ 0 = 0) + (hθd : ∀ t ∈ Ioo 0 T, HasDerivAt θ (∫ x, h t x) t) : + (∫ x, w T x) = θ T := by + obtain ⟨B, hB, hwb⟩ := hw.uniform_tail_bound hT hν ha hh hc hpos + have hwi := hw.integrable hT hν ha hh hc hpos + let M : ℝ := ∫ x, B * planeTailProfile x + have hmass (t : ℝ) (ht : t ∈ Icc 0 T) : (∫ x, |w t x|) ≤ M := by + apply integral_mono (hwi t ht).norm (planeTailProfile_integrable.const_mul B) + intro x + simpa only [Real.norm_eq_abs] using hwb t ht x + obtain ⟨C, hC, hΔ⟩ := massCutoff_laplacian_bound + obtain ⟨N, hN⟩ := hc.cutoff_eventually_exact T hT + let φ : ℕ → Plane → ℝ := fun n => concentrationCutoff ((n : ℝ) + 1) 0 + let E : ℕ → ℝ := fun n => ν * (((n : ℝ) + 1)⁻¹ ^ 2 * C) * M * T + have herror (n : ℕ) (hn : N ≤ n) : |(∫ x, φ n x * w T x) - θ T| ≤ E n := by + have hφ : ContDiff ℝ ∞ (φ n) := concentrationCutoff_smooth _ _ + have hφc : HasCompactSupport (φ n) := concentrationCutoff_compactSupport (by positivity) _ + have hscale : 0 ≤ ((n : ℝ) + 1)⁻¹ ^ 2 * C := by positivity + have hD (s : ℝ) (hs : s ∈ Ioo 0 T) : + HasDerivAt (fun r => (∫ x, φ n x * w r x) - θ r) + (ν * ∫ x, w s x * scalarLaplacian (φ n) x) s := by + have htest := (hw.test_integral_derivative ha hh hdiv hφ hφc hs).sub (hθd s hs) + have hid : + ((∫ x, w s x * (ν * scalarLaplacian (φ n) x + fderiv ℝ (φ n) x (a s x))) + + ∫ x, φ n x * h s x) - (∫ x, h s x) = + ν * ∫ x, w s x * scalarLaplacian (φ n) x := by + have he (x : Plane) : w s x * (ν * scalarLaplacian (φ n) x + + fderiv ℝ (φ n) x (a s x)) = ν * (w s x * scalarLaplacian (φ n) x) := by + rw [(hN n hn s (Ioo_subset_Icc_self hs) x).1] + ring + have hh' (x : Plane) : φ n x * h s x = h s x := + (hN n hn s (Ioo_subset_Icc_self hs) x).2 + simp_rw [he, hh'] + rw [integral_const_mul] + ring + rw [hid] at htest + exact htest + have hbound (s : ℝ) (hs : s ∈ Ioo 0 T) : + |ν * ∫ x, w s x * scalarLaplacian (φ n) x| ≤ + ν * (((n : ℝ) + 1)⁻¹ ^ 2 * C) * M := by + have hsc : AEStronglyMeasurable (scalarLaplacian (φ n)) volume := + (scalarLaplacian_smooth hφ).continuous.aestronglyMeasurable + have hi := abs_integral_mul_le (hwi s (Ioo_subset_Icc_self hs)) hsc + (concentrationCutoff_laplacian (fun x => hΔ x) ((n : ℝ) + 1) 0) + rw [abs_mul, abs_of_nonneg hν] + calc + _ ≤ ν * ((((n : ℝ) + 1)⁻¹ ^ 2 * C) * ∫ x, |w s x|) := + mul_le_mul_of_nonneg_left hi hν + _ ≤ ν * ((((n : ℝ) + 1)⁻¹ ^ 2 * C) * M) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left + (hmass s (Ioo_subset_Icc_self hs)) hscale) hν + _ = _ := by ring + have hi := abs_increment_le_of_derivative_bound hT + ((hw.test_integral_continuousOn hφ hφc).sub hθ) hD hbound + have hz : (∫ x, φ n x * w 0 x) - θ 0 = 0 := by + simp only [hw.initial, mul_zero, integral_zero, hθ0, sub_self] + simpa only [Pi.sub_apply, hz, sub_zero, E] using hi + have hlim : Tendsto (fun n : ℕ => |(∫ x, φ n x * w T x) - θ T|) + atTop (𝓝 |(∫ x, w T x) - θ T|) := + ((concentrationCutoff_integral_limit (hwi T ⟨hT, le_rfl⟩) 0).sub_const (θ T)).abs + have hr : Tendsto (fun n : ℕ => ((n : ℝ) + 1)⁻¹) atTop (𝓝 0) := + tendsto_inv_atTop_zero.comp + (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_natCast_atTop_atTop) + have he : Tendsto E atTop (𝓝 0) := by + simpa only [E, zero_pow (by decide : (2 : ℕ) ≠ 0), zero_mul, mul_zero] using + ((((hr.pow 2).mul_const (C : ℝ)).const_mul ν).mul_const M).mul_const T + have hz : |(∫ x, w T x) - θ T| ≤ 0 := + le_of_tendsto_of_tendsto hlim he ((eventually_ge_atTop N).mono (fun n hn => herror n hn)) + exact sub_eq_zero.mp (abs_nonpos_iff.mp hz) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbaf7fe61ad2a638a3f88f9cc7fd1e9462bfab9f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMassContinuity.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarTail + +namespace OAI + +/-! Uniform integrable domination and continuity of whole-plane mass on +finite time intervals. Both are consequences of the local scalar estimates. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +theorem PlaneScalarSolution.uniform_tail_bound + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc 0 T, ∀ x, |w t x| ≤ B * planeTailProfile x := by + obtain ⟨C, K, hC, hK, hb⟩ := hw.tail_bound hT hν ha hh hc + refine ⟨C * Real.exp (K * T), mul_nonneg hC (Real.exp_pos _).le, ?_⟩ + have hn := hw.nonnegative hT hν ha hc hpos + intro t ht x + rw [abs_of_nonneg (hn t ht x)] + apply (hb t ht x).trans + apply mul_le_mul_of_nonneg_right _ (planeTailProfile_pos x).le + exact mul_le_mul_of_nonneg_left + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left ht.2 hK)) hC + +theorem PlaneScalarSolution.mass_continuousOn + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ContinuousOn (fun t => ∫ x, w t x) (Icc 0 T) := by + obtain ⟨B, _, hB⟩ := hw.uniform_tail_bound hT hν ha hh hc hpos + apply continuousOn_of_dominated + (fun t ht => (hw.slice_smooth ht).continuous.aestronglyMeasurable) + (bound := fun x => B * planeTailProfile x) + · intro t ht + filter_upwards [] with x + simpa only [Real.norm_eq_abs] using hB t ht x + · exact planeTailProfile_integrable.const_mul B + · filter_upwards [] with x + exact hw.smooth.continuousOn.comp + (continuous_id.prodMk continuous_const).continuousOn + (fun _ ht => ⟨ht, mem_univ x⟩) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumCompact.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumCompact.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc5215fde988b04370038bdb0ebf83846675adf3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumCompact.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMaximumPrinciple + +namespace OAI + +/-! The compactness step in the whole-plane maximum principle. Only the +positive superlevel set must remain in a compact spatial set; the scalar +itself may have noncompact diffusion tails. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped Topology ContDiff + +theorem positive_cylinder_max {w : ℝ → Plane → ℝ} {T : ℝ} + (hc : ContinuousOn (Function.uncurry w) (Icc 0 T ×ˢ univ)) + {K : Set Plane} (hK : IsCompact K) + (houtside : ∀ t ∈ Icc 0 T, ∀ x, 0 < w t x → x ∈ K) + {t : ℝ} (ht : t ∈ Icc 0 T) {x : Plane} (hx : 0 < w t x) : + ∃ s ∈ Icc 0 T, ∃ y, 0 < w s y ∧ ∀ r ∈ Icc 0 T, ∀ z, w r z ≤ w s y := by + have hne : (Icc (0 : ℝ) T ×ˢ K).Nonempty := ⟨(t, x), ht, houtside t ht x hx⟩ + obtain ⟨p, hp, hmax⟩ := (isCompact_Icc.prod hK).exists_isMaxOn hne + (hc.mono (fun _ hy => ⟨hy.1, mem_univ _⟩)) + have hpos : 0 < w p.1 p.2 := hx.trans_le + (hmax (show (t, x) ∈ Icc (0 : ℝ) T ×ˢ K from ⟨ht, houtside t ht x hx⟩)) + refine ⟨p.1, hp.1, p.2, hpos, ?_⟩ + intro r hr z + by_cases hz : 0 < w r z + · exact hmax (show (r, z) ∈ Icc (0 : ℝ) T ×ˢ K from ⟨hr, houtside r hr z hz⟩) + · exact (le_of_not_gt hz).trans hpos.le + +theorem scalar_maximum_principle_compact_superlevel {w d : ℝ → Plane → ℝ} + {a : ℝ → Plane → Plane} {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 ≤ ν) + (hc : ContinuousOn (Function.uncurry w) (Icc 0 T ×ˢ univ)) + (hcompact : ∀ ε : ℝ, 0 < ε → ∃ K : Set Plane, IsCompact K ∧ + ∀ t ∈ Icc 0 T, ∀ x, ε < w t x → x ∈ K) + (hs : ∀ t ∈ Icc 0 T, ContDiff ℝ ∞ (w t)) + (hd : ∀ t ∈ Ioc 0 T, ∀ x, HasDerivWithinAt (fun s => w s x) (d t x) (Icc 0 T) t) + (he : ∀ t ∈ Ioc 0 T, ∀ x, d t x ≤ scalarGenerator ν (a t) (w t) x) + (h₀ : ∀ x, w 0 x ≤ 0) : ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ 0 := by + intro t ht x + by_contra! hpos + let ε := w t x / (4 * (T + 1)) + have hε : 0 < ε := by dsimp [ε]; positivity + let v : ℝ → Plane → ℝ := fun s y => w s y - ε * (s + 1) + have hvc : ContinuousOn (Function.uncurry v) (Icc 0 T ×ˢ univ) := + hc.sub ((continuous_const.mul (continuous_fst.add continuous_const)).continuousOn) + obtain ⟨K, hK, houtside⟩ := hcompact ε hε + have hcv : ∀ s ∈ Icc 0 T, ∀ y, 0 < v s y → y ∈ K := by + intro s hs y hy + apply houtside s hs y + dsimp [v] at hy + nlinarith [mul_nonneg hε.le hs.1] + have hvtx : 0 < v t x := by + dsimp [v] + have hm : ε * (4 * (T + 1)) = w t x := by + dsimp [ε] + exact div_mul_cancel₀ _ (by positivity) + nlinarith [mul_le_mul_of_nonneg_left ht.2 hε.le] + obtain ⟨s, hsK, y, hvsy, hmax⟩ := positive_cylinder_max hvc hK hcv ht hvtx + have hspos : 0 < s := by + by_contra hn + have hz : s = 0 := le_antisymm (le_of_not_gt hn) hsK.1 + subst s + have h := h₀ y + dsimp [v] at hvsy + nlinarith + have hst : s ∈ Ioc (0 : ℝ) T := ⟨hspos, hsK.2⟩ + have htime : 0 ≤ d s y - ε := by + apply timeDerivative_nonneg_at_max hspos + (fun r hr => hmax r ⟨hr.1, hr.2.trans hsK.2⟩ y) + have hlin := (((hasDerivWithinAt_id s (Icc (0 : ℝ) T)).add_const 1).const_mul ε) + simpa only [v, Pi.sub_def, id_eq, mul_one] using + (((hd s hst y).sub hlin).mono (Icc_subset_Icc le_rfl hsK.2)) + have hspace : IsLocalMax (v s) y := + Filter.Eventually.of_forall (fun z => hmax s hsK z) + have hgen := scalarGenerator_nonpos ((hs s hsK).sub contDiff_const) hspace hν (a s) + rw [scalarGenerator_sub_const] at hgen + have hle := (he s hst y).trans hgen + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumPrinciple.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumPrinciple.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5bd5549bd8853f60eb1aba20d687a027414c26a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMaximumPrinciple.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneBarrier +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput + +namespace OAI + +/-! Bounded comparison on the whole plane, proved with an explicit +quadratic barrier. No periodicity, decay, integrability or compact support +of the scalar is assumed in this argument. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped Topology ContDiff + +theorem scalar_maximum_principle_bounded {w d : ℝ → Plane → ℝ} + {a : ℝ → Plane → Plane} {T ν A B : ℝ} + (_hT : 0 ≤ T) (hν : 0 ≤ ν) (hA : 0 ≤ A) + (ha : ∀ t ∈ Icc 0 T, ∀ x, ‖a t x‖ ≤ A) + (hb : ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ B) + (hc : ContinuousOn (Function.uncurry w) (Icc 0 T ×ˢ univ)) + (hs : ∀ t ∈ Icc 0 T, ContDiff ℝ ∞ (w t)) + (hd : ∀ t ∈ Ioc 0 T, ∀ x, HasDerivWithinAt (fun s => w s x) (d t x) (Icc 0 T) t) + (he : ∀ t ∈ Ioc 0 T, ∀ x, d t x ≤ scalarGenerator ν (a t) (w t) x) + (h₀ : ∀ x, w 0 x ≤ 0) : ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ 0 := by + intro t ht x + by_contra! hpos + let C := 4 * ν + 2 * A ^ 2 + 2 + have hC : 0 ≤ C := by dsimp [C]; positivity + let θ : ℝ → ℝ := fun s => Real.exp (C * s) + have hθ (s : ℝ) : 0 < θ s := Real.exp_pos _ + have hθ₁ : ∀ s ∈ Icc 0 T, 1 ≤ θ s := by + intro s hs + exact Real.one_le_exp_iff.mpr (mul_nonneg hC hs.1) + have hφ : 0 < planeBarrierSquare x := lt_of_lt_of_le (by norm_num) + (planeBarrierSquare_one_le x) + let ε := w t x / (2 * θ t * planeBarrierSquare x) + have hε : 0 < ε := div_pos hpos (by positivity) + let v : ℝ → Plane → ℝ := + fun s y => w s y - ε * θ s * planeBarrierSquare y + have hvc : ContinuousOn (Function.uncurry v) (Icc 0 T ×ˢ univ) := + hc.sub (((continuous_const.mul + (Real.continuous_exp.comp (continuous_const.mul continuous_fst))).mul + (planeBarrierSquare_smooth.continuous.comp continuous_snd)).continuousOn) + obtain ⟨K, hK, houtside⟩ := quadratic_barrier_positive_compact hε hb θ hθ₁ + have hvtx : 0 < v t x := by + have hm : ε * (2 * θ t * planeBarrierSquare x) = w t x := by + dsimp [ε] + exact div_mul_cancel₀ _ (by positivity) + dsimp only [v] + nlinarith + obtain ⟨s, hsK, y, hvsy, hmax⟩ := positive_cylinder_max hvc hK houtside ht hvtx + have hspos : 0 < s := by + by_contra hn + have hz : s = 0 := le_antisymm (le_of_not_gt hn) hsK.1 + subst s + have h := h₀ y + have hprod : 0 < ε * θ 0 * planeBarrierSquare y := + mul_pos (mul_pos hε (hθ 0)) (lt_of_lt_of_le (by norm_num) + (planeBarrierSquare_one_le y)) + dsimp only [v] at hvsy + linarith + have hst : s ∈ Ioc (0 : ℝ) T := ⟨hspos, hsK.2⟩ + have htime : 0 ≤ d s y - ε * C * θ s * planeBarrierSquare y := by + apply timeDerivative_nonneg_at_max hspos + (fun r hr => hmax r ⟨hr.1, hr.2.trans hsK.2⟩ y) + have hlin : HasDerivAt (fun r => ε * θ r * planeBarrierSquare y) + (ε * C * θ s * planeBarrierSquare y) s := by + simpa only [θ, id_eq, mul_one, one_mul, mul_assoc, mul_comm, mul_left_comm] using + ((((hasDerivAt_id s).const_mul C).exp.const_mul ε).mul_const (planeBarrierSquare y)) + exact ((hd s hst y).sub hlin.hasDerivWithinAt).mono + (Icc_subset_Icc le_rfl hsK.2) + have hspace : IsLocalMax (v s) y := + Filter.Eventually.of_forall (fun z => hmax s hsK z) + have hφs : ContDiff ℝ ∞ (fun z => (ε * θ s) * planeBarrierSquare z) := + contDiff_const.mul planeBarrierSquare_smooth + have hvs : ContDiff ℝ ∞ (v s) := + (hs s hsK).sub hφs + have hgen := scalarGenerator_nonpos hvs hspace hν (a s) + change scalarGenerator ν (a s) + (fun z => w s z - (ε * θ s) * planeBarrierSquare z) y ≤ 0 at hgen + rw [scalarGenerator_sub (hs s hsK) hφs, + scalarGenerator_const_mul planeBarrierSquare_smooth] at hgen + have hbound := planeBarrierSquare_generator_bound hν hA (a s) (ha s hsK) y + have hεθ : 0 < ε * θ s := mul_pos hε (hθ s) + have hmargin := mul_le_mul_of_nonneg_left hbound hεθ.le + have hstrict : 0 < ε * θ s * planeBarrierSquare y := + mul_pos hεθ (lt_of_lt_of_le (by norm_num) (planeBarrierSquare_one_le y)) + have hineq := he s hst y + dsimp only [C] at htime + nlinarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..791ee8c5adfc37d201c3dc95f14f56a22b874074 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingMass.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMovingTest +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneIntegralBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.ExpandingMassCutoff + +namespace OAI + +/-! A moving compact test loses at most the diffusion budget. Transport +cancellation is an identity of the concrete test and velocity, while scalar +positivity and total mass are supplied by the preceding PDE lemmas. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian ExpandingDetector Set MeasureTheory +open scoped ContDiff + +theorem PlaneScalarSolution.moving_mass_derivative_lower + {T ν M L : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hν : 0 ≤ ν) (hL : 0 ≤ L) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + {φ φd : ℝ → Plane → ℝ} + (hφ : ContDiff ℝ ∞ (Function.uncurry φ)) + (hφd : ContDiff ℝ ∞ (Function.uncurry φd)) + (hdφ : ∀ t x, HasDerivAt (fun s => φ s x) (φd t x) t) + {K : Set Plane} (hK : IsCompact K) + (hsupp : ∀ t, Function.support (φ t) ⊆ K) + (hdsupp : ∀ t, Function.support (φd t) ⊆ K) + {t : ℝ} (ht : t ∈ Ioo 0 T) + (hwi : Integrable (w t)) (hwn : ∀ x, 0 ≤ w t x) (hwm : (∫ x, w t x) ≤ M) + (hφn : ∀ x, 0 ≤ φ t x) (hhn : ∀ x, 0 ≤ h t x) + (hΔ : ∀ x, |scalarLaplacian (φ t) x| ≤ L) + (hcancel : ∀ x, φd t x + fderiv ℝ (φ t) x (a t x) = 0) : + ∃ d : ℝ, HasDerivAt (fun r => ∫ x, φ r x * w r x) d t ∧ - (ν * L * M) ≤ d := by + have hD := hw.moving_test_derivative ha hh hdiv hφ hφd hdφ hK hsupp hdsupp ht + refine ⟨_, hD, ?_⟩ + have hφs : ContDiff ℝ ∞ (φ t) := hφ.comp (contDiff_const.prodMk contDiff_id) + have hφds : ContDiff ℝ ∞ (φd t) := hφd.comp (contDiff_const.prodMk contDiff_id) + have hwS := hw.slice_smooth (Ioo_subset_Icc_self ht) + have haS : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hc : HasCompactSupport (φ t) := HasCompactSupport.intro (K := K) hK (fun x hx => by + by_contra hn + exact hx (hsupp t hn)) + have hdc : HasCompactSupport (φd t) := HasCompactSupport.intro (K := K) hK (fun x hx => by + by_contra hn + exact hx (hdsupp t hn)) + have hid : Integrable (fun x => φd t x * w t x) := + (hφds.mul hwS).continuous.integrable_of_hasCompactSupport hdc.mul_right + have hgrad : HasCompactSupport (fun x => fderiv ℝ (φ t) x (a t x)) := by + apply hc.mono' + intro x hx + by_contra hn + exact hx (by simp [fderiv_of_notMem_tsupport ℝ hn]) + have hgc : HasCompactSupport (fun x => ν * scalarLaplacian (φ t) x + + fderiv ℝ (φ t) x (a t x)) := + ((scalarLaplacian_compactSupport hc).mul_left).add hgrad + have hig : Integrable (fun x => w t x * (ν * scalarLaplacian (φ t) x + + fderiv ℝ (φ t) x (a t x))) := + (hwS.mul ((contDiff_const.mul (scalarLaplacian_smooth hφs)).add + ((hφs.fderiv_right (m := ∞) (by simp)).clm_apply haS))).continuous.integrable_of_hasCompactSupport hgc.mul_left + have he (x : Plane) : φd t x * w t x + w t x * + (ν * scalarLaplacian (φ t) x + fderiv ℝ (φ t) x (a t x)) = + ν * (w t x * scalarLaplacian (φ t) x) := by + linear_combination (w t x) * hcancel x + have hi : (∫ x, φd t x * w t x) + + (∫ x, w t x * (ν * scalarLaplacian (φ t) x + fderiv ℝ (φ t) x (a t x))) = + ν * ∫ x, w t x * scalarLaplacian (φ t) x := by + rw [← integral_add hid hig] + simp_rw [he] + exact integral_const_mul _ _ + rw [hi] + have hb := abs_integral_mul_le hwi (scalarLaplacian_smooth hφs).continuous.aestronglyMeasurable hΔ + have habs : (∫ x, |w t x|) = ∫ x, w t x := by + congr 1 + funext x + exact abs_of_nonneg (hwn x) + rw [habs] at hb + have hlower : -(L * M) ≤ ∫ x, w t x * scalarLaplacian (φ t) x := by + have hb' := hb.trans (mul_le_mul_of_nonneg_left hwm hL) + exact (abs_le.mp hb').1 + have hm := mul_le_mul_of_nonneg_left hlower hν + have hhpos : 0 ≤ ∫ x, φ t x * h t x := integral_nonneg (fun x => mul_nonneg (hφn x) (hhn x)) + nlinarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingTest.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..0960f282c4ea254fbe564997375596a4254fc732 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneMovingTest.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneWeightedEvolution + +namespace OAI + +/-! Compact tests depending on time. This is the local transport identity +used to retain scalar mass inside each moving computation gate. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff + +theorem PlaneScalarSolution.moving_test_derivative + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + {φ φd : ℝ → Plane → ℝ} + (hφ : ContDiff ℝ ∞ (Function.uncurry φ)) + (hφd : ContDiff ℝ ∞ (Function.uncurry φd)) + (hdφ : ∀ t x, HasDerivAt (fun s => φ s x) (φd t x) t) + {K : Set Plane} (hK : IsCompact K) + (hsupp : ∀ t, Function.support (φ t) ⊆ K) + (hdsupp : ∀ t, Function.support (φd t) ⊆ K) + {t : ℝ} (ht : t ∈ Ioo 0 T) : + HasDerivAt (fun r => ∫ x, φ r x * w r x) + ((∫ x, φd t x * w t x) + + (∫ x, w t x * (ν * scalarLaplacian (φ t) x + + fderiv ℝ (φ t) x (a t x))) + ∫ x, φ t x * h t x) t := by + let A : ℝ := t / 2 + let B : ℝ := (t + T) / 2 + have hi : Icc A B ⊆ Ioo (0 : ℝ) T := by + intro s hs + dsimp [A, B] at hs + constructor <;> linarith [ht.1, ht.2, hs.1, hs.2] + have htAB : t ∈ Ioo A B := by + constructor <;> dsimp [A, B] <;> linarith [ht.1, ht.2] + have hwc : ContDiffOn ℝ ∞ (Function.uncurry w) (Icc A B ×ˢ univ) := + hw.smooth.mono (fun _ hs => ⟨Ioo_subset_Icc_self (hi hs.1), hs.2⟩) + have hgen : ContDiffOn ℝ ∞ (fun p : ℝ × Plane => + scalarGenerator ν (a p.1) (w p.1) p.2 + h p.1 p.2) (Icc A B ×ˢ univ) := + ((hw.interior_generator ha).add hh.contDiffOn).mono (fun _ hs => ⟨hi hs.1, hs.2⟩) + have hg : ContinuousOn (fun p : ℝ × Plane => φ p.1 p.2 * w p.1 p.2) + (Icc A B ×ˢ univ) := (hφ.contDiffOn.mul hwc).continuousOn + have hd : ContinuousOn (fun p : ℝ × Plane => φd p.1 p.2 * w p.1 p.2 + + φ p.1 p.2 * (scalarGenerator ν (a p.1) (w p.1) p.2 + h p.1 p.2)) + (Icc A B ×ˢ univ) := + ((hφd.contDiffOn.mul hwc).add (hφ.contDiffOn.mul hgen)).continuousOn + have he (s : ℝ) (hs : s ∈ Ioo A B) (x : Plane) : + HasDerivAt (fun r => φ r x * w r x) + (φd s x * w s x + φ s x * + (scalarGenerator ν (a s) (w s) x + h s x)) s := by + have hsT := hi (Ioo_subset_Icc_self hs) + exact (hdφ s x).mul ((hw.equation s (Ioo_subset_Icc_self hsT) x).hasDerivAt + (Icc_mem_nhds hsT.1 hsT.2)) + have hzero (r : ℝ) (x : Plane) (hx : x ∉ K) : φ r x = 0 ∧ φd r x = 0 := by + constructor + · by_contra hn + exact hx (hsupp r hn) + · by_contra hn + exact hx (hdsupp r hn) + have hs (r : ℝ) : Function.support (fun x => φ r x * w r x) ⊆ K := by + intro x hx + by_contra hn + apply hx + change φ r x * w r x = 0 + rw [(hzero r x hn).1, zero_mul] + have hds : Function.support (fun x => φd t x * w t x + φ t x * + (scalarGenerator ν (a t) (w t) x + h t x)) ⊆ K := by + intro x hx + by_contra hn + apply hx + change φd t x * w t x + φ t x * + (scalarGenerator ν (a t) (w t) x + h t x) = 0 + rw [(hzero t x hn).1, (hzero t x hn).2, zero_mul, zero_mul, add_zero] + have hD := compact_supported_integral_hasDerivAt hg hd he hK hs hds htAB + have hφs : ContDiff ℝ ∞ (φ t) := hφ.comp (contDiff_const.prodMk contDiff_id) + have hφds : ContDiff ℝ ∞ (φd t) := hφd.comp (contDiff_const.prodMk contDiff_id) + have hwS := hw.slice_smooth (Ioo_subset_Icc_self ht) + have haS : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hhS : ContDiff ℝ ∞ (h t) := hh.comp (contDiff_const.prodMk contDiff_id) + have hφc : HasCompactSupport (φ t) := HasCompactSupport.intro (K := K) hK (fun x hx => by + by_contra hn + exact hx (hsupp t hn)) + have hdc : HasCompactSupport (φd t) := HasCompactSupport.intro (K := K) hK (fun x hx => by + by_contra hn + exact hx (hdsupp t hn)) + have hgS : ContDiff ℝ ∞ (scalarGenerator ν (a t) (w t)) := by + have hl : ContDiff ℝ ∞ (scalarLaplacian (w t)) := by + unfold scalarLaplacian + exact ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hwS)) + exact (contDiff_const.mul hl).sub + ((hwS.fderiv_right (m := ∞) (by simp)).clm_apply haS) + have hid : Integrable (fun x => φd t x * w t x) := + (hφds.mul hwS).continuous.integrable_of_hasCompactSupport hdc.mul_right + have hig : Integrable (fun x => φ t x * scalarGenerator ν (a t) (w t) x) := + (hφs.mul hgS).continuous.integrable_of_hasCompactSupport hφc.mul_right + have hih : Integrable (fun x => φ t x * h t x) := + (hφs.mul hhS).continuous.integrable_of_hasCompactSupport hφc.mul_right + have hidg : Integrable (fun x => φd t x * w t x + + φ t x * scalarGenerator ν (a t) (w t) x) := hid.add hig + have hI : (∫ x, φd t x * w t x + φ t x * + (scalarGenerator ν (a t) (w t) x + h t x)) = + (∫ x, φd t x * w t x) + (∫ x, w t x * + (ν * scalarLaplacian (φ t) x + fderiv ℝ (φ t) x (a t x))) + + ∫ x, φ t x * h t x := by + simp_rw [mul_add, ← add_assoc] + rw [integral_add hidg hih, integral_add hid hig, + integral_compact_generator hφs hwS haS hφc (hdiv t) ν] + simp only [mul_add] + exact hI ▸ hD + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlanePeriodicBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlanePeriodicBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..26665150e7bc010d6055ef90713bd79e993255ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlanePeriodicBounds.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusGeometry +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Regularity + +namespace OAI + +/-! Uniform bounds and a torus-distance modulus for smooth periodic data. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows Set +open scoped ContDiff NNReal + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +omit [NormedSpace ℝ F] in +theorem planePeriodic_bound {g : Plane → F} (hg : Continuous g) (hp : PlanePeriodic g) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x, ‖g x‖ ≤ C := by + obtain ⟨C, hC⟩ := (isCompact_Icc : IsCompact (Icc (0 : Plane) (fun _ => 1))).exists_bound_of_continuousOn hg.continuousOn + refine ⟨max C 0, le_max_right _ _, fun x => ?_⟩ + let y : Plane := fun j => x j - (⌊x j⌋ : ℤ) + have hy : y ∈ Icc (0 : Plane) (fun _ => 1) := by + constructor + · intro j + change 0 ≤ Int.fract (x j) + exact Int.fract_nonneg _ + · intro j + change Int.fract (x j) ≤ 1 + exact (Int.fract_lt_one _).le + have he : y + (fun j => ((⌊x j⌋ : ℤ) : ℝ)) = x := by + ext j + simp [y] + have hv := hp y (fun j => ⌊x j⌋) + rw [he] at hv + rw [hv] + exact (hC y hy).trans (le_max_left _ _) + +theorem planePeriodic_fderiv {g : Plane → F} (hg : Differentiable ℝ g) + (hp : PlanePeriodic g) : PlanePeriodic (fderiv ℝ g) := by + intro x n + exact fderiv_translation hg (fun y => hp y n) x + +theorem planePeriodic_lipschitz {g : Plane → F} (hg : ContDiff ℝ 1 g) + (hp : PlanePeriodic g) : ∃ K : ℝ≥0, LipschitzWith K g := by + obtain ⟨C, hC, hbound⟩ := planePeriodic_bound (hg.continuous_fderiv (by simp)) + (planePeriodic_fderiv (hg.differentiable (by simp)) hp) + refine ⟨⟨C, hC⟩, lipschitzWith_of_nnnorm_fderiv_le (hg.differentiable (by simp)) ?_⟩ + intro x + exact_mod_cast hbound x + +omit [NormedSpace ℝ F] in +theorem planePeriodic_norm_sub_le_torus {g : Plane → F} {K : ℝ≥0} + (hK : LipschitzWith K g) (hp : PlanePeriodic g) (x y : Plane) : + ‖g x - g y‖ ≤ K * VelocityDetector.torusNorm (x - y) := by + let z := y + VelocityDetector.centeredRepresentative (x - y) + have he : z + (fun j => ((⌊(x - y) j + 1 / 2⌋ : ℤ) : ℝ)) = x := by + ext j + simp only [z, VelocityDetector.centeredRepresentative, Pi.add_apply, Pi.sub_apply] + ring + have hz : g z = g x := by + have h := hp z (fun j => ⌊(x - y) j + 1 / 2⌋) + rw [he] at h + exact h.symm + have hn : ‖z - y‖ ≤ VelocityDetector.torusNorm (x - y) := by + have he' : z - y = VelocityDetector.centeredRepresentative (x - y) := by + dsimp [z] + abel + rw [he'] + exact planeCoordinates_norm_le + (planeCoordinates.symm (VelocityDetector.centeredRepresentative (x - y))) + rw [← hz] + exact (hK.norm_sub_le z y).trans (mul_le_mul_of_nonneg_left hn K.coe_nonneg) + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarComparison.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..45fed30920db3e58ea661dc58302a1be6dd84a9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarComparison.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMaximumPrinciple + +namespace OAI + +/-! Positivity and comparison from the whole-plane maximum principle. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem CompactPlaneCoefficients.drift_bound {a : ℝ → Plane → Plane} + {h : ℝ → Plane → ℝ} (hc : CompactPlaneCoefficients a h) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (T : ℝ) (hT : 0 ≤ T) : + ∃ A : ℝ, 0 ≤ A ∧ ∀ t ∈ Icc 0 T, ∀ x, ‖a t x‖ ≤ A := by + obtain ⟨K, hK, hzero⟩ := hc T hT + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hK).bddAbove_image + (ha.continuous.norm.continuousOn : + ContinuousOn (fun y : ℝ × Plane => ‖a y.1 y.2‖) (Icc 0 T ×ˢ K)) + refine ⟨max 0 B, le_max_left _ _, ?_⟩ + intro t ht x + by_cases hx : x ∈ K + · exact (hB ⟨(t, x), ⟨ht, hx⟩, rfl⟩).trans (le_max_right _ _) + · rw [(hzero t ht x hx).1, norm_zero] + exact le_max_left _ _ + +theorem CompactPlaneCoefficients.sub {a : ℝ → Plane → Plane} + {h k : ℝ → Plane → ℝ} (hh : CompactPlaneCoefficients a h) + (hk : CompactPlaneCoefficients a k) : + CompactPlaneCoefficients a (fun t x => h t x - k t x) := by + intro T hT + obtain ⟨K, hK, hzero⟩ := hh T hT + obtain ⟨L, hL, kzero⟩ := hk T hT + refine ⟨K ∪ L, hK.union hL, ?_⟩ + intro t ht x hx + have hxK : x ∉ K := fun h => hx (Or.inl h) + have hxL : x ∉ L := fun h => hx (Or.inr h) + exact ⟨(hzero t ht x hxK).1, by + change h t x - k t x = 0 + rw [(hzero t ht x hxK).2, (kzero t ht x hxL).2, sub_self]⟩ + +theorem PlaneScalarSolution.nonnegative {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (hcompact : CompactPlaneCoefficients a h) + (hh : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ w t x := by + obtain ⟨A, hA, hAb⟩ := hcompact.drift_bound ha T hT + obtain ⟨B, hB⟩ := hw.bounded + have he := scalar_maximum_principle_bounded + (w := fun t x => -w t x) + (d := fun t x => -(scalarGenerator ν (a t) (w t) x + h t x)) + hT hν hA hAb + (fun t ht x => (neg_le_abs (w t x)).trans (hB t ht x).1) + hw.smooth.continuousOn.neg + (fun t ht => (hw.slice_smooth ht).neg) + (fun t ht x => (hw.equation t ⟨ht.1.le, ht.2⟩ x).neg) + (fun t ht x => by + rw [scalarGenerator_neg] + linarith [hh t ⟨ht.1.le, ht.2⟩ x]) + (fun x => by rw [hw.initial]; simp) + exact fun t ht x => neg_nonpos.mp (he t ht x) + +theorem PlaneScalarSolution.sub {T ν : ℝ} {a : ℝ → Plane → Plane} + {h k w v : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hv : PlaneScalarSolution T ν a k v) : + PlaneScalarSolution T ν a (fun t x => h t x - k t x) + (fun t x => w t x - v t x) where + smooth := hw.smooth.sub hv.smooth + initial := by funext x; rw [hw.initial, hv.initial]; simp + equation := by + intro t ht x + convert (hw.equation t ht x).sub (hv.equation t ht x) using 1 + rw [scalarGenerator_sub (hw.slice_smooth ht) (hv.slice_smooth ht)] + ring + bounded := by + obtain ⟨B, hB⟩ := hw.bounded + obtain ⟨C, hC⟩ := hv.bounded + refine ⟨B + C, ?_⟩ + intro t ht x + constructor + · exact (abs_sub _ _).trans (add_le_add (hB t ht x).1 (hC t ht x).1) + · rw [fderiv_fun_sub ((hw.slice_smooth ht).differentiable (by simp) x) + ((hv.slice_smooth ht).differentiable (by simp) x)] + exact (norm_sub_le _ _).trans (add_le_add (hB t ht x).2 (hC t ht x).2) + +theorem PlaneScalarSolution.compare {T ν : ℝ} {a : ℝ → Plane → Plane} + {h k w v : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hv : PlaneScalarSolution T ν a k v) + (hT : 0 ≤ T) (hν : 0 ≤ ν) (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hch : CompactPlaneCoefficients a h) (hck : CompactPlaneCoefficients a k) + (hh : ∀ t ∈ Icc 0 T, ∀ x, h t x ≤ k t x) : + ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ v t x := by + have hp := (hv.sub hw).nonnegative hT hν ha (hck.sub hch) + (fun t ht x => sub_nonneg.mpr (hh t ht x)) + exact fun t ht x => sub_nonneg.mp (hp t ht x) + +theorem PlaneScalarSolution.unique {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hv : PlaneScalarSolution T ν a h v) + (hT : 0 ≤ T) (hν : 0 ≤ ν) (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hc : CompactPlaneCoefficients a h) : ∀ t ∈ Icc 0 T, w t = v t := by + intro t ht + funext x + exact le_antisymm + (hw.compare hv hT hν ha hc hc (fun _ _ _ => le_rfl) t ht x) + (hv.compare hw hT hν ha hc hc (fun _ _ _ => le_rfl) t ht x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..1db7649278d1bf8f7f74d4df8acbca80aa1a0004 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarDischarge.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildDataFields +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildJointSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildActualEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput + +namespace OAI + +/-! Whole-plane scalar existence via the Gaussian mild construction. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set PlaneScalarMild +open scoped Topology ContDiff + +theorem planeScalarExistence : PlaneScalarExistence := by + intro T ν hT hν a h ha hh hcompact + obtain ⟨K,hK,hKh⟩ := hcompact T hT.le + have hsource : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, Function.uncurry h (t,x) = 0 := + fun t ht x hx => (hKh t ht x hx).2 + have hcoeff : ∀ i t, t ∈ Icc (0 : ℝ) T → ∀ x ∉ K, + driftCoefficients a i (t,x) = 0 := by + intro i t ht x hx + exact driftCoefficients_supported hK.isClosed (fun y hy => (hKh t ht y hy).1) i x hx + obtain ⟨D,hinit,hs,hb⟩ := exists_supported_zero_data hK hh hsource + (driftCoefficients_smooth ha) hcoeff + have htime := D.supported_solutionJetValue_smooth_time hT hν hK hh hsource + (driftCoefficients_smooth ha) hcoeff hs hb + refine ⟨D.solutionValue hT.le hν, ?_, ?_⟩ + · refine ⟨D.solutionValue_smooth hT hν htime, ?_, ?_, ?_⟩ + · funext x + change D.solution hT.le hν (projIcc 0 T hT.le 0) x = 0 + rw [projIcc_of_mem hT.le (show (0 : ℝ) ∈ Icc 0 T from ⟨le_rfl,hT.le⟩)] + exact (D.solution_initial hT.le hν x).trans (hinit 0 x) + · intro t ht x + exact D.solutionValue_equation hT.le hν ha hs hb ht x + · obtain ⟨B,_,hB⟩ := D.solutionValue_spatial_bounds hT.le hν 1 + refine ⟨B, fun t ht x => ?_⟩ + constructor + · simpa only [norm_iteratedFDeriv_zero, Real.norm_eq_abs] using hB t ht 0 (by omega) x + · simpa only [norm_iteratedFDeriv_one] using hB t ht 1 (by omega) x + · obtain ⟨B,_,hB⟩ := D.solutionValue_spatial_bounds hT.le hν 3 + exact ⟨B,hB⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarGlobal.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarGlobal.lean new file mode 100644 index 0000000000000000000000000000000000000000..95bd30fda6b3e3b7b2b5de483eb6fb0c0b1d6dc2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarGlobal.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarComparison + +namespace OAI + +/-! Consistent finite-cylinder solutions give one scalar evolution for all +nonnegative time, with compatibility supplied by uniqueness. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem PlaneScalarSolution.restrict {T S ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) (hST : S ≤ T) : + PlaneScalarSolution S ν a h w := by + have hsub : Icc (0 : ℝ) S ⊆ Icc 0 T := Icc_subset_Icc le_rfl hST + refine ⟨hw.smooth.mono (fun _ hp => ⟨hsub hp.1, hp.2⟩), hw.initial, ?_, ?_⟩ + · intro t ht x + exact (hw.equation t (hsub ht) x).mono hsub + · obtain ⟨B, hB⟩ := hw.bounded + exact ⟨B, fun t ht => hB t (hsub ht)⟩ + +theorem PlaneScalarSolution.congr {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) + (he : ∀ t ∈ Icc 0 T, v t = w t) : PlaneScalarSolution T ν a h v := by + refine ⟨hw.smooth.congr (fun p hp => congrFun (he p.1 hp.1) p.2), ?_, ?_, ?_⟩ + · rw [he 0 ⟨le_rfl, hT⟩] + exact hw.initial + · intro t ht x + rw [he t ht] + exact (hw.equation t ht x).congr_of_mem (fun s hs => congrFun (he s hs) x) ht + · obtain ⟨B, hB⟩ := hw.bounded + refine ⟨B, ?_⟩ + intro t ht x + rw [he t ht] + exact hB t ht x + +/-- Bounded smooth solutions on every finite closed time cylinder. -/ +def GlobalPlaneScalarSolution (ν : ℝ) (a : ℝ → Plane → Plane) + (h w : ℝ → Plane → ℝ) : Prop := ∀ T, 0 ≤ T → PlaneScalarSolution T ν a h w + +theorem PlaneScalarExistence.global (hE : PlaneScalarExistence) + (ν : ℝ) (hν : 0 < ν) (a : ℝ → Plane → Plane) (h : ℝ → Plane → ℝ) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) : + ∃ w, GlobalPlaneScalarSolution ν a h w := by + have hex (n : ℕ) : ∃ w, PlaneScalarSolution ((n : ℝ) + 1) ν a h w := by + obtain ⟨w, hw, _⟩ := hE ((n : ℝ) + 1) ν (by positivity) hν a h ha hh hc + exact ⟨w, hw⟩ + choose v hv using hex + have hcompat (m n : ℕ) {s : ℝ} (hs : 0 ≤ s) + (hm : s ≤ (m : ℝ) + 1) (hn : s ≤ (n : ℝ) + 1) : v m s = v n s := by + let T := min ((m : ℝ) + 1) ((n : ℝ) + 1) + have hT : 0 ≤ T := le_min (by positivity) (by positivity) + have hsm : T ≤ (m : ℝ) + 1 := min_le_left _ _ + have hsn : T ≤ (n : ℝ) + 1 := min_le_right _ _ + exact ((hv m).restrict hsm).unique ((hv n).restrict hsn) hT hν.le ha hc s + ⟨hs, le_min hm hn⟩ + let w : ℝ → Plane → ℝ := fun t => v ⌈t⌉₊ t + refine ⟨w, fun T hT => ?_⟩ + let N : ℕ := ⌈T⌉₊ + have hTN : T ≤ (N : ℝ) + 1 := (Nat.le_ceil T).trans (by linarith) + apply ((hv N).restrict hTN).congr hT + intro t ht + exact hcompat ⌈t⌉₊ N ht.1 ((Nat.le_ceil t).trans (by linarith)) (ht.2.trans hTN) + +theorem GlobalPlaneScalarSolution.nonnegative {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : GlobalPlaneScalarSolution ν a h w) + (hν : 0 ≤ ν) (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hc : CompactPlaneCoefficients a h) (hh : ∀ t, 0 ≤ t → ∀ x, 0 ≤ h t x) : + ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x := by + intro t ht x + exact (hw t ht).nonnegative ht hν ha hc (fun s hs => hh s hs.1) t ⟨ht, le_rfl⟩ x + +theorem GlobalPlaneScalarSolution.unique {ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} (hw : GlobalPlaneScalarSolution ν a h w) + (hv : GlobalPlaneScalarSolution ν a h v) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (hc : CompactPlaneCoefficients a h) : + ∀ t, 0 ≤ t → w t = v t := by + intro t ht + exact (hw t ht).unique (hv t ht) ht hν ha hc t ⟨ht, le_rfl⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..5133d3fcdd6ca33c012f20dd6598d94185e79465 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarInput.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! Smooth scalar advection-diffusion on the whole plane. + +Ladyzhenskaya, Solonnikov and Ural'tseva, Linear and Quasi-linear Equations +of Parabolic Type, AMS Translations of Mathematical Monographs 23 (1968), +Chapter IV, Theorem 5.1, p.320; Cauchy problem (5.1)--(5.2), p.318 and +bounded Hölder classes, p.319. We specialize to positive constant diffusion, +smooth drift and source with common compact support on each finite slab, +and zero initial data. Higher Hölder orders give smoothness up to the initial +time from the right. The choice of Hölder order 3/2 also bounds spatial +derivatives through order three on each finite slab. + -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +def CompactPlaneCoefficients (a : ℝ → Plane → Plane) (h : ℝ → Plane → ℝ) : Prop := + ∀ T : ℝ, 0 ≤ T → ∃ K : Set Plane, IsCompact K ∧ + ∀ t ∈ Icc (0 : ℝ) T, ∀ x, x ∉ K → a t x = 0 ∧ h t x = 0 + +structure PlaneScalarSolution (T ν : ℝ) (a : ℝ → Plane → Plane) + (h w : ℝ → Plane → ℝ) : Prop where + smooth : ContDiffOn ℝ ∞ (Function.uncurry w) (Icc 0 T ×ˢ univ) + initial : w 0 = fun _ => 0 + equation : ∀ t ∈ Icc 0 T, ∀ x, + HasDerivWithinAt (fun s => w s x) + (scalarGenerator ν (a t) (w t) x + h t x) (Icc 0 T) t + bounded : ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ x, + |w t x| ≤ B ∧ ‖fderiv ℝ (w t) x‖ ≤ B + +/-- Only the orders needed for local tail and H² estimates are retained. +The bound may depend on the finite time interval and the coefficients. -/ +def PlaneSpatialBounds (T : ℝ) (w : ℝ → Plane → ℝ) : Prop := + ∃ B : ℝ, ∀ t ∈ Icc 0 T, ∀ k : ℕ, k ≤ 3 → ∀ x, + ‖iteratedFDeriv ℝ k (w t) x‖ ≤ B + +def PlaneScalarExistence : Prop := + ∀ (T ν : ℝ), 0 < T → 0 < ν → + ∀ (a : ℝ → Plane → Plane) (h : ℝ → Plane → ℝ), + ContDiff ℝ ∞ (Function.uncurry a) → + ContDiff ℝ ∞ (Function.uncurry h) → CompactPlaneCoefficients a h → + ∃ w, PlaneScalarSolution T ν a h w ∧ PlaneSpatialBounds T w + +theorem PlaneScalarSolution.slice_smooth {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + {t : ℝ} (ht : t ∈ Icc 0 T) : ContDiff ℝ ∞ (w t) := by + have hi : ContDiff ℝ ∞ (fun x : Plane => (t, x)) := + contDiff_const.prodMk contDiff_id + have hh := hw.smooth.comp hi.contDiffOn + (show MapsTo (fun x : Plane => (t, x)) univ (Icc 0 T ×ˢ univ) from + fun x _ => ⟨ht, mem_univ x⟩) + simpa only [Function.comp_def, Function.uncurry_apply_pair, contDiffOn_univ] using hh + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildActualEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildActualEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1e644850cd3b1591ffb9aeee41e4469872faa5b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildActualEquation.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildJetTime +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarDuhamelCoefficients + +namespace OAI + +/-! The canonical mild solution satisfies the prescribed scalar drift equation. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild.CompatibleData +open ShearFlows Set VelocityDetector +open scoped Topology ContDiff BigOperators + +theorem solutionValue_equation {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) {a : ℝ → Plane → Plane} {h : ℝ → Plane → ℝ} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hsource : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h t.val x) + (hcoeff : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = + driftCoefficients a i (t.val,x)) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) (x : Plane) : + HasDerivWithinAt (fun s => D.solutionValue hT hν s x) + (scalarGenerator ν (a t) (D.solutionValue hT hν t) x + h t x) (Icc (0 : ℝ) T) t := by + let L : Jet 0 →L[ℝ] ℝ := + (BoundedContinuousFunction.evalCLM ℝ x).comp (BoundedSpatialJets.functionMap Plane ℝ 0) + have hd := L.hasFDerivAt.comp_hasDerivWithinAt t + (D.solutionJetValue_hasDerivWithinAt hT hν 0 ht) + have hf : (fun s => L (D.solutionJetValue hT hν 0 s)) = + (fun s => D.solutionValue hT hν s x) := by + funext s + exact congrFun (D.solutionJetValue_function hT hν 0 s) x + change HasDerivWithinAt (fun s => L (D.solutionJetValue hT hν 0 s)) _ _ _ at hd + rw [hf] at hd + have hs : D.effectiveSourceValue hT hν (projIcc 0 T hT t) x = + h t x - fderiv ℝ (D.solutionValue hT hν t) x (a t x) := by + have he := D.effectiveSource_function hT hν (Function.uncurry h) (driftCoefficients a) + hsource hcoeff 0 (projIcc 0 T hT t) x + change D.effectiveSourceValue hT hν (projIcc 0 T hT t) x = _ at he + have hv : ((projIcc 0 T hT t : Icc (0 : ℝ) T) : ℝ) = t := + congrArg Subtype.val (projIcc_of_mem hT ht) + simp only [hv, Function.uncurry_apply_pair, driftCoefficients_zero, + driftCoefficients_succ] at he + have hslice : ContDiff ℝ ∞ (a t) := + ha.comp (show ContDiff ℝ ∞ (fun x : Plane => (t,x)) from + contDiff_const.prodMk contDiff_id) + exact he.trans (driftCoefficients_effective_source hslice + (D.solution_smooth hT hν (projIcc 0 T hT t)) (h t) x) + have hr : L (D.timeRHSJet hT hν 0 t) = + scalarGenerator ν (a t) (D.solutionValue hT hν t) x + h t x := by + change BoundedSpatialJets.function Plane ℝ 0 (D.timeRHSJet hT hν 0 t) x = _ + rw [D.timeRHSJet_function, hs] + change ν * scalarLaplacian (D.solutionValue hT hν t) x + + (h t x - fderiv ℝ (D.solutionValue hT hν t) x (a t x)) = _ + unfold scalarGenerator + ring + rwa [hr] at hd + +end ForcedComputation.PlaneScalarMild.CompatibleData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildData.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildData.lean new file mode 100644 index 0000000000000000000000000000000000000000..768f12a86a611517fd7abb52d36579793af45803 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildData.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildSource +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientJets + +namespace OAI + +/-! Compatible data turn the finite-jet equations into one scalar mild solution. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows +open scoped Topology ContDiff + +/-- Initial data, source, and the three coefficients, represented consistently at every order. -/ +structure CompatibleData (T : ℝ) where + initial : ∀ k, Jet k + source : ∀ k, WeaklySingular.Path (Jet k) T + coefficient : ∀ k, Fin 3 → C(Icc (0 : ℝ) T, Jet k) + initial_truncate : ∀ k n (hkn : k ≤ n), + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (initial n) = initial k + source_truncate : ∀ k n (hkn : k ≤ n), truncatePath k n hkn T (source n) = source k + coefficient_truncate : ∀ k n (hkn : k ≤ n) i t, + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (coefficient n i t) = coefficient k i t + +namespace CompatibleData + +/-- Equality of represented scalar functions supplies compatibility automatically. -/ +def ofRepresentatives {T : ℝ} (w₀ : Plane → ℝ) (h : Icc (0 : ℝ) T → Plane → ℝ) + (b : Fin 3 → Icc (0 : ℝ) T → Plane → ℝ) + (J : ∀ k, Jet k) (g : ∀ k, WeaklySingular.Path (Jet k) T) + (c : ∀ k, Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hJ : ∀ k x, BoundedSpatialJets.function Plane ℝ k (J k) x = w₀ x) + (hg : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (g k t) x = h t x) + (hc : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (c k i t) x = b i t x) : + CompatibleData T where + initial := J + source := g + coefficient := c + initial_truncate := by + intro k n hkn + apply BoundedSpatialJets.function_injective Plane ℝ k + ext x + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.truncate Plane ℝ k n hkn (J n)) x = _ + rw [BoundedSpatialJets.function_truncate, hJ, hJ] + source_truncate := by + intro k n hkn + apply truncatePath_eq_of_functions k n hkn T + intro t x + exact (hg n t x).trans (hg k t x).symm + coefficient_truncate := by + intro k n hkn i t + apply coefficient_truncate_of_functions k n hkn T (c n i) (c k i) + intro s x + exact (hc n i s x).trans (hc k i s x).symm + +/-- The canonical affine term includes the prescribed initial data and actual heat source. -/ +def affinePath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) (k : ℕ) : + WeaklySingular.Path (Jet k) T := + forcingPath hT hν k (D.initial (k+1)) (D.source k) + +theorem affinePath_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k n : ℕ) (hkn : k ≤ n) : + truncatePath k n hkn T (D.affinePath hT hν n) = D.affinePath hT hν k := by + have hJ : BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (BoundedSpatialJets.truncate Plane ℝ n (n+1) (by omega) (D.initial (n+1))) = + BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) (D.initial (k+1)) := by + calc + _ = BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (D.initial n) := + congrArg (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn) + (D.initial_truncate n (n+1) (by omega)) + _ = D.initial k := D.initial_truncate k n hkn + _ = _ := (D.initial_truncate k (k+1) (by omega)).symm + exact (forcingPath_truncate hT hν k n hkn _ _ hJ (D.source n)).trans + (congrArg (forcingPath hT hν k (D.initial (k+1))) (D.source_truncate k n hkn)) + +/-- All finite-order solutions determine this one scalar function. -/ +def solution {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) + (t : Icc (0 : ℝ) T) (x : Plane) : ℝ := + commonFunction hT hν D.coefficient (D.affinePath hT hν) t x + +theorem solution_smooth {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (t : Icc (0 : ℝ) T) : + ContDiff ℝ ∞ (D.solution hT hν t) := + commonFunction_smooth hT hν D.coefficient (D.affinePath hT hν) + D.coefficient_truncate (D.affinePath_truncate hT hν) t + +theorem solution_spatial_bound {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t : Icc (0 : ℝ) T, ∀ x : Plane, + ‖iteratedFDeriv ℝ k (D.solution hT hν t) x‖ ≤ C := + commonFunction_spatial_bound hT hν D.coefficient (D.affinePath hT hν) + D.coefficient_truncate (D.affinePath_truncate hT hν) k + +theorem solution_spatial_continuous {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : + Continuous (fun p : Icc (0 : ℝ) T × Plane => + iteratedFDeriv ℝ k (D.solution hT hν p.1) p.2) := + commonFunction_spatial_continuous hT hν D.coefficient (D.affinePath hT hν) + D.coefficient_truncate (D.affinePath_truncate hT hν) k + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDataFields.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDataFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f947b88ec3bd89f2501ad927f87c251bd42a560 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDataFields.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildData + +namespace OAI + +/-! Actual periodic or compactly supported smooth fields supply all compatible jet data. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows +open scoped Topology ContDiff BoundedContinuousFunction + +private theorem exists_data_of_representatives {T : ℝ} + (w₀ : Plane → ℝ) (h : ℝ × Plane → ℝ) (b : Fin 3 → ℝ × Plane → ℝ) + (hJ : ∀ k, ∃ J : Jet k, ∀ x, BoundedSpatialJets.function Plane ℝ k J x = w₀ x) + (hg : ∀ k, ∃ g : C(Icc (0 : ℝ) T, Jet k), + ∀ t x, BoundedSpatialJets.function Plane ℝ k (g t) x = h (t.val,x)) + (hc : ∀ k i, ∃ c : C(Icc (0 : ℝ) T, Jet k), + ∀ t x, BoundedSpatialJets.function Plane ℝ k (c t) x = b i (t.val,x)) : + ∃ D : CompatibleData T, + (∀ k x, BoundedSpatialJets.function Plane ℝ k (D.initial k) x = w₀ x) ∧ + (∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) ∧ + (∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) := by + choose J hJ using hJ + choose g hg using hg + choose c hc using hc + let u (k : ℕ) : WeaklySingular.Path (Jet k) T := (WeaklySingular.pathEquiv (Jet k) T).symm (g k) + have hu : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (u k t) x = h (t.val,x) := hg + refine ⟨CompatibleData.ofRepresentatives w₀ (fun t x => h (t.val,x)) + (fun i t x => b i (t.val,x)) J u c hJ hu hc, hJ, hu, hc⟩ + +/-- Smooth periodic initial data, source, and coefficients determine compatible finite jets. -/ +theorem exists_periodic_data {T : ℝ} (hT : 0 ≤ T) + {w₀ : Plane → ℝ} (hw : ContDiff ℝ ∞ w₀) (hpw : PlanePeriodic w₀) + {h : ℝ × Plane → ℝ} (hh : ContDiff ℝ ∞ h) + (hph : ∀ t, PlanePeriodic (fun x => h (t,x))) + {b : Fin 3 → ℝ × Plane → ℝ} (hb : ∀ i, ContDiff ℝ ∞ (b i)) + (hpb : ∀ i t, PlanePeriodic (fun x => b i (t,x))) : + ∃ D : CompatibleData T, + (∀ k x, BoundedSpatialJets.function Plane ℝ k (D.initial k) x = w₀ x) ∧ + (∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) ∧ + (∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) := by + apply exists_data_of_representatives w₀ h b + · intro k + obtain ⟨J, hJ⟩ := exists_periodic_jet_curve (hw.comp contDiff_snd) + (fun _ => hpw) k T + let t₀ : Icc (0 : ℝ) T := ⟨0, le_rfl, hT⟩ + exact ⟨J t₀, hJ t₀⟩ + · intro k + exact exists_periodic_jet_curve hh hph k T + · intro k i + exact exists_periodic_jet_curve (hb i) (hpb i) k T + +/-- Common compact spatial support gives the whole-plane data, with zero initial value. -/ +theorem exists_supported_zero_data {T : ℝ} {K : Set Plane} (hK : IsCompact K) + {h : ℝ × Plane → ℝ} (hh : ContDiff ℝ ∞ h) + (hsh : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, h (t,x) = 0) + {b : Fin 3 → ℝ × Plane → ℝ} (hb : ∀ i, ContDiff ℝ ∞ (b i)) + (hsb : ∀ i t, t ∈ Icc (0 : ℝ) T → ∀ x ∉ K, b i (t,x) = 0) : + ∃ D : CompatibleData T, + (∀ k x, BoundedSpatialJets.function Plane ℝ k (D.initial k) x = 0) ∧ + (∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) ∧ + (∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) := by + apply exists_data_of_representatives (fun _ => 0) h b + · intro k + refine ⟨0, fun x => ?_⟩ + exact ((BoundedContinuousFunction.evalCLM ℝ x).comp + (BoundedSpatialJets.functionMap Plane ℝ k)).map_zero + · intro k + exact exists_supported_jet_curve hh hK T hsh k + · intro k i + exact exists_supported_jet_curve (hb i) hK T (hsb i) k + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDerivatives.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7c93816b9129264884cf467d9083255a9f0112d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildDerivatives.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetDifferentiation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildSource + +namespace OAI + +/-! Directional derivatives commute with the actual Gaussian Volterra operators. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open MeasureTheory Set ShearFlows +open scoped Topology Interval ContDiff + +/-- Differentiate a continuous jet path pointwise. -/ +def directionalPath (k : ℕ) (v : Plane) (T : ℝ) : + WeaklySingular.Path (Jet (k+1)) T →L[ℝ] WeaklySingular.Path (Jet k) T := + (WeaklySingular.pathEquiv (Jet k) T).symm.toContinuousLinearEquiv.toContinuousLinearMap.comp + (((BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v).compLeftContinuous ℝ + (Icc (0 : ℝ) T)).comp + (WeaklySingular.pathEquiv (Jet (k+1)) T).toContinuousLinearEquiv.toContinuousLinearMap) + +@[simp] theorem directionalPath_apply (k : ℕ) (v : Plane) (T : ℝ) + (u : WeaklySingular.Path (Jet (k+1)) T) (t : Icc (0 : ℝ) T) : + directionalPath k v T u t = BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v (u t) := rfl + +theorem extendPath_directional {T : ℝ} (hT : 0 ≤ T) (k : ℕ) (v : Plane) + (u : WeaklySingular.Path (Jet (k+1)) T) (s : ℝ) : + WeaklySingular.extendPath (Jet k) hT (directionalPath k v T u) s = + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v + (WeaklySingular.extendPath (Jet (k+1)) hT u s) := rfl + +theorem rawHeatKernel_directional {ν : ℝ} (hν : 0 < ν) (k : ℕ) (v : Plane) + (r : ℝ) (J : Jet (k+1)) : + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v (rawHeatKernel hν (k+1) r J) = + rawHeatKernel hν k r (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v J) := by + by_cases hr : 0 < r + · rw [rawHeatKernel_pos hν (k+1) hr, rawHeatKernel_pos hν k hr] + exact BoundedSpatialJets.directionalDerivativeCLM_convolution Plane ℝ k v volume + (PlaneHeat.kernel (ν*r)) (PlaneHeat.kernel_integrable (mul_pos hν hr)) J + · simp only [rawHeatKernel_nonpos hν (k+1) (not_lt.mp hr), + rawHeatKernel_nonpos hν k (not_lt.mp hr), zero_apply, map_zero] + +theorem gradientKernel_directional {ν : ℝ} (hν : 0 < ν) (k : ℕ) (v : Plane) + (j : Fin 2) (r : ℝ) (J : Jet (k+1)) : + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v (gradientKernel hν (k+1) j r J) = + gradientKernel hν k j r (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v J) := by + by_cases hr : 0 < r + · rw [gradientKernel_pos hν (k+1) j hr, gradientKernel_pos hν k j hr] + exact BoundedSpatialJets.directionalDerivativeCLM_convolution Plane ℝ k v volume + (PlaneHeat.kernelDerivative (ν*r) j) + (PlaneHeat.kernelDerivative_integrable (mul_pos hν hr) j) J + · simp only [gradientKernel_nonpos hν (k+1) j (not_lt.mp hr), + gradientKernel_nonpos hν k j (not_lt.mp hr), zero_apply, map_zero] + +theorem rawKernels_directional {ν : ℝ} (hν : 0 < ν) (k : ℕ) (v : Plane) + (i : Fin 3) (r : ℝ) (J : Jet (k+1)) : + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v (rawKernels hν (k+1) i r J) = + rawKernels hν k i r (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v J) := + Fin.cases (rawHeatKernel_directional hν k v r J) + (fun j => gradientKernel_directional hν k v j r J) i + +/-- Spatial differentiation passes through the actual singular time integral. -/ +theorem rawKernelIntegral_directional {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (v : Plane) (u : WeaklySingular.Path (Jet (k+1)) T) + (i : Fin 3) (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v + (∫ s in 0..t.val, rawKernels hν (k+1) i (t.val-s) + (WeaklySingular.extendPath (Jet (k+1)) hT u s)) = + ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (WeaklySingular.extendPath (Jet k) hT (directionalPath k v T u) s) := by + apply map_integral_eq (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v) + (rawKernel_path_integrable hT hν (k+1) u i t) + intro s + exact (rawKernels_directional hν k v i (t.val-s) _).trans + (congrArg (rawKernels hν k i (t.val-s)) (extendPath_directional hT k v u s).symm) + +private theorem gradient_convolve_C1 {t : ℝ} (ht : 0 < t) {f : Plane → ℝ} + (hf : ContDiff ℝ 1 f) (j : Fin 2) (C D : ℝ) + (hC : ∀ x, ‖f x‖ ≤ C) (hD : ∀ x, ‖fderiv ℝ f x‖ ≤ D) (x : Plane) : + BoundedKernel.convolve Plane ℝ volume (PlaneHeat.kernelDerivative t j) f x = + BoundedKernel.convolve Plane ℝ volume (PlaneHeat.kernel t) + (fun y => fderiv ℝ f y (Pi.single j 1)) x := by + have he : PlaneHeat.heatConvolution ℝ t f = + BoundedKernel.convolve Plane ℝ volume (PlaneHeat.kernel t) f := + funext (PlaneHeat.heatConvolution_eq ℝ t f) + have hi := BoundedKernel.integrand_integrable Plane (Plane →L[ℝ] ℝ) volume + (PlaneHeat.kernel t) (fderiv ℝ f) (PlaneHeat.kernel_integrable ht) + (hf.continuous_fderiv (by norm_num)) D hD x + rw [← PlaneHeat.fderiv_heatConvolution_basis ℝ ht f hf.continuous C hC x j, he, + BoundedKernel.fderiv_convolve Plane ℝ volume (PlaneHeat.kernel t) f + (PlaneHeat.kernel_integrable ht) hf C D hC hD x, + ContinuousLinearMap.integral_apply hi] + rfl + +/-- On finite jets, a Gaussian gradient acting on the input equals heat acting on its derivative. -/ +theorem gradientKernel_eq_heatDerivative {ν : ℝ} (hν : 0 < ν) (k : ℕ) + (j : Fin 2) (r : ℝ) (J : Jet (k+1)) : + gradientKernel hν k j r (BoundedSpatialJets.truncateCLM Plane ℝ k (k+1) (by omega) J) = + rawHeatKernel hν k r + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) J) := by + by_cases hr : 0 < r + · rw [gradientKernel_pos hν k j hr, rawHeatKernel_pos hν k hr] + apply BoundedSpatialJets.function_injective Plane ℝ k + ext x + rw [PlaneHeat.gradientOperator_apply, PlaneHeat.heatOperator_apply] + have hd : ∀ y, ‖fderiv ℝ (BoundedSpatialJets.function Plane ℝ (k+1) J) y‖ ≤ ‖J‖ := by + intro y + rw [← BoundedSpatialJets.function_derivative Plane ℝ k J y] + exact (BoundedSpatialJets.norm_function_le Plane (Plane →L[ℝ] ℝ) k + (BoundedSpatialJets.derivative Plane ℝ k J) y).trans + (BoundedSpatialJets.norm_derivative_le Plane ℝ k J) + have hh := gradient_convolve_C1 (mul_pos hν hr) + ((BoundedSpatialJets.function_contDiff Plane ℝ (k+1) J).of_le (by simp)) + j ‖J‖ ‖J‖ (BoundedSpatialJets.norm_function_le Plane ℝ (k+1) J) hd x + have htr (y : Plane) : BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.truncateCLM Plane ℝ k (k+1) (by omega) J) y = + BoundedSpatialJets.function Plane ℝ (k+1) J y := + BoundedSpatialJets.function_truncate Plane ℝ k (k+1) (by omega) J y + simpa only [BoundedKernel.convolve, BoundedSpatialJets.function_directionalDerivativeCLM, + htr] using hh + · simp only [gradientKernel_nonpos hν k j (not_lt.mp hr), + rawHeatKernel_nonpos hν k (not_lt.mp hr), zero_apply] + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..03af0f4a69fa2a16a2e38c946f06c9c9a178e5f5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildEquation.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildKernels +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetBilinear + +namespace OAI + +/-! Actual finite-jet scalar mild equations with the Gaussian heat and gradient operators. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Real MeasureTheory Set ShearFlows +open scoped Topology Interval BigOperators + +/-- Multiplication by a bounded scalar jet, as a bounded linear operator on the unknown jet. -/ +def multiplication (k : ℕ) (b : Jet k) : Jet k →L[ℝ] Jet k := + BoundedSpatialJets.operatorEquiv Plane ℝ ℝ k + (BoundedSpatialJets.bilinearCLM Plane ℝ ℝ ℝ k (ContinuousLinearMap.mul ℝ ℝ) b) + +theorem multiplication_apply (k : ℕ) (b u : Jet k) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (multiplication k b u) x = + BoundedSpatialJets.function Plane ℝ k b x * BoundedSpatialJets.function Plane ℝ k u x := by + exact BoundedSpatialJets.function_bilinear Plane ℝ ℝ ℝ k (ContinuousLinearMap.mul ℝ ℝ) b u x + +/-- A continuous coefficient jet curve induces a continuous curve of multiplication operators. -/ +def coefficientCurve {T : ℝ} (k : ℕ) (b : C(Icc (0 : ℝ) T, Jet k)) : + C(Icc (0 : ℝ) T, Jet k →L[ℝ] Jet k) := + ⟨fun t => multiplication k (b t), + (BoundedSpatialJets.operatorEquiv Plane ℝ ℝ k).continuous.comp + ((BoundedSpatialJets.bilinearCLM Plane ℝ ℝ ℝ k (ContinuousLinearMap.mul ℝ ℝ)).continuous.comp + b.continuous)⟩ + +@[simp] theorem coefficientCurve_apply {T : ℝ} (k : ℕ) (b : C(Icc (0 : ℝ) T, Jet k)) + (t : Icc (0 : ℝ) T) : coefficientCurve k b t = multiplication k (b t) := rfl + +private theorem integral_sum_eq_raw {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (u : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (∑ i, ∫ s in 0..t.val, kernels hν k T i (t.val-s) + (coefficientCurve k (b i) (projIcc 0 T hT s) + (WeaklySingular.extendPath (Jet k) hT u s))) = + ∑ i, ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT u s)) := by + apply Finset.sum_congr rfl + intro i _ + apply intervalIntegral.integral_congr + intro s hs + rw [uIcc_of_le t.property.1] at hs + dsimp only + rw [kernels_eq_raw hν k ((sub_le_self _ hs.1).trans t.property.2) i] + rfl + +/-- The scalar mild equation is uniquely solvable on every finite time interval in every +finite jet order. The three coefficients are `div a`, `-a₀`, and `-a₁` in the drift equation. -/ +theorem exists_unique_mild {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (a : WeaklySingular.Path (Jet k) T) : + ∃! u : WeaklySingular.Path (Jet k) T, ∀ t : Icc (0 : ℝ) T, u t = a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT u s)) := by + obtain ⟨u, hu, huniq⟩ := WeaklySingular.exists_unique_integral_equation (Jet k) hT + (kernels hν k T) (kernels_continuous hν k T) (kernelConstants ν T) + (kernelConstants_nonneg ν T) (kernels_bound hν k T) (fun i => coefficientCurve k (b i)) a + refine ⟨u, ?_, ?_⟩ + · intro t + exact (hu t).trans (congrArg (fun v => a t + v) (integral_sum_eq_raw hT hν k b u t)) + · intro v hv + apply huniq v + intro t + exact (hv t).trans (congrArg (fun w => a t + w) (integral_sum_eq_raw hT hν k b v t).symm) + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildHeatForm.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildHeatForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..34984a0439691db0594aa4dfca0ea6963fec38d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildHeatForm.lean @@ -0,0 +1,200 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildDerivatives +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildData + +namespace OAI + +/-! Rewrite the scalar mild equation using one heat operator and the effective source. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set MeasureTheory ShearFlows +open scoped Topology Interval BigOperators + +/-- A coefficient multiplied by a continuous unknown jet path. -/ +def productPath {T : ℝ} (k : ℕ) (b : C(Icc (0 : ℝ) T, Jet k)) + (u : WeaklySingular.Path (Jet k) T) : WeaklySingular.Path (Jet k) T := + WeaklySingular.coefficientOperator (Jet k) (coefficientCurve k b) u + +@[simp] theorem productPath_apply {T : ℝ} (k : ℕ) (b : C(Icc (0 : ℝ) T, Jet k)) + (u : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + productPath k b u t = multiplication k (b t) (u t) := rfl + +theorem productPath_truncate {T : ℝ} (k n : ℕ) (hkn : k ≤ n) + (b : C(Icc (0 : ℝ) T, Jet n)) (c : C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b t) = c t) + (u : WeaklySingular.Path (Jet n) T) : + truncatePath k n hkn T (productPath n b u) = + productPath k c (truncatePath k n hkn T u) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + change BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (multiplication n (b t) (u t)) = _ + exact (multiplication_truncate k n hkn (b t) (u t)).trans + (congrArg (fun z : Jet k => multiplication k z + (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (u t))) (hbc t)) + +/-- All three raw kernels define bounded source operators on the finite interval. -/ +def kernelSourceOperator {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) (i : Fin 3) : + WeaklySingular.Path (Jet k) T →L[ℝ] WeaklySingular.Path (Jet k) T := + WeaklySingular.integralOperator (Jet k) hT (kernels hν k T i) + (kernels_continuous hν k T i) (kernelConstants ν T i) + (kernelConstants_nonneg ν T i) (kernels_bound hν k T i) + +@[simp] theorem kernelSourceOperator_apply {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (i : Fin 3) (u : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + kernelSourceOperator hT hν k i u t = ∫ s in 0..t.val, + rawKernels hν k i (t.val-s) (WeaklySingular.extendPath (Jet k) hT u s) := by + change (∫ s in 0..t.val, kernels hν k T i (t.val-s) + (WeaklySingular.extendPath (Jet k) hT u s)) = _ + apply intervalIntegral.integral_congr + intro s hs + rw [uIcc_of_le t.property.1] at hs + exact congrArg (fun L : Jet k →L[ℝ] Jet k => L + (WeaklySingular.extendPath (Jet k) hT u s)) + (kernels_eq_raw hν k ((sub_le_self _ hs.1).trans t.property.2) i) + +@[simp] theorem kernelSourceOperator_zero {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (u : WeaklySingular.Path (Jet k) T) : + kernelSourceOperator hT hν k 0 u = heatSourcePath hT hν k u := rfl + +private theorem gradient_integrand_eq_heat {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (j : Fin 2) (u : WeaklySingular.Path (Jet (k+1)) T) (r s : ℝ) : + rawKernels hν k j.succ r + (WeaklySingular.extendPath (Jet k) hT (truncatePath k (k+1) (by omega) T u) s) = + rawHeatKernel hν k r + (WeaklySingular.extendPath (Jet k) hT (directionalPath k (Pi.single j 1) T u) s) := by + change gradientKernel hν k j r + (WeaklySingular.extendPath (Jet k) hT (truncatePath k (k+1) (by omega) T u) s) = _ + exact (congrArg (gradientKernel hν k j r) (extendPath_truncate k (k+1) (by omega) hT u s)).trans + ((gradientKernel_eq_heatDerivative hν k j r _).trans + (congrArg (rawHeatKernel hν k r) (extendPath_directional hT k (Pi.single j 1) u s).symm)) + +private theorem gradient_integral_eq_heat {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (j : Fin 2) (u : WeaklySingular.Path (Jet (k+1)) T) (t : ℝ) : + (∫ s in 0..t, rawKernels hν k j.succ (t-s) + (WeaklySingular.extendPath (Jet k) hT (truncatePath k (k+1) (by omega) T u) s)) = + ∫ s in 0..t, rawHeatKernel hν k (t-s) + (WeaklySingular.extendPath (Jet k) hT (directionalPath k (Pi.single j 1) T u) s) := + intervalIntegral.integral_congr (fun s _ => gradient_integrand_eq_heat hT hν k j u (t-s) s) + +/-- A spatial-gradient source operator equals heat applied to the differentiated source. -/ +theorem gradientSource_eq_heatSource {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (j : Fin 2) (u : WeaklySingular.Path (Jet (k+1)) T) : + kernelSourceOperator hT hν k j.succ (truncatePath k (k+1) (by omega) T u) = + heatSourcePath hT hν k (directionalPath k (Pi.single j 1) T u) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + exact (kernelSourceOperator_apply hT hν k j.succ _ t).trans + ((gradient_integral_eq_heat hT hν k j u t.val).trans + (heatSourcePath_apply hT hν k (directionalPath k (Pi.single j 1) T u) t).symm) + +private theorem path_sum_apply {ι : Type*} [Fintype ι] {T : ℝ} (k : ℕ) + (u : ι → WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (∑ i, u i) t = ∑ i, u i t := by + change (ContinuousMap.evalCLM ℝ t) ((WeaklySingular.pathEquiv (Jet k) T) (∑ i, u i)) = _ + simp only [map_sum] + rfl + +private theorem path_add_apply {T : ℝ} (k : ℕ) + (u v : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (u+v) t = u t+v t := rfl + +private theorem linear_source_sum {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (L : E →L[ℝ] E) (a b : E) (v : Fin 2 → E) : + L a + (L b + ∑ j, L (v j)) = L (a+b+∑ j, v j) := by + rw [map_add, map_add, map_sum] + abel + +namespace CompatibleData + +/-- The unique finite-jet solution used to represent the common scalar function. -/ +def solutionJet {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) (k : ℕ) : + WeaklySingular.Path (Jet k) T := + mildSolution hT hν k (D.coefficient k) (D.affinePath hT hν k) + +theorem solutionJet_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k n : ℕ) (hkn : k ≤ n) : + truncatePath k n hkn T (D.solutionJet hT hν n) = D.solutionJet hT hν k := by + exact (mildSolution_truncate hT hν k n hkn _ _ + (D.coefficient_truncate k n hkn) (D.affinePath hT hν n)).trans + (congrArg (mildSolution hT hν k (D.coefficient k)) (D.affinePath_truncate hT hν k n hkn)) + +/-- The true source after moving the drift derivatives off the heat kernel. -/ +def effectiveSource {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) (k : ℕ) : + WeaklySingular.Path (Jet k) T := + D.source k + productPath k (D.coefficient k 0) (D.solutionJet hT hν k) + + ∑ j : Fin 2, directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1))) + +private theorem solutionJet_eq_sources {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : + D.solutionJet hT hν k = D.affinePath hT hν k + + ∑ i : Fin 3, kernelSourceOperator hT hν k i + (productPath k (D.coefficient k i) (D.solutionJet hT hν k)) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + change D.solutionJet hT hν k t = _ + rw [path_add_apply, path_sum_apply] + have hu := mildSolution_spec hT hν k (D.coefficient k) (D.affinePath hT hν k) t + exact hu.trans (congrArg (fun z : Jet k => D.affinePath hT hν k t + z) + (Finset.sum_congr rfl (fun i _ => + (kernelSourceOperator_apply hT hν k i + (productPath k (D.coefficient k i) (D.solutionJet hT hν k)) t).symm))) + +private theorem gradientProduct_eq_heatSource {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (j : Fin 2) : + kernelSourceOperator hT hν k j.succ + (productPath k (D.coefficient k j.succ) (D.solutionJet hT hν k)) = + heatSourcePath hT hν k (directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1)))) := by + have hp : truncatePath k (k+1) (by omega) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1))) = + productPath k (D.coefficient k j.succ) (D.solutionJet hT hν k) := + (productPath_truncate k (k+1) (by omega) _ _ + (D.coefficient_truncate k (k+1) (by omega) j.succ) _).trans + (congrArg (productPath k (D.coefficient k j.succ)) + (D.solutionJet_truncate hT hν k (k+1) (by omega))) + exact (congrArg (kernelSourceOperator hT hν k j.succ) hp.symm).trans + (gradientSource_eq_heatSource hT hν k j _) + +/-- The common scalar solution satisfies a pure heat Duhamel equation at every jet order. -/ +theorem solutionJet_heat_form {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : + D.solutionJet hT hν k = initialHeatPath hν k (D.initial (k+1)) + + heatSourcePath hT hν k (D.effectiveSource hT hν k) := by + let H : WeaklySingular.Path (Jet k) T →L[ℝ] WeaklySingular.Path (Jet k) T := + WeaklySingular.integralOperator (Jet k) hT (heatKernel hν k T) + (heatKernel_continuous hν k T) (Real.sqrt (T+1)) (Real.sqrt_nonneg _) + (heatKernel_bound hν k T) + let p := productPath k (D.coefficient k 0) (D.solutionJet hT hν k) + let v : Fin 2 → WeaklySingular.Path (Jet k) T := fun j => + directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1))) + have hs : (∑ i : Fin 3, kernelSourceOperator hT hν k i + (productPath k (D.coefficient k i) (D.solutionJet hT hν k))) = + H p + ∑ j : Fin 2, H (v j) := by + rw [Fin.sum_univ_succ] + exact congrArg (fun z => H p + z) + (Finset.sum_congr rfl (fun j _ => D.gradientProduct_eq_heatSource hT hν k j)) + have hu := D.solutionJet_eq_sources hT hν k + calc + D.solutionJet hT hν k = + (initialHeatPath hν k (D.initial (k+1)) + H (D.source k)) + + (H p + ∑ j : Fin 2, H (v j)) := by + exact hu.trans (congrArg (fun z => D.affinePath hT hν k + z) hs) + _ = initialHeatPath hν k (D.initial (k+1)) + + (H (D.source k) + (H p + ∑ j : Fin 2, H (v j))) := add_assoc _ _ _ + _ = initialHeatPath hν k (D.initial (k+1)) + H (D.source k+p+∑ j, v j) := + congrArg (fun z => initialHeatPath hν k (D.initial (k+1)) + z) + (linear_source_sum H (D.source k) p v) + _ = _ := rfl + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJetTime.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJetTime.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1a7904bf9c5de2652a0363a9a904b3da3a2bcc6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJetTime.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildTimeEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetTimeDerivative + +namespace OAI + +/-! The scalar PDE holds as an ODE between successive finite spatial-jet spaces. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +def laplacianJetCLM (k : ℕ) : Jet (k+2) →L[ℝ] Jet k := + ∑ j : Fin 2, (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1)).comp + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ (k+1) (Pi.single j 1)) + +theorem function_laplacianJetCLM (k : ℕ) (J : Jet (k+2)) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (laplacianJetCLM k J) x = + ∑ j : Fin 2, PlaneHeat.spatialPartial ℝ j (PlaneHeat.spatialPartial ℝ j + (BoundedSpatialJets.function Plane ℝ (k+2) J)) x := by + let L : Jet k →L[ℝ] ℝ := + (BoundedContinuousFunction.evalCLM ℝ x).comp (BoundedSpatialJets.functionMap Plane ℝ k) + change L ((laplacianJetCLM k) J) = _ + simp only [laplacianJetCLM, sum_apply, ContinuousLinearMap.comp_apply, map_sum] + apply Finset.sum_congr rfl + intro j _ + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ (k+1) (Pi.single j 1) J)) x = _ + rw [BoundedSpatialJets.function_directionalDerivativeCLM] + have he : (BoundedSpatialJets.function Plane ℝ (k+1) + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ (k+1) (Pi.single j 1) J) : Plane → ℝ) = + PlaneHeat.spatialPartial ℝ j (BoundedSpatialJets.function Plane ℝ (k+2) J) := by + funext y + exact BoundedSpatialJets.function_directionalDerivativeCLM Plane ℝ (k+1) (Pi.single j 1) J y + rw [he] + rfl + +namespace CompatibleData + +def solutionJetValue {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) + (k : ℕ) (s : ℝ) : Jet k := WeaklySingular.extendPath (Jet k) hT (D.solutionJet hT hν k) s + +def timeRHSJet {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) + (k : ℕ) (s : ℝ) : Jet k := + ν • laplacianJetCLM k (D.solutionJetValue hT hν (k+2) s) + + WeaklySingular.extendPath (Jet k) hT (D.effectiveSource hT hν k) s + +theorem solutionJetValue_continuous {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : Continuous (D.solutionJetValue hT hν k) := + WeaklySingular.continuous_extendPath (Jet k) hT _ + +theorem timeRHSJet_continuous {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : Continuous (D.timeRHSJet hT hν k) := + ((laplacianJetCLM k).continuous.comp (D.solutionJetValue_continuous hT hν (k+2))).const_smul ν |>.add + (WeaklySingular.continuous_extendPath (Jet k) hT _) + +theorem solutionJetValue_function {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (s : ℝ) : + (BoundedSpatialJets.function Plane ℝ k (D.solutionJetValue hT hν k s) : Plane → ℝ) = + D.solutionValue hT hν s := by + funext x + exact D.solutionJet_function hT hν k (projIcc 0 T hT s) x + +theorem timeRHSJet_function {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (s : ℝ) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (D.timeRHSJet hT hν k s) x = + ν * ∑ j : Fin 2, PlaneHeat.spatialPartial ℝ j + (PlaneHeat.spatialPartial ℝ j (D.solutionValue hT hν s)) x + + D.effectiveSourceValue hT hν (projIcc 0 T hT s) x := by + rw [timeRHSJet, BoundedSpatialJets.function_add, BoundedSpatialJets.function_smul, + function_laplacianJetCLM, D.solutionJetValue_function] + change _ + sourceValue hT k (D.effectiveSource hT hν k) s x = _ + rw [D.sourceValue_effectiveSource] + rfl + +/-- The time derivative exists in the full jet norm, including the two endpoints. -/ +theorem solutionJetValue_hasDerivWithinAt {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) : + HasDerivWithinAt (D.solutionJetValue hT hν k) (D.timeRHSJet hT hν k t) + (Icc (0 : ℝ) T) t := by + apply BoundedSpatialJets.hasDerivWithinAt_of_pointwise_derivative k _ _ + (D.solutionJetValue_continuous hT hν k) (D.timeRHSJet_continuous hT hν k) _ ht + intro s hs x + have hd := D.solutionValue_interior_equation hT hν hs x + have he : (fun r => BoundedSpatialJets.function Plane ℝ k (D.solutionJetValue hT hν k r) x) = + (fun r => D.solutionValue hT hν r x) := by + funext r + exact congrFun (D.solutionJetValue_function hT hν k r) x + rw [he, D.timeRHSJet_function] + exact hd + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJointSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJointSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..9246171cec07fd298f332eb239865cb10690ff12 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildJointSmooth.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetJointSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildTimeSmooth + +namespace OAI + +/-! Joint smoothness of the actual scalar mild solution on the closed time slab. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild.CompatibleData +open ShearFlows Set +open scoped Topology ContDiff + +private def smoothCurves {T ν : ℝ} (hT : 0 < T) (hν : 0 < ν) (D : CompatibleData T) + (hs : ∀ k, ContDiffOn ℝ ∞ (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T)) : + BoundedSpatialJets.SmoothPlaneCurves T where + curve := D.solutionJetValue hT.le hν + smooth := hs + compatible := by + intro k n hkn t _ + have he := congrArg (fun q : WeaklySingular.Path (Jet k) T => + q (projIcc 0 T hT.le t)) (D.solutionJet_truncate hT.le hν k n hkn) + exact he + +/-- Norm-smooth time jets give joint smoothness, including the initial boundary. -/ +theorem solutionValue_smooth {T ν : ℝ} (hT : 0 < T) (hν : 0 < ν) (D : CompatibleData T) + (hs : ∀ k, ContDiffOn ℝ ∞ (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T)) : + ContDiffOn ℝ ∞ (Function.uncurry (D.solutionValue hT.le hν)) + (Icc (0 : ℝ) T ×ˢ (univ : Set Plane)) := by + have he : (smoothCurves hT hν D hs).value = Function.uncurry (D.solutionValue hT.le hν) := by + funext p + exact congrFun (D.solutionJetValue_function hT.le hν 0 p.1) p.2 + rw [← he] + exact (smoothCurves hT hν D hs).value_contDiffOn hT + +/-- Uniform bounds on any finite list of spatial derivative orders. -/ +theorem solutionValue_spatial_bounds {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (n : ℕ) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc (0 : ℝ) T, ∀ k ≤ n, ∀ x, + ‖iteratedFDeriv ℝ k (D.solutionValue hT hν t) x‖ ≤ B := by + choose C hC hc using D.solution_spatial_bound hT hν + refine ⟨∑ k ∈ Finset.range (n+1), C k, Finset.sum_nonneg (fun k _ => hC k), ?_⟩ + intro t _ k hk x + exact (hc k (projIcc 0 T hT t) x).trans + (Finset.single_le_sum (fun i _ => hC i) (Finset.mem_range.mpr (by omega))) + +end ForcedComputation.PlaneScalarMild.CompatibleData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildKernels.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildKernels.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd5623d4f81d7e84c80d2b5f30fd18b3f1ea88d0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildKernels.lean @@ -0,0 +1,170 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatTimeContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.WeaklySingularEquation + +namespace OAI + +/-! The three genuine heat kernels needed for the scalar mild equation on finite spatial jets. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Real Set ShearFlows +open scoped Topology + +abbrev Jet (k : ℕ) := BoundedSpatialJets.Space Plane ℝ k +abbrev PositiveTime := {r : ℝ // 0 < r} + +private def zeroExtension {E : Type*} [Zero E] (L : PositiveTime → E) (r : ℝ) : E := + if hr : 0 < r then L ⟨r,hr⟩ else 0 + +private theorem zeroExtension_continuous {E : Type*} [TopologicalSpace E] [Zero E] + (L : PositiveTime → E) (hL : Continuous L) : ContinuousOn (zeroExtension L) (Ioi 0) := by + apply continuousOn_iff_continuous_domRestrict.mpr + have he : (Ioi (0 : ℝ)).domRestrict (zeroExtension L) = L := by + funext r + exact dite_eq_left r.property + rw [he] + exact hL + +/-- The cutoff is one on the working interval and supplies a global square-root bound. -/ +def heatCutoff (T : ℝ) (r : PositiveTime) : ℝ := + min 1 (Real.sqrt (T+1) / Real.sqrt (r : ℝ)) + +theorem heatCutoff_continuous (T : ℝ) : Continuous (heatCutoff T) := by + exact continuous_const.min (continuous_const.div + (Real.continuous_sqrt.comp continuous_subtype_val) + (fun r => (Real.sqrt_pos.mpr r.property).ne')) + +theorem heatCutoff_nonneg (T : ℝ) (r : PositiveTime) : 0 ≤ heatCutoff T r := + le_min zero_le_one (div_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _)) + +theorem heatCutoff_le (T : ℝ) (r : PositiveTime) : + heatCutoff T r ≤ Real.sqrt (T+1) * WeaklySingular.inverseSqrt (r : ℝ) := by + simpa only [heatCutoff, div_eq_mul_inv, WeaklySingular.inverseSqrt] using + (min_le_right (1 : ℝ) (Real.sqrt (T+1) / Real.sqrt (r : ℝ))) + +theorem heatCutoff_eq_one {T : ℝ} (r : PositiveTime) (hr : (r : ℝ) ≤ T) : + heatCutoff T r = 1 := by + apply min_eq_left + apply (le_div_iff₀ (Real.sqrt_pos.mpr r.property)).mpr + simpa only [one_mul] using Real.sqrt_le_sqrt (show (r : ℝ) ≤ T+1 by linarith) + +private def scaledTime {ν : ℝ} (hν : 0 < ν) (r : PositiveTime) : PositiveTime := + ⟨ν * (r : ℝ), mul_pos hν r.property⟩ + +private theorem scaledTime_continuous {ν : ℝ} (hν : 0 < ν) : Continuous (scaledTime hν) := + (continuous_const.mul continuous_subtype_val).subtype_mk _ + +/-- The unmodified heat operator, set to zero only at nonpositive times. -/ +def rawHeatKernel {ν : ℝ} (hν : 0 < ν) (k : ℕ) : ℝ → Jet k →L[ℝ] Jet k := + zeroExtension (fun r => PlaneHeat.heatOperator ℝ k (ν * r.val) (mul_pos hν r.property)) + +/-- The globally square-root-bounded heat kernel, unchanged on the working interval. -/ +def heatKernel {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) : ℝ → Jet k →L[ℝ] Jet k := + zeroExtension (fun r => heatCutoff T r • + PlaneHeat.heatOperator ℝ k (ν * r.val) (mul_pos hν r.property)) + +/-- A Cartesian heat derivative needs no additional cutoff. -/ +def gradientKernel {ν : ℝ} (hν : 0 < ν) (k : ℕ) (j : Fin 2) : + ℝ → Jet k →L[ℝ] Jet k := + zeroExtension (fun r => PlaneHeat.gradientOperator ℝ k (ν * r.val) (mul_pos hν r.property) j) + +theorem rawHeatKernel_pos {ν r : ℝ} (hν : 0 < ν) (k : ℕ) (hr : 0 < r) : + rawHeatKernel hν k r = PlaneHeat.heatOperator ℝ k (ν*r) (mul_pos hν hr) := + dite_eq_left hr + +theorem rawHeatKernel_nonpos {ν r : ℝ} (hν : 0 < ν) (k : ℕ) (hr : r ≤ 0) : + rawHeatKernel hν k r = 0 := dite_eq_right (not_lt.mpr hr) + +theorem gradientKernel_pos {ν r : ℝ} (hν : 0 < ν) (k : ℕ) (j : Fin 2) (hr : 0 < r) : + gradientKernel hν k j r = PlaneHeat.gradientOperator ℝ k (ν*r) (mul_pos hν hr) j := + dite_eq_left hr + +theorem gradientKernel_nonpos {ν r : ℝ} (hν : 0 < ν) (k : ℕ) (j : Fin 2) (hr : r ≤ 0) : + gradientKernel hν k j r = 0 := dite_eq_right (not_lt.mpr hr) + +theorem heatKernel_continuous {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) : + ContinuousOn (heatKernel hν k T) (Ioi 0) := + zeroExtension_continuous _ ((heatCutoff_continuous T).smul + ((PlaneHeat.continuous_heatOperator ℝ k).comp (scaledTime_continuous hν))) + +theorem gradientKernel_continuous {ν : ℝ} (hν : 0 < ν) (k : ℕ) (j : Fin 2) : + ContinuousOn (gradientKernel hν k j) (Ioi 0) := + zeroExtension_continuous _ + ((PlaneHeat.continuous_gradientOperator ℝ k j).comp (scaledTime_continuous hν)) + +theorem heatKernel_eq_raw {ν T r : ℝ} (hν : 0 < ν) (k : ℕ) (hr : r ≤ T) : + heatKernel hν k T r = rawHeatKernel hν k r := by + by_cases hp : 0 < r + · simp only [heatKernel, rawHeatKernel, zeroExtension, dite_eq_left hp, + heatCutoff_eq_one ⟨r,hp⟩ hr, one_smul] + · simp only [heatKernel, rawHeatKernel, zeroExtension, dite_eq_right hp] + +theorem heatKernel_bound {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) : + ∀ r, 0 ≤ r → ‖heatKernel hν k T r‖ ≤ + Real.sqrt (T+1) * WeaklySingular.inverseSqrt r := by + intro r _ + by_cases hr : 0 < r + · rw [heatKernel, zeroExtension, dite_eq_left hr] + apply (ContinuousLinearMap.opNorm_smul_le _ _).trans + rw [Real.norm_eq_abs, abs_of_nonneg (heatCutoff_nonneg T ⟨r,hr⟩)] + exact (mul_le_mul_of_nonneg_left + (PlaneHeat.norm_heatOperator_le ℝ k (ν*r) (mul_pos hν hr)) + (heatCutoff_nonneg T ⟨r,hr⟩)).trans <| by + rw [mul_one] + exact heatCutoff_le T ⟨r,hr⟩ + · simp only [heatKernel, zeroExtension, dite_eq_right hr, ContinuousLinearMap.opNorm_zero] + exact mul_nonneg (Real.sqrt_nonneg _) (WeaklySingular.inverseSqrt_nonneg _) + +theorem gradientKernel_bound {ν : ℝ} (hν : 0 < ν) (k : ℕ) (j : Fin 2) : + ∀ r, 0 ≤ r → ‖gradientKernel hν k j r‖ ≤ + (2 / Real.sqrt ν) * WeaklySingular.inverseSqrt r := by + intro r _ + by_cases hr : 0 < r + · rw [gradientKernel, zeroExtension, dite_eq_left hr] + apply (PlaneHeat.norm_gradientOperator_le ℝ k (ν*r) (mul_pos hν hr) j).trans_eq + rw [Real.sqrt_mul hν.le] + simp only [div_eq_mul_inv, mul_inv_rev, WeaklySingular.inverseSqrt] + ring + · simp only [gradientKernel, zeroExtension, dite_eq_right hr, ContinuousLinearMap.opNorm_zero] + exact mul_nonneg (div_nonneg (by norm_num : (0 : ℝ) ≤ 2) (Real.sqrt_nonneg ν)) + (WeaklySingular.inverseSqrt_nonneg r) + +/-- Index zero is the heat term; the other two indices are Cartesian derivatives. -/ +def kernels {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) : + Fin 3 → ℝ → Jet k →L[ℝ] Jet k := + Fin.cases (heatKernel hν k T) (gradientKernel hν k) + +def rawKernels {ν : ℝ} (hν : 0 < ν) (k : ℕ) : Fin 3 → ℝ → Jet k →L[ℝ] Jet k := + Fin.cases (rawHeatKernel hν k) (gradientKernel hν k) + +def kernelConstants (ν T : ℝ) : Fin 3 → ℝ := + Fin.cases (Real.sqrt (T+1)) (fun _ => 2 / Real.sqrt ν) + +theorem kernelConstants_nonneg (ν T : ℝ) (i : Fin 3) : 0 ≤ kernelConstants ν T i := by + refine Fin.cases ?_ (fun j => ?_) i + · exact Real.sqrt_nonneg _ + · exact div_nonneg (by norm_num) (Real.sqrt_nonneg _) + +theorem kernels_continuous {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) (i : Fin 3) : + ContinuousOn (kernels hν k T i) (Ioi 0) := by + refine Fin.cases ?_ (fun j => ?_) i + · exact heatKernel_continuous hν k T + · exact gradientKernel_continuous hν k j + +theorem kernels_bound {ν : ℝ} (hν : 0 < ν) (k : ℕ) (T : ℝ) (i : Fin 3) : + ∀ r, 0 ≤ r → ‖kernels hν k T i r‖ ≤ kernelConstants ν T i * WeaklySingular.inverseSqrt r := by + refine Fin.cases ?_ (fun j => ?_) i + · exact heatKernel_bound hν k T + · exact gradientKernel_bound hν k j + +theorem kernels_eq_raw {ν T r : ℝ} (hν : 0 < ν) (k : ℕ) (hr : r ≤ T) (i : Fin 3) : + kernels hν k T i r = rawKernels hν k i r := by + refine Fin.cases ?_ (fun _ => rfl) i + exact heatKernel_eq_raw hν k hr + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPeriodicity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPeriodicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..238ce8f277b42e697aaadc595e6e618c5def87cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPeriodicity.lean @@ -0,0 +1,213 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildPointwise +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.BoundedSpatialJetTranslation + +namespace OAI + +/-! Spatial periodicity of the actual scalar mild solution, by translation and uniqueness. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows MeasureTheory +open scoped Topology Interval BigOperators + +def translationPath (k : ℕ) (a : Plane) (T : ℝ) : + WeaklySingular.Path (Jet k) T →L[ℝ] WeaklySingular.Path (Jet k) T := + (WeaklySingular.pathEquiv (Jet k) T).symm.toContinuousLinearEquiv.toContinuousLinearMap.comp + (((BoundedSpatialJets.translationCLM Plane ℝ k a).compLeftContinuous ℝ (Icc (0 : ℝ) T)).comp + (WeaklySingular.pathEquiv (Jet k) T).toContinuousLinearEquiv.toContinuousLinearMap) + +@[simp] theorem translationPath_apply (k : ℕ) (a : Plane) (T : ℝ) + (u : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + translationPath k a T u t = BoundedSpatialJets.translationCLM Plane ℝ k a (u t) := rfl + +theorem extendPath_translation {T : ℝ} (hT : 0 ≤ T) (k : ℕ) (a : Plane) + (u : WeaklySingular.Path (Jet k) T) (s : ℝ) : + WeaklySingular.extendPath (Jet k) hT (translationPath k a T u) s = + BoundedSpatialJets.translationCLM Plane ℝ k a (WeaklySingular.extendPath (Jet k) hT u s) := rfl + +theorem multiplication_translation (k : ℕ) (a : Plane) (b u : Jet k) : + BoundedSpatialJets.translationCLM Plane ℝ k a (multiplication k b u) = + multiplication k (BoundedSpatialJets.translationCLM Plane ℝ k a b) + (BoundedSpatialJets.translationCLM Plane ℝ k a u) := by + apply BoundedSpatialJets.function_injective Plane ℝ k + apply BoundedContinuousFunction.ext + intro x + simp only [BoundedSpatialJets.translationCLM_apply, BoundedSpatialJets.function_translation, + multiplication_apply] + +theorem rawHeatKernel_translation {ν : ℝ} (hν : 0 < ν) (k : ℕ) (a : Plane) + (r : ℝ) (u : Jet k) : + BoundedSpatialJets.translationCLM Plane ℝ k a (rawHeatKernel hν k r u) = + rawHeatKernel hν k r (BoundedSpatialJets.translationCLM Plane ℝ k a u) := by + by_cases hr : 0 < r + · rw [rawHeatKernel_pos hν k hr] + exact BoundedSpatialJets.translation_convolution Plane ℝ k a volume + (PlaneHeat.kernel (ν*r)) (PlaneHeat.kernel_integrable (mul_pos hν hr)) u + · simp only [rawHeatKernel_nonpos hν k (not_lt.mp hr), zero_apply, map_zero] + +theorem gradientKernel_translation {ν : ℝ} (hν : 0 < ν) (k : ℕ) (a : Plane) + (j : Fin 2) (r : ℝ) (u : Jet k) : + BoundedSpatialJets.translationCLM Plane ℝ k a (gradientKernel hν k j r u) = + gradientKernel hν k j r (BoundedSpatialJets.translationCLM Plane ℝ k a u) := by + by_cases hr : 0 < r + · rw [gradientKernel_pos hν k j hr] + exact BoundedSpatialJets.translation_convolution Plane ℝ k a volume + (PlaneHeat.kernelDerivative (ν*r) j) + (PlaneHeat.kernelDerivative_integrable (mul_pos hν hr) j) u + · simp only [gradientKernel_nonpos hν k j (not_lt.mp hr), zero_apply, map_zero] + +theorem rawKernels_translation {ν : ℝ} (hν : 0 < ν) (k : ℕ) (a : Plane) + (i : Fin 3) (r : ℝ) (u : Jet k) : + BoundedSpatialJets.translationCLM Plane ℝ k a (rawKernels hν k i r u) = + rawKernels hν k i r (BoundedSpatialJets.translationCLM Plane ℝ k a u) := + Fin.cases (rawHeatKernel_translation hν k a r u) + (fun j => gradientKernel_translation hν k a j r u) i + +theorem evolutionOperator_translation (k : ℕ) (a : Plane) (r : ℝ) (u : Jet k) : + BoundedSpatialJets.translationCLM Plane ℝ k a (PlaneHeat.evolutionOperator ℝ k r u) = + PlaneHeat.evolutionOperator ℝ k r (BoundedSpatialJets.translationCLM Plane ℝ k a u) := by + by_cases hr : 0 < r + · simp only [PlaneHeat.evolutionOperator, dite_eq_left hr] + exact BoundedSpatialJets.translation_convolution Plane ℝ k a volume + (PlaneHeat.kernel r) (PlaneHeat.kernel_integrable hr) u + · simp only [PlaneHeat.evolutionOperator, dite_eq_right hr, ContinuousLinearMap.id_apply] + +private theorem translate_mild_integrand {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (a : Plane) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hb : ∀ i t, BoundedSpatialJets.translationCLM Plane ℝ k a (b i t) = b i t) + (u : WeaklySingular.Path (Jet k) T) (i : Fin 3) (t s : ℝ) : + BoundedSpatialJets.translationCLM Plane ℝ k a + (rawKernels hν k i (t-s) (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT u s))) = + rawKernels hν k i (t-s) (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (translationPath k a T u) s)) := by + exact (rawKernels_translation hν k a i (t-s) _).trans + (congrArg (rawKernels hν k i (t-s)) + ((multiplication_translation k a _ _).trans + (congrArg₂ (fun p q : Jet k => multiplication k p q) + (hb i _) (extendPath_translation hT k a u s).symm))) + +private theorem translate_mild_integral {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (a : Plane) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hb : ∀ i t, BoundedSpatialJets.translationCLM Plane ℝ k a (b i t) = b i t) + (u : WeaklySingular.Path (Jet k) T) (i : Fin 3) (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.translationCLM Plane ℝ k a + (∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (b i (projIcc 0 T hT s)) (WeaklySingular.extendPath (Jet k) hT u s))) = + ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (translationPath k a T u) s)) := + map_integral_eq (BoundedSpatialJets.translationCLM Plane ℝ k a) + (mild_integrand_integrable hT hν k (b i) u i t) + (translate_mild_integrand hT hν k a b hb u i t.val) + +private theorem map_add_sum {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (P : E →L[ℝ] E) (u : E) (v : Fin 3 → E) : + P (u + ∑ i, v i) = P u + ∑ i, P (v i) := by + rw [map_add, map_sum] + +/-- A translation preserving the data also preserves the unique mild solution. -/ +theorem mildSolution_translation {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (a : Plane) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hb : ∀ i t, BoundedSpatialJets.translationCLM Plane ℝ k a (b i t) = b i t) + (g : WeaklySingular.Path (Jet k) T) + (hg : ∀ t, BoundedSpatialJets.translationCLM Plane ℝ k a (g t) = g t) : + translationPath k a T (mildSolution hT hν k b g) = mildSolution hT hν k b g := by + let u := mildSolution hT hν k b g + have hsol (t : Icc (0 : ℝ) T) := mildSolution_spec hT hν k b g t + apply (Classical.choose_spec (exists_unique_mild hT hν k b g)).2 + intro t + change BoundedSpatialJets.translationCLM Plane ℝ k a (u t) = _ + have he := congrArg (BoundedSpatialJets.translationCLM Plane ℝ k a) (hsol t) + exact he.trans ((map_add_sum _ _ _).trans + (congrArg₂ (fun x y : Jet k => x+y) (hg t) + (Finset.sum_congr rfl (fun i _ => translate_mild_integral hT hν k a b hb u i t)))) + +namespace CompatibleData + +private theorem affinePath_translation {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (a : Plane) + (hI : BoundedSpatialJets.translationCLM Plane ℝ k a (D.initial k) = D.initial k) + (hg : ∀ t, BoundedSpatialJets.translationCLM Plane ℝ k a (D.source k t) = D.source k t) + (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.translationCLM Plane ℝ k a (D.affinePath hT hν k t) = + D.affinePath hT hν k t := by + have hJ : BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) (D.initial (k+1)) = + D.initial k := D.initial_truncate k (k+1) (by omega) + have hf : D.affinePath hT hν k t = PlaneHeat.evolutionOperator ℝ k (ν*t.val) (D.initial k) + + ∫ s in 0..t.val, rawHeatKernel hν k (t.val-s) + (WeaklySingular.extendPath (Jet k) hT (D.source k) s) := by + change forcingPath hT hν k (D.initial (k+1)) (D.source k) t = _ + rw [forcingPath_apply, hJ] + have hi : BoundedSpatialJets.translationCLM Plane ℝ k a + (∫ s in 0..t.val, rawHeatKernel hν k (t.val-s) + (WeaklySingular.extendPath (Jet k) hT (D.source k) s)) = + ∫ s in 0..t.val, rawHeatKernel hν k (t.val-s) + (WeaklySingular.extendPath (Jet k) hT (D.source k) s) := by + apply map_integral_eq (BoundedSpatialJets.translationCLM Plane ℝ k a) + (rawKernel_path_integrable hT hν k (D.source k) 0 t) + intro s + exact (rawHeatKernel_translation hν k a (t.val-s) _).trans + (congrArg (rawHeatKernel hν k (t.val-s)) (hg (projIcc 0 T hT s))) + have he : BoundedSpatialJets.translationCLM Plane ℝ k a + (PlaneHeat.evolutionOperator ℝ k (ν*t.val) (D.initial k)) = + PlaneHeat.evolutionOperator ℝ k (ν*t.val) (D.initial k) := + (evolutionOperator_translation k a (ν*t.val) (D.initial k)).trans + (congrArg (PlaneHeat.evolutionOperator ℝ k (ν*t.val)) hI) + exact (congrArg (BoundedSpatialJets.translationCLM Plane ℝ k a) hf).trans + (((BoundedSpatialJets.translationCLM Plane ℝ k a).map_add _ _).trans + ((congrArg₂ (fun x y : Jet k => x+y) he hi).trans hf.symm)) + +/-- Periodicity is inherited by the actual compatible mild solution, not merely its data. -/ +theorem solution_periodic {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) + (hI : ∀ k, PlanePeriodic (BoundedSpatialJets.function Plane ℝ k (D.initial k))) + (hg : ∀ k t, PlanePeriodic (BoundedSpatialJets.function Plane ℝ k (D.source k t))) + (hb : ∀ k i t, PlanePeriodic (BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t))) + (t : Icc (0 : ℝ) T) : PlanePeriodic (D.solution hT hν t) := by + intro x z + let a : Plane := fun j => (z j : ℝ) + have hc (i : Fin 3) (s : Icc (0 : ℝ) T) : + BoundedSpatialJets.translationCLM Plane ℝ 0 a (D.coefficient 0 i s) = D.coefficient 0 i s := + BoundedSpatialJets.translation_eq_self Plane ℝ 0 a _ (fun y => hb 0 i s y z) + have hsource (s : Icc (0 : ℝ) T) : + BoundedSpatialJets.translationCLM Plane ℝ 0 a (D.source 0 s) = D.source 0 s := + BoundedSpatialJets.translation_eq_self Plane ℝ 0 a _ (fun y => hg 0 s y z) + have hinitial : BoundedSpatialJets.translationCLM Plane ℝ 0 a (D.initial 0) = D.initial 0 := + BoundedSpatialJets.translation_eq_self Plane ℝ 0 a _ (fun y => hI 0 y z) + have he := mildSolution_translation hT hν 0 a (D.coefficient 0) hc (D.affinePath hT hν 0) + (D.affinePath_translation hT hν 0 a hinitial hsource) + have hv := congrArg (fun u : WeaklySingular.Path (Jet 0) T => + BoundedSpatialJets.function Plane ℝ 0 (u t) x) he + change BoundedSpatialJets.function Plane ℝ 0 + (BoundedSpatialJets.translationCLM Plane ℝ 0 a (D.solutionJet hT hν 0 t)) x = + BoundedSpatialJets.function Plane ℝ 0 (D.solutionJet hT hν 0 t) x at hv + simpa only [BoundedSpatialJets.translationCLM_apply, BoundedSpatialJets.function_translation, + D.solutionJet_function hT hν] using hv + +/-- Actual periodic field representations supply all translation-invariance hypotheses. -/ +theorem solution_periodic_of_representatives {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) {w₀ : Plane → ℝ} (hpw : PlanePeriodic w₀) + {h : ℝ × Plane → ℝ} (hph : ∀ t, PlanePeriodic (fun x => h (t,x))) + {b : Fin 3 → ℝ × Plane → ℝ} (hpb : ∀ i t, PlanePeriodic (fun x => b i (t,x))) + (hinit : ∀ k x, BoundedSpatialJets.function Plane ℝ k (D.initial k) x = w₀ x) + (hsource : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) + (hcoeff : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) + (t : Icc (0 : ℝ) T) : PlanePeriodic (D.solution hT hν t) := by + apply D.solution_periodic hT hν + · intro k x z + rw [hinit, hinit] + exact hpw x z + · intro k s x z + rw [hsource, hsource] + exact hph s.val x z + · intro k i s x z + rw [hcoeff, hcoeff] + exact hpb i s.val x z + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPointwise.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPointwise.lean new file mode 100644 index 0000000000000000000000000000000000000000..9fd5668f84767e4ff57137d40c04f7ffca5f960c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildPointwise.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildHeatForm + +namespace OAI + +/-! Scalar interpretation of the effective source and initial value. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows MeasureTheory +open scoped Topology Interval BigOperators BoundedContinuousFunction + +private def scalarPathEvaluation {T : ℝ} (k : ℕ) (t : Icc (0 : ℝ) T) (x : Plane) : + WeaklySingular.Path (Jet k) T →L[ℝ] ℝ := + (BoundedContinuousFunction.evalCLM ℝ x).comp + ((BoundedSpatialJets.functionMap Plane ℝ k).comp + ((ContinuousMap.evalCLM ℝ t).comp + (WeaklySingular.pathEquiv (Jet k) T).toContinuousLinearEquiv.toContinuousLinearMap)) + +@[simp] private theorem scalarPathEvaluation_apply {T : ℝ} (k : ℕ) + (t : Icc (0 : ℝ) T) (x : Plane) (u : WeaklySingular.Path (Jet k) T) : + scalarPathEvaluation k t x u = BoundedSpatialJets.function Plane ℝ k (u t) x := rfl + +namespace CompatibleData + +theorem solutionJet_function {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (t : Icc (0 : ℝ) T) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (D.solutionJet hT hν k t) x = D.solution hT hν t x := + (commonFunction_eq hT hν D.coefficient (D.affinePath hT hν) + D.coefficient_truncate (D.affinePath_truncate hT hν) k t x).symm + +/-- The represented derivative of a coefficient product is the actual spatial derivative. -/ +private theorem product_directional_function {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (b : Fin 3 → ℝ × Plane → ℝ) + (hb : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) + (k : ℕ) (i : Fin 3) (v : Plane) (t : Icc (0 : ℝ) T) (x : Plane) : + scalarPathEvaluation k t x (directionalPath k v T + (productPath (k+1) (D.coefficient (k+1) i) (D.solutionJet hT hν (k+1)))) = + fderiv ℝ (fun y => b i (t.val,y) * D.solution hT hν t y) x v := by + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k v + (multiplication (k+1) (D.coefficient (k+1) i t) (D.solutionJet hT hν (k+1) t))) x = _ + rw [BoundedSpatialJets.function_directionalDerivativeCLM] + have he : (BoundedSpatialJets.function Plane ℝ (k+1) + (multiplication (k+1) (D.coefficient (k+1) i t) (D.solutionJet hT hν (k+1) t)) : Plane → ℝ) = + (fun y => b i (t.val,y) * D.solution hT hν t y) := by + funext y + rw [multiplication_apply, hb, D.solutionJet_function] + rw [he] + +/-- The Banach-space effective source has the expected divergence-form scalar value. -/ +theorem effectiveSource_function {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (h : ℝ × Plane → ℝ) (b : Fin 3 → ℝ × Plane → ℝ) + (hh : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) + (hb : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) + (k : ℕ) (t : Icc (0 : ℝ) T) (x : Plane) : + BoundedSpatialJets.function Plane ℝ k (D.effectiveSource hT hν k t) x = + h (t.val,x) + b 0 (t.val,x) * D.solution hT hν t x + + ∑ j : Fin 2, fderiv ℝ (fun y => b j.succ (t.val,y) * D.solution hT hν t y) x + (Pi.single j 1) := by + change scalarPathEvaluation k t x (D.source k + + productPath k (D.coefficient k 0) (D.solutionJet hT hν k) + + ∑ j : Fin 2, directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1)))) = _ + rw [map_add, map_add, map_sum] + simp only [scalarPathEvaluation_apply, productPath_apply, multiplication_apply, hh, hb, + D.solutionJet_function] + exact congrArg (fun z : ℝ => h (t.val,x) + b 0 (t.val,x) * D.solution hT hν t x + z) + (Finset.sum_congr rfl (fun j _ => D.product_directional_function hT hν b hb k j.succ + (Pi.single j 1) t x)) + +/-- The mild solution takes exactly its prescribed initial value. -/ +theorem solution_initial {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (x : Plane) : + D.solution hT hν ⟨0, le_rfl, hT⟩ x = BoundedSpatialJets.function Plane ℝ 0 (D.initial 0) x := by + let t₀ : Icc (0 : ℝ) T := ⟨0, le_rfl, hT⟩ + have he := congrArg (fun u : WeaklySingular.Path (Jet 0) T => u t₀) + (D.solutionJet_heat_form hT hν 0) + change D.solutionJet hT hν 0 t₀ = initialHeatPath hν 0 (D.initial 1) t₀ + + heatSourcePath hT hν 0 (D.effectiveSource hT hν 0) t₀ at he + rw [initialHeatPath_apply, heatSourcePath_apply] at he + simp only [t₀, mul_zero, PlaneHeat.evolutionOperator_initial, ContinuousLinearMap.id_apply, + intervalIntegral.integral_same, add_zero] at he + have hJ := D.initial_truncate 0 1 (by omega) + have hs := congrArg (fun J : Jet 0 => BoundedSpatialJets.function Plane ℝ 0 J x) (he.trans hJ) + exact (D.solutionJet_function hT hν 0 t₀ x).symm.trans hs + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5222baa3e11a81fb551218cc0d496e16d16450e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSmooth.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildTruncation + +namespace OAI + +/-! A common spatially smooth function represented by compatible finite-jet mild solutions. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows MeasureTheory +open scoped Topology ContDiff Interval BigOperators + +/-- The uniquely determined continuous solution at a fixed finite jet order. -/ +def mildSolution {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (a : WeaklySingular.Path (Jet k) T) : WeaklySingular.Path (Jet k) T := + Classical.choose (exists_unique_mild hT hν k b a) + +theorem mildSolution_spec {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k : ℕ) (b : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (a : WeaklySingular.Path (Jet k) T) : + ∀ t : Icc (0 : ℝ) T, mildSolution hT hν k b a t = a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (mildSolution hT hν k b a) s)) := + (Classical.choose_spec (exists_unique_mild hT hν k b a)).1 + +theorem mildSolution_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) + (b : Fin 3 → C(Icc (0 : ℝ) T, Jet n)) + (c : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ i t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b i t) = c i t) + (a : WeaklySingular.Path (Jet n) T) : + truncatePath k n hkn T (mildSolution hT hν n b a) = + mildSolution hT hν k c (truncatePath k n hkn T a) := + mild_solutions_compatible hT hν k n hkn b c hbc a _ _ + (mildSolution_spec hT hν n b a) (mildSolution_spec hT hν k c (truncatePath k n hkn T a)) + +variable {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (b : ∀ k, Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (a : ∀ k, WeaklySingular.Path (Jet k) T) + +/-- The common scalar function is read from the uniquely determined zeroth-order path. -/ +def commonFunction (t : Icc (0 : ℝ) T) (x : Plane) : ℝ := + BoundedSpatialJets.function Plane ℝ 0 (mildSolution hT hν 0 (b 0) (a 0) t) x + +variable + (hb : ∀ k n (hkn : k ≤ n) i t, + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b n i t) = b k i t) + (ha : ∀ k n (hkn : k ≤ n), truncatePath k n hkn T (a n) = a k) + +include hb ha in +theorem commonFunction_eq (k : ℕ) (t : Icc (0 : ℝ) T) (x : Plane) : + commonFunction hT hν b a t x = + BoundedSpatialJets.function Plane ℝ k (mildSolution hT hν k (b k) (a k) t) x := by + have he := mildSolution_truncate hT hν 0 k (Nat.zero_le k) (b k) (b 0) + (hb 0 k (Nat.zero_le k)) (a k) + rw [ha 0 k (Nat.zero_le k)] at he + have hp := congrArg (fun u : WeaklySingular.Path (Jet 0) T => + BoundedSpatialJets.function Plane ℝ 0 (u t) x) he + change BoundedSpatialJets.function Plane ℝ 0 + (BoundedSpatialJets.truncate Plane ℝ 0 k (Nat.zero_le k) + (mildSolution hT hν k (b k) (a k) t)) x = commonFunction hT hν b a t x at hp + rw [BoundedSpatialJets.function_truncate] at hp + exact hp.symm + +include hb ha in +/-- Every finite-order solution represents the same spatially smooth scalar function. -/ +theorem commonFunction_smooth (t : Icc (0 : ℝ) T) : + ContDiff ℝ ∞ (commonFunction hT hν b a t) := by + apply contDiff_infty.mpr + intro k + have he : commonFunction hT hν b a t = + BoundedSpatialJets.function Plane ℝ k (mildSolution hT hν k (b k) (a k) t) := by + funext x + exact commonFunction_eq hT hν b a hb ha k t x + rw [he] + exact BoundedSpatialJets.function_contDiff Plane ℝ k _ + +include hb ha in +/-- On the compact time interval every spatial derivative is uniformly bounded. -/ +theorem commonFunction_spatial_bound (k : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t : Icc (0 : ℝ) T, ∀ x : Plane, + ‖iteratedFDeriv ℝ k (commonFunction hT hν b a t) x‖ ≤ C := by + let u := mildSolution hT hν k (b k) (a k) + refine ⟨‖u‖, norm_nonneg _, ?_⟩ + intro t x + have he : commonFunction hT hν b a t = BoundedSpatialJets.function Plane ℝ k (u t) := by + funext y + exact commonFunction_eq hT hν b a hb ha k t y + rw [he] + exact (BoundedSpatialJets.norm_iteratedFDeriv_le Plane ℝ k (u t) k le_rfl x).trans + (((WeaklySingular.pathEquiv (Jet k) T u).norm_coe_le_norm t).trans_eq + ((WeaklySingular.pathEquiv (Jet k) T).norm_map u)) + +include hb ha in +/-- Every spatial derivative of the common function varies jointly continuously. -/ +theorem commonFunction_spatial_continuous (k : ℕ) : + Continuous (fun p : Icc (0 : ℝ) T × Plane => + iteratedFDeriv ℝ k (commonFunction hT hν b a p.1) p.2) := by + let u := mildSolution hT hν k (b k) (a k) + let i : Fin (k+1) := ⟨k, Nat.lt_succ_self k⟩ + have hc : Continuous (fun t : Icc (0 : ℝ) T => (u t).val i) := + (BoundedSpatialJets.projection Plane ℝ k i).continuous.comp + (WeaklySingular.pathEquiv (Jet k) T u).continuous + have he (t : Icc (0 : ℝ) T) : commonFunction hT hν b a t = + BoundedSpatialJets.function Plane ℝ k (u t) := by + funext x + exact commonFunction_eq hT hν b a hb ha k t x + have hj : (fun p : Icc (0 : ℝ) T × Plane => + iteratedFDeriv ℝ k (commonFunction hT hν b a p.1) p.2) = + (fun p => (u p.1).val i p.2) := by + funext p + rw [he p.1] + exact congrFun (BoundedSpatialJets.iteratedFDeriv_function Plane ℝ k (u p.1) k le_rfl) p.2 + rw [hj] + exact (hc.comp continuous_fst).eval continuous_snd + +/-- Continuity in time is in the uniform norm, so evaluation is jointly continuous. -/ +theorem commonFunction_continuous : + Continuous (fun p : Icc (0 : ℝ) T × Plane => commonFunction hT hν b a p.1 p.2) := by + have hc : Continuous (fun t : Icc (0 : ℝ) T => BoundedSpatialJets.function Plane ℝ 0 + (mildSolution hT hν 0 (b 0) (a 0) t)) := + (BoundedSpatialJets.functionMap Plane ℝ 0).continuous.comp + (WeaklySingular.pathEquiv (Jet 0) T (mildSolution hT hν 0 (b 0) (a 0))).continuous + exact (hc.comp continuous_fst).eval continuous_snd + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSource.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecc15c5d3b1e1b2c8088500f98c0a746d7b0ae77 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSource.lean @@ -0,0 +1,152 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildTruncation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatInitialContinuity + +namespace OAI + +/-! The canonical initial-data and source paths for the finite-jet mild equation. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set Filter MeasureTheory ShearFlows +open scoped Topology Interval BigOperators + +/-- Strong continuity of heat evolution on any jet with one extra bounded derivative. -/ +theorem initialHeat_continuousOn {ν : ℝ} (hν : 0 < ν) (k : ℕ) (J : Jet (k+1)) : + ContinuousOn (fun t : ℝ => PlaneHeat.evolutionOperator ℝ k (ν*t) + (BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) J)) (Ici 0) := by + let v := BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) J + have hc : ContinuousOn (fun r : ℝ => PlaneHeat.evolutionOperator ℝ k r v) (Ioi 0) := by + apply continuousOn_iff_continuous_domRestrict.mpr + have he : (fun r : Ioi (0 : ℝ) => PlaneHeat.evolutionOperator ℝ k r.val v) = + (fun r : Ioi (0 : ℝ) => PlaneHeat.heatOperator ℝ k r.val r.property v) := by + funext r + have hr : 0 < r.val := r.property + have he : PlaneHeat.evolutionOperator ℝ k r.val = PlaneHeat.heatOperator ℝ k r.val hr := + dite_eq_left hr + exact congrArg (fun L : Jet k →L[ℝ] Jet k => L v) he + change Continuous (fun r : Ioi (0 : ℝ) => PlaneHeat.evolutionOperator ℝ k r.val v) + rw [he] + exact (PlaneHeat.continuous_heatOperator ℝ k).clm_apply continuous_const + intro t ht + by_cases hz : t = 0 + · subst t + apply ContinuousAt.continuousWithinAt + change Tendsto (fun s : ℝ => PlaneHeat.evolutionOperator ℝ k (ν*s) v) + (𝓝 0) (𝓝 (PlaneHeat.evolutionOperator ℝ k (ν*0) v)) + have hd := (PlaneHeat.evolutionOperator_truncate_tendsto ℝ k J).comp + (show Tendsto (fun s : ℝ => ν*s) (𝓝 0) (𝓝 0) by + simpa only [mul_zero] using + (show Continuous (fun s : ℝ => ν*s) from continuous_const.mul continuous_id).tendsto (0 : ℝ)) + simpa only [Function.comp_def, v, mul_zero, PlaneHeat.evolutionOperator_initial, ContinuousLinearMap.id_apply] + using hd + · have hp : 0 < ν*t := mul_pos hν (lt_of_le_of_ne ht (fun h => hz h.symm)) + exact ((hc.continuousAt (Ioi_mem_nhds hp)).comp + (f := fun s : ℝ => ν*s) (continuousAt_const.mul continuousAt_id)).continuousWithinAt + +/-- The initial heat evolution as a continuous path, including time zero. -/ +def initialHeatPath {T ν : ℝ} (hν : 0 < ν) (k : ℕ) (J : Jet (k+1)) : + WeaklySingular.Path (Jet k) T := + (WeaklySingular.pathEquiv (Jet k) T).symm + ⟨fun t => PlaneHeat.evolutionOperator ℝ k (ν*t.val) + (BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) J), + (initialHeat_continuousOn hν k J).comp_continuous continuous_subtype_val + (fun t => t.property.1)⟩ + +@[simp] theorem initialHeatPath_apply {T ν : ℝ} (hν : 0 < ν) (k : ℕ) + (J : Jet (k+1)) (t : Icc (0 : ℝ) T) : + initialHeatPath (T := T) hν k J t = PlaneHeat.evolutionOperator ℝ k (ν*t.val) + (BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) J) := rfl + +/-- The artificial positive-time cutoff disappears on the finite integration interval. -/ +def heatSourcePath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (g : WeaklySingular.Path (Jet k) T) : WeaklySingular.Path (Jet k) T := + WeaklySingular.integralOperator (Jet k) hT (heatKernel hν k T) + (heatKernel_continuous hν k T) (Real.sqrt (T+1)) (Real.sqrt_nonneg _) + (heatKernel_bound hν k T) g + +@[simp] theorem heatSourcePath_apply {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (g : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + heatSourcePath hT hν k g t = ∫ s in 0..t.val, + rawHeatKernel hν k (t.val-s) (WeaklySingular.extendPath (Jet k) hT g s) := by + change (∫ s in 0..t.val, heatKernel hν k T (t.val-s) + (WeaklySingular.extendPath (Jet k) hT g s)) = _ + apply intervalIntegral.integral_congr + intro s hs + rw [uIcc_of_le t.property.1] at hs + exact congrArg (fun L : Jet k →L[ℝ] Jet k => L + (WeaklySingular.extendPath (Jet k) hT g s)) + (heatKernel_eq_raw hν k ((sub_le_self _ hs.1).trans t.property.2)) + +/-- Heat evolution and truncation commute also at the initial time. -/ +theorem evolutionOperator_truncate (k n : ℕ) (hkn : k ≤ n) (r : ℝ) (J : Jet n) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (PlaneHeat.evolutionOperator ℝ n r J) = + PlaneHeat.evolutionOperator ℝ k r (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn J) := by + by_cases hr : 0 < r + · simp only [PlaneHeat.evolutionOperator, dite_eq_left hr] + exact (BoundedSpatialJets.convolution_truncate Plane ℝ k n hkn volume + (PlaneHeat.kernel r) (PlaneHeat.kernel_integrable hr) J).symm + · simp only [PlaneHeat.evolutionOperator, dite_eq_right hr, ContinuousLinearMap.id_apply] + +/-- The inhomogeneous source path is compatible with every finite-order truncation. -/ +theorem heatSourcePath_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) (g : WeaklySingular.Path (Jet n) T) : + truncatePath k n hkn T (heatSourcePath hT hν n g) = + heatSourcePath hT hν k (truncatePath k n hkn T g) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + change BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (heatSourcePath hT hν n g t) = _ + simp only [heatSourcePath_apply] + exact rawKernelIntegral_truncate hT hν k n hkn g 0 t + +/-- The initial paths inherit compatibility from their initial jets. -/ +theorem initialHeatPath_truncate {T ν : ℝ} (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) (J : Jet (n+1)) (K : Jet (k+1)) + (hJK : BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (BoundedSpatialJets.truncate Plane ℝ n (n+1) (by omega) J) = + BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) K) : + truncatePath k n hkn T (initialHeatPath hν n J) = initialHeatPath hν k K := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + change BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (PlaneHeat.evolutionOperator ℝ n (ν*t.val) + (BoundedSpatialJets.truncate Plane ℝ n (n+1) (by omega) J)) = _ + exact (evolutionOperator_truncate k n hkn (ν*t.val) _).trans + (congrArg (PlaneHeat.evolutionOperator ℝ k (ν*t.val)) hJK) + +/-- The actual affine forcing path in the scalar variation-of-constants equation. -/ +def forcingPath {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (J : Jet (k+1)) (g : WeaklySingular.Path (Jet k) T) : + WeaklySingular.Path (Jet k) T := initialHeatPath hν k J + heatSourcePath hT hν k g + +@[simp] theorem forcingPath_apply {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (J : Jet (k+1)) (g : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + forcingPath hT hν k J g t = + PlaneHeat.evolutionOperator ℝ k (ν*t.val) + (BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) J) + + ∫ s in 0..t.val, rawHeatKernel hν k (t.val-s) + (WeaklySingular.extendPath (Jet k) hT g s) := by + change initialHeatPath hν k J t + heatSourcePath hT hν k g t = _ + rw [initialHeatPath_apply, heatSourcePath_apply] + +/-- Canonical forcing paths retain compatibility at every spatial derivative order. -/ +theorem forcingPath_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) (J : Jet (n+1)) (K : Jet (k+1)) + (hJK : BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (BoundedSpatialJets.truncate Plane ℝ n (n+1) (by omega) J) = + BoundedSpatialJets.truncate Plane ℝ k (k+1) (by omega) K) + (g : WeaklySingular.Path (Jet n) T) : + truncatePath k n hkn T (forcingPath hT hν n J g) = + forcingPath hT hν k K (truncatePath k n hkn T g) := by + change truncatePath k n hkn T (initialHeatPath hν n J + heatSourcePath hT hν n g) = _ + rw [map_add, initialHeatPath_truncate hν k n hkn J K hJK, heatSourcePath_truncate] + rfl + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSourceRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSourceRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1492071573e05a9b647b43ecb6254a802794e28 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildSourceRegularity.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildPointwise + +namespace OAI + +/-! Compatibility and spatial regularity of the effective heat source. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows +open scoped Topology ContDiff BigOperators + +theorem directionalPath_truncate {T : ℝ} (k n : ℕ) (hkn : k ≤ n) (v : Plane) + (u : WeaklySingular.Path (Jet (n+1)) T) : + truncatePath k n hkn T (directionalPath n v T u) = + directionalPath k v T (truncatePath (k+1) (n+1) (Nat.add_le_add_right hkn 1) T u) := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + exact BoundedSpatialJets.directionalDerivativeCLM_truncate Plane ℝ k n hkn v (u t) + +private theorem map_add_add_sum {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] (P : E →L[ℝ] F) + (a b : E) (v : Fin 2 → E) : + P (a+b+∑ j, v j) = P a+P b+∑ j, P (v j) := by + rw [map_add, map_add, map_sum] + +namespace CompatibleData + +private theorem product_solution_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k n : ℕ) (hkn : k ≤ n) (i : Fin 3) : + truncatePath k n hkn T (productPath n (D.coefficient n i) (D.solutionJet hT hν n)) = + productPath k (D.coefficient k i) (D.solutionJet hT hν k) := + (productPath_truncate k n hkn _ _ (D.coefficient_truncate k n hkn i) _).trans + (congrArg (productPath k (D.coefficient k i)) (D.solutionJet_truncate hT hν k n hkn)) + +private theorem directional_product_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k n : ℕ) (hkn : k ≤ n) (j : Fin 2) : + truncatePath k n hkn T (directionalPath n (Pi.single j 1) T + (productPath (n+1) (D.coefficient (n+1) j.succ) (D.solutionJet hT hν (n+1)))) = + directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1))) := + (directionalPath_truncate k n hkn (Pi.single j 1) _).trans + (congrArg (directionalPath k (Pi.single j 1) T) + (D.product_solution_truncate hT hν (k+1) (n+1) (Nat.add_le_add_right hkn 1) j.succ)) + +/-- The effective source represents the same function at every jet order. -/ +theorem effectiveSource_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k n : ℕ) (hkn : k ≤ n) : + truncatePath k n hkn T (D.effectiveSource hT hν n) = D.effectiveSource hT hν k := by + let P := truncatePath k n hkn T + exact (map_add_add_sum P (D.source n) + (productPath n (D.coefficient n 0) (D.solutionJet hT hν n)) + (fun j => directionalPath n (Pi.single j 1) T + (productPath (n+1) (D.coefficient (n+1) j.succ) (D.solutionJet hT hν (n+1))))).trans + (congrArg₂ (fun u v : WeaklySingular.Path (Jet k) T => u+v) + (congrArg₂ (fun u v : WeaklySingular.Path (Jet k) T => u+v) + (D.source_truncate k n hkn) (D.product_solution_truncate hT hν k n hkn 0)) + (Finset.sum_congr rfl (fun j _ => D.directional_product_truncate hT hν k n hkn j))) + +/-- The common scalar effective source. -/ +def effectiveSourceValue {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (t : Icc (0 : ℝ) T) (x : Plane) : ℝ := + BoundedSpatialJets.function Plane ℝ 0 (D.effectiveSource hT hν 0 t) x + +theorem effectiveSourceValue_eq {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (t : Icc (0 : ℝ) T) (x : Plane) : + D.effectiveSourceValue hT hν t x = + BoundedSpatialJets.function Plane ℝ k (D.effectiveSource hT hν k t) x := by + have he := congrArg (fun u : WeaklySingular.Path (Jet 0) T => + BoundedSpatialJets.function Plane ℝ 0 (u t) x) + (D.effectiveSource_truncate hT hν 0 k (Nat.zero_le k)) + change BoundedSpatialJets.function Plane ℝ 0 + (BoundedSpatialJets.truncate Plane ℝ 0 k (Nat.zero_le k) (D.effectiveSource hT hν k t)) x = + D.effectiveSourceValue hT hν t x at he + rw [BoundedSpatialJets.function_truncate] at he + exact he.symm + +/-- The effective source has smooth spatial slices, obtained from the compatible finite jets. -/ +theorem effectiveSource_smooth {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (t : Icc (0 : ℝ) T) : + ContDiff ℝ ∞ (D.effectiveSourceValue hT hν t) := by + apply contDiff_infty.mpr + intro k + have he : D.effectiveSourceValue hT hν t = + BoundedSpatialJets.function Plane ℝ k (D.effectiveSource hT hν k t) := by + funext x + exact D.effectiveSourceValue_eq hT hν k t x + rw [he] + exact BoundedSpatialJets.function_contDiff Plane ℝ k _ + +/-- Every spatial derivative of the effective source varies jointly continuously. -/ +theorem effectiveSource_spatial_continuous {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) : + Continuous (fun p : Icc (0 : ℝ) T × Plane => + iteratedFDeriv ℝ k (D.effectiveSourceValue hT hν p.1) p.2) := by + let u := D.effectiveSource hT hν k + let i : Fin (k+1) := ⟨k, Nat.lt_succ_self k⟩ + have hc : Continuous (fun t : Icc (0 : ℝ) T => (u t).val i) := + (BoundedSpatialJets.projection Plane ℝ k i).continuous.comp + (WeaklySingular.pathEquiv (Jet k) T u).continuous + have he (t : Icc (0 : ℝ) T) : D.effectiveSourceValue hT hν t = + BoundedSpatialJets.function Plane ℝ k (u t) := by + funext x + exact D.effectiveSourceValue_eq hT hν k t x + have hj : (fun p : Icc (0 : ℝ) T × Plane => + iteratedFDeriv ℝ k (D.effectiveSourceValue hT hν p.1) p.2) = + (fun p => (u p.1).val i p.2) := by + funext p + rw [he p.1] + exact congrFun (BoundedSpatialJets.iteratedFDeriv_function Plane ℝ k (u p.1) k le_rfl) p.2 + rw [hj] + exact (hc.comp continuous_fst).eval continuous_snd + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..98765497da4a899b841254ef11b314413c5bcbab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeEquation.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneHeatDuhamelEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildSourceRegularity + +namespace OAI + +/-! The actual time equation of the compatible scalar mild solution. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild.CompatibleData +open ShearFlows Set Filter MeasureTheory +open scoped Topology ContDiff Interval BigOperators + +def initialValue {T : ℝ} (D : CompatibleData T) : Plane → ℝ := + BoundedSpatialJets.function Plane ℝ 0 (D.initial 0) + +theorem initialValue_eq {T : ℝ} (D : CompatibleData T) (k : ℕ) : + D.initialValue = (BoundedSpatialJets.function Plane ℝ k (D.initial k) : Plane → ℝ) := by + funext x + have he := congrArg (fun J : Jet 0 => BoundedSpatialJets.function Plane ℝ 0 J x) + (D.initial_truncate 0 k (Nat.zero_le k)) + change BoundedSpatialJets.function Plane ℝ 0 + (BoundedSpatialJets.truncate Plane ℝ 0 k (Nat.zero_le k) (D.initial k)) x = D.initialValue x at he + rw [BoundedSpatialJets.function_truncate] at he + exact he.symm + +theorem initialValue_smooth {T : ℝ} (D : CompatibleData T) : ContDiff ℝ ∞ D.initialValue := by + apply contDiff_infty.mpr + intro k + rw [D.initialValue_eq k] + exact BoundedSpatialJets.function_contDiff Plane ℝ k _ + +def solutionValue {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (D : CompatibleData T) + (t : ℝ) (x : Plane) : ℝ := D.solution hT hν (projIcc 0 T hT t) x + +theorem solutionValue_heat_form {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) T) (x : Plane) : + D.solutionValue hT hν t x = PlaneHeat.evolution ℝ D.initialValue (ν*t) x + + heatSourceValue hT hν 3 (D.effectiveSource hT hν 3) t x := by + let t' : Icc (0 : ℝ) T := ⟨t, ht⟩ + have hs := congrArg (fun u : WeaklySingular.Path (Jet 3) T => u t') + (D.solutionJet_heat_form hT hν 3) + change D.solutionJet hT hν 3 t' = initialHeatPath hν 3 (D.initial 4) t' + + heatSourcePath hT hν 3 (D.effectiveSource hT hν 3) t' at hs + have he : (BoundedSpatialJets.function Plane ℝ 3 + (BoundedSpatialJets.truncate Plane ℝ 3 4 (by omega) (D.initial 4)) : Plane → ℝ) = + D.initialValue := by + funext y + rw [BoundedSpatialJets.function_truncate, D.initialValue_eq 4] + change D.solution hT hν (projIcc 0 T hT t) x = _ + rw [projIcc_of_mem hT ht, ← D.solutionJet_function hT hν 3] + rw [hs, BoundedSpatialJets.function_add, initialHeatPath_apply, PlaneHeat.evolutionOperator_function, he] + simp only [heatSourceValue, sourceValue, WeaklySingular.extendPath, + projIcc_of_mem hT ht, t'] + +theorem sourceValue_effectiveSource {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (s : ℝ) : + sourceValue hT k (D.effectiveSource hT hν k) s = + D.effectiveSourceValue hT hν (projIcc 0 T hT s) := by + funext x + exact (D.effectiveSourceValue_eq hT hν k (projIcc 0 T hT s) x).symm + +theorem solutionValue_interior_equation {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) T) (x : Plane) : + HasDerivAt (fun s => D.solutionValue hT hν s x) + (ν * ∑ j : Fin 2, PlaneHeat.spatialPartial ℝ j + (PlaneHeat.spatialPartial ℝ j (D.solutionValue hT hν t)) x + + D.effectiveSourceValue hT hν (projIcc 0 T hT t) x) t := by + have hq (s : ℝ) : ContDiff ℝ ∞ (sourceValue hT 3 (D.effectiveSource hT hν 3) s) := by + rw [D.sourceValue_effectiveSource hT hν] + exact D.effectiveSource_smooth hT hν _ + have hd := PlaneHeat.hasDerivAt_duhamel hT hν D.initialValue D.initialValue_smooth + (D.initial 3) (D.initialValue_eq 3).symm (D.effectiveSource hT hν 3) hq ht x + have he : D.solutionValue hT hν t = (fun y => + PlaneHeat.evolution ℝ D.initialValue (ν*t) y + + heatSourceValue hT hν 3 (D.effectiveSource hT hν 3) t y) := by + funext y + exact D.solutionValue_heat_form hT hν ⟨ht.1.le, ht.2.le⟩ y + rw [D.sourceValue_effectiveSource hT hν, ← he] at hd + apply hd.congr_of_eventuallyEq + filter_upwards [isOpen_Ioo.mem_nhds ht] with s hs + exact D.solutionValue_heat_form hT hν ⟨hs.1.le, hs.2.le⟩ x + +end ForcedComputation.PlaneScalarMild.CompatibleData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..b775e90f29357afa2beac60364853f4f15cbf4d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTimeSmooth.lean @@ -0,0 +1,171 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildJetTime +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientTimeJets + +namespace OAI + +/-! Time smoothness of every spatial jet of the actual scalar mild solution. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Set ShearFlows +open scoped Topology ContDiff BigOperators + +private theorem multiplication_contDiffOn {T : ℝ} {n : ℕ∞ω} (k : ℕ) + {b u : ℝ → Jet k} (hb : ContDiffOn ℝ n b (Icc (0 : ℝ) T)) + (hu : ContDiffOn ℝ n u (Icc (0 : ℝ) T)) : + ContDiffOn ℝ n (fun t => multiplication k (b t) (u t)) (Icc (0 : ℝ) T) := by + let B := BoundedSpatialJets.bilinearCLM Plane ℝ ℝ ℝ k (ContinuousLinearMap.mul ℝ ℝ) + let L := BoundedSpatialJets.operatorEquiv Plane ℝ ℝ k + have hB : ContDiffOn ℝ n (fun t => B (b t)) (Icc (0 : ℝ) T) := + B.contDiff.comp_contDiffOn hb + have hLb : IsBoundedLinearMap ℝ + (fun A : BoundedSpatialJets.Operator Plane ℝ ℝ k => (L A : Jet k →L[ℝ] Jet k)) := + { map_add := fun _ _ => rfl + map_smul := fun _ _ => rfl + bound := ⟨1, zero_lt_one, fun A => by + simpa only [one_mul] using (le_of_eq (L.norm_map A))⟩ } + have hL : ContDiffOn ℝ n (fun t => L (B (b t))) (Icc (0 : ℝ) T) := + hLb.contDiff.comp_contDiffOn hB + exact hL.clm_apply hu + +private theorem path_add_eval {T : ℝ} (k : ℕ) + (u v : WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (u+v) t = u t+v t := rfl + +private theorem path_sum_eval {T : ℝ} (k : ℕ) + (u : Fin 2 → WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (∑ j, u j) t = ∑ j, u j t := by + change (ContinuousMap.evalCLM ℝ t) ((WeaklySingular.pathEquiv (Jet k) T) (∑ j, u j)) = _ + simp only [map_sum] + rfl + +private theorem path_three_eval {T : ℝ} (k : ℕ) + (u v : WeaklySingular.Path (Jet k) T) + (w : Fin 2 → WeaklySingular.Path (Jet k) T) (t : Icc (0 : ℝ) T) : + (u+v+∑ j, w j) t = u t+v t+∑ j, w j t := by + exact (path_add_eval k (u+v) (∑ j, w j) t).trans + (congrArg₂ (fun a b : Jet k => a+b) (path_add_eval k u v t) (path_sum_eval k w t)) + +namespace CompatibleData + +private def sourceJetValue {T : ℝ} (hT : 0 ≤ T) (D : CompatibleData T) (k : ℕ) : ℝ → Jet k := + WeaklySingular.extendPath (Jet k) hT (D.source k) + +private def coefficientJetValue {T : ℝ} (hT : 0 ≤ T) (D : CompatibleData T) + (k : ℕ) (i : Fin 3) : ℝ → Jet k := + CoefficientTimeJets.extend hT (D.coefficient k i) + +private theorem effectiveSourceJet_formula {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) (k : ℕ) (t : ℝ) : + WeaklySingular.extendPath (Jet k) hT (D.effectiveSource hT hν k) t = + D.sourceJetValue hT k t + + multiplication k (D.coefficientJetValue hT k 0 t) (D.solutionJetValue hT hν k t) + + ∑ j : Fin 2, BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) + (multiplication (k+1) (D.coefficientJetValue hT (k+1) j.succ t) + (D.solutionJetValue hT hν (k+1) t)) := by + let p := productPath k (D.coefficient k 0) (D.solutionJet hT hν k) + let v : Fin 2 → WeaklySingular.Path (Jet k) T := fun j => + directionalPath k (Pi.single j 1) T + (productPath (k+1) (D.coefficient (k+1) j.succ) (D.solutionJet hT hν (k+1))) + let r := projIcc 0 T hT t + change (D.source k + p + ∑ j, v j) r = _ + have hp : p r = multiplication k (D.coefficientJetValue hT k 0 t) + (D.solutionJetValue hT hν k t) := rfl + have hv (j : Fin 2) : v j r = + BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) + (multiplication (k+1) (D.coefficientJetValue hT (k+1) j.succ t) + (D.solutionJetValue hT hν (k+1) t)) := rfl + exact (path_three_eval k (D.source k) p v r).trans + (congrArg₂ (fun a b : Jet k => a+b) + (congrArg₂ (fun a b : Jet k => a+b) rfl hp) + (Finset.sum_congr rfl (fun j _ => hv j))) + +private theorem effectiveSourceJet_contDiffOn {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (D : CompatibleData T) {n : ℕ∞ω} + (hs : ∀ k, ContDiffOn ℝ n (D.sourceJetValue hT k) (Icc (0 : ℝ) T)) + (hb : ∀ k i, ContDiffOn ℝ n (D.coefficientJetValue hT k i) (Icc (0 : ℝ) T)) + (hu : ∀ k, ContDiffOn ℝ n (D.solutionJetValue hT hν k) (Icc (0 : ℝ) T)) (k : ℕ) : + ContDiffOn ℝ n (WeaklySingular.extendPath (Jet k) hT (D.effectiveSource hT hν k)) + (Icc (0 : ℝ) T) := by + have hp := multiplication_contDiffOn k (hb k 0) (hu k) + have hd (j : Fin 2) := (BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1)).contDiff.comp_contDiffOn + (multiplication_contDiffOn (k+1) (hb (k+1) j.succ) (hu (k+1))) + have he : WeaklySingular.extendPath (Jet k) hT (D.effectiveSource hT hν k) = + (fun t => D.sourceJetValue hT k t + + multiplication k (D.coefficientJetValue hT k 0 t) (D.solutionJetValue hT hν k t) + + ∑ j : Fin 2, BoundedSpatialJets.directionalDerivativeCLM Plane ℝ k (Pi.single j 1) + (multiplication (k+1) (D.coefficientJetValue hT (k+1) j.succ t) + (D.solutionJetValue hT hν (k+1) t))) := + funext (D.effectiveSourceJet_formula hT hν k) + rw [he] + exact ((hs k).add hp).add (ContDiffOn.sum (fun j _ => hd j)) + +/-- Smooth source and coefficient curves make every finite spatial jet smooth in time. -/ +theorem solutionJetValue_smooth_time {T ν : ℝ} (hT : 0 < T) (hν : 0 < ν) + (D : CompatibleData T) + (hs : ∀ k, ContDiffOn ℝ ∞ (WeaklySingular.extendPath (Jet k) hT.le (D.source k)) + (Icc (0 : ℝ) T)) + (hb : ∀ k i, ContDiffOn ℝ ∞ (CoefficientTimeJets.extend hT.le (D.coefficient k i)) + (Icc (0 : ℝ) T)) (k : ℕ) : + ContDiffOn ℝ ∞ (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T) := by + have hall : ∀ m : ℕ, ∀ k, + ContDiffOn ℝ m (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T) := by + intro m + induction m with + | zero => intro k; exact contDiffOn_zero.mpr (D.solutionJetValue_continuous hT.le hν k).continuousOn + | succ m ih => + intro k + have hq := D.effectiveSourceJet_contDiffOn hT.le hν + (fun i => (hs i).of_le (by simp)) (fun i j => (hb i j).of_le (by simp)) ih k + have hr : ContDiffOn ℝ m (D.timeRHSJet hT.le hν k) (Icc (0 : ℝ) T) := + (((laplacianJetCLM k).contDiff.comp_contDiffOn (ih (k+2))).const_smul ν).add hq + rw [Nat.cast_add, Nat.cast_one, contDiffOn_succ_iff_derivWithin (uniqueDiffOn_Icc hT)] + refine ⟨fun t ht => (D.solutionJetValue_hasDerivWithinAt hT.le hν k ht).differentiableWithinAt, + by simp, ?_⟩ + apply hr.congr + intro t ht + exact (D.solutionJetValue_hasDerivWithinAt hT.le hν k ht).derivWithin (uniqueDiffOn_Icc hT t ht) + exact contDiffOn_infty.mpr (fun m => hall m k) + +/-- The periodic data supplied by the compiler satisfy the time-smoothness hypotheses. -/ +theorem periodic_solutionJetValue_smooth_time {T ν : ℝ} (hT : 0 < T) (hν : 0 < ν) + (D : CompatibleData T) {h : ℝ × Plane → ℝ} (hh : ContDiff ℝ ∞ h) + (hph : ∀ t, PlanePeriodic (fun x => h (t,x))) + {b : Fin 3 → ℝ × Plane → ℝ} (hbs : ∀ i, ContDiff ℝ ∞ (b i)) + (hpb : ∀ i t, PlanePeriodic (fun x => b i (t,x))) + (hsource : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) + (hcoeff : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) + (k : ℕ) : ContDiffOn ℝ ∞ (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T) := by + apply D.solutionJetValue_smooth_time hT hν + · intro n + exact CoefficientTimeJets.periodic_curve_smooth hT hh hph + ((WeaklySingular.pathEquiv (Jet n) T) (D.source n)) (hsource n) + · intro n i + exact CoefficientTimeJets.periodic_curve_smooth hT (hbs i) (hpb i) + (D.coefficient n i) (hcoeff n i) + +/-- A common compact support gives the same smoothness for the whole-plane data. -/ +theorem supported_solutionJetValue_smooth_time {T ν : ℝ} (hT : 0 < T) (hν : 0 < ν) + (D : CompatibleData T) {K : Set Plane} (hK : IsCompact K) + {h : ℝ × Plane → ℝ} (hh : ContDiff ℝ ∞ h) + (hsh : ∀ t ∈ Icc (0 : ℝ) T, ∀ x ∉ K, h (t,x) = 0) + {b : Fin 3 → ℝ × Plane → ℝ} (hbs : ∀ i, ContDiff ℝ ∞ (b i)) + (hsb : ∀ i t, t ∈ Icc (0 : ℝ) T → ∀ x ∉ K, b i (t,x) = 0) + (hsource : ∀ k t x, BoundedSpatialJets.function Plane ℝ k (D.source k t) x = h (t.val,x)) + (hcoeff : ∀ k i t x, BoundedSpatialJets.function Plane ℝ k (D.coefficient k i t) x = b i (t.val,x)) + (k : ℕ) : ContDiffOn ℝ ∞ (D.solutionJetValue hT.le hν k) (Icc (0 : ℝ) T) := by + apply D.solutionJetValue_smooth_time hT hν + · intro n + exact CoefficientTimeJets.supported_curve_smooth hT hh hK hsh + ((WeaklySingular.pathEquiv (Jet n) T) (D.source n)) (hsource n) + · intro n i + exact CoefficientTimeJets.supported_curve_smooth hT (hbs i) hK (hsb i) + (D.coefficient n i) (hcoeff n i) + +end CompatibleData +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTruncation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTruncation.lean new file mode 100644 index 0000000000000000000000000000000000000000..55e82b785479c78d35ecce0b47220d3dd6000051 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarMildTruncation.lean @@ -0,0 +1,270 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildEquation + +namespace OAI + +/-! Compatibility of finite-jet mild solutions under lossless truncation. -/ + +noncomputable section +namespace ForcedComputation.PlaneScalarMild + +open Real MeasureTheory Set ShearFlows +open scoped Topology Interval BigOperators + +/-- Truncate every value of a continuous jet path. -/ +def truncatePath (k n : ℕ) (hkn : k ≤ n) (T : ℝ) : + WeaklySingular.Path (Jet n) T →L[ℝ] WeaklySingular.Path (Jet k) T := + (WeaklySingular.pathEquiv (Jet k) T).symm.toContinuousLinearEquiv.toContinuousLinearMap.comp + (((BoundedSpatialJets.truncateCLM Plane ℝ k n hkn).compLeftContinuous ℝ (Icc (0 : ℝ) T)).comp + (WeaklySingular.pathEquiv (Jet n) T).toContinuousLinearEquiv.toContinuousLinearMap) + +@[simp] theorem truncatePath_apply (k n : ℕ) (hkn : k ≤ n) (T : ℝ) + (u : WeaklySingular.Path (Jet n) T) (t : Icc (0 : ℝ) T) : + truncatePath k n hkn T u t = BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (u t) := rfl + +theorem extendPath_truncate (k n : ℕ) (hkn : k ≤ n) {T : ℝ} (hT : 0 ≤ T) + (u : WeaklySingular.Path (Jet n) T) (s : ℝ) : + WeaklySingular.extendPath (Jet k) hT (truncatePath k n hkn T u) s = + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (WeaklySingular.extendPath (Jet n) hT u s) := rfl + +/-- Any two jet paths representing the same scalar function agree after truncation. -/ +theorem truncatePath_eq_of_functions (k n : ℕ) (hkn : k ≤ n) (T : ℝ) + (u : WeaklySingular.Path (Jet n) T) (v : WeaklySingular.Path (Jet k) T) + (h : ∀ t x, BoundedSpatialJets.function Plane ℝ n (u t) x = + BoundedSpatialJets.function Plane ℝ k (v t) x) : + truncatePath k n hkn T u = v := by + apply (WeaklySingular.pathEquiv (Jet k) T).injective + apply ContinuousMap.ext + intro t + apply BoundedSpatialJets.function_injective Plane ℝ k + ext x + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.truncate Plane ℝ k n hkn (u t)) x = _ + rw [BoundedSpatialJets.function_truncate] + exact h t x + +/-- Representing the same coefficient function forces compatibility of its finite jets. -/ +theorem coefficient_truncate_of_functions (k n : ℕ) (hkn : k ≤ n) (T : ℝ) + (b : C(Icc (0 : ℝ) T, Jet n)) (c : C(Icc (0 : ℝ) T, Jet k)) + (h : ∀ t x, BoundedSpatialJets.function Plane ℝ n (b t) x = + BoundedSpatialJets.function Plane ℝ k (c t) x) (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b t) = c t := by + apply BoundedSpatialJets.function_injective Plane ℝ k + ext x + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.truncate Plane ℝ k n hkn (b t)) x = _ + rw [BoundedSpatialJets.function_truncate] + exact h t x + +theorem multiplication_truncate (k n : ℕ) (hkn : k ≤ n) (b u : Jet n) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (multiplication n b u) = + multiplication k (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn b) + (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn u) := by + apply BoundedSpatialJets.function_injective Plane ℝ k + ext x + change BoundedSpatialJets.function Plane ℝ k + (BoundedSpatialJets.truncate Plane ℝ k n hkn (multiplication n b u)) x = _ + simp only [BoundedSpatialJets.function_truncate, multiplication_apply] + rfl + +theorem rawHeatKernel_truncate {ν : ℝ} (hν : 0 < ν) (k n : ℕ) (hkn : k ≤ n) + (r : ℝ) (u : Jet n) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (rawHeatKernel hν n r u) = + rawHeatKernel hν k r (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn u) := by + by_cases hr : 0 < r + · rw [rawHeatKernel_pos hν n hr, rawHeatKernel_pos hν k hr] + exact (BoundedSpatialJets.convolution_truncate Plane ℝ k n hkn volume + (PlaneHeat.kernel (ν*r)) (PlaneHeat.kernel_integrable (mul_pos hν hr)) u).symm + · simp only [rawHeatKernel_nonpos hν n (not_lt.mp hr), + rawHeatKernel_nonpos hν k (not_lt.mp hr), zero_apply, map_zero] + +theorem gradientKernel_truncate {ν : ℝ} (hν : 0 < ν) (k n : ℕ) (hkn : k ≤ n) + (j : Fin 2) (r : ℝ) (u : Jet n) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (gradientKernel hν n j r u) = + gradientKernel hν k j r (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn u) := by + by_cases hr : 0 < r + · rw [gradientKernel_pos hν n j hr, gradientKernel_pos hν k j hr] + exact (BoundedSpatialJets.convolution_truncate Plane ℝ k n hkn volume + (PlaneHeat.kernelDerivative (ν*r) j) + (PlaneHeat.kernelDerivative_integrable (mul_pos hν hr) j) u).symm + · simp only [gradientKernel_nonpos hν n j (not_lt.mp hr), + gradientKernel_nonpos hν k j (not_lt.mp hr), zero_apply, map_zero] + +theorem rawKernels_truncate {ν : ℝ} (hν : 0 < ν) (k n : ℕ) (hkn : k ≤ n) + (i : Fin 3) (r : ℝ) (u : Jet n) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (rawKernels hν n i r u) = + rawKernels hν k i r (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn u) := by + exact Fin.cases (rawHeatKernel_truncate hν k n hkn r u) + (fun j => gradientKernel_truncate hν k n hkn j r u) i + +/-- A continuous source path gives Bochner-integrable heat and gradient integrands. -/ +theorem rawKernel_path_integrable {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (u : WeaklySingular.Path (Jet k) T) + (i : Fin 3) (t : Icc (0 : ℝ) T) : + IntervalIntegrable (fun s => rawKernels hν k i (t.val-s) + (WeaklySingular.extendPath (Jet k) hT u s)) volume 0 t.val := by + let v := u + let z := WeaklySingular.extendPath (Jet k) hT v + have hz : Continuous z := WeaklySingular.continuous_extendPath (Jet k) hT v + have hm : AEStronglyMeasurable (fun s => kernels hν k T i (t.val-s) (z s)) + (volume.restrict (Ioc 0 t.val)) := by + have hc : ContinuousOn (fun s => kernels hν k T i (t.val-s) (z s)) (Ioo 0 t.val) := by + intro s hs + have hk : ContinuousAt (fun r : ℝ => kernels hν k T i (t.val-r)) s := + ((kernels_continuous hν k T i).continuousAt (Ioi_mem_nhds (sub_pos.mpr hs.2))).comp + (f := fun r : ℝ => t.val-r) (continuousAt_const.sub continuousAt_id) + exact (hk.clm_apply hz.continuousAt).continuousWithinAt + rw [← restrict_Ioo_eq_restrict_Ioc] + exact hc.aestronglyMeasurable measurableSet_Ioo + have hi : IntervalIntegrable (fun s => kernels hν k T i (t.val-s) (z s)) volume 0 t.val := by + apply WeaklySingular.intervalIntegrable_of_inverseSqrt_bound (Jet k) t.property.1 _ + (kernelConstants ν T i * ‖v‖) hm + intro s hs + have hr : 0 ≤ t.val-s := sub_nonneg.mpr hs.2 + calc + _ ≤ ‖kernels hν k T i (t.val-s)‖ * ‖z s‖ := (kernels hν k T i (t.val-s)).le_opNorm _ + _ ≤ (kernelConstants ν T i * WeaklySingular.inverseSqrt (t.val-s)) * ‖v‖ := + mul_le_mul (kernels_bound hν k T i _ hr) + (WeaklySingular.norm_extendPath_le (Jet k) hT v s) (norm_nonneg _) + (mul_nonneg (kernelConstants_nonneg ν T i) (WeaklySingular.inverseSqrt_nonneg _)) + _ = _ := by ring + apply hi.congr + intro s hs + rw [uIoc_of_le t.property.1] at hs + dsimp only + rw [kernels_eq_raw hν k ((sub_le_self _ hs.1.le).trans t.property.2) i] + +/-- The actual coefficient/kernel integrands are integrable at the singular endpoint. -/ +theorem mild_integrand_integrable {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) (k : ℕ) + (b : C(Icc (0 : ℝ) T, Jet k)) (u : WeaklySingular.Path (Jet k) T) + (i : Fin 3) (t : Icc (0 : ℝ) T) : + IntervalIntegrable (fun s => rawKernels hν k i (t.val-s) + (multiplication k (b (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT u s))) volume 0 t.val := by + exact rawKernel_path_integrable hT hν k + (WeaklySingular.coefficientOperator (Jet k) (coefficientCurve k b) u) i t + +section IntegralTransport + +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +theorem map_integral_eq (P : E →L[ℝ] F) {f : ℝ → E} {g : ℝ → F} + {t : ℝ} (hi : IntervalIntegrable f volume 0 t) (he : ∀ s, P (f s) = g s) : + P (∫ s in 0..t, f s) = ∫ s in 0..t, g s := by + exact (P.intervalIntegral_comp_comm hi).symm.trans + (intervalIntegral.integral_congr (fun s _ => he s)) + +omit [CompleteSpace E] [CompleteSpace F] in +private theorem map_add_finite_sum {ι : Type*} [Fintype ι] + (P : E →L[ℝ] F) (x : E) (v : ι → E) : + P (x + ∑ i, v i) = P x + ∑ i, P (v i) := by + rw [map_add, map_sum] + +end IntegralTransport + +/-- Truncation commutes with the actual unweighted heat and gradient integrals. -/ +theorem rawKernelIntegral_truncate {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) (u : WeaklySingular.Path (Jet n) T) + (i : Fin 3) (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (WeaklySingular.extendPath (Jet n) hT u s)) = + ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (WeaklySingular.extendPath (Jet k) hT (truncatePath k n hkn T u) s) := by + apply map_integral_eq (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn) + (rawKernel_path_integrable hT hν n u i t) + intro s + exact (rawKernels_truncate hν k n hkn i (t.val-s) _).trans + (congrArg (rawKernels hν k i (t.val-s)) + (extendPath_truncate k n hkn hT u s).symm) + +private theorem truncate_integrand {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) + (b : Fin 3 → C(Icc (0 : ℝ) T, Jet n)) + (c : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ i t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b i t) = c i t) + (u : WeaklySingular.Path (Jet n) T) (i : Fin 3) (t : ℝ) (s : ℝ) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (rawKernels hν n i (t-s) (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) = + rawKernels hν k i (t-s) + (multiplication k (c i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (truncatePath k n hkn T u) s)) := by + exact (rawKernels_truncate hν k n hkn i (t-s) _).trans + (congrArg (rawKernels hν k i (t-s)) + ((multiplication_truncate k n hkn _ _).trans + (congrArg₂ (fun b u : Jet k => multiplication k b u) (hbc i (projIcc 0 T hT s)) + (extendPath_truncate k n hkn hT u s).symm))) + +private theorem truncate_integral_term {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) + (b : Fin 3 → C(Icc (0 : ℝ) T, Jet n)) + (c : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ i t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b i t) = c i t) + (u : WeaklySingular.Path (Jet n) T) (i : Fin 3) (t : Icc (0 : ℝ) T) : + BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + (∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) = + ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (c i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (truncatePath k n hkn T u) s)) := + map_integral_eq (BoundedSpatialJets.truncateCLM Plane ℝ k n hkn) + (mild_integrand_integrable hT hν n (b i) u i t) + (truncate_integrand hT hν k n hkn b c hbc u i t.val) + +/-- A high-order solution truncates to the low-order equation with truncated data. -/ +theorem truncate_mild_equation {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) + (b : Fin 3 → C(Icc (0 : ℝ) T, Jet n)) + (c : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ i t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b i t) = c i t) + (a u : WeaklySingular.Path (Jet n) T) + (hu : ∀ t : Icc (0 : ℝ) T, u t = a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) : + ∀ t : Icc (0 : ℝ) T, truncatePath k n hkn T u t = truncatePath k n hkn T a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (c i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT (truncatePath k n hkn T u) s)) := by + intro t + let P : Jet n →L[ℝ] Jet k := BoundedSpatialJets.truncateCLM Plane ℝ k n hkn + change P (u t) = P (a t) + _ + calc + P (u t) = P (a t + ∑ i, ∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) := congrArg P (hu t) + _ = P (a t) + ∑ i, P (∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) := + map_add_finite_sum P (a t) (fun i => ∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) + _ = _ := congrArg (fun v : Jet k => P (a t) + v) + (Finset.sum_congr rfl (fun i _ => truncate_integral_term hT hν k n hkn b c hbc u i t)) + +/-- Uniqueness identifies solutions at different jet orders, independently of the chosen weight. -/ +theorem mild_solutions_compatible {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 < ν) + (k n : ℕ) (hkn : k ≤ n) + (b : Fin 3 → C(Icc (0 : ℝ) T, Jet n)) + (c : Fin 3 → C(Icc (0 : ℝ) T, Jet k)) + (hbc : ∀ i t, BoundedSpatialJets.truncateCLM Plane ℝ k n hkn (b i t) = c i t) + (a u : WeaklySingular.Path (Jet n) T) (v : WeaklySingular.Path (Jet k) T) + (hu : ∀ t : Icc (0 : ℝ) T, u t = a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν n i (t.val-s) + (multiplication n (b i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet n) hT u s))) + (hv : ∀ t : Icc (0 : ℝ) T, v t = truncatePath k n hkn T a t + + ∑ i, ∫ s in 0..t.val, rawKernels hν k i (t.val-s) + (multiplication k (c i (projIcc 0 T hT s)) + (WeaklySingular.extendPath (Jet k) hT v s))) : + truncatePath k n hkn T u = v := by + obtain ⟨w, _, huniq⟩ := exists_unique_mild hT hν k c (truncatePath k n hkn T a) + exact (huniq _ (truncate_mild_equation hT hν k n hkn b c hbc a u hu)).trans (huniq v hv).symm + +end ForcedComputation.PlaneScalarMild + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..375e4404ccfae46977edc3a0003a189f88b8b0bb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarRegularity.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarGlobal + +namespace OAI + +/-! Finite-slab spatial derivative bounds for the unique scalar solution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem PlaneSpatialBounds.restrict {T S : ℝ} {w : ℝ → Plane → ℝ} + (hw : PlaneSpatialBounds T w) (hST : S ≤ T) : PlaneSpatialBounds S w := by + obtain ⟨B, hB⟩ := hw + exact ⟨B, fun t ht => hB t ⟨ht.1, ht.2.trans hST⟩⟩ + +theorem PlaneSpatialBounds.congr {T : ℝ} {w v : ℝ → Plane → ℝ} + (hw : PlaneSpatialBounds T w) (he : ∀ t ∈ Icc 0 T, v t = w t) : + PlaneSpatialBounds T v := by + obtain ⟨B, hB⟩ := hw + refine ⟨B, ?_⟩ + intro t ht k hk x + rw [he t ht] + exact hB t ht k hk x + +theorem PlaneScalarSolution.spatial_bounds (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) : + PlaneSpatialBounds T w := by + obtain ⟨v, hv, hb⟩ := hE (T + 1) ν (by linarith) hν a h ha hh hc + have hST : T ≤ T + 1 := by linarith + have he := hw.unique (hv.restrict hST) hT hν.le ha hc + exact (hb.restrict hST).congr he + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarScaling.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..f07f2b637bea04604288f01ed966645203487740 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarScaling.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneBarrier + +namespace OAI + +/-! Translation and dilation of scalar test functions on the plane. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian +open scoped ContDiff + +def scalarAffineScale (r : ℝ) (c x : Plane) : Plane := r • (x - c) + +theorem scalarAffineScale_smooth (r : ℝ) (c : Plane) : + ContDiff ℝ ∞ (scalarAffineScale r c) := by + apply contDiff_pi.mpr + intro j + change ContDiff ℝ ∞ (fun x : Plane => r * (x j - c j)) + exact contDiff_const.mul ((contDiff_apply ℝ ℝ j).sub contDiff_const) + +theorem scalarAffineScale_hasFDerivAt (r : ℝ) (c x : Plane) : + HasFDerivAt (scalarAffineScale r c) (r • ContinuousLinearMap.id ℝ Plane) x := + ((hasFDerivAt_id x).sub_const c).const_smul r + +theorem spatialD_affine_scale {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (r : ℝ) (c : Plane) (j : Fin 2) : + spatialD j (fun x => f (scalarAffineScale r c x)) = + fun x => r * spatialD j f (scalarAffineScale r c x) := by + funext x + have hd := ((hf.differentiable (by simp) (scalarAffineScale r c x)).hasFDerivAt).comp x + (scalarAffineScale_hasFDerivAt r c x) + change fderiv ℝ (fun x => f (scalarAffineScale r c x)) x (basis j) = _ + change HasFDerivAt (fun x => f (scalarAffineScale r c x)) _ x at hd + rw [hd.fderiv] + simp [spatialD, smul_eq_mul] + +theorem scalarLaplacian_affine_scale {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (r : ℝ) (c x : Plane) : + scalarLaplacian (fun y => f (scalarAffineScale r c y)) x = + r ^ 2 * scalarLaplacian f (scalarAffineScale r c x) := by + have he (j : Fin 2) : + spatialD j (spatialD j (fun y => f (scalarAffineScale r c y))) x = + r ^ 2 * spatialD j (spatialD j f) (scalarAffineScale r c x) := by + rw [spatialD_affine_scale hf] + have hs : ContDiff ℝ ∞ (fun y => spatialD j f (scalarAffineScale r c y)) := + (spatialD_smooth j hf).comp (scalarAffineScale_smooth r c) + rw [spatialD_const_mul hs] + rw [spatialD_affine_scale (spatialD_smooth j hf)] + ring + simp only [scalarLaplacian, he, Finset.mul_sum] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarSupersolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarSupersolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd90495907457551a0cf5777cdc096d2bd379955 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarSupersolution.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarGlobal +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTailBounds + +namespace OAI + +/-! Comparison against an explicit nonnegative supersolution on the plane. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem PlaneScalarSolution.le_supersolution {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w v d : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + (hT : 0 ≤ T) (hν : 0 ≤ ν) (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hcompact : CompactPlaneCoefficients a h) + (hc : ContinuousOn (Function.uncurry v) (Icc 0 T ×ˢ univ)) + (hs : ∀ t ∈ Icc 0 T, ContDiff ℝ ∞ (v t)) + (hd : ∀ t ∈ Ioc 0 T, ∀ x, + HasDerivWithinAt (fun s => v s x) (d t x) (Icc 0 T) t) + (he : ∀ t ∈ Ioc 0 T, ∀ x, scalarGenerator ν (a t) (v t) x + h t x ≤ d t x) + (hv : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ v t x) : + ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ v t x := by + obtain ⟨A, hA, hAb⟩ := hcompact.drift_bound ha T hT + obtain ⟨B, hB⟩ := hw.bounded + have hm := scalar_maximum_principle_bounded + (w := fun t x => w t x - v t x) + (d := fun t x => scalarGenerator ν (a t) (w t) x + h t x - d t x) + (B := B) + hT hν hA hAb + (fun t ht x => by linarith [(le_abs_self (w t x)).trans (hB t ht x).1, hv t ht x]) + (hw.smooth.continuousOn.sub hc) + (fun t ht => (hw.slice_smooth ht).sub (hs t ht)) + (fun t ht x => (hw.equation t ⟨ht.1.le, ht.2⟩ x).sub (hd t ht x)) + (fun t ht x => by + rw [scalarGenerator_sub (hw.slice_smooth ⟨ht.1.le, ht.2⟩) + (hs t ⟨ht.1.le, ht.2⟩)] + linarith [he t ht x]) + (fun x => by rw [hw.initial]; simpa using hv 0 ⟨le_rfl, hT⟩ x) + exact fun t ht x => sub_nonpos.mp (hm t ht x) + +theorem CompactPlaneCoefficients.source_tail_bound {a : ℝ → Plane → Plane} + {h : ℝ → Plane → ℝ} (hc : CompactPlaneCoefficients a h) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (T : ℝ) (hT : 0 ≤ T) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc 0 T, ∀ x, + h t x ≤ C * planeTailProfile x := by + obtain ⟨K, hK, hzero⟩ := hc T hT + have hc' : Continuous (fun y : ℝ × Plane => h y.1 y.2 * planeBarrierSquare y.2 ^ 2) := + hh.continuous.mul ((planeBarrierSquare_smooth.continuous.comp continuous_snd).pow 2) + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hK).bddAbove_image hc'.continuousOn + refine ⟨max 0 B, le_max_left _ _, ?_⟩ + intro t ht x + by_cases hx : x ∈ K + · have hb : h t x * planeBarrierSquare x ^ 2 ≤ max 0 B := + (hB ⟨(t, x), ⟨ht, hx⟩, rfl⟩).trans (le_max_right _ _) + have hm := mul_le_mul_of_nonneg_right hb (planeTailProfile_pos x).le + have he : planeBarrierSquare x ^ 2 * planeTailProfile x = 1 := by + unfold planeTailProfile + field_simp [(planeBarrierSquare_pos x).ne'] + calc + h t x = (h t x * planeBarrierSquare x ^ 2) * planeTailProfile x := by rw [mul_assoc, he, mul_one] + _ ≤ _ := hm + · rw [(hzero t ht x hx).2] + exact mul_nonneg (le_max_left _ _) (planeTailProfile_pos x).le + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarTail.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ba7d78f3cbab3380cb148c8d5a1e26753e949c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneScalarTail.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarSupersolution + +namespace OAI + +/-! Integrable diffusion tails on each finite time cylinder, from bounded comparison. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +theorem PlaneScalarSolution.tail_bound {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) : + ∃ C K : ℝ, 0 ≤ C ∧ 0 ≤ K ∧ ∀ t ∈ Icc 0 T, ∀ x, + w t x ≤ C * Real.exp (K * t) * planeTailProfile x := by + obtain ⟨A, hA, hAb⟩ := hc.drift_bound ha T hT + obtain ⟨C, hC, hCb⟩ := hc.source_tail_bound hh T hT + let K := 24 * ν + 8 * A + 1 + have hK : 0 ≤ K := by dsimp [K]; positivity + let v : ℝ → Plane → ℝ := fun t x => C * Real.exp (K * t) * planeTailProfile x + refine ⟨C, K, hC, hK, ?_⟩ + apply hw.le_supersolution hT hν ha hc + (d := fun t x => K * v t x) + · have hs : ContDiff ℝ ∞ (Function.uncurry v) := by + exact ((contDiff_const.mul + ((contDiff_const.mul contDiff_fst).exp)).mul + (planeTailProfile_smooth.comp contDiff_snd)) + exact hs.continuous.continuousOn + · intro t _ + exact contDiff_const.mul planeTailProfile_smooth + · intro t _ x + apply HasDerivAt.hasDerivWithinAt + simpa only [v, id_eq, mul_one, one_mul, mul_assoc, mul_comm, mul_left_comm] using + ((((hasDerivAt_id t).const_mul K).exp.const_mul C).mul_const (planeTailProfile x)) + · intro t ht x + have hcoef : 0 ≤ C * Real.exp (K * t) := mul_nonneg hC (Real.exp_pos _).le + have hg := mul_le_mul_of_nonneg_left + (planeTailProfile_generator_bound hν hA (a t) (hAb t ⟨ht.1.le, ht.2⟩) x) hcoef + have he : 1 ≤ Real.exp (K * t) := + Real.one_le_exp_iff.mpr (mul_nonneg hK ht.1.le) + have hce : C ≤ C * Real.exp (K * t) := by nlinarith + have hh' : h t x ≤ v t x := (hCb t ⟨ht.1.le, ht.2⟩ x).trans + (mul_le_mul_of_nonneg_right hce (planeTailProfile_pos x).le) + change scalarGenerator ν (a t) + (fun y => (C * Real.exp (K * t)) * planeTailProfile y) x + h t x ≤ K * v t x + rw [scalarGenerator_const_mul planeTailProfile_smooth] + dsimp only [K, v] at * + nlinarith + · intro t _ x + exact mul_nonneg (mul_nonneg hC (Real.exp_pos _).le) (planeTailProfile_pos x).le + +theorem PlaneScalarSolution.integrable {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} (hw : PlaneScalarSolution T ν a h w) + (hT : 0 ≤ T) (hν : 0 ≤ ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ∀ t ∈ Icc 0 T, Integrable (w t) := by + obtain ⟨C, K, _, _, hb⟩ := hw.tail_bound hT hν ha hh hc + have hnonneg := hw.nonnegative hT hν ha hc hpos + intro t ht + apply (planeTailProfile_integrable.const_mul (C * Real.exp (K * t))).mono' + (hw.slice_smooth ht).continuous.aestronglyMeasurable + filter_upwards [] with x + rw [Real.norm_eq_abs, abs_of_nonneg (hnonneg t ht x)] + exact hb t ht x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1f273cae95a0e15d2d5aee856048516afb3dd3a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevContinuity.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSobolevSlices +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCylinderCalculus +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSquareContinuity + +namespace OAI + +/-! The scalar and its first two spatial derivatives vary continuously in +L2 on each closed finite time interval. This is the spatial H2 time condition. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory Set +open scoped ContDiff + +theorem planeTailProfile_le_derivativeTail (x : Plane) : + planeTailProfile x ≤ derivativeTail x := by + have h0 := (derivativeTail_pos x).le + have h1 := derivativeTail_le_one x + have hs : derivativeTail x ^ 2 ≤ 1 := pow_le_one₀ h0 h1 + have hm := mul_le_mul_of_nonneg_left hs h0 + rw [← derivativeTail_cube] + nlinarith + +theorem PlaneScalarSolution.uniform_jet2_tail (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ∃ A : ℝ, 0 ≤ A ∧ ∀ t ∈ Icc 0 T, ∀ x, + |w t x| ≤ A * derivativeTail x ∧ + (∀ j, |spatialD j (w t) x| ≤ A * derivativeTail x) ∧ + (∀ j k, |spatialD j (spatialD k (w t)) x| ≤ A * derivativeTail x) := by + obtain ⟨B, hB, htail⟩ := hw.uniform_tail_bound hT hν.le ha hh hc hpos + obtain ⟨N, hN⟩ := hw.spatial_bounds hE hT hν ha hh hc + let M := max 0 N + have hM : 0 ≤ M := le_max_left _ _ + let A := B + 3 * (100 * B + M) + have hBA : B ≤ A := by dsimp [A]; nlinarith + refine ⟨A, by dsimp [A]; positivity, ?_⟩ + intro t ht x + have h2 : ∀ y, ‖iteratedFDeriv ℝ 2 (w t) y‖ ≤ M := + fun y => (hN t ht 2 (by omega) y).trans (le_max_right _ _) + have h3 : ∀ y, ‖iteratedFDeriv ℝ 3 (w t) y‖ ≤ M := + fun y => (hN t ht 3 le_rfl y).trans (le_max_right _ _) + refine ⟨?_, ?_, ?_⟩ + · exact (htail t ht x).trans ((mul_le_mul_of_nonneg_left + (planeTailProfile_le_derivativeTail x) hB).trans + (mul_le_mul_of_nonneg_right hBA (derivativeTail_pos x).le)) + · intro j + apply (scalar_gradient_entry_tail (hw.slice_smooth ht) hB hM (htail t ht) h2 x j).trans + apply mul_le_mul_of_nonneg_right _ (derivativeTail_pos x).le + dsimp [A] + nlinarith + · intro j k + apply (scalar_hessian_entry_tail (hw.slice_smooth ht) hB hM (htail t ht) h3 x j k).trans + apply mul_le_mul_of_nonneg_right _ (derivativeTail_pos x).le + dsimp [A] + linarith + +def PlaneH2ContinuousOn (w : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + SquareDistanceContinuousOn w S ∧ + (∀ j, SquareDistanceContinuousOn (fun t => spatialD j (w t)) S) ∧ + (∀ j k, SquareDistanceContinuousOn (fun t => spatialD j (spatialD k (w t))) S) + +theorem PlaneScalarSolution.h2_continuousOn (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + PlaneH2ContinuousOn w (Icc 0 T) := by + obtain ⟨A, _, hA⟩ := hw.uniform_jet2_tail hE hT.le hν ha hh hc hpos + have hi : Integrable (fun x => (A * derivativeTail x) ^ 2) := by + convert derivativeTail_square_integrable.const_mul (A ^ 2) using 1 + funext x + ring + have hcurry {F : ℝ × Plane → ℝ} + (hF : ContinuousOn F (Icc 0 T ×ˢ univ)) (x : Plane) : + ContinuousOn (fun t => F (t, x)) (Icc 0 T) := + hF.comp (continuous_id.prodMk continuous_const).continuousOn + (fun t ht => ⟨ht, mem_univ x⟩) + refine ⟨?_, ?_, ?_⟩ + · exact squareDistanceContinuousOn_of_envelope (fun t ht => (hw.slice_smooth ht).continuous) + (fun x => hcurry hw.smooth.continuousOn x) hi (fun t ht x => (hA t ht x).1) + · intro j + exact squareDistanceContinuousOn_of_envelope + (fun t ht => (spatialD_smooth j (hw.slice_smooth ht)).continuous) + (fun x => hcurry (hw.cylinder_spatialD hT j).continuousOn x) + hi (fun t ht x => (hA t ht x).2.1 j) + · intro j k + exact squareDistanceContinuousOn_of_envelope + (fun t ht => (spatialD_smooth j (spatialD_smooth k (hw.slice_smooth ht))).continuous) + (fun x => hcurry (hw.cylinder_second_spatialD hT j k).continuousOn x) + hi (fun t ht x => (hA t ht x).2.2 j k) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevL2.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ab143f96a9556f42a8d1ea0ee3d85a58e934a4b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevL2.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTimeRegularity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneL2Lift + +namespace OAI + +/-! The scalar solution has continuous L2 representatives for all spatial +derivatives through order two, and is continuously differentiable in L2. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory Set +open scoped ContDiff + +def PlaneContinuousL2 (F : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + ∃ U : ℝ → PlaneL2, ContinuousOn U S ∧ + ∀ t ∈ S, (fun x => U t x) =ᵐ[volume] F t + +def PlaneCInH2 (F : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + PlaneContinuousL2 F S ∧ + (∀ j, PlaneContinuousL2 (fun t => spatialD j (F t)) S) ∧ + (∀ j k, PlaneContinuousL2 (fun t => spatialD j (spatialD k (F t))) S) + +theorem PlaneScalarSolution.cInH2 (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : PlaneCInH2 w (Icc 0 T) := by + have hi := fun t ht => hw.square_integrable_jet2 hE hT.le hν ha hh hc hpos (t := t) ht + obtain ⟨h0, h1, h2⟩ := hw.h2_continuousOn hE hT hν ha hh hc hpos + refine ⟨?_, ?_, ?_⟩ + · apply exists_planeL2_continuous_representation _ h0 + intro t ht + exact (memLp_two_iff_integrable_sq (hw.slice_smooth ht).continuous.aestronglyMeasurable).mpr + (hi t ht).1 + · intro j + apply exists_planeL2_continuous_representation _ (h1 j) + intro t ht + exact (memLp_two_iff_integrable_sq + (spatialD_smooth j (hw.slice_smooth ht)).continuous.aestronglyMeasurable).mpr + ((hi t ht).2.1 j) + · intro j k + apply exists_planeL2_continuous_representation _ (h2 j k) + intro t ht + exact (memLp_two_iff_integrable_sq + (spatialD_smooth j (spatialD_smooth k (hw.slice_smooth ht))).continuous.aestronglyMeasurable).mpr + ((hi t ht).2.2 j k) + +theorem PlaneScalarSolution.c1L2 (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + PlaneC1L2 w (planeTimeDerivative ν a h w) (Icc 0 T) := by + obtain ⟨B, hB, hb⟩ := hw.time_derivative_envelope hE hT.le hν ha hh hc hpos + have hs (t : ℝ) (ht : t ∈ Icc 0 T) : Continuous (planeTimeDerivative ν a h w t) := + hw.timeDerivative_slice_continuous ha hh ht + have hm (t : ℝ) (ht : t ∈ Icc 0 T) : MemLp (planeTimeDerivative ν a h w t) 2 volume := by + apply (memLp_two_iff_integrable_sq (hs t ht).aestronglyMeasurable).mpr + apply (derivativeTail_square_integrable.const_mul (B ^ 2)).mono' + ((hs t ht).pow 2).aestronglyMeasurable + filter_upwards [] with x + change ‖planeTimeDerivative ν a h w t x ^ 2‖ ≤ B ^ 2 * derivativeTail x ^ 2 + have hh' := (sq_le_sq₀ (abs_nonneg _) (mul_nonneg hB (derivativeTail_pos x).le)).mpr + (hb t ht x) + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (planeTimeDerivative ν a h w t x)] + have hwm (t : ℝ) (ht : t ∈ Icc 0 T) : MemLp (w t) 2 volume := + (memLp_two_iff_integrable_sq (hw.slice_smooth ht).continuous.aestronglyMeasurable).mpr + (hw.square_integrable_jet2 hE hT.le hν ha hh hc hpos ht).1 + obtain ⟨hd, hcG⟩ := hw.strong_time_regularity hE hT hν ha hh hc hpos + exact planeC1L2_of_square_estimates hwm hm + (hw.h2_continuousOn hE hT hν ha hh hc hpos).1 hcG hd + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevSlices.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevSlices.lean new file mode 100644 index 0000000000000000000000000000000000000000..b72014dea9a13ec5a90d591963a360c0f6074ed5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSobolevSlices.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneGradientTail +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarRegularity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMassContinuity + +namespace OAI + +/-! For a smooth scalar, its classical derivatives through order two +are square integrable. These are the spatial H² conditions on each slice. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory Set +open scoped ContDiff + +def PlaneSquareIntegrableJet2 (f : Plane → ℝ) : Prop := + Integrable (fun x => f x ^ 2) ∧ + (∀ j, Integrable (fun x => spatialD j f x ^ 2)) ∧ + (∀ j k, Integrable (fun x => spatialD j (spatialD k f) x ^ 2)) + +theorem scalar_square_integrable_jet2 {f : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) {B M : ℝ} (hB : 0 ≤ B) (hM : 0 ≤ M) + (hfB : ∀ x, |f x| ≤ B * planeTailProfile x) + (hfM2 : ∀ x, ‖iteratedFDeriv ℝ 2 f x‖ ≤ M) + (hfM3 : ∀ x, ‖iteratedFDeriv ℝ 3 f x‖ ≤ M) : + PlaneSquareIntegrableJet2 f := by + have hfi : Integrable f := (planeTailProfile_integrable.const_mul B).mono' + hf.continuous.aestronglyMeasurable (Filter.Eventually.of_forall + (fun x => by simpa only [Real.norm_eq_abs] using hfB x)) + have hfb : ∀ x, ‖f x‖ ≤ B := by + intro x + rw [Real.norm_eq_abs] + exact (hfB x).trans (by simpa only [mul_one] using + mul_le_mul_of_nonneg_left (planeTailProfile_le_one x) hB) + have hi2 : Integrable (fun x => f x * f x) := hfi.mul_bdd + hf.continuous.aestronglyMeasurable (Filter.Eventually.of_forall hfb) + refine ⟨by simpa only [pow_two] using hi2, ?_, ?_⟩ + · exact scalar_gradient_square_integrable hf hB hM hfB hfM2 + · exact scalar_hessian_square_integrable hf hB hM hfB hfM3 + +theorem PlaneScalarSolution.square_integrable_jet2 (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) + {t : ℝ} (ht : t ∈ Icc 0 T) : PlaneSquareIntegrableJet2 (w t) := by + obtain ⟨B, hB, htail⟩ := hw.uniform_tail_bound hT hν.le ha hh hc hpos + obtain ⟨M, hM⟩ := hw.spatial_bounds hE hT hν ha hh hc + exact scalar_square_integrable_jet2 (hw.slice_smooth ht) hB (le_max_left 0 M) + (htail t ht) (fun x => (hM t ht 2 (by omega) x).trans (le_max_right 0 M)) + (fun x => (hM t ht 3 le_rfl x).trans (le_max_right 0 M)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSquareContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSquareContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5663b670792c4ea9f28da1831de83e376aad63e0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneSquareContinuity.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneMassContinuity + +namespace OAI + +/-! An integrable square envelope upgrades pointwise time continuity to +continuity of the squared L2 distance. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +theorem square_distance_continuousOn {F : ℝ → Plane → ℝ} {S : Set ℝ} + {b : Plane → ℝ} + (hspace : ∀ t ∈ S, Continuous (F t)) + (htime : ∀ x, ContinuousOn (fun t => F t x) S) + (hb : Integrable (fun x => b x ^ 2)) + (hbound : ∀ t ∈ S, ∀ x, |F t x| ≤ b x) + {s : ℝ} (hs : s ∈ S) : + ContinuousOn (fun t => ∫ x, (F t x - F s x) ^ 2) S := by + apply continuousOn_of_dominated + (fun t ht => ((hspace t ht).sub (hspace s hs)).pow 2 |>.aestronglyMeasurable) + (bound := fun x => 4 * b x ^ 2) + · intro t ht + filter_upwards [] with x + have hb0 : 0 ≤ b x := (abs_nonneg _).trans (hbound s hs x) + have hd : |F t x - F s x| ≤ 2 * b x := + (abs_sub _ _).trans (by linarith [hbound t ht x, hbound s hs x]) + have hsq := (sq_le_sq₀ (abs_nonneg _) (by positivity : 0 ≤ 2 * b x)).mpr hd + change ‖(F t x - F s x) ^ 2‖ ≤ 4 * b x ^ 2 + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (F t x - F s x)] + · exact hb.const_mul 4 + · exact Filter.Eventually.of_forall (fun x => ((htime x).sub continuousOn_const).pow 2) + +def SquareDistanceContinuousOn (F : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + ∀ s ∈ S, Tendsto (fun t => ∫ x, (F t x - F s x) ^ 2) (𝓝[S] s) (𝓝 0) + +theorem squareDistanceContinuousOn_of_envelope {F : ℝ → Plane → ℝ} {S : Set ℝ} + {b : Plane → ℝ} + (hspace : ∀ t ∈ S, Continuous (F t)) + (htime : ∀ x, ContinuousOn (fun t => F t x) S) + (hb : Integrable (fun x => b x ^ 2)) + (hbound : ∀ t ∈ S, ∀ x, |F t x| ≤ b x) : + SquareDistanceContinuousOn F S := by + intro s hs + have hh := square_distance_continuousOn hspace htime hb hbound hs s hs + simpa [ContinuousWithinAt] using hh + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneStrongDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneStrongDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f6117750fa0575562dd0841a71f51bdeaad03ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneStrongDerivative.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSquareContinuity +import Mathlib.Analysis.Calculus.MeanValue + +namespace OAI + +/-! Pointwise differentiation and a common L2 derivative envelope imply +strong L2 differentiation, including one-sided differentiation at time zero. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows MeasureTheory Set Filter +open scoped Topology + +def PlaneStrongDerivativeOn (F G : ℝ → Plane → ℝ) (S : Set ℝ) : Prop := + ∀ t ∈ S, Tendsto + (fun s => ∫ x, (slope (fun r => F r x) t s - G t x) ^ 2) + (𝓝[S \ {t}] t) (𝓝 0) + +theorem strongDerivativeOn_of_envelope {F G : ℝ → Plane → ℝ} {S : Set ℝ} + (hS : Convex ℝ S) {b : Plane → ℝ} + (hspace : ∀ t ∈ S, Continuous (F t)) + (hgspace : ∀ t ∈ S, Continuous (G t)) + (hd : ∀ t ∈ S, ∀ x, HasDerivWithinAt (fun r => F r x) (G t x) S t) + (hb : Integrable (fun x => b x ^ 2)) + (hbound : ∀ t ∈ S, ∀ x, |G t x| ≤ b x) : + PlaneStrongDerivativeOn F G S := by + intro t ht + have hmeas : ∀ᶠ s in 𝓝[S \ {t}] t, + AEStronglyMeasurable (fun x => (slope (fun r => F r x) t s - G t x) ^ 2) := by + filter_upwards [self_mem_nhdsWithin] with s hs + have hc : Continuous (fun x => slope (fun r => F r x) t s - G t x) := by + simp only [slope_def_field] + exact (((hspace s hs.1).sub (hspace t ht)).div_const (s - t)).sub (hgspace t ht) + exact (hc.pow 2).aestronglyMeasurable + have hmajor : ∀ᶠ s in 𝓝[S \ {t}] t, ∀ᵐ x, + ‖(slope (fun r => F r x) t s - G t x) ^ 2‖ ≤ 4 * b x ^ 2 := by + filter_upwards [self_mem_nhdsWithin] with s hs + filter_upwards [] with x + have hst : s ≠ t := by simpa only [mem_singleton_iff] using hs.2 + have hb0 : 0 ≤ b x := (abs_nonneg _).trans (hbound t ht x) + have hl := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun r hr => hd r hr x) + (fun r hr => show ‖G r x‖ ≤ b x by simpa only [Real.norm_eq_abs] using hbound r hr x) + hS ht hs.1 + have hq : |slope (fun r => F r x) t s| ≤ b x := by + rw [slope_def_field, abs_div] + apply (div_le_iff₀ (abs_pos.mpr (sub_ne_zero.mpr hst))).mpr + simpa only [Real.norm_eq_abs] using hl + have he : |slope (fun r => F r x) t s - G t x| ≤ 2 * b x := + (abs_sub _ _).trans (by linarith [hbound t ht x]) + have he2 := (sq_le_sq₀ (abs_nonneg _) (by positivity : 0 ≤ 2 * b x)).mpr he + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (slope (fun r => F r x) t s - G t x)] + have hlim : ∀ᵐ x, Tendsto + (fun s => (slope (fun r => F r x) t s - G t x) ^ 2) + (𝓝[S \ {t}] t) (𝓝 (0 : ℝ)) := by + filter_upwards [] with x + have hh := ((hasDerivWithinAt_iff_tendsto_slope.mp (hd t ht x)).sub_const (G t x)).pow 2 + simpa using hh + have he := tendsto_integral_filter_of_dominated_convergence (f := fun _ : Plane => (0 : ℝ)) + (fun x => 4 * b x ^ 2) + hmeas hmajor (hb.const_mul 4) hlim + simpa using he + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6b60702ab851efe1379885d18919a5f717ecd13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailBounds.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTailProfile + +namespace OAI + +/-! Explicit differential inequalities for the integrable tail profile. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +theorem planeBarrierSquare_abs_coordinate (x : Plane) (j : Fin 2) : + |x j| ≤ planeBarrierSquare x := by + apply abs_le.mpr + fin_cases j + · change -(1 + (x 0) ^ 2 + (x 1) ^ 2) ≤ x 0 ∧ x 0 ≤ 1 + (x 0) ^ 2 + (x 1) ^ 2 + constructor <;> nlinarith [sq_nonneg (x 0 - 1), sq_nonneg (x 0 + 1), sq_nonneg (x 1)] + · change -(1 + (x 0) ^ 2 + (x 1) ^ 2) ≤ x 1 ∧ x 1 ≤ 1 + (x 0) ^ 2 + (x 1) ^ 2 + constructor <;> nlinarith [sq_nonneg (x 1 - 1), sq_nonneg (x 1 + 1), sq_nonneg (x 0)] + +theorem planeTailProfile_laplacian_bound (x : Plane) : + scalarLaplacian planeTailProfile x ≤ 24 * planeTailProfile x := by + have hp := planeBarrierSquare_pos x + have hi : 0 ≤ (planeBarrierSquare x)⁻¹ := (inv_pos.mpr hp).le + have hs : (x 0) ^ 2 + (x 1) ^ 2 ≤ (planeBarrierSquare x) ^ 2 := by + unfold planeBarrierSquare + nlinarith [sq_nonneg (x 0), sq_nonneg (x 1), + sq_nonneg ((x 0) ^ 2 + (x 1) ^ 2)] + have hm := mul_le_mul_of_nonneg_right hs (pow_nonneg hi 4) + have he : planeBarrierSquare x ^ 2 * (planeBarrierSquare x)⁻¹ ^ 4 = + planeTailProfile x := by + unfold planeTailProfile + field_simp [hp.ne'] + rw [he] at hm + rw [planeTailProfile_laplacian] + nlinarith [pow_nonneg hi 3] + +theorem planeTailProfile_advection_bound {A : ℝ} (_hA : 0 ≤ A) + (a : Plane → Plane) (ha : ∀ x, ‖a x‖ ≤ A) (x : Plane) : + -fderiv ℝ planeTailProfile x (a x) ≤ 8 * A * planeTailProfile x := by + have hp := planeBarrierSquare_pos x + have hac (j : Fin 2) : |a x j| ≤ A := by + have hnorm : |a x j| ≤ ‖a x‖ := by + simpa only [Real.norm_eq_abs] using (norm_le_pi_norm (a x) j) + exact hnorm.trans (ha x) + have hj (j : Fin 2) : x j * a x j ≤ planeBarrierSquare x * A := by + calc + _ ≤ |x j * a x j| := le_abs_self _ + _ = |x j| * |a x j| := abs_mul _ _ + _ ≤ planeBarrierSquare x * A := + mul_le_mul (planeBarrierSquare_abs_coordinate x j) (hac j) + (abs_nonneg _) hp.le + have hs : x 0 * a x 0 + x 1 * a x 1 ≤ 2 * A * planeBarrierSquare x := by + linarith [hj 0, hj 1] + have hm := mul_le_mul_of_nonneg_right hs + (show 0 ≤ 4 * (planeBarrierSquare x)⁻¹ ^ 3 by positivity) + have he : planeBarrierSquare x * (planeBarrierSquare x)⁻¹ ^ 3 = + planeTailProfile x := by + unfold planeTailProfile + field_simp [hp.ne'] + rw [planeTailProfile_fderiv] + calc + _ = (x 0 * a x 0 + x 1 * a x 1) * (4 * (planeBarrierSquare x)⁻¹ ^ 3) := by ring + _ ≤ (2 * A * planeBarrierSquare x) * (4 * (planeBarrierSquare x)⁻¹ ^ 3) := hm + _ = 8 * A * planeTailProfile x := by rw [show + (2 * A * planeBarrierSquare x) * (4 * (planeBarrierSquare x)⁻¹ ^ 3) = + 8 * A * (planeBarrierSquare x * (planeBarrierSquare x)⁻¹ ^ 3) by ring, he] + +theorem planeTailProfile_generator_bound {ν A : ℝ} (hν : 0 ≤ ν) (hA : 0 ≤ A) + (a : Plane → Plane) (ha : ∀ x, ‖a x‖ ≤ A) (x : Plane) : + scalarGenerator ν a planeTailProfile x ≤ (24 * ν + 8 * A) * planeTailProfile x := by + have hl := mul_le_mul_of_nonneg_left (planeTailProfile_laplacian_bound x) hν + have ha' := planeTailProfile_advection_bound hA a ha x + unfold scalarGenerator + nlinarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailProfile.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..77bb96b9746797fbcf9edb684df3e7adce73b0f4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailProfile.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneBarrier +import Mathlib.Analysis.SpecialFunctions.JapaneseBracket +import Mathlib.Analysis.Calculus.Deriv.ZPow + +namespace OAI + +/-! An integrable rational profile on the whole plane with derivative bounds +controlling diffusion tails. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff + +def planeTailProfile (x : Plane) : ℝ := (planeBarrierSquare x)⁻¹ ^ 2 + +theorem planeBarrierSquare_pos (x : Plane) : 0 < planeBarrierSquare x := + lt_of_lt_of_le (by norm_num) (planeBarrierSquare_one_le x) + +theorem planeTailProfile_pos (x : Plane) : 0 < planeTailProfile x := by + exact pow_pos (inv_pos.mpr (planeBarrierSquare_pos x)) 2 + +theorem planeTailProfile_smooth : ContDiff ℝ ∞ planeTailProfile := + (planeBarrierSquare_smooth.inv (fun x => (planeBarrierSquare_pos x).ne')).pow 2 + +theorem planeTailProfile_le_one (x : Plane) : planeTailProfile x ≤ 1 := by + have hi : (planeBarrierSquare x)⁻¹ ≤ 1 := + (inv_le_one₀ (planeBarrierSquare_pos x)).mpr (planeBarrierSquare_one_le x) + have hn : 0 ≤ (planeBarrierSquare x)⁻¹ := (inv_pos.mpr (planeBarrierSquare_pos x)).le + change (planeBarrierSquare x)⁻¹ ^ 2 ≤ 1 + nlinarith + +theorem planeTailProfile_fderiv (x v : Plane) : + fderiv ℝ planeTailProfile x v = + -4 * (x 0 * v 0 + x 1 * v 1) * (planeBarrierSquare x)⁻¹ ^ 3 := by + have hz := (planeBarrierSquare_pos x).ne' + have hd := (hasDerivAt_zpow (-2) (planeBarrierSquare x) (Or.inl hz)).comp_hasFDerivAt x + (planeBarrierSquare_smooth.differentiable (by simp) x).hasFDerivAt + have he : (fun y : Plane => planeBarrierSquare y ^ (-2 : ℤ)) = planeTailProfile := by + funext y + simp [planeTailProfile, zpow_neg] + change HasFDerivAt (fun y => planeBarrierSquare y ^ (-2 : ℤ)) _ x at hd + rw [he] at hd + rw [hd.fderiv] + simp [planeBarrierSquare_fderiv, zpow_neg] + ring + +theorem planeTailProfile_spatialD (j : Fin 2) : + spatialD j planeTailProfile = fun x => -4 * x j * (planeBarrierSquare x)⁻¹ ^ 3 := by + funext x + rw [spatialD, planeTailProfile_fderiv] + fin_cases j <;> simp [PlanarHamiltonian.basis] + +theorem planeTailProfile_secondD (j : Fin 2) (x : Plane) : + spatialD j (spatialD j planeTailProfile) x = + -4 * (planeBarrierSquare x)⁻¹ ^ 3 + + 24 * (x j) ^ 2 * (planeBarrierSquare x)⁻¹ ^ 4 := by + have hz := (planeBarrierSquare_pos x).ne' + have hd := (hasDerivAt_zpow (-3) (planeBarrierSquare x) (Or.inl hz)).comp_hasFDerivAt x + (planeBarrierSquare_smooth.differentiable (by simp) x).hasFDerivAt + have he : (fun y : Plane => planeBarrierSquare y ^ (-3 : ℤ)) = + (fun y => (planeBarrierSquare y)⁻¹ ^ 3) := by + funext y + simp [zpow_neg] + change HasFDerivAt (fun y => planeBarrierSquare y ^ (-3 : ℤ)) _ x at hd + rw [he] at hd + have hh := ((hasFDerivAt_apply (𝕜 := ℝ) j x).const_mul (-4)).mul hd + rw [planeTailProfile_spatialD] + change fderiv ℝ (fun y : Plane => -4 * y j * (planeBarrierSquare y)⁻¹ ^ 3) x + (PlanarHamiltonian.basis j) = _ + change HasFDerivAt (fun y : Plane => -4 * y j * (planeBarrierSquare y)⁻¹ ^ 3) _ x at hh + rw [hh.fderiv] + fin_cases j <;> simp [planeBarrierSquare_fderiv, PlanarHamiltonian.basis, zpow_neg] <;> ring + +theorem planeTailProfile_laplacian (x : Plane) : + scalarLaplacian planeTailProfile x = + -8 * (planeBarrierSquare x)⁻¹ ^ 3 + + 24 * ((x 0) ^ 2 + (x 1) ^ 2) * (planeBarrierSquare x)⁻¹ ^ 4 := by + simp [scalarLaplacian, planeTailProfile_secondD, Fin.sum_univ_two] + ring + +theorem planeBarrierSquare_norm_sq (x : Plane) : + 1 + ‖x‖ ^ 2 ≤ planeBarrierSquare x := by + have hc (j : Fin 2) : |x j| ≤ Real.sqrt ((x 0) ^ 2 + (x 1) ^ 2) := by + apply (Real.le_sqrt (abs_nonneg _) (by positivity)).mpr + fin_cases j + · change |x 0| ^ 2 ≤ (x 0) ^ 2 + (x 1) ^ 2 + rw [sq_abs] + nlinarith [sq_nonneg (x 1)] + · change |x 1| ^ 2 ≤ (x 0) ^ 2 + (x 1) ^ 2 + rw [sq_abs] + nlinarith [sq_nonneg (x 0)] + have hn : ‖x‖ ≤ Real.sqrt ((x 0) ^ 2 + (x 1) ^ 2) := by + apply (pi_norm_le_iff_of_nonneg (Real.sqrt_nonneg _)).mpr + intro j + exact hc j + have hs := Real.sq_sqrt (show 0 ≤ (x 0) ^ 2 + (x 1) ^ 2 by positivity) + unfold planeBarrierSquare + nlinarith [norm_nonneg x] + +theorem planeTailProfile_integrable : Integrable planeTailProfile := by + have hi : Integrable (fun x : Plane => (1 + ‖x‖ ^ 2)⁻¹ ^ 2) := by + have h := integrable_rpow_neg_one_add_norm_sq (E := Plane) (μ := volume) + (r := 4) (by norm_num) + convert h using 1 + funext x + norm_num [Real.rpow_neg, Real.rpow_natCast] + apply hi.mono' planeTailProfile_smooth.continuous.aestronglyMeasurable + filter_upwards [] with x + rw [Real.norm_eq_abs, abs_of_pos (planeTailProfile_pos x)] + have hp : 0 < 1 + ‖x‖ ^ 2 := by positivity + have he := (inv_le_inv₀ (planeBarrierSquare_pos x) hp).mpr + (planeBarrierSquare_norm_sq x) + exact pow_le_pow_left₀ (inv_pos.mpr (planeBarrierSquare_pos x)).le he 2 + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailShift.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..0287980797eb549dabfe2ee6daef1c23c5a4bda5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTailShift.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTailProfile + +namespace OAI + +/-! The rational scalar tail changes by only a fixed factor on a unit +coordinate neighborhood. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows + +theorem planeBarrierSquare_near {x y : Plane} (hxy : ∀ j, |x j - y j| ≤ 1) : + planeBarrierSquare x ≤ 5 * planeBarrierSquare y := by + have hj (j : Fin 2) : (x j) ^ 2 ≤ 2 * (y j) ^ 2 + 2 := by + have hd : (x j - y j) ^ 2 ≤ 1 := by + nlinarith [(abs_le.mp (hxy j)).1, (abs_le.mp (hxy j)).2, + sq_nonneg (x j - y j)] + nlinarith [sq_nonneg (x j - 2 * y j)] + have h0 := hj 0 + have h1 := hj 1 + unfold planeBarrierSquare + nlinarith [sq_nonneg (y 0), sq_nonneg (y 1)] + +theorem planeTailProfile_near {x y : Plane} (hxy : ∀ j, |x j - y j| ≤ 1) : + planeTailProfile y ≤ 25 * planeTailProfile x := by + have hx := planeBarrierSquare_pos x + have hy := planeBarrierSquare_pos y + have hb := planeBarrierSquare_near hxy + have he : planeBarrierSquare x ^ 2 ≤ 25 * planeBarrierSquare y ^ 2 := by + nlinarith [sq_nonneg (5 * planeBarrierSquare y - planeBarrierSquare x)] + have hd : (1 : ℝ) / planeBarrierSquare y ^ 2 ≤ 25 / planeBarrierSquare x ^ 2 := + (div_le_div_iff₀ (sq_pos_of_pos hy) (sq_pos_of_pos hx)).mpr (by simpa using he) + simpa only [planeTailProfile, one_div, div_eq_mul_inv, inv_pow, one_mul] using hd + +theorem planeTailProfile_line_le (x v : Plane) {t : ℝ} (ht : |t| ≤ 1) + (hv : ‖v‖ ≤ 1) : planeTailProfile (x + t • v) ≤ 25 * planeTailProfile x := by + apply planeTailProfile_near + intro j + have hvj : |v j| ≤ 1 := + (show |v j| ≤ ‖v‖ by simpa only [Real.norm_eq_abs] using norm_le_pi_norm v j).trans hv + have hp := mul_le_mul ht hvj (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + change |x j - (x j + t * v j)| ≤ 1 + rw [show x j - (x j + t * v j) = -(t * v j) from by ring, abs_neg, abs_mul] + simpa only [one_mul] using hp + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTaylorControl.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTaylorControl.lean new file mode 100644 index 0000000000000000000000000000000000000000..d18ad27b77304f24dbca23165d601065a0b4602b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTaylorControl.lean @@ -0,0 +1,98 @@ +import Mathlib.Analysis.Calculus.Taylor +import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas +import Mathlib.Tactic + +namespace OAI + +/-! A three-point estimate converting bounded third derivatives and scalar tail +decay into square integrable second derivatives. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open Set +open scoped ContDiff + +theorem taylor_two_remainder_bound {f : ℝ → ℝ} (hf : ContDiff ℝ ∞ f) + {M s : ℝ} (hs : s ≠ 0) (hM : ∀ t, |iteratedDeriv 3 f t| ≤ M) : + |f s - (f 0 + s * iteratedDeriv 1 f 0 + (s ^ 2 / 2) * iteratedDeriv 2 f 0)| ≤ + M * |s| ^ 3 / 6 := by + have hne : (0 : ℝ) ≠ s := Ne.symm hs + have hf3 : ContDiff ℝ 3 f := hf.of_le (by simp) + obtain ⟨ξ, _, he⟩ := taylor_mean_remainder_lagrange_iteratedDeriv + (n := 2) hne hf3.contDiffOn + have hd (k : ℕ) : iteratedDerivWithin k f (uIcc 0 s) 0 = iteratedDeriv k f 0 := + iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_uIcc hne) + ((hf.of_le (by simp)).contDiffAt) left_mem_uIcc + have hp : taylorWithinEval f 2 (uIcc 0 s) 0 s = + f 0 + s * iteratedDeriv 1 f 0 + (s ^ 2 / 2) * iteratedDeriv 2 f 0 := by + rw [taylorWithinEval_succ f 1, taylorWithinEval_succ f 0] + simp only [taylor_within_zero_eval, hd, sub_zero, Nat.factorial_zero, + Nat.factorial_one, Nat.cast_zero, Nat.cast_one, zero_add, mul_one, + inv_one, pow_one, smul_eq_mul] + ring + rw [hp] at he + rw [he] + norm_num only [Nat.reduceAdd, Nat.factorial, Nat.cast_ofNat, Nat.cast_one, + sub_zero, abs_div, abs_mul, abs_pow] + exact div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right (hM ξ) (pow_nonneg (abs_nonneg s) 3)) (by norm_num) + +theorem second_derivative_three_point_bound {f : ℝ → ℝ} (hf : ContDiff ℝ ∞ f) + {M B h : ℝ} (hh : 0 < h) (hM : 0 ≤ M) + (hthird : ∀ t, |iteratedDeriv 3 f t| ≤ M) + (hzero : |f 0| ≤ B) (hplus : |f h| ≤ B) (hminus : |f (-h)| ≤ B) : + |iteratedDeriv 2 f 0| * h ^ 2 ≤ 4 * B + M * h ^ 3 := by + have hp := taylor_two_remainder_bound hf hh.ne' hthird + have hm := taylor_two_remainder_bound hf (neg_ne_zero.mpr hh.ne') hthird + rw [abs_of_pos hh] at hp + rw [abs_neg, abs_of_pos hh] at hm + have hpl := (abs_le.mp hp).1 + have hpu := (abs_le.mp hp).2 + have hml := (abs_le.mp hm).1 + have hmu := (abs_le.mp hm).2 + have hz := abs_le.mp hzero + have hph := abs_le.mp hplus + have hmh := abs_le.mp hminus + have hc : 0 ≤ M * h ^ 3 := mul_nonneg hM (pow_nonneg hh.le 3) + by_cases hd : 0 ≤ iteratedDeriv 2 f 0 + · rw [abs_of_nonneg hd] + nlinarith + · rw [abs_of_neg (lt_of_not_ge hd)] + nlinarith + + +theorem first_derivative_two_point_bound {f : ℝ → ℝ} (hf : ContDiff ℝ ∞ f) + {M B h : ℝ} (hh : 0 < h) (_hM : 0 ≤ M) + (hsecond : ∀ t, |iteratedDeriv 2 f t| ≤ M) + (hzero : |f 0| ≤ B) (hplus : |f h| ≤ B) : + |iteratedDeriv 1 f 0| * h ≤ 2 * B + M * h ^ 2 := by + have hne : (0 : ℝ) ≠ h := Ne.symm hh.ne' + have hf2 : ContDiff ℝ 2 f := hf.of_le (by simp) + obtain ⟨ξ, _, he⟩ := taylor_mean_remainder_lagrange_iteratedDeriv + (n := 1) hne hf2.contDiffOn + have hd : iteratedDerivWithin 1 f (uIcc 0 h) 0 = iteratedDeriv 1 f 0 := + iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_uIcc hne) + ((hf.of_le (by simp)).contDiffAt) left_mem_uIcc + have hp : taylorWithinEval f 1 (uIcc 0 h) 0 h = f 0 + h * iteratedDeriv 1 f 0 := by + rw [taylorWithinEval_succ f 0] + simp [hd] + rw [hp] at he + have hξ := abs_le.mp (hsecond ξ) + have hz := abs_le.mp hzero + have hhf := abs_le.mp hplus + norm_num at he + rw [iteratedDeriv_one] + have hu := mul_le_mul_of_nonneg_right hξ.2 (sq_nonneg h) + have hl := mul_le_mul_of_nonneg_right hξ.1 (sq_nonneg h) + by_cases hs : 0 ≤ deriv f 0 + · rw [abs_of_nonneg hs] + nlinarith [mul_nonneg _hM (sq_nonneg h)] + · rw [abs_of_neg (lt_of_not_ge hs)] + nlinarith [mul_nonneg _hM (sq_nonneg h)] + + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTestIntegral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTestIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..961ff166a0349ed946f27c4b414b00af44da0892 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTestIntegral.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactIntegration +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EnergyCalculus + +namespace OAI + +/-! Differentiation under a compact spatial test integral on a finite time +interval. No global spatial support assumption is made on the solution. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory Filter +open scoped ContDiff Topology + +private theorem plane_slice_continuous {g : ℝ × Plane → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) (ht : t ∈ Icc a b) : + Continuous (fun x => g (t, x)) := + hg.comp_continuous (continuous_const.prodMk continuous_id) + (fun _ => ⟨ht, mem_univ _⟩) + +theorem compact_integral_continuousOn {g : ℝ × Plane → ℝ} {a b : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) {K : Set Plane} (hK : IsCompact K) : + ContinuousOn (fun t => ∫ x in K, g (t, x)) (Icc a b) := by + rw [continuousOn_iff_continuous_domRestrict] + apply continuous_parametric_integral_of_continuous (s := K) _ hK + exact hg.comp_continuous + ((continuous_subtype_val.comp continuous_fst).prodMk continuous_snd) + (fun y => ⟨y.1.property, mem_univ _⟩) + +theorem compact_supported_integral_continuousOn {g : ℝ × Plane → ℝ} {a b : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) {K : Set Plane} (hK : IsCompact K) + (hs : ∀ r, Function.support (fun x => g (r, x)) ⊆ K) : + ContinuousOn (fun r => ∫ x, g (r, x)) (Icc a b) := by + have hi (r : ℝ) : (∫ x in K, g (r, x)) = ∫ x, g (r, x) := + setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + by_contra hn + exact hx (hs r hn)) + simpa only [hi] using compact_integral_continuousOn hg hK + +theorem compact_integral_hasDerivAt {g d : ℝ × Plane → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) + (hd : ContinuousOn d (Icc a b ×ˢ univ)) + (he : ∀ s ∈ Ioo a b, ∀ x, HasDerivAt (fun r => g (r, x)) (d (s, x)) s) + {K : Set Plane} (hK : IsCompact K) (ht : t ∈ Ioo a b) : + HasDerivAt (fun r => ∫ x in K, g (r, x)) (∫ x in K, d (t, x)) t := by + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hK).bddAbove_image + (hd.norm.mono (fun _ hp => ⟨hp.1, mem_univ _⟩)) + have hb : ∀ᵐ x ∂(volume.restrict K), ∀ s ∈ Ioo a b, ‖d (s, x)‖ ≤ B := by + filter_upwards [ae_restrict_mem hK.measurableSet] with x hx + intro s hs + exact hB (mem_image_of_mem _ ⟨Ioo_subset_Icc_self hs, hx⟩) + have hm : ∀ᶠ s in 𝓝 t, AEStronglyMeasurable (fun x => g (s, x)) (volume.restrict K) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs + exact (plane_slice_continuous hg (Ioo_subset_Icc_self hs)).aestronglyMeasurable + have hi : IntegrableOn (fun x => g (t, x)) K := + (plane_slice_continuous hg (Ioo_subset_Icc_self ht)).continuousOn.integrableOn_compact hK + have hdm : AEStronglyMeasurable (fun x => d (t, x)) (volume.restrict K) := + (plane_slice_continuous hd (Ioo_subset_Icc_self ht)).aestronglyMeasurable + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le (Ioo_mem_nhds ht.1 ht.2) + hm hi hdm hb (integrableOn_const hK.measure_ne_top) + (Eventually.of_forall (fun x s hs => he s hs x))).2 + +theorem compact_supported_integral_hasDerivAt {g d : ℝ × Plane → ℝ} {a b t : ℝ} + (hg : ContinuousOn g (Icc a b ×ˢ univ)) + (hd : ContinuousOn d (Icc a b ×ˢ univ)) + (he : ∀ s ∈ Ioo a b, ∀ x, HasDerivAt (fun r => g (r, x)) (d (s, x)) s) + {K : Set Plane} (hK : IsCompact K) + (hs : ∀ r, Function.support (fun x => g (r, x)) ⊆ K) + (hds : Function.support (fun x => d (t, x)) ⊆ K) (ht : t ∈ Ioo a b) : + HasDerivAt (fun r => ∫ x, g (r, x)) (∫ x, d (t, x)) t := by + have hh := compact_integral_hasDerivAt hg hd he hK ht + have hi (r : ℝ) : (∫ x in K, g (r, x)) = ∫ x, g (r, x) := + setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + by_contra hn + exact hx (hs r hn)) + rw [show (fun r => ∫ x in K, g (r, x)) = (fun r => ∫ x, g (r, x)) from funext hi] at hh + have hdi : (∫ x in K, d (t, x)) = ∫ x, d (t, x) := + setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by + by_contra hn + exact hx (hds hn)) + exact hdi ▸ hh + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTimeRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTimeRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ede82f78be7539083555817477c53c21a57e3b6a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneTimeRegularity.lean @@ -0,0 +1,183 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneSobolevContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneStrongDerivative + +namespace OAI + +/-! Strong L2 time differentiability of the whole-plane scalar solution. +The derivative is the actual advection-diffusion right-hand side. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian MeasureTheory Set +open scoped ContDiff + +def planeTimeDerivative (ν : ℝ) (a : ℝ → Plane → Plane) + (h w : ℝ → Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + scalarGenerator ν (a t) (w t) x + h t x + +theorem PlaneScalarSolution.cylinder_generator {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) : + ContDiffOn ℝ ∞ (Function.uncurry (planeTimeDerivative ν a h w)) + (Icc 0 T ×ˢ univ) := by + have hl : ContDiffOn ℝ ∞ (fun p : ℝ × Plane => scalarLaplacian (w p.1) p.2) + (Icc 0 T ×ˢ univ) := + ContDiffOn.sum (fun j _ => hw.cylinder_second_spatialD hT j j) + have hp : ContDiffOn ℝ ∞ + (fun p : ℝ × Plane => ∑ j : Fin 2, a p.1 p.2 j * spatialD j (w p.1) p.2) + (Icc 0 T ×ˢ univ) := + ContDiffOn.sum (fun j _ => ((contDiff_apply ℝ ℝ j).comp ha).contDiffOn.mul + (hw.cylinder_spatialD hT j)) + have hv : ContDiffOn ℝ ∞ (fun _ : ℝ × Plane => ν) (Icc 0 T ×ˢ univ) := contDiffOn_const + have hc := ((hv.mul hl).sub hp).add hh.contDiffOn + apply hc.congr + rintro ⟨t, x⟩ _ + change ν * scalarLaplacian (w t) x - fderiv ℝ (w t) x (a t x) + h t x = + ν * scalarLaplacian (w t) x - + (∑ j : Fin 2, a t x j * spatialD j (w t) x) + h t x + rw [scalar_directional_basis] + +theorem scalarLaplacian_smooth {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) : + ContDiff ℝ ∞ (scalarLaplacian f) := + ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hf)) + +theorem PlaneScalarSolution.timeDerivative_slice_continuous {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + {t : ℝ} (ht : t ∈ Icc 0 T) : Continuous (planeTimeDerivative ν a h w t) := by + have hws := hw.slice_smooth ht + have has : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hhs : ContDiff ℝ ∞ (h t) := hh.comp (contDiff_const.prodMk contDiff_id) + change Continuous (fun x => ν * scalarLaplacian (w t) x - + fderiv ℝ (w t) x (a t x) + h t x) + exact ((continuous_const.mul (scalarLaplacian_smooth hws).continuous).sub + ((hws.fderiv_right (by simp)).clm_apply has).continuous).add hhs.continuous + +private theorem continuousOn_time_slice {F : ℝ × Plane → ℝ} {S : Set ℝ} + (hF : ContinuousOn F (S ×ˢ univ)) (x : Plane) : + ContinuousOn (fun t => F (t, x)) S := by + have hm : ContinuousOn (fun t : ℝ => (t, x)) S := + continuousOn_id.prodMk continuousOn_const + exact ContinuousOn.comp hF hm (fun t ht => ⟨ht, mem_univ x⟩) + +theorem PlaneScalarSolution.timeDerivative_time_continuous {T ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (x : Plane) : + ContinuousOn (fun t => planeTimeDerivative ν a h w t x) (Icc 0 T) := + continuousOn_time_slice (hw.cylinder_generator hT ha hh).continuousOn x + +theorem scalarGenerator_tail_bound {ν A B C : ℝ} (hν : 0 ≤ ν) + (hA : 0 ≤ A) (_hB : 0 ≤ B) {a : Plane → Plane} {h f : Plane → ℝ} + (ha : ∀ x, ‖a x‖ ≤ A) + (hfirst : ∀ x j, |spatialD j f x| ≤ B * derivativeTail x) + (hsecond : ∀ x j k, |spatialD j (spatialD k f) x| ≤ B * derivativeTail x) + (hh : ∀ x, |h x| ≤ C * derivativeTail x) (x : Plane) : + |scalarGenerator ν a f x + h x| ≤ (2 * ν * B + 2 * A * B + C) * derivativeTail x := by + have hl : |scalarLaplacian f x| ≤ 2 * B * derivativeTail x := by + unfold scalarLaplacian + calc + _ ≤ ∑ j : Fin 2, |spatialD j (spatialD j f) x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _j : Fin 2, B * derivativeTail x := Finset.sum_le_sum (fun j _ => hsecond x j j) + _ = _ := by simp; ring + have hv (j : Fin 2) : |a x j| ≤ A := + (show |a x j| ≤ ‖a x‖ by simpa only [Real.norm_eq_abs] using norm_le_pi_norm (a x) j).trans (ha x) + have hp : |fderiv ℝ f x (a x)| ≤ 2 * A * B * derivativeTail x := by + rw [scalar_directional_basis] + calc + _ ≤ ∑ j : Fin 2, |a x j * spatialD j f x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _j : Fin 2, A * (B * derivativeTail x) := by + apply Finset.sum_le_sum + intro j _ + rw [abs_mul] + exact mul_le_mul (hv j) (hfirst x j) (abs_nonneg _) hA + _ = _ := by simp; ring + have hn : |ν * scalarLaplacian f x| ≤ ν * (2 * B * derivativeTail x) := by + rw [abs_mul, abs_of_nonneg hν] + exact mul_le_mul_of_nonneg_left hl hν + unfold scalarGenerator + calc + _ ≤ |ν * scalarLaplacian f x - fderiv ℝ f x (a x)| + |h x| := abs_add_le _ _ + _ ≤ |ν * scalarLaplacian f x| + |fderiv ℝ f x (a x)| + |h x| := + by linarith [abs_sub (ν * scalarLaplacian f x) (fderiv ℝ f x (a x))] + _ ≤ ν * (2 * B * derivativeTail x) + 2 * A * B * derivativeTail x + + C * derivativeTail x := by linarith [hh x] + _ = _ := by ring + +theorem PlaneScalarSolution.time_derivative_envelope (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 ≤ T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + ∃ B : ℝ, 0 ≤ B ∧ ∀ t ∈ Icc 0 T, ∀ x, + |planeTimeDerivative ν a h w t x| ≤ B * derivativeTail x := by + obtain ⟨B, hB, hb⟩ := hw.uniform_jet2_tail hE hT hν ha hh hc hpos + obtain ⟨A, hA, hab⟩ := hc.drift_bound ha T hT + obtain ⟨C, hC, hcb⟩ := hc.source_tail_bound hh T hT + refine ⟨2 * ν * B + 2 * A * B + C, by positivity, ?_⟩ + intro t ht x + exact scalarGenerator_tail_bound hν.le hA hB (hab t ht) + (fun y j => (hb t ht y).2.1 j) (fun y j k => (hb t ht y).2.2 j k) + (fun y => by + rw [abs_of_nonneg (hpos t ht y)] + exact (hcb t ht y).trans + (mul_le_mul_of_nonneg_left (planeTailProfile_le_derivativeTail y) hC)) x + +theorem PlaneScalarSolution.strong_time_derivative (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + PlaneStrongDerivativeOn w (planeTimeDerivative ν a h w) (Icc 0 T) := by + obtain ⟨B, _, hb⟩ := hw.time_derivative_envelope hE hT.le hν ha hh hc hpos + have hi : Integrable (fun x => (B * derivativeTail x) ^ 2) := by + convert derivativeTail_square_integrable.const_mul (B ^ 2) using 1 + funext x + ring + have hs (t : ℝ) (ht : t ∈ Icc 0 T) : Continuous (planeTimeDerivative ν a h w t) := + hw.timeDerivative_slice_continuous ha hh ht + have hd : ∀ t ∈ Icc 0 T, ∀ x, HasDerivWithinAt (fun r => w r x) + (planeTimeDerivative ν a h w t x) (Icc 0 T) t := hw.equation + exact strongDerivativeOn_of_envelope (convex_Icc 0 T) + (fun t ht => (hw.slice_smooth ht).continuous) hs hd hi hb + +theorem PlaneScalarSolution.time_derivative_square_continuity (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + SquareDistanceContinuousOn (planeTimeDerivative ν a h w) (Icc 0 T) := by + obtain ⟨B, _, hb⟩ := hw.time_derivative_envelope hE hT.le hν ha hh hc hpos + have hi : Integrable (fun x => (B * derivativeTail x) ^ 2) := by + convert derivativeTail_square_integrable.const_mul (B ^ 2) using 1 + funext x + ring + have hs (t : ℝ) (ht : t ∈ Icc 0 T) : Continuous (planeTimeDerivative ν a h w t) := + hw.timeDerivative_slice_continuous ha hh ht + exact squareDistanceContinuousOn_of_envelope hs + (hw.timeDerivative_time_continuous hT ha hh) hi hb + +theorem PlaneScalarSolution.strong_time_regularity (hE : PlaneScalarExistence) + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) (hT : 0 < T) (hν : 0 < ν) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hc : CompactPlaneCoefficients a h) + (hpos : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) : + PlaneStrongDerivativeOn w (planeTimeDerivative ν a h w) (Icc 0 T) ∧ + SquareDistanceContinuousOn (planeTimeDerivative ν a h w) (Icc 0 T) := + ⟨hw.strong_time_derivative hE hT hν ha hh hc hpos, + hw.time_derivative_square_continuity hE hT hν ha hh hc hpos⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneUnitImpulse.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneUnitImpulse.lean new file mode 100644 index 0000000000000000000000000000000000000000..266eb1acb04992fcc6f89074fd20e4a2e6508a9a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneUnitImpulse.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarInput +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Profiles +import Mathlib.MeasureTheory.Integral.Pi + +namespace OAI + +/-! The initial unit-mass vertical impulse for the expanding detector. -/ + +noncomputable section +namespace ForcedComputation.ExpandingDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +theorem smoothPulse_total_integral {a b : ℝ} (hab : a < b) : + (∫ x, smoothPulse a b x) = 1 := by + have hz : ∀ x, x ∉ Icc a b → smoothPulse a b x = 0 := by + intro x hx + by_cases hxa : x < a + · exact smoothPulse_before hab hxa.le + · have hax : a ≤ x := le_of_not_gt hxa + have hbx : b < x := lt_of_not_ge (fun hxb => hx ⟨hax, hxb⟩) + exact smoothPulse_after hab hbx.le + rw [← setIntegral_eq_integral_of_forall_compl_eq_zero hz, + integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hab.le] + exact smoothPulse_integral hab + +def impulseProfile (c x : ℝ) : ℝ := smoothPulse 0 1 (x - c + 1 / 2) + +theorem impulseProfile_smooth (c : ℝ) : ContDiff ℝ ∞ (impulseProfile c) := + (smoothPulse_smooth 0 1).comp ((contDiff_id.sub contDiff_const).add contDiff_const) + +theorem impulseProfile_nonneg (c x : ℝ) : 0 ≤ impulseProfile c x := + smoothPulse_nonneg (by norm_num) _ + +theorem impulseProfile_zero {c x : ℝ} (hx : x < c - 1 / 2 ∨ c + 1 / 2 < x) : + impulseProfile c x = 0 := by + rcases hx with hx | hx + · exact smoothPulse_before (by norm_num) (by linarith) + · exact smoothPulse_after (by norm_num) (by linarith) + +theorem impulseProfile_integral (c : ℝ) : (∫ x, impulseProfile c x) = 1 := by + have he : impulseProfile c = fun x => smoothPulse 0 1 (x + (-c + 1 / 2)) := by + funext x + change smoothPulse 0 1 (x - c + 1 / 2) = smoothPulse 0 1 (x + (-c + 1 / 2)) + congr 1 + ring + rw [he, integral_add_right_eq_self] + exact smoothPulse_total_integral (by norm_num) + +def spatialImpulse (p x : Plane) : ℝ := ∏ j : Fin 2, impulseProfile (p j) (x j) + +theorem spatialImpulse_smooth (p : Plane) : ContDiff ℝ ∞ (spatialImpulse p) := by + change ContDiff ℝ ∞ (fun x : Plane => ∏ j : Fin 2, impulseProfile (p j) (x j)) + simpa only [Fin.prod_univ_two, Function.comp_def] using + ((impulseProfile_smooth (p 0)).comp (contDiff_apply ℝ ℝ (0 : Fin 2))).mul + ((impulseProfile_smooth (p 1)).comp (contDiff_apply ℝ ℝ (1 : Fin 2))) + +theorem spatialImpulse_nonneg (p x : Plane) : 0 ≤ spatialImpulse p x := + Finset.prod_nonneg (fun j _ => impulseProfile_nonneg (p j) (x j)) + +theorem spatialImpulse_integral (p : Plane) : (∫ x, spatialImpulse p x) = 1 := by + change (∫ x : Plane, ∏ j : Fin 2, impulseProfile (p j) (x j)) = 1 + rw [integral_fintype_prod_volume_eq_prod] + simp only [impulseProfile_integral, Finset.prod_const_one] + +theorem spatialImpulse_support (p : Plane) : Function.support (spatialImpulse p) ⊆ + Icc (fun j => p j - 1 / 2) (fun j => p j + 1 / 2) := by + intro x hx + have hj (j : Fin 2) : p j - 1 / 2 ≤ x j ∧ x j ≤ p j + 1 / 2 := by + by_contra hn + have hz : impulseProfile (p j) (x j) = 0 := impulseProfile_zero (by + simpa only [not_and_or, not_le] using hn) + exact hx (Finset.prod_eq_zero (Finset.mem_univ j) hz) + exact ⟨fun j => (hj j).1, fun j => (hj j).2⟩ + +theorem spatialImpulse_compactSupport (p : Plane) : HasCompactSupport (spatialImpulse p) := by + apply HasCompactSupport.intro (K := Icc (fun j => p j - 1 / 2) (fun j => p j + 1 / 2)) + isCompact_Icc + intro x hx + by_contra hn + exact hx (spatialImpulse_support p hn) + +def unitImpulse (p : Plane) (t : ℝ) (x : Plane) : ℝ := + smoothPulse 0 1 t * spatialImpulse p x + +theorem unitImpulse_smooth (p : Plane) : ContDiff ℝ ∞ (Function.uncurry (unitImpulse p)) := + ((smoothPulse_smooth 0 1).comp contDiff_fst).mul + ((spatialImpulse_smooth p).comp contDiff_snd) + +theorem unitImpulse_nonneg (p : Plane) (t : ℝ) (x : Plane) : 0 ≤ unitImpulse p t x := + mul_nonneg (smoothPulse_nonneg (by norm_num) t) (spatialImpulse_nonneg p x) + +theorem unitImpulse_mass (p : Plane) (t : ℝ) : (∫ x, unitImpulse p t x) = smoothPulse 0 1 t := by + change (∫ x, smoothPulse 0 1 t * spatialImpulse p x) = smoothPulse 0 1 t + rw [integral_const_mul, spatialImpulse_integral, mul_one] + +end ForcedComputation.ExpandingDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneWeightedEvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneWeightedEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..72dc3e1660004234a90511054d6035eaadb54c7a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/PlaneWeightedEvolution.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneTestIntegral +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCompactTransport +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneInteriorCalculus + +namespace OAI + +/-! The whole-plane scalar equation tested against a compact smooth +function. Its spatial tails require no integration-by-parts boundary term. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff + +theorem PlaneScalarSolution.test_integral_continuousOn + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) + {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) (hc : HasCompactSupport φ) : + ContinuousOn (fun r => ∫ x, φ x * w r x) (Icc 0 T) := by + apply compact_supported_integral_continuousOn (g := fun p : ℝ × Plane => φ p.2 * w p.1 p.2) + (((hφ.comp contDiff_snd).contDiffOn.mul hw.smooth).continuousOn) hc.isCompact + intro r x hx + by_contra hn + apply hx + change φ x * w r x = 0 + rw [image_eq_zero_of_notMem_tsupport hn, zero_mul] + +theorem PlaneScalarSolution.test_integral_derivative + {T ν : ℝ} {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : PlaneScalarSolution T ν a h w) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) + (hdiv : ∀ t x, divergence (a t) x = 0) + {φ : Plane → ℝ} (hφ : ContDiff ℝ ∞ φ) (hc : HasCompactSupport φ) + {t : ℝ} (ht : t ∈ Ioo 0 T) : + HasDerivAt (fun r => ∫ x, φ x * w r x) + ((∫ x, w t x * (ν * scalarLaplacian φ x + fderiv ℝ φ x (a t x))) + + ∫ x, φ x * h t x) t := by + let A : ℝ := t / 2 + let B : ℝ := (t + T) / 2 + have hi : Icc A B ⊆ Ioo (0 : ℝ) T := by + intro s hs + dsimp [A, B] at hs + constructor <;> linarith [ht.1, ht.2, hs.1, hs.2] + have htAB : t ∈ Ioo A B := by constructor <;> dsimp [A, B] <;> linarith [ht.1, ht.2] + have hp : ContDiff ℝ ∞ (fun p : ℝ × Plane => φ p.2) := hφ.comp contDiff_snd + have hg : ContinuousOn (fun p : ℝ × Plane => φ p.2 * w p.1 p.2) + (Icc A B ×ˢ univ) := + (hp.contDiffOn.mul (hw.smooth.mono (fun _ hs => + ⟨Ioo_subset_Icc_self (hi hs.1), hs.2⟩))).continuousOn + have hd : ContinuousOn (fun p : ℝ × Plane => φ p.2 * + (scalarGenerator ν (a p.1) (w p.1) p.2 + h p.1 p.2)) (Icc A B ×ˢ univ) := + (hp.contDiffOn.mul (((hw.interior_generator ha).add hh.contDiffOn).mono + (fun _ hs => ⟨hi hs.1, hs.2⟩))).continuousOn + have he (s : ℝ) (hs : s ∈ Ioo A B) (x : Plane) : + HasDerivAt (fun r => φ x * w r x) + (φ x * (scalarGenerator ν (a s) (w s) x + h s x)) s := by + have hsT := hi (Ioo_subset_Icc_self hs) + exact ((hw.equation s (Ioo_subset_Icc_self hsT) x).hasDerivAt + (Icc_mem_nhds hsT.1 hsT.2)).const_mul (φ x) + have hsupp (r : ℝ) : Function.support (fun x => φ x * w r x) ⊆ tsupport φ := by + intro x hx + by_contra hn + apply hx + change φ x * w r x = 0 + rw [image_eq_zero_of_notMem_tsupport hn, zero_mul] + have hdsupp : Function.support (fun x => φ x * + (scalarGenerator ν (a t) (w t) x + h t x)) ⊆ tsupport φ := by + intro x hx + by_contra hn + apply hx + change φ x * (scalarGenerator ν (a t) (w t) x + h t x) = 0 + rw [image_eq_zero_of_notMem_tsupport hn, zero_mul] + have hD := compact_supported_integral_hasDerivAt hg hd he hc.isCompact hsupp hdsupp htAB + have hwS := hw.slice_smooth (Ioo_subset_Icc_self ht) + have haS : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + have hhS : ContDiff ℝ ∞ (h t) := hh.comp (contDiff_const.prodMk contDiff_id) + have hG : ContDiff ℝ ∞ (scalarGenerator ν (a t) (w t)) := by + apply ContDiff.sub + · apply ContDiff.mul contDiff_const + unfold scalarLaplacian + exact ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hwS)) + · exact (hwS.fderiv_right (m := ∞) (by simp)).clm_apply haS + have hig : Integrable (fun x => φ x * scalarGenerator ν (a t) (w t) x) := + (hφ.mul hG).continuous.integrable_of_hasCompactSupport hc.mul_right + have hih : Integrable (fun x => φ x * h t x) := + (hφ.mul hhS).continuous.integrable_of_hasCompactSupport hc.mul_right + have hI : (∫ x, φ x * (scalarGenerator ν (a t) (w t) x + h t x)) = + (∫ x, w t x * (ν * scalarLaplacian φ x + fderiv ℝ φ x (a t x))) + + ∫ x, φ x * h t x := by + simp_rw [mul_add] + rw [integral_add hig hih, integral_compact_generator hφ hwS haS hc (hdiv t) ν] + simp only [mul_add] + exact hI ▸ hD + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..613229a5a3d6bc52824eb657298dd161e49c90b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBounds.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarComparison + +namespace OAI + +/-! Constant and affine barriers give the quantitative scalar estimates +used during injection and stirring. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem scalarGenerator_const (ν : ℝ) (a : Plane → Plane) (c : ℝ) (x : Plane) : + scalarGenerator ν a (fun _ => c) x = 0 := by + have h := scalarGenerator_sub_const ν a (fun _ => 0) (-c) x + simpa only [zero_sub, neg_neg, scalarGenerator_zero] using h + +theorem affine_solution (T ν M A : ℝ) (a : ℝ → Plane → Plane) : + TorusScalarSolution T ν a (fun _ _ => A) (fun t _ => M + A * t) (fun _ => M) := by + refine ⟨(contDiff_const.add (contDiff_const.mul contDiff_fst)).contDiffOn, + fun _ _ _ _ => rfl, ?_, ?_⟩ + · funext x + simp + · intro t _ x + simpa only [scalarGenerator_const, zero_add, mul_one, id_eq] using + (((hasDerivWithinAt_id t (Icc (0 : ℝ) T)).const_mul A).const_add M) + +theorem TorusScalarSolution.upper_bound {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) + {M A : ℝ} (hh : ∀ t ∈ Icc 0 T, ∀ x, h t x ≤ A) (h₀ : ∀ x, w₀ x ≤ M) : + ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ M + A * t := + hw.compare (affine_solution T ν M A a) hT hν hh h₀ + +theorem TorusScalarSolution.absolute_bound {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) + {M A : ℝ} (hh : ∀ t ∈ Icc 0 T, ∀ x, |h t x| ≤ A) + (h₀ : ∀ x, |w₀ x| ≤ M) : + ∀ t ∈ Icc 0 T, ∀ x, |w t x| ≤ M + A * t := by + have hu := hw.upper_bound hT hν + (fun t ht x => (abs_le.mp (hh t ht x)).2) (fun x => (abs_le.mp (h₀ x)).2) + have hl := (affine_solution T ν (-M) (-A) a).compare hw hT hν + (fun t ht x => (abs_le.mp (hh t ht x)).1) (fun x => (abs_le.mp (h₀ x)).1) + intro t ht x + apply abs_le.mpr + constructor + · have h := hl t ht x + linarith + · exact hu t ht x + + +/-- A residual bound gives a pointwise error bound, including an initial error. -/ +theorem TorusScalarSolution.stability {T ν : ℝ} {a : ℝ → Plane → Plane} + {h k w v : ℝ → Plane → ℝ} {w₀ v₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) + (hv : TorusScalarSolution T ν a k v v₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) + {E D : ℝ} (hres : ∀ t ∈ Icc 0 T, ∀ x, |h t x - k t x| ≤ D) + (hinit : ∀ x, |w₀ x - v₀ x| ≤ E) : + ∀ t ∈ Icc 0 T, ∀ x, |w t x - v t x| ≤ E + D * t := + (hw.sub hv).absolute_bound hT hν hres hinit + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBurstError.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBurstError.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd75f661717f6af471047df23be51d5c9c9023d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarBurstError.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorScales + +namespace OAI + +/-! The prescribed rational burst duration makes the scalar diffusion error +strictly smaller than the detector's fixed observation gap. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +theorem scalar_burst_error (C L n : ℕ) + {a : ℝ → Plane → Plane} {h w v : ℝ → Plane → ℝ} + (hw : TorusScalarSolution (2 * (duration C L n : ℝ)) 1 a h w (fun _ => 0)) + (hv : TorusScalarSolution (2 * (duration C L n : ℝ)) 1 a + (fun t x => h t x - scalarLaplacian (v t) x) v (fun _ => 0)) + (hlap : ∀ t ∈ Icc 0 (2 * (duration C L n : ℝ)), ∀ x, + |scalarLaplacian (v t) x| ≤ (laplacianBound C L n : ℝ)) : + ∀ t ∈ Icc 0 (2 * (duration C L n : ℝ)), ∀ x, |w t x - v t x| < 1 / 16 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hD : (0 : ℝ) ≤ laplacianBound C L n := by + exact_mod_cast laplacianBound_nonneg C L n + have hs : (2 : ℝ) * (duration C L n : ℝ) * (laplacianBound C L n : ℝ) < 1 / 16 := by + have hh := (Rat.cast_lt (K := ℝ)).mpr (diffusion_loss_small C L n) + norm_num only [Rat.cast_mul, Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] at hh + exact hh + have he := hw.stability hv (by positivity) (by norm_num) + (E := 0) (D := (laplacianBound C L n : ℝ)) + (fun t ht x => by simpa only [sub_sub_cancel] using hlap t ht x) + (fun _ => by simp) + intro t ht x + calc + _ ≤ (laplacianBound C L n : ℝ) * t := by simpa only [zero_add] using he t ht x + _ ≤ (laplacianBound C L n : ℝ) * (2 * (duration C L n : ℝ)) := + mul_le_mul_of_nonneg_left ht.2 hD + _ < 1 / 16 := by nlinarith + +/-- The same comparison includes all older injections through their small +value at the start of this burst; no decomposition of the scalar is needed. -/ +theorem scalar_burst_error_initial (C L n : ℕ) + {a : ℝ → Plane → Plane} {h w v : ℝ → Plane → ℝ} {w₀ v₀ : Plane → ℝ} + (hw : TorusScalarSolution (2 * (duration C L n : ℝ)) 1 a h w w₀) + (hv : TorusScalarSolution (2 * (duration C L n : ℝ)) 1 a + (fun t x => h t x - scalarLaplacian (v t) x) v v₀) + (hlap : ∀ t ∈ Icc 0 (2 * (duration C L n : ℝ)), ∀ x, + |scalarLaplacian (v t) x| ≤ (laplacianBound C L n : ℝ)) + {E : ℝ} (hinit : ∀ x, |w₀ x - v₀ x| ≤ E) : + ∀ t ∈ Icc 0 (2 * (duration C L n : ℝ)), ∀ x, + |w t x - v t x| < E + 1 / 16 := by + have hd : (0 : ℝ) < duration C L n := by exact_mod_cast duration_pos C L n + have hD : (0 : ℝ) ≤ laplacianBound C L n := by + exact_mod_cast laplacianBound_nonneg C L n + have hs : (2 : ℝ) * (duration C L n : ℝ) * (laplacianBound C L n : ℝ) < 1 / 16 := by + have hh := (Rat.cast_lt (K := ℝ)).mpr (diffusion_loss_small C L n) + norm_num only [Rat.cast_mul, Rat.cast_div, Rat.cast_ofNat, Rat.cast_one] at hh + exact hh + have he := hw.stability hv (by positivity) (by norm_num) + (E := E) (D := (laplacianBound C L n : ℝ)) + (fun t ht x => by simpa only [sub_sub_cancel] using hlap t ht x) hinit + intro t ht x + calc + _ ≤ E + (laplacianBound C L n : ℝ) * t := he t ht x + _ ≤ E + (laplacianBound C L n : ℝ) * (2 * (duration C L n : ℝ)) := + add_le_add le_rfl (mul_le_mul_of_nonneg_left ht.2 hD) + _ < E + 1 / 16 := by nlinarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCharacteristics.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCharacteristics.lean new file mode 100644 index 0000000000000000000000000000000000000000..0612f184e6dab73ed47a600ff5a1e037124a9491 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCharacteristics.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarTransition +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! The inviscid reference is constant along actual characteristics. +Its transport equation follows by differentiating that identity. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows +open scoped ContDiff + +def pullbackScalar (Ψ : ℝ → ℝ → Plane → Plane) (g : Plane → ℝ) + (t : ℝ) (x : Plane) : ℝ := g (Ψ t (-t) x) + +theorem planar_transition_equivariant {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) (a t : ℝ) (x : Plane) (k : Fin 2 → ℤ) : + Ψ a t (x + fun j => (k j : ℝ)) = Ψ a t x + fun j => (k j : ℝ) := by + symm + apply hΨ.unique a (x + fun j => (k j : ℝ)) + (fun s => Ψ a s x + fun j => (k j : ℝ)) + · rw [hΨ.initial] + · intro s + rw [hp (a + s) (Ψ a s x) k] + exact (hΨ.ode a s x).add_const (fun j => (k j : ℝ)) + +theorem pullbackScalar_periodic {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hp : ∀ s, PlanePeriodic (V s)) {g : Plane → ℝ} (hg : PlanePeriodic g) (t : ℝ) : + PlanePeriodic (pullbackScalar Ψ g t) := by + intro x k + unfold pullbackScalar + rw [planar_transition_equivariant hΨ hp, hg] + +theorem pullbackScalar_along {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (g : Plane → ℝ) (t r : ℝ) (x : Plane) : + pullbackScalar Ψ g (t + r) (Ψ t r x) = pullbackScalar Ψ g t x := by + have he : Ψ 0 (t + r) (Ψ t (-t) x) = Ψ t r x := by + rw [hΨ.compose 0 t r, zero_add] + have hi : Ψ 0 t (Ψ t (-t) x) = x := by + simpa only [zero_add] using hΨ.inverse_right 0 t x + rw [hi] + unfold pullbackScalar + rw [← he] + simpa only [zero_add] using congrArg g (hΨ.inverse_left 0 (t + r) (Ψ t (-t) x)) + +theorem scalar_characteristic_equation {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + {u : ℝ → Plane → ℝ} (hu : ContDiff ℝ ∞ (Function.uncurry u)) + (hinv : ∀ t r x, u (t + r) (Ψ t r x) = u t x) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => u s x) (-fderiv ℝ (u t) x (V t x)) t := by + let D := fderiv ℝ (Function.uncurry u) (t, x) + have hf : HasFDerivAt (Function.uncurry u) D (t, x) := + (hu.differentiable (by simp) (t, x)).hasFDerivAt + have hγ : HasDerivAt (fun r => (t + r, Ψ t r x)) (1, V t x) 0 := by + simpa only [add_zero, hΨ.initial, id_eq] using + ((hasDerivAt_id (0 : ℝ)).const_add t).prodMk (hΨ.ode t 0 x) + have hfγ : HasFDerivAt (Function.uncurry u) D (t + 0, Ψ t 0 x) := by + simpa only [add_zero, hΨ.initial] using hf + have hc := hfγ.comp_hasDerivAt 0 hγ + have hz : HasDerivAt (fun r => u (t + r) (Ψ t r x)) 0 0 := by + simpa only [hinv] using hasDerivAt_const (0 : ℝ) (u t x) + have he : D (1, V t x) = 0 := hc.unique hz + have hspace := hf.comp x ((hasFDerivAt_const t x).prodMk (hasFDerivAt_id x)) + have hsp : D (0, V t x) = fderiv ℝ (u t) x (V t x) := by + simpa only [Function.comp_def, Function.uncurry_apply_pair, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.prod_apply, + zero_apply, ContinuousLinearMap.id_apply] using + (congrArg (fun A : Plane →L[ℝ] ℝ => A (V t x)) hspace.fderiv).symm + have hadd : ((1 : ℝ), V t x) = (1, (0 : Plane)) + (0, V t x) := by + ext <;> simp + rw [hadd, map_add, hsp] at he + have htD : D (1, (0 : Plane)) = -fderiv ℝ (u t) x (V t x) := by linarith + have htime := hf.comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + simpa only [Function.comp_def, Function.uncurry_apply_pair, id_eq, htD] using htime + +theorem pullbackScalar_transport {V : ℝ → Plane → Plane} + {Ψ : ℝ → ℝ → Plane → Plane} (hΨ : IsPlanarTransition V Ψ) + (hback : ContDiff ℝ ∞ (fun y : ℝ × Plane => Ψ y.1 (-y.1) y.2)) + {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => pullbackScalar Ψ g s x) + (-fderiv ℝ (pullbackScalar Ψ g t) x (V t x)) t := + scalar_characteristic_equation (u := pullbackScalar Ψ g) hΨ (hg.comp hback) + (pullbackScalar_along hΨ g) t x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarComparison.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe7a3d0a4c28dc72142fd71d5fc3ac808789dea9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarComparison.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarPositivity + +namespace OAI + +/-! Scalar comparison and uniqueness from the maximum principle. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +theorem spatialD_sub {f g : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hg : ContDiff ℝ ∞ g) (j : Fin 2) : + spatialD j (fun x => f x - g x) = fun x => spatialD j f x - spatialD j g x := by + funext x + simp only [spatialD, fderiv_fun_sub (hf.differentiable (by simp) x) + (hg.differentiable (by simp) x), sub_apply] + +theorem scalarGenerator_sub {f g : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (hg : ContDiff ℝ ∞ g) (ν : ℝ) (a : Plane → Plane) (x : Plane) : + scalarGenerator ν a (fun y => f y - g y) x = + scalarGenerator ν a f x - scalarGenerator ν a g x := by + have hl : scalarLaplacian (fun y => f y - g y) x = + scalarLaplacian f x - scalarLaplacian g x := by + unfold scalarLaplacian + simp only [spatialD_sub hf hg] + simp only [spatialD_sub (spatialD_smooth _ hf) (spatialD_smooth _ hg), + Finset.sum_sub_distrib] + simp only [scalarGenerator, hl, fderiv_fun_sub (hf.differentiable (by simp) x) + (hg.differentiable (by simp) x), sub_apply] + ring + +theorem TorusScalarSolution.sub {T ν : ℝ} {a : ℝ → Plane → Plane} + {h k w v : ℝ → Plane → ℝ} {w₀ v₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) + (hv : TorusScalarSolution T ν a k v v₀) : + TorusScalarSolution T ν a (fun t x => h t x - k t x) + (fun t x => w t x - v t x) (fun x => w₀ x - v₀ x) := by + refine ⟨hw.smooth.sub hv.smooth, ?_, ?_, ?_⟩ + · intro t ht x n + dsimp only + rw [hw.periodic t ht x n, hv.periodic t ht x n] + · funext x + rw [hw.initial, hv.initial] + · intro t ht x + have hd := (hw.equation t ht x).sub (hv.equation t ht x) + convert hd using 1 + rw [scalarGenerator_sub (hw.slice_smooth ht) (hv.slice_smooth ht)] + ring + +theorem TorusScalarSolution.compare {T ν : ℝ} {a : ℝ → Plane → Plane} + {h k w v : ℝ → Plane → ℝ} {w₀ v₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) + (hv : TorusScalarSolution T ν a k v v₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) + (hh : ∀ t ∈ Icc 0 T, ∀ x, h t x ≤ k t x) (h₀ : ∀ x, w₀ x ≤ v₀ x) : + ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ v t x := by + have hp := (hv.sub hw).nonnegative hT hν + (fun t ht x => sub_nonneg.mpr (hh t ht x)) + (fun x => sub_nonneg.mpr (h₀ x)) + exact fun t ht x => sub_nonneg.mp (hp t ht x) + +theorem TorusScalarSolution.unique {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) + (hv : TorusScalarSolution T ν a h v w₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) : + ∀ t ∈ Icc 0 T, w t = v t := by + intro t ht + funext x + exact le_antisymm + (hw.compare hv hT hν (fun _ _ _ => le_rfl) (fun _ => le_rfl) t ht x) + (hv.compare hw hT hν (fun _ _ _ => le_rfl) (fun _ => le_rfl) t ht x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCompositionBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCompositionBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..083a1a580caa4acfb78e27338a5e757356071f69 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarCompositionBounds.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.EuclideanFlowBounds + +namespace OAI + +/-! The Hessian chain rule used for a transported detector bump. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open scoped ContDiff + +theorem scalar_second_composition {g : EuclideanPlane → ℝ} + {φ : EuclideanPlane → EuclideanPlane} (hg : ContDiff ℝ ∞ g) + (hφ : ContDiff ℝ ∞ φ) (x v w : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (g ∘ φ)) x v w = + fderiv ℝ g (φ x) (fderiv ℝ (fderiv ℝ φ) x v w) + + fderiv ℝ (fderiv ℝ g) (φ x) (fderiv ℝ φ x v) (fderiv ℝ φ x w) := by + have he : fderiv ℝ (g ∘ φ) = + fun y => (fderiv ℝ g (φ y)).comp (fderiv ℝ φ y) := by + funext y + exact fderiv_comp y (hg.differentiable (by simp) _) (hφ.differentiable (by simp) _) + rw [he] + have hg' := ((hg.fderiv_right (m := ∞) (by simp)).differentiable (by simp) (φ x)).hasFDerivAt + have hφ' := ((hφ.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x).hasFDerivAt + have hd := (hg'.comp x ((hφ.differentiable (by simp) x).hasFDerivAt)).clm_comp hφ' + simp only [Function.comp_def] at hd + rw [hd.fderiv] + rfl + +theorem scalar_second_composition_bound {g : EuclideanPlane → ℝ} + {φ : EuclideanPlane → EuclideanPlane} (hg : ContDiff ℝ ∞ g) + (hφ : ContDiff ℝ ∞ φ) (x : EuclideanPlane) {A B P Q : ℝ} + (hA : 0 ≤ A) (hB : 0 ≤ B) (hP : 0 ≤ P) (hQ : 0 ≤ Q) + (hg₁ : ‖fderiv ℝ g (φ x)‖ ≤ A) (hg₂ : ‖fderiv ℝ (fderiv ℝ g) (φ x)‖ ≤ B) + (hφ₁ : ‖fderiv ℝ φ x‖ ≤ P) (hφ₂ : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ Q) : + ‖fderiv ℝ (fderiv ℝ (g ∘ φ)) x‖ ≤ A * Q + B * P ^ 2 := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro v + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro w + rw [scalar_second_composition hg hφ] + have hvb : ‖fderiv ℝ φ x v‖ ≤ P * ‖v‖ := + ((fderiv ℝ φ x).le_opNorm v).trans (mul_le_mul_of_nonneg_right hφ₁ (norm_nonneg v)) + have hwb : ‖fderiv ℝ φ x w‖ ≤ P * ‖w‖ := + ((fderiv ℝ φ x).le_opNorm w).trans (mul_le_mul_of_nonneg_right hφ₁ (norm_nonneg w)) + calc + _ ≤ ‖fderiv ℝ g (φ x) (fderiv ℝ (fderiv ℝ φ) x v w)‖ + + ‖fderiv ℝ (fderiv ℝ g) (φ x) (fderiv ℝ φ x v) (fderiv ℝ φ x w)‖ := norm_add_le _ _ + _ ≤ ‖fderiv ℝ g (φ x)‖ * (‖fderiv ℝ (fderiv ℝ φ) x‖ * ‖v‖ * ‖w‖) + + ‖fderiv ℝ (fderiv ℝ g) (φ x)‖ * ‖fderiv ℝ φ x v‖ * ‖fderiv ℝ φ x w‖ := by + apply add_le_add + · exact ((fderiv ℝ g (φ x)).le_opNorm _).trans + (mul_le_mul_of_nonneg_left ((fderiv ℝ (fderiv ℝ φ) x).le_opNorm₂ v w) (norm_nonneg _)) + · exact (fderiv ℝ (fderiv ℝ g) (φ x)).le_opNorm₂ _ _ + _ ≤ A * (Q * ‖v‖ * ‖w‖) + B * (P * ‖v‖) * (P * ‖w‖) := by + apply add_le_add + · exact mul_le_mul hg₁ + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right hφ₂ (norm_nonneg v)) (norm_nonneg w)) + (by positivity) hA + · exact mul_le_mul (mul_le_mul hg₂ hvb (norm_nonneg _) hB) hwb + (norm_nonneg _) (mul_nonneg hB (mul_nonneg hP (norm_nonneg v))) + _ = ((A * Q + B * P ^ 2) * ‖v‖) * ‖w‖ := by ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDecayMain.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDecayMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..d59d4236105c0029fb19b9b6ed841cccdfc3d67f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDecayMain.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.RapidForcing.Main +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.RapidConsequences + +namespace OAI + +/-! +Compact spatial forcing with slow derivative decay, space-time L² bounds, +and uniformly bounded kinetic energy. + +This is Theorem `bcs:scalar-theorem` in *Scalar Potentials and Slow Clocks for +Forced Fluid Computation*, obtained by specializing the rapid decay bounds +of the addressed construction. +-/ + +noncomputable section +open Set MeasureTheory + +namespace RapidForcing + +theorem compact_support_slow_decay (ν : ℝ) (hν : 0 < ν) + (hνcomp : ComputableReal ν) : + ∃ compile : ℕ → ℕ × ℕ, Computable compile ∧ + ∀ (M : Machine) (w : M.Input), + let u := addressedVelocity M w + let f := addressedForce ν M w + ForceProgram (compile (M.inputDescription w)) f ∧ + Smooth f ∧ Supported f ∧ Smooth u ∧ Supported u ∧ + (∀ l α, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedD l α u t x‖ + ‖mixedD l α f t x‖ ≤ C * (1 + t)⁻¹ ^ (1 + l)) ∧ + SpaceTimeL2 u ∧ SpaceTimeL2 f ∧ + (∃ E : ℝ, ∀ t, 0 ≤ t → (1 / 2 : ℝ) * ∫ x, ‖u t x‖ ^ 2 ≤ E) ∧ + UniqueEnergySolution ν f u (fun _ _ => 0) ∧ + ∃ X : ℝ → Space → Space, MaterialFlow u X ∧ + (M.Halts w ↔ ∃ t : ℝ, 0 ≤ t ∧ (X t 0) 0 < -1) := by + obtain ⟨compile, hc, hall⟩ := compact_support_rapid_decay ν hν hνcomp + refine ⟨compile, hc, fun M w => ?_⟩ + obtain ⟨hp, hfs, hfK, hfr, _, hus, huK, hur, _, hsol, X, hX, hhalt⟩ := hall M w + obtain ⟨q, hq⟩ := exists_rat_gt ‖ν‖ + have hful2 := (addressedForce_jetControl ν q hq.le M w).spaceTimeL2 + have huul2 := (addressedVelocity_jetControl M w).spaceTimeL2 + have hdecay : ∀ l α, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, + ‖mixedD l α (addressedVelocity M w) t x‖ + + ‖mixedD l α (addressedForce ν M w) t x‖ ≤ C * (1 + t)⁻¹ ^ (1 + l) := by + intro l α + obtain ⟨A, hA, hAb⟩ := hur.slowDecay l α + obtain ⟨B, hB, hBb⟩ := hfr.slowDecay l α + refine ⟨A + B, add_nonneg hA hB, fun t ht x => ?_⟩ + calc + _ ≤ A * (1 + t)⁻¹ ^ (1 + l) + B * (1 + t)⁻¹ ^ (1 + l) := + add_le_add (hAb t ht x) (hBb t ht x) + _ = _ := (add_mul _ _ _).symm + have heb : ∃ E : ℝ, ∀ t, 0 ≤ t → + (1 / 2 : ℝ) * ∫ x, ‖addressedVelocity M w t x‖ ^ 2 ≤ E := by + apply supported_uniform_energy + · intro t + exact (addressedVelocity_joint_smooth M w).continuous.comp + (continuous_const.prodMk continuous_id) + · exact huK + · obtain ⟨C, hC, hb⟩ := hur 0 0 (fun _ => 0) + exact ⟨C, hC, fun t ht x => by simpa [mixedD, spatialMulti] using hb t ht x⟩ + exact ⟨hp, hfs, hfK, hus, huK, hdecay, huul2, hful2, heb, hsol, X, hX, hhalt⟩ + +end RapidForcing + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDuhamelCoefficients.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDuhamelCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf96878e2ed3e7c08971c6a0515d907d8a61c5bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarDuhamelCoefficients.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneCoefficientJets + +namespace OAI + +/-! The three divergence-form coefficients for the actual scalar advection equation. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff BigOperators + +def driftCoefficients (a : ℝ → Plane → Plane) (i : Fin 3) (p : ℝ × Plane) : ℝ := + Fin.cases (PlanarHamiltonian.divergence (a p.1) p.2) (fun j => -a p.1 p.2 j) i + +@[simp] theorem driftCoefficients_zero (a : ℝ → Plane → Plane) (p : ℝ × Plane) : + driftCoefficients a 0 p = PlanarHamiltonian.divergence (a p.1) p.2 := rfl + +@[simp] theorem driftCoefficients_succ (a : ℝ → Plane → Plane) (j : Fin 2) (p : ℝ × Plane) : + driftCoefficients a j.succ p = -a p.1 p.2 j := by + simp only [driftCoefficients, Fin.cases_succ] + +theorem spatialD_parameter_smooth {f : ℝ × Plane → ℝ} (hf : ContDiff ℝ ∞ f) (j : Fin 2) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => spatialD j (fun y => f (p.1,y)) p.2) := by + have he (p : ℝ × Plane) : spatialD j (fun y => f (p.1,y)) p.2 = + fderiv ℝ f p (0, PlanarHamiltonian.basis j) := by + have hi : HasFDerivAt (fun y : Plane => (p.1,y)) + (ContinuousLinearMap.inr ℝ ℝ Plane) p.2 := hasFDerivAt_prodMk_right p.1 p.2 + have hd := (hf.differentiable (by simp) p).hasFDerivAt.comp p.2 hi + change HasFDerivAt (fun y : Plane => f (p.1,y)) _ p.2 at hd + rw [spatialD, hd.fderiv] + rfl + simp_rw [he] + exact (hf.fderiv_right (by simp)).clm_apply contDiff_const + +theorem driftCoefficients_smooth {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (i : Fin 3) : + ContDiff ℝ ∞ (driftCoefficients a i) := by + refine Fin.cases ?_ (fun j => ?_) i + · change ContDiff ℝ ∞ (fun p : ℝ × Plane => ∑ j : Fin 2, spatialD j (fun y => a p.1 y j) p.2) + exact ContDiff.sum fun j _ => spatialD_parameter_smooth ((contDiff_apply ℝ ℝ j).comp ha) j + · change ContDiff ℝ ∞ (fun p : ℝ × Plane => -a p.1 p.2 j) + exact ((contDiff_apply ℝ ℝ j).comp ha).neg + +theorem driftCoefficients_periodic {a : ℝ → Plane → Plane} + (ha : ContDiff ℝ ∞ (Function.uncurry a)) (hp : ∀ t, PlanePeriodic (a t)) + (i : Fin 3) (t : ℝ) : PlanePeriodic (fun x => driftCoefficients a i (t,x)) := by + have hs : ContDiff ℝ ∞ (a t) := ha.comp (contDiff_const.prodMk contDiff_id) + refine Fin.cases ?_ (fun j => ?_) i + · intro x n + change (∑ j : Fin 2, spatialD j (fun y => a t y j) (x + fun j => (n j : ℝ))) = + ∑ j : Fin 2, spatialD j (fun y => a t y j) x + apply Finset.sum_congr rfl + intro j _ + exact spatialD_periodic ((contDiff_apply ℝ ℝ j).comp hs) + (fun y m => congrFun (hp t y m) j) j x n + · intro x n + exact congrArg (fun v : Plane => -v j) (hp t x n) + +theorem driftCoefficients_supported {a : ℝ → Plane → Plane} {K : Set Plane} + (hK : IsClosed K) {t : ℝ} (ha : ∀ x ∉ K, a t x = 0) + (i : Fin 3) (x : Plane) (hx : x ∉ K) : driftCoefficients a i (t,x) = 0 := by + have hd (j : Fin 2) : fderiv ℝ (fun y => a t y j) x = 0 := by + apply fderiv_of_notMem_tsupport + have hs : tsupport (fun y => a t y j) ⊆ K := by + apply closure_minimal _ hK + intro y hy + by_contra h + apply hy + simp only [ha y h, Pi.zero_apply] + exact fun h => hx (hs h) + refine Fin.cases ?_ (fun j => ?_) i + · change (∑ j : Fin 2, fderiv ℝ (fun y => a t y j) x (PlanarHamiltonian.basis j)) = 0 + simp only [hd, zero_apply, Finset.sum_const_zero] + · change -a t x _ = 0 + simp only [ha x hx, Pi.zero_apply, neg_zero] + +theorem driftCoefficients_effective_source {a : Plane → Plane} {w : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hw : ContDiff ℝ ∞ w) (h : Plane → ℝ) (x : Plane) : + h x + PlanarHamiltonian.divergence a x * w x + + (∑ j : Fin 2, spatialD j (fun y => (-a y j) * w y) x) = + h x - fderiv ℝ w x (a x) := by + have he (j : Fin 2) : spatialD j (fun y => (-a y j) * w y) x = + -spatialD j (fun y => (w y • a y) j) x := by + have hf : (fun y => (-a y j) * w y) = fun y => -((w y • a y) j) := by + funext y + simp only [Pi.smul_apply, smul_eq_mul] + ring + rw [hf, spatialD, fderiv_fun_neg] + rfl + simp_rw [he] + rw [Finset.sum_neg_distrib] + change h x + PlanarHamiltonian.divergence a x * w x - + PlanarHamiltonian.divergence (fun y => w y • a y) x = _ + rw [divergence_scalar_product ha hw] + ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarEuclideanLaplacian.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarEuclideanLaplacian.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff9db6658c0c9fa176f4aa52021e2feb203e87e4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarEuclideanLaplacian.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarTransportBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! The scalar PDE's coordinate Laplacian equals the trace computed in +Euclidean coordinates. Thus the detector Hessian estimates have no hidden +change-of-norm factor. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian +open scoped ContDiff BigOperators + +def scalarEuclidean (g : Plane → ℝ) : EuclideanPlane → ℝ := g ∘ planeCoordinates + +theorem scalarEuclidean_smooth {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) : + ContDiff ℝ ∞ (scalarEuclidean g) := hg.comp planeCoordinates.contDiff + +theorem scalarEuclidean_second {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (x v w : EuclideanPlane) : + fderiv ℝ (fderiv ℝ (scalarEuclidean g)) x v w = + fderiv ℝ (fderiv ℝ g) (planeCoordinates x) (planeCoordinates v) (planeCoordinates w) := by + have he : fderiv ℝ (scalarEuclidean g) = + fun y => (fderiv ℝ g (planeCoordinates y)).comp planeCoordinates.toContinuousLinearMap := by + funext y + simpa only [scalarEuclidean, ContinuousLinearEquiv.fderiv] using + fderiv_comp y (hg.differentiable (by simp) _) planeCoordinates.differentiableAt + rw [he] + have hg' := ((hg.fderiv_right (m := ∞) (by simp)).differentiable (by simp) + (planeCoordinates x)).hasFDerivAt + have hd := (hg'.comp x planeCoordinates.hasFDerivAt).clm_comp + (hasFDerivAt_const (planeCoordinates.toContinuousLinearMap) x) + simp only [Function.comp_def] at hd + rw [hd.fderiv] + simp + +theorem scalarLaplacian_eq_euclidean_trace {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (x : Plane) : + scalarLaplacian g x = ∑ j : Fin 2, + fderiv ℝ (fderiv ℝ (scalarEuclidean g)) (planeCoordinates.symm x) + (EuclideanSpace.single j 1) (EuclideanSpace.single j 1) := by + apply Finset.sum_congr rfl + intro j _ + rw [scalarEuclidean_second hg] + have hbase : planeCoordinates (EuclideanSpace.single j 1) = PlanarHamiltonian.basis j := by + ext k + simp [planeCoordinates, PlanarHamiltonian.basis, Pi.single_apply] + rw [planeCoordinates.apply_symm_apply, hbase] + unfold spatialD + rw [fderiv_clm_apply ((hg.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x) + (differentiableAt_const _)] + simp + +theorem scalarLaplacian_bound_of_euclidean_hessian {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (x : Plane) {B : ℝ} + (hb : ‖fderiv ℝ (fderiv ℝ (scalarEuclidean g)) (planeCoordinates.symm x)‖ ≤ B) : + |scalarLaplacian g x| ≤ 2 * B := by + rw [scalarLaplacian_eq_euclidean_trace hg] + exact hessian_trace_bound _ _ hb + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarGlobalExistence.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarGlobalExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fbbe11b9cef20666c4169b61cdfda8ebfca3672 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarGlobalExistence.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarBounds + +namespace OAI + +/-! Consistent finite-cylinder solutions give one scalar evolution for all +nonnegative time, with compatibility supplied by uniqueness. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem TorusScalarSolution.restrict {T S ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (hST : S ≤ T) : + TorusScalarSolution S ν a h w w₀ := by + have hsub : Icc (0 : ℝ) S ⊆ Icc 0 T := Icc_subset_Icc le_rfl hST + refine ⟨hw.smooth.mono (fun _ hp => ⟨hsub hp.1, hp.2⟩), + fun t ht => hw.periodic t (hsub ht), hw.initial, ?_⟩ + intro t ht x + exact (hw.equation t (hsub ht) x).mono hsub + +theorem TorusScalarSolution.congr {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (hT : 0 ≤ T) + (he : ∀ t ∈ Icc 0 T, v t = w t) : TorusScalarSolution T ν a h v w₀ := by + refine ⟨hw.smooth.congr (fun p hp => congrFun (he p.1 hp.1) p.2), ?_, ?_, ?_⟩ + · intro t ht + rw [he t ht] + exact hw.periodic t ht + · rw [he 0 ⟨le_rfl, hT⟩] + exact hw.initial + · intro t ht x + rw [he t ht] + exact (hw.equation t ht x).congr_of_mem (fun s hs => congrFun (he s hs) x) ht + +/-- Smoothness and the equation on every finite closed time cylinder. -/ +def GlobalTorusScalarSolution (ν : ℝ) (a : ℝ → Plane → Plane) + (h w : ℝ → Plane → ℝ) (w₀ : Plane → ℝ) : Prop := + ∀ T, 0 ≤ T → TorusScalarSolution T ν a h w w₀ + +theorem TorusScalarExistence.global (hE : TorusScalarExistence) + (ν : ℝ) (hν : 0 < ν) (a : ℝ → Plane → Plane) + (h : ℝ → Plane → ℝ) (w₀ : Plane → ℝ) + (ha : ContDiff ℝ ∞ (Function.uncurry a)) + (hh : ContDiff ℝ ∞ (Function.uncurry h)) (hw₀ : ContDiff ℝ ∞ w₀) + (hpa : ∀ t, PlanePeriodic (a t)) (hph : ∀ t, PlanePeriodic (h t)) + (hp₀ : PlanePeriodic w₀) : + ∃ w, GlobalTorusScalarSolution ν a h w w₀ := by + have hex (n : ℕ) : ∃ w, TorusScalarSolution ((n : ℝ) + 1) ν a h w w₀ := + hE _ ν (by positivity) hν a h w₀ ha hh hw₀ hpa hph hp₀ + choose v hv using hex + have hcompat (m n : ℕ) {s : ℝ} (hs : 0 ≤ s) + (hm : s ≤ (m : ℝ) + 1) (hn : s ≤ (n : ℝ) + 1) : v m s = v n s := by + let T := min ((m : ℝ) + 1) ((n : ℝ) + 1) + have hT : 0 ≤ T := le_min (by positivity) (by positivity) + have hsm : T ≤ (m : ℝ) + 1 := min_le_left _ _ + have hsn : T ≤ (n : ℝ) + 1 := min_le_right _ _ + exact ((hv m).restrict hsm).unique ((hv n).restrict hsn) hT hν.le s + ⟨hs, le_min hm hn⟩ + let w : ℝ → Plane → ℝ := fun t => v ⌈t⌉₊ t + refine ⟨w, fun T hT => ?_⟩ + let N : ℕ := ⌈T⌉₊ + have hTN : T ≤ (N : ℝ) + 1 := (Nat.le_ceil T).trans (by linarith) + apply ((hv N).restrict hTN).congr hT + intro t ht + exact hcompat ⌈t⌉₊ N ht.1 ((Nat.le_ceil t).trans (by linarith)) (ht.2.trans hTN) + +theorem GlobalTorusScalarSolution.nonnegative {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w w₀) (hν : 0 ≤ ν) + (hh : ∀ t, 0 ≤ t → ∀ x, 0 ≤ h t x) (h₀ : ∀ x, 0 ≤ w₀ x) : + ∀ t, 0 ≤ t → ∀ x, 0 ≤ w t x := by + intro t ht x + exact (hw t ht).nonnegative ht hν (fun s hs => hh s hs.1) h₀ t ⟨ht, le_rfl⟩ x + +theorem GlobalTorusScalarSolution.unique {ν : ℝ} {a : ℝ → Plane → Plane} + {h w v : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w w₀) + (hv : GlobalTorusScalarSolution ν a h v w₀) (hν : 0 ≤ ν) : + ∀ t, 0 ≤ t → w t = v t := by + intro t ht + exact (hw t ht).unique (hv t ht) ht hν t ⟨ht, le_rfl⟩ + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..6850f76c0e135d900048fcc818bc436afe908c40 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassCalculus.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput + +namespace OAI + +/-! The diffusion and incompressible transport terms have zero spatial +integral on the unit torus. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff BigOperators + +theorem spatialD_periodic {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) (j : Fin 2) : PlanePeriodic (spatialD j g) := by + intro x n + have h := fderiv_translation (hg.differentiable (by simp)) (fun y => hp y n) x + exact congrArg (fun A : Plane →L[ℝ] ℝ => A (PlanarHamiltonian.basis j)) h + +theorem scalarLaplacian_integral_zero {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) : + (∫ x in Icc (0 : Plane) (fun _ => 1), scalarLaplacian g x) = 0 := by + unfold scalarLaplacian + rw [integral_finsetSum] + · apply Finset.sum_eq_zero + intro j _ + exact integral_planar_periodic_derivative (spatialD_smooth j hg) (spatialD_periodic hg hp j) j + · intro j _ + exact (spatialD_smooth j (spatialD_smooth j hg)).continuous.integrableOn_Icc + +theorem scalar_directional_basis (g : Plane → ℝ) (x v : Plane) : + fderiv ℝ g x v = ∑ j : Fin 2, v j * spatialD j g x := by + have hv : v = v 0 • PlanarHamiltonian.basis 0 + v 1 • PlanarHamiltonian.basis 1 := by + ext j + fin_cases j <;> simp + rw [hv, map_add, map_smul, map_smul, Fin.sum_univ_two] + simp only [spatialD, smul_eq_mul] + congr 1 <;> simp + +theorem divergence_scalar_product {a : Plane → Plane} {g : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hg : ContDiff ℝ ∞ g) (x : Plane) : + PlanarHamiltonian.divergence (fun y => g y • a y) x = + g x * PlanarHamiltonian.divergence a x + fderiv ℝ g x (a x) := by + have hd (j : Fin 2) : spatialD j (fun y => (g y • a y) j) x = + g x * spatialD j (fun y => a y j) x + a x j * spatialD j g x := by + have h := ((hg.differentiable (by simp) x).hasFDerivAt).mul + (((contDiff_apply ℝ ℝ j).comp ha).differentiable (by simp) x).hasFDerivAt + change HasFDerivAt (fun y => (g y • a y) j) _ x at h + rw [spatialD, h.fderiv] + simp only [add_apply, smul_apply, smul_eq_mul, spatialD, Function.comp_def] + rw [PlanarHamiltonian.divergence, scalar_directional_basis] + simp_rw [hd] + simp only [Finset.sum_add_distrib, ← Finset.mul_sum] + rfl + +theorem divergence_periodic_integral_zero {a : Plane → Plane} + (ha : ContDiff ℝ ∞ a) (hp : PlanePeriodic a) : + (∫ x in Icc (0 : Plane) (fun _ => 1), PlanarHamiltonian.divergence a x) = 0 := by + unfold PlanarHamiltonian.divergence + rw [integral_finsetSum] + · apply Finset.sum_eq_zero + intro j _ + exact integral_planar_periodic_derivative ((contDiff_apply ℝ ℝ j).comp ha) + (fun x n => congrFun (hp x n) j) j + · intro j _ + exact (spatialD_smooth j ((contDiff_apply ℝ ℝ j).comp ha)).continuous.integrableOn_Icc + +theorem scalar_transport_integral_zero {a : Plane → Plane} {g : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hg : ContDiff ℝ ∞ g) + (hpa : PlanePeriodic a) (hpg : PlanePeriodic g) + (hdiv : ∀ x, PlanarHamiltonian.divergence a x = 0) : + (∫ x in Icc (0 : Plane) (fun _ => 1), fderiv ℝ g x (a x)) = 0 := by + have hp : PlanePeriodic (fun y => g y • a y) := by + intro x n + change g (x + fun j => (n j : ℝ)) • a (x + fun j => (n j : ℝ)) = g x • a x + rw [hpg x n, hpa x n] + have hi := divergence_periodic_integral_zero (hg.smul ha) hp + have he (x : Plane) : PlanarHamiltonian.divergence (g • a) x = + fderiv ℝ g x (a x) := by + rw [show g • a = (fun y => g y • a y) from rfl, + divergence_scalar_product ha hg, hdiv, mul_zero, zero_add] + simpa only [he] using hi + +theorem scalarGenerator_integral_zero {a : Plane → Plane} {g : Plane → ℝ} + (ha : ContDiff ℝ ∞ a) (hg : ContDiff ℝ ∞ g) + (hpa : PlanePeriodic a) (hpg : PlanePeriodic g) + (hdiv : ∀ x, PlanarHamiltonian.divergence a x = 0) (ν : ℝ) : + (∫ x in Icc (0 : Plane) (fun _ => 1), scalarGenerator ν a g x) = 0 := by + have hL : Continuous (scalarLaplacian g) := by + apply continuous_finsetSum + intro j _ + exact (spatialD_smooth j (spatialD_smooth j hg)).continuous + have hD : Continuous (fun x => fderiv ℝ g x (a x)) := + ((hg.fderiv_right (m := ∞) (by simp)).clm_apply ha).continuous + simp_rw [scalarGenerator] + rw [integral_sub (hL.const_mul ν).integrableOn_Icc hD.integrableOn_Icc, + integral_const_mul, scalarLaplacian_integral_zero hg hpg, + scalar_transport_integral_zero ha hg hpa hpg hdiv] + simp + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassEvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e56dba5d4eaac933ac7b0f7175c7747ef06e8d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassEvolution.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.EnergyCalculus + +namespace OAI + +/-! The scalar's total mass changes only by the prescribed source. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory Filter +open scoped ContDiff Topology + +def scalarMass (w : ℝ → Plane → ℝ) (t : ℝ) : ℝ := + ∫ x in Icc (0 : Plane) (fun _ => 1), w t x + +theorem scalarMass_continuous {w : ℝ → Plane → ℝ} + (hw : Continuous (Function.uncurry w)) : Continuous (scalarMass w) := by + exact continuous_parametric_integral_of_continuous hw isCompact_Icc + +theorem scalarMass_hasDerivAt {w d : ℝ → Plane → ℝ} + (hw : Continuous (Function.uncurry w)) (hd : Continuous (Function.uncurry d)) + (hderiv : ∀ s x, HasDerivAt (fun r => w r x) (d s x) s) (t : ℝ) : + HasDerivAt (scalarMass w) (scalarMass d t) t := by + let K : Set Plane := Icc 0 (fun _ => 1) + obtain ⟨B, hB⟩ := (isCompact_Icc.prod (isCompact_Icc (a := (0 : Plane)) + (b := fun _ => 1))).bddAbove_image + (hd.norm.continuousOn (s := Icc (t - 1) (t + 1) ×ˢ K)) + have hbound : ∀ᵐ x ∂(volume.restrict K), + ∀ s ∈ Ioo (t - 1) (t + 1), ‖d s x‖ ≤ B := by + filter_upwards [ae_restrict_mem measurableSet_Icc] with x hx + intro s hs + exact hB (mem_image_of_mem (fun y : ℝ × Plane => ‖d y.1 y.2‖) + (show (s, x) ∈ Icc (t - 1) (t + 1) ×ˢ K from ⟨Ioo_subset_Icc_self hs, hx⟩)) + have hmeas : ∀ᶠ s in 𝓝 t, + AEStronglyMeasurable (w s) (volume.restrict K) := by + exact Eventually.of_forall (fun s => + (hw.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable) + have hint : IntegrableOn (w t) K := + (hw.comp (continuous_const.prodMk continuous_id)).integrableOn_Icc + have hdmeas : AEStronglyMeasurable (d t) (volume.restrict K) := + (hd.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le + (Ioo_mem_nhds (by linarith) (by linarith)) hmeas hint hdmeas hbound + (by exact integrableOn_const (s := K) (hs := isCompact_Icc.measure_lt_top.ne)) + (Eventually.of_forall (fun x s _ => hderiv s x))).2 + +theorem scalarMass_source_derivative {ν : ℝ} + {a : ℝ → Plane → Plane} {h w d : ℝ → Plane → ℝ} + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (hd : Continuous (Function.uncurry d)) + (ha : ∀ t, ContDiff ℝ ∞ (a t)) + (hpa : ∀ t, PlanePeriodic (a t)) (hpw : ∀ t, PlanePeriodic (w t)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (hderiv : ∀ t x, HasDerivAt (fun s => w s x) (d t x) t) + (he : ∀ t x, d t x = scalarGenerator ν (a t) (w t) x + h t x) + (hh : ∀ t, Continuous (h t)) (t : ℝ) : + HasDerivAt (scalarMass w) (scalarMass h t) t := by + have hws : ContDiff ℝ ∞ (w t) := + hw.comp (contDiff_const.prodMk contDiff_id) + have hG : Continuous (fun x => scalarGenerator ν (a t) (w t) x) := by + apply Continuous.sub + · apply Continuous.const_mul + apply continuous_finsetSum + intro j _ + exact (PlanarHamiltonian.spatialD_smooth j + (PlanarHamiltonian.spatialD_smooth j hws)).continuous + · exact ((hws.fderiv_right (m := ∞) (by simp)).clm_apply (ha t)).continuous + have hi : scalarMass d t = scalarMass h t := by + unfold scalarMass + simp_rw [he t] + rw [integral_add hG.integrableOn_Icc (hh t).integrableOn_Icc, + scalarGenerator_integral_zero (ha t) hws (hpa t) (hpw t) (hdiv t) ν, + zero_add] + exact hi ▸ scalarMass_hasDerivAt hw.continuous hd hderiv t + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassSolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..0308ae54243be6a336408016deddbda45c67b670 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMassSolution.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassEvolution +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid + +namespace OAI + +/-! The mass identity at every nonnegative time of a smooth global scalar +solution. Only the equation at that time is needed. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +def scalarTimeDerivative (w : ℝ → Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + fderiv ℝ (Function.uncurry w) (t, x) (1, 0) + +theorem scalarTimeDerivative_smooth {w : ℝ → Plane → ℝ} + (hw : ContDiff ℝ ∞ (Function.uncurry w)) : + ContDiff ℝ ∞ (Function.uncurry (scalarTimeDerivative w)) := + (hw.fderiv_right (m := ∞) (by simp)).clm_apply contDiff_const + +theorem scalarTimeDerivative_hasDerivAt {w : ℝ → Plane → ℝ} + (hw : ContDiff ℝ ∞ (Function.uncurry w)) (t : ℝ) (x : Plane) : + HasDerivAt (fun s => w s x) (scalarTimeDerivative w t x) t := by + exact ((hw.differentiable (by simp) (t, x)).hasFDerivAt).comp_hasDerivAt t + ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + +theorem GlobalTorusScalarSolution.mass_hasDerivAt {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hs : GlobalTorusScalarSolution ν a h w w₀) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + (ha : ∀ t, ContDiff ℝ ∞ (a t)) + (hpa : ∀ t, PlanePeriodic (a t)) + (hdiv : ∀ t x, PlanarHamiltonian.divergence (a t) x = 0) + (hh : ∀ t, Continuous (h t)) {t : ℝ} (ht : 0 ≤ t) : + HasDerivAt (scalarMass w) (scalarMass h t) t := by + have hd := scalarMass_hasDerivAt hw.continuous + (scalarTimeDerivative_smooth hw).continuous (scalarTimeDerivative_hasDerivAt hw) t + have he (x : Plane) : scalarTimeDerivative w t x = + scalarGenerator ν (a t) (w t) x + h t x := by + rw [← (scalarTimeDerivative_hasDerivAt hw t x).deriv] + exact hs.deriv_eq hw ht x + have hws : ContDiff ℝ ∞ (w t) := hw.comp (contDiff_const.prodMk contDiff_id) + have hG : Continuous (fun x => scalarGenerator ν (a t) (w t) x) := by + apply Continuous.sub + · apply Continuous.const_mul + apply continuous_finsetSum + intro j _ + exact (PlanarHamiltonian.spatialD_smooth j + (PlanarHamiltonian.spatialD_smooth j hws)).continuous + · exact ((hws.fderiv_right (m := ∞) (by simp)).clm_apply (ha t)).continuous + have hi : scalarMass (scalarTimeDerivative w) t = scalarMass h t := by + unfold scalarMass + simp_rw [he] + rw [integral_add hG.integrableOn_Icc (hh t).integrableOn_Icc, + scalarGenerator_integral_zero (ha t) hws (hpa t) + ((hs t ht).periodic t ⟨ht, le_rfl⟩) (hdiv t) ν, zero_add] + exact hi ▸ hd + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumCalculus.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..f959fe1c43df76426a6bdb19c5a4a93b2e7cd674 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumCalculus.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput +import OAI.Analysis.AffineBernstein.LocalMaximumSecond + +namespace OAI + +/-! The local differential inequality behind scalar comparison. These +statements concern the actual first and second spatial derivatives. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set Filter +open scoped ContDiff Topology + +theorem spatialD_neg (f : Plane → ℝ) (j : Fin 2) : + spatialD j (fun x => -f x) = fun x => -spatialD j f x := by + funext x + simp only [spatialD, fderiv_fun_neg, neg_apply] + +theorem scalarGenerator_neg (ν : ℝ) (a : Plane → Plane) (f : Plane → ℝ) (x : Plane) : + scalarGenerator ν a (fun y => -f y) x = -scalarGenerator ν a f x := by + simp only [scalarGenerator, scalarLaplacian, spatialD_neg, Finset.sum_neg_distrib, + fderiv_fun_neg, neg_apply] + ring + +theorem spatialD_second_nonpos {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + {x : Plane} (hm : IsLocalMax f x) (j : Fin 2) : + spatialD j (spatialD j f) x ≤ 0 := by + let v := PlanarHamiltonian.basis j + let γ : ℝ → Plane := fun t => x + t • v + let g : ℝ → ℝ := fun t => f (γ t) + have hγ (t : ℝ) : HasDerivAt γ v t := by + simpa only [γ, one_smul, id_eq] using ((hasDerivAt_id t).smul_const v).const_add x + have hg : ContDiff ℝ ∞ g := hf.comp (contDiff_const.add (contDiff_id.smul contDiff_const)) + have hgm : IsLocalMax g 0 := by + have ht : Tendsto γ (𝓝 0) (𝓝 x) := by + simpa only [γ, zero_smul, add_zero] using (hγ 0).continuousAt.tendsto + change ∀ᶠ t in 𝓝 (0 : ℝ), f (γ t) ≤ f (γ 0) + simpa only [γ, zero_smul, add_zero] using ht.eventually hm + have hd (t : ℝ) : deriv g t = spatialD j f (γ t) := + ((hf.differentiable (by simp) _).hasFDerivAt.comp_hasDerivAt t (hγ t)).deriv + have hp := ((spatialD_smooth j hf).differentiable (by simp) (γ 0)).hasFDerivAt + have hs := (hp.comp_hasDerivAt 0 (hγ 0)).deriv + have he : deriv (deriv g) 0 = spatialD j (spatialD j f) x := by + rw [funext hd] + simpa only [Function.comp_def, spatialD, γ, v, zero_smul, add_zero] using hs + rw [← he] + exact AffineBernstein.localMax_second_deriv_nonpos (hg.contDiffAt.of_le (by simp)) hgm + +theorem scalarLaplacian_nonpos {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + {x : Plane} (hm : IsLocalMax f x) : scalarLaplacian f x ≤ 0 := by + apply Finset.sum_nonpos + intro j _ + exact spatialD_second_nonpos hf hm j + +theorem scalarGenerator_nonpos {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + {x : Plane} (hm : IsLocalMax f x) {ν : ℝ} (hν : 0 ≤ ν) (a : Plane → Plane) : + scalarGenerator ν a f x ≤ 0 := by + unfold scalarGenerator + rw [hm.fderiv_eq_zero] + simp only [zero_apply, sub_zero] + exact mul_nonpos_of_nonneg_of_nonpos hν (scalarLaplacian_nonpos hf hm) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumPrinciple.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumPrinciple.lean new file mode 100644 index 0000000000000000000000000000000000000000..d67cfcd1bc0c592352223a1e4dee04f8d5927a57 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarMaximumPrinciple.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMaximumCalculus + +namespace OAI + +/-! The weak maximum principle on the two-torus, proved on a compact +fundamental square. No parabolic existence theorem is used in this argument. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set Filter +open scoped Topology ContDiff + +def unitRepresentative (x : Plane) : Plane := fun j => Int.fract (x j) + +theorem unitRepresentative_mem (x : Plane) : + unitRepresentative x ∈ Icc (0 : Plane) (fun _ => 1) := by + exact ⟨fun j => Int.fract_nonneg _, fun j => (Int.fract_lt_one _).le⟩ + +theorem periodic_unitRepresentative {f : Plane → ℝ} (hf : ForcedComputation.PlanePeriodic f) + (x : Plane) : f (unitRepresentative x) = f x := by + have he : unitRepresentative x = x + fun j => ((-⌊x j⌋ : ℤ) : ℝ) := by + funext j + simp [unitRepresentative, Int.fract, sub_eq_add_neg] + rw [he] + exact hf _ _ + +theorem periodic_cylinder_max {w : ℝ → Plane → ℝ} {T : ℝ} (hT : 0 ≤ T) + (hc : ContinuousOn (Function.uncurry w) (Icc 0 T ×ˢ univ)) + (hp : ∀ t ∈ Icc 0 T, ForcedComputation.PlanePeriodic (w t)) : + ∃ t ∈ Icc 0 T, ∃ x : Plane, ∀ s ∈ Icc 0 T, ∀ y, w s y ≤ w t x := by + have hK : IsCompact (Icc (0 : ℝ) T ×ˢ Icc (0 : Plane) (fun _ => 1)) := + isCompact_Icc.prod isCompact_Icc + have hne : (Icc (0 : ℝ) T ×ˢ Icc (0 : Plane) (fun _ => 1)).Nonempty := + ⟨(0, 0), ⟨⟨le_rfl, hT⟩, ⟨le_rfl, fun _ => zero_le_one⟩⟩⟩ + obtain ⟨p, hpK, hmax⟩ := hK.exists_isMaxOn hne + (hc.mono (fun _ h => ⟨h.1, mem_univ _⟩)) + refine ⟨p.1, hpK.1, p.2, fun s hs y => ?_⟩ + rw [← periodic_unitRepresentative (hp s hs) y] + exact hmax (show (s, unitRepresentative y) ∈ + Icc (0 : ℝ) T ×ˢ Icc (0 : Plane) (fun _ => 1) from ⟨hs, unitRepresentative_mem y⟩) + +theorem spatialD_sub_const (f : Plane → ℝ) (c : ℝ) (j : Fin 2) : + spatialD j (fun x => f x - c) = spatialD j f := by + funext x + simp only [spatialD, fderiv_sub_const] + +theorem scalarGenerator_sub_const (ν : ℝ) (a : Plane → Plane) + (f : Plane → ℝ) (c : ℝ) (x : Plane) : + scalarGenerator ν a (fun y => f y - c) x = scalarGenerator ν a f x := by + simp only [scalarGenerator, scalarLaplacian, spatialD_sub_const, fderiv_sub_const] + +theorem timeDerivative_nonneg_at_max {f : ℝ → ℝ} {d t : ℝ} (ht : 0 < t) + (hm : IsMaxOn f (Icc 0 t) t) (hd : HasDerivWithinAt f d (Icc 0 t) t) : 0 ≤ d := by + have hv : 0 - t ∈ posTangentConeAt (Icc 0 t) t := + sub_mem_posTangentConeAt_of_segment_subset + (by rw [segment_symm, segment_eq_Icc ht.le]) + have h := hm.isLocalMaxOn.hasFDerivWithinAt_nonpos hd.hasFDerivWithinAt hv + have hmul : d * (0 - t) ≤ 0 := by + simpa only [ContinuousLinearMap.toSpanSingleton_apply, smul_eq_mul, + mul_comm] using h + nlinarith + +theorem scalar_maximum_principle {w d : ℝ → Plane → ℝ} + {a : ℝ → Plane → Plane} {T ν : ℝ} (hT : 0 ≤ T) (hν : 0 ≤ ν) + (hc : ContinuousOn (Function.uncurry w) (Icc 0 T ×ˢ univ)) + (hp : ∀ t ∈ Icc 0 T, ForcedComputation.PlanePeriodic (w t)) + (hs : ∀ t ∈ Icc 0 T, ContDiff ℝ ∞ (w t)) + (hd : ∀ t ∈ Ioc 0 T, ∀ x, HasDerivWithinAt (fun s => w s x) (d t x) (Icc 0 T) t) + (he : ∀ t ∈ Ioc 0 T, ∀ x, d t x ≤ scalarGenerator ν (a t) (w t) x) + (h₀ : ∀ x, w 0 x ≤ 0) : ∀ t ∈ Icc 0 T, ∀ x, w t x ≤ 0 := by + intro t ht x + by_contra! hpos + let ε := w t x / (2 * (T + 1)) + have hε : 0 < ε := by dsimp [ε]; positivity + let v : ℝ → Plane → ℝ := fun s y => w s y - ε * s + have hvc : ContinuousOn (Function.uncurry v) (Icc 0 T ×ˢ univ) := + hc.sub ((continuous_const.mul continuous_fst).continuousOn) + have hvp : ∀ s ∈ Icc 0 T, ForcedComputation.PlanePeriodic (v s) := by + intro s hs y n + dsimp [v] + rw [hp s hs y n] + obtain ⟨s, hsK, y, hmax⟩ := periodic_cylinder_max hT hvc hvp + have hvtx : 0 < v t x := by + dsimp [v] + have hmul : ε * (2 * (T + 1)) = w t x := by + dsimp [ε] + exact div_mul_cancel₀ _ (by positivity) + have htimele := mul_le_mul_of_nonneg_left ht.2 hε.le + nlinarith + have hvsy : 0 < v s y := hvtx.trans_le (hmax t ht x) + have hspos : 0 < s := by + by_contra hn + have hz : s = 0 := le_antisymm (le_of_not_gt hn) hsK.1 + subst s + have h := h₀ y + dsimp [v] at hvsy + linarith + have hst : s ∈ Ioc (0 : ℝ) T := ⟨hspos, hsK.2⟩ + have htime : 0 ≤ d s y - ε := by + apply timeDerivative_nonneg_at_max hspos + (fun r hr => hmax r ⟨hr.1, hr.2.trans hsK.2⟩ y) + simpa only [v, Pi.sub_def, id_eq, mul_one] using + (((hd s hst y).sub ((hasDerivWithinAt_id s _).const_mul ε)).mono + (Icc_subset_Icc le_rfl hsK.2)) + have hspace : IsLocalMax (v s) y := Filter.Eventually.of_forall (fun z => hmax s hsK z) + have hgen := scalarGenerator_nonpos ((hs s hsK).sub contDiff_const) hspace hν (a s) + rw [scalarGenerator_sub_const] at hgen + have hle := (he s hst y).trans hgen + linarith + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarPositivity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8abfd9f764376cc4da66d7b96a80d9051bf521d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarPositivity.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMaximumPrinciple + +namespace OAI + +/-! Positivity from the scalar maximum principle. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set + +theorem TorusScalarSolution.nonnegative {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) (hT : 0 ≤ T) (hν : 0 ≤ ν) + (hh : ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ h t x) (h₀ : ∀ x, 0 ≤ w₀ x) : + ∀ t ∈ Icc 0 T, ∀ x, 0 ≤ w t x := by + let d : ℝ → Plane → ℝ := fun t x => -(scalarGenerator ν (a t) (w t) x + h t x) + have hm := scalar_maximum_principle (w := fun t x => -w t x) (d := d) (a := a) + hT hν hw.smooth.continuousOn.neg + (fun t ht x n => by dsimp; rw [hw.periodic t ht x n]) + (fun t ht => (hw.slice_smooth ht).neg) + (fun t ht x => (hw.equation t ⟨ht.1.le, ht.2⟩ x).neg) + (fun t ht x => by + dsimp only [d] + rw [scalarGenerator_neg] + linarith [hh t ⟨ht.1.le, ht.2⟩ x]) + (fun x => by simpa only [hw.initial, neg_nonpos] using h₀ x) + exact fun t ht x => neg_nonpos.mp (hm t ht x) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTimeWindow.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTimeWindow.lean new file mode 100644 index 0000000000000000000000000000000000000000..1392710528cc7cf09e60ce47115e0f8bf61184df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTimeWindow.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.TriangularFluid +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatEvolution + +namespace OAI + +/-! Restriction to a physical time window, and the exact heat evolution +during an interval on which the prescribed drift and source vanish. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem GlobalTorusScalarSolution.window {ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hs : GlobalTorusScalarSolution ν a h w w₀) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + {s T : ℝ} (hs₀ : 0 ≤ s) (_hT : 0 ≤ T) : + TorusScalarSolution T ν (fun t => a (s + t)) (fun t => h (s + t)) + (fun t => w (s + t)) (w s) := by + refine ⟨(hw.comp ((contDiff_const.add contDiff_fst).prodMk contDiff_snd)).contDiffOn, + ?_, ?_, ?_⟩ + · intro t ht + have ht₀ : 0 ≤ s + t := add_nonneg hs₀ ht.1 + exact (hs (s + t) ht₀).periodic (s + t) ⟨ht₀, le_rfl⟩ + · simp only [add_zero] + · intro t ht x + have hd : HasDerivAt (fun r => w r x) + (scalarGenerator ν (a (s + t)) (w (s + t)) x + h (s + t) x) (s + t) := by + rw [← hs.deriv_eq hw (add_nonneg hs₀ ht.1) x] + exact ((hw.comp (contDiff_id.prodMk contDiff_const)).differentiable + (by simp) (s + t)).hasDerivAt + simpa only [mul_one, Function.comp_def, id_eq] using + (hd.comp t ((hasDerivAt_id t).const_add s)).hasDerivWithinAt + +theorem GlobalTorusScalarSolution.heat_window (hK : TorusHeatInput) + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hs : GlobalTorusScalarSolution 1 a h w w₀) + (hw : ContDiff ℝ ∞ (Function.uncurry w)) + {s T : ℝ} (hs₀ : 0 ≤ s) (hT : 0 ≤ T) + (ha : ∀ t ∈ Icc (0 : ℝ) T, a (s + t) = fun _ => 0) + (hh : ∀ t ∈ Icc (0 : ℝ) T, h (s + t) = fun _ => 0) : + ∀ t ∈ Icc (0 : ℝ) T, w (s + t) = torusHeatEvolution (w s) t := by + have hwin := hs.window hw hs₀ hT + have hzero : TorusScalarSolution T 1 (fun _ _ => 0) (fun _ _ => 0) + (fun t => w (s + t)) (w s) := by + refine { hwin with equation := ?_ } + intro t ht x + simpa only [ha t ht, hh t ht] using hwin.equation t ht x + have hp : PlanePeriodic (w s) := (hs s hs₀).periodic s ⟨hs₀, le_rfl⟩ + exact hzero.unique + (hK.solution T hT (w s) (hw.comp (contDiff_const.prodMk contDiff_id)) hp) + hT (by norm_num) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTransportBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTransportBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d3a6f028f3e6ee239950cf52f8442301023e5fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarTransportBounds.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarCompositionBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Detector.VelocityDetectorBounds + +namespace OAI + +/-! The transported bump estimate used in each compact detector block. +All flow estimates here follow from the same two variational equations. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open scoped ContDiff BigOperators + +theorem inverse_second_variation_sharp {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + {K : ℝ} (hK : 0 < K) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ K) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ K) + (a : ℝ) (x : EuclideanPlane) {t : ℝ} (ht : 0 ≤ t) : + ‖fderiv ℝ (fderiv ℝ (Ψ a (-t))) x‖ ≤ K * t * Real.exp (3 * K * t) := by + have hb₂' (s : ℝ) (y : EuclideanPlane) : + ‖fderiv ℝ (fderiv ℝ (fun x => -V (-s) x)) y‖ ≤ K := by + have he := euclidean_second_fderiv_fun_neg (V (-s)) y + have hn := norm_neg (fderiv ℝ (fderiv ℝ (V (-s))) y) + exact (congrArg norm he).le.trans (hn.le.trans (hb₂ (-s) y)) + have h := euclidean_second_variation_sharp_operator hv.reverse hK + (fun s y => by simpa only [fderiv_fun_neg, norm_neg] using hb₁ (-s) y) + hb₂' (-a) x ht + simpa only [neg_neg] using h + +/-- The trace costs a factor of two in the planar Euclidean norm. -/ +theorem hessian_trace_bound (f : EuclideanPlane → ℝ) (x : EuclideanPlane) + {B : ℝ} (hB : ‖fderiv ℝ (fderiv ℝ f) x‖ ≤ B) : + |∑ j : Fin 2, fderiv ℝ (fderiv ℝ f) x + (EuclideanSpace.single j 1) (EuclideanSpace.single j 1)| ≤ 2 * B := by + calc + _ ≤ ∑ j : Fin 2, |fderiv ℝ (fderiv ℝ f) x + (EuclideanSpace.single j 1) (EuclideanSpace.single j 1)| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _j : Fin 2, B := by + apply Finset.sum_le_sum + intro j _ + have h := (fderiv ℝ (fderiv ℝ f) x).le_opNorm₂ + (EuclideanSpace.single j 1) (EuclideanSpace.single j 1) + have hn : |fderiv ℝ (fderiv ℝ f) x + (EuclideanSpace.single j 1) (EuclideanSpace.single j 1)| ≤ + ‖fderiv ℝ (fderiv ℝ f) x‖ := by + simpa only [Real.norm_eq_abs, PiLp.norm_single, norm_one, mul_one] using h + exact hn.trans hB + _ = 2 * B := by simp + +/-- A block runs at most `n` periods. The inverse-flow Hessian has the +polynomial prefactor needed for the manuscript's exact rational scale. -/ +theorem inverse_flow_block_bounds {V : ℝ → EuclideanPlane → EuclideanPlane} + {Ψ : ℝ → ℝ → EuclideanPlane → EuclideanPlane} (hv : EuclideanVariations V Ψ) + (L n : ℕ) (hL : 0 < L) + (hb₁ : ∀ a x, ‖fderiv ℝ (V a) x‖ ≤ (L : ℝ)) + (hb₂ : ∀ a x, ‖fderiv ℝ (fderiv ℝ (V a)) x‖ ≤ (L : ℝ)) + (a : ℝ) (x : EuclideanPlane) {s : ℝ} (hs : 0 ≤ s) (hsn : s ≤ n) : + ‖fderiv ℝ (Ψ a (-s)) x‖ ≤ (expansion L : ℝ) ^ n ∧ + ‖fderiv ℝ (fderiv ℝ (Ψ a (-s))) x‖ ≤ + (n : ℝ) * L * (expansion L : ℝ) ^ (3 * n) := by + constructor + · exact (euclidean_first_variation_reverse hv hb₁ a x hs).trans + (exp_time_le_expansion_pow L n hsn) + · have hK : (0 : ℝ) < L := by exact_mod_cast hL + have hexp : Real.exp (3 * (L : ℝ) * s) ≤ (expansion L : ℝ) ^ (3 * n) := by + have h := exp_time_le_expansion_pow L (3 * n) + (s := 3 * s) (by push_cast; linarith) + convert h using 1 + ring_nf + calc + _ ≤ (L : ℝ) * s * Real.exp (3 * L * s) := + inverse_second_variation_sharp hv hK hb₁ hb₂ a x hs + _ ≤ (L : ℝ) * n * (expansion L : ℝ) ^ (3 * n) := by + exact mul_le_mul (mul_le_mul_of_nonneg_left hsn (Nat.cast_nonneg L)) hexp + (Real.exp_pos _).le (by positivity) + _ = _ := by ring + +/-- The chain rule gives exactly the scale used in the detector, before +multiplying by the dimension to take a Laplacian. -/ +theorem transported_hessian_bound {g : EuclideanPlane → ℝ} + {φ : EuclideanPlane → EuclideanPlane} (hg : ContDiff ℝ ∞ g) + (hφ : ContDiff ℝ ∞ φ) (x : EuclideanPlane) (C L n : ℕ) + {b : ℝ} (hb : 0 < b) (hb₁ : b ≤ 1) + (hg₁ : ‖fderiv ℝ g (φ x)‖ ≤ (C : ℝ) * b⁻¹) + (hg₂ : ‖fderiv ℝ (fderiv ℝ g) (φ x)‖ ≤ (C : ℝ) * b⁻¹ ^ 2) + (hφ₁ : ‖fderiv ℝ φ x‖ ≤ (expansion L : ℝ) ^ n) + (hφ₂ : ‖fderiv ℝ (fderiv ℝ φ) x‖ ≤ + (n : ℝ) * L * (expansion L : ℝ) ^ (3 * n)) : + ‖fderiv ℝ (fderiv ℝ (g ∘ φ)) x‖ ≤ + (C : ℝ) * b⁻¹ ^ 2 * (1 + (n : ℝ) * L) * (expansion L : ℝ) ^ (3 * n) := by + have hi : b⁻¹ ≤ b⁻¹ ^ 2 := by + have h := (one_le_inv₀ hb).mpr hb₁ + nlinarith + have hR : (1 : ℝ) ≤ expansion L := by exact_mod_cast expansion_one_le L + have hp : ((expansion L : ℝ) ^ n) ^ 2 ≤ (expansion L : ℝ) ^ (3 * n) := by + rw [← pow_mul] + exact pow_le_pow_right₀ hR (by omega) + calc + _ ≤ ((C : ℝ) * b⁻¹) * ((n : ℝ) * L * (expansion L : ℝ) ^ (3 * n)) + + ((C : ℝ) * b⁻¹ ^ 2) * ((expansion L : ℝ) ^ n) ^ 2 := + scalar_second_composition_bound hg hφ x (by positivity) (by positivity) + (by positivity) (by positivity) hg₁ hg₂ hφ₁ hφ₂ + _ ≤ ((C : ℝ) * b⁻¹ ^ 2) * ((n : ℝ) * L * (expansion L : ℝ) ^ (3 * n)) + + ((C : ℝ) * b⁻¹ ^ 2) * (expansion L : ℝ) ^ (3 * n) := by + apply add_le_add + · exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hi (Nat.cast_nonneg C)) (by positivity) + · exact mul_le_mul_of_nonneg_left hp (by positivity) + _ = _ := by ring + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarZeroExtension.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarZeroExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..c02bce617d9b57cd5377f85c62a6f759ee950c89 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/ScalarZeroExtension.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarGlobalExistence + +namespace OAI + +/-! The detector starts after time two. Its scalar solution therefore admits +a smooth zero extension across the initial time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped ContDiff Topology + +def scalarZeroExtension (w : ℝ → Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + if 0 ≤ t then w t x else 0 + +theorem GlobalTorusScalarSolution.smoothAt_positive {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w w₀) {t : ℝ} (ht : 0 < t) (x : Plane) : + ContDiffAt ℝ ∞ (Function.uncurry w) (t, x) := by + have hT : 0 ≤ t + 1 := by linarith + have hp : (t, x) ∈ Icc 0 (t + 1) ×ˢ (univ : Set Plane) := + ⟨⟨ht.le, by linarith⟩, mem_univ _⟩ + exact ((hw (t + 1) hT).smooth (t, x) hp).contDiffAt + (prod_mem_nhds (Icc_mem_nhds ht (by linarith)) univ_mem) + +theorem GlobalTorusScalarSolution.zero_before_one {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w (fun _ => 0)) (hν : 0 ≤ ν) + (hh : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x, h t x = 0) : + ∀ t ∈ Icc (0 : ℝ) 1, ∀ x, w t x = 0 := by + have hb := (hw 1 (by norm_num)).absolute_bound (by norm_num) hν + (M := 0) (A := 0) (fun t ht x => by simp only [hh t ht x, abs_zero, le_refl]) + (fun _ => by simp) + intro t ht x + have ha : |w t x| ≤ 0 := by simpa only [zero_mul, zero_add] using hb t ht x + exact abs_eq_zero.mp (le_antisymm ha (abs_nonneg _)) + +theorem GlobalTorusScalarSolution.zeroExtension {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w w₀) : + GlobalTorusScalarSolution ν a h (scalarZeroExtension w) w₀ := by + intro T hT + apply (hw T hT).congr hT + intro t ht + funext x + dsimp only [scalarZeroExtension] + split_ifs with h + · rfl + · exact (h ht.1).elim + +theorem GlobalTorusScalarSolution.zeroExtension_smooth {ν : ℝ} + {a : ℝ → Plane → Plane} {h w : ℝ → Plane → ℝ} + (hw : GlobalTorusScalarSolution ν a h w (fun _ => 0)) (hν : 0 ≤ ν) + (hh : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x, h t x = 0) : + ContDiff ℝ ∞ (Function.uncurry (scalarZeroExtension w)) := by + apply contDiff_iff_contDiffAt.mpr + intro y + by_cases hy : y.1 < 1 + · have he : Function.uncurry (scalarZeroExtension w) =ᶠ[𝓝 y] fun _ => (0 : ℝ) := by + have hn : ∀ᶠ z : ℝ × Plane in 𝓝 y, z.1 < 1 := + (continuous_fst.tendsto y).eventually (eventually_lt_nhds hy) + filter_upwards [hn] with z hz + change (if 0 ≤ z.1 then w z.1 z.2 else 0) = 0 + split_ifs with h₀ + · exact hw.zero_before_one hν hh z.1 ⟨h₀, hz.le⟩ z.2 + · rfl + exact contDiff_const.contDiffAt.congr_of_eventuallyEq he + · have ht : 0 < y.1 := by linarith + have he : Function.uncurry (scalarZeroExtension w) =ᶠ[𝓝 y] Function.uncurry w := by + have hn : ∀ᶠ z : ℝ × Plane in 𝓝 y, 0 < z.1 := + (continuous_fst.tendsto y).eventually (eventually_gt_nhds ht) + filter_upwards [hn] with z hz + change (if 0 ≤ z.1 then w z.1 z.2 else 0) = w z.1 z.2 + split_ifs with h + · rfl + · exact (h hz.le).elim + exact (hw.smoothAt_positive ht y.2).congr_of_eventuallyEq he + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/SpatialParameterDerivatives.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/SpatialParameterDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..b178f24d6f9772d911b5eb98528296a0f534776d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/SpatialParameterDerivatives.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlanePeriodicBounds +import Mathlib.Analysis.Calculus.ContDiff.Basic + +namespace OAI + +/-! Joint smoothness and periodicity of spatial derivatives with a time parameter. -/ + +noncomputable section +namespace ForcedComputation +open ShearFlows +open scoped ContDiff + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Restrict the total derivative to spatial directions. -/ +def spatialParameterDerivative (n : ℕ) (f : ℝ × Plane → F) (p : ℝ × Plane) : + ContinuousMultilinearMap ℝ (fun _ : Fin n => Plane) F := + (iteratedFDeriv ℝ n f p).compContinuousLinearMap + (fun _ => ContinuousLinearMap.inr ℝ ℝ Plane) + +theorem spatialParameterDerivative_eq {f : ℝ × Plane → F} (hf : ContDiff ℝ ∞ f) + (n : ℕ) (t : ℝ) (x : Plane) : + spatialParameterDerivative n f (t,x) = + iteratedFDeriv ℝ n (fun y : Plane => f (t,y)) x := by + let g : ℝ × Plane → F := fun p => f ((t, (0 : Plane))+p) + have hg : ContDiff ℝ ∞ g := hf.comp (contDiff_const.add contDiff_id) + have h := (ContinuousLinearMap.inr ℝ ℝ Plane).iteratedFDeriv_comp_right + hg x (i := n) (by simp) + simpa [g, spatialParameterDerivative, Function.comp_def, + iteratedFDeriv_comp_add_left] using h.symm + +theorem spatialParameterDerivative_smooth {f : ℝ × Plane → F} + (hf : ContDiff ℝ ∞ f) (n : ℕ) : ContDiff ℝ ∞ (spatialParameterDerivative n f) := by + exact (ContinuousMultilinearMap.compContinuousLinearMapL + (F := F) (fun _ : Fin n => ContinuousLinearMap.inr ℝ ℝ Plane)).contDiff.comp + (hf.iteratedFDeriv_right (i := n) (by simp)) + +theorem planePeriodic_iteratedFDeriv {f : Plane → F} (hp : PlanePeriodic f) (n : ℕ) : + PlanePeriodic (iteratedFDeriv ℝ n f) := by + intro x k + have he : (fun y : Plane => f (y+fun j => (k j : ℝ))) = f := funext (fun y => hp y k) + have h := congrArg (fun g : Plane → F => iteratedFDeriv ℝ n g x) he + rw [iteratedFDeriv_comp_add_right] at h + exact h + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBoundaryRegularity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBoundaryRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d3721d37212b151f076dfc0e9b9df81d8fee4c4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBoundaryRegularity.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatInitialContinuity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatLaplacianTransfer +import Mathlib.Analysis.Calculus.FDeriv.Extend +import Mathlib.Analysis.Calculus.TangentCone.Real +import Mathlib.Analysis.Calculus.TangentCone.Prod + +namespace OAI + +/-! All orders of heat regularity on the closed initial half-cylinder. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set Filter +open scoped ContDiff Topology BigOperators + +theorem heatDataLaplacian_smooth {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) : + ContDiff ℝ ∞ (scalarLaplacian g) := + ContDiff.sum (fun j _ => spatialD_smooth j (spatialD_smooth j hg)) + +theorem heatDataLaplacian_periodic {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) : PlanePeriodic (scalarLaplacian g) := by + intro x n + apply Finset.sum_congr rfl + intro j _ + exact spatialD_periodic (spatialD_smooth j hg) (spatialD_periodic hg hp j) j x n + +/-- The joint derivative, expressed entirely by evolutions of smooth initial data. -/ +def torusHeatDerivative (g : Plane → ℝ) (p : ℝ × Plane) : (ℝ × Plane) →L[ℝ] ℝ := + torusHeatEvolution (scalarLaplacian g) p.1 p.2 • ContinuousLinearMap.fst ℝ ℝ Plane + + ∑ j : Fin 2, torusHeatEvolution (spatialD j g) p.1 p.2 • + (ContinuousLinearMap.proj j).comp (ContinuousLinearMap.snd ℝ ℝ Plane) + +theorem torusHeatDerivative_apply (g : Plane → ℝ) (p v : ℝ × Plane) : + torusHeatDerivative g p v = + v.1 * torusHeatEvolution (scalarLaplacian g) p.1 p.2 + + ∑ j : Fin 2, v.2 j * torusHeatEvolution (spatialD j g) p.1 p.2 := by + simp only [torusHeatDerivative, add_apply, smul_apply, + sum_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.proj_apply, smul_eq_mul] + congr 1 + · exact mul_comm _ _ + · apply Finset.sum_congr rfl + intro j _ + exact mul_comm _ _ + +theorem torusHeatEvolution_fderiv_positive {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) {t : ℝ} (ht : 0 < t) (x : Plane) : + fderiv ℝ (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) (t,x) = + torusHeatDerivative g (t,x) := by + let f : ℝ × Plane → ℝ := fun p => torusHeatEvolution g p.1 p.2 + have hmem : (t,x) ∈ Ioi (0 : ℝ) ×ˢ (univ : Set Plane) := ⟨ht, mem_univ _⟩ + have hd : HasFDerivAt f (fderiv ℝ f (t,x)) (t,x) := + ((torusHeatEvolution_smooth_positive g hg.continuous).differentiableOn (by simp) + (t,x) hmem).differentiableAt ((isOpen_Ioi.prod isOpen_univ).mem_nhds hmem) + |>.hasFDerivAt + have htime : fderiv ℝ f (t,x) (1,0) = + torusHeatEvolution (scalarLaplacian g) t x := by + have h := hd.comp_hasDerivAt t ((hasDerivAt_id t).prodMk (hasDerivAt_const t x)) + exact h.unique (torusHeatEvolution_time_data hg hp ht x) + have hspace (v : Plane) : fderiv ℝ f (t,x) (0,v) = + ∑ j : Fin 2, v j * torusHeatEvolution (spatialD j g) t x := by + have h := (hd.comp x (hasFDerivAt_prodMk_right t x)).fderiv + have hv := congrArg (fun L : Plane →L[ℝ] ℝ => L v) h + change fderiv ℝ (torusHeatEvolution g t) x v = fderiv ℝ f (t,x) (0,v) at hv + rw [← hv, scalar_directional_basis] + apply Finset.sum_congr rfl + intro j _ + rw [torusHeatEvolution_spatialD hg hp] + apply ContinuousLinearMap.ext + intro v + rw [torusHeatDerivative_apply] + have he : v = v.1 • (1, (0 : Plane)) + (0, v.2) := by ext <;> simp + calc + _ = fderiv ℝ f (t,x) (v.1 • (1, (0 : Plane)) + (0, v.2)) := congrArg _ he + _ = _ := by rw [map_add, map_smul, htime, hspace]; rfl + +theorem torusHeatDerivative_continuousOn {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) : + ContinuousOn (torusHeatDerivative g) (Ici (0 : ℝ) ×ˢ (univ : Set Plane)) := by + apply ContinuousOn.add + · exact (torusHeatEvolution_continuousOn (heatDataLaplacian_smooth hg |>.of_le (by simp)) + (heatDataLaplacian_periodic hg hp)).smul continuousOn_const + · exact continuousOn_finsetSum _ (fun j _ => + (torusHeatEvolution_continuousOn (spatialD_smooth j hg |>.of_le (by simp)) + (spatialD_periodic hg hp j)).smul continuousOn_const) + +theorem torusHeatEvolution_hasFDerivWithinAt {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) {p : ℝ × Plane} + (hp₀ : p ∈ Ici (0 : ℝ) ×ˢ (univ : Set Plane)) : + HasFDerivWithinAt (fun q : ℝ × Plane => torusHeatEvolution g q.1 q.2) + (torusHeatDerivative g p) (Ici (0 : ℝ) ×ˢ univ) p := by + have hc : closure (Ioi (0 : ℝ) ×ˢ (univ : Set Plane)) = Ici (0 : ℝ) ×ˢ univ := by + rw [closure_prod_eq, closure_Ioi, closure_univ] + have hcont := torusHeatEvolution_continuousOn (hg.of_le (by simp)) hp + have hs : Ioi (0 : ℝ) ×ˢ (univ : Set Plane) ⊆ Ici (0 : ℝ) ×ˢ univ := by + rintro ⟨s,y⟩ ⟨hs,hy⟩ + change 0 < s at hs + change 0 ≤ s ∧ y ∈ (univ : Set Plane) + exact ⟨hs.le,hy⟩ + have hlim := (torusHeatDerivative_continuousOn hg hp p hp₀).mono + hs + have he : (fun q : ℝ × Plane => fderiv ℝ + (fun r : ℝ × Plane => torusHeatEvolution g r.1 r.2) q) =ᶠ[ + 𝓝[Ioi (0 : ℝ) ×ˢ (univ : Set Plane)] p] torusHeatDerivative g := by + filter_upwards [self_mem_nhdsWithin] with q hq + exact torusHeatEvolution_fderiv_positive hg hp hq.1 q.2 + have h := hasFDerivWithinAt_closure_of_tendsto_fderiv + ((torusHeatEvolution_smooth_positive g hg.continuous).differentiableOn (by simp)) + ((convex_Ioi (0 : ℝ)).prod convex_univ) (isOpen_Ioi.prod isOpen_univ) + (fun q hq => (hcont q (hc ▸ hq)).mono hs) + (hlim.congr' he.symm) + rwa [hc] at h + +theorem torusHeatEvolution_contDiffOn {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (Ici (0 : ℝ) ×ˢ (univ : Set Plane)) := by + have hi (n : ℕ) : ∀ (g : Plane → ℝ), ContDiff ℝ ∞ g → PlanePeriodic g → + ContDiffOn ℝ n (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (Ici (0 : ℝ) ×ˢ (univ : Set Plane)) := by + induction n with + | zero => + intro g hg hp + exact contDiffOn_zero.mpr (torusHeatEvolution_continuousOn (hg.of_le (by simp)) hp) + | succ n ih => + intro g hg hp + rw [Nat.cast_add, Nat.cast_one] + apply (contDiffOn_succ_iff_hasFDerivWithinAt_of_uniqueDiffOn + ((uniqueDiffOn_Ici (0 : ℝ)).prod uniqueDiffOn_univ)).mpr + refine ⟨by simp, torusHeatDerivative g, ?_, fun p hp₀ => + torusHeatEvolution_hasFDerivWithinAt hg hp hp₀⟩ + exact ((ih _ (heatDataLaplacian_smooth hg) (heatDataLaplacian_periodic hg hp)).smul + contDiffOn_const).add (ContDiffOn.sum (fun j _ => + (ih _ (spatialD_smooth j hg) (spatialD_periodic hg hp j)).smul contDiffOn_const)) + exact contDiffOn_infty.mpr (fun n => hi n g hg hp) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBounds.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d25fc858e25d88b9c09a88f06a3cfccc579c244 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatBounds.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatInput +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.HeatGaussianBounds + +namespace OAI + +/-! Two numerical heat bounds derived from the flat-torus Gaussian estimate. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector + +theorem torusHeatKernel_after_one (hK : TorusHeatInput) {t : ℝ} (ht : 1 ≤ t) + (x : ShearFlows.Plane) : torusHeatKernel t x ≤ 16 := by + have ht₀ : 0 < t := by linarith + have hπ := Real.pi_gt_three + have hq : 1 / (4 * Real.pi * t) ≤ (1 : ℝ) := by + apply (div_le_one (by positivity)).mpr + nlinarith + have hs : Real.sqrt (1 / (4 * Real.pi * t)) ≤ 1 := by + simpa only [Real.sqrt_one] using Real.sqrt_le_sqrt hq + have he : Real.exp (-(torusDistanceSq x) / (4 * t)) ≤ 1 := by + apply Real.exp_le_one_iff.mpr + exact div_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (torusDistanceSq_nonneg x)) + (by positivity) + calc + torusHeatKernel t x ≤ + 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * + Real.exp (-(torusDistanceSq x) / (4 * t)) := hK.gaussian t ht₀ x + _ ≤ 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * 1 := + mul_le_mul_of_nonneg_left he (by positivity) + _ ≤ 16 := by nlinarith [Real.sqrt_nonneg (1 / (4 * Real.pi * t))] + +theorem torusHeatKernel_separated (hK : TorusHeatInput) {t d : ℝ} + (ht : 0 < t) (hd : 0 < d) (x : ShearFlows.Plane) + (hx : d ^ 2 ≤ torusDistanceSq x) : torusHeatKernel t x ≤ 8 + 64 / d ^ 2 := by + have hπ := Real.pi_gt_three + have hq : 1 / (4 * Real.pi * t) ≤ t⁻¹ := by + rw [one_div, inv_le_inv₀ (by positivity) ht] + nlinarith + have hs : Real.sqrt (1 / (4 * Real.pi * t)) ^ 2 = 1 / (4 * Real.pi * t) := + Real.sq_sqrt (by positivity) + have hc : 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 ≤ 8 + 8 * t⁻¹ := by + nlinarith [sq_nonneg (Real.sqrt (1 / (4 * Real.pi * t)) - 1)] + have hdist : d ^ 2 / (8 * t) ≤ torusDistanceSq x / (4 * t) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + nlinarith [sq_nonneg d] + have he : Real.exp (-(torusDistanceSq x) / (4 * t)) ≤ + Real.exp (-(d ^ 2 / (8 * t))) := by + apply Real.exp_le_exp.mpr + rw [neg_div] + exact neg_le_neg hdist + have he₁ : Real.exp (-(d ^ 2 / (8 * t))) ≤ 1 := + Real.exp_le_one_iff.mpr (neg_nonpos.mpr (by positivity)) + calc + torusHeatKernel t x ≤ + 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * + Real.exp (-(torusDistanceSq x) / (4 * t)) := hK.gaussian t ht x + _ ≤ 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * + Real.exp (-(d ^ 2 / (8 * t))) := + mul_le_mul_of_nonneg_left he (by positivity) + _ ≤ (8 + 8 * t⁻¹) * Real.exp (-(d ^ 2 / (8 * t))) := + mul_le_mul_of_nonneg_right hc (Real.exp_pos _).le + _ = 8 * Real.exp (-(d ^ 2 / (8 * t))) + + 8 * (t⁻¹ * Real.exp (-(d ^ 2 / (8 * t)))) := by ring + _ ≤ 8 * 1 + 8 * (8 / d ^ 2) := add_le_add + (mul_le_mul_of_nonneg_left he₁ (by norm_num)) + (mul_le_mul_of_nonneg_left (gaussian_time_factor hd ht) (by norm_num)) + _ = 8 + 64 / d ^ 2 := by ring + +theorem torusHeatKernel_detector_bounds (hK : TorusHeatInput) {t : ℝ} (ht : 0 < t) + (x : ShearFlows.Plane) : + (1 ≤ t ∨ (1 / 32 : ℝ) ^ 2 ≤ torusDistanceSq x → torusHeatKernel t x < 1000000000) ∧ + (1 ≤ t ∨ (1 / 16 : ℝ) ^ 2 ≤ torusDistanceSq x → torusHeatKernel t x < 100000000) := by + constructor + · intro h + rcases h with h | h + · exact (torusHeatKernel_after_one hK h x).trans_lt (by norm_num) + · exact (torusHeatKernel_separated hK ht (by norm_num : (0 : ℝ) < 1 / 32) x h).trans_lt + (by norm_num) + · intro h + rcases h with h | h + · exact (torusHeatKernel_after_one hK h x).trans_lt (by norm_num) + · exact (torusHeatKernel_separated hK ht (by norm_num : (0 : ℝ) < 1 / 16) x h).trans_lt + (by norm_num) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatConcentration.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatConcentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec2c236f6812d0cc86ea085458bf44be9fa58ab1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatConcentration.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlanePeriodicBounds +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics + +namespace OAI + +/-! Quantitative concentration of the actual torus heat kernel near the lattice. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter MeasureTheory +open scoped Topology NNReal + +def torusHeatTail (d t : ℝ) : ℝ := + (8 + 8 * t⁻¹) * Real.exp (-(d^2 / (4*t))) + +theorem torusHeatTail_nonneg {t : ℝ} (ht : 0 < t) (d : ℝ) : + 0 ≤ torusHeatTail d t := by unfold torusHeatTail; positivity + +theorem torusHeatKernel_le_tail {t d : ℝ} (ht : 0 < t) (x : Plane) + (hx : d^2 ≤ torusDistanceSq x) : torusHeatKernel t x ≤ torusHeatTail d t := by + have hq : 1 / (4 * Real.pi * t) ≤ t⁻¹ := by + rw [one_div, inv_le_inv₀ (by positivity) ht] + nlinarith [Real.pi_gt_three] + have hs : Real.sqrt (1 / (4 * Real.pi * t)) ^ 2 = 1 / (4 * Real.pi * t) := + Real.sq_sqrt (by positivity) + have hc : 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t)))^2 ≤ 8 + 8 * t⁻¹ := by + nlinarith [sq_nonneg (Real.sqrt (1 / (4 * Real.pi * t)) - 1)] + have he : Real.exp (-(torusDistanceSq x) / (4*t)) ≤ Real.exp (-(d^2 / (4*t))) := by + apply Real.exp_le_exp.mpr + rw [neg_div] + exact neg_le_neg ((div_le_div_iff_of_pos_right (by positivity)).mpr hx) + exact (torusHeatKernel_gaussian ht x).trans + (mul_le_mul hc he (Real.exp_pos _).le (by positivity)) + +theorem torusHeatTail_tendsto {d : ℝ} (hd : 0 < d) : + Tendsto (torusHeatTail d) (𝓝[>] 0) (𝓝 0) := by + let b := d^2 / 4 + have hb : 0 < b := by dsimp [b]; positivity + have h₀ := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero 0 b hb).comp + tendsto_inv_nhdsGT_zero + have h₁ := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero 1 b hb).comp + tendsto_inv_nhdsGT_zero + have h := (h₀.const_mul 8).add (h₁.const_mul 8) + simp only [Function.comp_def, Real.rpow_zero, Real.rpow_one, one_mul, + mul_zero, add_zero] at h + convert h using 1 + funext t + dsimp [torusHeatTail, b] + rw [show -(d^2 / (4*t)) = -(d^2 / 4) * t⁻¹ by ring] + ring + +theorem torusHeatEvolution_error_estimate {g : Plane → ℝ} {K : ℝ≥0} {B d t : ℝ} + (hg : LipschitzWith K g) (hp : PlanePeriodic g) (hB : ∀ x, |g x| ≤ B) + (hd : 0 < d) (ht : 0 < t) (x : Plane) : + |torusHeatEvolution g t x - g x| ≤ K * d + 2 * B * torusHeatTail d t := by + have hB₀ : 0 ≤ B := (abs_nonneg (g 0)).trans (hB 0) + have hK : Continuous (fun y : Plane => torusHeatKernel t (x-y)) := + (torusHeatKernel_continuous ht).comp (continuous_const.sub continuous_id) + have hi₁ : IntegrableOn (fun y : Plane => torusHeatKernel t (x-y) * g y) + (Icc (0 : Plane) (fun _ => 1)) := (hK.mul hg.continuous).integrableOn_Icc + have hi₂ : IntegrableOn (fun y : Plane => torusHeatKernel t (x-y) * g x) + (Icc (0 : Plane) (fun _ => 1)) := (hK.mul continuous_const).integrableOn_Icc + have he : torusHeatEvolution g t x - g x = + ∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x-y) * (g y - g x) := by + rw [torusHeatEvolution, ite_eq_right (not_le.mpr ht)] + simp_rw [mul_sub] + rw [integral_sub hi₁ hi₂, integral_mul_const, torusHeatKernel_integral ht, one_mul] + rw [he, ← Real.norm_eq_abs] + have hi : IntegrableOn (fun y : Plane => K*d*torusHeatKernel t (x-y) + + 2*B*torusHeatTail d t) (Icc (0 : Plane) (fun _ => 1)) := + ((continuous_const.mul hK).add continuous_const).integrableOn_Icc + calc + _ ≤ ∫ y in Icc (0 : Plane) (fun _ => 1), + K * d * torusHeatKernel t (x-y) + 2 * B * torusHeatTail d t := by + apply norm_integral_le_of_norm_le hi + exact ae_of_all _ fun y => by + rw [norm_mul, Real.norm_eq_abs, abs_of_nonneg (torusHeatKernel_nonneg ht _), + Real.norm_eq_abs] + by_cases hnear : torusNorm (x-y) ≤ d + · have hdiff := planePeriodic_norm_sub_le_torus hg hp x y + rw [Real.norm_eq_abs, abs_sub_comm] at hdiff + have hsmall : |g y - g x| ≤ K*d := + hdiff.trans (mul_le_mul_of_nonneg_left hnear K.coe_nonneg) + calc + _ ≤ torusHeatKernel t (x-y) * ((K : ℝ)*d) := + mul_le_mul_of_nonneg_left hsmall (torusHeatKernel_nonneg ht _) + _ = (K : ℝ)*d*torusHeatKernel t (x-y) := by ring + _ ≤ _ := le_add_of_nonneg_right (by + exact mul_nonneg (by positivity) (torusHeatTail_nonneg ht d)) + · have hdist : d^2 ≤ torusDistanceSq (x-y) := by + rw [← torusNorm_sq] + nlinarith [lt_of_not_ge hnear, torusNorm_nonneg (x-y)] + have hdiff : |g y - g x| ≤ 2*B := (abs_sub _ _).trans (by linarith [hB y, hB x]) + have hbound := torusHeatKernel_le_tail ht (x-y) hdist + calc + _ ≤ torusHeatKernel t (x-y) * (2*B) := + mul_le_mul_of_nonneg_left hdiff (torusHeatKernel_nonneg ht _) + _ = 2*B*torusHeatKernel t (x-y) := by ring + _ ≤ 2*B*torusHeatTail d t := + mul_le_mul_of_nonneg_left hbound (by positivity) + _ ≤ _ := le_add_of_nonneg_left + (mul_nonneg (mul_nonneg K.coe_nonneg hd.le) (torusHeatKernel_nonneg ht _)) + _ = K*d + 2*B*torusHeatTail d t := by + have hia : IntegrableOn (fun y : Plane => (K : ℝ)*d*torusHeatKernel t (x-y)) + (Icc (0 : Plane) (fun _ => 1)) := (continuous_const.mul hK).integrableOn_Icc + rw [integral_add (f := fun y : Plane => (K : ℝ)*d*torusHeatKernel t (x-y)) + (g := fun _ : Plane => 2*B*torusHeatTail d t) hia continuous_const.integrableOn_Icc, + integral_const_mul, torusHeatKernel_integral ht] + have hvol : volume.real (Icc (0 : Plane) (fun _ => 1)) = 1 := by + rw [Measure.real, Real.volume_Icc_pi_toReal (a := (0 : Plane)) + (b := fun _ => 1) (fun _ => zero_le_one)] + simp + rw [setIntegral_const, hvol, one_smul, mul_one] + +theorem torusHeatEvolution_tendsto_uniformly {g : Plane → ℝ} + (hg : ContDiff ℝ 1 g) (hp : PlanePeriodic g) : + TendstoUniformly (torusHeatEvolution g) g (𝓝[>] 0) := by + obtain ⟨K, hK⟩ := planePeriodic_lipschitz hg hp + obtain ⟨B, _, hB⟩ := planePeriodic_bound hg.continuous hp + have hB' (x : Plane) : |g x| ≤ B := by simpa only [Real.norm_eq_abs] using hB x + rw [Metric.tendstoUniformly_iff] + intro ε hε + let d := ε / (2 * ((K : ℝ) + 1)) + have hd : 0 < d := by dsimp [d]; positivity + have hsmall : (K : ℝ) * d < ε / 2 := by + have he : 2 * ((K : ℝ) + 1) * d = ε := by + dsimp [d] + field_simp + nlinarith [K.coe_nonneg] + have ht := (torusHeatTail_tendsto hd).const_mul (2*B) + simp only [mul_zero] at ht + have ht' := (tendsto_order.1 ht).2 (ε/2) (by linarith) + filter_upwards [self_mem_nhdsWithin, ht'] with t ht₀ htail x + have he := torusHeatEvolution_error_estimate hK hp hB' hd ht₀ x + have hlt : |torusHeatEvolution g t x - g x| < ε := by linarith + simpa only [Real.dist_eq, abs_sub_comm] using hlt + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..c071a5e4b368ad3387646b3ad702eb7503d6a9e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolution.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatBounds +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarBounds + +namespace OAI + +/-! Consequences of the heat representation used during the detector waits: +mass bounds for a nonnegative bump, linear splitting, and propagation of a +uniform error estimate. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +theorem torusHeatEvolution_nonnegative {g : Plane → ℝ} (hg : ∀ x, 0 ≤ g x) + (t : ℝ) (x : Plane) : 0 ≤ torusHeatEvolution g t x := by + unfold torusHeatEvolution + split_ifs with ht + · exact hg x + · exact integral_nonneg (fun y => mul_nonneg (torusHeatKernel_nonneg (lt_of_not_ge ht) _) + (hg y)) + +theorem torusHeatEvolution_add (hK : TorusHeatInput) {g h : Plane → ℝ} + (hg : Continuous g) (hh : Continuous h) (t : ℝ) (x : Plane) : + torusHeatEvolution (fun y => g y + h y) t x = + torusHeatEvolution g t x + torusHeatEvolution h t x := by + unfold torusHeatEvolution + split_ifs with ht + · rfl + · have hc : Continuous (fun y => torusHeatKernel t (x - y)) := + (hK.continuous t (lt_of_not_ge ht)).comp (continuous_const.sub continuous_id) + simp_rw [mul_add] + exact integral_add (hc.mul hg).integrableOn_Icc (hc.mul hh).integrableOn_Icc + +theorem torusHeatEvolution_mass_bound (hK : TorusHeatInput) {g : Plane → ℝ} + (hg : Continuous g) (hg₀ : ∀ x, 0 ≤ g x) {t H : ℝ} (ht : 0 < t) (x : Plane) + (hbound : ∀ y ∈ Icc (0 : Plane) (fun _ => 1), + g y ≠ 0 → torusHeatKernel t (x - y) ≤ H) : + torusHeatEvolution g t x ≤ H * ∫ y in Icc (0 : Plane) (fun _ => 1), g y := by + have hc : Continuous (fun y => torusHeatKernel t (x - y)) := + (hK.continuous t ht).comp (continuous_const.sub continuous_id) + rw [torusHeatEvolution, ite_eq_right (not_le.mpr ht), ← integral_const_mul] + apply setIntegral_mono_on (hc.mul hg).integrableOn_Icc + (hg.const_mul H).integrableOn_Icc measurableSet_Icc + intro y hy + change torusHeatKernel t (x - y) * g y ≤ H * g y + by_cases hz : g y = 0 + · simp only [hz, mul_zero, le_refl] + · exact mul_le_mul_of_nonneg_right (hbound y hy hz) (hg₀ y) + +theorem torusHeatEvolution_after_one (hK : TorusHeatInput) {g : Plane → ℝ} + (hg : Continuous g) (hg₀ : ∀ x, 0 ≤ g x) {t : ℝ} (ht : 1 ≤ t) (x : Plane) : + torusHeatEvolution g t x ≤ 16 * ∫ y in Icc (0 : Plane) (fun _ => 1), g y := + torusHeatEvolution_mass_bound hK hg hg₀ (by linarith) x + (fun y _ _ => torusHeatKernel_after_one hK ht (x - y)) + +theorem torusHeatEvolution_error_bound (hK : TorusHeatInput) {g : Plane → ℝ} + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) {E : ℝ} (hE : ∀ x, |g x| ≤ E) + {t : ℝ} (ht : 0 ≤ t) (x : Plane) : |torusHeatEvolution g t x| ≤ E := by + have hb := (hK.solution t ht g hg hp).absolute_bound ht (by norm_num) + (M := E) (A := 0) (fun _ _ _ => by simp) hE t ⟨ht, le_rfl⟩ x + simpa only [zero_mul, add_zero] using hb + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolutionSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolutionSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6531515310b574e55d6687bfc1cd5e5bce249bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatEvolutionSmooth.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatPositiveSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.CompactParameterIntegral + +namespace OAI + +/-! Smoothness of the prescribed heat convolution at every positive time. +Compact parameter integration applies after using logarithmic time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff + +private abbrev HeatCell := Icc (0 : Plane) (fun _ => 1) +private instance : CompactSpace HeatCell := + isCompact_iff_compactSpace.mp + (isCompact_Icc : IsCompact (Icc (0 : Plane) (fun _ => 1))) +local instance : MeasureSpace HeatCell := Measure.Subtype.measureSpace +private instance : IsFiniteMeasure (volume : Measure HeatCell) := by + constructor + rw [Measure.Subtype.volume_univ measurableSet_Icc.nullMeasurableSet] + exact (isCompact_Icc : IsCompact (Icc (0 : Plane) (fun _ => 1))).measure_lt_top + +theorem torusHeatEvolution_exp_smooth (g : Plane → ℝ) (hg : Continuous g) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => torusHeatEvolution g (Real.exp p.1) p.2) := by + let E := (ℝ × Plane) × ℝ + let f : E → ℝ := fun q => torusHeatKernel (Real.exp q.1.1) q.1.2 * q.2 + have hf : ContDiff ℝ ∞ f := + (torusHeatKernel_exp_smooth.comp contDiff_fst).mul contDiff_snd + let b : C(HeatCell, E) := ⟨fun y => ((0, -(y : Plane)), g y), + (continuous_const.prodMk continuous_subtype_val.neg).prodMk + (hg.comp continuous_subtype_val)⟩ + let A : (ℝ × Plane) →L[ℝ] C(HeatCell, E) := + (ContinuousLinearMap.const ℝ HeatCell).comp (ContinuousLinearMap.inl ℝ (ℝ × Plane) ℝ) + have hv : ContDiff ℝ ∞ (fun p => A p + b) := A.contDiff.add contDiff_const + have h := Flow.contDiff_compactIntegral (volume : Measure HeatCell) + (⟨f, hf.continuous⟩ : C(E, ℝ)) hf (fun p => A p + b) hv + convert h using 1 + funext p + rw [torusHeatEvolution, ite_eq_right (not_le.mpr (Real.exp_pos _)), + ← integral_subtype measurableSet_Icc] + congr 1 + funext y + change torusHeatKernel (Real.exp p.1) (p.2 - (y : Plane)) * g y = + torusHeatKernel (Real.exp (p.1 + 0)) (p.2 + -(y : Plane)) * (0 + g y) + simp only [add_zero, zero_add, sub_eq_add_neg] + + +theorem torusHeatEvolution_smooth_positive (g : Plane → ℝ) (hg : Continuous g) : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (Ioi (0 : ℝ) ×ˢ univ) := by + have hl : ContDiffOn ℝ ∞ (fun p : ℝ × Plane => (Real.log p.1, p.2)) + (Ioi (0 : ℝ) ×ˢ univ) := + (contDiff_fst.contDiffOn.log (fun _ hp => ne_of_gt hp.1)).prodMk + contDiff_snd.contDiffOn + have hs := (torusHeatEvolution_exp_smooth g hg).comp_contDiffOn hl + apply hs.congr + intro p hp + change torusHeatEvolution g p.1 p.2 = + torusHeatEvolution g (Real.exp (Real.log p.1)) p.2 + rw [Real.exp_log hp.1] + + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatGaussianBound.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatGaussianBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d31c367f744655822cd1e382da81cd72b2ade41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatGaussianBound.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatLattice +import Mathlib.Analysis.SumIntegralComparisons + +namespace OAI + +/-! Elementary lattice estimates for the two-dimensional torus heat kernel. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped BigOperators + +theorem gaussian_nat_tsum_le {b : ℝ} (hb : 0 < b) : + (∑' n : ℕ, Real.exp (-b * (n : ℝ) ^ 2)) ≤ 1 + Real.sqrt (Real.pi / b) := by + have ha : AntitoneOn (fun x : ℝ => Real.exp (-b * x ^ 2)) (Ici 0) := by + intro x hx y hy hxy + apply Real.exp_le_exp.mpr + have hs := (sq_le_sq₀ hx hy).mpr hxy + nlinarith + have hi := integrable_exp_neg_mul_sq hb + have hh := ha.tsum_le_integral hi.integrableOn (fun x _ => (Real.exp_pos _).le) + rw [integral_gaussian_Ioi] at hh + simp only [zero_pow two_ne_zero, mul_zero, Real.exp_zero] at hh + have hs : 0 ≤ Real.sqrt (Real.pi / b) := Real.sqrt_nonneg _ + linarith + +theorem gaussianLattice_add_int (t x : ℝ) (m : ℤ) : + gaussianLattice t (x + m) = gaussianLattice t x := by + unfold gaussianLattice + have h := (Equiv.addRight m).tsum_eq + (fun n : ℤ => Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t))) + convert h using 1 + apply tsum_congr + intro n + simp only [Equiv.coe_addRight, Int.cast_add] + congr 2 + ring + +theorem gaussianLattice_neg (t x : ℝ) : gaussianLattice t (-x) = gaussianLattice t x := by + unfold gaussianLattice + have h := (Equiv.neg ℤ).tsum_eq + (fun n : ℤ => Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t))) + convert h using 1 + apply tsum_congr + intro n + simp only [Equiv.neg_apply, Int.cast_neg] + congr 2 + ring + +theorem gaussianLattice_abs (t x : ℝ) : gaussianLattice t |x| = gaussianLattice t x := by + rcases le_total 0 x with hx | hx + · rw [abs_of_nonneg hx] + · rw [abs_of_nonpos hx, gaussianLattice_neg] + +theorem gaussian_nat_summable {t : ℝ} (ht : 0 < t) : + Summable (fun n : ℕ => Real.exp (-((n : ℝ) ^ 2) / (4 * t))) := by + have h := (gaussianLattice_summable ht 0).comp_injective + (show Function.Injective (fun n : ℕ => (n : ℤ)) from Int.ofNat_injective) + simpa only [Function.comp_def, zero_add, Int.cast_natCast] using h + +theorem gaussian_nat_scaled_le {t : ℝ} (ht : 0 < t) : + (∑' n : ℕ, Real.exp (-((n : ℝ) ^ 2) / (4 * t))) ≤ + 1 + Real.sqrt (4 * Real.pi * t) := by + have h := gaussian_nat_tsum_le (b := (4 * t)⁻¹) (by positivity) + have he (x : ℝ) : -(4 * t)⁻¹ * x ^ 2 = -(x ^ 2) / (4 * t) := by ring + have hs : Real.pi / (4 * t)⁻¹ = 4 * Real.pi * t := by rw [div_inv_eq_mul]; ring + simpa only [he, hs] using h + +theorem gaussianLattice_centered_le {t r : ℝ} (ht : 0 < t) + (hr : 0 ≤ r) (hr' : r ≤ 1 / 2) : + gaussianLattice t r ≤ 2 * (1 + Real.sqrt (4 * Real.pi * t)) * + Real.exp (-(r ^ 2) / (4 * t)) := by + let fp := fun n : ℕ => Real.exp (-((r + (n : ℝ)) ^ 2) / (4 * t)) + let fm := fun n : ℕ => Real.exp (-((r - ((n : ℝ) + 1)) ^ 2) / (4 * t)) + let u := fun n : ℕ => Real.exp (-(r ^ 2) / (4 * t)) * + Real.exp (-((n : ℝ) ^ 2) / (4 * t)) + have hu : Summable u := (gaussian_nat_summable ht).mul_left _ + have hbound (s : ℝ) (n : ℕ) (hs : r ^ 2 + (n : ℝ) ^ 2 ≤ s ^ 2) : + Real.exp (-(s ^ 2) / (4 * t)) ≤ u n := by + dsimp only [u] + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + calc + _ ≤ (-(r ^ 2) - (n : ℝ) ^ 2) / (4 * t) := + div_le_div_of_nonneg_right (by linarith) (by positivity) + _ = _ := by ring + have hfp (n : ℕ) : fp n ≤ u n := by + apply hbound + nlinarith [mul_nonneg hr (Nat.cast_nonneg n : (0 : ℝ) ≤ n)] + have hfm (n : ℕ) : fm n ≤ u n := by + apply hbound + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg n + have hnr : 0 ≤ (n : ℝ) * (1 - r) := mul_nonneg hn (by linarith) + nlinarith + have hp : Summable fp := hu.of_nonneg_of_le (fun _ => (Real.exp_pos _).le) hfp + have hm : Summable fm := hu.of_nonneg_of_le (fun _ => (Real.exp_pos _).le) hfm + have he : gaussianLattice t r = (∑' n, fp n) + ∑' n, fm n := by + calc + gaussianLattice t r = ∑' n : ℤ, Int.rec fp fm n := by + apply tsum_congr + intro n + cases n with + | ofNat n => simp only [fp, Int.ofNat_eq_natCast, Int.cast_natCast] + | negSucc n => + simp only [fm, Int.cast_negSucc] + push_cast + congr 2 + _ = _ := (hp.hasSum.int_rec hm.hasSum).tsum_eq + rw [he] + calc + _ ≤ (∑' n, u n) + ∑' n, u n := + add_le_add (hp.tsum_le_tsum hfp hu) (hm.tsum_le_tsum hfm hu) + _ = 2 * Real.exp (-(r ^ 2) / (4 * t)) * + (∑' n : ℕ, Real.exp (-((n : ℝ) ^ 2) / (4 * t))) := by + dsimp only [u] + rw [tsum_mul_left] + ring + _ ≤ 2 * Real.exp (-(r ^ 2) / (4 * t)) * + (1 + Real.sqrt (4 * Real.pi * t)) := + mul_le_mul_of_nonneg_left (gaussian_nat_scaled_le ht) (by positivity) + _ = _ := by ring + +theorem gaussianLattice_nearest_le {t : ℝ} (ht : 0 < t) (x : ℝ) : + gaussianLattice t x ≤ 2 * (1 + Real.sqrt (4 * Real.pi * t)) * + Real.exp (-((x - (⌊x + 1 / 2⌋ : ℤ)) ^ 2) / (4 * t)) := by + let m : ℤ := ⌊x + 1 / 2⌋ + let r : ℝ := x - (m : ℝ) + have hrl : -(1 / 2 : ℝ) ≤ r := by + have h := Int.floor_le (x + 1 / 2) + dsimp only [r, m] + linarith + have hru : r ≤ (1 / 2 : ℝ) := by + have h := Int.lt_floor_add_one (x + 1 / 2) + dsimp only [r, m] + linarith + have he := gaussianLattice_add_int t r m + have hx : r + (m : ℝ) = x := by dsimp only [r]; ring + rw [hx] at he + rw [he, ← gaussianLattice_abs t r] + simpa only [sq_abs] using gaussianLattice_centered_le ht (abs_nonneg r) + (abs_le.mpr ⟨hrl, hru⟩) + +theorem gaussianLattice_nonneg (t x : ℝ) : 0 ≤ gaussianLattice t x := + tsum_nonneg (fun _ => (Real.exp_pos _).le) + +theorem torusHeatKernel_gaussian {t : ℝ} (ht : 0 < t) (x : Plane) : + torusHeatKernel t x ≤ + 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * + Real.exp (-(torusDistanceSq x) / (4 * t)) := by + let A := 4 * Real.pi * t + let S := Real.sqrt A + let E := fun j : Fin 2 => Real.exp (-((x j - (⌊x j + 1 / 2⌋ : ℤ)) ^ 2) / (4 * t)) + have hA : 0 < A := by dsimp only [A]; positivity + have hS : 0 < S := Real.sqrt_pos.mpr hA + have hS2 : S ^ 2 = A := Real.sq_sqrt hA.le + have hAi : A⁻¹ = S⁻¹ ^ 2 := by rw [← hS2, inv_pow] + have hSi : Real.sqrt (1 / A) = S⁻¹ := by + simp only [one_div, Real.sqrt_inv, S] + have hcoeff : A⁻¹ * (2 * (1 + S)) ^ 2 = 4 * (1 + Real.sqrt (1 / A)) ^ 2 := by + rw [hAi, hSi] + field_simp [hS.ne'] + ring + have hE : E 0 * E 1 = Real.exp (-(torusDistanceSq x) / (4 * t)) := by + dsimp only [E] + rw [← Real.exp_add] + congr 1 + simp only [torusDistanceSq, Fin.sum_univ_two] + ring + rw [torusHeatKernel_factor ht] + change A⁻¹ * (gaussianLattice t (x 0) * gaussianLattice t (x 1)) ≤ _ + calc + _ ≤ A⁻¹ * ((2 * (1 + S) * E 0) * (2 * (1 + S) * E 1)) := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr hA.le) + exact mul_le_mul (gaussianLattice_nearest_le ht (x 0)) + (gaussianLattice_nearest_le ht (x 1)) (gaussianLattice_nonneg t (x 1)) + (by dsimp only [S, E]; positivity) + _ = (A⁻¹ * (2 * (1 + S)) ^ 2) * (E 0 * E 1) := by ring + _ = _ := by rw [hcoeff, hE] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInitialContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInitialContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1585113a7e0dc1ad7972d22c43536080f2fce9d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInitialContinuity.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatConcentration +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatEvolutionSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatPeriodicity +import Mathlib.Topology.UniformSpace.UniformApproximation +import Mathlib.Topology.Order.LeftRight + +namespace OAI + +/-! Joint continuity of the prescribed heat evolution at the initial boundary. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set Filter +open scoped Topology ContDiff + +theorem torusHeatEvolution_initial_joint_limit {g : Plane → ℝ} + (hg : ContDiff ℝ 1 g) (hp : PlanePeriodic g) (x : Plane) : + Tendsto (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + ((𝓝[>] 0) ×ˢ 𝓝 x) (𝓝 (g x)) := by + have h := torusHeatEvolution_tendsto_uniformly hg hp + have hu : TendstoUniformly + (fun p : ℝ × Plane => torusHeatEvolution g p.1) g ((𝓝[>] 0) ×ˢ 𝓝 x) := by + intro u hu + exact tendsto_fst.eventually (h u hu) + exact hu.tendsto_comp hg.continuous.continuousAt tendsto_snd + +theorem torusHeatEvolution_continuous_initial {g : Plane → ℝ} + (hg : ContDiff ℝ 1 g) (hp : PlanePeriodic g) (x : Plane) : + ContinuousWithinAt (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (Ici (0 : ℝ) ×ˢ univ) (0, x) := by + change Tendsto (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (𝓝[Ici (0 : ℝ) ×ˢ univ] (0, x)) (𝓝 (torusHeatEvolution g 0 x)) + rw [torusHeatEvolution_initial, nhdsWithin_prod_eq, nhdsWithin_univ, + ← nhdsGT_sup_nhdsWithin_singleton, sup_prod, tendsto_sup] + refine ⟨torusHeatEvolution_initial_joint_limit hg hp x, ?_⟩ + rw [nhdsWithin_singleton, pure_prod, tendsto_map'_iff] + simpa only [ContinuousAt, Function.comp_def, torusHeatEvolution_initial] using hg.continuous.continuousAt + +theorem torusHeatEvolution_continuousOn {g : Plane → ℝ} + (hg : ContDiff ℝ 1 g) (hp : PlanePeriodic g) : + ContinuousOn (fun p : ℝ × Plane => torusHeatEvolution g p.1 p.2) + (Ici (0 : ℝ) ×ˢ univ) := by + rintro ⟨t, x⟩ ht + by_cases hzero : t = 0 + · subst t + exact torusHeatEvolution_continuous_initial hg hp x + · have hpos : 0 < t := lt_of_le_of_ne ht.1 (Ne.symm hzero) + have hmem : (t,x) ∈ Ioi (0 : ℝ) ×ˢ (univ : Set Plane) := ⟨hpos, mem_univ x⟩ + exact ((torusHeatEvolution_smooth_positive g hg.continuous).continuousOn.continuousAt + ((isOpen_Ioi.prod isOpen_univ).mem_nhds hmem)).continuousWithinAt + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ddcf95156d8b586cec46b0ddabe73c1ef954342 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatInput.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusScalarInput +import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral + +namespace OAI + +/-! The isotropic two-dimensional periodic heat kernel and its Gaussian bound. + +P. Maheux, Notes on Heat Kernels on Infinite dimensional Torus (16 February +2008), Sections 2.1 and 3.1, and Theorem 3.1, equation (3.15), pp. 5, 10--11. +The isotropic two-dimensional kernel is rescaled from period 2π to period +one. Its generator is the coordinate Laplacian, and its Gaussian estimate +is the first upper bound in (3.15). Source: https://idpoisson.fr/maheux/InfiniteTorusV2.pdf +-/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +/-- Squared Euclidean distance to the nearest lattice point, using the +centered representative in each coordinate. -/ +def torusDistanceSq (x : Plane) : ℝ := + ∑ j : Fin 2, (x j - (⌊x j + 1 / 2⌋ : ℤ)) ^ 2 + +def torusHeatKernel (t : ℝ) (x : Plane) : ℝ := + (4 * Real.pi * t)⁻¹ * ∑' k : Fin 2 → ℤ, + Real.exp (-(∑ j : Fin 2, (x j + (k j : ℝ)) ^ 2) / (4 * t)) + +def torusHeatEvolution (g : Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + if t ≤ 0 then g x else + ∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x - y) * g y + +/-- The flat-torus specialization of the heat representation and Gaussian bound. -/ +structure TorusHeatInput : Prop where + continuous : ∀ t, 0 < t → Continuous (torusHeatKernel t) + solution : ∀ (T : ℝ), 0 ≤ T → ∀ (g : Plane → ℝ), + ContDiff ℝ ∞ g → PlanePeriodic g → + TorusScalarSolution T 1 (fun _ _ => 0) (fun _ _ => 0) (torusHeatEvolution g) g + gaussian : ∀ t, 0 < t → ∀ x, + torusHeatKernel t x ≤ + 4 * (1 + Real.sqrt (1 / (4 * Real.pi * t))) ^ 2 * + Real.exp (-(torusDistanceSq x) / (4 * t)) + +theorem torusDistanceSq_nonneg (x : Plane) : 0 ≤ torusDistanceSq x := + Finset.sum_nonneg (fun _ _ => sq_nonneg _) + +theorem torusHeatKernel_nonneg {t : ℝ} (ht : 0 < t) (x : Plane) : + 0 ≤ torusHeatKernel t x := by + unfold torusHeatKernel + exact mul_nonneg (inv_nonneg.mpr (by positivity)) + (tsum_nonneg (fun _ => (Real.exp_pos _).le)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatIntegrationByParts.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatIntegrationByParts.lean new file mode 100644 index 0000000000000000000000000000000000000000..a28c3649782121b90b120cdc530c4fc2bda7b9ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatIntegrationByParts.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassCalculus + +namespace OAI + +/-! The periodic integration-by-parts identity used to transfer heat derivatives. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff + +theorem periodic_integral_mul_spatialD {f g : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (hpf : PlanePeriodic f) (hpg : PlanePeriodic g) (j : Fin 2) : + (∫ x in Icc (0 : Plane) (fun _ => 1), f x * spatialD j g x) = + -(∫ x in Icc (0 : Plane) (fun _ => 1), spatialD j f x * g x) := by + have hp : PlanePeriodic (fun x => f x * g x) := by + intro x n + change f (x+fun j => (n j : ℝ)) * g (x+fun j => (n j : ℝ)) = f x * g x + rw [hpf x n, hpg x n] + have hz := integral_planar_periodic_derivative (hf.mul hg) hp j + have he (x : Plane) : fderiv ℝ (fun y => f y * g y) x (PlanarHamiltonian.basis j) = + spatialD j f x * g x + f x * spatialD j g x := by + rw [fderiv_fun_mul (hf.differentiable (by simp) x) (hg.differentiable (by simp) x)] + simp only [add_apply, smul_apply, smul_eq_mul, spatialD] + ring + simp_rw [he] at hz + have hi₁ : IntegrableOn (fun x : Plane => spatialD j f x * g x) + (Icc (0 : Plane) (fun _ => 1)) := + ((spatialD_smooth j hf).continuous.mul hg.continuous).integrableOn_Icc + have hi₂ : IntegrableOn (fun x : Plane => f x * spatialD j g x) + (Icc (0 : Plane) (fun _ => 1)) := + (hf.continuous.mul (spatialD_smooth j hg).continuous).integrableOn_Icc + rw [integral_add hi₁ hi₂] at hz + linarith + +theorem periodic_integral_mul_spatialD_twice {f g : Plane → ℝ} + (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (hpf : PlanePeriodic f) (hpg : PlanePeriodic g) (j : Fin 2) : + (∫ x in Icc (0 : Plane) (fun _ => 1), f x * spatialD j (spatialD j g) x) = + ∫ x in Icc (0 : Plane) (fun _ => 1), spatialD j (spatialD j f) x * g x := by + rw [periodic_integral_mul_spatialD hf (spatialD_smooth j hg) hpf + (spatialD_periodic hg hpg j) j, + periodic_integral_mul_spatialD (spatialD_smooth j hf) hg + (spatialD_periodic hf hpf j) hpg j, neg_neg] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatKernelEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatKernelEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb763b64039f40a9d94506c60b0a41ce0caa1d53 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatKernelEquation.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatPositiveSmooth + +namespace OAI + +/-! The Gaussian lattice kernel satisfies the coordinate heat equation. +Fourier products keep the two first and second spatial derivatives explicit. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +def torusHeatFourierProduct (c : ℂ) (k l : ℕ) (t : ℝ) (x : Plane) : ℝ := + (c * periodicHeatMoment k (t, x 0) * periodicHeatMoment l (t, x 1)).re + +theorem torusHeatFourierProduct_time (c : ℂ) (k l : ℕ) {t : ℝ} + (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => torusHeatFourierProduct c k l s x) + (torusHeatFourierProduct (-4 * (Real.pi : ℂ)^2 * c) (k+2) l t x + + torusHeatFourierProduct (-4 * (Real.pi : ℂ)^2 * c) k (l+2) t x) t := by + have h := Complex.reCLM.hasFDerivAt.comp_hasDerivAt t + (((periodicHeatMoment_time k ht (x 0)).const_mul c).mul + (periodicHeatMoment_time l ht (x 1))) + change HasDerivAt (fun s => torusHeatFourierProduct c k l s x) _ t at h + convert! h using 1 + simp only [torusHeatFourierProduct, Complex.reCLM_apply] + rw [← Complex.add_re] + congr 1 + ring + +private theorem moment_plane_deriv (k : ℕ) {t : ℝ} (ht : 0 < t) + (x : Plane) (j : Fin 2) : + HasFDerivAt (fun y : Plane => periodicHeatMoment k (t, y j)) + ((ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).smulRight + (2 * (Real.pi : ℂ) * Complex.I * periodicHeatMoment (k+1) (t, x j))) x := by + have h := periodicHeatMoment_space k ht (x j) + change HasDerivAt (fun y => periodicHeatMoment k (t, y)) _ + ((ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ) x) at h + convert! h.hasFDerivAt.comp x + (ContinuousLinearMap.proj j : Plane →L[ℝ] ℝ).hasFDerivAt using 1 + +theorem torusHeatFourierProduct_spatialD_zero (c : ℂ) (k l : ℕ) {t : ℝ} + (ht : 0 < t) : + spatialD 0 (torusHeatFourierProduct c k l t) = + torusHeatFourierProduct (c * (2 * (Real.pi : ℂ) * Complex.I)) (k+1) l t := by + funext x + have h := Complex.reCLM.hasFDerivAt.comp x + (((moment_plane_deriv k ht x 0).const_mul c).mul (moment_plane_deriv l ht x 1)) + change HasFDerivAt (torusHeatFourierProduct c k l t) _ x at h + rw [spatialD, h.fderiv] + simp only [ContinuousLinearMap.comp_apply, add_apply, + ContinuousLinearMap.smulRight_apply, smul_apply, + ContinuousLinearMap.proj_apply, PlanarHamiltonian.basis, Pi.single_eq_same, Pi.single_eq_of_ne + (show (1 : Fin 2) ≠ 0 by decide), zero_smul, one_smul, + Complex.reCLM_apply, torusHeatFourierProduct] + congr 1 + ring + +theorem torusHeatFourierProduct_spatialD_one (c : ℂ) (k l : ℕ) {t : ℝ} + (ht : 0 < t) : + spatialD 1 (torusHeatFourierProduct c k l t) = + torusHeatFourierProduct (c * (2 * (Real.pi : ℂ) * Complex.I)) k (l+1) t := by + funext x + have h := Complex.reCLM.hasFDerivAt.comp x + (((moment_plane_deriv k ht x 0).const_mul c).mul (moment_plane_deriv l ht x 1)) + change HasFDerivAt (torusHeatFourierProduct c k l t) _ x at h + rw [spatialD, h.fderiv] + simp only [ContinuousLinearMap.comp_apply, add_apply, + ContinuousLinearMap.smulRight_apply, smul_apply, + ContinuousLinearMap.proj_apply, PlanarHamiltonian.basis, Pi.single_eq_same, Pi.single_eq_of_ne + (show (0 : Fin 2) ≠ 1 by decide), zero_smul, one_smul, + Complex.reCLM_apply, torusHeatFourierProduct] + congr 1 + ring + +theorem torusHeatKernel_eq_fourierProduct {t : ℝ} (ht : 0 < t) : + torusHeatKernel t = torusHeatFourierProduct 1 0 0 t := by + funext x + simpa only [torusHeatFourierProduct, one_mul, Complex.ofReal_re] using + congrArg Complex.re (torusHeatKernel_complex ht x) + +theorem torusHeatKernel_laplacian {t : ℝ} (ht : 0 < t) (x : Plane) : + scalarLaplacian (torusHeatKernel t) x = + torusHeatFourierProduct (-4 * (Real.pi : ℂ)^2) 2 0 t x + + torusHeatFourierProduct (-4 * (Real.pi : ℂ)^2) 0 2 t x := by + have hc : (1 : ℂ) * (2 * (Real.pi : ℂ) * Complex.I) * + (2 * (Real.pi : ℂ) * Complex.I) = -4 * (Real.pi : ℂ)^2 := by + ring_nf + rw [Complex.I_sq] + ring + rw [torusHeatKernel_eq_fourierProduct ht] + simp only [scalarLaplacian, Fin.sum_univ_two, + torusHeatFourierProduct_spatialD_zero _ _ _ ht, + torusHeatFourierProduct_spatialD_one _ _ _ ht, hc] + +theorem torusHeatFourierProduct_exp_smooth (c : ℂ) (k l : ℕ) : + ContDiff ℝ ∞ (fun p : ℝ × Plane => torusHeatFourierProduct c k l (Real.exp p.1) p.2) := by + have hm (m : ℕ) (j : Fin 2) : ContDiff ℝ ∞ + (fun p : ℝ × Plane => periodicHeatMoment m (Real.exp p.1, p.2 j)) := by + have h := (periodicHeatMoment_smooth m).comp + (contDiff_fst.exp.prodMk ((contDiff_apply ℝ ℝ j).comp contDiff_snd)).contDiffOn + (show MapsTo (fun p : ℝ × Plane => (Real.exp p.1, p.2 j)) univ + (Ioi (0 : ℝ) ×ˢ univ) from fun _ _ => ⟨Real.exp_pos _, mem_univ _⟩) + simpa only [Function.comp_def, contDiffOn_univ] using h + exact Complex.reCLM.contDiff.comp ((contDiff_const.mul (hm k 0)).mul (hm l 1)) + +theorem torusHeatKernel_laplacian_exp_smooth : + ContDiff ℝ ∞ (fun p : ℝ × Plane => scalarLaplacian (torusHeatKernel (Real.exp p.1)) p.2) := by + have h := (torusHeatFourierProduct_exp_smooth (-4 * (Real.pi : ℂ)^2) 2 0).add + (torusHeatFourierProduct_exp_smooth (-4 * (Real.pi : ℂ)^2) 0 2) + convert h using 1 + funext p + exact torusHeatKernel_laplacian (Real.exp_pos _) _ + +theorem torusHeatKernel_equation {t : ℝ} (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => torusHeatKernel s x) + (scalarLaplacian (torusHeatKernel t) x) t := by + have h := torusHeatFourierProduct_time 1 0 0 ht x + rw [torusHeatKernel_laplacian ht] + simp only [mul_one] at h + apply h.congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds ht] with s hs + exact congrFun (torusHeatKernel_eq_fourierProduct hs) x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLaplacianTransfer.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLaplacianTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..092831173702ecc499dcd44d2615c90509ad4f6c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLaplacianTransfer.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatTimeDerivative +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatIntegrationByParts +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Programs.TorusConvolution + +namespace OAI + +/-! Transfer of the time derivative to the Laplacian of the initial data. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set MeasureTheory +open scoped ContDiff BigOperators + +private theorem reflected_spatialD {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (x : Plane) (j : Fin 2) : + spatialD j (fun y => f (x-y)) = fun y => -spatialD j f (x-y) := by + funext y + have hm : HasFDerivAt (fun z : Plane => x-z) (-(ContinuousLinearMap.id ℝ Plane)) y := by + convert! (hasFDerivAt_const (𝕜 := ℝ) x y).sub (hasFDerivAt_id y) using 1 + simp only [zero_sub] + have h := (hf.differentiable (by simp) (x-y)).hasFDerivAt.comp y hm + change HasFDerivAt (fun y => f (x-y)) _ y at h + rw [spatialD, h.fderiv] + simp only [ContinuousLinearMap.comp_apply, neg_apply, ContinuousLinearMap.id_apply, + map_neg, spatialD] + +private theorem reflected_spatialD_twice {f : Plane → ℝ} (hf : ContDiff ℝ ∞ f) + (x : Plane) (j : Fin 2) : + spatialD j (spatialD j (fun y => f (x-y))) = + fun y => spatialD j (spatialD j f) (x-y) := by + rw [reflected_spatialD hf] + funext y + rw [spatialD, fderiv_fun_neg, neg_apply] + change -spatialD j (fun z => spatialD j f (x-z)) y = _ + rw [reflected_spatialD (spatialD_smooth j hf)] + exact neg_neg _ + +private theorem reflected_periodic {f : Plane → ℝ} (hp : PlanePeriodic f) (x : Plane) : + PlanePeriodic (fun y => f (x-y)) := by + intro y n + have he : x-(y+fun j => (n j : ℝ)) = (x-y)+fun j => ((-n j : ℤ) : ℝ) := by + ext j + simp only [Pi.sub_apply, Pi.add_apply, Int.cast_neg] + ring + change f (x-(y+fun j => (n j : ℝ))) = f (x-y) + rw [he, hp (x-y) (fun j => -n j)] + +theorem heatLaplacianIntegral_eq {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) {t : ℝ} (ht : 0 < t) (x : Plane) : + heatLaplacianIntegral g t x = torusHeatEvolution (scalarLaplacian g) t x := by + have hk : ContDiff ℝ ∞ (torusHeatKernel t) := by + have h := torusHeatKernel_smooth_positive.comp + (contDiff_const.prodMk contDiff_id).contDiffOn + (show MapsTo (fun y : Plane => (t,y)) univ (Ioi (0 : ℝ) ×ˢ univ) from + fun _ _ => ⟨ht, mem_univ _⟩) + simpa only [Function.comp_def, id_eq, contDiffOn_univ] using h + have hkr : ContDiff ℝ ∞ (fun y : Plane => torusHeatKernel t (x-y)) := + hk.comp (contDiff_const.sub contDiff_id) + have hpr := reflected_periodic (torusHeatKernel_periodic ht) x + have hj (j : Fin 2) : + (∫ y in Icc (0 : Plane) (fun _ => 1), + spatialD j (spatialD j (torusHeatKernel t)) (x-y) * g y) = + ∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x-y) * spatialD j (spatialD j g) y := by + have h := periodic_integral_mul_spatialD_twice hkr hg hpr hp j + rw [reflected_spatialD_twice hk] at h + exact h.symm + have hi₁ (j : Fin 2) : IntegrableOn (fun y : Plane => + spatialD j (spatialD j (torusHeatKernel t)) (x-y) * g y) + (Icc (0 : Plane) (fun _ => 1)) := + (((spatialD_smooth j (spatialD_smooth j hk)).comp + (contDiff_const.sub contDiff_id)).continuous.mul hg.continuous).integrableOn_Icc + have hi₂ (j : Fin 2) : IntegrableOn (fun y : Plane => + torusHeatKernel t (x-y) * spatialD j (spatialD j g) y) + (Icc (0 : Plane) (fun _ => 1)) := + (hkr.continuous.mul (spatialD_smooth j (spatialD_smooth j hg)).continuous).integrableOn_Icc + rw [heatLaplacianIntegral, torusHeatEvolution, ite_eq_right (not_le.mpr ht)] + simp only [scalarLaplacian, Finset.sum_mul, Finset.mul_sum] + rw [integral_finsetSum Finset.univ (fun j _ => hi₁ j), + integral_finsetSum Finset.univ (fun j _ => hi₂ j)] + exact Finset.sum_congr rfl (fun j _ => hj j) + +theorem torusHeatEvolution_time_data {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) {t : ℝ} (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => torusHeatEvolution g s x) + (torusHeatEvolution (scalarLaplacian g) t x) t := by + rw [← heatLaplacianIntegral_eq hg hp ht x] + exact torusHeatEvolution_hasDerivAt hg.continuous ht x + +theorem torusHeatEvolution_add_direct {f g : Plane → ℝ} (hf : Continuous f) (hg : Continuous g) + (t : ℝ) (x : Plane) : + torusHeatEvolution (f+g) t x = torusHeatEvolution f t x + torusHeatEvolution g t x := by + by_cases ht : t ≤ 0 + · simp only [torusHeatEvolution, ite_eq_left ht, Pi.add_apply] + · have hk : Continuous (fun y : Plane => torusHeatKernel t (x-y)) := + (torusHeatKernel_continuous (lt_of_not_ge ht)).comp (continuous_const.sub continuous_id) + simp only [torusHeatEvolution, ite_eq_right ht, Pi.add_apply, mul_add] + exact integral_add (hk.mul hf).integrableOn_Icc (hk.mul hg).integrableOn_Icc + +theorem torusHeatEvolution_laplacian {g : Plane → ℝ} (hg : ContDiff ℝ ∞ g) + (hp : PlanePeriodic g) (t : ℝ) : + scalarLaplacian (torusHeatEvolution g t) = torusHeatEvolution (scalarLaplacian g) t := by + have hj (j : Fin 2) : spatialD j (spatialD j (torusHeatEvolution g t)) = + torusHeatEvolution (spatialD j (spatialD j g)) t := by + rw [torusHeatEvolution_spatialD hg hp, + torusHeatEvolution_spatialD (spatialD_smooth j hg) (spatialD_periodic hg hp j)] + have he : scalarLaplacian g = spatialD 0 (spatialD 0 g) + spatialD 1 (spatialD 1 g) := by + funext x + simp only [scalarLaplacian, Fin.sum_univ_two, Pi.add_apply] + funext x + rw [he, torusHeatEvolution_add_direct + (spatialD_smooth 0 (spatialD_smooth 0 hg)).continuous + (spatialD_smooth 1 (spatialD_smooth 1 hg)).continuous] + simp only [scalarLaplacian, Fin.sum_univ_two, hj] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLattice.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1b5969067052a3e560b6db0d32452c9518a4608 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatLattice.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatInput +import Mathlib.NumberTheory.ModularForms.JacobiTheta.Bounds +import Mathlib.Analysis.Normed.Group.FunctionSeries +import Mathlib.Analysis.Normed.Ring.InfiniteSum + +namespace OAI + +/-! Summability, factorization and continuity of the actual periodized Gaussian. +These lemmas address the heat-kernel input, without assuming a heat equation. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped ContDiff BigOperators + +def gaussianLattice (t x : ℝ) : ℝ := + ∑' n : ℤ, Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t)) + +theorem gaussianLattice_summable {t : ℝ} (ht : 0 < t) (x : ℝ) : + Summable (fun n : ℤ => Real.exp (-((x + (n : ℝ)) ^ 2) / (4 * t))) := by + have h := HurwitzKernelBounds.summable_f_int 0 x + (t := 1 / (4 * Real.pi * t)) (by positivity) + apply h.congr + intro n + simp only [HurwitzKernelBounds.f_int, pow_zero, one_mul] + congr 1 + field_simp [ht.ne', Real.pi_ne_zero] + ring + +theorem torusHeatKernel_factor {t : ℝ} (ht : 0 < t) (x : Plane) : + torusHeatKernel t x = (4 * Real.pi * t)⁻¹ * + (gaussianLattice t (x 0) * gaussianLattice t (x 1)) := by + unfold torusHeatKernel gaussianLattice + congr 1 + calc + (∑' k : Fin 2 → ℤ, Real.exp (-(∑ j : Fin 2, (x j + (k j : ℝ)) ^ 2) / (4 * t))) = + ∑' k : Fin 2 → ℤ, Real.exp (-((x 0 + (k 0 : ℝ)) ^ 2) / (4 * t)) * + Real.exp (-((x 1 + (k 1 : ℝ)) ^ 2) / (4 * t)) := by + apply tsum_congr + intro k + rw [← Real.exp_add] + congr 1 + simp only [Fin.sum_univ_two] + ring + _ = ∑' p : ℤ × ℤ, Real.exp (-((x 0 + (p.1 : ℝ)) ^ 2) / (4 * t)) * + Real.exp (-((x 1 + (p.2 : ℝ)) ^ 2) / (4 * t)) := + (finTwoArrowEquiv ℤ).tsum_eq (fun p : ℤ × ℤ => + Real.exp (-((x 0 + (p.1 : ℝ)) ^ 2) / (4 * t)) * + Real.exp (-((x 1 + (p.2 : ℝ)) ^ 2) / (4 * t))) + _ = _ := (tsum_mul_tsum_of_summable_norm + (gaussianLattice_summable ht (x 0)).norm + (gaussianLattice_summable ht (x 1)).norm).symm + +theorem gaussianLattice_continuous {t : ℝ} (ht : 0 < t) : Continuous (gaussianLattice t) := by + apply continuous_iff_continuousAt.mpr + intro x₀ + let M := |x₀| + 1 + let u := fun n : ℤ => Real.exp (M ^ 2 / (4 * t)) * Real.exp (-((n : ℝ) ^ 2) / (8 * t)) + have hu : Summable u := by + have hs := (gaussianLattice_summable (t := 2 * t) (by positivity) 0).mul_left + (Real.exp (M ^ 2 / (4 * t))) + simpa only [u, zero_add, ← mul_assoc, show (4 : ℝ) * 2 = 8 by norm_num] using hs + have hc : ContinuousOn (gaussianLattice t) (Metric.ball x₀ 1) := by + apply continuousOn_tsum (u := u) + · intro n + exact (((continuous_id.add continuous_const).pow 2).neg.div_const (4 * t)).rexp.continuousOn + · exact hu + · intro n x hx + have hx' : |x - x₀| < 1 := by simpa only [Metric.mem_ball, Real.dist_eq] using hx + have hxM : |x| ≤ M := by + dsimp only [M] + calc + |x| ≤ |x - x₀| + |x₀| := by simpa only [sub_add_cancel] using abs_add_le (x - x₀) x₀ + _ ≤ |x₀| + 1 := by linarith + have hM : 0 ≤ M := by dsimp only [M]; positivity + have hsq : (n : ℝ) ^ 2 ≤ 2 * (x + (n : ℝ)) ^ 2 + 2 * M ^ 2 := by + have hxx : x ^ 2 ≤ M ^ 2 := by + simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg x) hM).mpr hxM + nlinarith [sq_nonneg ((n : ℝ) + 2 * x)] + have he : -((x + (n : ℝ)) ^ 2) / (4 * t) ≤ + M ^ 2 / (4 * t) + -((n : ℝ) ^ 2) / (8 * t) := by + calc + _ = (-2 * (x + (n : ℝ)) ^ 2) / (8 * t) := by + field_simp + ring + _ ≤ (2 * M ^ 2 - (n : ℝ) ^ 2) / (8 * t) := + div_le_div_of_nonneg_right (by linarith) (by positivity) + _ = _ := by + field_simp + ring + dsimp only [u] + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), ← Real.exp_add] + exact Real.exp_le_exp.mpr he + exact hc.continuousAt (Metric.ball_mem_nhds x₀ zero_lt_one) + +theorem torusHeatKernel_continuous {t : ℝ} (ht : 0 < t) : + Continuous (torusHeatKernel t) := by + have he : torusHeatKernel t = fun x : Plane => (4 * Real.pi * t)⁻¹ * + (gaussianLattice t (x 0) * gaussianLattice t (x 1)) := funext (torusHeatKernel_factor ht) + rw [he] + exact continuous_const.mul (((gaussianLattice_continuous ht).comp (continuous_apply 0)).mul + ((gaussianLattice_continuous ht).comp (continuous_apply 1))) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatMass.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..09a4dd8a628fa844c9261f0852923a442cd59cc4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatMass.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatMass +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatPositiveSmooth +import Mathlib.MeasureTheory.Integral.Pi + +namespace OAI + +/-! Unit mass and the sup-norm estimate for the actual two-dimensional heat kernel. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory +open scoped BigOperators + +theorem torusHeatKernel_integral {t : ℝ} (ht : 0 < t) (x : Plane) : + (∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x - y)) = 1 := by + have hc : (∫ y in Icc (0 : Plane) (fun _ => 1), + (torusHeatKernel t (x - y) : ℂ)) = 1 := by + simp_rw [torusHeatKernel_complex ht] + have hp : (fun y : Plane => periodicHeatMoment 0 (t, (x - y) 0) * + periodicHeatMoment 0 (t, (x - y) 1)) = + (fun y => ∏ j : Fin 2, periodicHeatMoment 0 (t, x j - y j)) := by + funext y + simp [Fin.prod_univ_two] + rw [hp] + change (∫ y, ∏ j : Fin 2, periodicHeatMoment 0 (t, x j - y j) + ∂((Measure.pi (fun _ : Fin 2 => (volume : Measure ℝ))).restrict + (Icc (0 : Plane) (fun _ => 1)))) = 1 + rw [← pi_univ_Icc, Measure.restrict_pi_pi] + change (∫ y : Plane, ∏ j : Fin 2, periodicHeatMoment 0 (t, x j - y j) + ∂Measure.pi (fun _ : Fin 2 => volume.restrict (Icc (0 : ℝ) 1))) = 1 + rw [integral_fintype_prod_eq_prod (fun (j : Fin 2) (y : ℝ) => + periodicHeatMoment 0 (t, x j - y))] + simp [periodicHeatMoment_integral ht] + rw [integral_complex_ofReal] at hc + exact_mod_cast hc + +theorem torusHeatEvolution_const (c : ℝ) (t : ℝ) (x : Plane) : + torusHeatEvolution (fun _ => c) t x = c := by + by_cases ht : t ≤ 0 + · simp [torusHeatEvolution, ht] + · rw [torusHeatEvolution, ite_eq_right ht, integral_mul_const, + torusHeatKernel_integral (lt_of_not_ge ht), one_mul] + +theorem torusHeatEvolution_norm_le {g : Plane → ℝ} {B t : ℝ} + (hB : ∀ x, |g x| ≤ B) (ht : 0 < t) (x : Plane) : + |torusHeatEvolution g t x| ≤ B := by + have hK : Continuous (fun y : Plane => torusHeatKernel t (x - y)) := + (torusHeatKernel_continuous ht).comp (continuous_const.sub continuous_id) + have hi : IntegrableOn (fun y : Plane => torusHeatKernel t (x - y) * B) + (Icc (0 : Plane) (fun _ => 1)) := + (hK.mul continuous_const).continuousOn.integrableOn_compact isCompact_Icc + rw [torusHeatEvolution, ite_eq_right (not_le.mpr ht), ← Real.norm_eq_abs] + calc + ‖∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x - y) * g y‖ ≤ + ∫ y in Icc (0 : Plane) (fun _ => 1), torusHeatKernel t (x - y) * B := by + apply norm_integral_le_of_norm_le hi + exact ae_of_all _ fun y => by + rw [norm_mul, Real.norm_eq_abs, abs_of_nonneg (torusHeatKernel_nonneg ht _), + Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (hB y) (torusHeatKernel_nonneg ht _) + _ = B := by rw [integral_mul_const, torusHeatKernel_integral ht, one_mul] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPeriodicity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPeriodicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee33ab0565e73a5a4ff9c04f36ab75256c59ff5e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPeriodicity.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatGaussianBound + +namespace OAI + +/-! The prescribed Gaussian convolution has the exact initial value and +preserves the unit spatial periods. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory + +theorem torusHeatKernel_periodic {t : ℝ} (ht : 0 < t) : + PlanePeriodic (torusHeatKernel t) := by + intro x n + rw [torusHeatKernel_factor ht, torusHeatKernel_factor ht] + simp only [Pi.add_apply, gaussianLattice_add_int] + +theorem torusHeatEvolution_initial (g : Plane → ℝ) : torusHeatEvolution g 0 = g := by + funext x + simp only [torusHeatEvolution, le_refl, ↓reduceIte] + +theorem torusHeatEvolution_periodic {g : Plane → ℝ} (hg : PlanePeriodic g) (t : ℝ) : + PlanePeriodic (torusHeatEvolution g t) := by + intro x n + by_cases ht : t ≤ 0 + · simpa only [torusHeatEvolution, ite_eq_left ht] using hg x n + · simp only [torusHeatEvolution, ite_eq_right ht] + apply integral_congr_ae + filter_upwards [] with y + have he : (x + fun j => (n j : ℝ)) - y = (x - y) + fun j => (n j : ℝ) := by + ext j + simp only [Pi.add_apply, Pi.sub_apply] + ring + rw [he, torusHeatKernel_periodic (lt_of_not_ge ht) (x - y) n] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPositiveSmooth.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPositiveSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..6643a60ba772300ed1094ca4751bed688d364cfc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatPositiveSmooth.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatPoisson +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PeriodicHeatEquation + +namespace OAI + +/-! Joint smoothness of the explicitly prescribed torus kernel for positive + time, obtained from its convergent Fourier series. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem torusHeatKernel_complex {t : ℝ} (ht : 0 < t) (x : Plane) : + (torusHeatKernel t x : ℂ) = + periodicHeatMoment 0 (t, x 0) * periodicHeatMoment 0 (t, x 1) := by + rw [torusHeatKernel_factor ht, periodicHeatMoment_zero_gaussian ht, + periodicHeatMoment_zero_gaussian ht] + have hs : (Real.sqrt (4 * Real.pi * t) : ℂ) ^ 2 = (4 * Real.pi * t : ℝ) := by + exact_mod_cast Real.sq_sqrt (show 0 ≤ 4 * Real.pi * t by positivity) + calc + _ = ((Real.sqrt (4 * Real.pi * t) : ℂ) ^ 2)⁻¹ * + ((gaussianLattice t (x 0) : ℂ) * (gaussianLattice t (x 1) : ℂ)) := by + rw [hs] + push_cast + rfl + _ = _ := by rw [← inv_pow]; ring + +theorem torusHeatKernel_smooth_positive : + ContDiffOn ℝ ∞ (fun p : ℝ × Plane => torusHeatKernel p.1 p.2) + (Ioi (0 : ℝ) ×ˢ univ) := by + have hm (j : Fin 2) : ContDiffOn ℝ ∞ + (fun p : ℝ × Plane => periodicHeatMoment 0 (p.1, p.2 j)) + (Ioi (0 : ℝ) ×ˢ univ) := by + exact (periodicHeatMoment_smooth 0).comp + (contDiff_fst.prodMk ((contDiff_apply ℝ ℝ j).comp contDiff_snd)).contDiffOn + (fun p hp => ⟨hp.1, mem_univ _⟩) + have h := Complex.reCLM.contDiff.comp_contDiffOn ((hm 0).mul (hm 1)) + apply h.congr + intro p hp + exact congrArg Complex.re (torusHeatKernel_complex hp.1 p.2) + +theorem torusHeatKernel_exp_smooth : + ContDiff ℝ ∞ (fun p : ℝ × Plane => torusHeatKernel (Real.exp p.1) p.2) := by + have h := torusHeatKernel_smooth_positive.comp + (contDiff_fst.exp.prodMk contDiff_snd).contDiffOn + (show MapsTo (fun p : ℝ × Plane => (Real.exp p.1, p.2)) univ + (Ioi (0 : ℝ) ×ˢ univ) from fun p _ => ⟨Real.exp_pos _, mem_univ _⟩) + simpa only [Function.comp_def, contDiffOn_univ] using h + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatSolution.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb555a18b207b617cdaf35fc65b5569dc3456292 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatSolution.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatBoundaryRegularity +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatGaussianBound + +namespace OAI + +/-! The periodic Gaussian heat evolution solves the scalar heat equation. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set +open scoped ContDiff + +theorem torusHeatEvolution_solution (T : ℝ) (g : Plane → ℝ) + (hg : ContDiff ℝ ∞ g) (hp : PlanePeriodic g) : + TorusScalarSolution T 1 (fun _ _ => 0) (fun _ _ => 0) (torusHeatEvolution g) g := by + refine ⟨(torusHeatEvolution_contDiffOn hg hp).mono (fun _ h => ⟨h.1.1, h.2⟩), + fun t _ => torusHeatEvolution_periodic hp t, torusHeatEvolution_initial g, ?_⟩ + intro t ht x + have hd := torusHeatEvolution_hasFDerivWithinAt hg hp + (show (t,x) ∈ Ici (0 : ℝ) ×ˢ (univ : Set Plane) from ⟨ht.1, mem_univ _⟩) + have hl : HasDerivWithinAt (fun s : ℝ => (s,x)) (1,0) (Icc 0 T) t := + (hasDerivAt_id t).hasDerivWithinAt.prodMk (hasDerivWithinAt_const t (Icc 0 T) x) + have h := hd.comp_hasDerivWithinAt t hl + (show MapsTo (fun s : ℝ => (s,x)) (Icc 0 T) (Ici (0 : ℝ) ×ˢ univ) from + fun s hs => ⟨hs.1, mem_univ _⟩) + change HasDerivWithinAt (fun s => torusHeatEvolution g s x) _ (Icc 0 T) t at h + simpa only [torusHeatDerivative_apply, one_mul, Pi.zero_apply, zero_mul, + Finset.sum_const_zero, add_zero, scalarGenerator, one_mul, + ContinuousLinearMap.map_zero, sub_zero, torusHeatEvolution_laplacian hg hp t] using h + +/-- Maheux's two-dimensional periodic heat representation and Gaussian bound +for the lattice Gaussian and convolution. -/ +theorem torusHeatInput : TorusHeatInput where + continuous := fun _ ht => torusHeatKernel_continuous ht + solution := fun T _ g hg hp => torusHeatEvolution_solution T g hg hp + gaussian := fun _ ht x => torusHeatKernel_gaussian ht x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatTimeDerivative.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatTimeDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..f024f6474bf73616af1d5041dd3a3ae4799de2ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusHeatTimeDerivative.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.TorusHeatKernelEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.ScalarMassEvolution + +namespace OAI + +/-! Time differentiation of the prescribed heat convolution at positive time. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set MeasureTheory Filter +open scoped Topology ContDiff + +def heatLaplacianIntegral (g : Plane → ℝ) (t : ℝ) (x : Plane) : ℝ := + ∫ y in Icc (0 : Plane) (fun _ => 1), scalarLaplacian (torusHeatKernel t) (x-y) * g y + +theorem torusHeatEvolution_log_hasDerivAt {g : Plane → ℝ} (hg : Continuous g) + (s : ℝ) (x : Plane) : + HasDerivAt (fun r => torusHeatEvolution g (Real.exp r) x) + (Real.exp s * heatLaplacianIntegral g (Real.exp s) x) s := by + let W : ℝ → Plane → ℝ := fun r y => torusHeatKernel (Real.exp r) (x-y) * g y + let D : ℝ → Plane → ℝ := fun r y => + Real.exp r * (scalarLaplacian (torusHeatKernel (Real.exp r)) (x-y) * g y) + have hi : ContDiff ℝ ∞ (fun p : ℝ × Plane => (p.1, x-p.2)) := + contDiff_fst.prodMk (contDiff_const.sub contDiff_snd) + have hW : Continuous (Function.uncurry W) := + (torusHeatKernel_exp_smooth.comp hi).continuous.mul (hg.comp continuous_snd) + have hD : Continuous (Function.uncurry D) := + (Real.continuous_exp.comp continuous_fst).mul + ((torusHeatKernel_laplacian_exp_smooth.comp hi).continuous.mul + (hg.comp continuous_snd)) + have hd (r : ℝ) (y : Plane) : HasDerivAt (fun u => W u y) (D r y) r := by + have h := ((torusHeatKernel_equation (Real.exp_pos r) (x-y)).comp r + (Real.hasDerivAt_exp r)).mul_const (g y) + change HasDerivAt (fun u => W u y) _ r at h + convert! h using 1 + dsimp [D] + ring + have h := scalarMass_hasDerivAt hW hD hd s + have he : (fun r => torusHeatEvolution g (Real.exp r) x) = scalarMass W := by + funext r + rw [torusHeatEvolution, ite_eq_right (not_le.mpr (Real.exp_pos r))] + rfl + rw [he] + convert h using 1 + dsimp [scalarMass, D, heatLaplacianIntegral] + rw [integral_const_mul] + +theorem torusHeatEvolution_hasDerivAt {g : Plane → ℝ} (hg : Continuous g) + {t : ℝ} (ht : 0 < t) (x : Plane) : + HasDerivAt (fun s => torusHeatEvolution g s x) (heatLaplacianIntegral g t x) t := by + have h := (torusHeatEvolution_log_hasDerivAt hg (Real.log t) x).comp t + (Real.hasDerivAt_log ht.ne') + have he : (Real.exp (Real.log t) * heatLaplacianIntegral g (Real.exp (Real.log t)) x) * + t⁻¹ = heatLaplacianIntegral g t x := by + rw [Real.exp_log ht] + field_simp + rw [he] at h + apply h.congr_of_eventuallyEq + filter_upwards [Ioi_mem_nhds ht] with s hs + simp only [Function.comp_def, Real.exp_log hs] + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarDischarge.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarDischarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..27df08a40ec6affb0e209addf3a76f38a8990627 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarDischarge.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildDataFields +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildJointSmooth +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildActualEquation +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.PlaneScalarMildPeriodicity + +namespace OAI + +/-! Scalar existence on the torus via periodic Gaussian mild solutions. -/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows Set PlaneScalarMild +open scoped Topology ContDiff + +theorem torusScalarExistence : TorusScalarExistence := by + intro T ν hT hν a h w₀ ha hh hw hpa hph hpw + have hpb := driftCoefficients_periodic ha hpa + obtain ⟨D,hinit,hs,hb⟩ := exists_periodic_data hT.le hw hpw hh hph + (driftCoefficients_smooth ha) hpb + have htime := D.periodic_solutionJetValue_smooth_time hT hν hh hph + (driftCoefficients_smooth ha) hpb hs hb + refine ⟨D.solutionValue hT.le hν, D.solutionValue_smooth hT hν htime, ?_, ?_, ?_⟩ + · intro t _ + exact D.solution_periodic_of_representatives hT.le hν hpw hph hpb hinit hs hb + (projIcc 0 T hT.le t) + · funext x + change D.solution hT.le hν (projIcc 0 T hT.le 0) x = w₀ x + rw [projIcc_of_mem hT.le (show (0 : ℝ) ∈ Icc 0 T from ⟨le_rfl,hT.le⟩)] + exact (D.solution_initial hT.le hν x).trans (hinit 0 x) + · intro t ht x + exact D.solutionValue_equation hT.le hν ha hs hb ht x + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarInput.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d56ca2352bbedfa75b75537e02d61f7abcf6ccf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/TorusScalarInput.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Flow.PlanarPeriodicProperties + +namespace OAI + +/-! Classical scalar advection-diffusion on the flat two-torus. + +Mantegazza and Martinazzi, A note on quasilinear parabolic equations on +manifolds, Ann. Sc. Norm. Super. Pisa (5) 11 (2012), 857--874, +Proposition 2.3 and Remark 2.4 (p. 861), specialized to the flat two-torus, +second order, constant positive diffusion and a prescribed smooth drift. +Finite-time coefficients can be extended with a time cutoff before applying +the globally bounded-coefficient result. +-/ + +noncomputable section +namespace ForcedComputation.VelocityDetector +open ShearFlows PlanarHamiltonian Set +open scoped ContDiff + +def scalarLaplacian (w : Plane → ℝ) (x : Plane) : ℝ := + ∑ j : Fin 2, spatialD j (spatialD j w) x + +def scalarGenerator (ν : ℝ) (a : Plane → Plane) (w : Plane → ℝ) (x : Plane) : ℝ := + ν * scalarLaplacian w x - fderiv ℝ w x (a x) + +/-- Smoothness and the actual scalar equation on a finite closed cylinder. +The time derivative is one-sided at its two endpoints. -/ +structure TorusScalarSolution (T ν : ℝ) (a : ℝ → Plane → Plane) + (h w : ℝ → Plane → ℝ) (w₀ : Plane → ℝ) : Prop where + smooth : ContDiffOn ℝ ∞ (Function.uncurry w) (Icc 0 T ×ˢ univ) + periodic : ∀ t ∈ Icc 0 T, PlanePeriodic (w t) + initial : w 0 = w₀ + equation : ∀ t ∈ Icc 0 T, ∀ x, + HasDerivWithinAt (fun s => w s x) + (scalarGenerator ν (a t) (w t) x + h t x) (Icc 0 T) t + +theorem TorusScalarSolution.slice_smooth {T ν : ℝ} {a : ℝ → Plane → Plane} + {h w : ℝ → Plane → ℝ} {w₀ : Plane → ℝ} + (hw : TorusScalarSolution T ν a h w w₀) {t : ℝ} (ht : t ∈ Icc 0 T) : + ContDiff ℝ ∞ (w t) := by + have hi : ContDiff ℝ ∞ (fun x : Plane => (t, x)) := + contDiff_const.prodMk contDiff_id + have hh := hw.smooth.comp hi.contDiffOn + (show MapsTo (fun x : Plane => (t, x)) univ (Icc 0 T ×ˢ univ) from + fun x _ => ⟨ht, mem_univ x⟩) + simpa only [Function.comp_def, Function.uncurry_apply_pair, contDiffOn_univ] using hh + +/-- Classical existence for smooth periodic scalar advection-diffusion on a +finite time cylinder. -/ +def TorusScalarExistence : Prop := + ∀ (T ν : ℝ), 0 < T → 0 < ν → + ∀ (a : ℝ → Plane → Plane) (h : ℝ → Plane → ℝ) (w₀ : Plane → ℝ), + ContDiff ℝ ∞ (Function.uncurry a) → + ContDiff ℝ ∞ (Function.uncurry h) → ContDiff ℝ ∞ w₀ → + (∀ t, PlanePeriodic (a t)) → (∀ t, PlanePeriodic (h t)) → PlanePeriodic w₀ → + ∃ w, TorusScalarSolution T ν a h w w₀ + +theorem scalarLaplacian_zero (x : Plane) : scalarLaplacian (fun _ => 0) x = 0 := by + have hd (j : Fin 2) : spatialD j (fun _ : Plane => (0 : ℝ)) = fun _ => 0 := by + funext y + simp [spatialD] + simp only [scalarLaplacian, hd, Finset.sum_const_zero] + +theorem scalarGenerator_zero (ν : ℝ) (a : Plane → Plane) (x : Plane) : + scalarGenerator ν a (fun _ => 0) x = 0 := by + simp [scalarGenerator, scalarLaplacian_zero] + +theorem zero_solution (T ν : ℝ) (a : ℝ → Plane → Plane) : + TorusScalarSolution T ν a (fun _ _ => 0) (fun _ _ => 0) (fun _ => 0) := by + refine ⟨contDiffOn_const, fun _ _ _ _ => rfl, rfl, ?_⟩ + intro t _ x + simpa only [scalarGenerator_zero, add_zero] using + (hasDerivWithinAt_const t (Icc (0 : ℝ) T) (0 : ℝ)) + +end ForcedComputation.VelocityDetector + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/VolterraDifferentiation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/VolterraDifferentiation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c182e64c746ecd03f1558c106367ea7196c93e8d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/VolterraDifferentiation.lean @@ -0,0 +1,62 @@ +import Mathlib.Analysis.Calculus.ParametricIntervalIntegral +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! The moving-endpoint part of differentiation of a Volterra integral. -/ + +noncomputable section +namespace ForcedComputation +open Set Filter MeasureTheory +open scoped Topology Interval + +variable (F : Type*) [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + +/-- Joint continuity is enough for the derivative of an integral over a shrinking +interval, even when its integrand depends on the moving endpoint. -/ +theorem hasDerivAt_shrinking_integral (f : ℝ → ℝ → F) + (hf : Continuous (Function.uncurry f)) (a : ℝ) : + HasDerivAt (fun t => ∫ s in a..t, f t s) (f a a) a := by + let g : ℝ → F := fun t => ∫ r in (0:ℝ)..1, f t (a+(t-a)*r) + have hc : Continuous (fun p : ℝ × ℝ => f p.1 (a+(p.1-a)*p.2)) := + hf.comp (continuous_fst.prodMk + (continuous_const.add ((continuous_fst.sub continuous_const).mul continuous_snd))) + have hg : Continuous g := + intervalIntegral.continuous_parametric_intervalIntegral_of_continuous' + (f := fun t r => f t (a+(t-a)*r)) (μ := volume) hc 0 1 + have hg0 : g a = f a a := by + simp [g] + have he (t : ℝ) : (∫ s in a..t, f t s) = (t-a) • g t := by + have h := intervalIntegral.smul_integral_comp_add_mul (f t) (t-a) a + (a := (0:ℝ)) (b := 1) + simpa only [mul_zero, add_zero, mul_one, add_sub_cancel] using h.symm + apply hasDerivAt_iff_tendsto_slope.mpr + have ht : Tendsto g (𝓝[≠] a) (𝓝 (f a a)) := by + rw [← hg0] + exact hg.continuousAt.mono_left nhdsWithin_le_nhds + apply ht.congr' + filter_upwards [self_mem_nhdsWithin] with t ht + have hta : t-a ≠ 0 := sub_ne_zero.mpr ht + simp only [slope_def_module, he, sub_self, zero_smul, sub_zero, + smul_smul, inv_mul_cancel₀ hta, one_smul] + +/-- Leibniz' rule after the fixed-endpoint derivative has been justified by +dominated differentiation. -/ +theorem hasDerivAt_volterra_of_fixed (f : ℝ → ℝ → F) + (hf : Continuous (Function.uncurry f)) (a t : ℝ) (d : F) + (hd : HasDerivAt (fun u => ∫ s in a..t, f u s) d t) : + HasDerivAt (fun u => ∫ s in a..u, f u s) (d + f t t) t := by + have hb := hasDerivAt_shrinking_integral F f hf t + apply (hd.add hb).congr_of_eventuallyEq + apply Eventually.of_forall + intro u + exact (intervalIntegral.integral_add_adjacent_intervals + ((hf.comp (continuous_const.prodMk continuous_id)).intervalIntegrable a t) + ((hf.comp (continuous_const.prodMk continuous_id)).intervalIntegrable t u)).symm + +end ForcedComputation + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularContinuity.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bdfdbb6aaad11ff806f64734ef772c869a23806 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularContinuity.lean @@ -0,0 +1,155 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.WeaklySingularIntegral +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +/-! Continuity of a Volterra integral with an inverse-square-root operator singularity. -/ + +noncomputable section +namespace ForcedComputation.WeaklySingular + +open Real MeasureTheory Set Filter +open scoped Topology Interval + +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + +private theorem scale_inverseSqrt {t : ℝ} (ht : 0 ≤ t) (r : ℝ) : + t * inverseSqrt (t * r) = Real.sqrt t * inverseSqrt r := by + have he : t * (Real.sqrt t)⁻¹ = Real.sqrt t := by + by_cases hz : t = 0 + · simp [hz] + · have hs : Real.sqrt t ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (lt_of_le_of_ne ht (Ne.symm hz))) + change t / Real.sqrt t = Real.sqrt t + exact (div_eq_iff hs).mpr (Real.mul_self_sqrt ht).symm + unfold inverseSqrt + rw [Real.sqrt_mul ht, mul_inv_rev] + calc + _ = (t * (Real.sqrt t)⁻¹) * (Real.sqrt r)⁻¹ := by ring + _ = _ := by rw [he] + +private def scaled (K : ℝ → E →L[ℝ] E) (u : ℝ → E) (t r : ℝ) : E := + t • K (t * (1 - r)) (u (t * r)) + +private theorem volterra_eq_scaled (K : ℝ → E →L[ℝ] E) (u : ℝ → E) (t : ℝ) : + volterra E K u t = ∫ r in 0..1, scaled E K u t r := by + have he : (fun r => scaled E K u t r) = + fun r => t • (fun s => K (t - s) (u s)) (t * r) := by + funext r + dsimp only [scaled] + rw [show t * (1 - r) = t - t * r by ring] + rw [he, intervalIntegral.integral_smul] + symm + simpa only [mul_zero, mul_one, volterra] using + intervalIntegral.smul_integral_comp_mul_left (fun s => K (t - s) (u s)) t + (a := (0 : ℝ)) (b := 1) + +private theorem norm_scaled_le (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (C B : ℝ) (hC : 0 ≤ C) + (hK : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (hu : ∀ s, ‖u s‖ ≤ B) {t : ℝ} (ht : 0 ≤ t) {r : ℝ} (hr : r ∈ Icc 0 1) : + ‖scaled E K u t r‖ ≤ C * B * Real.sqrt t * inverseSqrt (1 - r) := by + have hp : 0 ≤ t * (1 - r) := mul_nonneg ht (sub_nonneg.mpr hr.2) + calc + _ = t * ‖K (t * (1 - r)) (u (t * r))‖ := by + rw [scaled, norm_smul, Real.norm_eq_abs, abs_of_nonneg ht] + _ ≤ t * ((C * inverseSqrt (t * (1 - r))) * B) := + mul_le_mul_of_nonneg_left + (((K (t * (1 - r))).le_opNorm (u (t * r))).trans + (mul_le_mul (hK _ hp) (hu _) (norm_nonneg _) + (mul_nonneg hC (inverseSqrt_nonneg _)))) ht + _ = C * B * (t * inverseSqrt (t * (1 - r))) := by ring + _ = _ := by rw [scale_inverseSqrt ht]; ring + +private theorem scaled_continuousAt_parameter (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (hK : ContinuousOn K (Ioi 0)) (hu : Continuous u) {t : ℝ} (ht : 0 < t) + {r : ℝ} (hr : r < 1) : ContinuousAt (fun s => scaled E K u s r) t := by + have hp : 0 < t * (1 - r) := mul_pos ht (sub_pos.mpr hr) + have harg : ContinuousAt (fun s : ℝ => s * (1 - r)) t := + continuousAt_id.mul continuousAt_const + have hk : ContinuousAt (fun s : ℝ => K (s * (1 - r))) t := + (hK.continuousAt (Ioi_mem_nhds hp)).comp (f := fun s : ℝ => s * (1 - r)) harg + have hsrc : ContinuousAt (fun s : ℝ => u (s * r)) t := + hu.continuousAt.comp (continuousAt_id.mul continuousAt_const) + exact continuousAt_id.smul (hk.clm_apply hsrc) + +private theorem scaled_measurable (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (hK : ContinuousOn K (Ioi 0)) (hu : Continuous u) {t : ℝ} (ht : 0 < t) : + AEStronglyMeasurable (scaled E K u t) (volume.restrict (Ι (0 : ℝ) 1)) := by + have hc : ContinuousOn (scaled E K u t) (Ioo 0 1) := by + intro r hr + have hp : 0 < t * (1 - r) := mul_pos ht (sub_pos.mpr hr.2) + have harg : ContinuousAt (fun q : ℝ => t * (1 - q)) r := + continuousAt_const.mul (continuousAt_const.sub continuousAt_id) + have hk : ContinuousAt (fun q : ℝ => K (t * (1 - q))) r := + (hK.continuousAt (Ioi_mem_nhds hp)).comp (f := fun q : ℝ => t * (1 - q)) harg + have hsrc : ContinuousAt (fun r : ℝ => u (t * r)) r := + hu.continuousAt.comp (continuousAt_const.mul continuousAt_id) + exact (continuousAt_const.smul (hk.clm_apply hsrc)).continuousWithinAt + rw [uIoc_of_le (zero_le_one : (0 : ℝ) ≤ 1), ← restrict_Ioo_eq_restrict_Ioc] + exact hc.aestronglyMeasurable measurableSet_Ioo + +/-- Positive-time continuity follows by moving the integral to a fixed unit interval. -/ +theorem continuousAt_volterra (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (hK : ContinuousOn K (Ioi 0)) (hu : Continuous u) + (C B : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (hub : ∀ s, ‖u s‖ ≤ B) {t : ℝ} (ht : 0 < t) : + ContinuousAt (volterra E K u) t := by + have hB : 0 ≤ B := (norm_nonneg (u 0)).trans (hub 0) + have hI : Ioo (t / 2) (2 * t) ∈ 𝓝 t := Ioo_mem_nhds (by linarith) (by linarith) + have hc : ContinuousAt (fun s => ∫ r in 0..1, scaled E K u s r) t := by + apply intervalIntegral.continuousAt_of_dominated_interval + (bound := fun r => (C * B * Real.sqrt (2 * t)) * inverseSqrt (1 - r)) + · filter_upwards [hI] with s hs + exact scaled_measurable E K u hK hu (by linarith [hs.1]) + · filter_upwards [hI] with s hs + exact ae_of_all _ fun r hr => by + rw [uIoc_of_le (zero_le_one : (0 : ℝ) ≤ 1)] at hr + have hs₀ : 0 ≤ s := by linarith [hs.1] + apply (norm_scaled_le E K u C B hC hbound hub hs₀ ⟨hr.1.le, hr.2⟩).trans + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt hs.2.le) (mul_nonneg hC hB)) + (inverseSqrt_nonneg _) + · exact (inverseSqrt_sub_intervalIntegrable (zero_le_one : (0 : ℝ) ≤ 1)).const_mul _ + · filter_upwards [(volume.ae_ne (1 : ℝ))] with r hr hrs + rw [uIoc_of_le (zero_le_one : (0 : ℝ) ≤ 1)] at hrs + exact scaled_continuousAt_parameter E K u hK hu ht (lt_of_le_of_ne hrs.2 hr) + have he : volterra E K u = fun s => ∫ r in 0..1, scaled E K u s r := + funext (volterra_eq_scaled E K u) + rw [he] + exact hc + +/-- The O(sqrt(t)) estimate supplies the missing continuity at the initial endpoint. -/ +theorem continuousWithinAt_volterra_zero (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (C B : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (hub : ∀ s, ‖u s‖ ≤ B) : + ContinuousWithinAt (volterra E K u) (Ici 0) 0 := by + have hzero : volterra E K u 0 = 0 := by simp [volterra] + rw [ContinuousWithinAt, hzero, tendsto_zero_iff_norm_tendsto_zero] + apply squeeze_zero' (Eventually.of_forall fun _ => norm_nonneg _) + · filter_upwards [self_mem_nhdsWithin] with t ht + exact norm_volterra_le E ht K u C B hC (fun r hr => hbound r hr.1) + (fun s _ => hub s) + · have h : Tendsto Real.sqrt (𝓝[Ici (0 : ℝ)] 0) (𝓝 (Real.sqrt 0)) := + (Real.continuous_sqrt.tendsto 0).mono_left inf_le_left + simpa only [Real.sqrt_zero, mul_zero] using h.const_mul (2 * C * B) + +/-- A bounded continuous source produces a continuous Volterra path on every finite time interval. -/ +theorem continuousOn_volterra (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (hK : ContinuousOn K (Ioi 0)) (hu : Continuous u) + (C B : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (hub : ∀ s, ‖u s‖ ≤ B) : ContinuousOn (volterra E K u) (Ici 0) := by + intro t ht + change 0 ≤ t at ht + rcases eq_or_lt_of_le ht with h | h + · subst t + exact continuousWithinAt_volterra_zero E K u C B hC hbound hub + · exact (continuousAt_volterra E K u hK hu C B hC hbound hub h).continuousWithinAt + +end ForcedComputation.WeaklySingular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularEquation.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..48e543205fefd29978164465b80958b8c26289e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularEquation.lean @@ -0,0 +1,238 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.WeaklySingularWeighted +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.JetVolterraFixedPoint + +namespace OAI + +/-! Linear Volterra equations with finitely many continuous time-dependent coefficients. -/ + +noncomputable section +namespace ForcedComputation.WeaklySingular + +open Real MeasureTheory Set Filter +open scoped Topology Interval BigOperators + +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- Pointwise action of a continuous coefficient on a continuous path. -/ +def coefficientOperator {T : ℝ} (A : C(Icc (0 : ℝ) T, E →L[ℝ] E)) : + Path E T →L[ℝ] Path E T := + LinearMap.mkContinuous + { toFun := fun u => (pathEquiv E T).symm + ⟨fun t => A t (u t), A.continuous.clm_apply (pathEquiv E T u).continuous⟩ + map_add' := by + intro u v + apply (pathEquiv E T).injective + ext t + exact (A t).map_add (u t) (v t) + map_smul' := by + intro c u + apply (pathEquiv E T).injective + ext t + exact (A t).map_smul c (u t) } + ‖A‖ (by + intro u + rw [← (pathEquiv E T).norm_map] + apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg A) (norm_nonneg u))).mpr + intro t + exact ((A t).le_opNorm (u t)).trans <| + mul_le_mul (A.norm_coe_le_norm t) + ((pathEquiv E T u).norm_coe_le_norm t) (norm_nonneg _) (norm_nonneg A)) + +@[simp] theorem coefficientOperator_apply {T : ℝ} + (A : C(Icc (0 : ℝ) T, E →L[ℝ] E)) (u : Path E T) (t : Icc (0 : ℝ) T) : + coefficientOperator E A u t = A t (u t) := rfl + +theorem norm_coefficientOperator_le {T : ℝ} (A : C(Icc (0 : ℝ) T, E →L[ℝ] E)) : + ‖coefficientOperator E A‖ ≤ ‖A‖ := by + apply (coefficientOperator E A).opNorm_le_bound (norm_nonneg A) + intro u + rw [← (pathEquiv E T).norm_map] + apply (ContinuousMap.norm_le _ (mul_nonneg (norm_nonneg A) (norm_nonneg u))).mpr + intro t + exact ((A t).le_opNorm (u t)).trans <| + mul_le_mul (A.norm_coe_le_norm t) ((pathEquiv E T u).norm_coe_le_norm t) + (norm_nonneg _) (norm_nonneg A) + +/-- Multiplication by an exponential scalar weight on the time interval. -/ +def weightOperator (T rate : ℝ) : Path E T →L[ℝ] Path E T := + coefficientOperator E + ⟨fun t => Real.exp (rate * (t : ℝ)) • ContinuousLinearMap.id ℝ E, + ((Real.continuous_exp.comp (continuous_const.mul continuous_subtype_val)).smul + continuous_const)⟩ + +@[simp] theorem weightOperator_apply (T rate : ℝ) (u : Path E T) (t : Icc (0 : ℝ) T) : + weightOperator E T rate u t = Real.exp (rate * (t : ℝ)) • u t := rfl + +theorem weightOperator_inverse (T rate : ℝ) (u : Path E T) : + weightOperator E T (-rate) (weightOperator E T rate u) = u := by + apply (pathEquiv E T).injective + ext t + change Real.exp (-rate * (t : ℝ)) • (Real.exp (rate * (t : ℝ)) • u t) = u t + rw [smul_smul, ← Real.exp_add] + simp only [neg_mul, neg_add_cancel, Real.exp_zero, one_smul] + +theorem weightOperator_injective (T rate : ℝ) : Function.Injective (weightOperator E T rate) := by + intro u v huv + have h := congrArg (weightOperator E T (-rate)) huv + simpa only [weightOperator_inverse] using h + +variable {ι : Type*} [Fintype ι] + +/-- A finite sum of genuine Volterra integrals with continuous coefficient paths. -/ +def familyOperator {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (rate : ℝ) (hrate : 0 ≤ rate) : + Path E T →L[ℝ] Path E T := + ∑ i, (integralOperator E hT (weightedKernel E rate (K i)) + (weightedKernel_continuous E rate (K i) (hK i)) (C i) (hC i) + (weightedKernel_bound E hrate (hC i) (K i) (hbound i))).comp (coefficientOperator E (A i)) + +theorem familyOperator_apply {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (rate : ℝ) (hrate : 0 ≤ rate) + (u : Path E T) (t : Icc (0 : ℝ) T) : + familyOperator E hT K hK C hC hbound A rate hrate u t = + ∑ i, ∫ s in 0..t.val, Real.exp (-rate * (t.val-s)) • + K i (t.val-s) (A i (projIcc 0 T hT s) (extendPath E hT u s)) := by + have hsum (v : ι → Path E T) : (∑ i, v i) t = ∑ i, v i t := by + change (ContinuousMap.evalCLM ℝ t) ((pathEquiv E T) (∑ i, v i)) = _ + simp only [map_sum] + rfl + simp only [familyOperator, sum_apply, ContinuousLinearMap.comp_apply] + rw [hsum] + apply Finset.sum_congr rfl + intro i _ + rfl + +theorem familyOperator_zero_apply {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (u : Path E T) (t : Icc (0 : ℝ) T) : + familyOperator E hT K hK C hC hbound A 0 le_rfl u t = + ∑ i, ∫ s in 0..t.val, + K i (t.val-s) (A i (projIcc 0 T hT s) (extendPath E hT u s)) := by + simpa only [neg_zero, zero_mul, Real.exp_zero, one_smul] using + familyOperator_apply E hT K hK C hC hbound A 0 le_rfl u t + +theorem norm_familyOperator_le {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (rate : ℝ) (hrate : 0 ≤ rate) : + ‖familyOperator E hT K hK C hC hbound A rate hrate‖ ≤ + (∑ i, C i * ‖A i‖) * ∫ r in 0..T, weightedProfile rate r := by + have hm : 0 ≤ ∫ r in 0..T, weightedProfile rate r := + intervalIntegral.integral_nonneg hT (fun r _ => weightedProfile_nonneg rate r) + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ i, (C i * ∫ r in 0..T, weightedProfile rate r) * ‖A i‖ := by + apply Finset.sum_le_sum + intro i _ + exact ((ContinuousLinearMap.opNorm_comp_le _ _)).trans <| + mul_le_mul (norm_weightedIntegralOperator_le E hT hrate (K i) (hK i) (hC i) (hbound i)) + (norm_coefficientOperator_le E (A i)) (norm_nonneg _) (mul_nonneg (hC i) hm) + _ = _ := by rw [Finset.sum_mul]; apply Finset.sum_congr rfl; intro i _; ring + +theorem exists_familyOperator_contraction {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) : + ∃ rate : ℝ, ∃ hrate : 0 ≤ rate, + ‖familyOperator E hT K hK C hC hbound A rate hrate‖ < 1 := by + have ht : Tendsto (fun rate : ℝ => (∑ i, C i * ‖A i‖) * + ∫ r in 0..T, weightedProfile rate r) atTop (𝓝 0) := by + simpa only [mul_zero] using (weightedProfile_integral_tendsto hT).const_mul (∑ i, C i * ‖A i‖) + have he := (tendsto_order.1 ht).2 1 zero_lt_one + obtain ⟨rate, hrate, hsmall⟩ := (eventually_ge_atTop (0 : ℝ)).and he |>.exists + exact ⟨rate, hrate, (norm_familyOperator_le E hT K hK C hC hbound A rate hrate).trans_lt hsmall⟩ + +theorem weight_familyOperator {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (rate : ℝ) (hrate : 0 ≤ rate) + (u : Path E T) : + weightOperator E T (-rate) (familyOperator E hT K hK C hC hbound A 0 le_rfl u) = + familyOperator E hT K hK C hC hbound A rate hrate (weightOperator E T (-rate) u) := by + apply (pathEquiv E T).injective + ext t + simp only [weightOperator_apply, familyOperator_apply, Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [← intervalIntegral.integral_smul] + apply intervalIntegral.integral_congr + intro s hs + rw [uIcc_of_le t.property.1] at hs + have hsT : s ∈ Icc (0 : ℝ) T := ⟨hs.1, hs.2.trans t.property.2⟩ + have hp : (projIcc 0 T hT s : ℝ) = s := by rw [projIcc_of_mem hT hsT] + have hexp : Real.exp (-rate * t.val) = + Real.exp (-rate * (t.val-s)) * Real.exp (-rate * s) := by + rw [← Real.exp_add] + congr 1 + ring + simp only [zero_mul, neg_zero, Real.exp_zero, one_smul, extendPath, weightOperator_apply, + hp, map_smul, ← smul_smul, hexp] + +variable [CompleteSpace E] + +/-- A finite family of weakly singular kernels has a unique continuous solution on any finite slab. -/ +theorem exists_unique_family_equation {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (a : Path E T) : + ∃! u : Path E T, u = a + familyOperator E hT K hK C hC hbound A 0 le_rfl u := by + obtain ⟨rate, hrate, hcontract⟩ := exists_familyOperator_contraction E hT K hK C hC hbound A + let L := familyOperator E hT K hK C hC hbound A rate hrate + let b := weightOperator E T (-rate) a + let w := JetVolterra.solution (Path E T) b L hcontract + have hw : w = b + L w := JetVolterra.solution_eq (Path E T) b L hcontract + let u := weightOperator E T rate w + have hu : weightOperator E T (-rate) u = w := weightOperator_inverse E T rate w + refine ⟨u, ?_, ?_⟩ + · apply weightOperator_injective E T (-rate) + rw [map_add, weight_familyOperator E hT K hK C hC hbound A rate hrate, hu] + exact hw + · intro v hv + have hv' : weightOperator E T (-rate) v = b + L (weightOperator E T (-rate) v) := by + calc + _ = weightOperator E T (-rate) (a + familyOperator E hT K hK C hC hbound A 0 le_rfl v) := + congrArg (weightOperator E T (-rate)) hv + _ = _ := by rw [map_add, weight_familyOperator E hT K hK C hC hbound A rate hrate] + have he := JetVolterra.solution_unique (Path E T) b L hcontract _ hv' + apply weightOperator_injective E T (-rate) + exact he.trans hu.symm + +/-- Pointwise form of the unique equation, with the actual finite sum of time integrals. -/ +theorem exists_unique_integral_equation {T : ℝ} (hT : 0 ≤ T) + (K : ι → ℝ → E →L[ℝ] E) (hK : ∀ i, ContinuousOn (K i) (Ioi 0)) + (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i r, 0 ≤ r → ‖K i r‖ ≤ C i * inverseSqrt r) + (A : ι → C(Icc (0 : ℝ) T, E →L[ℝ] E)) (a : Path E T) : + ∃! u : Path E T, ∀ t : Icc (0 : ℝ) T, u t = a t + + ∑ i, ∫ s in 0..t.val, + K i (t.val-s) (A i (projIcc 0 T hT s) (extendPath E hT u s)) := by + obtain ⟨u, hu, huniq⟩ := exists_unique_family_equation E hT K hK C hC hbound A a + refine ⟨u, ?_, ?_⟩ + · intro t + have ht := congrArg (fun v : Path E T => v t) hu + change u t = a t + familyOperator E hT K hK C hC hbound A 0 le_rfl u t at ht + simpa only [familyOperator_zero_apply] using ht + · intro v hv + apply huniq v + apply (pathEquiv E T).injective + ext t + change v t = a t + familyOperator E hT K hK C hC hbound A 0 le_rfl v t + simpa only [familyOperator_zero_apply] using hv t + +end ForcedComputation.WeaklySingular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularIntegral.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbb9bc186f8377aa662dd6f776316c5a4aab0ac5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularIntegral.lean @@ -0,0 +1,104 @@ +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic + +namespace OAI + +/-! Exact integrability and norm bounds for an inverse-square-root Volterra kernel. -/ + +noncomputable section +namespace ForcedComputation.WeaklySingular + +open Real MeasureTheory Set +open scoped Topology Interval + +def inverseSqrt (r : ℝ) : ℝ := (Real.sqrt r)⁻¹ + +theorem inverseSqrt_nonneg (r : ℝ) : 0 ≤ inverseSqrt r := + inv_nonneg.mpr (Real.sqrt_nonneg r) + +theorem inverseSqrt_eq_rpow {r : ℝ} (hr : 0 ≤ r) : + inverseSqrt r = r ^ (-(1 / 2 : ℝ)) := by + rw [Real.rpow_neg hr, ← Real.sqrt_eq_rpow] + rfl + +theorem inverseSqrt_intervalIntegrable {t : ℝ} (ht : 0 ≤ t) : + IntervalIntegrable inverseSqrt volume 0 t := by + have hi := intervalIntegral.intervalIntegrable_rpow' (a := (0 : ℝ)) (b := t) + (by norm_num : (-1 : ℝ) < -(1 / 2 : ℝ)) + apply hi.congr + intro r hr + rw [uIoc_of_le ht] at hr + exact (inverseSqrt_eq_rpow hr.1.le).symm + +theorem integral_inverseSqrt {t : ℝ} (ht : 0 ≤ t) : + (∫ r in 0..t, inverseSqrt r) = 2 * Real.sqrt t := by + calc + _ = ∫ r in 0..t, r ^ (-(1 / 2 : ℝ)) := by + apply intervalIntegral.integral_congr + intro r hr + rw [uIcc_of_le ht] at hr + exact inverseSqrt_eq_rpow hr.1 + _ = _ := by + rw [integral_rpow (Or.inl (by norm_num : (-1 : ℝ) < -(1 / 2 : ℝ)))] + norm_num + rw [← Real.sqrt_eq_rpow] + ring + +theorem inverseSqrt_sub_intervalIntegrable {t : ℝ} (ht : 0 ≤ t) : + IntervalIntegrable (fun s => inverseSqrt (t - s)) volume 0 t := by + simpa only [sub_zero, sub_self] using (inverseSqrt_intervalIntegrable ht).comp_sub_left t |>.symm + +theorem integral_inverseSqrt_sub {t : ℝ} (ht : 0 ≤ t) : + (∫ s in 0..t, inverseSqrt (t - s)) = 2 * Real.sqrt t := by + rw [intervalIntegral.integral_comp_sub_left, sub_self, sub_zero, integral_inverseSqrt ht] + +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + +omit [NormedSpace ℝ E] in +/-- A measurable integrand dominated by the inverse-square-root kernel is integrable. -/ +theorem intervalIntegrable_of_inverseSqrt_bound {t : ℝ} (ht : 0 ≤ t) + (f : ℝ → E) (B : ℝ) (hm : AEStronglyMeasurable f (volume.restrict (Ioc 0 t))) + (hb : ∀ s ∈ Ioc 0 t, ‖f s‖ ≤ B * inverseSqrt (t - s)) : + IntervalIntegrable f volume 0 t := by + rw [intervalIntegrable_iff_integrableOn_Ioc_of_le ht] + apply (((inverseSqrt_sub_intervalIntegrable ht).const_mul B).1).mono' hm + exact (ae_restrict_mem measurableSet_Ioc).mono fun s hs => hb s hs + +/-- The exact square-root norm bound, including the zero-time endpoint. -/ +theorem norm_integral_le_inverseSqrt {t : ℝ} (ht : 0 ≤ t) (f : ℝ → E) (B : ℝ) + (hb : ∀ s ∈ Ioc 0 t, ‖f s‖ ≤ B * inverseSqrt (t - s)) : + ‖∫ s in 0..t, f s‖ ≤ 2 * B * Real.sqrt t := by + calc + _ ≤ ∫ s in 0..t, B * inverseSqrt (t - s) := + intervalIntegral.norm_integral_le_of_norm_le ht + (ae_of_all _ fun s hs => hb s hs) ((inverseSqrt_sub_intervalIntegrable ht).const_mul B) + _ = _ := by + rw [intervalIntegral.integral_const_mul, integral_inverseSqrt_sub ht] + ring + +/-- The actual Volterra integral for an operator-valued kernel and a source curve. -/ +def volterra (K : ℝ → E →L[ℝ] E) (u : ℝ → E) (t : ℝ) : E := + ∫ s in 0..t, K (t - s) (u s) + +theorem norm_volterra_le {t : ℝ} (ht : 0 ≤ t) + (K : ℝ → E →L[ℝ] E) (u : ℝ → E) (C B : ℝ) (hC : 0 ≤ C) + (hK : ∀ r ∈ Icc 0 t, ‖K r‖ ≤ C * inverseSqrt r) + (hu : ∀ s ∈ Icc 0 t, ‖u s‖ ≤ B) : + ‖volterra E K u t‖ ≤ 2 * C * B * Real.sqrt t := by + have hb (s : ℝ) (hs : s ∈ Ioc 0 t) : + ‖K (t - s) (u s)‖ ≤ (C * B) * inverseSqrt (t - s) := by + have hr : t - s ∈ Icc 0 t := ⟨sub_nonneg.mpr hs.2, by linarith [hs.1]⟩ + calc + _ ≤ ‖K (t - s)‖ * ‖u s‖ := (K (t - s)).le_opNorm (u s) + _ ≤ (C * inverseSqrt (t - s)) * B := + mul_le_mul (hK _ hr) (hu s ⟨hs.1.le, hs.2⟩) (norm_nonneg _) + (mul_nonneg hC (inverseSqrt_nonneg _)) + _ = _ := by ring + simpa only [volterra, mul_assoc] using norm_integral_le_inverseSqrt E ht + (fun s => K (t - s) (u s)) (C * B) hb + +end ForcedComputation.WeaklySingular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularOperator.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f3fbf22c6fdf7a4196dd9ed11f17869fef706b5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularOperator.lean @@ -0,0 +1,157 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.WeaklySingularContinuity +import Mathlib.Topology.Order.ProjIcc +import Mathlib.Topology.ContinuousMap.Compact + +namespace OAI + +/-! A weakly singular Volterra integral as a bounded linear operator on continuous paths. -/ + +noncomputable section +namespace ForcedComputation.WeaklySingular + +open Real MeasureTheory Set Filter +open scoped Topology Interval + +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + +private theorem volterra_integrable (K : ℝ → E →L[ℝ] E) (u : ℝ → E) + (hK : ContinuousOn K (Ioi 0)) (hu : Continuous u) + (C B : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (hub : ∀ s, ‖u s‖ ≤ B) {t : ℝ} (ht : 0 ≤ t) : + IntervalIntegrable (fun s => K (t - s) (u s)) volume 0 t := by + have hm : AEStronglyMeasurable (fun s => K (t - s) (u s)) (volume.restrict (Ioc 0 t)) := by + have hc : ContinuousOn (fun s => K (t - s) (u s)) (Ioo 0 t) := by + intro s hs + have hk := (hK.continuousAt (Ioi_mem_nhds (sub_pos.mpr hs.2))).comp + (continuousAt_const.sub continuousAt_id) + exact (hk.clm_apply hu.continuousAt).continuousWithinAt + rw [← restrict_Ioo_eq_restrict_Ioc] + exact hc.aestronglyMeasurable measurableSet_Ioo + apply intervalIntegrable_of_inverseSqrt_bound E ht _ (C * B) hm + intro s hs + have hp : 0 ≤ t - s := sub_nonneg.mpr hs.2 + calc + _ ≤ ‖K (t - s)‖ * ‖u s‖ := (K (t - s)).le_opNorm (u s) + _ ≤ (C * inverseSqrt (t - s)) * B := + mul_le_mul (hbound _ hp) (hub s) (norm_nonneg _) + (mul_nonneg hC (inverseSqrt_nonneg _)) + _ = _ := by ring + +/-- A fixed normed-space structure for continuous paths on the closed time interval. -/ +def Path (T : ℝ) := C(Icc (0 : ℝ) T, E) + +instance (T : ℝ) : NormedAddCommGroup (Path E T) := + inferInstanceAs (NormedAddCommGroup C(Icc (0 : ℝ) T, E)) +instance (T : ℝ) : NormedSpace ℝ (Path E T) := + inferInstanceAs (NormedSpace ℝ C(Icc (0 : ℝ) T, E)) +instance (T : ℝ) [CompleteSpace E] : CompleteSpace (Path E T) := + inferInstanceAs (CompleteSpace C(Icc (0 : ℝ) T, E)) + +def pathEquiv (T : ℝ) : Path E T ≃ₗᵢ[ℝ] C(Icc (0 : ℝ) T, E) := + LinearIsometryEquiv.refl ℝ _ + +instance (T : ℝ) : CoeFun (Path E T) (fun _ => Icc (0 : ℝ) T → E) := + ⟨fun u => pathEquiv E T u⟩ + +/-- Constant continuation beyond the endpoints gives a global bounded continuous source. -/ +def extendPath {T : ℝ} (hT : 0 ≤ T) (u : Path E T) (s : ℝ) : E := + u (projIcc 0 T hT s) + +theorem continuous_extendPath {T : ℝ} (hT : 0 ≤ T) (u : Path E T) : + Continuous (extendPath E hT u) := + (pathEquiv E T u).continuous.comp continuous_projIcc + +theorem norm_extendPath_le {T : ℝ} (hT : 0 ≤ T) (u : Path E T) (s : ℝ) : + ‖extendPath E hT u s‖ ≤ ‖u‖ := + ((pathEquiv E T u).norm_coe_le_norm _).trans_eq ((pathEquiv E T).norm_map u) + +@[simp] theorem extendPath_coe {T : ℝ} (hT : 0 ≤ T) (u : Path E T) (s : Icc (0 : ℝ) T) : + extendPath E hT u s = u s := by + simp only [extendPath, projIcc_val] + +private def integralPath {T : ℝ} (hT : 0 ≤ T) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (u : Path E T) : Path E T := + (pathEquiv E T).symm + { toFun := fun t => volterra E K (extendPath E hT u) t + continuous_toFun := + (continuousOn_volterra E K (extendPath E hT u) hK + (continuous_extendPath E hT u) C ‖u‖ hC hbound + (norm_extendPath_le E hT u)).comp_continuous continuous_subtype_val + (fun t => t.property.1) } + +private theorem norm_integralPath_le {T : ℝ} (hT : 0 ≤ T) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (u : Path E T) : + ‖integralPath E hT K hK C hC hbound u‖ ≤ (2 * C * Real.sqrt T) * ‖u‖ := by + rw [← (pathEquiv E T).norm_map (integralPath E hT K hK C hC hbound u)] + apply (ContinuousMap.norm_le _ (by positivity)).mpr + intro t + change ‖volterra E K (extendPath E hT u) t.val‖ ≤ _ + calc + _ ≤ 2 * C * ‖u‖ * Real.sqrt t.val := + norm_volterra_le E t.property.1 K (extendPath E hT u) C ‖u‖ hC + (fun r hr => hbound r hr.1) (fun s _ => norm_extendPath_le E hT u s) + _ ≤ 2 * C * ‖u‖ * Real.sqrt T := + mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt t.property.2) (by positivity) + _ = _ := by ring + +/-- The actual Volterra operator on continuous paths; its norm is bounded by `2 C sqrt T`. -/ +def integralOperator {T : ℝ} (hT : 0 ≤ T) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) : + Path E T →L[ℝ] Path E T := + LinearMap.mkContinuous + { toFun := integralPath E hT K hK C hC hbound + map_add' := by + intro u v + apply (pathEquiv E T).injective + rw [map_add] + apply ContinuousMap.ext + intro t + change (∫ s in 0..t.val, K (t.val - s) (extendPath E hT (u + v) s)) = + (∫ s in 0..t.val, K (t.val - s) (extendPath E hT u s)) + + ∫ s in 0..t.val, K (t.val - s) (extendPath E hT v s) + have he (s : ℝ) : extendPath E hT (u + v) s = + extendPath E hT u s + extendPath E hT v s := rfl + simp_rw [he, map_add] + exact intervalIntegral.integral_add + (volterra_integrable E K (extendPath E hT u) hK (continuous_extendPath E hT u) + C ‖u‖ hC hbound (norm_extendPath_le E hT u) t.property.1) + (volterra_integrable E K (extendPath E hT v) hK (continuous_extendPath E hT v) + C ‖v‖ hC hbound (norm_extendPath_le E hT v) t.property.1) + map_smul' := by + intro c u + apply (pathEquiv E T).injective + rw [map_smul] + apply ContinuousMap.ext + intro t + change (∫ s in 0..t.val, K (t.val - s) (extendPath E hT (c • u) s)) = + c • ∫ s in 0..t.val, K (t.val - s) (extendPath E hT u s) + have he (s : ℝ) : extendPath E hT (c • u) s = c • extendPath E hT u s := rfl + simp_rw [he, map_smul] + exact intervalIntegral.integral_smul c _ } + (2 * C * Real.sqrt T) (norm_integralPath_le E hT K hK C hC hbound) + +@[simp] theorem integralOperator_apply {T : ℝ} (hT : 0 ≤ T) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (u : Path E T) (t : Icc (0 : ℝ) T) : + integralOperator E hT K hK C hC hbound u t = + ∫ s in 0..t.val, K (t.val - s) (extendPath E hT u s) := rfl + +theorem norm_integralOperator_le {T : ℝ} (hT : 0 ≤ T) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) : + ‖integralOperator E hT K hK C hC hbound‖ ≤ 2 * C * Real.sqrt T := + (integralOperator E hT K hK C hC hbound).opNorm_le_bound (by positivity) + (norm_integralPath_le E hT K hK C hC hbound) + +end ForcedComputation.WeaklySingular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularWeighted.lean b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..72671e9b89692d617c2027b90c4be4db20cf6722 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/ForcedComputation/Scalar/WeaklySingularWeighted.lean @@ -0,0 +1,149 @@ +import OAI.MathematicalPhysics.NavierStokes.ForcedComputation.Scalar.WeaklySingularOperator +import Mathlib.Analysis.SpecialFunctions.Exp + +namespace OAI + +/-! Integrable majorants and exponential damping of weakly singular Volterra operators. -/ + +noncomputable section +namespace ForcedComputation.WeaklySingular + +open Real MeasureTheory Set Filter +open scoped Topology Interval + +variable (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- Any integrable nonnegative kernel majorant bounds the path operator norm. -/ +theorem norm_integralOperator_le_integral {T : ℝ} (hT : 0 ≤ T) + (K : ℝ → E →L[ℝ] E) (hK : ContinuousOn K (Ioi 0)) + (C : ℝ) (hC : 0 ≤ C) (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) + (b : ℝ → ℝ) (hbi : IntervalIntegrable b volume 0 T) + (hb : ∀ r ∈ Icc 0 T, 0 ≤ b r) (hKb : ∀ r ∈ Icc 0 T, ‖K r‖ ≤ b r) : + ‖integralOperator E hT K hK C hC hbound‖ ≤ ∫ r in 0..T, b r := by + have hmass : 0 ≤ ∫ r in 0..T, b r := intervalIntegral.integral_nonneg hT hb + refine (integralOperator E hT K hK C hC hbound).opNorm_le_bound hmass ?_ + intro u + rw [← (pathEquiv E T).norm_map (integralOperator E hT K hK C hC hbound u)] + apply (ContinuousMap.norm_le _ (mul_nonneg hmass (norm_nonneg u))).mpr + intro t + change ‖∫ s in 0..t.val, K (t.val - s) (extendPath E hT u s)‖ ≤ _ + have hbt : IntervalIntegrable b volume 0 t.val := hbi.mono_set <| by + rw [uIcc_of_le t.property.1, uIcc_of_le hT] + exact Icc_subset_Icc le_rfl t.property.2 + have hbs : IntervalIntegrable (fun s => b (t.val - s)) volume 0 t.val := by + simpa only [sub_zero, sub_self] using (hbt.comp_sub_left t.val).symm + calc + _ ≤ ∫ s in 0..t.val, b (t.val - s) * ‖u‖ := by + apply intervalIntegral.norm_integral_le_of_norm_le t.property.1 _ (hbs.mul_const ‖u‖) + exact ae_of_all _ fun s hs => by + have hr : t.val - s ∈ Icc (0 : ℝ) T := + ⟨sub_nonneg.mpr hs.2, (sub_le_self _ hs.1.le).trans t.property.2⟩ + exact ((K (t.val - s)).le_opNorm _).trans <| + mul_le_mul (hKb _ hr) (norm_extendPath_le E hT u s) (norm_nonneg _) (hb _ hr) + _ = (∫ r in 0..t.val, b r) * ‖u‖ := by + rw [intervalIntegral.integral_mul_const, intervalIntegral.integral_comp_sub_left, + sub_self, sub_zero] + _ ≤ (∫ r in 0..T, b r) * ‖u‖ := by + apply mul_le_mul_of_nonneg_right _ (norm_nonneg u) + exact intervalIntegral.integral_mono_interval le_rfl t.property.1 t.property.2 + ((ae_restrict_mem measurableSet_Ioc).mono fun r hr => hb r ⟨hr.1.le, hr.2⟩) hbi + +/-- The scalar majorant after exponential time weighting. -/ +def weightedProfile (rate r : ℝ) : ℝ := Real.exp (-rate * r) * inverseSqrt r + +theorem weightedProfile_nonneg (rate r : ℝ) : 0 ≤ weightedProfile rate r := + mul_nonneg (Real.exp_pos _).le (inverseSqrt_nonneg r) + +theorem weightedProfile_integrable {T : ℝ} (hT : 0 ≤ T) (rate : ℝ) : + IntervalIntegrable (weightedProfile rate) volume 0 T := + (inverseSqrt_intervalIntegrable hT).continuousOn_mul + ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn) + +theorem weightedProfile_le {rate r : ℝ} (hrate : 0 ≤ rate) (hr : 0 ≤ r) : + weightedProfile rate r ≤ inverseSqrt r := by + unfold weightedProfile + exact (mul_le_mul_of_nonneg_right + (Real.exp_le_one_iff.mpr (mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hrate) hr)) + (inverseSqrt_nonneg r)).trans_eq (one_mul _) + +/-- On every finite interval the exponentially weighted singular mass tends to zero. -/ +theorem weightedProfile_integral_tendsto {T : ℝ} (hT : 0 ≤ T) : + Tendsto (fun rate : ℝ => ∫ r in 0..T, weightedProfile rate r) atTop (𝓝 0) := by + have hh := intervalIntegral.tendsto_integral_filter_of_dominated_convergence + (a := (0 : ℝ)) (b := T) (μ := volume) (l := atTop) + (F := fun rate r : ℝ => weightedProfile rate r) (f := fun _ => (0 : ℝ)) + inverseSqrt + (Eventually.of_forall fun rate => + (weightedProfile_integrable hT rate).aestronglyMeasurable_restrict_uIoc) + (by + filter_upwards [eventually_ge_atTop (0 : ℝ)] with rate hrate + exact ae_of_all _ fun r hr => by + rw [uIoc_of_le hT] at hr + simpa only [Real.norm_eq_abs, abs_of_nonneg (weightedProfile_nonneg rate r)] using + weightedProfile_le hrate hr.1.le) + (inverseSqrt_intervalIntegrable hT) + (ae_of_all _ fun r hr => by + rw [uIoc_of_le hT] at hr + have he : Tendsto (fun rate : ℝ => Real.exp (-rate * r)) atTop (𝓝 0) := by + simpa only [neg_mul, Function.comp_def, id_eq] using Real.tendsto_exp_neg_atTop_nhds_zero.comp + ((tendsto_id : Tendsto (fun rate : ℝ => rate) atTop atTop).atTop_mul_const hr.1) + simpa only [weightedProfile, zero_mul] using he.mul_const (inverseSqrt r)) + simpa only [intervalIntegral.integral_zero] using hh + +/-- Exponential conjugation changes only the time kernel. -/ +def weightedKernel (rate : ℝ) (K : ℝ → E →L[ℝ] E) (r : ℝ) : E →L[ℝ] E := + Real.exp (-rate * r) • K r + +theorem weightedKernel_continuous (rate : ℝ) (K : ℝ → E →L[ℝ] E) + (hK : ContinuousOn K (Ioi 0)) : ContinuousOn (weightedKernel E rate K) (Ioi 0) := + ((Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn.smul hK) + +theorem weightedKernel_bound {rate C : ℝ} (hrate : 0 ≤ rate) (hC : 0 ≤ C) + (K : ℝ → E →L[ℝ] E) (hK : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) : + ∀ r, 0 ≤ r → ‖weightedKernel E rate K r‖ ≤ C * inverseSqrt r := by + intro r hr + calc + _ = Real.exp (-rate * r) * ‖K r‖ := by + rw [weightedKernel, norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + _ ≤ Real.exp (-rate * r) * (C * inverseSqrt r) := + mul_le_mul_of_nonneg_left (hK r hr) (Real.exp_pos _).le + _ = C * weightedProfile rate r := by unfold weightedProfile; ring + _ ≤ _ := mul_le_mul_of_nonneg_left (weightedProfile_le hrate hr) hC + +theorem norm_weightedIntegralOperator_le {T rate C : ℝ} (hT : 0 ≤ T) (hrate : 0 ≤ rate) + (K : ℝ → E →L[ℝ] E) (hK : ContinuousOn K (Ioi 0)) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) : + ‖integralOperator E hT (weightedKernel E rate K) (weightedKernel_continuous E rate K hK) + C hC (weightedKernel_bound E hrate hC K hbound)‖ ≤ + C * ∫ r in 0..T, weightedProfile rate r := by + rw [← intervalIntegral.integral_const_mul] + apply norm_integralOperator_le_integral E hT _ _ C hC _ _ + ((weightedProfile_integrable hT rate).const_mul C) + (fun r _ => mul_nonneg hC (weightedProfile_nonneg rate r)) + intro r hr + calc + _ = Real.exp (-rate * r) * ‖K r‖ := by + rw [weightedKernel, norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + _ ≤ Real.exp (-rate * r) * (C * inverseSqrt r) := + mul_le_mul_of_nonneg_left (hbound r hr.1) (Real.exp_pos _).le + _ = _ := by unfold weightedProfile; ring + +/-- Weighting makes the Volterra operator arbitrarily small without shortening the interval. -/ +theorem exists_weightedIntegralOperator_norm_lt {T C : ℝ} (hT : 0 ≤ T) + (K : ℝ → E →L[ℝ] E) (hK : ContinuousOn K (Ioi 0)) (hC : 0 ≤ C) + (hbound : ∀ r, 0 ≤ r → ‖K r‖ ≤ C * inverseSqrt r) {q : ℝ} (hq : 0 < q) : + ∃ rate : ℝ, ∃ hrate : 0 ≤ rate, + ‖integralOperator E hT (weightedKernel E rate K) (weightedKernel_continuous E rate K hK) + C hC (weightedKernel_bound E hrate hC K hbound)‖ < q := by + have ht : Tendsto (fun rate : ℝ => C * ∫ r in 0..T, weightedProfile rate r) + atTop (𝓝 0) := by + simpa only [mul_zero] using (weightedProfile_integral_tendsto hT).const_mul C + have he := (tendsto_order.1 ht).2 q hq + obtain ⟨rate, hrate, hsmall⟩ := (eventually_ge_atTop (0 : ℝ)).and he |>.exists + exact ⟨rate, hrate, (norm_weightedIntegralOperator_le E hT hrate K hK hC hbound).trans_lt hsmall⟩ + +end ForcedComputation.WeaklySingular + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/HomogeneousDatum.lean b/lean/OAI/MathematicalPhysics/NavierStokes/HomogeneousDatum.lean new file mode 100644 index 0000000000000000000000000000000000000000..00e3601638512992a5f00c27fec055321b55d062 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/HomogeneousDatum.lean @@ -0,0 +1,271 @@ +import Mathlib.Analysis.Calculus.ContDiff.WithLp +import Mathlib.Analysis.Calculus.Deriv.Inv +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.Analysis.Normed.Lp.MeasurableSpace +import Mathlib.Analysis.SpecialFunctions.Pow.Integral +import Mathlib.MeasureTheory.Function.L2Space +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.FinCases +import Mathlib.Tactic.FunProp +import Mathlib.Tactic.GCongr +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +/-! +# The prescribed homogeneous axisymmetric datum + +The field `StationaryNS.homogeneousDatum` is the datum +`V(130z / (r² + z²))` from the homogeneous-datum subsection of +*Stationary instability and nonuniqueness for axisymmetric swirl-free Navier–Stokes*. +It is homogeneous of degree `-1`, axisymmetric and swirl-free, smooth and classically +solenoidal away from the origin, and square integrable on every compact set. +-/ + +noncomputable section + +namespace StationaryNS + +abbrev Space := EuclideanSpace ℝ (Fin 3) +abbrev Field := Space → Space + +/-- The square of the distance to the origin, in Cartesian coordinates. -/ +def radiusSq (x : Space) : ℝ := x 0 ^ 2 + x 1 ^ 2 + x 2 ^ 2 + +/-- The homogeneous datum `V(130z/(r²+z²))` of `sa:homogeneous-datum`, +written in Cartesian coordinates. Its value at the origin is fixed to zero; +that value has no bearing on its distributional interpretation. -/ +def homogeneousDatum (x : Space) : Space := + WithLp.toLp 2 ![ + 130 * x 0 * (x 0 ^ 2 + x 1 ^ 2 - x 2 ^ 2) / radiusSq x ^ 2, + 130 * x 1 * (x 0 ^ 2 + x 1 ^ 2 - x 2 ^ 2) / radiusSq x ^ 2, + -260 * x 2 ^ 3 / radiusSq x ^ 2] + +theorem radiusSq_ne_zero {x : Space} (hx : x ≠ 0) : radiusSq x ≠ 0 := by + intro hzero + have hzero' : x 0 ^ 2 + x 1 ^ 2 + x 2 ^ 2 = 0 := hzero + have hx0 : x 0 = 0 := by nlinarith [sq_nonneg (x 0), sq_nonneg (x 1), sq_nonneg (x 2)] + have hx1 : x 1 = 0 := by nlinarith [sq_nonneg (x 0), sq_nonneg (x 1), sq_nonneg (x 2)] + have hx2 : x 2 = 0 := by nlinarith [sq_nonneg (x 0), sq_nonneg (x 1), sq_nonneg (x 2)] + apply hx + ext i + fin_cases i <;> simp [hx0, hx1, hx2] + +theorem radiusSq_smul (t : ℝ) (x : Space) : radiusSq (t • x) = t ^ 2 * radiusSq x := by + simp only [radiusSq, PiLp.smul_apply, smul_eq_mul] + ring + +@[simp] theorem homogeneousDatum_zero : homogeneousDatum 0 = 0 := by + ext i + fin_cases i <;> simp [homogeneousDatum, radiusSq] + +/-- Homogeneity of degree `-1`, with every nonzero real scale allowed. -/ +theorem homogeneousDatum_smul {t : ℝ} (ht : t ≠ 0) (x : Space) : + homogeneousDatum (t • x) = t⁻¹ • homogeneousDatum x := by + by_cases hx : x = 0 + · subst x + simp + have hq := radiusSq_ne_zero hx + ext i + fin_cases i <;> + simp [homogeneousDatum, radiusSq_smul, PiLp.smul_apply] <;> + field_simp + +/-- Reflection in the horizontal plane. -/ +def reflectZ (x : Space) : Space := WithLp.toLp 2 ![x 0, x 1, -x 2] + +@[simp] theorem radiusSq_reflectZ (x : Space) : radiusSq (reflectZ x) = radiusSq x := by + simp [radiusSq, reflectZ] + +/-- Positive vector reflection parity of the prescribed homogeneous datum. -/ +theorem homogeneousDatum_parity (x : Space) : + homogeneousDatum (reflectZ x) = reflectZ (homogeneousDatum x) := by + ext i + fin_cases i <;> simp [homogeneousDatum, reflectZ, radiusSq] + ring + +/-- The Cartesian angular component is zero. -/ +theorem homogeneousDatum_swirlFree (x : Space) : + x 0 * homogeneousDatum x 1 - x 1 * homogeneousDatum x 0 = 0 := by + simp [homogeneousDatum] + ring + +/-- The datum is smooth away from its singular point. -/ +theorem homogeneousDatum_contDiffOn : + ContDiffOn ℝ ⊤ homogeneousDatum ({0}ᶜ : Set Space) := by + have hp (i : Fin 3) : ContDiff ℝ ⊤ (fun x : Space => x i) := contDiff_piLp_apply 2 + have hq : ContDiff ℝ ⊤ radiusSq := by + exact ((hp 0).pow 2 |>.add ((hp 1).pow 2)).add ((hp 2).pow 2) + have hden (x : Space) (hx : x ∈ ({0}ᶜ : Set Space)) : radiusSq x ^ 2 ≠ 0 := by + apply pow_ne_zero + apply radiusSq_ne_zero + simpa using hx + apply (contDiffOn_piLp 2).mpr + intro i + fin_cases i <;> simp only [homogeneousDatum, PiLp.toLp_apply] <;> + apply ContDiffOn.div _ ((hq.pow 2).contDiffOn) hden <;> fun_prop + +/-- The classical radial drift `x·∇u`. -/ +def drift (u : Field) (x : Space) : Space := fderiv ℝ u x x + +/-- Euler's identity for the prescribed degree `-1` datum. -/ +theorem homogeneousDatum_euler {x : Space} (hx : x ≠ 0) : + drift homogeneousDatum x + homogeneousDatum x = 0 := by + have hnhds : ({0}ᶜ : Set Space) ∈ nhds x := + isOpen_compl_singleton.mem_nhds (by simpa using hx) + have hu : DifferentiableAt ℝ homogeneousDatum x := + (homogeneousDatum_contDiffOn.contDiffAt hnhds).differentiableAt (by simp) + have hlin : HasDerivAt (fun t : ℝ => t • x) x 1 := by + simpa using (hasDerivAt_id (1 : ℝ)).smul_const x + have hu' : HasFDerivAt homogeneousDatum (fderiv ℝ homogeneousDatum x) + ((fun t : ℝ => t • x) 1) := by + simpa using hu.hasFDerivAt + have hcomp₀ := HasFDerivAt.comp_hasDerivAt 1 hu' hlin + have hcomp : HasDerivAt (fun t : ℝ => homogeneousDatum (t • x)) + (drift homogeneousDatum x) 1 := by + simpa only [drift, Function.comp_def] using hcomp₀ + have heq : (fun t : ℝ => homogeneousDatum (t • x)) =ᶠ[nhds 1] + (fun t => t⁻¹ • homogeneousDatum x) := by + filter_upwards [eventually_ne_nhds (one_ne_zero : (1 : ℝ) ≠ 0)] with t ht + exact homogeneousDatum_smul ht x + have hinv : HasDerivAt (fun t : ℝ => t⁻¹ • homogeneousDatum x) + (-homogeneousDatum x) 1 := by + simpa using (hasDerivAt_inv (one_ne_zero : (1 : ℝ) ≠ 0)).smul_const + (homogeneousDatum x) + rw [hcomp.unique (hinv.congr_of_eventuallyEq heq), neg_add_cancel] + +/-- Cartesian divergence at points where the field is differentiable. -/ +def divergence (u : Field) (x : Space) : ℝ := + ∑ i : Fin 3, fderiv ℝ (fun y => u y i) x (EuclideanSpace.single i 1) + +/-- The datum is classically solenoidal off the origin. Distributional +solenoidality across the singular point needs a separate small-sphere estimate. -/ +theorem homogeneousDatum_divergence {x : Space} (hx : x ≠ 0) : + divergence homogeneousDatum x = 0 := by + have hp (i : Fin 3) : HasFDerivAt (fun y : Space => y i) (EuclideanSpace.proj (𝕜 := ℝ) i) x := + (EuclideanSpace.proj (𝕜 := ℝ) i).hasFDerivAt + have hq := ((hp 0).pow 2 |>.add ((hp 1).pow 2)).add ((hp 2).pow 2) + have hq' : HasFDerivAt radiusSq _ x := hq + have hd := (hasDerivAt_inv (pow_ne_zero 2 (radiusSq_ne_zero hx))).comp_hasFDerivAt x + (hq'.pow 2) + have hxy := ((hp 0).pow 2 |>.add ((hp 1).pow 2)).sub ((hp 2).pow 2) + have h0 := (((hp 0).const_mul 130).fun_mul hxy).fun_mul hd + have h1 := (((hp 1).const_mul 130).fun_mul hxy).fun_mul hd + have h2 := (((hp 2).pow 3).const_mul (-260)).fun_mul hd + simp only [divergence, Fin.sum_univ_three, homogeneousDatum, PiLp.toLp_apply] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val, div_eq_mul_inv] + simp only [Pi.add_apply, Pi.sub_apply, Function.comp_apply] at h0 h1 h2 + rw [h0.fderiv, h1.fderiv, h2.fderiv] + simp [PiLp.proj_apply] + field_simp [radiusSq_ne_zero hx] + unfold radiusSq + ring + +/-- Unit vector along the axis of symmetry. -/ +def axialUnit : Space := EuclideanSpace.single 2 1 + +/-- Invariance under the full orthogonal group fixing the vertical axis +pointwise. Unlike invariance under rotations alone, this includes reflections +in vertical planes and excludes a swirl component. -/ +def AxisymmetricSwirlFree (u : Field) : Prop := + ∀ R : Space ≃ₗᵢ[ℝ] Space, R axialUnit = axialUnit → ∀ x, u (R x) = R (u x) + +theorem radiusSq_eq_normSq (x : Space) : radiusSq x = ‖x‖ ^ 2 := by + simp [EuclideanSpace.norm_sq_eq, Fin.sum_univ_three, radiusSq, Real.norm_eq_abs] + +/-- A coordinate-free expression useful for the orthogonal symmetries. -/ +theorem homogeneousDatum_vector (x : Space) : + homogeneousDatum x = (130 / radiusSq x ^ 2) • + ((radiusSq x - 2 * x 2 ^ 2) • x - (radiusSq x * x 2) • axialUnit) := by + ext i + fin_cases i <;> simp [homogeneousDatum, axialUnit, radiusSq] <;> ring + +theorem homogeneousDatum_axisymmetricSwirlFree : AxisymmetricSwirlFree homogeneousDatum := by + intro R hR x + have hq : radiusSq (R x) = radiusSq x := by + simp only [radiusSq_eq_normSq, R.norm_map] + have hz : R x 2 = x 2 := by + have hi := R.inner_map_map axialUnit x + rw [hR] at hi + simpa [axialUnit, EuclideanSpace.inner_single_left] using hi + rw [homogeneousDatum_vector, homogeneousDatum_vector, hq, hz] + simp only [map_smul, map_sub, hR] + +/-- The singular datum obeys the pointwise inverse-distance bound, interpreted +with Lean's zero inverse at the origin. -/ +theorem homogeneousDatum_norm (x : Space) : ‖homogeneousDatum x‖ ≤ 260 / ‖x‖ := by + by_cases hx : x = 0 + · subst x + simp + have hr : 0 < ‖x‖ := norm_pos_iff.mpr hx + have hq : 0 < radiusSq x := by rw [radiusSq_eq_normSq]; positivity + have hz : |x 2| ≤ ‖x‖ := by simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le x 2 + have hzq : x 2 ^ 2 ≤ radiusSq x := by + unfold radiusSq + nlinarith [sq_nonneg (x 0), sq_nonneg (x 1)] + have ha : |radiusSq x - 2 * x 2 ^ 2| ≤ radiusSq x := + abs_le.mpr ⟨by linarith, by nlinarith [sq_nonneg (x 2)]⟩ + have he : ‖axialUnit‖ = 1 := by simp [axialUnit] + calc + ‖homogeneousDatum x‖ = (130 / radiusSq x ^ 2) * + ‖(radiusSq x - 2 * x 2 ^ 2) • x - (radiusSq x * x 2) • axialUnit‖ := by + rw [homogeneousDatum_vector, norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity)] + _ ≤ (130 / radiusSq x ^ 2) * + (‖(radiusSq x - 2 * x 2 ^ 2) • x‖ + ‖(radiusSq x * x 2) • axialUnit‖) := by + gcongr + exact norm_sub_le _ _ + _ = (130 / radiusSq x ^ 2) * + (|radiusSq x - 2 * x 2 ^ 2| * ‖x‖ + radiusSq x * |x 2|) := by + rw [norm_smul, norm_smul, he] + simp only [Real.norm_eq_abs, abs_mul, abs_of_pos hq, mul_one] + _ ≤ (130 / radiusSq x ^ 2) * (radiusSq x * ‖x‖ + radiusSq x * ‖x‖) := by + gcongr + _ = 260 / ‖x‖ := by + rw [radiusSq_eq_normSq] + field_simp + ring + +theorem homogeneousDatum_measurable : Measurable homogeneousDatum := by + have hp (i : Fin 3) : Measurable (fun x : Space => x i) := + (contDiff_piLp_apply 2 (𝕜 := ℝ) (n := 0)).continuous.measurable + have hq : Measurable radiusSq := by + exact ((hp 0).pow_const 2 |>.add ((hp 1).pow_const 2)).add ((hp 2).pow_const 2) + have heq : homogeneousDatum = fun x : Space => (130 / radiusSq x ^ 2) • + ((radiusSq x - 2 * x 2 ^ 2) • x - (radiusSq x * x 2) • axialUnit) := + funext homogeneousDatum_vector + rw [heq] + fun_prop + +open MeasureTheory in +/-- Local square integrability, including the singular point. -/ +theorem homogeneousDatum_sq_locallyIntegrable : + LocallyIntegrable (fun x : Space => ‖homogeneousDatum x‖ ^ 2) := by + have hdim : Module.finrank ℝ Space = 3 := by simp [Space] + apply locallyIntegrable_of_norm_le_rpow (by rw [hdim]; norm_num) + (C := 260 ^ 2) (α := 2) (by rw [hdim]; norm_num) + · apply Filter.Eventually.of_forall + intro x + calc + ‖‖homogeneousDatum x‖ ^ 2‖ = ‖homogeneousDatum x‖ ^ 2 := by + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + _ ≤ (260 / ‖x‖) ^ 2 := by + exact pow_le_pow_left₀ (norm_nonneg _) (homogeneousDatum_norm x) 2 + _ = 260 ^ 2 * ‖x‖ ^ (-(2 : ℝ)) := by + rw [Real.rpow_neg (norm_nonneg _), Real.rpow_two] + ring + · exact (homogeneousDatum_measurable.norm.pow_const 2).aestronglyMeasurable + +open MeasureTheory in +/-- The datum belongs to `L²` on every compact subset of three-dimensional space. -/ +theorem homogeneousDatum_memLp_two_on_compact {K : Set Space} (hK : IsCompact K) : + MemLp homogeneousDatum 2 (volume.restrict K) := by + rw [memLp_two_iff_integrable_sq_norm homogeneousDatum_measurable.aestronglyMeasurable] + exact homogeneousDatum_sq_locallyIntegrable.integrableOn_isCompact hK + +end StationaryNS + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/Material/Clock.lean b/lean/OAI/MathematicalPhysics/NavierStokes/Material/Clock.lean new file mode 100644 index 0000000000000000000000000000000000000000..1979a74670e1b27d5c46fc3cd6200bd1b387e8ab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/Material/Clock.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Model + +namespace OAI + +namespace Alternating +open scoped Topology + +noncomputable def clock (t : ℝ) : ℝ := Real.smoothTransition (2 * t - 1 / 2) + +theorem clock_smooth : ContDiff ℝ (⊤ : ℕ∞) clock := by unfold clock; fun_prop + +theorem clock_zero {t : ℝ} (ht : t ≤ 1 / 4) : clock t = 0 := + Real.smoothTransition.zero_of_nonpos (by linarith) + +theorem clock_one {t : ℝ} (ht : 3 / 4 ≤ t) : clock t = 1 := + Real.smoothTransition.one_of_one_le (by linarith) + +theorem clock_mem (t : ℝ) : clock t ∈ Set.Icc 0 1 := + ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ + +theorem clock_monotone : Monotone clock := fun _ _ h => + Real.smoothTransition.monotone (by linarith) + +theorem clock_deriv_nonneg (t : ℝ) : 0 ≤ deriv clock t := clock_monotone.deriv_nonneg + +theorem clock_deriv_collar (n : ℕ) {t : ℝ} (ht : t < 1 / 4 ∨ 3 / 4 < t) : + iteratedDeriv (n + 1) clock t = 0 := by + rcases ht with ht | ht + · have he : clock =ᶠ[𝓝 t] fun _ => (0 : ℝ) := by + filter_upwards [Iio_mem_nhds ht] with s hs + exact clock_zero hs.le + simpa [iteratedDeriv_const] using he.iteratedDeriv_eq (n + 1) + · have he : clock =ᶠ[𝓝 t] fun _ => (1 : ℝ) := by + filter_upwards [Ioi_mem_nhds ht] with s hs + exact clock_one hs.le + simpa [iteratedDeriv_const] using he.iteratedDeriv_eq (n + 1) + +theorem clock_deriv_support (n : ℕ) : + tsupport (iteratedDeriv (n + 1) clock) ⊆ Set.Icc (1 / 4 : ℝ) (3 / 4) := by + apply closure_minimal _ isClosed_Icc + intro t ht + by_contra hn + have hor : t < 1 / 4 ∨ 3 / 4 < t := by + simpa only [Set.mem_Icc, not_and_or, not_le] using hn + exact ht (clock_deriv_collar n hor) + +theorem clock_deriv_compact (n : ℕ) : HasCompactSupport (iteratedDeriv (n + 1) clock) := + isCompact_Icc.of_isClosed_subset isClosed_closure (clock_deriv_support n) + +theorem clock_derivatives_bounded (n : ℕ) : ∃ M : ℝ, 0 < M ∧ + ∀ t : ℝ, |iteratedDeriv n clock t| ≤ M := by + cases n with + | zero => + exact ⟨1, by norm_num, fun t => by simpa [abs_of_nonneg (clock_mem t).1] using (clock_mem t).2⟩ + | succ n => + have hc := clock_smooth.continuous_iteratedDeriv (n + 1) + (by exact_mod_cast (le_top : (n + 1 : ℕ∞) ≤ ⊤)) + obtain ⟨M, hM, hbound⟩ := ((clock_deriv_compact n).isCompact_range hc).isBounded.exists_pos_norm_le + exact ⟨M, hM, fun t => by simpa using hbound _ ⟨t, rfl⟩⟩ + +theorem clock_total_progress : ∫ t : ℝ in (0 : ℝ)..1, deriv clock t = 1 := by + have hc := clock_smooth.continuous_deriv (by norm_num) + rw [intervalIntegral.integral_deriv_eq_sub' clock rfl + (fun x _ => clock_smooth.differentiable (by norm_num) x) hc.continuousOn] + rw [clock_one (by norm_num), clock_zero (by norm_num)] + norm_num + +end Alternating + +end OAI diff --git a/lean/OAI/MathematicalPhysics/NavierStokes/Material/Compiler.lean b/lean/OAI/MathematicalPhysics/NavierStokes/Material/Compiler.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1d96330650a8e46f5b1f3046a466a924a5f35b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/NavierStokes/Material/Compiler.lean @@ -0,0 +1,393 @@ +import OAI.MathematicalPhysics.NavierStokes.Material.Decoding + +namespace OAI + +namespace Alternating.Memory +open scoped BigOperators + +noncomputable def tapeUpdate (b a ell : ℕ) (i : Instruction) (A B : ℝ) : ℝ × ℝ := + let R := (b : ℝ) * B - 2 * a + if i.2.2 = 2 then (((2 * i.2.1 : ℝ) + A) / b, R) + else if i.2.2 = 1 then (A, ((2 * i.2.1 : ℝ) + R) / b) + else ((b : ℝ) * A - 2 * ell, + ((2 * ell : ℝ) + ((2 * i.2.1 : ℝ) + R) / b) / b) + +noncomputable def branchCode (b K a ell : ℕ) (i : Instruction) (A B : ℝ) : ℝ := + ((2 * i.1 : ℝ) + (tapeUpdate b a ell i A B).1 + + (b : ℝ)⁻¹ ^ K * (tapeUpdate b a ell i A B).2) / b + +theorem branchCode_smooth (b K a ell : ℕ) (i : Instruction) : + ContDiff ℝ (⊤ : ℕ∞) (fun p : ℝ × ℝ => branchCode b K a ell i p.1 p.2) := by + unfold branchCode tapeUpdate + split_ifs <;> fun_prop + +noncomputable def localBranchCode (M : Machine) (K q a : ℕ) (A B : ℝ) : ℝ := + let i := M.normalizedInstruction q a + if i.2.2 = 0 then + ∑ ell ∈ Finset.range M.symbolCount, + digitSelector (alphabetBase M) ell A * branchCode (alphabetBase M) K a ell i A B + else branchCode (alphabetBase M) K a 0 i A B + +theorem localBranchCode_smooth (M : Machine) (K q a : ℕ) : + ContDiff ℝ (⊤ : ℕ∞) (fun p : ℝ × ℝ => localBranchCode M K q a p.1 p.2) := by + dsimp only [localBranchCode] + + split_ifs + · apply ContDiff.sum + intro ell _ + exact ((digitSelector_smooth _ _).comp contDiff_fst).mul (branchCode_smooth _ _ _ _ _) + · exact branchCode_smooth _ _ _ _ _ + +noncomputable def localWrite (M : Machine) (N n : ℕ) (D : ℝ) : ℝ := + let b := alphabetBase M + let C := readState b N n D + let A := readLeft b N n D + let B := readRight b N n D + epsilon b N (n + 1) * + ∑ q ∈ Finset.range (M.stateCount + 1), ∑ a ∈ Finset.range M.symbolCount, + digitSelector b q C * digitSelector b a B * + localBranchCode M (width N (n + 1)) q a A B + +theorem localWrite_smooth (M : Machine) (N n : ℕ) : + ContDiff ℝ (⊤ : ℕ∞) (localWrite M N n) := by + have hb : 2 ≤ alphabetBase M := by have := alphabetBase_ge_four M; omega + apply contDiff_const.mul + apply ContDiff.sum + intro q _ + apply ContDiff.sum + intro a _ + apply ContDiff.mul + · exact ((digitSelector_smooth _ _).comp (readState_smooth hb N n)).mul + ((digitSelector_smooth _ _).comp (readRight_smooth hb N n)) + · exact (localBranchCode_smooth M _ q a).comp + ((readLeft_smooth hb N n).prodMk (readRight_smooth hb N n)) + +end Alternating.Memory + +namespace Alternating.Memory + +noncomputable def sequenceCode (b K : ℕ) (a : ℕ → ℕ) : ℝ := + fraction b ((List.range K).map a) + +theorem sequenceCode_head (b K : ℕ) (a : ℕ → ℕ) : + sequenceCode b (K + 1) a = + ((a 0 : ℝ) + sequenceCode b K (fun j => a (j + 1))) / b := by + simp [sequenceCode, List.range_succ_eq_map, Function.comp_def, Nat.succ_eq_add_one] + +theorem sequenceCode_agree (b K : ℕ) {a c : ℕ → ℕ} (hac : ∀ j < K, a j = c j) : + sequenceCode b K a = sequenceCode b K c := by + unfold sequenceCode + congr 1 + apply List.map_congr_left + intro j hj + exact hac j (List.mem_range.1 hj) + +theorem sequenceCode_extend {b K : ℕ} (hb : 0 < b) {a : ℕ → ℕ} (ha : a K = 0) : + sequenceCode b (K + 1) a = sequenceCode b K a := by + simp [sequenceCode, List.range_succ, List.map_append, fraction_append hb, ha] + +theorem sequenceCode_widen {b K L : ℕ} (hb : 0 < b) (hKL : K ≤ L) + {a : ℕ → ℕ} (ha : ∀ j, K ≤ j → a j = 0) : sequenceCode b L a = sequenceCode b K a := by + obtain ⟨r, rfl⟩ := Nat.exists_eq_add_of_le hKL + clear hKL + induction r with + | zero => simp + | succ r ih => + rw [← Nat.add_assoc, sequenceCode_extend hb (ha _ (by omega)), ih] + +theorem sequenceCode_pop {b K L : ℕ} (hb : 0 < b) (hKL : K ≤ L + 1) + {a : ℕ → ℕ} (ha : ∀ j, K ≤ j → a j = 0) : + sequenceCode b L (fun j => a (j + 1)) = (b : ℝ) * sequenceCode b K a - a 0 := by + have h := sequenceCode_head b L a + rw [sequenceCode_widen hb hKL ha] at h + have hb0 : (b : ℝ) ≠ 0 := by exact_mod_cast hb.ne' + field_simp at h + linarith + +def leftSequence (c : Configuration) (j : ℕ) : ℕ := + 2 * c.tape (c.head - 1 - (j : ℤ)) + +def rightSequence (c : Configuration) (j : ℕ) : ℕ := + 2 * c.tape (c.head + (j : ℤ)) + +theorem actualSequences_vanish (I : MachineInput) (n : ℕ) {j : ℕ} + (hj : width I.2.length n ≤ j) : + leftSequence (configurationAt I n) j = 0 ∧ rightSequence (configurationAt I n) j = 0 := by + have h := actualBlock_full_tape I n hj + simp only [leftSequence, rightSequence, h.1, h.2, mul_zero, and_self] + +theorem leftSequence_moveRight_zero (c : Configuration) (p w : ℕ) : + leftSequence (applyInstruction c (p, w, 2)) 0 = 2 * w := by + have he : c.head + 2 - 1 - 1 = c.head := by omega + simp [leftSequence, applyInstruction, he] + +theorem leftSequence_moveRight_succ (c : Configuration) (p w j : ℕ) : + leftSequence (applyInstruction c (p, w, 2)) (j + 1) = leftSequence c j := by + change 2 * (Function.update c.tape c.head w) (c.head + 2 - 1 - 1 - ((j + 1 : ℕ) : ℤ)) = _ + have he : c.head + 2 - 1 - 1 - ((j + 1 : ℕ) : ℤ) = c.head - 1 - (j : ℤ) := by omega + rw [he, Function.update_of_ne (by omega)] + rfl + +theorem rightSequence_moveRight (c : Configuration) (p w j : ℕ) : + rightSequence (applyInstruction c (p, w, 2)) j = rightSequence c (j + 1) := by + change 2 * (Function.update c.tape c.head w) (c.head + 2 - 1 + (j : ℤ)) = _ + rw [Function.update_of_ne (by omega)] + congr 2 + dsimp [rightSequence] + omega + +theorem leftSequence_stay (c : Configuration) (p w j : ℕ) : + leftSequence (applyInstruction c (p, w, 1)) j = leftSequence c j := by + dsimp [leftSequence, applyInstruction] + rw [Function.update_of_ne (by omega)] + congr 2 + omega + +theorem rightSequence_stay_zero (c : Configuration) (p w : ℕ) : + rightSequence (applyInstruction c (p, w, 1)) 0 = 2 * w := by + simp [rightSequence, applyInstruction] + +theorem rightSequence_stay_succ (c : Configuration) (p w j : ℕ) : + rightSequence (applyInstruction c (p, w, 1)) (j + 1) = rightSequence c (j + 1) := by + dsimp [rightSequence, applyInstruction] + rw [Function.update_of_ne (by omega)] + congr 2 + omega + +theorem leftSequence_moveLeft (c : Configuration) (p w j : ℕ) : + leftSequence (applyInstruction c (p, w, 0)) j = leftSequence c (j + 1) := by + dsimp [leftSequence, applyInstruction] + rw [Function.update_of_ne (by omega)] + congr 2 + omega + +theorem rightSequence_moveLeft_zero (c : Configuration) (p w : ℕ) : + rightSequence (applyInstruction c (p, w, 0)) 0 = leftSequence c 0 := by + dsimp [rightSequence, leftSequence, applyInstruction] + rw [Function.update_of_ne (by omega)] + congr 2 + omega + +theorem rightSequence_moveLeft_one (c : Configuration) (p w : ℕ) : + rightSequence (applyInstruction c (p, w, 0)) 1 = 2 * w := by + simp [rightSequence, applyInstruction] + +theorem rightSequence_moveLeft_add_two (c : Configuration) (p w j : ℕ) : + rightSequence (applyInstruction c (p, w, 0)) (j + 2) = rightSequence c (j + 1) := by + dsimp [rightSequence, applyInstruction] + rw [Function.update_of_ne (by omega)] + congr 2 + omega + + +theorem tapeUpdate_correct {b K : ℕ} (hb : 0 < b) (c : Configuration) (i : Instruction) + (hl : ∀ j, K ≤ j → leftSequence c j = 0) + (hr : ∀ j, K ≤ j → rightSequence c j = 0) : + tapeUpdate b (c.tape c.head) (c.tape (c.head - 1)) i + (sequenceCode b K (leftSequence c)) (sequenceCode b K (rightSequence c)) = + (sequenceCode b (K + 2) (leftSequence (applyInstruction c i)), + sequenceCode b (K + 2) (rightSequence (applyInstruction c i))) := by + rcases i with ⟨p, w, d⟩ + fin_cases d + · change tapeUpdate b (c.tape c.head) (c.tape (c.head - 1)) (p, w, 0) + (sequenceCode b K (leftSequence c)) (sequenceCode b K (rightSequence c)) = + (sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 0))), + sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 0)))) + have hA : sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 0))) = + (b : ℝ) * sequenceCode b K (leftSequence c) - (leftSequence c 0 : ℝ) := by + rw [show leftSequence (applyInstruction c (p, w, 0)) = + (fun j => leftSequence c (j + 1)) from funext (leftSequence_moveLeft c p w)] + exact sequenceCode_pop hb (by omega) hl + have hB : sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 0))) = + ((leftSequence c 0 : ℝ) + ((2 * w : ℝ) + + ((b : ℝ) * sequenceCode b K (rightSequence c) - rightSequence c 0)) / b) / b := by + rw [show K + 2 = (K + 1) + 1 by omega, sequenceCode_head, + rightSequence_moveLeft_zero, sequenceCode_head] + simp only [zero_add, Nat.add_assoc] + rw [rightSequence_moveLeft_one] + simp_rw [rightSequence_moveLeft_add_two] + rw [sequenceCode_pop hb (by omega) hr] + push_cast + rfl + rw [hA, hB] + simp [tapeUpdate, leftSequence, rightSequence] + · change tapeUpdate b (c.tape c.head) (c.tape (c.head - 1)) (p, w, 1) + (sequenceCode b K (leftSequence c)) (sequenceCode b K (rightSequence c)) = + (sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 1))), + sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 1)))) + have hA : sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 1))) = + sequenceCode b K (leftSequence c) := by + rw [funext (leftSequence_stay c p w)] + exact sequenceCode_widen hb (by omega) hl + have hB : sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 1))) = + ((2 * w : ℝ) + ((b : ℝ) * sequenceCode b K (rightSequence c) - rightSequence c 0)) / b := by + rw [show K + 2 = (K + 1) + 1 by omega, sequenceCode_head, rightSequence_stay_zero] + simp_rw [rightSequence_stay_succ] + rw [sequenceCode_pop hb (by omega) hr] + push_cast + rfl + rw [hA, hB] + simp [tapeUpdate, rightSequence] + · change tapeUpdate b (c.tape c.head) (c.tape (c.head - 1)) (p, w, 2) + (sequenceCode b K (leftSequence c)) (sequenceCode b K (rightSequence c)) = + (sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 2))), + sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 2)))) + have hA : sequenceCode b (K + 2) (leftSequence (applyInstruction c (p, w, 2))) = + ((2 * w : ℝ) + sequenceCode b K (leftSequence c)) / b := by + rw [show K + 2 = (K + 1) + 1 by omega, sequenceCode_head, leftSequence_moveRight_zero] + simp_rw [leftSequence_moveRight_succ] + rw [sequenceCode_widen hb (by omega) hl] + push_cast + rfl + have hB : sequenceCode b (K + 2) (rightSequence (applyInstruction c (p, w, 2))) = + (b : ℝ) * sequenceCode b K (rightSequence c) - rightSequence c 0 := by + rw [show rightSequence (applyInstruction c (p, w, 2)) = + (fun j => rightSequence c (j + 1)) from funext (rightSequence_moveRight c p w)] + exact sequenceCode_pop hb (by omega) hr + rw [hA, hB] + simp [tapeUpdate, rightSequence] + + +open scoped BigOperators + +theorem width_succ (N n : ℕ) : width N (n + 1) = width N n + 2 := by + dsimp [width] + omega + +@[simp] theorem actualBlock_leftCode_eq (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + (actualBlock I hI n).leftCode = + sequenceCode (alphabetBase I.1) (width I.2.length n) (leftSequence (configurationAt I n)) := rfl + +@[simp] theorem actualBlock_rightCode_eq (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + (actualBlock I hI n).rightCode = + sequenceCode (alphabetBase I.1) (width I.2.length n) (rightSequence (configurationAt I n)) := rfl + +theorem tapeUpdate_actual (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + let c := configurationAt I n + tapeUpdate (alphabetBase I.1) (c.tape c.head) (c.tape (c.head - 1)) + (I.1.normalizedInstruction c.state (c.tape c.head)) + (actualBlock I hI n).leftCode (actualBlock I hI n).rightCode = + ((actualBlock I hI (n + 1)).leftCode, (actualBlock I hI (n + 1)).rightCode) := by + have hb : 0 < alphabetBase I.1 := by have := alphabetBase_ge_four I.1; omega + have h := tapeUpdate_correct hb (configurationAt I n) + (I.1.normalizedInstruction (configurationAt I n).state + ((configurationAt I n).tape (configurationAt I n).head)) + (fun j hj => (actualSequences_vanish I n hj).1) + (fun j hj => (actualSequences_vanish I n hj).2) + rw [← I.1.step_eq_normalized, ← configurationAt_succ, ← width_succ] at h + exact h + +theorem branchCode_actual (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + let c := configurationAt I n + branchCode (alphabetBase I.1) (width I.2.length (n + 1)) + (c.tape c.head) (c.tape (c.head - 1)) + (I.1.normalizedInstruction c.state (c.tape c.head)) + (actualBlock I hI n).leftCode (actualBlock I hI n).rightCode = + (actualBlock I hI (n + 1)).code := by + have hb : 0 < alphabetBase I.1 := by have := alphabetBase_ge_four I.1; omega + dsimp only + rw [branchCode, tapeUpdate_actual, (actualBlock I hI (n + 1)).code_formula hb] + simp only [actualBlock, configurationAt_succ, Machine.step_eq_normalized, applyInstruction, + Nat.cast_mul, Nat.cast_ofNat] + +theorem sequenceCode_digit_cylinder {b K d : ℕ} (hb : 2 ≤ b) (hK : 0 < K) + {f : ℕ → ℕ} (hf : ∀ j < K, Even (f j) ∧ f j + 2 ≤ b) (hd : f 0 = 2 * d) : + (b : ℝ) * sequenceCode b K f ∈ Set.Icc (2 * (d : ℝ)) (2 * d + 1) := by + obtain ⟨L, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hK.ne' + have hb0 : (b : ℝ) ≠ 0 := by exact_mod_cast (by omega : b ≠ 0) + have hallowed : AllowedDigits b ((List.range L).map (fun j => f (j + 1))) := by + intro x hx + obtain ⟨j, hj, rfl⟩ := List.mem_map.1 hx + have hj' := List.mem_range.1 hj + exact hf _ (by omega) + have hrest0 := fraction_nonneg b ((List.range L).map (fun j => f (j + 1))) + have hrest1 := fraction_lt_one hb hallowed + change 0 ≤ sequenceCode b L (fun j => f (j + 1)) at hrest0 + change sequenceCode b L (fun j => f (j + 1)) < 1 at hrest1 + rw [sequenceCode_head, hd] + have he : (b : ℝ) * (((2 * d : ℕ) : ℝ) + sequenceCode b L (fun j => f (j + 1))) / b = + 2 * d + sequenceCode b L (fun j => f (j + 1)) := by + push_cast + field_simp + rw [← mul_div_assoc, he] + exact ⟨by linarith, by linarith⟩ + +theorem actualBlock_left_cylinder (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + let c := configurationAt I n + (alphabetBase I.1 : ℝ) * (actualBlock I hI n).leftCode ∈ + Set.Icc (2 * (c.tape (c.head - 1) : ℝ)) (2 * c.tape (c.head - 1) + 1) := by + apply sequenceCode_digit_cylinder (by have := alphabetBase_ge_four I.1; omega) + (by dsimp [width]; omega) + · intro j _ + exact symbol_digit_allowed ((configurationAt_valid hI n).2 _) + · simp + +theorem actualBlock_right_cylinder (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + let c := configurationAt I n + (alphabetBase I.1 : ℝ) * (actualBlock I hI n).rightCode ∈ + Set.Icc (2 * (c.tape c.head : ℝ)) (2 * c.tape c.head + 1) := by + apply sequenceCode_digit_cylinder (by have := alphabetBase_ge_four I.1; omega) + (by dsimp [width]; omega) + · intro j _ + exact symbol_digit_allowed ((configurationAt_valid hI n).2 _) + · simp + +theorem branchCode_nonleft {b K a e : ℕ} {i : Instruction} (hi : i.2.2 ≠ 0) (A B : ℝ) : + branchCode b K a e i A B = branchCode b K a 0 i A B := by + dsimp [branchCode, tapeUpdate] + split_ifs with h2 h1 + · rfl + · rfl + · have hd := i.2.2.isLt + have hne2 : i.2.2.val ≠ 2 := fun h => h2 (Fin.ext h) + have hne1 : i.2.2.val ≠ 1 := fun h => h1 (Fin.ext h) + have hne0 : i.2.2.val ≠ 0 := fun h => hi (Fin.ext h) + omega + +theorem localBranchCode_exact {M : Machine} {K q a ell : ℕ} (hell : ell < M.symbolCount) + {A B : ℝ} (hA : (alphabetBase M : ℝ) * A ∈ Set.Icc (2 * (ell : ℝ)) (2 * ell + 1)) : + localBranchCode M K q a A B = + branchCode (alphabetBase M) K a ell (M.normalizedInstruction q a) A B := by + dsimp only [localBranchCode] + split_ifs with hd + · exact selector_sum hell hA _ + · exact (branchCode_nonleft hd A B).symm + +theorem localWrite_at_cylinders {M : Machine} {N n q a ell : ℕ} {D : ℝ} + (hq : q ≤ M.stateCount) (ha : a < M.symbolCount) (hell : ell < M.symbolCount) + (hC : (alphabetBase M : ℝ) * readState (alphabetBase M) N n D ∈ + Set.Icc (2 * (q : ℝ)) (2 * q + 1)) + (hA : (alphabetBase M : ℝ) * readLeft (alphabetBase M) N n D ∈ + Set.Icc (2 * (ell : ℝ)) (2 * ell + 1)) + (hB : (alphabetBase M : ℝ) * readRight (alphabetBase M) N n D ∈ + Set.Icc (2 * (a : ℝ)) (2 * a + 1)) : + localWrite M N n D = epsilon (alphabetBase M) N (n + 1) * + branchCode (alphabetBase M) (width N (n + 1)) a ell (M.normalizedInstruction q a) + (readLeft (alphabetBase M) N n D) (readRight (alphabetBase M) N n D) := by + dsimp only [localWrite] + simp_rw [digitSelector_selects hC, digitSelector_selects hB] + have hq' : q < M.stateCount + 1 := by omega + simp only [ite_mul, one_mul, zero_mul, Finset.sum_ite_irrel, Finset.sum_const_zero, Finset.sum_ite_eq', Finset.mem_range, ite_eq_left ha, ite_eq_left hq'] + rw [localBranchCode_exact hell hA] + +theorem localWrite_exact (I : MachineInput) (hI : ValidInput I) (n : ℕ) : + localWrite I.1 I.2.length n (donor (alphabetBase I.1) I.2.length (actualBlock I hI) n) = + epsilon (alphabetBase I.1) I.2.length (n + 1) * (actualBlock I hI (n + 1)).code := by + let c := configurationAt I n + have hv := configurationAt_valid hI n + rcases actualBlock_read I hI n with ⟨hC, hB, hA⟩ + change readState (alphabetBase I.1) I.2.length n + (donor (alphabetBase I.1) I.2.length (actualBlock I hI) n) = (actualBlock I hI n).code at hC + change readLeft (alphabetBase I.1) I.2.length n + (donor (alphabetBase I.1) I.2.length (actualBlock I hI) n) = (actualBlock I hI n).leftCode at hA + change readRight (alphabetBase I.1) I.2.length n + (donor (alphabetBase I.1) I.2.length (actualBlock I hI) n) = (actualBlock I hI n).rightCode at hB + have hb : 2 ≤ alphabetBase I.1 := by have := alphabetBase_ge_four I.1; omega + rw [localWrite_at_cylinders hv.1 (hv.2 c.head) (hv.2 (c.head - 1)) + (by rw [hC]; exact (actualBlock I hI n).code_state_cylinder hb rfl) + (by rw [hA]; exact actualBlock_left_cylinder I hI n) + (by rw [hB]; exact actualBlock_right_cylinder I hI n), hA, hB, branchCode_actual] + +end Alternating.Memory + +end OAI